VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkBorderRepresentation.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 =========================================================================*/ 00041 #ifndef __vtkBorderRepresentation_h 00042 #define __vtkBorderRepresentation_h 00043 00044 #include "vtkWidgetRepresentation.h" 00045 #include "vtkCoordinate.h" //Because of the viewport coordinate macro 00046 00047 class vtkPoints; 00048 class vtkPolyData; 00049 class vtkTransform; 00050 class vtkTransformPolyDataFilter; 00051 class vtkPolyDataMapper2D; 00052 class vtkActor2D; 00053 class vtkProperty2D; 00054 00055 00056 class VTK_WIDGETS_EXPORT vtkBorderRepresentation : public vtkWidgetRepresentation 00057 { 00058 public: 00060 static vtkBorderRepresentation *New(); 00061 00063 00064 vtkTypeMacro(vtkBorderRepresentation,vtkWidgetRepresentation); 00065 void PrintSelf(ostream& os, vtkIndent indent); 00067 00069 00076 vtkViewportCoordinateMacro(Position); 00077 vtkViewportCoordinateMacro(Position2); 00079 00080 //BTX 00081 enum {BORDER_OFF=0,BORDER_ON,BORDER_ACTIVE}; 00082 //ETX 00084 00089 vtkSetClampMacro(ShowBorder,int,BORDER_OFF,BORDER_ACTIVE); 00090 vtkGetMacro(ShowBorder,int); 00091 void SetShowBorderToOff() {this->SetShowBorder(BORDER_OFF);} 00092 void SetShowBorderToOn() {this->SetShowBorder(BORDER_ON);} 00093 void SetShowBorderToActive() {this->SetShowBorder(BORDER_ACTIVE);} 00095 00097 00098 vtkGetObjectMacro(BorderProperty,vtkProperty2D); 00100 00102 00107 vtkSetMacro(ProportionalResize,int); 00108 vtkGetMacro(ProportionalResize,int); 00109 vtkBooleanMacro(ProportionalResize,int); 00111 00113 00116 vtkSetVector2Macro(MinimumSize,int); 00117 vtkGetVector2Macro(MinimumSize,int); 00118 vtkSetVector2Macro(MaximumSize,int); 00119 vtkGetVector2Macro(MaximumSize,int); 00121 00123 00126 vtkSetClampMacro(Tolerance,int,1,10); 00127 vtkGetMacro(Tolerance,int); 00129 00131 00133 vtkGetVectorMacro(SelectionPoint,double,2); 00135 00137 00140 vtkSetMacro(Moving,int); 00141 vtkGetMacro(Moving,int); 00142 vtkBooleanMacro(Moving,int); 00144 00145 //BTX 00147 00148 enum _InteractionState 00149 { 00150 Outside=0, 00151 Inside, 00152 AdjustingP0, 00153 AdjustingP1, 00154 AdjustingP2, 00155 AdjustingP3, 00156 AdjustingE0, 00157 AdjustingE1, 00158 AdjustingE2, 00159 AdjustingE3 00160 }; 00161 //ETX 00163 00165 00167 virtual void BuildRepresentation(); 00168 virtual void StartWidgetInteraction(double eventPos[2]); 00169 virtual void WidgetInteraction(double eventPos[2]); 00170 virtual void GetSize(double size[2]) 00171 {size[0]=1.0; size[1]=1.0;} 00172 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00174 00176 00178 virtual void GetActors2D(vtkPropCollection*); 00179 virtual void ReleaseGraphicsResources(vtkWindow*); 00180 virtual int RenderOverlay(vtkViewport*); 00181 virtual int RenderOpaqueGeometry(vtkViewport*); 00182 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*); 00183 virtual int HasTranslucentPolygonalGeometry(); 00185 00186 protected: 00187 vtkBorderRepresentation(); 00188 ~vtkBorderRepresentation(); 00189 00190 // Ivars 00191 int ShowBorder; 00192 vtkProperty2D *BorderProperty; 00193 int ProportionalResize; 00194 int Tolerance; 00195 int Moving; 00196 double SelectionPoint[2]; 00197 00198 // Layout (position of lower left and upper right corners of border) 00199 vtkCoordinate *PositionCoordinate; 00200 vtkCoordinate *Position2Coordinate; 00201 00202 // Sometimes subclasses must negotiate with their superclasses 00203 // to achieve the correct layout. 00204 int Negotiated; 00205 virtual void NegotiateLayout(); 00206 00207 // Keep track of start position when moving border 00208 double StartPosition[2]; 00209 00210 // Border representation. Subclasses may use the BWTransform class 00211 // to transform their geometry into the region surrounded by the border. 00212 vtkPoints *BWPoints; 00213 vtkPolyData *BWPolyData; 00214 vtkTransform *BWTransform; 00215 vtkTransformPolyDataFilter *BWTransformFilter; 00216 vtkPolyDataMapper2D *BWMapper; 00217 vtkActor2D *BWActor; 00218 00219 // Constraints on size 00220 int MinimumSize[2]; 00221 int MaximumSize[2]; 00222 00223 private: 00224 vtkBorderRepresentation(const vtkBorderRepresentation&); //Not implemented 00225 void operator=(const vtkBorderRepresentation&); //Not implemented 00226 }; 00227 00228 #endif