VTK
vtkSimple3DCirclesStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSimple3DCirclesStrategy.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
41 #ifndef vtkSimple3DCirclesStrategyH
42 #define vtkSimple3DCirclesStrategyH 1
43 
44 #include "vtkGraphLayoutStrategy.h"
45 #include "vtkVariant.h" // For variant API
46 
47 class vtkAbstractArray;
48 class vtkDirectedGraph;
49 class vtkIdTypeArray;
50 class vtkIntArray;
51 class vtkSimple3DCirclesStrategyInternal;
52 
54  {
55 public:
58  void PrintSelf( ostream& os, vtkIndent indent );
59 
60 //BTX
61  enum
62  {
63  FixedRadiusMethod = 0, FixedDistanceMethod = 1
64  };
65 //ETX
67 
70  vtkSetMacro(Method,int);
71  vtkGetMacro(Method,int);
72  // Description:
73  // If Method is FixedRadiusMethod: Set or get the radius of the circles.
74  // If Method is FixedDistanceMethod: Set or get the distance of the points in the circle.
75  vtkSetMacro(Radius,double);
76  vtkGetMacro(Radius,double);
77  // Description:
78  // Set or get the vertical (local z) distance between the circles. If AutoHeight is on, this is the minimal height between
79  // the circle layers
80  vtkSetMacro(Height,double);
81  vtkGetMacro(Height,double);
82  // Description:
83  // Set or get the origin of the geometry. This is the center of the first circle. SetOrigin(x,y,z)
84  vtkSetVector3Macro(Origin,double);
85  vtkGetVector3Macro(Origin,double);
86  // Description:
87  // Set or get the normal vector of the circles plain. The height is growing in this direction. The direction must not be zero vector.
88  // The default vector is (0.0,0.0,1.0)
89  virtual void SetDirection( double dx, double dy, double dz );
90  virtual void SetDirection( double d[3] );
91  vtkGetVector3Macro(Direction,double);
92  // Description:
93  // Set or get initial vertices. If MarkedStartVertices is added, loop is accepted in the graph. (If all of the loop start vertices are
94  // marked in MarkedStartVertices array.) MarkedStartVertices size must be equal with the number of the vertices in the graph. Start
95  // vertices must be marked by MarkedValue. (E.g.: if MarkedValue=3 and MarkedStartPoints is { 0, 3, 5, 3 }, the start points ids will
96  // be {1,3}.) )
97  virtual void SetMarkedStartVertices( vtkAbstractArray * _arg );
98  vtkGetObjectMacro(MarkedStartVertices,vtkAbstractArray);
99  // Description:
100  // Set or get MarkedValue. See: MarkedStartVertices.
101  virtual void SetMarkedValue( vtkVariant _arg );
102  virtual vtkVariant GetMarkedValue( void );
103  // Description:
104  // Set or get ForceToUseUniversalStartPointsFinder. If ForceToUseUniversalStartPointsFinder is true, MarkedStartVertices won't be used.
105  // In this case the input graph must be vtkDirectedAcyclicGraph (Defualt: false).
106  vtkSetMacro(ForceToUseUniversalStartPointsFinder,int);
107  vtkGetMacro(ForceToUseUniversalStartPointsFinder,int);
108  vtkBooleanMacro(ForceToUseUniversalStartPointsFinder,int);
109  // Description:
110  // Set or get auto height (Default: false). If AutoHeight is true, (r(i+1) - r(i-1))/Height will be smaller than tan(MinimumRadian).
111  // If you want equal distances and parallel circles, you should turn off AutoHeight.
112  vtkSetMacro(AutoHeight,int);
113  vtkGetMacro(AutoHeight,int);
114  vtkBooleanMacro(AutoHeight,int);
115  // Description:
116  // Set or get minimum radian (used by auto height).
117  vtkSetMacro(MinimumRadian,double);
118  vtkGetMacro(MinimumRadian,double);
119  // Description:
120  // Set or get minimum degree (used by auto height). There is no separated minimum degree, so minimum radian will be changed.
121  virtual void SetMinimumDegree( double degree );
122  virtual double GetMinimumDegree( void );
123  // Description:
124  // Set or get hierarchical layers id by vertices (An usual vertex's layer id is greater or equal to zero. If a vertex is standalone, its
125  // layer id is -2.) If no HierarchicalLayers array is defined, vtkSimple3DCirclesStrategy will generate it automatically (default).
126  virtual void SetHierarchicalLayers( vtkIntArray * _arg );
127  vtkGetObjectMacro(HierarchicalLayers,vtkIntArray);
128  // Description:
129  // Set or get hierarchical ordering of vertices (The array starts from the first vertex's id. All id must be greater or equal to zero!)
130  // If no HierarchicalOrder is defined, vtkSimple3DCirclesStrategy will generate it automatically (default).
131  virtual void SetHierarchicalOrder( vtkIdTypeArray * _arg );
132  vtkGetObjectMacro(HierarchicalOrder,vtkIdTypeArray);
133  // Description:
134  // Standard layout method
135  virtual void Layout( void );
136  // Description:
137  // Set graph (warning: HierarchicalOrder and HierarchicalLayers will set to zero. These reference counts will be decreased!)
138  virtual void SetGraph( vtkGraph * graph );
139 protected:
140 //BTX
142  virtual ~vtkSimple3DCirclesStrategy( void );
144 
145  inline void Transform( double Local[], double Global[] );
146 
147  double Radius;
148  double Height;
149  double Origin[3];
150  double Direction[3];
151  int Method;
157 
160 //ETX
161 private:
162 //BTX
164 
167  virtual int UniversalStartPoints( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal * target, vtkSimple3DCirclesStrategyInternal *StandAlones, vtkIntArray * layers );
168  // Description:
169  // Build hierarchical layers in the graph. A vertices hierarchical layer number is equal the maximum of its inputs hierarchical layer numbers plus one.
170  virtual int BuildLayers( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal * source, vtkIntArray * layers );
171  // Description:
172  // Build hierarchical ordering of the graph points.
173  virtual void BuildPointOrder( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal *source, vtkSimple3DCirclesStrategyInternal *StandAlones, vtkIntArray * layers, vtkIdTypeArray * order );
175 
176  double T[3][3];
177 //ETX
178 
179  vtkSimple3DCirclesStrategy(const vtkSimple3DCirclesStrategy&); // Not implemented.
180  void operator=(const vtkSimple3DCirclesStrategy&); // Not implemented.
181  };
182 
183 #endif