VTK  9.0.20201030
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 =========================================================================*/
31 #ifndef vtkFinitePlaneRepresentation_h
32 #define vtkFinitePlaneRepresentation_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkActor;
38 class vtkBox;
39 class vtkCellPicker;
40 class vtkConeSource;
41 class vtkFeatureEdges;
42 class vtkLineSource;
43 class vtkPolyData;
44 class vtkPolyDataMapper;
45 class vtkProperty;
46 class vtkSphereSource;
47 class vtkTransform;
48 class vtkTubeFilter;
49 
50 class VTKINTERACTIONWIDGETS_EXPORT vtkFinitePlaneRepresentation : public vtkWidgetRepresentation
51 {
52 public:
57 
59 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
70  void GetPolyData(vtkPolyData* pd);
71 
73 
78  vtkGetObjectMacro(V1HandleProperty, vtkProperty);
79  vtkGetObjectMacro(V2HandleProperty, vtkProperty);
80  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
82 
84 
89  vtkGetObjectMacro(PlaneProperty, vtkProperty);
90  vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
92 
94 
98  vtkSetMacro(Tubing, bool);
99  vtkGetMacro(Tubing, bool);
100  vtkBooleanMacro(Tubing, bool);
102 
104 
110  void SetDrawPlane(bool plane);
111  vtkGetMacro(DrawPlane, bool);
112  vtkBooleanMacro(DrawPlane, bool);
114 
116 
120  void SetHandles(bool handles);
121  virtual void HandlesOn();
122  virtual void HandlesOff();
124 
126 
129  void PlaceWidget(double bounds[6]) override;
130  void BuildRepresentation() override;
131  int ComputeInteractionState(int X, int Y, int modify = 0) override;
132  void StartWidgetInteraction(double e[2]) override;
133  void WidgetInteraction(double e[2]) override;
134  double* GetBounds() override;
136 
138 
141  void ReleaseGraphicsResources(vtkWindow*) override;
142  int RenderOpaqueGeometry(vtkViewport*) override;
146 
147  vtkSetClampMacro(InteractionState, int, Outside, Pushing);
148 
150 
153  void SetOrigin(double x, double y, double z);
154  void SetOrigin(double x[3]);
155  vtkGetVector3Macro(Origin, double);
157 
159 
162  void SetNormal(double x, double y, double z);
163  void SetNormal(double n[3]);
164  vtkGetVector3Macro(Normal, double);
166 
168 
171  void SetV1(double x, double y);
172  void SetV1(double x[2]);
173  vtkGetVector2Macro(V1, double);
175 
177 
180  void SetV2(double x, double y);
181  void SetV2(double x[2]);
182  vtkGetVector2Macro(V2, double);
184 
186 
190  virtual void SetRepresentationState(int);
191  vtkGetMacro(RepresentationState, int);
193 
195 
198  vtkGetObjectMacro(NormalProperty, vtkProperty);
199  vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
201 
202  // Methods to manipulate the plane
203  void TranslateOrigin(double* p1, double* p2);
204  void MovePoint1(double* p1, double* p2);
205  void MovePoint2(double* p1, double* p2);
206  void Push(double* p1, double* p2);
207  void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
208 
210  {
211  Outside = 0,
217  Pushing
218  };
219 
220  /*
221  * Register internal Pickers within PickingManager
222  */
223  void RegisterPickers() override;
224 
225 protected:
227  ~vtkFinitePlaneRepresentation() override;
228 
229  virtual void CreateDefaultProperties();
230 
231  // Size the glyphs representing hot spots (e.g., handles)
232  virtual void SizeHandles();
233 
234  void SetHighlightNormal(int highlight);
235  void SetHighlightPlane(int highlight);
236  void SetHighlightHandle(vtkProp* prop);
237 
238  double LastEventPosition[3];
239 
240  // the representation state
242 
243  // the origin
247  double Origin[3];
248 
249  // the normal
250  double Normal[3];
251 
252  // the previous normal
253  double PreviousNormal[3];
254 
255  // the rotation transform
257 
258  // the X Vector
262  double V1[3];
263 
264  // the Y Vector
268  double V2[3];
269 
270  // The + normal cone
274 
275  // The + normal line
279 
280  // The - normal cone
284 
285  // The - normal line
289 
290  // The finite plane
294 
295  // Optional tubes are represented by extracting boundary edges
300  bool Tubing; // control whether tubing is on
301  bool DrawPlane; // control whether plane is on
302 
303  // Picking objects
306 
307  // Transform the planes (used for rotations)
309 
310  // Support GetBounds() method
312 
313  // Properties used to control the appearance of selected objects and
314  // the manipulator in general.
323 
324 private:
326  void operator=(const vtkFinitePlaneRepresentation&) = delete;
327 };
328 
329 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:36
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:135
vtkWidgetRepresentation.h
vtkFinitePlaneRepresentation
represent the vtkFinitePlaneWidget.
Definition: vtkFinitePlaneRepresentation.h:50
vtkFinitePlaneRepresentation::CurrentHandle
vtkActor * CurrentHandle
Definition: vtkFinitePlaneRepresentation.h:305
vtkFinitePlaneRepresentation::PlanePolyData
vtkPolyData * PlanePolyData
Definition: vtkFinitePlaneRepresentation.h:291
vtkFinitePlaneRepresentation::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkFinitePlaneRepresentation.h:304
vtkFinitePlaneRepresentation::Edges
vtkFeatureEdges * Edges
Definition: vtkFinitePlaneRepresentation.h:296
vtkFinitePlaneRepresentation::PlaneMapper
vtkPolyDataMapper * PlaneMapper
Definition: vtkFinitePlaneRepresentation.h:292
vtkFinitePlaneRepresentation::ConeActor2
vtkActor * ConeActor2
Definition: vtkFinitePlaneRepresentation.h:283
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:315
vtkX3D::Normal
Definition: vtkX3D.h:51
vtkFinitePlaneRepresentation::Tubing
bool Tubing
Definition: vtkFinitePlaneRepresentation.h:300
vtkConeSource
generate polygonal cone
Definition: vtkConeSource.h:38
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:59
vtkFinitePlaneRepresentation::SelectedPlaneProperty
vtkProperty * SelectedPlaneProperty
Definition: vtkFinitePlaneRepresentation.h:320
vtkFinitePlaneRepresentation::V1HandleProperty
vtkProperty * V1HandleProperty
Definition: vtkFinitePlaneRepresentation.h:316
vtkFinitePlaneRepresentation::RepresentationState
int RepresentationState
Definition: vtkFinitePlaneRepresentation.h:241
vtkFinitePlaneRepresentation::DrawPlane
bool DrawPlane
Definition: vtkFinitePlaneRepresentation.h:301
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkFinitePlaneRepresentation::MoveOrigin
Definition: vtkFinitePlaneRepresentation.h:212
vtkFinitePlaneRepresentation::BoundingBox
vtkBox * BoundingBox
Definition: vtkFinitePlaneRepresentation.h:311
vtkFinitePlaneRepresentation::EdgesTuber
vtkTubeFilter * EdgesTuber
Definition: vtkFinitePlaneRepresentation.h:297
vtkWidgetRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:216
vtkWidgetRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkWidgetRepresentation.h:213
vtkTubeFilter
filter that generates tubes around lines
Definition: vtkTubeFilter.h:79
vtkFinitePlaneRepresentation::EdgesMapper
vtkPolyDataMapper * EdgesMapper
Definition: vtkFinitePlaneRepresentation.h:298
vtkWidgetRepresentation::WidgetInteraction
virtual void WidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:136
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:208
vtkFinitePlaneRepresentation::V2Actor
vtkActor * V2Actor
Definition: vtkFinitePlaneRepresentation.h:267
vtkFinitePlaneRepresentation::ConeMapper
vtkPolyDataMapper * ConeMapper
Definition: vtkFinitePlaneRepresentation.h:272
vtkFinitePlaneRepresentation::SelectedNormalProperty
vtkProperty * SelectedNormalProperty
Definition: vtkFinitePlaneRepresentation.h:322
vtkFinitePlaneRepresentation::PlaneProperty
vtkProperty * PlaneProperty
Definition: vtkFinitePlaneRepresentation.h:319
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:41
vtkFinitePlaneRepresentation::ModifyV1
Definition: vtkFinitePlaneRepresentation.h:213
vtkFinitePlaneRepresentation::_InteractionState
_InteractionState
Definition: vtkFinitePlaneRepresentation.h:209
vtkFinitePlaneRepresentation::Moving
Definition: vtkFinitePlaneRepresentation.h:215
vtkFinitePlaneRepresentation::TransformRotation
vtkTransform * TransformRotation
Definition: vtkFinitePlaneRepresentation.h:308
vtkFinitePlaneRepresentation::Rotating
Definition: vtkFinitePlaneRepresentation.h:216
vtkFinitePlaneRepresentation::LineActor
vtkActor * LineActor
Definition: vtkFinitePlaneRepresentation.h:278
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkWidgetRepresentation::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkFinitePlaneRepresentation::Transform
vtkTransform * Transform
Definition: vtkFinitePlaneRepresentation.h:256
vtkFinitePlaneRepresentation::LineSource
vtkLineSource * LineSource
Definition: vtkFinitePlaneRepresentation.h:276
vtkFinitePlaneRepresentation::V1Geometry
vtkSphereSource * V1Geometry
Definition: vtkFinitePlaneRepresentation.h:259
vtkFeatureEdges
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
Definition: vtkFeatureEdges.h:47
vtkFinitePlaneRepresentation::LineSource2
vtkLineSource * LineSource2
Definition: vtkFinitePlaneRepresentation.h:286
vtkLineSource
create a line defined by two end points
Definition: vtkLineSource.h:60
vtkFinitePlaneRepresentation::ConeActor
vtkActor * ConeActor
Definition: vtkFinitePlaneRepresentation.h:273
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkFinitePlaneRepresentation::LineActor2
vtkActor * LineActor2
Definition: vtkFinitePlaneRepresentation.h:288
vtkFinitePlaneRepresentation::ConeSource2
vtkConeSource * ConeSource2
Definition: vtkFinitePlaneRepresentation.h:281
vtkFinitePlaneRepresentation::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkFinitePlaneRepresentation.h:318
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
vtkFinitePlaneRepresentation::V2HandleProperty
vtkProperty * V2HandleProperty
Definition: vtkFinitePlaneRepresentation.h:317
vtkWidgetRepresentation::PlaceWidget
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
vtkBox
implicit function for a bounding box
Definition: vtkBox.h:38
vtkFinitePlaneRepresentation::NormalProperty
vtkProperty * NormalProperty
Definition: vtkFinitePlaneRepresentation.h:321
vtkFinitePlaneRepresentation::OriginGeometry
vtkSphereSource * OriginGeometry
Definition: vtkFinitePlaneRepresentation.h:244
vtkWidgetRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:215
vtkFinitePlaneRepresentation::V2Mapper
vtkPolyDataMapper * V2Mapper
Definition: vtkFinitePlaneRepresentation.h:266
vtkFinitePlaneRepresentation::LineMapper2
vtkPolyDataMapper * LineMapper2
Definition: vtkFinitePlaneRepresentation.h:287
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkFinitePlaneRepresentation::OriginMapper
vtkPolyDataMapper * OriginMapper
Definition: vtkFinitePlaneRepresentation.h:245
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:61
vtkFinitePlaneRepresentation::ModifyV2
Definition: vtkFinitePlaneRepresentation.h:214
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:218
vtkFinitePlaneRepresentation::ConeSource
vtkConeSource * ConeSource
Definition: vtkFinitePlaneRepresentation.h:271
vtkFinitePlaneRepresentation::V2Geometry
vtkSphereSource * V2Geometry
Definition: vtkFinitePlaneRepresentation.h:265
vtkFinitePlaneRepresentation::V1Mapper
vtkPolyDataMapper * V1Mapper
Definition: vtkFinitePlaneRepresentation.h:260
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:66
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:246
vtkFinitePlaneRepresentation::LineMapper
vtkPolyDataMapper * LineMapper
Definition: vtkFinitePlaneRepresentation.h:277
vtkFinitePlaneRepresentation::EdgesActor
vtkActor * EdgesActor
Definition: vtkFinitePlaneRepresentation.h:299
vtkFinitePlaneRepresentation::PlaneActor
vtkActor * PlaneActor
Definition: vtkFinitePlaneRepresentation.h:293
vtkFinitePlaneRepresentation::V1Actor
vtkActor * V1Actor
Definition: vtkFinitePlaneRepresentation.h:261
vtkFinitePlaneRepresentation::ConeMapper2
vtkPolyDataMapper * ConeMapper2
Definition: vtkFinitePlaneRepresentation.h:282
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.