00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00039 #ifndef __vtkConstrainedPointHandleRepresentation_h
00040 #define __vtkConstrainedPointHandleRepresentation_h
00041
00042 #include "vtkHandleRepresentation.h"
00043
00044 class vtkProperty;
00045 class vtkActor;
00046 class vtkPolyDataMapper;
00047 class vtkPolyData;
00048 class vtkGlyph3D;
00049 class vtkPoints;
00050 class vtkPolyData;
00051 class vtkPlane;
00052 class vtkPlaneCollection;
00053 class vtkPlanes;
00054 class vtkRenderer;
00055
00056 class VTK_WIDGETS_EXPORT vtkConstrainedPointHandleRepresentation : public vtkHandleRepresentation
00057 {
00058 public:
00060 static vtkConstrainedPointHandleRepresentation *New();
00061
00063
00064 vtkTypeMacro(vtkConstrainedPointHandleRepresentation,vtkHandleRepresentation);
00065 void PrintSelf(ostream& os, vtkIndent indent);
00067
00069
00072 void SetCursorShape(vtkPolyData *cursorShape);
00073 vtkPolyData *GetCursorShape();
00075
00077
00080 void SetActiveCursorShape(vtkPolyData *activeShape);
00081 vtkPolyData *GetActiveCursorShape();
00083
00085
00088 vtkSetClampMacro(ProjectionNormal,int,
00089 vtkConstrainedPointHandleRepresentation::XAxis,
00090 vtkConstrainedPointHandleRepresentation::Oblique);
00091 vtkGetMacro(ProjectionNormal,int);
00093
00094 void SetProjectionNormalToXAxis()
00095 { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis); }
00096 void SetProjectionNormalToYAxis()
00097 { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis); }
00098 void SetProjectionNormalToZAxis()
00099 { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis); }
00100 void SetProjectionNormalToOblique()
00101 { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique); }
00102
00104
00106 void SetObliquePlane(vtkPlane *);
00107 vtkGetObjectMacro(ObliquePlane, vtkPlane);
00109
00111
00115 void SetProjectionPosition(double position);
00116 vtkGetMacro(ProjectionPosition, double);
00118
00120
00126 void AddBoundingPlane(vtkPlane *plane);
00127 void RemoveBoundingPlane(vtkPlane *plane);
00128 void RemoveAllBoundingPlanes();
00129 virtual void SetBoundingPlanes(vtkPlaneCollection*);
00130 vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
00131 void SetBoundingPlanes(vtkPlanes *planes);
00133
00137 virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]);
00138
00140
00143 void SetPosition(double x, double y, double z);
00144 void SetPosition(double xyz[3]);
00145 double* GetPosition();
00146 void GetPosition(double xyz[3]);
00148
00150
00152 vtkGetObjectMacro(Property,vtkProperty);
00154
00156
00158 vtkGetObjectMacro(SelectedProperty,vtkProperty);
00160
00162
00164 vtkGetObjectMacro(ActiveProperty,vtkProperty);
00166
00168
00171 virtual void SetRenderer(vtkRenderer *ren);
00172 virtual void BuildRepresentation();
00173 virtual void StartWidgetInteraction(double eventPos[2]);
00174 virtual void WidgetInteraction(double eventPos[2]);
00175 virtual int ComputeInteractionState(int X, int Y, int modify);
00177
00180 virtual void SetDisplayPosition(double pos[3]);
00181
00183
00184 virtual void GetActors(vtkPropCollection *);
00185 virtual void ReleaseGraphicsResources(vtkWindow *);
00186 virtual int RenderOverlay(vtkViewport *viewport);
00187 virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00188 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00189 virtual int HasTranslucentPolygonalGeometry();
00190 virtual void ShallowCopy(vtkProp* prop);
00192
00193
00194 enum {XAxis=0,YAxis,ZAxis,Oblique};
00195
00196
00197 protected:
00198 vtkConstrainedPointHandleRepresentation();
00199 ~vtkConstrainedPointHandleRepresentation();
00200
00201
00202 vtkActor *Actor;
00203 vtkPolyDataMapper *Mapper;
00204 vtkGlyph3D *Glypher;
00205 vtkPolyData *CursorShape;
00206 vtkPolyData *ActiveCursorShape;
00207 vtkPolyData *FocalData;
00208 vtkPoints *FocalPoint;
00209
00210
00211 double LastPickPosition[3];
00212 double LastEventPosition[2];
00213
00214
00215 void Translate(double eventPos[2]);
00216 void Scale(double eventPos[2]);
00217 void Highlight(int highlight);
00218
00219
00220
00221 vtkProperty *Property;
00222 vtkProperty *SelectedProperty;
00223 vtkProperty *ActiveProperty;
00224 void CreateDefaultProperties();
00225
00226
00227 int ProjectionNormal;
00228 double ProjectionPosition;
00229 int ProjectToPlane;
00230 vtkPlane *ObliquePlane;
00231
00232 vtkPlaneCollection *BoundingPlanes;
00233
00234
00235 int GetIntersectionPosition( double eventPos[2],
00236 double worldPos[3],
00237 double tolerance = 0.0,
00238 vtkRenderer *renderer=0);
00239
00240
00241 void GetProjectionNormal( double normal[3] );
00242
00243
00244
00245 void GetProjectionOrigin( double origin[3] );
00246
00247
00248
00249
00250
00251 double InteractionOffset[2];
00252
00253 private:
00254 vtkConstrainedPointHandleRepresentation(const vtkConstrainedPointHandleRepresentation&);
00255 void operator=(const vtkConstrainedPointHandleRepresentation&);
00256 };
00257
00258 #endif