VTK
vtkAbstractPolygonalHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractPolygonalHandleRepresentation3D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
31 #ifndef vtkAbstractPolygonalHandleRepresentation3D_h
32 #define vtkAbstractPolygonalHandleRepresentation3D_h
33 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkProperty;
38 class vtkPolyDataMapper;
39 class vtkCellPicker;
42 class vtkMatrix4x4;
43 class vtkPolyData;
45 class vtkActor;
46 class vtkFollower;
47 class vtkVectorText;
48 
49 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
51 {
52 public:
53 
55 
59  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
63 
66  void SetWorldPosition(double p[3]) override;
67  void SetDisplayPosition(double p[3]) override;
69 
71 
74  void SetHandle( vtkPolyData * );
75  vtkPolyData * GetHandle();
77 
79 
82  void SetProperty(vtkProperty*);
83  void SetSelectedProperty(vtkProperty*);
84  vtkGetObjectMacro(Property,vtkProperty);
85  vtkGetObjectMacro(SelectedProperty,vtkProperty);
87 
92  virtual vtkAbstractTransform * GetTransform();
93 
95 
98  void BuildRepresentation() override;
99  void StartWidgetInteraction(double eventPos[2]) override;
100  void WidgetInteraction(double eventPos[2]) override;
101  int ComputeInteractionState(int X, int Y, int modify=0) override;
103 
105 
108  void ShallowCopy(vtkProp *prop) override;
109  void DeepCopy(vtkProp *prop) override;
110  void GetActors(vtkPropCollection *) override;
111  void ReleaseGraphicsResources(vtkWindow *) override;
112  int RenderOpaqueGeometry(vtkViewport *viewport) override;
113  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
114  int HasTranslucentPolygonalGeometry() override;
115  double *GetBounds() override;
117 
119 
123  vtkSetMacro( LabelVisibility, vtkTypeBool );
124  vtkGetMacro( LabelVisibility, vtkTypeBool );
125  vtkBooleanMacro( LabelVisibility, vtkTypeBool );
126  virtual void SetLabelText( const char * label );
127  virtual char * GetLabelText();
129 
131 
134  virtual void SetLabelTextScale( double scale[3] );
135  void SetLabelTextScale(double x, double y, double z)
136  {
137  double scale[3] = {x, y, z};
138  this->SetLabelTextScale(scale);
139  }
140  virtual double * GetLabelTextScale();
142 
144 
147  vtkGetObjectMacro( LabelTextActor, vtkFollower );
149 
155  virtual void SetUniformScale( double scale );
156 
158 
161  vtkSetMacro( HandleVisibility, vtkTypeBool );
162  vtkGetMacro( HandleVisibility, vtkTypeBool );
163  vtkBooleanMacro( HandleVisibility, vtkTypeBool );
165 
166  void Highlight(int highlight) override;
167 
169 
180  vtkSetMacro( SmoothMotion, vtkTypeBool );
181  vtkGetMacro( SmoothMotion, vtkTypeBool );
182  vtkBooleanMacro( SmoothMotion, vtkTypeBool );
184 
185  /*
186  * Register internal Pickers within PickingManager
187  */
188  void RegisterPickers() override;
189 
190 protected:
193 
200  double LastPickPosition[3];
201  double LastEventPosition[2];
208 
209  // Methods to manipulate the cursor
210  virtual void Translate(double *p1, double *p2);
211  virtual void Scale(double *p1, double *p2, double eventPos[2]);
212  virtual void MoveFocus(double *p1, double *p2);
213 
214  void CreateDefaultProperties();
215 
216  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
217  // world coordinates), the new display position of the handle center is
218  // populated into requestedDisplayPos. This is again only a request for the
219  // new display position. It is up to the point placer to deduce the
220  // appropriate world co-ordinates that this display position will map into.
221  // The placer may even disallow such a movement.
222  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
223  // as the event position, ie the location of the mouse cursor. If its OFF,
224  // incremental offsets as described above are used to compute it.
225  void MoveFocusRequest( double *p1, double *p2,
226  double eventPos[2], double requestedDisplayPos[3] );
227 
228  int DetermineConstraintAxis(int constraint, double *x, double *startPickPos);
229 
239  virtual void UpdateHandle();
240 
244  virtual void UpdateLabel();
245 
246  // Handle the label.
253 
254 private:
256  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&) = delete;
257 };
258 
259 #endif
260 
261 
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:36
vtkAbstractPolygonalHandleRepresentation3D::WaitingForMotion
int WaitingForMotion
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:205
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:136
vtkAbstractPolygonalHandleRepresentation3D::Actor
vtkActor * Actor
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:194
vtkWidgetRepresentation::GetActors
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
Definition: vtkWidgetRepresentation.h:217
vtkFollower
a subclass of actor that always faces the camera
Definition: vtkFollower.h:40
vtkAbstractPolygonalHandleRepresentation3D::HandleVisibility
vtkTypeBool HandleVisibility
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:207
vtkAbstractTransform
superclass for all geometric transformations
Definition: vtkAbstractTransform.h:50
vtkAbstractPolygonalHandleRepresentation3D::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:195
vtkX3D::scale
Definition: vtkX3D.h:229
vtkAbstractPolygonalHandleRepresentation3D::LabelAnnotationTextScaleInitialized
bool LabelAnnotationTextScaleInitialized
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:251
vtkHandleRepresentation::SetWorldPosition
virtual void SetWorldPosition(double pos[3])
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:55
vtkAbstractPolygonalHandleRepresentation3D
represent a user defined handle geometry in 3D while maintaining a fixed orientation w....
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:49
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkHandleRepresentation.h
vtkVectorText
create polygonal text
Definition: vtkVectorText.h:41
vtkAbstractPolygonalHandleRepresentation3D::HandleTransformFilter
vtkTransformPolyDataFilter * HandleTransformFilter
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:196
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkAbstractPolygonalHandleRepresentation3D::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:204
vtkHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWidgetRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:223
vtkWidgetRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkWidgetRepresentation.h:220
vtkAbstractPolygonalHandleRepresentation3D::HandleTransform
vtkMatrixToLinearTransform * HandleTransform
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:197
vtkAbstractPolygonalHandleRepresentation3D::LabelTextActor
vtkFollower * LabelTextActor
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:248
vtkWidgetRepresentation::WidgetInteraction
virtual void WidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:137
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:215
vtkWidgetRepresentation::HasTranslucentPolygonalGeometry
int HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkWidgetRepresentation.h:225
vtkMatrixToLinearTransform
convert a matrix to a transform
Definition: vtkMatrixToLinearTransform.h:37
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkWidgetRepresentation::RegisterPickers
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:45
vtkAbstractPolygonalHandleRepresentation3D::Property
vtkProperty * Property
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:203
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkAbstractPolygonalHandleRepresentation3D::LabelTextInput
vtkVectorText * LabelTextInput
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:250
vtkAbstractPolygonalHandleRepresentation3D::LabelVisibility
vtkTypeBool LabelVisibility
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:247
vtkAbstractPolygonalHandleRepresentation3D::LabelTextMapper
vtkPolyDataMapper * LabelTextMapper
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:249
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:46
vtkAbstractPolygonalHandleRepresentation3D::ConstraintAxis
int ConstraintAxis
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:202
vtkAbstractPolygonalHandleRepresentation3D::SetLabelTextScale
void SetLabelTextScale(double x, double y, double z)
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:135
vtkAbstractPolygonalHandleRepresentation3D::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:199
vtkWidgetRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:222
vtkHandleRepresentation::DeepCopy
virtual void DeepCopy(vtkProp *prop)
vtkHandleRepresentation::SetDisplayPosition
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkAbstractPolygonalHandleRepresentation3D::WaitCount
int WaitCount
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:206
vtkHandleRepresentation::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkAbstractPolygonalHandleRepresentation3D::HandleTransformMatrix
vtkMatrix4x4 * HandleTransformMatrix
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:198
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:60
vtkAbstractPolygonalHandleRepresentation3D::SmoothMotion
vtkTypeBool SmoothMotion
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:252
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:35
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:63
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkWidgetRepresentation::Highlight
virtual void Highlight(int vtkNotUsed(highlightOn))
Definition: vtkWidgetRepresentation.h:142