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