Salome HOME
PAL12608: Add possibility to check geometry of a shape.
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.hh
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 #ifndef __GEOM_GEN_I_H__
21 #define __GEOM_GEN_I_H__
22
23 #include "GEOMImpl_Gen.hxx"
24
25 // IDL headers
26 #include <SALOMEconfig.h>
27 #include CORBA_SERVER_HEADER(GEOM_Gen)
28
29 #include CORBA_CLIENT_HEADER(SALOMEDS)
30 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
31
32
33 #include "SALOME_Component_i.hxx"
34 #include "SALOME_NamingService.hxx"
35
36 #include "GEOM_IBasicOperations_i.hh"
37 #include "GEOM_ITransformOperations_i.hh"
38 #include "GEOM_I3DPrimOperations_i.hh"
39 #include "GEOM_IShapesOperations_i.hh"
40 #include "GEOM_IBlocksOperations_i.hh"
41 #include "GEOM_IBooleanOperations_i.hh"
42 #include "GEOM_ICurvesOperations_i.hh"
43 #include "GEOM_ILocalOperations_i.hh"
44 #include "GEOM_IHealingOperations_i.hh"
45 #include "GEOM_IInsertOperations_i.hh"
46 #include "GEOM_IMeasureOperations_i.hh"
47 #include "GEOM_IGroupOperations_i.hh"
48
49 //#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
50
51
52 //=====================================================================
53 // GEOM_Gen_i : class definition
54 //=====================================================================
55 class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Component_i
56 {
57  public:
58
59   //-----------------------------------------------------------------------//
60   // Constructor / Destructor                                              //
61   //-----------------------------------------------------------------------//
62
63   // constructor to be called for servant creation.
64   GEOM_Gen_i();
65   GEOM_Gen_i(CORBA::ORB_ptr orb,
66              PortableServer::POA_ptr poa,
67              PortableServer::ObjectId * contId,
68              const char *instanceName,
69              const char *interfaceName);
70
71   // destructor, doing nothing (for now)
72   virtual ~GEOM_Gen_i();
73
74   // generic method to be put in a super class
75   void register_name(char * name);
76
77
78   //-----------------------------------------------------------------------//
79   // Inherited methods from SALOMEDS::Driver                               //
80   //-----------------------------------------------------------------------//
81
82   SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
83                           const char* theURL,
84                           bool isMultiFile);
85
86   SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
87                                const char* theURL,
88                                bool isMultiFile);
89
90   CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
91                       const SALOMEDS::TMPFile& theStream,
92                       const char* theURL,
93                       bool isMultiFile);
94
95   CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
96                            const SALOMEDS::TMPFile& theStream,
97                            const char* theURL,
98                            bool isMultiFile);
99
100   void Close(SALOMEDS::SComponent_ptr theComponent);
101   char* ComponentDataType();
102
103
104   char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
105                                const char* IORString,
106                                CORBA::Boolean isMultiFile,
107                                CORBA::Boolean isASCII);
108   char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
109                                const char* aLocalPersistentID,
110                                CORBA::Boolean isMultiFile,
111                                CORBA::Boolean isASCII);
112
113   bool CanPublishInStudy(CORBA::Object_ptr theIOR);
114   SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
115                                        SALOMEDS::SObject_ptr theSObject,
116                                        CORBA::Object_ptr theObject,
117                                        const char* theName) throw (SALOME::SALOME_Exception) ;
118
119   CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
120   SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
121   CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
122   SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
123                                   CORBA::Long theObjectID,
124                                   SALOMEDS::SObject_ptr theObject);
125
126   /*! \brief Adds theObject in the study with a name = theName, if
127    *         theFather is not null the object is placed under theFather
128    */
129   SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
130                                     GEOM::GEOM_Object_ptr theObject,
131                                     const char* theName,
132                                     GEOM::GEOM_Object_ptr theFather);
133
134   //-----------------------------------------------------------------------//
135   // Transaction methods                                                   //
136   //-----------------------------------------------------------------------//
137
138   //Undos one transaction in the document associated with theStudyID
139   virtual void Undo(CORBA::Long theStudyID);
140
141   //Redos one transaction in the document associated with theStudyID
142   virtual void Redo(CORBA::Long theStudyID);
143
144   //-----------------------------------------------------------------------//
145   // Operations methods                                                    //
146   //-----------------------------------------------------------------------//
147
148   //Returns a pointer to BasicOperations interface
149   virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
150     throw (SALOME::SALOME_Exception);
151
152   //Returns a pointer to TransformOperations interface
153   virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
154     throw (SALOME::SALOME_Exception);
155
156   //Returns a pointer to 3DPrimOperations interface
157   virtual GEOM::GEOM_I3DPrimOperations_ptr GetI3DPrimOperations (CORBA::Long theStudyID)
158     throw (SALOME::SALOME_Exception);
159
160   //Returns a pointer to ShapesOperations interface
161   virtual GEOM::GEOM_IShapesOperations_ptr GetIShapesOperations (CORBA::Long theStudyID)
162     throw (SALOME::SALOME_Exception);
163
164   //Returns a pointer to BlocksOperations interface
165   virtual GEOM::GEOM_IBlocksOperations_ptr GetIBlocksOperations (CORBA::Long theStudyID)
166     throw (SALOME::SALOME_Exception);
167
168   //Returns a pointer to BooleanOperations interface
169   virtual GEOM::GEOM_IBooleanOperations_ptr GetIBooleanOperations (CORBA::Long theStudyID)
170     throw (SALOME::SALOME_Exception);
171
172   //Returns a pointer to CurvesOperations interface
173   virtual GEOM::GEOM_ICurvesOperations_ptr GetICurvesOperations (CORBA::Long theStudyID)
174     throw (SALOME::SALOME_Exception);
175
176   //Returns a pointer to LocalOperations interface
177   virtual GEOM::GEOM_ILocalOperations_ptr GetILocalOperations (CORBA::Long theStudyID)
178     throw (SALOME::SALOME_Exception);
179
180   //Returns a pointer to HealingOperations interface
181   virtual GEOM::GEOM_IHealingOperations_ptr GetIHealingOperations (CORBA::Long theStudyID)
182     throw (SALOME::SALOME_Exception);
183
184   //Returns a pointer to InsertOperations interface
185   virtual GEOM::GEOM_IInsertOperations_ptr GetIInsertOperations (CORBA::Long theStudyID)
186     throw (SALOME::SALOME_Exception);
187
188   //Returns a pointer to MeasureOperations interface
189   virtual GEOM::GEOM_IMeasureOperations_ptr GetIMeasureOperations (CORBA::Long theStudyID)
190     throw (SALOME::SALOME_Exception);
191
192   //Returns a pointer to GroupOperations interface
193   virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID)
194     throw (SALOME::SALOME_Exception);
195
196   //Adds a new sub shape
197   virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
198                                              const GEOM::ListOfLong& theIndices);
199
200   virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject);
201
202   virtual  char* GetStringFromIOR(GEOM::GEOM_Object_ptr theObject);
203
204   virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
205
206   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
207                                        CORBA::Boolean isPublished,
208                                        CORBA::Boolean& isValidScript);
209
210   char* GetDumpName (const char* theStudyEntry);
211
212   GEOM::string_array* GetAllDumpNames();
213
214   //-----------------------------------------------------------------------//
215   // Internal methods                                                      //
216   //-----------------------------------------------------------------------//
217
218   virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
219
220  private:
221
222    ::GEOMImpl_Gen* _impl;
223    SALOME_NamingService * name_service;
224    char * _name;
225 };
226
227 #endif