VTK
vtkRenderedGraphRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRenderedGraphRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
31 #ifndef __vtkRenderedGraphRepresentation_h
32 #define __vtkRenderedGraphRepresentation_h
33 
35 #include "vtkSmartPointer.h" // for SP ivars
36 
37 class vtkActor;
38 class vtkApplyColors;
39 class vtkApplyIcons;
40 class vtkEdgeCenters;
41 class vtkEdgeLayout;
43 class vtkGraphLayout;
45 class vtkGraphToGlyphs;
46 class vtkGraphToPoints;
47 class vtkGraphToPolyData;
48 class vtkIconGlyphFilter;
49 class vtkInformation;
51 class vtkLookupTable;
54 class vtkPolyData;
55 class vtkPolyDataMapper;
58 class vtkRenderView;
59 class vtkScalarBarWidget;
60 class vtkScalarsToColors;
61 class vtkTextProperty;
62 class vtkTexturedActor2D;
64 class vtkVertexDegree;
65 class vtkView;
66 class vtkViewTheme;
67 
69 {
70 public:
73  void PrintSelf(ostream& os, vtkIndent indent);
74 
75  // ------------------------------------------------------------------------
76  // Vertex labels
77 
78  virtual void SetVertexLabelArrayName(const char* name);
79  virtual const char* GetVertexLabelArrayName();
80  virtual void SetVertexLabelPriorityArrayName(const char* name);
81  virtual const char* GetVertexLabelPriorityArrayName();
82  virtual void SetVertexLabelVisibility(bool b);
83  virtual bool GetVertexLabelVisibility();
84  vtkBooleanMacro(VertexLabelVisibility, bool);
85  virtual void SetVertexLabelTextProperty(vtkTextProperty* p);
86  virtual vtkTextProperty* GetVertexLabelTextProperty();
87  vtkSetStringMacro(VertexHoverArrayName);
88  vtkGetStringMacro(VertexHoverArrayName);
90 
92  vtkSetMacro(HideVertexLabelsOnInteraction, bool)
93  vtkGetMacro(HideVertexLabelsOnInteraction, bool)
94  vtkBooleanMacro(HideVertexLabelsOnInteraction, bool)
96 
97  // ------------------------------------------------------------------------
98  // Edge labels
99 
100  virtual void SetEdgeLabelArrayName(const char* name);
101  virtual const char* GetEdgeLabelArrayName();
102  virtual void SetEdgeLabelPriorityArrayName(const char* name);
103  virtual const char* GetEdgeLabelPriorityArrayName();
104  virtual void SetEdgeLabelVisibility(bool b);
105  virtual bool GetEdgeLabelVisibility();
106  vtkBooleanMacro(EdgeLabelVisibility, bool);
107  virtual void SetEdgeLabelTextProperty(vtkTextProperty* p);
108  virtual vtkTextProperty* GetEdgeLabelTextProperty();
109  vtkSetStringMacro(EdgeHoverArrayName);
110  vtkGetStringMacro(EdgeHoverArrayName);
112 
114  vtkSetMacro(HideEdgeLabelsOnInteraction, bool)
115  vtkGetMacro(HideEdgeLabelsOnInteraction, bool)
116  vtkBooleanMacro(HideEdgeLabelsOnInteraction, bool)
118 
119  // ------------------------------------------------------------------------
120  // Vertex icons
121 
122  virtual void SetVertexIconArrayName(const char* name);
123  virtual const char* GetVertexIconArrayName();
124  virtual void SetVertexIconPriorityArrayName(const char* name);
125  virtual const char* GetVertexIconPriorityArrayName();
126  virtual void SetVertexIconVisibility(bool b);
127  virtual bool GetVertexIconVisibility();
128  vtkBooleanMacro(VertexIconVisibility, bool);
129  virtual void AddVertexIconType(const char* name, int type);
130  virtual void ClearVertexIconTypes();
131  virtual void SetUseVertexIconTypeMap(bool b);
132  virtual bool GetUseVertexIconTypeMap();
133  vtkBooleanMacro(UseVertexIconTypeMap, bool);
134  virtual void SetVertexIconAlignment(int align);
135  virtual int GetVertexIconAlignment();
136  virtual void SetVertexSelectedIcon(int icon);
137  virtual int GetVertexSelectedIcon();
138  virtual void SetVertexDefaultIcon(int icon);
139  virtual int GetVertexDefaultIcon();
140 
142 
147  virtual void SetVertexIconSelectionMode(int mode);
148  virtual int GetVertexIconSelectionMode();
149  virtual void SetVertexIconSelectionModeToSelectedIcon()
150  { this->SetVertexIconSelectionMode(0); }
151  virtual void SetVertexIconSelectionModeToSelectedOffset()
152  { this->SetVertexIconSelectionMode(1); }
153  virtual void SetVertexIconSelectionModeToAnnotationIcon()
154  { this->SetVertexIconSelectionMode(2); }
155  virtual void SetVertexIconSelectionModeToIgnoreSelection()
156  { this->SetVertexIconSelectionMode(3); }
158 
159  // ------------------------------------------------------------------------
160  // Edge icons
161 
162  virtual void SetEdgeIconArrayName(const char* name);
163  virtual const char* GetEdgeIconArrayName();
164  virtual void SetEdgeIconPriorityArrayName(const char* name);
165  virtual const char* GetEdgeIconPriorityArrayName();
166  virtual void SetEdgeIconVisibility(bool b);
167  virtual bool GetEdgeIconVisibility();
168  vtkBooleanMacro(EdgeIconVisibility, bool);
169  virtual void AddEdgeIconType(const char* name, int type);
170  virtual void ClearEdgeIconTypes();
171  virtual void SetUseEdgeIconTypeMap(bool b);
172  virtual bool GetUseEdgeIconTypeMap();
173  vtkBooleanMacro(UseEdgeIconTypeMap, bool);
174  virtual void SetEdgeIconAlignment(int align);
175  virtual int GetEdgeIconAlignment();
176 
177  // ------------------------------------------------------------------------
178  // Vertex colors
179 
180  virtual void SetColorVerticesByArray(bool b);
181  virtual bool GetColorVerticesByArray();
182  vtkBooleanMacro(ColorVerticesByArray, bool);
183  virtual void SetVertexColorArrayName(const char* name);
184  virtual const char* GetVertexColorArrayName();
185 
186  // ------------------------------------------------------------------------
187  // Edge colors
188 
189  virtual void SetColorEdgesByArray(bool b);
190  virtual bool GetColorEdgesByArray();
191  vtkBooleanMacro(ColorEdgesByArray, bool);
192  virtual void SetEdgeColorArrayName(const char* name);
193  virtual const char* GetEdgeColorArrayName();
194 
195  // ------------------------------------------------------------------------
196  // Enabled vertices
197 
198  virtual void SetEnableVerticesByArray(bool b);
199  virtual bool GetEnableVerticesByArray();
200  vtkBooleanMacro(EnableVerticesByArray, bool);
201  virtual void SetEnabledVerticesArrayName(const char* name);
202  virtual const char* GetEnabledVerticesArrayName();
203 
204  // ------------------------------------------------------------------------
205  // Enabled edges
206 
207  virtual void SetEnableEdgesByArray(bool b);
208  virtual bool GetEnableEdgesByArray();
209  vtkBooleanMacro(EnableEdgesByArray, bool);
210  virtual void SetEnabledEdgesArrayName(const char* name);
211  virtual const char* GetEnabledEdgesArrayName();
212 
213  virtual void SetEdgeVisibility(bool b);
214  virtual bool GetEdgeVisibility();
215  vtkBooleanMacro(EdgeVisibility, bool);
216 
217  void SetEdgeSelection(bool b);
218  bool GetEdgeSelection();
219 
220  // ------------------------------------------------------------------------
221  // Vertex layout strategy
222 
224 
225  virtual void SetLayoutStrategy(vtkGraphLayoutStrategy* strategy);
226  virtual vtkGraphLayoutStrategy* GetLayoutStrategy();
228 
230 
231  virtual void SetLayoutStrategy(const char* name);
232  vtkGetStringMacro(LayoutStrategyName);
234 
236 
237  void SetLayoutStrategyToRandom()
238  { this->SetLayoutStrategy("Random"); }
239  void SetLayoutStrategyToForceDirected()
240  { this->SetLayoutStrategy("Force Directed"); }
241  void SetLayoutStrategyToSimple2D()
242  { this->SetLayoutStrategy("Simple 2D"); }
243  void SetLayoutStrategyToClustering2D()
244  { this->SetLayoutStrategy("Clustering 2D"); }
245  void SetLayoutStrategyToCommunity2D()
246  { this->SetLayoutStrategy("Community 2D"); }
247  void SetLayoutStrategyToFast2D()
248  { this->SetLayoutStrategy("Fast 2D"); }
249  void SetLayoutStrategyToPassThrough()
250  { this->SetLayoutStrategy("Pass Through"); }
251  void SetLayoutStrategyToCircular()
252  { this->SetLayoutStrategy("Circular"); }
253  void SetLayoutStrategyToTree()
254  { this->SetLayoutStrategy("Tree"); }
255  void SetLayoutStrategyToCosmicTree()
256  { this->SetLayoutStrategy("Cosmic Tree"); }
257  void SetLayoutStrategyToCone()
258  { this->SetLayoutStrategy("Cone"); }
259  void SetLayoutStrategyToSpanTree()
260  { this->SetLayoutStrategy("Span Tree"); }
262 
264 
266  virtual void SetLayoutStrategyToAssignCoordinates(
267  const char* xarr, const char* yarr = 0, const char* zarr = 0);
269 
271 
280  virtual void SetLayoutStrategyToTree(
281  bool radial,
282  double angle = 90,
283  double leafSpacing = 0.9,
284  double logSpacing = 1.0);
286 
288 
297  virtual void SetLayoutStrategyToCosmicTree(
298  const char* nodeSizeArrayName,
299  bool sizeLeafNodesOnly = true,
300  int layoutDepth = 0,
301  vtkIdType layoutRoot = -1);
303 
304  // ------------------------------------------------------------------------
305  // Edge layout strategy
306 
308 
309  virtual void SetEdgeLayoutStrategy(vtkEdgeLayoutStrategy* strategy);
310  virtual vtkEdgeLayoutStrategy* GetEdgeLayoutStrategy();
311  void SetEdgeLayoutStrategyToArcParallel()
312  { this->SetEdgeLayoutStrategy("Arc Parallel"); }
313  void SetEdgeLayoutStrategyToPassThrough()
314  { this->SetEdgeLayoutStrategy("Pass Through"); }
316 
319  virtual void SetEdgeLayoutStrategyToGeo(double explodeFactor = 0.2);
320 
322 
323  virtual void SetEdgeLayoutStrategy(const char* name);
324  vtkGetStringMacro(EdgeLayoutStrategyName);
326 
327  // ------------------------------------------------------------------------
328  // Miscellaneous
329 
331  virtual void ApplyViewTheme(vtkViewTheme* theme);
332 
334 
335  virtual void SetGlyphType(int type);
336  virtual int GetGlyphType();
338 
340 
341  virtual void SetScaling(bool b);
342  virtual bool GetScaling();
343  vtkBooleanMacro(Scaling, bool);
345 
347 
348  virtual void SetScalingArrayName(const char* name);
349  virtual const char* GetScalingArrayName();
351 
353 
354  virtual void SetVertexScalarBarVisibility(bool b);
355  virtual bool GetVertexScalarBarVisibility();
356  virtual void SetEdgeScalarBarVisibility(bool b);
357  virtual bool GetEdgeScalarBarVisibility();
359 
361  virtual bool IsLayoutComplete();
362 
364  virtual void UpdateLayout();
365 
367  void ComputeSelectedGraphBounds( double bounds[6] );
368 
369 protected:
372 
374 
375  virtual bool AddToView(vtkView* view);
376  virtual bool RemoveFromView(vtkView* view);
378 
379  virtual void PrepareForRendering(vtkRenderView* view);
380 
381  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* sel);
382 
384 
386 
387  virtual int RequestData(
388  vtkInformation* request,
389  vtkInformationVector** inputVector,
390  vtkInformationVector* outputVector);
392 
393  //BTX
395 
424  //ETX
426 
429 
430  vtkSetStringMacro(VertexColorArrayNameInternal);
431  vtkGetStringMacro(VertexColorArrayNameInternal);
433 
434  vtkSetStringMacro(EdgeColorArrayNameInternal);
435  vtkGetStringMacro(EdgeColorArrayNameInternal);
437 
438  vtkSetStringMacro(ScalingArrayNameInternal);
439  vtkGetStringMacro(ScalingArrayNameInternal);
441 
442  vtkSetStringMacro(LayoutStrategyName);
443  char* LayoutStrategyName;
444  vtkSetStringMacro(EdgeLayoutStrategyName);
448 
450 
451 private:
453  void operator=(const vtkRenderedGraphRepresentation&); // Not implemented
454 };
455 
456 #endif
457