VTK  9.3.20240419
vtk3DWidget.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
47 #ifndef vtk3DWidget_h
48 #define vtk3DWidget_h
49 
50 #include "vtkInteractionWidgetsModule.h" // For export macro
51 #include "vtkInteractorObserver.h"
52 
53 VTK_ABI_NAMESPACE_BEGIN
54 class vtk3DWidgetConnection;
55 class vtkAlgorithmOutput;
56 class vtkDataSet;
57 class vtkProp3D;
58 
59 class VTKINTERACTIONWIDGETS_EXPORT vtk3DWidget : public vtkInteractorObserver
60 {
61 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
75  virtual void PlaceWidget(double bounds[6]) = 0;
76  virtual void PlaceWidget();
77  virtual void PlaceWidget(
78  double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
80 
82 
87  virtual void SetProp3D(vtkProp3D*);
88  vtkGetObjectMacro(Prop3D, vtkProp3D);
90 
92 
97  virtual void SetInputData(vtkDataSet*);
99  virtual vtkDataSet* GetInput();
101 
103 
110  vtkSetClampMacro(PlaceFactor, double, 0.01, VTK_DOUBLE_MAX);
111  vtkGetMacro(PlaceFactor, double);
113 
115 
121  vtkSetClampMacro(HandleSize, double, 0.001, 0.5);
122  vtkGetMacro(HandleSize, double);
124 
125 protected:
127  ~vtk3DWidget() override;
128 
129  // Used to position and scale the widget initially
131 
132  vtk3DWidgetConnection* ConnectionHolder;
133 
134  // has the widget ever been placed
135  double PlaceFactor;
136  int Placed;
137  void AdjustBounds(double bounds[6], double newBounds[6], double center[3]);
138 
139  // control the size of handles (if there are any)
140  double InitialBounds[6];
142  double HandleSize;
143  double SizeHandles(double factor);
144  virtual void SizeHandles() {} // subclass in turn invokes parent's SizeHandles()
145 
146  // used to track the depth of the last pick; also interacts with handle sizing
148  double LastPickPosition[3];
149 
150  void UpdateInput();
151 
152 private:
153  vtk3DWidget(const vtk3DWidget&) = delete;
154  void operator=(const vtk3DWidget&) = delete;
155 };
156 
157 VTK_ABI_NAMESPACE_END
158 #endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:60
virtual void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
This method is used to initially place the widget.
double PlaceFactor
Definition: vtk3DWidget.h:135
double SizeHandles(double factor)
void AdjustBounds(double bounds[6], double newBounds[6], double center[3])
virtual void SetInputConnection(vtkAlgorithmOutput *)
Specify the input dataset.
void UpdateInput()
virtual void SetProp3D(vtkProp3D *)
Specify a vtkProp3D around which to place the widget.
vtk3DWidgetConnection * ConnectionHolder
Definition: vtk3DWidget.h:132
double InitialLength
Definition: vtk3DWidget.h:141
virtual vtkDataSet * GetInput()
Specify the input dataset.
virtual void PlaceWidget()
This method is used to initially place the widget.
virtual void SetInputData(vtkDataSet *)
Specify the input dataset.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double HandleSize
Definition: vtk3DWidget.h:142
virtual void PlaceWidget(double bounds[6])=0
This method is used to initially place the widget.
virtual void SizeHandles()
Definition: vtk3DWidget.h:144
~vtk3DWidget() override
vtkProp3D * Prop3D
Definition: vtk3DWidget.h:130
Proxy object to connect input/output ports.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
a simple class to control print indentation
Definition: vtkIndent.h:108
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:89
@ center
Definition: vtkX3D.h:230
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154