VTK
vtkCompassRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCompassRepresentation.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 =========================================================================*/
15 
16 /*-------------------------------------------------------------------------
17  Copyright 2008 Sandia Corporation.
18  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
19  the U.S. Government retains certain rights in this software.
20 -------------------------------------------------------------------------*/
21 
29 #ifndef vtkCompassRepresentation_h
30 #define vtkCompassRepresentation_h
31 
32 #include "vtkGeovisCoreModule.h" // For export macro
34 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
35 #include "vtkCenteredSliderRepresentation.h" // to use in a SP
36 #include "vtkSmartPointer.h" // used for SmartPointers
37 
38 class vtkActor2D;
39 class vtkPoints;
40 class vtkCellArray;
41 class vtkPolyData;
43 class vtkCoordinate;
44 class vtkProperty2D;
45 class vtkPropCollection;
46 class vtkWindow;
47 class vtkViewport;
48 class vtkTransform;
50 class vtkTextProperty;
51 class vtkTextActor;
52 
53 
54 class VTKGEOVISCORE_EXPORT vtkCompassRepresentation :
56 {
57 public:
61  static vtkCompassRepresentation *New();
62 
64 
67  vtkTypeMacro(vtkCompassRepresentation,
69  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
71 
80  vtkCoordinate *GetPoint1Coordinate();
81 
90  vtkCoordinate *GetPoint2Coordinate();
91 
93 
97  vtkGetObjectMacro(RingProperty,vtkProperty2D);
99 
101 
105  vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
107 
109 
112  vtkGetObjectMacro(LabelProperty,vtkTextProperty);
114 
116 
121  void PlaceWidget(double bounds[6]) VTK_OVERRIDE;
122  void BuildRepresentation() VTK_OVERRIDE;
123  void StartWidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
124  void WidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
125  virtual void TiltWidgetInteraction(double eventPos[2]);
126  virtual void DistanceWidgetInteraction(double eventPos[2]);
127  int ComputeInteractionState(int X, int Y, int modify=0) VTK_OVERRIDE;
128  void Highlight(int) VTK_OVERRIDE;
130 
132 
135  void GetActors(vtkPropCollection*) VTK_OVERRIDE;
136  void ReleaseGraphicsResources(vtkWindow*) VTK_OVERRIDE;
137  int RenderOverlay(vtkViewport*) VTK_OVERRIDE;
138  int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
140 
141  virtual void SetHeading(double value);
142  virtual double GetHeading();
143  virtual void SetTilt(double value);
144  virtual double GetTilt();
145  virtual void UpdateTilt(double time);
146  virtual void EndTilt();
147  virtual void SetDistance(double value);
148  virtual double GetDistance();
149  virtual void UpdateDistance(double time);
150  virtual void EndDistance();
151  void SetRenderer(vtkRenderer *ren) VTK_OVERRIDE;
152 
153  // Enums are used to describe what is selected
155  {
156  Outside=0,
164  DistanceAdjusting
165  };
166 
167 protected:
169  ~vtkCompassRepresentation() VTK_OVERRIDE;
170 
171  // Positioning the widget
172  vtkCoordinate *Point1Coordinate;
173  vtkCoordinate *Point2Coordinate;
174 
175  // radius values
176  double InnerRadius;
177  double OuterRadius;
178 
179  // tilt and distance rep
180 
183 
184  // Define the geometry. It is constructed in canaonical position
185  // along the x-axis and then rotated into position.
186  vtkTransform *XForm;
187  vtkPoints *Points;
188 
189  vtkPolyData *Ring;
191  vtkPolyDataMapper2D *RingMapper;
192  vtkActor2D *RingActor;
193  vtkProperty2D *RingProperty;
194 
195  vtkPolyDataMapper2D *BackdropMapper;
196  vtkActor2D *Backdrop;
197 
198  vtkTextProperty *LabelProperty;
199  vtkTextActor *LabelActor;
200  vtkTextProperty *StatusProperty;
201  vtkTextActor *StatusActor;
202 
203  vtkProperty2D *SelectedProperty;
204 
205  // build the tube geometry
206  void BuildRing();
207  void BuildBackdrop();
208 
209  // used for positioning etc
210  void GetCenterAndUnitRadius(int center[2], double &radius);
211 
212  int HighlightState;
213 
214  double Heading;
215  double Tilt;
216  double Distance;
217 
218 private:
219  vtkCompassRepresentation(const vtkCompassRepresentation&) VTK_DELETE_FUNCTION;
220  void operator=(const vtkCompassRepresentation&) VTK_DELETE_FUNCTION;
221 };
222 
223 #endif
abstract specification for Viewports
Definition: vtkViewport.h:44
a actor that draws 2D data
Definition: vtkActor2D.h:39
abstract specification for renderers
Definition: vtkRenderer.h:57
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
Hold a reference to a vtkObjectBase instance.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
provide the representation for a continuous value
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
An actor that displays text.
Definition: vtkTextActor.h:50
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
a simple class to control print indentation
Definition: vtkIndent.h:33
void BuildRepresentation() override
Methods to interface with the vtkSliderWidget.
represent text properties.
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:72
object to represent cell connectivity
Definition: vtkCellArray.h:44
provide the representation for a vtkCenteredSliderWidget
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:33
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkSliderWidget.