00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCenteredSliderRepresentation.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 00035 #ifndef __vtkCenteredSliderRepresentation_h 00036 #define __vtkCenteredSliderRepresentation_h 00037 00038 #include "vtkSliderRepresentation.h" 00039 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro 00040 00041 class vtkPoints; 00042 class vtkCellArray; 00043 class vtkPolyData; 00044 class vtkPolyDataMapper2D; 00045 class vtkActor2D; 00046 class vtkCoordinate; 00047 class vtkProperty2D; 00048 class vtkPropCollection; 00049 class vtkWindow; 00050 class vtkViewport; 00051 class vtkTransform; 00052 class vtkTransformPolyDataFilter; 00053 class vtkTextProperty; 00054 class vtkTextMapper; 00055 class vtkTextActor; 00056 00057 00058 class VTK_WIDGETS_EXPORT vtkCenteredSliderRepresentation : public vtkSliderRepresentation 00059 { 00060 public: 00062 static vtkCenteredSliderRepresentation *New(); 00063 00065 00066 vtkTypeMacro(vtkCenteredSliderRepresentation, 00067 vtkSliderRepresentation); 00068 void PrintSelf(ostream& os, vtkIndent indent); 00070 00077 vtkCoordinate *GetPoint1Coordinate(); 00078 00085 vtkCoordinate *GetPoint2Coordinate(); 00086 00088 00090 virtual void SetTitleText(const char*); 00091 virtual const char* GetTitleText(); 00093 00095 00096 vtkGetObjectMacro(TubeProperty,vtkProperty2D); 00097 vtkGetObjectMacro(SliderProperty,vtkProperty2D); 00099 00101 00103 vtkGetObjectMacro(SelectedProperty,vtkProperty2D); 00105 00107 00108 vtkGetObjectMacro(LabelProperty,vtkTextProperty); 00110 00112 00115 virtual void PlaceWidget(double bounds[6]); 00116 virtual void BuildRepresentation(); 00117 virtual void StartWidgetInteraction(double eventPos[2]); 00118 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00119 virtual void WidgetInteraction(double eventPos[2]); 00120 virtual void Highlight(int); 00122 00124 00125 virtual void GetActors(vtkPropCollection*); 00126 virtual void ReleaseGraphicsResources(vtkWindow*); 00127 virtual int RenderOverlay(vtkViewport*); 00128 virtual int RenderOpaqueGeometry(vtkViewport*); 00130 00131 protected: 00132 vtkCenteredSliderRepresentation(); 00133 ~vtkCenteredSliderRepresentation(); 00134 00135 // Positioning the widget 00136 vtkCoordinate *Point1Coordinate; 00137 vtkCoordinate *Point2Coordinate; 00138 00139 // Determine the parameter t along the slider 00140 virtual double ComputePickPosition(double x, double y); 00141 00142 // Define the geometry. It is constructed in canaonical position 00143 // along the x-axis and then rotated into position. 00144 vtkTransform *XForm; 00145 vtkPoints *Points; 00146 00147 vtkCellArray *SliderCells; 00148 vtkPolyData *Slider; 00149 vtkTransformPolyDataFilter *SliderXForm; 00150 vtkPolyDataMapper2D *SliderMapper; 00151 vtkActor2D *SliderActor; 00152 vtkProperty2D *SliderProperty; 00153 00154 vtkCellArray *TubeCells; 00155 vtkPolyData *Tube; 00156 vtkTransformPolyDataFilter *TubeXForm; 00157 vtkPolyDataMapper2D *TubeMapper; 00158 vtkActor2D *TubeActor; 00159 vtkProperty2D *TubeProperty; 00160 00161 vtkTextProperty *LabelProperty; 00162 vtkTextActor *LabelActor; 00163 00164 vtkProperty2D *SelectedProperty; 00165 int HighlightState; 00166 00167 // build the tube geometry 00168 void BuildTube(); 00169 00170 private: 00171 00172 // how many points along the tube 00173 int ArcCount; 00174 double ArcStart; 00175 double ArcEnd; 00176 double ButtonSize; 00177 double TubeSize; 00178 00179 vtkCenteredSliderRepresentation 00180 (const vtkCenteredSliderRepresentation&); // Not implemented 00181 void operator=(const vtkCenteredSliderRepresentation&); //Not implemented 00182 }; 00183 00184 #endif