00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkSliderRepresentation2D.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 =========================================================================*/ 00034 #ifndef __vtkSliderRepresentation2D_h 00035 #define __vtkSliderRepresentation2D_h 00036 00037 #include "vtkSliderRepresentation.h" 00038 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro 00039 00040 class vtkPoints; 00041 class vtkCellArray; 00042 class vtkPolyData; 00043 class vtkPolyDataMapper2D; 00044 class vtkActor2D; 00045 class vtkCoordinate; 00046 class vtkProperty2D; 00047 class vtkPropCollection; 00048 class vtkWindow; 00049 class vtkViewport; 00050 class vtkTransform; 00051 class vtkTransformPolyDataFilter; 00052 class vtkTextProperty; 00053 class vtkTextMapper; 00054 class vtkTextActor; 00055 00056 00057 class VTK_WIDGETS_EXPORT vtkSliderRepresentation2D : public vtkSliderRepresentation 00058 { 00059 public: 00061 static vtkSliderRepresentation2D *New(); 00062 00064 00065 vtkTypeMacro(vtkSliderRepresentation2D,vtkSliderRepresentation); 00066 void PrintSelf(ostream& os, vtkIndent indent); 00068 00075 vtkCoordinate *GetPoint1Coordinate(); 00076 00083 vtkCoordinate *GetPoint2Coordinate(); 00084 00086 00088 virtual void SetTitleText(const char*); 00089 virtual const char* GetTitleText(); 00091 00093 00095 vtkGetObjectMacro(SliderProperty,vtkProperty2D); 00097 00099 00100 vtkGetObjectMacro(TubeProperty,vtkProperty2D); 00101 vtkGetObjectMacro(CapProperty,vtkProperty2D); 00103 00105 00107 vtkGetObjectMacro(SelectedProperty,vtkProperty2D); 00109 00111 00112 vtkGetObjectMacro(LabelProperty,vtkTextProperty); 00113 vtkGetObjectMacro(TitleProperty,vtkTextProperty); 00115 00117 00120 virtual void PlaceWidget(double bounds[6]); 00121 virtual void BuildRepresentation(); 00122 virtual void StartWidgetInteraction(double eventPos[2]); 00123 virtual void WidgetInteraction(double newEventPos[2]); 00124 virtual void Highlight(int); 00126 00128 00129 virtual void GetActors2D(vtkPropCollection*); 00130 virtual void ReleaseGraphicsResources(vtkWindow*); 00131 virtual int RenderOverlay(vtkViewport*); 00132 virtual int RenderOpaqueGeometry(vtkViewport*); 00134 00135 protected: 00136 vtkSliderRepresentation2D(); 00137 ~vtkSliderRepresentation2D(); 00138 00139 // Positioning the widget 00140 vtkCoordinate *Point1Coordinate; 00141 vtkCoordinate *Point2Coordinate; 00142 00143 // Determine the parameter t along the slider 00144 virtual double ComputePickPosition(double eventPos[2]); 00145 00146 // Define the geometry. It is constructed in canaonical position 00147 // along the x-axis and then rotated into position. 00148 vtkTransform *XForm; 00149 vtkPoints *Points; 00150 00151 vtkCellArray *SliderCells; 00152 vtkPolyData *Slider; 00153 vtkTransformPolyDataFilter *SliderXForm; 00154 vtkPolyDataMapper2D *SliderMapper; 00155 vtkActor2D *SliderActor; 00156 vtkProperty2D *SliderProperty; 00157 00158 vtkCellArray *TubeCells; 00159 vtkPolyData *Tube; 00160 vtkTransformPolyDataFilter *TubeXForm; 00161 vtkPolyDataMapper2D *TubeMapper; 00162 vtkActor2D *TubeActor; 00163 vtkProperty2D *TubeProperty; 00164 00165 vtkCellArray *CapCells; 00166 vtkPolyData *Cap; 00167 vtkTransformPolyDataFilter *CapXForm; 00168 vtkPolyDataMapper2D *CapMapper; 00169 vtkActor2D *CapActor; 00170 vtkProperty2D *CapProperty; 00171 00172 vtkTextProperty *LabelProperty; 00173 vtkTextMapper *LabelMapper; 00174 vtkActor2D *LabelActor; 00175 00176 vtkTextProperty *TitleProperty; 00177 vtkTextMapper *TitleMapper; 00178 vtkActor2D *TitleActor; 00179 00180 vtkProperty2D *SelectedProperty; 00181 00182 // internal variables used for computation 00183 double X; 00184 00185 private: 00186 vtkSliderRepresentation2D(const vtkSliderRepresentation2D&); //Not implemented 00187 void operator=(const vtkSliderRepresentation2D&); //Not implemented 00188 }; 00189 00190 #endif