VTK  9.2.6
vtkBoxRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkBoxRepresentation.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
39#ifndef vtkBoxRepresentation_h
40#define vtkBoxRepresentation_h
41
42#include "vtkInteractionWidgetsModule.h" // For export macro
44
45class vtkActor;
47class vtkLineSource;
48class vtkSphereSource;
49class vtkCellPicker;
50class vtkProperty;
51class vtkPolyData;
52class vtkPoints;
55class vtkTransform;
56class vtkPlane;
57class vtkPlanes;
58class vtkBox;
59class vtkDoubleArray;
60class vtkMatrix4x4;
61
62class VTKINTERACTIONWIDGETS_EXPORT vtkBoxRepresentation : public vtkWidgetRepresentation
63{
64public:
69
71
75 void PrintSelf(ostream& os, vtkIndent indent) override;
77
86 void GetPlanes(vtkPlanes* planes);
87
88 // Get the underlying planes used by this rep
89 // this can be used as a cropping planes in vtkMapper
90 vtkPlane* GetUnderlyingPlane(int i) { return this->Planes[i]; }
91
93
99 vtkSetMacro(InsideOut, vtkTypeBool);
100 vtkGetMacro(InsideOut, vtkTypeBool);
101 vtkBooleanMacro(InsideOut, vtkTypeBool);
103
111 virtual void GetTransform(vtkTransform* t);
112
119 virtual void SetTransform(vtkTransform* t);
120
132
134
139 vtkGetObjectMacro(HandleProperty, vtkProperty);
142
144
149 vtkGetObjectMacro(FaceProperty, vtkProperty);
152
154
159 vtkGetObjectMacro(OutlineProperty, vtkProperty);
162
164
169 vtkGetMacro(OutlineFaceWires, int);
173
175
181 vtkGetMacro(OutlineCursorWires, int);
185
187
191 virtual void HandlesOn();
192 virtual void HandlesOff();
194
196
199 void PlaceWidget(double bounds[6]) override;
200 void BuildRepresentation() override;
201 int ComputeInteractionState(int X, int Y, int modify = 0) override;
202 void StartWidgetInteraction(double e[2]) override;
203 void WidgetInteraction(double e[2]) override;
204 double* GetBounds() VTK_SIZEHINT(6) override;
206 unsigned long event, void* calldata) override;
208 unsigned long event, void* calldata) override;
210 unsigned long event, void* calldata, int modify = 0) override;
212 unsigned long event, void* calldata) override;
214
216
224
225 // Used to manage the state of the widget
226 enum
227 {
238 };
239
249 void SetInteractionState(int state);
250
252
256 vtkGetMacro(TwoPlaneMode, bool);
257 void SetTwoPlaneMode(bool);
259
261
265 vtkGetMacro(SnapToAxes, bool);
266 vtkSetMacro(SnapToAxes, bool);
268
270
277
278 /*
279 * Register internal Pickers within PickingManager
280 */
281 void RegisterPickers() override;
282
284
288 vtkGetMacro(TranslationAxis, int);
289 vtkSetClampMacro(TranslationAxis, int, -1, 2);
291
293
301
303
308
315
316protected:
319
320 // Manage how the representation appears
327
329
330 // Constraint axis translation
332
333 // the hexahedron (6 faces)
337 vtkPoints* Points; // used by others as well
338 double N[6][3]; // the normals of the faces
339
340 // A face of the hexahedron
344
345 // glyphs representing hot spots (e.g., handles)
349 virtual void PositionHandles();
350 int HighlightHandle(vtkProp* prop); // returns cell id
351 void HighlightFace(int cellId);
352 void HighlightOutline(int highlight);
353 virtual void ComputeNormals();
354 virtual void SizeHandles();
355
356 // wireframe outline
360
361 // Do the picking
367
368 // Transform the hexahedral points (used for rotations)
370
371 // Support GetBounds() method
373
374 // Properties used to control the appearance of selected objects and
375 // the manipulator in general.
383
384 // Control the orientation of the normals
389
390 // Helper methods
391 virtual void Translate(const double* p1, const double* p2);
392 virtual void Scale(const double* p1, const double* p2, int X, int Y);
393 virtual void Rotate(int X, int Y, const double* p1, const double* p2, const double* vpn);
394 void MovePlusXFace(const double* p1, const double* p2);
395 void MoveMinusXFace(const double* p1, const double* p2);
396 void MovePlusYFace(const double* p1, const double* p2);
397 void MoveMinusYFace(const double* p1, const double* p2);
398 void MovePlusZFace(const double* p1, const double* p2);
399 void MoveMinusZFace(const double* p1, const double* p2);
400 void UpdatePose(const double* p1, const double* d1, const double* p2, const double* d2);
401
402 // Internal ivars for performance
406
407 // The actual planes which are being manipulated
409
410 //"dir" is the direction in which the face can be moved i.e. the axis passing
411 // through the center
412 void MoveFace(const double* p1, const double* p2, const double* dir, double* x1, double* x2,
413 double* x3, double* x4, double* x5);
414 // Helper method to obtain the direction in which the face is to be moved.
415 // Handles special cases where some of the scale factors are 0.
416 void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3]);
417
418private:
420 void operator=(const vtkBoxRepresentation&) = delete;
421};
422
423#endif
define the API for widget / widget representation
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:52
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
virtual void PositionHandles()
virtual void SetTransform(vtkTransform *t)
Set the position, scale and orientation of the box widget using the transform specified.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void MovePlusZFace(const double *p1, const double *p2)
void OutlineCursorWiresOff()
Control the representation of the outline.
void MoveMinusYFace(const double *p1, const double *p2)
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
void GetPlanes(vtkPlanes *planes)
Get the planes describing the implicit function defined by the box widget.
void SetOutlineCursorWires(int)
Control the representation of the outline.
vtkPolyDataMapper * HexFaceMapper
void StepBackward()
For complex events should we snap orientations to be aligned with the x y z axes.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
void GetActors(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
void MoveMinusXFace(const double *p1, const double *p2)
void MoveFace(const double *p1, const double *p2, const double *dir, double *x1, double *x2, double *x3, double *x4, double *x5)
virtual void HandlesOff()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
void HighlightFace(int cellId)
int HighlightHandle(vtkProp *prop)
bool IsTranslationConstrained()
Returns true if ContrainedAxis.
void OutlineFaceWiresOn()
Control the representation of the outline.
vtkPolyDataMapper * OutlineMapper
vtkPlane * GetUnderlyingPlane(int i)
void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3])
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.
virtual void Translate(const double *p1, const double *p2)
void MovePlusYFace(const double *p1, const double *p2)
void EndComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void SizeHandles()
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void Rotate(int X, int Y, const double *p1, const double *p2, const double *vpn)
vtkSphereSource ** HandleGeometry
virtual void GetTransform(vtkTransform *t)
Retrieve a linear transform characterizing the transformation of the box.
vtkDoubleArray * PlaneNormals
void SetTwoPlaneMode(bool)
In two plane mode only the X planes are shown this is useful for defining thick slabs.
void WidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkProperty * SelectedOutlineProperty
void OutlineCursorWiresOn()
Control the representation of the outline.
virtual void ComputeNormals()
void HighlightOutline(int highlight)
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that define the box widget.
void UpdatePose(const double *p1, const double *d1, const double *p2, const double *d2)
vtkProperty * SelectedHandleProperty
void MovePlusXFace(const double *p1, const double *p2)
vtkPolyDataMapper * HexMapper
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting, and required by, the rendering process.
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
void StepForward()
For complex events should we snap orientations to be aligned with the x y z axes.
vtkPolyDataMapper ** HandleMapper
void SetInteractionState(int state)
The interaction state may be set from a widget (e.g., vtkBoxWidget2) or other object.
virtual void HandlesOn()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
void SetOutlineFaceWires(int)
Control the representation of the outline.
~vtkBoxRepresentation() override
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
These are methods that satisfy vtkWidgetRepresentation's API.
void OutlineFaceWiresOff()
Control the representation of the outline.
virtual void CreateDefaultProperties()
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
These are methods that satisfy vtkWidgetRepresentation's API.
void PlaceWidget(double bounds[6]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting, and required by, the rendering process.
virtual void Scale(const double *p1, const double *p2, int X, int Y)
double * GetBounds() override
These are methods that satisfy vtkWidgetRepresentation's API.
static vtkBoxRepresentation * New()
Instantiate the class.
void MoveMinusZFace(const double *p1, const double *p2)
double SnappedEventOrientations[3][4]
implicit function for a bounding box
Definition vtkBox.h:42
ray-cast cell picker for all kinds of Prop3Ds
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition vtkIndent.h:40
create a line defined by two end points
represent and manipulate 4x4 transformation matrices
perform various plane computations
Definition vtkPlane.h:37
implicit function for convex set of planes
Definition vtkPlanes.h:53
represent the position of a point in 3D space
represent and manipulate 3D points
Definition vtkPoints.h:40
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:91
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:68
platform-independent render window interaction including picking and frame rate control.
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:56
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_SIZEHINT(...)