00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00028 #ifndef __vtkRenderedGraphRepresentation_h
00029 #define __vtkRenderedGraphRepresentation_h
00030
00031 #include "vtkRenderedRepresentation.h"
00032 #include "vtkSmartPointer.h"
00033
00034 class vtkActor;
00035 class vtkApplyColors;
00036 class vtkApplyIcons;
00037 class vtkEdgeCenters;
00038 class vtkEdgeLayout;
00039 class vtkEdgeLayoutStrategy;
00040 class vtkGraphLayout;
00041 class vtkGraphLayoutStrategy;
00042 class vtkGraphToGlyphs;
00043 class vtkGraphToPoints;
00044 class vtkGraphToPolyData;
00045 class vtkIconGlyphFilter;
00046 class vtkInformation;
00047 class vtkInformationVector;
00048 class vtkLookupTable;
00049 class vtkPerturbCoincidentVertices;
00050 class vtkPointSetToLabelHierarchy;
00051 class vtkPolyData;
00052 class vtkPolyDataMapper;
00053 class vtkPolyDataMapper2D;
00054 class vtkRemoveHiddenData;
00055 class vtkRenderView;
00056 class vtkScalarBarWidget;
00057 class vtkScalarsToColors;
00058 class vtkTextProperty;
00059 class vtkTexturedActor2D;
00060 class vtkTransformCoordinateSystems;
00061 class vtkVertexDegree;
00062 class vtkView;
00063 class vtkViewTheme;
00064
00065 class VTK_VIEWS_EXPORT vtkRenderedGraphRepresentation : public vtkRenderedRepresentation
00066 {
00067 public:
00068 static vtkRenderedGraphRepresentation* New();
00069 vtkTypeRevisionMacro(vtkRenderedGraphRepresentation, vtkRenderedRepresentation);
00070 void PrintSelf(ostream& os, vtkIndent indent);
00071
00072
00073
00074
00075 virtual void SetVertexLabelArrayName(const char* name);
00076 virtual const char* GetVertexLabelArrayName();
00077 virtual void SetVertexLabelPriorityArrayName(const char* name);
00078 virtual const char* GetVertexLabelPriorityArrayName();
00079 virtual void SetVertexLabelVisibility(bool b);
00080 virtual bool GetVertexLabelVisibility();
00081 vtkBooleanMacro(VertexLabelVisibility, bool);
00082 virtual void SetVertexLabelTextProperty(vtkTextProperty* p);
00083 virtual vtkTextProperty* GetVertexLabelTextProperty();
00084 vtkSetStringMacro(VertexHoverArrayName);
00085 vtkGetStringMacro(VertexHoverArrayName);
00087
00089 vtkSetMacro(HideVertexLabelsOnInteraction, bool)
00090 vtkGetMacro(HideVertexLabelsOnInteraction, bool)
00091 vtkBooleanMacro(HideVertexLabelsOnInteraction, bool)
00093
00094
00095
00096
00097 virtual void SetEdgeLabelArrayName(const char* name);
00098 virtual const char* GetEdgeLabelArrayName();
00099 virtual void SetEdgeLabelPriorityArrayName(const char* name);
00100 virtual const char* GetEdgeLabelPriorityArrayName();
00101 virtual void SetEdgeLabelVisibility(bool b);
00102 virtual bool GetEdgeLabelVisibility();
00103 vtkBooleanMacro(EdgeLabelVisibility, bool);
00104 virtual void SetEdgeLabelTextProperty(vtkTextProperty* p);
00105 virtual vtkTextProperty* GetEdgeLabelTextProperty();
00106 vtkSetStringMacro(EdgeHoverArrayName);
00107 vtkGetStringMacro(EdgeHoverArrayName);
00109
00111 vtkSetMacro(HideEdgeLabelsOnInteraction, bool)
00112 vtkGetMacro(HideEdgeLabelsOnInteraction, bool)
00113 vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool)
00115
00116
00117
00118
00119 virtual void SetVertexIconArrayName(const char* name);
00120 virtual const char* GetVertexIconArrayName();
00121 virtual void SetVertexIconPriorityArrayName(const char* name);
00122 virtual const char* GetVertexIconPriorityArrayName();
00123 virtual void SetVertexIconVisibility(bool b);
00124 virtual bool GetVertexIconVisibility();
00125 vtkBooleanMacro(VertexIconVisibility, bool);
00126 virtual void AddVertexIconType(const char* name, int type);
00127 virtual void ClearVertexIconTypes();
00128 virtual void SetUseVertexIconTypeMap(bool b);
00129 virtual bool GetUseVertexIconTypeMap();
00130 vtkBooleanMacro(UseVertexIconTypeMap, bool);
00131 virtual void SetVertexIconAlignment(int align);
00132 virtual int GetVertexIconAlignment();
00133 virtual void SetVertexSelectedIcon(int icon);
00134 virtual int GetVertexSelectedIcon();
00135
00137
00142 virtual void SetVertexIconSelectionMode(int mode);
00143 virtual int GetVertexIconSelectionMode();
00144 virtual void SetVertexIconSelectionModeToSelectedIcon()
00145 { this->SetVertexIconSelectionMode(0); }
00146 virtual void SetVertexIconSelectionModeToSelectedOffset()
00147 { this->SetVertexIconSelectionMode(1); }
00148 virtual void SetVertexIconSelectionModeToAnnotationIcon()
00149 { this->SetVertexIconSelectionMode(2); }
00150 virtual void SetVertexIconSelectionModeToIgnoreSelection()
00151 { this->SetVertexIconSelectionMode(3); }
00153
00154
00155
00156
00157 virtual void SetEdgeIconArrayName(const char* name);
00158 virtual const char* GetEdgeIconArrayName();
00159 virtual void SetEdgeIconPriorityArrayName(const char* name);
00160 virtual const char* GetEdgeIconPriorityArrayName();
00161 virtual void SetEdgeIconVisibility(bool b);
00162 virtual bool GetEdgeIconVisibility();
00163 vtkBooleanMacro(EdgeIconVisibility, bool);
00164 virtual void AddEdgeIconType(const char* name, int type);
00165 virtual void ClearEdgeIconTypes();
00166 virtual void SetUseEdgeIconTypeMap(bool b);
00167 virtual bool GetUseEdgeIconTypeMap();
00168 vtkBooleanMacro(UseEdgeIconTypeMap, bool);
00169 virtual void SetEdgeIconAlignment(int align);
00170 virtual int GetEdgeIconAlignment();
00171
00172
00173
00174
00175 virtual void SetColorVerticesByArray(bool b);
00176 virtual bool GetColorVerticesByArray();
00177 vtkBooleanMacro(ColorVerticesByArray, bool);
00178 virtual void SetVertexColorArrayName(const char* name);
00179 virtual const char* GetVertexColorArrayName();
00180
00181
00182
00183
00184 virtual void SetColorEdgesByArray(bool b);
00185 virtual bool GetColorEdgesByArray();
00186 vtkBooleanMacro(ColorEdgesByArray, bool);
00187 virtual void SetEdgeColorArrayName(const char* name);
00188 virtual const char* GetEdgeColorArrayName();
00189
00190
00191
00192
00193 virtual void SetEnableVerticesByArray(bool b);
00194 virtual bool GetEnableVerticesByArray();
00195 vtkBooleanMacro(EnableVerticesByArray, bool);
00196 virtual void SetEnabledVerticesArrayName(const char* name);
00197 virtual const char* GetEnabledVerticesArrayName();
00198
00199
00200
00201
00202 virtual void SetEnableEdgesByArray(bool b);
00203 virtual bool GetEnableEdgesByArray();
00204 vtkBooleanMacro(EnableEdgesByArray, bool);
00205 virtual void SetEnabledEdgesArrayName(const char* name);
00206 virtual const char* GetEnabledEdgesArrayName();
00207
00208 virtual void SetEdgeVisibility(bool b);
00209 virtual bool GetEdgeVisibility();
00210 vtkBooleanMacro(EdgeVisibility, bool);
00211
00212
00213
00214
00216
00217 virtual void SetLayoutStrategy(vtkGraphLayoutStrategy* strategy);
00218 virtual vtkGraphLayoutStrategy* GetLayoutStrategy();
00220
00222
00223 virtual void SetLayoutStrategy(const char* name);
00224 vtkGetStringMacro(LayoutStrategyName);
00226
00228
00229 void SetLayoutStrategyToRandom()
00230 { this->SetLayoutStrategy("Random"); }
00231 void SetLayoutStrategyToForceDirected()
00232 { this->SetLayoutStrategy("Force Directed"); }
00233 void SetLayoutStrategyToSimple2D()
00234 { this->SetLayoutStrategy("Simple 2D"); }
00235 void SetLayoutStrategyToClustering2D()
00236 { this->SetLayoutStrategy("Clustering 2D"); }
00237 void SetLayoutStrategyToCommunity2D()
00238 { this->SetLayoutStrategy("Community 2D"); }
00239 void SetLayoutStrategyToFast2D()
00240 { this->SetLayoutStrategy("Fast 2D"); }
00241 void SetLayoutStrategyToPassThrough()
00242 { this->SetLayoutStrategy("Pass Through"); }
00243 void SetLayoutStrategyToCircular()
00244 { this->SetLayoutStrategy("Circular"); }
00245 void SetLayoutStrategyToTree()
00246 { this->SetLayoutStrategy("Tree"); }
00247 void SetLayoutStrategyToCosmicTree()
00248 { this->SetLayoutStrategy("Cosmic Tree"); }
00249 void SetLayoutStrategyToCone()
00250 { this->SetLayoutStrategy("Cone"); }
00251 void SetLayoutStrategyToSpanTree()
00252 { this->SetLayoutStrategy("Span Tree"); }
00254
00256
00258 virtual void SetLayoutStrategyToAssignCoordinates(
00259 const char* xarr, const char* yarr = 0, const char* zarr = 0);
00261
00263
00272 virtual void SetLayoutStrategyToTree(
00273 bool radial,
00274 double angle = 90,
00275 double leafSpacing = 0.9,
00276 double logSpacing = 1.0);
00278
00280
00289 virtual void SetLayoutStrategyToCosmicTree(
00290 const char* nodeSizeArrayName,
00291 bool sizeLeafNodesOnly = true,
00292 int layoutDepth = 0,
00293 vtkIdType layoutRoot = -1);
00295
00296
00297
00298
00300
00301 virtual void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy* strategy);
00302 virtual vtkEdgeLayoutStrategy* GetEdgeLayoutStrategy();
00303 void SetEdgeLayoutStrategyToArcParallel()
00304 { this->SetEdgeLayoutStrategy("Arc Parallel"); }
00305 void SetEdgeLayoutStrategyToPassThrough()
00306 { this->SetEdgeLayoutStrategy("Pass Through"); }
00308
00311 virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
00312
00314
00315 virtual void SetEdgeLayoutStrategy(const char* name);
00316 vtkGetStringMacro(EdgeLayoutStrategyName);
00318
00319
00320
00321
00323 virtual void ApplyViewTheme(vtkViewTheme* theme);
00324
00326
00327 virtual void SetGlyphType(int type);
00328 virtual int GetGlyphType();
00330
00332
00333 virtual void SetScaling(bool b);
00334 virtual bool GetScaling();
00335 vtkBooleanMacro(Scaling, bool);
00337
00339
00340 virtual void SetScalingArrayName(const char* name);
00341 virtual const char* GetScalingArrayName();
00343
00345
00346 virtual void SetVertexScalarBarVisibility(bool b);
00347 virtual bool GetVertexScalarBarVisibility();
00348 virtual void SetEdgeScalarBarVisibility(bool b);
00349 virtual bool GetEdgeScalarBarVisibility();
00351
00353 virtual bool IsLayoutComplete();
00354
00356 virtual void UpdateLayout();
00357
00359 void ComputeSelectedGraphBounds( double bounds[6] );
00360
00361 protected:
00362 vtkRenderedGraphRepresentation();
00363 ~vtkRenderedGraphRepresentation();
00364
00366
00367 virtual bool AddToView(vtkView* view);
00368 virtual bool RemoveFromView(vtkView* view);
00370
00371 virtual void PrepareForRendering(vtkRenderView* view);
00372
00373 virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* sel);
00374
00375
00376 virtual vtkUnicodeString GetHoverTextInternal(vtkSelection* sel);
00377
00378
00380
00381 virtual int RequestData(
00382 vtkInformation* request,
00383 vtkInformationVector** inputVector,
00384 vtkInformationVector* outputVector);
00386
00387
00389
00390 vtkSmartPointer<vtkApplyColors> ApplyColors;
00391 vtkSmartPointer<vtkVertexDegree> VertexDegree;
00392 vtkSmartPointer<vtkPolyData> EmptyPolyData;
00393 vtkSmartPointer<vtkEdgeCenters> EdgeCenters;
00394 vtkSmartPointer<vtkGraphToPoints> GraphToPoints;
00395 vtkSmartPointer<vtkPointSetToLabelHierarchy> VertexLabelHierarchy;
00396 vtkSmartPointer<vtkPointSetToLabelHierarchy> EdgeLabelHierarchy;
00397 vtkSmartPointer<vtkGraphLayout> Layout;
00398 vtkSmartPointer<vtkPerturbCoincidentVertices> Coincident;
00399 vtkSmartPointer<vtkEdgeLayout> EdgeLayout;
00400 vtkSmartPointer<vtkGraphToPolyData> GraphToPoly;
00401 vtkSmartPointer<vtkPolyDataMapper> EdgeMapper;
00402 vtkSmartPointer<vtkActor> EdgeActor;
00403 vtkSmartPointer<vtkGraphToGlyphs> VertexGlyph;
00404 vtkSmartPointer<vtkPolyDataMapper> VertexMapper;
00405 vtkSmartPointer<vtkActor> VertexActor;
00406 vtkSmartPointer<vtkGraphToGlyphs> OutlineGlyph;
00407 vtkSmartPointer<vtkPolyDataMapper> OutlineMapper;
00408 vtkSmartPointer<vtkActor> OutlineActor;
00409 vtkSmartPointer<vtkScalarBarWidget> VertexScalarBar;
00410 vtkSmartPointer<vtkScalarBarWidget> EdgeScalarBar;
00411 vtkSmartPointer<vtkRemoveHiddenData> RemoveHiddenGraph;
00412 vtkSmartPointer<vtkApplyIcons> ApplyVertexIcons;
00413 vtkSmartPointer<vtkGraphToPoints> VertexIconPoints;
00414 vtkSmartPointer<vtkTransformCoordinateSystems> VertexIconTransform;
00415 vtkSmartPointer<vtkIconGlyphFilter> VertexIconGlyph;
00416 vtkSmartPointer<vtkPolyDataMapper2D> VertexIconMapper;
00417 vtkSmartPointer<vtkTexturedActor2D> VertexIconActor;
00418
00420
00421 char* VertexHoverArrayName;
00422 char* EdgeHoverArrayName;
00423
00424 vtkSetStringMacro(VertexColorArrayNameInternal);
00425 vtkGetStringMacro(VertexColorArrayNameInternal);
00426 char* VertexColorArrayNameInternal;
00427
00428 vtkSetStringMacro(EdgeColorArrayNameInternal);
00429 vtkGetStringMacro(EdgeColorArrayNameInternal);
00430 char* EdgeColorArrayNameInternal;
00431
00432 vtkSetStringMacro(ScalingArrayNameInternal);
00433 vtkGetStringMacro(ScalingArrayNameInternal);
00434 char* ScalingArrayNameInternal;
00435
00436 vtkSetStringMacro(LayoutStrategyName);
00437 char* LayoutStrategyName;
00438 vtkSetStringMacro(EdgeLayoutStrategyName);
00439 char* EdgeLayoutStrategyName;
00440 bool HideVertexLabelsOnInteraction;
00441 bool HideEdgeLabelsOnInteraction;
00442
00443 private:
00444 vtkRenderedGraphRepresentation(const vtkRenderedGraphRepresentation&);
00445 void operator=(const vtkRenderedGraphRepresentation&);
00446 };
00447
00448 #endif
00449