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 vtkTypeMacro(SALOME_Actor,vtkActor);
56 // This causes the actor to be rendered. It, in turn, will render the actor`s
57 // property and then mapper.
58 virtual void Render(vtkRenderer *, vtkMapper *);
61 // This method is used internally by the rendering process.
62 // We overide the superclass method to properly set the estimated render time.
63 virtual int RenderOpaqueGeometry(vtkViewport *viewport);
66 // Release any graphics resources that are being consumed by this actor.
67 // The parameter window could be used to determine which graphic
68 // resources to release.
69 virtual void ReleaseGraphicsResources(vtkWindow *);
71 virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
72 virtual Handle_SALOME_InteractiveObject getIO() { return myIO; }
73 virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
75 virtual Standard_CString getName() { return myName; }
76 virtual void setName(Standard_CString aName){
78 if(hasIO()) myIO->setName(aName);
81 virtual int getDisplayMode() { return myDisplayMode; }
82 virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
84 virtual bool hasHighlight() { return false; }
85 virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }
86 virtual Standard_Boolean isHighlighted() { return ishighlighted; }
88 virtual void SetOpacity(float opa) { m_opacity = opa; }
89 virtual float GetOpacity() { return m_opacity; }
91 virtual void SetColor(float r,float g,float b) {};
92 virtual void GetColor(float& r,float& g,float& b) {};
94 vtkSetObjectMacro(PreviewProperty,vtkProperty);
96 virtual void SetPreSelected(Standard_Boolean presel = Standard_False) { ispreselected = presel; }
98 // Used to obtain all dependent actors
99 virtual void GetChildActors(vtkActorCollection*) {};
101 virtual void AddToRender(vtkRenderer* theRenderer);
102 virtual void RemoveFromRender(vtkRenderer* theRenderer);
104 virtual vtkPolyData* GetPolyDataInput();
105 virtual void SetMapper(vtkMapper* theMapper);
106 virtual void SetTransform(SALOME_Transform* theTransform);
108 virtual void SetRepresentation(int theMode);
109 virtual int GetRepresentation();
112 vtkProperty *PreviewProperty;
113 Standard_Boolean ispreselected;
115 Handle_SALOME_InteractiveObject myIO;
116 Standard_CString myName;
119 Standard_Boolean ishighlighted;
122 SALOME_Transform *myTransform;
123 std::vector<SALOME_PassThroughFilter*> myPassFilter;
124 SALOME_TransformFilter *myTransformFilter;
125 int myRepresentation;
128 #endif // SALOME_ACTOR_H