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=========================================================================*/
117#ifndef vtkBoxWidget_h
118#define vtkBoxWidget_h
119
120#include "vtk3DWidget.h"
121#include "vtkInteractionWidgetsModule.h" // For export macro
122
123class vtkActor;
124class vtkCellPicker;
125class vtkPlanes;
126class vtkPoints;
127class vtkPolyData;
129class vtkProp;
130class vtkProperty;
131class vtkSphereSource;
132class vtkTransform;
133
134class VTKINTERACTIONWIDGETS_EXPORT vtkBoxWidget : public vtk3DWidget
135{
136public:
140 static vtkBoxWidget* New();
141
142 vtkTypeMacro(vtkBoxWidget, vtk3DWidget);
143 void PrintSelf(ostream& os, vtkIndent indent) override;
144
146
149 void SetEnabled(int) override;
150 void PlaceWidget(double bounds[6]) override;
151 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
153 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
154 {
155 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
156 }
158
167 void GetPlanes(vtkPlanes* planes);
168
170
175 vtkSetMacro(InsideOut, vtkTypeBool);
176 vtkGetMacro(InsideOut, vtkTypeBool);
177 vtkBooleanMacro(InsideOut, vtkTypeBool);
179
187 virtual void GetTransform(vtkTransform* t);
188
195 virtual void SetTransform(vtkTransform* t);
196
208
210
215 vtkGetObjectMacro(HandleProperty, vtkProperty);
216 vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
218
220
224 void HandlesOn();
227
229
234 vtkGetObjectMacro(FaceProperty, vtkProperty);
235 vtkGetObjectMacro(SelectedFaceProperty, vtkProperty);
237
239
244 vtkGetObjectMacro(OutlineProperty, vtkProperty);
245 vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
247
249
254 vtkGetMacro(OutlineFaceWires, int);
255 void OutlineFaceWiresOn() { this->SetOutlineFaceWires(1); }
256 void OutlineFaceWiresOff() { this->SetOutlineFaceWires(0); }
258
260
266 vtkGetMacro(OutlineCursorWires, int);
267 void OutlineCursorWiresOn() { this->SetOutlineCursorWires(1); }
268 void OutlineCursorWiresOff() { this->SetOutlineCursorWires(0); }
270
272
276 vtkSetMacro(TranslationEnabled, vtkTypeBool);
277 vtkGetMacro(TranslationEnabled, vtkTypeBool);
278 vtkBooleanMacro(TranslationEnabled, vtkTypeBool);
279 vtkSetMacro(ScalingEnabled, vtkTypeBool);
280 vtkGetMacro(ScalingEnabled, vtkTypeBool);
281 vtkBooleanMacro(ScalingEnabled, vtkTypeBool);
282 vtkSetMacro(RotationEnabled, vtkTypeBool);
283 vtkGetMacro(RotationEnabled, vtkTypeBool);
284 vtkBooleanMacro(RotationEnabled, vtkTypeBool);
286
287protected:
289 ~vtkBoxWidget() override;
290
291 // Manage the state of the widget
292 int State;
294 {
295 Start = 0,
298 Outside
299 };
300
301 // Handles the events
302 static void ProcessEvents(
303 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
304
305 // ProcessEvents() dispatches to these methods.
306 virtual void OnMouseMove();
307 virtual void OnLeftButtonDown();
308 virtual void OnLeftButtonUp();
309 virtual void OnMiddleButtonDown();
310 virtual void OnMiddleButtonUp();
311 virtual void OnRightButtonDown();
312 virtual void OnRightButtonUp();
313
314 // the hexahedron (6 faces)
318 vtkPoints* Points; // used by others as well
319 double N[6][3]; // the normals of the faces
320
321 // A face of the hexahedron
325
326 // glyphs representing hot spots (e.g., handles)
330 virtual void PositionHandles();
331 int HighlightHandle(vtkProp* prop); // returns cell id
332 void HighlightFace(int cellId);
333 void HighlightOutline(int highlight);
335 void SizeHandles() override;
336
337 // wireframe outline
341
342 // Do the picking
347
348 // Register internal Pickers within PickingManager
349 void RegisterPickers() override;
350
351 // Methods to manipulate the hexahedron.
352 virtual void Translate(double* p1, double* p2);
353 virtual void Scale(double* p1, double* p2, int X, int Y);
354 virtual void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
355 void MovePlusXFace(double* p1, double* p2);
356 void MoveMinusXFace(double* p1, double* p2);
357 void MovePlusYFace(double* p1, double* p2);
358 void MoveMinusYFace(double* p1, double* p2);
359 void MovePlusZFace(double* p1, double* p2);
360 void MoveMinusZFace(double* p1, double* p2);
361
362 //"dir" is the direction in which the face can be moved i.e. the axis passing
363 // through the center
364 void MoveFace(double* p1, double* p2, double* dir, double* x1, double* x2, double* x3, double* x4,
365 double* x5);
366 // Helper method to obtain the direction in which the face is to be moved.
367 // Handles special cases where some of the scale factors are 0.
368 void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3]);
369
370 // Transform the hexahedral points (used for rotations)
372
373 // Properties used to control the appearance of selected objects and
374 // the manipulator in general.
382
383 // Control the orientation of the normals
388
389 // Control whether scaling, rotation, and translation are supported
393
394private:
395 vtkBoxWidget(const vtkBoxWidget&) = delete;
396 void operator=(const vtkBoxWidget&) = delete;
397};
398
399#endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:68
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
orthogonal hexahedron 3D widget
Definition: vtkBoxWidget.h:135
virtual void OnLeftButtonDown()
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
Definition: vtkBoxWidget.h:152
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.
Definition: vtkBoxWidget.h:268
void PlaceWidget() override
Methods that satisfy the superclass' API.
Definition: vtkBoxWidget.h:151
virtual void Scale(double *p1, double *p2, int X, int Y)
vtkTypeBool ScalingEnabled
Definition: vtkBoxWidget.h:391
vtkPolyData * HexPolyData
Definition: vtkBoxWidget.h:317
void CreateDefaultProperties()
vtkPolyData * HexFacePolyData
Definition: vtkBoxWidget.h:324
virtual void Translate(double *p1, double *p2)
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
vtkActor * HexOutline
Definition: vtkBoxWidget.h:338
void ComputeNormals()
~vtkBoxWidget() override
void HighlightOutline(int highlight)
vtkSphereSource ** HandleGeometry
Definition: vtkBoxWidget.h:329
vtkTransform * Transform
Definition: vtkBoxWidget.h:371
vtkProperty * SelectedFaceProperty
Definition: vtkBoxWidget.h:378
vtkCellPicker * HandlePicker
Definition: vtkBoxWidget.h:343
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
Definition: vtkBoxWidget.h:375
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
virtual void OnRightButtonUp()
void OutlineCursorWiresOn()
Control the representation of the outline.
Definition: vtkBoxWidget.h:267
void MovePlusYFace(double *p1, double *p2)
vtkCellPicker * HexPicker
Definition: vtkBoxWidget.h:344
vtkPolyDataMapper * HexMapper
Definition: vtkBoxWidget.h:316
virtual void OnMiddleButtonDown()
vtkPoints * Points
Definition: vtkBoxWidget.h:318
int OutlineCursorWires
Definition: vtkBoxWidget.h:386
void GetDirection(const double Nx[3], const double Ny[3], const double Nz[3], double dir[3])
vtkTypeBool RotationEnabled
Definition: vtkBoxWidget.h:392
void HandlesOn()
Switches handles (the spheres) on or off by manipulating the actor visibility.
int OutlineFaceWires
Definition: vtkBoxWidget.h:385
void SetOutlineFaceWires(int)
Control the representation of the outline.
vtkTypeBool InsideOut
Definition: vtkBoxWidget.h:384
vtkTypeBool TranslationEnabled
Definition: vtkBoxWidget.h:390
vtkPolyDataMapper * HexFaceMapper
Definition: vtkBoxWidget.h:323
int HighlightHandle(vtkProp *prop)
static vtkBoxWidget * New()
Instantiate the object.
vtkActor * HexActor
Definition: vtkBoxWidget.h:315
vtkProperty * OutlineProperty
Definition: vtkBoxWidget.h:379
vtkActor ** Handle
Definition: vtkBoxWidget.h:327
void OutlineFaceWiresOn()
Control the representation of the outline.
Definition: vtkBoxWidget.h:255
vtkPolyData * OutlinePolyData
Definition: vtkBoxWidget.h:340
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
Definition: vtkBoxWidget.h:377
vtkActor * HexFace
Definition: vtkBoxWidget.h:322
void OutlineFaceWiresOff()
Control the representation of the outline.
Definition: vtkBoxWidget.h:256
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
Definition: vtkBoxWidget.h:376
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
Definition: vtkBoxWidget.h:339
vtkProperty * SelectedOutlineProperty
Definition: vtkBoxWidget.h:380
vtkPolyDataMapper ** HandleMapper
Definition: vtkBoxWidget.h:328
vtkActor * CurrentHandle
Definition: vtkBoxWidget.h:345
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:119
abstract base class for most VTK objects
Definition: vtkObject.h:79
implicit function for convex set of planes
Definition: vtkPlanes.h:162
represent and manipulate 3D points
Definition: vtkPoints.h:149
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:73
represent surface properties of a geometric object
Definition: vtkProperty.h:177
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
@ dir
Definition: vtkX3D.h:330
int vtkTypeBool
Definition: vtkABI.h:69