1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkDistanceRepresentation2D.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 // .NAME vtkDistanceRepresentation2D - represent the vtkDistanceWidget 16 // .SECTION Description 17 // The vtkDistanceRepresentation2D is a representation for the 18 // vtkDistanceWidget. This representation consists of a measuring line (axis) 19 // and two vtkHandleWidgets to place the end points of the line. Note that 20 // this particular widget draws its representation in the overlay plane, and 21 // the handles also operate in the 2D overlay plane. (If you desire to use 22 // the distance widget for 3D measurements, use the 23 // vtkDistanceRepresentation3D.) 24 25 // .SECTION See Also 26 // vtkDistanceWidget vtkDistanceRepresentation vtkDistanceRepresentation3D 27 28 29 #ifndef vtkDistanceRepresentation2D_h 30 #define vtkDistanceRepresentation2D_h 31 32 #include "vtkInteractionWidgetsModule.h" // For export macro 33 #include "vtkDistanceRepresentation.h" 34 35 class vtkAxisActor2D; 36 class vtkProperty2D; 37 38 39 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation2D : public vtkDistanceRepresentation 40 { 41 public: 42 // Description: 43 // Instantiate class. 44 static vtkDistanceRepresentation2D *New(); 45 46 // Description: 47 // Standard VTK methods. 48 vtkTypeMacro(vtkDistanceRepresentation2D,vtkDistanceRepresentation); 49 void PrintSelf(ostream& os, vtkIndent indent); 50 51 // Description: 52 // Satisfy the superclasses API. GetDistance()53 virtual double GetDistance() 54 {return this->Distance;} 55 56 // Description: 57 // Methods to Set/Get the coordinates of the two points defining 58 // this representation. Note that methods are available for both 59 // display and world coordinates. 60 double* GetPoint1WorldPosition(); 61 double* GetPoint2WorldPosition(); 62 void GetPoint1WorldPosition(double pos[3]); 63 void GetPoint2WorldPosition(double pos[3]); 64 void SetPoint1WorldPosition(double pos[3]); 65 void SetPoint2WorldPosition(double pos[3]); 66 67 void SetPoint1DisplayPosition(double pos[3]); 68 void SetPoint2DisplayPosition(double pos[3]); 69 void GetPoint1DisplayPosition(double pos[3]); 70 void GetPoint2DisplayPosition(double pos[3]); 71 72 // Description: 73 // Retrieve the vtkAxisActor2D used to draw the measurement axis. With this 74 // properties can be set and so on. There is also a convenience method to 75 // get the axis property. 76 vtkAxisActor2D *GetAxis(); 77 vtkProperty2D *GetAxisProperty(); 78 79 // Description: 80 // Method to satisfy superclasses' API. 81 virtual void BuildRepresentation(); 82 83 // Description: 84 // Methods required by vtkProp superclass. 85 virtual void ReleaseGraphicsResources(vtkWindow *w); 86 virtual int RenderOverlay(vtkViewport *viewport); 87 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 88 89 protected: 90 vtkDistanceRepresentation2D(); 91 ~vtkDistanceRepresentation2D(); 92 93 // Add a line to the mix 94 vtkAxisActor2D *AxisActor; 95 vtkProperty2D *AxisProperty; 96 97 // The distance between the two points 98 double Distance; 99 100 private: 101 vtkDistanceRepresentation2D(const vtkDistanceRepresentation2D&); //Not implemented 102 void operator=(const vtkDistanceRepresentation2D&); //Not implemented 103 }; 104 105 #endif 106