VTK  9.5.20250802
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
27VTK_ABI_NAMESPACE_BEGIN
28
29class vtkActor;
30class vtkImageData;
33class vtkProperty;
34
35class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkBoundedWidgetRepresentation
37{
38public:
40
44 void PrintSelf(ostream& os, vtkIndent indent) override;
46
54 vtkSetMacro(OutlineTranslation, bool);
55 vtkGetMacro(OutlineTranslation, bool);
56 vtkBooleanMacro(OutlineTranslation, bool);
58
65 vtkSetMacro(OutsideBounds, bool);
66 vtkGetMacro(OutsideBounds, bool);
67 vtkBooleanMacro(OutsideBounds, bool);
69
76 vtkSetMacro(ConstrainToWidgetBounds, bool);
77 vtkGetMacro(ConstrainToWidgetBounds, bool);
78 vtkBooleanMacro(ConstrainToWidgetBounds, bool);
80
87 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
124protected:
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
162
167 void SetOutlineBounds(double bounds[6]);
168 void GetOutlineBounds(double bounds[6]);
170
176
182 void UpdateCenterAndBounds(double center[6]);
183
188
193 void SetOutlineColor(double r, double g, double b);
194 void SetSelectedOutlineColor(double r, double g, double b);
196
201
202 vtkImageData* GetBox() { return this->Box; }
203
204private:
206 void operator=(const vtkBoundedWidgetRepresentation&) = delete;
207
211 void UpdateWidgetBounds();
212
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
230VTK_ABI_NAMESPACE_END
231#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
Extends the vtkWidgetRepresentation to help positioning widget in space and how it should be displaye...
void SetOutlineBounds(double bounds[6])
Set/Get the outline bounds.
void SetTranslationAxisOff()
Constrains translation on given axis.
void HighlightOutline(int highlight)
Switch between outline properties depending on highlight.
virtual void CreateDefaultProperties()
Create and initialize properties with default values.
void TranslateOutline(double *p1, double *p2)
Translate outline from point p1 to point p2.
double GetDiagonalLength()
 Return the Outline diagonal length.
virtual void TranslateRepresentation(const vtkVector3d &)
Translate the representation, to be implemented in derived class.
void SetXTranslationAxisOn()
Constrains translation on given axis.
void TransformBounds(vtkTransform *transform)
Transform the current outline bounds using given transform.
void SetYTranslationAxisOn()
Constrains translation on given axis.
void SetSelectedOutlineColor(double r, double g, double b)
Set the default colors for outline.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
bool IsTranslationConstrained()
Returns true if Axis is constrained, i.e.
void UpdateCenterAndBounds(double center[6])
Modify Center argument to clamp it into bounds, if required.
~vtkBoundedWidgetRepresentation() override
void UpdateOutline()
 Ensure outline is up to date.
void SetZTranslationAxisOn()
Constrains translation on given axis.
void GetOutlineBounds(double bounds[6])
Set/Get the outline bounds.
void SetOutlineColor(double r, double g, double b)
Set the default colors for outline.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
Allocate and hold a VTK object.
Definition vtkNew.h:167
create wireframe outline for an arbitrary data set or composite dataset
map vtkPolyData to graphics primitives
represent surface properties of a geometric object
describes linear transformations via a 4x4 matrix
abstract class defines interface between the widget and widget representation classes
#define VTK_MARSHALAUTO