VTK
vtkDistanceRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDistanceRepresentation3D.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 =========================================================================*/
29 #ifndef vtkDistanceRepresentation3D_h
30 #define vtkDistanceRepresentation3D_h
31 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
34 
35 class vtkPoints;
36 class vtkPolyData;
37 class vtkPolyDataMapper;
38 class vtkActor;
39 class vtkVectorText;
40 class vtkFollower;
41 class vtkBox;
42 class vtkCylinderSource;
43 class vtkGlyph3D;
44 class vtkDoubleArray;
46 class vtkProperty;
47 
48 
49 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation3D : public vtkDistanceRepresentation
50 {
51 public:
56 
58 
62  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
64 
68  double GetDistance() VTK_OVERRIDE
69  {return this->Distance;}
70 
72 
76  void SetGlyphScale(double scale);
77  vtkGetMacro(GlyphScale, double);
79 
83  virtual vtkProperty *GetLineProperty();
84 
86 
90  void SetLabelPosition(double labelPosition);
91  vtkGetMacro(LabelPosition, double);
93 
95 
98  vtkSetClampMacro(MaximumNumberOfRulerTicks, int, 1, VTK_INT_MAX);
99  vtkGetMacro(MaximumNumberOfRulerTicks, int);
101 
103 
107  vtkGetObjectMacro(GlyphActor, vtkActor);
109 
111 
115  vtkGetObjectMacro(LabelActor, vtkFollower);
117 
119 
124  double* GetPoint1WorldPosition() VTK_OVERRIDE;
125  double* GetPoint2WorldPosition() VTK_OVERRIDE;
126  void GetPoint1WorldPosition(double pos[3]) VTK_OVERRIDE;
127  void GetPoint2WorldPosition(double pos[3]) VTK_OVERRIDE;
128  void SetPoint1WorldPosition(double pos[3]) VTK_OVERRIDE;
129  void SetPoint2WorldPosition(double pos[3]) VTK_OVERRIDE;
131 
132  void SetPoint1DisplayPosition(double pos[3]) VTK_OVERRIDE;
133  void SetPoint2DisplayPosition(double pos[3]) VTK_OVERRIDE;
134  void GetPoint1DisplayPosition(double pos[3]) VTK_OVERRIDE;
135  void GetPoint2DisplayPosition(double pos[3]) VTK_OVERRIDE;
136 
138 
141  void BuildRepresentation() VTK_OVERRIDE;
142  double *GetBounds() VTK_OVERRIDE;
144 
146 
149  void ReleaseGraphicsResources(vtkWindow *w) VTK_OVERRIDE;
150  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
151  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
153 
155 
159  void SetLabelScale(double x, double y, double z)
160  {
161  double scale[3];
162  scale[0] = x;
163  scale[1] = y;
164  scale[2] = z;
165  this->SetLabelScale(scale);
166  }
167  virtual void SetLabelScale( double scale[3] );
168  virtual double * GetLabelScale();
170 
174  virtual vtkProperty *GetLabelProperty();
175 
176 protected:
178  ~vtkDistanceRepresentation3D() VTK_OVERRIDE;
179 
180  // The line
181  vtkPoints *LinePoints;
182  vtkPolyData *LinePolyData;
183  vtkPolyDataMapper *LineMapper;
184  vtkActor *LineActor;
185 
186  // The distance label
187  vtkVectorText *LabelText;
188  vtkPolyDataMapper *LabelMapper;
189  vtkFollower *LabelActor;
190 
191  // Support internal operations
192  bool LabelScaleSpecified;
193 
194  // The 3D disk tick marks
195  vtkPoints *GlyphPoints;
196  vtkDoubleArray *GlyphVectors;
197  vtkPolyData *GlyphPolyData;
198  vtkCylinderSource *GlyphCylinder;
200  vtkGlyph3D *Glyph3D;
201  vtkPolyDataMapper *GlyphMapper;
202  vtkActor *GlyphActor;
203 
204  // Glyph3D scale
205  double GlyphScale;
206  bool GlyphScaleSpecified;
207 
208  // The distance between the two points
209  double Distance;
210 
211  // Support GetBounds() method
212  vtkBox *BoundingBox;
213 
214  // Maximum number of ticks on the 3d ruler
215  int MaximumNumberOfRulerTicks;
216 
217  // Label title position
218  double LabelPosition;
219 
220 private:
221  vtkDistanceRepresentation3D(const vtkDistanceRepresentation3D&) VTK_DELETE_FUNCTION;
222  void operator=(const vtkDistanceRepresentation3D&) VTK_DELETE_FUNCTION;
223 
224  // Internal method to update the position of the label.
225  void UpdateLabelPosition();
226 };
227 
228 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
generate a cylinder centered at origin
abstract specification for Viewports
Definition: vtkViewport.h:44
represent the vtkDistanceWidget
represent surface properties of a geometric object
Definition: vtkProperty.h:58
#define VTK_INT_MAX
Definition: vtkType.h:157
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
transform points and associated normals and vectors for polygonal dataset
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
represent the vtkDistanceWidget
dynamic, self-adjusting array of double
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
virtual double * GetPoint1WorldPosition()=0
Methods to Set/Get the coordinates of the two points defining this representation.
a simple class to control print indentation
Definition: vtkIndent.h:33
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:105
map vtkPolyData to graphics primitives
a subclass of actor that always faces the camera
Definition: vtkFollower.h:40
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
implicit function for a bounding box
Definition: vtkBox.h:38
represent and manipulate 3D points
Definition: vtkPoints.h:33
double GetDistance() override
Satisfy the superclasses API.
create polygonal text
Definition: vtkVectorText.h:41