00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00040 #ifndef __vtkLineRepresentation_h
00041 #define __vtkLineRepresentation_h
00042
00043 #include "vtkWidgetRepresentation.h"
00044
00045 class vtkActor;
00046 class vtkPolyDataMapper;
00047 class vtkLineSource;
00048 class vtkSphereSource;
00049 class vtkProperty;
00050 class vtkPolyData;
00051 class vtkPolyDataAlgorithm;
00052 class vtkPointHandleRepresentation3D;
00053 class vtkBox;
00054
00055
00056 class VTK_WIDGETS_EXPORT vtkLineRepresentation : public vtkWidgetRepresentation
00057 {
00058 public:
00060 static vtkLineRepresentation *New();
00061
00063
00064 vtkTypeRevisionMacro(vtkLineRepresentation,vtkWidgetRepresentation);
00065 void PrintSelf(ostream& os, vtkIndent indent);
00067
00069
00072 void GetPoint1WorldPosition(double pos[3]);
00073 double* GetPoint1WorldPosition();
00074 void GetPoint1DisplayPosition(double pos[3]);
00075 double* GetPoint1DisplayPosition();
00076 void SetPoint1WorldPosition(double pos[3]);
00077 void SetPoint1DisplayPosition(double pos[3]);
00078 void GetPoint2DisplayPosition(double pos[3]);
00079 double* GetPoint2DisplayPosition();
00080 void GetPoint2WorldPosition(double pos[3]);
00081 double* GetPoint2WorldPosition();
00082 void SetPoint2WorldPosition(double pos[3]);
00083 void SetPoint2DisplayPosition(double pos[3]);
00085
00087
00095 void SetHandleRepresentation(vtkPointHandleRepresentation3D *handle);
00096 void InstantiateHandleRepresentation();
00098
00100
00101 vtkGetObjectMacro(Point1Representation,vtkPointHandleRepresentation3D);
00102 vtkGetObjectMacro(Point2Representation,vtkPointHandleRepresentation3D);
00103 vtkGetObjectMacro(LineHandleRepresentation,vtkPointHandleRepresentation3D);
00105
00107
00109 vtkGetObjectMacro(EndPointProperty,vtkProperty);
00110 vtkGetObjectMacro(SelectedEndPointProperty,vtkProperty);
00112
00114
00116 vtkGetObjectMacro(LineProperty,vtkProperty);
00117 vtkGetObjectMacro(SelectedLineProperty,vtkProperty);
00119
00121
00124 vtkSetClampMacro(Tolerance,int,1,100);
00125 vtkGetMacro(Tolerance,int);
00127
00129
00132 void SetResolution(int res);
00133 int GetResolution();
00135
00142 void GetPolyData(vtkPolyData *pd);
00143
00145
00146 virtual void PlaceWidget(double bounds[6]);
00147 virtual void BuildRepresentation();
00148 virtual int ComputeInteractionState(int X, int Y, int modify=0);
00149 virtual void StartWidgetInteraction(double e[2]);
00150 virtual void WidgetInteraction(double e[2]);
00151 virtual double *GetBounds();
00153
00155
00156 virtual void ReleaseGraphicsResources(vtkWindow*);
00157 virtual int RenderOpaqueGeometry(vtkViewport*);
00158 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
00159 virtual int HasTranslucentPolygonalGeometry();
00161
00162
00163 enum {Outside=0,OnP1,OnP2,TranslatingP1,TranslatingP2,OnLine,Scaling};
00164
00165
00167
00174 vtkSetClampMacro(InteractionState,int,Outside,Scaling);
00176
00178
00180 virtual void SetRepresentationState(int);
00181 vtkGetMacro(RepresentationState, int);
00183
00186 virtual unsigned long GetMTime();
00187
00189 virtual void SetRenderer(vtkRenderer *ren);
00190
00191 protected:
00192 vtkLineRepresentation();
00193 ~vtkLineRepresentation();
00194
00195
00196 vtkPointHandleRepresentation3D *HandleRepresentation;
00197 vtkPointHandleRepresentation3D *Point1Representation;
00198 vtkPointHandleRepresentation3D *Point2Representation;
00199 vtkPointHandleRepresentation3D *LineHandleRepresentation;
00200
00201
00202 int RepresentationState;
00203
00204
00205 vtkActor *LineActor;
00206 vtkPolyDataMapper *LineMapper;
00207 vtkLineSource *LineSource;
00208
00209
00210 vtkActor **Handle;
00211 vtkPolyDataMapper **HandleMapper;
00212 vtkSphereSource **HandleGeometry;
00213
00214
00215
00216 vtkProperty *EndPointProperty;
00217 vtkProperty *SelectedEndPointProperty;
00218 vtkProperty *LineProperty;
00219 vtkProperty *SelectedLineProperty;
00220 void CreateDefaultProperties();
00221
00222
00223 int Tolerance;
00224
00225
00226 int ClampToBounds;
00227 void ClampPosition(double x[3]);
00228 void HighlightPoint(int ptId, int highlight);
00229 void HighlightLine(int highlight);
00230 int InBounds(double x[3]);
00231 void SizeHandles();
00232
00233
00234 double StartP1[3];
00235 double StartP2[3];
00236 double StartLineHandle[3];
00237 double Length;
00238 double LastEventPosition[3];
00239
00240
00241 vtkBox *BoundingBox;
00242
00243
00244
00245
00246
00247 int InitializedDisplayPosition;
00248
00249 private:
00250 vtkLineRepresentation(const vtkLineRepresentation&);
00251 void operator=(const vtkLineRepresentation&);
00252 };
00253
00254 #endif