X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOBJECT%2FGEOM_Actor.h;h=b1e2d7a627a7d7dc9062239a87c357c2ffbc4892;hb=8999793a64e88dc19aba9ae983ee3c8848cd20d1;hp=cc62951591fe33ae1efecabca8310da3ae6bbea2;hpb=8bc9b430c5f9f3cf77539fee550f1b56769d3893;p=modules%2Fgeom.git diff --git a/src/OBJECT/GEOM_Actor.h b/src/OBJECT/GEOM_Actor.h index cc6295159..b1e2d7a62 100644 --- a/src/OBJECT/GEOM_Actor.h +++ b/src/OBJECT/GEOM_Actor.h @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -29,99 +29,194 @@ #ifndef GEOM_ACTOR_H #define GEOM_ACTOR_H -#include "SALOME_Actor.h" +#include "GEOM_OBJECT_defs.hxx" +#include "GEOM_SmartPtr.h" + +#include -//OpenCASCADE #include -#include +#include +class vtkCamera; -class TopoDS_Shape; +class GEOM_VertexSource; +typedef GEOM_SmartPtr PVertexSource; -#ifdef _WIN_32 -#define VTKOCC_EXPORT __declspec (dllexport) -#else -#define VTKOCC_EXPORT -#endif -class VTKOCC_EXPORT GEOM_Actor : public SALOME_Actor { +class GEOM_EdgeSource; +typedef GEOM_SmartPtr PEdgeSource; +class GEOM_WireframeFace; +typedef GEOM_SmartPtr PWFaceSource; - public: - vtkTypeMacro(GEOM_Actor,SALOME_Actor); +class GEOM_ShadingFace; +typedef GEOM_SmartPtr PSFaceSource; + +#include +class vtkRenderer; +class vtkAppendPolyData; +typedef GEOM_SmartPtr PAppendFilter; + +class GEOM_OBJECT_EXPORT GEOM_Actor: public SALOME_Actor +{ +public: + vtkTypeMacro(GEOM_Actor,SALOME_Actor); static GEOM_Actor* New(); + void SetShape(const TopoDS_Shape& theShape, + float theDeflection, + bool theIsRelative, + bool theIsVector = false); + + void SetDeflection(float theDeflection, bool theIsRelative); + float GetDeflection() const{ return myDeflection;} + bool GetIsRelative() const{ return myIsRelative;} + + void AddToRender(vtkRenderer* theRenderer); + void RemoveFromRender(vtkRenderer* theRenderer); + + enum EDisplayMode{ eWireframe, eShading}; + +/* void SetDisplayMode(EDisplayMode theMode); */ +/* EDisplayMode GetDisplayMode() const { return myDisplayMode;} */ + + void SetSelected(bool theIsSelected); + bool IsSelected() const { return myIsSelected;} + + // OLD METHODS + // Properties + void SetHighlightProperty(vtkProperty* Prop); + void SetWireframeProperty(vtkProperty* Prop); + void SetShadingProperty(vtkProperty* Prop); + + void setDeflection(double adef); + virtual void setDisplayMode(int thenewmode); + // Description: // This causes the actor to be rendered. It, in turn, will render the actor's // property and then mapper. virtual void Render(vtkRenderer *, vtkMapper *); - // Description: // Release any graphics resources that are being consumed by this actor. // The parameter window could be used to determine which graphic // resources to release. void ReleaseGraphicsResources(vtkWindow *); - const TopoDS_Shape& getTopo(); - void setInputShape(const TopoDS_Shape& ashape,double adef1,int imode); - + void setInputShape(const TopoDS_Shape& ashape, double adef1, + int imode, bool isVector = false); double getDeflection(); - void setDeflection(double adefl); + double isVector(); // SubShape void SubShapeOn(); void SubShapeOff(); - - // Display Mode - void setDisplayMode(int); // Highlight - void highlight(Standard_Boolean highlight); - bool hasHighlight(); + virtual void highlight(bool theHighlight); + virtual bool hasHighlight() { return true; } void ShallowCopy(vtkProp *prop); - // Properties - void SetHighlightProperty(vtkProperty* Prop); - void SetWireframeProperty(vtkProperty* Prop); - void SetShadingProperty(vtkProperty* Prop); - // Opacity - void SetOpacity(float opa); - float GetOpacity(); + void SetOpacity(vtkFloatingPointType opa); + vtkFloatingPointType GetOpacity(); // Color - void SetColor(float r,float g,float b); - void GetColor(float& r,float& g,float& b); + void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); + void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); + + virtual bool IsInfinitive(); + + // overloaded functions + //! To map current selection to VTK representation + virtual + void + Highlight(bool theHighlight); + + //---------------------------------------------------------------------------- + //! To process prehighlight (called from #SVTK_InteractorStyle) + virtual + bool + PreHighlight(vtkInteractorStyle* theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight); + + //! To process highlight (called from #SVTK_InteractorStyle) + virtual + bool + Highlight(vtkInteractorStyle* theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight); + + //! Visibility management + virtual + void + SetVisibility( int ); + + //! IsoLines management + // theNb[0] - number of U lines + // theNb[1] - number of V lines + virtual + void + SetNbIsos(const int theNb[2]); + + virtual + void + GetNbIsos(int &theNbU,int &theNbV); + +protected: + void SetShape(const TopoDS_Shape& theShape, + const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap, + bool theIsVector = false); + + void SetModified(); - virtual bool IsInfinite() {return myIsInfinite;} - protected: + void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result); GEOM_Actor(); ~GEOM_Actor(); - GEOM_Actor(const GEOM_Actor&) {}; - void operator=(const GEOM_Actor&) {}; - void CreateWireframeMapper(); - void CreateShadingMapper(); - void CreateMapper(int theMode); - void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result); +private: + TopoDS_Shape myShape; + int myNbIsos[2]; + float myDeflection; + bool myIsRelative; + bool myIsForced; - private: + // EDisplayMode myDisplayMode; + bool myIsSelected; - bool subshape; - bool myIsInfinite; + PDeviceActor myVertexActor; + PVertexSource myVertexSource; - TopoDS_Shape myShape; - double deflection; + PDeviceActor myIsolatedEdgeActor; + PEdgeSource myIsolatedEdgeSource; + + PDeviceActor myOneFaceEdgeActor; + PEdgeSource myOneFaceEdgeSource; + + PDeviceActor mySharedEdgeActor; + PEdgeSource mySharedEdgeSource; - vtkMapper* ShadingMapper; - vtkMapper* WireframeMapper; + PDeviceActor myWireframeFaceActor; + PWFaceSource myWireframeFaceSource; - vtkProperty* ShadingProperty; - vtkProperty* WireframeProperty; - vtkProperty* HighlightProperty; + PDeviceActor myShadingFaceActor; + PSFaceSource myShadingFaceSource; + PDeviceActor myHighlightActor; + vtkSmartPointer myHighlightProp; + vtkSmartPointer myPreHighlightProp; + vtkSmartPointer myShadingFaceProp; + + PAppendFilter myAppendFilter; + PPolyDataMapper myPolyDataMapper; + + virtual void SetMapper(vtkMapper*); + + GEOM_Actor(const GEOM_Actor&); + void operator=(const GEOM_Actor&); }; + #endif //GEOM_ACTOR_H