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=========================================================================*/
35
36#ifndef vtkBoxRepresentation_h
37#define vtkBoxRepresentation_h
38
39#include "vtkInteractionWidgetsModule.h" // For export macro
41
42class vtkActor;
44class vtkLineSource;
45class vtkSphereSource;
46class vtkCellPicker;
47class vtkProperty;
48class vtkPolyData;
49class vtkPoints;
52class vtkTransform;
53class vtkPlane;
54class vtkPlanes;
55class vtkBox;
56class vtkDoubleArray;
57class vtkMatrix4x4;
58
59class VTKINTERACTIONWIDGETS_EXPORT vtkBoxRepresentation : public vtkWidgetRepresentation
60{
61public:
66
68
72 void PrintSelf(ostream& os, vtkIndent indent) override;
74
83 void GetPlanes(vtkPlanes* planes);
84
85 // Get the underlying planes used by this rep
86 // this can be used as a cropping planes in vtkMapper
87 vtkPlane* GetUnderlyingPlane(int i) { return this->Planes[i]; }
88
90
96 vtkSetMacro(InsideOut, vtkTypeBool);
97 vtkGetMacro(InsideOut, vtkTypeBool);
98 vtkBooleanMacro(InsideOut, vtkTypeBool);
100
108 virtual void GetTransform(vtkTransform* t);
109
116 virtual void SetTransform(vtkTransform* t);
117
129
131
136 vtkGetObjectMacro(HandleProperty, vtkProperty);
139
141
146 vtkGetObjectMacro(FaceProperty, vtkProperty);
149
151
156 vtkGetObjectMacro(OutlineProperty, vtkProperty);
159
161
166 vtkGetMacro(OutlineFaceWires, int);
170
172
178 vtkGetMacro(OutlineCursorWires, int);
182
184
188 virtual void HandlesOn();
189 virtual void HandlesOff();
191
193
196 void PlaceWidget(double bounds[6]) override;
197 void BuildRepresentation() override;
198 int ComputeInteractionState(int X, int Y, int modify = 0) override;
199 void StartWidgetInteraction(double e[2]) override;
200 void WidgetInteraction(double e[2]) override;
201 double* GetBounds() VTK_SIZEHINT(6) override;
203 unsigned long event, void* calldata) override;
205 unsigned long event, void* calldata) override;
207 unsigned long event, void* calldata, int modify = 0) override;
209 unsigned long event, void* calldata) override;
211
213
221
222 // Used to manage the state of the widget
223 enum
224 {
235 };
236
246 void SetInteractionState(int state);
247
249
253 vtkGetMacro(TwoPlaneMode, bool);
254 void SetTwoPlaneMode(bool);
256
258
262 vtkGetMacro(SnapToAxes, bool);
263 vtkSetMacro(SnapToAxes, bool);
265
267
274
275 /*
276 * Register internal Pickers within PickingManager
277 */
278 void RegisterPickers() override;
279
281
285 vtkGetMacro(TranslationAxis, int);
286 vtkSetClampMacro(TranslationAxis, int, -1, 2);
288
290
298
300
305
312
313protected:
316
317 // Manage how the representation appears
324
326
327 // Constraint axis translation
329
330 // the hexahedron (6 faces)
334 vtkPoints* Points; // used by others as well
335 double N[6][3]; // the normals of the faces
336
337 // A face of the hexahedron
341
342 // glyphs representing hot spots (e.g., handles)
346 virtual void PositionHandles();
347 int HighlightHandle(vtkProp* prop); // returns cell id
348 void HighlightFace(int cellId);
349 void HighlightOutline(int highlight);
350 virtual void ComputeNormals();
351 virtual void SizeHandles();
352
353 // wireframe outline
357
358 // Do the picking
364
365 // Transform the hexahedral points (used for rotations)
367
368 // Support GetBounds() method
370
371 // Properties used to control the appearance of selected objects and
372 // the manipulator in general.
380
381 // Control the orientation of the normals
386
387 // Helper methods
388 virtual void Translate(const double* p1, const double* p2);
389 virtual void Scale(const double* p1, const double* p2, int X, int Y);
390 virtual void Rotate(int X, int Y, const double* p1, const double* p2, const double* vpn);
391 void MovePlusXFace(const double* p1, const double* p2);
392 void MoveMinusXFace(const double* p1, const double* p2);
393 void MovePlusYFace(const double* p1, const double* p2);
394 void MoveMinusYFace(const double* p1, const double* p2);
395 void MovePlusZFace(const double* p1, const double* p2);
396 void MoveMinusZFace(const double* p1, const double* p2);
397 void UpdatePose(const double* p1, const double* d1, const double* p2, const double* d2);
398
399 // Internal ivars for performance
403
404 // The actual planes which are being manipulated
406
407 //"dir" is the direction in which the face can be moved i.e. the axis passing
408 // through the center
409 void MoveFace(const double* p1, const double* p2, const double* dir, double* x1, double* x2,
410 double* x3, double* x4, double* x5);
411 // Helper method to obtain the direction in which the face is to be moved.
412 // Handles special cases where some of the scale factors are 0.
413 void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3]);
414
415private:
417 void operator=(const vtkBoxRepresentation&) = delete;
418};
419
420#endif
define the API for widget / widget representation
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:46
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:39
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:34
create a line defined by two end points
represent and manipulate 4x4 transformation matrices
perform various plane computations
Definition vtkPlane.h:34
implicit function for convex set of planes
Definition vtkPlanes.h:50
represent the position of a point in 3D space
represent and manipulate 3D points
Definition vtkPoints.h:34
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:85
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:62
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:50
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_SIZEHINT(...)