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 #include "vtkVariant.h" // For variant API
00046 
00047 class vtkAbstractArray;
00048 class vtkDirectedGraph;
00049 class vtkIdTypeArray;
00050 class vtkIntArray;
00051 class vtkSimple3DCirclesStrategyInternal;
00052 
00053 class VTK_INFOVIS_EXPORT vtkSimple3DCirclesStrategy : public vtkGraphLayoutStrategy
00054   {
00055 public:
00056   static vtkSimple3DCirclesStrategy * New();
00057   vtkTypeMacro(vtkSimple3DCirclesStrategy,vtkGraphLayoutStrategy);
00058   void PrintSelf( ostream& os, vtkIndent indent );
00059 
00060 //BTX
00061   enum
00062     {
00063     FixedRadiusMethod = 0, FixedDistanceMethod = 1
00064     };
00065 //ETX
00067 
00070   vtkSetMacro(Method,int);
00071   vtkGetMacro(Method,int);
00072   // Description:
00073   // If Method is FixedRadiusMethod: Set or get the radius of the circles.
00074   // If Method is FixedDistanceMethod: Set or get the distance of the points in the circle.
00075   vtkSetMacro(Radius,double);
00076   vtkGetMacro(Radius,double);
00077   // Description:
00078   // Set or get the vertical (local z) distance between the circles. If AutoHeight is on, this is the minimal height between
00079   // the circle layers
00080   vtkSetMacro(Height,double);
00081   vtkGetMacro(Height,double);
00082   // Description:
00083   // Set or get the origin of the geometry. This is the center of the first circle. SetOrigin(x,y,z)
00084   vtkSetVector3Macro(Origin,double);
00085   vtkGetVector3Macro(Origin,double);
00086   // Description:
00087   // Set or get the normal vector of the circles plain. The height is growing in this direction. The direction must not be zero vector.
00088   // The default vector is (0.0,0.0,1.0)
00089   virtual void SetDirection( double dx, double dy, double dz );
00090   virtual void SetDirection( double d[3] );
00091   vtkGetVector3Macro(Direction,double);
00092   // Description:
00093   // Set or get initial vertices. If MarkedStartVertices is added, loop is accepted in the graph. (If all of the loop start vertices are
00094   // marked in MarkedStartVertices array.) MarkedStartVertices size must be equal with the number of the vertices in the graph. Start
00095   // vertices must be marked by MarkedValue. (E.g.: if MarkedValue=3 and MarkedStartPoints is { 0, 3, 5, 3 }, the start points ids will
00096   // be {1,3}.) )
00097   virtual void SetMarkedStartVertices( vtkAbstractArray * _arg );
00098   vtkGetObjectMacro(MarkedStartVertices,vtkAbstractArray);
00099   // Description:
00100   // Set or get MarkedValue. See: MarkedStartVertices.
00101   virtual void SetMarkedValue( vtkVariant _arg );
00102   virtual vtkVariant GetMarkedValue( void );
00103   // Description:
00104   // Set or get ForceToUseUniversalStartPointsFinder. If ForceToUseUniversalStartPointsFinder is true, MarkedStartVertices won't be used.
00105   // In this case the input graph must be vtkDirectedAcyclicGraph (Defualt: false).
00106   vtkSetMacro(ForceToUseUniversalStartPointsFinder,int);
00107   vtkGetMacro(ForceToUseUniversalStartPointsFinder,int);
00108   vtkBooleanMacro(ForceToUseUniversalStartPointsFinder,int);
00109   // Description:
00110   // Set or get auto height (Default: false). If AutoHeight is true, (r(i+1) - r(i-1))/Height will be smaller than tan(MinimumRadian).
00111   // If you want equal distances and parallel circles, you should turn off AutoHeight.
00112   vtkSetMacro(AutoHeight,int);
00113   vtkGetMacro(AutoHeight,int);
00114   vtkBooleanMacro(AutoHeight,int);
00115   // Description:
00116   // Set or get minimum radian (used by auto height).
00117   vtkSetMacro(MinimumRadian,double);
00118   vtkGetMacro(MinimumRadian,double);
00119   // Description:
00120   // Set or get minimum degree (used by auto height). There is no separated minimum degree, so minimum radian will be changed.
00121   virtual void SetMinimumDegree( double degree );
00122   virtual double GetMinimumDegree( void );
00123   // Description:
00124   // 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
00125   // layer id is -2.) If no HierarchicalLayers array is defined, vtkSimple3DCirclesStrategy will generate it automatically (default).
00126   virtual void SetHierarchicalLayers( vtkIntArray * _arg );
00127   vtkGetObjectMacro(HierarchicalLayers,vtkIntArray);
00128   // Description:
00129   // 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!)
00130   // If no HierarchicalOrder is defined, vtkSimple3DCirclesStrategy will generate it automatically (default).
00131   virtual void SetHierarchicalOrder( vtkIdTypeArray * _arg );
00132   vtkGetObjectMacro(HierarchicalOrder,vtkIdTypeArray);
00133   // Description:
00134   // Standard layout method
00135   virtual void Layout( void );
00136   // Description:
00137   // Set graph (warning: HierarchicalOrder and HierarchicalLayers will set to zero. These reference counts will be decreased!)
00138   virtual void SetGraph( vtkGraph * graph );
00139 protected:
00140 //BTX
00141   vtkSimple3DCirclesStrategy( void );
00142   virtual ~vtkSimple3DCirclesStrategy( void );
00144 
00145   inline void Transform( double Local[], double Global[] );
00146 
00147   double Radius;
00148   double Height;
00149   double Origin[3];
00150   double Direction[3];
00151   int Method;
00152   vtkAbstractArray * MarkedStartVertices;
00153   vtkVariant MarkedValue;
00154   int ForceToUseUniversalStartPointsFinder;
00155   int AutoHeight;
00156   double MinimumRadian;
00157 
00158   vtkIntArray * HierarchicalLayers;
00159   vtkIdTypeArray * HierarchicalOrder;
00160 //ETX
00161 private:
00162 //BTX
00164 
00167   virtual int UniversalStartPoints( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal * target, vtkSimple3DCirclesStrategyInternal *StandAlones, vtkIntArray * layers );
00168   // Description:
00169   // Build hierarchical layers in the graph. A vertices hierarchical layer number is equal the maximum of its inputs hierarchical layer numbers plus one.
00170   virtual int BuildLayers( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal * source, vtkIntArray * layers );
00171   // Description:
00172   // Build hierarchical ordering of the graph points.
00173   virtual void BuildPointOrder( vtkDirectedGraph * input, vtkSimple3DCirclesStrategyInternal *source, vtkSimple3DCirclesStrategyInternal *StandAlones, vtkIntArray * layers, vtkIdTypeArray * order );
00175 
00176   double T[3][3];
00177 //ETX
00178 
00179   vtkSimple3DCirclesStrategy(const vtkSimple3DCirclesStrategy&);  // Not implemented.
00180   void operator=(const vtkSimple3DCirclesStrategy&);  // Not implemented.
00181   };
00182 
00183 #endif