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 void Highlight(int highlight);
00198
00199 protected:
00200 vtkConstrainedPointHandleRepresentation();
00201 ~vtkConstrainedPointHandleRepresentation();
00202
00203
00204 vtkActor *Actor;
00205 vtkPolyDataMapper *Mapper;
00206 vtkGlyph3D *Glypher;
00207 vtkPolyData *CursorShape;
00208 vtkPolyData *ActiveCursorShape;
00209 vtkPolyData *FocalData;
00210 vtkPoints *FocalPoint;
00211
00212
00213 double LastPickPosition[3];
00214 double LastEventPosition[2];
00215
00216
00217 void Translate(double eventPos[2]);
00218 void Scale(double eventPos[2]);
00219
00220
00221
00222
00223 vtkProperty *Property;
00224 vtkProperty *SelectedProperty;
00225 vtkProperty *ActiveProperty;
00226 void CreateDefaultProperties();
00227
00228
00229 int ProjectionNormal;
00230 double ProjectionPosition;
00231 int ProjectToPlane;
00232 vtkPlane *ObliquePlane;
00233
00234 vtkPlaneCollection *BoundingPlanes;
00235
00236
00237 int GetIntersectionPosition( double eventPos[2],
00238 double worldPos[3],
00239 double tolerance = 0.0,
00240 vtkRenderer *renderer=0);
00241
00242
00243 void GetProjectionNormal( double normal[3] );
00244
00245
00246
00247 void GetProjectionOrigin( double origin[3] );
00248
00249
00250
00251
00252
00253 double InteractionOffset[2];
00254
00255 private:
00256 vtkConstrainedPointHandleRepresentation(const vtkConstrainedPointHandleRepresentation&);
00257 void operator=(const vtkConstrainedPointHandleRepresentation&);
00258 };
00259
00260 #endif