From bc9708cd0a4a1bae5b27ec54241d889d2e9dd486 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 4 Sep 2013 13:49:39 +0000 Subject: [PATCH] Improvements for HYDRO module: 1. General mechanism for activation of GUI Geometry operations. 2. Plugins mechanism in Geometry module. --- adm_local/cmake_files/FindGEOM.cmake | 1 + bin/geom_setenv.py | 52 ++- configure.ac | 1 + idl/GEOM_Gen.idl | 12 +- resources/GEOMActions.xml | 62 +++ resources/Makefile.am | 1 + resources/SalomeApp.xml.in | 1 + src/AdvancedEngine/AdvancedEngine.cxx | 43 ++ .../AdvancedEngine_OperationsCreator.cc | 72 +++ .../AdvancedEngine_OperationsCreator.hh | 51 +++ src/AdvancedEngine/AdvancedEngine_Types.hxx | 37 ++ .../GEOMImpl_DividedDiskDriver.cxx | 3 +- .../GEOMImpl_DividedDiskDriver.hxx | 0 .../GEOMImpl_IAdvancedOperations.cxx | 2 + .../GEOMImpl_IAdvancedOperations.hxx | 0 .../GEOMImpl_IDividedDisk.hxx | 0 .../GEOMImpl_IPipeTShape.hxx | 0 .../GEOMImpl_ISmoothingSurface.hxx | 0 .../GEOMImpl_PipeTShapeDriver.cxx | 3 +- .../GEOMImpl_PipeTShapeDriver.hxx | 0 .../GEOMImpl_SmoothingSurfaceDriver.cxx | 2 + .../GEOMImpl_SmoothingSurfaceDriver.hxx | 0 src/AdvancedEngine/GEOM_AdvancedEngine.hxx | 43 ++ .../GEOM_IAdvancedOperations_i.cc | 0 .../GEOM_IAdvancedOperations_i.hh | 0 src/AdvancedEngine/Makefile.am | 83 ++++ src/AdvancedGUI/AdvancedGUI.cxx | 56 ++- src/AdvancedGUI/AdvancedGUI.h | 5 +- .../AdvancedGUI_DividedCylinderDlg.cxx | 3 +- .../AdvancedGUI_DividedDiskDlg.cxx | 3 +- src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx | 3 +- .../AdvancedGUI_SmoothingSurfaceDlg.cxx | 3 +- src/AdvancedGUI/AdvancedGUI_images.ts | 177 ++++++++ src/AdvancedGUI/AdvancedGUI_msg_en.ts | 273 ++++++++++++ src/AdvancedGUI/AdvancedGUI_msg_fr.ts | 273 ++++++++++++ src/AdvancedGUI/AdvancedGUI_msg_ja.ts | 233 ++++++++++ src/AdvancedGUI/Makefile.am | 12 +- src/GEOMGUI/GEOMGUI_XmlHandler.cxx | 157 +++++++ src/GEOMGUI/GEOMGUI_XmlHandler.h | 90 ++++ src/GEOMGUI/GEOMPluginGUI.cxx | 54 +++ src/GEOMGUI/GEOMPluginGUI.h | 49 +++ src/GEOMGUI/GEOM_images.ts | 166 ------- src/GEOMGUI/GEOM_msg_en.ts | 262 ----------- src/GEOMGUI/GEOM_msg_fr.ts | 254 ----------- src/GEOMGUI/GEOM_msg_ja.ts | 112 ----- src/GEOMGUI/GeometryGUI.cxx | 409 ++++++++++++++---- src/GEOMGUI/GeometryGUI.h | 14 +- src/GEOMGUI/GeometryGUI_Operations.h | 11 +- src/GEOMGUI/Makefile.am | 4 + src/GEOMImpl/GEOMImpl_Gen.cxx | 28 -- src/GEOMImpl/GEOMImpl_Gen.hxx | 4 - src/GEOMImpl/GEOMImpl_Types.hxx | 19 +- src/GEOMImpl/Makefile.am | 20 - src/GEOM_I/GEOM_Gen_i.cc | 136 ++++-- src/GEOM_I/GEOM_Gen_i.hh | 26 +- src/GEOM_I/Makefile.am | 2 - src/GEOM_I_Superv/GEOM_Superv_i.cc | 5 +- src/GEOM_SWIG/geomBuilder.py | 29 +- src/Makefile.am | 5 +- 59 files changed, 2347 insertions(+), 1019 deletions(-) create mode 100644 resources/GEOMActions.xml create mode 100644 src/AdvancedEngine/AdvancedEngine.cxx create mode 100644 src/AdvancedEngine/AdvancedEngine_OperationsCreator.cc create mode 100755 src/AdvancedEngine/AdvancedEngine_OperationsCreator.hh create mode 100644 src/AdvancedEngine/AdvancedEngine_Types.hxx rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_DividedDiskDriver.cxx (99%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_DividedDiskDriver.hxx (100%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_IAdvancedOperations.cxx (99%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_IAdvancedOperations.hxx (100%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_IDividedDisk.hxx (100%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_IPipeTShape.hxx (100%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_ISmoothingSurface.hxx (100%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_PipeTShapeDriver.cxx (99%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_PipeTShapeDriver.hxx (100%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_SmoothingSurfaceDriver.cxx (99%) rename src/{GEOMImpl => AdvancedEngine}/GEOMImpl_SmoothingSurfaceDriver.hxx (100%) create mode 100755 src/AdvancedEngine/GEOM_AdvancedEngine.hxx rename src/{GEOM_I => AdvancedEngine}/GEOM_IAdvancedOperations_i.cc (100%) rename src/{GEOM_I => AdvancedEngine}/GEOM_IAdvancedOperations_i.hh (100%) create mode 100644 src/AdvancedEngine/Makefile.am create mode 100644 src/AdvancedGUI/AdvancedGUI_images.ts create mode 100644 src/AdvancedGUI/AdvancedGUI_msg_en.ts create mode 100644 src/AdvancedGUI/AdvancedGUI_msg_fr.ts create mode 100644 src/AdvancedGUI/AdvancedGUI_msg_ja.ts create mode 100644 src/GEOMGUI/GEOMGUI_XmlHandler.cxx create mode 100644 src/GEOMGUI/GEOMGUI_XmlHandler.h create mode 100644 src/GEOMGUI/GEOMPluginGUI.cxx create mode 100644 src/GEOMGUI/GEOMPluginGUI.h diff --git a/adm_local/cmake_files/FindGEOM.cmake b/adm_local/cmake_files/FindGEOM.cmake index 217f94034..d30118d0e 100644 --- a/adm_local/cmake_files/FindGEOM.cmake +++ b/adm_local/cmake_files/FindGEOM.cmake @@ -19,6 +19,7 @@ SET(GEOM_CXXFLAGS -I${GEOM_ROOT_DIR}/include/salome) +FIND_LIBRARY(AdvancedEngine AdvancedEngine ${GEOM_ROOT_DIR}/lib/salome) FIND_LIBRARY(AdvancedGUI AdvancedGUI ${GEOM_ROOT_DIR}/lib/salome) FIND_LIBRARY(BasicGUI BasicGUI ${GEOM_ROOT_DIR}/lib/salome) FIND_LIBRARY(BlocksGUI BlocksGUI ${GEOM_ROOT_DIR}/lib/salome) diff --git a/bin/geom_setenv.py b/bin/geom_setenv.py index 4d3702913..3132e1450 100644 --- a/bin/geom_setenv.py +++ b/bin/geom_setenv.py @@ -19,14 +19,16 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import os +import os, sys from salome_utils import getTmpDir, generateFileName, uniteFiles -from setenv import salome_subdir +from setenv import add_path, get_lib_dir, salome_subdir # ----------------------------------------------------------------------------- def set_env( args ): """Add to the PATH-variables modules specific paths""" + psep = os.pathsep + python_version="python%d.%d" % sys.version_info[0:2] tmp_dir = getTmpDir() env_dir = generateFileName( tmp_dir, prefix="env", with_port=True ) @@ -45,3 +47,49 @@ def set_env( args ): pass pass + # find plugins + plugin_list = [] + resource_path_list = [] + for env_var in os.environ.keys(): + value = os.environ[env_var] + if env_var[-9:] == "_ROOT_DIR" and value: + plugin_root = value + plugin = env_var[:-9] # plugin name may have wrong case + + # look for NAMEOFPlugin.xml file among resource files + resource_dir = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower()) + if not os.access( resource_dir, os.F_OK ): continue + for resource_file in os.listdir( resource_dir ): + if not resource_file.endswith( ".xml") or \ + resource_file.lower() != plugin.lower() + ".xml": + continue + # use "name" attribute of "geom-plugin" as name of plugin in a right case + from xml.dom.minidom import parse + xml_doc = parse( os.path.join( resource_dir, resource_file )) + plugin_nodes = xml_doc.getElementsByTagName("geom-plugin") + if not plugin_nodes or not plugin_nodes[0].hasAttribute("name"): continue + plugin = plugin_nodes[0].getAttribute("name") + if plugin in plugin_list: continue + + # add paths of plugin + plugin_list.append(plugin) + if not os.environ.has_key("SALOME_"+plugin+"Resources"): + resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower()) + os.environ["SALOME_"+plugin+"Resources"] = resource_path + resource_path_list.append( resource_path ) + add_path(os.path.join(plugin_root,get_lib_dir(),python_version, "site-packages",salome_subdir), "PYTHONPATH") + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH") + + if sys.platform == "win32": + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH") + add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH") + else: + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH") + add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH") + add_path(os.path.join(plugin_root,"bin",salome_subdir), "PATH") + pass + pass + break + plugin_list.append("GEOMActions") + os.environ["GEOM_PluginsList"] = ":".join(plugin_list) + os.environ["SalomeAppConfig"] = os.environ["SalomeAppConfig"] + psep + psep.join(resource_path_list) diff --git a/configure.ac b/configure.ac index bb1e8d656..af06e2955 100644 --- a/configure.ac +++ b/configure.ac @@ -489,6 +489,7 @@ AC_OUTPUT([ \ doc/salome/tui/static/header.html \ src/Makefile \ src/AdvancedGUI/Makefile \ + src/AdvancedEngine/Makefile \ src/ARCHIMEDE/Makefile \ src/BREPExport/Makefile \ src/BREPImport/Makefile \ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 23083c1f4..7aaaa622c 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -4563,8 +4563,8 @@ module GEOM in boolean theInheritFirstArg, in boolean theAddPrefix); - // # Methods to access interfaces for objects creation and transformation - + // # Methods to access interfaces for objects creation and transformation + GEOM_IBasicOperations GetIBasicOperations (in long theStudyID) raises (SALOME::SALOME_Exception); GEOM_ITransformOperations GetITransformOperations(in long theStudyID) raises (SALOME::SALOME_Exception); GEOM_I3DPrimOperations GetI3DPrimOperations (in long theStudyID) raises (SALOME::SALOME_Exception); @@ -4577,10 +4577,12 @@ module GEOM GEOM_IMeasureOperations GetIMeasureOperations (in long theStudyID) raises (SALOME::SALOME_Exception); GEOM_IBlocksOperations GetIBlocksOperations (in long theStudyID) raises (SALOME::SALOME_Exception); GEOM_IGroupOperations GetIGroupOperations (in long theStudyID) raises (SALOME::SALOME_Exception); - GEOM_IAdvancedOperations GetIAdvancedOperations (in long theStudyID) raises (SALOME::SALOME_Exception); - // # Objects Management - + GEOM_IOperations GetPluginOperations (in long theStudyID, + in string theLibName) raises (SALOME::SALOME_Exception); + + // # Objects Management + /*! * \brief Removes the object from the GEOM component diff --git a/resources/GEOMActions.xml b/resources/GEOMActions.xml new file mode 100644 index 000000000..a59fcbbc2 --- /dev/null +++ b/resources/GEOMActions.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Makefile.am b/resources/Makefile.am index 90ca30a67..0fd04dc92 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -25,6 +25,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am dist_salomeres_DATA = \ +GEOMActions.xml \ GEOM_en.xml \ GEOM_fr.xml \ GEOM.config \ diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index fbd07f25b..6f5be593d 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -37,6 +37,7 @@
+
diff --git a/src/AdvancedEngine/AdvancedEngine.cxx b/src/AdvancedEngine/AdvancedEngine.cxx new file mode 100644 index 000000000..bd5356b33 --- /dev/null +++ b/src/AdvancedEngine/AdvancedEngine.cxx @@ -0,0 +1,43 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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_AdvancedEngine.hxx" + +#include "AdvancedEngine_OperationsCreator.hh" + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ +ADVANCEDENGINE_EXPORT + GEOM_GenericOperationsCreator* GetOperationsCreator() + { + //MESSAGE("GetOperationsCreator"); + + AdvancedEngine_OperationsCreator* aCreator = new AdvancedEngine_OperationsCreator(); + + return aCreator; + } +} diff --git a/src/AdvancedEngine/AdvancedEngine_OperationsCreator.cc b/src/AdvancedEngine/AdvancedEngine_OperationsCreator.cc new file mode 100644 index 000000000..811c480b6 --- /dev/null +++ b/src/AdvancedEngine/AdvancedEngine_OperationsCreator.cc @@ -0,0 +1,72 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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_AdvancedEngine.hxx" + +#include "AdvancedEngine_OperationsCreator.hh" + +#include "GEOM_IAdvancedOperations_i.hh" + +// Operations +#include +#include +// #include +#include +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ + +#include +#include + +#include "Utils_ExceptHandlers.hxx" +#include "utilities.h" + +//============================================================================ +// function : Create +// purpose : +//============================================================================ +GEOM_IOperations_i* AdvancedEngine_OperationsCreator::Create (PortableServer::POA_ptr thePOA, + int theStudyId, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_Gen* theGenImpl) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "AdvancedEngine_OperationsCreator::Create" ); + + if (_mapOfOperations.find(theStudyId) == _mapOfOperations.end()) { + _mapOfOperations[theStudyId] = new GEOMImpl_IAdvancedOperations (theGenImpl, theStudyId); + + // Advanced operations + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), + new GEOMImpl_PipeTShapeDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedDiskDriver::GetID(), + new GEOMImpl_DividedDiskDriver()); + //TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(), + // new GEOMImpl_DividedCylinderDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SmoothingSurfaceDriver::GetID(), + new GEOMImpl_SmoothingSurfaceDriver()); + /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ + } + + GEOM_IAdvancedOperations_i* aServant = + new GEOM_IAdvancedOperations_i (thePOA, theEngine, _mapOfOperations[theStudyId]); + + return aServant; +} diff --git a/src/AdvancedEngine/AdvancedEngine_OperationsCreator.hh b/src/AdvancedEngine/AdvancedEngine_OperationsCreator.hh new file mode 100755 index 000000000..098dc8faf --- /dev/null +++ b/src/AdvancedEngine/AdvancedEngine_OperationsCreator.hh @@ -0,0 +1,51 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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 + +#ifndef _GEOM_ADVANCEDENGINE_OPERATIONSCREATOR_HXX_ +#define _GEOM_ADVANCEDENGINE_OPERATIONSCREATOR_HXX_ + +#include "GEOM_AdvancedEngine.hxx" + +#include "GEOM_Gen_i.hh" + +#include "GEOMImpl_IAdvancedOperations.hxx" + +#include + +//===================================================================== +// Operations creator +//===================================================================== +class ADVANCEDENGINE_EXPORT AdvancedEngine_OperationsCreator : public GEOM_GenericOperationsCreator +{ + public: + // Create operations + virtual GEOM_IOperations_i* Create (PortableServer::POA_ptr thePOA, + int theStudyId, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_Gen* theGenImpl); + // return the name of IDL module + //virtual std::string GetModuleName(); + + private: + std::map _mapOfOperations; +}; + +#endif diff --git a/src/AdvancedEngine/AdvancedEngine_Types.hxx b/src/AdvancedEngine/AdvancedEngine_Types.hxx new file mode 100644 index 000000000..aae00cda0 --- /dev/null +++ b/src/AdvancedEngine/AdvancedEngine_Types.hxx @@ -0,0 +1,37 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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 + +// Advanced functions (base = 200) +#define ADVANCED_BASE 200 // NO OPERATION (advanced operations base) +#define GEOM_TSHAPE 201 +#define GEOM_DIVIDEDDISK 202 +#define GEOM_DIVIDEDCYLINDER 203 +#define GEOM_SMOOTHINGSURFACE 204 +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ +// Advanced functions sub-operations codes +#define TSHAPE_BASIC 1 +#define TSHAPE_CHAMFER 2 +#define TSHAPE_FILLET 3 +#define DIVIDEDDISK_R_RATIO 1 +#define DIVIDEDDISK_R_VECTOR_PNT 2 +#define DIVIDEDCYLINDER_R_H 1 +#define SMOOTHINGSURFACE_LPOINTS 1 +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx b/src/AdvancedEngine/GEOMImpl_DividedDiskDriver.cxx similarity index 99% rename from src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx rename to src/AdvancedEngine/GEOMImpl_DividedDiskDriver.cxx index 8a756d56c..d44566c2f 100644 --- a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx +++ b/src/AdvancedEngine/GEOMImpl_DividedDiskDriver.cxx @@ -18,10 +18,11 @@ // 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 +#include "AdvancedEngine_Types.hxx" + #include #include #include diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx b/src/AdvancedEngine/GEOMImpl_DividedDiskDriver.hxx similarity index 100% rename from src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx rename to src/AdvancedEngine/GEOMImpl_DividedDiskDriver.hxx diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/AdvancedEngine/GEOMImpl_IAdvancedOperations.cxx similarity index 99% rename from src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx rename to src/AdvancedEngine/GEOMImpl_IAdvancedOperations.cxx index 42d457fc4..4e07fb95d 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/AdvancedEngine/GEOMImpl_IAdvancedOperations.cxx @@ -92,6 +92,8 @@ #include +#include "AdvancedEngine_Types.hxx" + #include #include #include diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/AdvancedEngine/GEOMImpl_IAdvancedOperations.hxx similarity index 100% rename from src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx rename to src/AdvancedEngine/GEOMImpl_IAdvancedOperations.hxx diff --git a/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx b/src/AdvancedEngine/GEOMImpl_IDividedDisk.hxx similarity index 100% rename from src/GEOMImpl/GEOMImpl_IDividedDisk.hxx rename to src/AdvancedEngine/GEOMImpl_IDividedDisk.hxx diff --git a/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx b/src/AdvancedEngine/GEOMImpl_IPipeTShape.hxx similarity index 100% rename from src/GEOMImpl/GEOMImpl_IPipeTShape.hxx rename to src/AdvancedEngine/GEOMImpl_IPipeTShape.hxx diff --git a/src/GEOMImpl/GEOMImpl_ISmoothingSurface.hxx b/src/AdvancedEngine/GEOMImpl_ISmoothingSurface.hxx similarity index 100% rename from src/GEOMImpl/GEOMImpl_ISmoothingSurface.hxx rename to src/AdvancedEngine/GEOMImpl_ISmoothingSurface.hxx diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx b/src/AdvancedEngine/GEOMImpl_PipeTShapeDriver.cxx similarity index 99% rename from src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx rename to src/AdvancedEngine/GEOMImpl_PipeTShapeDriver.cxx index 4446e8343..3641ee7fc 100644 --- a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx +++ b/src/AdvancedEngine/GEOMImpl_PipeTShapeDriver.cxx @@ -15,7 +15,6 @@ // 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 @@ -71,6 +70,8 @@ #include //@@ include required header files here @@// +#include "AdvancedEngine_Types.hxx" + //======================================================================= //function : GetID //purpose : diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx b/src/AdvancedEngine/GEOMImpl_PipeTShapeDriver.hxx similarity index 100% rename from src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx rename to src/AdvancedEngine/GEOMImpl_PipeTShapeDriver.hxx diff --git a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx b/src/AdvancedEngine/GEOMImpl_SmoothingSurfaceDriver.cxx similarity index 99% rename from src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx rename to src/AdvancedEngine/GEOMImpl_SmoothingSurfaceDriver.cxx index 4dbb65b17..2f4d80558 100644 --- a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx +++ b/src/AdvancedEngine/GEOMImpl_SmoothingSurfaceDriver.cxx @@ -21,6 +21,8 @@ #include +#include "AdvancedEngine_Types.hxx" + #include #include #include diff --git a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx b/src/AdvancedEngine/GEOMImpl_SmoothingSurfaceDriver.hxx similarity index 100% rename from src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx rename to src/AdvancedEngine/GEOMImpl_SmoothingSurfaceDriver.hxx diff --git a/src/AdvancedEngine/GEOM_AdvancedEngine.hxx b/src/AdvancedEngine/GEOM_AdvancedEngine.hxx new file mode 100755 index 000000000..ec1522503 --- /dev/null +++ b/src/AdvancedEngine/GEOM_AdvancedEngine.hxx @@ -0,0 +1,43 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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 + +#ifndef _GEOM_ADVANCEDENGINE_HXX_ +#define _GEOM_ADVANCEDENGINE_HXX_ + +#ifdef WNT + #if defined ADVANCEDENGINE_EXPORTS || defined AdvancedEngine_EXPORTS + #if defined WIN32 + #define ADVANCEDENGINE_EXPORT __declspec( dllexport ) + #else + #define ADVANCEDENGINE_EXPORT + #endif + #else + #if defined WIN32 + #define ADVANCEDENGINE_EXPORT __declspec( dllimport ) + #else + #define ADVANCEDENGINE_EXPORT + #endif + #endif +#else + #define ADVANCEDENGINE_EXPORT +#endif + +#endif diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/AdvancedEngine/GEOM_IAdvancedOperations_i.cc similarity index 100% rename from src/GEOM_I/GEOM_IAdvancedOperations_i.cc rename to src/AdvancedEngine/GEOM_IAdvancedOperations_i.cc diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh b/src/AdvancedEngine/GEOM_IAdvancedOperations_i.hh similarity index 100% rename from src/GEOM_I/GEOM_IAdvancedOperations_i.hh rename to src/AdvancedEngine/GEOM_IAdvancedOperations_i.hh diff --git a/src/AdvancedEngine/Makefile.am b/src/AdvancedEngine/Makefile.am new file mode 100644 index 000000000..a8af35ffc --- /dev/null +++ b/src/AdvancedEngine/Makefile.am @@ -0,0 +1,83 @@ +# Copyright (C) 2007-2013 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. +# +# 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 $(top_srcdir)/adm_local/unix/make_common_starter.am + +# Libraries targets +lib_LTLIBRARIES = libAdvancedEngine.la + +# header files +salomeinclude_HEADERS = \ + AdvancedEngine_Types.hxx \ + AdvancedEngine_OperationsCreator.hh \ + GEOM_AdvancedEngine.hxx \ + GEOMImpl_IAdvancedOperations.hxx \ + GEOM_IAdvancedOperations_i.hh + +ADVANCED_INCLUDES = +ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx +ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx +##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx +ADVANCED_INCLUDES += GEOMImpl_ISmoothingSurface.hxx GEOMImpl_SmoothingSurfaceDriver.hxx +##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## + +salomeinclude_HEADERS += $(ADVANCED_INCLUDES) + +dist_libAdvancedEngine_la_SOURCES = \ + AdvancedEngine.cxx \ + AdvancedEngine_OperationsCreator.cc \ + GEOMImpl_IAdvancedOperations.cxx \ + GEOM_IAdvancedOperations_i.cc + +ADVANCED_SOURCES = +ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx +ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx +##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx +ADVANCED_SOURCES += GEOMImpl_SmoothingSurfaceDriver.cxx +##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## + +dist_libAdvancedEngine_la_SOURCES += $(ADVANCED_SOURCES) + +# additional information to compile and link file + +libAdvancedEngine_la_CPPFLAGS = \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(BOOST_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) \ + -I$(srcdir)/../GEOMUtils \ + -I$(srcdir)/../NMTDS \ + -I$(srcdir)/../NMTTools \ + -I$(srcdir)/../GEOMAlgo \ + -I$(srcdir)/../GEOM \ + -I$(srcdir)/../GEOMImpl \ + -I$(srcdir)/../GEOM_I \ + -I$(top_builddir)/idl \ + -I$(top_builddir) + +libAdvancedEngine_la_LDFLAGS = \ + ../../idl/libSalomeIDLGEOM.la \ + ../GEOMUtils/libGEOMUtils.la \ + ../GEOMAlgo/libGEOMAlgo.la \ + ../GEOM/libGEOMbasic.la \ + ../GEOMImpl/libGEOMimpl.la \ + ../GEOM_I/libGEOMEngine.la \ + $(KERNEL_LDFLAGS) -lOpUtil -lSalomeNS -lSalomeContainer -lSalomeGenericObj -lTOOLSDS \ + $(CAS_DATAEXCHANGE) \ + $(CAS_LDPATH) -lTKFillet -lTKOffset diff --git a/src/AdvancedGUI/AdvancedGUI.cxx b/src/AdvancedGUI/AdvancedGUI.cxx index 818f4c276..12aec5c8f 100644 --- a/src/AdvancedGUI/AdvancedGUI.cxx +++ b/src/AdvancedGUI/AdvancedGUI.cxx @@ -23,7 +23,7 @@ #include "AdvancedGUI.h" #include "GeometryGUI.h" -#include "GeometryGUI_Operations.h" +//#include "GeometryGUI_Operations.h" #include #include @@ -36,11 +36,13 @@ #include +#include + //======================================================================= // function : AdvancedGUI() // purpose : Constructor //======================================================================= -AdvancedGUI::AdvancedGUI( GeometryGUI* parent ) : GEOMGUI( parent ) +AdvancedGUI::AdvancedGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent ) { } @@ -57,6 +59,28 @@ AdvancedGUI::~AdvancedGUI() // purpose : //======================================================================= bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) +{ + switch ( theCommandID ) { + case 1: + return OnGUIEvent("TShape_Basic", parent); + case 2: + return OnGUIEvent("DividedDisk", parent); + case 3: + return OnGUIEvent("DividedCylinder", parent); + case 4: + return OnGUIEvent("SmoothingSurface", parent); + //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// + default: + return OnGUIEvent("", parent); + } + return false; +} + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool AdvancedGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent ) { SalomeApp_Application* app = getGeometryGUI()->getApp(); if ( !app ) return false; @@ -65,26 +89,24 @@ bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; - switch ( theCommandID ) { - case GEOMOp::OpPipeTShape: + if (theCommandID == "TShape_Basic") { aDlg = new AdvancedGUI_PipeTShapeDlg( getGeometryGUI(), parent ); - break; -// case GEOMOp::OpPipeTShapeGroups: -// aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent ); -// break; - case GEOMOp::OpDividedDisk: + } + //else if (theCommandID == "TShape_Groups") { + // aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent ); + //} + else if (theCommandID == "DividedDisk") { aDlg = new AdvancedGUI_DividedDiskDlg( getGeometryGUI(), parent ); - break; - case GEOMOp::OpDividedCylinder: + } + else if (theCommandID == "DividedCylinder") { aDlg = new AdvancedGUI_DividedCylinderDlg( getGeometryGUI(), parent ); - break; - case GEOMOp::OpSmoothingSurface: + } + else if (theCommandID == "SmoothingSurface") { aDlg = new AdvancedGUI_SmoothingSurfaceDlg( getGeometryGUI(), parent ); - break; + } //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// - default: + else { app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); - break; } if ( aDlg != NULL ) @@ -101,7 +123,7 @@ extern "C" #ifdef WIN32 __declspec( dllexport ) #endif - GEOMGUI* GetLibGUI( GeometryGUI* parent ) + GEOMPluginGUI* GetLibGUI( GeometryGUI* parent ) { return new AdvancedGUI( parent ); } diff --git a/src/AdvancedGUI/AdvancedGUI.h b/src/AdvancedGUI/AdvancedGUI.h index 2ee00afc9..7d746c5d5 100644 --- a/src/AdvancedGUI/AdvancedGUI.h +++ b/src/AdvancedGUI/AdvancedGUI.h @@ -23,19 +23,20 @@ #ifndef ADVANCEDGUI_H #define ADVANCEDGUI_H -#include "GEOMGUI.h" +#include "GEOMPluginGUI.h" //================================================================================= // class : AdvancedGUI // purpose : //================================================================================= -class AdvancedGUI : public GEOMGUI +class AdvancedGUI : public GEOMPluginGUI { public: AdvancedGUI( GeometryGUI* ); ~AdvancedGUI(); bool OnGUIEvent( int, SUIT_Desktop* ); + bool OnGUIEvent( const QString&, SUIT_Desktop* ); }; #endif // ADVANCEDGUI_H diff --git a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx index e87bf882a..77eb987a4 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx @@ -217,7 +217,8 @@ void AdvancedGUI_DividedCylinderDlg::ValueChangedInSpinBox() //================================================================================= GEOM::GEOM_IOperations_ptr AdvancedGUI_DividedCylinderDlg::createOperation() { - return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + //return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine"); } //================================================================================= diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx index ecf1f1325..76e1a68f0 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx @@ -392,7 +392,8 @@ void AdvancedGUI_DividedDiskDlg::ValueChangedInSpinBox() //================================================================================= GEOM::GEOM_IOperations_ptr AdvancedGUI_DividedDiskDlg::createOperation() { - return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + //return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine"); } //================================================================================= diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx index 748004596..4e686ea82 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -844,7 +844,8 @@ void AdvancedGUI_PipeTShapeDlg::DisplayPreview (const bool activate, const bool //================================================================================= GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() { - return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + //return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine"); } //================================================================================= diff --git a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx index 2f8a5febd..9a1d4107b 100644 --- a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx @@ -158,7 +158,8 @@ void AdvancedGUI_SmoothingSurfaceDlg::enterEvent (QEvent*) //================================================================================= GEOM::GEOM_IOperations_ptr AdvancedGUI_SmoothingSurfaceDlg::createOperation() { - return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + //return getGeomEngine()->GetIAdvancedOperations(getStudyId()); + return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine"); } //================================================================================= diff --git a/src/AdvancedGUI/AdvancedGUI_images.ts b/src/AdvancedGUI/AdvancedGUI_images.ts new file mode 100644 index 000000000..3dd602c67 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_images.ts @@ -0,0 +1,177 @@ + + + + + @default + + ICON_OBJBROWSER_ADVANCED_201 + tree_pipetshape.png + + + ICON_OBJBROWSER_ADVANCED_202 + divided_disk.png + + + ICON_OBJBROWSER_ADVANCED_203 + dividedcylinder.png + + + ICON_OBJBROWSER_ADVANCED_204 + tree_smoothingsurface.png + + + + ICON_DLG_PIPETSHAPE + pipetshape.png + + + ICO_PIPETSHAPE + pipetshape.png + + + ICO_PIPETSHAPE_IMPORT + pipetshape_import_icon.png + + + DLG_PIPETSHAPE + dlg_pipetshape.png + + + IMG_PIPETSHAPE_SECT + pipetshape_section.png + + + DLG_PIPETSHAPE_L1 + dlg_pipetshapel1.png + + + DLG_PIPETSHAPE_R1 + dlg_pipetshaper1.png + + + DLG_PIPETSHAPE_W1 + dlg_pipetshapew1.png + + + DLG_PIPETSHAPE_L2 + dlg_pipetshapel2.png + + + DLG_PIPETSHAPE_R2 + dlg_pipetshaper2.png + + + DLG_PIPETSHAPE_W2 + dlg_pipetshapew2.png + + + + DLG_PIPETSHAPE_FILLET + dlg_pipetshapefillet.png + + + DLG_PIPETSHAPE_FILLET_L1 + dlg_pipetshapefilletl1.png + + + DLG_PIPETSHAPE_FILLET_R1 + dlg_pipetshapefilletr1.png + + + DLG_PIPETSHAPE_FILLET_W1 + dlg_pipetshapefilletw1.png + + + DLG_PIPETSHAPE_FILLET_L2 + dlg_pipetshapefilletl2.png + + + DLG_PIPETSHAPE_FILLET_R2 + dlg_pipetshapefilletr2.png + + + DLG_PIPETSHAPE_FILLET_W2 + dlg_pipetshapefilletw2.png + + + DLG_PIPETSHAPE_FILLET_RF + dlg_pipetshapefilletrf.png + + + + DLG_PIPETSHAPE_CHAMFER + dlg_pipetshapechamfer.png + + + DLG_PIPETSHAPE_CHAMFER_L1 + dlg_pipetshapechamferl1.png + + + DLG_PIPETSHAPE_CHAMFER_R1 + dlg_pipetshapechamferr1.png + + + DLG_PIPETSHAPE_CHAMFER_W1 + dlg_pipetshapechamferw1.png + + + DLG_PIPETSHAPE_CHAMFER_L2 + dlg_pipetshapechamferl2.png + + + DLG_PIPETSHAPE_CHAMFER_R2 + dlg_pipetshapechamferr2.png + + + DLG_PIPETSHAPE_CHAMFER_W2 + dlg_pipetshapechamferw2.png + + + DLG_PIPETSHAPE_CHAMFER_H + dlg_pipetshapechamferh.png + + + DLG_PIPETSHAPE_CHAMFER_W + dlg_pipetshapechamferw.png + + + + + + ICON_DLG_DIVIDEDDISK_R_RATIO + divided_disk.png + + + ICO_DIVIDEDDISK + divided_disk.png + + + + ICON_DLG_DIVIDEDCYLINDER_R_H + dividedcylinder_r_h.png + + + ICO_DIVIDEDCYLINDER + dividedcylinder.png + + + + ICON_DLG_SMOOTHINGSURFACE_LPOINTS + smoothingsurface_lpoints.png + + + ICO_SMOOTHINGSURFACE + smoothingsurface.png + + + + diff --git a/src/AdvancedGUI/AdvancedGUI_msg_en.ts b/src/AdvancedGUI/AdvancedGUI_msg_en.ts new file mode 100644 index 000000000..e7524147c --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_msg_en.ts @@ -0,0 +1,273 @@ + + + + + @default + + GEOM_ADVANCED + Advanced shape: type %1 + + + GEOM_ADVANCED_201 + Pipe TShape + + + GEOM_ADVANCED_202 + Divided Disk + + + GEOM_ADVANCED_203 + Divided Cylinder + + + GEOM_DIVIDEDDISK + Divided Disk + + + GEOM_DIVIDEDDISK_TITLE + Divided Disk construction + + + GEOM_DIVIDEDCYLINDER + Divided Cylinder + + + GEOM_DIVIDEDCYLINDER_TITLE + Divided Cylinder construction + + + MEN_DIVIDEDCYLINDER + Divided Cylinder + + + TOP_DIVIDEDCYLINDER + Divided Cylinder + + + STB_DIVIDEDCYLINDER + Divided Cylinder + + + MEN_DIVIDEDDISK + Divided Disk + + + TOP_DIVIDEDDISK + Divided Disk + + + STB_DIVIDEDDISK + Divided Disk + + + TOP_PIPETSHAPE + Create Pipe TShape + + + MEN_PIPETSHAPE + Pipe TShape + + + STB_PIPETSHAPE + Create new Pipe TShape object + + + TOP_SMOOTHINGSURFACE + Smoothing Surface + + + MEN_SMOOTHINGSURFACE + Smoothing Surface + + + STB_SMOOTHINGSURFACE + Smoothing Surface + + + HALF_LENGTH_MAIN_PIPE + Main pipe half length + + + HALF_LENGTH_INCIDENT_PIPE + Incident pipe half length + + + CIRCULAR_QUARTER_PIPE + Circular quarter of pipe + + + THICKNESS + Thickness + + + FLANGE + Flange + + + CHAMFER_OR_FILLET + Chamfer or fillet + + + CHAMFER + Chamfer + + + FILLET + Fillet + + + JUNCTION_FACE_1 + Junction 1 + + + JUNCTION_FACE_2 + Junction 2 + + + JUNCTION_FACE_3 + Junction 3 + + + INTERNAL_FACES + Internal faces + + + + AdvancedGUI_PipeTShapeDlg + + GEOM_PIPE_TSHAPE_TITLE + Pipe TShape Construction + + + GEOM_PIPE_TSHAPE + PipeTShape + + + GEOM_PIPE_TSHAPE_MPIPE + Main pipe + + + GEOM_PIPE_TSHAPE_R + Radius + + + GEOM_PIPE_TSHAPE_W + Width + + + GEOM_PIPE_TSHAPE_L + Half-length + + + GEOM_PIPE_TSHAPE_IPIPE + Incident pipe + + + GEOM_PIPE_TSHAPE_CHAMFER + Chamfer + + + GEOM_PIPE_TSHAPE_CHAMFER_H + Height + + + GEOM_PIPE_TSHAPE_CHAMFER_W + Width + + + GEOM_PIPE_TSHAPE_FILLET + Fillet + + + GEOM_PIPE_TSHAPE_HEX + Prepare for hex mesh + + + GEOM_PIPE_TSHAPE_POSITION + Set position + + + GEOM_PIPE_TSHAPE_POSITION_P1 + Junction P1 + + + GEOM_PIPE_TSHAPE_POSITION_P2 + Junction P2 + + + GEOM_PIPE_TSHAPE_POSITION_P3 + Junction P3 + + + GEOM_PIPE_TSHAPE_POSITION_LBL_L1 + New L1 + + + GEOM_PIPE_TSHAPE_POSITION_LBL_L2 + New L2 + + + GEOM_PIPE_TSHAPE_LEFT_TR + Left thickness reduction + + + GEOM_PIPE_TSHAPE_RIGHT_TR + Right thickness reduction + + + GEOM_PIPE_TSHAPE_INCI_TR + Incident pipe thickness reduction + + + GEOM_PIPE_TSHAPE_TR_R + Radius (r%1) + + + GEOM_PIPE_TSHAPE_TR_W + Width (w%1) + + + GEOM_PIPE_TSHAPE_TR_L_TRANS + Transition length (ltrans%1) + + + GEOM_PIPE_TSHAPE_TR_L_THIN + Thin part length (lthin%1) + + + GEOM_PIPETSHAPE_GROUPMAIN + Main parameters + + + GEOM_PIPETSHAPE_GROUPREDUCT + Thickness reduction + + + GEOM_PIPETSHAPE_GROUPPOS + Position + + + + AdvancedGUI_SmoothingSurfaceDlg + + GEOM_SMOOTHINGSURFACE_TITLE + Smoothing surface Construction + + + GEOM_SMOOTHINGSURFACE + Smoothing surface + + + GEOM_SMOOTHINGSURFACE_RESULT + Result name + + + GEOM_SMOOTHINGSURFACE_ARG + Nodes + + + GEOM_SMOOTHINGSURFACE_ARG_POINTS + Points + + + diff --git a/src/AdvancedGUI/AdvancedGUI_msg_fr.ts b/src/AdvancedGUI/AdvancedGUI_msg_fr.ts new file mode 100644 index 000000000..69c38cbc9 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_msg_fr.ts @@ -0,0 +1,273 @@ + + + + + @default + + GEOM_ADVANCED + Objet géométrique avancé : type %1 + + + GEOM_ADVANCED_201 + Tuyau en T + + + GEOM_ADVANCED_202 + Disque prédécoupé + + + GEOM_ADVANCED_203 + Cylindre prédécoupé + + + GEOM_DIVIDEDDISK + Disque prédécoupé + + + GEOM_DIVIDEDDISK_TITLE + Construction d'un disque prédécoupé + + + GEOM_DIVIDEDCYLINDER + Cylinder prédécoupé + + + GEOM_DIVIDEDCYLINDER_TITLE + Construction d'un cylindre prédécoupé + + + MEN_DIVIDEDCYLINDER + Cylinder prédécoupé + + + TOP_DIVIDEDCYLINDER + Cylinder prédécoupé + + + STB_DIVIDEDCYLINDER + Cylinder prédécoupé + + + MEN_DIVIDEDDISK + Disque prédécoupé + + + TOP_DIVIDEDDISK + Disque prédécoupé + + + STB_DIVIDEDDISK + Disque prédécoupé + + + TOP_PIPETSHAPE + Créer un tuyau en T + + + MEN_PIPETSHAPE + Tuyau en T + + + STB_PIPETSHAPE + Créer un tuyau en T + + + TOP_SMOOTHINGSURFACE + Smoothing Surface + + + MEN_SMOOTHINGSURFACE + Smoothing Surface + + + STB_SMOOTHINGSURFACE + Smoothing Surface + + + HALF_LENGTH_MAIN_PIPE + Demi-longueur du tuyau principal + + + HALF_LENGTH_INCIDENT_PIPE + Demi-longueur du tuyau incident + + + CIRCULAR_QUARTER_PIPE + Un quart circulaire du tuyau + + + THICKNESS + Epaisseur + + + FLANGE + Collerette + + + CHAMFER_OR_FILLET + Chanfrein ou congé + + + CHAMFER + Chanfrein + + + FILLET + Congé + + + JUNCTION_FACE_1 + Jonction 1 + + + JUNCTION_FACE_2 + Jonction 2 + + + JUNCTION_FACE_3 + Jonction 3 + + + INTERNAL_FACES + Internal faces + + + + AdvancedGUI_PipeTShapeDlg + + GEOM_PIPE_TSHAPE_TITLE + Construction d'un tuyau en T + + + GEOM_PIPE_TSHAPE + Tuyau en T + + + GEOM_PIPE_TSHAPE_MPIPE + Tuyau principal + + + GEOM_PIPE_TSHAPE_R + Rayon + + + GEOM_PIPE_TSHAPE_W + Largeur + + + GEOM_PIPE_TSHAPE_L + Demi-longueur + + + GEOM_PIPE_TSHAPE_IPIPE + Tuyau incident + + + GEOM_PIPE_TSHAPE_CHAMFER + Chanfrein + + + GEOM_PIPE_TSHAPE_CHAMFER_H + Hauteur + + + GEOM_PIPE_TSHAPE_CHAMFER_W + Largeur + + + GEOM_PIPE_TSHAPE_FILLET + Congé + + + GEOM_PIPE_TSHAPE_HEX + Préparer pour un maillage hexaédrique + + + GEOM_PIPE_TSHAPE_POSITION + Définir la position + + + GEOM_PIPE_TSHAPE_POSITION_P1 + Jonction P1 + + + GEOM_PIPE_TSHAPE_POSITION_P2 + Jonction P2 + + + GEOM_PIPE_TSHAPE_POSITION_P3 + Jonction P3 + + + GEOM_PIPE_TSHAPE_POSITION_LBL_L1 + Nouvelle L1 + + + GEOM_PIPE_TSHAPE_POSITION_LBL_L2 + Nouvelle L2 + + + GEOM_PIPE_TSHAPE_LEFT_TR + Réduction d'épaisseur à gauche + + + GEOM_PIPE_TSHAPE_RIGHT_TR + Réduction d'épaisseur à droite + + + GEOM_PIPE_TSHAPE_INCI_TR + Réduction d'épaisseur du tuyau incident + + + GEOM_PIPE_TSHAPE_TR_R + Rayon (r%1) + + + GEOM_PIPE_TSHAPE_TR_W + Epaisseur (w%1) + + + GEOM_PIPE_TSHAPE_TR_L_TRANS + Longueur de transition (ltrans%1) + + + GEOM_PIPE_TSHAPE_TR_L_THIN + Longueur de la partie étroite (lthin%1) + + + GEOM_PIPETSHAPE_GROUPMAIN + Paramètres principaux + + + GEOM_PIPETSHAPE_GROUPREDUCT + Réduction d'épaisseur + + + GEOM_PIPETSHAPE_GROUPPOS + Position + + + + AdvancedGUI_SmoothingSurfaceDlg + + GEOM_SMOOTHINGSURFACE_TITLE + Constructions de surface lisse + + + GEOM_SMOOTHINGSURFACE + Surface lissee + + + GEOM_SMOOTHINGSURFACE_RESULT + Nom du résultat + + + GEOM_SMOOTHINGSURFACE_ARG + Noeuds + + + GEOM_SMOOTHINGSURFACE_ARG_POINTS + Points + + + diff --git a/src/AdvancedGUI/AdvancedGUI_msg_ja.ts b/src/AdvancedGUI/AdvancedGUI_msg_ja.ts new file mode 100644 index 000000000..186e19fb7 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_msg_ja.ts @@ -0,0 +1,233 @@ + + + + + @default + + GEOM_ADVANCED + 形状を高度な:%1 入力 + + + GEOM_ADVANCED_201 + TShape をパイプします。 + + + GEOM_ADVANCED_202 + 分割ディスク + + + GEOM_ADVANCED_203 + 分割シリンダー + + + GEOM_DIVIDEDDISK + 分割ディスク + + + GEOM_DIVIDEDDISK_TITLE + 分割ディスク建設 + + + GEOM_DIVIDEDCYLINDER + 分割シリンダー + + + GEOM_DIVIDEDCYLINDER_TITLE + 分割構造 + + + MEN_DIVIDEDCYLINDER + 分割シリンダー + + + TOP_DIVIDEDCYLINDER + 分割シリンダー + + + STB_DIVIDEDCYLINDER + 分割シリンダー + + + MEN_DIVIDEDDISK + 分割ディスク + + + TOP_DIVIDEDDISK + 分割ディスク + + + STB_DIVIDEDDISK + 分割ディスク + + + TOP_PIPETSHAPE + TShape パイプを作成します。 + + + MEN_PIPETSHAPE + TShape をパイプします。 + + + STB_PIPETSHAPE + 新しいパイプ TShape オブジェクトを作成します。 + + + TOP_SMOOTHINGSURFACE + Smoothing Surface + + + MEN_SMOOTHINGSURFACE + Smoothing Surface + + + STB_SMOOTHINGSURFACE + Smoothing Surface + + + HALF_LENGTH_MAIN_PIPE + 主配管の長さの半分 + + + HALF_LENGTH_INCIDENT_PIPE + インシデント管長さの半分 + + + CIRCULAR_QUARTER_PIPE + 円形の四半期パイプの + + + THICKNESS + 厚 + + + FLANGE + フランジ + + + CHAMFER_OR_FILLET + 面取りまたはフィレット + + + CHAMFER + 面取り + + + FILLET + フィレット + + + JUNCTION_FACE_1 + ジャンクション 1 + + + JUNCTION_FACE_2 + ジャンクション 2 + + + JUNCTION_FACE_3 + ジャンクション 3 + + + INTERNAL_FACES + Internal faces + + + + AdvancedGUI_PipeTShapeDlg + + GEOM_PIPE_TSHAPE_TITLE + パイプ TShape 建設 + + + GEOM_PIPE_TSHAPE + PipeTShape + + + GEOM_PIPE_TSHAPE_MPIPE + 主配管 + + + GEOM_PIPE_TSHAPE_R + 半径 + + + GEOM_PIPE_TSHAPE_W + 幅 + + + GEOM_PIPE_TSHAPE_L + ハーフレングス + + + GEOM_PIPE_TSHAPE_IPIPE + インシデント管 + + + GEOM_PIPE_TSHAPE_CHAMFER + 面取り + + + GEOM_PIPE_TSHAPE_CHAMFER_H + 高さ + + + GEOM_PIPE_TSHAPE_CHAMFER_W + 幅 + + + GEOM_PIPE_TSHAPE_FILLET + フィレット + + + GEOM_PIPE_TSHAPE_HEX + 16 進数のメッシュのための準備します。 + + + GEOM_PIPE_TSHAPE_POSITION + 位置の設定 + + + GEOM_PIPE_TSHAPE_POSITION_P1 + ジャンクション P1 + + + GEOM_PIPE_TSHAPE_POSITION_P2 + ジャンクション P2 + + + GEOM_PIPE_TSHAPE_POSITION_P3 + ジャンクション P3 + + + GEOM_PIPE_TSHAPE_POSITION_LBL_L1 + 新しい L1 + + + GEOM_PIPE_TSHAPE_POSITION_LBL_L2 + 新しい L2 + + + + AdvancedGUI_SmoothingSurfaceDlg + + GEOM_SMOOTHINGSURFACE_TITLE + Smoothing surface Construction + + + GEOM_SMOOTHINGSURFACE + Smoothing surface + + + GEOM_SMOOTHINGSURFACE_RESULT + Result name + + + GEOM_SMOOTHINGSURFACE_ARG + Nodes + + + GEOM_SMOOTHINGSURFACE_ARG_POINTS + Points + + + diff --git a/src/AdvancedGUI/Makefile.am b/src/AdvancedGUI/Makefile.am index ae8aca2ea..436727e37 100644 --- a/src/AdvancedGUI/Makefile.am +++ b/src/AdvancedGUI/Makefile.am @@ -15,14 +15,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# # File : Makefile.am # Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am -# header files +# header files salomeinclude_HEADERS = \ AdvancedGUI.h @@ -65,6 +64,13 @@ MOC_FILES += $(ADVANCED_MOC_FILES) nodist_libAdvancedGUI_la_SOURCES = \ $(MOC_FILES) +# resources files +nodist_salomeres_DATA = \ + AdvancedGUI_images.qm \ + AdvancedGUI_msg_en.qm \ + AdvancedGUI_msg_fr.qm \ + AdvancedGUI_msg_ja.qm + # additional information to compile and link file libAdvancedGUI_la_CPPFLAGS = \ diff --git a/src/GEOMGUI/GEOMGUI_XmlHandler.cxx b/src/GEOMGUI/GEOMGUI_XmlHandler.cxx new file mode 100644 index 000000000..27106bc4c --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_XmlHandler.cxx @@ -0,0 +1,157 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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 + +// GEOM GEOMGUI : reading of xml file with list of available plugin actions +// File : GEOMGUI_XmlHandler.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. + +#include "GEOMGUI_XmlHandler.h" + +#include "GEOMGUI.h" + +// SALOME KERNEL includes +#include + +/*! + * Constructor + */ +GEOMGUI_XmlHandler::GEOMGUI_XmlHandler() +{ +} + +/*! + * Destructor + */ +GEOMGUI_XmlHandler::~GEOMGUI_XmlHandler() +{ +} + +/*! + * Starts parsing of document. Does some initialization + * + * Reimplemented from QXmlDefaultHandler. + */ +bool GEOMGUI_XmlHandler::startDocument() +{ + myErrorProt = ""; + return true; +} + +/*! + * Does different actions depending on the name of the tag and the + * state you are in document. + * + * Reimplemented from QXmlDefaultHandler. + */ +bool GEOMGUI_XmlHandler::startElement (const QString&, const QString&, + const QString& qName, + const QXmlAttributes& atts) +{ + if (qName == "geom-plugins") { // set of plugins + //myHypothesesMap.clear(); + //myAlgorithmsMap.clear(); + } + else if (qName == "geom-plugin") { // group of actions + myPluginData.myName = atts.value("name"); + myPluginData.myServerLib = atts.value("server-lib"); + myPluginData.myClientLib = atts.value("gui-lib"); + + //QString aResName = atts.value("resources"); + //if (aResName != "") { + // SUIT_ResourceMgr* resMgr = GEOMGUI::resourceMgr(); + // QString lang = resMgr->stringValue( resMgr->langSection(), "language", "en" ); + // resMgr->loadTranslator( "resources", QString( "%1_msg_%2.qm" ).arg( aResName, lang ) ); + // resMgr->loadTranslator( "resources", QString( "%1_images.qm" ).arg( aResName, lang ) ); + //} + } + else if (qName == "actions") { // group of actions + } + else if (qName == "action") { // an action + GEOMGUI_ActionData aData; + aData.myLabel = atts.value("label"); + aData.myIcon = atts.value("icon"); + aData.myMenu = atts.value("menu"); + aData.myTooltip = atts.value("tooltip"); + aData.myStatusBar = atts.value("status-bar"); + + myPluginData.myListOfActions.append(aData); + } + else { + // error + return false; + } + return true; +} + +/*! + * Reimplemented from QXmlDefaultHandler. + */ +bool GEOMGUI_XmlHandler::endElement (const QString&, const QString&, const QString&) +{ + return true; +} + +/*! + * Reimplemented from QXmlDefaultHandler. + */ +bool GEOMGUI_XmlHandler::characters (const QString& ch) +{ + // we are not interested in whitespaces + //QString ch_simplified = ch.simplified(); + //if ( ch_simplified.isEmpty() ) + // return true; + return true; +} + +/*! + * Returns the default error string. + * + * Reimplemented from QXmlDefaultHandler. + */ +QString GEOMGUI_XmlHandler::errorString() +{ + return "the document is not in the quote file format"; +} + +/*! + * Returns the error protocol if parsing failed + * + * Reimplemented from QXmlDefaultHandler. + */ +QString GEOMGUI_XmlHandler::errorProtocol() +{ + return myErrorProt; +} + +/*! + * Returns exception + * + * Reimplemented from QXmlDefaultHandler. + */ +bool GEOMGUI_XmlHandler::fatalError (const QXmlParseException& exception) +{ + myErrorProt += QString("fatal parsing error: %1 in line %2, column %3\n") + .arg(exception.message()) + .arg(exception.lineNumber()) + .arg(exception.columnNumber()); + + return QXmlDefaultHandler::fatalError( exception ); +} diff --git a/src/GEOMGUI/GEOMGUI_XmlHandler.h b/src/GEOMGUI/GEOMGUI_XmlHandler.h new file mode 100644 index 000000000..c1808bca0 --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_XmlHandler.h @@ -0,0 +1,90 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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 +// + +// GEOM GEOMGUI : reading of xml file with list of available plugin actions +// File : GEOMGUI_XmlHandler.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. + +#ifndef GEOMGUI_XMLHANDLER_H +#define GEOMGUI_XMLHANDLER_H + +// GEOM includes +#include "GEOMGUI.h" + +// Qt includes +#include +#include +#include + +//GUI includes +#include + +//class HypothesisData; +//class HypothesesSet; + +struct GEOMGUI_ActionData +{ + QString myLabel; // unique ID + QString myIcon; + QString myMenu; + QString myTooltip; + QString myStatusBar; + + //int myAccel; + //bool myToggle; + //QString myShortcut; +}; + +struct GEOMGUI_PluginData +{ + QString myName; + QString myServerLib; + QString myClientLib; + + //QList myListOfActions; + QList myListOfActions; +}; + +class GEOMGUI_EXPORT GEOMGUI_XmlHandler : public QXmlDefaultHandler +{ +public: + GEOMGUI_XmlHandler(); + virtual ~GEOMGUI_XmlHandler(); + + bool startDocument(); + bool startElement( const QString&, const QString&, + const QString&, const QXmlAttributes& ); + bool endElement( const QString&, const QString&, const QString& ); + bool characters( const QString& ); + + QString errorString(); + QString errorProtocol(); + bool fatalError( const QXmlParseException& ); + +public: + GEOMGUI_PluginData myPluginData; + +private: + QString myErrorProt; +}; + +#endif // GEOMGUI_XMLHANDLER_H diff --git a/src/GEOMGUI/GEOMPluginGUI.cxx b/src/GEOMGUI/GEOMPluginGUI.cxx new file mode 100644 index 000000000..1ba093a84 --- /dev/null +++ b/src/GEOMGUI/GEOMPluginGUI.cxx @@ -0,0 +1,54 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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 + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMPluginGUI.cxx + +#include "GEOMPluginGUI.h" +#include "GeometryGUI.h" + +#include + +//================================================================================= +// function : GEOMPluginGUI::GEOMPluginGUI +// purpose : Constructor +//================================================================================= +GEOMPluginGUI::GEOMPluginGUI (GeometryGUI* parent) + : GEOMGUI (parent) +{ +} + +//================================================================================= +// function : GEOMPluginGUI::~GEOMPluginGUI +// purpose : Destructor +//================================================================================= +GEOMPluginGUI::~GEOMPluginGUI() +{ +} + +//================================================================================= +// class : GEOMPluginGUI::OnGUIEvent +// purpose : Main/popup menu events processing +//================================================================================= +bool GEOMPluginGUI::OnGUIEvent (const QString& /*action*/, SUIT_Desktop* /*parent*/) +{ + return true; +} diff --git a/src/GEOMGUI/GEOMPluginGUI.h b/src/GEOMGUI/GEOMPluginGUI.h new file mode 100644 index 000000000..537dd6c47 --- /dev/null +++ b/src/GEOMGUI/GEOMPluginGUI.h @@ -0,0 +1,49 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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 + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMPluginGUI.h + +#ifndef GEOMPLUGINGUI_H +#define GEOMPLUGINGUI_H + +#include "GEOMGUI.h" + +#include + +//================================================================================= +// class : GEOMPluginGUI +// purpose : Base class for all geometry Plugins +//================================================================================= +class GEOMGUI_EXPORT GEOMPluginGUI : public GEOMGUI +{ +public : + // Constructor + GEOMPluginGUI (GeometryGUI* parent); + // Destructor + virtual ~GEOMPluginGUI(); + + //! Parameter action specifies the operation ID + virtual bool OnGUIEvent (const QString& action, SUIT_Desktop* parent); + //virtual bool OnGUIEvent (const QString& action, SUIT_Desktop* parent, const QVariant& theParam); +}; + +#endif // GEOMPluginGUI_H diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 667c07514..853507205 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1211,171 +1211,5 @@ ICON_DLG_SCALE_ALONG_AXES scale_along_axes.png - - ICON_DLG_PIPETSHAPE - pipetshape.png - - - ICO_PIPETSHAPE - pipetshape.png - - - ICO_PIPETSHAPE_IMPORT - pipetshape_import_icon.png - - - DLG_PIPETSHAPE - dlg_pipetshape.png - - - IMG_PIPETSHAPE_SECT - pipetshape_section.png - - - DLG_PIPETSHAPE_L1 - dlg_pipetshapel1.png - - - DLG_PIPETSHAPE_R1 - dlg_pipetshaper1.png - - - DLG_PIPETSHAPE_W1 - dlg_pipetshapew1.png - - - DLG_PIPETSHAPE_L2 - dlg_pipetshapel2.png - - - DLG_PIPETSHAPE_R2 - dlg_pipetshaper2.png - - - DLG_PIPETSHAPE_W2 - dlg_pipetshapew2.png - - - - DLG_PIPETSHAPE_FILLET - dlg_pipetshapefillet.png - - - DLG_PIPETSHAPE_FILLET_L1 - dlg_pipetshapefilletl1.png - - - DLG_PIPETSHAPE_FILLET_R1 - dlg_pipetshapefilletr1.png - - - DLG_PIPETSHAPE_FILLET_W1 - dlg_pipetshapefilletw1.png - - - DLG_PIPETSHAPE_FILLET_L2 - dlg_pipetshapefilletl2.png - - - DLG_PIPETSHAPE_FILLET_R2 - dlg_pipetshapefilletr2.png - - - DLG_PIPETSHAPE_FILLET_W2 - dlg_pipetshapefilletw2.png - - - DLG_PIPETSHAPE_FILLET_RF - dlg_pipetshapefilletrf.png - - - - DLG_PIPETSHAPE_CHAMFER - dlg_pipetshapechamfer.png - - - DLG_PIPETSHAPE_CHAMFER_L1 - dlg_pipetshapechamferl1.png - - - DLG_PIPETSHAPE_CHAMFER_R1 - dlg_pipetshapechamferr1.png - - - DLG_PIPETSHAPE_CHAMFER_W1 - dlg_pipetshapechamferw1.png - - - DLG_PIPETSHAPE_CHAMFER_L2 - dlg_pipetshapechamferl2.png - - - DLG_PIPETSHAPE_CHAMFER_R2 - dlg_pipetshapechamferr2.png - - - DLG_PIPETSHAPE_CHAMFER_W2 - dlg_pipetshapechamferw2.png - - - DLG_PIPETSHAPE_CHAMFER_H - dlg_pipetshapechamferh.png - - - DLG_PIPETSHAPE_CHAMFER_W - dlg_pipetshapechamferw.png - - - - ICON_OBJBROWSER_ADVANCED_201 - tree_pipetshape.png - - - - ICON_DLG_DIVIDEDDISK_R_RATIO - divided_disk.png - - - ICO_DIVIDEDDISK - divided_disk.png - - - ICON_OBJBROWSER_ADVANCED_202 - divided_disk.png - - - ICON_DLG_DIVIDEDCYLINDER_R_H - dividedcylinder_r_h.png - - - ICO_DIVIDEDCYLINDER - dividedcylinder.png - - - ICON_OBJBROWSER_ADVANCED_203 - dividedcylinder.png - - - ICON_DLG_SMOOTHINGSURFACE_LPOINTS - smoothingsurface_lpoints.png - - - ICO_SMOOTHINGSURFACE - smoothingsurface.png - - - ICON_OBJBROWSER_ADVANCED_204 - tree_smoothingsurface.png - - diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 8ca73f466..c11b96858 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -559,22 +559,6 @@ Please, select face, shell or solid and try again GEOM_DIVIDE_EDGE_TITLE Addition of point - - GEOM_DIVIDEDDISK - Divided Disk - - - GEOM_DIVIDEDDISK_TITLE - Divided Disk construction - - - GEOM_DIVIDEDCYLINDER - Divided Cylinder - - - GEOM_DIVIDEDCYLINDER_TITLE - Divided Cylinder construction - GEOM_DX Dx : @@ -2496,30 +2480,6 @@ Please, select face, shell or solid and try again MEN_DISK Disk - - MEN_DIVIDEDDISK - Divided Disk - - - TOP_DIVIDEDDISK - Divided Disk - - - STB_DIVIDEDDISK - Divided Disk - - - MEN_DIVIDEDCYLINDER - Divided Cylinder - - - TOP_DIVIDEDCYLINDER - Divided Cylinder - - - STB_DIVIDEDCYLINDER - Divided Cylinder - MEN_DISPLAY_ALL Show All @@ -4892,87 +4852,11 @@ shells and solids on the other hand. Take into account the units (%1) embedded to the file? Ignoring units will cause model scaling (as dimensions are supposed to be specified in meters). - - GEOM_ADVANCED - Advanced shape: type %1 - - - GEOM_ADVANCED_202 - Divided Disk - - - GEOM_ADVANCED_203 - Divided Cylinder - GEOM_PRECISION_HINT Input value precision can be adjusted using '%1' parameter in Geometry module preferences. - - TOP_PIPETSHAPE - Create Pipe TShape - - - MEN_PIPETSHAPE - Pipe TShape - - - STB_PIPETSHAPE - Create new Pipe TShape object - - - GEOM_ADVANCED_201 - Pipe TShape - - - HALF_LENGTH_MAIN_PIPE - Main pipe half length - - - HALF_LENGTH_INCIDENT_PIPE - Incident pipe half length - - - CIRCULAR_QUARTER_PIPE - Circular quarter of pipe - - - THICKNESS - Thickness - - - FLANGE - Flange - - - CHAMFER_OR_FILLET - Chamfer or fillet - - - CHAMFER - Chamfer - - - FILLET - Fillet - - - JUNCTION_FACE_1 - Junction 1 - - - JUNCTION_FACE_2 - Junction 2 - - - JUNCTION_FACE_3 - Junction 3 - - - INTERNAL_FACES - Internal faces - GEOM_PLUGINS_OTHER Other @@ -4993,14 +4877,6 @@ Ignoring units will cause model scaling (as dimensions are supposed to be specif TOP_SMOOTHINGSURFACE Smoothing Surface - - MEN_SMOOTHINGSURFACE - Smoothing Surface - - - STB_SMOOTHINGSURFACE - Smoothing Surface - GEOM_SELECT_IMAGE Select image... @@ -5823,144 +5699,6 @@ Do you want to create new material? Shared_%1 - - AdvancedGUI_PipeTShapeDlg - - GEOM_PIPE_TSHAPE_TITLE - Pipe TShape Construction - - - GEOM_PIPE_TSHAPE - PipeTShape - - - GEOM_PIPE_TSHAPE_MPIPE - Main pipe - - - GEOM_PIPE_TSHAPE_R - Radius - - - GEOM_PIPE_TSHAPE_W - Width - - - GEOM_PIPE_TSHAPE_L - Half-length - - - GEOM_PIPE_TSHAPE_IPIPE - Incident pipe - - - GEOM_PIPE_TSHAPE_CHAMFER - Chamfer - - - GEOM_PIPE_TSHAPE_CHAMFER_H - Height - - - GEOM_PIPE_TSHAPE_CHAMFER_W - Width - - - GEOM_PIPE_TSHAPE_FILLET - Fillet - - - GEOM_PIPE_TSHAPE_HEX - Prepare for hex mesh - - - GEOM_PIPE_TSHAPE_POSITION - Set position - - - GEOM_PIPE_TSHAPE_POSITION_P1 - Junction P1 - - - GEOM_PIPE_TSHAPE_POSITION_P2 - Junction P2 - - - GEOM_PIPE_TSHAPE_POSITION_P3 - Junction P3 - - - GEOM_PIPE_TSHAPE_POSITION_LBL_L1 - New L1 - - - GEOM_PIPE_TSHAPE_POSITION_LBL_L2 - New L2 - - - GEOM_PIPE_TSHAPE_LEFT_TR - Left thickness reduction - - - GEOM_PIPE_TSHAPE_RIGHT_TR - Right thickness reduction - - - GEOM_PIPE_TSHAPE_INCI_TR - Incident pipe thickness reduction - - - GEOM_PIPE_TSHAPE_TR_R - Radius (r%1) - - - GEOM_PIPE_TSHAPE_TR_W - Width (w%1) - - - GEOM_PIPE_TSHAPE_TR_L_TRANS - Transition length (ltrans%1) - - - GEOM_PIPE_TSHAPE_TR_L_THIN - Thin part length (lthin%1) - - - GEOM_PIPETSHAPE_GROUPMAIN - Main parameters - - - GEOM_PIPETSHAPE_GROUPREDUCT - Thickness reduction - - - GEOM_PIPETSHAPE_GROUPPOS - Position - - - - AdvancedGUI_SmoothingSurfaceDlg - - GEOM_SMOOTHINGSURFACE_TITLE - Smoothing surface Construction - - - GEOM_SMOOTHINGSURFACE - Smoothing surface - - - GEOM_SMOOTHINGSURFACE_RESULT - Result name - - - GEOM_SMOOTHINGSURFACE_ARG - Nodes - - - GEOM_SMOOTHINGSURFACE_ARG_POINTS - Points - - GEOMToolsGUI_PublishDlg diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index fa0c70000..11bde0082 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -565,22 +565,6 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_DIVIDE_EDGE_TITLE Ajouter un point - - GEOM_DIVIDEDDISK - Disque prédécoupé - - - GEOM_DIVIDEDDISK_TITLE - Construction d'un disque prédécoupé - - - GEOM_DIVIDEDCYLINDER - Cylinder prédécoupé - - - GEOM_DIVIDEDCYLINDER_TITLE - Construction d'un cylindre prédécoupé - GEOM_DX Dx : @@ -2502,30 +2486,6 @@ Choisissez une face, une coque ou un solide et essayez de nouveau MEN_DISK Disque - - MEN_DIVIDEDDISK - Disque prédécoupé - - - TOP_DIVIDEDDISK - Disque prédécoupé - - - STB_DIVIDEDDISK - Disque prédécoupé - - - MEN_DIVIDEDCYLINDER - Cylinder prédécoupé - - - TOP_DIVIDEDCYLINDER - Cylinder prédécoupé - - - STB_DIVIDEDCYLINDER - Cylinder prédécoupé - MEN_DISPLAY_ALL Afficher tout @@ -4898,87 +4858,11 @@ les coques et solides d'un autre. Voulez-vous prendre les unités du fichier (%1) en considération? Sinon le modèle sera mis à l'échelle GEOM (unités interprétées comme des mètres). - - GEOM_ADVANCED - Objet géométrique avancé : type %1 - - - GEOM_ADVANCED_202 - Disque prédécoupé - - - GEOM_ADVANCED_203 - Cylindre prédécoupé - GEOM_PRECISION_HINT Il est possible d'ajuster la précision de la valeur d'entrée avec le paramètre '%1' aux préférences du module Géométrie. - - TOP_PIPETSHAPE - Créer un tuyau en T - - - MEN_PIPETSHAPE - Tuyau en T - - - STB_PIPETSHAPE - Créer un tuyau en T - - - GEOM_ADVANCED_201 - Tuyau en T - - - HALF_LENGTH_MAIN_PIPE - Demi-longueur du tuyau principal - - - HALF_LENGTH_INCIDENT_PIPE - Demi-longueur du tuyau incident - - - CIRCULAR_QUARTER_PIPE - Un quart circulaire du tuyau - - - THICKNESS - Epaisseur - - - FLANGE - Collerette - - - CHAMFER_OR_FILLET - Chanfrein ou congé - - - CHAMFER - Chanfrein - - - FILLET - Congé - - - JUNCTION_FACE_1 - Jonction 1 - - - JUNCTION_FACE_2 - Jonction 2 - - - JUNCTION_FACE_3 - Jonction 3 - - - INTERNAL_FACES - Internal faces - GEOM_PLUGINS_OTHER Autre @@ -5829,144 +5713,6 @@ Voulez-vous en créer un nouveau ? Partagé_%1 - - AdvancedGUI_PipeTShapeDlg - - GEOM_PIPE_TSHAPE_TITLE - Construction d'un tuyau en T - - - GEOM_PIPE_TSHAPE - Tuyau en T - - - GEOM_PIPE_TSHAPE_MPIPE - Tuyau principal - - - GEOM_PIPE_TSHAPE_R - Rayon - - - GEOM_PIPE_TSHAPE_W - Largeur - - - GEOM_PIPE_TSHAPE_L - Demi-longueur - - - GEOM_PIPE_TSHAPE_IPIPE - Tuyau incident - - - GEOM_PIPE_TSHAPE_CHAMFER - Chanfrein - - - GEOM_PIPE_TSHAPE_CHAMFER_H - Hauteur - - - GEOM_PIPE_TSHAPE_CHAMFER_W - Largeur - - - GEOM_PIPE_TSHAPE_FILLET - Congé - - - GEOM_PIPE_TSHAPE_HEX - Préparer pour un maillage hexaédrique - - - GEOM_PIPE_TSHAPE_POSITION - Définir la position - - - GEOM_PIPE_TSHAPE_POSITION_P1 - Jonction P1 - - - GEOM_PIPE_TSHAPE_POSITION_P2 - Jonction P2 - - - GEOM_PIPE_TSHAPE_POSITION_P3 - Jonction P3 - - - GEOM_PIPE_TSHAPE_POSITION_LBL_L1 - Nouvelle L1 - - - GEOM_PIPE_TSHAPE_POSITION_LBL_L2 - Nouvelle L2 - - - GEOM_PIPE_TSHAPE_LEFT_TR - Réduction d'épaisseur à gauche - - - GEOM_PIPE_TSHAPE_RIGHT_TR - Réduction d'épaisseur à droite - - - GEOM_PIPE_TSHAPE_INCI_TR - Réduction d'épaisseur du tuyau incident - - - GEOM_PIPE_TSHAPE_TR_R - Rayon (r%1) - - - GEOM_PIPE_TSHAPE_TR_W - Epaisseur (w%1) - - - GEOM_PIPE_TSHAPE_TR_L_TRANS - Longueur de transition (ltrans%1) - - - GEOM_PIPE_TSHAPE_TR_L_THIN - Longueur de la partie étroite (lthin%1) - - - GEOM_PIPETSHAPE_GROUPMAIN - Paramètres principaux - - - GEOM_PIPETSHAPE_GROUPREDUCT - Réduction d'épaisseur - - - GEOM_PIPETSHAPE_GROUPPOS - Position - - - - AdvancedGUI_SmoothingSurfaceDlg - - GEOM_SMOOTHINGSURFACE_TITLE - Constructions de surface lisse - - - GEOM_SMOOTHINGSURFACE - Surface lissee - - - GEOM_SMOOTHINGSURFACE_RESULT - Nom du résultat - - - GEOM_SMOOTHINGSURFACE_ARG - Noeuds - - - GEOM_SMOOTHINGSURFACE_ARG_POINTS - Points - - GEOMToolsGUI_PublishDlg diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts index dfbbdbdb6..cad65b98a 100644 --- a/src/GEOMGUI/GEOM_msg_ja.ts +++ b/src/GEOMGUI/GEOM_msg_ja.ts @@ -551,22 +551,6 @@ GEOM_DIVIDE_EDGE_TITLE ポイントの追加 - - GEOM_DIVIDEDDISK - 分割ディスク - - - GEOM_DIVIDEDDISK_TITLE - 分割ディスク建設 - - - GEOM_DIVIDEDCYLINDER - 分割シリンダー - - - GEOM_DIVIDEDCYLINDER_TITLE - 分割構造 - GEOM_DX Dx: @@ -2459,30 +2443,6 @@ MEN_DISK ディスク - - MEN_DIVIDEDDISK - 分割ディスク - - - TOP_DIVIDEDDISK - 分割ディスク - - - STB_DIVIDEDDISK - 分割ディスク - - - MEN_DIVIDEDCYLINDER - 分割シリンダー - - - TOP_DIVIDEDCYLINDER - 分割シリンダー - - - STB_DIVIDEDCYLINDER - 分割シリンダー - MEN_DISPLAY_ALL すべて表示します。 @@ -4751,82 +4711,10 @@ GEOM_SCALE_DIMENSIONS ユニット (%1) ファイルに埋め込まれたアカウントを考慮か?ユニットを無視することにより、モデルをスケーリング (メートル単位で指定するにはサイズを想定)。 - - GEOM_ADVANCED - 形状を高度な:%1 入力 - - - GEOM_ADVANCED_202 - 分割ディスク - - - GEOM_ADVANCED_203 - 分割シリンダー - GEOM_PRECISION_HINT 入力値の精度は、ジオメトリのモジュール設定に '%1' パラメーターを使用して調整できます。 - - TOP_PIPETSHAPE - TShape パイプを作成します。 - - - MEN_PIPETSHAPE - TShape をパイプします。 - - - STB_PIPETSHAPE - 新しいパイプ TShape オブジェクトを作成します。 - - - GEOM_ADVANCED_201 - TShape をパイプします。 - - - HALF_LENGTH_MAIN_PIPE - 主配管の長さの半分 - - - HALF_LENGTH_INCIDENT_PIPE - インシデント管長さの半分 - - - CIRCULAR_QUARTER_PIPE - 円形の四半期パイプの - - - THICKNESS - 厚 - - - FLANGE - フランジ - - - CHAMFER_OR_FILLET - 面取りまたはフィレット - - - CHAMFER - 面取り - - - FILLET - フィレット - - - JUNCTION_FACE_1 - ジャンクション 1 - - - JUNCTION_FACE_2 - ジャンクション 2 - - - JUNCTION_FACE_3 - ジャンクション 3 - GEOM_PLUGINS_OTHER その他 diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 10ce0ffee..c18df18ad 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -29,6 +29,8 @@ #include "Python.h" #include "GeometryGUI.h" #include "GeometryGUI_Operations.h" +#include "GEOMPluginGUI.h" +#include "GEOMGUI_XmlHandler.h" #include "GEOMGUI_OCCSelector.h" #include "GEOMGUI_Selection.h" #include "GEOMGUI_CreationInfoWdg.h" @@ -82,6 +84,7 @@ #include // External includes +#include #include #include #include @@ -277,6 +280,50 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) return myGUIMap.contains( libraryName ) ? myGUIMap[ libraryName ] : 0; } +//======================================================================= +// function : GeometryGUI::getPluginLibrary() +// purpose : get or load GUI Plugin library by name [ internal ] +//======================================================================= +typedef GEOMPluginGUI* (*PluginLibraryGUI)( GeometryGUI* ); +GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName ) +{ + if ( !myGUIMap.contains( libraryName ) ) { + // try to load library if it is not loaded yet +#ifndef WNT + QString dirs = getenv( "LD_LIBRARY_PATH" ); + QString sep = ":"; +#else + QString dirs = getenv( "PATH" ); + QString sep = ";"; +#endif + if ( !dirs.isEmpty() ) { + QStringList dirList = dirs.split(sep, QString::SkipEmptyParts ); // skip empty entries + QListIterator it( dirList ); it.toBack(); + while ( it.hasPrevious() ) { + QFileInfo fi( Qtx::addSlash( it.previous() ) + libraryName ); + if ( fi.exists() ) { + OSD_SharedLibrary aSharedLibrary( fi.fileName().toLatin1().constData() ); + bool res = aSharedLibrary.DlOpen( OSD_RTLD_LAZY ); + if ( !res ) { + MESSAGE( "Can't open library : " << aSharedLibrary.DlError() ); + continue; // continue search further + } + OSD_Function osdF = aSharedLibrary.DlSymb( "GetLibGUI" ); + if ( osdF != NULL ) { + PluginLibraryGUI func = (GEOMPluginGUI* (*) (GeometryGUI*))osdF; + GEOMPluginGUI* libGUI = (*func)( this ); + if ( libGUI ) { + myGUIMap[ libraryName ] = libGUI; + break; // found and loaded! + } + } + } + } + } + } + return myGUIMap.contains( libraryName ) ? (GEOMPluginGUI*)myGUIMap[ libraryName ] : 0; +} + //======================================================================= // function : GeometryGUI::ActiveWorkingPlane() // purpose : Activate Working Plane View @@ -393,8 +440,10 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) << GEOMOp::OpPointMarker << GEOMOp::OpCreateFolder << GEOMOp::OpSortChildren; - if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) ) - return; + if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) ) { + // activate OCC viewer + getApp()->getViewManager(OCCViewer_Viewer::Type(), /*create=*/true); + } // fix for IPAL9103, point 2 if ( CORBA::is_nil( GetGeomGen() ) ) { @@ -590,16 +639,45 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) case GEOMOp::OpExplodeBlock: // MENU BLOCKS - EXPLODE ON BLOCKS libName = "BlocksGUI"; break; - case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base) - case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE -// case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS - case GEOMOp::OpDividedDisk: // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK - case GEOMOp::OpDividedCylinder: // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER - case GEOMOp::OpSmoothingSurface: // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE - //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// - libName = "AdvancedGUI"; - break; + //case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base) + //case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE + //case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS + //case GEOMOp::OpDividedDisk: // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK + //case GEOMOp::OpDividedCylinder: // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER + //case GEOMOp::OpSmoothingSurface: // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE + //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// + //libName = "AdvancedGUI"; + //break; default: + if (myPluginActions.contains(id)) { + libName = myPluginActions[id].first; + + GEOMPluginGUI* library = 0; + if ( !libName.isEmpty() ) { +#ifndef WNT + libName = QString( "lib" ) + libName + ".so"; +#else + libName = libName + ".dll"; +#endif + library = getPluginLibrary( libName ); + } + + // call method of corresponding GUI library + if ( library ) { + //QString action ("%1"); + //action = action.arg(id); + + //if( !theParam.isValid() ) + library->OnGUIEvent( myPluginActions[id].second, desk ); + //else + // library->OnGUIEvent( id, desk, theParam); + } + else + SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) ); + + updateCreationInfo(); + return; + } break; } @@ -626,6 +704,57 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) updateCreationInfo(); } +//================================================================================= +// function : GeometryGUI::activateOperation() +// purpose : +//================================================================================= +bool GeometryGUI::activateOperation( int actionId ) +{ + OnGUIEvent(actionId); + return true; +} + +//================================================================================= +// function : GeometryGUI::activateOperation() +// purpose : +//================================================================================= +bool GeometryGUI::activateOperation( const QString& actionId ) +{ + bool isOk = false; + + int id = actionId.toInt(&isOk); + if (isOk) + OnGUIEvent(id); + + return isOk; +} + +//================================================================================= +// function : GeometryGUI::activateOperation() +// purpose : +//================================================================================= +bool GeometryGUI::activateOperation( const QString& actionId, const QString& plugin ) +{ + bool isOk = false; + + QString pluginLib = plugin; + // TODO: if is a plugin name, find plugin library name + if (myPluginLibs.contains(plugin)) + pluginLib = myPluginLibs[plugin]; + + QMap::iterator actionsIter = myPluginActions.begin(); + for (; actionsIter != myPluginActions.end(); ++actionsIter) { + const PluginAction& anAction = actionsIter.value(); + if (anAction.first == pluginLib && anAction.second == actionId) { + // activate operation + OnGUIEvent(actionsIter.key()); + isOk = true; + } + } + + return isOk; +} + //================================================================================= // function : GeometryGUI::OnKeyPress() // purpose : Called when any key is pressed by user [static] @@ -909,8 +1038,6 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpCreateFolder, "POP_CREATE_FOLDER" ); createGeomAction( GEOMOp::OpSortChildren, "POP_SORT_CHILD_ITEMS" ); - createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" ); - // Create actions for increase/decrease transparency shortcuts createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false, "Geometry:Increase transparency"); @@ -923,10 +1050,10 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpDecrNbIsos, "", "", 0, false, "Geometry:Decrease number of isolines"); -// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" ); - createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" ); - createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" ); - createGeomAction( GEOMOp::OpSmoothingSurface, "SMOOTHINGSURFACE" ); + //createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" ); + //createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" ); + //createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" ); + //createGeomAction( GEOMOp::OpSmoothingSurface, "SMOOTHINGSURFACE" ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// // ---- create menus -------------------------- @@ -965,7 +1092,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpCone, primId, -1 ); createMenu( GEOMOp::OpRectangle, primId, -1 ); createMenu( GEOMOp::OpDisk, primId, -1 ); - createMenu( GEOMOp::OpPipeTShape,primId, -1 ); + //createMenu( GEOMOp::OpPipeTShape,primId, -1 ); int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 ); createMenu( GEOMOp::OpPrism, genId, -1 ); @@ -976,9 +1103,9 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpPipePath, genId, -1 ); #endif - int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 ); - createMenu( GEOMOp::OpSmoothingSurface, advId, -1 ); - //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// + //int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 ); + //createMenu( GEOMOp::OpSmoothingSurface, advId, -1 ); + //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// createMenu( separator(), newEntId, -1 ); @@ -994,8 +1121,8 @@ void GeometryGUI::initialize( CAM_Application* app ) int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 ); createMenu( GEOMOp::OpQuadFace, blocksId, -1 ); createMenu( GEOMOp::OpHexaSolid, blocksId, -1 ); - createMenu( GEOMOp::OpDividedDisk, blocksId, -1 ); - createMenu( GEOMOp::OpDividedCylinder, blocksId, -1 ); + //createMenu( GEOMOp::OpDividedDisk, blocksId, -1 ); + //createMenu( GEOMOp::OpDividedCylinder, blocksId, -1 ); createMenu( separator(), newEntId, -1 ); @@ -1108,7 +1235,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( separator(), toolsId, -1 ); createMenu( GEOMOp::OpCheckGeom, toolsId, -1 ); #endif - + createMenu( separator(), toolsId, -1 ); createMenu( GEOMOp::OpMaterialsLibrary, toolsId, -1 ); createMenu( separator(), toolsId, -1 ); @@ -1168,14 +1295,11 @@ void GeometryGUI::initialize( CAM_Application* app ) createTool( GEOMOp::OpCone, primTbId ); createTool( GEOMOp::OpRectangle, primTbId ); createTool( GEOMOp::OpDisk, primTbId ); - createTool( GEOMOp::OpPipeTShape, primTbId ); //rnc - - int blocksTbId = createTool( tr( "TOOL_BLOCKS" ) ); - createTool( GEOMOp::OpDividedDisk, blocksTbId ); - createTool( GEOMOp::OpDividedCylinder, blocksTbId ); + //createTool( GEOMOp::OpPipeTShape, primTbId ); //rnc -// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); //rnc -// createTool( GEOMOp::OpPipeTShape, advancedTbId ); + //int blocksTbId = createTool( tr( "TOOL_BLOCKS" ) ); + //createTool( GEOMOp::OpDividedDisk, blocksTbId ); + //createTool( GEOMOp::OpDividedCylinder, blocksTbId ); int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) ); createTool( GEOMOp::OpFuse, boolTbId ); @@ -1250,12 +1374,12 @@ void GeometryGUI::initialize( CAM_Application* app ) int picturesTbId = createTool( tr( "TOOL_PICTURES" ) ); createTool( GEOMOp::OpPictureImport, picturesTbId ); - #ifdef WITH_OPENCV - createTool( GEOMOp::OpFeatureDetect, picturesTbId ); - #endif +#ifdef WITH_OPENCV + createTool( GEOMOp::OpFeatureDetect, picturesTbId ); +#endif - int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); - createTool( GEOMOp::OpSmoothingSurface, advancedTbId ); + //int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); + //createTool( GEOMOp::OpSmoothingSurface, advancedTbId ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// // ---- create popup menus -------------------------- @@ -1316,7 +1440,7 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule ); mgr->insert( separator(), -1, -1 ); // ----------- - + mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})" + "and isPhysicalMaterial=false", QtxPopupMgr::VisibleRule ); mgr->insert( action( GEOMOp::OpTransparency ), -1, -1 ); // transparency @@ -1328,9 +1452,9 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker //mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule ); mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and ( $typeid in {%1} or compoundOfVertices=true ) " ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule ); - + // material properties - mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 ); + mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 ); mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); // texture @@ -1424,6 +1548,144 @@ void GeometryGUI::initialize( CAM_Application* app ) QColor c = resMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) ); GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c)); } + + // create plugin actions and menus + addPluginActions(); +} + +//======================================================================= +// function : GeometryGUI::addPluginActions() +// purpose : +//======================================================================= +void GeometryGUI::addPluginActions() +{ + // Resource manager + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if (!resMgr) return; + + // Find names of a resource XML files ("GEOMActions.xml" and others); + QString PluginsXml; + char* cenv = getenv("GEOM_PluginsList"); + if (cenv) + PluginsXml.sprintf("%s", cenv); + + QStringList PluginsXmlList = PluginsXml.split(":", QString::SkipEmptyParts); + if (PluginsXmlList.count() == 0) return; + + // get full names of xml files from PluginsXmlList + QStringList xmlFiles; + xmlFiles.append(QDir::home().filePath("CustomGeomPlugins.xml")); // may be inexistent + for (int i = 0; i < PluginsXmlList.count(); i++) { + PluginsXml = PluginsXmlList[ i ]; + + // Find full path to the resource XML file + QString xmlFile = resMgr->path("resources", "GEOM", PluginsXml + ".xml"); + if ( xmlFile.isEmpty() ) // try PLUGIN resources + xmlFile = resMgr->path("resources", PluginsXml, PluginsXml + ".xml"); + if ( !xmlFile.isEmpty() ) + xmlFiles.append( xmlFile ); + } + + // create "Advanced Operations" menu and corresponding toolbar + //int advancedMenuId = createMenu(tr("MEN_ADVANCED"), -1, -1, 10); + //int advancedTbarId = createTool(tr("TOOL_ADVANCED")); + int id = GEOMOp::OpLastOperationID; // TODO? + + // loop on xmlFiles + QString aNoAccessFiles; + for (int i = 0; i < xmlFiles.count(); i++) { + QString xmlFile = xmlFiles[ i ]; + + QFile file (xmlFile); + if (file.exists() && file.open(QIODevice::ReadOnly)) { + file.close(); + + GEOMGUI_XmlHandler* aXmlHandler = new GEOMGUI_XmlHandler(); + ASSERT(aXmlHandler); + + QXmlInputSource source (&file); + QXmlSimpleReader reader; + reader.setContentHandler(aXmlHandler); + reader.setErrorHandler(aXmlHandler); + bool ok = reader.parse(source); + file.close(); + + if (ok) { + // bind action lib and label to its ID for activateOperation() method proper work + myPluginLibs[aXmlHandler->myPluginData.myName] = aXmlHandler->myPluginData.myClientLib; + + QListIterator anActionsIter (aXmlHandler->myPluginData.myListOfActions); + while (anActionsIter.hasNext()) { + GEOMGUI_ActionData anActionData = anActionsIter.next(); + + //QPixmap icon = resMgr->loadPixmap("GEOM", tr(anActionData.myIcon.toLatin1().constData())); + QPixmap icon = resMgr->loadPixmap(aXmlHandler->myPluginData.myName, + anActionData.myIcon.toLatin1().constData()); + + // path to action in menu + QStringList smenus = anActionData.myMenu.split( "/" ); + QString actionName = smenus.last(); + actionName = actionName.toUpper().prepend("MEN_"); + smenus.removeLast(); + + // path to action in toolbar + QStringList stools = anActionData.myTooltip.split( "/" ); + QString actionTool = stools.last(); + actionTool = actionTool.toUpper().prepend("TOP_"); + stools.removeLast(); + + createAction(id, // ~ anActionData.myLabel + tr(actionTool.toLatin1().constData()), + icon, + tr(actionName.toLatin1().constData()), + anActionData.myStatusBar.toLatin1().constData(), + 0 /*accel*/, + application()->desktop(), + false /*toggle*/, + this, SLOT(OnGUIEvent()), + QString() /*shortcutAction*/); + + int menuId = -1; + foreach (QString subMenu, smenus) { + subMenu = subMenu.toUpper().prepend("MEN_"); + menuId = createMenu(tr(subMenu.toLatin1().constData()), menuId, -1); + } + //createMenu(id, pluginMenuId, -1); + createMenu(id, menuId, -1); + + QString subTool = stools[0]; + subTool = subTool.toUpper().prepend("TOOL_"); + int toolId = createTool(tr(subTool.toLatin1().constData())); + //createTool(id, advancedTbarId); + createTool(id, toolId); + + // add action id to map + PluginAction anAction (aXmlHandler->myPluginData.myClientLib, anActionData.myLabel); + myPluginActions[id] = anAction; + + id++; + } + } + else { + SUIT_MessageBox::critical(application()->desktop(), + tr("INF_PARSE_ERROR"), + tr(aXmlHandler->errorProtocol().toLatin1().data())); + } + delete aXmlHandler; + } + else if ( i > 0 ) { // 1st is ~/CustomGeomPlugins.xml + if (aNoAccessFiles.isEmpty()) + aNoAccessFiles = xmlFile; + else + aNoAccessFiles += ", " + xmlFile; + } + } // end loop on xmlFiles + + if (!aNoAccessFiles.isEmpty()) { + QString aMess = QObject::tr("PLUGIN_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n"; + aMess += QObject::tr("PLUGIN_FILE_CHECK_VARIABLE"); + SUIT_MessageBox::warning(application()->desktop(), tr("GEOM_WRN_WARNING"), aMess); + } } //======================================================================= @@ -1687,13 +1949,14 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm ) //================================================================================ /*! - * \brief Slot called when selection changed. Shows creation info of a selected object + * \brief Slot called when selection changed. Shows creation info of a selected object */ //================================================================================ void GeometryGUI::updateCreationInfo() { - myCreationInfoWdg->clear(); + if ( myCreationInfoWdg ) + myCreationInfoWdg->clear(); // Code below is commented to have myCreationInfoWdg filled as soon as it is shown again // if ( !myCreationInfoWdg->isVisible() ) @@ -1726,34 +1989,32 @@ void GeometryGUI::updateCreationInfo() // pass creation info of geomObj to myCreationInfoWdg - QPixmap icon; - QString operationName; - myCreationInfoWdg->setOperation( icon, operationName ); - - try - { - OCC_CATCH_SIGNALS; - GEOM::CreationInformation_var info = geomObj->GetCreationInformation(); - if ( &info.in() ) - { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QString name = info->operationName.in(); - if ( !name.isEmpty() ) - { - icon = resMgr->loadPixmap( "GEOM", tr( ("ICO_"+name).toLatin1().constData() ), false ); - operationName = tr( ("MEN_"+name).toLatin1().constData() ); - if ( operationName.startsWith( "MEN_" )) - operationName = name; // no translation - myCreationInfoWdg->setOperation( icon, operationName ); - - for ( size_t i = 0; i < info->params.length(); ++i ) - myCreationInfoWdg->addParam( info->params[i].name.in(), - info->params[i].value.in() ); + if ( myCreationInfoWdg ) { + QPixmap icon; + QString operationName; + myCreationInfoWdg->setOperation( icon, operationName ); + + try { + OCC_CATCH_SIGNALS; + GEOM::CreationInformation_var info = geomObj->GetCreationInformation(); + if ( &info.in() ) { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QString name = info->operationName.in(); + if ( !name.isEmpty() ) { + icon = resMgr->loadPixmap( "GEOM", tr( ("ICO_"+name).toLatin1().constData() ), false ); + operationName = tr( ("MEN_"+name).toLatin1().constData() ); + if ( operationName.startsWith( "MEN_" )) + operationName = name; // no translation + myCreationInfoWdg->setOperation( icon, operationName ); + + for ( size_t i = 0; i < info->params.length(); ++i ) + myCreationInfoWdg->addParam( info->params[i].name.in(), + info->params[i].value.in() ); + } } } - } - catch (...) - { + catch (...) { + } } } @@ -1880,7 +2141,7 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& if( isPredefMat ){ QMenu* matMenu = new QMenu(); QSignalMapper* signalMapper = new QSignalMapper( matMenu ); - + //Get current material model for the object QVariant v; LightApp_Application* anApp = dynamic_cast( getApp() ); @@ -1895,13 +2156,13 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& // get list of all predefined materials QStringList materials = Material_ResourceMgr::resourceMgr()->materials(); bool found = false; - foreach ( QString material, materials ) + foreach ( QString material, materials ) { QAction* menAct = matMenu->addAction( material ); connect(menAct, SIGNAL( toggled( bool ) ), signalMapper, SLOT( map() ) ); signalMapper->setMapping( menAct, material ); menAct->setCheckable( true ); - // Set checked if this material is current + // Set checked if this material is current Material_Model aModel; aModel.fromResources( material ); if ( !found && aModel.toProperties() == curModel ) { @@ -2013,15 +2274,15 @@ void GeometryGUI::createPreferences() addPreference( tr( "PREF_AUTO_BRING_TO_FRONT" ), genGroup, LightApp_Preferences::Bool, "Geometry", "auto_bring_to_front" ); - + int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId ); setPreferenceProperty( isoGroup, "columns", 2 ); int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup, - LightApp_Preferences::IntSpin, "Geometry", "iso_number_u" ); + LightApp_Preferences::IntSpin, "Geometry", "iso_number_u" ); setPreferenceProperty( isoU, "min", 0 ); setPreferenceProperty( isoU, "max", 100000 ); int isoV = addPreference( tr( "PREF_ISOS_V" ), isoGroup, - LightApp_Preferences::IntSpin, "Geometry", "iso_number_v" ); + LightApp_Preferences::IntSpin, "Geometry", "iso_number_v" ); setPreferenceProperty( isoV, "min", 0 ); setPreferenceProperty( isoV, "max", 100000 ); @@ -2109,7 +2370,7 @@ void GeometryGUI::createPreferences() // Set property for default material setPreferenceProperty( material, "strings", Material_ResourceMgr::resourceMgr()->materials() ); - + // Set property vertex marker type QList aMarkerTypeIndicesList; QList aMarkerTypeIconsList; diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index cbef549b6..78eb05db4 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -38,9 +38,11 @@ #include #include "GEOMGUI.h" +#include "GEOMPluginGUI.h" // QT Includes #include +#include // OCCT Includes #include @@ -113,6 +115,9 @@ public: // Process action void OnGUIEvent( int id, const QVariant& theParam = QVariant( QVariant::Invalid ) ); + virtual bool activateOperation( int actionId ); + virtual bool activateOperation( const QString& actionId ); + virtual bool activateOperation( const QString& actionId, const QString& plugin ); // The Working Plane management void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; } @@ -180,6 +185,7 @@ protected: private: GEOMGUI* getLibrary( const QString& libraryName ); + GEOMPluginGUI* getPluginLibrary( const QString& libraryName ); void createGeomAction( const int id, const QString& po_id, const QString& icon_id = QString(""), const int key = 0, const bool toggle = false, @@ -188,6 +194,7 @@ private: const bool isSingle = false, const int isVisible = -1, const bool isExpandAll = false, const bool isOCC = false, const int parentId = -1 ); + void addPluginActions(); void createOriginAndBaseVectors(); @@ -205,12 +212,17 @@ private: typedef QMap StudyTextureMap; typedef QMap GUIMap; + typedef QPair PluginAction; + GUIMap myGUIMap; // GUI libraries map QDialog* myActiveDialogBox; // active dialog box gp_Ax3 myWorkingPlane; - QMap myRules; // popup rules + //QMap myRules; // popup rules static StudyTextureMap myTextureMap; // texture map + QMap myPluginActions; // plugin actions + QMap myPluginLibs; // plugin name to plugin client library + QList myOCCSelectors; QList myVTKSelectors; diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 38fa6d57f..86963a94b 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -195,12 +195,13 @@ namespace GEOMOp { OpExplodeBlock = 6104, // MENU BLOCKS - EXPLODE ON BLOCKS // AdvancedGUI -----------------//-------------------------------- OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base) - OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE - //OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS - OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK - OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER - OpSmoothingSurface = 10005, // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE + //OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE + //OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS + //OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK + //OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER + //OpSmoothingSurface = 10005, // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE //@@ insert new functions before this line @@ do not remove this line @@// + OpLastOperationID = 20000 // DO NOT USE OPERATION IDs MORE THAN 20000 !!! }; } diff --git a/src/GEOMGUI/Makefile.am b/src/GEOMGUI/Makefile.am index 54f6e94fb..c476494dd 100644 --- a/src/GEOMGUI/Makefile.am +++ b/src/GEOMGUI/Makefile.am @@ -32,6 +32,8 @@ salomeinclude_HEADERS = \ GeometryGUI.h \ GeometryGUI_Operations.h\ GEOMGUI.h \ + GEOMPluginGUI.h \ + GEOMGUI_XmlHandler.h \ GEOM_Displayer.h \ GEOMGUI_OCCSelector.h \ GEOMGUI_Selection.h \ @@ -41,6 +43,8 @@ salomeinclude_HEADERS = \ dist_libGEOM_la_SOURCES = \ GeometryGUI.cxx \ GEOMGUI.cxx \ + GEOMPluginGUI.cxx \ + GEOMGUI_XmlHandler.cxx \ GEOM_Displayer.cxx \ GEOMGUI_OCCSelector.cxx \ GEOMGUI_Selection.cxx \ diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx index 9de130a4a..4b91160ba 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.cxx +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -82,12 +82,6 @@ #include #include #include -// Advanced operations -#include -#include -// #include -#include -/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ //============================================================================= /*! @@ -169,13 +163,6 @@ GEOMImpl_Gen::GEOMImpl_Gen() // Measurements TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver()); - // Advanced operations - TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver()); - TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedDiskDriver::GetID(), new GEOMImpl_DividedDiskDriver()); -// TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(), new GEOMImpl_DividedCylinderDriver()); - TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SmoothingSurfaceDriver::GetID(), new GEOMImpl_SmoothingSurfaceDriver()); - /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ - SetEngine(this); } @@ -405,18 +392,3 @@ GEOMImpl_IGroupOperations* GEOMImpl_Gen::GetIGroupOperations(int theDocID) return _mapOfGroupOperations[theDocID]; } - -//============================================================================= -/*! - * GetIAdvancedOperations - */ -//============================================================================= -GEOMImpl_IAdvancedOperations* GEOMImpl_Gen::GetIAdvancedOperations(int theDocID) -{ - if(_mapOfAdvancedOperations.find(theDocID) == _mapOfAdvancedOperations.end()) { - _mapOfAdvancedOperations[theDocID] = new GEOMImpl_IAdvancedOperations(this, theDocID); - } - - return _mapOfAdvancedOperations[theDocID]; -} - diff --git a/src/GEOMImpl/GEOMImpl_Gen.hxx b/src/GEOMImpl/GEOMImpl_Gen.hxx index ed9e7752d..06ca4ff63 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.hxx +++ b/src/GEOMImpl/GEOMImpl_Gen.hxx @@ -39,7 +39,6 @@ #include "GEOMImpl_IInsertOperations.hxx" #include "GEOMImpl_IMeasureOperations.hxx" #include "GEOMImpl_IGroupOperations.hxx" -#include "GEOMImpl_IAdvancedOperations.hxx" #include "GEOM_Engine.hxx" class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine @@ -72,8 +71,6 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine GEOMImpl_IGroupOperations* GetIGroupOperations(int theDocID); - GEOMImpl_IAdvancedOperations* GetIAdvancedOperations(int theDocID); - private: std::map _mapOfBasicOperations; @@ -88,7 +85,6 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine std::map _mapOfInsertOperations; std::map _mapOfMeasureOperations; std::map _mapOfGroupOperations; - std::map _mapOfAdvancedOperations; }; #endif diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index a1056d69a..d4884912b 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -50,8 +50,6 @@ #define GEOM_CIRC_ARC 19 #define GEOM_FILLET 20 -#define GEOM_FILLET_2D 45 -#define GEOM_FILLET_1D 46 #define GEOM_CHAMFER 21 #define GEOM_EDGE 22 @@ -105,6 +103,9 @@ #define GEOM_THICKENING 49 +#define GEOM_FILLET_2D 50 +#define GEOM_FILLET_1D 51 + //GEOM_Function types #define COPY_WITH_REF 1 @@ -353,17 +354,3 @@ // Advanced functions (base = 200) #define ADVANCED_BASE 200 // NO OPERATION (advanced operations base) -#define GEOM_TSHAPE 201 -#define GEOM_DIVIDEDDISK 202 -#define GEOM_DIVIDEDCYLINDER 203 -#define GEOM_SMOOTHINGSURFACE 204 -/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ -// Advanced functions sub-operations codes -#define TSHAPE_BASIC 1 -#define TSHAPE_CHAMFER 2 -#define TSHAPE_FILLET 3 -#define DIVIDEDDISK_R_RATIO 1 -#define DIVIDEDDISK_R_VECTOR_PNT 2 -#define DIVIDEDCYLINDER_R_H 1 -#define SMOOTHINGSURFACE_LPOINTS 1 -/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index f4a04e8d7..a20ee6e2e 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -43,7 +43,6 @@ salomeinclude_HEADERS = \ GEOMImpl_IInsertOperations.hxx \ GEOMImpl_IMeasureOperations.hxx \ GEOMImpl_IGroupOperations.hxx \ - GEOMImpl_IAdvancedOperations.hxx \ GEOMImpl_IGlue.hxx \ GEOMImpl_PointDriver.hxx \ GEOMImpl_IPoint.hxx \ @@ -146,15 +145,6 @@ salomeinclude_HEADERS = \ GEOMImpl_Types.hxx \ GEOM_GEOMImpl.hxx -ADVANCED_INCLUDES = -ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx -ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx -##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx -ADVANCED_INCLUDES += GEOMImpl_ISmoothingSurface.hxx GEOMImpl_SmoothingSurfaceDriver.hxx -##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## - -salomeinclude_HEADERS += $(ADVANCED_INCLUDES) - dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_IBasicOperations.cxx \ GEOMImpl_ITransformOperations.cxx \ @@ -168,7 +158,6 @@ dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_IInsertOperations.cxx \ GEOMImpl_IMeasureOperations.cxx \ GEOMImpl_IGroupOperations.cxx \ - GEOMImpl_IAdvancedOperations.cxx \ GEOMImpl_Gen.cxx \ GEOMImpl_PointDriver.cxx \ GEOMImpl_VectorDriver.cxx \ @@ -220,15 +209,6 @@ dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_FillingDriver.cxx \ GEOMImpl_GlueDriver.cxx -ADVANCED_SOURCES = -ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx -ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx -##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx -ADVANCED_SOURCES += GEOMImpl_SmoothingSurfaceDriver.cxx -##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## - -dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES) - # additional information to compile and link file libGEOMimpl_la_CPPFLAGS = \ diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 3026120cc..c44b639c7 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #ifdef WNT #pragma warning( disable:4786 ) @@ -64,6 +63,25 @@ #include #include +#ifdef WNT + #include + #include +#else + #include +#endif + +#ifdef WNT + #define LibHandle HMODULE + #define LoadLib( name ) LoadLibrary( name ) + #define GetProc GetProcAddress + #define UnLoadLib( handle ) FreeLibrary( handle ); +#else + #define LibHandle void* + #define LoadLib( name ) dlopen( name, RTLD_LAZY ) + #define GetProc dlsym + #define UnLoadLib( handle ) dlclose( handle ); +#endif + //============================================================================ // function : GEOM_Gen_i() // purpose : constructor to be called for servant creation. @@ -243,30 +261,30 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, } else { GEOM::shape_type myshapetype=aShape->GetShapeType(); if ( myshapetype == GEOM::COMPOUND ) { - aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPOUND" ); - aShapeName = "Compound_"; - } else if ( myshapetype == GEOM::COMPSOLID ) { - aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPSOLID"); - aShapeName = "Compsolid_"; - } else if ( myshapetype == GEOM::SOLID ) { - aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SOLID"); - aShapeName = "Solid_"; - } else if ( myshapetype == GEOM::SHELL ) { - aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SHELL"); - aShapeName = "Shell_"; - } else if ( myshapetype == GEOM::FACE ) { - aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_FACE"); - aShapeName = "Face_"; - } else if ( myshapetype == GEOM::WIRE ) { - aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_WIRE"); - aShapeName = "Wire_"; - } else if ( myshapetype == GEOM::EDGE ) { - aResultSO->SetAttrString("AttributePixMap", "ICON_OBJBROWSER_EDGE"); - aShapeName = "Edge_"; - } else if ( myshapetype == GEOM::VERTEX ) { - aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_VERTEX" ); - aShapeName = "Vertex_"; - } + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPOUND" ); + aShapeName = "Compound_"; + } else if ( myshapetype == GEOM::COMPSOLID ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPSOLID"); + aShapeName = "Compsolid_"; + } else if ( myshapetype == GEOM::SOLID ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SOLID"); + aShapeName = "Solid_"; + } else if ( myshapetype == GEOM::SHELL ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SHELL"); + aShapeName = "Shell_"; + } else if ( myshapetype == GEOM::FACE ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_FACE"); + aShapeName = "Face_"; + } else if ( myshapetype == GEOM::WIRE ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_WIRE"); + aShapeName = "Wire_"; + } else if ( myshapetype == GEOM::EDGE ) { + aResultSO->SetAttrString("AttributePixMap", "ICON_OBJBROWSER_EDGE"); + aShapeName = "Edge_"; + } else if ( myshapetype == GEOM::VERTEX ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_VERTEX" ); + aShapeName = "Vertex_"; + } } //if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag()); //else aShapeName = TCollection_AsciiString(CORBA::string_dup(theName)); @@ -2316,22 +2334,78 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theS } //============================================================================ -// function : GetIAdvancedOperations +// function : GetPluginOperations // purpose : //============================================================================ -GEOM::GEOM_IAdvancedOperations_ptr GEOM_Gen_i::GetIAdvancedOperations(CORBA::Long theStudyID) +GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(CORBA::Long theStudyID, + const char* theLibName) throw ( SALOME::SALOME_Exception ) { + std::string aPlatformLibName; +#ifdef WNT + aPlatformLibName = theLibName; + aPlatformLibName += ".dll" ; +#else + aPlatformLibName = "lib"; + aPlatformLibName += theLibName; + aPlatformLibName += ".so"; +#endif + Unexpect aCatch(SALOME_SalomeException); - MESSAGE( "GEOM_Gen_i::GetIAdvancedOperations" ); + MESSAGE( "GEOM_Gen_i::GetPluginOperations" ); GEOM::GEOM_Gen_ptr engine = _this(); - GEOM_IAdvancedOperations_i* aServant = - new GEOM_IAdvancedOperations_i(_poa, engine, _impl->GetIAdvancedOperations(theStudyID)); + GEOM_IOperations_i* aServant = 0; + GEOM::GEOM_IOperations_var operations; + + try { + // check, if corresponding operations are already created + if (myOpCreatorMap.find(std::string(theLibName)) == myOpCreatorMap.end()) { + // load plugin library + LibHandle libHandle = LoadLib( aPlatformLibName.c_str()/*theLibName*/ ); + if (!libHandle) { + // report any error, if occured +#ifndef WNT + const char* anError = dlerror(); + throw(SALOME_Exception(anError)); +#else + throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" ))); +#endif + } + + // get method, returning operations creator + typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)(); + GetOperationsCreator procHandle = + (GetOperationsCreator)GetProc( libHandle, "GetOperationsCreator" ); + if (!procHandle) { + throw(SALOME_Exception(LOCALIZED("bad geometry plugin library"))); + UnLoadLib(libHandle); + } + + // get operations creator + GEOM_GenericOperationsCreator* aCreator = procHandle(); + if (!aCreator) { + throw(SALOME_Exception(LOCALIZED("bad geometry plugin library implementation"))); + } + + // map operations creator to a plugin name + myOpCreatorMap[std::string(theLibName)] = aCreator; + } + + // create a new operations object, store its ref. in engine + aServant = myOpCreatorMap[std::string(theLibName)]->Create(_poa, theStudyID, engine, _impl); + //??? aServant->SetLibName(aPlatformLibName/*theLibName*/); // for persistency assurance + } + catch (SALOME_Exception& S_ex) { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + if (!aServant) + return operations._retn(); // activate the CORBA servant - GEOM::GEOM_IAdvancedOperations_var operations = aServant->_this(); + operations = GEOM::GEOM_IOperations::_narrow( aServant->_this() ); return operations._retn(); } diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index 0b264cfd0..c87fe23cf 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #ifndef __GEOM_GEN_I_H__ #define __GEOM_GEN_I_H__ @@ -50,16 +49,31 @@ #include "GEOM_IInsertOperations_i.hh" #include "GEOM_IMeasureOperations_i.hh" #include "GEOM_IGroupOperations_i.hh" -#include "GEOM_IAdvancedOperations_i.hh" #include +#include #include #include //#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +//===================================================================== +// Generic operations creator (for plugins mechanism) +//===================================================================== +class GEOM_I_EXPORT GEOM_GenericOperationsCreator +{ +public: + // Create operations + virtual GEOM_IOperations_i* Create (PortableServer::POA_ptr thePOA, + int theStudyId, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_Gen* theGenImpl) = 0; + // return the name of IDL module + //virtual std::string GetModuleName() = 0; +}; + //===================================================================== // GEOM_Gen_i : class definition //===================================================================== @@ -242,8 +256,9 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID) throw (SALOME::SALOME_Exception); - //Returns a pointer to AdvancedOperations interface - virtual GEOM::GEOM_IAdvancedOperations_ptr GetIAdvancedOperations (CORBA::Long theStudyID) + //Returns a pointer to corresponding plugin operations interface + virtual GEOM::GEOM_IOperations_ptr GetPluginOperations (CORBA::Long theStudyID, + const char* theLibName) throw (SALOME::SALOME_Exception); //Adds a new sub-shape @@ -342,6 +357,9 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi ::GEOMImpl_Gen* _impl; SALOME_NamingService * name_service; char * _name; + + // plugin operations managing + std::map myOpCreatorMap; }; #endif diff --git a/src/GEOM_I/Makefile.am b/src/GEOM_I/Makefile.am index a64d9537e..4dee78ed9 100644 --- a/src/GEOM_I/Makefile.am +++ b/src/GEOM_I/Makefile.am @@ -44,7 +44,6 @@ salomeinclude_HEADERS = \ GEOM_ITransformOperations_i.hh \ GEOM_IMeasureOperations_i.hh \ GEOM_IGroupOperations_i.hh \ - GEOM_IAdvancedOperations_i.hh \ GEOM_Gen_i.hh \ GEOM_GEOM_I.hxx \ GEOM_wrap.hxx @@ -64,7 +63,6 @@ dist_libGEOMEngine_la_SOURCES = \ GEOM_ITransformOperations_i.cc \ GEOM_IMeasureOperations_i.cc \ GEOM_IGroupOperations_i.cc \ - GEOM_IAdvancedOperations_i.cc \ GEOM_Gen_i.cc \ GEOM_DumpPython.cc diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index ab8c5798e..556910df6 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -398,8 +398,9 @@ void GEOM_Superv_i::getAdvancedOp() if (CORBA::is_nil(myAdvancedOp) || isNewStudy(myLastStudyID,myStudyID)) { //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" // Try to get id of the study from the SALOME Session - if(myStudyID < 0 ) SetStudyID(-1); - myAdvancedOp = myGeomEngine->GetIAdvancedOperations(myStudyID); + if(myStudyID < 0 ) SetStudyID(-1); + //myAdvancedOp = myGeomEngine->GetIAdvancedOperations(myStudyID); + myAdvancedOp = GEOM::GEOM_IAdvancedOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "AdvancedEngine")); } } diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 40715da11..2e71559e6 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -459,6 +459,18 @@ class info: CLOSED = 1 UNCLOSED = 2 +##! Private class used to bind calls of plugin operations to geomBuilder +class PluginOperation: + def __init__(self, operation, function): + self.operation = operation + self.function = function + pass + + def __call__(self, *args): + res = self.function(self.operation, *args) + RaiseIfFailed(self.function.__name__, self.operation) + return res + # Warning: geom is a singleton geom = None engine = None @@ -684,13 +696,28 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): self.MeasuOp = self.GetIMeasureOperations (self.myStudyId) self.BlocksOp = self.GetIBlocksOperations (self.myStudyId) self.GroupOp = self.GetIGroupOperations (self.myStudyId) - self.AdvOp = self.GetIAdvancedOperations (self.myStudyId) + #self.AdvOp = self.GetIAdvancedOperations (self.myStudyId) + self.AdvOp = self.GetPluginOperations (self.myStudyId, "AdvancedEngine") # set GEOM as root in the use case tree self.myUseCaseBuilder = self.myStudy.GetUseCaseBuilder() self.myUseCaseBuilder.SetRootCurrent() self.myUseCaseBuilder.Append(self.father) pass + def GetPluginOperations(self, studyID, libraryName): + op = GEOM._objref_GEOM_Gen.GetPluginOperations(self, studyID, libraryName) + if op: + # bind methods of operations to self + methods = op.__class__.__dict__['__methods__'] + avoid_methods = self.BasicOp.__class__.__dict__['__methods__'] + for meth_name in methods: + if not meth_name in avoid_methods: # avoid basic methods + function = getattr(op.__class__, meth_name) + if callable(function): + #self.__dict__[meth_name] = self.__PluginOperation(op, function) + self.__dict__[meth_name] = PluginOperation(op, function) + return op + ## Enable / disable results auto-publishing # # The automatic publishing is managed in the following way: diff --git a/src/Makefile.am b/src/Makefile.am index 1c2ba31d1..a473cc47a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,7 +34,8 @@ if GEOM_ENABLE_GUI SUBDIRS += OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \ GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \ EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \ - RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI GEOM_SWIG_WITHIHM + RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI AdvancedEngine \ + GEOM_SWIG_WITHIHM endif DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER \ @@ -45,4 +46,4 @@ DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER \ GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \ EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \ RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \ - GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition + AdvancedEngine GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition -- 2.39.2