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 class vtkFollower;
00055 class vtkVectorText;
00056 class vtkPolyDataMapper;
00057
00058 class VTK_WIDGETS_EXPORT vtkLineRepresentation : public vtkWidgetRepresentation
00059 {
00060 public:
00062 static vtkLineRepresentation *New();
00063
00065
00066 vtkTypeRevisionMacro(vtkLineRepresentation,vtkWidgetRepresentation);
00067 void PrintSelf(ostream& os, vtkIndent indent);
00069
00071
00074 void GetPoint1WorldPosition(double pos[3]);
00075 double* GetPoint1WorldPosition();
00076 void GetPoint1DisplayPosition(double pos[3]);
00077 double* GetPoint1DisplayPosition();
00078 void SetPoint1WorldPosition(double pos[3]);
00079 void SetPoint1DisplayPosition(double pos[3]);
00080 void GetPoint2DisplayPosition(double pos[3]);
00081 double* GetPoint2DisplayPosition();
00082 void GetPoint2WorldPosition(double pos[3]);
00083 double* GetPoint2WorldPosition();
00084 void SetPoint2WorldPosition(double pos[3]);
00085 void SetPoint2DisplayPosition(double pos[3]);
00087
00089
00097 void SetHandleRepresentation(vtkPointHandleRepresentation3D *handle);
00098 void InstantiateHandleRepresentation();
00100
00102
00103 vtkGetObjectMacro(Point1Representation,vtkPointHandleRepresentation3D);
00104 vtkGetObjectMacro(Point2Representation,vtkPointHandleRepresentation3D);
00105 vtkGetObjectMacro(LineHandleRepresentation,vtkPointHandleRepresentation3D);
00107
00109
00111 vtkGetObjectMacro(EndPointProperty,vtkProperty);
00112 vtkGetObjectMacro(SelectedEndPointProperty,vtkProperty);
00114
00116
00118 vtkGetObjectMacro(LineProperty,vtkProperty);
00119 vtkGetObjectMacro(SelectedLineProperty,vtkProperty);
00121
00123
00126 vtkSetClampMacro(Tolerance,int,1,100);
00127 vtkGetMacro(Tolerance,int);
00129
00131
00134 void SetResolution(int res);
00135 int GetResolution();
00137
00144 void GetPolyData(vtkPolyData *pd);
00145
00147
00148 virtual void PlaceWidget(double bounds[6]);
00149 virtual void BuildRepresentation();
00150 virtual int ComputeInteractionState(int X, int Y, int modify=0);
00151 virtual void StartWidgetInteraction(double e[2]);
00152 virtual void WidgetInteraction(double e[2]);
00153 virtual double *GetBounds();
00155
00157
00158 virtual void GetActors(vtkPropCollection *pc);
00159 virtual void ReleaseGraphicsResources(vtkWindow*);
00160 virtual int RenderOpaqueGeometry(vtkViewport*);
00161 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
00162 virtual int HasTranslucentPolygonalGeometry();
00164
00165
00166 enum {Outside=0,OnP1,OnP2,TranslatingP1,TranslatingP2,OnLine,Scaling};
00167
00168
00170
00177 vtkSetClampMacro(InteractionState,int,Outside,Scaling);
00179
00181
00183 virtual void SetRepresentationState(int);
00184 vtkGetMacro(RepresentationState, int);
00186
00189 virtual unsigned long GetMTime();
00190
00192 virtual void SetRenderer(vtkRenderer *ren);
00193
00195
00196 vtkSetMacro( DistanceAnnotationVisibility, int );
00197 vtkGetMacro( DistanceAnnotationVisibility, int );
00198 vtkBooleanMacro( DistanceAnnotationVisibility, int );
00200
00202
00205 vtkSetStringMacro(DistanceAnnotationFormat);
00206 vtkGetStringMacro(DistanceAnnotationFormat);
00208
00210
00211 virtual void SetDistanceAnnotationScale( double scale[3] );
00212 virtual double * GetDistanceAnnotationScale();
00214
00216 double GetDistance();
00217
00218 protected:
00219 vtkLineRepresentation();
00220 ~vtkLineRepresentation();
00221
00222
00223 vtkPointHandleRepresentation3D *HandleRepresentation;
00224 vtkPointHandleRepresentation3D *Point1Representation;
00225 vtkPointHandleRepresentation3D *Point2Representation;
00226 vtkPointHandleRepresentation3D *LineHandleRepresentation;
00227
00228
00229 int RepresentationState;
00230
00231
00232 vtkActor *LineActor;
00233 vtkPolyDataMapper *LineMapper;
00234 vtkLineSource *LineSource;
00235
00236
00237 vtkActor **Handle;
00238 vtkPolyDataMapper **HandleMapper;
00239 vtkSphereSource **HandleGeometry;
00240
00241
00242
00243 vtkProperty *EndPointProperty;
00244 vtkProperty *SelectedEndPointProperty;
00245 vtkProperty *LineProperty;
00246 vtkProperty *SelectedLineProperty;
00247 void CreateDefaultProperties();
00248
00249
00250 int Tolerance;
00251
00252
00253 int ClampToBounds;
00254 void ClampPosition(double x[3]);
00255 void HighlightPoint(int ptId, int highlight);
00256 void HighlightLine(int highlight);
00257 int InBounds(double x[3]);
00258 void SizeHandles();
00259
00260
00261 double StartP1[3];
00262 double StartP2[3];
00263 double StartLineHandle[3];
00264 double Length;
00265 double LastEventPosition[3];
00266
00267
00268 vtkBox *BoundingBox;
00269
00270
00271
00272
00273
00274 int InitializedDisplayPosition;
00275
00276
00277 int DistanceAnnotationVisibility;
00278 char *DistanceAnnotationFormat;
00279
00280 vtkFollower *TextActor;
00281 vtkPolyDataMapper *TextMapper;
00282 vtkVectorText *TextInput;
00283 double Distance;
00284 bool AnnotationTextScaleInitialized;
00285
00286 private:
00287 vtkLineRepresentation(const vtkLineRepresentation&);
00288 void operator=(const vtkLineRepresentation&);
00289 };
00290
00291 #endif