mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 09:50:34 +05:00
Checkpoint 0 - OK now time to study management
This commit is contained in:
parent
30bf08e12b
commit
eaf42a347a
@ -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 )
|
||||||
|
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)
|
||||||
|
53
src/GEOM_SWIG/GeomHelper.cxx
Normal file
53
src/GEOM_SWIG/GeomHelper.cxx
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// 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_i.hh"
|
||||||
|
#include "SALOME_Container_i.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::POA_var poa2 = poa->create_POA("POAGeom",pman,policies);
|
||||||
|
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_i *servant = new GEOM_Gen_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);
|
||||||
|
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();
|
||||||
|
}
|
@ -705,7 +705,13 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
|||||||
# 1. CORBA resolution of server
|
# 1. CORBA resolution of server
|
||||||
# 2. the __new__ method is called again
|
# 2. the __new__ method is called again
|
||||||
#print "==== FindOrLoadComponent ", engine, geom, doLcc, created
|
#print "==== FindOrLoadComponent ", engine, geom, doLcc, created
|
||||||
geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
|
#geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
|
||||||
|
import GeomHelper
|
||||||
|
geom_ior = GeomHelper.BuildGEOMInstance()
|
||||||
|
import GEOM
|
||||||
|
import CORBA
|
||||||
|
orb=CORBA.ORB_init([''])
|
||||||
|
geom = orb.string_to_object(geom_ior)
|
||||||
#print "====1 ",geom
|
#print "====1 ",geom
|
||||||
else:
|
else:
|
||||||
# FindOrLoadComponent not called
|
# FindOrLoadComponent not called
|
||||||
|
Loading…
Reference in New Issue
Block a user