VTK
vtkOrientedGlyphContourRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOrientedGlyphContourRepresentation.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 =========================================================================*/
28 #ifndef vtkOrientedGlyphContourRepresentation_h
29 #define vtkOrientedGlyphContourRepresentation_h
30 
31 #include "vtkInteractionWidgetsModule.h" // For export macro
33 
34 class vtkProperty;
35 class vtkActor;
36 class vtkPolyDataMapper;
37 class vtkPolyData;
38 class vtkGlyph3D;
39 class vtkPoints;
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkOrientedGlyphContourRepresentation : public vtkContourRepresentation
42 {
43 public:
48 
50 
54  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
56 
58 
63  void SetCursorShape(vtkPolyData *cursorShape);
64  vtkPolyData *GetCursorShape();
66 
68 
73  void SetActiveCursorShape(vtkPolyData *activeShape);
74  vtkPolyData *GetActiveCursorShape();
76 
78 
82  vtkGetObjectMacro(Property,vtkProperty);
84 
86 
90  vtkGetObjectMacro(ActiveProperty,vtkProperty);
92 
94 
97  vtkGetObjectMacro(LinesProperty,vtkProperty);
99 
101 
106  void SetRenderer(vtkRenderer *ren) VTK_OVERRIDE;
107  void BuildRepresentation() VTK_OVERRIDE;
108  void StartWidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
109  void WidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
110  int ComputeInteractionState(int X, int Y, int modified=0) VTK_OVERRIDE;
112 
114 
117  void GetActors(vtkPropCollection *) VTK_OVERRIDE;
118  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
119  int RenderOverlay(vtkViewport *viewport) VTK_OVERRIDE;
120  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
121  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
122  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
124 
128  vtkPolyData * GetContourRepresentationAsPolyData() VTK_OVERRIDE;
129 
131 
137  vtkSetMacro( AlwaysOnTop, int );
138  vtkGetMacro( AlwaysOnTop, int );
139  vtkBooleanMacro( AlwaysOnTop, int );
141 
146  void SetLineColor(double r, double g, double b);
147 
152  void SetShowSelectedNodes(int) VTK_OVERRIDE;
153 
157  double *GetBounds() VTK_OVERRIDE;
158 
159 protected:
161  ~vtkOrientedGlyphContourRepresentation() VTK_OVERRIDE;
162 
163  // Render the cursor
164  vtkActor *Actor;
166  vtkGlyph3D *Glypher;
167  vtkActor *ActiveActor;
168  vtkPolyDataMapper *ActiveMapper;
169  vtkGlyph3D *ActiveGlypher;
170  vtkPolyData *CursorShape;
171  vtkPolyData *ActiveCursorShape;
172  vtkPolyData *FocalData;
173  vtkPoints *FocalPoint;
174  vtkPolyData *ActiveFocalData;
175  vtkPoints *ActiveFocalPoint;
176 
177  vtkPolyData *SelectedNodesData;
178  vtkPoints *SelectedNodesPoints;
179  vtkActor *SelectedNodesActor;
180  vtkPolyDataMapper *SelectedNodesMapper;
181  vtkGlyph3D *SelectedNodesGlypher;
182  vtkPolyData *SelectedNodesCursorShape;
183  void CreateSelectedNodesRepresentation();
184 
185  vtkPolyData *Lines;
186  vtkPolyDataMapper *LinesMapper;
187  vtkActor *LinesActor;
188 
189  // Support picking
190  double LastPickPosition[3];
191  double LastEventPosition[2];
192 
193  // Methods to manipulate the cursor
194  void Translate(double eventPos[2]);
195  void Scale(double eventPos[2]);
196  void ShiftContour(double eventPos[2]);
197  void ScaleContour(double eventPos[2]);
198 
199  void ComputeCentroid(double* ioCentroid);
200 
201  // Properties used to control the appearance of selected objects and
202  // the manipulator in general.
203  vtkProperty *Property;
204  vtkProperty *ActiveProperty;
205  vtkProperty *LinesProperty;
206  void CreateDefaultProperties();
207 
208 
209  // Distance between where the mouse event happens and where the
210  // widget is focused - maintain this distance during interaction.
211  double InteractionOffset[2];
212 
213  int AlwaysOnTop;
214 
215  void BuildLines() VTK_OVERRIDE;
216 
217 private:
218  vtkOrientedGlyphContourRepresentation(const vtkOrientedGlyphContourRepresentation&) VTK_DELETE_FUNCTION;
219  void operator=(const vtkOrientedGlyphContourRepresentation&) VTK_DELETE_FUNCTION;
220 };
221 
222 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:58
void BuildRepresentation() override=0
These are methods that satisfy vtkWidgetRepresentation's API.
Default representation for the contour widget.
virtual void SetRenderer(vtkRenderer *ren)
Subclasses of vtkWidgetRepresentation must implement these methods.
abstract specification for renderers
Definition: vtkRenderer.h:57
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
represent the vtkContourWidget
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
a simple class to control print indentation
Definition: vtkIndent.h:33
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:105
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
map vtkPolyData to graphics primitives
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3D points
Definition: vtkPoints.h:33