VTK
dox/Infovis/vtkSimple3DCirclesStrategy.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSimple3DCirclesStrategy.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00041 #ifndef vtkSimple3DCirclesStrategyH
00042 #define vtkSimple3DCirclesStrategyH 1
00043 
00044 #include "vtkGraphLayoutStrategy.h"
00045 
00046 class vtkDirectedGraph;
00047 class vtkIdTypeArray;
00048 class vtkIntArray;
00049 class vtkSimple3DCirclesStrategyInternal;
00050 
00051 class VTK_INFOVIS_EXPORT vtkSimple3DCirclesStrategy : public vtkGraphLayoutStrategy
00052   {
00053 public:
00054   static vtkSimple3DCirclesStrategy * New();
00055   vtkTypeMacro(vtkSimple3DCirclesStrategy,vtkGraphLayoutStrategy);
00056   void PrintSelf( ostream& os, vtkIndent indent );
00057 
00058 //BTX
00059   enum
00060     {
00061     FixedRadiusMethod = 0, FixedDistanceMethod = 1
00062     };
00063 //ETX
00065 
00068   vtkSetMacro(Method,int);
00069   vtkGetMacro(Method,int);
00070   // Description:
00071   // If Method is FixedRadiusMethod: Set or get the radius of the circles.
00072   // If Method is FixedDistanceMethod: Set or get the distance of the points in the circle.
00073   vtkSetMacro(Radius,double);
00074   vtkGetMacro(Radius,double);
00075   // Description:
00076   // Set or get the vertical (local z) distance between the circles. If AutoHeight is on, this is the minimal height between
00077   // the circle layers
00078   vtkSetMacro(Height,double);
00079   vtkGetMacro(Height,double);
00080   // Description:
00081   // Set or get the orign of the geometry. This is the center of the first circle. SetOrign(x,y,z)
00082   vtkSetVector3Macro(Orign,double);
00083   vtkGetVector3Macro(Orign,double);
00084   // Description:
00085   // Set or get the normal vector of the circles plain. The height is growing in this direction. The direction must not be zero vector.
00086   // The default vector is (0.0,0.0,1.0)
00087   virtual void SetDirection( double dx, double dy, double dz );
00088   virtual void SetDirection( double d[3] );
00089   vtkGetVector3Macro(Direction,double);
00090   // Description:
00091   // Set or get initial vertices. If MarkedStartVertices is added, loop is accepted in the graph. (If all of the loop start vertices are
00092   // marked in MarkedStartVertices array.) MarkedStartVertices size must be equal with the number of the vertices in the graph. Start
00093   // vertices must be marked by MarkedValue. (E.g.: if MarkedValue=3 and MarkedStartPoints is { 0, 3, 5, 3 }, the start points ids will
00094   // be {1,3}.) )
00095   virtual void SetMarkedStartVertices( vtkIntArray * _arg );
00096   vtkGetObjectMacro(MarkedStartVertices,vtkIntArray);
00097   // Description:
00098   // Set or get MarkedValue. See: MarkedStartVertices.
00099   vtkSetMacro(MarkedValue,int);
00100   vtkGetMacro(MarkedValue,int);
00101   // Description:
00102   // Set or get ForceToUseUniversalStartPointsFinder. If ForceToUseUniversalStartPointsFinder is true, MarkedStartVertices won't be used.
00103   // In this case the input graph must be vtkDirectedAcyclicGraph (Defualt: false).
00104   vtkSetMacro(ForceToUseUniversalStartPointsFinder,int);
00105   vtkGetMacro(ForceToUseUniversalStartPointsFinder,int);
00106   vtkBooleanMacro(ForceToUseUniversalStartPointsFinder,int);
00107   // Description:
00108   // Set or get auto height (Default: false). If AutoHeight is true, (r(i+1) - r(i-1))/Height will be smaller than tan(MinimumRadian).
00109   // If you want equal distances and parallel circles, you should turn off AutoHeight.
00110   vtkSetMacro(AutoHeight,int);
00111   vtkGetMacro(AutoHeight,int);
00112   vtkBooleanMacro(AutoHeight,int);
00113   // Description:
00114   // Set or get minimum radian (used by auto height).
00115   vtkSetMacro(MinimumRadian,double);
00116   vtkGetMacro(MinimumRadian,double);
00117   // Description:
00118   // Set or get minimum degree (used by auto height). There is no separated minimum degree, so minimum radian will be changed.
00119   virtual void SetMinimumDegree( double degree );
00120   virtual double GetMinimumDegree( void );
00121   // Description:
00122   // 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
00123   // layer id is -2.) If no HierarchicalLayers array is defined, vtkSimple3DCirclesStrategy will generate it automatically (default).
00124   virtual void SetHierarchicalLayers( vtkIntArray * _arg );
00125   vtkGetObjectMacro(HierarchicalLayers,vtkIntArray);
00126   // Description:
00127   // 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!)
00128   // If no HierarchicalOrder is defined, vtkSimple3DCirclesStrategy will generate it automatically (default).
00129   virtual void SetHierarchicalOrder( vtkIdTypeArray * _arg );
00130   vtkGetObjectMacro(HierarchicalOrder,vtkIdTypeArray);
00131   // Description:
00132   // Standard layout method
00133   virtual void Layout( void );
00134   // Description:
00135   // Set graph (warning: HierarchicalOrder and HierarchicalLayers will set to zero. These reference counts will be decreased!)
00136   virtual void SetGraph( vtkGraph * graph );
00138 protected:
00139 //BTX
00140   vtkSimple3DCirclesStrategy( void );
00141   virtual ~vtkSimple3DCirclesStrategy( void );
00142 
00143   inline void Transform( double Local[], double Global[] );
00144 
00145   double Radius;
00146   double Height;
00147   double Orign[3];
00148   double Direction[3];
00149   int Method;
00150   vtkIntArray * MarkedStartVertices;
00151   int MarkedValue;
00152   int ForceToUseUniversalStartPointsFinder;
00153   int AutoHeight;
00154   double MinimumRadian;
00155 
00156   vtkIntArray * HierarchicalLayers;
00157   vtkIdTypeArray * HierarchicalOrder;
00158 //ETX
00159 private:
00160 //BTX
00162 
00165   virtual int UniversalStartPoints( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal * target, vtkSimple3DCirclesStrategyInternal *StandAlones, vtkIntArray * layers );
00166   // Description:
00167   // Build hierarchical layers in the graph. A vertices hierarchical layer number is equal the maximum of its inputs hierarchical layer numbers plus one.
00168   virtual int BuildLayers( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal * source, vtkIntArray * layers );
00169   // Description:
00170   // Build hierarchical ordering of the graph points.
00171   virtual void BuildPointOrder( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal *source, vtkSimple3DCirclesStrategyInternal *StandAlones, vtkIntArray * layers, vtkIdTypeArray * order );
00173 
00174   double T[3][3];
00175 //ETX
00176 
00177   vtkSimple3DCirclesStrategy(const vtkSimple3DCirclesStrategy&);  // Not implemented.
00178   void operator=(const vtkSimple3DCirclesStrategy&);  // Not implemented.
00179   };
00180 
00181 #endif