Go to the documentation of this file.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 #ifndef GEOM_ACTOR_H
00030 #define GEOM_ACTOR_H
00031
00032 #include "GEOM_OBJECT_defs.hxx"
00033 #include "GEOM_SmartPtr.h"
00034
00035 #include <SALOME_Actor.h>
00036
00037 #include <TopoDS_Shape.hxx>
00038 #include <vtkSmartPointer.h>
00039
00040 class vtkCamera;
00041
00042 class GEOM_VertexSource;
00043 typedef GEOM_SmartPtr<GEOM_VertexSource> PVertexSource;
00044
00045 class GEOM_EdgeSource;
00046 typedef GEOM_SmartPtr<GEOM_EdgeSource> PEdgeSource;
00047
00048 class GEOM_WireframeFace;
00049 typedef GEOM_SmartPtr<GEOM_WireframeFace> PWFaceSource;
00050
00051 class GEOM_ShadingFace;
00052 typedef GEOM_SmartPtr<GEOM_ShadingFace> PSFaceSource;
00053
00054 class vtkRenderer;
00055
00056 class vtkAppendPolyData;
00057 typedef GEOM_SmartPtr<vtkAppendPolyData> PAppendFilter;
00058
00059 class GEOM_OBJECT_EXPORT GEOM_Actor: public SALOME_Actor
00060 {
00061 public:
00062 vtkTypeMacro(GEOM_Actor,SALOME_Actor);
00063 static GEOM_Actor* New();
00064
00065 void SetShape(const TopoDS_Shape& theShape,
00066 float theDeflection,
00067 bool theIsVector = false);
00068
00069 void SetDeflection(float theDeflection);
00070 float GetDeflection() const{ return myDeflection;}
00071
00072 void AddToRender(vtkRenderer* theRenderer);
00073 void RemoveFromRender(vtkRenderer* theRenderer);
00074
00075 enum EDisplayMode{ eWireframe, eShading};
00076
00077
00078
00079
00080 void SetSelected(bool theIsSelected);
00081 bool IsSelected() const { return myIsSelected;}
00082
00083
00084
00085 void SetHighlightProperty(vtkProperty* Prop);
00086 void SetWireframeProperty(vtkProperty* Prop);
00087 void SetShadingProperty(vtkProperty* Prop);
00088
00089 void setDeflection(double adef);
00090 virtual void setDisplayMode(int thenewmode);
00091
00092
00093
00094
00095 virtual void Render(vtkRenderer *, vtkMapper *);
00096
00097
00098
00099
00100 void ReleaseGraphicsResources(vtkWindow *);
00101 const TopoDS_Shape& getTopo();
00102 void setInputShape(const TopoDS_Shape& ashape, double adef1,
00103 int imode, bool isVector = false);
00104 double getDeflection();
00105 double isVector();
00106
00107
00108 void SubShapeOn();
00109 void SubShapeOff();
00110
00111
00112 virtual void highlight(bool theHighlight);
00113 virtual bool hasHighlight() { return true; }
00114
00115 void ShallowCopy(vtkProp *prop);
00116
00117
00118 void SetOpacity(vtkFloatingPointType opa);
00119 vtkFloatingPointType GetOpacity();
00120
00121
00122 void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
00123 void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
00124
00125 virtual bool IsInfinitive();
00126
00127
00129 virtual
00130 void
00131 Highlight(bool theHighlight);
00132
00133
00135 virtual
00136 bool
00137 PreHighlight(vtkInteractorStyle* theInteractorStyle,
00138 SVTK_SelectionEvent* theSelectionEvent,
00139 bool theIsHighlight);
00140
00142 virtual
00143 bool
00144 Highlight(vtkInteractorStyle* theInteractorStyle,
00145 SVTK_SelectionEvent* theSelectionEvent,
00146 bool theIsHighlight);
00147
00149 virtual
00150 void
00151 SetVisibility( int );
00152
00154
00155
00156 virtual
00157 void
00158 SetNbIsos(const int theNb[2]);
00159
00160 virtual
00161 void
00162 GetNbIsos(int &theNbU,int &theNbV);
00163
00165 virtual
00166 void
00167 SetVectorMode(const bool theMode);
00168
00169 virtual
00170 bool
00171 GetVectorMode();
00172
00173 protected:
00174 void SetModified();
00175
00176 void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
00177
00178 GEOM_Actor();
00179 ~GEOM_Actor();
00180
00181 private:
00182 TopoDS_Shape myShape;
00183 int myNbIsos[2];
00184 bool isOnlyVertex;
00185
00186 float myDeflection;
00187 bool myIsForced;
00188
00189
00190 bool myIsSelected;
00191 bool myVectorMode;
00192
00193 PDeviceActor myVertexActor;
00194 PVertexSource myVertexSource;
00195
00196 PDeviceActor myIsolatedEdgeActor;
00197 PEdgeSource myIsolatedEdgeSource;
00198
00199 PDeviceActor myOneFaceEdgeActor;
00200 PEdgeSource myOneFaceEdgeSource;
00201
00202 PDeviceActor mySharedEdgeActor;
00203 PEdgeSource mySharedEdgeSource;
00204
00205 PDeviceActor myWireframeFaceActor;
00206 PWFaceSource myWireframeFaceSource;
00207
00208 PDeviceActor myShadingFaceActor;
00209 PSFaceSource myShadingFaceSource;
00210
00211 PDeviceActor myHighlightActor;
00212 vtkSmartPointer<vtkProperty> myHighlightProp;
00213 vtkSmartPointer<vtkProperty> myPreHighlightProp;
00214 vtkSmartPointer<vtkProperty> myShadingFaceProp;
00215
00216 PAppendFilter myAppendFilter;
00217 PPolyDataMapper myPolyDataMapper;
00218
00219 virtual void SetMapper(vtkMapper*);
00220
00221 GEOM_Actor(const GEOM_Actor&);
00222 void operator=(const GEOM_Actor&);
00223 };
00224
00225 #endif //GEOM_ACTOR_H
00226
00227