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
47class vtkActor;
49class vtkCellPicker;
50class vtkConeSource;
51class vtkLineSource;
52class vtkSphereSource;
53class vtkTubeFilter;
54class vtkPlane;
55class vtkCutter;
56class vtkProperty;
57class vtkImageData;
59class vtkFeatureEdges;
60class vtkPolyData;
62class vtkTransform;
63class vtkBox;
64class vtkLookupTable;
65
66class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneRepresentation : public vtkWidgetRepresentation
67{
68public:
73
75
79 void PrintSelf(ostream& os, vtkIndent indent);
81
83
86 void SetOrigin(double x, double y, double z);
87 void SetOrigin(double x[3]);
88 double* GetOrigin();
89 void GetOrigin(double xyz[3]);
91
93
96 void SetNormal(double x, double y, double z);
97 void SetNormal(double x[3]);
99 double* GetNormal();
100 void GetNormal(double xyz[3]);
102
104
112 vtkGetMacro(NormalToXAxis,int);
113 vtkBooleanMacro(NormalToXAxis,int);
115 vtkGetMacro(NormalToYAxis,int);
116 vtkBooleanMacro(NormalToYAxis,int);
118 vtkGetMacro(NormalToZAxis,int);
119 vtkBooleanMacro(NormalToZAxis,int);
121
123
128 virtual void SetLockNormalToCamera(int);
129 vtkGetMacro(LockNormalToCamera,int);
130 vtkBooleanMacro(LockNormalToCamera,int);
132
134
138 vtkSetMacro(Tubing,int);
139 vtkGetMacro(Tubing,int);
140 vtkBooleanMacro(Tubing,int);
142
144
150 void SetDrawPlane(int plane);
151 vtkGetMacro(DrawPlane,int);
152 vtkBooleanMacro(DrawPlane,int);
154
156
160 vtkSetMacro(OutlineTranslation,int);
161 vtkGetMacro(OutlineTranslation,int);
162 vtkBooleanMacro(OutlineTranslation,int);
164
166
170 vtkSetMacro(OutsideBounds,int);
171 vtkGetMacro(OutsideBounds,int);
172 vtkBooleanMacro(OutsideBounds,int);
174
176
182 vtkSetVector6Macro(WidgetBounds, double);
183 vtkGetVector6Macro(WidgetBounds, double);
185
187
194 vtkSetMacro(ConstrainToWidgetBounds,int);
195 vtkGetMacro(ConstrainToWidgetBounds,int);
196 vtkBooleanMacro(ConstrainToWidgetBounds,int);
198
200
203 vtkSetMacro(ScaleEnabled,int);
204 vtkGetMacro(ScaleEnabled,int);
205 vtkBooleanMacro(ScaleEnabled,int);
207
213
219
227 void GetPlane(vtkPlane *plane);
228
234 void SetPlane(vtkPlane *plane);
235
240 void UpdatePlacement(void);
241
243
246 vtkGetObjectMacro(NormalProperty,vtkProperty);
247 vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
249
251
255 vtkGetObjectMacro(PlaneProperty,vtkProperty);
256 vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
258
260
263 vtkGetObjectMacro(OutlineProperty,vtkProperty);
264 vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
266
268
272 vtkGetObjectMacro(EdgesProperty,vtkProperty);
274
275
279 void SetEdgeColor(double, double, double);
280 void SetEdgeColor(double x[3]);
282
284
289 vtkSetClampMacro(BumpDistance,double,0.000001,1);
290 vtkGetMacro(BumpDistance,double);
292
301 void BumpPlane(int dir, double factor);
302
309 void PushPlane(double distance);
310
312
315 virtual int ComputeInteractionState(int X, int Y, int modify=0);
316 virtual void PlaceWidget(double bounds[6]);
317 virtual void BuildRepresentation();
318 virtual void StartWidgetInteraction(double eventPos[2]);
319 virtual void WidgetInteraction(double newEventPos[2]);
320 virtual void EndWidgetInteraction(double newEventPos[2]);
322
323
326 virtual double *GetBounds();
327 virtual void GetActors(vtkPropCollection *pc);
333
334 // Manage the state of the widget
336 {
337 Outside=0,
343 Scaling
344 };
345
347
356 vtkSetClampMacro(InteractionState,int,Outside,Scaling);
358
360
364 virtual void SetRepresentationState(int);
365 vtkGetMacro(RepresentationState, int);
367
368protected:
371
373
374 // Keep track of event positions
375 double LastEventPosition[3];
376
377 // Controlling ivars
381
382 // Locking normal to camera
384
385 // Controlling the push operation
387
388 // The actual plane which is being manipulated
390
391 // The bounding box is represented by a single voxel image data
396 void HighlightOutline(int highlight);
397 int OutlineTranslation; //whether the outline can be moved
398 int ScaleEnabled; //whether the widget can be scaled
399 int OutsideBounds; //whether the widget can be moved outside input's bounds
400 double WidgetBounds[6];
402
403 // The cut plane is produced with a vtkCutter
408 void HighlightPlane(int highlight);
409
410 // Optional tubes are represented by extracting boundary edges and tubing
415 int Tubing; //control whether tubing is on
416
417 // The + normal cone
421 void HighlightNormal(int highlight);
422
423 // The + normal line
427
428 // The - normal cone
432
433 // The - normal line
437
438 // The origin positioning handle
442
443 // Do the picking
445
446 // Register internal Pickers within PickingManager
447 virtual void RegisterPickers();
448
449 // Transform the normal (used for rotation)
451
452 // Methods to manipulate the plane
453 void Rotate(double X, double Y, double *p1, double *p2, double *vpn);
454 void TranslatePlane(double *p1, double *p2);
455 void TranslateOutline(double *p1, double *p2);
456 void TranslateOrigin(double *p1, double *p2);
457 void Push(double *p1, double *p2);
458 void Scale(double *p1, double *p2, double X, double Y);
460
461 // Properties used to control the appearance of selected objects and
462 // the manipulator in general.
471
473
474 // Support GetBounds() method
476
477private:
479 void operator=(const vtkImplicitPlaneRepresentation&) VTK_DELETE_FUNCTION;
480};
481
482#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
implicit function for a bounding box
Definition: vtkBox.h:42
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
generate polygonal cone
Definition: vtkConeSource.h:45
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:70
extract boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a class defining the representation for a vtkImplicitPlaneWidget2
void Rotate(double X, double Y, double *p1, double *p2, double *vpn)
void SetEdgeColor(vtkLookupTable *)
Set color to the edge.
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
void SetDrawPlane(int plane)
Enable/disable the drawing of the plane.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the plane.
void Scale(double *p1, double *p2, double X, double Y)
vtkPolyDataAlgorithm * GetPolyDataAlgorithm()
Satisfies superclass API.
void HighlightPlane(int highlight)
virtual void GetActors(vtkPropCollection *pc)
For some exporters and other other operations we must be able to collect all the actors or volumes.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void WidgetInteraction(double newEventPos[2])
virtual double * GetBounds()
Methods supporting the rendering process.
virtual void EndWidgetInteraction(double newEventPos[2])
void HighlightNormal(int highlight)
void UpdatePlacement(void)
Satisfies the superclass API.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
Methods to interface with the vtkSliderWidget.
void GetPlane(vtkPlane *plane)
Get the implicit function for the plane by copying the origin and normal of the cut plane into the pr...
virtual void SetLockNormalToCamera(int)
If enabled, and a vtkCamera is available through the renderer, then LockNormalToCamera will cause the...
void Push(double *p1, double *p2)
static vtkImplicitPlaneRepresentation * New()
Instantiate the class.
virtual void BuildRepresentation()
virtual void StartWidgetInteraction(double eventPos[2])
void SetNormalToXAxis(int)
Force the plane widget to be aligned with one of the x-y-z axes.
void PushPlane(double distance)
Push the plane the distance specified along the normal.
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
void GetNormal(double xyz[3])
void SetEdgeColor(double x[3])
void SetOrigin(double x, double y, double z)
Get the origin of the plane.
void BumpPlane(int dir, double factor)
Translate the plane in the direction of the normal by the specified BumpDistance.
virtual void PlaceWidget(double bounds[6])
void TranslateOrigin(double *p1, double *p2)
void SetEdgeColor(double, double, double)
virtual int HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
void GetOrigin(double xyz[3])
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
void SetNormal(double x, double y, double z)
Get the normal to the plane.
void TranslatePlane(double *p1, double *p2)
void TranslateOutline(double *p1, double *p2)
void HighlightOutline(int highlight)
void SetPlane(vtkPlane *plane)
Alternative way to define the cutting plane.
virtual int RenderOpaqueGeometry(vtkViewport *)
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:40
create a line defined by two end points
Definition: vtkLineSource.h:43
map scalar values into colors via a lookup table
create wireframe outline for arbitrary data set
perform various plane computations
Definition: vtkPlane.h:38
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
a list of Props
represent surface properties of a geometric object
Definition: vtkProperty.h:65
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
filter that generates tubes around lines
Definition: vtkTubeFilter.h:84
abstract specification for Viewports
Definition: vtkViewport.h:48
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ dir
Definition: vtkX3D.h:324
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.