]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GEOM_Displayer.h
Salome HOME
*** empty log message ***
[modules/geom.git] / src / GEOMGUI / GEOM_Displayer.h
1 // GEOM GEOMGUI : GUI for Geometry component
2 //
3 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : GEOM_Displayer.h
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24 //
25
26 #ifndef GEOM_DISPLAYER_H
27 #define GEOM_DISPLAYER_H
28
29 #include "GEOM_GEOMGUI.hxx"
30
31 #include <SALOME_InteractiveObject.hxx>
32
33 class SALOME_ListIO;
34 class SALOME_View;
35 class SALOME_Prs;
36 class SALOME_OCCPrs;
37 class SALOME_VTKPrs;
38 class SALOME_OCCViewType;
39
40 #include <TopoDS_Shape.hxx>
41 #include <Quantity_Color.hxx>
42 #include <LightApp_Displayer.h>
43 #include <Aspect_TypeOfMarker.hxx>
44
45 #include <list>
46
47 #include <SALOMEconfig.h>
48 #include CORBA_CLIENT_HEADER(GEOM_Gen)
49
50 #define GEOM_ALLOBJECTS -1 // Selection of all objects is activated
51 #define GEOM_PREVIEW    -2 // Definition for preview selection
52 #define GEOM_ALLSHAPES  -3 // Selection of all shapes is activated
53 #define GEOM_ALLGEOM    -4 // Selection of all geom objects is activated
54
55 typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
56
57 class TColStd_MapOfInteger;
58 class LightApp_SelectionMgr;
59 class SalomeApp_Study;
60 class SalomeApp_Application;
61 class SUIT_SelectionFilter;
62 //class SALOME_Selection;
63
64 class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer
65 {
66
67 public:
68   /* Constructor */
69   GEOM_Displayer( SalomeApp_Study* app );
70   /* Destructor */
71   virtual ~GEOM_Displayer();
72
73   virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const;
74
75   /* Display/Erase object methods */
76   void          Display   ( const Handle(SALOME_InteractiveObject)& theIO,
77                             const bool updateViewer = true,
78                             SALOME_View* theViewFrame = 0 );
79
80   // This overloaded Display() method can be useful for operations
81   // not using dialog boxes.
82   void          Display   ( GEOM::GEOM_Object_ptr theObj,
83                             const bool updateViewer = true );
84
85   void          Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
86                             const bool updateViewer = true );
87
88   void          Erase     ( const Handle(SALOME_InteractiveObject)& theIO,
89                             const bool forced = false,
90                             const bool updateViewer = true,
91                             SALOME_View* theViewFrame = 0 );
92
93   void          Erase     ( GEOM::GEOM_Object_ptr theObj,
94                             const bool forced = false,
95                             const bool updateViewer = true );
96
97   /* Display/Erase list of objects methods */
98
99   void          Display   ( const SALOME_ListIO& theIOList,
100                             const bool updateViewer = true );
101
102   void          Erase     ( const SALOME_ListIO& theIOList,
103                             const bool forced = false,
104                             const bool updateViewer = true );
105
106   void          Redisplay ( const SALOME_ListIO& theIOList,
107                             const bool updateViewer = true );
108
109   /* build presentation accordint to the current viewer type*/
110   SALOME_Prs*   BuildPrs  ( GEOM::GEOM_Object_ptr );
111   SALOME_Prs*   BuildPrs  ( const TopoDS_Shape& );
112
113   /* Set color for shape displaying. If it is equal -1 then default color is used.
114      Available values are from Quantity_NameOfColor enumeration */
115   void          SetColor  ( const int );
116   void          UnsetColor();
117   int           GetColor  () const;
118   bool          HasColor  () const;
119
120   /* Set width for shape displaying. If it is equal -1 then default width is used. */
121   void          SetWidth  ( const double );
122   void          UnsetWidth();
123   double        GetWidth  () const;
124   bool          HasWidth  () const;
125   
126   /* Set display mode shape displaying. If it is equal -1 then display mode is used. */
127   int           SetDisplayMode( const int );
128   int           GetDisplayMode() const;
129   int           UnsetDisplayMode();
130
131
132   /* Sets name - for temporary objects only */
133   void          SetName( const char* theName );
134   void          UnsetName();
135
136   /* Reimplemented from SALOME_Displayer */
137   virtual void  Update( SALOME_OCCPrs* );
138   virtual void  Update( SALOME_VTKPrs* );
139   virtual void  BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& );
140   virtual void  AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& );
141
142   /* This methos is used for activisation/deactivisation of objects to be displayed*/
143   void          SetToActivate( const bool );
144   bool          ToActivate() const;
145
146   /* Activate/Deactivate selection*/
147   void         LocalSelection( const Handle(SALOME_InteractiveObject)&, const int );
148   void         LocalSelection( const SALOME_ListIO& theIOList, const int );
149   void         GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
150   void         GlobalSelection( const TColStd_MapOfInteger&, const bool = false );
151
152   SalomeApp_Study* getStudy() const;
153
154 protected:
155   /* internal methods */
156   /* Builds presentation accordint to the current viewer type */
157   virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
158
159   /* Sets interactive object */
160   void        setIO( const Handle(SALOME_InteractiveObject)& theIO );
161
162   /* Sets shape */
163   void        setShape( const TopoDS_Shape& theShape );
164
165   /* Resets internal data */
166   void        internalReset();
167
168   void        clearTemporary( LightApp_SelectionMgr* theSelMgr );
169
170   SUIT_SelectionFilter* getFilter( const int theMode );
171
172 protected:
173   Handle(SALOME_InteractiveObject) myIO;
174   TopoDS_Shape                     myShape;
175   string                           myName;
176   int                              myType;
177   SALOME_View*                     myViewFrame;
178
179   // Attributes
180   Quantity_Color                   myShadingColor;
181   int                              myColor;
182   double                           myWidth;
183   bool                             myToActivate;
184   int                              myDisplayMode;
185   Aspect_TypeOfMarker              myTypeOfMarker;
186   double                           myScaleOfMarker;
187
188 private:
189   SalomeApp_Application* myApp;
190 };
191
192 #endif // GEOM_DISPLAYER_H
193