VTK  9.5.2
vtkBoxWidget.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
97
98#ifndef vtkBoxWidget_h
99#define vtkBoxWidget_h
100
101#include "vtk3DWidget.h"
102#include "vtkInteractionWidgetsModule.h" // For export macro
103
104VTK_ABI_NAMESPACE_BEGIN
105class vtkActor;
106class vtkCellPicker;
107class vtkPlanes;
108class vtkPoints;
109class vtkPolyData;
111class vtkProp;
112class vtkProperty;
113class vtkSphereSource;
114class vtkTransform;
115
116class VTKINTERACTIONWIDGETS_EXPORT vtkBoxWidget : public vtk3DWidget
117{
118public:
122 static vtkBoxWidget* New();
123
124 vtkTypeMacro(vtkBoxWidget, vtk3DWidget);
125 void PrintSelf(ostream& os, vtkIndent indent) override;
126
128
131 void SetEnabled(int) override;
132 void PlaceWidget(double bounds[6]) override;
133 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
135 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
136 {
137 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
138 }
139
140
149 void GetPlanes(vtkPlanes* planes);
150
152
157 vtkSetMacro(InsideOut, vtkTypeBool);
158 vtkGetMacro(InsideOut, vtkTypeBool);
159 vtkBooleanMacro(InsideOut, vtkTypeBool);
161
169 virtual void GetTransform(vtkTransform* t);
170
177 virtual void SetTransform(vtkTransform* t);
178
190
192
197 vtkGetObjectMacro(HandleProperty, vtkProperty);
200
202
206 void HandlesOn();
209
211
216 vtkGetObjectMacro(FaceProperty, vtkProperty);
219
221
226 vtkGetObjectMacro(OutlineProperty, vtkProperty);
229
231
236 vtkGetMacro(OutlineFaceWires, int);
240
242
248 vtkGetMacro(OutlineCursorWires, int);
252
254
263 vtkBooleanMacro(ScalingEnabled, vtkTypeBool);
266 vtkBooleanMacro(RotationEnabled, vtkTypeBool);
268
269protected:
271 ~vtkBoxWidget() override;
272
273 // Manage the state of the widget
274 int State;
282
283 // Handles the events
284 static void ProcessEvents(
285 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
286
287 // ProcessEvents() dispatches to these methods.
288 virtual void OnMouseMove();
289 virtual void OnLeftButtonDown();
290 virtual void OnLeftButtonUp();
291 virtual void OnMiddleButtonDown();
292 virtual void OnMiddleButtonUp();
293 virtual void OnRightButtonDown();
294 virtual void OnRightButtonUp();
295
296 // the hexahedron (6 faces)
300 vtkPoints* Points; // used by others as well
301 double N[6][3]; // the normals of the faces
302
303 // A face of the hexahedron
307
308 // glyphs representing hot spots (e.g., handles)
312 virtual void PositionHandles();
313 int HighlightHandle(vtkProp* prop); // returns cell id
314 void HighlightFace(int cellId);
315 void HighlightOutline(int highlight);
317 void SizeHandles() override;
318
319 // wireframe outline
323
324 // Do the picking
329
330 // Register internal Pickers within PickingManager
331 void RegisterPickers() override;
332
333 // Methods to manipulate the hexahedron.
334 virtual void Translate(double* p1, double* p2);
335 virtual void Scale(double* p1, double* p2, int X, int Y);
336 virtual void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
337 void MovePlusXFace(double* p1, double* p2);
338 void MoveMinusXFace(double* p1, double* p2);
339 void MovePlusYFace(double* p1, double* p2);
340 void MoveMinusYFace(double* p1, double* p2);
341 void MovePlusZFace(double* p1, double* p2);
342 void MoveMinusZFace(double* p1, double* p2);
343
344 //"dir" is the direction in which the face can be moved i.e. the axis passing
345 // through the center
346 void MoveFace(double* p1, double* p2, double* dir, double* x1, double* x2, double* x3, double* x4,
347 double* x5);
348 // Helper method to obtain the direction in which the face is to be moved.
349 // Handles special cases where some of the scale factors are 0.
350 void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3]);
351
352 // Transform the hexahedral points (used for rotations)
354
355 // Properties used to control the appearance of selected objects and
356 // the manipulator in general.
364
365 // Control the orientation of the normals
370
371 // Control whether scaling, rotation, and translation are supported
375
376private:
377 vtkBoxWidget(const vtkBoxWidget&) = delete;
378 void operator=(const vtkBoxWidget&) = delete;
379};
380
381VTK_ABI_NAMESPACE_END
382#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:151
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:108
implicit function for convex set of planes
Definition vtkPlanes.h:151
represent and manipulate 3D points
Definition vtkPoints.h:139
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:63
represent surface properties of a geometric object
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:64