1 // SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOME_Actor.h
25 // Author : Nicolas REJNERI
29 #ifndef SALOME_ACTOR_H
30 #define SALOME_ACTOR_H
33 #include "VTKViewer_Common.h"
34 #include "SALOME_InteractiveObject.hxx"
38 class SALOME_Transform;
39 class SALOME_GeometryFilter;
40 class SALOME_TransformFilter;
41 class SALOME_PassThroughFilter;
43 extern int SALOME_POINT_SIZE;
45 class SALOME_Actor : public vtkLODActor{
47 //constructor should be protected due to first implementation of this class
48 //it was abstract class
52 static SALOME_Actor* New();
54 vtkTypeMacro(SALOME_Actor,vtkLODActor);
56 virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
57 virtual Handle_SALOME_InteractiveObject getIO() { return myIO; }
58 virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
60 virtual Standard_CString getName() { return myName; }
61 virtual void setName(Standard_CString aName){
63 if(hasIO()) myIO->setName(aName);
66 virtual int getDisplayMode() { return myDisplayMode; }
67 virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
69 virtual bool hasHighlight() { return false; }
70 virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }
71 virtual Standard_Boolean isHighlighted() { return ishighlighted; }
73 virtual void SetOpacity(float opa) { m_opacity = opa; }
74 virtual float GetOpacity() { return m_opacity; }
76 virtual void SetColor(float r,float g,float b) {};
77 virtual void GetColor(float& r,float& g,float& b) {};
79 vtkSetObjectMacro(PreviewProperty,vtkProperty);
81 virtual void SetPreSelected(Standard_Boolean presel = Standard_False) { ispreselected = presel; }
83 // Used to obtain all dependent actors
84 virtual void GetChildActors(vtkActorCollection*) {};
86 virtual void AddToRender(vtkRenderer* theRenderer);
87 virtual void RemoveFromRender(vtkRenderer* theRenderer);
89 typedef std::vector<int> TVectorId;
90 virtual int GetObjId(int theVtkID) { return -1;}
91 virtual TVectorId GetVtkId(int theObjID) { return TVectorId();}
93 virtual int GetObjDimension( const int theObjId );
95 virtual void SetMapper(vtkMapper* theMapper);
96 virtual vtkPolyData* GetPolyDataInput();
98 virtual void SetTransform(SALOME_Transform* theTransform);
99 virtual unsigned long int GetMTime();
101 virtual void SetRepresentation(int theMode);
102 virtual int GetRepresentation();
104 // Infinitive means actor without size (point for example
105 // which is not taken into account in calculation of boundaries of the scene
106 virtual bool IsInfinitive() { return myIsInfinite; }
109 vtkProperty *PreviewProperty;
110 Standard_Boolean ispreselected;
112 Handle(SALOME_InteractiveObject) myIO;
113 Standard_CString myName;
116 Standard_Boolean ishighlighted;
121 SALOME_GeometryFilter *myGeomFilter;
122 SALOME_TransformFilter *myTransformFilter;
123 std::vector<SALOME_PassThroughFilter*> myPassFilter;
125 int myRepresentation;
126 vtkProperty *myProperty;
129 #endif // SALOME_ACTOR_H