1 // GEOM GEOMGUI : GUI for Geometry component
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 : GEOM_Displayer.h
25 // Author : Vadim SANDLER
29 #if !defined (__GEOM_DISPLAYER_H)
30 #define __GEOM_DISPLAYER_H
32 #include "SALOME_Prs.h"
33 #include "SALOME_InteractiveObject.hxx"
34 #include "SALOME_ListIO.hxx"
35 #include <TopoDS_Shape.hxx>
36 #include <Quantity_Color.hxx>
40 #include <SALOMEconfig.h>
41 #include CORBA_CLIENT_HEADER(GEOM_Gen)
43 #define GEOM_ALLOBJECTS -1 // Selection of all objects is activated
44 #define GEOM_PREVIEW -2 // Definition for preview selection
45 #define GEOM_ALLSHAPES -3 // Selection of all shapes is activated
46 #define GEOM_ALLGEOM -4 // Selection of all geom objects is activated
48 typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
50 class TColStd_MapOfInteger;
51 class SalomeApp_SelectionMgr;
52 class SalomeApp_Study;
53 class SUIT_SelectionFilter;
54 //class SALOME_Selection;
56 //#include <SALOME_WNT.hxx>
58 //#define SALOME_WNT_EXPORT
60 #if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS
61 #define GEOMGUI_WNT_EXPORT __declspec( dllexport )
63 #define GEOMGUI_WNT_EXPORT
66 class GEOMGUI_WNT_EXPORT GEOM_Displayer : public SALOME_Displayer
71 GEOM_Displayer( SalomeApp_Study* study );
73 virtual ~GEOM_Displayer();
75 /* Display/Erase object methods */
77 void Display ( const Handle(SALOME_InteractiveObject)& theIO,
78 const bool updateViewer = true,
79 SALOME_View* theViewFrame = 0 );
81 // This overloaded Display() method can be useful for operations
82 // not using dialog boxes.
83 void Display ( GEOM::GEOM_Object_ptr theObj,
84 const bool updateViewer = true );
86 void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
87 const bool updateViewer = true );
89 void Erase ( const Handle(SALOME_InteractiveObject)& theIO,
90 const bool forced = false,
91 const bool updateViewer = true,
92 SALOME_View* theViewFrame = 0 );
94 void Erase ( GEOM::GEOM_Object_ptr theObj,
95 const bool forced = false,
96 const bool updateViewer = true );
98 /* Display/Erase list of objects methods */
100 void Display ( const SALOME_ListIO& theIOList,
101 const bool updateViewer = true );
103 void Erase ( const SALOME_ListIO& theIOList,
104 const bool forced = false,
105 const bool updateViewer = true );
107 void Redisplay ( const SALOME_ListIO& theIOList,
108 const bool updateViewer = true );
110 /* Erase all objects displayed in the given or active view */
111 void EraseAll ( const bool forced = false,
112 const bool updateViewer = true,
113 SALOME_View* theViewFrame = 0 );
115 /* Update current viewer */
118 /* build presentation accordint to the current viewer type*/
119 SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
120 SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
122 /* Set color for shape displaying. If it is equal -1 then default color is used.
123 Available values are from Quantity_NameOfColor enumeration */
124 void SetColor ( const int );
126 int GetColor () const;
127 bool HasColor () const;
129 /* Set width for shape displaying. If it is equal -1 then default width is used. */
130 void SetWidth ( const double );
132 double GetWidth () const;
133 bool HasWidth () const;
136 /* Sets name - for temporary objects only */
137 void SetName( const char* theName ) { myName = theName; }
138 void UnsetName() { myName = ""; }
140 /* Reimplemented from SALOME_Displayer */
141 virtual void Update( SALOME_OCCPrs* );
142 virtual void Update( SALOME_VTKPrs* );
143 virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& );
144 virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& );
146 /* This methos is used for activisation/deactivisation of objects to be displayed*/
147 void SetToActivate( const bool );
148 bool ToActivate() const;
150 /* Activate/Deactivate selection*/
151 void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int );
152 void LocalSelection( const SALOME_ListIO& theIOList, const int );
153 void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
154 void GlobalSelection( const TColStd_MapOfInteger&, const bool = false );
156 static SALOME_View* GetActiveView();
157 SalomeApp_Study* getStudy() const {return myStudy;}
160 /* internal methods */
161 /* Builds presentation accordint to the current viewer type */
162 SALOME_Prs* buildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
163 SALOME_View* theViewFrame = 0 );
165 /* Sets interactive object */
166 void setIO( const Handle(SALOME_InteractiveObject)& theIO ) { myIO = theIO; }
169 void setShape( const TopoDS_Shape& theShape ) { myShape = theShape; }
171 /* Resets internal data */
172 void internalReset();
174 void clearTemporary( SalomeApp_SelectionMgr* theSelMgr );
176 SUIT_SelectionFilter* getFilter( const int theMode );
179 Handle(SALOME_InteractiveObject) myIO;
180 TopoDS_Shape myShape;
183 SALOME_View* myViewFrame;
186 Quantity_Color myShadingColor;
193 SalomeApp_Study* myStudy;
196 #endif // __GEOM_DISPLAYER_H