]> SALOME platform Git repositories - plugins/acisplugin.git/commitdiff
Salome HOME
Deleted Study parameter mpa/23299
authormpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:15:46 +0000 (16:15 +0300)
committermpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:15:46 +0000 (16:15 +0300)
CMakeLists.txt
doc/salome/examples/ACISPlugindemo.py
src/ACISPluginBuilder.py
src/ACISPlugin_GUI.cxx
src/ACISPlugin_OperationsCreator.cxx
src/ACISPlugin_OperationsCreator.hxx

index 54341c61c3a8441062c70016c313a3f96668b83b..9a377b8cb197793d1d627ec09e7f043b32f88a3f 100644 (file)
@@ -35,12 +35,20 @@ SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
 SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
 
+# Common CMake macros
+SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+  LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+  INCLUDE(SalomeMacros)
+ELSE()
+  MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
+ENDIF()
+
 # Find KERNEL
 # ===========
 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the SALOME KERNEL")
 IF(EXISTS ${KERNEL_ROOT_DIR})
   LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
-  INCLUDE(SalomeMacros)
   FIND_PACKAGE(SalomeKERNEL REQUIRED)
   KERNEL_WITH_CORBA() #check whether KERNEL is built with CORBA
   ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
index e392d5fd5e9bb55517a24b23cd4fa842c3045089..c47f6a483d807d57475f9e057b7e351c4798b20e 100644 (file)
@@ -5,7 +5,7 @@ import salome
 salome.salome_init()
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 # - path to the file
 acisFile = os.getenv("DATA_DIR") + "/Shapes/Sat/Bug841_Robot01_ACIS_15_Volumique.sat"
index 41da806861a0d312c5f4f2f4286af3199a382f18..1ff2b00c17451ec9d8a02ca3935eb78cfb453d9f 100644 (file)
@@ -32,7 +32,7 @@ def GetACISPluginOperations(self):
     Returns:
         An instance of ACIS plugin operations interface
     """
-    anOp = self.GetPluginOperations(self.myStudyId, __libraryName__)
+    anOp = self.GetPluginOperations(__libraryName__)
     return anOp._narrow(IACISOperations)
 
 ## Export the given shape into a file with given name in ACIS format.
index 3c9719abc890bbdb07da25a1e4e467392fc7c054..a4f72cb4192389b4e61e0cd3c05e42cba76979f1 100644 (file)
@@ -106,11 +106,8 @@ bool ACISPlugin_GUI::importACIS( SUIT_Desktop* parent )
 {
   SalomeApp_Application* app = getGeometryGUI()->getApp();
   if ( !app ) return false;
-  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
-  if ( !study ) return false;
 
-  SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
-  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "ACISPluginEngine" );
+  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( "ACISPluginEngine" );
   ACISPlugin::IACISOperations_var acisOp = ACISPlugin::IACISOperations::_narrow( op );
   if ( CORBA::is_nil( acisOp ) ) return false;
 
@@ -154,12 +151,11 @@ bool ACISPlugin_GUI::importACIS( SUIT_Desktop* parent )
           GEOM::GEOM_Object_var main = result[0];
           QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
           main.in()->SetName( publishName.toStdString().c_str() );
-          SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
-                                                                SALOMEDS::SObject::_nil(),
-                                                                main.in(),
-                                                                publishName.toUtf8().constData() );
+          SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( SALOMEDS::SObject::_nil(),
+                                                                                main.in(),
+                                                                                publishName.toUtf8().constData() );
           if ( acisAnswer == SUIT_MessageBox::Yes || acisAnswer == SUIT_MessageBox::YesToAll )
-            GeometryGUI::GetGeomGen()->PublishNamedShapesInStudy( dsStudy, main.in() );
+            GeometryGUI::GetGeomGen()->PublishNamedShapesInStudy( main.in() );
 
           entryList.append( so->GetID() );
           transaction.commit();
@@ -175,7 +171,7 @@ bool ACISPlugin_GUI::importACIS( SUIT_Desktop* parent )
         transaction.abort();
       }
     }
-    getGeometryGUI()->updateObjBrowser( true );
+    getGeometryGUI()->updateObjBrowser();
     app->browseObjects( entryList );
 
     if ( errors.count() > 0 )
@@ -196,11 +192,8 @@ bool ACISPlugin_GUI::exportACIS( SUIT_Desktop* parent )
 {
   SalomeApp_Application* app = getGeometryGUI()->getApp();
   if ( !app ) return false;
-  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
-  if ( !study ) return false;
 
-  SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
-  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "ACISPluginEngine" );
+  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( "ACISPluginEngine" );
   ACISPlugin::IACISOperations_var acisOp = ACISPlugin::IACISOperations::_narrow( op );
   if ( CORBA::is_nil( acisOp ) ) return false;
 
index dcb734ac57e71f9f63360d890c7555b9a2d31cd6..9656126d69286e9c06b5a55910493d7e44e72c1b 100644 (file)
@@ -53,19 +53,17 @@ ACISPlugin_OperationsCreator::~ACISPlugin_OperationsCreator()
 }
 
 GEOM_IOperations_i* ACISPlugin_OperationsCreator::Create( PortableServer::POA_ptr thePOA,
-                                                          int                     theStudyId,
                                                           GEOM::GEOM_Gen_ptr      theEngine,
                                                           ::GEOMImpl_Gen*         theGenImpl )
 {
   Unexpect aCatch( SALOME_SalomeException );
   MESSAGE( "ACISPlugin_OperationsCreator::Create" );
-  return new ACISPlugin_IOperations_i( thePOA, theEngine, get( theGenImpl, theStudyId ) );
+  return new ACISPlugin_IOperations_i( thePOA, theEngine, get( theGenImpl ) );
 }
 
-ACISPlugin_IOperations* ACISPlugin_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl,
-                                                           int             theStudyId )
+ACISPlugin_IOperations* ACISPlugin_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl )
 {
-  if (_mapOfOperations.find( theStudyId ) == _mapOfOperations.end() )
-    _mapOfOperations[theStudyId] = new ACISPlugin_IOperations( theGenImpl, theStudyId );
-  return _mapOfOperations[theStudyId];
+  if( !_operation )
+    _operation = new ACISPlugin_IOperations( theGenImpl );
+  return _operation;
 }
index 5efbb22eb71d193f71d641b356609456c75d80a1..78757b23fc6b96a04a5287b4ba249b569cb72f4b 100644 (file)
@@ -41,15 +41,13 @@ public:
   ~ACISPlugin_OperationsCreator();
 
   GEOM_IOperations_i* Create( PortableServer::POA_ptr thePOA,
-                              int                     theStudyId,
                               GEOM::GEOM_Gen_ptr      theEngine,
                               ::GEOMImpl_Gen*         theGenImpl );
 
 private:
-  static ACISPlugin_IOperations* get( ::GEOMImpl_Gen* theGenImpl,
-                                      int             theStudyId );
+  static ACISPlugin_IOperations* get( ::GEOMImpl_Gen* theGenImpl );
 
-  static std::map <int, ACISPlugin_IOperations*>  _mapOfOperations;
+  static ACISPlugin_IOperations* _operation;
 
   friend class ACISPlugin_IECallBack;
 };