VTK  9.4.20250114
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
26VTK_ABI_NAMESPACE_BEGIN
27
28class vtkActor;
29class vtkImageData;
32class vtkProperty;
33
34class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkBoundedWidgetRepresentation
36{
37public:
39
43 void PrintSelf(ostream& os, vtkIndent indent) override;
45
53 vtkSetMacro(OutlineTranslation, bool);
54 vtkGetMacro(OutlineTranslation, bool);
55 vtkBooleanMacro(OutlineTranslation, bool);
57
64 vtkSetMacro(OutsideBounds, bool);
65 vtkGetMacro(OutsideBounds, bool);
66 vtkBooleanMacro(OutsideBounds, bool);
68
75 vtkSetMacro(ConstrainToWidgetBounds, bool);
76 vtkGetMacro(ConstrainToWidgetBounds, bool);
77 vtkBooleanMacro(ConstrainToWidgetBounds, bool);
79
86 vtkGetObjectMacro(OutlineProperty, vtkProperty);
87 vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
89
91
97 vtkSetVector6Macro(WidgetBounds, double);
98 vtkGetVector6Macro(WidgetBounds, double);
100
102
108 vtkGetMacro(TranslationAxis, int);
109 vtkSetClampMacro(TranslationAxis, int, -1, 2);
111
113
117 void SetXTranslationAxisOn() { this->SetTranslationAxis(Axis::XAxis); }
118 void SetYTranslationAxisOn() { this->SetTranslationAxis(Axis::YAxis); }
119 void SetZTranslationAxisOn() { this->SetTranslationAxis(Axis::ZAxis); }
120 void SetTranslationAxisOff() { this->SetTranslationAxis(Axis::NONE); }
122
123protected:
126
127 vtkActor* GetOutlineActor() { return this->OutlineActor; }
128
134 void HighlightOutline(int highlight);
135
141 void TranslateOutline(double* p1, double* p2);
142
148 virtual void TranslateRepresentation(const vtkVector3d&){};
149
155 bool IsTranslationConstrained() { return this->TranslationAxis != Axis::NONE; }
156
161
166 void SetOutlineBounds(double bounds[6]);
167 void GetOutlineBounds(double bounds[6]);
169
175
181 void UpdateCenterAndBounds(double center[6]);
182
187
192 void SetOutlineColor(double r, double g, double b);
193 void SetSelectedOutlineColor(double r, double g, double b);
195
200
201 vtkImageData* GetBox() { return this->Box; }
202
203private:
205 void operator=(const vtkBoundedWidgetRepresentation&) = delete;
206
210 void UpdateWidgetBounds();
211
214 vtkNew<vtkPolyDataMapper> OutlineMapper;
215 vtkNew<vtkActor> OutlineActor;
216
217 vtkNew<vtkProperty> OutlineProperty;
218 vtkNew<vtkProperty> SelectedOutlineProperty;
219
220 bool OutlineTranslation = true;
221 bool OutsideBounds = true;
222 bool ConstrainToWidgetBounds = true;
223
224 int TranslationAxis = Axis::NONE;
225
226 double WidgetBounds[6] = { 1, -1, 1, -1, 1, -1 };
227};
228
229VTK_ABI_NAMESPACE_END
230#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