]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOM_I/GEOM_Gen_i.hh
Salome HOME
Merge V8_4_BR branch.
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.hh
index c87fe23cf2c4bbaa32f11cd4cdca7f2f799e39f7..3413d9d971cd41dd95c69edbf5b2ec44949b3277 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,6 +18,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #ifndef __GEOM_GEN_I_H__
 #define __GEOM_GEN_I_H__
 #include "GEOM_IInsertOperations_i.hh"
 #include "GEOM_IMeasureOperations_i.hh"
 #include "GEOM_IGroupOperations_i.hh"
+#include "GEOM_IFieldOperations_i.hh"
+#include "GEOMUtils.hxx"
 
 #include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_SequenceOfShape.hxx>
 
 #include <map>
 #include <set>
+#include <list>
 #include <string>
 
 //#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
 
-
 //=====================================================================
 // Generic operations creator (for plugins mechanism)
 //=====================================================================
@@ -159,10 +163,10 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   /*! \brief Adds theObject in the study with a name = theName, if
    *         theFather is not null the object is placed under theFather
    */
-  SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
-                                    GEOM::GEOM_Object_ptr theObject,
-                                    const char* theName,
-                                    GEOM::GEOM_Object_ptr theFather);
+  SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr       theStudy,
+                                    GEOM::GEOM_BaseObject_ptr theObject,
+                                    const char*               theName,
+                                    GEOM::GEOM_BaseObject_ptr theFather);
 
   /*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
    *         To be used from python scripts out of geompy.addToStudy (non-default usage)
@@ -194,6 +198,10 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
                                       CORBA::Boolean          theInheritFirstArg,
                                       CORBA::Boolean          theAddPrefix);
 
+  //Collects dependencies of the given objects from other ones
+  SALOMEDS::TMPFile* GetDependencyTree(SALOMEDS::Study_ptr theStudy,
+                                       const GEOM::string_array& theObjectEntries);
+
   //-----------------------------------------------------------------------//
   // Transaction methods                                                   //
   //-----------------------------------------------------------------------//
@@ -256,6 +264,10 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID)
     throw (SALOME::SALOME_Exception);
 
+  //Returns a pointer to FiedlOperations interface
+  virtual GEOM::GEOM_IFieldOperations_ptr GetIFieldOperations (CORBA::Long theStudyID)
+    throw (SALOME::SALOME_Exception);
+
   //Returns a pointer to corresponding plugin operations interface
   virtual GEOM::GEOM_IOperations_ptr GetPluginOperations (CORBA::Long theStudyID,
                                                           const char* theLibName)
@@ -265,7 +277,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
                                              const GEOM::ListOfLong& theIndices);
 
-  virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject);
+  virtual void RemoveObject(GEOM::GEOM_BaseObject_ptr theObject);
 
   virtual  char* GetStringFromIOR(GEOM::GEOM_Object_ptr theObject);
 
@@ -288,27 +300,36 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   virtual char* getVersion();
 
   // Create a new folder object
-  SALOMEDS::SObject_ptr CreateFolder(const char* theName, 
-                                    SALOMEDS::SObject_ptr theFather);
+  SALOMEDS::SObject_ptr CreateFolder(const char* theName,
+                                     SALOMEDS::SObject_ptr theFather);
 
   // Move GEOM object to the specified folder
-  void MoveToFolder(GEOM::GEOM_Object_ptr theObject, 
-                   SALOMEDS::SObject_ptr theFolder);
+  void MoveToFolder(GEOM::GEOM_Object_ptr theObject,
+                    SALOMEDS::SObject_ptr theFolder);
 
   // Move list of GEOM objects to the specified folder
-  void MoveListToFolder (const GEOM::ListOfGO& theListOfGO, 
-                        SALOMEDS::SObject_ptr theFolder);
+  void MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
+                         SALOMEDS::SObject_ptr theFolder);
 
   // Move objects to the specified position
   void Move( const GEOM::object_list& what,
-            SALOMEDS::SObject_ptr where,
-            CORBA::Long row );
+             SALOMEDS::SObject_ptr where,
+             CORBA::Long row );
+
+  /*! \brief Fills 3 lists that is used to clean study of redundant objects.
+   *         To be used from GUI.
+   */
+  void GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
+                               GEOM::string_array& theSelectedEntries,
+                               GEOM::string_array& theParentEntries,
+                               GEOM::string_array& theSubEntries,
+                               GEOM::string_array& theOtherEntries);
 
   //-----------------------------------------------------------------------//
   // Internal methods                                                      //
   //-----------------------------------------------------------------------//
 
-  virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
+  virtual GEOM::GEOM_BaseObject_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
 
  private:
   GEOM::ListOfGO* RestoreSubShapes (SALOMEDS::Study_ptr     theStudy,
@@ -343,7 +364,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
                                                  GEOM::find_shape_method theFindMethod,
                                                  CORBA::Boolean          theAddPrefix);
 
-  // auxilary for PublishNamedShapesInStudy
+  // auxiliary for PublishNamedShapesInStudy
   void CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
                              GEOM::GEOM_Object_var theMainShape,
                              const TopTools_IndexedMapOfShape& anIndices,
@@ -352,6 +373,31 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
                              const Standard_CString& GrName,
                              GEOM::ListOfGO_var aResList);
 
+  void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+                            GEOMUtils::LevelsList &upLevelList,
+                            std::map< std::string, std::set<std::string> > &passedEntries,
+                            int level = 0 );
+
+  void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+                              GEOMUtils::LevelsList &downLevelList,
+                              std::map< std::string, std::set<std::string> > &passedEntries,
+                              int level = 0 );
+
+  void includeParentDependencies(GEOM::GEOM_BaseObject_ptr gbo,
+                                 std::set<std::string>& aSelected,
+                                 std::set<std::string>& aParents,
+                                 std::set<std::string>& aChildren,
+                                 std::set<std::string>& anOthers);
+
+  void includeSubObjects(SALOMEDS::Study_ptr theStudy,
+                         const std::string& aSelectedEntry,
+                         std::set<std::string>& aSelected,
+                         std::set<std::string>& aParents,
+                         std::set<std::string>& aChildren,
+                         std::set<std::string>& anOthers);
+
+  void LoadPlugin(const std::string& theLibName);
+
  private:
 
    ::GEOMImpl_Gen* _impl;