VTK  9.2.6
vtkBoxWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkBoxWidget.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=========================================================================*/
80
81#ifndef vtkBoxWidget_h
82#define vtkBoxWidget_h
83
84#include "vtk3DWidget.h"
85#include "vtkInteractionWidgetsModule.h" // For export macro
86
87class vtkActor;
88class vtkCellPicker;
89class vtkPlanes;
90class vtkPoints;
91class vtkPolyData;
93class vtkProp;
94class vtkProperty;
95class vtkSphereSource;
96class vtkTransform;
97
98class VTKINTERACTIONWIDGETS_EXPORT vtkBoxWidget : public vtk3DWidget
99{
100public:
104 static vtkBoxWidget* New();
105
106 vtkTypeMacro(vtkBoxWidget, vtk3DWidget);
107 void PrintSelf(ostream& os, vtkIndent indent) override;
108
110
113 void SetEnabled(int) override;
114 void PlaceWidget(double bounds[6]) override;
115 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
117 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
118 {
119 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
120 }
121
122
131 void GetPlanes(vtkPlanes* planes);
132
134
139 vtkSetMacro(InsideOut, vtkTypeBool);
140 vtkGetMacro(InsideOut, vtkTypeBool);
141 vtkBooleanMacro(InsideOut, vtkTypeBool);
143
151 virtual void GetTransform(vtkTransform* t);
152
159 virtual void SetTransform(vtkTransform* t);
160
172
174
179 vtkGetObjectMacro(HandleProperty, vtkProperty);
182
184
188 void HandlesOn();
191
193
198 vtkGetObjectMacro(FaceProperty, vtkProperty);
201
203
208 vtkGetObjectMacro(OutlineProperty, vtkProperty);
211
213
218 vtkGetMacro(OutlineFaceWires, int);
222
224
230 vtkGetMacro(OutlineCursorWires, int);
234
236
245 vtkBooleanMacro(ScalingEnabled, vtkTypeBool);
248 vtkBooleanMacro(RotationEnabled, vtkTypeBool);
250
251protected:
253 ~vtkBoxWidget() override;
254
255 // Manage the state of the widget
256 int State;
264
265 // Handles the events
266 static void ProcessEvents(
267 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
268
269 // ProcessEvents() dispatches to these methods.
270 virtual void OnMouseMove();
271 virtual void OnLeftButtonDown();
272 virtual void OnLeftButtonUp();
273 virtual void OnMiddleButtonDown();
274 virtual void OnMiddleButtonUp();
275 virtual void OnRightButtonDown();
276 virtual void OnRightButtonUp();
277
278 // the hexahedron (6 faces)
282 vtkPoints* Points; // used by others as well
283 double N[6][3]; // the normals of the faces
284
285 // A face of the hexahedron
289
290 // glyphs representing hot spots (e.g., handles)
294 virtual void PositionHandles();
295 int HighlightHandle(vtkProp* prop); // returns cell id
296 void HighlightFace(int cellId);
297 void HighlightOutline(int highlight);
299 void SizeHandles() override;
300
301 // wireframe outline
305
306 // Do the picking
311
312 // Register internal Pickers within PickingManager
313 void RegisterPickers() override;
314
315 // Methods to manipulate the hexahedron.
316 virtual void Translate(double* p1, double* p2);
317 virtual void Scale(double* p1, double* p2, int X, int Y);
318 virtual void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
319 void MovePlusXFace(double* p1, double* p2);
320 void MoveMinusXFace(double* p1, double* p2);
321 void MovePlusYFace(double* p1, double* p2);
322 void MoveMinusYFace(double* p1, double* p2);
323 void MovePlusZFace(double* p1, double* p2);
324 void MoveMinusZFace(double* p1, double* p2);
325
326 //"dir" is the direction in which the face can be moved i.e. the axis passing
327 // through the center
328 void MoveFace(double* p1, double* p2, double* dir, double* x1, double* x2, double* x3, double* x4,
329 double* x5);
330 // Helper method to obtain the direction in which the face is to be moved.
331 // Handles special cases where some of the scale factors are 0.
332 void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3]);
333
334 // Transform the hexahedral points (used for rotations)
336
337 // Properties used to control the appearance of selected objects and
338 // the manipulator in general.
346
347 // Control the orientation of the normals
352
353 // Control whether scaling, rotation, and translation are supported
357
358private:
359 vtkBoxWidget(const vtkBoxWidget&) = delete;
360 void operator=(const vtkBoxWidget&) = delete;
361};
362
363#endif
virtual void PlaceWidget(double bounds[6])=0
This method is used to initially place the widget.
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:52
virtual void OnLeftButtonDown()
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
virtual void PositionHandles()
void SetOutlineCursorWires(int)
Control the representation of the outline.
void GenerateOutline()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void OutlineCursorWiresOff()
Control the representation of the outline.
void PlaceWidget() override
Methods that satisfy the superclass' API.
virtual void Scale(double *p1, double *p2, int X, int Y)
vtkTypeBool ScalingEnabled
vtkPolyData * HexPolyData
void CreateDefaultProperties()
vtkPolyData * HexFacePolyData
virtual void Translate(double *p1, double *p2)
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
vtkActor * HexOutline
void ComputeNormals()
~vtkBoxWidget() override
void HighlightOutline(int highlight)
vtkSphereSource ** HandleGeometry
vtkTransform * Transform
vtkProperty * SelectedFaceProperty
vtkCellPicker * HandlePicker
virtual void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
void SetEnabled(int) override
Methods that satisfy the superclass' API.
void MoveFace(double *p1, double *p2, double *dir, double *x1, double *x2, double *x3, double *x4, double *x5)
vtkProperty * HandleProperty
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
virtual void OnRightButtonUp()
void OutlineCursorWiresOn()
Control the representation of the outline.
void MovePlusYFace(double *p1, double *p2)
double N[6][3]
vtkCellPicker * HexPicker
vtkPolyDataMapper * HexMapper
virtual void OnMiddleButtonDown()
vtkPoints * Points
void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3])
vtkTypeBool RotationEnabled
void HandlesOn()
Switches handles (the spheres) on or off by manipulating the actor visibility.
void SetOutlineFaceWires(int)
Control the representation of the outline.
vtkTypeBool InsideOut
vtkTypeBool TranslationEnabled
vtkPolyDataMapper * HexFaceMapper
int HighlightHandle(vtkProp *prop)
static vtkBoxWidget * New()
Instantiate the object.
vtkActor * HexActor
vtkProperty * OutlineProperty
vtkActor ** Handle
void OutlineFaceWiresOn()
Control the representation of the outline.
vtkPolyData * OutlinePolyData
void MoveMinusXFace(double *p1, double *p2)
void MovePlusXFace(double *p1, double *p2)
virtual void GetTransform(vtkTransform *t)
Retrieve a linear transform characterizing the transformation of the box.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
vtkProperty * FaceProperty
vtkActor * HexFace
void OutlineFaceWiresOff()
Control the representation of the outline.
void MoveMinusZFace(double *p1, double *p2)
virtual void SetTransform(vtkTransform *t)
Set the position, scale and orientation of the box widget using the transform specified.
virtual void OnLeftButtonUp()
void MovePlusZFace(double *p1, double *p2)
virtual void OnRightButtonDown()
virtual void OnMiddleButtonUp()
void HandlesOff()
Switches handles (the spheres) on or off by manipulating the actor visibility.
vtkProperty * SelectedHandleProperty
void MoveMinusYFace(double *p1, double *p2)
virtual void OnMouseMove()
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that define the box widget.
void SizeHandles() override
vtkPolyDataMapper * OutlineMapper
vtkProperty * SelectedOutlineProperty
vtkPolyDataMapper ** HandleMapper
vtkActor * CurrentHandle
void HighlightFace(int cellId)
void GetPlanes(vtkPlanes *planes)
Get the planes describing the implicit function defined by the box widget.
ray-cast cell picker for all kinds of Prop3Ds
a simple class to control print indentation
Definition vtkIndent.h:40
implicit function for convex set of planes
Definition vtkPlanes.h:53
represent and manipulate 3D points
Definition vtkPoints.h:40
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:57
represent surface properties of a geometric object
Definition vtkProperty.h:68
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:69