]> SALOME platform Git repositories - plugins/xtplugin.git/commitdiff
Salome HOME
Deleted deprecated code mpa/23299
authormpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:26:14 +0000 (16:26 +0300)
committermpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:26:14 +0000 (16:26 +0300)
CMakeLists.txt
doc/salome/examples/XTPlugindemo.py
src/XTPluginBuilder.py
src/XTPlugin_GUI.cxx
src/XTPlugin_OperationsCreator.cxx
src/XTPlugin_OperationsCreator.hxx

index 9d36065f08c642d59383c28420b6c5b24918cedb..73d033172fb7d86123defc0d85fab1fde5d8cb35 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 f8d34bea248e3fd34ac935dc596ab216746eaa6d..85242c3a96d338bf11739c6f108dcc46ef7dff00 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
 xtFile = "/path/to/the/xt/file.x_t"
index edb5b2992582715dafd9f6b2a075523f6670f985..da1110ec48e49c8b7cfa3c02ff32c3f054114081 100644 (file)
@@ -32,7 +32,7 @@ def GetXTPluginOperations(self):
     Returns:
         An instance of XT plugin operations interface
     """
-    anOp = self.GetPluginOperations(self.myStudyId, __libraryName__)
+    anOp = self.GetPluginOperations(__libraryName__)
     return anOp._narrow(IXTOperations)
 
 ## Import a shape from the XT file
index 3bd0f68c0d025d2a253b40ad948ce25ab61ec18a..8aac0d208576a46bc9d3a7e27af35ce822ece3bf 100644 (file)
@@ -102,11 +102,8 @@ bool XTPlugin_GUI::importXT( 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(), "XTPluginEngine" );
+  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( "XTPluginEngine" );
   XTPlugin::IXTOperations_var xtOp = XTPlugin::IXTOperations::_narrow( op );
   if ( CORBA::is_nil( xtOp ) ) return false;
 
@@ -133,14 +130,13 @@ bool XTPlugin_GUI::importXT( 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
        {
@@ -153,7 +149,7 @@ bool XTPlugin_GUI::importXT( SUIT_Desktop* parent )
        transaction.abort();
      }
    }
-   getGeometryGUI()->updateObjBrowser( true );
+   getGeometryGUI()->updateObjBrowser();
    app->browseObjects( entryList );
 
    if ( errors.count() > 0 )
index 7acd93d13456e7171dec6b4bc3538629bbec4291..0a1c8d43e2aec82af38d3068c8a697835fa8577b 100644 (file)
@@ -50,19 +50,17 @@ XTPlugin_OperationsCreator::~XTPlugin_OperationsCreator()
 }
 
 GEOM_IOperations_i* XTPlugin_OperationsCreator::Create( PortableServer::POA_ptr thePOA,
-                                                        int                     theStudyId,
                                                         GEOM::GEOM_Gen_ptr      theEngine,
                                                         ::GEOMImpl_Gen*         theGenImpl )
 {
   Unexpect aCatch( SALOME_SalomeException );
   MESSAGE( "XTPlugin_OperationsCreator::Create" );
-  return new XTPlugin_IOperations_i( thePOA, theEngine, get( theGenImpl, theStudyId ) );
+  return new XTPlugin_IOperations_i( thePOA, theEngine, get( theGenImpl ) );
 }
 
-XTPlugin_IOperations* XTPlugin_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl,
-                                                       int             theStudyId )
+XTPlugin_IOperations* XTPlugin_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl )
 {
-  if (_mapOfOperations.find( theStudyId ) == _mapOfOperations.end() )
-    _mapOfOperations[theStudyId] = new XTPlugin_IOperations( theGenImpl, theStudyId );
-  return _mapOfOperations[theStudyId];
+  if( !_operation )
+    _operation = new XTPlugin_IOperations( theGenImpl );
+  return _operation;
 }
index ae374c146a9fbb448772e6a229442eaf93362226..001c55c96e9f62f81ae6f37186d54ac0078469fa 100644 (file)
@@ -41,15 +41,13 @@ public:
   ~XTPlugin_OperationsCreator();
 
   GEOM_IOperations_i* Create( PortableServer::POA_ptr thePOA,
-                              int                     theStudyId,
                               GEOM::GEOM_Gen_ptr      theEngine,
                               ::GEOMImpl_Gen*         theGenImpl );
 
 private:
-  static XTPlugin_IOperations* get( ::GEOMImpl_Gen* theGenImpl,
-                                    int             theStudyId );
+  static XTPlugin_IOperations* get( ::GEOMImpl_Gen* theGenImpl );
 
-  static std::map <int, XTPlugin_IOperations*> _mapOfOperations;
+  static XTPlugin_IOperations* _operation;
 
   friend class XTPlugin_IECallBack;
 };