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 =========================================================================*/
38 #ifndef vtkImplicitPlaneRepresentation_h
39 #define vtkImplicitPlaneRepresentation_h
40 
41 #include "vtkInteractionWidgetsModule.h" // For export macro
43 
44 class vtkActor;
45 class vtkPolyDataMapper;
46 class vtkCellPicker;
47 class vtkConeSource;
48 class vtkLineSource;
49 class vtkSphereSource;
50 class vtkTubeFilter;
51 class vtkPlane;
52 class vtkPlaneSource;
53 class vtkCutter;
54 class vtkProperty;
55 class vtkImageData;
56 class vtkOutlineFilter;
57 class vtkFeatureEdges;
58 class vtkPolyData;
60 class vtkTransform;
61 class vtkBox;
62 class vtkLookupTable;
63 
64 class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneRepresentation : public vtkWidgetRepresentation
65 {
66 public:
71 
73 
77  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
81 
84  void SetOrigin(double x, double y, double z);
85  void SetOrigin(double x[3]);
86  double* GetOrigin() VTK_SIZEHINT(3);
87  void GetOrigin(double xyz[3]);
89 
91 
94  void SetNormal(double x, double y, double z);
95  void SetNormal(double x[3]);
96  void SetNormalToCamera();
97  double* GetNormal() VTK_SIZEHINT(3);
98  void GetNormal(double xyz[3]);
100 
102 
109  void SetNormalToXAxis(vtkTypeBool);
110  vtkGetMacro(NormalToXAxis,vtkTypeBool);
111  vtkBooleanMacro(NormalToXAxis,vtkTypeBool);
112  void SetNormalToYAxis(vtkTypeBool);
113  vtkGetMacro(NormalToYAxis,vtkTypeBool);
114  vtkBooleanMacro(NormalToYAxis,vtkTypeBool);
115  void SetNormalToZAxis(vtkTypeBool);
116  vtkGetMacro(NormalToZAxis,vtkTypeBool);
117  vtkBooleanMacro(NormalToZAxis,vtkTypeBool);
119 
121 
126  virtual void SetLockNormalToCamera(vtkTypeBool);
127  vtkGetMacro(LockNormalToCamera,vtkTypeBool);
128  vtkBooleanMacro(LockNormalToCamera,vtkTypeBool);
130 
132 
136  vtkSetMacro(Tubing,vtkTypeBool);
137  vtkGetMacro(Tubing,vtkTypeBool);
138  vtkBooleanMacro(Tubing,vtkTypeBool);
140 
142 
148  void SetDrawPlane(vtkTypeBool plane);
149  vtkGetMacro(DrawPlane,vtkTypeBool);
150  vtkBooleanMacro(DrawPlane,vtkTypeBool);
152 
154 
157  void SetDrawOutline(vtkTypeBool plane);
158  vtkGetMacro(DrawOutline,vtkTypeBool);
159  vtkBooleanMacro(DrawOutline,vtkTypeBool);
161 
163 
167  vtkSetMacro(OutlineTranslation,vtkTypeBool);
168  vtkGetMacro(OutlineTranslation,vtkTypeBool);
169  vtkBooleanMacro(OutlineTranslation,vtkTypeBool);
171 
173 
177  vtkSetMacro(OutsideBounds,vtkTypeBool);
178  vtkGetMacro(OutsideBounds,vtkTypeBool);
179  vtkBooleanMacro(OutsideBounds,vtkTypeBool);
181 
183 
189  vtkSetVector6Macro(WidgetBounds, double);
190  vtkGetVector6Macro(WidgetBounds, double);
192 
194 
201  vtkSetMacro(ConstrainToWidgetBounds,vtkTypeBool);
202  vtkGetMacro(ConstrainToWidgetBounds,vtkTypeBool);
203  vtkBooleanMacro(ConstrainToWidgetBounds,vtkTypeBool);
205 
207 
210  vtkSetMacro(ScaleEnabled,vtkTypeBool);
211  vtkGetMacro(ScaleEnabled,vtkTypeBool);
212  vtkBooleanMacro(ScaleEnabled,vtkTypeBool);
214 
219  void GetPolyData(vtkPolyData *pd);
220 
225  vtkPolyDataAlgorithm* GetPolyDataAlgorithm();
226 
234  void GetPlane(vtkPlane *plane);
235 
241  void SetPlane(vtkPlane *plane);
242 
247  void UpdatePlacement(void);
248 
250 
253  vtkGetObjectMacro(NormalProperty,vtkProperty);
254  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
256 
258 
262  vtkGetObjectMacro(PlaneProperty,vtkProperty);
263  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
265 
267 
270  vtkGetObjectMacro(OutlineProperty,vtkProperty);
271  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
273 
275 
279  vtkGetObjectMacro(EdgesProperty,vtkProperty);
281 
282 
285  void SetEdgeColor(vtkLookupTable*);
286  void SetEdgeColor(double, double, double);
287  void SetEdgeColor(double x[3]);
289 
291 
296  vtkSetClampMacro(BumpDistance,double,0.000001,1);
297  vtkGetMacro(BumpDistance,double);
299 
308  void BumpPlane(int dir, double factor);
309 
316  void PushPlane(double distance);
317 
319 
322  int ComputeInteractionState(int X, int Y, int modify=0) override;
323  void PlaceWidget(double bounds[6]) override;
324  void BuildRepresentation() override;
325  void StartWidgetInteraction(double eventPos[2]) override;
326  void WidgetInteraction(double newEventPos[2]) override;
327  void EndWidgetInteraction(double newEventPos[2]) override;
328  void StartComplexInteraction(
330  vtkAbstractWidget *widget,
331  unsigned long event, void *calldata) override;
332  void ComplexInteraction(
334  vtkAbstractWidget *widget,
335  unsigned long event, void *calldata) override;
336  int ComputeComplexInteractionState(
338  vtkAbstractWidget *widget,
339  unsigned long event, void *calldata, int modify = 0) override;
340  void EndComplexInteraction(
342  vtkAbstractWidget *widget,
343  unsigned long event, void *calldata) override;
345 
347 
350  double *GetBounds() VTK_SIZEHINT(6) override;
351  void GetActors(vtkPropCollection *pc) override;
352  void ReleaseGraphicsResources(vtkWindow*) override;
353  int RenderOpaqueGeometry(vtkViewport*) override;
354  int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
355  int HasTranslucentPolygonalGeometry() override;
357 
358  // Manage the state of the widget
360  {
361  Outside=0,
367  Scaling
368  };
369 
371 
380  vtkSetClampMacro(InteractionState,int,Outside,Scaling);
382 
384 
388  virtual void SetRepresentationState(int);
389  vtkGetMacro(RepresentationState, int);
391 
392  // Get the underlying plane object used by this rep
393  // this can be used as a cropping plane in vtkMapper
395  return this->Plane; }
396 
398 
402  virtual void SetCropPlaneToBoundingBox(bool);
403  vtkGetMacro(CropPlaneToBoundingBox,bool);
404  vtkBooleanMacro(CropPlaneToBoundingBox,bool);
406 
407 
408 protected:
410  ~vtkImplicitPlaneRepresentation() override;
411 
413 
414  // Keep track of event positions
415  double LastEventPosition[3];
416  double LastEventOrientation[4];
417  double StartEventOrientation[4];
418 
419  // Controlling ivars
423 
424  // Locking normal to camera
426 
427  // Controlling the push operation
428  double BumpDistance;
429 
430  // The actual plane which is being manipulated
432 
433  // The bounding box is represented by a single voxel image data
438  void HighlightOutline(int highlight);
439  vtkTypeBool OutlineTranslation; //whether the outline can be moved
440  vtkTypeBool ScaleEnabled; //whether the widget can be scaled
441  vtkTypeBool OutsideBounds; //whether the widget can be moved outside input's bounds
442  double WidgetBounds[6];
444 
445  // The cut plane is produced with a vtkCutter
452  void HighlightPlane(int highlight);
453 
454  // Optional tubes are represented by extracting boundary edges and tubing
459  vtkTypeBool Tubing; //control whether tubing is on
460 
461  // The + normal cone
465  void HighlightNormal(int highlight);
466 
467  // The + normal line
471 
472  // The - normal cone
476 
477  // The - normal line
481 
482  // The origin positioning handle
486 
487  // Do the picking
489 
490  // Register internal Pickers within PickingManager
491  void RegisterPickers() override;
492 
493  // Transform the normal (used for rotation)
495 
496  // Methods to manipulate the plane
497  void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
498  void Rotate3D(double *p1, double *p2);
499  void TranslatePlane(double *p1, double *p2);
500  void TranslateOutline(double *p1, double *p2);
501  void TranslateOrigin(double *p1, double *p2);
502  void UpdatePose(double *p1, double *d1, double *p2, double *d2);
503  void Push(double *p1, double *p2);
504  void Scale(double *p1, double *p2, double X, double Y);
505  void SizeHandles();
506 
507  // Properties used to control the appearance of selected objects and
508  // the manipulator in general.
516  void CreateDefaultProperties();
517 
518  void GeneratePlane();
519 
521 
522  // Support GetBounds() method
524 
525 private:
527  void operator=(const vtkImplicitPlaneRepresentation&) = delete;
528 };
529 
530 #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:63
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:60
map scalar values into colors via a lookup table
generate polygonal cone
Definition: vtkConeSource.h:38
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
abstract class defines interface between the widget and widget representation classes ...
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
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
Superclass for algorithms that produce only polydata as output.
filter that generates tubes around lines
Definition: vtkTubeFilter.h:77
a simple class to control print indentation
Definition: vtkIndent.h:33
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:39
perform various plane computations
Definition: vtkPlane.h:31
#define VTK_SIZEHINT(...)
create an array of quadrilaterals located in a plane
define the API for widget / widget representation
create a line defined by two end points
Definition: vtkLineSource.h:36
map vtkPolyData to graphics primitives
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:63
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:38