00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #ifndef __vtkCompassRepresentation_h
00029 #define __vtkCompassRepresentation_h
00030
00031 #include "vtkContinuousValueWidgetRepresentation.h"
00032 #include "vtkCoordinate.h"
00033 #include "vtkCenteredSliderRepresentation.h"
00034 #include "vtkSmartPointer.h"
00035
00036 class vtkActor2D;
00037 class vtkPoints;
00038 class vtkCellArray;
00039 class vtkPolyData;
00040 class vtkPolyDataMapper2D;
00041 class vtkCoordinate;
00042 class vtkProperty2D;
00043 class vtkPropCollection;
00044 class vtkWindow;
00045 class vtkViewport;
00046 class vtkTransform;
00047 class vtkTransformPolyDataFilter;
00048 class vtkTextProperty;
00049 class vtkTextActor;
00050
00051
00052 class VTK_GEOVIS_EXPORT vtkCompassRepresentation :
00053 public vtkContinuousValueWidgetRepresentation
00054 {
00055 public:
00057 static vtkCompassRepresentation *New();
00058
00060
00061 vtkTypeMacro(vtkCompassRepresentation,
00062 vtkContinuousValueWidgetRepresentation);
00063 void PrintSelf(ostream& os, vtkIndent indent);
00065
00072 vtkCoordinate *GetPoint1Coordinate();
00073
00080 vtkCoordinate *GetPoint2Coordinate();
00081
00083
00085 vtkGetObjectMacro(RingProperty,vtkProperty2D);
00087
00089
00091 vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
00093
00095
00096 vtkGetObjectMacro(LabelProperty,vtkTextProperty);
00098
00100
00103 virtual void PlaceWidget(double bounds[6]);
00104 virtual void BuildRepresentation();
00105 virtual void StartWidgetInteraction(double eventPos[2]);
00106 virtual void WidgetInteraction(double eventPos[2]);
00107 virtual void TiltWidgetInteraction(double eventPos[2]);
00108 virtual void DistanceWidgetInteraction(double eventPos[2]);
00109 virtual int ComputeInteractionState(int X, int Y, int modify=0);
00110 virtual void Highlight(int);
00112
00114
00115 virtual void GetActors(vtkPropCollection*);
00116 virtual void ReleaseGraphicsResources(vtkWindow*);
00117 virtual int RenderOverlay(vtkViewport*);
00118 virtual int RenderOpaqueGeometry(vtkViewport*);
00120
00121 virtual void SetHeading(double value);
00122 virtual double GetHeading();
00123 virtual void SetTilt(double value);
00124 virtual double GetTilt();
00125 virtual void UpdateTilt(double time);
00126 virtual void EndTilt();
00127 virtual void SetDistance(double value);
00128 virtual double GetDistance();
00129 virtual void UpdateDistance(double time);
00130 virtual void EndDistance();
00131 virtual void SetRenderer(vtkRenderer *ren);
00132
00133
00134
00135 enum _InteractionState
00136 {
00137 Outside=0,
00138 Inside,
00139 Adjusting,
00140 TiltDown,
00141 TiltUp,
00142 TiltAdjusting,
00143 DistanceOut,
00144 DistanceIn,
00145 DistanceAdjusting
00146 };
00147
00148
00149 protected:
00150 vtkCompassRepresentation();
00151 ~vtkCompassRepresentation();
00152
00153
00154 vtkCoordinate *Point1Coordinate;
00155 vtkCoordinate *Point2Coordinate;
00156
00157
00158 double InnerRadius;
00159 double OuterRadius;
00160
00161
00162
00163 vtkSmartPointer<vtkCenteredSliderRepresentation> TiltRepresentation;
00164 vtkSmartPointer<vtkCenteredSliderRepresentation> DistanceRepresentation;
00165
00166
00167
00168
00169 vtkTransform *XForm;
00170 vtkPoints *Points;
00171
00172 vtkPolyData *Ring;
00173 vtkTransformPolyDataFilter *RingXForm;
00174 vtkPolyDataMapper2D *RingMapper;
00175 vtkActor2D *RingActor;
00176 vtkProperty2D *RingProperty;
00177
00178 vtkPolyDataMapper2D *BackdropMapper;
00179 vtkActor2D *Backdrop;
00180
00181 vtkTextProperty *LabelProperty;
00182 vtkTextActor *LabelActor;
00183 vtkTextProperty *StatusProperty;
00184 vtkTextActor *StatusActor;
00185
00186 vtkProperty2D *SelectedProperty;
00187
00188
00189 void BuildRing();
00190 void BuildBackdrop();
00191
00192
00193 void GetCenterAndUnitRadius(int center[2], double &radius);
00194
00195 int HighlightState;
00196
00197 double Heading;
00198 double Tilt;
00199 double Distance;
00200
00201 private:
00202 vtkCompassRepresentation(const vtkCompassRepresentation&);
00203 void operator=(const vtkCompassRepresentation&);
00204 };
00205
00206 #endif