From: mpa Date: Fri, 3 Feb 2017 13:15:46 +0000 (+0300) Subject: Deleted Study parameter X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmpa%2F23299;p=plugins%2Facisplugin.git Deleted Study parameter --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 54341c6..9a377b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/doc/salome/examples/ACISPlugindemo.py b/doc/salome/examples/ACISPlugindemo.py index e392d5f..c47f6a4 100644 --- a/doc/salome/examples/ACISPlugindemo.py +++ b/doc/salome/examples/ACISPlugindemo.py @@ -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" diff --git a/src/ACISPluginBuilder.py b/src/ACISPluginBuilder.py index 41da806..1ff2b00 100644 --- a/src/ACISPluginBuilder.py +++ b/src/ACISPluginBuilder.py @@ -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. diff --git a/src/ACISPlugin_GUI.cxx b/src/ACISPlugin_GUI.cxx index 3c9719a..a4f72cb 100644 --- a/src/ACISPlugin_GUI.cxx +++ b/src/ACISPlugin_GUI.cxx @@ -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 ( 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 ( 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; diff --git a/src/ACISPlugin_OperationsCreator.cxx b/src/ACISPlugin_OperationsCreator.cxx index dcb734a..9656126 100644 --- a/src/ACISPlugin_OperationsCreator.cxx +++ b/src/ACISPlugin_OperationsCreator.cxx @@ -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; } diff --git a/src/ACISPlugin_OperationsCreator.hxx b/src/ACISPlugin_OperationsCreator.hxx index 5efbb22..78757b2 100644 --- a/src/ACISPlugin_OperationsCreator.hxx +++ b/src/ACISPlugin_OperationsCreator.hxx @@ -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 _mapOfOperations; + static ACISPlugin_IOperations* _operation; friend class ACISPlugin_IECallBack; };