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"
35 #ifndef _Handle_SALOME_InteractiveObject_HeaderFile
36 #include "Handle_SALOME_InteractiveObject.hxx"
40 class SALOME_Transform;
41 class SALOME_TransformFilter;
42 class SALOME_PassThroughFilter;
44 extern int SALOME_POINT_SIZE;
46 class SALOME_Actor : public vtkLODActor{
48 //constructor should be protected due to first implementation of this class
49 //it was abstract class
53 static SALOME_Actor* New();
55 vtkTypeMacro(SALOME_Actor,vtkLODActor);
58 // This causes the actor to be rendered. It, in turn, will render the actor`s
59 // property and then mapper.
60 //virtual void Render(vtkRenderer *, vtkMapper *);
63 // This method is used internally by the rendering process.
64 // We overide the superclass method to properly set the estimated render time.
65 //virtual int RenderOpaqueGeometry(vtkViewport *viewport);
68 // Release any graphics resources that are being consumed by this actor.
69 // The parameter window could be used to determine which graphic
70 // resources to release.
71 //virtual void ReleaseGraphicsResources(vtkWindow *);
73 virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
74 virtual Handle_SALOME_InteractiveObject getIO() { return myIO; }
75 virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
77 virtual Standard_CString getName() { return myName; }
78 virtual void setName(Standard_CString aName){
80 if(hasIO()) myIO->setName(aName);
83 virtual int getDisplayMode() { return myDisplayMode; }
84 virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
86 virtual bool hasHighlight() { return false; }
87 virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }
88 virtual Standard_Boolean isHighlighted() { return ishighlighted; }
90 virtual void SetOpacity(float opa) { m_opacity = opa; }
91 virtual float GetOpacity() { return m_opacity; }
93 virtual void SetColor(float r,float g,float b) {};
94 virtual void GetColor(float& r,float& g,float& b) {};
96 vtkSetObjectMacro(PreviewProperty,vtkProperty);
98 virtual void SetPreSelected(Standard_Boolean presel = Standard_False) { ispreselected = presel; }
100 // Used to obtain all dependent actors
101 virtual void GetChildActors(vtkActorCollection*) {};
103 virtual void AddToRender(vtkRenderer* theRenderer);
104 virtual void RemoveFromRender(vtkRenderer* theRenderer);
106 virtual vtkPolyData* GetPolyDataInput();
107 virtual void SetMapper(vtkMapper* theMapper);
108 virtual void SetTransform(SALOME_Transform* theTransform);
110 virtual unsigned long int GetMTime();
112 virtual void SetRepresentation(int theMode);
113 virtual int GetRepresentation();
115 // Infinitive means actor without size (point for example
116 // which is not taken into account in calculation of boundaries of the scene
117 virtual bool IsInfinitive() { return false; }
120 vtkProperty *PreviewProperty;
121 Standard_Boolean ispreselected;
123 Handle_SALOME_InteractiveObject myIO;
124 Standard_CString myName;
127 Standard_Boolean ishighlighted;
130 SALOME_Transform *myTransform;
131 std::vector<SALOME_PassThroughFilter*> myPassFilter;
132 SALOME_TransformFilter *myTransformFilter;
133 vtkProperty *myProperty;
134 int myRepresentation;
137 #endif // SALOME_ACTOR_H