VTK
dox/Interaction/Widgets/vtkCenteredSliderRepresentation.h
Go to the documentation of this file.
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 "vtkInteractionWidgetsModule.h" // For export macro
00039 #include "vtkSliderRepresentation.h"
00040 #include "vtkCoordinate.h" // For vtkViewportCoordinateMacro
00041 
00042 class vtkPoints;
00043 class vtkCellArray;
00044 class vtkPolyData;
00045 class vtkPolyDataMapper2D;
00046 class vtkActor2D;
00047 class vtkCoordinate;
00048 class vtkProperty2D;
00049 class vtkPropCollection;
00050 class vtkWindow;
00051 class vtkViewport;
00052 class vtkTransform;
00053 class vtkTransformPolyDataFilter;
00054 class vtkTextProperty;
00055 class vtkTextMapper;
00056 class vtkTextActor;
00057 
00058 
00059 class VTKINTERACTIONWIDGETS_EXPORT vtkCenteredSliderRepresentation : public vtkSliderRepresentation
00060 {
00061 public:
00063   static vtkCenteredSliderRepresentation *New();
00064 
00066 
00067   vtkTypeMacro(vtkCenteredSliderRepresentation,
00068                        vtkSliderRepresentation);
00069   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00078   vtkCoordinate *GetPoint1Coordinate();
00079 
00086   vtkCoordinate *GetPoint2Coordinate();
00087 
00089 
00091   virtual void SetTitleText(const char*);
00092   virtual const char* GetTitleText();
00094 
00096 
00097   vtkGetObjectMacro(TubeProperty,vtkProperty2D);
00098   vtkGetObjectMacro(SliderProperty,vtkProperty2D);
00100 
00102 
00104   vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
00106 
00108 
00109   vtkGetObjectMacro(LabelProperty,vtkTextProperty);
00111 
00113 
00116   virtual void PlaceWidget(double bounds[6]);
00117   virtual void BuildRepresentation();
00118   virtual void StartWidgetInteraction(double eventPos[2]);
00119   virtual int ComputeInteractionState(int X, int Y, int modify=0);
00120   virtual void WidgetInteraction(double eventPos[2]);
00121   virtual void Highlight(int);
00123 
00125 
00126   virtual void GetActors(vtkPropCollection*);
00127   virtual void ReleaseGraphicsResources(vtkWindow*);
00128   virtual int RenderOverlay(vtkViewport*);
00129   virtual int RenderOpaqueGeometry(vtkViewport*);
00131 
00132 protected:
00133   vtkCenteredSliderRepresentation();
00134   ~vtkCenteredSliderRepresentation();
00135 
00136   // Positioning the widget
00137   vtkCoordinate *Point1Coordinate;
00138   vtkCoordinate *Point2Coordinate;
00139 
00140   // Determine the parameter t along the slider
00141   virtual double ComputePickPosition(double x, double y);
00142 
00143   // Define the geometry. It is constructed in canaonical position
00144   // along the x-axis and then rotated into position.
00145   vtkTransform        *XForm;
00146   vtkPoints           *Points;
00147 
00148   vtkCellArray        *SliderCells;
00149   vtkPolyData         *Slider;
00150   vtkTransformPolyDataFilter *SliderXForm;
00151   vtkPolyDataMapper2D *SliderMapper;
00152   vtkActor2D          *SliderActor;
00153   vtkProperty2D       *SliderProperty;
00154 
00155   vtkCellArray        *TubeCells;
00156   vtkPolyData         *Tube;
00157   vtkTransformPolyDataFilter *TubeXForm;
00158   vtkPolyDataMapper2D *TubeMapper;
00159   vtkActor2D          *TubeActor;
00160   vtkProperty2D       *TubeProperty;
00161 
00162   vtkTextProperty     *LabelProperty;
00163   vtkTextActor        *LabelActor;
00164 
00165   vtkProperty2D       *SelectedProperty;
00166   int HighlightState;
00167 
00168   // build the tube geometry
00169   void BuildTube();
00170 
00171 private:
00172 
00173   // how many points along the tube
00174   int ArcCount;
00175   double ArcStart;
00176   double ArcEnd;
00177   double ButtonSize;
00178   double TubeSize;
00179 
00180   vtkCenteredSliderRepresentation
00181     (const vtkCenteredSliderRepresentation&); // Not implemented
00182   void operator=(const vtkCenteredSliderRepresentation&);  //Not implemented
00183 };
00184 
00185 #endif