Back to index

salome-geom  6.5.0
GEOM_Gen_i.hh
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef __GEOM_GEN_I_H__
00024 #define __GEOM_GEN_I_H__
00025 
00026 #include "GEOM_GEOM_I.hxx"
00027 
00028 #include "GEOMImpl_Gen.hxx"
00029 
00030 // IDL headers
00031 #include <SALOMEconfig.h>
00032 #include CORBA_SERVER_HEADER(GEOM_Gen)
00033 
00034 #include CORBA_CLIENT_HEADER(SALOMEDS)
00035 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
00036 
00037 
00038 #include "SALOME_Component_i.hxx"
00039 #include "SALOME_NamingService.hxx"
00040 
00041 #include "GEOM_IBasicOperations_i.hh"
00042 #include "GEOM_ITransformOperations_i.hh"
00043 #include "GEOM_I3DPrimOperations_i.hh"
00044 #include "GEOM_IShapesOperations_i.hh"
00045 #include "GEOM_IBlocksOperations_i.hh"
00046 #include "GEOM_IBooleanOperations_i.hh"
00047 #include "GEOM_ICurvesOperations_i.hh"
00048 #include "GEOM_ILocalOperations_i.hh"
00049 #include "GEOM_IHealingOperations_i.hh"
00050 #include "GEOM_IInsertOperations_i.hh"
00051 #include "GEOM_IMeasureOperations_i.hh"
00052 #include "GEOM_IGroupOperations_i.hh"
00053 #include "GEOM_IAdvancedOperations_i.hh"
00054 
00055 #include <TopTools_IndexedMapOfShape.hxx>
00056 
00057 #include <set>
00058 #include <string>
00059 
00060 //#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
00061 
00062 
00063 //=====================================================================
00064 // GEOM_Gen_i : class definition
00065 //=====================================================================
00066 class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Component_i
00067 {
00068  public:
00069 
00070   //-----------------------------------------------------------------------//
00071   // Constructor / Destructor                                              //
00072   //-----------------------------------------------------------------------//
00073 
00074   // constructor to be called for servant creation.
00075   GEOM_Gen_i();
00076   GEOM_Gen_i(CORBA::ORB_ptr orb,
00077              PortableServer::POA_ptr poa,
00078              PortableServer::ObjectId * contId,
00079              const char *instanceName,
00080              const char *interfaceName);
00081 
00082   // destructor, doing nothing (for now)
00083   virtual ~GEOM_Gen_i();
00084 
00085   // generic method to be put in a super class
00086   void register_name(char * name);
00087 
00088 
00089   //-----------------------------------------------------------------------//
00090   // Inherited methods from SALOMEDS::Driver                               //
00091   //-----------------------------------------------------------------------//
00092 
00093   SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
00094                           const char* theURL,
00095                           bool isMultiFile);
00096 
00097   SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
00098                                const char* theURL,
00099                                bool isMultiFile);
00100 
00101   CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
00102                       const SALOMEDS::TMPFile& theStream,
00103                       const char* theURL,
00104                       bool isMultiFile);
00105 
00106   CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent,
00107                            const SALOMEDS::TMPFile& theStream,
00108                            const char* theURL,
00109                            bool isMultiFile);
00110 
00111   void Close(SALOMEDS::SComponent_ptr theComponent);
00112   char* ComponentDataType();
00113 
00114 
00115   char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
00116                                const char* IORString,
00117                                CORBA::Boolean isMultiFile,
00118                                CORBA::Boolean isASCII);
00119   char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
00120                                const char* aLocalPersistentID,
00121                                CORBA::Boolean isMultiFile,
00122                                CORBA::Boolean isASCII);
00123 
00124   bool CanPublishInStudy(CORBA::Object_ptr theIOR);
00125   SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
00126                                        SALOMEDS::SObject_ptr theSObject,
00127                                        CORBA::Object_ptr theObject,
00128                                        const char* theName) throw (SALOME::SALOME_Exception) ;
00129 
00130   GEOM::ListOfGO* PublishNamedShapesInStudy(SALOMEDS::Study_ptr theStudy,
00131                                             CORBA::Object_ptr theObject);
00132 
00133   CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
00134   SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
00135   CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
00136   SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
00137                                   CORBA::Long theObjectID,
00138                                   SALOMEDS::SObject_ptr theObject);
00139 
00143   SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
00144                                     GEOM::GEOM_Object_ptr theObject,
00145                                     const char* theName,
00146                                     GEOM::GEOM_Object_ptr theFather);
00147 
00151   GEOM::ListOfGO* RestoreSubShapesO (SALOMEDS::Study_ptr     theStudy,
00152                                      GEOM::GEOM_Object_ptr   theObject,
00153                                      const GEOM::ListOfGO&   theArgs,
00154                                      GEOM::find_shape_method theFindMethod,
00155                                      CORBA::Boolean          theInheritFirstArg,
00156                                      CORBA::Boolean          theAddPrefix);
00157 
00161   GEOM::ListOfGO* RestoreGivenSubShapesO (SALOMEDS::Study_ptr     theStudy,
00162                                           GEOM::GEOM_Object_ptr   theObject,
00163                                           const GEOM::ListOfGO&   theArgs,
00164                                           GEOM::find_shape_method theFindMethod,
00165                                           CORBA::Boolean          theInheritFirstArg,
00166                                           CORBA::Boolean          theAddPrefix);
00167 
00171   GEOM::ListOfGO* RestoreSubShapesSO (SALOMEDS::Study_ptr     theStudy,
00172                                       SALOMEDS::SObject_ptr   theSObject,
00173                                       const GEOM::ListOfGO&   theArgs,
00174                                       GEOM::find_shape_method theFindMethod,
00175                                       CORBA::Boolean          theInheritFirstArg,
00176                                       CORBA::Boolean          theAddPrefix);
00177 
00178   //-----------------------------------------------------------------------//
00179   // Transaction methods                                                   //
00180   //-----------------------------------------------------------------------//
00181 
00182   //Undos one transaction in the document associated with theStudyID
00183   virtual void Undo(CORBA::Long theStudyID);
00184 
00185   //Redos one transaction in the document associated with theStudyID
00186   virtual void Redo(CORBA::Long theStudyID);
00187 
00188   //-----------------------------------------------------------------------//
00189   // Operations methods                                                    //
00190   //-----------------------------------------------------------------------//
00191 
00192   //Returns a pointer to BasicOperations interface
00193   virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
00194     throw (SALOME::SALOME_Exception);
00195 
00196   //Returns a pointer to TransformOperations interface
00197   virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
00198     throw (SALOME::SALOME_Exception);
00199 
00200   //Returns a pointer to 3DPrimOperations interface
00201   virtual GEOM::GEOM_I3DPrimOperations_ptr GetI3DPrimOperations (CORBA::Long theStudyID)
00202     throw (SALOME::SALOME_Exception);
00203 
00204   //Returns a pointer to ShapesOperations interface
00205   virtual GEOM::GEOM_IShapesOperations_ptr GetIShapesOperations (CORBA::Long theStudyID)
00206     throw (SALOME::SALOME_Exception);
00207 
00208   //Returns a pointer to BlocksOperations interface
00209   virtual GEOM::GEOM_IBlocksOperations_ptr GetIBlocksOperations (CORBA::Long theStudyID)
00210     throw (SALOME::SALOME_Exception);
00211 
00212   //Returns a pointer to BooleanOperations interface
00213   virtual GEOM::GEOM_IBooleanOperations_ptr GetIBooleanOperations (CORBA::Long theStudyID)
00214     throw (SALOME::SALOME_Exception);
00215 
00216   //Returns a pointer to CurvesOperations interface
00217   virtual GEOM::GEOM_ICurvesOperations_ptr GetICurvesOperations (CORBA::Long theStudyID)
00218     throw (SALOME::SALOME_Exception);
00219 
00220   //Returns a pointer to LocalOperations interface
00221   virtual GEOM::GEOM_ILocalOperations_ptr GetILocalOperations (CORBA::Long theStudyID)
00222     throw (SALOME::SALOME_Exception);
00223 
00224   //Returns a pointer to HealingOperations interface
00225   virtual GEOM::GEOM_IHealingOperations_ptr GetIHealingOperations (CORBA::Long theStudyID)
00226     throw (SALOME::SALOME_Exception);
00227 
00228   //Returns a pointer to InsertOperations interface
00229   virtual GEOM::GEOM_IInsertOperations_ptr GetIInsertOperations (CORBA::Long theStudyID)
00230     throw (SALOME::SALOME_Exception);
00231 
00232   //Returns a pointer to MeasureOperations interface
00233   virtual GEOM::GEOM_IMeasureOperations_ptr GetIMeasureOperations (CORBA::Long theStudyID)
00234     throw (SALOME::SALOME_Exception);
00235 
00236   //Returns a pointer to GroupOperations interface
00237   virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID)
00238     throw (SALOME::SALOME_Exception);
00239 
00240   //Returns a pointer to AdvancedOperations interface
00241   virtual GEOM::GEOM_IAdvancedOperations_ptr GetIAdvancedOperations (CORBA::Long theStudyID)
00242     throw (SALOME::SALOME_Exception);
00243 
00244   //Adds a new sub-shape
00245   virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
00246                                              const GEOM::ListOfLong& theIndices);
00247 
00248   virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject);
00249 
00250   virtual  char* GetStringFromIOR(GEOM::GEOM_Object_ptr theObject);
00251 
00252   virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
00253 
00254   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
00255                                        CORBA::Boolean isPublished,
00256                                        CORBA::Boolean isMultiFile,
00257                                        CORBA::Boolean& isValidScript);
00258 
00259   char* GetDumpName (const char* theStudyEntry);
00260 
00261   GEOM::string_array* GetAllDumpNames();
00262 
00263   // Object information
00264   virtual bool hasObjectInfo();
00265   virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
00266 
00267   //-----------------------------------------------------------------------//
00268   // Internal methods                                                      //
00269   //-----------------------------------------------------------------------//
00270 
00271   virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
00272 
00273  private:
00274   GEOM::ListOfGO* RestoreSubShapes (SALOMEDS::Study_ptr     theStudy,
00275                                     GEOM::GEOM_Object_ptr   theObject,
00276                                     SALOMEDS::SObject_ptr   theSObject,
00277                                     const GEOM::ListOfGO&   theArgs,
00278                                     GEOM::find_shape_method theFindMethod,
00279                                     CORBA::Boolean          theInheritFirstArg,
00280                                     CORBA::Boolean          theAddPrefix);
00281 
00282   GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr     theStudy,
00283                                             SALOMEDS::SObject_ptr   theOldSO,
00284                                             SALOMEDS::SObject_ptr   theNewSO,
00285                                             GEOM::GEOM_Object_ptr   theNewO,
00286                                             GEOM::ListOfGO&         theOutArgs,
00287                                             GEOM::find_shape_method theFindMethod,
00288                                             CORBA::Boolean          theAddPrefix);
00289 
00290   GEOM::ListOfGO* RestoreGivenSubShapes (SALOMEDS::Study_ptr     theStudy,
00291                                          GEOM::GEOM_Object_ptr   theObject,
00292                                          SALOMEDS::SObject_ptr   theSObject,
00293                                          const GEOM::ListOfGO&   theArgs,
00294                                          GEOM::find_shape_method theFindMethod,
00295                                          CORBA::Boolean          theInheritFirstArg,
00296                                          CORBA::Boolean          theAddPrefix);
00297 
00298   GEOM::ListOfGO* RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr     theStudy,
00299                                                  SALOMEDS::SObject_ptr   theOldSO,
00300                                                  SALOMEDS::SObject_ptr   theNewSO,
00301                                                  GEOM::GEOM_Object_ptr   theNewO,
00302                                                  std::set<std::string>   theArgs,
00303                                                  GEOM::find_shape_method theFindMethod,
00304                                                  CORBA::Boolean          theAddPrefix);
00305 
00306   // auxilary for PublishNamedShapesInStudy
00307   void CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
00308                              GEOM::GEOM_Object_var theMainShape,
00309                              const TopTools_IndexedMapOfShape& anIndices,
00310                              const TopTools_SequenceOfShape& SeqS,
00311                              const TColStd_SequenceOfAsciiString& SeqN,
00312                              const Standard_CString& GrName,
00313                              GEOM::ListOfGO_var aResList);
00314 
00315  private:
00316 
00317    ::GEOMImpl_Gen* _impl;
00318    SALOME_NamingService * name_service;
00319    char * _name;
00320 };
00321 
00322 #endif