VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCompassRepresentation.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00016 /*------------------------------------------------------------------------- 00017 Copyright 2008 Sandia Corporation. 00018 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00019 the U.S. Government retains certain rights in this software. 00020 -------------------------------------------------------------------------*/ 00021 00028 #ifndef __vtkCompassRepresentation_h 00029 #define __vtkCompassRepresentation_h 00030 00031 #include "vtkGeovisCoreModule.h" // For export macro 00032 #include "vtkContinuousValueWidgetRepresentation.h" 00033 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro 00034 #include "vtkCenteredSliderRepresentation.h" // to use in a SP 00035 #include "vtkSmartPointer.h" // used for SmartPointers 00036 00037 class vtkActor2D; 00038 class vtkPoints; 00039 class vtkCellArray; 00040 class vtkPolyData; 00041 class vtkPolyDataMapper2D; 00042 class vtkCoordinate; 00043 class vtkProperty2D; 00044 class vtkPropCollection; 00045 class vtkWindow; 00046 class vtkViewport; 00047 class vtkTransform; 00048 class vtkTransformPolyDataFilter; 00049 class vtkTextProperty; 00050 class vtkTextActor; 00051 00052 00053 class VTKGEOVISCORE_EXPORT vtkCompassRepresentation : 00054 public vtkContinuousValueWidgetRepresentation 00055 { 00056 public: 00058 static vtkCompassRepresentation *New(); 00059 00061 00062 vtkTypeMacro(vtkCompassRepresentation, 00063 vtkContinuousValueWidgetRepresentation); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00066 00073 vtkCoordinate *GetPoint1Coordinate(); 00074 00081 vtkCoordinate *GetPoint2Coordinate(); 00082 00084 00086 vtkGetObjectMacro(RingProperty,vtkProperty2D); 00088 00090 00092 vtkGetObjectMacro(SelectedProperty,vtkProperty2D); 00094 00096 00097 vtkGetObjectMacro(LabelProperty,vtkTextProperty); 00099 00101 00104 virtual void PlaceWidget(double bounds[6]); 00105 virtual void BuildRepresentation(); 00106 virtual void StartWidgetInteraction(double eventPos[2]); 00107 virtual void WidgetInteraction(double eventPos[2]); 00108 virtual void TiltWidgetInteraction(double eventPos[2]); 00109 virtual void DistanceWidgetInteraction(double eventPos[2]); 00110 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00111 virtual void Highlight(int); 00113 00115 00116 virtual void GetActors(vtkPropCollection*); 00117 virtual void ReleaseGraphicsResources(vtkWindow*); 00118 virtual int RenderOverlay(vtkViewport*); 00119 virtual int RenderOpaqueGeometry(vtkViewport*); 00121 00122 virtual void SetHeading(double value); 00123 virtual double GetHeading(); 00124 virtual void SetTilt(double value); 00125 virtual double GetTilt(); 00126 virtual void UpdateTilt(double time); 00127 virtual void EndTilt(); 00128 virtual void SetDistance(double value); 00129 virtual double GetDistance(); 00130 virtual void UpdateDistance(double time); 00131 virtual void EndDistance(); 00132 virtual void SetRenderer(vtkRenderer *ren); 00133 00134 //BTX 00135 // Enums are used to describe what is selected 00136 enum _InteractionState 00137 { 00138 Outside=0, 00139 Inside, 00140 Adjusting, 00141 TiltDown, 00142 TiltUp, 00143 TiltAdjusting, 00144 DistanceOut, 00145 DistanceIn, 00146 DistanceAdjusting 00147 }; 00148 //ETX 00149 00150 protected: 00151 vtkCompassRepresentation(); 00152 ~vtkCompassRepresentation(); 00153 00154 // Positioning the widget 00155 vtkCoordinate *Point1Coordinate; 00156 vtkCoordinate *Point2Coordinate; 00157 00158 // radius values 00159 double InnerRadius; 00160 double OuterRadius; 00161 00162 // tilt and distance rep 00163 //BTX 00164 vtkSmartPointer<vtkCenteredSliderRepresentation> TiltRepresentation; 00165 vtkSmartPointer<vtkCenteredSliderRepresentation> DistanceRepresentation; 00166 //ETX 00167 00168 // Define the geometry. It is constructed in canaonical position 00169 // along the x-axis and then rotated into position. 00170 vtkTransform *XForm; 00171 vtkPoints *Points; 00172 00173 vtkPolyData *Ring; 00174 vtkTransformPolyDataFilter *RingXForm; 00175 vtkPolyDataMapper2D *RingMapper; 00176 vtkActor2D *RingActor; 00177 vtkProperty2D *RingProperty; 00178 00179 vtkPolyDataMapper2D *BackdropMapper; 00180 vtkActor2D *Backdrop; 00181 00182 vtkTextProperty *LabelProperty; 00183 vtkTextActor *LabelActor; 00184 vtkTextProperty *StatusProperty; 00185 vtkTextActor *StatusActor; 00186 00187 vtkProperty2D *SelectedProperty; 00188 00189 // build the tube geometry 00190 void BuildRing(); 00191 void BuildBackdrop(); 00192 00193 // used for positioning etc 00194 void GetCenterAndUnitRadius(int center[2], double &radius); 00195 00196 int HighlightState; 00197 00198 double Heading; 00199 double Tilt; 00200 double Distance; 00201 00202 private: 00203 vtkCompassRepresentation(const vtkCompassRepresentation&); //Not implemented 00204 void operator=(const vtkCompassRepresentation&); //Not implemented 00205 }; 00206 00207 #endif