VTK  9.7.1
vtkBoxWidget2.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
87 #ifndef vtkBoxWidget2_h
88 #define vtkBoxWidget2_h
89 
90 #include "vtkAbstractWidget.h"
91 #include "vtkBoxRepresentation.h"
92 #include "vtkInteractionWidgetsModule.h" // For export macro
93 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
94 
95 VTK_ABI_NAMESPACE_BEGIN
97 class vtkHandleWidget;
98 
99 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkBoxWidget2 : public vtkAbstractWidget
100 {
101 public:
105  static vtkBoxWidget2* New();
106 
108 
112  void PrintSelf(ostream& os, vtkIndent indent) override;
114 
121  {
122  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
123  }
124 
126 
134  vtkSetMacro(TranslationEnabled, vtkTypeBool);
135  vtkGetMacro(TranslationEnabled, vtkTypeBool);
136  vtkBooleanMacro(TranslationEnabled, vtkTypeBool);
137  vtkSetMacro(ScalingEnabled, vtkTypeBool);
138  vtkGetMacro(ScalingEnabled, vtkTypeBool);
139  vtkBooleanMacro(ScalingEnabled, vtkTypeBool);
140  vtkSetMacro(RotationEnabled, vtkTypeBool);
141  vtkGetMacro(RotationEnabled, vtkTypeBool);
142  vtkBooleanMacro(RotationEnabled, vtkTypeBool);
143  vtkSetMacro(MoveFacesEnabled, vtkTypeBool);
144  vtkGetMacro(MoveFacesEnabled, vtkTypeBool);
145  vtkBooleanMacro(MoveFacesEnabled, vtkTypeBool);
147 
152  void CreateDefaultRepresentation() override;
153 
158  void SetEnabled(int enabling) override;
159 
161 
166  void SetRotationAxisMode(int mode);
167  int GetRotationAxisMode();
168  void SetRotationAxisModeToFree() { this->SetRotationAxisMode(vtkBoxRepresentation::ROTATE_FREE); }
169  void SetRotationAxisModeToX() { this->SetRotationAxisMode(vtkBoxRepresentation::ROTATE_X); }
170  void SetRotationAxisModeToY() { this->SetRotationAxisMode(vtkBoxRepresentation::ROTATE_Y); }
171  void SetRotationAxisModeToZ() { this->SetRotationAxisMode(vtkBoxRepresentation::ROTATE_Z); }
173 
174 protected:
175  vtkBoxWidget2();
176  ~vtkBoxWidget2() override;
177 
178  // Manage the state of the widget
181  {
182  Start = 0,
183  Active
184  };
185 
186  // These methods handle events
187  static void SelectAction(vtkAbstractWidget*);
188  static void EndSelectAction(vtkAbstractWidget*);
189  static void TranslateAction(vtkAbstractWidget*);
190  static void ScaleAction(vtkAbstractWidget*);
191  static void MoveAction(vtkAbstractWidget*);
192  static void SelectAction3D(vtkAbstractWidget*);
193  static void EndSelectAction3D(vtkAbstractWidget*);
194  static void MoveAction3D(vtkAbstractWidget*);
195  static void StepAction3D(vtkAbstractWidget*);
196 
197  // Control whether scaling, rotation, and translation are supported
202 
204  static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
205 
206 private:
207  vtkBoxWidget2(const vtkBoxWidget2&) = delete;
208  void operator=(const vtkBoxWidget2&) = delete;
209 };
210 
211 VTK_ABI_NAMESPACE_END
212 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
vtkCallbackCommand * KeyEventCallbackCommand
vtkTypeBool ScalingEnabled
a class defining the representation for the vtkBoxWidget2
a general widget for moving handles
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
void SetRepresentation(vtkBoxRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...
int vtkTypeBool
Definition: vtkABI.h:64
void SetRotationAxisModeToX()
Get/Set the rotation mode of the box.
supports function callbacks
void SetRotationAxisModeToZ()
Get/Set the rotation mode of the box.
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetRotationAxisModeToY()
Get/Set the rotation mode of the box.
3D widget for manipulating a box
Definition: vtkBoxWidget2.h:99
define the API for widget / widget representation
void SetRotationAxisModeToFree()
Get/Set the rotation mode of the box.
vtkTypeBool TranslationEnabled
void SetEnabled(int) override
Methods for activating this widget.
vtkTypeBool MoveFacesEnabled
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkTypeBool RotationEnabled