mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-26 09:20:35 +05:00
2 servant implementations of GEOM::GEOM_GEN. One with Study and ModuleCatalog retrived from NS (like the beginning), another one with Study and ModulCatalog embedded
This commit is contained in:
parent
cb793ede66
commit
81eb14d320
@ -52,6 +52,7 @@ SET(_link_LIBRARIES
|
|||||||
${KERNEL_TOOLSDS}
|
${KERNEL_TOOLSDS}
|
||||||
${KERNEL_SalomeContainer}
|
${KERNEL_SalomeContainer}
|
||||||
${KERNEL_SalomeNS}
|
${KERNEL_SalomeNS}
|
||||||
|
${KERNEL_SalomeDS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# --- headers ---
|
# --- headers ---
|
||||||
@ -74,6 +75,8 @@ SET(GEOMEngine_HEADERS
|
|||||||
GEOM_IMeasureOperations_i.hh
|
GEOM_IMeasureOperations_i.hh
|
||||||
GEOM_IGroupOperations_i.hh
|
GEOM_IGroupOperations_i.hh
|
||||||
GEOM_Gen_i.hh
|
GEOM_Gen_i.hh
|
||||||
|
GEOM_Gen_Session_i.hh
|
||||||
|
GEOM_Gen_No_Session_i.hh
|
||||||
GEOM_GEOM_I.hxx
|
GEOM_GEOM_I.hxx
|
||||||
GEOM_wrap.hxx
|
GEOM_wrap.hxx
|
||||||
)
|
)
|
||||||
@ -98,6 +101,8 @@ SET(GEOMEngine_SOURCES
|
|||||||
GEOM_IGroupOperations_i.cc
|
GEOM_IGroupOperations_i.cc
|
||||||
GEOM_IFieldOperations_i.cc
|
GEOM_IFieldOperations_i.cc
|
||||||
GEOM_Gen_i.cc
|
GEOM_Gen_i.cc
|
||||||
|
GEOM_Gen_Session_i.cc
|
||||||
|
GEOM_Gen_No_Session_i.cc
|
||||||
GEOM_DumpPython.cc
|
GEOM_DumpPython.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
35
src/GEOM_I/GEOM_Gen_No_Session_i.cc
Normal file
35
src/GEOM_I/GEOM_Gen_No_Session_i.cc
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (C) 2021 CEA/DEN, EDF R&D
|
||||||
|
//
|
||||||
|
// 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "GEOM_Gen_No_Session_i.hh"
|
||||||
|
|
||||||
|
#include "SALOMEDS_Study_i.hxx"
|
||||||
|
|
||||||
|
GEOM_Gen_No_Session_i::GEOM_Gen_No_Session_i(CORBA::ORB_ptr orb,
|
||||||
|
PortableServer::POA_ptr poa,
|
||||||
|
PortableServer::ObjectId *contId,
|
||||||
|
const char *instanceName,
|
||||||
|
const char *interfaceName):GEOM_Gen_i(orb,poa,contId,instanceName,interfaceName,false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SALOMEDS::Study_var GEOM_Gen_No_Session_i::getStudyServant()
|
||||||
|
{
|
||||||
|
return SALOMEDS::Study::_duplicate(KERNEL::getStudyServantSA());
|
||||||
|
}
|
34
src/GEOM_I/GEOM_Gen_No_Session_i.hh
Normal file
34
src/GEOM_I/GEOM_Gen_No_Session_i.hh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (C) 2021 CEA/DEN, EDF R&D
|
||||||
|
//
|
||||||
|
// 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GEOM_Gen_i.hh"
|
||||||
|
|
||||||
|
class GEOM_I_EXPORT GEOM_Gen_No_Session_i : public GEOM_Gen_i
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GEOM_Gen_No_Session_i(CORBA::ORB_ptr orb,
|
||||||
|
PortableServer::POA_ptr poa,
|
||||||
|
PortableServer::ObjectId * contId,
|
||||||
|
const char *instanceName,
|
||||||
|
const char *interfaceName);
|
||||||
|
|
||||||
|
SALOMEDS::Study_var getStudyServant() override;
|
||||||
|
};
|
64
src/GEOM_I/GEOM_Gen_Session_i.cc
Normal file
64
src/GEOM_I/GEOM_Gen_Session_i.cc
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Copyright (C) 2021 CEA/DEN, EDF R&D
|
||||||
|
//
|
||||||
|
// 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "GEOM_Gen_Session_i.hh"
|
||||||
|
|
||||||
|
GEOM_Gen_Session_i::GEOM_Gen_Session_i(CORBA::ORB_ptr orb,
|
||||||
|
PortableServer::POA_ptr poa,
|
||||||
|
PortableServer::ObjectId *contId,
|
||||||
|
const char *instanceName,
|
||||||
|
const char *interfaceName):GEOM_Gen_i(orb,poa,contId,instanceName,interfaceName,true)
|
||||||
|
{
|
||||||
|
name_service = new SALOME_NamingService(_orb);
|
||||||
|
}
|
||||||
|
|
||||||
|
GEOM_Gen_Session_i::~GEOM_Gen_Session_i()
|
||||||
|
{
|
||||||
|
delete name_service;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GEOM_Gen_Session_i::register_name(char * name)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Gen_var g = _this();
|
||||||
|
name_service->Register(g, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
SALOMEDS::Study_var GEOM_Gen_Session_i::getStudyServant()
|
||||||
|
{
|
||||||
|
static SALOMEDS::Study_var aStudy;
|
||||||
|
if(CORBA::is_nil(aStudy))
|
||||||
|
{
|
||||||
|
CORBA::Object_ptr anObject = name_service->Resolve("/Study");
|
||||||
|
aStudy = SALOMEDS::Study::_narrow(anObject);
|
||||||
|
}
|
||||||
|
return aStudy;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
GEOM_I_EXPORT PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB_ptr orb,
|
||||||
|
PortableServer::POA_ptr poa,
|
||||||
|
PortableServer::ObjectId* contId,
|
||||||
|
const char* instanceName,
|
||||||
|
const char* interfaceName)
|
||||||
|
{
|
||||||
|
GEOM_Gen_Session_i* myGEOM_Gen_i = new GEOM_Gen_Session_i(orb, poa, contId, instanceName, interfaceName);
|
||||||
|
return myGEOM_Gen_i->getId();
|
||||||
|
}
|
||||||
|
}
|
39
src/GEOM_I/GEOM_Gen_Session_i.hh
Normal file
39
src/GEOM_I/GEOM_Gen_Session_i.hh
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright (C) 2021 CEA/DEN, EDF R&D
|
||||||
|
//
|
||||||
|
// 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GEOM_Gen_i.hh"
|
||||||
|
|
||||||
|
class GEOM_I_EXPORT GEOM_Gen_Session_i : public GEOM_Gen_i
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GEOM_Gen_Session_i(CORBA::ORB_ptr orb,
|
||||||
|
PortableServer::POA_ptr poa,
|
||||||
|
PortableServer::ObjectId * contId,
|
||||||
|
const char *instanceName,
|
||||||
|
const char *interfaceName);
|
||||||
|
~GEOM_Gen_Session_i();
|
||||||
|
void register_name(char * name);
|
||||||
|
SALOMEDS::Study_var getStudyServant() override;
|
||||||
|
SALOME_NamingService *GetNS() { return name_service; }
|
||||||
|
private:
|
||||||
|
SALOME_NamingService *name_service = nullptr;
|
||||||
|
};
|
||||||
|
|
@ -98,13 +98,12 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
|
|||||||
PortableServer::POA_ptr poa,
|
PortableServer::POA_ptr poa,
|
||||||
PortableServer::ObjectId* contId,
|
PortableServer::ObjectId* contId,
|
||||||
const char* instanceName,
|
const char* instanceName,
|
||||||
const char* interfaceName) :
|
const char* interfaceName,
|
||||||
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
|
bool withRegistry) :
|
||||||
|
Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, withRegistry)
|
||||||
{
|
{
|
||||||
_thisObj = this;
|
_thisObj = this;
|
||||||
_id = _poa->activate_object(_thisObj);
|
_id = _poa->activate_object(_thisObj);
|
||||||
name_service = new SALOME_NamingService(_orb);
|
|
||||||
|
|
||||||
_impl = new ::GEOMImpl_Gen;
|
_impl = new ::GEOMImpl_Gen;
|
||||||
|
|
||||||
//PAL10867: disable signals catching with "noexcepthandler" option
|
//PAL10867: disable signals catching with "noexcepthandler" option
|
||||||
@ -140,10 +139,8 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
|
|||||||
// purpose : destructor
|
// purpose : destructor
|
||||||
//============================================================================
|
//============================================================================
|
||||||
GEOM_Gen_i::~GEOM_Gen_i() {
|
GEOM_Gen_i::~GEOM_Gen_i() {
|
||||||
delete name_service;
|
|
||||||
delete _impl;
|
delete _impl;
|
||||||
std::map<std::string, GEOM_GenericOperationsCreator*>::const_iterator it;
|
for (auto it = myOpCreatorMap.cbegin(); it != myOpCreatorMap.cend(); ++it)
|
||||||
for ( it = myOpCreatorMap.begin(); it != myOpCreatorMap.end(); ++it)
|
|
||||||
delete (*it).second;
|
delete (*it).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2155,30 +2152,6 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
|
|||||||
return aParts._retn();
|
return aParts._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
// function : register()
|
|
||||||
// purpose : register 'name' in 'name_service'
|
|
||||||
//============================================================================
|
|
||||||
void GEOM_Gen_i::register_name(char * name)
|
|
||||||
{
|
|
||||||
GEOM::GEOM_Gen_var g = _this();
|
|
||||||
name_service->Register(g, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
// function : getStudyServant()
|
|
||||||
// purpose : Get Study
|
|
||||||
//============================================================================
|
|
||||||
SALOMEDS::Study_var GEOM_Gen_i::getStudyServant()
|
|
||||||
{
|
|
||||||
static SALOMEDS::Study_var aStudy;
|
|
||||||
if(CORBA::is_nil(aStudy)){
|
|
||||||
CORBA::Object_ptr anObject = name_service->Resolve("/Study");
|
|
||||||
aStudy = SALOMEDS::Study::_narrow(anObject);
|
|
||||||
}
|
|
||||||
return aStudy;
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// function : findOrCreateComponent()
|
// function : findOrCreateComponent()
|
||||||
// purpose : Find root study component; create if it does not exist
|
// purpose : Find root study component; create if it does not exist
|
||||||
@ -3351,24 +3324,4 @@ void GEOM_Gen_i::includeSubObjects(const std::string& aSelectedEntry,
|
|||||||
includeSubObjects( aSubEntryStr, aSelected, aParents, aChildren, anOthers );
|
includeSubObjects( aSubEntryStr, aSelected, aParents, aChildren, anOthers );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=====================================================================================
|
|
||||||
// EXPORTED METHODS
|
|
||||||
//=====================================================================================
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
GEOM_I_EXPORT
|
|
||||||
PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB*, PortableServer::POA*, PortableServer::ObjectId*, const char*, const char*);
|
|
||||||
*/
|
|
||||||
|
|
||||||
GEOM_I_EXPORT
|
|
||||||
PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB_ptr orb,
|
|
||||||
PortableServer::POA_ptr poa,
|
|
||||||
PortableServer::ObjectId* contId,
|
|
||||||
const char* instanceName,
|
|
||||||
const char* interfaceName)
|
|
||||||
{
|
|
||||||
GEOM_Gen_i* myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
|
|
||||||
return myGEOM_Gen_i->getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -81,7 +81,7 @@ class GEOM_I_EXPORT GEOM_GenericOperationsCreator
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
// GEOM_Gen_i : class definition
|
// GEOM_Gen_i : class definition
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Component_i
|
class GEOM_I_EXPORT GEOM_Gen_i : public POA_GEOM::GEOM_Gen, public Engines_Component_i
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -95,22 +95,17 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
PortableServer::POA_ptr poa,
|
PortableServer::POA_ptr poa,
|
||||||
PortableServer::ObjectId * contId,
|
PortableServer::ObjectId * contId,
|
||||||
const char *instanceName,
|
const char *instanceName,
|
||||||
const char *interfaceName);
|
const char *interfaceName,
|
||||||
|
bool withRegistry = true);
|
||||||
|
|
||||||
// destructor, doing nothing (for now)
|
// destructor, doing nothing (for now)
|
||||||
virtual ~GEOM_Gen_i();
|
virtual ~GEOM_Gen_i();
|
||||||
|
|
||||||
// generic method to be put in a super class
|
|
||||||
void register_name(char * name);
|
|
||||||
|
|
||||||
// Get ORB object
|
// Get ORB object
|
||||||
CORBA::ORB_ptr GetORB() { return CORBA::ORB::_duplicate(_orb); }
|
CORBA::ORB_ptr GetORB() { return CORBA::ORB::_duplicate(_orb); }
|
||||||
|
|
||||||
// Get Naming Service object
|
|
||||||
SALOME_NamingService* GetNS() { return name_service; }
|
|
||||||
|
|
||||||
// Get Study
|
// Get Study
|
||||||
SALOMEDS::Study_var getStudyServant();
|
virtual SALOMEDS::Study_var getStudyServant() = 0;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------//
|
//-----------------------------------------------------------------------//
|
||||||
// Inherited methods from SALOMEDS::Driver //
|
// Inherited methods from SALOMEDS::Driver //
|
||||||
@ -388,7 +383,6 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
::GEOMImpl_Gen* _impl;
|
::GEOMImpl_Gen* _impl;
|
||||||
SALOME_NamingService * name_service;
|
|
||||||
char * _name;
|
char * _name;
|
||||||
|
|
||||||
// plugin operations managing
|
// plugin operations managing
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "GEOM_IOperations_i.hh"
|
#include "GEOM_IOperations_i.hh"
|
||||||
|
|
||||||
#include "GEOM_Engine.hxx"
|
#include "GEOM_Engine.hxx"
|
||||||
#include "GEOM_Gen_i.hh"
|
#include "GEOM_Gen_Session_i.hh"
|
||||||
#include <SALOME_NamingService.hxx>
|
#include <SALOME_NamingService.hxx>
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -232,7 +232,7 @@ void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj)
|
|||||||
if (!CORBA::is_nil (theObj)) {
|
if (!CORBA::is_nil (theObj)) {
|
||||||
// Cast _engine to GEOM_Gen_i type.
|
// Cast _engine to GEOM_Gen_i type.
|
||||||
PortableServer::Servant aServant = myPOA->reference_to_servant(_engine.in());
|
PortableServer::Servant aServant = myPOA->reference_to_servant(_engine.in());
|
||||||
GEOM_Gen_i *anEngine = dynamic_cast<GEOM_Gen_i *>(aServant);
|
GEOM_Gen_Session_i *anEngine = dynamic_cast<GEOM_Gen_Session_i *>(aServant);
|
||||||
|
|
||||||
if (anEngine) {
|
if (anEngine) {
|
||||||
SALOME_NamingService *aNameService = anEngine->GetNS();
|
SALOME_NamingService *aNameService = anEngine->GetNS();
|
||||||
|
@ -17,6 +17,17 @@
|
|||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
|
||||||
|
include(${SWIG_USE_FILE})
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${PROJECT_BINARY_DIR}/idl
|
||||||
|
${PROJECT_SOURCE_DIR}/src/GEOMUtils
|
||||||
|
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
|
||||||
|
${PROJECT_SOURCE_DIR}/src/GEOM
|
||||||
|
${PROJECT_SOURCE_DIR}/src/GEOMImpl
|
||||||
|
${PROJECT_SOURCE_DIR}/src/GEOM_I
|
||||||
|
)
|
||||||
|
|
||||||
# --- scripts ---
|
# --- scripts ---
|
||||||
|
|
||||||
# scripts / samples,data
|
# scripts / samples,data
|
||||||
@ -118,6 +129,23 @@ SET(_shared_SCRIPTS
|
|||||||
GEOM_shared_modules.py
|
GEOM_shared_modules.py
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
SET(GeomHelper_HEADERS GeomHelper.h GeomHelper.i)
|
||||||
|
SET(GeomHelper_SOURCES GeomHelper.cxx ${GeomHelper_HEADERS})
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(GeomHelper.i PROPERTIES CPLUSPLUS ON)
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(GeomHelper.i PROPERTIES SWIG_FLAGS "-py3")
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(GeomHelper_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
|
||||||
|
SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/GeomHelper.py )
|
||||||
|
IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||||
|
SWIG_ADD_MODULE(GeomHelper python ${GeomHelper_SOURCES})
|
||||||
|
ELSE()
|
||||||
|
SWIG_ADD_LIBRARY(GeomHelper LANGUAGE python SOURCES ${GeomHelper_SOURCES})
|
||||||
|
ENDIF()
|
||||||
|
SWIG_LINK_LIBRARIES(GeomHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} GEOMEngine ${KERNEL_SalomeKernelHelpers} ${KERNEL_SalomeDS} )
|
||||||
|
install(TARGETS _GeomHelper DESTINATION ${SALOME_INSTALL_LIBS})
|
||||||
|
install(FILES ${GeomHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
|
||||||
|
SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_GeomHelper_REAL_NAME}")
|
||||||
|
|
||||||
# --- rules ---
|
# --- rules ---
|
||||||
|
|
||||||
SALOME_INSTALL_SCRIPTS("${_other_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_DATA} DEF_PERMS)
|
SALOME_INSTALL_SCRIPTS("${_other_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_DATA} DEF_PERMS)
|
||||||
|
56
src/GEOM_SWIG/GeomHelper.cxx
Normal file
56
src/GEOM_SWIG/GeomHelper.cxx
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "GeomHelper.h"
|
||||||
|
|
||||||
|
#include "GEOM_Gen_No_Session_i.hh"
|
||||||
|
#include "SALOME_Container_i.hxx"
|
||||||
|
#include "SALOME_KernelServices.hxx"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
std::string BuildGEOMInstance()
|
||||||
|
{
|
||||||
|
CORBA::ORB_var orb;
|
||||||
|
{ int argc(0); orb = CORBA::ORB_init(argc,nullptr); }
|
||||||
|
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
|
||||||
|
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
|
||||||
|
PortableServer::POAManager_var pman = poa->the_POAManager();
|
||||||
|
CORBA::PolicyList policies;
|
||||||
|
policies.length(0);
|
||||||
|
PortableServer::ObjectId_var conId;
|
||||||
|
//
|
||||||
|
{
|
||||||
|
char *argv[4] = {"Container","FactoryServer","toto",nullptr};
|
||||||
|
Engines_Container_i *cont = new Engines_Container_i(orb,poa,"FactoryServer",2,argv,false,false);
|
||||||
|
conId = poa->activate_object(cont);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
pman->activate();
|
||||||
|
//
|
||||||
|
GEOM_Gen_No_Session_i *servant = new GEOM_Gen_No_Session_i(orb,poa,const_cast<PortableServer::ObjectId*>(&conId.in()),"GEOM_inst_2","GEOM");
|
||||||
|
PortableServer::ObjectId *zeId = servant->getId();
|
||||||
|
CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
|
||||||
|
char *interfaceName = servant->interfaceName();
|
||||||
|
std::string interfaceNameCpp(interfaceName);
|
||||||
|
CORBA::string_free(interfaceName);
|
||||||
|
KERNEL::RegisterCompo(interfaceNameCpp,zeRef);
|
||||||
|
CORBA::String_var ior = orb->object_to_string(zeRef);
|
||||||
|
return std::string(ior.in());
|
||||||
|
}
|
22
src/GEOM_SWIG/GeomHelper.h
Normal file
22
src/GEOM_SWIG/GeomHelper.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
std::string BuildGEOMInstance();
|
27
src/GEOM_SWIG/GeomHelper.i
Normal file
27
src/GEOM_SWIG/GeomHelper.i
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
%module GeomHelper
|
||||||
|
|
||||||
|
%include "std_string.i"
|
||||||
|
|
||||||
|
%inline
|
||||||
|
{
|
||||||
|
std::string BuildGEOMInstance();
|
||||||
|
}
|
@ -853,7 +853,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
|||||||
self.GroupOp = self.GetIGroupOperations ()
|
self.GroupOp = self.GetIGroupOperations ()
|
||||||
self.FieldOp = self.GetIFieldOperations ()
|
self.FieldOp = self.GetIFieldOperations ()
|
||||||
|
|
||||||
notebook.myStudy = salome.myStudy
|
notebook.myStudy = self.myStudy
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def GetPluginOperations(self, libraryName):
|
def GetPluginOperations(self, libraryName):
|
||||||
|
Loading…
Reference in New Issue
Block a user