00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00033 #ifndef __vtkParallelopipedRepresentation_h
00034 #define __vtkParallelopipedRepresentation_h
00035
00036 #include "vtkWidgetRepresentation.h"
00037
00038 class vtkActor;
00039 class vtkPlane;
00040 class vtkPoints;
00041 class vtkPolyData;
00042 class vtkPolyDataMapper;
00043 class vtkProperty;
00044 class vtkCellArray;
00045 class vtkTransform;
00046 class vtkHandleRepresentation;
00047 class vtkClosedSurfacePointPlacer;
00048 class vtkPlaneCollection;
00049 class vtkParallelopipedTopology;
00050
00051 class VTK_WIDGETS_EXPORT vtkParallelopipedRepresentation
00052 : public vtkWidgetRepresentation
00053 {
00054 public:
00056 static vtkParallelopipedRepresentation *New();
00057
00059
00060 vtkTypeMacro(vtkParallelopipedRepresentation,vtkWidgetRepresentation);
00061 void PrintSelf(ostream& os, vtkIndent indent);
00063
00065 virtual void GetActors(vtkPropCollection *pc);
00066
00068
00076 virtual void PlaceWidget(double corners[8][3]);
00077 virtual void PlaceWidget(double bounds[6]);
00079
00081
00084 vtkSetMacro(InteractionState,int);
00086
00092 void GetBoundingPlanes( vtkPlaneCollection *pc );
00093
00095 void GetPolyData(vtkPolyData *pd);
00096
00098 virtual double *GetBounds();
00099
00101
00102 virtual void SetHandleProperty (vtkProperty *);
00103 virtual void SetHoveredHandleProperty (vtkProperty *);
00104 virtual void SetSelectedHandleProperty (vtkProperty *);
00105 vtkGetObjectMacro(HandleProperty, vtkProperty );
00106 vtkGetObjectMacro(HoveredHandleProperty, vtkProperty );
00107 vtkGetObjectMacro(SelectedHandleProperty, vtkProperty );
00109
00110 void SetHandleRepresentation(vtkHandleRepresentation *handle);
00111 vtkHandleRepresentation* GetHandleRepresentation(int index);
00112
00114
00116 void HandlesOn();
00117 void HandlesOff();
00119
00121
00123 vtkGetObjectMacro(FaceProperty,vtkProperty);
00124 vtkGetObjectMacro(SelectedFaceProperty,vtkProperty);
00126
00128
00130 vtkGetObjectMacro(OutlineProperty,vtkProperty);
00131 vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
00133
00136 virtual void BuildRepresentation();
00137
00139
00140 virtual void ReleaseGraphicsResources(vtkWindow *w);
00141 virtual int RenderOverlay(vtkViewport *viewport);
00142 virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00144
00147 virtual int ComputeInteractionState(int X, int Y, int modify=0);
00148
00149
00150 enum _InteractionState
00151 {
00152 Outside = 0,
00153 Inside,
00154 RequestResizeParallelopiped,
00155 RequestResizeParallelopipedAlongAnAxis,
00156 RequestChairMode,
00157 RequestTranslateParallelopiped,
00158 RequestScaleParallelopiped,
00159 RequestRotateParallelopiped,
00160 ResizingParallelopiped,
00161 ResizingParallelopipedAlongAnAxis,
00162 ChairMode,
00163 TranslatingParallelopiped,
00164 ScalingParallelopiped,
00165 RotatingParallelopiped
00166 };
00167
00168
00169
00170 virtual void Translate( double translation[3] );
00171 virtual void Translate( int X, int Y );
00172 virtual void Scale( int X, int Y );
00173
00176 virtual void PositionHandles();
00177
00179
00183 vtkSetMacro( MinimumThickness, double );
00184 vtkGetMacro( MinimumThickness, double );
00186
00187 protected:
00188 vtkParallelopipedRepresentation();
00189 ~vtkParallelopipedRepresentation();
00190
00192 void TranslatePoint( int n, const double motionVector[3] );
00193
00196 void SetHandleHighlight( int handleIdx, vtkProperty *property );
00197
00199
00201 void SetFaceHighlight( vtkCellArray * face, vtkProperty * );
00202 void HighlightAllFaces();
00203 void UnHighlightAllFaces();
00205
00206
00207
00208
00209 void UpdateChairAtNode( int node );
00210
00211
00212 void RemoveExistingChairs();
00213
00214
00215
00216
00217
00218
00219 void GetParallelopipedBoundingPlanes( vtkPlaneCollection * pc );
00220
00221
00222 void DefinePlane( vtkPlane *, double p[3][3]);
00223
00224
00225
00226
00227
00228 void DefinePlane( vtkPlane *, vtkIdType, vtkIdType, vtkIdType);
00229
00230 vtkActor * HexActor;
00231 vtkPolyDataMapper * HexMapper;
00232 vtkPolyData * HexPolyData;
00233 vtkPoints * Points;
00234 vtkActor * HexFaceActor;
00235 vtkPolyDataMapper * HexFaceMapper;
00236 vtkPolyData * HexFacePolyData;
00237
00238 double LastEventPosition[2];
00239
00240
00241 int LastResizeAxisIdx;
00242
00243 vtkHandleRepresentation * HandleRepresentation;
00244 vtkHandleRepresentation ** HandleRepresentations;
00245 int CurrentHandleIdx;
00246 int ChairHandleIdx;
00247
00248
00249
00250
00251 double InitialChairDepth;
00252
00253 vtkProperty * HandleProperty;
00254 vtkProperty * HoveredHandleProperty;
00255 vtkProperty * FaceProperty;
00256 vtkProperty * OutlineProperty;
00257 vtkProperty * SelectedHandleProperty;
00258 vtkProperty * SelectedFaceProperty;
00259 vtkProperty * SelectedOutlineProperty;
00260 vtkClosedSurfacePointPlacer * ChairPointPlacer;
00261 vtkParallelopipedTopology * Topology;
00262 double MinimumThickness;
00263 double AbsoluteMinimumThickness;
00264
00265 private:
00266 vtkParallelopipedRepresentation(const vtkParallelopipedRepresentation&);
00267 void operator=(const vtkParallelopipedRepresentation&);
00268 };
00269
00270 #endif