00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __vtkPVAxesActor_h
00041 #define __vtkPVAxesActor_h
00042
00043 #include "SVTK.h"
00044 #include "vtkProp3D.h"
00045
00046 class vtkRenderer;
00047 class vtkPropCollection;
00048 class vtkMapper;
00049 class vtkProperty;
00050 class vtkActor;
00051 class vtkFollower;
00052 class vtkCylinderSource;
00053 class vtkLineSource;
00054 class vtkConeSource;
00055 class vtkSphereSource;
00056 class vtkPolyData;
00057 class vtkVectorText;
00058
00059 class SVTK_EXPORT vtkPVAxesActor : public vtkProp3D
00060 {
00061 public:
00062 static vtkPVAxesActor *New();
00063 vtkTypeRevisionMacro(vtkPVAxesActor,vtkProp3D);
00064 void PrintSelf(ostream& os, vtkIndent indent);
00065
00066
00067
00068
00069
00070
00071 virtual void GetActors(vtkPropCollection *);
00072
00073
00074
00075 virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00076 #if (VTK_MINOR_VERSION>=2)
00077 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00078 virtual int HasTranslucentPolygonalGeometry();
00079 #else
00080 virtual int RenderTranslucentGeometry(vtkViewport *viewport);
00081 #endif
00082
00083
00084
00085 void ShallowCopy(vtkProp *prop);
00086
00087
00088
00089
00090
00091 void ReleaseGraphicsResources(vtkWindow *);
00092
00093
00094
00095
00096 void GetBounds(double bounds[6]);
00097 double *GetBounds();
00098
00099
00100
00101 unsigned long int GetMTime();
00102
00103
00104
00105
00106
00107
00108 virtual unsigned long GetRedrawMTime();
00109
00110
00111
00112 void SetTotalLength( float v[3] )
00113 { this->SetTotalLength( v[0], v[1], v[2] ); }
00114 void SetTotalLength( float x, float y, float z );
00115 vtkGetVectorMacro( TotalLength, float, 3 );
00116
00117
00118
00119 void SetNormalizedShaftLength( float v[3] )
00120 { this->SetNormalizedShaftLength( v[0], v[1], v[2] ); }
00121 void SetNormalizedShaftLength( float x, float y, float z );
00122 vtkGetVectorMacro( NormalizedShaftLength, float, 3 );
00123
00124
00125
00126 void SetNormalizedTipLength( float v[3] )
00127 { this->SetNormalizedTipLength( v[0], v[1], v[2] ); }
00128 void SetNormalizedTipLength( float x, float y, float z );
00129 vtkGetVectorMacro( NormalizedTipLength, float, 3 );
00130
00131
00132
00133 vtkSetClampMacro(ConeResolution, int, 3, 128);
00134 vtkGetMacro(ConeResolution, int);
00135 vtkSetClampMacro(SphereResolution, int, 3, 128);
00136 vtkGetMacro(SphereResolution, int);
00137 vtkSetClampMacro(CylinderResolution, int, 3, 128);
00138 vtkGetMacro(CylinderResolution, int);
00139
00140
00141
00142 vtkSetClampMacro(ConeRadius, float, 0, VTK_LARGE_FLOAT);
00143 vtkGetMacro(ConeRadius, float);
00144 vtkSetClampMacro(SphereRadius, float, 0, VTK_LARGE_FLOAT);
00145 vtkGetMacro(SphereRadius, float);
00146 vtkSetClampMacro(CylinderRadius, float, 0, VTK_LARGE_FLOAT);
00147 vtkGetMacro(CylinderRadius, float);
00148
00149
00150
00151 vtkSetClampMacro(XAxisLabelPosition, float, 0, 1);
00152 vtkGetMacro(XAxisLabelPosition, float);
00153 vtkSetClampMacro(YAxisLabelPosition, float, 0, 1);
00154 vtkGetMacro(YAxisLabelPosition, float);
00155 vtkSetClampMacro(ZAxisLabelPosition, float, 0, 1);
00156 vtkGetMacro(ZAxisLabelPosition, float);
00157
00158
00159
00160 void SetShaftType( int type );
00161 void SetShaftTypeToCylinder()
00162 { this->SetShaftType( vtkPVAxesActor::CYLINDER_SHAFT ); }
00163 void SetShaftTypeToLine()
00164 { this->SetShaftType( vtkPVAxesActor::LINE_SHAFT ); }
00165 void SetShaftTypeToUserDefined()
00166 { this->SetShaftType( vtkPVAxesActor::USER_DEFINED_SHAFT ); }
00167
00168
00169
00170 void SetTipType( int type );
00171 void SetTipTypeToCone()
00172 { this->SetTipType( vtkPVAxesActor::CONE_TIP ); }
00173 void SetTipTypeToSphere()
00174 { this->SetTipType( vtkPVAxesActor::SPHERE_TIP ); }
00175 void SetTipTypeToUserDefined()
00176 { this->SetTipType( vtkPVAxesActor::USER_DEFINED_TIP ); }
00177
00178
00179
00180
00181 void SetUserDefinedTip( vtkPolyData * );
00182 vtkGetObjectMacro( UserDefinedTip, vtkPolyData );
00183
00184
00185
00186 void SetUserDefinedShaft( vtkPolyData * );
00187 vtkGetObjectMacro( UserDefinedShaft, vtkPolyData );
00188
00189
00190
00191 vtkProperty *GetXAxisTipProperty();
00192 vtkProperty *GetYAxisTipProperty();
00193 vtkProperty *GetZAxisTipProperty();
00194
00195
00196
00197 vtkProperty *GetXAxisShaftProperty();
00198 vtkProperty *GetYAxisShaftProperty();
00199 vtkProperty *GetZAxisShaftProperty();
00200
00201
00202
00203 vtkProperty *GetXAxisLabelProperty();
00204 vtkProperty *GetYAxisLabelProperty();
00205 vtkProperty *GetZAxisLabelProperty();
00206
00207
00208
00209
00210 vtkSetStringMacro( XAxisLabelText );
00211 vtkSetStringMacro( YAxisLabelText );
00212 vtkSetStringMacro( ZAxisLabelText );
00213
00214
00215 enum
00216 {
00217 CYLINDER_SHAFT,
00218 LINE_SHAFT,
00219 USER_DEFINED_SHAFT
00220 };
00221
00222
00223 enum
00224 {
00225 CONE_TIP,
00226 SPHERE_TIP,
00227 USER_DEFINED_TIP
00228 };
00229
00230
00231
00232 void AddToRender( vtkRenderer* theRenderer );
00233
00234 protected:
00235 vtkPVAxesActor();
00236 ~vtkPVAxesActor();
00237
00238 vtkCylinderSource *CylinderSource;
00239 vtkLineSource *LineSource;
00240 vtkConeSource *ConeSource;
00241 vtkSphereSource *SphereSource;
00242
00243 vtkActor *XAxisShaft;
00244 vtkActor *YAxisShaft;
00245 vtkActor *ZAxisShaft;
00246
00247 vtkActor *XAxisTip;
00248 vtkActor *YAxisTip;
00249 vtkActor *ZAxisTip;
00250
00251 void UpdateProps();
00252
00253 float TotalLength[3];
00254 float NormalizedShaftLength[3];
00255 float NormalizedTipLength[3];
00256
00257 int ShaftType;
00258 int TipType;
00259
00260 vtkPolyData *UserDefinedTip;
00261 vtkPolyData *UserDefinedShaft;
00262
00263 char *XAxisLabelText;
00264 char *YAxisLabelText;
00265 char *ZAxisLabelText;
00266
00267 vtkVectorText *XAxisVectorText;
00268 vtkVectorText *YAxisVectorText;
00269 vtkVectorText *ZAxisVectorText;
00270
00271 vtkFollower *XAxisLabel;
00272 vtkFollower *YAxisLabel;
00273 vtkFollower *ZAxisLabel;
00274
00275 int ConeResolution;
00276 int SphereResolution;
00277 int CylinderResolution;
00278
00279 float ConeRadius;
00280 float SphereRadius;
00281 float CylinderRadius;
00282
00283 float XAxisLabelPosition;
00284 float YAxisLabelPosition;
00285 float ZAxisLabelPosition;
00286
00287 private:
00288 vtkPVAxesActor(const vtkPVAxesActor&);
00289 void operator=(const vtkPVAxesActor&);
00290 };
00291
00292 #endif
00293