VTK
vtkImplicitPlaneRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImplicitPlaneRepresentation.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 =========================================================================*/
41 #ifndef vtkImplicitPlaneRepresentation_h
42 #define vtkImplicitPlaneRepresentation_h
43 
44 #include "vtkInteractionWidgetsModule.h" // For export macro
46 
47 class vtkActor;
48 class vtkPolyDataMapper;
49 class vtkCellPicker;
50 class vtkConeSource;
51 class vtkLineSource;
52 class vtkSphereSource;
53 class vtkTubeFilter;
54 class vtkPlane;
55 class vtkPlaneSource;
56 class vtkCutter;
57 class vtkProperty;
58 class vtkImageData;
59 class vtkOutlineFilter;
60 class vtkFeatureEdges;
61 class vtkPolyData;
63 class vtkTransform;
64 class vtkBox;
65 class vtkLookupTable;
66 
67 class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneRepresentation : public vtkWidgetRepresentation
68 {
69 public:
74 
76 
80  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
84 
87  void SetOrigin(double x, double y, double z);
88  void SetOrigin(double x[3]);
89  double* GetOrigin();
90  void GetOrigin(double xyz[3]);
92 
94 
97  void SetNormal(double x, double y, double z);
98  void SetNormal(double x[3]);
99  void SetNormalToCamera();
100  double* GetNormal();
101  void GetNormal(double xyz[3]);
103 
105 
112  void SetNormalToXAxis(int);
113  vtkGetMacro(NormalToXAxis,int);
114  vtkBooleanMacro(NormalToXAxis,int);
115  void SetNormalToYAxis(int);
116  vtkGetMacro(NormalToYAxis,int);
117  vtkBooleanMacro(NormalToYAxis,int);
118  void SetNormalToZAxis(int);
119  vtkGetMacro(NormalToZAxis,int);
120  vtkBooleanMacro(NormalToZAxis,int);
122 
124 
129  virtual void SetLockNormalToCamera(int);
130  vtkGetMacro(LockNormalToCamera,int);
131  vtkBooleanMacro(LockNormalToCamera,int);
133 
135 
139  vtkSetMacro(Tubing,int);
140  vtkGetMacro(Tubing,int);
141  vtkBooleanMacro(Tubing,int);
143 
145 
151  void SetDrawPlane(int plane);
152  vtkGetMacro(DrawPlane,int);
153  vtkBooleanMacro(DrawPlane,int);
155 
157 
160  void SetDrawOutline(int plane);
161  vtkGetMacro(DrawOutline,int);
162  vtkBooleanMacro(DrawOutline,int);
164 
166 
170  vtkSetMacro(OutlineTranslation,int);
171  vtkGetMacro(OutlineTranslation,int);
172  vtkBooleanMacro(OutlineTranslation,int);
174 
176 
180  vtkSetMacro(OutsideBounds,int);
181  vtkGetMacro(OutsideBounds,int);
182  vtkBooleanMacro(OutsideBounds,int);
184 
186 
192  vtkSetVector6Macro(WidgetBounds, double);
193  vtkGetVector6Macro(WidgetBounds, double);
195 
197 
204  vtkSetMacro(ConstrainToWidgetBounds,int);
205  vtkGetMacro(ConstrainToWidgetBounds,int);
206  vtkBooleanMacro(ConstrainToWidgetBounds,int);
208 
210 
213  vtkSetMacro(ScaleEnabled,int);
214  vtkGetMacro(ScaleEnabled,int);
215  vtkBooleanMacro(ScaleEnabled,int);
217 
222  void GetPolyData(vtkPolyData *pd);
223 
228  vtkPolyDataAlgorithm* GetPolyDataAlgorithm();
229 
237  void GetPlane(vtkPlane *plane);
238 
244  void SetPlane(vtkPlane *plane);
245 
250  void UpdatePlacement(void);
251 
253 
256  vtkGetObjectMacro(NormalProperty,vtkProperty);
257  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
259 
261 
265  vtkGetObjectMacro(PlaneProperty,vtkProperty);
266  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
268 
270 
273  vtkGetObjectMacro(OutlineProperty,vtkProperty);
274  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
276 
278 
282  vtkGetObjectMacro(EdgesProperty,vtkProperty);
284 
285 
288  void SetEdgeColor(vtkLookupTable*);
289  void SetEdgeColor(double, double, double);
290  void SetEdgeColor(double x[3]);
292 
294 
299  vtkSetClampMacro(BumpDistance,double,0.000001,1);
300  vtkGetMacro(BumpDistance,double);
302 
311  void BumpPlane(int dir, double factor);
312 
319  void PushPlane(double distance);
320 
322 
325  int ComputeInteractionState(int X, int Y, int modify=0) override;
326  void PlaceWidget(double bounds[6]) override;
327  void BuildRepresentation() override;
328  void StartWidgetInteraction(double eventPos[2]) override;
329  void WidgetInteraction(double newEventPos[2]) override;
330  void EndWidgetInteraction(double newEventPos[2]) override;
333  vtkAbstractWidget *widget,
334  unsigned long event, void *calldata) override;
335  void ComplexInteraction(
337  vtkAbstractWidget *widget,
338  unsigned long event, void *calldata) override;
341  vtkAbstractWidget *widget,
342  unsigned long event, void *calldata, int modify = 0) override;
345  vtkAbstractWidget *widget,
346  unsigned long event, void *calldata) override;
348 
350 
353  double *GetBounds() override;
354  void GetActors(vtkPropCollection *pc) override;
355  void ReleaseGraphicsResources(vtkWindow*) override;
356  int RenderOpaqueGeometry(vtkViewport*) override;
358  int HasTranslucentPolygonalGeometry() override;
360 
361  // Manage the state of the widget
363  {
364  Outside=0,
370  Scaling
371  };
372 
374 
383  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
385 
387 
391  virtual void SetRepresentationState(int);
392  vtkGetMacro(RepresentationState, int);
394 
395  // Get the underlying plane object used by this rep
396  // this can be used as a cropping plane in vtkMapper
398  return this->Plane; }
399 
401 
405  virtual void SetCropPlaneToBoundingBox(bool);
406  vtkGetMacro(CropPlaneToBoundingBox,bool);
407  vtkBooleanMacro(CropPlaneToBoundingBox,bool);
409 
410 
411 protected:
413  ~vtkImplicitPlaneRepresentation() override;
414 
416 
417  // Keep track of event positions
418  double LastEventPosition[3];
419  double LastEventOrientation[4];
420  double StartEventOrientation[4];
421 
422  // Controlling ivars
426 
427  // Locking normal to camera
429 
430  // Controlling the push operation
431  double BumpDistance;
432 
433  // The actual plane which is being manipulated
435 
436  // The bounding box is represented by a single voxel image data
441  void HighlightOutline(int highlight);
442  int OutlineTranslation; //whether the outline can be moved
443  int ScaleEnabled; //whether the widget can be scaled
444  int OutsideBounds; //whether the widget can be moved outside input's bounds
445  double WidgetBounds[6];
447 
448  // The cut plane is produced with a vtkCutter
455  void HighlightPlane(int highlight);
456 
457  // Optional tubes are represented by extracting boundary edges and tubing
462  int Tubing; //control whether tubing is on
463 
464  // The + normal cone
468  void HighlightNormal(int highlight);
469 
470  // The + normal line
474 
475  // The - normal cone
479 
480  // The - normal line
484 
485  // The origin positioning handle
489 
490  // Do the picking
492 
493  // Register internal Pickers within PickingManager
494  void RegisterPickers() override;
495 
496  // Transform the normal (used for rotation)
498 
499  // Methods to manipulate the plane
500  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
501  void Rotate3D(double *p1, double *p2);
502  void TranslatePlane(double *p1, double *p2);
503  void TranslateOutline(double *p1, double *p2);
504  void TranslateOrigin(double *p1, double *p2);
505  void UpdatePose(double *p1, double *d1, double *p2, double *d2);
506  void Push(double *p1, double *p2);
507  void Scale(double *p1, double *p2, double X, double Y);
508  void SizeHandles();
509 
510  // Properties used to control the appearance of selected objects and
511  // the manipulator in general.
519  void CreateDefaultProperties();
520 
521  void GeneratePlane();
522 
524 
525  // Support GetBounds() method
527 
528 private:
530  void operator=(const vtkImplicitPlaneRepresentation&) = delete;
531 };
532 
533 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:69
virtual void EndWidgetInteraction(double newEventPos[2])
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:65
virtual void StartWidgetInteraction(double eventPos[2])
virtual int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *callData, int modify=0)
map scalar values into colors via a lookup table
virtual void ComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
virtual void EndComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
virtual void StartComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
generate polygonal cone
Definition: vtkConeSource.h:44
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
abstract class defines interface between the widget and widget representation classes
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
platform-independent render window interaction including picking and frame rate control.
create wireframe outline for arbitrary data set
create a polygonal sphere centered at the origin
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:83
int HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
a class defining the representation for a vtkImplicitPlaneWidget2
extract boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
perform various plane computations
Definition: vtkPlane.h:37
virtual void WidgetInteraction(double newEventPos[2])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
create an array of quadrilaterals located in a plane
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
define the API for widget / widget representation
create a line defined by two end points
Definition: vtkLineSource.h:42
map vtkPolyData to graphics primitives
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
implicit function for a bounding box
Definition: vtkBox.h:41