license changed to LGPL for libnxcl, libnxsnmp, libnxlp, libnxsl, and libnxmap
[public/netxms.git] / src / libnxmap / libnxmap.h
1 /*
2 ** NetXMS - Network Management System
3 ** Network Map Library
4 ** Copyright (C) 2003-2010 Victor Kirhenshtein
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU Lesser General Public License as published by
8 ** the Free Software Foundation; either version 3 of the License, or
9 ** (at your option) any later version.
10 **
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
15 **
16 ** You should have received a copy of the GNU Lesser General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 **
20 ** File: libnxmap.h
21 **
22 **/
23
24 #ifndef _libnxmap_h_
25 #define _libnxmap_h_
26
27 #include <nms_common.h>
28 #include <nms_util.h>
29 #include <nms_threads.h>
30 #include <nxcpapi.h>
31 #include <netxms_maps.h>
32
33
34 //
35 // Generic layout engine
36 //
37
38 class nxleGeneric
39 {
40 protected:
41 nxmap_Graph *m_graph;
42
43 public:
44 nxleGeneric(nxmap_Graph *pGraph) { m_graph = pGraph; }
45 virtual ~nxleGeneric() { }
46
47 virtual void Execute(void) { }
48 };
49
50
51 //
52 // Radial layout engine
53 //
54
55 class nxleRadial : public nxleGeneric
56 {
57 protected:
58 double *m_width;
59 double *m_fullWidth;
60 double *m_angle;
61 double *m_distance;
62 double m_delta;
63 double m_increase;
64 BOOL m_bConvexity;
65
66 double SetWidth(nxmap_Vertex *root);
67 void SetPlacement(nxmap_Vertex *root, double ro,
68 double alpha1, double alpha2, int layer);
69
70 public:
71 nxleRadial(nxmap_Graph *pGraph);
72 virtual ~nxleRadial();
73
74 virtual void Execute(void);
75 };
76
77
78 //
79 // Reingold Tilford layout engine
80 //
81
82 class nxleReingoldTilford : public nxleGeneric
83 {
84 protected:
85 double *m_xPreliminary;
86 double *m_xModifier;
87 double *m_xParentModifier;
88 int *m_passCount;
89 nxmap_Vertex **m_leftBrother;
90 DWORD *m_layer;
91 nxmap_Vertex **m_contour;
92 double m_spacing;
93
94 void Initialize(nxmap_Vertex *root, DWORD layer);
95 double TrueX(nxmap_Vertex *root);
96 void FirstPass(nxmap_Vertex *root);
97 void SecondPass(nxmap_Vertex *root, double modifier);
98
99 public:
100 nxleReingoldTilford(nxmap_Graph *pGraph);
101 virtual ~nxleReingoldTilford();
102
103 virtual void Execute(void);
104 };
105
106 #endif /* _libnxmap_h_ */