]> SALOME platform Git repositories - plugins/dxfplugin.git/commitdiff
Salome HOME
Deleted Study parameter mpa/23299
authormpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:17:18 +0000 (16:17 +0300)
committermpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:17:18 +0000 (16:17 +0300)
CMakeLists.txt
doc/salome/examples/DXFPlugindemo.py
src/DXFPluginBuilder.py
src/DXFPlugin_GUI.cxx
src/DXFPlugin_OperationsCreator.cxx
src/DXFPlugin_OperationsCreator.hxx

index aac1a39a036bfad21ebb7393f832ec3bd5b7ccbb..5de973249b021f8392951feaed261d9fac0626ef 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 81dbefe70b4589ff88b2b9eba5834ab03715ad2e..16790cf8f6085152d018d8dc30b6a317cd66e1c3 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
 dxfFile = os.path.join(os.getenv("TEMP", "/tmp"), "testExportImportDXF.dxf")
index 04b229a43e449189d0a99931f4b0c81cb0a698aa..f8c9a14fc81a139aa5e45998aea2634f9b9f4d05 100644 (file)
@@ -32,7 +32,7 @@ def GetDXFPluginOperations(self):
     Returns:
         An instance of DXF plugin operations interface
     """
-    anOp = self.GetPluginOperations(self.myStudyId, __libraryName__)
+    anOp = self.GetPluginOperations(__libraryName__)
     return anOp._narrow(IDXFOperations)
 
 ## Export the given shape into a file with given name in DXF format.
index 376f97ea3b13d5219728ace00d7ae01e122f94eb..d4b24a771f382c84346b2e9443cad58f810e6322 100644 (file)
@@ -105,11 +105,8 @@ bool DXFPlugin_GUI::importDXF( 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(), "DXFPluginEngine" );
+  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( "DXFPluginEngine" );
   DXFPlugin::IDXFOperations_var dxfOp = DXFPlugin::IDXFOperations::_narrow( op );
   if ( CORBA::is_nil( dxfOp ) ) return false;
 
@@ -136,14 +133,13 @@ bool DXFPlugin_GUI::importDXF( SUIT_Desktop* parent )
         {
           GEOM::GEOM_Object_var main = result[0];
           QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
-          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() );
 
           entryList.append( so->GetID() );
           transaction.commit();
-          GEOM_Displayer( study ).Display( main.in() );
+          GEOM_Displayer().Display( main.in() );
         }
         else
         {
@@ -156,7 +152,7 @@ bool DXFPlugin_GUI::importDXF( SUIT_Desktop* parent )
         transaction.abort();
       }
     }
-    getGeometryGUI()->updateObjBrowser( true );
+    getGeometryGUI()->updateObjBrowser();
     app->browseObjects( entryList );
 
     if ( errors.count() > 0 )
@@ -177,11 +173,8 @@ bool DXFPlugin_GUI::exportDXF( 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(), "DXFPluginEngine" );
+  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( "DXFPluginEngine" );
   DXFPlugin::IDXFOperations_var dxfOp = DXFPlugin::IDXFOperations::_narrow( op );
   if ( CORBA::is_nil( dxfOp ) ) return false;
 
index 23337d5643f15eaa17035e39026e337886741970..b9a9265e71ad68380cc06443e9c199d0d34cfa29 100644 (file)
@@ -53,19 +53,17 @@ DXFPlugin_OperationsCreator::~DXFPlugin_OperationsCreator()
 }
 
 GEOM_IOperations_i* DXFPlugin_OperationsCreator::Create( PortableServer::POA_ptr thePOA,
-                                                         int                     theStudyId,
                                                          GEOM::GEOM_Gen_ptr      theEngine,
                                                          ::GEOMImpl_Gen*         theGenImpl )
 {
   Unexpect aCatch( SALOME_SalomeException );
   MESSAGE( "DXFPlugin_OperationsCreator::Create" );
-  return new DXFPlugin_IOperations_i( thePOA, theEngine, get( theGenImpl, theStudyId ) );
+  return new DXFPlugin_IOperations_i( thePOA, theEngine, get( theGenImpl ) );
 }
 
-DXFPlugin_IOperations* DXFPlugin_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl,
-                                                         int             theStudyId )
+DXFPlugin_IOperations* DXFPlugin_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl )
 {
-  if (_mapOfOperations.find( theStudyId ) == _mapOfOperations.end() )
-    _mapOfOperations[theStudyId] = new DXFPlugin_IOperations( theGenImpl, theStudyId );
-  return _mapOfOperations[theStudyId];
+  if( !_operation )
+    _operation = new DXFPlugin_IOperations( theGenImpl );
+  return _operation;
 }
index c0a365e0962ff7446d24bb8dbed6b00d8831a7c6..ca59e0a143075c5cd37e6ab95544a5b8a4651cb4 100644 (file)
@@ -41,15 +41,13 @@ public:
   ~DXFPlugin_OperationsCreator();
 
   GEOM_IOperations_i* Create( PortableServer::POA_ptr thePOA,
-                              int                     theStudyId,
                               GEOM::GEOM_Gen_ptr      theEngine,
                               ::GEOMImpl_Gen*         theGenImpl );
 
 private:
-  static DXFPlugin_IOperations* get( ::GEOMImpl_Gen* theGenImpl,
-                                     int             theStudyId );
+  static DXFPlugin_IOperations* get( ::GEOMImpl_Gen* theGenImpl );
 
-  static std::map <int, DXFPlugin_IOperations*>  _mapOfOperations;
+  static DXFPlugin_IOperations*  _operation;
 
   friend class DXFPlugin_IECallBack;
 };