File: vtkGraphLayoutViewer.h

package info (click to toggle)
paraview 3.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 124,600 kB
  • ctags: 133,728
  • sloc: cpp: 958,817; ansic: 509,658; tcl: 45,787; xml: 23,401; python: 19,574; perl: 3,112; yacc: 1,787; java: 1,517; sh: 665; asm: 471; lex: 400; makefile: 168; objc: 28
file content (203 lines) | stat: -rw-r--r-- 6,846 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    $RCSfile: vtkGraphLayoutViewer.h,v $

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
/*----------------------------------------------------------------------------
 Copyright (c) Sandia Corporation
 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
// .NAME vtkGraphLayoutViewer - Layout and display of a vtkGraph.
//
// .SECTION Description
// vtkGraphLayoutViewer is a convenience class for displaying a vtkGraph.  It
// packages up the functionality found in vtkRenderWindow, vtkRenderer,
// and vtkActor into a single easy to use class.  This class also creates 
// an image interactor style(vtkInteractorStyleImage) that allows zooming 
// and panning of the laid out graph.
// 
// .SECTION Notes
// Because the labeller likes to complain quite a bit, labels are defaulted
// to OFF. Also you should set all the other parameters first and then
// call SetLabelsOn() if you want labels.
//
// .SECTION See Also
// vtkTreeMapViewer
//
// .SECTION Thanks
// Thanks to Brian Wylie from Sandia National Laboratories for conceptualizing
// and implementing this class.

#ifndef __vtkGraphLayoutViewer_h
#define __vtkGraphLayoutViewer_h

#include "vtkObject.h"
#include "vtkSmartPointer.h"    // Required for smart pointer internal ivars.

class vtkAbstractGraph;
class vtkGraphLayout;
class vtkGraphLayoutStrategy;
class vtkGraphToPolyData;
class vtkTreeLevelsFilter;
class vtkPolyDataMapper;
class vtkAlgorithmOutput;
class vtkActor;
class vtkActor2D;
class vtkRenderWindowInteractor;
class vtkInteractorStyleImage;
class vtkRenderWindow;
class vtkRenderer;
class vtkRenderWindowInteractor;
class vtkLookupTable;
class vtkLabeledDataMapper;
class vtkEventForwarderCommand;
class vtkSphereSource;
class vtkGlyph3D;

class VTK_INFOVIS_EXPORT vtkGraphLayoutViewer : public vtkObject 
{
public:
  static vtkGraphLayoutViewer *New();
  vtkTypeRevisionMacro(vtkGraphLayoutViewer,vtkObject);
  void PrintSelf(ostream& os, vtkIndent indent);
  
  // Description:
  // Set the input data to the viewer.
  virtual void SetInput(vtkAbstractGraph *arg);

  // Description:
  // Set your own renderwindow
  virtual void SetRenderWindow(vtkRenderWindow *arg);
  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);

  // Description:
  // Set layout strategy for the tree map
  virtual void SetLayoutStrategy(const char *strategyName);
  virtual const char* GetLayoutStrategy();
  
  // Description:
  // Is the graph layout complete? This method is useful
  // for when the strategy is iterative and the application
  // wants to show the iterative progress of the graph layout
  // See Also: UpdateLayout();
  virtual int IsLayoutComplete();
  
  // Description:
  // This method is useful for when the strategy is iterative 
  // and the application wants to show the iterative progress 
  // of the graph layout. The application would have something like
  // while(!IsLayoutComplete())
  //   {
  //   UpdateLayout();
  //   }
  // See Also: IsLayoutComplete();
  virtual void UpdateLayout();
  
  // Description:
  // The name of the vertex field used for coloring the vertices
  virtual void SetVertexColorFieldName(const char *field);
  virtual char* GetVertexColorFieldName();
  
  // Description:
  // The name of the edge field used for coloring the edges
  virtual void SetEdgeColorFieldName(const char *field);
  virtual char* GetEdgeColorFieldName();
  
  // Description:
  // The name of the field used for labeling
  virtual void SetLabelFieldName(const char *field);
  virtual char* GetLabelFieldName();
  
  // Description:
  // These methods turn labeling on or off : defaulted to off
  virtual void SetLabelsOn();
  virtual void SetLabelsOff();
  
  // Description:
  // The size of the font used for labeling
  virtual void SetFontSize(const int size);
  virtual int GetFontSize();
  
  // Description:
  // Set/Get whether the layout is shown iteratively or not
  vtkSetMacro(Iterative, bool);
  vtkGetMacro(Iterative, bool);
  
  // Description:
  // Set/Get the field to use for the edge weights.
  vtkSetStringMacro(EdgeWeightField);
  vtkGetStringMacro(EdgeWeightField);
  
  // Description:
  // Get the graph output of the layout filter
  // Note: This function may return NULL if no
  // layout strategy is registered with this class
  vtkAbstractGraph* GetGraphAfterLayout();

protected:
  vtkGraphLayoutViewer();
  ~vtkGraphLayoutViewer();
  
  vtkAbstractGraph*                         Input;
  vtkRenderWindow*                          RenderWindow;
  vtkGraphLayoutStrategy*                   GraphLayoutStrategy;
  //BTX
  vtkSmartPointer<vtkGraphLayout>           GraphLayout;
  vtkSmartPointer<vtkGraphToPolyData>       GraphToPolyData;
  vtkSmartPointer<vtkSphereSource>          SphereSource;
  vtkSmartPointer<vtkGlyph3D>               VertexGlyphs;
  vtkSmartPointer<vtkInteractorStyleImage>  InteractorStyle;
  vtkSmartPointer<vtkPolyDataMapper>        GlyphMapper;
  vtkSmartPointer<vtkPolyDataMapper>        EdgeMapper;
  vtkSmartPointer<vtkRenderer>              Renderer;
  vtkSmartPointer<vtkActor>                 VertexActor;
  vtkSmartPointer<vtkActor>                 EdgeActor;
  vtkSmartPointer<vtkActor2D>               LabelActor;
  vtkSmartPointer<vtkLookupTable>           EdgeColorLUT;
  vtkSmartPointer<vtkLookupTable>           GlyphColorLUT;
  vtkSmartPointer<vtkLabeledDataMapper>     LabeledDataMapper;
  //ETX
  
  // Description:
  // This intercepts events from the graph layout class 
  // and re-emits them as if they came from this class.
  vtkEventForwarderCommand *EventForwarder;
  unsigned long ObserverTag;
  
private:

  // Internally used methods
  
  // Description:
  // Setup the internal pipeline for the graph layout view
  virtual void SetupPipeline();
  
  // Description:
  // When the input is set with SetInput() there some
  // initialization to do for the internal pipeline
  void InputInitialize();
  
  // Description:
  // Controls whether the layout is shown iteratively or not
  bool Iterative;
  
  // Description:
  // The field to use for the edge weights
  char*  EdgeWeightField;
  
  vtkGraphLayoutViewer(const vtkGraphLayoutViewer&);  // Not implemented.
  void operator=(const vtkGraphLayoutViewer&);  // Not implemented.
};

#endif