VTK  9.7.1
vtkBoundedWidgetRepresentation.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
19 #ifndef vtkBoundedWidgetRepresentation_h
20 #define vtkBoundedWidgetRepresentation_h
21 
22 #include "vtkInteractionWidgetsModule.h" // For export macro
23 #include "vtkNew.h"
25 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 
29 class vtkActor;
30 class vtkImageData;
31 class vtkOutlineFilter;
32 class vtkPolyDataMapper;
33 class vtkProperty;
34 
35 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkBoundedWidgetRepresentation
37 {
38 public:
40 
44  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
53  vtkSetMacro(OutlineTranslation, bool);
55  vtkGetMacro(OutlineTranslation, bool);
56  vtkBooleanMacro(OutlineTranslation, bool);
58 
64  vtkSetMacro(OutsideBounds, bool);
66  vtkGetMacro(OutsideBounds, bool);
67  vtkBooleanMacro(OutsideBounds, bool);
69 
75  vtkSetMacro(ConstrainToWidgetBounds, bool);
77  vtkGetMacro(ConstrainToWidgetBounds, bool);
78  vtkBooleanMacro(ConstrainToWidgetBounds, bool);
80 
86  vtkGetObjectMacro(OutlineProperty, vtkProperty);
88  vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
90 
92 
98  vtkSetVector6Macro(WidgetBounds, double);
99  vtkGetVector6Macro(WidgetBounds, double);
101 
103 
109  vtkGetMacro(TranslationAxis, int);
110  vtkSetClampMacro(TranslationAxis, int, -1, 2);
112 
114 
118  void SetXTranslationAxisOn() { this->SetTranslationAxis(Axis::XAxis); }
119  void SetYTranslationAxisOn() { this->SetTranslationAxis(Axis::YAxis); }
120  void SetZTranslationAxisOn() { this->SetTranslationAxis(Axis::ZAxis); }
121  void SetTranslationAxisOff() { this->SetTranslationAxis(Axis::NONE); }
123 
124 protected:
126  ~vtkBoundedWidgetRepresentation() override;
127 
128  vtkActor* GetOutlineActor() { return this->OutlineActor; }
129 
135  void HighlightOutline(int highlight);
136 
142  void TranslateOutline(double* p1, double* p2);
143 
149  virtual void TranslateRepresentation(const vtkVector3d&) {};
150 
156  bool IsTranslationConstrained() { return this->TranslationAxis != Axis::NONE; }
157 
161  double GetDiagonalLength();
162 
166  void SetOutlineBounds(double bounds[6]);
168  void GetOutlineBounds(double bounds[6]);
170 
175  void TransformBounds(vtkTransform* transform);
176 
182  void UpdateCenterAndBounds(double center[6]);
183 
187  virtual void CreateDefaultProperties();
188 
192  void SetOutlineColor(double r, double g, double b);
194  void SetSelectedOutlineColor(double r, double g, double b);
196 
200  void UpdateOutline();
201 
202  vtkImageData* GetBox() { return this->Box; }
203 
204 private:
206  void operator=(const vtkBoundedWidgetRepresentation&) = delete;
207 
211  void UpdateWidgetBounds();
212 
214  vtkNew<vtkOutlineFilter> Outline;
215  vtkNew<vtkPolyDataMapper> OutlineMapper;
216  vtkNew<vtkActor> OutlineActor;
217 
218  vtkNew<vtkProperty> OutlineProperty;
219  vtkNew<vtkProperty> SelectedOutlineProperty;
220 
221  bool OutlineTranslation = true;
222  bool OutsideBounds = true;
223  bool ConstrainToWidgetBounds = true;
224 
225  int TranslationAxis = Axis::NONE;
226 
227  double WidgetBounds[6] = { 1, -1, 1, -1, 1, -1 };
228 };
229 
230 VTK_ABI_NAMESPACE_END
231 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
represent surface properties of a geometric object
Definition: vtkProperty.h:59
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
abstract class defines interface between the widget and widget representation classes ...
bool IsTranslationConstrained()
Returns true if Axis is constrained, i.e.
create wireframe outline for an arbitrary data set or composite dataset
void SetZTranslationAxisOn()
Constrains translation on given axis.
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
virtual void TranslateRepresentation(const vtkVector3d &)
Translate the representation, to be implemented in derived class.
map vtkPolyData to graphics primitives
void SetTranslationAxisOff()
Constrains translation on given axis.
Extends the vtkWidgetRepresentation to help positioning widget in space and how it should be displaye...
#define VTK_MARSHALAUTO
void SetYTranslationAxisOn()
Constrains translation on given axis.
void SetXTranslationAxisOn()
Constrains translation on given axis.