00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00044 #ifndef __vtkGraphLayoutView_h
00045 #define __vtkGraphLayoutView_h
00046
00047 #include "vtkSmartPointer.h"
00048 #include "vtkRenderView.h"
00049
00050 class vtkActor;
00051 class vtkActor2D;
00052 class vtkArcParallelEdgeStrategy;
00053 class vtkCircularLayoutStrategy;
00054 class vtkClustering2DLayoutStrategy;
00055 class vtkCoordinate;
00056 class vtkCommunity2DLayoutStrategy;
00057 class vtkConstrained2DLayoutStrategy;
00058 class vtkDynamic2DLabelMapper;
00059 class vtkEdgeCenters;
00060 class vtkEdgeLayout;
00061 class vtkEdgeLayoutStrategy;
00062 class vtkExtractSelectedGraph;
00063 class vtkFast2DLayoutStrategy;
00064 class vtkForceDirectedLayoutStrategy;
00065 class vtkGraphLayout;
00066 class vtkGraphLayoutStrategy;
00067 class vtkGraphMapper;
00068 class vtkGraphToPolyData;
00069 class vtkKdTreeSelector;
00070 class vtkLookupTable;
00071 class vtkPassThroughEdgeStrategy;
00072 class vtkPassThroughLayoutStrategy;
00073 class vtkPerturbCoincidentVertices;
00074 class vtkPolyDataMapper;
00075 class vtkRandomLayoutStrategy;
00076 class vtkScalarBarWidget;
00077 class vtkSelectionLink;
00078 class vtkSimple2DLayoutStrategy;
00079 class vtkTexture;
00080 class vtkVertexDegree;
00081 class vtkVertexGlyphFilter;
00082 class vtkViewTheme;
00083 class vtkHardwareSelector;
00084
00085
00086
00087 class VTK_VIEWS_EXPORT vtkGraphLayoutView : public vtkRenderView
00088 {
00089 public:
00090 static vtkGraphLayoutView *New();
00091 vtkTypeRevisionMacro(vtkGraphLayoutView, vtkRenderView);
00092 void PrintSelf(ostream& os, vtkIndent indent);
00093
00095
00096 void SetVertexLabelArrayName(const char* name);
00097 const char* GetVertexLabelArrayName();
00099
00101
00102 void SetEdgeLabelArrayName(const char* name);
00103 const char* GetEdgeLabelArrayName();
00105
00107
00108 void SetVertexLabelVisibility(bool vis);
00109 bool GetVertexLabelVisibility();
00110 void VertexLabelVisibilityOn();
00111 void VertexLabelVisibilityOff();
00113
00115
00116 void SetEdgeLabelVisibility(bool vis);
00117 bool GetEdgeLabelVisibility();
00118 void EdgeLabelVisibilityOn();
00119 void EdgeLabelVisibilityOff();
00121
00123
00124 void SetVertexColorArrayName(const char* name);
00125 const char* GetVertexColorArrayName();
00127
00129
00130 void SetColorVertices(bool vis);
00131 bool GetColorVertices();
00132 void ColorVerticesOn();
00133 void ColorVerticesOff();
00135
00137
00138 void SetEdgeColorArrayName(const char* name);
00139 const char* GetEdgeColorArrayName();
00141
00143
00144 void SetColorEdges(bool vis);
00145 bool GetColorEdges();
00146 void ColorEdgesOn();
00147 void ColorEdgesOff();
00149
00151
00152 void SetEnabledEdgesArrayName(const char* name);
00153 const char* GetEnabledEdgesArrayName();
00155
00157
00158 void SetEnableEdgesByArray(bool vis);
00159 int GetEnableEdgesByArray();
00161
00163
00164 void SetEnabledVerticesArrayName(const char* name);
00165 const char* GetEnabledVerticesArrayName();
00167
00169
00170 void SetEnableVerticesByArray(bool vis);
00171 int GetEnableVerticesByArray();
00173
00175
00176 void SetScalingArrayName(const char* name);
00177 const char* GetScalingArrayName();
00179
00181
00182 void SetScaledGlyphs(bool arg);
00183 bool GetScaledGlyphs();
00184 vtkBooleanMacro(ScaledGlyphs, bool);
00186
00188
00199 void SetLayoutStrategy(const char* name);
00200 void SetLayoutStrategyToRandom()
00201 { this->SetLayoutStrategy("Random"); }
00202 void SetLayoutStrategyToForceDirected()
00203 { this->SetLayoutStrategy("Force Directed"); }
00204 void SetLayoutStrategyToSimple2D()
00205 { this->SetLayoutStrategy("Simple 2D"); }
00206 void SetLayoutStrategyToClustering2D()
00207 { this->SetLayoutStrategy("Clustering 2D"); }
00208 void SetLayoutStrategyToCommunity2D()
00209 { this->SetLayoutStrategy("Community 2D"); }
00210 void SetLayoutStrategyToFast2D()
00211 { this->SetLayoutStrategy("Fast 2D"); }
00212 void SetLayoutStrategyToPassThrough()
00213 { this->SetLayoutStrategy("Pass Through"); }
00214 void SetLayoutStrategyToCircular()
00215 { this->SetLayoutStrategy("Circular"); }
00216 const char* GetLayoutStrategyName()
00217 { return this->GetLayoutStrategyNameInternal(); }
00219
00221
00224 vtkGetObjectMacro(LayoutStrategy,vtkGraphLayoutStrategy);
00225 void SetLayoutStrategy(vtkGraphLayoutStrategy *s);
00227
00229
00233 void SetEdgeLayoutStrategy(const char* name);
00234 void SetEdgeLayoutStrategyToArcParallel()
00235 { this->SetEdgeLayoutStrategy("Arc Parallel"); }
00236 void SetEdgeLayoutStrategyToPassThrough()
00237 { this->SetEdgeLayoutStrategy("Pass Through"); }
00238 const char* GetEdgeLayoutStrategyName()
00239 { return this->GetEdgeLayoutStrategyNameInternal(); }
00241
00243
00246 vtkGetObjectMacro(EdgeLayoutStrategy,vtkEdgeLayoutStrategy);
00247 void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy *s);
00249
00254 void SetIterationsPerLayout(int iterations);
00255
00257 void SetIconTexture(vtkTexture *texture);
00258
00262 void AddIconType(char *type, int index);
00263
00265 void ClearIconTypes();
00266
00268 void SetIconSize(int *size);
00269
00272 void SetIconAlignment(int alignment);
00273
00275
00276 void SetIconVisibility(bool b);
00277 bool GetIconVisibility();
00278 vtkBooleanMacro(IconVisibility, bool);
00280
00282
00283 void SetIconArrayName(const char* name);
00284 const char* GetIconArrayName();
00286
00288 virtual void SetupRenderWindow(vtkRenderWindow* win);
00289
00291 virtual void ApplyViewTheme(vtkViewTheme* theme);
00292
00294
00295 virtual void SetVertexLabelFontSize(const int size);
00296 virtual int GetVertexLabelFontSize();
00298
00300
00301 virtual void SetEdgeLabelFontSize(const int size);
00302 virtual int GetEdgeLabelFontSize();
00304
00306 void SetEdgeScalarBarVisibility(bool vis);
00307
00309 void SetVertexScalarBarVisibility(bool vis);
00310
00314 virtual int IsLayoutComplete();
00315
00320 virtual void UpdateLayout();
00321
00322 protected:
00323 vtkGraphLayoutView();
00324 ~vtkGraphLayoutView();
00325
00327
00328 virtual void ProcessEvents(vtkObject* caller, unsigned long eventId,
00329 void* callData);
00331
00333
00335 virtual void AddInputConnection( int port, int item,
00336 vtkAlgorithmOutput* conn,
00337 vtkAlgorithmOutput* selectionConn);
00339
00341
00342 virtual void RemoveInputConnection( int port, int item,
00343 vtkAlgorithmOutput* conn,
00344 vtkAlgorithmOutput* selectionConn);
00346
00348 virtual void PrepareForRendering();
00349
00351 void MapToXYPlane(double displayX, double displayY, double &x, double &y);
00352
00354
00355 vtkGetStringMacro(LayoutStrategyNameInternal);
00356 vtkSetStringMacro(LayoutStrategyNameInternal);
00357 char* LayoutStrategyNameInternal;
00359
00361 vtkGraphLayoutStrategy* LayoutStrategy;
00362
00364
00365 vtkGetStringMacro(EdgeLayoutStrategyNameInternal);
00366 vtkSetStringMacro(EdgeLayoutStrategyNameInternal);
00367 char* EdgeLayoutStrategyNameInternal;
00369
00371 vtkEdgeLayoutStrategy* EdgeLayoutStrategy;
00372
00376 vtkEdgeLayoutStrategy* EdgeLayoutPreference;
00377
00379
00380 vtkGetStringMacro(IconArrayNameInternal);
00381 vtkSetStringMacro(IconArrayNameInternal);
00382 char* IconArrayNameInternal;
00384
00385
00386
00387 vtkSmartPointer<vtkCoordinate> Coordinate;
00388
00389
00390 vtkSmartPointer<vtkGraphLayout> GraphLayout;
00391 vtkSmartPointer<vtkRandomLayoutStrategy> RandomStrategy;
00392 vtkSmartPointer<vtkForceDirectedLayoutStrategy> ForceDirectedStrategy;
00393 vtkSmartPointer<vtkSimple2DLayoutStrategy> Simple2DStrategy;
00394 vtkSmartPointer<vtkClustering2DLayoutStrategy> Clustering2DStrategy;
00395 vtkSmartPointer<vtkCommunity2DLayoutStrategy> Community2DStrategy;
00396 vtkSmartPointer<vtkConstrained2DLayoutStrategy> Constrained2DStrategy;
00397 vtkSmartPointer<vtkFast2DLayoutStrategy> Fast2DStrategy;
00398 vtkSmartPointer<vtkPassThroughLayoutStrategy> PassThroughStrategy;
00399 vtkSmartPointer<vtkCircularLayoutStrategy> CircularStrategy;
00400 vtkSmartPointer<vtkEdgeLayout> EdgeLayout;
00401 vtkSmartPointer<vtkArcParallelEdgeStrategy> ArcParallelStrategy;
00402 vtkSmartPointer<vtkPassThroughEdgeStrategy> PassThroughEdgeStrategy;
00403 vtkSmartPointer<vtkPerturbCoincidentVertices> PerturbCoincidentVertices;
00404 vtkSmartPointer<vtkVertexDegree> VertexDegree;
00405 vtkSmartPointer<vtkEdgeCenters> EdgeCenters;
00406 vtkSmartPointer<vtkActor> GraphActor;
00407 vtkSmartPointer<vtkGraphMapper> GraphMapper;
00408 vtkSmartPointer<vtkDynamic2DLabelMapper> VertexLabelMapper;
00409 vtkSmartPointer<vtkActor2D> VertexLabelActor;
00410 vtkSmartPointer<vtkDynamic2DLabelMapper> EdgeLabelMapper;
00411 vtkSmartPointer<vtkActor2D> EdgeLabelActor;
00412 vtkSmartPointer<vtkScalarBarWidget> VertexScalarBar;
00413 vtkSmartPointer<vtkScalarBarWidget> EdgeScalarBar;
00414
00415
00416 vtkSmartPointer<vtkKdTreeSelector> KdTreeSelector;
00417 vtkSmartPointer<vtkHardwareSelector> HardwareSelector;
00418 vtkSmartPointer<vtkExtractSelectedGraph> ExtractSelectedGraph;
00419 vtkSmartPointer<vtkActor> SelectedGraphActor;
00420 vtkSmartPointer<vtkGraphMapper> SelectedGraphMapper;
00421
00422
00423 vtkSmartPointer<vtkGraphToPolyData> EdgeSelectionPoly;
00424 vtkSmartPointer<vtkPolyDataMapper> EdgeSelectionMapper;
00425 vtkSmartPointer<vtkActor> EdgeSelectionActor;
00426
00427
00428 private:
00429 vtkGraphLayoutView(const vtkGraphLayoutView&);
00430 void operator=(const vtkGraphLayoutView&);
00431 };
00432
00433 #endif