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 =========================================================================*/
31 #ifndef vtkOrientedGlyphContourRepresentation_h
32 #define vtkOrientedGlyphContourRepresentation_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkProperty;
38 class vtkActor;
39 class vtkPolyDataMapper;
40 class vtkPolyData;
41 class vtkGlyph3D;
42 class vtkPoints;
43 
44 class VTKINTERACTIONWIDGETS_EXPORT vtkOrientedGlyphContourRepresentation : public vtkContourRepresentation
45 {
46 public:
51 
53 
57  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
59 
61 
66  void SetCursorShape(vtkPolyData *cursorShape);
67  vtkPolyData *GetCursorShape();
69 
71 
76  void SetActiveCursorShape(vtkPolyData *activeShape);
77  vtkPolyData *GetActiveCursorShape();
79 
81 
85  vtkGetObjectMacro(Property,vtkProperty);
87 
89 
93  vtkGetObjectMacro(ActiveProperty,vtkProperty);
95 
97 
100  vtkGetObjectMacro(LinesProperty,vtkProperty);
102 
104 
109  void SetRenderer(vtkRenderer *ren) VTK_OVERRIDE;
110  void BuildRepresentation() VTK_OVERRIDE;
111  void StartWidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
112  void WidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
113  int ComputeInteractionState(int X, int Y, int modified=0) VTK_OVERRIDE;
115 
117 
120  void GetActors(vtkPropCollection *) VTK_OVERRIDE;
121  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
122  int RenderOverlay(vtkViewport *viewport) VTK_OVERRIDE;
123  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
124  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
125  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
127 
131  vtkPolyData * GetContourRepresentationAsPolyData() VTK_OVERRIDE;
132 
134 
140  vtkSetMacro( AlwaysOnTop, int );
141  vtkGetMacro( AlwaysOnTop, int );
142  vtkBooleanMacro( AlwaysOnTop, int );
144 
149  void SetLineColor(double r, double g, double b);
150 
155  void SetShowSelectedNodes(int) VTK_OVERRIDE;
156 
160  double *GetBounds() VTK_OVERRIDE;
161 
162 protected:
164  ~vtkOrientedGlyphContourRepresentation() VTK_OVERRIDE;
165 
166  // Render the cursor
167  vtkActor *Actor;
169  vtkGlyph3D *Glypher;
170  vtkActor *ActiveActor;
171  vtkPolyDataMapper *ActiveMapper;
172  vtkGlyph3D *ActiveGlypher;
173  vtkPolyData *CursorShape;
174  vtkPolyData *ActiveCursorShape;
175  vtkPolyData *FocalData;
176  vtkPoints *FocalPoint;
177  vtkPolyData *ActiveFocalData;
178  vtkPoints *ActiveFocalPoint;
179 
180  vtkPolyData *SelectedNodesData;
181  vtkPoints *SelectedNodesPoints;
182  vtkActor *SelectedNodesActor;
183  vtkPolyDataMapper *SelectedNodesMapper;
184  vtkGlyph3D *SelectedNodesGlypher;
185  vtkPolyData *SelectedNodesCursorShape;
186  void CreateSelectedNodesRepresentation();
187 
188  vtkPolyData *Lines;
189  vtkPolyDataMapper *LinesMapper;
190  vtkActor *LinesActor;
191 
192  // Support picking
193  double LastPickPosition[3];
194  double LastEventPosition[2];
195 
196  // Methods to manipulate the cursor
197  void Translate(double eventPos[2]);
198  void Scale(double eventPos[2]);
199  void ShiftContour(double eventPos[2]);
200  void ScaleContour(double eventPos[2]);
201 
202  void ComputeCentroid(double* ioCentroid);
203 
204  // Properties used to control the appearance of selected objects and
205  // the manipulator in general.
206  vtkProperty *Property;
207  vtkProperty *ActiveProperty;
208  vtkProperty *LinesProperty;
209  void CreateDefaultProperties();
210 
211 
212  // Distance between where the mouse event happens and where the
213  // widget is focused - maintain this distance during interaction.
214  double InteractionOffset[2];
215 
216  int AlwaysOnTop;
217 
218  void BuildLines() VTK_OVERRIDE;
219 
220 private:
221  vtkOrientedGlyphContourRepresentation(const vtkOrientedGlyphContourRepresentation&) VTK_DELETE_FUNCTION;
222  void operator=(const vtkOrientedGlyphContourRepresentation&) VTK_DELETE_FUNCTION;
223 };
224 
225 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:64
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:63
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
represent the vtkContourWidget
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
a simple class to control print indentation
Definition: vtkIndent.h:39
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:111
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:39