VTK
vtkFinitePlaneRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFinitePlaneRepresentation.h
5 
6  Copyright (c)
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 =========================================================================*/
34 #ifndef vtkFinitePlaneRepresentation_h
35 #define vtkFinitePlaneRepresentation_h
36 
37 #include "vtkInteractionWidgetsModule.h" // For export macro
39 
40 class vtkActor;
41 class vtkBox;
42 class vtkCellPicker;
43 class vtkConeSource;
44 class vtkFeatureEdges;
45 class vtkLineSource;
46 class vtkPolyData;
47 class vtkPolyDataMapper;
48 class vtkProperty;
49 class vtkSphereSource;
50 class vtkTransform;
51 class vtkTubeFilter;
52 
53 class VTKINTERACTIONWIDGETS_EXPORT vtkFinitePlaneRepresentation : public vtkWidgetRepresentation
54 {
55 public:
60 
62 
66  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
73  void GetPolyData(vtkPolyData *pd);
74 
76 
81  vtkGetObjectMacro(V1HandleProperty, vtkProperty);
82  vtkGetObjectMacro(V2HandleProperty, vtkProperty);
83  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
85 
87 
92  vtkGetObjectMacro(PlaneProperty, vtkProperty);
93  vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
95 
97 
101  vtkSetMacro(Tubing, bool);
102  vtkGetMacro(Tubing, bool);
103  vtkBooleanMacro(Tubing, bool);
105 
107 
113  void SetDrawPlane(bool plane);
114  vtkGetMacro(DrawPlane, bool);
115  vtkBooleanMacro(DrawPlane, bool);
117 
119 
123  void SetHandles(bool handles);
124  virtual void HandlesOn();
125  virtual void HandlesOff();
127 
129 
132  void PlaceWidget(double bounds[6]) override;
133  void BuildRepresentation() override;
134  int ComputeInteractionState(int X, int Y, int modify=0) override;
135  void StartWidgetInteraction(double e[2]) override;
136  void WidgetInteraction(double e[2]) override;
137  double *GetBounds() override;
139 
141 
144  void ReleaseGraphicsResources(vtkWindow*) override;
145  int RenderOpaqueGeometry(vtkViewport*) override;
149 
150  vtkSetClampMacro(InteractionState, int, Outside, Pushing);
151 
153 
156  void SetOrigin(double x, double y, double z);
157  void SetOrigin(double x[3]);
158  vtkGetVector3Macro(Origin, double);
160 
162 
165  void SetNormal(double x, double y, double z);
166  void SetNormal(double x[3]);
167  vtkGetVector3Macro(Normal, double);
169 
171 
174  void SetV1(double x, double y);
175  void SetV1(double x[2]);
176  vtkGetVector2Macro(V1, double);
178 
180 
183  void SetV2(double x, double y);
184  void SetV2(double x[2]);
185  vtkGetVector2Macro(V2, double);
187 
189 
193  virtual void SetRepresentationState(int);
194  vtkGetMacro(RepresentationState, int);
196 
198 
201  vtkGetObjectMacro(NormalProperty, vtkProperty);
202  vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
204 
205  // Methods to manipulate the plane
206  void TranslateOrigin(double *p1, double *p2);
207  void MovePoint1(double *p1, double *p2);
208  void MovePoint2(double *p1, double *p2);
209  void Push(double *p1, double *p2);
210  void Rotate(int X, int Y, double *p1, double *p2, double *vpn);
211 
213  {
214  Outside = 0,
220  Pushing
221  };
222 
223  /*
224  * Register internal Pickers within PickingManager
225  */
226  void RegisterPickers() override;
227 
228 protected:
230  ~vtkFinitePlaneRepresentation() override;
231 
232  virtual void CreateDefaultProperties();
233 
234  // Size the glyphs representing hot spots (e.g., handles)
235  virtual void SizeHandles();
236 
237  void SetHighlightNormal(int highlight);
238  void SetHighlightPlane(int highlight);
239  void SetHighlightHandle(vtkProp *prop);
240 
241  double LastEventPosition[3];
242 
243  // the representation state
245 
246  // the origin
250  double Origin[3];
251 
252  // the normal
253  double Normal[3];
254 
255  // the previous normal
256  double PreviousNormal[3];
257 
258  // the rotation transform
260 
261  // the X Vector
265  double V1[3];
266 
267  // the Y Vector
271  double V2[3];
272 
273  // The + normal cone
277 
278  // The + normal line
282 
283  // The - normal cone
287 
288  // The - normal line
292 
293  // The finite plane
297 
298  // Optional tubes are represented by extracting boundary edges
303  bool Tubing; //control whether tubing is on
304  bool DrawPlane; //control whether plane is on
305 
306  // Picking objects
309 
310  // Transform the planes (used for rotations)
312 
313  // Support GetBounds() method
315 
316  // Properties used to control the appearance of selected objects and
317  // the manipulator in general.
326 
327 private:
329  void operator=(const vtkFinitePlaneRepresentation&) = delete;
330 };
331 
332 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:136
vtkWidgetRepresentation.h
vtkFinitePlaneRepresentation
represent the vtkFinitePlaneWidget.
Definition: vtkFinitePlaneRepresentation.h:53
vtkFinitePlaneRepresentation::CurrentHandle
vtkActor * CurrentHandle
Definition: vtkFinitePlaneRepresentation.h:308
vtkFinitePlaneRepresentation::PlanePolyData
vtkPolyData * PlanePolyData
Definition: vtkFinitePlaneRepresentation.h:294
vtkFinitePlaneRepresentation::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkFinitePlaneRepresentation.h:307
vtkFinitePlaneRepresentation::Edges
vtkFeatureEdges * Edges
Definition: vtkFinitePlaneRepresentation.h:299
vtkFinitePlaneRepresentation::PlaneMapper
vtkPolyDataMapper * PlaneMapper
Definition: vtkFinitePlaneRepresentation.h:295
vtkFinitePlaneRepresentation::ConeActor2
vtkActor * ConeActor2
Definition: vtkFinitePlaneRepresentation.h:286
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkFinitePlaneRepresentation::OriginHandleProperty
vtkProperty * OriginHandleProperty
Definition: vtkFinitePlaneRepresentation.h:318
vtkX3D::Normal
Definition: vtkX3D.h:45
vtkFinitePlaneRepresentation::Tubing
bool Tubing
Definition: vtkFinitePlaneRepresentation.h:303
vtkConeSource
generate polygonal cone
Definition: vtkConeSource.h:44
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkFinitePlaneRepresentation::SelectedPlaneProperty
vtkProperty * SelectedPlaneProperty
Definition: vtkFinitePlaneRepresentation.h:323
vtkFinitePlaneRepresentation::V1HandleProperty
vtkProperty * V1HandleProperty
Definition: vtkFinitePlaneRepresentation.h:319
vtkFinitePlaneRepresentation::RepresentationState
int RepresentationState
Definition: vtkFinitePlaneRepresentation.h:244
vtkFinitePlaneRepresentation::DrawPlane
bool DrawPlane
Definition: vtkFinitePlaneRepresentation.h:304
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkFinitePlaneRepresentation::MoveOrigin
Definition: vtkFinitePlaneRepresentation.h:215
vtkFinitePlaneRepresentation::BoundingBox
vtkBox * BoundingBox
Definition: vtkFinitePlaneRepresentation.h:314
vtkFinitePlaneRepresentation::EdgesTuber
vtkTubeFilter * EdgesTuber
Definition: vtkFinitePlaneRepresentation.h:300
vtkWidgetRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:223
vtkWidgetRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkWidgetRepresentation.h:220
vtkTubeFilter
filter that generates tubes around lines
Definition: vtkTubeFilter.h:83
vtkFinitePlaneRepresentation::EdgesMapper
vtkPolyDataMapper * EdgesMapper
Definition: vtkFinitePlaneRepresentation.h:301
vtkWidgetRepresentation::WidgetInteraction
virtual void WidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:137
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:215
vtkFinitePlaneRepresentation::V2Actor
vtkActor * V2Actor
Definition: vtkFinitePlaneRepresentation.h:270
vtkFinitePlaneRepresentation::ConeMapper
vtkPolyDataMapper * ConeMapper
Definition: vtkFinitePlaneRepresentation.h:275
vtkFinitePlaneRepresentation::SelectedNormalProperty
vtkProperty * SelectedNormalProperty
Definition: vtkFinitePlaneRepresentation.h:325
vtkFinitePlaneRepresentation::PlaneProperty
vtkProperty * PlaneProperty
Definition: vtkFinitePlaneRepresentation.h:322
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:46
vtkFinitePlaneRepresentation::ModifyV1
Definition: vtkFinitePlaneRepresentation.h:216
vtkFinitePlaneRepresentation::_InteractionState
_InteractionState
Definition: vtkFinitePlaneRepresentation.h:212
vtkFinitePlaneRepresentation::Moving
Definition: vtkFinitePlaneRepresentation.h:218
vtkFinitePlaneRepresentation::TransformRotation
vtkTransform * TransformRotation
Definition: vtkFinitePlaneRepresentation.h:311
vtkFinitePlaneRepresentation::Rotating
Definition: vtkFinitePlaneRepresentation.h:219
vtkFinitePlaneRepresentation::LineActor
vtkActor * LineActor
Definition: vtkFinitePlaneRepresentation.h:281
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkWidgetRepresentation::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkFinitePlaneRepresentation::Transform
vtkTransform * Transform
Definition: vtkFinitePlaneRepresentation.h:259
vtkFinitePlaneRepresentation::LineSource
vtkLineSource * LineSource
Definition: vtkFinitePlaneRepresentation.h:279
vtkFinitePlaneRepresentation::V1Geometry
vtkSphereSource * V1Geometry
Definition: vtkFinitePlaneRepresentation.h:262
vtkFeatureEdges
extract boundary, non-manifold, and/or sharp edges from polygonal data
Definition: vtkFeatureEdges.h:49
vtkFinitePlaneRepresentation::LineSource2
vtkLineSource * LineSource2
Definition: vtkFinitePlaneRepresentation.h:289
vtkLineSource
create a line defined by two end points
Definition: vtkLineSource.h:42
vtkFinitePlaneRepresentation::ConeActor
vtkActor * ConeActor
Definition: vtkFinitePlaneRepresentation.h:276
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkFinitePlaneRepresentation::LineActor2
vtkActor * LineActor2
Definition: vtkFinitePlaneRepresentation.h:291
vtkFinitePlaneRepresentation::ConeSource2
vtkConeSource * ConeSource2
Definition: vtkFinitePlaneRepresentation.h:284
vtkFinitePlaneRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkFinitePlaneRepresentation.h:321
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
vtkFinitePlaneRepresentation::V2HandleProperty
vtkProperty * V2HandleProperty
Definition: vtkFinitePlaneRepresentation.h:320
vtkWidgetRepresentation::PlaceWidget
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
Definition: vtkWidgetRepresentation.h:135
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:41
vtkFinitePlaneRepresentation::NormalProperty
vtkProperty * NormalProperty
Definition: vtkFinitePlaneRepresentation.h:324
vtkFinitePlaneRepresentation::OriginGeometry
vtkSphereSource * OriginGeometry
Definition: vtkFinitePlaneRepresentation.h:247
vtkWidgetRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:222
vtkFinitePlaneRepresentation::V2Mapper
vtkPolyDataMapper * V2Mapper
Definition: vtkFinitePlaneRepresentation.h:269
vtkFinitePlaneRepresentation::LineMapper2
vtkPolyDataMapper * LineMapper2
Definition: vtkFinitePlaneRepresentation.h:290
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkFinitePlaneRepresentation::OriginMapper
vtkPolyDataMapper * OriginMapper
Definition: vtkFinitePlaneRepresentation.h:248
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:66
vtkFinitePlaneRepresentation::ModifyV2
Definition: vtkFinitePlaneRepresentation.h:217
vtkWidgetRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkWidgetRepresentation.h:225
vtkFinitePlaneRepresentation::ConeSource
vtkConeSource * ConeSource
Definition: vtkFinitePlaneRepresentation.h:274
vtkFinitePlaneRepresentation::V2Geometry
vtkSphereSource * V2Geometry
Definition: vtkFinitePlaneRepresentation.h:268
vtkFinitePlaneRepresentation::V1Mapper
vtkPolyDataMapper * V1Mapper
Definition: vtkFinitePlaneRepresentation.h:263
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkFinitePlaneRepresentation::OriginActor
vtkActor * OriginActor
Definition: vtkFinitePlaneRepresentation.h:249
vtkFinitePlaneRepresentation::LineMapper
vtkPolyDataMapper * LineMapper
Definition: vtkFinitePlaneRepresentation.h:280
vtkFinitePlaneRepresentation::EdgesActor
vtkActor * EdgesActor
Definition: vtkFinitePlaneRepresentation.h:302
vtkFinitePlaneRepresentation::PlaneActor
vtkActor * PlaneActor
Definition: vtkFinitePlaneRepresentation.h:296
vtkFinitePlaneRepresentation::V1Actor
vtkActor * V1Actor
Definition: vtkFinitePlaneRepresentation.h:264
vtkFinitePlaneRepresentation::ConeMapper2
vtkPolyDataMapper * ConeMapper2
Definition: vtkFinitePlaneRepresentation.h:285
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.