From: vsr Date: Thu, 9 Aug 2012 07:58:02 +0000 (+0000) Subject: Merge from V6_main_20120808 08Aug12 X-Git-Tag: V7_0_0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=73555c78ebf12a1fdb85157b8e7934ad566ae90a;p=modules%2Fgeom.git Merge from V6_main_20120808 08Aug12 --- diff --git a/GEOM_version.h.in b/GEOM_version.h.in index e511ffbba..ce1af35af 100644 --- a/GEOM_version.h.in +++ b/GEOM_version.h.in @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_version.h // Author : Vadim SANDLER // Module : SALOME @@ -32,5 +33,6 @@ #define GEOM_VERSION_STR "@VERSION@" #define GEOM_VERSION @XVERSION@ +#define GEOM_DEVELOPMENT @VERSION_DEV@ #endif // __GEOM_VERSION_H__ diff --git a/Makefile.am b/Makefile.am index 5242cf83f..863140fa7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 28/06/2001 @@ -28,18 +26,18 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am if GEOM_ENABLE_GUI ACLOCAL_AMFLAGS = -I adm_local/unix/config_files \ - -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ - -I ${GUI_ROOT_DIR}/adm_local/unix/config_files + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files else !GEOM_ENABLE_GUI ACLOCAL_AMFLAGS = -I adm_local/unix/config_files \ -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files endif -SUBDIRS = idl adm_local resources src doc bin +SUBDIRS = idl adm_local resources src bin doc -DIST_SUBDIRS = idl adm_local resources src doc bin +DIST_SUBDIRS = idl adm_local resources src bin doc -DISTCLEANFILES = a.out aclocal.m4 configure +DISTCLEANFILES = a.out aclocal.m4 configure local-install.sh hack_libtool adm_local/unix/config_files/config.guess adm_local/unix/config_files/config.sub adm_local/unix/config_files/depcomp adm_local/unix/config_files/install-sh adm_local/unix/config_files/libtool.m4 adm_local/unix/config_files/ltmain.sh adm_local/unix/config_files/ltoptions.m4 adm_local/unix/config_files/ltsugar.m4 adm_local/unix/config_files/ltversion.m4 adm_local/unix/config_files/lt~obsolete.m4 adm_local/unix/config_files/missing adm_local/unix/config_files/py-compile salomeinclude_DATA = GEOM_version.h diff --git a/adm_local/Makefile.am b/adm_local/Makefile.am index f35273fac..6d9ac170c 100644 --- a/adm_local/Makefile.am +++ b/adm_local/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + include $(top_srcdir)/adm_local/unix/make_common_starter.am -SUBDIRS = unix +SUBDIRS = unix cmake_files diff --git a/adm_local/cmake_files/FindGEOM.cmake b/adm_local/cmake_files/FindGEOM.cmake new file mode 100644 index 000000000..6703e076a --- /dev/null +++ b/adm_local/cmake_files/FindGEOM.cmake @@ -0,0 +1,62 @@ +# Copyright (C) 2007-2012 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 +# + +SET(GEOM_CXXFLAGS -I${GEOM_ROOT_DIR}/include/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) +FIND_LIBRARY(BooleanGUI BooleanGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(BREPExport BREPExport ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(BREPImport BREPImport ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(BuildGUI BuildGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(DisplayGUI DisplayGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(DlgRef DlgRef ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(EntityGUI EntityGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GenerationGUI GenerationGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMAlgo GEOMAlgo ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMArchimede GEOMArchimede ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMBase GEOMBase ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMbasic GEOMbasic ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMClient GEOMClient ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMEngine GEOMEngine ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMFiltersSelection GEOMFiltersSelection ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMimpl GEOMimpl ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMObject GEOMObject ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMSketcher GEOMSketcher ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOM GEOM ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOM_SupervEngine GEOM_SupervEngine ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GEOMToolsGUI GEOMToolsGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(GroupGUI GroupGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(IGESExport IGESExport ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(IGESImport IGESImport ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(MeasureGUI MeasureGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(NMTDS NMTDS ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(NMTTools NMTTools ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(OCC2VTK OCC2VTK ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(OperationGUI OperationGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(PrimitiveGUI PrimitiveGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(RepairGUI RepairGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeIDLGEOM SalomeIDLGEOM ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(ShHealOper ShHealOper ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(STEPExport STEPExport ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(STEPImport STEPImport ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(STLExport STLExport ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(TransformationGUI TransformationGUI ${GEOM_ROOT_DIR}/lib/salome) +FIND_LIBRARY(VTKExport VTKExport ${GEOM_ROOT_DIR}/lib/salome) diff --git a/adm_local/cmake_files/Makefile.am b/adm_local/cmake_files/Makefile.am new file mode 100644 index 000000000..3135a765d --- /dev/null +++ b/adm_local/cmake_files/Makefile.am @@ -0,0 +1,26 @@ +# Copyright (C) 2007-2012 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 + +admlocal_cmakedir = $(admlocaldir)/cmake_files + +dist_admlocal_cmake_DATA = \ +FindGEOM.cmake + diff --git a/adm_local/unix/Makefile.am b/adm_local/unix/Makefile.am index 5f6d5f753..0d5ee76b8 100644 --- a/adm_local/unix/Makefile.am +++ b/adm_local/unix/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + include $(top_srcdir)/adm_local/unix/make_common_starter.am SUBDIRS = config_files diff --git a/adm_local/unix/config_files/Makefile.am b/adm_local/unix/config_files/Makefile.am index 706857c88..7a5c9953e 100644 --- a/adm_local/unix/config_files/Makefile.am +++ b/adm_local/unix/config_files/Makefile.am @@ -1,25 +1,25 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + include $(top_srcdir)/adm_local/unix/make_common_starter.am dist_admlocalm4_DATA = \ -check_GEOM.m4 +check_GEOM.m4 \ +check_GUI.m4 \ +check_OpenCV.m4 diff --git a/adm_local/unix/config_files/check_GEOM.m4 b/adm_local/unix/config_files/check_GEOM.m4 index dd30f1b07..eeb81bb79 100644 --- a/adm_local/unix/config_files/check_GEOM.m4 +++ b/adm_local/unix/config_files/check_GEOM.m4 @@ -1,24 +1,25 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE dnl -dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl -dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com dnl + # Check availability of Geom binary distribution # # Author : Nicolas REJNERI (OPEN CASCADE, 2003) diff --git a/adm_local/unix/config_files/check_GUI.m4 b/adm_local/unix/config_files/check_GUI.m4 new file mode 100755 index 000000000..de8c71769 --- /dev/null +++ b/adm_local/unix/config_files/check_GUI.m4 @@ -0,0 +1,103 @@ +dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl + +# Check availability of Salome binary distribution +# +# Author : Marc Tajchman (CEA, 2002) +#------------------------------------------------------------ + +AC_DEFUN([CHECK_GUI_MODULE],[ +AC_REQUIRE([AC_LINKER_OPTIONS])dnl + +LightGUI_ok=no +FullGUI_ok=no + +GUI_LDFLAGS="" +GUI_CXXFLAGS="" + +SALOME_GUI_DIR="" + +AC_ARG_WITH(gui, + [--with-gui=DIR root directory path of SALOME GUI installation], + [], + [with_gui=auto]) + +if test "${with_gui}" = "no"; then + SalomeGUI_need=no +else + # define SALOME_GUI_DIR + if test "${with_gui}" = "yes" -o "${with_gui}" = "auto"; then + SalomeGUI_need="$with_gui" + AC_MSG_RESULT(try \${GUI_ROOT_DIR}: ${GUI_ROOT_DIR}) + if test "x${GUI_ROOT_DIR}" != "x" ; then + # GUI_ROOT_DIR environment variable defined + SALOME_GUI_DIR=${GUI_ROOT_DIR} + else + # search Salome binaries in PATH variable + AC_PATH_PROG(TEMP, SUITApp) + if test "x${TEMP}" != "x" ; then + AC_MSG_RESULT(SUITApp was found at : ${TEMP}) + SALOME_BIN_DIR=`dirname ${TEMP}` + SALOME_GUI_DIR=`cd ${SALOME_BIN_DIR}/../..; pwd` + fi + fi + else + # GUI directory defined by user + SalomeGUI_need=yes + SALOME_GUI_DIR="$with_gui" + fi + + # check GUI installation + AC_CHECKING(for light GUI) + if test -f ${SALOME_GUI_DIR}/bin/salome/SUITApp ; then + LightGUI_ok=yes + AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR}) + + GUI_ROOT_DIR=${SALOME_GUI_DIR} + + GUI_LDFLAGS=-L${SALOME_GUI_DIR}/lib${LIB_LOCATION_SUFFIX}/salome + GUI_CXXFLAGS=-I${SALOME_GUI_DIR}/include/salome + + AC_CHECKING(for full GUI) + if test -f ${SALOME_GUI_DIR}/bin/salome/SALOME_Session_Server ; then + FullGUI_ok=yes + fi + else + AC_MSG_WARN("Cannot find compiled SALOME GUI distribution") + fi + AC_MSG_RESULT(for light GUI: ${LightGUI_ok}) + AC_MSG_RESULT(for full GUI: ${FullGUI_ok}) +fi + +AC_SUBST(GUI_LDFLAGS) +AC_SUBST(GUI_CXXFLAGS) +AC_SUBST(GUI_ROOT_DIR) + +])dnl + +AC_DEFUN([CHECK_SALOME_GUI],[ + CHECK_GUI_MODULE() + SalomeGUI_ok=${LightGUI_ok} +])dnl + +AC_DEFUN([CHECK_CORBA_IN_GUI],[ + CHECK_GUI_MODULE() + CORBA_IN_GUI=${FullGUI_ok} + AC_SUBST(CORBA_IN_GUI) +])dnl diff --git a/adm_local/unix/config_files/check_OpenCV.m4 b/adm_local/unix/config_files/check_OpenCV.m4 new file mode 100644 index 000000000..b70ddd91e --- /dev/null +++ b/adm_local/unix/config_files/check_OpenCV.m4 @@ -0,0 +1,98 @@ +dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl + +dnl File : check_OpenCV.m4 +dnl Author : Renaud NEDELEC, Open CASCADE S.A.S (renaud.nedelec@opencascade.com) +dnl +AC_DEFUN([CHECK_OPENCV],[ + +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl + +AC_CHECKING([for OPENCV product]) + +AC_LANG_SAVE +AC_LANG_C + +OPENCV_INCLUDES="" +OPENCV_LIBS="" + +AC_ARG_WITH([opencv], + [ --with-opencv=DIR root directory path of OPENCV installation]) + +opencv_ok=no + +if test "$with_opencv" != "no" ; then + if test "$with_opencv" == "yes" || test "$with_opencv" == "auto"; then + OPENCV_HOME="" + else + OPENCV_HOME="$with_opencv" + fi + + if test "$OPENCV_HOME" == "" ; then + if test "x$OPENCV_INSTALL_DIR" != "x" ; then + OPENCV_HOME=$OPENCV_INSTALL_DIR + fi + fi + + if test "x$OPENCV_HOME" != "x"; then + + LOCAL_INCLUDES="-I$OPENCV_HOME/include -I$OPENCV_HOME/include/opencv" + LOCAL_LIBS="-L$OPENCV_HOME/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann" + + CPPFLAGS_old="$CPPFLAGS" + CXXFLAGS_old="$CXXFLAGS" + CPPFLAGS="$LOCAL_INCLUDES $CPPFLAGS" + CXXFLAGS="$LOCAL_INCLUDES $CXXFLAGS" + + AC_MSG_CHECKING([for OPENCV library]) + + LDFLAGS_old="$LDFLAGS" + LDFLAGS="-L. $LOCAL_LIBS $LDFLAGS" + + LDFLAGS="$LDFLAGS_old" + + opencv_ok=yes + + AC_MSG_RESULT([$opencv_ok]) + + CPPFLAGS="$CPPFLAGS_old" + CXXFLAGS="$CXXFLAGS_old" + + fi +fi + +if test "x$opencv_ok" == xno ; then + AC_MSG_RESULT([for OPENCV: no]) + AC_MSG_WARN([OPENCV includes or libraries are not found or are not properly installed]) + AC_MSG_WARN([Use --with-opencv option to define OPENCV installation.]) +else + OPENCV_INCLUDES=$LOCAL_INCLUDES + OPENCV_LIBS=$LOCAL_LIBS + AC_MSG_RESULT([for OPENCV: yes]) +fi + +AM_CONDITIONAL(WITH_OPENCV, [test x"$opencv_ok" = xyes]) + +AC_SUBST(OPENCV_INCLUDES) +AC_SUBST(OPENCV_LIBS) + +AC_LANG_RESTORE + +])dnl diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index 36ad8c3a7..4f70a7077 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -1,24 +1,30 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +# ============================================================ +# The following is to avoid PACKAGE_... env variable +# redefinition compilation warnings +# ============================================================ # +AM_CXXFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h +AM_CPPFLAGS = @KERNEL_CXXFLAGS@ -include SALOMEconfig.h + # ============================================================ # This file defines the common definitions used in several # Makefile. This file must be included, if needed, by the file diff --git a/bin/Makefile.am b/bin/Makefile.am index 5cc39861e..95a26d150 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Guillaume Boulant (CSSI) # Module : GEOM @@ -28,5 +26,10 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # non-distributed files nodist_salomescript_DATA = VERSION +# python files +dist_salomescript_PYTHON = \ + addvars2notebook_GEOM.py \ + geom_setenv.py + # distributed files dist_salomescript_SCRIPTS = diff --git a/bin/VERSION.in b/bin/VERSION.in index 108ad2265..33c708f57 100755 --- a/bin/VERSION.in +++ b/bin/VERSION.in @@ -1 +1,3 @@ -THIS IS SALOME - GEOM VERSION: @VERSION@ +[SALOME GEOM] : @VERSION@ +[DEVELOPMENT] : @VERSION_DEV@ +[DESCRIPTION] : SALOME Geometry module diff --git a/bin/addvars2notebook_GEOM.py b/bin/addvars2notebook_GEOM.py new file mode 100644 index 000000000..76bc4a012 --- /dev/null +++ b/bin/addvars2notebook_GEOM.py @@ -0,0 +1,68 @@ +# Copyright (C) 2007-2012 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 +# + +def addvars2notebook(filename, vars_and_values): + stream = open(filename) + lines = stream.readlines() + stream.close() + newlines = [] + for line in lines: + if line.find("= geompy.") >= 0: + name = line.split('=')[0] + name = name.strip() + vals = line + fields = vals.split("(") + if len(fields) == 2: + begin = fields[0] + "(" + vals = fields[1] + fields = vals.split(")") + if len(fields) == 2: + vals = fields[0] + end = ")" + fields[1] + vals = vals.split(',') + newline = begin + newvals = [] + for i in range(len(vals)): + valname = name + "_val_%s"%(i+1) + val = vals[i] + vvv = val.strip() + try: + iii = int(vvv) + vars_and_values.append([valname, val]) + val = val.replace(vvv, valname.__repr__()) + except ValueError: + try: + fff = float(vvv) + vars_and_values.append([valname, val]) + val = val.replace(vvv, valname.__repr__()) + except ValueError: + pass + pass + newvals.append(val) + pass + newline += ','.join(newvals) + newline += end + line = newline + pass + pass + pass + newlines.append(line) + pass + content = "".join(newlines) + return content diff --git a/bin/geom_setenv.py b/bin/geom_setenv.py new file mode 100644 index 000000000..dfe3ecab1 --- /dev/null +++ b/bin/geom_setenv.py @@ -0,0 +1,47 @@ +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# + +import os +from salome_utils import getTmpDir, generateFileName, uniteFiles +from setenv import salome_subdir + +# ----------------------------------------------------------------------------- + +def set_env( args ): + """Add to the PATH-variables modules specific paths""" + + tmp_dir = getTmpDir() + env_dir = generateFileName( tmp_dir, prefix="env", with_port=True ) + res_dir = os.path.join( os.getenv( "GEOM_ROOT_DIR" ), "share", salome_subdir, "resources", "geom" ) + + csf_list = ["Plugin", "GEOMDS_Resources", "ShHealing"] + + for csf_file in csf_list: + uniteFiles( os.path.join( res_dir, csf_file ), os.path.join( env_dir, csf_file ) ) + pass + + for csf_string in csf_list: + csf_var = "CSF_" + csf_string + "Defaults" + if not os.getenv( csf_var ): + os.environ[ csf_var ] = env_dir + pass + pass + diff --git a/build_cmake b/build_cmake index e2f5b160c..83f78035a 100755 --- a/build_cmake +++ b/build_cmake @@ -1,26 +1,22 @@ #!/bin/sh -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - CURRENT_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` diff --git a/build_cmake.bat b/build_cmake.bat index 772c3da37..0829ab1f1 100644 --- a/build_cmake.bat +++ b/build_cmake.bat @@ -1,2 +1,20 @@ - +@REM Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +@REM +@REM This library is free software; you can redistribute it and/or +@REM modify it under the terms of the GNU Lesser General Public +@REM License as published by the Free Software Foundation; either +@REM version 2.1 of the License. +@REM +@REM This library is distributed in the hope that it will be useful, +@REM but WITHOUT ANY WARRANTY; without even the implied warranty of +@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +@REM Lesser General Public License for more details. +@REM +@REM You should have received a copy of the GNU Lesser General Public +@REM License along with this library; if not, write to the Free Software +@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +@REM +@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +@REM + %PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --geom diff --git a/build_configure b/build_configure index d8b893183..8d2bef16f 100755 --- a/build_configure +++ b/build_configure @@ -1,25 +1,26 @@ #!/bin/bash -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Tool for updating list of .in file for the SALOME project # and regenerating configure script # Author : Marc Tajchman - CEA @@ -31,7 +32,6 @@ # ORIG_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` -GEOM_WITH_GUI="yes" ######################################################################## # Test if the KERNEL_ROOT_DIR is set correctly @@ -47,62 +47,23 @@ fi # exit #fi -for option -do - case $option in - -with-gui | --with-gui) - GEOM_WITH_GUI="yes" - break;; - -without-gui | --without-gui | -with-gui=no | --with-gui=no) - GEOM_WITH_GUI="no" - break;; - esac -done - ######################################################################## -# Test if the GUI_ROOT_DIR is set correctly -if test ${GEOM_WITH_GUI} = yes; then - if test ! -d "${GUI_ROOT_DIR}"; then - echo "failed : GUI_ROOT_DIR variable is not correct !" - exit - fi -fi cd ${CONF_DIR} ABS_CONF_DIR=`pwd` ####################################################################### -# Update configure.ac script: to set NETGENPLUGIN_WITH_GUI variable -sed -e s/GEOM_WITH_GUI=[a-z]*/GEOM_WITH_GUI=${GEOM_WITH_GUI}/g configure.ac > configure.tmp -mv -f configure.tmp configure.ac - -mkdir -p salome_adm/unix/config_files -#cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/* salome_adm/unix/config_files -#cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/pythonbe.py salome_adm/unix - -cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix - -#cp -f ${GUI_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files - -# remove KERNEL deprecated configure files -#for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \ -# check_mico.m4 config.guess ltmain.sh ac_cxx_bool.m4 ltconfig ac_cxx_typename.m4 \ -# check_pthreads.m4 config.sub libtool.m4 ac_cxx_mutable.m4 missing -# do -# rm -f salome_adm/unix/config_files/${deprecated} -# done - # ____________________________________________________________________ # aclocal creates the aclocal.m4 file from the standard macro and the -# custom macro embedded in the directory salome_adm/unix/config_files -# and KERNEL config_files directory. +# custom macro embedded in the directory adm_local/unix/config_files +# and KERNEL salome_adm/unix/config_files directory. # output: # aclocal.m4 # autom4te.cache (directory) -echo "====================================================== aclocal" +echo "======================================================= aclocal" -if test ${GEOM_WITH_GUI} = yes; then +if test -d "${GUI_ROOT_DIR}"; then aclocal -I adm_local/unix/config_files \ -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1 @@ -117,10 +78,10 @@ fi # version. The files are created in the directory specified with the # AC_CONFIG_AUX_DIR() tag (see configure.ac). # output: -# salome_adm/unix/config_files/config.guess -# salome_adm/unix/config_files/config.sub -# salome_adm/unix/config_files/ltmain.sh -#echo "====================================================== libtoolize" +# adm_local/unix/config_files/config.guess +# adm_local/unix/config_files/config.sub +# adm_local/unix/config_files/ltmain.sh +echo "==================================================== libtoolize" libtoolize --force --copy --automake || exit 1 @@ -140,11 +101,11 @@ autoconf # AC_CONFIG_AUX_DIR() tag (see configure.ac). This step also # creates the Makefile.in files from the Makefile.am files. # output: -# salome_adm/unix/config_files/compile -# salome_adm/unix/config_files/depcomp -# salome_adm/unix/config_files/install-sh -# salome_adm/unix/config_files/missing -# salome_adm/unix/config_files/py-compile +# adm_local/unix/config_files/compile +# adm_local/unix/config_files/depcomp +# adm_local/unix/config_files/install-sh +# adm_local/unix/config_files/missing +# adm_local/unix/config_files/py-compile # Makefile.in (from Makefile.am) echo "====================================================== automake" diff --git a/clean_configure b/clean_configure index f57f7b3bf..6fc5b4f83 100755 --- a/clean_configure +++ b/clean_configure @@ -1,35 +1,41 @@ #!/bin/sh -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + rm -rf autom4te.cache aclocal.m4 configure make_config find . -name "*~" -print -exec rm {} \; find . -name "*.pyc" -print -exec rm {} \; #exit # ==================== ON SORT AVANT +here=`pwd` +libdir=adm_local/unix/config_files +cd $libdir +# Files created by libtoolize +rm -f config.* depcomp install-sh l*.m4 ltmain.sh missing py-compile +# Files created by automake +rm -rf install-sh missing depcomp py-compile +cd $here find bin -name Makefile.in | xargs rm -f find doc -name Makefile.in | xargs rm -f find idl -name Makefile.in | xargs rm -f find resources -name Makefile.in | xargs rm -f -find salome_adm -name Makefile.in | xargs rm -f +find adm_local -name Makefile.in | xargs rm -f find src -name Makefile.in | xargs rm -f rm -f Makefile.in diff --git a/configure.ac b/configure.ac index 9df51f5f8..a5d0afcd9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Author : Marc Tajchman (CEA) # Date : 28/06/2001 # Modified by : Patrick GOLDBRONN (CEA) @@ -26,15 +24,17 @@ # Modified by : Alexander BORODIN (OCN) - autotools usage # Created from configure.in.base # -AC_INIT([Salome2 Project GEOM module], [5.1.0], [webmaster.salome@opencascade.com], [SalomeGEOM]) -AC_CONFIG_AUX_DIR(salome_adm/unix/config_files) +AC_INIT([Salome2 Project GEOM module], [6.5.0], [webmaster.salome@opencascade.com], [SalomeGEOM]) +AC_CONFIG_AUX_DIR(adm_local/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE([tar-pax]) +AM_INIT_AUTOMAKE([tar-pax -Wno-portability]) XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'` AC_SUBST(XVERSION) +VERSION_DEV=1 +AC_SUBST(VERSION_DEV) # set up MODULE_NAME variable for dynamic construction of directories (resources, etc.) MODULE_NAME=geom @@ -82,6 +82,7 @@ echo AC_PROG_MAKE_SET AC_PROG_INSTALL +AC_LOCAL_INSTALL dnl dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques ! @@ -108,7 +109,7 @@ dnl Fix up the INSTALL macro if it s a relative path. We want the dnl full-path to the binary instead. case "$INSTALL" in *install-sh*) - INSTALL='\${ROOT_BUILDDIR}'/salome_adm/unix/config_files/install-sh + INSTALL='\${ROOT_BUILDDIR}'/adm_local/unix/config_files/install-sh ;; esac @@ -147,7 +148,15 @@ dnl testing MPICH dnl --------------------------------------------- dnl -CHECK_MPICH +dnl CHECK_MPICH + +echo +echo --------------------------------------------- +echo testing MPI +echo --------------------------------------------- +echo + +CHECK_MPI echo echo --------------------------------------------- @@ -232,11 +241,34 @@ CORBA=adm_local/unix/$corba fi -GEOM_WITH_GUI=yes +echo +echo --------------------------------------------- +echo Testing GUI +echo --------------------------------------------- +echo + +CHECK_GUI_MODULE -AM_CONDITIONAL(GEOM_ENABLE_GUI, [test "${GEOM_WITH_GUI}" = "yes"]) +gui_ok=no +if test "${SalomeGUI_need}" != "no" -a "${FullGUI_ok}" = "yes" ; then + gui_ok=yes +fi + +AM_CONDITIONAL(GEOM_ENABLE_GUI, [test "${gui_ok}" = "yes"]) + +if test "${SalomeGUI_need}" == "yes"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(For configure GEOM module necessary full GUI!) + fi +elif test "${SalomeGUI_need}" == "auto"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(Full GUI not found. Build will be done without GUI!) + fi +elif test "${SalomeGUI_need}" == "no"; then + echo Build without GUI option has been chosen +fi -if test "${GEOM_WITH_GUI}" = "yes"; then +if test "${gui_ok}" = "yes"; then echo echo --------------------------------------------- echo testing openGL @@ -252,35 +284,15 @@ if test "${GEOM_WITH_GUI}" = "yes"; then echo CHECK_QT +fi - echo - echo --------------------------------------------- - echo testing VTK - echo --------------------------------------------- - echo - - CHECK_VTK - - echo - echo --------------------------------------------- - echo Testing GUI - echo --------------------------------------------- - echo - - CHECK_SALOME_GUI - - echo - echo --------------------------------------------- - echo Testing full GUI - echo --------------------------------------------- - echo +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo - CHECK_CORBA_IN_GUI - if test "x${CORBA_IN_GUI}" != "xyes"; then - echo "failed : For configure GEOM module necessary full GUI !" - exit - fi -fi +CHECK_VTK echo echo --------------------------------------------- @@ -314,6 +326,24 @@ echo CHECK_HTML_GENERATORS +echo +echo --------------------------------------------- +echo testing sphinx +echo --------------------------------------------- +echo +CHECK_SPHINX + +echo +echo --------------------------------------------- +echo testing Opencv +echo --------------------------------------------- +echo +CHECK_OPENCV +if test "${opencv_ok}" = "yes"; then + AC_DEFINE_UNQUOTED(WITH_OPENCV,${WITH_OPENCV}) +fi + + echo echo --------------------------------------------- echo Testing Kernel @@ -328,23 +358,77 @@ echo Summary echo --------------------------------------------- echo -echo Configure +if test "${SalomeGUI_need}" == "no"; then + echo "* Configuration options (without GUI):" +else + echo "* Configuration options:" +fi +echo + +obligatory_vars="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok" +optional_vars="opencv_ok" +gui_vars="OpenGL_ok qt_ok gui_ok" + +### +# mandatory products +### + +echo "--- Mandatory products:" + +missing_obligatory=no +for var in $obligatory_vars +do + eval toto=\$$var + if test x$toto == "x"; then toto="no" ; fi + if test x$toto == "xno"; then missing_obligatory=yes ; fi + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$$var + #fi +done +if test x$missing_obligatory == "xyes"; then + AC_MSG_ERROR([one or more obligatory product is missing]) +fi + +### +# gui products +### -if test "${GEOM_WITH_GUI}" = "yes"; then -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok SalomeGUI_ok" +if test "${SalomeGUI_need}" == "yes"; then + # SALOME GUI is mandatory + if test "${gui_ok}" != "yes"; then + AC_MSG_ERROR([SALOME GUI is missing]) + fi fi -if test "${GEOM_WITH_GUI}" = "no"; then -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" + +if test "${SalomeGUI_need}" != "no"; then + echo "--- GUI products (optional):" + + for var in $gui_vars + do + eval toto=\$$var + if test x$toto == "x"; then toto="no"; fi + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$toto + done fi -for var in $variables +### +# optional products +### + +echo "--- Other products (optional):" + +for var in $optional_vars do - printf " %10s : " `echo \$var | sed -e "s,_ok,,"` - eval echo \$$var + eval toto=\$$var + if test x$toto != "x"; then + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$$var + fi done echo -echo "Default ORB : $DEFAULT_ORB" +echo "* Default ORB : $DEFAULT_ORB" echo dnl We don t need to say when we re entering directories if we re using @@ -365,69 +449,94 @@ echo # chmod +x ./bin/*; \ #]) +AC_HACK_LIBTOOL +AC_CONFIG_COMMANDS([hack_libtool],[ +sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\ + $(pwd)/hack_libtool \1 \"\$[@]\" \n\ +}\n\ +CC=\"hack_libtool\"%g" libtool +sed -i "s%\(\s*\)for searchdir in \$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path; do%\1searchdirs=\"\$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path\"\n\1for searchdir in \$searchdirs; do%g" libtool +sed -i "s%\(\s*\)searchdirs=\"\$newlib_search_path \$lib_search_path \(.*\)\"%\1searchdirs=\"\$newlib_search_path \$lib_search_path\"\n\1sss_beg=\"\"\n\1sss_end=\"\2\"%g" libtool +sed -i "s%\(\s*\)\(for searchdir in \$searchdirs; do\)%\1for sss in \$searchdirs; do\n\1 if ! test -d \$sss; then continue; fi\n\1 ssss=\$(cd \$sss; pwd)\n\1 if test \"\$ssss\" != \"\" \&\& test -d \$ssss; then\n\1 case \$ssss in\n\1 /usr/lib | /usr/lib64 ) ;;\n\1 * ) sss_beg=\"\$sss_beg \$ssss\" ;;\n\1 esac\n\1 fi\n\1done\n\1searchdirs=\"\$sss_beg \$sss_end\"\n\1\2%g" libtool +],[]) + # This list is initiated using autoscan and must be updated manually # when adding a new file .in to manage. When you execute # autoscan, the Makefile list is generated in the output file configure.scan. # This could be helpfull to update de configuration. AC_OUTPUT([ \ - ./salome_adm/unix/SALOMEconfig.h \ - ./adm_local/Makefile \ - ./adm_local/unix/Makefile \ - ./adm_local/unix/config_files/Makefile \ - ./bin/VERSION \ - ./bin/Makefile \ - ./GEOM_version.h \ - ./doc/Makefile \ - ./doc/salome/Makefile \ - ./doc/salome/gui/Makefile \ - ./doc/salome/gui/GEOM/Makefile \ - ./doc/salome/gui/GEOM/doxyfile \ - ./doc/salome/gui/GEOM/doxyfile_py \ - ./doc/salome/gui/GEOM/doxyfile_tui \ - ./doc/salome/tui/Makefile \ - ./doc/salome/tui/doxyfile \ - ./src/Makefile \ - ./src/ARCHIMEDE/Makefile \ - ./src/BREPExport/Makefile \ - ./src/BREPImport/Makefile \ - ./src/BasicGUI/Makefile \ - ./src/BlocksGUI/Makefile \ - ./src/BooleanGUI/Makefile \ - ./src/BuildGUI/Makefile \ - ./src/DisplayGUI/Makefile \ - ./src/DlgRef/Makefile \ - ./src/EntityGUI/Makefile \ - ./src/GEOM/Makefile \ - ./src/GEOMAlgo/Makefile \ - ./src/GEOMBase/Makefile \ - ./src/GEOMClient/Makefile \ - ./src/GEOMFiltersSelection/Makefile \ - ./src/GEOMGUI/Makefile \ - ./src/GEOMImpl/Makefile \ - ./src/GEOMToolsGUI/Makefile \ - ./src/GEOM_I/Makefile \ - ./src/GEOM_I_Superv/Makefile \ - ./src/GEOM_SWIG/Makefile \ - ./src/GEOM_SWIG_WITHIHM/Makefile \ - ./src/GenerationGUI/Makefile \ - ./src/GroupGUI/Makefile \ - ./src/IGESExport/Makefile \ - ./src/IGESImport/Makefile \ - ./src/MeasureGUI/Makefile \ - ./src/NMTDS/Makefile \ - ./src/NMTTools/Makefile \ - ./src/OBJECT/Makefile \ - ./src/OperationGUI/Makefile \ - ./src/PrimitiveGUI/Makefile \ - ./src/RepairGUI/Makefile \ - ./src/SKETCHER/Makefile \ - ./src/STEPExport/Makefile \ - ./src/STEPImport/Makefile \ - ./src/STLExport/Makefile \ - ./src/ShHealOper/Makefile \ - ./src/TransformationGUI/Makefile \ - ./resources/Makefile \ - ./resources/GEOMCatalog.xml \ - ./idl/Makefile \ + adm_local/Makefile \ + adm_local/cmake_files/Makefile \ + adm_local/unix/Makefile \ + adm_local/unix/config_files/Makefile \ + bin/VERSION \ + bin/Makefile \ + GEOM_version.h \ + doc/Makefile \ + doc/docutils/Makefile \ + doc/docutils/conf.py \ + doc/salome/Makefile \ + doc/salome/gui/Makefile \ + doc/salome/gui/GEOM/Makefile \ + doc/salome/gui/GEOM/doxyfile \ + doc/salome/gui/GEOM/doxyfile_py \ + doc/salome/gui/GEOM/doxyfile_tui \ + doc/salome/gui/GEOM/static/header.html \ + doc/salome/gui/GEOM/static/header_py.html \ + doc/salome/tui/Makefile \ + doc/salome/tui/doxyfile \ + doc/salome/tui/static/header.html \ + src/Makefile \ + src/AdvancedGUI/Makefile \ + src/ARCHIMEDE/Makefile \ + src/BREPExport/Makefile \ + src/BREPImport/Makefile \ + src/BasicGUI/Makefile \ + src/BlocksGUI/Makefile \ + src/BooleanGUI/Makefile \ + src/BuildGUI/Makefile \ + src/DisplayGUI/Makefile \ + src/DlgRef/Makefile \ + src/EntityGUI/Makefile \ + src/GEOM/Makefile \ + src/GEOMAlgo/Makefile \ + src/GEOMBase/Makefile \ + src/GEOMClient/Makefile \ + src/GEOMFiltersSelection/Makefile \ + src/Material/Makefile \ + src/GEOMGUI/Makefile \ + src/GEOMImpl/Makefile \ + src/GEOMToolsGUI/Makefile \ + src/GEOM_I/Makefile \ + src/GEOM_I_Superv/Makefile \ + src/GEOM_SWIG/Makefile \ + src/GEOM_SWIG_WITHIHM/Makefile \ + src/GEOM_PY/Makefile \ + src/GEOM_PY/structelem/Makefile \ + src/GenerationGUI/Makefile \ + src/GroupGUI/Makefile \ + src/IGESExport/Makefile \ + src/IGESImport/Makefile \ + src/MeasureGUI/Makefile \ + src/NMTDS/Makefile \ + src/NMTTools/Makefile \ + src/OBJECT/Makefile \ + src/OCC2VTK/Makefile \ + src/OperationGUI/Makefile \ + src/PrimitiveGUI/Makefile \ + src/RepairGUI/Makefile \ + src/SKETCHER/Makefile \ + src/STEPExport/Makefile \ + src/STEPImport/Makefile \ + src/STLExport/Makefile \ + src/ShHealOper/Makefile \ + src/ShapeRecognition/Makefile \ + src/TransformationGUI/Makefile \ + src/VTKExport/Makefile \ + resources/Makefile \ + resources/GEOMCatalog.xml \ + resources/SalomeApp.xml \ + resources/Plugin \ + idl/Makefile \ Makefile \ ]) diff --git a/doc/Makefile.am b/doc/Makefile.am index 1902d9d21..8f3319cec 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,32 +1,29 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 30/11/2001 # Modified by : Alexander BORODIN (OCN) - autotools usage -# $Header$ -# source path # -SUBDIRS = salome +SUBDIRS = salome docutils +#SUBDIRS = salome usr_docs: (cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs) diff --git a/doc/docutils/Makefile.am b/doc/docutils/Makefile.am new file mode 100644 index 000000000..a1dd57ced --- /dev/null +++ b/doc/docutils/Makefile.am @@ -0,0 +1,97 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 $(top_srcdir)/adm_local/unix/make_common_starter.am + +pydocdir = $(docdir)/tui/GEOM/docutils + +RSTFILES = \ + index.rst \ + overview.rst \ + docapi.rst + +EXTRA_DIST += images $(RSTFILES) + +SPHINXOPTS = +SOURCEDIR = $(srcdir) +SPHINXBUILD = sphinx-build +PAPEROPT_a4 = -D latex_paper_size=a4 +ALLSPHINXOPTS = -d doctrees $(PAPEROPT_a4) $(SPHINXOPTS) $(SOURCEDIR) + +if GEOM_ENABLE_GUI +SPHINX_PYTHONPATH = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(GUI_ROOT_DIR)/lib/salome:$(GUI_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GUI_ROOT_DIR)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages +else !GEOM_ENABLE_GUI +SPHINX_PYTHONPATH = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages +endif + +if GEOM_ENABLE_GUI +SPHINX_LD_LIBRARY_PATH = $(GUI_ROOT_DIR)/lib/salome:$(KERNEL_ROOT_DIR)/lib/salome:$(OMNIORB_ROOT)/lib +else !GEOM_ENABLE_GUI +SPHINX_LD_LIBRARY_PATH = $(KERNEL_ROOT_DIR)/lib/salome:$(OMNIORB_ROOT)/lib +endif + + +.PHONY: latex + +if SPHINX_IS_OK + +html/index.html:$(RSTFILES) + mkdir -p html doctrees + PYTHONPATH=$(SPHINX_PYTHONPATH):${PYTHONPATH} \ + LD_LIBRARY_PATH=$(SPHINX_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} \ + $(SPHINXBUILD) -c $(top_builddir)/doc/docutils -W -b html $(ALLSPHINXOPTS) html + @echo + @echo "Build finished. The HTML pages are in html." + +else + +html/index.html: + @echo "Documentation for Python package not built. Sphinx was not present at configure time." + +endif + +latex: + mkdir -p latex doctrees + PYTHONPATH=$(SPHINX_PYTHONPATH):${PYTHONPATH} \ + LD_LIBRARY_PATH=$(SPHINX_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} \ + $(SPHINXBUILD) -c $(top_builddir)/doc/docutils -W -b latex $(ALLSPHINXOPTS) latex + @echo + @echo "Build finished; the LaTeX files are in latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +install-data-local: html/index.html + test -z $(pydocdir) || mkdir -p $(DESTDIR)$(pydocdir) + if test -d "html"; then b=; else b="$(srcdir)/"; fi; \ + cp -rf $$b"html"/* $(pydocdir) ; \ + if test -f $$b"latex"/geompy.pdf; then cp -f $$b"latex"/geompy.pdf $(pydocdir) ; fi; + +uninstall-local: + -test -d $(pydocdir) && chmod -R +w $(pydocdir) && rm -rf $(pydocdir)/* + +clean-local: + -rm -rf html latex doctrees + if test -d "html"; then rm -rf html ; fi + +dist-hook: + -test -d html && cp -Rp html $(distdir) diff --git a/doc/docutils/conf.py.in b/doc/docutils/conf.py.in new file mode 100644 index 000000000..ab0f94d07 --- /dev/null +++ b/doc/docutils/conf.py.in @@ -0,0 +1,200 @@ +# -*- coding: iso-8859-1 -*- +# +# yacs documentation build configuration file, created by +# sphinx-quickstart on Fri Aug 29 09:57:25 2008. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# The contents of this file are pickled, so don't put values in the namespace +# that aren't pickleable (module imports are okay, they're removed automatically). +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If your extensions are in another directory, add it here. If the directory +# is relative to the documentation root, use os.path.abspath to make it +# absolute, like shown here. +#sys.path.append(os.path.abspath('.')) + +# General configuration +# --------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc'] + +# Uncomment the following line to build the links with Python documentation +# (you might need to set http_proxy environment variable for this to work) +#extensions += ['sphinx.ext.intersphinx'] + +# Intersphinx mapping to add links to modules and objects in the Python +# standard library documentation +intersphinx_mapping = {'http://docs.python.org': None} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +source_encoding = 'utf-8' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'GEOM python packages' +copyright = '2010 EDF R&D' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '@VERSION@' +# The full version, including alpha/beta/rc tags. +release = '@VERSION@' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +language = 'en' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = ['.build','ref','images','CVS','.svn'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# Options for HTML output +# ----------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'default' +#html_theme = 'nature' +#html_theme = 'agogo' +#html_theme = 'sphinxdoc' +#html_theme = 'omadoc' + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = ['themes'] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +#html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +html_use_modindex = False + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, the reST sources are included in the HTML build as _sources/. +html_copy_source = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'geompydoc' + + +# Options for LaTeX output +# ------------------------ + +# The paper size ('letter' or 'a4'). +latex_paper_size = 'a4' + +# The font size ('10pt', '11pt' or '12pt'). +latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, document class [howto/manual]). +latex_documents = [ + ('index', 'geompy.tex', 'Documentation of the GEOM python packages', 'EDF R\&D', 'manual') +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +latex_logo = '@srcdir@/../salome/tui/images/head.png' + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = True + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +latex_use_modindex = False diff --git a/doc/docutils/docapi.rst b/doc/docutils/docapi.rst new file mode 100644 index 000000000..6f9140b05 --- /dev/null +++ b/doc/docutils/docapi.rst @@ -0,0 +1,52 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + Documentation of the programming interface (API) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +This section describes the python packages and modules of the +``salome.geom`` python package. The main part is generated from the +code documentation included in source python files. + +:mod:`salome.geom` -- Package containing the GEOM python utilities +================================================================== + +:mod:`geomtools` -- Tools to access GEOM engine and objects +----------------------------------------------------------- + +.. automodule:: salome.geom.geomtools + :members: + +:mod:`sketcher` -- Wrapper to help the creation of simple sketches +------------------------------------------------------------------ + +.. automodule:: salome.geom.sketcher + :members: + +.. autoclass:: Sketcher + :members: + +:mod:`structelem` -- Structural elements package +------------------------------------------------ + +.. automodule:: salome.geom.structelem + +.. autoclass:: StructuralElementManager + :members: + +.. autoclass:: StructuralElement + :members: + +:mod:`structelem.parts` -- Structural element parts +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: salome.geom.structelem.parts + :members: + :undoc-members: + :show-inheritance: + +:mod:`structelem.orientation` -- Structural element orientation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: salome.geom.structelem.orientation + :members: + :undoc-members: diff --git a/doc/docutils/images/salome-geom-structuralelements.png b/doc/docutils/images/salome-geom-structuralelements.png new file mode 100644 index 000000000..9c05f7ecd Binary files /dev/null and b/doc/docutils/images/salome-geom-structuralelements.png differ diff --git a/doc/docutils/index.rst b/doc/docutils/index.rst new file mode 100644 index 000000000..2a0233d4e --- /dev/null +++ b/doc/docutils/index.rst @@ -0,0 +1,11 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + Documentation of the GEOM python package +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +.. toctree:: + :maxdepth: 3 + + overview.rst + docapi.rst + diff --git a/doc/docutils/overview.rst b/doc/docutils/overview.rst new file mode 100644 index 000000000..c74a0aaed --- /dev/null +++ b/doc/docutils/overview.rst @@ -0,0 +1,75 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +General presentation of the GEOM python package +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The GEOM python package essentially contains: + +* Utility functions to handle GEOM items in Salome study (see ``geomtools.py``). + + - add a shape to a study, remove from the study + - display a shape in a viewer, erase the shape from the viewers + - completly delete a shape (undisplay, unpublish, and destroy the shape) + - helper functions to manage the selection in the object browser +* Wrapping functions to help the usage of GEOM tools: + + - a sketcher module to create sketches from the python API (see + ``sketcher.py``) +* The visualization of structural elements: a function to create + geometrical 3D representations of mechanical models called + "structural elements" (see package ``structelem``) + +The functions are distributed in the python package +``salome.geom``. The specification of the programming interface of +this package is detailled in the part :doc:`Documentation of the +programming interface (API)` of this documentation. + +.. note:: + The main package ``salome`` contains other sub-packages that are + distributed with the other SALOME modules. For example, the KERNEL + module provides the python package ``salome.kernel`` and SMESH the + package ``salome.smesh``. + +Visualization of structural elements (package ``structelem``) +------------------------------------------------------------- + +The usage of the visualization of structural elements can be +appreciated with this set of instructions: + +.. code-block:: python + + from salome.geom.structelem import TEST_StructuralElement + TEST_StructuralElement() + +This creates the geometrical objects displayed in the study below: + +.. image:: /images/salome-geom-structuralelements.png + :align: center + +Manipulate GEOM object in the study (module ``geomtools``) +---------------------------------------------------------- + +The usage of the ``geomtools`` module can be appreciated with this set +of instructions: + +.. code-block:: python + + from salome.geom.geomtools import TEST_createAndDeleteShape + TEST_createAndDeleteShape() + +This test executes the following procedure: + +* Create, publish, and display a cylinder +* Create, publish, and display a sphere +* Create a box, publish it in a folder "boxset", and display it with a + "pink" color. +* Erase the sphere from the viewer (the sphere still exists in the study) +* Delete the cylinder (the cylinder is no longer displayed and does + not exist any more, neither in the study nor the GEOM componet. + +At the end of the execution of this test, you should have in the +SALOME session: + +* the box, in a dedicated folder of the study, and displayed in the + viewer +* the sphere, in the standard place of the study, and not displayed diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index 5a92861e5..8bf9f392d 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 30/11/2001 diff --git a/doc/salome/gui/GEOM/Makefile.am b/doc/salome/gui/GEOM/Makefile.am index 88bb9710f..3b96e0abd 100755 --- a/doc/salome/gui/GEOM/Makefile.am +++ b/doc/salome/gui/GEOM/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Vasily Rusyaev (Open Cascade NN) # Modified by : Alexander BORODIN (OCN) - autotools usage @@ -26,15 +24,16 @@ # include $(top_srcdir)/adm_local/unix/make_common_starter.am -EXTRA_DIST += images input static +EXTRA_DIST += images input static/footer.html static/doxygen.css static/SALOME_BOA_PA.pdf + +guidocdir = $(docdir)/gui/GEOM +guidoc_DATA = images/head.png static/SALOME_BOA_PA.pdf -usr_docs: doxyfile_tui doxyfile_py doxyfile +usr_docs: doxyfile_tui doxyfile_py doxyfile echo "===========================================" ; \ echo "Replacing geompyDC by geompy" ; \ echo "===========================================" ; \ - sed -e "/class geompyDC/d" -e "s/^ *#/#/g" -e "s/^ *def /def /g" \ - -e "s/geompyDC/geompy/g" $(top_srcdir)/src/GEOM_SWIG/geompyDC.py > \ - $(top_builddir)/src/GEOM_SWIG/geompy.py ; \ + $(KERNEL_ROOT_DIR)/bin/salome/prepare_generating_doc.py geompy.py $(top_srcdir)/src/GEOM_SWIG/geompyDC.py geompy ; \ echo "===========================================" ; \ echo "Generating examples documentation" ; \ echo "===========================================" ; \ @@ -46,30 +45,33 @@ usr_docs: doxyfile_tui doxyfile_py doxyfile echo "===========================================" ; \ echo "Generating GUI documentation" ; \ echo "===========================================" ; \ - $(DOXYGEN) doxyfile ; \ - rm -f $(top_builddir)/src/GEOM_SWIG/geompy.py + $(DOXYGEN) doxyfile ; \ + rm -f ./geompy.py docs: usr_docs clean-local: - @for filen in `find . -maxdepth 1` ; do \ + @for filen in `find . -maxdepth 1` ; do \ case $${filen} in \ - ./Makefile | ./doxyfile | ./doxyfile_py | ./doxyfile_tui ) ;; \ - . | .. ) ;; \ + ./Makefile* | ./doxyfile* | ./images | ./input | ./static ) ;; \ + . | .. | ./CVS ) ;; \ *) echo "Removing $${filen}" ; rm -rf $${filen} ;; \ esac ; \ done ; install-data-local: usr_docs - $(INSTALL) -d $(DESTDIR)$(docdir)/gui/GEOM - @for filen in `find . -maxdepth 1` ; do \ + @if [ -e index.html ]; then \ + $(INSTALL) -d $(DESTDIR)$(docdir)/gui/GEOM ; \ + for filen in `find . -maxdepth 1` ; do \ case $${filen} in \ - ./Makefile | ./doxyfile | ./doxyfile_py | ./doxyfile_tui ) ;; \ - ./doxyfile.bak | ./doxyfile_py.bak | ./doxyfile_tui.bak ) ;; \ - . | .. ) ;; \ + ./Makefile* | ./doxyfile* ) ;; \ + . | .. | ./static ) ;; \ *) echo "Installing $${filen}" ; cp -rp $${filen} $(DESTDIR)$(docdir)/gui/GEOM ;; \ esac ; \ - done ; + done ; \ + cp -rp $(srcdir)/images/head.png $(DESTDIR)$(docdir)/gui/GEOM/geompy_doc ; \ + fi + uninstall-local: rm -rf $(DESTDIR)$(docdir)/gui/GEOM diff --git a/doc/salome/gui/GEOM/doxyfile.in b/doc/salome/gui/GEOM/doxyfile.in index cc7de8625..06d9bfd86 100755 --- a/doc/salome/gui/GEOM/doxyfile.in +++ b/doc/salome/gui/GEOM/doxyfile.in @@ -1,29 +1,29 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "Geometry Module Reference Manual v.@VERSION@" +PROJECT_NAME = "SALOME Geometry User's Guide" OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English @@ -40,6 +40,7 @@ WARNINGS = YES #--------------------------------------------------------------------------- INPUT = @srcdir@/input FILE_PATTERNS = *.doc +EXCLUDE_PATTERNS = creating_adv_obj.doc EXCLUDE = IMAGE_PATH = @srcdir@/images EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG @@ -49,14 +50,20 @@ EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = . -HTML_HEADER = @srcdir@/static/header.html +HTML_HEADER = @builddir@/static/header.html HTML_FOOTER = @srcdir@/static/footer.html -#HTML_STYLESHEET = @srcdir@/static/doxygen.css +HTML_STYLESHEET = @srcdir@/static/doxygen.css TOC_EXPAND = YES DISABLE_INDEX = NO GENERATE_TREEVIEW = YES +SEARCHENGINE = YES TREEVIEW_WIDTH = 300 +#--------------------------------------------------------------------------- +#SORT related options +#--------------------------------------------------------------------------- +SORT_GROUP_NAMES = NO + #--------------------------------------------------------------------------- #LaTeX related option #--------------------------------------------------------------------------- @@ -69,6 +76,8 @@ GENERATE_RTF = NO #--------------------------------------------------------------------------- #External reference options -#--------------------------------------------------------------------------- -TAGFILES = geompy_doc.tag=geompy_doc +#--------------------------------------------------------------------------- +TAGFILES = geompy_doc.tag=../GEOM/geompy_doc #rnv: 07.04.2011 Workaround for the doxygen 1.7.3: + #because it wrongly defines location of the html files for search. ALLEXTERNALS = NO +SEARCHENGINE = YES diff --git a/doc/salome/gui/GEOM/doxyfile_py.in b/doc/salome/gui/GEOM/doxyfile_py.in index efa355dfc..c35ee2024 100755 --- a/doc/salome/gui/GEOM/doxyfile_py.in +++ b/doc/salome/gui/GEOM/doxyfile_py.in @@ -1,35 +1,35 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "Geometry Module Reference Manual v.@VERSION@" +PROJECT_NAME = "SALOME Geometry User's Guide" OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = NO +REPEAT_BRIEF = YES ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = YES FULL_PATH_NAMES = NO @@ -99,8 +99,8 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = @top_builddir@/src/GEOM_SWIG -FILE_PATTERNS = geompy.py +INPUT = . @top_srcdir@/idl +FILE_PATTERNS = geompy.py GEOM_Gen.idl IMAGE_PATH = @srcdir@/images EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG RECURSIVE = NO @@ -110,11 +110,11 @@ RECURSIVE = NO #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = geompy_doc -HTML_HEADER = @srcdir@/static/header.html +HTML_HEADER = @builddir@/static/header_py.html HTML_FOOTER = @srcdir@/static/footer.html -#HTML_STYLESHEET = @srcdir@/static/doxygen.css +HTML_STYLESHEET = @srcdir@/static/doxygen.css TOC_EXPAND = YES -DISABLE_INDEX = YES +DISABLE_INDEX = NO GENERATE_TREEVIEW = NO #--------------------------------------------------------------------------- @@ -159,3 +159,4 @@ DOT_CLEANUP = YES #--------------------------------------------------------------------------- GENERATE_TAGFILE = geompy_doc.tag TAGFILES = tui_examples.tag=.. +SEARCHENGINE = YES diff --git a/doc/salome/gui/GEOM/doxyfile_tui.in b/doc/salome/gui/GEOM/doxyfile_tui.in index e324105c0..9617a169d 100755 --- a/doc/salome/gui/GEOM/doxyfile_tui.in +++ b/doc/salome/gui/GEOM/doxyfile_tui.in @@ -1,29 +1,29 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "Geometry Module Reference Manual v.@VERSION@" +PROJECT_NAME = "SALOME Geometry User's Guide" OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English @@ -48,12 +48,12 @@ EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = . -HTML_HEADER = @srcdir@/static/header.html +HTML_HEADER = @builddir@/static/header.html HTML_FOOTER = @srcdir@/static/footer.html -#HTML_STYLESHEET = @srcdir@/static/doxygen.css +HTML_STYLESHEET = @srcdir@/static/doxygen.css TOC_EXPAND = YES DISABLE_INDEX = NO -GENERATE_TREEVIEW = YES +GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 300 #--------------------------------------------------------------------------- @@ -70,3 +70,4 @@ GENERATE_RTF = NO #External reference options #--------------------------------------------------------------------------- GENERATE_TAGFILE = tui_examples.tag +SEARCHENGINE = YES diff --git a/doc/salome/gui/GEOM/images/arc_icon.png b/doc/salome/gui/GEOM/images/arc_icon.png new file mode 100644 index 000000000..074c67dea Binary files /dev/null and b/doc/salome/gui/GEOM/images/arc_icon.png differ diff --git a/doc/salome/gui/GEOM/images/archimede.png b/doc/salome/gui/GEOM/images/archimede.png index 4ee2ee9b6..52fdaccd7 100755 Binary files a/doc/salome/gui/GEOM/images/archimede.png and b/doc/salome/gui/GEOM/images/archimede.png differ diff --git a/doc/salome/gui/GEOM/images/bool1.png b/doc/salome/gui/GEOM/images/bool1.png index 4cee18f8c..5dac3ca24 100755 Binary files a/doc/salome/gui/GEOM/images/bool1.png and b/doc/salome/gui/GEOM/images/bool1.png differ diff --git a/doc/salome/gui/GEOM/images/bool2.png b/doc/salome/gui/GEOM/images/bool2.png index bf027eb3a..a14fec4e8 100755 Binary files a/doc/salome/gui/GEOM/images/bool2.png and b/doc/salome/gui/GEOM/images/bool2.png differ diff --git a/doc/salome/gui/GEOM/images/bool3.png b/doc/salome/gui/GEOM/images/bool3.png index 91fffb130..1e8941a3c 100755 Binary files a/doc/salome/gui/GEOM/images/bool3.png and b/doc/salome/gui/GEOM/images/bool3.png differ diff --git a/doc/salome/gui/GEOM/images/box3.png b/doc/salome/gui/GEOM/images/box3.png index b64fdf983..a53e05d1a 100755 Binary files a/doc/salome/gui/GEOM/images/box3.png and b/doc/salome/gui/GEOM/images/box3.png differ diff --git a/doc/salome/gui/GEOM/images/chamfer1.png b/doc/salome/gui/GEOM/images/chamfer1.png index d5cbde120..3276f2669 100755 Binary files a/doc/salome/gui/GEOM/images/chamfer1.png and b/doc/salome/gui/GEOM/images/chamfer1.png differ diff --git a/doc/salome/gui/GEOM/images/chamfer2.png b/doc/salome/gui/GEOM/images/chamfer2.png index 65c563221..ca8e2fecf 100755 Binary files a/doc/salome/gui/GEOM/images/chamfer2.png and b/doc/salome/gui/GEOM/images/chamfer2.png differ diff --git a/doc/salome/gui/GEOM/images/chamfer3.png b/doc/salome/gui/GEOM/images/chamfer3.png index e0af355ac..467b4c425 100755 Binary files a/doc/salome/gui/GEOM/images/chamfer3.png and b/doc/salome/gui/GEOM/images/chamfer3.png differ diff --git a/doc/salome/gui/GEOM/images/chamfer4.png b/doc/salome/gui/GEOM/images/chamfer4.png index 74d5bd54a..9c9282bb5 100755 Binary files a/doc/salome/gui/GEOM/images/chamfer4.png and b/doc/salome/gui/GEOM/images/chamfer4.png differ diff --git a/doc/salome/gui/GEOM/images/change_direction.png b/doc/salome/gui/GEOM/images/change_direction.png new file mode 100644 index 000000000..fb34fedda Binary files /dev/null and b/doc/salome/gui/GEOM/images/change_direction.png differ diff --git a/doc/salome/gui/GEOM/images/compound2.png b/doc/salome/gui/GEOM/images/compound2.png new file mode 100644 index 000000000..f49c63e06 Binary files /dev/null and b/doc/salome/gui/GEOM/images/compound2.png differ diff --git a/doc/salome/gui/GEOM/images/contour_detect_snapshot.png b/doc/salome/gui/GEOM/images/contour_detect_snapshot.png new file mode 100644 index 000000000..1c95bb74f Binary files /dev/null and b/doc/salome/gui/GEOM/images/contour_detect_snapshot.png differ diff --git a/doc/salome/gui/GEOM/images/contour_detection_example2.png b/doc/salome/gui/GEOM/images/contour_detection_example2.png new file mode 100644 index 000000000..4ed9396cf Binary files /dev/null and b/doc/salome/gui/GEOM/images/contour_detection_example2.png differ diff --git a/doc/salome/gui/GEOM/images/curve.png b/doc/salome/gui/GEOM/images/curve.png index b9af501eb..53582446f 100755 Binary files a/doc/salome/gui/GEOM/images/curve.png and b/doc/salome/gui/GEOM/images/curve.png differ diff --git a/doc/salome/gui/GEOM/images/curve1.png b/doc/salome/gui/GEOM/images/curve1.png new file mode 100644 index 000000000..56ffbeb33 Binary files /dev/null and b/doc/salome/gui/GEOM/images/curve1.png differ diff --git a/doc/salome/gui/GEOM/images/curve2.png b/doc/salome/gui/GEOM/images/curve2.png new file mode 100644 index 000000000..a9dd3f0f7 Binary files /dev/null and b/doc/salome/gui/GEOM/images/curve2.png differ diff --git a/doc/salome/gui/GEOM/images/curve3.png b/doc/salome/gui/GEOM/images/curve3.png new file mode 100644 index 000000000..7d711c2f3 Binary files /dev/null and b/doc/salome/gui/GEOM/images/curve3.png differ diff --git a/doc/salome/gui/GEOM/images/curve4.png b/doc/salome/gui/GEOM/images/curve4.png new file mode 100644 index 000000000..cbb60924d Binary files /dev/null and b/doc/salome/gui/GEOM/images/curve4.png differ diff --git a/doc/salome/gui/GEOM/images/custom_point_marker.png b/doc/salome/gui/GEOM/images/custom_point_marker.png new file mode 100755 index 000000000..a71625ecd Binary files /dev/null and b/doc/salome/gui/GEOM/images/custom_point_marker.png differ diff --git a/doc/salome/gui/GEOM/images/deflection_0001.png b/doc/salome/gui/GEOM/images/deflection_0001.png new file mode 100644 index 000000000..bc9895803 Binary files /dev/null and b/doc/salome/gui/GEOM/images/deflection_0001.png differ diff --git a/doc/salome/gui/GEOM/images/deflection_001.png b/doc/salome/gui/GEOM/images/deflection_001.png new file mode 100644 index 000000000..84b35cb6d Binary files /dev/null and b/doc/salome/gui/GEOM/images/deflection_001.png differ diff --git a/doc/salome/gui/GEOM/images/dialog.png b/doc/salome/gui/GEOM/images/dialog.png index 53a2f41b5..09459032f 100755 Binary files a/doc/salome/gui/GEOM/images/dialog.png and b/doc/salome/gui/GEOM/images/dialog.png differ diff --git a/doc/salome/gui/GEOM/images/divided_disk.png b/doc/salome/gui/GEOM/images/divided_disk.png new file mode 100644 index 000000000..fe0868d9e Binary files /dev/null and b/doc/salome/gui/GEOM/images/divided_disk.png differ diff --git a/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png b/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png new file mode 100644 index 000000000..c57f8f6b5 Binary files /dev/null and b/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/divided_disk_dlg.png b/doc/salome/gui/GEOM/images/divided_disk_dlg.png new file mode 100644 index 000000000..3a8b8baad Binary files /dev/null and b/doc/salome/gui/GEOM/images/divided_disk_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/dividedcylinder.png b/doc/salome/gui/GEOM/images/dividedcylinder.png new file mode 100644 index 000000000..e84ecf06a Binary files /dev/null and b/doc/salome/gui/GEOM/images/dividedcylinder.png differ diff --git a/doc/salome/gui/GEOM/images/dividedcylinder_dlg.png b/doc/salome/gui/GEOM/images/dividedcylinder_dlg.png new file mode 100644 index 000000000..95b96d00e Binary files /dev/null and b/doc/salome/gui/GEOM/images/dividedcylinder_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/draft.png b/doc/salome/gui/GEOM/images/draft.png new file mode 100644 index 000000000..d99c8a605 Binary files /dev/null and b/doc/salome/gui/GEOM/images/draft.png differ diff --git a/doc/salome/gui/GEOM/images/edge1.png b/doc/salome/gui/GEOM/images/edge1.png new file mode 100644 index 000000000..1ef12aecb Binary files /dev/null and b/doc/salome/gui/GEOM/images/edge1.png differ diff --git a/doc/salome/gui/GEOM/images/edge2.png b/doc/salome/gui/GEOM/images/edge2.png new file mode 100644 index 000000000..273ce86bc Binary files /dev/null and b/doc/salome/gui/GEOM/images/edge2.png differ diff --git a/doc/salome/gui/GEOM/images/edge3.png b/doc/salome/gui/GEOM/images/edge3.png new file mode 100644 index 000000000..d234053ed Binary files /dev/null and b/doc/salome/gui/GEOM/images/edge3.png differ diff --git a/doc/salome/gui/GEOM/images/editgroup.png b/doc/salome/gui/GEOM/images/editgroup.png index 25a55f8a7..935fabeac 100755 Binary files a/doc/salome/gui/GEOM/images/editgroup.png and b/doc/salome/gui/GEOM/images/editgroup.png differ diff --git a/doc/salome/gui/GEOM/images/ellipse.png b/doc/salome/gui/GEOM/images/ellipse.png index 8eea6cae6..9b3150115 100755 Binary files a/doc/salome/gui/GEOM/images/ellipse.png and b/doc/salome/gui/GEOM/images/ellipse.png differ diff --git a/doc/salome/gui/GEOM/images/extruded_boss.png b/doc/salome/gui/GEOM/images/extruded_boss.png new file mode 100644 index 000000000..fca4e90d8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/extruded_boss.png differ diff --git a/doc/salome/gui/GEOM/images/extruded_boss_dlg.png b/doc/salome/gui/GEOM/images/extruded_boss_dlg.png new file mode 100644 index 000000000..80c767eec Binary files /dev/null and b/doc/salome/gui/GEOM/images/extruded_boss_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/extruded_boss_example.png b/doc/salome/gui/GEOM/images/extruded_boss_example.png new file mode 100644 index 000000000..3d99a2471 Binary files /dev/null and b/doc/salome/gui/GEOM/images/extruded_boss_example.png differ diff --git a/doc/salome/gui/GEOM/images/extruded_cut.png b/doc/salome/gui/GEOM/images/extruded_cut.png new file mode 100644 index 000000000..21ae1cf2b Binary files /dev/null and b/doc/salome/gui/GEOM/images/extruded_cut.png differ diff --git a/doc/salome/gui/GEOM/images/extruded_cut_dlg.png b/doc/salome/gui/GEOM/images/extruded_cut_dlg.png new file mode 100644 index 000000000..f18ed6aca Binary files /dev/null and b/doc/salome/gui/GEOM/images/extruded_cut_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/extruded_cut_example.png b/doc/salome/gui/GEOM/images/extruded_cut_example.png new file mode 100644 index 000000000..667034c31 Binary files /dev/null and b/doc/salome/gui/GEOM/images/extruded_cut_example.png differ diff --git a/doc/salome/gui/GEOM/images/extrusion1.png b/doc/salome/gui/GEOM/images/extrusion1.png index 5ec63e0b8..1d3bc40da 100755 Binary files a/doc/salome/gui/GEOM/images/extrusion1.png and b/doc/salome/gui/GEOM/images/extrusion1.png differ diff --git a/doc/salome/gui/GEOM/images/extrusion2.png b/doc/salome/gui/GEOM/images/extrusion2.png index 28ef20217..42b6d8ba5 100755 Binary files a/doc/salome/gui/GEOM/images/extrusion2.png and b/doc/salome/gui/GEOM/images/extrusion2.png differ diff --git a/doc/salome/gui/GEOM/images/extrusion3.png b/doc/salome/gui/GEOM/images/extrusion3.png index 5147f78c1..47cd72260 100644 Binary files a/doc/salome/gui/GEOM/images/extrusion3.png and b/doc/salome/gui/GEOM/images/extrusion3.png differ diff --git a/doc/salome/gui/GEOM/images/face1.png b/doc/salome/gui/GEOM/images/face1.png index 2fbea98ae..7347e7710 100644 Binary files a/doc/salome/gui/GEOM/images/face1.png and b/doc/salome/gui/GEOM/images/face1.png differ diff --git a/doc/salome/gui/GEOM/images/face2.png b/doc/salome/gui/GEOM/images/face2.png index 97ce397a0..f66927dc0 100644 Binary files a/doc/salome/gui/GEOM/images/face2.png and b/doc/salome/gui/GEOM/images/face2.png differ diff --git a/doc/salome/gui/GEOM/images/feature_detect.png b/doc/salome/gui/GEOM/images/feature_detect.png new file mode 100644 index 000000000..ea1e15492 Binary files /dev/null and b/doc/salome/gui/GEOM/images/feature_detect.png differ diff --git a/doc/salome/gui/GEOM/images/feature_detection_dlg.png b/doc/salome/gui/GEOM/images/feature_detection_dlg.png new file mode 100644 index 000000000..edaa4dfe8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/feature_detection_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/feature_detection_dlg2.png b/doc/salome/gui/GEOM/images/feature_detection_dlg2.png new file mode 100644 index 000000000..88bd608a8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/feature_detection_dlg2.png differ diff --git a/doc/salome/gui/GEOM/images/feature_detection_dlg3.png b/doc/salome/gui/GEOM/images/feature_detection_dlg3.png new file mode 100644 index 000000000..54bf9611f Binary files /dev/null and b/doc/salome/gui/GEOM/images/feature_detection_dlg3.png differ diff --git a/doc/salome/gui/GEOM/images/fillet1.png b/doc/salome/gui/GEOM/images/fillet1.png index 99093f6d5..4d1c5cf73 100755 Binary files a/doc/salome/gui/GEOM/images/fillet1.png and b/doc/salome/gui/GEOM/images/fillet1.png differ diff --git a/doc/salome/gui/GEOM/images/fillet1d_1.png b/doc/salome/gui/GEOM/images/fillet1d_1.png new file mode 100644 index 000000000..00ddc0854 Binary files /dev/null and b/doc/salome/gui/GEOM/images/fillet1d_1.png differ diff --git a/doc/salome/gui/GEOM/images/fillet1d_2.png b/doc/salome/gui/GEOM/images/fillet1d_2.png new file mode 100644 index 000000000..053053370 Binary files /dev/null and b/doc/salome/gui/GEOM/images/fillet1d_2.png differ diff --git a/doc/salome/gui/GEOM/images/fillet2.png b/doc/salome/gui/GEOM/images/fillet2.png index 3c94f1410..a0165300c 100755 Binary files a/doc/salome/gui/GEOM/images/fillet2.png and b/doc/salome/gui/GEOM/images/fillet2.png differ diff --git a/doc/salome/gui/GEOM/images/fillet2d_2.png b/doc/salome/gui/GEOM/images/fillet2d_2.png index 58579c47d..6dd74c7d8 100755 Binary files a/doc/salome/gui/GEOM/images/fillet2d_2.png and b/doc/salome/gui/GEOM/images/fillet2d_2.png differ diff --git a/doc/salome/gui/GEOM/images/fillet3.png b/doc/salome/gui/GEOM/images/fillet3.png index 62564feba..7de0b087a 100755 Binary files a/doc/salome/gui/GEOM/images/fillet3.png and b/doc/salome/gui/GEOM/images/fillet3.png differ diff --git a/doc/salome/gui/GEOM/images/filling.png b/doc/salome/gui/GEOM/images/filling.png index 3263ea475..2efb1c8ea 100755 Binary files a/doc/salome/gui/GEOM/images/filling.png and b/doc/salome/gui/GEOM/images/filling.png differ diff --git a/doc/salome/gui/GEOM/images/front1.png b/doc/salome/gui/GEOM/images/front1.png new file mode 100644 index 000000000..863772bee Binary files /dev/null and b/doc/salome/gui/GEOM/images/front1.png differ diff --git a/doc/salome/gui/GEOM/images/front2.png b/doc/salome/gui/GEOM/images/front2.png new file mode 100644 index 000000000..77cc24d61 Binary files /dev/null and b/doc/salome/gui/GEOM/images/front2.png differ diff --git a/doc/salome/gui/GEOM/images/fuse.png b/doc/salome/gui/GEOM/images/fuse.png new file mode 100644 index 000000000..968ccee1e Binary files /dev/null and b/doc/salome/gui/GEOM/images/fuse.png differ diff --git a/doc/salome/gui/GEOM/images/fuse_collinear_edges.png b/doc/salome/gui/GEOM/images/fuse_collinear_edges.png new file mode 100644 index 000000000..85531b25e Binary files /dev/null and b/doc/salome/gui/GEOM/images/fuse_collinear_edges.png differ diff --git a/doc/salome/gui/GEOM/images/geomcreategroup.png b/doc/salome/gui/GEOM/images/geomcreategroup.png index 8e0706a40..b74b00dfb 100755 Binary files a/doc/salome/gui/GEOM/images/geomcreategroup.png and b/doc/salome/gui/GEOM/images/geomcreategroup.png differ diff --git a/doc/salome/gui/GEOM/images/geomscreen.png b/doc/salome/gui/GEOM/images/geomscreen.png index a8df645d2..ebcd56f2e 100755 Binary files a/doc/salome/gui/GEOM/images/geomscreen.png and b/doc/salome/gui/GEOM/images/geomscreen.png differ diff --git a/doc/salome/gui/GEOM/images/get_in_place_lost_part.png b/doc/salome/gui/GEOM/images/get_in_place_lost_part.png new file mode 100644 index 000000000..2abc8432a Binary files /dev/null and b/doc/salome/gui/GEOM/images/get_in_place_lost_part.png differ diff --git a/doc/salome/gui/GEOM/images/glue2.png b/doc/salome/gui/GEOM/images/glue2.png index 08fb4f97e..2df8a68b4 100644 Binary files a/doc/salome/gui/GEOM/images/glue2.png and b/doc/salome/gui/GEOM/images/glue2.png differ diff --git a/doc/salome/gui/GEOM/images/glue4.png b/doc/salome/gui/GEOM/images/glue4.png new file mode 100644 index 000000000..32e07ec22 Binary files /dev/null and b/doc/salome/gui/GEOM/images/glue4.png differ diff --git a/doc/salome/gui/GEOM/images/glue5.png b/doc/salome/gui/GEOM/images/glue5.png new file mode 100644 index 000000000..3a9a266e2 Binary files /dev/null and b/doc/salome/gui/GEOM/images/glue5.png differ diff --git a/doc/salome/gui/GEOM/images/glue7.png b/doc/salome/gui/GEOM/images/glue7.png new file mode 100644 index 000000000..a365ca2c4 Binary files /dev/null and b/doc/salome/gui/GEOM/images/glue7.png differ diff --git a/doc/salome/gui/GEOM/images/glue8.png b/doc/salome/gui/GEOM/images/glue8.png new file mode 100644 index 000000000..20e3aec7d Binary files /dev/null and b/doc/salome/gui/GEOM/images/glue8.png differ diff --git a/doc/salome/gui/GEOM/images/head.png b/doc/salome/gui/GEOM/images/head.png new file mode 100755 index 000000000..307d9ef9a Binary files /dev/null and b/doc/salome/gui/GEOM/images/head.png differ diff --git a/doc/salome/gui/GEOM/images/iges_unit.png b/doc/salome/gui/GEOM/images/iges_unit.png new file mode 100644 index 000000000..60aba603a Binary files /dev/null and b/doc/salome/gui/GEOM/images/iges_unit.png differ diff --git a/doc/salome/gui/GEOM/images/image1.gif b/doc/salome/gui/GEOM/images/image1.gif deleted file mode 100755 index 2f2fe9a21..000000000 Binary files a/doc/salome/gui/GEOM/images/image1.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image1.png b/doc/salome/gui/GEOM/images/image1.png new file mode 100644 index 000000000..b4b3e26db Binary files /dev/null and b/doc/salome/gui/GEOM/images/image1.png differ diff --git a/doc/salome/gui/GEOM/images/image109.jpg b/doc/salome/gui/GEOM/images/image109.jpg deleted file mode 100755 index de4e1e134..000000000 Binary files a/doc/salome/gui/GEOM/images/image109.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image109.png b/doc/salome/gui/GEOM/images/image109.png new file mode 100644 index 000000000..0dc60a1c1 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image109.png differ diff --git a/doc/salome/gui/GEOM/images/image110.jpg b/doc/salome/gui/GEOM/images/image110.jpg deleted file mode 100755 index 45f72b594..000000000 Binary files a/doc/salome/gui/GEOM/images/image110.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image110.png b/doc/salome/gui/GEOM/images/image110.png new file mode 100644 index 000000000..eeb9bf8e8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image110.png differ diff --git a/doc/salome/gui/GEOM/images/image112.jpg b/doc/salome/gui/GEOM/images/image112.jpg deleted file mode 100755 index 33399b3e1..000000000 Binary files a/doc/salome/gui/GEOM/images/image112.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image112.png b/doc/salome/gui/GEOM/images/image112.png new file mode 100644 index 000000000..5941f1cdc Binary files /dev/null and b/doc/salome/gui/GEOM/images/image112.png differ diff --git a/doc/salome/gui/GEOM/images/image113.jpg b/doc/salome/gui/GEOM/images/image113.jpg deleted file mode 100755 index fa01cfb36..000000000 Binary files a/doc/salome/gui/GEOM/images/image113.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image113.png b/doc/salome/gui/GEOM/images/image113.png new file mode 100644 index 000000000..85d5086c0 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image113.png differ diff --git a/doc/salome/gui/GEOM/images/image145.jpg b/doc/salome/gui/GEOM/images/image145.jpg deleted file mode 100755 index a035c8d89..000000000 Binary files a/doc/salome/gui/GEOM/images/image145.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image145.png b/doc/salome/gui/GEOM/images/image145.png new file mode 100644 index 000000000..fd5fc75a6 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image145.png differ diff --git a/doc/salome/gui/GEOM/images/image15.jpg b/doc/salome/gui/GEOM/images/image15.jpg deleted file mode 100755 index 50a9c9ece..000000000 Binary files a/doc/salome/gui/GEOM/images/image15.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image15.png b/doc/salome/gui/GEOM/images/image15.png new file mode 100644 index 000000000..e0f5294e0 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image15.png differ diff --git a/doc/salome/gui/GEOM/images/image154.jpg b/doc/salome/gui/GEOM/images/image154.jpg deleted file mode 100755 index 5129007a9..000000000 Binary files a/doc/salome/gui/GEOM/images/image154.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image154.png b/doc/salome/gui/GEOM/images/image154.png new file mode 100644 index 000000000..b259ed3e6 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image154.png differ diff --git a/doc/salome/gui/GEOM/images/image156.jpg b/doc/salome/gui/GEOM/images/image156.jpg deleted file mode 100755 index f2d718579..000000000 Binary files a/doc/salome/gui/GEOM/images/image156.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image156.png b/doc/salome/gui/GEOM/images/image156.png new file mode 100644 index 000000000..14fa25753 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image156.png differ diff --git a/doc/salome/gui/GEOM/images/image16.jpg b/doc/salome/gui/GEOM/images/image16.jpg deleted file mode 100755 index 42f79d392..000000000 Binary files a/doc/salome/gui/GEOM/images/image16.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image16.png b/doc/salome/gui/GEOM/images/image16.png new file mode 100644 index 000000000..5101810d3 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image16.png differ diff --git a/doc/salome/gui/GEOM/images/image160.jpg b/doc/salome/gui/GEOM/images/image160.jpg deleted file mode 100755 index a88429f79..000000000 Binary files a/doc/salome/gui/GEOM/images/image160.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image160.png b/doc/salome/gui/GEOM/images/image160.png new file mode 100644 index 000000000..e7845ab26 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image160.png differ diff --git a/doc/salome/gui/GEOM/images/image167.jpg b/doc/salome/gui/GEOM/images/image167.jpg deleted file mode 100755 index 775496ffc..000000000 Binary files a/doc/salome/gui/GEOM/images/image167.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image167.png b/doc/salome/gui/GEOM/images/image167.png new file mode 100644 index 000000000..87907ac6d Binary files /dev/null and b/doc/salome/gui/GEOM/images/image167.png differ diff --git a/doc/salome/gui/GEOM/images/image168.jpg b/doc/salome/gui/GEOM/images/image168.jpg deleted file mode 100755 index f69d2b8df..000000000 Binary files a/doc/salome/gui/GEOM/images/image168.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image180.jpg b/doc/salome/gui/GEOM/images/image180.jpg deleted file mode 100755 index 1c57ef013..000000000 Binary files a/doc/salome/gui/GEOM/images/image180.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image180.png b/doc/salome/gui/GEOM/images/image180.png new file mode 100644 index 000000000..1fb4d1e9e Binary files /dev/null and b/doc/salome/gui/GEOM/images/image180.png differ diff --git a/doc/salome/gui/GEOM/images/image181.jpg b/doc/salome/gui/GEOM/images/image181.jpg deleted file mode 100755 index d0171dfc9..000000000 Binary files a/doc/salome/gui/GEOM/images/image181.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image181.png b/doc/salome/gui/GEOM/images/image181.png new file mode 100644 index 000000000..0ae2afda2 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image181.png differ diff --git a/doc/salome/gui/GEOM/images/image185.jpg b/doc/salome/gui/GEOM/images/image185.jpg deleted file mode 100755 index 7fb6ef62a..000000000 Binary files a/doc/salome/gui/GEOM/images/image185.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image185.png b/doc/salome/gui/GEOM/images/image185.png new file mode 100644 index 000000000..a5350ded3 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image185.png differ diff --git a/doc/salome/gui/GEOM/images/image193.jpg b/doc/salome/gui/GEOM/images/image193.jpg deleted file mode 100755 index dc184f5fb..000000000 Binary files a/doc/salome/gui/GEOM/images/image193.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image193.png b/doc/salome/gui/GEOM/images/image193.png new file mode 100644 index 000000000..929ef9bef Binary files /dev/null and b/doc/salome/gui/GEOM/images/image193.png differ diff --git a/doc/salome/gui/GEOM/images/image2.gif b/doc/salome/gui/GEOM/images/image2.gif deleted file mode 100755 index 833410711..000000000 Binary files a/doc/salome/gui/GEOM/images/image2.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image2.jpg b/doc/salome/gui/GEOM/images/image2.jpg deleted file mode 100755 index 5857ccc61..000000000 Binary files a/doc/salome/gui/GEOM/images/image2.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image204.jpg b/doc/salome/gui/GEOM/images/image204.jpg deleted file mode 100755 index ce23e6aa0..000000000 Binary files a/doc/salome/gui/GEOM/images/image204.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image204.png b/doc/salome/gui/GEOM/images/image204.png new file mode 100644 index 000000000..98db0797e Binary files /dev/null and b/doc/salome/gui/GEOM/images/image204.png differ diff --git a/doc/salome/gui/GEOM/images/image206.jpg b/doc/salome/gui/GEOM/images/image206.jpg deleted file mode 100755 index 85e9e803d..000000000 Binary files a/doc/salome/gui/GEOM/images/image206.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image206.png b/doc/salome/gui/GEOM/images/image206.png new file mode 100644 index 000000000..553529ac4 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image206.png differ diff --git a/doc/salome/gui/GEOM/images/image21.png b/doc/salome/gui/GEOM/images/image21.png new file mode 100644 index 000000000..e6bc2e7f6 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image21.png differ diff --git a/doc/salome/gui/GEOM/images/image22.png b/doc/salome/gui/GEOM/images/image22.png new file mode 100644 index 000000000..f44cb6b1f Binary files /dev/null and b/doc/salome/gui/GEOM/images/image22.png differ diff --git a/doc/salome/gui/GEOM/images/image3.jpg b/doc/salome/gui/GEOM/images/image3.jpg deleted file mode 100755 index 4aacee4ed..000000000 Binary files a/doc/salome/gui/GEOM/images/image3.jpg and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image3.png b/doc/salome/gui/GEOM/images/image3.png new file mode 100644 index 000000000..d237358be Binary files /dev/null and b/doc/salome/gui/GEOM/images/image3.png differ diff --git a/doc/salome/gui/GEOM/images/image30.gif b/doc/salome/gui/GEOM/images/image30.gif deleted file mode 100755 index a773887f1..000000000 Binary files a/doc/salome/gui/GEOM/images/image30.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image30.png b/doc/salome/gui/GEOM/images/image30.png new file mode 100644 index 000000000..aa5092b3f Binary files /dev/null and b/doc/salome/gui/GEOM/images/image30.png differ diff --git a/doc/salome/gui/GEOM/images/image34.gif b/doc/salome/gui/GEOM/images/image34.gif deleted file mode 100755 index d7f8089db..000000000 Binary files a/doc/salome/gui/GEOM/images/image34.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image34.png b/doc/salome/gui/GEOM/images/image34.png new file mode 100644 index 000000000..e13e00661 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image34.png differ diff --git a/doc/salome/gui/GEOM/images/image36.gif b/doc/salome/gui/GEOM/images/image36.gif deleted file mode 100755 index 8b6955c8a..000000000 Binary files a/doc/salome/gui/GEOM/images/image36.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image36.png b/doc/salome/gui/GEOM/images/image36.png new file mode 100644 index 000000000..ae6b1a274 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image36.png differ diff --git a/doc/salome/gui/GEOM/images/image38.gif b/doc/salome/gui/GEOM/images/image38.gif deleted file mode 100755 index db1f51c2a..000000000 Binary files a/doc/salome/gui/GEOM/images/image38.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image38.png b/doc/salome/gui/GEOM/images/image38.png new file mode 100644 index 000000000..08e06200f Binary files /dev/null and b/doc/salome/gui/GEOM/images/image38.png differ diff --git a/doc/salome/gui/GEOM/images/image4.gif b/doc/salome/gui/GEOM/images/image4.gif deleted file mode 100755 index 385de8fd5..000000000 Binary files a/doc/salome/gui/GEOM/images/image4.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image4.png b/doc/salome/gui/GEOM/images/image4.png new file mode 100644 index 000000000..4055b46cf Binary files /dev/null and b/doc/salome/gui/GEOM/images/image4.png differ diff --git a/doc/salome/gui/GEOM/images/image40.gif b/doc/salome/gui/GEOM/images/image40.gif deleted file mode 100755 index b24e58c72..000000000 Binary files a/doc/salome/gui/GEOM/images/image40.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image40.png b/doc/salome/gui/GEOM/images/image40.png new file mode 100644 index 000000000..804d9a861 Binary files /dev/null and b/doc/salome/gui/GEOM/images/image40.png differ diff --git a/doc/salome/gui/GEOM/images/image47.gif b/doc/salome/gui/GEOM/images/image47.gif deleted file mode 100755 index 6e6cbead4..000000000 Binary files a/doc/salome/gui/GEOM/images/image47.gif and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/image47.png b/doc/salome/gui/GEOM/images/image47.png new file mode 100644 index 000000000..968d44d2a Binary files /dev/null and b/doc/salome/gui/GEOM/images/image47.png differ diff --git a/doc/salome/gui/GEOM/images/import_picture.png b/doc/salome/gui/GEOM/images/import_picture.png new file mode 100644 index 000000000..a4b3ace98 Binary files /dev/null and b/doc/salome/gui/GEOM/images/import_picture.png differ diff --git a/doc/salome/gui/GEOM/images/limit_tolerance_dlg.png b/doc/salome/gui/GEOM/images/limit_tolerance_dlg.png new file mode 100644 index 000000000..98adfc454 Binary files /dev/null and b/doc/salome/gui/GEOM/images/limit_tolerance_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/line_icon.png b/doc/salome/gui/GEOM/images/line_icon.png new file mode 100644 index 000000000..6176fb62d Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_icon.png differ diff --git a/doc/salome/gui/GEOM/images/line_width.png b/doc/salome/gui/GEOM/images/line_width.png new file mode 100755 index 000000000..bf5c713a8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width.png differ diff --git a/doc/salome/gui/GEOM/images/line_width_1.png b/doc/salome/gui/GEOM/images/line_width_1.png new file mode 100755 index 000000000..e7fc005f2 Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width_1.png differ diff --git a/doc/salome/gui/GEOM/images/line_width_2.png b/doc/salome/gui/GEOM/images/line_width_2.png new file mode 100755 index 000000000..4d49df5cb Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width_2.png differ diff --git a/doc/salome/gui/GEOM/images/material.png b/doc/salome/gui/GEOM/images/material.png new file mode 100644 index 000000000..085921468 Binary files /dev/null and b/doc/salome/gui/GEOM/images/material.png differ diff --git a/doc/salome/gui/GEOM/images/material_OCC.png b/doc/salome/gui/GEOM/images/material_OCC.png new file mode 100644 index 000000000..6f23268a5 Binary files /dev/null and b/doc/salome/gui/GEOM/images/material_OCC.png differ diff --git a/doc/salome/gui/GEOM/images/material_VTK.png b/doc/salome/gui/GEOM/images/material_VTK.png new file mode 100644 index 000000000..3910ff9c4 Binary files /dev/null and b/doc/salome/gui/GEOM/images/material_VTK.png differ diff --git a/doc/salome/gui/GEOM/images/measures11.png b/doc/salome/gui/GEOM/images/measures11.png new file mode 100644 index 000000000..85af6f187 Binary files /dev/null and b/doc/salome/gui/GEOM/images/measures11.png differ diff --git a/doc/salome/gui/GEOM/images/mtrans1.png b/doc/salome/gui/GEOM/images/mtrans1.png index ee4b2ea31..f5752e4b1 100755 Binary files a/doc/salome/gui/GEOM/images/mtrans1.png and b/doc/salome/gui/GEOM/images/mtrans1.png differ diff --git a/doc/salome/gui/GEOM/images/mtrans2.png b/doc/salome/gui/GEOM/images/mtrans2.png index 1d80d6547..c61b1c3c1 100755 Binary files a/doc/salome/gui/GEOM/images/mtrans2.png and b/doc/salome/gui/GEOM/images/mtrans2.png differ diff --git a/doc/salome/gui/GEOM/images/mtransf1.png b/doc/salome/gui/GEOM/images/mtransf1.png index ee26e0b7c..2e3195172 100755 Binary files a/doc/salome/gui/GEOM/images/mtransf1.png and b/doc/salome/gui/GEOM/images/mtransf1.png differ diff --git a/doc/salome/gui/GEOM/images/mtransf2.png b/doc/salome/gui/GEOM/images/mtransf2.png index c4077ed98..1042744d1 100755 Binary files a/doc/salome/gui/GEOM/images/mtransf2.png and b/doc/salome/gui/GEOM/images/mtransf2.png differ diff --git a/doc/salome/gui/GEOM/images/neo-deflection.png b/doc/salome/gui/GEOM/images/neo-deflection.png new file mode 100644 index 000000000..4ff2d29f3 Binary files /dev/null and b/doc/salome/gui/GEOM/images/neo-deflection.png differ diff --git a/doc/salome/gui/GEOM/images/neo-mrot1.png b/doc/salome/gui/GEOM/images/neo-mrot1.png index 3510a636c..e94b5ab73 100755 Binary files a/doc/salome/gui/GEOM/images/neo-mrot1.png and b/doc/salome/gui/GEOM/images/neo-mrot1.png differ diff --git a/doc/salome/gui/GEOM/images/neo-mrot2.png b/doc/salome/gui/GEOM/images/neo-mrot2.png index 07463ed14..f3f3c347e 100755 Binary files a/doc/salome/gui/GEOM/images/neo-mrot2.png and b/doc/salome/gui/GEOM/images/neo-mrot2.png differ diff --git a/doc/salome/gui/GEOM/images/neo-obj1.png b/doc/salome/gui/GEOM/images/neo-obj1.png index b7edefb7e..df078a1fe 100755 Binary files a/doc/salome/gui/GEOM/images/neo-obj1.png and b/doc/salome/gui/GEOM/images/neo-obj1.png differ diff --git a/doc/salome/gui/GEOM/images/neo-obj2.png b/doc/salome/gui/GEOM/images/neo-obj2.png deleted file mode 100755 index 3ce42b45c..000000000 Binary files a/doc/salome/gui/GEOM/images/neo-obj2.png and /dev/null differ diff --git a/doc/salome/gui/GEOM/images/neo-obj3.png b/doc/salome/gui/GEOM/images/neo-obj3.png index 65464a70c..c378521b8 100755 Binary files a/doc/salome/gui/GEOM/images/neo-obj3.png and b/doc/salome/gui/GEOM/images/neo-obj3.png differ diff --git a/doc/salome/gui/GEOM/images/neo-obj7.png b/doc/salome/gui/GEOM/images/neo-obj7.png index d15d13d90..25c367210 100755 Binary files a/doc/salome/gui/GEOM/images/neo-obj7.png and b/doc/salome/gui/GEOM/images/neo-obj7.png differ diff --git a/doc/salome/gui/GEOM/images/neo-scetcher1.png b/doc/salome/gui/GEOM/images/neo-scetcher1.png index 23ec1f3e6..1f387e952 100755 Binary files a/doc/salome/gui/GEOM/images/neo-scetcher1.png and b/doc/salome/gui/GEOM/images/neo-scetcher1.png differ diff --git a/doc/salome/gui/GEOM/images/neo-scetcher2.png b/doc/salome/gui/GEOM/images/neo-scetcher2.png index 837031035..bf0312277 100755 Binary files a/doc/salome/gui/GEOM/images/neo-scetcher2.png and b/doc/salome/gui/GEOM/images/neo-scetcher2.png differ diff --git a/doc/salome/gui/GEOM/images/neo-section.png b/doc/salome/gui/GEOM/images/neo-section.png index f73794cbf..532d1f835 100755 Binary files a/doc/salome/gui/GEOM/images/neo-section.png and b/doc/salome/gui/GEOM/images/neo-section.png differ diff --git a/doc/salome/gui/GEOM/images/neo-transparency.png b/doc/salome/gui/GEOM/images/neo-transparency.png index bff078966..0a2946d17 100755 Binary files a/doc/salome/gui/GEOM/images/neo-transparency.png and b/doc/salome/gui/GEOM/images/neo-transparency.png differ diff --git a/doc/salome/gui/GEOM/images/ob_popup_menu.png b/doc/salome/gui/GEOM/images/ob_popup_menu.png new file mode 100644 index 000000000..51ae305d7 Binary files /dev/null and b/doc/salome/gui/GEOM/images/ob_popup_menu.png differ diff --git a/doc/salome/gui/GEOM/images/occ_view_camera_dump.png b/doc/salome/gui/GEOM/images/occ_view_camera_dump.png new file mode 100755 index 000000000..b02616f29 Binary files /dev/null and b/doc/salome/gui/GEOM/images/occ_view_camera_dump.png differ diff --git a/doc/salome/gui/GEOM/images/partition.png b/doc/salome/gui/GEOM/images/partition.png new file mode 100644 index 000000000..7cb037293 Binary files /dev/null and b/doc/salome/gui/GEOM/images/partition.png differ diff --git a/doc/salome/gui/GEOM/images/partition1.png b/doc/salome/gui/GEOM/images/partition1.png index 026d13d09..baf8c4ac9 100755 Binary files a/doc/salome/gui/GEOM/images/partition1.png and b/doc/salome/gui/GEOM/images/partition1.png differ diff --git a/doc/salome/gui/GEOM/images/partition2.png b/doc/salome/gui/GEOM/images/partition2.png index 97dcbdc7b..12b92335b 100755 Binary files a/doc/salome/gui/GEOM/images/partition2.png and b/doc/salome/gui/GEOM/images/partition2.png differ diff --git a/doc/salome/gui/GEOM/images/partitionsn3.png b/doc/salome/gui/GEOM/images/partitionsn3.png new file mode 100644 index 000000000..474f8b0b0 Binary files /dev/null and b/doc/salome/gui/GEOM/images/partitionsn3.png differ diff --git a/doc/salome/gui/GEOM/images/picture_import_dlg.png b/doc/salome/gui/GEOM/images/picture_import_dlg.png new file mode 100644 index 000000000..cd38a6513 Binary files /dev/null and b/doc/salome/gui/GEOM/images/picture_import_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/pipe.png b/doc/salome/gui/GEOM/images/pipe.png index d75445374..e256ba197 100755 Binary files a/doc/salome/gui/GEOM/images/pipe.png and b/doc/salome/gui/GEOM/images/pipe.png differ diff --git a/doc/salome/gui/GEOM/images/pipe2.png b/doc/salome/gui/GEOM/images/pipe2.png index 66d6d9f98..b1f4637b8 100755 Binary files a/doc/salome/gui/GEOM/images/pipe2.png and b/doc/salome/gui/GEOM/images/pipe2.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshape.png b/doc/salome/gui/GEOM/images/pipetshape.png new file mode 100644 index 000000000..af7540c44 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshape.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshape_dlg.png b/doc/salome/gui/GEOM/images/pipetshape_dlg.png new file mode 100644 index 000000000..c59e012e5 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshape_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshapechamfer.png b/doc/salome/gui/GEOM/images/pipetshapechamfer.png new file mode 100644 index 000000000..6ec7b2e9f Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshapechamfer.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshapefillet.png b/doc/salome/gui/GEOM/images/pipetshapefillet.png new file mode 100644 index 000000000..b1cf14061 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshapefillet.png differ diff --git a/doc/salome/gui/GEOM/images/plane1.png b/doc/salome/gui/GEOM/images/plane1.png index aaf7f12d5..e336b7a2e 100755 Binary files a/doc/salome/gui/GEOM/images/plane1.png and b/doc/salome/gui/GEOM/images/plane1.png differ diff --git a/doc/salome/gui/GEOM/images/plane2.png b/doc/salome/gui/GEOM/images/plane2.png index 3644d6b38..5c202409e 100755 Binary files a/doc/salome/gui/GEOM/images/plane2.png and b/doc/salome/gui/GEOM/images/plane2.png differ diff --git a/doc/salome/gui/GEOM/images/plane3.png b/doc/salome/gui/GEOM/images/plane3.png index b815f8d0d..18c9f8088 100755 Binary files a/doc/salome/gui/GEOM/images/plane3.png and b/doc/salome/gui/GEOM/images/plane3.png differ diff --git a/doc/salome/gui/GEOM/images/plane4.png b/doc/salome/gui/GEOM/images/plane4.png new file mode 100644 index 000000000..41b00fe53 Binary files /dev/null and b/doc/salome/gui/GEOM/images/plane4.png differ diff --git a/doc/salome/gui/GEOM/images/plane5.png b/doc/salome/gui/GEOM/images/plane5.png new file mode 100644 index 000000000..76c668a83 Binary files /dev/null and b/doc/salome/gui/GEOM/images/plane5.png differ diff --git a/doc/salome/gui/GEOM/images/point3.png b/doc/salome/gui/GEOM/images/point3.png index 35c28ad50..8b4daecc1 100755 Binary files a/doc/salome/gui/GEOM/images/point3.png and b/doc/salome/gui/GEOM/images/point3.png differ diff --git a/doc/salome/gui/GEOM/images/point3_2.png b/doc/salome/gui/GEOM/images/point3_2.png new file mode 100644 index 000000000..8e7f3a127 Binary files /dev/null and b/doc/salome/gui/GEOM/images/point3_2.png differ diff --git a/doc/salome/gui/GEOM/images/point3_3.png b/doc/salome/gui/GEOM/images/point3_3.png new file mode 100644 index 000000000..d4f2c9adb Binary files /dev/null and b/doc/salome/gui/GEOM/images/point3_3.png differ diff --git a/doc/salome/gui/GEOM/images/point4.png b/doc/salome/gui/GEOM/images/point4.png index 08739979a..dc3e08641 100755 Binary files a/doc/salome/gui/GEOM/images/point4.png and b/doc/salome/gui/GEOM/images/point4.png differ diff --git a/doc/salome/gui/GEOM/images/point5.png b/doc/salome/gui/GEOM/images/point5.png index e005604b8..46f1db2a7 100755 Binary files a/doc/salome/gui/GEOM/images/point5.png and b/doc/salome/gui/GEOM/images/point5.png differ diff --git a/doc/salome/gui/GEOM/images/point5_2.png b/doc/salome/gui/GEOM/images/point5_2.png new file mode 100644 index 000000000..233631e63 Binary files /dev/null and b/doc/salome/gui/GEOM/images/point5_2.png differ diff --git a/doc/salome/gui/GEOM/images/point_marker_dlg1.png b/doc/salome/gui/GEOM/images/point_marker_dlg1.png new file mode 100755 index 000000000..25ca798b7 Binary files /dev/null and b/doc/salome/gui/GEOM/images/point_marker_dlg1.png differ diff --git a/doc/salome/gui/GEOM/images/point_marker_dlg2.png b/doc/salome/gui/GEOM/images/point_marker_dlg2.png new file mode 100755 index 000000000..d0f7acef0 Binary files /dev/null and b/doc/salome/gui/GEOM/images/point_marker_dlg2.png differ diff --git a/doc/salome/gui/GEOM/images/pref15.png b/doc/salome/gui/GEOM/images/pref15.png new file mode 100755 index 000000000..3d9e5f628 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pref15.png differ diff --git a/doc/salome/gui/GEOM/images/projection_dlg.png b/doc/salome/gui/GEOM/images/projection_dlg.png new file mode 100644 index 000000000..ac912b9a8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/projection_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/projection_preview.png b/doc/salome/gui/GEOM/images/projection_preview.png new file mode 100644 index 000000000..85d767eab Binary files /dev/null and b/doc/salome/gui/GEOM/images/projection_preview.png differ diff --git a/doc/salome/gui/GEOM/images/publish_dlg.png b/doc/salome/gui/GEOM/images/publish_dlg.png new file mode 100755 index 000000000..465681351 Binary files /dev/null and b/doc/salome/gui/GEOM/images/publish_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/rectangle_icon.png b/doc/salome/gui/GEOM/images/rectangle_icon.png new file mode 100644 index 000000000..9812d8e7d Binary files /dev/null and b/doc/salome/gui/GEOM/images/rectangle_icon.png differ diff --git a/doc/salome/gui/GEOM/images/remove_extra_edges.png b/doc/salome/gui/GEOM/images/remove_extra_edges.png index 64cc0f0b3..f5a620b65 100644 Binary files a/doc/salome/gui/GEOM/images/remove_extra_edges.png and b/doc/salome/gui/GEOM/images/remove_extra_edges.png differ diff --git a/doc/salome/gui/GEOM/images/repair2.png b/doc/salome/gui/GEOM/images/repair2.png index 8049d60e8..6d4e20c7a 100755 Binary files a/doc/salome/gui/GEOM/images/repair2.png and b/doc/salome/gui/GEOM/images/repair2.png differ diff --git a/doc/salome/gui/GEOM/images/restore-ss-cut.png b/doc/salome/gui/GEOM/images/restore-ss-cut.png index 8db26d85f..75552e8fb 100644 Binary files a/doc/salome/gui/GEOM/images/restore-ss-cut.png and b/doc/salome/gui/GEOM/images/restore-ss-cut.png differ diff --git a/doc/salome/gui/GEOM/images/restore-ss-dialog.png b/doc/salome/gui/GEOM/images/restore-ss-dialog.png index 64fc9d2c1..54670c3e5 100644 Binary files a/doc/salome/gui/GEOM/images/restore-ss-dialog.png and b/doc/salome/gui/GEOM/images/restore-ss-dialog.png differ diff --git a/doc/salome/gui/GEOM/images/revolution.png b/doc/salome/gui/GEOM/images/revolution.png index f0e3fa9d8..a56c218c5 100755 Binary files a/doc/salome/gui/GEOM/images/revolution.png and b/doc/salome/gui/GEOM/images/revolution.png differ diff --git a/doc/salome/gui/GEOM/images/sat_named_shapes.png b/doc/salome/gui/GEOM/images/sat_named_shapes.png new file mode 100644 index 000000000..cb3bca660 Binary files /dev/null and b/doc/salome/gui/GEOM/images/sat_named_shapes.png differ diff --git a/doc/salome/gui/GEOM/images/shapesonshape.png b/doc/salome/gui/GEOM/images/shapesonshape.png index 0c01b3ba7..0f291dfa1 100755 Binary files a/doc/salome/gui/GEOM/images/shapesonshape.png and b/doc/salome/gui/GEOM/images/shapesonshape.png differ diff --git a/doc/salome/gui/GEOM/images/shared_shapes.png b/doc/salome/gui/GEOM/images/shared_shapes.png new file mode 100644 index 000000000..400a42ba5 Binary files /dev/null and b/doc/salome/gui/GEOM/images/shared_shapes.png differ diff --git a/doc/salome/gui/GEOM/images/sketch.png b/doc/salome/gui/GEOM/images/sketch.png new file mode 100644 index 000000000..f2964c744 Binary files /dev/null and b/doc/salome/gui/GEOM/images/sketch.png differ diff --git a/doc/salome/gui/GEOM/images/sketch_example.png b/doc/salome/gui/GEOM/images/sketch_example.png new file mode 100644 index 000000000..cbd6475a0 Binary files /dev/null and b/doc/salome/gui/GEOM/images/sketch_example.png differ diff --git a/doc/salome/gui/GEOM/images/sketcher_dlg.png b/doc/salome/gui/GEOM/images/sketcher_dlg.png new file mode 100644 index 000000000..32105409f Binary files /dev/null and b/doc/salome/gui/GEOM/images/sketcher_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/sketcher_dlg2.png b/doc/salome/gui/GEOM/images/sketcher_dlg2.png new file mode 100644 index 000000000..1e0daf36f Binary files /dev/null and b/doc/salome/gui/GEOM/images/sketcher_dlg2.png differ diff --git a/doc/salome/gui/GEOM/images/std_point_marker.png b/doc/salome/gui/GEOM/images/std_point_marker.png new file mode 100755 index 000000000..ccf478b0c Binary files /dev/null and b/doc/salome/gui/GEOM/images/std_point_marker.png differ diff --git a/doc/salome/gui/GEOM/images/transformation1.png b/doc/salome/gui/GEOM/images/transformation1.png index 0ed8d8d93..7cbeb4ef7 100755 Binary files a/doc/salome/gui/GEOM/images/transformation1.png and b/doc/salome/gui/GEOM/images/transformation1.png differ diff --git a/doc/salome/gui/GEOM/images/transformation10.png b/doc/salome/gui/GEOM/images/transformation10.png index 7aa59f16b..12334d40f 100755 Binary files a/doc/salome/gui/GEOM/images/transformation10.png and b/doc/salome/gui/GEOM/images/transformation10.png differ diff --git a/doc/salome/gui/GEOM/images/transformation10a.png b/doc/salome/gui/GEOM/images/transformation10a.png index c24b6aac5..f5090d58a 100644 Binary files a/doc/salome/gui/GEOM/images/transformation10a.png and b/doc/salome/gui/GEOM/images/transformation10a.png differ diff --git a/doc/salome/gui/GEOM/images/transformation11.png b/doc/salome/gui/GEOM/images/transformation11.png index 02ae81233..922071e1d 100755 Binary files a/doc/salome/gui/GEOM/images/transformation11.png and b/doc/salome/gui/GEOM/images/transformation11.png differ diff --git a/doc/salome/gui/GEOM/images/transformation13.png b/doc/salome/gui/GEOM/images/transformation13.png index 1ae0170df..f664b60d3 100644 Binary files a/doc/salome/gui/GEOM/images/transformation13.png and b/doc/salome/gui/GEOM/images/transformation13.png differ diff --git a/doc/salome/gui/GEOM/images/transformation2.png b/doc/salome/gui/GEOM/images/transformation2.png index 3642ceda8..c9ffaa514 100755 Binary files a/doc/salome/gui/GEOM/images/transformation2.png and b/doc/salome/gui/GEOM/images/transformation2.png differ diff --git a/doc/salome/gui/GEOM/images/transformation3.png b/doc/salome/gui/GEOM/images/transformation3.png index fb9a09fef..bdb841f3a 100755 Binary files a/doc/salome/gui/GEOM/images/transformation3.png and b/doc/salome/gui/GEOM/images/transformation3.png differ diff --git a/doc/salome/gui/GEOM/images/transformation4.png b/doc/salome/gui/GEOM/images/transformation4.png index 42f4bf79b..c6155b026 100755 Binary files a/doc/salome/gui/GEOM/images/transformation4.png and b/doc/salome/gui/GEOM/images/transformation4.png differ diff --git a/doc/salome/gui/GEOM/images/transformation4a.png b/doc/salome/gui/GEOM/images/transformation4a.png index 1d98b09f0..8f38f650e 100644 Binary files a/doc/salome/gui/GEOM/images/transformation4a.png and b/doc/salome/gui/GEOM/images/transformation4a.png differ diff --git a/doc/salome/gui/GEOM/images/transformation5.png b/doc/salome/gui/GEOM/images/transformation5.png index 48b632622..6c59f33de 100755 Binary files a/doc/salome/gui/GEOM/images/transformation5.png and b/doc/salome/gui/GEOM/images/transformation5.png differ diff --git a/doc/salome/gui/GEOM/images/transformation6.png b/doc/salome/gui/GEOM/images/transformation6.png index b77c7450f..33ba08c99 100755 Binary files a/doc/salome/gui/GEOM/images/transformation6.png and b/doc/salome/gui/GEOM/images/transformation6.png differ diff --git a/doc/salome/gui/GEOM/images/transformation7.png b/doc/salome/gui/GEOM/images/transformation7.png index cadec9ec2..d495057c0 100755 Binary files a/doc/salome/gui/GEOM/images/transformation7.png and b/doc/salome/gui/GEOM/images/transformation7.png differ diff --git a/doc/salome/gui/GEOM/images/transformation8.png b/doc/salome/gui/GEOM/images/transformation8.png index 316314320..c1e8bea87 100755 Binary files a/doc/salome/gui/GEOM/images/transformation8.png and b/doc/salome/gui/GEOM/images/transformation8.png differ diff --git a/doc/salome/gui/GEOM/images/transformation9.png b/doc/salome/gui/GEOM/images/transformation9.png index 1b633a490..8a25e3fdb 100755 Binary files a/doc/salome/gui/GEOM/images/transformation9.png and b/doc/salome/gui/GEOM/images/transformation9.png differ diff --git a/doc/salome/gui/GEOM/images/using_notebook_geom.png b/doc/salome/gui/GEOM/images/using_notebook_geom.png new file mode 100644 index 000000000..79de77f12 Binary files /dev/null and b/doc/salome/gui/GEOM/images/using_notebook_geom.png differ diff --git a/doc/salome/gui/GEOM/images/vectors_mode.png b/doc/salome/gui/GEOM/images/vectors_mode.png new file mode 100644 index 000000000..893b7c328 Binary files /dev/null and b/doc/salome/gui/GEOM/images/vectors_mode.png differ diff --git a/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc b/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc index f16624bbd..4a58ee64a 100644 --- a/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc +++ b/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc @@ -5,30 +5,42 @@ \n To Add Point on Edge in the Main Menu select Repair - > Add Point on Edge. -\n This operation splits an edge in two in accordance with the +\n This operation splits an edge in two new edges in accordance with the specified mode (by length or by parameter) and a value specifying the position of the point on edge (for example val =0.5; mode = -Length). This operation is available in OCC Viewer only. +by length). This operation is available in OCC Viewer only. \n The \b Result will be a \b GEOM_Object. \n TUI Command: geompy.DivideEdge(Shape, EdgeID, Value, -IsByParameter), where \em Shape is a shape which contains an edge to -be divided, \em EdgeID is the ID of the edge to be divided, if it = -1, -then Shape is an edge, \em Value is a paramter on the edge or a -length. \em IsByParameter if it is True then Value is the edge parameter -in the range [0:1] otherwise it is a part of the length of the edge in the range -[0: full length of the edge] -\n Arguments: Name + 1 Edge + 1 value setting the position of +IsByParameter) +- \em Shape is a shape which contains an edge to be divided +- \em EdgeID is the ID of the edge to be divided, if it is = -1, +then \em Shape should be an edge itself +- \em Value is a value of parameter on edge or length parameter, +depending on \em IsByParameter. +- \em IsByParameter is a boolean flag, specifying operation mode: + - \c True: \em Value is treated as a curve parameter [0..1] + - \c False: \em Value is treated as a length parameter [0..1] + +Arguments: Name + 1 Edge + 1 Value setting the position of the point according to one of the selected modes. +The difference between "by parameter" and "by length" modes becomes +apparent on the edges with irregular parametrization (for example, +b-splines which usually have irregular density by the length). +For example, value 0.5 "by length" on such edge will produce the point +in the middle of this edge (equidistant from both its ends); the same +0.5 value "by parameter" will result in the point situated closer to +one of the ends (depending on the actual parametrization). + \image html repair8.png \n Example: -\image html image167.jpg "The initial edge" +\image html image167.png "The initial edge" -\image html image168.jpg "The edge split in two segments" +\image html image168.png "The edge split in two segments" Our TUI Scripts provide you with useful examples of the use of \ref tui_add_point_on_edge "Repairing Operations". diff --git a/doc/salome/gui/GEOM/input/angle.doc b/doc/salome/gui/GEOM/input/angle.doc new file mode 100644 index 000000000..17e6c94de --- /dev/null +++ b/doc/salome/gui/GEOM/input/angle.doc @@ -0,0 +1,20 @@ +/*! + +\page angle_page Angle + +Returns the angle between two lines or linear edges in degrees. + +\note If both arguments are vectors, the angle is computed in + accordance with their orientations, otherwise the minimum angle + is computed. + +\n TUI Command: geompy.GetAngle(shape1, shape2), where +Shape1 and Shape2 are shapes between which the angle is computed. +Another TUI command is geompy.GetAngleRadians(shape1,shape2), +which returns the value of angle in radians. + +See also a \ref tui_angle_page "TUI example". + +\image html angle.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/archimede.doc b/doc/salome/gui/GEOM/input/archimede.doc index 933a8d018..aed6376a5 100644 --- a/doc/salome/gui/GEOM/input/archimede.doc +++ b/doc/salome/gui/GEOM/input/archimede.doc @@ -17,6 +17,7 @@ the shape, \em WaterDensity is density of water, \em MeshingDeflection is a deflection of the mesh, using to compute the section. \n Arguments: Name + 1 shape + 3 values (Weight, Water Density & Meshing Deflection). +\n Advanced options \ref preview_anchor "Preview" \image html archimede.png diff --git a/doc/salome/gui/GEOM/input/basic_prop.doc b/doc/salome/gui/GEOM/input/basic_prop.doc new file mode 100644 index 000000000..2821eabd3 --- /dev/null +++ b/doc/salome/gui/GEOM/input/basic_prop.doc @@ -0,0 +1,17 @@ +/*! + +\page basic_prop_page Basic Properties + +Returns the properties (Length, Surface & Volume) for the selected +geometrical object. + +Result: Display Length, Surface & Volume in the form of +Python Tuple. +\nTUI Command: geompy.BasicProperties(Shape), where +\em Shape is a shape whose properties are inquired. + +See also a \ref tui_basic_properties_page "TUI example". + +\image html neo-basicprop.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/boudaries.doc b/doc/salome/gui/GEOM/input/boudaries.doc new file mode 100644 index 000000000..65acdc06a --- /dev/null +++ b/doc/salome/gui/GEOM/input/boudaries.doc @@ -0,0 +1,18 @@ +/*! + +\page boundaries_page Check Free Boundaries + +Detects and highlights wires and edges that are not shared between +two faces and are considered a shape's boundary. + +TUI Command: (NoError, ClosedWires, OpenWires) = +geompy.GetFreeBoundary(Shape), where \em Shape is a shape to be +checked, \em NoError is false if an error occurred while checking free +boundaries, \em ClosedWires is a list of closed free boundary wires, +\em OpenWires is a list of open free boundary wires. + +See also a \ref tui_free_boundaries_page "TUI example". + +\image html repair9.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/bounding_box.doc b/doc/salome/gui/GEOM/input/bounding_box.doc new file mode 100644 index 000000000..eeb16c4ff --- /dev/null +++ b/doc/salome/gui/GEOM/input/bounding_box.doc @@ -0,0 +1,25 @@ +/*! + +\page bounding_box_page Bounding Box + +Returns the dimensions of the bounding box for the selected +geometrical object. + +\note To take into account any possible shape distortion +that affects the resulting bounding box, the algorithm enlarges +the bounding box to the maximum deflection value of +faces (by iterating through all faces of a shape). +This functionallity is implemented in such a way to have +a satisfactory performance. + +Result: Displays the bounding box dimensions of a +geometrical object in form of a Python Tuple (Xmin, Xmax, Ymin, +Ymax, Zmin, Zmax). +\n TUI Command: geompy.BoundingBox(Shape), where \em Shape +is the shape for which a bounding box is computed. + +See also a \ref tui_bounding_box_page "TUI example". + +\image html measures5.png + +*/ diff --git a/doc/salome/gui/GEOM/input/bring_to_front.doc b/doc/salome/gui/GEOM/input/bring_to_front.doc new file mode 100644 index 000000000..e53e74e20 --- /dev/null +++ b/doc/salome/gui/GEOM/input/bring_to_front.doc @@ -0,0 +1,21 @@ +/*! + +\page bring_to_front_page Bring To Front + +\n This option is relevant for better viewing of complex 3D models. +It allows to bring to the viewer foreground the selected geometrical object. + +Let's take for example two coincident primitives: a box and a cylinder. + +In the first picture the box has been visually superimposed over the +cylinder using Bring to front option. + +\image html front1.png + +In the second picture the box has been returned to its normal state +using Clear Top Level State context menu command, however, the +cylinder has been brought to front. + + \image html front2.png + +*/ diff --git a/doc/salome/gui/GEOM/input/building_by_blocks.doc b/doc/salome/gui/GEOM/input/building_by_blocks.doc index fa2611d7c..a3257f747 100644 --- a/doc/salome/gui/GEOM/input/building_by_blocks.doc +++ b/doc/salome/gui/GEOM/input/building_by_blocks.doc @@ -17,103 +17,17 @@ Hexahedral Block - is a block with constraints for hexahedral meshing. Block Compound - is a compound composed of blocks only. -These functionalities are available from the main menu via New +Some functionalities that allow building blocks easily are available from the main menu via New Entity / Blocks.
    -
  • \ref quad_face_anchor "Quadrangle face"
  • -
  • \ref hexa_solid_anchor "Hexahedral solid"
  • +
  • \subpage create_quadrangle_face_page "Quadrangle face"
  • +
  • \subpage create_hexa_solid_page "Hexahedral solid"
  • +
  • \subpage create_divideddisk_page "Divided disk"
  • +
  • \subpage create_dividedcylinder_page "Divided cylinder"
-
-\anchor quad_face_anchor -

Quadrangle face

- -\n Description: Builds a face using the below mentioned -arguments. This operation allows to build a face bypassing the -intermediate stage of building edges and wires (in the case of -building by 4 points) or wires (in the case of building by 4 or 2 -edges). - -\n The \b Result of the operation will be a \b GEOM_Object (face). - -\n TUI Command: -
    -
  • geompy.MakeQuad4Vertices(V1, V2, V3, V4), where V1, V2, -V3, V4 are four vertices from which a face is constructed. Edges are -created automatically.
  • -
  • geompy.MakeQuad2Edges(E1, E2), where E1, E2 are edges from -which the face is constructed, two other edges are created -automatically.
  • -
  • geompy.MakeQuad(E1, E2, E3, E4), where E1, E2, E3, E4 are -four edges from which the face is constructed.
  • -
- -Arguments: -
    -
  • Name + 4 Points, or
  • -
  • Name + 2 Edges, or
  • -
  • Name + 4 Edges.
  • -
- -\n Dialog Box: - -\image html block1.png - -\image html block2.png - -\image html block3.png - -\n Example: -\image html image185.jpg "Quadrangle face built by blocks" - - -

-\anchor hexa_solid_anchor -

Hexahedral solid

- -\n Description: Builds a hexahedral solid. either of the below -mentioned arguments. This operation allows to build a solid bypassing -the intermediate stage of building a shell and 4 faces (in the case of -building by 2 faces) or just a shell (in the case of building by 6 -faces). - -\n The \b Result of the operation will be a \b GEOM_Object (solid). - -\n TUI Command: -
    -
  • geompy.MakeHexa2Faces(F1, F2), where F1 and F2 are faces -from which the hexahedron is constructed, other four faces are created -automatically.
  • -
  • geompy.MakeHexa(F1, F2, F3, F4, F5, F6), where F1 — F6 are six faces from which the hexahedron is constructed.
  • -
- -\n Arguments: -
    -
  • Name + 2 Faces, or
  • -
  • Name + 6 Faces.
  • -
- -\n Dialog Box: - -\image html block4.png - - - -\image html block5.png - -\n Example: - -\image html image180.jpg -
Hexahedral Solid built on the base of six Faces
- -\image html image181.jpg -
Hexahedral Solid built on the base of two Faces
- +*/ -The created blocks can be processed with \ref blocks_operations_page "Operations on Blocks". -Our TUI Scripts provide you with useful examples of -\ref tui_building_by_blocks_page "Building by Blocks". -*/ diff --git a/doc/salome/gui/GEOM/input/center_mass.doc b/doc/salome/gui/GEOM/input/center_mass.doc new file mode 100644 index 000000000..b4d8ce4e7 --- /dev/null +++ b/doc/salome/gui/GEOM/input/center_mass.doc @@ -0,0 +1,16 @@ +/*! + +\page center_mass_page Center of Mass + +Calculates and returns the coordinates of the gravity center for +the selected geometrical object. + +Result: GEOM_Object (vertex). +\n TUI Command: geompy.MakeCDG(Shape), where \em Shape is +the shape for which a center of gravity is computed. + +See also a \ref tui_center_of_mass_page "TUI example". + +\image html measures3.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/chamfer_operation.doc b/doc/salome/gui/GEOM/input/chamfer_operation.doc index 38fdba843..36d5d68bf 100644 --- a/doc/salome/gui/GEOM/input/chamfer_operation.doc +++ b/doc/salome/gui/GEOM/input/chamfer_operation.doc @@ -3,7 +3,7 @@ \page chamfer_operation_page Chamfer \n To produce a \b Chamfer in the Main Menu select -Operations - > Transformation - > Chamfer +Operations - > Chamfer \n This operation allows you to make chamfer of the edges of a Shape. \n The \b Result will be a \b GEOM_Object. @@ -13,6 +13,7 @@ define the Main Object to create a chamfer on and the \b Dimension (radius) of the chamfer. \n TUI Command: geompy.MakeChamferAll(Shape, D) \n Arguments: Name + 1 SHAPE + 1 value (Chamfer dimension). +\n Advanced options \ref preview_anchor "Preview" \image html chamfer1.png diff --git a/doc/salome/gui/GEOM/input/change_orientation_operation.doc b/doc/salome/gui/GEOM/input/change_orientation_operation.doc index ecb01031c..15fb20e9e 100644 --- a/doc/salome/gui/GEOM/input/change_orientation_operation.doc +++ b/doc/salome/gui/GEOM/input/change_orientation_operation.doc @@ -4,10 +4,10 @@ \n To Change Orientation in the Main Menu select Repair - > Change Orientation. \n This operation reverses the normals of selected faces or the normal -of faces composing composing the selected opened shell. +of faces composing the selected opened shell. For edge or wire the operation reverses its direction. \n TUI Command: geompy.ChangeOrientation(shape) -\n Arguments: Name + one or several objects (face(s)), opened shell(s). +\n Arguments: Name + one or several objects (edge(s), wire(s), face(s), opened shell(s)). \n Uncheck Create a copy checkbox if you don't wish to leave the initial object in the project (Result name field will be locked). @@ -16,10 +16,10 @@ locked). \n Example: -\image html image38.gif +\image html image38.png
Inward orientation
-\image html image40.gif +\image html image40.png
Outward orientation
*/ diff --git a/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc b/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc new file mode 100644 index 000000000..81d8379a0 --- /dev/null +++ b/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc @@ -0,0 +1,33 @@ +/*! + +\page check_compound_of_blocks_page Check Compound of Blocks + +Checks whether a shape is a compound of glued blocks. To be +considered as a compound of blocks, the given shape must satisfy the +following conditions: +
    +
  • Each element of the compound should be a Block (6 faces and 12 edges);
  • +
  • A connection between two Blocks should be an entire quadrangle face or an entire edge;
  • +
  • The compound should be connected;
  • +
  • Two quadrangle faces should be glued.
  • +
+ +\n Informs of the following possible errors: +
    +
  • not a block;
  • +
  • not glued;
  • +
  • not connected;
  • +
  • extra or degenerated edge.
  • +
+ +\n Result: Boolean; highlight in the viewer. +\n TUI Command: +geompy.CheckCompoundOfBlocks(Compound). Checks if the shape +is a valid compound of blocks. If it is true, then the validity flag +is returned, and encountered errors are printed in the python console. + +See also a \ref tui_check_compound_of_blocks_page "TUI example". + +\image html measures10.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/check_self_intersections.doc b/doc/salome/gui/GEOM/input/check_self_intersections.doc new file mode 100644 index 000000000..d1477bd66 --- /dev/null +++ b/doc/salome/gui/GEOM/input/check_self_intersections.doc @@ -0,0 +1,22 @@ +/*! + +\page check_self_intersections_page Detect Self-intersections + +\n Checks the topology of the selected shape to detect self-intersections. + Returns True if there are no self-intersections. Reports pairs of + intersected sub-shapes, if there are any. + +\note This tool is useful for detection of shapes, not suitable for +arguments of Boolean operations and Partition algorithm. +For more information about Partition and Boolean Operations Algorithms +and their limitations refer to this document. + +\n Result: Boolean. +\n TUI Command: geompy.CheckSelfIntersections(theShape), +where \em theShape is the shape checked for validity. + +See also a \ref tui_check_self_intersections_page "TUI example". + +\image html measures11.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/check_shape.doc b/doc/salome/gui/GEOM/input/check_shape.doc new file mode 100644 index 000000000..9ffbf5b9a --- /dev/null +++ b/doc/salome/gui/GEOM/input/check_shape.doc @@ -0,0 +1,18 @@ +/*! + +\page check_shape_page Check Shape + +\n Checks the topology of the selected geometrical object and returns +True if it is valid. Check also geometry checkbox allows to test the +geometry as well. + +\n Result: Boolean. +\n TUI Command: geompy.CheckShape(theShape, theIsCheckGeom = 0), +where \em theShape is the shape checked for validity. + +See also a \ref tui_check_shape_page "TUI example". + +\image html measures9.png + + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/color.doc b/doc/salome/gui/GEOM/input/color.doc index fcaff6f45..cb56c49e1 100644 --- a/doc/salome/gui/GEOM/input/color.doc +++ b/doc/salome/gui/GEOM/input/color.doc @@ -4,7 +4,10 @@ \n You can change the filling color of your object in the standard Select Color menu accessible by right-clicking on an object and -selecting \b Color in the pop-up menu box. +selecting \b Color in the pop-up menu box. + +This functionality is avalible only if \em artificial +\ref material "material model" is assigned to the selected shape. \n TUI Command: gg.setColor(ID, Short, Short, Short) @@ -13,4 +16,4 @@ selecting \b Color in the pop-up menu box. Our TUI Scripts provide you with useful examples of \ref tui_change_color "Changing Display Parameters". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/common_operation.doc b/doc/salome/gui/GEOM/input/common_operation.doc index dfefce0df..f6903e24c 100644 --- a/doc/salome/gui/GEOM/input/common_operation.doc +++ b/doc/salome/gui/GEOM/input/common_operation.doc @@ -2,19 +2,25 @@ \page common_operation_page Common -\n To produce a \b Common operation in the Main Menu select Operations - > Boolean - > Common +For detail description of the Boolean operations please refer to +this document. +It provides a general review of the Partition and Boolean +operations algorithms, describes the usage methodology and highlighs +major limitations of these operations. -\n This operation cuts the common part of two shapes and transforms it into an independent geometrical object. +To produce a \b Common operation in the Main Menu select Operations - > Boolean - > Common -\n The \b Result will be any \b GEOM_Object. -\n TUI Command: geompy.MakeCommon(s1, s2) -\n Arguments: Name + 2 shapes. -\n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". +This operation cuts the common part of two shapes and transforms it into an independent geometrical object. + +The \b Result will be any \b GEOM_Object. +TUI Command: geompy.MakeCommon(s1, s2) +Arguments: Name + 2 shapes. +Advanced option: +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html bool2.png -\n Example: +Example: \image html fusesn1.png "The initial shapes" diff --git a/doc/salome/gui/GEOM/input/creating_3dsketcher.doc b/doc/salome/gui/GEOM/input/creating_3dsketcher.doc index bb914ea55..fcc0ba56d 100755 --- a/doc/salome/gui/GEOM/input/creating_3dsketcher.doc +++ b/doc/salome/gui/GEOM/input/creating_3dsketcher.doc @@ -4,22 +4,33 @@ 3D Sketcher allows creating a closed or unclosed 3D wire from a list of points. -To create a 3D Sketch, select in the main menu New Entity -> 3D Sketch. +To create a 3D Sketch, select in the main menu New Entity -> Basic -> 3D Sketch. \image html 3dsketch2.png -The position of each coordinates can be defined by absolute coordinates X, Y, Z or -by relative coordinates DX, DY, DZ with respect to the previous Applied point. -Type of coordinates can be selected by the Coordinates Type radio buttons. -\n "Sketch Validation" button applies the wire, only red part will be built by "Sketch Validation". -\n "Sketch Closure" will close the Sketch by straight line from last red part and apply it. -To make a closed wire using the TUI command, the first and the last point shoul +In this dialog it is possible to define the coordinates of the points. + +The position of each point can be defined by \b Absolute coordinates X, Y, Z or +by \b Relative coordinates DX, DY, DZ with respect to the previous Applied point. +The type of coordinates can be selected by the Coordinates Type +radio buttons. + +To add the point in the list of points and to proceed with the +definition of the next point, click Apply button. \b Undo and +\b Redo buttons, respectively, remove or restore the last point in the list. + +\n "Sketch Validation" button applies the wire, built by the +user, "as is". +\n "Sketch Closure" closes the Sketch by a straight line from +the start to the end point and applies it. + +To make a closed wire using the TUI command, the first and the last point should have the same coordinates. The Result of the operation will be a \b GEOM_Object. TUI Command: geompy.Make3DSketcher( [ PointsList ] ) -This algorithm creates a wire, from the list of real values which define XYZ +This algorithm creates a wire from the list of real values, which define XYZ coordinates of points. Example: diff --git a/doc/salome/gui/GEOM/input/creating_adv_obj.doc b/doc/salome/gui/GEOM/input/creating_adv_obj.doc index 26b0b4601..648a18ae9 100644 --- a/doc/salome/gui/GEOM/input/creating_adv_obj.doc +++ b/doc/salome/gui/GEOM/input/creating_adv_obj.doc @@ -2,16 +2,13 @@ \page create_adv_obj_page Creating Advanced Geometrical Objects -New Entity -> Build submenu allows to create topological -entities: +New Entity -> Advanced submenu allows to create additional complex topological objects.
    -
  • \subpage create_edge_page
  • -
  • \subpage create_wire_page
  • -
  • \subpage create_face_page
  • -
  • \subpage create_shell_page
  • -
  • \subpage create_solid_page
  • -
  • \subpage create_compound_page
  • +
  • \subpage create_pipetshape_page
  • +
  • \subpage create_divideddisk_page
  • +
  • \subpage create_dividedcylinder_page
  • +
- -*/ \ No newline at end of file + +*/ diff --git a/doc/salome/gui/GEOM/input/creating_basic_go.doc b/doc/salome/gui/GEOM/input/creating_basic_go.doc index 49e3b2f34..aea41d9b3 100644 --- a/doc/salome/gui/GEOM/input/creating_basic_go.doc +++ b/doc/salome/gui/GEOM/input/creating_basic_go.doc @@ -12,10 +12,11 @@ geometrical objects as:
  • \subpage create_ellipse_page
  • \subpage create_arc_page
  • \subpage create_curve_page
  • +
  • \subpage create_sketcher_page
  • +
  • \subpage create_3dsketcher_page
  • \subpage create_vector_page
  • \subpage create_plane_page
  • -
  • \subpage create_wplane_page
  • \subpage create_lcs_page
  • -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/creating_box.doc b/doc/salome/gui/GEOM/input/creating_box.doc index 817088463..7df825189 100644 --- a/doc/salome/gui/GEOM/input/creating_box.doc +++ b/doc/salome/gui/GEOM/input/creating_box.doc @@ -30,10 +30,7 @@ accessible only via \b TUI commands. this way you don't need to create them in advance). \n TUI Command: geompy.MakeBox(x1,y1,z1,x2,y2,z2) \n Arguments: Name + X, Y and Z coordinates of both points. -\note You can also use variables defined in the SALOME \b NoteBook -to specify any numerical parameters of the box. -\image html box3.png Example: diff --git a/doc/salome/gui/GEOM/input/creating_compound.doc b/doc/salome/gui/GEOM/input/creating_compound.doc index d139c2b11..ad1a899fe 100644 --- a/doc/salome/gui/GEOM/input/creating_compound.doc +++ b/doc/salome/gui/GEOM/input/creating_compound.doc @@ -11,7 +11,7 @@ Entity - > Build - > Compound. \n TUI Command: geompy.MakeCompound(ListOfShape) \n Arguments: Name + List of shapes. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html neo-obj7.png diff --git a/doc/salome/gui/GEOM/input/creating_curve.doc b/doc/salome/gui/GEOM/input/creating_curve.doc index e442851bf..9c3371826 100644 --- a/doc/salome/gui/GEOM/input/creating_curve.doc +++ b/doc/salome/gui/GEOM/input/creating_curve.doc @@ -5,37 +5,95 @@ To create a \b Curve in the Main Menu select New Entity - > Basic - > Curve -\n There are three algorithms to create a \b Curve in the 3D space. Each -time you define it by a list of \b Points through which the curve -passes. The three Curve Construction menu choices correspond to three +There are three Curve Construction menu choices corresponding to three possible types of curves: Polyline, Besier or B-spline (Interpolated). -\n The \b Result of each operation will be a GEOM_Object (edge). +The curve is defined by a list of \b Points through which it passes. + -\n TUI Commands: +\n There are two ways to define these Points:
      -
    • geompy.MakePolyline(ListOfShapes)
    • -
    • geompy.MakeBezier(ListOfShapes)
    • -
    • geompy.MakeInterpol(ListOfShapes)
    • +
    • By Selection manual picking of the points in the Object Browser or 3D Viewer. +
    • Analytical parametric definition of the points through +python expressions.
    -ListOfShape is a list of points through which the curve passes. -Arguments: Name + at least 2 points which will serve as nodes -on the curve. - -\image html curve.png +\n The \b Result of each operation will be a GEOM_Object (edge). -Examples: +Polyline \image html polyline.png -
    Polyline
    + +Polyline or polygonal chain is a connected series of line segments. It +can be defined by the following parameters: + +\image html curve2.png + +
      +
    • Points at least 2 points which will serve as nodes on the curve.
    • +
    • Build a closed wire checkbox allows creating the curve as +closed wire.
    • +
    + +\n TUI Command: geompy.MakePolyline(ListOfShapes,isClosed) + +Bezier \image html bezier.png -
    Bezier
    + +Bezier curve is a curve completely contained in a convex hull of its +control points. It can be defined by the following parameters: + + +\image html curve3.png + +
      +
    • Points at least 2 points used to approximate the curve.
    • +
    • Build a closed edge checkbox allows creating the curve as +closed edge.
    • +
    + +\n TUI Command: geompy.MakeBezier(ListOfShapes,isClosed) + +B-spline \image html interpol.png -
    B-Spline
    + +B-spline is a union of curve segments defined at each node span. It +can be defined by the following parameters: + +\image html curve4.png + +
      +
    • Points at least 2 points which will serve as nodes on the curve.
    • +
    • Build a closed edge checkbox allows creating the curve as +closed edge.
    • +
    • If Reorder vertices taking into account distances is +checked, the interpolation algorithm does not follow the order of +vertices but searches for the closest vertex.
    • +
    + +\n TUI Command: +geompy.MakeInterpol(ListOfShapes,isClosed,doReordering) + +Analytical Definition + +The input parameters for analytical definition are common for all +types of curves. + +\image html curve1.png + +
      +
    • X(t)equation, Y(t)equation, Z(t)equation are python +expressions for X, Y and Z coordinates of the basic points of the curve.
    • +
    • Min t, Max t are minimum and maximum values of the parameter \b t.
    • +
    • Step is the number of steps of the parameter \b t.
    • +
    + +\n TUI Command: geompy.MakeCurveParametric(XExpr, YExpt, ZExpt, tMin, tMax, nbSteps, curveType, True) + +\nAdvanced options \ref preview_anchor "Preview" Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_curve "Basic Geometric Objects". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/creating_dividedcylinder.doc b/doc/salome/gui/GEOM/input/creating_dividedcylinder.doc new file mode 100644 index 000000000..1b9de1e2d --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_dividedcylinder.doc @@ -0,0 +1,27 @@ +/*! + +\page create_dividedcylinder_page DividedCylinder + +The Divided cylinder object is a cylinder divided into \b blocks for easy hexaedral meshing. + +\image html dividedcylinder.png + +To create a \b DividedCylinder in the Main Menu select New Entity - > +Advanced - > DividedCylinder + +Specify the parameters of the DividedCylinder object creation in the opened dialog +box and press "Apply" or "Apply & Close" button. +Result of each operation will be a GEOM_Object. + +TUI Command: geompy.MakeDividedCylinder(R, H) + +Arguments: +- \b R - Radius of the cylinder +- \b H - Height of the cylinder + +\image html dividedcylinder_dlg.png + +Our TUI Scripts provide you with useful examples of creation of +\ref tui_creation_dividedcylinder "Advanced objects". + +*/ diff --git a/doc/salome/gui/GEOM/input/creating_divideddisk.doc b/doc/salome/gui/GEOM/input/creating_divideddisk.doc new file mode 100644 index 000000000..b42460f40 --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_divideddisk.doc @@ -0,0 +1,48 @@ +/*! + +\page create_divideddisk_page DividedDisk + +The Divided disk object is a disk divided into \b blocks. It means that it's a shape prepared for hexaedral meshing. + +\n Moreover this shape can be used as a basis in an \ref create_extrusion_alongpath_page "Extrusion along a path" operation in order to obtain any tube shape prepared for hexaedral meshing +(see example below). + +Example: + +\image html divided_disk.png + +To create a Divided Disk in the Main Menu select New Entity - > +Advanced - > DividedDisk + +\n Then there are 2 ways to create a Divided Disk in 3D space. +\n For both operations : +Specify the parameters of the DividedDisk object creation in the opened dialog +box and press "Apply" or "Apply & Close" button. +Result of each operation will be a GEOM_Object. + +\n First way : by radius and orientation (plane "OXY", "OYZ" or "OZX"). The resulting disk is located at the origin of coordinates + +TUI Command: geompy.MakeDividedDisk(Radius, Orientation) + +Arguments: +- \b Radius - Radius of the disk +- \b Orientation - Plane on wich the disk will be built + +\image html divided_disk_dlg.png + +\n Second way : by giving its center, normal and radius. + +TUI Command: geompy.MakeDividedDiskPntVecR(Center, Vector, +Radius) + +Arguments: +- \b Center - Center of the disk +- \b Vector - Normal to the plane of the disk +- \b Radius - Radius of the disk + +\image html divided_disk_PntVecR_dlg.png + +Our TUI Scripts provide you with useful examples of creation of +\ref tui_creation_divideddisk "Advanced objects". + +*/ diff --git a/doc/salome/gui/GEOM/input/creating_edge.doc b/doc/salome/gui/GEOM/input/creating_edge.doc index 6d45a5418..f22f4c495 100644 --- a/doc/salome/gui/GEOM/input/creating_edge.doc +++ b/doc/salome/gui/GEOM/input/creating_edge.doc @@ -2,25 +2,68 @@ \page create_edge_page Edge -\n To create an \b Edge in the Main Menu select New Entity- > Build - > Edge +To create an \b Edge, in the Main Menu select New Entity > +Build > Edge -\n You can create an \b Edge from two points (\b Point1 and \b Point2), being the first and the last vertices of the edge. +There are three ways to create an edge. In all cases the \b Result +will be a \b GEOM_Object (EDGE). -The \b Result will be a \b GEOM_Object (EDGE). +Firstly, you can create a linear \b Edge by specifying two points (\b Point1 and +\b Point2), which are the first and the last vertices of the edge. -TUI Command: geompy.MakeEdge(Vertex1, Vertex2), where -Vertex1 and Vertex2 are correspondingly the first and the last vertex -of the edge. +TUI Command: geompy.MakeEdge(Vertex1, Vertex2)
    +Arguments: Name + 2 vertices (Vertex1 and Vertex2 are +correspondingly the first and the last vertex of the edge). -Arguments: Name + 2 vertices. +\image html edge1.png "Create edge by two points" -\image html neo-obj2.png +Secondly, you can create an \b Edge by specifying a single wire. -\n Example: +In this mode the following use cases are possible: +- All edges that form the wire lie on the same geometrical curve +(i.e. curve(edge1) == curve(edge2)). +- The edges that form the wire lie on analytical curves of the same +type, for example, segments of line, arcs, etc. In this case, the +algorithm checks geometrical coincidence of these curves using +a certain tolerance. If the curves are coinciding in terms of the given +tolerance, the resulting edge is built as if on a single curve. +- The edges that form the wire have the same tangency in the connection +points. In this case the curves are interpolated by the single +b-spline curve with sufficient precision. The resulting edge will +be built on this curve. + +The case when the edges that form the wire have different tangency in +the connection points (sharp bend) is not processed. + +TUI Command: geompy.MakeEdgeWire(Wire, LinearTolerance, AngularTolerance)
    +Arguments: Name + 1 wire + Linear Tolerance + Angular Tolerance +(tolerance values are used to check coincidence of the underlying curves). + +\image html edge2.png "Create edge from wire" + +Thirdly, it is possible to build an edge of required \b Length on any existing +\b Edge. + +Start Point parameter is optional: +- if used, it allows selecting any existing point - in such a case the start point +of the new edge will be chosen as start or end point of the selected \b Edge +whatever is closest to the selected Start Point +- if it is missed, the start point of the initial edge is used + +Length can exceed the length of the initial edge length or be +negative. In this case the existing edge is extrapolated +along its curve (except for bezier and b-spline curves). + +TUI Command: geompy.MakeEdgeOnCurveByLength(Edge, Length, StartPoint = None)
    +Arguments: Name + 1 edge + Length + 1 Vertex + +\image html edge3.png "Create edge on curve" + +Example: \image html edgesn.png "Edge" Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_edge "Advanced Geometric Objects". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/creating_ellipse.doc b/doc/salome/gui/GEOM/input/creating_ellipse.doc index 2beaa9086..8f67658bb 100644 --- a/doc/salome/gui/GEOM/input/creating_ellipse.doc +++ b/doc/salome/gui/GEOM/input/creating_ellipse.doc @@ -4,17 +4,30 @@ To create an \b Ellipse in the Main Menu select New Entity - > Basic - > Ellipse -\n You can define an \b Ellipse by its Center Point, a \b -Vector giving its normal, and its Major & Minor Radiuses. +\n You can define an \b Ellipse by its Center point, a \b +Vector giving its normal, another vector specifying the direction of +ellipse's Major Axis and its Major & Minor Radiuses. \n The \b Result of the operation will be a GEOM_Object (edge). -\n TUI Command: geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor) +\note The parameters Center, Vector and Major Axis +are optional. By default it is presumed that the Center point +is located at the origin of the global coordinate system, the \b Vector +corresponds to the OZ axis of the global coordinate system and Major Axis +corresponds to the OX axis of the global coordinate system. + + +\note The actual direction of the major axis vector is defined as + Vmaj' = (Vn * Vmaj) * Vn, where \em Vn is a normal vector and +\em Vmaj is an original vector of the major axis. + +\n TUI Command (no major axis): geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor) \n Arguments: Name + 1 vertex (for the center) + 1 edge (for the direction) + 1 X Radius + 1 Y Radius. -\note By default it is presumed that the Center Point is located at the Origin of the global -coordinate system, and the \b Vector corresponds to OZ axis of the global -coordinate system. +\n TUI Command (use major axis):geompy.MakeEllipseVec(Point, Vector, RadiusMajor, RadiusMinor, VectorMajor) +\n Arguments: Name + 1 vertex (for the center) + 1 edge (for +the normal direction) + 1 X Radius + 1 Y Radius + 1 edge (for the +major axis direction) \image html ellipse.png diff --git a/doc/salome/gui/GEOM/input/creating_explode.doc b/doc/salome/gui/GEOM/input/creating_explode.doc index 747aba637..b2f971864 100644 --- a/doc/salome/gui/GEOM/input/creating_explode.doc +++ b/doc/salome/gui/GEOM/input/creating_explode.doc @@ -2,12 +2,12 @@ \page create_explode_page Explode -\n To \b Explode an object into subshapes, in the Main Menu +\n To \b Explode an object into sub-shapes, in the Main Menu select New Entity > Explode. -\n To create a list of subshapes (vertices, edges, wires etc.) of the +\n To create a list of sub-shapes (vertices, edges, wires etc.) of the given shape using the \b Explode operation, you need to define the Main -Object, which will be exploded and the Type of Subshapes you wish to +Object, which will be exploded and the Type of Sub-shapes you wish to obtain from it. \n The \b Result of the operation will be a List of \b GEOM_Objects (vertexes, edges, wires, faces, shells or solids). @@ -15,25 +15,29 @@ obtain from it. \n Using TUI Commands you can perform this operation in a variety of ways:
      +
    • geompy.ExtractShapes(Shape, Type, isSorted) explodes a +Shape into sub-shapes of a given Type and returns a List of sub-shapes. +This method does not return the Shape itself if it matches the +Type.
    • geompy.SubShapeAll(Shape, Type) explodes a Shape on -subshapes of a given Type and returns a List of sub-shapes.
    • +sub-shapes of a given Type and returns a List of sub-shapes.
    • geompy.SubShapeAllIDs(Shape, Type) explodes a Shape on -subshapes of a given Type and returns a List of IDs of +sub-shapes of a given Type and returns a List of IDs of sub-shapes.
    • -
    • geompy.SubShapeAllSorted(Shape, Type) xplodes a shape on -subshapes of a given type and sorts them by coordinates of their -gravity centers, returning a list of sub-shapes.
    • -
    • geompy.SubShapeAllSortedIDs(Shape, Type) explodes a shape -on subshapes of a given type and sorts them by coordinates of their -gravity centers, returning a List of IDs of sub-shapes.
    • +
    • geompy.SubShapeAllSortedCentres(Shape, Type) explodes a +shape on sub-shapes of a given type and sorts them by coordinates of +their gravity centers, returning a list of sub-shapes.
    • +
    • geompy.SubShapeAllSortedCentresIDs(Shape, Type) explodes +a shape on sub-shapes of a given type and sorts them by coordinates of +their gravity centers, returning a List of IDs of sub-shapes.
    • geompy.SubShape(Shape, Type, ListOfInd) allows to obtain a compound of sub-shapes of the Shape, selected by they indices in a list of all sub-shapes of the given Type. Each index is in the range [1, Nb_Sub-Shapes_Of_Given_Type].
    • -
    • geompy.SubShapeSorted(Shape, Type, ListOfInd) allows to -obtain a compound of sub-shapes of the Shape, selected by they indices -in sorted list of all sub-shapes of the given Type. Each index is in -the range [1, Nb_Sub-Shapes_Of_Given_Type]
    • +
    • geompy.SubShapeSortedCentres(Shape, Type, ListOfInd) +allows to obtain a compound of sub-shapes of the Shape, selected by +they indices in sorted list of all sub-shapes of the given Type. Each +index is in the range [1, Nb_Sub-Shapes_Of_Given_Type]
    \n Arguments: 1 SHAPE + 1 type of SubShape. diff --git a/doc/salome/gui/GEOM/input/creating_extrusion.doc b/doc/salome/gui/GEOM/input/creating_extrusion.doc index 6cc92388c..104b7a286 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion.doc @@ -5,42 +5,54 @@ \n To generate an \b Extrusion on an object in the Main Menu select New Entity - > Generation - > Extrusion -\n There are 2 algorithms for creation of an \b Extrusion (Prism). +\n There are 3 algorithms for creation of an \b Extrusion (Prism). \n The \b Result of the operation will be a GEOM_Object (edge, face, shell solid or compsolid). \n Firstly, you can define the Base Shape (a basis of the extrusion), the \b Vector (a direction of the extrusion) and the \b -Height of extrusion. +Height of extrusion. Optionally you can define the Scale Factor to +build extrusion with scaled opposite base. Scaling is possible only +with 1D and 2D bases. +
    It is possible to select in GUI several Base Shapes to make +several extrusions (using Shift button). \n The \b Result of the operation will be a GEOM_Object (edge, face, shell, solid or compsolid). -\n Both Directions checkbox allows extruiding the source -object both forward and backward. -\n TUI Command: geompy.MakePrismVecH(Base, Vector, Height) -\n Arguments: Name + 1 shape (vertex, edge, planar wire, face or -shell) serving as base object + 1 vector (for direction of the -extrusion) + 1 value (dimension). +\n Both Directions checkbox allows extruding the source +object both forward and backward. With this option scaling is not possible. +\n TUI Command: geompy.MakePrismVecH(Base, Vector, Height, theScaleFactor = -1.0) +\n Arguments: Name + one or several shapes (vertex, edge, planar wire, face or +shell) serving as base objects + 1 vector (for direction of the +extrusion) + 1 value (dimension) + 1 optional value (scale factor for +the opposite base). +\nAdvanced options \ref preview_anchor "Preview" \image html extrusion1.png -\n Secondly, you can define the \b Extrusion by the Base Shape +\n Secondly, you can define the \b Extrusion by the Base Shape(s) and the \b Start and End Point of the \b Vector (in this way -you don't need to create it in advance). -\n Both Directions checkbox allows extruiding the source -object both forward and backward. -\n TUI Command: geompy.MakePrism(Base, Point1, Point2) -\n Arguments: Name + 1 shape (vertex, edge, planar wire, face or -shell) serving as base object + 2 vertices. +you don't need to create it in advance). Optionally you can define the +Scale Factor to build extrusion with scaled opposite +base. Scaling is possible only with 1D and 2D bases. +\n Both Directions checkbox allows extruding the source +object both forward and backward. With this option scaling is not possible. +\n TUI Command: geompy.MakePrism(Base, Point1, Point2, theScaleFactor = -1.0) +\n Arguments: Name + one or several shapes (vertex, edge, planar wire, face or +shell) serving as base objects + 2 vertices + 1 optional value (scale factor for +the opposite base). \image html extrusion2.png -\n Finally, you can define the \b Extrusion by the Base Shape -and the DX, DY, DZ Vector\n +\n Finally, you can define the \b Extrusion by the Base Shape(s) +and the DX, DY, DZ Vector. Optionally you can define the +Scale Factor to build extrusion with scaled opposite +base. Scaling is possible only with 1D and 2D bases.\n Both Directions checkbox allows extruding the -source objects both forward and backward. -\n TUI Command: geompy.MakePrismDXDYDZ(Base, dx, dy, dz) -\n Arguments: Name + 1 shape (vertex, edge, planar wire, face or -shell) serving as base object + 3 axis directions. +source objects both forward and backward. With this option scaling is not possible. +\n TUI Command: geompy.MakePrismDXDYDZ(Base, dx, dy, dz, theScaleFactor = -1.0) +\n Arguments: Name + one or several shapes (vertex, edge, planar wire, face or +shell) serving as base objects + 3 axis directions + 1 optional value (scale factor for +the opposite base). \image html extrusion3.png diff --git a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc index 7095d2e59..4af2ea093 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc @@ -7,12 +7,13 @@ To generate a \b Pipe in the Main Menu select New Entity - > Generatio \n Firstly, to create an extruded \b Pipe shape, you can define the Base Object (vertex, edge, planar wire, face or shell), which will be extruded and the Path Object (edge or wire) along which the Base -Object will be extruded. +Object will be extruded.
    +It is possible to select in GUI several Base Objects to make several pipes (using Shift button). \n In this mode the default pipe generation algorithm is used. The pipe -is created in such a way that the angle between the normal vector to -the base shape and the tangent to the path wire at any point of the -given path is kept constant. -\n Check Box Select unpublished edges - if checked, allows to select an edge of any other shape as the path object. +is created so that the angle between the normal vector to +the base shape and the tangent to the path wire remains constant at any point of the +given path. +\n Select unpublished edges checkbox - if checked, allows to select an edge of any other shape as the path object. \n The \b Result of the operation will be a GEOM_Object (edge, face, shell, solid or compsolid). @@ -20,22 +21,24 @@ solid or compsolid). \n Arguments: Name + 1 shape (vertex, edge, planar wire, face or shell) serving as base object + 1 shape (edge or wire) for definition of the path. +\n Advanced options \ref preview_anchor "Preview" \image html pipe.png Example: -\image html pipe_wire_edgesn.png "Extrusion of wire" +\image html pipe_wire_edgesn.png "Extrusion of a wire" \n Secondly, you can define the Base Object (edge, planar wire or face), which will be extruded, the Path Object (edge or wire) along which the Base -Object will be extruded and the Vector (edge or wire). +Object will be extruded and the BiNormal Vector (edge or +wire). + \n In contrast to the default mode, in this mode the pipe is generated -in such a way that the angle between the normal vector to the base -shape and the BiNormal vector given as the third argument is kept -constant. -\n Check Box Select unpublished edges - if checked, allows to select an edge of any other shape as the path object. +to preserve the constant angle between the normal vector to the base +shape and the BiNormal vector given as the third argument. +\n Select unpublished edges checkbox - if checked, allows to select an edge of any other shape as the path object. \n The \b Result of the operation will be a GEOM_Object (edge, face, shell, solid or compsolid). @@ -49,7 +52,7 @@ BiNormal direction to perform the extrusion. Example: -\image html pipebinormalsn.png "Extrusion of face with BiNormal parameter" +\image html pipebinormalsn.png "Extrusion of a face with BiNormal parameter" Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_pipe "Complex Geometric Objects". diff --git a/doc/salome/gui/GEOM/input/creating_face.doc b/doc/salome/gui/GEOM/input/creating_face.doc index 11cd76498..1bfd520dd 100644 --- a/doc/salome/gui/GEOM/input/creating_face.doc +++ b/doc/salome/gui/GEOM/input/creating_face.doc @@ -17,6 +17,8 @@ placement of the wires. If some resulting wires remain open, they will be added in the resulting compound "as is". \n Check Try to create a planar face to create a planar face or nothing if it is impossible. +\note Please note, that the resulting face can have a huge tolerance, if the initial wire has a big deviation from the plane. If the final tolerance exceeds 1e-06, a warning will be shown, but the face will be created and published in the study in a normal way. Using such faces can lead to failures or unpredictable results in most operations. + \n The \b Result will be a \b GEOM_Object (FACE). \n TUI Command: geompy.MakeFaceWires([list of Shapes], isPlanarWanted) @@ -33,6 +35,6 @@ face or nothing if it is impossible. \image html facesn3.png "Examples of faces" Our TUI Scripts provide you with useful examples of creation of -\ref tui_creation_squareface "Primitives". +\ref tui_creation_face "Advanced Geometric Objects". */ diff --git a/doc/salome/gui/GEOM/input/creating_filling.doc b/doc/salome/gui/GEOM/input/creating_filling.doc index fd4407f1e..874cac94b 100644 --- a/doc/salome/gui/GEOM/input/creating_filling.doc +++ b/doc/salome/gui/GEOM/input/creating_filling.doc @@ -4,24 +4,43 @@ To generate a \b Filling in the Main Menu select New Entity - > Generation - > Filling -To create a curving face using several edges you need to define the +To create a curvilinear face from several edges you need to define the following parameters: -\n Edges Compound - the list of edges used for creation of the -surface; -\n \b Minimum and Maximum Degree of equation of the resulting BSpline or Besier curves describing the surface; +\n Input Compound - the list of edges/wires used for creation +of the surface. To prepare for the filling each wire of the compound +is converted to an edge created on a BSpline curve built using curves +from all edges of the wire. +\n \b Minimum and Maximum Degree of equation of the resulting +BSpline or Besier curves describing the surface; \n \b Tolerance for \b 2D and for \b 3D - minimum distance between the created surface and the reference edge; -\n Number of -Iterations - defines the maximum number of iterations. The iterations are repeated until the required tolerance is reached. So, a greater number of iterations allows producing a better surface. -\n Approximation - if checked, BSpline curves are generated in the process of surface construction (using GeomAPI_PointsToBSplineSurface functionality). By default the surface is created using Besier curves. The usage of Approximation makes the algorithm work slower, but allows building the -surface for rather complex cases. +\n Number of Iterations - defines the maximum number of iterations. The +iterations are repeated until the required tolerance is reached. So, a +greater number of iterations allows producing a better surface. +\n Method - Kind of method to perform filling operation + +
      +
    1. Default - the standard behaviour.
    2. +
    3. Use edges orientation - the edges orientation is used: if an edge is +reversed, the curve from this edge is reversed before being used by the filling +algorithm.
    4. +
    5. Auto-correct edges orientation - curves orientation is changed to +minimize the sum of distances between ends points of edges.
    6. +
    + +\n Approximation - if checked, BSpline curves are generated in +the process of surface construction (using +GeomAPI_PointsToBSplineSurface functionality). By default the surface +is created using Besier curves. The usage of Approximation +slows the algorithm, but allows building the surface for complex cases. \n The \b Result of the operation will be a GEOM_Object (face). \n TUI Command: geompy.MakeFilling(Edges, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter) -\n Arguments: Name + 1 List of edges + 6 Parameters +\n Arguments: Name + 1 List of edges + 7 Parameters (Min. degree, Max. degree, Number of iterations, 2D tolerance, 3D -tolerance, Number of iterations, Appro). +tolerance, Number of iterations, Method, Approximation). +\n Advanced options \ref preview_anchor "Preview" \image html filling.png diff --git a/doc/salome/gui/GEOM/input/creating_geom_objects.doc b/doc/salome/gui/GEOM/input/creating_geom_objects.doc index ae5dfb8c7..66178b2ea 100644 --- a/doc/salome/gui/GEOM/input/creating_geom_objects.doc +++ b/doc/salome/gui/GEOM/input/creating_geom_objects.doc @@ -15,13 +15,13 @@ extrusion, rotation, interpolation of other objects. lower dimension, which belong to the objects of higher dimension.
  • \subpage build_by_blocks_page "Build by blocks" faces from edges and solids from faces.
  • -
  • create line segments and arcs using \subpage create_sketcher_page -"Sketcher".
  • -
  • create a closed or unclosed 3D wire from a list of points using -\subpage create_3dsketcher_page "3D Sketcher".
  • \subpage create_explode_page "Explode" objects of higher dimension into sub-objects of lower dimension.
  • -
  • create \subpage create_adv_obj_page "Advanced geometrical objects" - edges, wires, shells...
  • +
  • create \subpage create_topological_obj_page "Topological objects" - edges, wires, shells...
  • +\note It is possible to use the variables defined in the SALOME \b NoteBook + to specify the numerical parameters for creation of any object. + + */ diff --git a/doc/salome/gui/GEOM/input/creating_hexaedral_solid.doc b/doc/salome/gui/GEOM/input/creating_hexaedral_solid.doc new file mode 100644 index 000000000..fbfa2dc3d --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_hexaedral_solid.doc @@ -0,0 +1,49 @@ +/*! + +\page create_hexa_solid_page Hexaedral solid + +\n Description: Builds a hexahedral solid. either of the below +mentioned arguments. This operation allows to build a solid bypassing +the intermediate stage of building a shell and 4 faces (in the case of +building by 2 faces) or just a shell (in the case of building by 6 +faces). + +\n The \b Result of the operation will be a \b GEOM_Object (solid). + +\n TUI Command: +
      +
    • geompy.MakeHexa2Faces(F1, F2), where F1 and F2 are faces +from which the hexahedron is constructed, other four faces are created +automatically.
    • +
    • geompy.MakeHexa(F1, F2, F3, F4, F5, F6), where F1 — F6 are six faces from which the hexahedron is constructed.
    • +
    + +\n Arguments: +
      +
    • Name + 2 Faces, or
    • +
    • Name + 6 Faces.
    • +
    + +\n Dialog Box: + +\image html block4.png + + + +\image html block5.png + +\n Example: + +\image html image180.png +
    Hexahedral Solid built on the base of six Faces
    + +\image html image181.png +
    Hexahedral Solid built on the base of two Faces
    + + +The created blocks can be processed with \ref blocks_operations_page "Operations on Blocks". + +Our TUI Scripts provide you with useful examples of +\ref tui_building_by_blocks_page "Building by Blocks". + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/creating_lcs.doc b/doc/salome/gui/GEOM/input/creating_lcs.doc index 6b714f9c2..1c06b2cc3 100644 --- a/doc/salome/gui/GEOM/input/creating_lcs.doc +++ b/doc/salome/gui/GEOM/input/creating_lcs.doc @@ -17,6 +17,7 @@ YDY, YDZ is a a vector of OY direction of the LCS. \n Secondly, you can simply select any object in the object browser or 3D viewer, in this case the coordinates of origin and axes direction of the LCS are calculated automatically basing on the selected object. +\n TUI command: geompy.MakeMarkerFromShape(theShape). \n Arguments: Name + reference object. \image html neo-localcs2.png @@ -24,17 +25,21 @@ of the LCS are calculated automatically basing on the selected object. \n The last algorithm of LCS construction allows to define the coordinates of origin by a point and axes directions by a line or a vector. -\n Arguments: Name + 1 point of origin + X axis direction, Y -axis direction. +\n TUI command: geompy.MakeMarkerPntTwoVec(Center, VectorX, +VectorY) where Center is the origin of the coordinate system, +VectorX is the direction of OX axis and VectorY is the direction of OY axis. +\n Arguments: Name + 1 point of origin + X axis direction, Y axis direction. \image html neo-localcs3.png -Press «OK» or «Apply» button to create an LCS at the location with the +Press \c OK or \c Apply button to create an LCS at the location with the specified coordinates. The new object is shown in the Object Browser and in 3D viewer. Example: -\image html image145.jpg "Local Coordinate System" +\image html image145.png "Local Coordinate System" -*/ \ No newline at end of file +TUI Script provides you with a useful example of +\ref tui_creation_lcs "Local Coordinate System" creation. +*/ diff --git a/doc/salome/gui/GEOM/input/creating_pipetshape.doc b/doc/salome/gui/GEOM/input/creating_pipetshape.doc new file mode 100644 index 000000000..b7f448ed9 --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_pipetshape.doc @@ -0,0 +1,59 @@ +/*! + +\page create_pipetshape_page PipeTShape + +To create a \b PipeTShape in the Main Menu select New Entity -> Primitives -> PipeTShape + +Specify the parameters of the PipeTShape object in the opened dialog +box and press "Apply" or "Apply & Close" button. +The result of the operation will be a GEOM_Object. + +TUI Command: geompy.MakePipeTShape(R1, W1, L1, R2, W2, L2, HexMesh=True, P1=None, P2=None, P3=None) + +Arguments: +- \b R1 - Radius of the main T-shape pipe. +- \b W1 - Thickness of the main T-shape pipe. +- \b L1 - Length of the main T-shape pipe. +- \b R2 - Radius of the incident T-shape pipe. +- \b W2 - Thickness of the incident T-shape pipe. +- \b L2 - Length of the incident T-shape pipe. +- \b HexMesh - If True, the shape is splitted into blocks (suitable for hexaedral mesh). +- \b P1 - First junction point of the main pipe (GEOM Vertex). +- \b P2 - Second junction point of the main pipe (GEOM Vertex). +- \b P3 - Junction point of the incident pipe (GEOM Vertex). + +\n Advanced options \ref preview_anchor "Preview" + +\image html pipetshape_dlg.png + +Example: + +\image html pipetshape.png + +A Pipe T-Shape can be created with a chamfer at the junction of the main and the incident pipes: + +TUI Command: geompy.MakePipeTShapeChamfer(R1, W1, L1, R2, W2, L2, H, W, HexMesh=True, P1=None, P2=None, P3=None) + +The arguments are the same as of the normal Pipe T-Shape plus: +- \b H - Height of the chamfer along the incident pipe. +- \b W - Width of the chamfer along the main pipe. + +Example: + +\image html pipetshapechamfer.png + +A Pipe T-Shape can be created with a fillet at the junction of the main and the incident pipes: + +TUI Command: geompy.MakePipeTShapeFillet(R1, W1, L1, R2, W2, L2, RF, HexMesh=True, P1=None, P2=None, P3=None) + +The arguments are the same as of the normal Pipe T-Shape plus: +- \b RF - Radius of the fillet. + +Example: + +\image html pipetshapefillet.png + +Our TUI Scripts provide you with useful examples of creation of +\ref tui_creation_pipetshape "Advanced objects". + +*/ diff --git a/doc/salome/gui/GEOM/input/creating_plane.doc b/doc/salome/gui/GEOM/input/creating_plane.doc index c6116021b..5573f61e4 100644 --- a/doc/salome/gui/GEOM/input/creating_plane.doc +++ b/doc/salome/gui/GEOM/input/creating_plane.doc @@ -26,15 +26,25 @@ of the plane). \image html plane2.png -\n Finally, you can define a \b Plane by another \b Plane or Local -Coordinate System and a Size of the Plane. To change selection type cilck the corresponding -radio button "Face" or "Local Coordinate System". +\n Thirdly, you can define a \b Plane by another \b Plane or Face and a Size of the Plane. \n TUI Command: geompy.MakePlaneFace(Face, TrimSize) -\n Arguments: Name + 1 face + 1 value (to define the size of -the plane). +\n Arguments: Name + 1 face + 1 value (to define the size of the plane). \image html plane3.png +\n Fourthly, you can define a \b Plane by two Vectors. The first vector defines the center point and the direction, +the second vector defines the normal to the Plane. +\n TUI Command: geompy.MakePlane2Vec(Vec1, Vec2, TrimSize) +\n Arguments: Name + 2 vectors + 1 value (to define the size of the plane). + +\image html plane4.png + +\n Finally, you can define a \b Plane by the Local Coordinate System and the orientation (OXY, OYZ, OZX). +\n TUI Command: geompy.MakePlaneLCS(LCS, TrimSize, [1, 2, or 3]) +\n Arguments: Name + LCS + 1 value (to define the size of the plane) + 1 value (to define the orientation) + +\image html plane5.png + Examples: \image html planes1.png diff --git a/doc/salome/gui/GEOM/input/creating_point.doc b/doc/salome/gui/GEOM/input/creating_point.doc index 3c992c8f0..9844a3cff 100644 --- a/doc/salome/gui/GEOM/input/creating_point.doc +++ b/doc/salome/gui/GEOM/input/creating_point.doc @@ -31,17 +31,39 @@ point is located in the middle of the edge. \n TUI Command: geompy.MakeVertexOnCurve(Edge,Parameter). \n Arguments: Name + 1 edge + 1 Parameter defining the position of the point on the given edge. - \image html point3.png -\n Fourthly, we can define a point by intersection of two \b Lines. -\n TUI Command: geompy.MakePointOnLinesIntersection(myLine1,myLine2). -\n Arguments: Name + 2 lines +Alternatively, it is possible to define a point by an \b Edge and a \b Length. +The \b Length defines the position of the point on the given edge. It +can exceed the length of the edge or be negative. In this case the edge +is extrapolated along its curve (except for bezier and b-spline +curves). +The Start Point defines the direction for the length +calculation (if not defined, the first vertex of +Edge is used, else the vertex of Edge closest to StartPoint is used). +\n TUI Command: geompy.MakeVertexOnCurveByLength(Edge,Length,StartPoint=None). +\n Arguments: Name + 1 edge + 1 Length + 1 Point. + +\image html point3_3.png + +It is also possible to define 3D coordinates of the point +projected on the given edge to produce the resulting point. +\n TUI Command: geompy.MakeVertexOnCurveByCoord(Edge,X,Y,Z). +\n Arguments: Name + 1 edge + 3 coordinate values of the +projected point. +\image html point3_2.png + +\n Fourthly, we can define a point(s) by intersection of two \b Lines or \b Wires (or a Wire and a Line). +If they intersect only once, a point will be created. If there are several intersections, a compound of +points will be created. The type of the selected object (Line or Wire) can be changed in the popup menu, +after clicking the corresponding selection button. (see the picture below) +\n TUI Command: geompy.MakePointOnLinesIntersection(myLine1,myWire1). +\n Arguments: Name + 2 1D objects \image html point4.png -Example: -\n Finally, we can define a point by a \b Face and two Parameters: U and \b V +\n Finally, we can define a point by a \b Face and +Two Parameters: U and \b V indicating its position on the Face, ranging from 0.0 to 1.0. For example, (0.5; 0.5) means that the point is located in the middle of the face. \n TUI Command: geompy.MakeVertexOnSurface(myFace,myUParameter,myVParameter). @@ -50,6 +72,13 @@ position of the point on the given face. \image html point5.png +Alternatively, it is possible to define 3D coordinates of the point projected on the given face. +\n TUI Command: geompy.MakeVertexOnSurface(myFace,X,Y,Z). +\n Arguments: Name + 1 face + 3 coordinate values +to project point on the given face. + +\image html point5_2.png + Example: \image html points.png "Points by edge and parameter and by coordinates" diff --git a/doc/salome/gui/GEOM/input/creating_primitives.doc b/doc/salome/gui/GEOM/input/creating_primitives.doc index 1800330b5..babf1e227 100644 --- a/doc/salome/gui/GEOM/input/creating_primitives.doc +++ b/doc/salome/gui/GEOM/input/creating_primitives.doc @@ -2,7 +2,7 @@ \page create_primitives_page Creating Primitives -New Entity -> Primitives submenu allows to create voluminal +New Entity -> Primitives submenu allows to create volumical geometrical objects, such as:
      @@ -11,8 +11,9 @@ geometrical objects, such as:
    • \subpage create_sphere_page
    • \subpage create_torus_page
    • \subpage create_cone_page
    • -
    • \subpage create_squareface_page "Face"
    • +
    • \subpage create_squareface_page
    • \subpage create_disk_page
    • +
    • \subpage create_pipetshape_page
    -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/creating_quadrangle_face.doc b/doc/salome/gui/GEOM/input/creating_quadrangle_face.doc new file mode 100644 index 000000000..1aa7c91f8 --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_quadrangle_face.doc @@ -0,0 +1,43 @@ +/*! + +\page create_quadrangle_face_page Quadrangle face + +\n Description: Builds a face using the below mentioned +arguments. This operation allows to build a face bypassing the +intermediate stage of building edges and wires (in the case of +building by 4 points) or wires (in the case of building by 4 or 2 +edges). + +\n The \b Result of the operation will be a \b GEOM_Object (face). + +\n TUI Command: +
      +
    • geompy.MakeQuad4Vertices(V1, V2, V3, V4), where V1, V2, +V3, V4 are four vertices from which a face is constructed. Edges are +created automatically.
    • +
    • geompy.MakeQuad2Edges(E1, E2), where E1, E2 are edges from +which the face is constructed, two other edges are created +automatically.
    • +
    • geompy.MakeQuad(E1, E2, E3, E4), where E1, E2, E3, E4 are +four edges from which the face is constructed.
    • +
    + +Arguments: +
      +
    • Name + 4 Points, or
    • +
    • Name + 2 Edges, or
    • +
    • Name + 4 Edges.
    • +
    + +\n Dialog Box: + +\image html block1.png + +\image html block2.png + +\image html block3.png + +\n Example: +\image html image185.png "Quadrangle face built by blocks" + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/creating_revolution.doc b/doc/salome/gui/GEOM/input/creating_revolution.doc index 80c7ebc5f..4e649ad7c 100644 --- a/doc/salome/gui/GEOM/input/creating_revolution.doc +++ b/doc/salome/gui/GEOM/input/creating_revolution.doc @@ -7,7 +7,8 @@ select New Entity - > Generation - > Revolution \n To create an extruded shape by \b Revolution you need to define the source \b Object to rotate, the \b Axis of revolution and the \b Angle by which -the \b Shape has to be rotated around the \b Axis (in degrees). +the \b Shape has to be rotated around the \b Axis (in degrees).
    +It is possible to select in GUI several objects to make several revolutions (using Shift button). \n Both Directions checkbox allows extruding the source object both forward and backward. \n The \b Result of the operation will be a GEOM_Object (edge, face, shell, @@ -15,6 +16,7 @@ solid or compsolid). \n TUI Command: geompy.MakeRevolution(Shape, Axis, Angle). \n Arguments: Name + 1 shape (vertex, edge, planar wire, face or shell) serving as base object + 1 vector (for direction) + 1 value (angle). +\n Advanced options \ref preview_anchor "Preview" \image html revolution.png diff --git a/doc/salome/gui/GEOM/input/creating_sketcher.doc b/doc/salome/gui/GEOM/input/creating_sketcher.doc index ce1a6e78d..7aa11153a 100644 --- a/doc/salome/gui/GEOM/input/creating_sketcher.doc +++ b/doc/salome/gui/GEOM/input/creating_sketcher.doc @@ -1,39 +1,104 @@ /*! -\page create_sketcher_page Sketcher +\page create_sketcher_page 2D Sketcher -Sketcher allows to create curves of 2 types: line segment and arc. -By default the start point of the curve is located at the point of -origin of the reference coordinate system and the curve lies in the -plane XOY. The end of the curve is defined by -means of "destination", which can be a destination point (for segment -only) or destination direction coupled with length of a segment or -angle and radius of an arc. +The 2D Sketcher allows you to draw 2D shapes on a working plane. You +can create sketches of two types: -\n Sketcher is able to create planar curves only. Therefore, it is -necessary to select a working plane before starting a sketch (by -default, XOY plane is used). Sketcher creates curves lying in the -current working plane (New Entity -> Basic -> Working Plane). +
      +
    • \b Profile made of connected curves of 2 types: line segments and \b arcs. -\n This functionality is available from the main menu via New -Entity / Sketch. +\b or -\n The Result of the operation will be a \b GEOM_Object. +
    • \b Rectangle +
    -\n TUI Command: geompy.MakeSketcher(Command, WorkingPlane) -\n This algorithm creates a sketcher (wire or face), following the -textual description, passed through the Command argument. The edges of -the resulting wire or face will be arcs of circles and/or linear -segments. -\n \em Command is a string, defining the sketcher by the coordinates of -points in the local working plane. -\n WorkingPlane can be a plane or a planar face. The plane is -defined by the XYZ coordinates of three non-coincident points. The -planar face is an existing GEOM_Object. +The \b Result is a \b Wire + +\n Example: + +\image html sketch_example.png + +To create a 2D Sketch: + +
      +
    1. In the main menu select New Entity -> Basic -> 2D Sketch or click on \image html sketch.png
    2. + +
    3. Select the \b plane or the planar face on which to create the sketch. +\note By default the sketch is created on the XOY plane of the global coordinate system. +If Local Coordinate Systems have been created in the study they appear +in the combobox and can be selected as a reference coordinate system.
    4. + +
    5. Choose a \b segment or an \b arc element to start a \b profile or choose \b rectangle to draw a rectangle. + +\n If you draw a \b profile: + +
    6. Select a start point. By default the start point of the curve is located at the point of +origin of the reference coordinate system.
    7. + +
    8. Create curve portions and click on \b Apply after each step.
    9. + +
    10. Select either \b Close or Sketch Closure if you want to close the profile before closing the window.
    11. +
    + +\n To create a \b Segment: + +
      +
    1. In the Element Type part of the dialog box select: + +\image html line_icon.png
    2. + +
    3. You can define the segment by either its end point or \b direction and \b length. The direction is defined relatively to the tangent at the last point of the sketch. It can be: +
        +
      • Tangent (colinear to the tangent at the last point)
      • +
      • Perpendicular
      • +
      • Defined by an angle
      • +
      • Defined by a vector (Vx, Vy)
      • +
      + +
    4. + +
    + +\n To create an \b Arc: + +
      +
    1. In the Element Type part of the dialog box select \image html arc_icon.png
    2. + +
    3. You can define the segment by either its end point or \b direction \b radius and \b angle.
    4. + +
        +
      • In case of an end point the arc can be built in three different ways:
      • +
          +
        • From the end point only. The arc is \b tangential to the end of the sketch.
        • +
        • From the end point and a \b radius. (The radius must be greater than half of the distance between the last point and the end point of the arc).
        • +
        • From the \b center of the circle and the end point. The constraint on the center is first taken into account. + The destination point is only used to define the angle of the arc and won't lie on the arc in the general case.
        • +
        + +
      • The direction is defined relatively to the tangent at the last point of the sketch. It can be:
      • + +
          +
        • Tangent (colinear to the tangent at the last point)
        • < +
        • Perpendicular
        • +
        • Defined by an angle
        • +
        • Defined by a vector (Vx, Vy)
        • +
        +
      + +
    + +\note For the first segment or arc of the sketch the reference direction is the X direction of the reference coordinate system. + +\n Dialog Box: + +\image html sketcher_dlg.png \n Arguments:
      -
    1. Element type (segment or arc).
    2. +
    3. Coordinate system (Existing Local CS or Global CS can be selected)
    4. +
    5. A plane or a planar face to define a new Local Coordinate System +
    6. Element type (segment, arc or rectangle).
    7. Destination type (point or direction).
    8. Destination point by means of:
      • @@ -44,30 +109,58 @@ planar face is an existing GEOM_Object.
      • Destination direction by means of:
        • angle between the new segment and the previous one;
        • -
        • perpendicular to the previous segment (same as previous, but angle +
        • perpendicular to the previous segment (same as previous, but the angle is predefined and is equal to 90 degrees);
        • tangent to the previous segment;
        • vector components DX, DY.
        -
      • Parameters of an element (for segment : length or target X or Y coordinate value, for arc : radius and angle).
      • +
      • Parameters of an element (for segment : length or target X or Y coordinate value, for arc : radius, angle or center coordinates).
    \b Buttons: -"Sketch Validation" button applies the wire, only red part will be built by "Sketch Validation". -\n "Sketch Closure" will close the Sketch by straight line from last red part and apply it. +"Restore" button orientates the viewer correspondingly to the chosen working plane and fits the scene to show all its objects. +\n "Close" button applies the wire, only the red part will be built. +\n "Sketch Closure" will close the Sketch by a straight line +from the last red part and apply it. + +\n To draw a \b rectangle: + +
      +
    1. In the Element Type part of the dialog box select \image html rectangle_icon.png
    2. + +
    3. Draw a rectangle with the mouse directly in the view or fill in the coordinates of two opposite vertices of the rectangle.
    4. +
    5. Apply and Close
    6. +
    \n Dialog Box: -\image html neo-scetcher1.png +\image html sketcher_dlg2.png -\image html neo-scetcher2.png +\n Arguments: +
      +
    1. Coordinate system (Existing Local CS or Global CS can be selected)
    2. +
    3. A plane or a planar face to define a new Local Coordinate System +
    4. Element type (segment, arc or rectangle).
    5. +
    6. The X,Y coordinates of two opposite vertices of the rectangle
    7. +
    -\n Example: -\image html image204.jpg "Creation of a circle with sketcher" +\n TUI Command: geompy.MakeSketcherOnPlane(Command, WorkingPlane) +\n This algorithm creates a sketcher (wire or face), following the +textual description, passed through the Command argument. The edges of +the resulting wire or face will be arcs of circles and/or linear +segments. +\n \em Command is a string, defining the sketcher by the coordinates of +points in the current LCS. +\n WorkingPlane can be a Local CS, a plane, or a planar face. + Our TUI Scripts provide you with useful examples of the use of \ref tui_sketcher_page "Sketcher". +A wrapper also exists to help in the construction of a sketcher using simple commands. +The description of this wrapper can be found in the +dedicated page of the salome.geom python package. + */ diff --git a/doc/salome/gui/GEOM/input/creating_squareface.doc b/doc/salome/gui/GEOM/input/creating_squareface.doc index 4267a400f..f10b0e350 100755 --- a/doc/salome/gui/GEOM/input/creating_squareface.doc +++ b/doc/salome/gui/GEOM/input/creating_squareface.doc @@ -1,19 +1,19 @@ /*! -\page create_squareface_page Square Face +\page create_squareface_page Rectangle -A primitive called Square Face is a square plane of certain dimensions and orientation +A primitive called \b Rectangle is a rectangular face of certain dimensions and orientation -To create a \b Square Face in the Main Menu select New Entity - > -Primitives - > Face +To create a \b Rectangle in the Main Menu select New Entity - > +Primitives - > Rectangle -\n There are 2 algorithms to create a \b Square \b Face in the 3D space. +\n There are 2 algorithms to create a \b Rectangle in the 3D space. \n The \b Result of each operation will be a GEOM_Object (Face). -\n Firstly, you can create a \b Face at the origin +\n Firstly, you can create a \b Rectangle at the origin of coordinates defining its boundaries by the height and the width and its axis by the orientation radio buttons (OXY, OYZ or OZX).This -means that the Square Face will lie in "OXY", "OYZ" or "OZX" plane correspondingly. +means that the \b Rectangle will lie in "OXY", "OYZ" or "OZX" plane correspondingly. \n TUI Command: geompy.MakeFaceHW(Height, Width, Orientation) \n Arguments: Name + 3 values (Dimensions at origin: heigth, width and orientation). @@ -21,12 +21,12 @@ orientation). \image html face1.png -\n Secondly, you can define a \b Face by the height and the width sizes and an \b Edge defining the normal to the center of the face. +\n Secondly, you can define a \b Rectangle by the height and the width sizes and an \b Edge defining the normal to the center of the face. \n TUI Command: geompy.MakeFaceObjHW(Vector, Height, Width) \n Arguments: Name + 1 Vector (normal to the center) + 2 doubles (to describe a face sizes). -\n It is also possible to create a Square Face from another selected face. For this, switch the Object Type button +\n It is also possible to create a \b Rectangle from another selected face. For this, switch the Object Type button to \b Face, then select a face object and set the values of Height and Width for the new face. The created face will lie in the plane of the selected face. \n TUI Command: geompy.MakeFaceObjHW(Face, Height, Width) @@ -35,9 +35,9 @@ Height and Width for the new face. The created face will lie in the plane of the \image html face2.png Example: -\image html faces.png "Square face" +\image html faces.png "Rectangle" Our TUI Scripts provide you with useful examples of creating -\ref tui_creation_face "Primitives". +\ref tui_creation_squareface "Primitives". */ diff --git a/doc/salome/gui/GEOM/input/creating_topological_obj.doc b/doc/salome/gui/GEOM/input/creating_topological_obj.doc new file mode 100644 index 000000000..aff1438e7 --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_topological_obj.doc @@ -0,0 +1,17 @@ +/*! + +\page create_topological_obj_page Creating Topological Objects + +New Entity -> Build submenu allows to create topological +entities: + +
      +
    • \subpage create_edge_page
    • +
    • \subpage create_wire_page
    • +
    • \subpage create_face_page
    • +
    • \subpage create_shell_page
    • +
    • \subpage create_solid_page
    • +
    • \subpage create_compound_page
    • +
    + +*/ diff --git a/doc/salome/gui/GEOM/input/creating_vector.doc b/doc/salome/gui/GEOM/input/creating_vector.doc index 331180e95..2b02312b6 100644 --- a/doc/salome/gui/GEOM/input/creating_vector.doc +++ b/doc/salome/gui/GEOM/input/creating_vector.doc @@ -23,7 +23,7 @@ coordinates by its End Point. Example: -\image html image34.gif "A vector by two points and a vector from the origin of coordinates" +\image html image34.png "A vector by two points and a vector from the origin of coordinates" Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_vector "Basic Geometric Objects". diff --git a/doc/salome/gui/GEOM/input/creating_wire.doc b/doc/salome/gui/GEOM/input/creating_wire.doc index 54cf6c79a..917332160 100644 --- a/doc/salome/gui/GEOM/input/creating_wire.doc +++ b/doc/salome/gui/GEOM/input/creating_wire.doc @@ -4,14 +4,22 @@ \n To create a \b Wire in the Main Menu select New Entity - > Build - > Wire -\n You can create a \b Wire from several connected edges and wires by +\n You can create a \b Wire from several connected edges or wires by selecting them in the object browser or in the viewer holding Shift button. -\n The \b Result will be a \b GEOM_Object (WIRE). -\n TUI Command: geompy.MakeWire(ListOfShape) +It is possible to select wires or edges from objects. To specify sub-shape type, use +the Object Type radio buttons. -Arguments: Name + List of connected wires or edges. +Select \b Tolerance which will be used to check the +connections. If the \b Tolerance value is more than 1e-07, and a gap +within this tolerance is detected, the corresponding edges will be modified to +connect in the middle of the gap. +\n The \b Result will be a \b GEOM_Object (WIRE). + +\n TUI Command: geompy.MakeWire(ListOfShape, Tolerance) + +Arguments: Name + List of connected wires or edges + Tolerance. \n Dialog Box: @@ -24,4 +32,4 @@ button. Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_wire "Advanced Geometric Objects". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/creating_wplane.doc b/doc/salome/gui/GEOM/input/creating_wplane.doc deleted file mode 100644 index bb453c8a6..000000000 --- a/doc/salome/gui/GEOM/input/creating_wplane.doc +++ /dev/null @@ -1,40 +0,0 @@ -/*! - -\page create_wplane_page Working Plane - -Definition of a Working Plane is necessary for work with -\ref create_sketcher_page "Sketcher". - -\n To create a Working Plane in the Main Menu select -New Entity - > Basic - > Working Plane - -\n There is a number of algorithms to set the Working Plane and the -Camera Position. - -\n Firstly, you can select a \b Plane, a Planar Face or a Local Coordinate System to be your Working Plane. -\n Arguments: Name + 1 selection (plane or planar face). - -\image html workplane4.png - -\n Secondly, you can define a Working Plane by two Vectors. -\n Arguments: Name + 2 vectors. - -\image html workplane5.png - -\n Finally, you can select one of three basic projections of XYZ -coordinate system to be your Working Plane. - -\image html workplane6.png - -Reverse the plane normal checkbox allows changing the direction -of the working plane. - -Example: Working plane on the upper face of a box. - -\image html image36.gif -
    Normal Direction
    - -\image html image47.gif -
    Reversed Direction
    - -*/ diff --git a/doc/salome/gui/GEOM/input/cut_operation.doc b/doc/salome/gui/GEOM/input/cut_operation.doc index bab9ca7b8..5ea6c5dfc 100644 --- a/doc/salome/gui/GEOM/input/cut_operation.doc +++ b/doc/salome/gui/GEOM/input/cut_operation.doc @@ -2,19 +2,25 @@ \page cut_operation_page Cut -\n To produce a \b Cut operation in the Main Menu select Operations - > Boolean - > Cut +For detail description of the Boolean operations please refer to +this document. +It provides a general review of the Partition and Boolean +operations algorithms, describes the usage methodology and highlighs +major limitations of these operations. -\n This operation cuts a shape with another one. -\n The \b Result will be any \b GEOM_Object. -\n Arguments: Name + 2 shapes. -\n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". +To produce a \b Cut operation in the Main Menu select Operations - > Boolean - > Cut -\n Dialog Box: +This operation cuts a shape with another one. +The \b Result will be any \b GEOM_Object. +Arguments: Name + 2 shapes. +Advanced option: +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". + +Dialog Box: \image html bool3.png -\n Example: +Example: \image html fusesn1.png "The initial shapes" diff --git a/doc/salome/gui/GEOM/input/deflection.doc b/doc/salome/gui/GEOM/input/deflection.doc new file mode 100644 index 000000000..1d523f3b4 --- /dev/null +++ b/doc/salome/gui/GEOM/input/deflection.doc @@ -0,0 +1,19 @@ +/*! + +\page deflection_page Deflection + +\n In this menu you can change the deflection coefficient of the +shape. The less is the coefficient the better is the quality of the shape in the +viewer. + +\n Arguments: 1 floating point value (deviation coefficient). + +\image html neo-deflection.png + +\n Example: + +\image html deflection_001.png + +\image html deflection_0001.png + +*/ diff --git a/doc/salome/gui/GEOM/input/display_mode.doc b/doc/salome/gui/GEOM/input/display_mode.doc index 8fe2d92f4..f8eaeccf0 100644 --- a/doc/salome/gui/GEOM/input/display_mode.doc +++ b/doc/salome/gui/GEOM/input/display_mode.doc @@ -12,15 +12,24 @@ Wireframe or Shading. \n TUI Command: gg.setDisplayMode(ID, Short) -\n Examples: - \image html disp_mode1sn.png
    Wireframe
    \image html /disp_mode2sn.png
    Shading
    +\n It is possible to show the direction of edges of the selected +shape. For this, choose in the context menu of the shape +Display mode -> Show Edge Direction, or apply this +functionality for all objects in the current view via the main menu + View -> Display Mode -> Show/Hide Edge Direction. + +\image html vectors_mode.png +
    Vectors Mode (Show Edge Direction)
    + +\n TUI Command: gg.setVectorsMode(ID, Bool) + Our TUI Scripts provide you with useful examples of \ref tui_change_disp_mode "Changing Display Parameters". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/extruded_boss_operation.doc b/doc/salome/gui/GEOM/input/extruded_boss_operation.doc new file mode 100644 index 000000000..8338c6db4 --- /dev/null +++ b/doc/salome/gui/GEOM/input/extruded_boss_operation.doc @@ -0,0 +1,51 @@ +/*! + +\page extruded_boss_operation_page Extruded boss + +The Extruded boss operation allows you to easily add material on a \b solid by extruding a profile along the normal to its plane. + +\image html extruded_boss_example.png + +To produce the extruded boss: + +
      +
    1. Draw the \b profile of the extrusion. It can be: + +
        +
      • a \b Sketch drawn on a + planar face of the initial shape you want to boss.
      • + +
      • any closed edge or wire of this shape (circle, ellipse ...).
      • +
      + +
    2. + +
    3. In the Main Menu select Operations - > Extruded Boss or click on +\image html extruded_boss.png
    4. + +
    5. Fill in the dialog box fields: + +\image html extruded_boss_dlg.png
    6. + +
    + +The input arguments are: + +- The initial shape you want to add material on. It must be a solid or a compound made of a single solid. + +- The \b profile. It must be a \b closed edge or wire and it must be \b planar. + +- The \b height of extrusion. It is calculated from the base profile along the normal to its plane. + +And optionnaly: + +- A draft angle in degrees. Activated by clicking on \image html draft.png + +The direction can be reversed by pushing the Change direction button: \image html change_direction.png + + +This functionality is available via the textual interface with the command: + +\n TUI Command: geompy.MakeExtrudedBoss(InitShape, Profile, Height, Angle), + +*/ diff --git a/doc/salome/gui/GEOM/input/extruded_cut_operation.doc b/doc/salome/gui/GEOM/input/extruded_cut_operation.doc new file mode 100644 index 000000000..0d4d76581 --- /dev/null +++ b/doc/salome/gui/GEOM/input/extruded_cut_operation.doc @@ -0,0 +1,52 @@ +/*! + +\page extruded_cut_operation_page Extruded cut + +The Extruded cut operation allows you to easily remove material from a \b solid by extruding a profile along the normal to its plane. + +\image html extruded_cut_example.png + +To produce the extruded cut: + +
      +
    1. Draw the \b profile of the extrusion. It can be: +
        +
      • a \b Sketch drawn on a planar face of the object you want to cut.
      • +
      • any closed edge or wire of the desired shape (circle, ellipse ...).
      • +
      +
    2. + +
    3. In the Main Menu select Operations - > Extruded Cut or click on + + \image html extruded_cut.png + +
    4. + +
    5. Fill in the dialog box fields: + + \image html extruded_cut_dlg.png + +
    6. +
    + +The input arguments are: + +- The initial shape you want to cut. It must be a solid or a compound made of a single solid. + +- The \b profile. It must be a \b closed edge or wire and it must be \b planar. + +- The \b height of extrusion. It's calculated from the base profile along the normal to its plane. + +And optionnaly: + +- A draft angle in degrees. Activated by clicking on \image html draft.png + +The direction can be reversed by pushing the Change direction button: \image html change_direction.png + + +This functionality is available via the textual interface with the command: + +\n TUI Command: geompy.MakeExtrudedCut(InitShape, Profile, Height,Angle), + + +*/ diff --git a/doc/salome/gui/GEOM/input/features.doc b/doc/salome/gui/GEOM/input/features.doc new file mode 100644 index 000000000..26a4d9966 --- /dev/null +++ b/doc/salome/gui/GEOM/input/features.doc @@ -0,0 +1,20 @@ +/*! + +\page features_page Features + +Geometry module provides the following Features, +which allow to: + + +
      +
    • Produce a \subpage fillet1d_operation_page "1D Fillet" on the + corners of a Wire with Planar Edges.
    • +
    • Produce a \subpage fillet2d_operation_page "2D Fillet" on the corners of a Planar Face.
    • +
    • Produce a \subpage fillet_operation_page "3D Fillet" on the selected + edges of an object.
    • +
    • Produce a \subpage chamfer_operation_page "Chamfer" on the selected edges of an object.
    • +
    • Remove matter from an object by producing an \subpage extruded_cut_operation_page "Extruded Cut".
    • +
    • Add matter to an object by producing an \subpage extruded_boss_operation_page "Extruded Boss".
    • +
    + +*/ diff --git a/doc/salome/gui/GEOM/input/fillet1d_operation.doc b/doc/salome/gui/GEOM/input/fillet1d_operation.doc new file mode 100644 index 000000000..322b7c965 --- /dev/null +++ b/doc/salome/gui/GEOM/input/fillet1d_operation.doc @@ -0,0 +1,35 @@ +/*! + +\page fillet1d_operation_page Fillet 1D + +This operation creates fillets on the corners of a Wire with Planar +Edges. +Note that each couple of edges connected with a vertex, where 1D fillet should be +constructed, have to lie in the same plane. + +\image html fillet1d_2.png + +To produce a \b Fillet 1D in the Main Menu select +Operations - > Fillet 1D + +Define the Wire with planar Edges to create a fillet on, select the necessary +vertexes on this wire in the OCC Viewer and define the \b Radius of the Fillet. + +\b Note: This Operation Works for the Wires with Planar Edges only. + +\b Note: Use option Fuse collinear edges to allow bigger radius + to allow ignoring of possible secant points, i.e. the + joints of collinear edges, thus processing such edges as one. + +TUI Command: geompy.MakeFillet1D(Shape, R, ListVertexes) +\n Arguments: Name + 1 shape + empty list or several vertexes + 1 value (Fillet radius). +\n Advanced options: \ref preview_anchor "Preview" + +Examples: + +\image html fillet1d_1.png "Filleted Wire" + +Our TUI Scripts provide you with useful examples of the use of +\ref tui_fillet1d "Transformation Operations". + +*/ diff --git a/doc/salome/gui/GEOM/input/fillet2d_operation.doc b/doc/salome/gui/GEOM/input/fillet2d_operation.doc index 43701ed90..b6d8bfb5e 100755 --- a/doc/salome/gui/GEOM/input/fillet2d_operation.doc +++ b/doc/salome/gui/GEOM/input/fillet2d_operation.doc @@ -2,20 +2,26 @@ \page fillet2d_operation_page Fillet 2D -This operation creates fillets on the corners of a 2D Planar Face. +This operation creates fillets on the corners of a 2D Planar Face +or a Shell, made of 2D Planar Faces. \image html fillet2d_2.png -To produce a \b Fillet 2D in the Main Menu select -Operations - > Transformation - > Fillet 2D +To produce a Fillet 2D in the Main Menu select +Operations - > Fillet 2D -Define the Planar Face to create a fillet on, select the necessary -vertexes on this face in the OCC Viewer and define the \b Radius of the Fillet. +Define the Planar Face or the Shell to create a fillet +on, select the necessary vertexes on this shape in the OCC Viewer and +define the \b Radius of the Fillet. -\b Note: This Operation Works for the Planar 2D Faces Only. +\b Note: This operation works only for Planar 2D Faces and +shells, made of such faces. For shells, only corner vertexes are +available for fillet building, i.e. the vertexes that belong to only +one face of this shell. -TUI Command: geompy.MakeFillet(Shape, R, ListVertexes) +TUI Command: geompy.MakeFillet2D(Shape, R, ListVertexes) \n Arguments: Name + 1 shape + one or several vertexes + 1 value (Fillet radius). +\n Advanced options \ref preview_anchor "Preview" Examples: diff --git a/doc/salome/gui/GEOM/input/fillet_operation.doc b/doc/salome/gui/GEOM/input/fillet_operation.doc index 8bf2ee1f6..f59fa1030 100644 --- a/doc/salome/gui/GEOM/input/fillet_operation.doc +++ b/doc/salome/gui/GEOM/input/fillet_operation.doc @@ -1,9 +1,9 @@ /*! -\page fillet_operation_page Fillet +\page fillet_operation_page Fillet 3D \n To produce a \b Fillet in the Main Menu select -Operations - > Transformation - > Fillet +Operations - > Fillet \n This operation creates fillets on the edges of a shape. \n The \b Result will be a \b GEOM_Object. @@ -13,6 +13,7 @@ select the Main Object to create a fillet on and to define the \b Radius Fillet. \n TUI Command: geompy.MakeFilletAll(Shape, R) \n Arguments: Name + 1 shape + 1 value (fillet radius). +\n Advanced options \ref preview_anchor "Preview" \image html fillet1.png @@ -23,6 +24,7 @@ the \b Radius of the Fillet. \n TUI Command: geompy.MakeFillet(Shape, R, ShapeType, ListShapes) \n Arguments: Name + 1 shape + one or several edges (or faces) + 1 value (Fillet radius). +\n Advanced options \ref preview_anchor "Preview" \n Alternatively, there is a possibility to create a fillet with a variable radius. For this, toggle the lower radio button and define diff --git a/doc/salome/gui/GEOM/input/first_steps_guide.doc b/doc/salome/gui/GEOM/input/first_steps_guide.doc new file mode 100644 index 000000000..17ca4e8c5 --- /dev/null +++ b/doc/salome/gui/GEOM/input/first_steps_guide.doc @@ -0,0 +1,12 @@ +/*! + +\page first_steps_guide First steps in GEOM + +You can find here some useful information to start working with GEOM + +
      +
    • \subpage partition_explanation "Partition, compounds and boolean operations"
    • +
    + + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/free_faces.doc b/doc/salome/gui/GEOM/input/free_faces.doc new file mode 100644 index 000000000..9ec0cb1f8 --- /dev/null +++ b/doc/salome/gui/GEOM/input/free_faces.doc @@ -0,0 +1,19 @@ +/*! + +\page free_faces_page Check Free Faces + +Highlights all free faces of a given shape. A free +face is a face which is not shared between two objects of the shape. + +\note This functionality works only in VTK viewer. + +\b Result: a list of IDs of all free faces, containing in the shape. + +TUI Command: GetFreeFacesIDs(Shape), where \em Shape is +a shape to be checked. + +See also a \ref tui_free_faces_page "TUI example". + +\image html repair10.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/fuse_edges_operation.doc b/doc/salome/gui/GEOM/input/fuse_edges_operation.doc new file mode 100644 index 000000000..7924f73eb --- /dev/null +++ b/doc/salome/gui/GEOM/input/fuse_edges_operation.doc @@ -0,0 +1,23 @@ +/*! + +\page fuse_edges_operation_page Fuse Collinear Edges within a Wire + +\n To Fuse Collinear Edges within a Wire in the Main Menu +select Repair - > Fuse Collinear Edges within a Wire. +\n This operation removes selected vertices from a given wire in case +if adjacent edges are C1 continuous. The function takes a list of +vertices to suppress as a parameter. If the list is empty, all +vertices in a wire are assumed. + +\n Arguments: Name + a wire + a list of vertices (can be empty). + +\image html fuse_collinear_edges.png + +\n TUI Command: geompy.FuseCollinearEdgesWithinWire(wire, vertices), +where wire is a wire and vertices is a list of +vertices to be suppressed. + +Our TUI Scripts provide you with useful examples of the +\ref tui_fuse_collinear_edges "Fuse Collinear Edges" functionality usage. + +*/ diff --git a/doc/salome/gui/GEOM/input/fuse_operation.doc b/doc/salome/gui/GEOM/input/fuse_operation.doc index ece199c5c..4dd3a7bf5 100644 --- a/doc/salome/gui/GEOM/input/fuse_operation.doc +++ b/doc/salome/gui/GEOM/input/fuse_operation.doc @@ -2,20 +2,26 @@ \page fuse_operation_page Fuse -\n To produce a \b Fuse operation in the Main Menu select +For detail description of the Boolean operations please refer to +this document. +It provides a general review of the Partition and Boolean +operations algorithms, describes the usage methodology and highlighs +major limitations of these operations. + +To produce a \b Fuse operation in the Main Menu select Operations - > Boolean - > Fuse -\n This operation creates a shape from two shapes. +This operation creates a shape from two shapes. -\n The \b Result will be any \b GEOM_Object. -\n TUI Command: geompy.MakeFuse(s1, s2) -\n Arguments: Name + 2 shapes. -\n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". +The \b Result will be any \b GEOM_Object. +TUI Command: geompy.MakeFuse(s1, s2) +Arguments: Name + 2 shapes. +Advanced option: +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html bool1.png -\n Example: +Example: \image html fusesn1.png "The initial shapes" diff --git a/doc/salome/gui/GEOM/input/geometrical_object_properties.doc b/doc/salome/gui/GEOM/input/geometrical_object_properties.doc new file mode 100644 index 000000000..a5b55449a --- /dev/null +++ b/doc/salome/gui/GEOM/input/geometrical_object_properties.doc @@ -0,0 +1,106 @@ +/*! + +\page geometrical_obj_prop_page Geometrical Object Types + +GetType function: + +The Type property of the geometrical object specifies the +way the object has been created. It is an integer identifier that +has a predefined value depending on the function type used for the +object creation. The type of the object can be retrieved using the +\b %GetType() function of the \b GEOM_Object interface. + +For example: the geometrical object created using MakeBox() +functions has type equal to 7. The shape imported from the BREP, +IGES, STEP or other CAD file, has type equal to 1. + +The possible values of the geometrical objects are listed in the table below: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    IDSTRING
    0COPY
    1IMPORT
    2POINT
    3VECTOR
    4PLANE
    5LINE
    6TORUS
    7BOX
    8CYLINDER
    9CONE
    10SPHERE
    11PRISM
    12REVOLUTION
    13BOOLEAN
    14PARTITION
    15POLYLINE
    16CIRCLE
    17SPLINE
    18ELLIPSE
    19CIRC_ARC
    20FILLET
    21CHAMFER
    22EDGE
    23WIRE
    24FACE
    25SHELL
    26SOLID
    27COMPOUND
    28SUBSHAPE
    29PIPE
    30ARCHIMEDE
    31FILLING
    32EXPLODE
    33GLUED
    34SKETCHER
    35CDG
    36FREE_BOUNDS
    37GROUP
    38BLOCK
    39MARKER
    40THRUSECTIONS
    41COMPOUNDFILTER
    42SHAPES_ON_SHAPE
    43ELLIPSE_ARC
    443DSKETCHER
    45FILLET_2D
    46FILLET_1D
    201PIPETSHAPE
    + +Also geompy.py module provides a helper function ShapeIdToType() +that allows converting the geometrical object id value to its string representation. + +For example, the output of the following code: +\code +import geompy +box = geompy.MakeBoxDXDYDZ(10,10,10) +type = geompy.ShapeIdToType(box.GetType()) +print type +\endcode + +will be the "BOX" value. + +GetShapeType function: + +The ShapeType property specifies the geometrical object in terms of +its topologic nature. + +The possible values are defined in the GEOM namespace: { COMPOUND, COMPSOLID, +SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE }
    + +This type can be retrieved using the \b %GetShapeType() function +of the \b GEOM_Object interface. + +For example: +\code +import geompy +import GEOM +box = geompy.MakeBoxDXDYDZ(10,10,10) +type = box.GetShapeType() +print type == GEOM.SOLID +\endcode + +The result is "True". + +*/ diff --git a/doc/salome/gui/GEOM/input/geometry_preferences.doc b/doc/salome/gui/GEOM/input/geometry_preferences.doc new file mode 100644 index 000000000..00301daf9 --- /dev/null +++ b/doc/salome/gui/GEOM/input/geometry_preferences.doc @@ -0,0 +1,93 @@ +/*! + +\page geometry_preferences_page Geometry preferences + +In the \b Geometry module you can set preferences for visualisation of +geometrical figures, which can be used in later sessions with this module. +There is also a special group of preferences controlling input +precision for floating-point data. + +\image html pref15.png + +\par +To redefine any color click on the corresponding line to access to +the Select Color dialog box. + +
      +
    • General
    • +
        +
      • Default display mode - allows to choose between wireframe, shading or +shading with edges.
      • +
      • Default shading color - allows to select default shading +color.
      • +
      • Edges in shading - allows to select default edges color in shading mode.
      • +
      • Default wireframe color - allows to select default +wireframe color (to be applied to any lines not being free boundaries +or isolated lines).
      • +
      • Color of free boundaries - allows to select default color for free boundaries.
      • +
      • Color of edges, vectors and wires - allows to select +default color for edges, vectors and wires (isolated lines).
      • +
      • Color of points - allows to select default color for +vertices.
      • +
      • Color of isolines - allows to select default color for +isolines.
      • +
      • Step value for spin boxes - allows to define the increment +of values set in spin boxes.
      • +
      • Deflection coefficient - allows to define default deflection +coefficient for lines and surfaces. A smaller coefficient provides +better quality of a shape in the viewer.
      • +
      • Default front material - allows to define default front face material.
      • +
      • Default back material - allows to define default back face material.
      • +
      • Edges width - allows to define default width of the edges.
      • +
      • Isolines width - allows to define default width of the isolines.
      • +
      • Preview edges width - allows to define width of the edges for preview.
      • +
      • Measures line width - allows to define lines width of measurements tools.
      • + +
      +
    + +
      +
    • Input fields precision
    • +
        +
      • Length precision - allows to ajust input precision of coordinates and dimensions.
      • +
      • Angular precision - allows to ajust input precision of angles.
      • +
      • Length tolerance precision - allows to ajust input precision of tolerance of coordinates and dimensions.
      • +
      • Angular tolerance precision - allows to ajust input precision of tolerance of angles.
      • +
      • Weight precision - allows to ajust input precision of weight and mass.
      • +
      • Density precision - allows to ajust input precision of density.
      • +
      • Parametric precision - allows to ajust input precision of parametric values.
      • +
      • Parametric tolerance precision - allows to ajust input precision of tolerance in parametric space.
      • +
      +
    + +
      +
    • Marker of Points
    • +
        +
      • Type - allows to select the symbol for representation of +points (cross, asterisk, etc.).
      • +
      • Size - allows to define the size of the marker from 1 +(smallest) to 7 (largest).
      • +
      +
    + +
      +
    • Origin and base vectors
    • +
        +
      • Length of base vectors - allows to define the length +of base vectors.
      • +
      • Auto create - allows to automatically create a point +of origin and three base vectors of the rectangular coordinate +system immediately after the module activation.
      • +
      +
    + + +
      +
    • Operations
    • +
        +
      • Preview - allows to customize the displaying preview by default.
      • +
      +
    + + +*/ diff --git a/doc/salome/gui/GEOM/input/geompy.doc b/doc/salome/gui/GEOM/input/geompy.doc index 90bc578bb..1ab9a5b9d 100644 --- a/doc/salome/gui/GEOM/input/geompy.doc +++ b/doc/salome/gui/GEOM/input/geompy.doc @@ -13,7 +13,7 @@ By the links below you can find sample scripts for all operations provided by Geometry module.
      -
    • \subpage tui_viewing_geom_objs_page
    • +
    • \subpage tui_import_export_page
    • \subpage tui_creating_geom_objs_page
      • \ref tui_basic_geom_objs_page
      • @@ -24,6 +24,7 @@ provided by Geometry module.
      • \ref tui_sketcher_page
      • \ref tui_advanced_geom_objs_page
      +
    • \subpage tui_viewing_geom_objs_page
    • \subpage tui_transformation_page
      • \ref tui_basic_operations_page
      • @@ -33,6 +34,7 @@ provided by Geometry module.
      • \ref tui_repairing_operations_page
    • \subpage tui_measurement_tools_page
    • +
    • \subpage tui_notebook_geom_page
    • \subpage tui_swig_examples_page
      • \ref tui_test_others_page
      • diff --git a/doc/salome/gui/GEOM/input/glue_edges_operation.doc b/doc/salome/gui/GEOM/input/glue_edges_operation.doc new file mode 100644 index 000000000..e7e6a3330 --- /dev/null +++ b/doc/salome/gui/GEOM/input/glue_edges_operation.doc @@ -0,0 +1,60 @@ +/*! + +\page glue_edges_operation_page Glue Edges + +\n To Glue Edges in the Main Menu select Repair - > Glue Edges. + +\n This operation glues edges that are coincident with respect to the +given tolerance value. + +\n Arguments: Name + Compound of shapes + Tolerance value. +\n Advanced option: + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". +\n The \b Result will be a \b GEOM_Object. + + +\image html glue4.png + +\n TUI Command: +\n geompy.MakeGlueEdges(theShape,theTolerance), +\n where \em theShape is a compound of shapes to be glued, and \em + theTolerance is a maximum distance between two faces/edges, which can + be considered as coincident. + +\n It is also possible to manually select the edges that will be +glued - select the shape, specify the tolerance and press \b Detect button. + +\image html glue5.png + +\n \b Geometry module detects the edges where gluing can be +performed and displays a notification. + +\image html glue7.png + +\n The edges that can be glued are colored in red. It is +possible to select the edges for gluing in the 3D viewer. +The selected edges will be marked in white. + +\n TUI Command: +\n geompy.GetGlueEdges(theShape,theTolerance), +\n where \em theShape is a compound of shapes to be glued, \em + theTolerance is a maximum distance between two edges, which can + be considered as coincident. The \b Result will be a list of \b + GEOM_Objects, containing one sub-shape per each detected set of + coincident sub-shapes. + +\n geompy.MakeGlueEdgesByList(theShape,theTolerance,theEdges), +\n where \em theShape is a compound of shapes to be glued, \em + theTolerance is a maximum distance between two edges, which can + be considered as coincident, \em theEdges is a list of + sub-shapes to be glued. + +\n Example: + +\image html glue8.png +
        Box with an edge that can be glued
        + +Our TUI Scripts provide you with useful examples of the use of +Repairing Operations \ref tui_glue_edges "Glue Edges". + +*/ diff --git a/doc/salome/gui/GEOM/input/glue_faces_operation.doc b/doc/salome/gui/GEOM/input/glue_faces_operation.doc index f940075d5..3775aa479 100644 --- a/doc/salome/gui/GEOM/input/glue_faces_operation.doc +++ b/doc/salome/gui/GEOM/input/glue_faces_operation.doc @@ -1,38 +1,63 @@ /*! -\page glue_faces_operation_page Glue Faces +\page glue_faces_operation_page Glue Faces \n To Glue Faces in the Main Menu select Repair - > Glue Faces. + \n This operation glues faces that are coincident with respect to the given tolerance value. -\n The \b Result will be a \b GEOM_Object. - -\n TUI Command: - geompy.MakeGlueFaces(theShape,theTolerance), - where \em theShape is a compound of solids to be glued, \em - theTolerance is a maximum distance between two faces, which can be - considered as coincident. -\n Arguments: Name + Compound of solids + Tolerance value. +\n Arguments: Name + Compound of shapes + Tolerance value. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". +\n The \b Result will be a \b GEOM_Object. \image html glue1.png + +\n TUI Commands: +\n geompy.MakeGlueFaces(theShape,theTolerance,doKeepNonSolids), +\n where \em theShape is a compound of shapes to be glued, \em + theTolerance is a maximum distance between two faces, which can + be considered as coincident. The \em doKeepNonSolids flag allows to + throw away non-solids from the result, if false. The \b Result will + be a new \b GEOM_Object. + \n It is also possible to manually select the faces that will be glued - select the shape, specify the tolerance and press \b Detect button. \image html glue2.png -\n \b Geometry module detects the faces where gluing can be performed and -displays a notification. +\n \b Geometry module detects the faces where gluing can be +performed and displays a notification. \image html glue3.png -\n The faces that can be glued are colored in red. It is possible to -select the faces for gluing in the 3D viewer. The selected faces will -be marked in white. +\n The faces that can be glued are colored in red. It is +possible to select the faces for gluing in the 3D viewer. +The selected faces will be marked in white. + +\n When the faces are glued their edges are glued as well. By default, other +edges are not glued. To force gluing of all edges, check Glue all coincident edges +checkbox. + +\n TUI Commands: +\n geompy.GetGlueFaces(theShape,theTolerance), +\n where \em theShape is a compound of shapes to be glued, \em + theTolerance is a maximum distance between two faces, which can + be considered as coincident. The \b Result will be a list of \b + GEOM_Objects, containing one sub-shape per each detected set of + coincident sub-shapes. + +\n geompy.MakeGlueFacesByList(theShape,theTolerance,theFaces,doKeepNonSolids,doGlueAllEdges), +\n where \em theShape is a compound of shapes to be glued, \em + theTolerance is a maximum distance between two faces, which can + be considered as coincident, \em theFaces is a list of + sub-shapes to be glued. The \em doKeepNonSolids flag allows to throw + away non-solids from the result, if false. The \em doGlueAllEdges + allows to glue all edges, not only owned by glued faces. The \b + Result will be a new \b GEOM_Object. \n Example: @@ -46,6 +71,6 @@ be marked in white.
        Manual selection of faces for gluing
        Our TUI Scripts provide you with useful examples of the use of -\ref tui_glue_faces "Repairing Operations". +Repairing Operations \ref tui_glue_faces "Glue Faces". */ diff --git a/doc/salome/gui/GEOM/input/import_export.doc b/doc/salome/gui/GEOM/input/import_export.doc index 1cd5cc459..70537f934 100644 --- a/doc/salome/gui/GEOM/input/import_export.doc +++ b/doc/salome/gui/GEOM/input/import_export.doc @@ -4,7 +4,7 @@ In Geometry module you can import and export geometrical objects from/into BREP, IGES, STEP files. The mechanisms of import and export -are implemented via plug-ins, which gives you the opportunity to +are implemented via plug-ins, which gives the opportunity to expand the range of available formats by adding more plug-ins (for example, CATIA 5). @@ -22,6 +22,25 @@ Select the required file and click \b Open. Your file will be imported in the module and its contents (geometrical object) will be displayed in the Object Browser. +\note If the selected file is in IGES format and the length is not +expressed in meters, it will be suggested to scale the model into the +metric system (see the picture below). This feature can be helpful if +some wrong units have been written to the IGES file by a +3rd-party software. + +\image html iges_unit.png + +\par + +\note If the selected file is in ACIS format (the use of this format +requires licensing) and the file contains names for some shapes, it +will be suggested to create groups by types (solid, face, edge and +vertex) for all named shapes: + +\image html sat_named_shapes.png + +\par + \note It is possible to re-open from the initial file a previously imported shape if the file has been changed on disk. For this, select Reload From Disk in the context menu of the imported @@ -43,5 +62,8 @@ the name and the location of the file for exportation. \par Click \b Save to confirm your exportation. +Our TUI Scripts provide you with useful examples of the use of +\ref tui_import_export_page + */ diff --git a/doc/salome/gui/GEOM/input/importing_picture.doc b/doc/salome/gui/GEOM/input/importing_picture.doc new file mode 100644 index 000000000..6416a0cc0 --- /dev/null +++ b/doc/salome/gui/GEOM/input/importing_picture.doc @@ -0,0 +1,32 @@ +/*! + +\page import_picture_page Import a picture in the OCC viewer + +It is possible in GEOM to import a picture file in the OCC view. +The supported formats are : .bmp, .gif, .pix, .xwd, .rgb, .rs + + +The imported picture (engineering drawing, nautical chart, etc.) may be used as a support for 2D shape design. + +It is possible to create a \ref create_sketcher_page "sketch" on top of this picture or use the +\ref shape_recognition_page "Shape recognition" +functionalities to build geometrical shapes from some elements of the picture (contours, corners ...). + +To import a picture in the view: + +
          + +
        • select New Entity -> Import a picture in the view or click on \image html import_picture.png
        • + +
        • Click on ... and browse your image files to select one of them
        • + +
        • Apply
        • + +
        + +A new Picture object is created. Pan, zoom and rotation operations are available in the view like for any other object. + + +\image html picture_import_dlg.png + +*/ diff --git a/doc/salome/gui/GEOM/input/index.doc b/doc/salome/gui/GEOM/input/index.doc index c5121cabb..26928aaac 100644 --- a/doc/salome/gui/GEOM/input/index.doc +++ b/doc/salome/gui/GEOM/input/index.doc @@ -4,23 +4,37 @@ \image html geomscreen.png +If you are a new user some general information about GEOM usage are given here: +\subpage first_steps_guide + \b Geometry module of SALOME is destined for: -
          -
        • \subpage import_export_geom_obj_page "import and export of geometrical models" in IGES, BREP and STEP formats;
        • -
        • \subpage create_geom_obj_page "construction of geometrical objects" -using a wide range of functions;
        • -
        • \subpage view_geom_obj_page "viewing geometrical objects" in the OCC viewer;
        • -
        • \subpage transform_geom_obj_page "transformation of geometrical objects" using -various algorithms;
        • -
        • \subpage repairing_operations_page "optimization of geometrical objects";
        • -
        • \subpage using_measurement_tools_page "provision of information about geometrical objects".
        • -
        • \subpage using_notebook_geom_page.
        • -
        +- \subpage import_export_geom_obj_page "import and export of geometrical models" + in IGES, BREP and STEP formats; +- \subpage create_geom_obj_page "construction of geometrical objects" + using a wide range of functions; +- \subpage view_geom_obj_page "viewing geometrical objects" in the OCC + viewer; +- \subpage transform_geom_obj_page "transformation of geometrical objects" + using various algorithms; +- \subpage repairing_operations_page "optimization of geometrical objects"; +- viewing \subpage geometrical_obj_prop_page "geometrical object properties" + and other information about geometrical objects using + \subpage using_measurement_tools_page "measurement tools"; +- \subpage pictures_page "designing shapes from pictures"; +- easily setting parameters via the variables predefined in + \subpage using_notebook_geom_page "SALOME notebook". + +Geometry module preferences are described in the +\subpage geometry_preferences_page section of SALOME Geometry Help. Almost all geometry module functionalities are accessible via \subpage geompy_page "Geometry module Python Interface" -\image html image3.jpg "Example of Geometry module usage for engineering tasks" +Other functions are available in salome.geom python package. + +\image html image3.png "Example of Geometry module usage for engineering tasks" +There are also \subpage related_docs_page "additional reference documents" +for Geometry module that can be useful. */ diff --git a/doc/salome/gui/GEOM/input/inertia.doc b/doc/salome/gui/GEOM/input/inertia.doc new file mode 100644 index 000000000..e489b029a --- /dev/null +++ b/doc/salome/gui/GEOM/input/inertia.doc @@ -0,0 +1,21 @@ +/*! + +\page inertia_page Inertia + +Returns the axial moments of inertia for the selected geometrical object. + +\n Result: Displays the matrix of the own moments of inertia and +the relative moments of inertia in the form of Python Tuple +
        (I11, I12, I13,
        +
        I21, I22, I23,
        +
        I31, I32, I33,
        +
        Ix, Iy, Iz).
        +\n TUI Command: geompy.Inertia(Shape), where \em Shape is +a shape for which the own matrix of inertia and the relative moments of inertia are +returned. + +See also a \ref tui_inertia_page "TUI example". + +\image html measures4.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/isolines.doc b/doc/salome/gui/GEOM/input/isolines.doc index 10862f046..4f503afdf 100644 --- a/doc/salome/gui/GEOM/input/isolines.doc +++ b/doc/salome/gui/GEOM/input/isolines.doc @@ -4,7 +4,7 @@ \n In this menu you can change the number of isolines displayed within a shape. -\n Arguments:2 values (number of isolines). +\n Arguments: 2 values (number of isolines). \image html neo-isos.png @@ -14,4 +14,4 @@ a shape. \image html isos_u12_v12sn.png -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc b/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc new file mode 100644 index 000000000..f7c0b2e84 --- /dev/null +++ b/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc @@ -0,0 +1,37 @@ +/*! + +\page limit_tolerance_operation_page Limit Tolerance + +\n To produce a Limit Tolerance operation in the Main + Menu select Repair - > Limit Tolerance. + +\image html limit_tolerance_dlg.png + +\n Arguments: Name + 1 shape + 1 value (new tolerance). + +\n It is possible on all kind of shapes. + +\n The \b Result will be a \b GEOM_Object. + +\n This functionality tries to set a new value of tolerance for the + given shape. However, the final tolerance value also depends on the + initial shape topology (takes into consideration the existing gaps) to obtain + a valid resulting shape. + +\n Example of usage: +
          +
        1. Partition objects obj1 and obj2.
        2. +
        3. Partition fails.
        4. +
        5. Perform Limit Tolerance on objects obj1 and obj2.
        6. +
        7. Try to partition them again.
        8. +
        +See also \ref tui_limit_tolerance "TUI example". + +\n TUI Command: geompy.LimitTolerance(Shape, Tolerance), + where \em Shape is a shape with presumably incorrect tolerance, \em + Tolerance is the required tolerance value. + +Our TUI Scripts provide you with useful examples of +\ref tui_limit_tolerance "Repairing Operations". + +*/ diff --git a/doc/salome/gui/GEOM/input/line_width.doc b/doc/salome/gui/GEOM/input/line_width.doc new file mode 100644 index 000000000..3850a8dcd --- /dev/null +++ b/doc/salome/gui/GEOM/input/line_width.doc @@ -0,0 +1,18 @@ +/*! + +\page line_width_page Line Width + +\n In this menu you can change the width of the edges and isolines displayed within +a shape. + +\n Arguments: 1 value (width of the edge or isoline). + +\image html line_width.png + +\n Example: + +\image html line_width_1.png + +\image html line_width_2.png + +*/ diff --git a/doc/salome/gui/GEOM/input/material.doc b/doc/salome/gui/GEOM/input/material.doc new file mode 100644 index 000000000..4960e06f3 --- /dev/null +++ b/doc/salome/gui/GEOM/input/material.doc @@ -0,0 +1,145 @@ +/*! + +\page material_page Material properties + +\tableofcontents + +\section material_general_description General description + +\note The functionality related to the material properties is +\b experimental, so it might work not as expected. The behaviour might +be changed in the future versions of SALOME Geometry module. + +\n You can change the material properties of the selected shape(s) in +the dedicated dialog box. This dialog box can be invoked from the +context popup menu using "Material properties" item: + +\image html material.png + +In this dialog box you can: +- modify the properties of the material model currenly assigned to the +shape presentation; +- assign one of predefined global materials to the shape; +- create a custom material model and apply it to the shape. + +\note This functionality is available in both OCC and VTK 3D +viewers. However, note that due to the differencies between underlying API +of OCC and VTK libraries the behaviour of the functionality related to +the materials is different: +- presentation of the shape in OCC and VTK viewers is not fully identical; +- some material attributes can affect presentation in a different way. + +\section material_opengl_model OpenGL ligthing model + +The material is specifed by several attributes of the lighting +model. More details can be found in the documentation related to the +OpenGL programming, for example here: http://www.glprogramming.com/red/chapter05.html. + +In the OpenGL lighting model, the light in a scene comes from several +light sources; the light sources have an effect only when there are +surfaces that absorb and reflect light. Each surface is assumed to be +composed of a material with various properties. A material might emit +its own light (like headlights on an automobile), it might scatter +some incoming light in all directions, and it might reflect a +portion of the incoming light in a preferential direction like a +mirror or other shiny surface. + +The OpenGL lighting model considers the lighting to be divided into +four independent components: emissive, ambient, diffuse, and +specular. All four components are computed independently and then +added together. + +Ambient illumination is the light that has been scattered so much by the +environment that its direction is impossible to determine - it seems +to come from all directions. Backlighting in a room has a large +ambient component, since most of the light that reaches your eye has +first bounced off many surfaces. A spotlight outdoors has a tiny +ambient component; most of the light travels in the same direction, +and since you're outdoors, very little of the light reaches your eye +after bouncing off other objects. When ambient light strikes a +surface, it is scattered equally in all directions. + +The diffuse component is the light that comes from one direction, so +it is brighter if it comes squarely down on a surface than if it barely +glances off the surface. Once it hits a surface, however, it's +scattered equally in all directions, so it appears equally bright, no +matter where the eye is located. Any light coming from a particular +position or direction probably has a diffuse component. + +Finally, the specular light comes from a particular direction, and it +tends to bounce off the surface in a preferred direction. A +well-collimated laser beam bouncing off a high-quality mirror produces +specular reflection by almost 100 percent. Shiny metal or plastic has a +high specular component, and chalk or carpet has almost none. You can +think of specularity as shininess. + +Although a light source delivers a single distribution of frequencies, +the ambient, diffuse, and specular components might be different. For +example, if you have a white light in a room with red walls, the +scattered light tends to be red, although the light directly striking +objects is white. OpenGL allows you to set the red, green, and blue +values for each component of light independently. + +\section material Material properties dialog box + +The dialog box consists of two parts: +- The list box at the left shows all available material models, both +predefined by the application and custom one specified by the user. +- The widgets in the right part of the dialog box allows modifyng of +different properties of the material model. + +The following properties of the material model can be specified: +- \b Ambient color and coefficient (floating point value between 0 and 1) +- \b Diffuse color and coefficient (floating point value between 0 and 1) +- \b Specular color and coefficient (floating point value between 0 and 1) +- \b Emissive color and coefficient (floating point value between 0 +and 1). Note: this attribute is applicable only for the OCC viewer; +it simulates light originating from an object. +- \b Shininess +- \b Type of material model: \em physical or \em artificial. + +If the material model is specified as a \em physical one (like \em Gold, +for instance), this means that the color of the shape (more precisely +its \em ambient color) can not be modified. If you assign a physical +material model to the shape, the "Color" menu item will not be +available in the popup menu. + +If the model is non-physical (\em artificial), the color can be changed +to any appopriate one, only other attributes will be constant. In the +dialog box you will be able to modify the color of the shape via the +"Color" button. "Ambient color" button becomes disabled to signalize +that this attribute of the model is ignored. Also, it will be possible +to modify the color of the shape via the +\ref color_page "corresponding popup menu command". + +All available predefined material models are shown in the list box of +the Color and Material Properties dialog: +- [Current] item in the list corresponds to the material model + currently assigned to the selected shape(s). This model can be + freely modified by the user. +- Global material models are shown in blue color in the list; + these are the models predefined by the SALOME Geometry module. The user + is not allowed to modify the global models. +- User materials are shown in black color in the list. These + models are specified by the user and can be modified at any moment. + +The buttons "Add material" and "Remove material" in the lower part of +the dialog box can be used to create or remove custom material +models. The same commands are also available via the popup menu that +is shown if the user presses right mouse button in the materials list +box. An additional "Rename material" command, available in popup menu, +can be used to change the name of material model. + +Examples: + +\image html material_OCC.png +Different materials in OCC viewer + +\image html material_VTK.png +Different materials in VTK viewer + +The default material model is specified via the preferences of Geometry +module. + +*/ + diff --git a/doc/salome/gui/GEOM/input/min_distance.doc b/doc/salome/gui/GEOM/input/min_distance.doc new file mode 100644 index 000000000..690a17f3a --- /dev/null +++ b/doc/salome/gui/GEOM/input/min_distance.doc @@ -0,0 +1,16 @@ +/*! + +\page min_distance_page Min. Distance + +Returns the minimum distance between two geometrical objects and +the coordinates of the vector of distance and shows the vector in the viewer. + +TUI Command: geompy.MinDistance(Shape1, Shape2), +where \em Shape1 and \em Shape2 are shapes between which the minimal +distance is computed. + +See also a \ref tui_min_distance_page "TUI example". + +\image html distance.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/modify_location_operation.doc b/doc/salome/gui/GEOM/input/modify_location_operation.doc index 9ce13b3f8..3f94b0f0b 100644 --- a/doc/salome/gui/GEOM/input/modify_location_operation.doc +++ b/doc/salome/gui/GEOM/input/modify_location_operation.doc @@ -13,7 +13,7 @@ with the origin of the Local Coordinate System. will be removed. \n Arguments: Name + one or several objects + End Coordinate System. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation5.png @@ -21,7 +21,7 @@ will be removed. is to the right and the modified cube with the Local Coordinate System in the center of it is to the left . -\image html image30.gif +\image html image30.png \n The second algorithm modifies the location of an object using Start and End LSC, although the final position of the object will not @@ -34,7 +34,7 @@ otherwise it will be removed. \n Arguments: Name + one or several objects + Start Coordinate System + End Coordinate System. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation6.png @@ -42,30 +42,29 @@ In this picture we see the initial cube with the global coordinate system and two LCS: LocalCS1 (GCS+100 along x-axis) and LocalCS2 (GCS+200 along x-axis) -\image html image1.gif +\image html image1.png Selecting Start LCS = LCS1 and End LCS = LCS2, we obtain the translated cube at the position (100;0;0) -\image html image2.gif +\image html image21.png Selecting Start LCS = LCS2 and End LCS = LCS1, we obtain the translated cube at the position (-100;0;0) -\image html image4.gif +\image html image4.png The third algorithm modifies the location of an object using the Path object (Wire or Edge) and the Distance parameter (ranging from 0 to 1) defining how far the object will move along the path. \n Create a copy checkbox allows to keep the initial object, otherwise it will be removed. -\n Select Unpublished edges checkbox allows to select subshape edges on +\n Select Unpublished edges checkbox allows to select sub-shape edges on the other objects. \n Reverse Direction checkbox allows to REVERSE the direction of the object movement along its path. Arguments: Name + one or several objects + Translation path. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation - parameters and subshapes from arguments". +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation13.png diff --git a/doc/salome/gui/GEOM/input/multi_rotation_operation.doc b/doc/salome/gui/GEOM/input/multi_rotation_operation.doc index eff4bac5d..cdc6234a1 100644 --- a/doc/salome/gui/GEOM/input/multi_rotation_operation.doc +++ b/doc/salome/gui/GEOM/input/multi_rotation_operation.doc @@ -12,7 +12,9 @@ or two dimensions basing on the initial geometrical object. \n To produce a Simple Multi Rotation (in one dimension) you need to define a \b Shape to be rotated, an \b Axis of rotation and a Number of Times the shape must be rotated. Rotation Angle will -be 2*PI/NbTimes +be 2 * \a PI / \a NbTimes. Number of shapes in the resulting compound will be equal +to \a NbTimes (if \a NbTimes = 1, the result will contain only the initial +non-transformed shape). \n TUI Command: geompy.MultiRotate1D(Shape, Axis, NbTimes) \n Arguments: Name + 1 shape + 1 vector for direction + 1 value (repetition). @@ -32,7 +34,10 @@ the same way, but the Axis is defined by direction and point. \b Object around the given \b Axis on the given \b Angle a given Number of Times and multi-translates each rotation result. Translation direction passes through the center of gravity of -the rotated shape and its projection on the rotation axis. +the rotated shape and its projection on the rotation axis. Number of +shapes in the resulting compound will be equal to \a NbTimes1 x \a NbTimes2 (if +both \a NbTimes1 and \a NbTimes2 are equal to 1, the result will contain +only the initial non-transformed shape). \b Reverse checkbox allows to set the direction of rotation. \n TUI Command: geompy.MultiRotate2D(Shape, Axis, Angle, NbTimes1, Step, NbTimes2) \n Arguments: Name + 1 shape + 1 vector for direction + 1 angle diff --git a/doc/salome/gui/GEOM/input/multi_transformation_operation.doc b/doc/salome/gui/GEOM/input/multi_transformation_operation.doc index 668f04a0a..79e450513 100644 --- a/doc/salome/gui/GEOM/input/multi_transformation_operation.doc +++ b/doc/salome/gui/GEOM/input/multi_transformation_operation.doc @@ -19,6 +19,7 @@ defines the second direction of transformation, \em NbTimes is a number of transformations. \n Arguments: Name + 1 hexahedral solid + 1 or 2 faces + 1 integer (number of blocks). +\n Advanced options \ref preview_anchor "Preview" \image html mtransf1.png @@ -35,6 +36,8 @@ faces which define directions of the second transformation, \em NbTimesU and \em NbTimesV are numbers of transformations. \n Arguments: Name + 1 hexahedral solid + 2, 3 or 4 faces + 2 integers (number of blocks). +\n Advanced options \ref preview_anchor "Preview" + \image html mtransf2.png diff --git a/doc/salome/gui/GEOM/input/multi_translation_operation.doc b/doc/salome/gui/GEOM/input/multi_translation_operation.doc index 2bd2ef3fc..0d084f3c1 100644 --- a/doc/salome/gui/GEOM/input/multi_translation_operation.doc +++ b/doc/salome/gui/GEOM/input/multi_translation_operation.doc @@ -7,12 +7,24 @@ select Operations - > Transformation - > Multi Translation \n This operation makes several translations of a shape in \b one or \b two directions. -\n The \b Result will be one or several \b GEOM_Objects (compound). +\n The \b Result will be one or several \b GEOM_Objects +(compound). The total number of shapes in the resulting compound (for +a single initial selected shape) will be equal to: +- in case of \ref single_multi_translation "Single multi translation": +\a NbTimes (if \a NbTimes parameter is equal to 1, the result will +contain only the initial non-translated shape). +- in case of \ref double_multi_translation "Double multi translation": +\a NbTimes1 x \a NbTimes2 (if \a NbTimes1 and \a NbTimes2 parameters +are both equal to 1, the result will contain a single non-translated +initial shape). +\anchor single_multi_translation \n To produce a Simple Multi Translation (in one direction) you need to indicate an \b Object to be translated, a \b Vector of translation, a \b Step of translation and a Number of Times the -Object should be duplicated. +Object should be duplicated. If a curve has been selected instead of +the Vector, only its first and last vertices will be used to get the vector direction +and the dialog preview will display the vector along which the object will be translated. \n TUI Command: geompy.MakeMultiTranslation1D(Shape, Dir, Step, NbTimes) \n Arguments: Name + 1 shape + 1 vector (for direction) + 1 @@ -24,9 +36,12 @@ step value + 1 value (repetition). \image html multi_translation1dsn.png "The result of a simple multi-translation" +\anchor double_multi_translation \n To produce a Double Multi Translation (in two directions) you need to indicate an \b Object to be translated, and, for both axes, a \b Vector of translation, a \b Step of translation and a Number of Times the shape must be duplicated. +If a curve has been selected instead of the Vector, only its first and last vertices will be used to get the vector direction +and the dialog preview will display the vector along which the object will be translated. \n TUI Command: geompy.MakeMultiTranslation2D(Shape, Dir1, Step1, NbTimes1, Dir2, Step2, NbTimes2), where \em Shape is a shape diff --git a/doc/salome/gui/GEOM/input/normal.doc b/doc/salome/gui/GEOM/input/normal.doc new file mode 100644 index 000000000..aa2950b1f --- /dev/null +++ b/doc/salome/gui/GEOM/input/normal.doc @@ -0,0 +1,16 @@ +/*! + +\page normal_page Normal to a Face + +\n Calculates the normal vector to the selected \b Face. The \b Point +is a point of the \b Face, where the Normal should be calculated. + +\n TUI Command: geompy.GetNormal(Face, OptionalPoint = None), where \em Face is +the face to define normale of and \em OptionalPoint is the point to compute the normal at. +If the point is not given, the normale is calculated at the center of mass. + +See also a \ref tui_normal_face_page "TUI example". + +\image html normaletoface.png + +*/ diff --git a/doc/salome/gui/GEOM/input/offset_operation.doc b/doc/salome/gui/GEOM/input/offset_operation.doc index 41dd6dc14..c6fe55082 100644 --- a/doc/salome/gui/GEOM/input/offset_operation.doc +++ b/doc/salome/gui/GEOM/input/offset_operation.doc @@ -16,7 +16,7 @@ the offset. \n Arguments: Name + Object (face(s), shell(s), solid(s)) + Offset value \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation11.png diff --git a/doc/salome/gui/GEOM/input/partition.doc b/doc/salome/gui/GEOM/input/partition.doc index 532f4c375..9af094e70 100644 --- a/doc/salome/gui/GEOM/input/partition.doc +++ b/doc/salome/gui/GEOM/input/partition.doc @@ -2,55 +2,109 @@ \page partition_page Partition -\n To produce a \b Partition in the Main Menu select Operations - > Partition +For detail description of the Partition operation please refer to +this document. +It provides a general review of the Partition and Boolean +operations algorithms, describes the usage methodology and highlighs +major limitations of these operations. -\n This operation builds a compound by intersection of several shapes with a tool object or a plane. -\n The \b Result will be any \b GEOM_Object. +To produce a \b Partition in the Main Menu select Operations - > Partition + +This operation builds a compound by intersection of several shapes +with a set of tool objects or with a plane. +The \b Result will be a \b GEOM_Object.

        Intersection of two shapes.

        -\n As far as the intersection of two objects can produce any type of +\image html partition1.png + +Arguments: Name + 2 lists of shapes (the shapes from the +first list will be intersected with the shapes from the second list) + +Resulting Type of shape. + +As far as the intersection of two objects can produce any type of geometrical objects, Resulting type box allows choosing the preferrable result, i.e. a solid, a shell, a list of faces, etc. -\n TUI Command: geompy.MakePartition(ListOfShapes, -ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs, -ListOfMaterials), where where \em ListOfShapes is a list of shapes to -be intersected and \em ListOfTools is a list of shapes to intersect the -shapes from ListOfShapes. -\n Since the implementation of a new version of PartitionAlgo other -parameters are ignored by the current functionality and remain there -only to support the old scripts. -\n Arguments: Name + 2 lists of shapes (the shapes from the -first list will be intersected with the shapes from the second list) + -reconstruction limit. -\n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". -\image html partition1.png +The Resulting type has to be equal or lower than the type of the +\em Objects. In other words, if the \em Objects don't contain any +shape of this type, Partition fails. -Keep shapes of lower type checkbox allows building geometrical objects. -Only lower type objects will be preserved without the upper ones. +Keep shapes of lower type checkbox manages standalone shapes of +type other than the \em Limit. If it is checked, lower dimension +objects will be preserved, else they will be lost. +For example, you partition a box (Solid) and a face (Face) +without any tool (the box is split in two parts by the shape). If you +choose the Resulting Type "Solid", you will +obtain a compound of two solids, but if you also check Keep shapes of lower +type checkbox, you will obtain a compound of two solids and one +face (there will be a hole in the resulting face, where the original +face intersects with the box, see the corresponding \ref partition_picture_3 "picture" below). -

        Intersection of a Shape and a Plane.

        +No sub-shapes intersection (Compounds only) check box affects +only input shapes of the Compound type. If this option is switched off (default +behavior) each input compound will be automatically exploded into +sub-shapes and the intersection between these shapes will be also +computed. If this option is switched on, the intersection between +sub-shapes will not be performed. In this case the Partition algorithm +will work faster, but the result might differ from the default behavior. + + Advanced option: + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". + +\note Partition is a complex operation, so its result of it depends + on the quality of the initial shapes. Sometimes, if partition fails, + such healing operations as Shape Processing + and Limit Tolerance can help to attune source shapes to obtain correct result of the Partition. + See also \ref tui_limit_tolerance "TUI example" of shape healing. -\n TUI Command: geompy.MakeHalfPartition(Shapes, -Plane), where \em Shapes are a list of Shapes to be intersected -and \em Plane is a Tool shape, to intersect the \em Shapes. -\n Arguments: Name + a list of shapes which will be intersected -+ 1 cutting plane. -\n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". +TUI Command (with sub-shapes intersection): + +geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside, +ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials, +KeepNonlimitShapes) + +TUI Command (without sub-shapes intersection): + +geompy.MakePartitionNonSelfIntersectedShape(ListOfShapes, +ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs, +ListOfMaterials, KeepNonlimitShapes) + +Here, +- \em ListOfShapes is a list of shapes to be intersected +- \em ListOfTools is a list of shapes to intersect the shapes from +\em ListOfShapes +- \em Limit is a Type of resulting shapes +- \em KeepNonlimitShapes is a flag that allows to preserve standalone +shapes of low dimension (than \em Limit) in the result. +- Other parameters are obsolete and kept only for compatibility with +previous versions of SALOME. + +

        Intersection of a Shape and a Plane.

        \image html partition2.png -\n Example: +Arguments: Name + 1 shape to be intersected + 1 cutting plane. + +Advanced option: +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". + +TUI Command: + +geompy.MakeHalfPartition(Shape, Plane), where: +- \em Shape is a source shape to be intersected by the \em Plane +- \em Plane is a tool shape, to intersect the \em Shape. + +Examples: \image html partitionsn1.png "Box intersected by a plane" \image html partitionsn2.png "Result of intersection" -Our TUI Scripts provide you with useful examples of the use of -\ref tui_partition "Basic Operations". +\anchor partition_picture_3 +\image html partitionsn3.png "Result of intersection of a box and a plane (both as \em Objects, no tools) with the Resulting type \em Solid and checked 'Keep shapes of lower type'" + +Our TUI Scripts provide you with useful examples of \ref tui_partition "Basic Operations". */ diff --git a/doc/salome/gui/GEOM/input/partition_explanation.doc b/doc/salome/gui/GEOM/input/partition_explanation.doc new file mode 100644 index 000000000..2725784af --- /dev/null +++ b/doc/salome/gui/GEOM/input/partition_explanation.doc @@ -0,0 +1,55 @@ +/*! + +\page partition_explanation Fuse, Partition and Compound usage + +\tableofcontents + +It is frequently asked about the difference between the above mentioned operations. It's indeed simple. Lets take the example of a cylinder and a box that you want to join together. + +\section sec1 Fuse + +The \b fuse operation will make a single solid from the two given solids. It allows you to build complex models by putting simple shapes together. +\image html fuse.png + +\section sec2 Partition +The \b partition operation will also connect the two solids but it will keep a face at the frontier (in brown on the picture below). The resulting shape will consist in two connected solids that share +a face at their frontier. It means that this face is present only one time in the resulting shape and is a sub-shape of both the box and the cylinder. + +\n This operation allows you to identify different areas in a shape (e.g. different materials) and to ensure a conformal mesh when meshing it later. Indeed the face at the frontier is meshed only once. + +\image html partition.png + + +\section sec3 Compound +When you build a \b compound by using the build -> compound operation you just make an object that contains the two separate solids like in a "bag". +The two solids remain unconnected. The compound is just a set of shapes, no more. + +\n The compound Allows applying operations to a collection of shapes. + +\image html compound2.png + + +\section sec4 Summary + +In the frame of this example we can summarize the following differences: + +
          +
        • \b Fuse +
            +
          • \a Result : A single solid.
          • +
          • \a Purpose : Allows building complex models by putting simple shapes together.
          • +
          +
        • \b Partition +
            +
          • \a Result : Two connected solids sharing faces.
          • +
          • \a Purpose : Useful to ensure a conformal mesh of separated areas of your model (fluid / solid , concrete / steel ...)
          • +
          +
        • \b Compound +
            +
          • \a Result : Two unconnected solids.
          • +
          • \a Purpose : Allows applying operations to a collection of shapes.
          • +
          +
        + + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/pictures.doc b/doc/salome/gui/GEOM/input/pictures.doc new file mode 100644 index 000000000..de4a44859 --- /dev/null +++ b/doc/salome/gui/GEOM/input/pictures.doc @@ -0,0 +1,12 @@ +/*! + +\page pictures_page Designing shapes from pictures + +Some tools in GEOM allow you to create shapes, basing the design on imported pictures (engineering drawings, nautical charts ...) : + +
          +
        • \subpage import_picture_page, such as engeneering drawings or nautical charts as a support for shape design. +
        • \subpage shape_recognition_page previously imported in the OCC viewer . +
        + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/point_coordinates.doc b/doc/salome/gui/GEOM/input/point_coordinates.doc new file mode 100644 index 000000000..d83f62ee1 --- /dev/null +++ b/doc/salome/gui/GEOM/input/point_coordinates.doc @@ -0,0 +1,15 @@ +/*! + +\page point_coordinates_page Point Coordinates + +Returns the coordinates of a point. + +Result: Point coordinates (X, Y, Z) in 3D space in the form of Python Tuple. +\nTUI Command: geompy.PointCoordinates(Point), +where \em Point is a point whose coordinates are inquired. + +See also a \ref tui_point_coordinates_page "TUI example". + +\image html measures1.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/point_marker.doc b/doc/salome/gui/GEOM/input/point_marker.doc new file mode 100644 index 000000000..ddc4a6b3d --- /dev/null +++ b/doc/salome/gui/GEOM/input/point_marker.doc @@ -0,0 +1,56 @@ +/*! + +\page point_marker_page Point Marker + +\n You can change the representation of the geometrical vertices in +the 3D viewer either by selecting one of the predefined +shapes or by loading a custom texture from an external file. + +- Standard point markers + +The Geometry module provides a set of predefined point marker shapes which +can be used to display vertices in 3D viewer. +Each standard point marker has two attributes: type (defines shape +form) and scale factor (defines shape size). + +\image html point_marker_dlg1.png + +TUI Command: go.SetMarkerStd(Type, Size). + +\image html std_point_marker.png "Standard point markers" + +- Custom point markers + +It is also possible to load a point marker shape from an external file. +This file should provide a description of the point texture as a set +of lines; each line is represented as sequence of "0" and "1" symbols, +where "1" symbol means an opaque pixel and "0" symbol means a +transparent pixel. The width of the texture correspond to the length +of the longest line in the file, expanded to the nearest byte-aligned +value. The height of the texture is equal to the number of non-empty +lines in the file. Note that missing symbols are replaced by "0". + +Here is a texture file sample: + +
        +00111100
        +00111100
        +11111111
        +11111111
        +11111111
        +11111111
        +00111100
        +00111100
        +
        + +\image html point_marker_dlg2.png + +TUI Command: go.SetMarkerTexture(ID). + +\image html custom_point_marker.png "Custom point markers" + +Our TUI Scripts provide you with useful examples of +\ref tui_point_marker "Point Marker" setting. + +*/ + diff --git a/doc/salome/gui/GEOM/input/projection_operation.doc b/doc/salome/gui/GEOM/input/projection_operation.doc new file mode 100644 index 000000000..825dfa159 --- /dev/null +++ b/doc/salome/gui/GEOM/input/projection_operation.doc @@ -0,0 +1,27 @@ +/*! + +\page projection_operation_page Projection on a Face + +\n To produce a Projection in the Main Menu select +Operations - > Transformation - > Projection + +\n This operation makes normal projection of a Source vertex, edge + or wire on a given Target face. +\n Arguments: Name + 2 Objects. +\n The \b Result will be an \b Object. + +\image html projection_dlg.png + +\n Example: + +\image html projection_preview.png "The curve (in red) and its projection on the cylindric surface" + +\n TUI Command: geompy.MakeProjection(Source, Target), + where \em Source is a shape which has to be projected, \em Target + is a face, on which the \em Source shape will be projected. The \em + Result will be a \em GEOM_Object. + +Our TUI Scripts provide you with useful examples of the use of +\ref tui_projection "Transformation Operations". + +*/ diff --git a/doc/salome/gui/GEOM/input/propagate_operation.doc b/doc/salome/gui/GEOM/input/propagate_operation.doc index 1c7c3482a..c730c93eb 100644 --- a/doc/salome/gui/GEOM/input/propagate_operation.doc +++ b/doc/salome/gui/GEOM/input/propagate_operation.doc @@ -18,9 +18,9 @@ is a shape to build propagation groups on. \n Example: -\image html image15.jpg "The initial box" +\image html image15.png "The initial box" -\image html image16.jpg "The resulting edges" +\image html image16.png "The resulting edges" Our TUI Scripts provide you with useful examples of the use of \ref tui_propagate "Blocks Operations". diff --git a/doc/salome/gui/GEOM/input/related_docs.doc b/doc/salome/gui/GEOM/input/related_docs.doc new file mode 100644 index 000000000..fea4ba010 --- /dev/null +++ b/doc/salome/gui/GEOM/input/related_docs.doc @@ -0,0 +1,10 @@ +/*! +\page related_docs_page Related Documents + +Here you can find additional reference documents for Geometry module +that can be useful for reading. + +General Fuse Algorithm, Partition +Algorithm, Boolean Operations Algorithm. Backgrounds. + +*/ diff --git a/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc b/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc index ad32a93b7..448c75adf 100644 --- a/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc +++ b/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc @@ -5,13 +5,18 @@ \n To Remove extra edges in the Main Menu select Repair - > Remove extra edges. \n This operation removes all seam and degenerated edges from a given -shape and unites faces and edges, sharing one surface. - -\n TUI Command: geompy.RemoveExtraEdges(theShape), -there theShape is a compound or a single solid to remove irregular edges from. -\n Arguments: Name + one shape. +shape. Its main purpose is healing of solids and compounds to obtain +hexahedral solids and compounds of hexahedral solids. +However, there is an option to unite all faces sharing one +surface, which produces not only hexahedral solids. + +\n TUI Command: geompy.RemoveExtraEdges(theShape,doUnionFaces), +where theShape is a compound or a single solid +and doUnionFaces is a boolean parameter, that regulates, +whether the faces, sharing a common surface, should be united. +\n Arguments: Name + one shape + a flag. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html remove_extra_edges.png @@ -23,4 +28,7 @@ there theShape is a compound or a single solid to remove irregular edge \image html remove_extra_edges2.png
        Improved shape
        +Our TUI Scripts provide you with useful examples of the +\ref swig_RemoveExtraEdges "Remove Extra Edges" functionality usage. + */ diff --git a/doc/salome/gui/GEOM/input/repairing_operations.doc b/doc/salome/gui/GEOM/input/repairing_operations.doc index 542f5c25e..8fd31bab1 100644 --- a/doc/salome/gui/GEOM/input/repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/repairing_operations.doc @@ -1,6 +1,6 @@ /*! -\page repairing_operations_page Repairing Operations +\page repairing_operations_page Repairing geometrical objects Repairing operations improve the shapes, processing them with complex algorithms: @@ -17,12 +17,19 @@ holes with free boundaries on a selected face.
      • \subpage sewing_operation_page "Sewing" - sews faces or shells.
      • \subpage glue_faces_operation_page "Glue faces" - unites coincident faces within the given tolerance.
      • +
      • \subpage glue_edges_operation_page "Glue edges" - unites +coincident edges within the given tolerance.
      • +
      • \subpage limit_tolerance_operation_page "Limit Tolerance" - tries +to set new tolerance value for the given shape.
      • \subpage add_point_on_edge_operation_page "Add point on edge" - splits an edge in two.
      • \subpage change_orientation_operation_page "Change orientation" - reverses the normals of the selected faces.
      • \subpage remove_extra_edges_operation_page "Remove extra edges" - removes seam and degenerated edges from the given shape.
      • +
      • \subpage fuse_edges_operation_page "Fuse Collinear Edges within a Wire" - +removes selected vertices from a given wire in case if adjacent edges +are C1 continuous.
      */ diff --git a/doc/salome/gui/GEOM/input/restore_presentation_parameters.doc b/doc/salome/gui/GEOM/input/restore_presentation_parameters.doc index f97527a1a..d7705a3f0 100644 --- a/doc/salome/gui/GEOM/input/restore_presentation_parameters.doc +++ b/doc/salome/gui/GEOM/input/restore_presentation_parameters.doc @@ -1,12 +1,14 @@ /*! -\page restore_presentation_parameters_page Restore presentation parameters and a tree of subshapes +\page restore_presentation_parameters_page Advanced Transformation Options -\n This functionality allows the operation result to inherit colour -and subshapes from its arguments. +
      Set presentation parameters and sub-shapes from arguments
      + +\n This option allows the operation result to inherit color +and sub-shapes from its arguments. \n To activate this functionality, check in "Set -presentation parameters and subshapes from arguments" checkbox in the +presentation parameters and sub-shapes from arguments" checkbox in the corresponding dialog. \n For example, there exist two objects: Box_1 with two published @@ -15,43 +17,51 @@ faces and Cylinder_1 with free published edges. \image html restore-ss-viewer-before.png "The initial box and cylinder" First, we examine the case when the resulting shape corresponds to one argument (after transformation, -after the boolean operation Cut, or after the partiton with one object shape). +after the Boolean operation Cut, or after the partiton with one object shape). We create a Cut of Box_1 with Cylinder_1. \image html restore-ss-cut.png -The resulting shape inherits the subshapes and the colour of Box_1. +The resulting shape inherits the sub-shapes and the colour of Box_1. \image html restore-ss-viewer-cut.png "The resulting shape" Second, we examine the case when the resulting shape is composed from multiple arguments -(after all boolean operations, except for Cut, or after the partition with +(after all Boolean operations, except for Cut, or after the partition with several object shapes, or if the resulting shape is a compound). We create a Common of Box_1 and Cylinder_1. \image html restore-ss-dialog.png -\n The resulting object is created with several subshapes that correspond to the -operation arguments and their published subshapes. The resulting shape -has a default colour, but its subshapes inherit colors corresponding -to arguments and their subshapes. +\n The resulting object is created with several sub-shapes that correspond to the +operation arguments and their published sub-shapes. The resulting shape +has a default color, but its sub-shapes inherit colors corresponding +to arguments and their sub-shapes. -\image html restore-ss-viewer-after.png "Thev resulting shape" +\image html restore-ss-viewer-after.png "The resulting shape" Please, note that when the resulting shape corresponds to one -argument, the inherited subshapes depend directly on the resulting shape. +argument, the inherited sub-shapes depend directly on the resulting shape. \image html restore-ss-OB-cut.png When the resulting shape is composed from multiple arguments, the -inherited subshapes depend on the arguments. +inherited sub-shapes depend on the arguments. \image html restore-ss-OB.png \n You can also call this functionality from your python scripts. See our TUI Scripts for \ref tui_restore_prs_params "example". +
      Add prefix to names of restored sub-shapes
      +This option allows adding the prefix "from_" to the names of +restored sub-shapes, and the prefix "from_subshapes_of_" to the names of partially restored sub-shapes. +By default this option is On. + +\anchor preview_anchor
      Preview
      +Preview checkbox allows displaying/erasing simulation of the Result in the viewer. + */ diff --git a/doc/salome/gui/GEOM/input/rotation_operation.doc b/doc/salome/gui/GEOM/input/rotation_operation.doc index a2b6d11f4..41dd4137c 100644 --- a/doc/salome/gui/GEOM/input/rotation_operation.doc +++ b/doc/salome/gui/GEOM/input/rotation_operation.doc @@ -13,7 +13,7 @@ be rotated, an \b Axis of rotation and an \b Angle of rotation. \n Arguments: Name + one or several objects + 1 vector for direction of rotation + 1 angle. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation4.png @@ -30,7 +30,7 @@ from the first point to the second and to the third. \n TUI Command: geompy.MakeRotationThreePoints(Shape, CentralPoint, Point1, Point2) \n Arguments: 1 shape + 3 points. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation4a.png diff --git a/doc/salome/gui/GEOM/input/scale_operation.doc b/doc/salome/gui/GEOM/input/scale_operation.doc index 12f4bc63d..1c437e1ba 100644 --- a/doc/salome/gui/GEOM/input/scale_operation.doc +++ b/doc/salome/gui/GEOM/input/scale_operation.doc @@ -10,7 +10,7 @@ shape. For this, you need to define the \b Shape to be scaled, the Central Point of scale and the Scale Factor(s). \n The \b Result will be a \b GEOM_Object. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation10.png \n TUI Command: geompy.MakeScaleTransform(Shape, CenterOfScale, Factor) diff --git a/doc/salome/gui/GEOM/input/section_operation.doc b/doc/salome/gui/GEOM/input/section_operation.doc index c4f450d30..383f1c5de 100644 --- a/doc/salome/gui/GEOM/input/section_operation.doc +++ b/doc/salome/gui/GEOM/input/section_operation.doc @@ -2,20 +2,26 @@ \page section_opeartion_page Section -\n To produce a \b Section operation in the Main Menu select +For detail description of the Boolean operations please refer to +this document. +It provides a general review of the Partition and Boolean +operations algorithms, describes the usage methodology and highlighs +major limitations of these operations. + +To produce a \b Section operation in the Main Menu select Operations - > Boolean - > Section -\n This operation creates the section between 2 shapes. +This operation creates the section between 2 shapes. -\n The \b Result will be any \b GEOM_Object (EDGE or WIRE). -\n TUI Command: geompy.MakeSection(s1, s2) -\n Arguments: Name + 2 shapes. -\n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". +The \b Result will be any \b GEOM_Object (EDGE or WIRE). +TUI Command: geompy.MakeSection(s1, s2) +Arguments: Name + 2 shapes. +Advanced option: +\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html neo-section.png -\n Example: +Example: \image html fusesn1.png "The initial shapes" diff --git a/doc/salome/gui/GEOM/input/sewing_operation.doc b/doc/salome/gui/GEOM/input/sewing_operation.doc index 1c478822e..9ee5eff67 100644 --- a/doc/salome/gui/GEOM/input/sewing_operation.doc +++ b/doc/salome/gui/GEOM/input/sewing_operation.doc @@ -4,7 +4,7 @@ \n To produce a \b Sewing operation in the Main Menu select Repair - > Sewing. -\n This operation allows to sew several faces or shells. +\n It is possible to sew only compounds of faces or shells. \n The \b Result will be a \b GEOM_Object. @@ -23,9 +23,9 @@ your shape: \n Example: -\image html image112.jpg "The initial faces" +\image html image112.png "The initial faces" -\image html image113.jpg "The sewn faces" +\image html image113.png "The sewn faces" Our TUI Scripts provide you with useful examples of the use of \ref tui_sewing "Repairing Operations". diff --git a/doc/salome/gui/GEOM/input/shape_processing_operation.doc b/doc/salome/gui/GEOM/input/shape_processing_operation.doc index ca438ada1..aa97ec32f 100644 --- a/doc/salome/gui/GEOM/input/shape_processing_operation.doc +++ b/doc/salome/gui/GEOM/input/shape_processing_operation.doc @@ -3,10 +3,10 @@ \page shape_processing_operation_page Shape Processing \n To produce a Shape Processing operation in the Main Menu -select Repair - > Shape Processing. + select Repair - > Shape Processing. \n This operation processes one or more shapes using various operators. -\n The \b Result will be a \b GEOM_Object. +\n The \b Result will be a \b GEOM.GEOM_Object. \n TUI Command: geompy.ProcessShape(Shape, Operators, Parameters, Values), where \em Shape is a processed shape, \em Operators @@ -15,6 +15,19 @@ is a list of operators ("FixShape", "SplitClosedFaces", etc.), etc), \em Values is a list of values of parameters placed in the same order as in the list of Parameters. +\note Shape Processing is useful not only on invalid shapes, + but also on the shapes, that are classified as valid by + the Check functionality. Use it, if an operation (for + example, Partition) fails. + Example of usage: +
        +
      1. Try to partition objects obj1 and obj2.
      2. +
      3. Partition fails.
      4. +
      5. Perform Shape Processing on objects obj1 and obj2.
      6. +
      7. Try to partition them again.
      8. +
      + See also \ref tui_limit_tolerance "TUI example". + \n In this dialog box you can select the object that you need to process, define its name and operators applied to it during processing. @@ -140,15 +153,15 @@ curves not having the same parameter. \n Example: -\image html image154.jpg +\image html image154.png
      Shape before applying Shape Processing (FixShape operator). View # 1.
      -\image html image156.jpg +\image html image156.png
      Shape before applying Shape Processing (FixShape operator). View # 2.
      -\image html image160.jpg +\image html image160.png
      The same shape after applying Shape Processing.
      diff --git a/doc/salome/gui/GEOM/input/shape_recognition.doc b/doc/salome/gui/GEOM/input/shape_recognition.doc new file mode 100644 index 000000000..0a894c54d --- /dev/null +++ b/doc/salome/gui/GEOM/input/shape_recognition.doc @@ -0,0 +1,98 @@ +/*! + +\page shape_recognition_page Shape recognition from a picture + +\note +
        +
      1. This functionality is not fully operational yet. It is provided for testing purpose and because it might already be helpful in some situations. + (Do not hesitate to make feedbacks on possible bugs ...)
      2. + +
      3. The functionality is only available if SALOME has been built with the optional prerequisite OpenCV.
      4. +
      + +This tool allows you to automatically create geometrical shapes from +pictures with help of shape recognition algorithms. +Contours or Corners can be built. + +\b Example: + +Detection of the cost line on a nautical chart + +\image html contour_detection_example2.png + +\n + +To use the Shape recogition tool: + +
        +
      1. \ref import_picture_page "Import a picture" in the view
      2. + +
      3. Select New Entity -> Shape Recognition or click on \image html feature_detect.png
      4. + +
      + + + +Then you can choose to create either contours or corners from this picture. + +\n + +To create Contours : + +
        +
      1. Select in the Picture field a previously imported picture.
      2. + +
      3. Click on \image html occ_view_camera_dump.png
      4. + +
      5. Draw a rectangle in the zone whose contour is to be found. The + zone will be identified by the colors of this Filtering Sample. + + \b Example: + + In the picture shown above, the contours have been drawn basing on + the sample, containing white and violet color, thus all white and + violet areas in the picture are included in the outlined zone. + + \image html feature_detection_dlg3.png + + + +
      6. Output type + +
          + +
        • \b Spline : The \b result will be a \b Compound of \b Edges. Each contour will be a single \b edge based on a B-Spline curve (it will be smooth).
        • + +
        • \b Polyline : The \b result will be a \b Compound of \b Wires. Each contour will be a wire made of lines (i.e. a \b Polygon)
        • + +
        + + In both cases each contour can then be retrieved by an explode operation with the appropriate subshape type. + +
      7. + + \note It is better to use the \b Spline output type unless you want to find the frontier of a polygon (rectangle ...) + +
      + + +\n + +To create Corners : + +
        +
      1. In the Picture field select a previously imported picture.
      2. + +
      3. Apply
      4. + + The \b Result will be a \b Compound of \b Vertices + + \image html feature_detection_dlg2.png + + + +
      + + + +*/ diff --git a/doc/salome/gui/GEOM/input/shapesonshape.doc b/doc/salome/gui/GEOM/input/shapesonshape.doc index b0caaa396..f2571ccd4 100755 --- a/doc/salome/gui/GEOM/input/shapesonshape.doc +++ b/doc/salome/gui/GEOM/input/shapesonshape.doc @@ -2,7 +2,10 @@ \page shapesonshape_page Get Shapes on Shape -This operation is a special case of Explode operation. It produces a group of sub-shapes of the exploded shape, which are located in a definite way relatively another reference shape. +This operation is a special case of Explode operation. It +produces a group of sub-shapes of the exploded shape, which are +located in a definite way relatively another reference shape. The +reference shape should be a solid. To use this operation, select in the Main Menu Operations -> Get Shapes on Shape. The following dialog box will appear. @@ -11,7 +14,8 @@ To use this operation, select in the Main Menu Operations -> Get Shapes on Sh
      • Name is the name of the resulting group of shapes;
      • Shape for exploding is the shape that will be exploded;
      • -
      • Shape for checking is the reference shape;
      • +
      • Solid for checking is the reference shape, which should be +a solid;
      • Reconstruction Limit is the type of created sub-shapes: solid, shell, face, wire, edge, vertex;
      • State is the position of the created sub-shapes relatively the reference shapes: @@ -24,6 +28,8 @@ To use this operation, select in the Main Menu Operations -> Get Shapes on Sh
    +\n Advanced options \ref preview_anchor "Preview" + Example: In the images below the box is the exploded shape and the cylinder is the reference shape. In the first image the edge IN the reference cylinder is highlighted in red, in the second the edges OUT of the reference cylinder are highlighted. diff --git a/doc/salome/gui/GEOM/input/shared_shapes.doc b/doc/salome/gui/GEOM/input/shared_shapes.doc new file mode 100755 index 000000000..81c060016 --- /dev/null +++ b/doc/salome/gui/GEOM/input/shared_shapes.doc @@ -0,0 +1,30 @@ +/*! + +\page shared_shapes_page Get Shared Shapes + +This operation is a special case of Explode operation. It +produces sub-shapes of the exploded shape (the first shape in the list +of argument shapes), which are shared with all other shapes in the +arguments. + +To use this operation, select in the Main Menu Operations -> Get +Shared Shapes. The following dialog box will appear. + +\image html shared_shapes.png + +
      +
    • Name is the base name of the resulting shapes;
    • +
    • Shapes are the shapes to fing shared sub-shapes of;
    • +
    • Sub-shapes Type is the type of required sub-shapes;
    • +
    + +\n Advanced options \ref preview_anchor "Preview" + +\n TUI Command: geompy.GetSharedShapesMulti(Shapes, +Type), where \em Shapes is a list of shapes to fing shared sub- +shapes of and \em Type is the type of required sub-shapes. + +Our TUI Scripts provide you with useful examples of the use of +\ref swig_GetSharedShapes "Get Shared Shapes" functionality. + +*/ diff --git a/doc/salome/gui/GEOM/input/suppress_faces_operation.doc b/doc/salome/gui/GEOM/input/suppress_faces_operation.doc index 67dbd6313..4606cb609 100644 --- a/doc/salome/gui/GEOM/input/suppress_faces_operation.doc +++ b/doc/salome/gui/GEOM/input/suppress_faces_operation.doc @@ -13,8 +13,8 @@ available in OCC Viewer only. \n TUI Command: geompy.SuppressFaces(Shape, ListOfID), where \em Shape is a shape to be processed, \em ListOfID is a list of faces ID's to be removed. -\n Arguments: Name + Faces which should be removed (you can -select them in the 3D viewer). +\n Arguments: Name + 1 shape + Faces which should be removed +(you can select them in the 3D viewer). \image html repair2.png @@ -27,4 +27,4 @@ select them in the 3D viewer). Our TUI Scripts provide you with useful examples of the use of \ref tui_suppress_faces "Repairing Operations". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/suppress_holes_operation.doc b/doc/salome/gui/GEOM/input/suppress_holes_operation.doc index d353f5f40..498d349ec 100644 --- a/doc/salome/gui/GEOM/input/suppress_holes_operation.doc +++ b/doc/salome/gui/GEOM/input/suppress_holes_operation.doc @@ -11,7 +11,7 @@ shell or face. This operation is available in OCC Viewer only. \n TUI Command: geompy.SuppressHoles(Shape, ListOfWireID), where \em Shape is a shell or face, where holes -with free boundaries must be removed, \em ListOfWireID is a list of wire sub shapes ID's. If it is +with free boundaries must be removed, \em ListOfWireID is a list of wire sub-shapes ID's. If it is empty, then all holes are removed. \image html repair5.png @@ -25,9 +25,9 @@ your shape: \n Example: -\image html image109.jpg "The cone with a hole" +\image html image109.png "The cone with a hole" -\image html image110.jpg "The hole has been suppressed" +\image html image110.png "The hole has been suppressed" Our TUI Scripts provide you with useful examples of the use of \ref tui_suppress_holes "Repairing Operations". diff --git a/doc/salome/gui/GEOM/input/tolerance.doc b/doc/salome/gui/GEOM/input/tolerance.doc new file mode 100644 index 000000000..3b84055f8 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tolerance.doc @@ -0,0 +1,17 @@ +/*! + +\page tolerance_page Tolerance + +\n Returns the maximum and the minimum tolerance for the selected +geometrical object. + +\n Result: Displays the tolerance values (FaceMinTol, +FaceMaxTol, EgdeMinTol, EgdeMaxTol, VertexMinTol, VertexMaxTol). +\n TUI Command: geompy.Tolerance(Shape), where \em Shape +is a shape for which minimal and maximal tolerances are returned. + +See also a \ref tui_tolerance_page "TUI example". + +\image html new-tolerance.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/transformation_operations.doc b/doc/salome/gui/GEOM/input/transformation_operations.doc index faa58dc93..075973737 100644 --- a/doc/salome/gui/GEOM/input/transformation_operations.doc +++ b/doc/salome/gui/GEOM/input/transformation_operations.doc @@ -9,20 +9,15 @@ which allow to:
    • \subpage translation_operation_page "Translate" an object by a certain vector.
    • \subpage rotation_operation_page "Rotate" an object around a -certain axis by a certain angle.
    • + certain axis by a certain angle.
    • \subpage modify_location_operation_page "Move" an object to a new location.
    • \subpage mirror_operation_page "Mirror" an object through a point -an axis or a plane of symmetry.
    • -
    • \subpage scale_operation_page "Scale" an object by one or several scale -factors.
    • -
    • Create an \subpage offset_operation_page "Offset" of the object.
    • + an axis or a plane of symmetry. +
    • \subpage scale_operation_page "Scale" an object by one or several scale factors.
    • +
    • Create an \subpage offset_operation_page "Offset" of an object.
    • +
    • Create a \subpage projection_operation_page "Projection" of an object on a face.
    • Create a simultaneous \subpage multi_translation_operation_page "Translation in several directions".
    • Create a simultaneous \subpage multi_rotation_operation_page
    • "Rotation in several directions". -
    • Produce a \subpage fillet_operation_page "Fillet" on the selected -edges of the object.
    • -
    • Produce a \subpage fillet2d_operation_page "2D Fillet" on the corners of a Planar Face.
    • -
    • Produce a \subpage chamfer_operation_page "Chamfer" on the -selected edges of the object.
    -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/transforming_geom_objs.doc b/doc/salome/gui/GEOM/input/transforming_geom_objs.doc index adab40078..573182a4d 100644 --- a/doc/salome/gui/GEOM/input/transforming_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/transforming_geom_objs.doc @@ -6,11 +6,16 @@ The objects created in Salome can be processed with Transformation operations, which can be classified into:
      -
    • \subpage using_boolean_operations_page "Boolean operations" using -Boolean logical operators.
    • +
    • \subpage using_boolean_operations_page "Boolean operations", which allow combining objects +with boolean logical operators.
    • \subpage transformation_operations_page "Transformation operations", which modify shape or location of the selected object.
    • +
    • \subpage features_page "Features", +which allow adding or removing matter from an object.
    • + +
    • Operations with \subpage blocks_operations_page "Blocks".
    • +
    • \subpage partition_page "Partition" operation, which creates a compound by intersection of several shapes with a tool object or a plane.
    • \subpage archimede_page "Archimede" operation, which creates a @@ -18,13 +23,13 @@ plane corresponding to the modelled waterline of the object plunged into water.
    • \subpage shapesonshape_page "Get shapes on shape" operation, a special case of \b Explode operation.
    • - -
    • Operations with \subpage blocks_operations_page "Blocks".
    • +
    • \subpage shared_shapes_page "Get shared shapes" operation, a +special case of \b Explode operation.
    • -
    • \subpage restore_presentation_parameters_page "Restore presentation pareameters". +
    • \subpage restore_presentation_parameters_page "Restore presentation parameters". This cross-operation functionality allows the resulting shape to -inherit colors and subshapes from its parent shapes.
    • +inherit colors and sub-shapes from its parent shapes.
    diff --git a/doc/salome/gui/GEOM/input/translation_operation.doc b/doc/salome/gui/GEOM/input/translation_operation.doc index 32958367d..60ca83c62 100644 --- a/doc/salome/gui/GEOM/input/translation_operation.doc +++ b/doc/salome/gui/GEOM/input/translation_operation.doc @@ -18,7 +18,7 @@ DZ),
    where Shape is a shape to be translated, DX, DY, DZ are components of translation vector. \n Arguments: Name + one or several objects + 3 values (coordinates). \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation1.png @@ -27,17 +27,19 @@ of the vector. \n TUI Command: geompy.MakeTranslationTwoPoints(Object, Point1, Point2) \n Arguments: Name + one or several objects + 2 vertices \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation2.png -\n Finally you can define an \b Object and the vector. The object will be translated by the length of the vector. +\n Finally you can define an \b Object and a vector. The object will be translated by the length of the vector. +If a curve has been selected instead of the vector, only its first and last vertices will be used to get the vector direction +and the dialog preview will display the vector along which the object will be translated. \n TUI Command: geompy.MakeTranslationVector(Object, Vector) \n Activate Distance checkbox and Distance field allow defining the custom distance of translation. \n TUI Command for translation by vector and custom distance: geompy.MakeTranslationVectorDistance(Object, Vector, Distance) \n Arguments: Name + one or several objects + 1 vector. \n Advanced option: - \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". + \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \image html transformation3.png diff --git a/doc/salome/gui/GEOM/input/transparency.doc b/doc/salome/gui/GEOM/input/transparency.doc index c7c0a3ea9..1bb550cbf 100644 --- a/doc/salome/gui/GEOM/input/transparency.doc +++ b/doc/salome/gui/GEOM/input/transparency.doc @@ -3,14 +3,18 @@ \page transparency_page Transparency \n You can change the transparency of a shape in the range between 0% -(absolutely transparent and thus invisible) and 100% (absolutely opaque) +(absolutely opaque) and 100% (absolutely transparent and thus invisible) in the following dialog box. \image html neo-transparency.png -or using a TUI Command: gg.setTransparency(ID, Double) +or using a TUI Command: gg.setTransparency(ID, Value) -\n Examples: +where +- ID is an object ID (entry) +- Value is a transparency value in range [0-1]; 0 means fully opaque, 1 means fully transparent + +Examples: \image html colorsn.png
    Opaque
    diff --git a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc index 21efff941..4b9047f34 100644 --- a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc @@ -2,220 +2,119 @@ \page tui_advanced_geom_objs_page Advanced Geometrical Objects -\anchor tui_creation_edge -

    Creation of an Edge

    +\anchor tui_creation_pipetshape +

    Creation of PipeTShape

    \code import geompy import salome gg = salome.ImportComponentGUI("GEOM") -# create vertices -p0 = geompy.MakeVertex(0. , 0. , 0. ) -pxyz = geompy.MakeVertex(100., 100., 100.) - -# create an edge -edge = geompy.MakeEdge(p0, pxyz) +# create PipeTShape object +pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0) # add object in the study -id_edge = geompy.addToStudy(edge,"Edge") +id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape") +# add groups in the study +for g in pipetshape[1:]: + geompy.addToStudyInFather(pipetshape[0], g, g.GetName()) + +# Create junction vertices +P1 = geompy.MakeVertex(0.0, 0.0, 0.0) +P2 = geompy.MakeVertex(400.0, 0.0, 0.0) +P3 = geompy.MakeVertex(200.0, 0.0, 200.0) + +# create PipeTShape object with position +pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3) -# display an edge -gg.createAndDisplayGO(id_edge) -\endcode - -\anchor tui_creation_wire -

    Creation of a Wire

    +# add object in the study +id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position") +# add groups in the study +for g in pipetshape_position[1:]: + geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName()) -\code -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") +# create PipeTShape with chamfer object +pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0) -# create vertices -px = geompy.MakeVertex(100., 0. , 0. ) -py = geompy.MakeVertex(0. , 100., 0. ) -pz = geompy.MakeVertex(0. , 0. , 100.) +# add object in the study +id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer") +# add groups in the study +for g in pipetshapechamfer[1:]: + geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName()) -# create a vector from two points -vxy = geompy.MakeVector(px, py) +# create PipeTShape with chamfer object with position +pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3) -# create an arc from three points -arc = geompy.MakeArc(py, pz, px) +# add object in the study +id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position") +# add groups in the study +for g in pipetshapechamfer_position[1:]: + geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName()) -# create a wire -wire = geompy.MakeWire([vxy, arc]) +# create PipeTShape with fillet object +pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0) -# add an object in the study -id_wire = geompy.addToStudy(wire,"Wire") +# add object in the study +id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet") +# add groups in the study +for g in pipetshapefillet[1:]: + geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName()) -# display the wire -gg.createAndDisplayGO(id_wire) -\endcode - -\anchor tui_creation_face -

    Creation of a Face

    +# create PipeTShape with fillet object with position +pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3) -\code -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") +# add object in the study +id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position") +# add groups in the study +for g in pipetshapefillet_position[1:]: + geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName()) + + +# display pipetshapes +gg.createAndDisplayGO(id_pipetshape) +gg.createAndDisplayGO(id_pipetshape_position) +gg.createAndDisplayGO(id_pipetshapechamfer) +gg.createAndDisplayGO(id_pipetshapechamfer_position) +gg.createAndDisplayGO(id_pipetshapefillet) +gg.createAndDisplayGO(id_pipetshapefillet_position) -# create vertices -p0 = geompy.MakeVertex(0. , 0. , 0. ) -px = geompy.MakeVertex(100., 0. , 0. ) -py = geompy.MakeVertex(0. , 100., 0. ) -pz = geompy.MakeVertex(0. , 0. , 100.) -pxyz = geompy.MakeVertex(100., 100., 100.) - -# create a vector from two points -vxy = geompy.MakeVector(px, py) - -# create an arc from three points -arc = geompy.MakeArc(py, pz, px) - -# create a wire -wire = geompy.MakeWire([vxy, arc]) - -# create sketchers -sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW", - [100,0,0, 1,1,1, -1,1,0]) -sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW") -sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW") -isPlanarFace = 1 - -# create a face from the wire -face1 = geompy.MakeFace(wire, isPlanarFace) - -# create faces from two wires -face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace) -face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace) - -# add objects in the study -id_face1 = geompy.addToStudy(face1,"Face1") -id_face2 = geompy.addToStudy(face2,"Face2") -id_face3 = geompy.addToStudy(face3,"Face3") - -# display the faces -gg.createAndDisplayGO(id_face1) -gg.setDisplayMode(id_face1,1) -gg.setTransparency(id_face1,0.2) -gg.createAndDisplayGO(id_face2) -gg.setDisplayMode(id_face2,1) -gg.setTransparency(id_face2,0.2) -gg.createAndDisplayGO(id_face3) -gg.setDisplayMode(id_face3,1) -gg.setTransparency(id_face3,0.2) \endcode - -\anchor tui_creation_shell -

    Creation of a Shell

    -\code -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") - -#create vertices -p0 = geompy.MakeVertex( 0., 0., 0.) -pxyz = geompy.MakeVertex( 5., 5., 40.) - -# create sketchers -sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW") -sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW") -isPlanarFace = 1 - -# create a face from two wires -face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace) - -# create a prism -prism = geompy.MakePrism(face, p0, pxyz) - -# explode the prism into faces -prism_faces = geompy.SubShapeAllSorted(prism, geompy.ShapeType["FACE"]) - -# create a shell from a set of faces -shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3], - prism_faces[7], prism_faces[9]]) - -# add objects in the study -id_shell = geompy.addToStudy(shell,"Shell") - -# display the shell -gg.createAndDisplayGO(id_shell) -gg.setDisplayMode(id_shell,1) -\endcode - -\anchor tui_creation_solid -

    Creation of a Solid

    +\anchor tui_creation_divideddisk +

    Creation of DividedDisk

    \code import geompy import salome gg = salome.ImportComponentGUI("GEOM") -#create vertices -p0 = geompy.MakeVertex( 0., 0., 0.) -pz = geompy.MakeVertex( 0., 0., 40.) - -# create sketchers -sketcher = geompy.MakeSketcher("Sketcher:F -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW") +# create DividedDisk object +divideddisk = geompy.MakeDividedDisk(100, 50) -# create faces from two wires -face = geompy.MakeFace(sketcher,1) - -# create a prism -prism = geompy.MakePrism(face, p0, pz) - -# explode the prism into faces -prism_faces = geompy.SubShapeAllSorted(prism, geompy.ShapeType["FACE"]) - -# create a shell from a set of faces -shell = geompy.MakeShell([prism_faces[0], prism_faces[1], - prism_faces[3], prism_faces[4], - prism_faces[5], prism_faces[2]]) - -# create a solid, bounded by the given shells -solid = geompy.MakeSolid([shell]) - -# add objects in the study -id_solid = geompy.addToStudy(solid,"Solid") +# add object in the study +id_divideddisk = geompy.addToStudy(divideddisk,"DividedDisk") -# display the solid -gg.createAndDisplayGO(id_solid) -gg.setDisplayMode(id_solid,1) +# display divideddisk +gg.createAndDisplayGO(id_divideddisk) \endcode - -\anchor tui_creation_compound -

    Creation of a Compound

    + +\anchor tui_creation_dividedcylinder +

    Creation of DividedCylinder

    \code import geompy import salome gg = salome.ImportComponentGUI("GEOM") -# create a vertex and a vector -p1 = geompy.MakeVertex( -30., -30., 50.) -p2 = geompy.MakeVertex( -60., -60., 30.) -p3 = geompy.MakeVertex( -30., -30., 10.) - -# create an arc from three points -arc = geompy.MakeArc(p1, p2, p3) -ShapeListCompound = [] -i = 0 -while i <= 3 : - S = geompy.MakeTranslation(arc, i * 50., 0., 0.) - ShapeListCompound.append(S) - i = i + 1 - -# create a compund of the given shapes -compound = geompy.MakeCompound(ShapeListCompound) +# create DividedCylinder object +dividedcylinder = geompy.MakeDividedCylinder(100, 300) # add object in the study -id_compound = geompy.addToStudy(compound,"Compound") +id_dividedcylinder = geompy.addToStudy(dividedcylinder,"DividedCylinder") -# display the compound -gg.createAndDisplayGO(id_compound) +# display dividedcylinder +gg.createAndDisplayGO(id_dividedcylinder) \endcode -*/ \ No newline at end of file + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_angle.doc b/doc/salome/gui/GEOM/input/tui_angle.doc new file mode 100644 index 000000000..fa459d31e --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_angle.doc @@ -0,0 +1,67 @@ +/*! + +\page tui_angle_page Angle + +\code +import salome +salome.salome_init() + +import math +import geompy +geompy.init_geom(salome.myStudy) + +OX = geompy.MakeVectorDXDYDZ(10, 0,0) +OXY = geompy.MakeVectorDXDYDZ(10,10,0) + +# in one plane +Angle = geompy.GetAngle(OX, OXY) + +print "\nAngle between OX and OXY = ", Angle +if math.fabs(Angle - 45.0) > 1e-05: + print " Error: returned angle is", Angle, "while must be 45.0" + pass + +Angle = geompy.GetAngleRadians(OX, OXY) + +print "\nAngle between OX and OXY in radians = ", Angle +if math.fabs(Angle - math.pi/4) > 1e-05: + print " Error: returned angle is", Angle, "while must be pi/4" + pass + +Angle = geompy.GetAngleVectors(OX, OXY, True) + +print "\nAngle between vectors OX and OXY = ", Angle +if math.fabs(Angle - 45.0) > 1e-05: + print " Error: returned angle is", Angle, "while must be 45.0" + pass + +Angle = geompy.GetAngleRadiansVectors(OX, OXY, False) + +print "\nBig angle between vectors OX and OXY in radians = ", Angle +if math.fabs(Angle - math.pi*7./4.) > 1e-05: + print " Error: returned angle is", Angle, "while must be 7*pi/4" + pass + +# not in one plane +OXY_shift = geompy.MakeTranslation(OXY,10,-10,20) +Angle = geompy.GetAngle(OX, OXY_shift) + +print "\nAngle between OX and OXY_shift = ", Angle +if math.fabs(Angle - 45.0) > 1e-05: + print " Error: returned angle is", Angle, "while must be 45.0" + pass + +# not linear +pnt1 = geompy.MakeVertex(0, 0, 0) +pnt2 = geompy.MakeVertex(10, 0, 0) +pnt3 = geompy.MakeVertex(20, 10, 0) +arc = geompy.MakeArc(pnt1, pnt2, pnt3) +Angle = geompy.GetAngle(OX, arc) + +if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()): + print "Error. Angle must not be computed on curvilinear edges" + pass + +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc index 89baf140d..0cb092228 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc @@ -16,10 +16,28 @@ p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.) px = geompy.MakeVertex(100., 0., 0.) py = geompy.MakeVertex(0., 100., 0.) pz = geompy.MakeVertex(0., 0., 100.) +p1 = geompy.MakeVertex(50., 50., 30.) -# create a curve and a vertex on it +# create a curve and vertices on it Arc = geompy.MakeArc(py, pz, px) +# create a vertex by parameter p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) +# create a vertex by length +p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., None) +#create a vertex by point projection +p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10) + +# create 2 lines and make a point on its intersection +line_1 = geompy.MakeLineTwoPnt(p0, p100) +line_2 = geompy.MakeLineTwoPnt(p1, pz) +p_inter = geompy.MakeVertexOnLinesIntersection(line_1, line_2) + +# create a face and vertices on it +Add_line = geompy.MakeLineTwoPnt(px, py) +arc_face = geompy.MakeFaceWires([Arc, Add_line], 1) +p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5) +p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35) + # add objects in the study id_p0 = geompy.addToStudy(p0, "Vertex 0") @@ -28,13 +46,23 @@ id_px = geompy.addToStudy(px, "Vertex X") id_py = geompy.addToStudy(py, "Vertex Y") id_pz = geompy.addToStudy(pz, "Vertex Z") id_Arc = geompy.addToStudy(Arc, "Arc") -id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc") +id_line_1 = geompy.addToStudy(line_1, "Line 1") +id_line_2 = geompy.addToStudy(line_2, "Line 2") +id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter") +id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc by length") +id_p_on_arc3 = geompy.addToStudy(p_on_arc3, "Vertex on Arc by point projection") +id_p_inter = geompy.addToStudy(p_inter, "Vertex on Lines Intersection") +id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter") +id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection") # display vertices gg.createAndDisplayGO(id_p0) gg.createAndDisplayGO(id_p100) gg.createAndDisplayGO(id_Arc) -gg.createAndDisplayGO(id_p_on_arc) +gg.createAndDisplayGO(id_p_inter) +gg.createAndDisplayGO(id_p_on_arc) +gg.createAndDisplayGO(id_p_on_arc2) +gg.createAndDisplayGO(id_p_on_arc3) \endcode \anchor tui_creation_line @@ -116,21 +144,32 @@ gg = salome.ImportComponentGUI("GEOM") # create vertices p0 = geompy.MakeVertex(0., 0., 0.) -p50 = geompy.MakeVertex(50., 50., 50.) +p1 = geompy.MakeVertex(50., 50., 50.) +p2 = geompy.MakeVertex(0., 50., 0.) -# create a vector from two points -vector = geompy.MakeVector(p0, p50) +# create a normal vector from two points +normal = geompy.MakeVector(p0, p1) + +# create a major axis vector from two points +major = geompy.MakeVector(p0, p2) # create an ellipse from a point, a vector and radiuses -ellipse = geompy.MakeEllipse(p50, vector, 50, 25) +ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25) + +# create an ellipse from a point, a normal vector, radiuses and a major axis vector +ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major) # add objects in the study -id_vector = geompy.addToStudy(vector, "Vector") -id_ellipse = geompy.addToStudy(ellipse,"Ellipse") +id_normal = geompy.addToStudy(normal, "Normal") +id_major = geompy.addToStudy(major, "Major Axis") +id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1") +id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2") # display the ellipse and its normal vector -gg.createAndDisplayGO(id_vector) -gg.createAndDisplayGO(id_ellipse) +gg.createAndDisplayGO(id_normal) +gg.createAndDisplayGO(id_major) +gg.createAndDisplayGO(id_ellipse1) +gg.createAndDisplayGO(id_ellipse2) \endcode \anchor tui_creation_arc @@ -188,7 +227,18 @@ polyline = geompy.MakePolyline([p0, p1, p2, p3, p4]) bezier = geompy.MakeBezier([p0, p1, p2, p3, p4]) #create a b-spline curve from a list of points -interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4]) +interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False) + +#create a polyline using parametric definition of the basic points +param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True) + +# create a bezier curve using parametric definition of the basic points +param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Bezier, theNewMethod=True) + +#create a b-spline curve using parametric definition of the basic points +param_interpol = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Interpolation, theNewMethod=True) + + # add objects in the study id_p0 = geompy.addToStudy(p0, "Point1") @@ -199,6 +249,11 @@ id_p4 = geompy.addToStudy(p4, "Point5") id_polyline = geompy.addToStudy(polyline, "Polyline") id_bezier = geompy.addToStudy(bezier, "Bezier") id_interpol = geompy.addToStudy(interpol, "Interpol") +id_param_polyline = geompy.addToStudy(param_polyline, "Polyline Parametric") +id_param_bezier = geompy.addToStudy(param_bezier, "Bezier Parametric") +id_param_interpol = geompy.addToStudy(param_interpol, "Interpol Parametric") + + # display the points and the curves gg.createAndDisplayGO(id_p0) @@ -209,6 +264,10 @@ gg.createAndDisplayGO(id_p4) gg.createAndDisplayGO(id_polyline) gg.createAndDisplayGO(id_bezier) gg.createAndDisplayGO(id_interpol) +gg.createAndDisplayGO(id_param_polyline) +gg.createAndDisplayGO(id_param_bezier) +gg.createAndDisplayGO(id_param_interpol) + \endcode \anchor tui_creation_vector @@ -257,8 +316,9 @@ p3 = geompy.MakeVertex(200., 200., 200.) p4 = geompy.MakeVertex(100., 100., 0.) p5 = geompy.MakeVertex(0. , 100., 0.) -# create a vector from the given components -vector = geompy.MakeVectorDXDYDZ(100., 100., 100.) +# create a vectors from the given components +vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.) +vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.) # create a vector from two points vector_arc = geompy.MakeVector(p2, p5) @@ -274,8 +334,12 @@ isPlanarWanted = 1 face = geompy.MakeFace(wire, isPlanarWanted) trimsize = 1000. +# create a Local Coordinate System + +LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0) + # create a plane from a point, a vector and a trimsize -plane1 = geompy.MakePlane(p1, vector, trimsize) +plane1 = geompy.MakePlane(p1, vector1, trimsize) # create a plane from three points and a trimsize plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize) @@ -283,23 +347,78 @@ plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize) # create a plane from the given face plane3 = geompy.MakePlaneFace(face, trimsize) +# create a plane from two vectors and a trimsize +plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize) + +# create a plane with the Local Coordinate System and a trimsize +plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1) + # add objects in the study id_face = geompy.addToStudy(face, "Face") id_plane1 = geompy.addToStudy(plane1,"Plane1") id_plane2 = geompy.addToStudy(plane2,"Plane2") id_plane3 = geompy.addToStudy(plane3,"Plane3") +id_plane4 = geompy.addToStudy(plane4,"Plane4") +id_plane5 = geompy.addToStudy(plane5,"Plane5") # display the points and the vectors gg.createAndDisplayGO(id_face) gg.createAndDisplayGO(id_plane1) gg.createAndDisplayGO(id_plane2) gg.createAndDisplayGO(id_plane3) +gg.createAndDisplayGO(id_plane4) +gg.createAndDisplayGO(id_plane5) gg.setDisplayMode(id_plane1,1) gg.setTransparency(id_plane1,0.5) gg.setDisplayMode(id_plane2,1) gg.setTransparency(id_plane2,0.5) gg.setDisplayMode(id_plane3,1) -gg.setTransparency(id_plane3,0.5) +gg.setTransparency(id_plane3,0.5) +gg.setDisplayMode(id_plane4,1) +gg.setTransparency(id_plane4,0.5) +gg.setDisplayMode(id_plane5,1) +gg.setTransparency(id_plane5,0.5) +\endcode + +\anchor tui_creation_lcs +

    Creation of a Local Coordinate System

    +\code +import GEOM +import geompy +import math +import SALOMEDS + +#Create vertexes, vectors and shapes to construct local CS +Vertex_1 = geompy.MakeVertex(50, 50, 50) +Vertex_2 = geompy.MakeVertex(70, 70, 70) +Vertex_3 = geompy.MakeVertex(0, 0, 0) +Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0) +Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0) +Face_1 = geompy.MakeFaceHW(100, 100, 1) +Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2) + +#Construct local CS by manual definition +LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) + +#Construct local CS by center point and two vectors (X and Y directions) +LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y) + +#Construct local CS from shape orientation +LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1) +LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1) + +#Add created object to study +geompy.addToStudy( Face_1, "Face_1" ) +geompy.addToStudy( Vertex_1, "Vertex_1" ) +geompy.addToStudy( Vertex_2, "Vertex_2" ) +geompy.addToStudy( Box_1, "Box_1" ) +geompy.addToStudy( Vertex_3, "Vertex_3" ) +geompy.addToStudy( Vector_X, "Vector_X" ) +geompy.addToStudy( Vector_Y, "Vector_Y" ) +geompy.addToStudy( LocalCS_1, "LocalCS_1" ) +geompy.addToStudy( LocalCS_2, "LocalCS_3" ) +geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" ) +geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" ) \endcode -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/tui_basic_operations.doc b/doc/salome/gui/GEOM/input/tui_basic_operations.doc index 1250c128d..aec3a7465 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_operations.doc @@ -80,11 +80,12 @@ gg.setDisplayMode(id_archimede,1) \endcode \anchor tui_restore_prs_params -

    Restore presentation parameters and subshapes

    +

    Restore presentation parameters and sub-shapes

    \code import geompy import GEOM +import SALOMEDS # create a box and a cylinder box = geompy.MakeBoxDXDYDZ(200, 200, 200) @@ -112,8 +113,8 @@ geompy.addToStudy(partition1, "Partition_1") geompy.addToStudy(partition2, "Partition_2") geompy.addToStudy(partition3, "Partition_3") -# Restore presentation parameters and subshapes -# different methods can be used to find the subshapes in the result: +# Restore presentation parameters and sub-shapes +# different methods can be used to find the sub-shapes in the result: # GetInPlace, GetSame, GetInPlaceByHistory, GetShapesOnShape. # By default, GetInPlace method is used (GEOM.FSM_GetInPlace) geompy.RestoreSubShapes(partition1) @@ -124,10 +125,10 @@ geompy.RestoreSubShapes(partition2, [], GEOM.FSM_GetInPlace) # but restore only the passed. geompy.RestoreSubShapes(partition3, [tra], GEOM.FSM_GetInPlaceByHistory) -# To find subshapes in a transformed shape only one method could be +# To find sub-shapes in a transformed shape only one method could be # used: pass GEOM.FSM_Transformed for that. # True passed for the last argument, means that the transformed shape -# will inherit colour and subshapes from its first argument (see above +# will inherit colour and sub-shapes from its first argument (see above # MakeTranslation). geompy.RestoreSubShapes(tra, [], GEOM.FSM_Transformed, True) diff --git a/doc/salome/gui/GEOM/input/tui_basic_properties.doc b/doc/salome/gui/GEOM/input/tui_basic_properties.doc new file mode 100644 index 000000000..4c01ec438 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_basic_properties.doc @@ -0,0 +1,26 @@ +/*! + +\page tui_basic_properties_page Basic Properties + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +props = geompy.BasicProperties(box) +print "\nBox 100x30x100 Basic Properties:" +print " Wires length: ", props[0] +print " Surface area: ", props[1] +print " Volume : ", props[2] +length = math.sqrt((props[0] - 1840)*(props[0] - 1840)) +area = math.sqrt((props[1] - 32000)*(props[1] - 32000)) +volume = math.sqrt((props[2] - 300000)*(props[2] - 300000)) +if length > 1e-7 or area > 1e-7 or volume > 1e-7: + print "While must be:" + print " Wires length: ", 1840 + print " Surface area: ", 32000 + print " Volume : ", 300000. +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_bounding_box.doc b/doc/salome/gui/GEOM/input/tui_bounding_box.doc new file mode 100644 index 000000000..232ab13b4 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_bounding_box.doc @@ -0,0 +1,17 @@ +/*! + +\page tui_bounding_box_page Bounding Box + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +bb = geompy.BoundingBox(box) +print "\nBounding Box of box 100x30x100:" +print " Xmin = ", bb[0], ", Xmax = ", bb[1] +print " Ymin = ", bb[2], ", Ymax = ", bb[3] +print " Zmin = ", bb[4], ", Zmax = ", bb[5] +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_center_of_mass.doc b/doc/salome/gui/GEOM/input/tui_center_of_mass.doc new file mode 100644 index 000000000..9c9b6f659 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_center_of_mass.doc @@ -0,0 +1,25 @@ +/*! + +\page tui_center_of_mass_page Center of masses + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +cm = geompy.MakeCDG(box) +if cm is None: + raise RuntimeError, "MakeCDG(box) failed" +else: + print "\nCentre of gravity of box has been successfully obtained:" + coords = geompy.PointCoordinates(cm) + print "(", coords[0], ", ", coords[1], ", ", coords[2], ")" + dx = math.sqrt((coords[0] - 50)*(coords[0] - 50)) + dy = math.sqrt((coords[1] - 15)*(coords[1] - 15)) + dz = math.sqrt((coords[2] - 50)*(coords[2] - 50)) + if dx > 1e-7 or dy > 1e-7 or dz > 1e-7: + print "But must be (50, 15, 50)" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc b/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc new file mode 100644 index 000000000..1bd2fe9bb --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc @@ -0,0 +1,27 @@ +/*! + +\page tui_check_compound_of_blocks_page Check Compound of Blocks + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create boxes +box1 = geompy.MakeBox(0,0,0,100,50,100) +box2 = geompy.MakeBox(100,0,0,250,50,100) + +# make a compound +compound = geompy.MakeCompound([box1, box2]) + +# glue the faces of the compound +tolerance = 1e-5 +glue = geompy.MakeGlueFaces(compound, tolerance) +IsValid = geompy.CheckCompoundOfBlocks(glue) +if IsValid == 0: + raise RuntimeError, "Invalid compound created" +else: + print "\nCompound is valid" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc b/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc new file mode 100644 index 000000000..e49de0a30 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc @@ -0,0 +1,17 @@ +/*! + +\page tui_check_self_intersections_page Detect Self-intersections + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +IsValid = geompy.CheckSelfIntersections(box) +if IsValid == 0: + raise RuntimeError, "Box with self-intersections created" +else: + print "\nBox is valid" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_check_shape.doc b/doc/salome/gui/GEOM/input/tui_check_shape.doc new file mode 100644 index 000000000..f9ca32c97 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_check_shape.doc @@ -0,0 +1,17 @@ +/*! + +\page tui_check_shape_page Check Shape + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +IsValid = geompy.CheckShape(box) +if IsValid == 0: + raise RuntimeError, "Invalid box created" +else: + print "\nBox is valid" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_complex_objs.doc b/doc/salome/gui/GEOM/input/tui_complex_objs.doc index 254846e07..7dcf151c1 100644 --- a/doc/salome/gui/GEOM/input/tui_complex_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_complex_objs.doc @@ -271,7 +271,7 @@ faces.append(f3) faces.append(f4) shell = geompy.MakeSewing(faces,1.e-6) shells.append(shell) -faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) +faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"]) subbases.append(faces[0]) # 2 section @@ -311,7 +311,7 @@ faces.append(f3) faces.append(f4) shell = geompy.MakeSewing(faces,1.e-6) shells.append(shell) -faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) +faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"]) subbases.append(faces[0]) # 3 section @@ -356,7 +356,7 @@ faces.append(f3) faces.append(f4) shell = geompy.MakeSewing(faces,1.e-6) shells.append(shell) -faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) +faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"]) subbases.append(faces[2]) # 4 section @@ -391,7 +391,7 @@ vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2]) ff = geompy.MakePlane(vp,vec,40) fs.append(ff) aPartition = geompy.MakePartition(shellsph,fs) -fs = geompy.SubShapeAllSorted(aPartition, geompy.ShapeType["FACE"]) +fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"]) faces.append(fs[0]) faces.append(fs[1]) @@ -399,7 +399,7 @@ faces.append(fs[2]) faces.append(fs[3]) shell = geompy.MakeSewing(faces,1.e-6) shells.append(shell) -faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) +faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"]) #=========================================================== @@ -501,25 +501,25 @@ locs = [] # 1 section shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16) shells.append(shell) -vs1 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) +vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"]) locs.append(vs1[17]) # 2 section shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16) shells.append(shell) -vs2 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) +vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"]) locs.append(vs2[17]) # 3 section shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16) shells.append(shell) -vs3 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) +vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"]) locs.append(vs3[17]) # 4 section shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16) shells.append(shell) -vs4 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) +vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"]) locs.append(vs4[17]) @@ -623,4 +623,31 @@ from math import pi spring = MakeSpring(50, 100, 2*pi, 1, 5, pi/2) \endcode +

    Creation of Tangent Plane On Face

    +\code +import salome +import geompy + + # Create Vertexes for curve + Vertex_1 = geompy.MakeVertex(0, 0, 0) + Vertex_2 = geompy.MakeVertex(0, 90, 30) + Vertex_3 = geompy.MakeVertex(100, 90, 0) + Vertex_4 = geompy.MakeVertex(-100, 90, 0) + # Create curve + Curve_1 = geompy.MakeInterpol([Vertex_4, Vertex_2, Vertex_3, Vertex_1]) + # Create Face by Extrusion of the Curve + Extrusion_1 = geompy.MakePrismDXDYDZ(Curve_1, 0, 30, -60) + # Make Tangent on this Extrusion (Face) + Tangent_1 = geompy.MakeTangentPlaneOnFace(Extrusion_1, 0.7, 0.5, 150) + # Publish in the study + geompy.addToStudy( Vertex_1, "Vertex_1" ) + geompy.addToStudy( Vertex_2, "Vertex_2" ) + geompy.addToStudy( Vertex_3, "Vertex_3" ) + geompy.addToStudy( Vertex_4, "Vertex_4" ) + geompy.addToStudy( Curve_1, "Curve_1" ) + geompy.addToStudy( Extrusion_1, "Extrusion_1" ) + geompy.addToStudy( Tangent_1, "Tangent_1" ) +\endcode + + */ diff --git a/doc/salome/gui/GEOM/input/tui_creating_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_creating_geom_objs.doc index 7ba4445f0..3109c2aa4 100644 --- a/doc/salome/gui/GEOM/input/tui_creating_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_creating_geom_objs.doc @@ -5,11 +5,13 @@
    • \subpage tui_basic_geom_objs_page
    • \subpage tui_primitives_page
    • +
    • \subpage tui_advanced_geom_objs_page
    • \subpage tui_complex_objs_page
    • \subpage tui_working_with_groups_page
    • \subpage tui_building_by_blocks_page
    • \subpage tui_sketcher_page
    • -
    • \subpage tui_advanced_geom_objs_page
    • +
    • \subpage tui_3dsketcher_page
    • +
    • \subpage tui_topological_geom_objs_page
    */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/tui_free_boundaries.doc b/doc/salome/gui/GEOM/input/tui_free_boundaries.doc new file mode 100644 index 000000000..b764df1b2 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_free_boundaries.doc @@ -0,0 +1,85 @@ +/*! + +\page tui_free_boundaries_page Check Free Boundaries + +\code +import os +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create boxes +box1 = geompy.MakeBox(0,0,0,100,50,100) +box2 = geompy.MakeBox(100,0,0,250,50,100) + +# make a compound +compound = geompy.MakeCompound([box1, box2]) + +# import from *.brep +ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep") + +# get a face +faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"]) + +# get the free boundary for face 32 +Res = geompy.GetFreeBoundary(faces[32]) +isSuccess = Res[0] +ClosedWires = Res[1] +OpenWires = Res[2] + +if isSuccess == 1 : + print "Checking free boudaries is OK." +else : + print "Checking free boudaries is KO!" +print "len(ClosedWires) = ", len(ClosedWires) + +i = 0 +for wire in ClosedWires : + wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1) + geompy.addToStudy(ClosedWires[i], wire_name) + if i < len(ClosedWires) : + i = i+ 1 + +print "len(OpenWires) = ", len(OpenWires) + +i = 0 +for wire in OpenWires : + wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1) + geompy.addToStudy(OpenWires[i], wire_name) + if i < len(OpenWires) : + i = i+ 1 + +# get the free boundary for face 41 +Res = geompy.GetFreeBoundary(faces[41]) +isSuccess = Res[0] +ClosedWires = Res[1] +OpenWires = Res[2] + +if isSuccess == 1 : + print "Checking free boudaries is OK." +else : + print "Checking free boudaries is KO!" +print "len(ClosedWires) = ", len(ClosedWires) + +i = 0 +for wire in ClosedWires : + wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1) + geompy.addToStudy(ClosedWires[i], wire_name) + if i < len(ClosedWires) : + i = i+ 1 + +print "len(OpenWires) = ", len(OpenWires) + +i = 0 +for wire in OpenWires : + wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1) + geompy.addToStudy(OpenWires[i], wire_name) + if i < len(OpenWires) : + i = i+ 1 + +# add the imported object to the study +id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP") +salome.sg.updateObjBrowser(1) +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_free_faces.doc b/doc/salome/gui/GEOM/input/tui_free_faces.doc new file mode 100644 index 000000000..7fd302288 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_free_faces.doc @@ -0,0 +1,52 @@ +/*! + +\page tui_free_faces_page Check Free Faces + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create a vertex and a vector +p1 = geompy.MakeVertex(35, 35, 0) +p2 = geompy.MakeVertex(35, 35, 50) +v = geompy.MakeVector(p1, p2) + +# create a cylinder +cylinder = geompy.MakeCone(p1, v, 30, 20, 20) + +# create a cone +cone = geompy.MakeCone(p1, v, 70, 40, 60) + +# make cut +cut = geompy.MakeCut(cone, cylinder) + +# get faces as sub-shapes +faces = [] +faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"]) +f_2 = geompy.GetSubShapeID(cut, faces[0]) + +# remove one face from the shape +cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) + +# suppress the specified wire +result = geompy.GetFreeFacesIDs(cut_without_f_2) +print "A number of free faces is ", len(result) + +# add objects in the study +all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"]) +for face in all_faces : + sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face) + if result.count(sub_shape_id) > 0 : + face_name = "Free face %d"%(sub_shape_id) + geompy.addToStudy(face, face_name) + +# in this example all faces from cut_without_f_2 are free +id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2") + +# display the results +gg.createAndDisplayGO(id_cut_without_f_2) +gg.setDisplayMode(id_cut_without_f_2,1) +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_import_export.doc b/doc/salome/gui/GEOM/input/tui_import_export.doc new file mode 100644 index 000000000..cdd8c4ea0 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_import_export.doc @@ -0,0 +1,45 @@ +/*! + +\page tui_import_export_page Import/Export +\code +import geompy +import salome + +# Example of import from IGES using various formats + +# get a path to SAMPLES_SRC +import os +thePath = os.getenv("DATA_DIR") +# create filenames +theFileName1 = thePath + "/Shapes/Iges/boite-3Dipsos_m.igs" +theFileName2 = thePath + "/Shapes/Iges/boite-3Dipsos_mm.igs" +#print "thePath = ", thePath + +# get units from files +UnitName1 = geompy.GetIGESUnit(theFileName1) +UnitName2 = geompy.GetIGESUnit(theFileName2) +print "UnitName1 = ", UnitName1 +print "UnitName2 = ", UnitName2 + +# import shapes +Shape1 = geompy.ImportIGES(theFileName1) +Shape2 = geompy.ImportIGES(theFileName2) +Shape3 = geompy.ImportFile(theFileName2,"IGES_SCALE") +[Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1) +[Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2) +[Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3) +geompy.addToStudy(Shape1, "3Dipsos_m") +geompy.addToStudy(Shape2, "3Dipsos_mm") +geompy.addToStudy(Shape3, "3Dipsos_mm_scaled") +d1 = (Xmax1-Xmin1)*(Xmax1-Xmin1) + (Ymax1-Ymin1)*(Ymax1-Ymin1) + (Zmax1-Zmin1)*(Zmax1-Zmin1) +d2 = (Xmax2-Xmin2)*(Xmax2-Xmin2) + (Ymax2-Ymin2)*(Ymax2-Ymin2) + (Zmax2-Zmin2)*(Zmax2-Zmin2) +d3 = (Xmax3-Xmin3)*(Xmax3-Xmin3) + (Ymax3-Ymin3)*(Ymax3-Ymin3) + (Zmax3-Zmin3)*(Zmax3-Zmin3) +import math +dd32 = math.sqrt(d3/d2) +dd12 = math.sqrt(d1/d2) +dd31 = math.sqrt(d3/d1) +# values dd31, dd12 and dd31 can be using for checking +print "dd32 = ",dd32," dd12 = ",dd12," dd31 = ",dd31 +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_inertia.doc b/doc/salome/gui/GEOM/input/tui_inertia.doc new file mode 100644 index 000000000..29530e292 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_inertia.doc @@ -0,0 +1,20 @@ +/*! + +\page tui_inertia_page Inertia + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +In = geompy.Inertia(box) +print "\nInertia matrix of box 100x30x100:" +print " (", In[0], ", ", In[1], ", ", In[2], ")" +print " (", In[3], ", ", In[4], ", ", In[5], ")" +print " (", In[6], ", ", In[7], ", ", In[8], ")" +print "Main moments of inertia of box 100x30x100:" +print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11] +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc index ff70d793a..4ce9b4239 100644 --- a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc +++ b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc @@ -2,368 +2,22 @@ \page tui_measurement_tools_page Measurement Tools -

    Point Coordinates

    - -\code -import math -import geompy - -# create a point -point = geompy.MakeVertex(15., 23., 80.) - -# get the coordinates of the point and check its values -coords = geompy.PointCoordinates(point) - -# check the obtained coordinate values -tolerance = 1.e-07 -def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance) - -if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.): - print "All values are OK." -else : - print "Coordinates of point must be (15, 23, 80), but returned (", - print coords[0], ", ", coords[1], ", ", coords[2], ")" - pass -\endcode - -

    Basic Properties

    - -\code -import geompy -import math - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -props = geompy.BasicProperties(box) -print "\nBox 100x30x100 Basic Properties:" -print " Wires length: ", props[0] -print " Surface area: ", props[1] -print " Volume : ", props[2] -length = math.sqrt((props[0] - 1840)*(props[0] - 1840)) -area = math.sqrt((props[1] - 32000)*(props[1] - 32000)) -volume = math.sqrt((props[2] - 300000)*(props[2] - 300000)) -if length > 1e-7 or area > 1e-7 or volume > 1e-7: - print "While must be:" - print " Wires length: ", 1840 - print " Surface area: ", 32000 - print " Volume : ", 300000. -\endcode - -

    Center of masses

    - -\code -import geompy -import math - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -cm = geompy.MakeCDG(box) -if cm is None: - raise RuntimeError, "MakeCDG(box) failed" -else: - print "\nCentre of gravity of box has been successfully obtained:" - coords = geompy.PointCoordinates(cm) - print "(", coords[0], ", ", coords[1], ", ", coords[2], ")" - dx = math.sqrt((coords[0] - 50)*(coords[0] - 50)) - dy = math.sqrt((coords[1] - 15)*(coords[1] - 15)) - dz = math.sqrt((coords[2] - 50)*(coords[2] - 50)) - if dx > 1e-7 or dy > 1e-7 or dz > 1e-7: - print "But must be (50, 15, 50)" -\endcode - -

    Inertia

    - -\code -import geompy -import math - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -In = geompy.Inertia(box) -print "\nInertia matrix of box 100x30x100:" -print " (", In[0], ", ", In[1], ", ", In[2], ")" -print " (", In[3], ", ", In[4], ", ", In[5], ")" -print " (", In[6], ", ", In[7], ", ", In[8], ")" -print "Main moments of inertia of box 100x30x100:" -print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11] -\endcode - -

    Check Free Boundaries

    - -\code -import os -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") - -# create boxes -box1 = geompy.MakeBox(0,0,0,100,50,100) -box2 = geompy.MakeBox(100,0,0,250,50,100) - -# make a compound -compound = geompy.MakeCompound([box1, box2]) - -# import from *.brep -ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep") - -# get a face -faces = geompy.SubShapeAllSorted(ImportFromBREP, geompy.ShapeType["FACE"]) - -# get the free boundary for face 32 -Res = geompy.GetFreeBoundary(faces[32]) -isSuccess = Res[0] -ClosedWires = Res[1] -OpenWires = Res[2] - -if isSuccess == 1 : - print "Checking free boudaries is OK." -else : - print "Checking free boudaries is KO!" -print "len(ClosedWires) = ", len(ClosedWires) - -i = 0 -for wire in ClosedWires : - wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1) - geompy.addToStudy(ClosedWires[i], wire_name) - if i < len(ClosedWires) : - i = i+ 1 - -print "len(OpenWires) = ", len(OpenWires) - -i = 0 -for wire in OpenWires : - wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1) - geompy.addToStudy(OpenWires[i], wire_name) - if i < len(OpenWires) : - i = i+ 1 - -# get the free boundary for face 41 -Res = geompy.GetFreeBoundary(faces[41]) -isSuccess = Res[0] -ClosedWires = Res[1] -OpenWires = Res[2] - -if isSuccess == 1 : - print "Checking free boudaries is OK." -else : - print "Checking free boudaries is KO!" -print "len(ClosedWires) = ", len(ClosedWires) - -i = 0 -for wire in ClosedWires : - wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1) - geompy.addToStudy(ClosedWires[i], wire_name) - if i < len(ClosedWires) : - i = i+ 1 - -print "len(OpenWires) = ", len(OpenWires) - -i = 0 -for wire in OpenWires : - wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1) - geompy.addToStudy(OpenWires[i], wire_name) - if i < len(OpenWires) : - i = i+ 1 - -# add the imported object to the study -id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP") -salome.sg.updateObjBrowser(1) -\endcode - - -

    Check Free Faces

    - -\code -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") - -# create a vertex and a vector -p1 = geompy.MakeVertex(35, 35, 0) -p2 = geompy.MakeVertex(35, 35, 50) -v = geompy.MakeVector(p1, p2) - -# create a cylinder -cylinder = geompy.MakeCone(p1, v, 30, 20, 20) - -# create a cone -cone = geompy.MakeCone(p1, v, 70, 40, 60) - -# make cut -cut = geompy.MakeCut(cone, cylinder) - -# get faces as sub-shapes -faces = [] -faces = geompy.SubShapeAllSorted(cut, geompy.ShapeType["FACE"]) -f_2 = geompy.GetSubShapeID(cut, faces[0]) - -# remove one face from the shape -cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) - -# suppress the specified wire -result = geompy.GetFreeFacesIDs(cut_without_f_2) -print "A number of free faces is ", len(result) - -# add objects in the study -all_faces = geompy.SubShapeAllSorted(cut_without_f_2, geompy.ShapeType["FACE"]) -for face in all_faces : - sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face) - if result.count(sub_shape_id) > 0 : - face_name = "Free face %d"%(sub_shape_id) - geompy.addToStudy(face, face_name) - -# in this example all faces from cut_without_f_2 are free -id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2") - -# display the results -gg.createAndDisplayGO(id_cut_without_f_2) -gg.setDisplayMode(id_cut_without_f_2,1) -\endcode - - - -

    Bounding Box

    - -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -bb = geompy.BoundingBox(box) -print "\nBounding Box of box 100x30x100:" -print " Xmin = ", bb[0], ", Xmax = ", bb[1] -print " Ymin = ", bb[2], ", Ymax = ", bb[3] -print " Zmin = ", bb[4], ", Zmax = ", bb[5] -\endcode - -

    Minimal Distance

    - -\code -import geompy - -# create boxes -box1 = geompy.MakeBoxDXDYDZ(100,30,100) -box2 = geompy.MakeBox(105,0,0,200,30,100) -min_dist = geompy.MinDistance(box1,box2) -print "\nMinimal distance between box1 and box2 = ", min_dist -\endcode - -

    Tolerance

    - -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -Toler = geompy.Tolerance(box) -print "\nBox 100x30x100 tolerance:" -print " Face min. tolerance: ", Toler[0] -print " Face max. tolerance: ", Toler[1] -print " Edge min. tolerance: ", Toler[2] -print " Edge max. tolerance: ", Toler[3] -print " Vertex min. tolerance: ", Toler[4] -print " Vertex max. tolerance: ", Toler[5] -\endcode - -

    Angle

    - -\code -import salome -salome.salome_init() - -import math -import geompy -geompy.init_geom(salome.myStudy) - -OX = geompy.MakeVectorDXDYDZ(10, 0,0) -OXY = geompy.MakeVectorDXDYDZ(10,10,0) - -# in one plane -Angle = geompy.GetAngle(OX, OXY) - -print "\nAngle between OX and OXY = ", Angle -if math.fabs(Angle - 45.0) > 1e-05: - print " Error: returned angle is", Angle, "while must be 45.0" - pass - -Angle = geompy.GetAngleRadians(OX, OXY) - -print "\nAngle between OX and OXY in radians = ", Angle -if math.fabs(Angle - math.pi/4) > 1e-05: - print " Error: returned angle is", Angle, "while must be pi/4" - pass - -# not in one plane -OXY_shift = geompy.MakeTranslation(OXY,10,-10,20) -Angle = geompy.GetAngle(OX, OXY_shift) - -print "Angle between OX and OXY_shift = ", Angle -if math.fabs(Angle - 45.0) > 1e-05: - print " Error: returned angle is", Angle, "while must be 45.0" - pass - -# not linear -pnt1 = geompy.MakeVertex(0, 0, 0) -pnt2 = geompy.MakeVertex(10, 0, 0) -pnt3 = geompy.MakeVertex(20, 10, 0) -arc = geompy.MakeArc(pnt1, pnt2, pnt3) -Angle = geompy.GetAngle(OX, arc) - -if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()): - print "Error. Angle must not be computed on curvilinear edges" - pass - -\endcode - - -

    What Is

    - -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -Descr = geompy.WhatIs(box) -print "\nBox 100x30x100 description:" -print Descr -\endcode - -

    Check Shape

    - -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -IsValid = geompy.CheckShape(box) -if IsValid == 0: - raise RuntimeError, "Invalid box created" -else: - print "\nBox is valid" -\endcode - -

    Check Compound of Blocks

    - -\code -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") - -# create boxes -box1 = geompy.MakeBox(0,0,0,100,50,100) -box2 = geompy.MakeBox(100,0,0,250,50,100) - -# make a compound -compound = geompy.MakeCompound([box1, box2]) - -# glue the faces of the compound -tolerance = 1e-5 -glue = geompy.MakeGlueFaces(compound, tolerance) -IsValid = geompy.CheckCompoundOfBlocks(glue) -if IsValid == 0: - raise RuntimeError, "Invalid compound created" -else: - print "\nCompound is valid" -\endcode +
      +
    • \subpage tui_point_coordinates_page
    • +
    • \subpage tui_basic_properties_page
    • +
    • \subpage tui_center_of_mass_page
    • +
    • \subpage tui_inertia_page
    • +
    • \subpage tui_normal_face_page
    • +
    • \subpage tui_bounding_box_page
    • +
    • \subpage tui_min_distance_page
    • +
    • \subpage tui_angle_page
    • +
    • \subpage tui_tolerance_page
    • +
    • \subpage tui_whatis_page
    • +
    • \subpage tui_free_boundaries_page
    • +
    • \subpage tui_free_faces_page
    • +
    • \subpage tui_check_shape_page
    • +
    • \subpage tui_check_compound_of_blocks_page
    • +
    • \subpage tui_check_self_intersections_page
    • +
    */ diff --git a/doc/salome/gui/GEOM/input/tui_min_distance.doc b/doc/salome/gui/GEOM/input/tui_min_distance.doc new file mode 100644 index 000000000..e26e219f9 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_min_distance.doc @@ -0,0 +1,15 @@ +/*! + +\page tui_min_distance_page Minimal Distance + +\code +import geompy + +# create boxes +box1 = geompy.MakeBoxDXDYDZ(100,30,100) +box2 = geompy.MakeBox(105,0,0,200,30,100) +min_dist = geompy.MinDistance(box1,box2) +print "\nMinimal distance between box1 and box2 = ", min_dist +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_normal_face.doc b/doc/salome/gui/GEOM/input/tui_normal_face.doc new file mode 100644 index 000000000..0c81116a8 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_normal_face.doc @@ -0,0 +1,23 @@ +/*! + +\page tui_normal_face_page Normal to a Face + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) + +faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"]) +face0 = faces[0] +vnorm = geompy.GetNormal(face0) +if vnorm is None: + raise RuntimeError, "GetNormal(face0) failed" +else: + geompy.addToStudy(face0, "Face0") + geompy.addToStudy(vnorm, "Normale to Face0") + print "\nNormale of face has been successfully obtained" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_notebook_geom.doc b/doc/salome/gui/GEOM/input/tui_notebook_geom.doc new file mode 100644 index 000000000..629ce6329 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_notebook_geom.doc @@ -0,0 +1,29 @@ +/*! + +\page tui_notebook_geom_page Using SALOME NoteBook + +\anchor tui_notebook_geom + +\code +import geompy +import salome +import salome_notebook +gg = salome.ImportComponentGUI("GEOM") + +# set variables +notebook = salome_notebook.notebook +notebook.set("Length", 150) +notebook.set("Width", 100) + +# create box +box = geompy.MakeBoxDXDYDZ("Length", "Width", 200) + +# add object in the study +id_box = geompy.addToStudy(box,"Box") + +# display the boxes +gg.createAndDisplayGO(id_box) +gg.setDisplayMode(id_box,1) +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_point_coordinates.doc b/doc/salome/gui/GEOM/input/tui_point_coordinates.doc new file mode 100644 index 000000000..0f138367b --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_point_coordinates.doc @@ -0,0 +1,27 @@ +/*! + +\page tui_point_coordinates_page Point Coordinates + +\code +import math +import geompy + +# create a point +point = geompy.MakeVertex(15., 23., 80.) + +# get the coordinates of the point and check its values +coords = geompy.PointCoordinates(point) + +# check the obtained coordinate values +tolerance = 1.e-07 +def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance) + +if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.): + print "All values are OK." +else : + print "Coordinates of point must be (15, 23, 80), but returned (", + print coords[0], ", ", coords[1], ", ", coords[2], ")" + pass +\endcode + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/tui_primitives.doc b/doc/salome/gui/GEOM/input/tui_primitives.doc index 538067c01..af7670ea8 100644 --- a/doc/salome/gui/GEOM/input/tui_primitives.doc +++ b/doc/salome/gui/GEOM/input/tui_primitives.doc @@ -196,7 +196,7 @@ gg.createAndDisplayGO(id_diks3) \endcode \anchor tui_creation_squareface -

    Creation of a Face

    +

    Creation of a Rectangle

    \code import geompy @@ -210,23 +210,21 @@ py = geompy.MakeVertex(0. , 100., 0. ) # create a vector on two points vxy = geompy.MakeVector(px, py) -# create a face in OXY plane +# create a rectangle in OXY plane face1 = geompy.MakeFaceHW(100, 100, 1) -# create a disk from a point, a vector and a radius +# create a rectangle using normal vector face2 = geompy.MakeFaceObjHW(vxy, 50, 150) -#create a circle from three points +# create a rectangle from other face face3 = geompy.MakeFaceObjHW(face2, 150, 50) # add objects in the study -id_vxy = geompy.addToStudy(vxy, "Vector") id_face1 = geompy.addToStudy(face1,"Face1") id_face2 = geompy.addToStudy(face2,"Face2") id_face3 = geompy.addToStudy(face3,"Face3") -# display disks -gg.createAndDisplayGO(id_vxy) +# display rectangles gg.createAndDisplayGO(id_face1) gg.createAndDisplayGO(id_face2) gg.createAndDisplayGO(id_face3) diff --git a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc index 98dccc6f0..0ce8b63db 100644 --- a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc @@ -65,7 +65,7 @@ box = geompy.MakeBoxDXDYDZ(200, 200, 200) # The list of IDs (IDList) for suppress faces sup_faces = [] -sup_faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) +sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"]) # get indices of the sub-shape f1_id = geompy.GetSubShapeID(box, sup_faces[3]) @@ -182,7 +182,7 @@ cut = geompy.MakeCut(cone, cylinder) # get faces as sub-shapes faces = [] -faces = geompy.SubShapeAllSorted(cut, geompy.ShapeType["FACE"]) +faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"]) f_2 = geompy.GetSubShapeID(cut, faces[2]) # remove one face from the shape @@ -190,7 +190,7 @@ cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) # get wires as sub-shapes wires = [] -wires = geompy.SubShapeAllSorted(cut_without_f_2, geompy.ShapeType["WIRE"]) +wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"]) w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0]) # suppress the selected wire @@ -289,6 +289,77 @@ gg.createAndDisplayGO(id_glue) gg.setDisplayMode(id_glue,1) \endcode +\anchor tui_glue_edges +

    Glue Edges

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create boxes +box1 = geompy.MakeBox(0,0,0,100,50,100) +box2 = geompy.MakeBox(100,0,0,250,50,100) + +# make compound +compound = geompy.MakeCompound([box1, box2]) + +# glue all compound's edges +tolerance = 1e-5 +glue1 = geompy.MakeGlueEdges(compound, tolerance) + +# glue some compound's edges +list_edges = geompy.GetGlueEdges(compound, tolerance) +glue2 = geompy.MakeGlueEdgesByList(compound, tolerance, [list_edges[0], list_edges[2]]) + +# add objects in study +geompy.addToStudy(box1, "Box1") +geompy.addToStudy(box2, "Box2") +geompy.addToStudy(compound, "Compound") +geompy.addToStudy(glue1, "Glue all edges") +geompy.addToStudy(glue2, "Glue two edges") + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) +\endcode + +\anchor tui_limit_tolerance +

    Limit Tolerance

    + +\code +import geompy +gg = salome.ImportComponentGUI("GEOM") + +# import initial topology +shape1 = geompy.ImportBREP("my_shape_1.brep") +shape2 = geompy.ImportBREP("my_shape_2.brep") + +geompy.addToStudy(shape1, "Shape 1") +geompy.addToStudy(shape2, "Shape 2") + +# perform partition +try: + part = geompy.MakePartition([shape1, shape2]) +except: + # limit tolerance + tolerance = 1e-07 + shape1_lt = geompy.LimitTolerance(shape1, tolerance) + shape2_lt = geompy.LimitTolerance(shape2, tolerance) + + # process shape + good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"]) + good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"]) + + geompy.addToStudy(good_shape1, "Shape 1 corrected") + geompy.addToStudy(good_shape2, "Shape 2 corrected") + + # perform partition on corrected shapes + part = geompy.MakePartition([good_shape1, good_shape2]) + pass + +geompy.addToStudy(part, "Partition") +\endcode + \anchor tui_add_point_on_edge

    Add Point on Edge

    @@ -308,17 +379,69 @@ divide = geompy.DivideEdge(edge, -1, 0.5, 0) # add objects in the study id_edge = geompy.addToStudy(edge, "Edge") -edge_points = geompy.SubShapeAllSorted(edge, geompy.ShapeType["VERTEX"]) +edge_points = geompy.SubShapeAllSortedCentres(edge, geompy.ShapeType["VERTEX"]) for point in edge_points: geompy.addToStudyInFather(edge, point, "Edge's point") id_divide = geompy.addToStudy(divide, "Divided edge") -edge_points = geompy.SubShapeAllSorted(divide, geompy.ShapeType["VERTEX"]) +edge_points = geompy.SubShapeAllSortedCentres(divide, geompy.ShapeType["VERTEX"]) for point in edge_points: geompy.addToStudyInFather(divide, point, "Edge's point after divide") salome.sg.updateObjBrowser(1) \endcode +\anchor tui_fuse_collinear_edges +

    Fuse Collinear Edges within a Wire

    + +\code +import geompy +import salome + +# create vertices +p1 = geompy.MakeVertex(0, 0, 0) +p2 = geompy.MakeVertex(70, 0, 0) +p3 = geompy.MakeVertex(70, 50, 0) +p4 = geompy.MakeVertex(70, 80, 0) +p5 = geompy.MakeVertex(50, 80, 0) +p6 = geompy.MakeVertex(20, 80, 0) +p7 = geompy.MakeVertex(0, 80, 0) +p8 = geompy.MakeVertex(0, 30, 0) + +points = [p1, p2, p3, p4, p5, p6, p7, p8] + +# make a wire +wire_1 = geompy.MakePolyline(points, True) + +# suppress some vertices in the wire +wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3]) +wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6]) + +# suppress all suitable vertices in the wire +wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, []) + +wires = [wire_1, wire_2, wire_3, wire_4] + +# add objects in the study +ii = 1 +for point in points: + geompy.addToStudy(point, "p%d"%ii) + ii = ii + 1 + pass + +ii = 1 +for wire in wires: + geompy.addToStudy(wire, "wire_%d"%ii) + wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"]) + jj = 1 + for point in wire_points: + geompy.addToStudyInFather(wire, point, "point_%d"%jj) + jj = jj + 1 + pass + ii = ii + 1 + pass + +salome.sg.updateObjBrowser(1) +\endcode */ diff --git a/doc/salome/gui/GEOM/input/tui_sketcher.doc b/doc/salome/gui/GEOM/input/tui_sketcher.doc index 31c576f23..e344eae27 100644 --- a/doc/salome/gui/GEOM/input/tui_sketcher.doc +++ b/doc/salome/gui/GEOM/input/tui_sketcher.doc @@ -1,6 +1,6 @@ /*! -\page tui_sketcher_page Sketcher +\page tui_sketcher_page 2D Sketcher \code import geompy @@ -45,4 +45,4 @@ gg.createAndDisplayGO(id_sketcher1) gg.createAndDisplayGO(id_sketcher2) \endcode -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/tui_swig_examples.doc b/doc/salome/gui/GEOM/input/tui_swig_examples.doc index 43b003d42..4385c1174 100644 --- a/doc/salome/gui/GEOM/input/tui_swig_examples.doc +++ b/doc/salome/gui/GEOM/input/tui_swig_examples.doc @@ -6,6 +6,7 @@
  • \subpage tui_test_others_page
  • \subpage tui_test_spanner_page
  • \subpage tui_test_all_page
  • +
  • \subpage tui_test_measures_page
  • */ diff --git a/doc/salome/gui/GEOM/input/tui_test_all.doc b/doc/salome/gui/GEOM/input/tui_test_all.doc index caeae7be8..2fe8d7623 100644 --- a/doc/salome/gui/GEOM/input/tui_test_all.doc +++ b/doc/salome/gui/GEOM/input/tui_test_all.doc @@ -13,15 +13,15 @@ \anchor swig_MakeMarker \until cs3 -\until MakePlaneThreePnt +\until MakePlaneLCS \anchor swig_MakeArc -\until MakeArcCenter +\until MakeArcOfEllipse \anchor swig_MakeCircle \until Circle2 -\until MakeVertexOnCurve +\until MakeVertexOnCurveByLength \anchor swig_MakeVertexOnLinesIntersection \until p_on_l1l2 @@ -29,11 +29,17 @@ \anchor swig_MakeTangentOnCurve \until tan_on_arc +\anchor swig_MakeTangentPlaneOnFace +\until tan_on_face + \until MakeCompound \anchor swig_MakeVertexOnSurface \until p_on_face +\anchor swig_MakeVertexOnSurfaceByCoord +\until p_on_face2 + \until S = geompy.MakeRotation \anchor swig_MakeLineTwoFaces @@ -42,6 +48,9 @@ \anchor swig_all_advanced \until MakeSewing +\anchor swig_MakeCopy +\until MakeCopy + \anchor swig_all_trsf \until RotatPnt @@ -54,6 +63,9 @@ \anchor swig_ChangeOrientation \until ChangeOrientation +\anchor swig_ExtractShapes +\until prism_edges + \anchor swig_FilletChamfer \until End of Local operations @@ -69,6 +81,12 @@ \anchor swig_all_addtostudy \until id_Partition1 +\anchor swig_all_addtostudyInFather +\until id_SubFace + +\anchor swig_SubShapeName +\until nameS + \anchor swig_all_decompose \until print "DONE" diff --git a/doc/salome/gui/GEOM/input/tui_test_measures.doc b/doc/salome/gui/GEOM/input/tui_test_measures.doc new file mode 100644 index 000000000..90dafb538 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_test_measures.doc @@ -0,0 +1,54 @@ +/*! + +\page tui_test_measures_page GEOM_TestMeasures.py + +\anchor swig_TestMeasures +

    GEOM_TestMeasures.py

    + +\dontinclude GEOM_TestMeasures.py +\skipline def TestMeasureOperations + +\until PointCoordinates + +\anchor swig_PointCoordinates +\until CheckShape + +\anchor swig_CheckShape +\until MakeCompound + +\anchor swig_CheckSelfIntersections +\until WhatIs + +\anchor swig_WhatIs +\until BasicProperties + +\anchor swig_BasicProperties +\until BoundingBox + +\anchor swig_BoundingBox +\until Inertia + +\anchor swig_Inertia +\until Tolerance + +\anchor swig_Tolerance +\until MakeCDG + +\anchor swig_MakeCDG +\until But must be + +\until face0 + +\anchor swig_GetNormal +\until MinDistance + +\anchor swig_MinDistance +\until in one plane + +\anchor swig_GetAngle +\until Error + +\anchor swig_GetAngleRadians +\until pass + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_test_others.doc b/doc/salome/gui/GEOM/input/tui_test_others.doc index 32d3c8b21..2b1b44c7c 100644 --- a/doc/salome/gui/GEOM/input/tui_test_others.doc +++ b/doc/salome/gui/GEOM/input/tui_test_others.doc @@ -40,11 +40,8 @@ \anchor swig_MakeChamfer \until id_MakeChamfer -\anchor swig_NumberOfFaces -\until Bad number of faces - -\anchor swig_NumberOfEdges -\until Bad number of edges +\anchor swig_NumberOf +\until Bad number of shapes \anchor swig_MakeBlockExplode \until id_MakeBlockExplode @@ -91,7 +88,7 @@ \until "freeFacesWithoutExtra" \anchor swig_GetSharedShapes -\until "sharedFace" +\until "sharedEdge_" \anchor swig_CheckAndImprove \until "blocksComp" @@ -102,12 +99,21 @@ \anchor swig_GetPoint \until blocksComp (-50, -50, -50) +\anchor swig_GetVertexNearPoint +\until near (40, 40, 40) + +\anchor swig_GetEdge +\until by two points + \anchor swig_GetEdgeNearPoint \until edge near point \anchor swig_GetBlockByParts \until "b0 image" +\anchor swig_GetShapesNearPoint +\until faces near point + \anchor swig_GetShapesOnPlane \until Face on Plane @@ -126,6 +132,12 @@ \anchor swig_GetShapesOnCylinderIDs \until Group of edges +\anchor swig_GetShapesOnCylinderWithLocation +\until Edge out of + +\anchor swig_GetShapesOnCylinderWithLocationIDs +\until Group of edges + \anchor swig_GetShapesOnSphere \until Vertex on Sphere diff --git a/doc/salome/gui/GEOM/input/tui_tolerance.doc b/doc/salome/gui/GEOM/input/tui_tolerance.doc new file mode 100644 index 000000000..55151302a --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_tolerance.doc @@ -0,0 +1,20 @@ +/*! + +\page tui_tolerance_page Tolerance + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +Toler = geompy.Tolerance(box) +print "\nBox 100x30x100 tolerance:" +print " Face min. tolerance: ", Toler[0] +print " Face max. tolerance: ", Toler[1] +print " Edge min. tolerance: ", Toler[2] +print " Edge max. tolerance: ", Toler[3] +print " Vertex min. tolerance: ", Toler[4] +print " Vertex max. tolerance: ", Toler[5] +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc new file mode 100644 index 000000000..e314abc85 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc @@ -0,0 +1,261 @@ +/*! + +\page tui_topological_geom_objs_page Topological Objects + +\anchor tui_creation_edge +

    Creation of an Edge

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# +# create edge by two points +# + +# create vertices +p0 = geompy.MakeVertex(0. , 0. , 0. ) +pxyz = geompy.MakeVertex(100., 100., 100.) + +# create an edge +edge = geompy.MakeEdge(p0, pxyz) + +# add object in the study +id_edge = geompy.addToStudy(edge,"Edge_1") + +# display an edge +gg.createAndDisplayGO(id_edge) + +# +# create edge from wire +# + +# create a circle +c = geompy.MakeCircle(None, None, 100) + +# create a wire +w = geompy.MakeWire([c], 1e-07) + +# create an edge from wire +edge = geompy.MakeEdgeWire(w) + +# add object in the study +id_edge = geompy.addToStudy(edge,"Edge_2") + +# display an edge +gg.createAndDisplayGO(id_edge) + +# +# create edge from existing curve and a length +# + +# create a circle +c = geompy.MakeCircle(None, None, 100) + +# create an edge of length 25.0 from the circle +edge = geompy.MakeEdgeOnCurveByLength(c, 25.0) + +# add object in the study +id_edge = geompy.addToStudy(edge,"Edge_3") + +# display an edge +gg.createAndDisplayGO(id_edge) + +\endcode + +\anchor tui_creation_wire +

    Creation of a Wire

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create vertices +px = geompy.MakeVertex(100., 0. , 0. ) +py = geompy.MakeVertex(0. , 100., 0. ) +pz = geompy.MakeVertex(0. , 0. , 100.) + +# create a vector from two points +vxy = geompy.MakeVector(px, py) + +# create an arc from three points +arc = geompy.MakeArc(py, pz, px) + +# create a wire +wire = geompy.MakeWire([vxy, arc]) + +# add an object in the study +id_wire = geompy.addToStudy(wire,"Wire") + +# display the wire +gg.createAndDisplayGO(id_wire) +\endcode + +\anchor tui_creation_face +

    Creation of a Face

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create vertices +p0 = geompy.MakeVertex(0. , 0. , 0. ) +px = geompy.MakeVertex(100., 0. , 0. ) +py = geompy.MakeVertex(0. , 100., 0. ) +pz = geompy.MakeVertex(0. , 0. , 100.) +pxyz = geompy.MakeVertex(100., 100., 100.) + +# create a vector from two points +vxy = geompy.MakeVector(px, py) + +# create an arc from three points +arc = geompy.MakeArc(py, pz, px) + +# create a wire +wire = geompy.MakeWire([vxy, arc]) + +# create sketchers +sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW", + [100,0,0, 1,1,1, -1,1,0]) +sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW") +sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW") +isPlanarFace = 1 + +# create a face from the wire +face1 = geompy.MakeFace(wire, isPlanarFace) + +# create faces from two wires +face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace) +face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace) + +# add objects in the study +id_face1 = geompy.addToStudy(face1,"Face1") +id_face2 = geompy.addToStudy(face2,"Face2") +id_face3 = geompy.addToStudy(face3,"Face3") + +# display the faces +gg.createAndDisplayGO(id_face1) +gg.setDisplayMode(id_face1,1) +gg.setTransparency(id_face1,0.2) +gg.createAndDisplayGO(id_face2) +gg.setDisplayMode(id_face2,1) +gg.setTransparency(id_face2,0.2) +gg.createAndDisplayGO(id_face3) +gg.setDisplayMode(id_face3,1) +gg.setTransparency(id_face3,0.2) +\endcode + +\anchor tui_creation_shell +

    Creation of a Shell

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +#create vertices +p0 = geompy.MakeVertex( 0., 0., 0.) +pxyz = geompy.MakeVertex( 5., 5., 40.) + +# create sketchers +sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW") +sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW") +isPlanarFace = 1 + +# create a face from two wires +face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace) + +# create a prism +prism = geompy.MakePrism(face, p0, pxyz) + +# explode the prism into faces +prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"]) + +# create a shell from a set of faces +shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3], + prism_faces[7], prism_faces[9]]) + +# add objects in the study +id_shell = geompy.addToStudy(shell,"Shell") + +# display the shell +gg.createAndDisplayGO(id_shell) +gg.setDisplayMode(id_shell,1) +\endcode + +\anchor tui_creation_solid +

    Creation of a Solid

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +#create vertices +p0 = geompy.MakeVertex( 0., 0., 0.) +pz = geompy.MakeVertex( 0., 0., 40.) + +# create sketchers +sketcher = geompy.MakeSketcher("Sketcher:F -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW") + +# create faces from two wires +face = geompy.MakeFace(sketcher,1) + +# create a prism +prism = geompy.MakePrism(face, p0, pz) + +# explode the prism into faces +prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"]) + +# create a shell from a set of faces +shell = geompy.MakeShell([prism_faces[0], prism_faces[1], + prism_faces[3], prism_faces[4], + prism_faces[5], prism_faces[2]]) + +# create a solid, bounded by the given shells +solid = geompy.MakeSolid([shell]) + +# add objects in the study +id_solid = geompy.addToStudy(solid,"Solid") + +# display the solid +gg.createAndDisplayGO(id_solid) +gg.setDisplayMode(id_solid,1) +\endcode + +\anchor tui_creation_compound +

    Creation of a Compound

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create a vertex and a vector +p1 = geompy.MakeVertex( -30., -30., 50.) +p2 = geompy.MakeVertex( -60., -60., 30.) +p3 = geompy.MakeVertex( -30., -30., 10.) + +# create an arc from three points +arc = geompy.MakeArc(p1, p2, p3) +ShapeListCompound = [] +i = 0 +while i <= 3 : + S = geompy.MakeTranslation(arc, i * 50., 0., 0.) + ShapeListCompound.append(S) + i = i + 1 + +# create a compund of the given shapes +compound = geompy.MakeCompound(ShapeListCompound) + +# add object in the study +id_compound = geompy.addToStudy(compound,"Compound") + +# display the compound +gg.createAndDisplayGO(id_compound) +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc index 7fd356e7c..09744cddf 100644 --- a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc @@ -246,6 +246,41 @@ gg.setDisplayMode(id_box,1) gg.createAndDisplayGO(id_offset) \endcode +\anchor tui_projection +

    Projection

    + +\code +import geompy +import salome + +# create a cylindric face and a curve(edge) +cylinder = geompy.MakeCylinderRH(100, 300) +[face_cyl] = geompy.SubShapes(cylinder, [3]) + +p1 = geompy.MakeVertex(200, 0, 100) +p2 = geompy.MakeVertex(200, 80, 100) +p3 = geompy.MakeVertex(200, 80, 180) +p4 = geompy.MakeVertex(130, 80, 180) +p5 = geompy.MakeVertex(90, 80, 240) + +curve = geompy.MakeInterpol([p1, p2, p3, p4, p5], False, False) + +# create a new object as projection of the +# given curve on the given cylindric face +projection = geompy.MakeProjection(curve, face_cyl) + +# add objects in the study +geompy.addToStudy(cylinder, "cylinder") +geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl") +geompy.addToStudy(p1, "p1") +geompy.addToStudy(p2, "p2") +geompy.addToStudy(p3, "p3") +geompy.addToStudy(p4, "p4") +geompy.addToStudy(p5, "p5") +geompy.addToStudy(curve, "curve") +geompy.addToStudy(projection, "projection") +\endcode + \anchor tui_multi_translation

    Multi Translation

    @@ -370,6 +405,29 @@ gg.createAndDisplayGO(id_face) gg.createAndDisplayGO(id_fillet2d) \endcode +\anchor tui_fillet1d +

    Fillet 1D

    + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create box +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +# take box edges to create custom complex wire +[Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSortedCentres(Box_1, geompy.ShapeType["EDGE"]) +# create wire +Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4]) +# make fillet at given wire vertices with giver radius +Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10]) + + +# display disks +gg.createAndDisplayGO(Wire_1) +gg.createAndDisplayGO(Fillet_1D_1) +\endcode + \anchor tui_fillet

    Fillet

    @@ -401,7 +459,7 @@ face = geompy.MakeFace(wire, 1) prism = geompy.MakePrismVecH(face, vz, 100.0) # get the list of IDs (IDList) for the fillet -prism_edges = geompy.SubShapeAllSorted(prism, ShapeTypeEdge) +prism_edges = geompy.SubShapeAllSortedCentres(prism, ShapeTypeEdge) IDlist_e = [] IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0])) IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1])) @@ -459,7 +517,7 @@ face = geompy.MakeFace(wire, 1) prism = geompy.MakePrismVecH(face, vz, 100.0) # get the list of IDs (IDList) for the chamfer -prism_faces = geompy.SubShapeAllSorted(prism, ShapeTypeFace) +prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace) f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0]) f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1]) IDlist_f = [f_ind_1, f_ind_2] diff --git a/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc index 146bd33fd..2573c0fa5 100644 --- a/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc @@ -9,14 +9,18 @@ import salome import geompy box = geompy.MakeBox(0,0,0, 50,50,50) +box2 = geompy.MakeBox(-50,-50,-50, 0,0,0) sphere = geompy.MakeSphere(50,50,50, 30) fuse = geompy.MakeBoolean(box,sphere,3) fuse_id = geompy.addToStudy(fuse,"Fuse") +box_id = geompy.addToStudy(box2, "Box") gg = salome.ImportComponentGUI("GEOM") gg.createAndDisplayGO(fuse_id) -gg.setDisplayMode(fuse_id,1) +gg.setDisplayMode(fuse_id,1) +gg.createAndDisplayGO(box_id) +gg.setVectorsMode(box_id, 1) \endcode \anchor tui_change_color @@ -57,4 +61,21 @@ gg.setColor(fuse_id,218,165,31) gg.setTransparency(fuse_id,0.5) \endcode -*/ \ No newline at end of file +\anchor tui_point_marker +

    Set Point Marker

    + +\code +import salome +import geompy + +texture = geompy.LoadTexture("/users/user/mytexture.dat") + +v1 = geompy.MakeVertex(0, 0, 0) +v2 = geompy.MakeVertex(100, 0, 0) +v3 = geompy.MakeVertex(0, 100, 0) + +v1.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25) +v2.SetMarkerStd(GEOM.MT_BALL, GEOM.MS_40) +v3.SetMarkerTexture(texture) +\endcode +*/ diff --git a/doc/salome/gui/GEOM/input/tui_whatis.doc b/doc/salome/gui/GEOM/input/tui_whatis.doc new file mode 100644 index 000000000..e89e8bf18 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_whatis.doc @@ -0,0 +1,15 @@ +/*! + +\page tui_whatis_page What Is + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +Descr = geompy.WhatIs(box) +print "\nBox 100x30x100 description:" +print Descr +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_working_with_groups.doc b/doc/salome/gui/GEOM/input/tui_working_with_groups.doc index 786e81816..e608a0923 100644 --- a/doc/salome/gui/GEOM/input/tui_working_with_groups.doc +++ b/doc/salome/gui/GEOM/input/tui_working_with_groups.doc @@ -20,7 +20,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200) group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) # add objects to the group -SubFaceList = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) +SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"]) for i in [0, 3, 5] : FaceID = geompy.GetSubShapeID(Box, SubFaceList[i]) geompy.AddObject(group, FaceID) @@ -60,7 +60,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200) group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) # add objects to the group -SubFaceList = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) +SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"]) for i in [0, 3, 5] : FaceID = geompy.GetSubShapeID(Box, SubFaceList[i]) geompy.AddObject(group, FaceID) @@ -89,7 +89,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200) group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) # add objects to the group -SubFaceList = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) +SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"]) for i in [0, 3, 5] : FaceID = geompy.GetSubShapeID(Box, SubFaceList[i]) geompy.AddObject(group, FaceID) @@ -107,4 +107,4 @@ gg.createAndDisplayGO(id_group1) salome.sg.updateObjBrowser(1) \endcode -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/using_boolean_operations.doc b/doc/salome/gui/GEOM/input/using_boolean_operations.doc index c7fd67b75..d0bca5b6a 100644 --- a/doc/salome/gui/GEOM/input/using_boolean_operations.doc +++ b/doc/salome/gui/GEOM/input/using_boolean_operations.doc @@ -1,8 +1,14 @@ /*! -\page using_boolean_operations_page Using Boolean Operations +\page using_boolean_operations_page Boolean Operations -\n You can use the following boolean operations for construction of more +For detail description of the Boolean operations please refer to +this document. +It provides a general review of the Partition and Boolean +operations algorithms, describes the usage methodology and highlighs +major limitations of these operations. + +You can use the following boolean operations for construction of more complex geometrical objects (2D & 3D elements):
      @@ -38,7 +44,7 @@ Shape2 is the second argument of Cut operation; geompy.MakeSection(Shape1, Shape2), where \em Shape1 and \em Shape2 is the second argument of Section operation; -\n Our TUI Scripts provide you with useful examples of the use of +Our TUI Scripts provide you with useful examples of the use of \ref tui_boolean_operations_page "Boolean Operations". */ diff --git a/doc/salome/gui/GEOM/input/using_measurement_tools.doc b/doc/salome/gui/GEOM/input/using_measurement_tools.doc index ec1a69f0d..7e18a1ddf 100644 --- a/doc/salome/gui/GEOM/input/using_measurement_tools.doc +++ b/doc/salome/gui/GEOM/input/using_measurement_tools.doc @@ -1,238 +1,35 @@ -/*! - -\page using_measurement_tools_page Using measurement tools - -\n Measurement tools in GEOM are necessary for getting different data -concerning created or imported geometrical objects. They are: - -
        -
      • \ref point_coord_anchor "Point coordinates"
      • -
      • \ref basic_prop_anchor "Basic properties"
      • -
      • \ref center_mass_anchor "Center of mass"
      • -
      • \ref inertia_anchor "Inertia"
      • -
      • \ref normale_anchor "Normal to a Face"
      • -
      • \ref boundaries_anchor "Check Free Boundaries"
      • -
      • \ref faces_anchor "Check Faces"
      • -
      • \ref bounding_box_anchor "Bounding box"
      • -
      • \ref min_distance_anchor "Min. distance"
      • -
      • \ref angle_anchor "Angle"
      • -
      • \ref tolerance_anchor "Tolerance"
      • -
      • \ref whatis_anchor "WhatIs"
      • -
      • \ref check_anchor "Check"
      • -
      • \ref check_compound_anchor "Check compound of blocks"
      • -
      - -\n Our TUI Scripts show how to use -\ref tui_measurement_tools_page "Measurement Tools" with TUI -commands. - -\n To use measurement tools: -\par -In the Main menu select \b Measures submenu. - -\anchor point_coord_anchor -

      Point coordinates

      - -\n Returns the coordinates of a point. - -\n Result: Point coordinates (X, Y, Z) in 3D space in the form of Python Tuple. -\n TUI Command: geompy.PointCoordinates(Point), -where \em Point is a point whose coordinates are inquired. - -\image html measures1.png - -\anchor basic_prop_anchor -

      Basic properties

      - -\n Returns the properties (Length, Surface & Volume) for the selected -geometrical object. - -\n Result: Display Length, Surface & Volume in the form of -Python Tuple. -\n TUI Command: geompy.BasicProperties(Shape), where -\em Shape is a shape whose properties are inquired. - -\image html neo-basicprop.png - -\anchor center_mass_anchor -

      Center of mass

      - -\n Calculates and returns the coordinates of the gravity center for -the selected geometrical object. - -\n Result: GEOM_Object (vertex). -\n TUI Command: geompy.MakeCDG(Shape), where \em Shape is -the shape for which a center of gravity is computed. - -\image html measures3.png - -\anchor inertia_anchor -

      Inertia

      - -Returns the axial moments of inertia for the selected geometrical object. - -\n Result: Displays the matrix of the own moments of inertia and -the relative moments of inertia in the form of Python Tuple -
      (I11, I12, I13,
      -
      I21, I22, I23,
      -
      I31, I32, I33,
      -
      Ix, Iy, Iz).
      -\n TUI Command: geompy.Inertia(Shape), where \em Shape is -a shape for which the own matrix of inertia and the relative moments of inertia are -returned. - -\image html measures4.png - -\anchor normale_anchor -

      Normal to a Face

      - -\n Calculates the normal vector to the selected \b Face. The \b Point -is a point of the \b Face, where the Normal should be calculated. - -\image html normaletoface.png - -\anchor boundaries_anchor -

      Check Free Boundaries

      - -\n Detects and highlights wires and edges that are not shared between -two faces and are considered a shape's boundary. - -\n TUI Command: (NoError, ClosedWires, OpenWires) = -geompy.GetFreeBoundary(Shape), where \em Shape is a shape to be -checked, \em NoError is false if an error occurred while checking free -boundaries, \em ClosedWires is a list of closed free boundary wires, -\em OpenWires is a list of open free boundary wires. - -\image html repair9.png - -\anchor faces_anchor -

      Check Free Faces

      - -\n Highlights all free faces of a given shape. A free -face is a face which is not shared between two objects of the shape. - -\n \b NOTE: This functionality works only in VTK viewer. - -\n \b Result: a list of IDs of all free faces, containing in the shape. -\n TUI Command: GetFreeFacesIDs(Shape), where \em Shape is -a shape to be checked. - -\image html repair10.png - -\anchor bounding_box_anchor -

      Bounding box

      - -\n Returns the dimensions of the bounding box for the selected -geometrical object. - -\n Result: Displays the dimensions of the bounding box of a -geometrical object in the form of Python Tuple (Xmin, Xmax, Ymin, -Ymax, Zmin, Zmax). -\n TUI Command: geompy.BoundingBox(Shape), where \em Shape -is a shape for which a bounding box is computed. - -\image html measures5.png - -\anchor min_distance_anchor -

      Min. distance

      - -\n Returns the minimum distance between two geometrical objects and -the coordinates of the vector of distance and shows the vector in the viewer. - -\n TUI Command: geompy.MinDistance(Shape1, Shape2), -where \em Shape1 and \em Shape2 are shapes between which the minimal -distance is computed. - -\image html distance.png - -\anchor angle_anchor -

      Angle

      - -\n Returns the angle between two lines or linear edges in degrees -\n TUI Command: geompy.GetAngle(shape1, shape2), where -Shape1 and Shape2 are shapes between which the angle is computed. -Another TUI command is geompy.GetAngleRadians(shape1,shape2), -which returns the value of angle in radians. - -\image html angle.png - -\anchor tolerance_anchor -

      Tolerance

      - -\n Returns the maximum and the minimum tolerance for the selected -geometrical object. - -\n Result: Displays the tolerance values (FaceMinTol, -FaceMaxTol, EgdeMinTol, EgdeMaxTol, VertexMinTol, VertexMaxTol). -\n TUI Command: geompy.Tolerance(Shape), where \em Shape -is a shape for which minimal and maximal tolerances are returned. - -\image html new-tolerance.png - -\anchor whatis_anchor -

      WhatIs

      - -\n General information about the selected geometrical object is the -list of types and quantities of all topological entities, composing -the shape. - -\n TUI Command: geompy.WhatIs(Shape), where \em Shape is a -shape from which a description is returned. - -\image html measures8.png - -\n Kind of Shape field characterises the -whole shape. If there is no additional information available for the -shape, Basic Properties button will be disabled, otherwise it -will show a dialog with information about -dimensions, position, orientation and other parameters of the shape. - -\n TUI Command: geompy.KindOfShape(Shape), where \em Shape is a -shape from which a description is returned. - -\image html measures8a.png - -\anchor check_anchor -

      Check

      - -\n Checks the topology of the selected geometrical object and returns -True if it is valid. Check also geometry checkbox allows to test the -geometry as well. - -\n Result: Boolean. -\n TUI Command: geompy.CheckShape(theShape, theIsCheckGeom = 0), -where \em theShape is the shape checked for validity. - -\image html measures9.png - -\anchor check_compound_anchor -

      Check compound of blocks

      - -\n Checks whether a shape is a compound of glued blocks. To be -considered as a compound of blocks, the given shape must satisfy the -following conditions: -
        -
      • Each element of the compound should be a Block (6 faces and 12 edges);
      • -
      • A connection between two Blocks should be an entire quadrangle face or an entire edge;
      • -
      • The compound should be connected;
      • -
      • Two quadrangle faces should be glued.
      • -
      - -\n Informs of the following possible errors: -
        -
      • not a block;
      • -
      • not glued;
      • -
      • not connected;
      • -
      • extra or degenerated edge.
      • -
      - -\n Result: Boolean; highlight in the viewer. -\n TUI Command: -geompy.CheckCompoundOfBlocks(Compound). Checks if the shape -is a valid compound of blocks. If it is true, then the validity flag -is returned, and encountered errors are printed in the python console. - -\image html measures10.png - -*/ - +/*! + +\page using_measurement_tools_page Measuring objects properties + +\n Measurement tools in GEOM are necessary for getting different data +concerning created or imported geometrical objects : + +
        +
      • \subpage point_coordinates_page "Point coordinates"
      • +
      • \subpage basic_prop_page "Basic properties"
      • +
      • \subpage center_mass_page "Center of mass"
      • +
      • \subpage inertia_page "Inertia"
      • +
      • \subpage normal_page "Normal to a Face"
      • +
      • \subpage bounding_box_page "Bounding box"
      • +
      • \subpage min_distance_page "Min. distance"
      • +
      • \subpage angle_page "Angle"
      • +
      • \subpage tolerance_page "Tolerance"
      • +
      • \subpage whatis_page "WhatIs"
      • +
      + +\n Or to check their integrity: + +
        +
      • \subpage boundaries_page "Check Free Boundaries"
      • +
      • \subpage free_faces_page "Check Free Faces"
      • +
      • \subpage check_shape_page "Check Shape"
      • +
      • \subpage check_compound_of_blocks_page "Check compound of blocks"
      • +
      • \subpage check_self_intersections_page "Detect Self-intersections"
      • +
      + +\n Our TUI Scripts show how to use +\ref tui_measurement_tools_page "Measurement Tools" with TUI +commands. + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/using_notebook_geom_page.doc b/doc/salome/gui/GEOM/input/using_notebook_geom_page.doc index d793d55a5..e22507f62 100644 --- a/doc/salome/gui/GEOM/input/using_notebook_geom_page.doc +++ b/doc/salome/gui/GEOM/input/using_notebook_geom_page.doc @@ -2,9 +2,15 @@ \page using_notebook_geom_page Using SALOME NoteBook -It is possible to use variables defined through SALOME NoteBook for -creation and modification of objects in the Geometry module with the following -limitations: +SALOME NoteBook allows defining variables to be used for creation and modification of objects. + +A detailed description of the SALOME NoteBook can be found the the GUI documentation. + +\image html using_notebook_geom.png "Definition of variables in SALOME NoteBook" + +\image html box3.png "Use of variables for creation of a box in Geometry module" + +The following limitations on the use of variables still exist:
      • \ref create_lcs_page "Local Coordinate System" dialog box.\n @@ -14,5 +20,9 @@ limitations:
      • \ref color_page "Select color" dialog box.
      • \ref isolines_page "Select Number of Isos" dialog box.
      + +Our TUI Scripts provide you with useful examples of +\ref tui_notebook_geom "Using SALOME NoteBook". + */ diff --git a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc index 701502e92..44cea48a6 100644 --- a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc +++ b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc @@ -2,12 +2,13 @@ \page view_geom_obj_page Viewing geometrical objects -\n Newly created geometrical objects are automatically displayed in +Newly created geometrical objects are automatically displayed in the OCC 3D Viewer. -\n OCC 3D Viewer is described in the documentation on GUI +OCC 3D Viewer is described in the documentation on GUI module. -\n After the object has appeared in the Viewer, you can select it with + +After the object has appeared in the Viewer, you can select it with left mouse click to change its presentation parameters and access to other useful options by right-clicking on the selected object. @@ -20,36 +21,78 @@ object. viewer and from the Object Browser.
    • \subpage display_mode_page "Display Mode" - allows to select between Wireframe and Shading presentation.
    • +
    • \subpage bring_to_front_page "Bring To Front" - allows to bring to +front of the viewer the selected geometrical object.
    • +
    • Clear Top Level State - allows to remove from the viewer foreground +geometrical objects that have been placed there via Bring To Front command.
    • \subpage color_page "Color" - allows to change the filling color in the standard Select Color menu.
    • \subpage transparency_page "Transparency" - allows to change the transparency of geometrical objects.
    • \subpage isolines_page "Isos" - allows to change the number of isolines displayed within a shape.
    • +
    • \subpage deflection_page "Deflection" - allows to change the +deflection coefficient of a shape.
    • +
    • \subpage material_page "Material" - allows to change the +material properties of a shape.
    • +
    • \subpage point_marker_page "Point Marker" - allows to change the +representation of geometrical vertices.
    • +
    • \subpage line_width_page "Line Width" - allows to change the +width of edges and isolines.
    • +
    • Auto color / Disable auto color - activates the auto color +mode. When the auto color mode is enabled, the groups created on the +sub-shapes of the selected geometrical object are automatically +coloured by the unique colors. TUI Commands : +go.SetAutoColor(enable), enabled = go.GetAutoColor()
    • Hide - allows to hide the selected geometrical object from the -viewer. TUI Command : sg.EraseOnly(ID) -\n \image html image18.png -
    • +viewer. TUI Command : sg.EraseOnly(ID) + +\image html image18.png +
    • Hide all - allows to hide all objects from the viewer. TUI -Command: sg.EraseAll() -\n \image html image26.png -
    • +Command: sg.EraseAll() + +\image html image26.png +
    • Show Only - allows to display only the selected -geometrical object. TUI Command: sg.DisplayOnly(ID) -\n \image html image33.png -
    • -
    • Update - refreshes the presentation of your geometrical object in the -Object Browser, applying all recent changes.
    • +geometrical object. TUI Command: sg.DisplayOnly(ID) + +\image html image33.png +
    • Dump view - exports an object from the viewer in bmp, png, jpg or jpeg image format.
    • Change background - allows to redefine the background -color. By default it is black. -\n\n Some of these functionalities are available through right-clicking +color. By default it is black.
    • +
    + +Some of these functionalities are available through right-clicking on the viewer background: -\image html image2.jpg
    +\image html image22.png
    +
    • Select Only provides a filter for exclusive selection of objects of a certain type.
    +The the following commands appear in the Object Browser context menu +under certain conditions: + +\image html ob_popup_menu.png
    + +
      +
    • \ref work_with_groups_page "Create Group" - allows creating groups of geometrical objects.
    • +
    • Hide Children / Show Children - hides / shows child +sub-objects in the Object Browser, if the selected geometric object has +child objects. When some child objects are hidden, the name of the +parent object is hilghlighted with bold font.
    • + +
    • Unpublish - unpublish the selected geometric object from the Object Browser +and erase it from all viewers. To publish unpublished geometric objects select in the +context menu of the Geometry root object Publish... item. +The following dialog box will appear
    • +
    + +\image html publish_dlg.png
    + +Switch the checkbox near the appropriate object and click Publish or Publish And Close button. */ diff --git a/doc/salome/gui/GEOM/input/whatis.doc b/doc/salome/gui/GEOM/input/whatis.doc new file mode 100644 index 000000000..faa183032 --- /dev/null +++ b/doc/salome/gui/GEOM/input/whatis.doc @@ -0,0 +1,27 @@ +/*! + +\page whatis_page What Is ? + +General information about the selected geometrical object is the +list of types and quantities of all topological entities, composing +the shape. + +\n TUI Command: geompy.WhatIs(Shape), where \em Shape is a +shape from which a description is returned. + +See also a \ref tui_whatis_page "TUI example". + +\image html measures8.png + +\n Kind of Shape field characterises the +whole shape. If there is no additional information available for the +shape, Basic Properties button will be disabled, otherwise it +will show a dialog with information about +dimensions, position, orientation and other parameters of the shape. + +\n TUI Command: geompy.KindOfShape(Shape), where \em Shape is a +shape from which a description is returned. + +\image html measures8a.png + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/working_with_groups.doc b/doc/salome/gui/GEOM/input/working_with_groups.doc index ef9fe6f95..07838d585 100644 --- a/doc/salome/gui/GEOM/input/working_with_groups.doc +++ b/doc/salome/gui/GEOM/input/working_with_groups.doc @@ -2,15 +2,15 @@ \page work_with_groups_page Working with groups -Creation and editing groups of subshapes of a geometrical object makes -handling subshapes much easier. This functionality is available in OCC +Creation and editing groups of sub-shapes of a geometrical object makes +handling sub-shapes much easier. This functionality is available in OCC viewer only.

    Create a group

    \image html image56.png -To create a group of subshapes of a geometrical object in the main +To create a group of sub-shapes of a geometrical object in the main menu select New entity > Group > Create \n The following menu will appear: @@ -32,13 +32,19 @@ Shape.
  • Geometrical parts of the Second Shape restricts the range of accessible elements to the sub-shapes of the Main Shape that geometrically coincide with the Second Shape.
  • -
  • Only Sub-Shapes of the Second Shape restricts the range of +
  • Only Sub-shapes of the Second Shape restricts the range of accessible elements to the sub-shapes of the Main Shape that are sub-shapes of the Second Shape. This is useful because sometimes purely geometrical coincidence is not enough and it is necessary to work with shapes, which actually belong both to the main and the second shape.
  • +
  • You can selectively display the selected elements using the following buttons:
  • +
      +
    • Show only selected - displays only the sub-shapes selected in the list box.
    • +
    • Hide selected - hides the sub-shapes selected in the list box.
    • +
    • Show all sub-shapes - displays only the sub-shapes of the Main Shape.
    • +
  • You can select the elements of your group in two ways:
    • You can select them manually in the 3D Viewer, and add to the @@ -64,11 +70,11 @@ creation of other groups), or skip it by clicking \b Close button. \n TUI Command: geompy.CreateGroup(MainShape, ShapeType), where MainShape is a shape for which the group is created, ShapeType is a type of shapes in the created group. -\n Arguments: 1 Shape + Type of subshape. +\n Arguments: 1 Shape + Type of sub-shape. Example: -\image html image193.jpg "Groups on a cylinder" +\image html image193.png "Groups on a cylinder"

      Edit a group

      @@ -84,16 +90,16 @@ Group > Edit
      . This menu is designed in the same way as the \n TUI Command:
      • geompy.AddObject(Group, SubShapeID), where Group is a -group to which a sub shape has to be added, SubShapeID is an ID of the -sub shape to be added to the group.
      • +group to which a sub-shape has to be added, SubShapeID is an ID of the +sub-shape to be added to the group.
      • geompy.RemoveObject(Group, SubShapeID), where Group is a -group from which a sub shape has to be removed, SubShapeID is an ID of -the sub shape to be removed from the group.
      • +group from which a sub-shape has to be removed, SubShapeID is an ID of +the sub-shape to be removed from the group.
      • geompy.GetObjectIDs(Group), where Group is a group for which its object's are returned. \n Returns: List of IDs.
      -\n Arguments: 1 Shape + its subshapes. +\n Arguments: 1 Shape + its sub-shapes. \n Dialog Box: diff --git a/doc/salome/gui/GEOM/static/SALOME_BOA_PA.pdf b/doc/salome/gui/GEOM/static/SALOME_BOA_PA.pdf new file mode 100755 index 000000000..f0da9b261 Binary files /dev/null and b/doc/salome/gui/GEOM/static/SALOME_BOA_PA.pdf differ diff --git a/doc/salome/gui/GEOM/static/doxygen.css b/doc/salome/gui/GEOM/static/doxygen.css index 88e613d23..7a2dcbde8 100755 --- a/doc/salome/gui/GEOM/static/doxygen.css +++ b/doc/salome/gui/GEOM/static/doxygen.css @@ -1,170 +1,836 @@ -H1 { - text-align: center; +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 12px; +} + +/* @group Heading Levels */ + +h1 { + font-size: 150%; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + padding: 2px; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.version { + border:1px solid #0000FF; + color: #CCCCCC; + font-family: Arial, Helvetica, sans-serif; + font-size: 9pt; + text-align: center; + width:100px; + -moz-border-radius: 8px; + margin: 5px; +} + +div.footer1 { + background-color: #DFE5F1; + border: 1px solid #AAAAAA; + font-family: Arial, Helvetica, sans-serif; + font-size: 11px; + padding: 10px; + margin-top: 15px; +} + + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 10px; + margin-right: 10px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.memitem { + padding: 0; + margin-bottom: 10px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 8px; + border-top-left-radius: 8px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + +} + +.memdoc { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; } -CAPTION { - font-weight: bold +.paramname { + color: #602020; + white-space: nowrap; } +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + -/* Link in the top navbar */ -A.qindex {} +/* @end */ -A.qindexRef {} +/* @group Directory (tree) */ -/* Link to any cross-referenced Doxygen element */ -A.el { - text-decoration: none; - font-weight: bold +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; } -A.elRef { - font-weight: bold +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; } -/* Link to any cross-referenced Doxygen element inside a code section - (ex: header) +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} */ -A.code { - text-decoration: none; - font-weight: normal; - color: #4444ee + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.ingroups +{ + font-size: 8pt; + padding-left: 5px; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +.title { + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +dl +{ + padding: 0 0 0 10px; +} + +dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug +{ + border-left:4px solid; + padding: 0 0 0 6px; +} + +dl.note +{ + border-color: #D0D000; +} + +dl.warning, dl.attention +{ + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + border-color: #00D000; +} + +dl.deprecated +{ + border-color: #505050; } -A.codeRef { - font-weight: normal; - color: #4444ee +dl.todo +{ + border-color: #00C0E0; } -A:hover { - text-decoration: none; - background-color: lightblue +dl.test +{ + border-color: #3030E0; } -DL.el { - margin-left: -1cm +dl.bug +{ + border-color: #C08050; } -/* A code fragment (ex: header) */ -DIV.fragment { - width: 100%; - border: none; - background-color: #CCCCCC +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; +/* font: 300% arial,sans-serif;*/ + margin: 0px; + padding: 0px; +} + +#projectbrief +{ + font: 120% arial,sans-serif; + margin: 0px; + padding: 0px; } -/* In the alpha list (coumpound index), style of an alphabetical index letter */ -DIV.ah { - background-color: #CCCCCC; - font-weight: bold; - color: #ffffff; - margin-bottom: 3px; - margin-top: 3px +#projectnumber +{ + font: 50% arial,sans-serif; + margin: 0px; + padding: 0px; } -/* Method name (+ type) */ -TD.md { - background-color: lightblue; - font-weight: bold; +#titlearea +{ + background: url("head.png"); + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; } -/* Method parameter (some of them) */ -TD.mdname1 { - background-color: lightblue; - font-weight: bold; color: #602020; -} - -/* Method parameter (some of them) */ -TD.mdname { - background-color: lightblue; - font-weight: bold; - color: #602020; - width: 600px; -} - -/* Separator between methods group (usually empty, seems not supported by IE) */ -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold -} - -DIV.groupText { - margin-left: 16px; - font-style: italic; - font-size: smaller -} - -BODY { - background: #FFFFFF; -} - -/*div.div-page { - background-color: #FFFFFF; - margin-left: 1em; - margin-right: 1em; - margin-top: 1em; - margin-bottom: 0.1em; - - padding-left: 1em; - padding-right: 1em; - padding-top: 0.5em; - padding-bottom: 0.5em; - - border: 2px solid #0D299A; - border-width: 2px; - border-color: #0D299A; -}*/ - -div.tabs { - text-align: justify; - margin-left : 2px; - margin-right : 2px; - margin-top : 2px; - margin-bottom : 2px - font-weight: bold; - color: #FFFFFF; -} - -DIV.div-footer { - margin-left: 1em; - margin-right: 1em; - margin-bottom: 0.2em; - text-align: right; - font-size: 9pt; -} - -/* In File List, Coumpound List, etc, 1st column of the index */ -TD.indexkey { - background-color: #CCCCCC; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} - -/* In File List, Coumpound List, etc, 2nd column of the index */ -TD.indexvalue { - background-color: #CCCCCC; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} - -span.keyword { color: #008000 } -span.keywordtype { color: #604020 } -span.keywordflow { color: #e08000 } -span.comment { color: #800000 } -span.preprocessor { color: #806020 } -span.stringliteral { color: #002080 } -span.charliteral { color: #008080 } diff --git a/doc/salome/gui/GEOM/static/footer.html b/doc/salome/gui/GEOM/static/footer.html index 9211d570f..4c89a2ba1 100755 --- a/doc/salome/gui/GEOM/static/footer.html +++ b/doc/salome/gui/GEOM/static/footer.html @@ -1,10 +1,12 @@ - - - - - -
      -
      Copyright © 2003-2009 CEA, EDF
      -
      +
    • +
    + +
    +
    + Copyright © 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
    + Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
    +
    +
    + \ No newline at end of file diff --git a/doc/salome/gui/GEOM/static/header.html b/doc/salome/gui/GEOM/static/header.html deleted file mode 100755 index a70a95e30..000000000 --- a/doc/salome/gui/GEOM/static/header.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - $title - - -
    -
    -SALOME documentation central -
    -
    diff --git a/doc/salome/gui/GEOM/static/header.html.in b/doc/salome/gui/GEOM/static/header.html.in new file mode 100755 index 000000000..4571b4363 --- /dev/null +++ b/doc/salome/gui/GEOM/static/header.html.in @@ -0,0 +1,20 @@ + + + + + +$title + +$treeview +$search +$mathjax + + + + +
    +
    Version: @VERSION@
    + +
    diff --git a/doc/salome/gui/GEOM/static/header_py.html.in b/doc/salome/gui/GEOM/static/header_py.html.in new file mode 100644 index 000000000..61414bb57 --- /dev/null +++ b/doc/salome/gui/GEOM/static/header_py.html.in @@ -0,0 +1,21 @@ + + + + + +$title + +$treeview +$search +$mathjax + + + + +
    +
    Version: @VERSION@
    + + +
    diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index e099a6aee..03e3efc6e 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # -* Makefile *- # Author : Patrick GOLDBRONN (CEA) # Date : 30/11/2001 diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index 3bdc1b46b..bf44e17b2 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -1,44 +1,43 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Vasily Rusyaev (Open Cascade NN) # Module : doc # include $(top_srcdir)/adm_local/unix/make_common_starter.am -EXTRA_DIST += images static +EXTRA_DIST += images input static/footer.html static/doxygen.css + +tuidocdir = $(docdir)/tui/GEOM +tuidoc_DATA = images/head.png images/geomscreen.png dev_docs: doxyfile echo "===========================================" ; \ echo "Replacing geompyDC by geompy" ; \ echo "===========================================" ; \ - sed -e "/class geompyDC/d" -e "s/^ *#/#/g" -e "s/^ *def /def /g" \ - -e "s/geompyDC/geompy/g" $(top_srcdir)/src/GEOM_SWIG/geompyDC.py > \ - $(top_builddir)/src/GEOM_SWIG/geompy.py ; \ + $(KERNEL_ROOT_DIR)/bin/salome/prepare_generating_doc.py geompy.py $(top_srcdir)/src/GEOM_SWIG/geompyDC.py geompy ; \ echo "===========================================" ; \ echo "Generating TUI documentation" ; \ echo "===========================================" ; \ $(DOXYGEN) doxyfile ; \ - rm -f $(top_builddir)/src/GEOM_SWIG/geompy.py + rm -f ./geompy.py clean-local: -rm -fr GEOM doxygen.bak @@ -50,4 +49,13 @@ install-data-local: fi; uninstall-local: - rm -rf $(DESTDIR)$(docdir)/tui/GEOM + @test -d $(DESTDIR)$(tuidocdir) && chmod -R +w $(DESTDIR)$(tuidocdir) ; \ + for filen in `find $(DESTDIR)$(tuidocdir) -mindepth 1 -maxdepth 1` dummy ; do \ + case $${filen} in \ + dummy ) ;; \ + $(DESTDIR)$(tuidocdir)/docutils ) ;; \ + $(DESTDIR)$(tuidocdir)/head.png ) ;; \ + $(DESTDIR)$(tuidocdir)/geomscreen.png ) ;; \ + * ) echo "removing $${filen}" && rm -rf $${filen} ;; \ + esac ; \ + done diff --git a/doc/salome/tui/doxyfile.in b/doc/salome/tui/doxyfile.in index ad1ea5a7d..8b7feba7a 100755 --- a/doc/salome/tui/doxyfile.in +++ b/doc/salome/tui/doxyfile.in @@ -1,23 +1,23 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # Doxyfile 1.4.6 @@ -25,7 +25,7 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "Geometry Module Programming Guide v.@VERSION@" +PROJECT_NAME = "SALOME Geometry Developer" PROJECT_NUMBER = OUTPUT_DIRECTORY = GEOM CREATE_SUBDIRS = NO @@ -98,11 +98,12 @@ WARN_LOGFILE = # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = @top_srcdir@/src \ - @top_builddir@/src/GEOM_SWIG/geompy.py \ + ./geompy.py \ @top_srcdir@/bin \ @top_srcdir@/idl \ - @top_builddir@/bin -FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ + @top_builddir@/bin \ + @srcdir@/input +FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ *.doc RECURSIVE = YES EXCLUDE = @top_srcdir@/src/GEOM_SWIG/geompy.py \ @top_srcdir@/src/GEOM_SWIG/geompyDC.py @@ -140,7 +141,7 @@ IGNORE_PREFIX = GENERATE_HTML = YES HTML_OUTPUT = . HTML_FILE_EXTENSION = .html -HTML_HEADER = @srcdir@/static/myheader.html +HTML_HEADER = @builddir@/static/header.html HTML_FOOTER = @srcdir@/static/footer.html HTML_STYLESHEET = @srcdir@/static/doxygen.css HTML_ALIGN_MEMBERS = YES @@ -249,7 +250,8 @@ INCLUDED_BY_GRAPH = NO CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = jpg +DOT_IMAGE_FORMAT = png +DOT_FONTNAME = Arial DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 diff --git a/doc/salome/tui/images/geomscreen.png b/doc/salome/tui/images/geomscreen.png new file mode 100644 index 000000000..58908a742 Binary files /dev/null and b/doc/salome/tui/images/geomscreen.png differ diff --git a/doc/salome/tui/images/head.png b/doc/salome/tui/images/head.png new file mode 100755 index 000000000..307d9ef9a Binary files /dev/null and b/doc/salome/tui/images/head.png differ diff --git a/doc/salome/tui/images/occ.gif b/doc/salome/tui/images/occ.gif deleted file mode 100755 index ce017c8ae..000000000 Binary files a/doc/salome/tui/images/occ.gif and /dev/null differ diff --git a/doc/salome/tui/input/index.doc b/doc/salome/tui/input/index.doc new file mode 100644 index 000000000..42a4d8813 --- /dev/null +++ b/doc/salome/tui/input/index.doc @@ -0,0 +1,15 @@ +/*! \mainpage + +\image html geomscreen.png + +To browse the \b SALOME Geometry module Developer Documentation, follow the links below or use navigation menu at the top of the page: + + +*/ \ No newline at end of file diff --git a/doc/salome/tui/static/doxygen.css b/doc/salome/tui/static/doxygen.css index 88e613d23..7a2dcbde8 100755 --- a/doc/salome/tui/static/doxygen.css +++ b/doc/salome/tui/static/doxygen.css @@ -1,170 +1,836 @@ -H1 { - text-align: center; +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 12px; +} + +/* @group Heading Levels */ + +h1 { + font-size: 150%; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + padding: 2px; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.version { + border:1px solid #0000FF; + color: #CCCCCC; + font-family: Arial, Helvetica, sans-serif; + font-size: 9pt; + text-align: center; + width:100px; + -moz-border-radius: 8px; + margin: 5px; +} + +div.footer1 { + background-color: #DFE5F1; + border: 1px solid #AAAAAA; + font-family: Arial, Helvetica, sans-serif; + font-size: 11px; + padding: 10px; + margin-top: 15px; +} + + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 10px; + margin-right: 10px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.memitem { + padding: 0; + margin-bottom: 10px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 8px; + border-top-left-radius: 8px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + +} + +.memdoc { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; } -CAPTION { - font-weight: bold +.paramname { + color: #602020; + white-space: nowrap; } +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + -/* Link in the top navbar */ -A.qindex {} +/* @end */ -A.qindexRef {} +/* @group Directory (tree) */ -/* Link to any cross-referenced Doxygen element */ -A.el { - text-decoration: none; - font-weight: bold +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; } -A.elRef { - font-weight: bold +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; } -/* Link to any cross-referenced Doxygen element inside a code section - (ex: header) +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} */ -A.code { - text-decoration: none; - font-weight: normal; - color: #4444ee + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.ingroups +{ + font-size: 8pt; + padding-left: 5px; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +.title { + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +dl +{ + padding: 0 0 0 10px; +} + +dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug +{ + border-left:4px solid; + padding: 0 0 0 6px; +} + +dl.note +{ + border-color: #D0D000; +} + +dl.warning, dl.attention +{ + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + border-color: #00D000; +} + +dl.deprecated +{ + border-color: #505050; } -A.codeRef { - font-weight: normal; - color: #4444ee +dl.todo +{ + border-color: #00C0E0; } -A:hover { - text-decoration: none; - background-color: lightblue +dl.test +{ + border-color: #3030E0; } -DL.el { - margin-left: -1cm +dl.bug +{ + border-color: #C08050; } -/* A code fragment (ex: header) */ -DIV.fragment { - width: 100%; - border: none; - background-color: #CCCCCC +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; +/* font: 300% arial,sans-serif;*/ + margin: 0px; + padding: 0px; +} + +#projectbrief +{ + font: 120% arial,sans-serif; + margin: 0px; + padding: 0px; } -/* In the alpha list (coumpound index), style of an alphabetical index letter */ -DIV.ah { - background-color: #CCCCCC; - font-weight: bold; - color: #ffffff; - margin-bottom: 3px; - margin-top: 3px +#projectnumber +{ + font: 50% arial,sans-serif; + margin: 0px; + padding: 0px; } -/* Method name (+ type) */ -TD.md { - background-color: lightblue; - font-weight: bold; +#titlearea +{ + background: url("head.png"); + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; } -/* Method parameter (some of them) */ -TD.mdname1 { - background-color: lightblue; - font-weight: bold; color: #602020; -} - -/* Method parameter (some of them) */ -TD.mdname { - background-color: lightblue; - font-weight: bold; - color: #602020; - width: 600px; -} - -/* Separator between methods group (usually empty, seems not supported by IE) */ -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold -} - -DIV.groupText { - margin-left: 16px; - font-style: italic; - font-size: smaller -} - -BODY { - background: #FFFFFF; -} - -/*div.div-page { - background-color: #FFFFFF; - margin-left: 1em; - margin-right: 1em; - margin-top: 1em; - margin-bottom: 0.1em; - - padding-left: 1em; - padding-right: 1em; - padding-top: 0.5em; - padding-bottom: 0.5em; - - border: 2px solid #0D299A; - border-width: 2px; - border-color: #0D299A; -}*/ - -div.tabs { - text-align: justify; - margin-left : 2px; - margin-right : 2px; - margin-top : 2px; - margin-bottom : 2px - font-weight: bold; - color: #FFFFFF; -} - -DIV.div-footer { - margin-left: 1em; - margin-right: 1em; - margin-bottom: 0.2em; - text-align: right; - font-size: 9pt; -} - -/* In File List, Coumpound List, etc, 1st column of the index */ -TD.indexkey { - background-color: #CCCCCC; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} - -/* In File List, Coumpound List, etc, 2nd column of the index */ -TD.indexvalue { - background-color: #CCCCCC; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} - -span.keyword { color: #008000 } -span.keywordtype { color: #604020 } -span.keywordflow { color: #e08000 } -span.comment { color: #800000 } -span.preprocessor { color: #806020 } -span.stringliteral { color: #002080 } -span.charliteral { color: #008080 } diff --git a/doc/salome/tui/static/footer.html b/doc/salome/tui/static/footer.html index cb55f397a..5b030c021 100755 --- a/doc/salome/tui/static/footer.html +++ b/doc/salome/tui/static/footer.html @@ -1,5 +1,14 @@ - - - - + + + + + +
    + +
    +Copyright © 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
    +Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
    +
    +
    + + diff --git a/doc/salome/tui/static/header.html.in b/doc/salome/tui/static/header.html.in new file mode 100755 index 000000000..4571b4363 --- /dev/null +++ b/doc/salome/tui/static/header.html.in @@ -0,0 +1,20 @@ + + + + + +$title + +$treeview +$search +$mathjax + + + + +
    +
    Version: @VERSION@
    + +
    diff --git a/doc/salome/tui/static/myheader.html b/doc/salome/tui/static/myheader.html deleted file mode 100755 index d2efb75fa..000000000 --- a/doc/salome/tui/static/myheader.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Main Page - - - - -  - - diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 7a64111e2..f3a41ad16 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1,27 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : GEOM_Gen.idl // Author : Sergey RUIN -// + #ifndef __GEOM_GEN__ #define __GEOM_GEN__ @@ -35,14 +35,44 @@ module GEOM { /*! - * Topological types of shapes (like Open Cascade types) + * \brief Topological types of shapes (like Open Cascade types) */ - enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, - FACE, WIRE, EDGE, VERTEX, SHAPE }; + enum shape_type + { + /*! */ + COMPOUND, + /*! A collection of solids */ + COMPSOLID, + /*! A part of 3D space bound by a shell */ + SOLID, + /*! A collection of faces connected by some edges of their wire boundaries */ + SHELL, + /*! Part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a close wire */ + FACE, + /*! A sequence of edges connected by their vertices */ + WIRE, + /*! Edge, a shape corresponding to a curve, and bound by a vertex at each extremity */ + EDGE, + /*! A zero-dimensional shape corresponding to a point in geometry */ + VERTEX, + /*! */ + SHAPE }; + /*! + * \brief Marker type + */ + enum marker_type { MT_NONE, MT_POINT, MT_PLUS, MT_STAR, MT_O, MT_X, MT_O_POINT, MT_O_PLUS, + MT_O_STAR, MT_O_X, MT_BALL, MT_RING1, MT_RING2, MT_RING3, MT_USER }; + + /*! + * /brief Marker size + */ + enum marker_size { MS_NONE, MS_10, MS_15, MS_20, MS_25, MS_30, MS_35, + MS_40, MS_45, MS_50, MS_55, MS_60, MS_65, MS_70 }; /*! - * State of shape relatively geometrical surface like plane, sphere or cylinder. + * \brief State of shape relatively geometrical surface like plane, sphere or cylinder. + * * Is used in functions GEOM_IShapesOperations.GetShapesOn() */ enum shape_state @@ -56,7 +86,7 @@ module GEOM * For sphere and cylinder it means outside of volume, bounded by the surface. */ ST_OUT, - + /*! * Shape is in the direction defined by the normal and on surface. * ONOUT = ON || OUT @@ -79,33 +109,91 @@ module GEOM }; /*! - * Kind of method to find inside one main shape some subshapes, + * \brief Kind of method to find inside one main shape some sub-shapes, * corresponding to other given shape (its argument) - * Is used in functions GEOM_Gen.RestoreSubShapes() + * + * Is used in functions GEOM_Gen.RestoreSubShapesO(), GEOM_Gen.RestoreSubShapesSO() */ enum find_shape_method { /*! Use GetInPlace functionality. Suits all cases, except transformations */ FSM_GetInPlace, - /*! To be used only for transformation result, to find subshapes of argument. + /*! To be used only for transformation result, to find sub-shapes of argument. * Only this method can be used after transformation. */ FSM_Transformed, - /*! To find only shared subshapes, not modified by the operation */ + /*! To find only shared sub-shapes, not modified by the operation */ FSM_GetSame, /*! Use GetShapesOnShape method (can work only on solids) */ FSM_GetShapesOnShape, /*! Use GetInPlaceByHistory method (can work only after Partition) */ - FSM_GetInPlaceByHistory + FSM_GetInPlaceByHistory, + + /*! To be used only for multi-transformation result. + * Only this method can be used after multi-transformation. + */ + FSM_MultiTransformed + }; + + /*! + * \brief Kind of method to perform filling operation + * + * Is used in functions GEOM_I3DPrimOperations.MakeFilling() + */ + enum filling_oper_method + { + /*! Default (standard behaviour) */ + FOM_Default, + + /*! Use edges orientation - orientation of edges is used: if the edge is + * reversed, the curve from this edge is reversed before using it in + * the filling algorithm. + */ + FOM_UseOri, + + /*! Auto-correct edges orientation - changes the orientation of the curves + * using minimization of sum of distances between the end points of the edges. + */ + FOM_AutoCorrect + }; + + /*! + * \brief Kind of the curves. + * + * Used in the functions GEOM_ICurvesOperations.MakeCurveParametric(), GEOM_ICurvesOperations.MakeCurveParametricNew() + */ + enum curve_type { + /*! Polyline curve */ + Polyline, + + /*! Bezier curve */ + Bezier, + + /*! Interpolation, curve */ + Interpolation + }; + + /*! + * \brief Pattern for block division of the disk + * + * Used in the functions GEOM_IAdvancedOperations.MakeDividedDisk(), GEOM_ICurvesOperations.MakeDividedDiskPntVecR() + */ + enum pattern { + /*! Square */ + SQUARE, + + /*! Hexagon */ + HEXAGON }; typedef sequence string_array; typedef sequence short_array; + typedef sequence ListOfBool; typedef sequence ListOfLong; typedef sequence ListOfDouble; @@ -113,45 +201,80 @@ module GEOM typedef sequence ListOfGO; + //# GEOM_Object /*! - * GEOM_Object: interface of geometric object + * \brief Interface of geometric object */ interface GEOM_Object : SALOME::GenericObj { /*! - * Get an entry of the object in GEOM component. + * \brief Get an entry of the object in GEOM component. */ string GetEntry(); /*! - * Get ID of study, where the object is created. + * \brief Get ID of study, where the object is created. */ long GetStudyID(); /*! - * Get internal type of the object (POINT, BOX, CYLINDER, EXTRUSION...). + * \brief Get internal type of the object (POINT, BOX, CYLINDER, EXTRUSION...). */ long GetType(); /*! - * Get a shape_type of the object value. + * \brief Get a shape_type of the object value. */ shape_type GetShapeType(); /*! - * Set name of the object. + * \brief Get the topology type of the object value. + * + * In contrast to the shape type, this function returns type of the most + * top-level sub-shape of the COMPOUND or COMPSOLID, if there is only one + * sub-shape there. + * \sa GetShapeType() + */ + shape_type GetTopologyType(); + + /*! + * \brief Get a minimal type of the top-level shapes contained in the object. + * + * This function is useful for the compounds only; for simple shapes it + * exactly the same value as GetShapeType(). + * Note, that compounds are procesed recursively. + * + * \sa GetShapeType(), GetTopologyType(), GetMaxShapeType() + */ + shape_type GetMinShapeType(); + + /*! + * \brief Get a maximal type of the top-level shapes contained in the object. + * + * This function is useful for the compounds only; for simple shapes it + * exactly the same value as GetShapeType(). + * Note, that compounds are procesed recursively. + * + * \sa GetShapeType(), GetTopologyType(), GetMinShapeType() + */ + shape_type GetMaxShapeType(); + + /*! + * \brief Set name of the object. + * * \param theName is a name which will be associated with this object. */ void SetName (in string theName); /*! - * Get name of the object associated with this object. + * \brief Get name of the object associated with this object. */ string GetName(); /*! - * Set color of the object. + * \brief Set color of the object. + * * \param theColor is a color of the object. */ void SetColor(in SALOMEDS::Color theColor); @@ -163,142 +286,181 @@ module GEOM /*! * Toggle auto color mode on the object. - * \param theAtoColor is a flag which toggles auto color mode. + * \param theAutoColor is a flag which toggles auto color mode. */ void SetAutoColor(in boolean theAutoColor); /*! - * Get flag of object's auto color mode. + * \brief Get flag of object's auto color mode. */ boolean GetAutoColor(); /*! - * Set a Study entry where this object was published. + * \brief Set standard point marker for the object + * \param theType standard marker type + * \param theSize marker relative size + */ + void SetMarkerStd(in marker_type theType, in marker_size theSize ); + + /*! + * \brief Set custom point marker for the object. + * + * The texture can be added by LoadTexture() or AddTexture() functions. + * \param theTextureId texture ID + */ + void SetMarkerTexture(in long theTextureId); + + /*! + * \brief Get type of the point marker assigned to the object + * \return current marker type (MT_NONE if no marker is set) + */ + marker_type GetMarkerType(); + + /*! + * \brief Get size of the point marker assigned to the object + * \return current marker relative size (MS_NONE if no marker is set) + */ + marker_size GetMarkerSize(); + + /*! + * \brief Get texture idenifier of the point marker assigned to the object + * \return marker texture ID (0 if no marker set) + */ + long GetMarkerTexture(); + + /*! + * \brief Set a Study entry where this object was published. */ void SetStudyEntry (in string theEntry); /*! - * Get a Study entry where this object was published. + * \brief Get a Study entry where this object was published. */ string GetStudyEntry(); /*! - * Get a list of all GEOM objects on which were the arguments + * \brief Get a list of all GEOM_Object on which were the arguments * when this object was constructed and modified. * \note This method is supposed to be used by GUI only. */ ListOfGO GetDependency(); /*! - * Get a list of GEOM objects on which the last function that created or modified the object depends. + * \brief Get a list of GEOM_Object on which the last function that created or modified the object depends. * \note This method is supposed to be used by GUI only. */ ListOfGO GetLastDependency(); /*! - * Get the TopoDS_Shape, for colocated case only. + * \brief Get the TopoDS_Shape, for colocated case only. */ long long getShape(); + // ###################################################################### + // # Internal methods (For sub-shape identification) + // ###################################################################### /*! - ###################################################################### - * Internal methods (For sub shape identification) - ###################################################################### - */ - - /*! - * Get geometric shape of the object as a byte stream + * \brief Get geometric shape of the object as a byte stream */ SALOMEDS::TMPFile GetShapeStream(); /* - * Returns True if this object is not a sub shape of another object. + * \brief Returns True if this object is not a sub-shape of another object. */ boolean IsMainShape(); /* - * Get a list of ID's of sub shapes in the main shape. + * \brief Get a list of ID's of sub-shapes in the main shape. * \note Internal method, suppopsed to be used only by GEOM_Client */ ListOfLong GetSubShapeIndices(); /* - * Get a main shape object to which this object is a sub shape + * \brief Get a main shape object to which this object is a sub-shape * \note Internal method, suppopsed to be used only by GEOM_Client */ GEOM_Object GetMainShape(); /* - * Return true if geom object representes a shape. + * \brief Return true if geom object representes a shape. + * * For example, method return false for GEOM_MARKER */ boolean IsShape(); + /* + * \brief Return true if passed object is identical to this object + * + * \param other object being compared with this one + */ + boolean IsSame(in GEOM_Object other); + /*! * Set list of parameters * \param theParameters is a string containing the notebook variables separated by ":" symbol, * used for object creation */ void SetParameters (in string theParameters); - + /*! - * Return list of notebook variables used for object creation separated by ":" symbol + * \brief Return list of notebook variables used for object creation separated by ":" symbol */ string GetParameters(); }; - + // # GEOM_IOperations: /*! - * GEOM_IOperations: basic methods of all geometric operations + * \brief Basic methods of all geometric operations */ interface GEOM_IOperations : SALOME::GenericObj { /*! - * To know, if the operation was successfully performed + * \brief To know, if the operation was successfully performed */ boolean IsDone(); /*! - * Set the operation error code + * \brief Set the operation error code * \param theErrorID is a string describing the error occured * \note This method is supposed to be used only by interfaces inheriting from IOperations. */ void SetErrorCode (in string theErrorID); /*! - * Get the operation error code + * \brief Get the operation error code */ string GetErrorCode(); /*! - * Get ID of study, where the operation is defined + * \brief Get ID of study, where the operation is defined */ long GetStudyID(); /*! - * Opens a new transaction + * \brief Opens a new transaction */ void StartOperation(); /*! - * Closes the previously opened trasaction + * \brief Closes the previously opened trasaction */ void FinishOperation(); /*! - * Aborts the previously opened transaction + * \brief Aborts the previously opened transaction */ void AbortOperation(); }; - + //# GEOM_IBasicOperations: /*! - * GEOM_IBasicOperations: interface for basic geometry creation + * \brief Interface for basic geometry creation + * * (Point, Vector, Plane, Marker) */ interface GEOM_IBasicOperations : GEOM_IOperations { /*! - * Create point by three coordinates. + * \brief Create point by three coordinates. * \param theX The X coordinate of the point. * \param theY The Y coordinate of the point. * \param theZ The Z coordinate of the point. @@ -307,7 +469,7 @@ module GEOM GEOM_Object MakePointXYZ (in double theX, in double theY, in double theZ); /*! - * Create a point, distant from the referenced point + * \brief Create a point, distant from the referenced point * on the given distances along the coordinate axes. * \param theReference The referenced point. * \param theX Displacement from the referenced point along OX axis. @@ -316,7 +478,7 @@ module GEOM * \return New GEOM_Object, containing the created point. */ GEOM_Object MakePointWithReference (in GEOM_Object theReference, - in double theX, in double theY, in double theZ); + in double theX, in double theY, in double theZ); /*! * Create a point, corresponding to the given parameter on the given curve. @@ -325,10 +487,36 @@ module GEOM * \return New GEOM_Object, containing the created point. */ GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, - in double theParameter); + in double theParameter); + + /*! + * \brief Create a point, corresponding to the given length on the given curve. + * \param theRefCurve The referenced curve. + * \param theLength Length on the referenced curve. It can be negative. + * \param theStartPoint Any vertex close to one of edge's + * ends to select start point among them. + * If NULL, fist vertex is used. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointOnCurveByLength (in GEOM_Object theRefCurve, + in double theLength, + in GEOM_Object theStartPoint); /*! - * Create a point, corresponding to the given parameters on the + * \brief Create a point on the given curve, projecting given point + * \param theRefCurve The referenced curve. + * \param theXParameter X co-ordinate of point to project on curve + * \param theYParameter Y co-ordinate of point to project on curve + * \param theZParameter Z co-ordinate of point to project on curve + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointOnCurveByCoord (in GEOM_Object theRefCurve, + in double theXParameter, + in double theYParameter, + in double theZParameter); + + /*! + * \brief Create a point, corresponding to the given parameters on the * given surface. * \param theRefSurf The referenced surface. * \param theUParameter Value of U-parameter on the referenced surface. @@ -336,41 +524,55 @@ module GEOM * \return New GEOM_Object, containing the created point. */ GEOM_Object MakePointOnSurface (in GEOM_Object theRefSurf, - in double theUParameter, - in double theVParameter); + in double theUParameter, + in double theVParameter); /*! - * Create a point, on two lines intersection. + * \brief Create a point on the given surface, projecting given point + * \param theRefSurf The referenced surface. + * \param theXParameter X co-ordinate of point to project on curve + * \param theYParameter Y co-ordinate of point to project on curve + * \param theZParameter Z co-ordinate of point to project on curve + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointOnSurfaceByCoord (in GEOM_Object theRefSurf, + in double theXParameter, + in double theYParameter, + in double theZParameter); + + + /*! + * \brief Create a point, on two lines intersection. * \param theRefLine1, theRefLine2 The referenced lines. * \return New GEOM_Object, containing the created point. */ GEOM_Object MakePointOnLinesIntersection (in GEOM_Object theRefLine1, - in GEOM_Object theRefLine2); + in GEOM_Object theRefLine2); /*! - * Create a vector, corresponding to tangent to the given parameter on the given curve. + * \brief Create a vector, corresponding to tangent to the given parameter on the given curve. * \param theRefCurve The referenced curve. * \param theParameter Value of parameter on the referenced curve.This value should be have value - * \between 0. and 1.. Value of 0. corresponds first parameter of curve value 1. corresponds - * \last parameter of curve. + * between 0. and 1.. Value of 0. corresponds first parameter of curve; value + * 1. corresponds last parameter of curve. * \return New GEOM_Object, containing the created point. */ GEOM_Object MakeTangentOnCurve (in GEOM_Object theRefCurve, - in double theParameter); + in double theParameter); /*! - * Create a vector with the given components. + * \brief Create a vector with the given components. * \param theDX X component of the vector. * \param theDY Y component of the vector. * \param theDZ Z component of the vector. * \return New GEOM_Object, containing the created vector. */ GEOM_Object MakeVectorDXDYDZ (in double theDX, - in double theDY, - in double theDZ); + in double theDY, + in double theDZ); /*! - * Create a vector between two points. + * \brief Create a vector between two points. * \param thePnt1 Start point for the vector. * \param thePnt2 End point for the vector. * \return New GEOM_Object, containing the created vector. @@ -378,7 +580,7 @@ module GEOM GEOM_Object MakeVectorTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); /*! - * Create a line, passing through the given point + * C\brief reate a line, passing through the given point * and parrallel to the given direction * \param thePnt Point. The resulting line will pass through it. * \param theDir Direction. The resulting line will be parallel to it. @@ -387,7 +589,7 @@ module GEOM GEOM_Object MakeLine (in GEOM_Object thePnt, in GEOM_Object theDir); /*! - * Create a line, passing through the given points + * \brief Create a line, passing through the given points * \param thePnt1 First of two points, defining the line. * \param thePnt2 Second of two points, defining the line. * \return New GEOM_Object, containing the created line. @@ -395,7 +597,7 @@ module GEOM GEOM_Object MakeLineTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); /*! - * Create a line, given by two faces intersection. + * \brief Create a line, given by two faces intersection. * \param theFace1 First of two faces, defining the line. * \param theFace2 Second of two faces, defining the line. * \return New GEOM_Object, containing the created line. @@ -403,7 +605,7 @@ module GEOM GEOM_Object MakeLineTwoFaces (in GEOM_Object theFace1, in GEOM_Object theFace2); /*! - * Create a plane, passing through the three given points + * \brief Create a plane, passing through the three given points * \param thePnt1 First of three points, defining the plane. * \param thePnt2 Second of three points, defining the plane. * \param thePnt3 Fird of three points, defining the plane. @@ -411,12 +613,12 @@ module GEOM * \return New GEOM_Object, containing the created plane. */ GEOM_Object MakePlaneThreePnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3, - in double theTrimSize); + in GEOM_Object thePnt2, + in GEOM_Object thePnt3, + in double theTrimSize); /*! - * Create a plane, passing through the given point + * \brief Create a plane, passing through the given point * and normal to the given vector. * \param thePnt Point, the plane has to pass through. * \param theVec Vector, defining the plane normal direction. @@ -424,31 +626,71 @@ module GEOM * \return New GEOM_Object, containing the created plane. */ GEOM_Object MakePlanePntVec (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theTrimSize); + in GEOM_Object theVec, + in double theTrimSize); /*! - * Create a plane, similar to the existing one, but with another size of representing face. + * \brief Create a plane, similar to the existing one, but with another size of representing face. * \param theFace Referenced plane or LCS(Marker). * \param theTrimSize New half size of a side of quadrangle face, representing the plane. * \return New GEOM_Object, containing the created plane. */ GEOM_Object MakePlaneFace (in GEOM_Object theFace, - in double theTrimSize); + in double theTrimSize); + + /*! + * \brief Create a plane, by two vectors. + * \param theVec1 Vector1, the plane has to pass through first point of this vector. + * \param theVec2 Vector2, defining the plane normal direction. + * \param theTrimSize Half size of a side of quadrangle face, representing the plane. + * \return New GEOM_Object, containing the created plane. + */ + GEOM_Object MakePlane2Vec (in GEOM_Object theVec1, + in GEOM_Object theVec2, + in double theTrimSize); /*! - * Create a local coordinate system. + * \brief Create a plane, defined by local coordinate system. + * \param theLCS Referenced LCS(Marker). + * \param theTrimSize Half size of a side of quadrangle face, representing the plane. + * \param theOrientation OXY, OYZ or OZX orientation = (1, 2 or 3). + * \return New GEOM_Object, containing the created plane. + */ + GEOM_Object MakePlaneLCS (in GEOM_Object theLCS, + in double theTrimSize, + in double theOrientation); + + /*! + * \brief Create a local coordinate system. * \param theOX,theOY,theOZ Three coordinates of coordinate system origin. * \param theXDX,theXDY,theXDZ Three components of OX direction * \param theYDX,theYDY,theYDZ Three components of OY direction * \return New GEOM_Object, containing the created coordinate system. */ GEOM_Object MakeMarker (in double theOX , in double theOY , in double theOZ, - in double theXDX, in double theXDY, in double theXDZ, - in double theYDX, in double theYDY, in double theYDZ); + in double theXDX, in double theXDY, in double theXDZ, + in double theYDX, in double theYDY, in double theYDZ); + + /*! + * \brief Create a local coordinate system from shape. + * \param theShape The initial shape to detect the coordinate system. + * \return New GEOM_Object, containing the created coordinate system. + */ + GEOM_Object MakeMarkerFromShape (in GEOM_Object theShape); /*! - * Create a tangent plane to specified face in the point with specified parameters. + * \brief Create a local coordinate system from point and two vectors (DX, DY). + * \param theOrigin Point of coordinate system origin. + * \param theXVec Vector of X direction. + * \param theYVec Vector of Y direction. + * \return New GEOM_Object, containing the created coordinate system. + */ + GEOM_Object MakeMarkerPntTwoVec (in GEOM_Object theOrigin, + in GEOM_Object theXVec, in GEOM_Object theYVec); + + /*! + * \brief Create a tangent plane to specified face in the point with specified parameters. + * * Values of parameters should be between 0. and 1.0 * \param theFace - face for which tangent plane shuold be built. * \param theParameterU - value of parameter by U @@ -457,26 +699,26 @@ module GEOM * \return New GEOM_Object, containing the face built on tangent plane. */ GEOM_Object MakeTangentPlaneOnFace(in GEOM_Object theFace, - in double theParameterU, - in double theParameterV, - in double theTrimSize); + in double theParameterU, + in double theParameterV, + in double theTrimSize); }; interface GEOM_ITransformOperations : GEOM_IOperations { /*! - * Translate the given object along the vector, specified by its end points. + * \brief Translate the given object along the vector, specified by its end points. * \param theObject The object to be translated. * \param thePoint1 Start point of translation vector. * \param thePoint2 End point of translation vector. * \return theObject. */ GEOM_Object TranslateTwoPoints (in GEOM_Object theObject, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); /*! - * Translate the given object along the vector, specified + * \brief Translate the given object along the vector, specified * by its end points, creating its copy before the translation. * \param theObject The object to be translated. * \param thePoint1 Start point of translation vector. @@ -484,64 +726,64 @@ module GEOM * \return New GEOM_Object, containing the translated object. */ GEOM_Object TranslateTwoPointsCopy (in GEOM_Object theObject, - in GEOM_Object thePoint1, + in GEOM_Object thePoint1, in GEOM_Object thePoint2); /*! - * Translate the given object along the vector, specified by its components. + * \brief Translate the given object along the vector, specified by its components. * \param theObject The object to be translated. * \param theDX,theDY,theDZ Components of translation vector. * \return theObject. */ GEOM_Object TranslateDXDYDZ (in GEOM_Object theObject, - in double theDX, in double theDY, in double theDZ); + in double theDX, in double theDY, in double theDZ); /*! - * Translate the given object along the vector, specified + * \brief Translate the given object along the vector, specified * by its components, creating its copy before the translation. * \param theObject The object to be translated. * \param theDX,theDY,theDZ Components of translation vector. * \return New GEOM_Object, containing the translated object. */ GEOM_Object TranslateDXDYDZCopy (in GEOM_Object theObject, - in double theDX, in double theDY, in double theDZ); + in double theDX, in double theDY, in double theDZ); /*! - * Translate the given object along the given vector. + * \brief Translate the given object along the given vector. * \param theObject The object to be translated. * \param theVector Translation vector, giving both direction and distance. * \return theObject. */ GEOM_Object TranslateVector (in GEOM_Object theObject, - in GEOM_Object theVector); + in GEOM_Object theVector); /*! - * Translate the given object along the given vector, + * \brief Translate the given object along the given vector, * creating its copy before the translation. * \param theObject The object to be translated. * \param theVector Translation vector, giving both direction and distance. * \return New GEOM_Object, containing the translated object. */ GEOM_Object TranslateVectorCopy (in GEOM_Object theObject, - in GEOM_Object theVector); + in GEOM_Object theVector); /*! - * Translate the given object along the given vector on given distance, + * \brief Translate the given object along the given vector on given distance, * creating its copy before the translation. * \param theObject The object to be translated. * \param theVector Translation vector, giving a direction. * \param theDistance Translation distance, giving a distance. - * \param theCope Translation copy, creating its copy if true. + * \param theCopy Translation copy, creating its copy if true. * \return New GEOM_Object, containing the translated object. */ GEOM_Object TranslateVectorDistance (in GEOM_Object theObject, - in GEOM_Object theVector, - in double theDistance, - in boolean theCopy); + in GEOM_Object theVector, + in double theDistance, + in boolean theCopy); /*! - * Translate the given object along the given vector a given number times + * \brief Translate the given object along the given vector a given number times * \param theObject The object to be translated. * \param theVector Direction of the translation. * \param theStep Distance to translate on. @@ -550,12 +792,12 @@ module GEOM * the shapes, obtained after each translation. */ GEOM_Object MultiTranslate1D (in GEOM_Object theObject, - in GEOM_Object theVector, - in double theStep, - in long theNbTimes); + in GEOM_Object theVector, + in double theStep, + in long theNbTimes); /*! - * Conseqently apply two specified translations to theObject specified number of times. + * \brief Conseqently apply two specified translations to theObject specified number of times. * \param theObject The object to be translated. * \param theVector1 Direction of the first translation. * \param theStep1 Step of the first translation. @@ -567,51 +809,52 @@ module GEOM * the shapes, obtained after each translation. */ GEOM_Object MultiTranslate2D (in GEOM_Object theObject, - in GEOM_Object theVector1, - in double theStep1, - in long theNbTimes1, - in GEOM_Object theVector2, - in double theStep2, - in long theNbTimes2); + in GEOM_Object theVector1, + in double theStep1, + in long theNbTimes1, + in GEOM_Object theVector2, + in double theStep2, + in long theNbTimes2); /*! - * Rotate given object around vector perpendicular to plane containing three points. + * \brief Rotate given object around vector perpendicular to plane containing three points. * \param theObject The object to be rotated. * \param theCentPoint central point - the axis is the vector perpendicular to the plane - * containing the three points. - * \param thePoint1 and thePoint2 - in a perpendicular plan of the axis. + * containing the three points. + * \param thePoint1,thePoint2 - in a perpendicular plan of the axis. * \return theObject. */ GEOM_Object RotateThreePoints (in GEOM_Object theObject, - in GEOM_Object theCentPoint, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); + in GEOM_Object theCentPoint, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); /*! - * Rotate given object around vector perpendicular to plane containing three points. + * \brief Rotate given object around vector perpendicular to plane containing three points. + * * Creating its copy before the rotatation. * \param theObject The object to be rotated. * \param theCentPoint central point - the axis is the vector perpendicular to the plane * containing the three points. - * \param thePoint1 and thePoint2 - in a perpendicular plan of the axis. + * \param thePoint1,thePoint2 - in a perpendicular plan of the axis. * \return New GEOM_Object, containing the rotated object. */ GEOM_Object RotateThreePointsCopy (in GEOM_Object theObject, - in GEOM_Object theCentPoint, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); + in GEOM_Object theCentPoint, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); /*! - * Rotate the given object around the given axis on the given angle. + * \brief Rotate the given object around the given axis on the given angle. * \param theObject The object to be rotated. * \param theAxis Rotation axis. * \param theAngle Rotation angle in radians. * \return theObject. */ GEOM_Object Rotate (in GEOM_Object theObject, - in GEOM_Object theAxis, - in double theAngle); + in GEOM_Object theAxis, + in double theAngle); /*! @@ -623,12 +866,13 @@ module GEOM * \return New GEOM_Object, containing the rotated object. */ GEOM_Object RotateCopy (in GEOM_Object theObject, - in GEOM_Object theAxis, - in double theAngle); + in GEOM_Object theAxis, + in double theAngle); /*! - * Rotate the given object around the given axis a given number times. + * \brief Rotate the given object around the given axis a given number times. + * * Rotation angle will be 2*PI/theNbTimes. * \param theObject The object to be rotated. * \param theAxis The rotation axis. @@ -637,13 +881,14 @@ module GEOM * shapes, obtained after each rotation. */ GEOM_Object MultiRotate1D (in GEOM_Object theObject, - in GEOM_Object theAxis, - in long theNbTimes); + in GEOM_Object theAxis, + in long theNbTimes); /*! - * Rotate the given object around the + * \brief Rotate the given object around the * given axis on the given angle a given number * times and multi-translate each rotation result. + * * Translation direction passes through center of gravity * of rotated shape and its projection on the rotation axis. * \param theObject The object to be rotated. @@ -656,14 +901,14 @@ module GEOM * shapes, obtained after each transformation. */ GEOM_Object MultiRotate2D (in GEOM_Object theObject, - in GEOM_Object theAxis, - in double theAngle, - in long theNbTimes1, - in double theStep, - in long theNbTimes2); + in GEOM_Object theAxis, + in double theAngle, + in long theNbTimes1, + in double theStep, + in long theNbTimes2); /*! - * Replace the given object by an object, + * \brief Replace the given object by an object, * symmetrical to it relatively the given plane. * \param theObject The object to be mirrored. * \param thePlane Plane of symmetry. @@ -671,7 +916,7 @@ module GEOM GEOM_Object MirrorPlane (in GEOM_Object theObject, in GEOM_Object thePlane); /*! - * Create an object, symmetrical + * \brief Create an object, symmetrical * to the given one relatively the given plane. * \param theObject The object to be mirrored. * \param thePlane Plane of symmetry. @@ -680,7 +925,7 @@ module GEOM GEOM_Object MirrorPlaneCopy (in GEOM_Object theObject, in GEOM_Object thePlane); /*! - * Replace the given object by an object, + * \brief Replace the given object by an object, * symmetrical to it relatively the given axis. * \param theObject The object to be mirrored. * \param theAxis Axis of symmetry. @@ -689,7 +934,7 @@ module GEOM GEOM_Object MirrorAxis (in GEOM_Object theObject, in GEOM_Object theAxis); /*! - * Create an object, symmetrical + * \brief Create an object, symmetrical * to the given one relatively the given axis. * \param theObject The object to be mirrored. * \param theAxis Axis of symmetry. @@ -698,7 +943,7 @@ module GEOM GEOM_Object MirrorAxisCopy (in GEOM_Object theObject, in GEOM_Object theAxis); /*! - * Replace the given object by an object, symmetrical to it relatively the given point. + * \brief Replace the given object by an object, symmetrical to it relatively the given point. * \param theObject The object to be mirrored. * \param thePoint Point of symmetry. * \return theObject. @@ -706,7 +951,7 @@ module GEOM GEOM_Object MirrorPoint (in GEOM_Object theObject, in GEOM_Object thePoint); /*! - * Create an object, symmetrical to the given one relatively the given point. + * \brief Create an object, symmetrical to the given one relatively the given point. * \param theObject The object to be mirrored. * \param thePoint Point of symmetry. * \return New GEOM_Object, containing the mirrored object. @@ -714,7 +959,7 @@ module GEOM GEOM_Object MirrorPointCopy (in GEOM_Object theObject, in GEOM_Object thePoint); /*! - * Replace the given object by its offset. + * \brief Replace the given object by its offset. * \param theObject The base object for the offset. * \param theOffset Offset value. * \return theObject. @@ -722,7 +967,7 @@ module GEOM GEOM_Object OffsetShape (in GEOM_Object theObject, in double theOffset); /*! - * Create new object as offset of the given one. + * \brief Create new object as offset of the given one. * \param theObject The base object for the offset. * \param theOffset Offset value. * \return New GEOM_Object, containing the offset object. @@ -730,27 +975,35 @@ module GEOM GEOM_Object OffsetShapeCopy (in GEOM_Object theObject, in double theOffset); /*! - * Scale the given object by the factor. + * \brief Create new object as projection of the given one on a 2D surface. + * \param theSource The source object for the projection. It can be a point, edge or wire. + * \param theTarget The target object. It can be planar or cylindrical face. + * \return New GEOM_Object, containing the projection. + */ + GEOM_Object ProjectShapeCopy (in GEOM_Object theSource, in GEOM_Object theTarget); + + /*! + * \brief Scale the given object by the factor. * \param theObject The object to be scaled. * \param thePoint Center point for scaling. * \param theFactor Scaling factor value. * \return theObject. */ GEOM_Object ScaleShape (in GEOM_Object theObject, in GEOM_Object thePoint, - in double theFactor); + in double theFactor); /*! - * Scale the given object by the factor, creating its copy before the scaling. + * \brief Scale the given object by the factor, creating its copy before the scaling. * \param theObject The object to be scaled. * \param thePoint Center point for scaling. * \param theFactor Scaling factor value. * \return New GEOM_Object, containing the scaled shape. */ GEOM_Object ScaleShapeCopy (in GEOM_Object theObject, in GEOM_Object thePoint, - in double theFactor); + in double theFactor); /*! - * Scale the given object by different factors along coordinate axes. + * \brief Scale the given object by different factors along coordinate axes. * \param theObject The object to be scaled. * \param thePoint Center point for scaling. * \param theFactorX,theFactorY,theFactorZ Scaling factors along each axis. @@ -763,7 +1016,7 @@ module GEOM in double theFactorZ); /*! - * Scale the given object by different factors along coordinate axes, + * \brief Scale the given object by different factors along coordinate axes, * creating its copy before the scaling. * \param theObject The object to be scaled. * \param thePoint Center point for scaling. @@ -777,7 +1030,7 @@ module GEOM in double theFactorZ); /*! - * Modify the Location of the given object by LCS. + * \brief Modify the Location of the given object by LCS. * \param theObject The object to be displaced. * \param theStartLCS Coordinate system to perform displacement from it. * If \a theStartLCS is NULL, displacement @@ -788,11 +1041,11 @@ module GEOM * \return theObject. */ GEOM_Object PositionShape (in GEOM_Object theObject, - in GEOM_Object theStartLCS, - in GEOM_Object theEndLCS); + in GEOM_Object theStartLCS, + in GEOM_Object theEndLCS); /*! - * Modify the Location of the given object by LCS, + * \brief Modify the Location of the given object by LCS, * creating its copy before the setting. * \param theObject The object to be displaced. * \param theStartLCS Coordinate system to perform displacement from it. @@ -804,43 +1057,56 @@ module GEOM * \return New GEOM_Object, containing the displaced shape. */ GEOM_Object PositionShapeCopy (in GEOM_Object theObject, - in GEOM_Object theStartLCS, - in GEOM_Object theEndLCS); + in GEOM_Object theStartLCS, + in GEOM_Object theEndLCS); /*! - * Modify the Location of the given object by Path, + * \brief Modify the Location of the given object by Path, * \param theObject The object to be displaced. * \param thePath Wire or Edge along that the object will be translated. - * \param theDistance progress of Path (0 = actual location, 1 = end of path location). - * \param theCopy is a true or false parameter. true is to create a copy, false to move the object. - * \param theCopy is a true or false parameter. true is to reverse direction, false is to move normal direction. + * \param theDistance progress of Path (0 = actual location, 1 = end of path location). + * \param theCopy is a true or false parameter. true is to create a copy, false to move the object. + * \param theReverse is a true or false parameter. true is to reverse direction, false is to move normal direction. * \return New GEOM_Object, containing the displaced shape. */ - GEOM_Object PositionAlongPath (in GEOM_Object theObject, - in GEOM_Object thePath, - in double theDistance, - in boolean theCopy, - in boolean theReverse); + in GEOM_Object thePath, + in double theDistance, + in boolean theCopy, + in boolean theReverse); /*! - * Recompute the shape from its arguments. + * \brief Transform the shape in the same way what was used for the sample shape creation. + * \param theObject The object to be transformed. + * \param theSample The object containing information about required transformation. + * \note Implementation of this method is limited by multi-transformations now. + * \note Internal method. + * \return New GEOM_Object, containing the transformed shape. + */ + GEOM_Object TransformLikeOtherCopy (in GEOM_Object theObject, + in GEOM_Object theSample); + + /*! + * \brief Recompute the shape from its arguments. * \param theObject The object to be recomputed. * \return theObject. */ GEOM_Object RecomputeObject (in GEOM_Object theObject); }; - + + // # GEOM_I3DPrimOperations: /*! - * GEOM_I3DPrimOperations: Interface for 3D primitives creation + * \brief Interface for 3D primitives creation + * * Box, Cylinder, Cone, Sphere, Prism (extrusion), * Pipe (extrusion along contour), Revolution, Solid (from shell). */ interface GEOM_I3DPrimOperations : GEOM_IOperations { /*! - * Create a box with specified dimensions along the coordinate axes + * \brief Create a box with specified dimensions along the coordinate axes * and with edges, parallel to the coordinate axes. + * * Center of the box will be at point (DX/2, DY/2, DZ/2). * \param theDX Length of Box edges, parallel to OX axis. * \param theDY Length of Box edges, parallel to OY axis. @@ -850,7 +1116,7 @@ module GEOM GEOM_Object MakeBoxDXDYDZ (in double theDX, in double theDY, in double theDZ); /*! - * Create a box with two specified opposite vertices, + * \brief Create a box with two specified opposite vertices, * and with edges, parallel to the coordinate axes * \param thePnt1 First of two opposite vertices. * \param thePnt2 Second of two opposite vertices. @@ -859,8 +1125,9 @@ module GEOM GEOM_Object MakeBoxTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); /*! - * Create a face specified dimensions along OX-OY coordinate axes, + * \brief Create a face specified dimensions along OX-OY coordinate axes, * with edges parallel to the coordinate axes. + * * Center of the face will be at point (0, 0, 0). * \param theH Height of the Face. * \param theW Width of the Face. @@ -869,46 +1136,48 @@ module GEOM */ GEOM_Object MakeFaceHW (in double theH, in double theW, in short theOrientation); /*! - * Create a face by normale vector or edge and two specified sizes, + * \brief Create a face by normale vector or edge and two specified sizes, * vertical (H) and horisontal (W). - * \param theVec defines plane. + * \param theObj defines plane. * \param theH vertical size (height). - * \param theW horisontal size (width). + * \param theW horisontal size (width). * \return New GEOM_Object, containing the created face. */ GEOM_Object MakeFaceObjHW (in GEOM_Object theObj, in double theH, in double theW); /*! - * Create a Disk (circular face) with given center, normal vector and radius. + * \brief Create a Disk (circular face) with given center, normal vector and radius. * \param thePnt disk center. * \param theVec Vector, normal to the plane of the disk. * \param theR Disk radius. * \return New GEOM_Object, containing the created disk. */ GEOM_Object MakeDiskPntVecR (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theR); + in GEOM_Object theVec, + in double theR); /*! - * Create a disk (circular face), passing through three given points + * \brief Create a disk (circular face), passing through three given points * \param thePnt1, thePnt2, thePnt3 Points, defining the disk. * \return New GEOM_Object, containing the created disk. */ GEOM_Object MakeDiskThreePnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3); - + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); + /*! - * Create a disk specified dimensions along OX-OY coordinate axes, + * \brief Create a disk specified dimensions along OX-OY coordinate axes. + * * Center of the disk at point (0, 0, 0). * \param theR of the Disk. * \param theOrientation Orientation belong axis OXY OYZ OZX * \return New GEOM_Object, containing the created disk. */ GEOM_Object MakeDiskR (in double theR, in short theOrientation); - + /*! - * Create a cylinder with given radius and height at - * the origin of coordinate system. Axis of the cylinder - * will be collinear to the OZ axis of the coordinate system. + * \brief Create a cylinder with given radius and height at + * the origin of coordinate system. + * + * Axis of the cylinder will be collinear to the OZ axis of the coordinate system. * \param theR Cylinder radius. * \param theH Cylinder height. * \return New GEOM_Object, containing the created cylinder. @@ -916,7 +1185,7 @@ module GEOM GEOM_Object MakeCylinderRH (in double theR, in double theH); /*! - * Create a cylinder with given base point, axis, radius and height. + * \brief Create a cylinder with given base point, axis, radius and height. * \param thePnt Central point of cylinder base. * \param theAxis Cylinder axis. * \param theR Cylinder radius. @@ -924,14 +1193,15 @@ module GEOM * \return New GEOM_Object, containing the created cylinder. */ GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt, - in GEOM_Object theAxis, - in double theR, - in double theH); + in GEOM_Object theAxis, + in double theR, + in double theH); /*! - * Create a cone with given height and radiuses at - * the origin of coordinate system. Axis of the cone will - * be collinear to the OZ axis of the coordinate system. + * \brief Create a cone with given height and radiuses at + * the origin of coordinate system. + * + * Axis of the cone will be collinear to the OZ axis of the coordinate system. * \param theR1 Radius of the first cone base. * \param theR2 Radius of the second cone base. * \note If both radiuses are non-zero, the cone will be truncated. @@ -942,7 +1212,7 @@ module GEOM GEOM_Object MakeConeR1R2H (in double theR1, in double theR2, in double theH); /*! - * Create a cone with given base point, axis, height and radiuses. + * \brief Create a cone with given base point, axis, height and radiuses. * \param thePnt Central point of the first cone base. * \param theAxis Cone axis. * \param theR1 Radius of the first cone base. @@ -953,22 +1223,22 @@ module GEOM * \return New GEOM_Object, containing the created cone. */ GEOM_Object MakeConePntVecR1R2H (in GEOM_Object thePnt, - in GEOM_Object theAxis, - in double theR1, - in double theR2, - in double theH); + in GEOM_Object theAxis, + in double theR1, + in double theR2, + in double theH); /*! - * Create a torus with given radiuses at the origin of coordinate system. + * \brief Create a torus with given radiuses at the origin of coordinate system. * \param theRMajor Torus major radius. * \param theRMinor Torus minor radius. * \return New GEOM_Object, containing the created torus. */ GEOM_Object MakeTorusRR (in double theRMajor, - in double theRMinor); + in double theRMinor); /*! - * Create a torus with given center, normal vector and radiuses. + * \brief Create a torus with given center, normal vector and radiuses. * \param thePnt Torus central point. * \param theVec Torus axis of symmetry. * \param theRMajor Torus major radius. @@ -976,19 +1246,19 @@ module GEOM * \return New GEOM_Object, containing the created torus. */ GEOM_Object MakeTorusPntVecRR (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theRMajor, - in double theRMinor); + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor); /*! - * Create a sphere with given radius at the origin of coordinate system. + * \brief Create a sphere with given radius at the origin of coordinate system. * \param theR Sphere radius. * \return New GEOM_Object, containing the created sphere. */ GEOM_Object MakeSphereR (in double theR); /*! - * Create a sphere with given center and radius. + * \brief Create a sphere with given center and radius. * \param thePnt Sphere center. * \param theR Sphere radius. * \return New GEOM_Object, containing the created . @@ -996,8 +1266,9 @@ module GEOM GEOM_Object MakeSpherePntR (in GEOM_Object thePnt, in double theR); /*! - * Create a shape by extrusion of the base shape along the vector, - * i.e. all the space, transfixed by the base shape during its translation + * \brief Create a shape by extrusion of the base shape along the vector + * + * All the space, transfixed by the base shape during its translation * along the vector on the given distance. * \param theBase Base shape to be extruded. * \param theVec Direction of extrusion. @@ -1005,42 +1276,73 @@ module GEOM * \return New GEOM_Object, containing the created prism. */ GEOM_Object MakePrismVecH (in GEOM_Object theBase, - in GEOM_Object theVec, - in double theH); - /* The Same Prism but in 2 directions (forward&backward) */ + in GEOM_Object theVec, + in double theH); + /* \brief The Same Prism but in 2 directions (forward&backward) */ GEOM_Object MakePrismVecH2Ways (in GEOM_Object theBase, - in GEOM_Object theVec, - in double theH); + in GEOM_Object theVec, + in double theH); + /* \brief The Same as MakePrismVecH but with scaling */ + GEOM_Object MakePrismVecHWithScaling (in GEOM_Object theBase, + in GEOM_Object theVec, + in double theH, + in double theScaleFactor); /*! - * Create a shape by extrusion of the base shape along a vector, defined by two points. + * \brief Create a shape by extrusion of the base shape along a vector, defined by two points. * \param theBase Base shape to be extruded. * \param thePoint1 First end of extrusion vector. * \param thePoint2 Second end of extrusion vector. * \return New GEOM_Object, containing the created prism. */ GEOM_Object MakePrismTwoPnt (in GEOM_Object theBase, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); - /* The same prism but in two directions forward&backward */ + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); + /* \brief The same prism but in two directions forward&backward */ GEOM_Object MakePrismTwoPnt2Ways (in GEOM_Object theBase, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); - + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); + /* \brief The Same as MakePrismTwoPnt but with scaling */ + GEOM_Object MakePrismTwoPntWithScaling (in GEOM_Object theBase, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2, + in double theScaleFactor); + /*! - * Create a shape by extrusion of the base shape along a vector, defined by DX DY DZ. + * \brief Create a shape by extrusion of the base shape along a vector, defined by DX DY DZ. * \param theBase Base shape to be extruded. - * \param DX, DY, DZ end of extrusion vector. + * \param theDX, theDY, theDZ end of extrusion vector. * \return New GEOM_Object, containing the created prism. */ GEOM_Object MakePrismDXDYDZ (in GEOM_Object theBase, - in double theDX, in double theDY, in double theDZ); - /* The same prism but in two directions forward&backward */ + in double theDX, in double theDY, in double theDZ); + /* \brief The same prism but in two directions forward&backward */ GEOM_Object MakePrismDXDYDZ2Ways (in GEOM_Object theBase, in double theDX, in double theDY, in double theDZ); + /* \brief The Same as MakePrismDXDYDZ but with scaling */ + GEOM_Object MakePrismDXDYDZWithScaling (in GEOM_Object theBase, + in double theDX, in double theDY, in double theDZ, + in double theScaleFactor); + + + /*! + * \brief Add / Remove material to / from a solid by extrusion of the base shape on the given distance. + * \param theInitShape Initial shape on which to perform the feature.It has to be a solid or + * a compound made of a single solid + * \param theBase Edge or wire defining the base shape to be extruded. + * \param theHeight Prism dimension along the normal of the face. + * \param theAngle Draft angel in degrees + * \param theFuse If true material is added else material is removed + * \return New GEOM_Object, containing the modified shape + */ + GEOM_Object MakeDraftPrism (in GEOM_Object theInitShape, + in GEOM_Object theBase, + in double theHeight, + in double theAngle, + in boolean theFuse); /*! - * Create a shape by extrusion of the base shape along + * \brief Create a shape by extrusion of the base shape along * the path shape. The path shape can be a wire or an edge. * \param theBase Base shape to be extruded. * \param thePath Path shape to extrude the base shape along it. @@ -1049,8 +1351,10 @@ module GEOM GEOM_Object MakePipe (in GEOM_Object theBase, in GEOM_Object thePath); /*! - * Create a shape by revolution of the base shape around the axis - * on the given angle, i.e. all the space, transfixed by the base + * \brief Create a shape by revolution of the base shape around the axis + * on the given angle. + * + * All the space, transfixed by the base * shape during its rotation around the axis on the given angle. * \param theBase Base shape to be rotated. * \param theAxis Rotation axis. @@ -1058,29 +1362,34 @@ module GEOM * \return New GEOM_Object, containing the created revolution. */ GEOM_Object MakeRevolutionAxisAngle (in GEOM_Object theBase, - in GEOM_Object theAxis, - in double theAngle); + in GEOM_Object theAxis, + in double theAngle); /* The Same Revolution but in both ways forward&backward */ GEOM_Object MakeRevolutionAxisAngle2Ways (in GEOM_Object theBase, - in GEOM_Object theAxis, - in double theAngle); + in GEOM_Object theAxis, + in double theAngle); /*! - * Create a filling from the given compound of contours. + * \brief Create a filling from the given compound of contours. + * \param theShape Initial shape on which to perform the feature. * \param theMinDeg a minimal degree of BSpline surface to create * \param theMaxDeg a maximal degree of BSpline surface to create * \param theTol2D a 2d tolerance to be reached * \param theTol3D a 3d tolerance to be reached * \param theNbIter a number of iteration of approximation algorithm + * \param theMethod Kind of method to perform filling operation. + * \param theApprox Boolean indicating if result should be approximated * \return New GEOM_Object, containing the created filling surface. */ GEOM_Object MakeFilling (in GEOM_Object theShape, - in long theMinDeg, in long theMaxDeg, - in double theTol2D, in double theTol3D, - in long theNbIter, in boolean theApprox); + in long theMinDeg, in long theMaxDeg, + in double theTol2D, in double theTol3D, + in long theNbIter, + in filling_oper_method theMethod, + in boolean theApprox); /*! - * Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. + * \brief Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. * \param theSeqSections - set of specified sections. * \param theModeSolid - mode defining building solid or shell * \param thePreci - precision 3D used for smoothing by default 1.e-6 @@ -1088,14 +1397,16 @@ module GEOM * \return New GEOM_Object, containing the created shell or solid. */ GEOM_Object MakeThruSections(in ListOfGO theSeqSections, - in boolean theModeSolid, - in double thePreci, + in boolean theModeSolid, + in double thePreci, in boolean theRuled); - /*! - * Create a shape by extrusion of the profile shape along - * the path shape. The path shape can be a wire or an edge. - * the several profiles can be specified in the several locations of path. + /*! + * \brief Create a shape by extrusion of the profile shape along + * the path shape. + * + * The path shape can be a wire or an edge. + * the several profiles can be specified in the several locations of path. * \param theSeqBases - list of Bases shape to be extruded. * \param theLocations - list of locations on the path corresponding * specified list of the Bases shapes. Number of locations @@ -1103,51 +1414,54 @@ module GEOM * \param thePath - Path shape to extrude the base shape along it. * \param theWithContact - the mode defining that the section is translated to be in * contact with the spine. - * \param - WithCorrection - defining that the section is rotated to be - * orthogonal to the spine tangent in the correspondent point + * \param theWithCorrection - defining that the section is rotated to be + * orthogonal to the spine tangent in the correspondent point * \return New GEOM_Object, containing the created pipe. */ GEOM_Object MakePipeWithDifferentSections (in ListOfGO theSeqBases, - in ListOfGO theLocations, - in GEOM_Object thePath, - in boolean theWithContact , - in boolean theWithCorrection ); + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); /*! - * Create a shape by extrusion of the profile shape along - * the path shape. The path shape can be a shell or a face. - * the several profiles can be specified in the several locations of path. + * \brief Create a shape by extrusion of the profile shape along + * the path shape. + * + * The path shape can be a shell or a face. + * the several profiles can be specified in the several locations of path. * \param theSeqBases - list of Bases shape to be extruded. - * \param theSeqSubBases - list of corresponding subshapes of section shapes. + * \param theSeqSubBases - list of corresponding sub-shapes of section shapes. * \param theLocations - list of locations on the path corresponding * specified list of the Bases shapes. Number of locations * should be equal to number of bases. * \param thePath - Path shape to extrude the base shape along it. * \param theWithContact - the mode defining that the section is translated to be in * contact with the spine. - * \param - WithCorrection - defining that the section is rotated to be - * orthogonal to the spine tangent in the correspondent point + * \param theWithCorrection - defining that the section is rotated to be + * orthogonal to the spine tangent in the correspondent point * \return New GEOM_Object, containing the created pipe. */ GEOM_Object MakePipeWithShellSections (in ListOfGO theSeqBases, - in ListOfGO theSeqSubBases, - in ListOfGO theLocations, - in GEOM_Object thePath, - in boolean theWithContact , - in boolean theWithCorrection ); + in ListOfGO theSeqSubBases, + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); /*! - * Create solids between given sections + * \brief Create solids between given sections * \param theSeqBases - list of sections (shell or face). * \param theLocations - list of corresponding vertexes * \return New GEOM_Object, containing the created solids. */ GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases, - in ListOfGO theLocations); + in ListOfGO theLocations); /*! - * Create a shape by extrusion of the base shape along - * the path shape with constant bi-normal direction along the given vector. + * \brief Create a shape by extrusion of the base shape along + * the path shape with constant bi-normal direction along the given vector. + * * The path shape can be a wire or an edge. * \param theBase Base shape to be extruded. * \param thePath Path shape to extrude the base shape along it. @@ -1156,21 +1470,23 @@ module GEOM * along the sweep surface. * \return New GEOM_Object, containing the created pipe. */ - GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase, - in GEOM_Object thePath, - in GEOM_Object theVec); + GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase, + in GEOM_Object thePath, + in GEOM_Object theVec); }; + // # GEOM_IShapesOperations /*! - * GEOM_IShapesOperations: Interface for Shapes creation: + * \brief Interface for Shapes creation: + * * Edge from two points, Wire from edges, Face from wire, * Shell from faces, Solid from shells, Compound from shapes */ interface GEOM_IShapesOperations : GEOM_IOperations { /*! - * Create a linear edge with specified ends. + * \brief Create a linear edge with specified ends. * \param thePnt1 Point for the first end of edge. * \param thePnt2 Point for the second end of edge. * \return New GEOM_Object, containing the created edge. @@ -1178,14 +1494,42 @@ module GEOM GEOM_Object MakeEdge (in GEOM_Object thePnt1, in GEOM_Object thePnt2); /*! - * Create a wire from the set of edges and wires. + * \brief Create an edge on another edge, corresponding to the given length on the given edge. + * \param theRefCurve The referenced edge. + * \param theLength Length on the referenced edge. It can be + * negative for extrapolation on base curve. + * \param theStartPoint Any vertex close to one of edge's + * ends to select start point among them. + * If NULL, fist vertex is used. + * \return New GEOM_Object, containing the created edge. + */ + GEOM_Object MakeEdgeOnCurveByLength (in GEOM_Object theRefCurve, + in double theLength, + in GEOM_Object theStartPoint); + + /*! + * \brief Create an edge from specified wire. + * \param theWire source Wire. + * \param theLinearTolerance linear tolerance value + * \param theAngularTolerance angular tolerance value + * \return New GEOM_Object, containing the created edge. + */ + GEOM_Object MakeEdgeWire (in GEOM_Object theWire, + in double theLinearTolerance, + in double theAngularTolerance); + + /*! + * \brief Create a wire from the set of edges and wires. * \param theEdgesAndWires List of edge and/or wires. + * \param theTolerance Maximum distance between vertices, that will be merged. + * Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()). * \return New GEOM_Object, containing the created wire. */ - GEOM_Object MakeWire (in ListOfGO theEdgesAndWires); + GEOM_Object MakeWire (in ListOfGO theEdgesAndWires, + in double theTolerance); /*! - * Create a face on the given wire. + * \brief Create a face on the given wire. * \param theWire closed Wire or Edge to build the face on. * \param isPlanarWanted If TRUE, only planar face will be built. * If impossible, NULL object will be returned. @@ -1194,7 +1538,7 @@ module GEOM GEOM_Object MakeFace (in GEOM_Object theWire, in boolean isPlanarWanted); /*! - * Create a face on the given wires set. + * \brief Create a face on the given wires set. * \param theWires List of closed wires or edges to build the face on. * \param isPlanarWanted If TRUE, only planar face will be built. * If impossible, NULL object will be returned. @@ -1203,35 +1547,35 @@ module GEOM GEOM_Object MakeFaceWires (in ListOfGO theWires, in boolean isPlanarWanted); /*! - * Create a shell from the set of faces and shells. + * \brief Create a shell from the set of faces and shells. * \param theFacesAndShells List of faces and/or shells. * \return New GEOM_Object, containing the created shell. */ GEOM_Object MakeShell (in ListOfGO theFacesAndShells); /*! - * Create a solid, bounded by the given shell. + * \brief Create a solid, bounded by the given shell. * \param theShell Bounding shell. * \return New GEOM_Object, containing the created solid. */ GEOM_Object MakeSolidShell (in GEOM_Object theShell); /*! - * Create a solid, bounded by the given shells. + * \brief Create a solid, bounded by the given shells. * \param theShells Bounding shells. * \return New GEOM_Object, containing the created solid. */ GEOM_Object MakeSolidShells (in ListOfGO theShells); /*! - * Create a compound of the given shapes. + * \brief Create a compound of the given shapes. * \param theShapes List of shapes to put in compound. * \return New GEOM_Object, containing the created compound. */ GEOM_Object MakeCompound (in ListOfGO theShapes); /*! - * Replace coincident faces in theShape by one face. + * \brief Replace coincident faces in theShape by one face. * \param theShape Initial shape. * \param theTolerance Maximum distance between faces, which can be considered as coincident. * \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes. @@ -1248,50 +1592,139 @@ module GEOM ListOfGO GetGlueFaces (in GEOM_Object theShape, in double theTolerance); /*! - * Replace coincident faces in theShape by one face + * \brief Replace coincident faces in theShape by one face * in compliance with given list of faces * \param theShape Initial shape. * \param theTolerance Maximum distance between faces, which can be considered as coincident. * \param theFaces List of faces for gluing. * \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes. + * \param doGlueAllEdges If TRUE, all coincident edges of theShape + * will be glued, otherwise only the edges, + * belonging to theFaces. * \return New GEOM_Object, containing a copy of theShape without some faces. */ GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, - in ListOfGO theFaces, in boolean doKeepNonSolids); + in ListOfGO theFaces, in boolean doKeepNonSolids, + in boolean doGlueAllEdges); + + /*! + * \brief Replace coincident edges in theShape by one edge. + * \param theShape Initial shape. + * \param theTolerance Maximum distance between edges, which can be considered as coincident. + * \return New GEOM_Object, containing a copy of theShape without coincident edges. + */ + GEOM_Object MakeGlueEdges (in GEOM_Object theShape, in double theTolerance); + + /*! + * Find coincident edges in theShape for possible gluing. + * \param theShape Initial shape. + * \param theTolerance Maximum distance between edges, which can be considered as coincident. + * \return ListOfGO + */ + ListOfGO GetGlueEdges (in GEOM_Object theShape, in double theTolerance); + + /*! + * \brief Replace coincident edges in theShape by one edge + * in compliance with given list of edges + * \param theShape Initial shape. + * \param theTolerance Maximum distance between edges, which can be considered as coincident. + * \param theEdges List of edges for gluing. + * \return New GEOM_Object, containing a copy of theShape without some edges. + */ + GEOM_Object MakeGlueEdgesByList (in GEOM_Object theShape, + in double theTolerance, + in ListOfGO theEdges); + + /*! + * \brief Get all sub-shapes and groups of \a theShape, + * that were created already by any other methods. + * \param theShape Any shape. + * \param theGroupsOnly If this parameter is TRUE, only groups will be + * returned, else all found sub-shapes and groups. + * \return List of existing sub-objects of \a theShape. + */ + ListOfGO GetExistingSubObjects (in GEOM_Object theShape, + in boolean theGroupsOnly); + + /*! + * \brief Deprecated method. + * + * Use MakeAllSubShapes() instead. + */ + ListOfGO MakeExplode (in GEOM_Object theShape, + in long theShapeType, + in boolean isSorted); /*! - * Explode a shape on subshapes of a given type. + * \brief Explode a shape on sub-shapes of a given type. + * + * If the shape itself has the given type, it is also returned. * \param theShape Shape to be exploded. * \param theShapeType Type of sub-shapes to be retrieved. * \param isSorted If this parameter is TRUE, sub-shapes will be * sorted by coordinates of their gravity centers. * \return List of sub-shapes of type theShapeType, contained in theShape. */ - ListOfGO MakeExplode (in GEOM_Object theShape, - in long theShapeType, - in boolean isSorted); + ListOfGO MakeAllSubShapes (in GEOM_Object theShape, + in long theShapeType, + in boolean isSorted); /*! - * Explode a shape on subshapes of a given type. - * Does the same, as the above method, but returns IDs of sub-shapes, - * not GEOM_Objects. It works faster. + * \brief Extract all sub-shapes of the given type from + * the given shape, excluding the shape itself. * \param theShape Shape to be exploded. * \param theShapeType Type of sub-shapes to be retrieved. * \param isSorted If this parameter is TRUE, sub-shapes will be * sorted by coordinates of their gravity centers. - * \return List of IDs of sub-shapes of type theShapeType, contained in theShape. + * \return List of sub-shapes of type theShapeType, contained in theShape. + */ + ListOfGO ExtractSubShapes (in GEOM_Object theShape, + in long theShapeType, + in boolean isSorted); + + /*! + * \brief Deprecated method. Use GetAllSubShapesIDs() instead. */ ListOfLong SubShapeAllIDs (in GEOM_Object theShape, - in long theShapeType, - in boolean isSorted); + in long theShapeType, + in boolean isSorted); /*! - * Get a sub shape defined by its unique ID inside \a theMainShape - * \note The sub shape GEOM_Objects can has ONLY ONE function. - * Don't try to apply modification operations on them. + * \brief Explode a shape on sub-shapes of a given type. + * + * Does the same, as MakeAllSubShapes, but returns IDs of + * sub-shapes, not GEOM_Object. It works faster. + * \param theShape Shape to be exploded. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param isSorted If this parameter is TRUE, sub-shapes will be + * sorted by coordinates of their gravity centers. + * \return List of IDs of sub-shapes of type theShapeType, contained in theShape. + */ + ListOfLong GetAllSubShapesIDs (in GEOM_Object theShape, + in long theShapeType, + in boolean isSorted); + + /*! + * \brief Get a sub-shape defined by its unique ID inside \a theMainShape + * \param theMainShape Main shape. + * \param theID Unique ID of sub-shape inside \a theMainShape. + * \return GEOM_Object, corresponding to found sub-shape. + * \note The sub-shape GEOM_Object can has ONLY ONE function. + * Don't try to apply modification operations (without copy) on them. */ GEOM_Object GetSubShape (in GEOM_Object theMainShape, - in long theID); + in long theID); + + /*! + * \brief Get a set of sub-shapes defined by their unique IDs inside \a theMainShape + * \param theMainShape Main shape. + * \param theIndices List of unique IDs of sub-shapes inside \a theMainShape. + * \return List of GEOM_Object, corresponding to found sub-shapes. + * \note The sub-shape GEOM_Object can has ONLY ONE function. + * Don't try to apply modification operations (without copy) on them. + */ + ListOfGO MakeSubShapes (in GEOM_Object theMainShape, + in ListOfLong theIndices); /*! * Get global index of \a theSubShape in \a theMainShape. @@ -1302,7 +1735,8 @@ module GEOM long GetSubShapeIndex (in GEOM_Object theMainShape, in GEOM_Object theSubShape); /*! - * Get index of \a theSubShape in \a theMainShape, unique among sub-shapes of the same type. + * \brief Get index of \a theSubShape in \a theMainShape, unique among sub-shapes of the same type. + * * Together with method GetShapeTypeString() it can be used * to generate automatic names for sub-shapes, when publishing them in a study. * \param theMainShape Main shape. @@ -1323,19 +1757,28 @@ module GEOM string GetShapeTypeString (in GEOM_Object theShape); /*! - * Count number of faces in the given shape. + * \brief Count number of faces in the given shape. * \param theShape Shape to count faces in. * \return Number of faces in the given shape. */ long NumberOfFaces (in GEOM_Object theShape); /*! - * Count number of edges in the given shape. + * \brief Count number of edges in the given shape. * \param theShape Shape to count edges in. * \return Number of edges in theShape. */ long NumberOfEdges (in GEOM_Object theShape); + /*! + * \brief Count number of sub-shapes of type \a theShapeType in the given shape. + * \param theShape Shape to count sub-shapes in. + * \param theShapeType The type of sub-shapes to count. + * \return Number of sub-shapes of type \a theShapeType in \a theShape. + */ + long NumberOfSubShapes (in GEOM_Object theShape, + in long theShapeType); + /*! * Reverses an orientation the given shape. * \param theShape Shape to be reversed. @@ -1344,7 +1787,8 @@ module GEOM GEOM_Object ChangeOrientation (in GEOM_Object theShape); /*! - * Retrieve all free faces from the given shape. + * \brief Retrieve all free faces from the given shape. + * * Free face is a face, which is not shared between two shells of the shape. * \param theShape Shape to find free faces in. * \return List of IDs of all free faces, contained in theShape. @@ -1352,84 +1796,112 @@ module GEOM ListOfLong GetFreeFacesIDs (in GEOM_Object theShape); /*! - * Get all sub-shapes of theShape1 of the given type, shared with theShape2. + * \brief Get all sub-shapes of theShape1 of the given type, shared with theShape2. * \param theShape1 Shape to find sub-shapes in. * \param theShape2 Shape to find shared sub-shapes with. * \param theShapeType Type of sub-shapes to be retrieved. * \return List of sub-shapes of theShape1, shared with theShape2. */ ListOfGO GetSharedShapes (in GEOM_Object theShape1, - in GEOM_Object theShape2, - in long theShapeType); + in GEOM_Object theShape2, + in long theShapeType); + + /*! + * \brief Get all sub-shapes, shared by all shapes in the list \a theShapes. + * \param theShapes Shapes to find common sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \return List of objects, that are sub-shapes of all given shapes. + */ + ListOfGO GetSharedShapesMulti (in ListOfGO theShapes, + in long theShapeType); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified plane by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theAx1 Vector (or line, or linear edge), specifying normal * direction and location of the plane to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of all found sub-shapes. */ ListOfGO GetShapesOnPlane (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theAx1, - in shape_state theState); + in long theShapeType, + in GEOM_Object theAx1, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified plane by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theAx1 Vector (or line, or linear edge), specifying normal * direction of the plane to find shapes on. * \param thePnt Point specifying location of the plane to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of all found sub-shapes. */ ListOfGO GetShapesOnPlaneWithLocation (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theAx1, - in GEOM_Object thePnt, - in shape_state theState); + in long theShapeType, + in GEOM_Object theAx1, + in GEOM_Object thePnt, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified cylinder by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theAxis Vector (or line, or linear edge), specifying * axis of the cylinder to find shapes on. * \param theRadius Radius of the cylinder to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of all found sub-shapes. */ ListOfGO GetShapesOnCylinder (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theAxis, - in double theRadius, - in shape_state theState); + in long theShapeType, + in GEOM_Object theAxis, + in double theRadius, + in shape_state theState); + + /*! + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified cylinder by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAxis Vector (or line, or linear edge), specifying + * axis of the cylinder to find shapes on. + * \param thePnt Point specifying location of the bottom of the cylinder. + * \param theRadius Radius of the cylinder to find shapes on. + * \param theState The state of the sub-shapes to find. + * \return List of all found sub-shapes. + */ + ListOfGO GetShapesOnCylinderWithLocation (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theAxis, + in GEOM_Object thePnt, + in double theRadius, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified sphere by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theCenter Point, specifying center of the sphere to find shapes on. * \param theRadius Radius of the sphere to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of all found sub-shapes. */ ListOfGO GetShapesOnSphere (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theCenter, - in double theRadius, - in shape_state theState); + in long theShapeType, + in GEOM_Object theCenter, + in double theRadius, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified quadrangle by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. @@ -1437,7 +1909,7 @@ module GEOM * \param theTopRigthPoint Top right quadrangle corner * \param theBottomLeftPoint Bottom left quadrangle corner * \param theBottomRigthPoint Bottom right quadrangle corner - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of all found sub-shapes. */ ListOfGO GetShapesOnQuadrangle (in GEOM_Object theShape, @@ -1449,72 +1921,91 @@ module GEOM in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified plane by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theAx1 Vector (or line, or linear edge), specifying normal * direction and location of the plane to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of IDs of all found sub-shapes. */ ListOfLong GetShapesOnPlaneIDs (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theAx1, - in shape_state theState); + in long theShapeType, + in GEOM_Object theAx1, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified plane by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theAx1 Vector (or line, or linear edge), specifying normal * direction of the plane to find shapes on. * \param thePnt Point specifying location of the plane to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of IDs of all found sub-shapes. */ ListOfLong GetShapesOnPlaneWithLocationIDs (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theAx1, - in GEOM_Object thePnt, - in shape_state theState); + in long theShapeType, + in GEOM_Object theAx1, + in GEOM_Object thePnt, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified cylinder by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theAxis Vector (or line, or linear edge), specifying * axis of the cylinder to find shapes on. * \param theRadius Radius of the cylinder to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of IDs of all found sub-shapes. */ ListOfLong GetShapesOnCylinderIDs (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theAxis, - in double theRadius, - in shape_state theState); + in long theShapeType, + in GEOM_Object theAxis, + in double theRadius, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified cylinder by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAxis Vector (or line, or linear edge), specifying + * axis of the cylinder to find shapes on. + * \param thePnt Point specifying location of the bottom of the cylinder. + * \param theRadius Radius of the cylinder to find shapes on. + * \param theState The state of the sub-shapes to find. + * \return List of IDs all found sub-shapes. + */ + ListOfLong GetShapesOnCylinderWithLocationIDs (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theAxis, + in GEOM_Object thePnt, + in double theRadius, + in shape_state theState); + + /*! + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified sphere by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. * \param theCenter Point, specifying center of the sphere to find shapes on. * \param theRadius Radius of the sphere to find shapes on. - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of IDs of all found sub-shapes. */ ListOfLong GetShapesOnSphereIDs (in GEOM_Object theShape, - in long theShapeType, - in GEOM_Object theCenter, - in double theRadius, - in shape_state theState); + in long theShapeType, + in GEOM_Object theCenter, + in double theRadius, + in shape_state theState); /*! - * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * \brief Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * the specified quadrangle by the certain way, defined through \a theState parameter. * \param theShape Shape to find sub-shapes of. * \param theShapeType Type of sub-shapes to be retrieved. @@ -1522,7 +2013,7 @@ module GEOM * \param theTopRigthPoint Top right quadrangle corner * \param theBottomLeftPoint Bottom left quadrangle corner * \param theBottomRigthPoint Bottom right quadrangle corner - * \param theState The state of the subshapes to find. + * \param theState The state of the sub-shapes to find. * \return List of IDs of all found sub-shapes. */ ListOfLong GetShapesOnQuadrangleIDs (in GEOM_Object theShape, @@ -1534,82 +2025,88 @@ module GEOM in shape_state theState); /*! - * \brief Find subshapes complying with given status - * \param theBox - the box to check state of subshapes against + * \brief Find sub-shapes complying with given status + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \return List of IDs of all found sub-shapes. */ ListOfLong GetShapesOnBoxIDs (in GEOM_Object theBox, - in GEOM_Object theShape, - in long theShapeType, - in shape_state theState); + in GEOM_Object theShape, + in long theShapeType, + in shape_state theState); /*! - * \brief Find subshapes complying with given status - * \param theBox - the box to check state of subshapes against + * \brief Find sub-shapes complying with given status + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \return List of all found sub-shapes. */ ListOfGO GetShapesOnBox (in GEOM_Object theBox, - in GEOM_Object theShape, - in long theShapeType, - in shape_state theState); + in GEOM_Object theShape, + in long theShapeType, + in shape_state theState); /*! - * \brief Find subshapes complying with given status - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find sub-shapes complying with given status + * \param theCheckShape - the shape to check state of sub-shapes against. It must be a solid. * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \return List of IDs of all found sub-shapes. */ ListOfLong GetShapesOnShapeIDs (in GEOM_Object theCheckShape, - in GEOM_Object theShape, - in short theShapeType, - in shape_state theState); + in GEOM_Object theShape, + in short theShapeType, + in shape_state theState); /*! - * \brief Find subshapes complying with given status - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find sub-shapes complying with given status + * \param theCheckShape - the shape to check state of sub-shapes against. It must be a solid. * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \return List of all found sub-shapes. */ ListOfGO GetShapesOnShape (in GEOM_Object theCheckShape, - in GEOM_Object theShape, - in short theShapeType, - in shape_state theState); + in GEOM_Object theShape, + in short theShapeType, + in shape_state theState); /*! - * \brief Find subshapes complying with given status - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find sub-shapes complying with given status + * \param theCheckShape - the shape to check state of sub-shapes against. It must be a solid. * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \return compound includes all found sub-shapes. */ GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape, - in GEOM_Object theShape, - in short theShapeType, - in shape_state theState); + in GEOM_Object theShape, + in short theShapeType, + in shape_state theState); /*! - * Get sub-shape(s) of \a theShapeWhere, which are + * \brief Get sub-shape(s) of \a theShapeWhere, which are * coincident with \a theShapeWhat or could be a part of it. * \param theShapeWhere Shape to find sub-shapes of. * \param theShapeWhat Shape, specifying what to find. * \return Group of all found sub-shapes or a single found sub-shape. */ GEOM_Object GetInPlace (in GEOM_Object theShapeWhere, - in GEOM_Object theShapeWhat); + in GEOM_Object theShapeWhat); /*! - * Get sub-shape(s) of \a theShapeWhere, which are + * Old implementation of GetInPlace functionality, based on shape properties. + */ + GEOM_Object GetInPlaceOld (in GEOM_Object theShapeWhere, + in GEOM_Object theShapeWhat); + + /*! + * \brief Get sub-shape(s) of \a theShapeWhere, which are * coincident with \a theShapeWhat or could be a part of it. * * Implementation of this method is based on a saved history of an operation, @@ -1623,89 +2120,105 @@ module GEOM * \return Group of all found sub-shapes or a single found sub-shape. */ GEOM_Object GetInPlaceByHistory (in GEOM_Object theShapeWhere, - in GEOM_Object theShapeWhat); + in GEOM_Object theShapeWhat); /*! - * Get sub-shape of theShapeWhere, which are + * \brief Get sub-shape of theShapeWhere, which are * coincident with \a theShapeWhat that can either SOLID, FACE, EDGE or VERTEX. * \param theShapeWhere Shape to find sub-shapes of. * \param theShapeWhat Shape, specifying what to find. * \return found sub-shape. */ GEOM_Object GetSame (in GEOM_Object theShapeWhere, - in GEOM_Object theShapeWhat); + in GEOM_Object theShapeWhat); + + /*! + * \brief Get sub-shape Ids of theShapeWhere, which are + * coincident with \a theShapeWhat that can either SOLID, FACE, EDGE or VERTEX. + * \param theShapeWhere Shape to find sub-shapes of. + * \param theShapeWhat Shape, specifying what to find. + * \return found sub-shape Ids. + */ + ListOfLong GetSameIDs (in GEOM_Object theShapeWhere, + in GEOM_Object theShapeWhat); + }; + // # GEOM_IBlocksOperations: /*! - * GEOM_IBlocksOperations: Interface for Blocks construction + * \brief Interface for Blocks construction * Face from points or edges, Block from faces, * Blocks multi-translation and multi-rotation */ interface GEOM_IBlocksOperations : GEOM_IOperations { - /*! - * Creation of blocks - */ + + // # Creation of blocks /*! - * Create a quadrangle face from four edges. Order of Edges is not + * \brief Create a quadrangle face from four edges. Order of Edges is not * important. It is not necessary that edges share the same vertex. * \param theEdge1,theEdge2,theEdge3,theEdge4 Edges for the face bound. * \return New GEOM_Object, containing the created face. */ GEOM_Object MakeQuad (in GEOM_Object theEdge1, - in GEOM_Object theEdge2, - in GEOM_Object theEdge3, - in GEOM_Object theEdge4); + in GEOM_Object theEdge2, + in GEOM_Object theEdge3, + in GEOM_Object theEdge4); /*! - * Create a quadrangle face on two edges. + * \brief Create a quadrangle face on two edges. + * * The missing edges will be built by creating the shortest ones. * \param theEdge1,theEdge2 Two opposite edges for the face. * \return New GEOM_Object, containing the created face. */ GEOM_Object MakeQuad2Edges (in GEOM_Object theEdge1, - in GEOM_Object theEdge2); + in GEOM_Object theEdge2); /*! - * Create a quadrangle face with specified corners. + * \brief Create a quadrangle face with specified corners. + * * The missing edges will be built by creating the shortest ones. * \param thePnt1,thePnt2,thePnt3,thePnt4 Corner vertices for the face. * \return New GEOM_Object, containing the created face. */ GEOM_Object MakeQuad4Vertices (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3, - in GEOM_Object thePnt4); + in GEOM_Object thePnt2, + in GEOM_Object thePnt3, + in GEOM_Object thePnt4); /*! - * Create a hexahedral solid, bounded by the six given faces. Order of - * faces is not important. It is not necessary that Faces share the same edge. - * \param theFace1-theFace6 Faces for the hexahedral solid. + * \brief Create a hexahedral solid, bounded by the six given faces. Order of + * faces is not important. + * + * It is not necessary that Faces share the same edge. + * \param theFace1,theFace2,theFace3,theFace4,theFace5,theFace6 Faces for the hexahedral solid. * \return New GEOM_Object, containing the created solid. */ GEOM_Object MakeHexa (in GEOM_Object theFace1, - in GEOM_Object theFace2, - in GEOM_Object theFace3, - in GEOM_Object theFace4, - in GEOM_Object theFace5, - in GEOM_Object theFace6); + in GEOM_Object theFace2, + in GEOM_Object theFace3, + in GEOM_Object theFace4, + in GEOM_Object theFace5, + in GEOM_Object theFace6); /*! - * Create a hexahedral solid between two given faces. + * \brief Create a hexahedral solid between two given faces. + * * The missing faces will be built by creating the smallest ones. * \param theFace1,theFace2 Two opposite faces for the hexahedral solid. * \return New GEOM_Object, containing the created solid. */ GEOM_Object MakeHexa2Faces (in GEOM_Object theFace1, - in GEOM_Object theFace2); + in GEOM_Object theFace2); - /*! - * Extract elements of blocks and blocks compounds - */ + + // # Extract elements of blocks and blocks compounds + /*! - * Get a vertex, found in the given shape by its coordinates. + * \brief Get a vertex, found in the given shape by its coordinates. * \param theShape Block or a compound of blocks. * \param theX,theY,theZ Coordinates of the sought vertex. * \param theEpsilon Maximum allowed distance between the resulting @@ -1713,99 +2226,123 @@ module GEOM * \return New GEOM_Object, containing the found vertex. */ GEOM_Object GetPoint (in GEOM_Object theShape, - in double theX, - in double theY, - in double theZ, - in double theEpsilon); + in double theX, + in double theY, + in double theZ, + in double theEpsilon); + + /*! + * \brief Find a vertex of the given shape, which has minimal distance to the given point. + * \param theShape Any shape. + * \param thePoint Point, close to the desired vertex. + * \return New GEOM_Object, containing the found vertex. + */ + GEOM_Object GetVertexNearPoint (in GEOM_Object theShape, + in GEOM_Object thePoint); /*! - * Get an edge, found in the given shape by two given vertices. + * \brief Get an edge, found in the given shape by two given vertices. * \param theShape Block or a compound of blocks. * \param thePoint1,thePoint2 Points, close to the ends of the desired edge. * \return New GEOM_Object, containing the found edge. */ GEOM_Object GetEdge (in GEOM_Object theShape, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); /*! - * Find an edge of the given shape, which has minimal distance to the given point. + * \brief Find an edge of the given shape, which has minimal distance to the given point. * \param theShape Block or a compound of blocks. * \param thePoint Point, close to the desired edge. * \return New GEOM_Object, containing the found edge. */ GEOM_Object GetEdgeNearPoint (in GEOM_Object theShape, - in GEOM_Object thePoint); + in GEOM_Object thePoint); /*! - * Returns a face, found in the given shape by four given corner vertices. + * \brief Returns a face, found in the given shape by four given corner vertices. * \param theShape Block or a compound of blocks. - * \param thePoint1-thePoint4 Points, close to the corners of the desired face. + * \param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face. * \return New GEOM_Object, containing the found face. */ GEOM_Object GetFaceByPoints (in GEOM_Object theShape, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2, - in GEOM_Object thePoint3, - in GEOM_Object thePoint4); + in GEOM_Object thePoint1, + in GEOM_Object thePoint2, + in GEOM_Object thePoint3, + in GEOM_Object thePoint4); /*! - * Get a face of block, found in the given shape by two given edges. + * \brief Get a face of block, found in the given shape by two given edges. * \param theShape Block or a compound of blocks. * \param theEdge1,theEdge2 Edges, close to the edges of the desired face. * \return New GEOM_Object, containing the found face. */ GEOM_Object GetFaceByEdges (in GEOM_Object theShape, - in GEOM_Object theEdge1, - in GEOM_Object theEdge2); + in GEOM_Object theEdge1, + in GEOM_Object theEdge2); /*! - * Find a face, opposite to the given one in the given block. + * \brief Find a face, opposite to the given one in the given block. * \param theBlock Must be a hexahedral solid. * \param theFace Face of \a theBlock, opposite to the desired face. * \return New GEOM_Object, containing the found face. */ GEOM_Object GetOppositeFace (in GEOM_Object theBlock, - in GEOM_Object theFace); + in GEOM_Object theFace); /*! - * Find a face of the given shape, which has minimal distance to the given point. + * \brief Find a face of the given shape, which has minimal distance to the given point. * \param theShape Block or a compound of blocks. * \param thePoint Point, close to the desired face. * \return New GEOM_Object, containing the found face. */ GEOM_Object GetFaceNearPoint (in GEOM_Object theShape, - in GEOM_Object thePoint); + in GEOM_Object thePoint); /*! - * Find a face of block, whose outside normale has minimal angle with the given vector. - * \param theShape Block or a compound of blocks. + * \brief Find a face of block, whose outside normale has minimal angle with the given vector. + * \param theBlock Block or a compound of blocks. * \param theVector Vector, close to the normale of the desired face. * \return New GEOM_Object, containing the found face. */ GEOM_Object GetFaceByNormale (in GEOM_Object theBlock, - in GEOM_Object theVector); + in GEOM_Object theVector); /*! - * Extract blocks from blocks compounds + * \brief Find all sub-shapes of type \a theShapeType of the given shape, + * which have minimal distance to the given point. + * \param theShape Any shape. + * \param thePoint Point, close to the desired shape. + * \param theShapeType Defines what kind of sub-shapes is searched. + * \param theTolerance The tolerance for distances comparison. All shapes + * with distances to the given point in interval + * [minimal_distance, minimal_distance + theTolerance] will be gathered. + * \return New GEOM_Object, containing a group of all found shapes. */ + GEOM_Object GetShapesNearPoint (in GEOM_Object theShape, + in GEOM_Object thePoint, + in long theShapeType, + in double theTolerance); + + // # Extract blocks from blocks compounds + /*! - * Check, if the compound contains only specified blocks. + * \brief Check, if the compound contains only specified blocks. * \param theCompound The compound to check. * \param theMinNbFaces If solid has lower number of faces, it is not a block. * \param theMaxNbFaces If solid has higher number of faces, it is not a block. * \note If theMaxNbFaces = 0, the maximum number of faces is not restricted. + * \param theNbBlocks Number of specified blocks in theCompound. * \return TRUE, if the given compound contains only blocks. - * \return theNbBlocks Number of specified blocks in theCompound. */ boolean IsCompoundOfBlocks (in GEOM_Object theCompound, - in long theMinNbFaces, - in long theMaxNbFaces, - out long theNbBlocks); + in long theMinNbFaces, + in long theMaxNbFaces, + out long theNbBlocks); /*! - * Enumeration of Blocks Compound defects. + * \brief Enumeration of Blocks Compound defects. */ enum BCErrorType { @@ -1826,7 +2363,7 @@ module GEOM }; /*! - * Description of Blocks Compound defect: type and incriminated sub-shapes. + * \brief Description of Blocks Compound defect: type and incriminated sub-shapes. */ struct BCError { @@ -1835,12 +2372,13 @@ module GEOM }; /*! - * Sequence of all Blocks Compound defects. + * \brief Sequence of all Blocks Compound defects. */ typedef sequence BCErrors; /*! - * Check, if the compound of blocks is given. + * \brief Check, if the compound of blocks is given. + * * To be considered as a compound of blocks, the * given shape must satisfy the following conditions: * - Each element of the compound should be a Block (6 faces and 12 edges). @@ -1849,32 +2387,39 @@ module GEOM * - The glue between two quadrangle faces should be applied. * \note Single block is also accepted as a valid compound of blocks. * \param theCompound The compound to check. + * \param theErrors Structure, containing discovered errors and incriminated sub-shapes. * \return TRUE, if the given shape is a compound of blocks. - * \return theErrors Structure, containing discovered errors and incriminated sub-shapes. */ boolean CheckCompoundOfBlocks (in GEOM_Object theCompound, - out BCErrors theErrors); + out BCErrors theErrors); /*! - * Convert sequence of Blocks Compound errors, returned by + * \brief Convert sequence of Blocks Compound errors, returned by * CheckCompoundOfBlocks(), into string. * \param theCompound The bad compound. * \param theErrors The sequence of \a theCompound errors. * \return String, describing all the errors in form, suitable for printing. */ string PrintBCErrors (in GEOM_Object theCompound, - in BCErrors theErrors); + in BCErrors theErrors); /*! - * Remove all seam and degenerated edges from \a theShape. + * \brief Remove all seam and degenerated edges from \a theShape. + * * Unite faces and edges, sharing one surface. * \param theShape The compound or single solid to remove irregular edges from. + * \param theOptimumNbFaces If more than zero, unite faces only for those solids, + * that have more than theOptimumNbFaces faces. If zero, unite faces always, + * regardsless their quantity in the solid. If negative, do not unite faces at all. + * For blocks repairing recommended value is 6. * \return Improved shape. */ - GEOM_Object RemoveExtraEdges (in GEOM_Object theShape); + GEOM_Object RemoveExtraEdges (in GEOM_Object theShape, + in long theOptimumNbFaces); /*! - * Check, if the given shape is a blocks compound. + * \brief Check, if the given shape is a blocks compound. + * * Fix all detected errors. * \note Single block can be also fixed by this method. * \param theCompound The compound to check and improve. @@ -1883,51 +2428,51 @@ module GEOM GEOM_Object CheckAndImprove (in GEOM_Object theCompound); /*! - * Get all the blocks, contained in the given compound. + * \brief Get all the blocks, contained in the given compound. + * * \param theCompound The compound to explode. * \param theMinNbFaces If solid has lower number of faces, it is not a block. * \param theMaxNbFaces If solid has higher number of faces, it is not a block. * \note If theMaxNbFaces = 0, the maximum number of faces is not restricted. - * \return List of GEOM_Objects, containing the retrieved blocks. + * \return List of GEOM_Object, containing the retrieved blocks. */ ListOfGO ExplodeCompoundOfBlocks (in GEOM_Object theCompound, - in long theMinNbFaces, - in long theMaxNbFaces); + in long theMinNbFaces, + in long theMaxNbFaces); /*! - * Find block, containing the given point inside its volume or on boundary. + * \brief Find block, containing the given point inside its volume or on boundary. * \param theCompound Compound, to find block in. * \param thePoint Point, close to the desired block. If the point lays on * boundary between some blocks, we return block with nearest center. * \return New GEOM_Object, containing the found block. */ GEOM_Object GetBlockNearPoint (in GEOM_Object theCompound, - in GEOM_Object thePoint); + in GEOM_Object thePoint); /*! - * Find block, containing all the elements, passed as the parts, or maximum quantity of them. + * \brief Find block, containing all the elements, passed as the parts, or maximum quantity of them. * \param theCompound Compound, to find block in. * \param theParts List of faces and/or edges and/or vertices to be parts of the found block. * \return New GEOM_Object, containing the found block. */ GEOM_Object GetBlockByParts (in GEOM_Object theCompound, - in ListOfGO theParts); + in ListOfGO theParts); /*! - * Return all blocks, containing all the elements, passed as the parts. + * \brief Return all blocks, containing all the elements, passed as the parts. * \param theCompound Compound, to find blocks in. * \param theParts List of faces and/or edges and/or vertices to be parts of the found blocks. - * \return List of GEOM_Objects, containing the found blocks. + * \return List of GEOM_Object, containing the found blocks. */ ListOfGO GetBlocksByParts (in GEOM_Object theCompound, - in ListOfGO theParts); + in ListOfGO theParts); - /*! - * Operations on blocks with gluing of result - */ + // # Operations on blocks with gluing of result /*! - * Multi-transformate block and glue the result. + * \brief Multi-transformate block and glue the result. + * * Transformation is defined so, as to superpose theDirFace1 with theDirFace2. * \param theBlock Hexahedral solid to be multi-transformed. * \param theDirFace1 First direction face global index. @@ -1938,12 +2483,12 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeMultiTransformation1D (in GEOM_Object theBlock, - in long theDirFace1, - in long theDirFace2, - in long theNbTimes); + in long theDirFace1, + in long theDirFace2, + in long theNbTimes); /*! - * Multi-transformate block and glue the result. + * \brief Multi-transformate block and glue the result. * \param theBlock Hexahedral solid to be multi-transformed. * \param theDirFace1U,theDirFace2U Direction faces for the first transformation. * \param theDirFace1V,theDirFace2V Direction faces for the second transformation. @@ -1951,35 +2496,36 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeMultiTransformation2D (in GEOM_Object theBlock, - in long theDirFace1U, - in long theDirFace2U, - in long theNbTimesU, - in long theDirFace1V, - in long theDirFace2V, - in long theNbTimesV); + in long theDirFace1U, + in long theDirFace2U, + in long theNbTimesU, + in long theDirFace1V, + in long theDirFace2V, + in long theNbTimesV); - /*! - * Special operation - propagation - */ + // # Special operation - propagation + /*! - * Build all possible propagation groups. + * \brief Build all possible propagation groups. + * * Propagation group is a set of all edges, opposite to one (main) * edge of this group directly or through other opposite edges. * Notion of Opposite Edge make sence only on quadrangle face. * \param theShape Shape to build propagation groups on. - * \return List of GEOM_Objects, each of them is a propagation group. + * \return List of GEOM_Object, each of them is a propagation group. */ ListOfGO Propagate (in GEOM_Object theShape); }; + // # GEOM_IBooleanOperations /*! - * GEOM_IBooleanOperations: Interface for boolean operations (Cut, Fuse, Common) + * \brief Interface for boolean operations (Cut, Fuse, Common) */ interface GEOM_IBooleanOperations : GEOM_IOperations { /*! - * Perform one of boolean operations on two given shapes. + * \brief Perform one of boolean operations on two given shapes. * \param theShape1 First argument for boolean operation. * \param theShape2 Second argument for boolean operation. * \param theOperation Indicates the operation to be done: @@ -1987,20 +2533,21 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeBoolean (in GEOM_Object theShape1, - in GEOM_Object theShape2, - in long theOperation); + in GEOM_Object theShape2, + in long theOperation); /*! - * Perform partition operation. + * \brief Perform partition operation. + * * \param theShapes Shapes to be intersected. * \param theTools Shapes to intersect theShapes. * \note Each compound from ListShapes and ListTools will be exploded in order * to avoid possible intersection between shapes from this compound. * \param theLimit Type of resulting shapes (corresponding to TopAbs_ShapeEnum). - # \param KeepNonlimitShapes: if this parameter == 0 - only shapes with - # type <= Limit are kept in the result, - # else - shapes with type > Limit are kept - # also (if they exist) + * \param theKeepNonlimitShapes: if this parameter == 0, then only shapes of + * target type (equal to Limit) are kept in the result, + * else standalone shapes of lower dimension + * are kept also (if they exist). * * After implementation new version of PartitionAlgo (October 2006) * other parameters are ignored by current functionality. They are kept @@ -2016,16 +2563,17 @@ module GEOM * \return New GEOM_Object, containing the result shapes. */ GEOM_Object MakePartition (in ListOfGO theShapes, - in ListOfGO theTools, - in ListOfGO theKeepInside, - in ListOfGO theRemoveInside, - in short theLimit, - in boolean theRemoveWebs, - in ListOfLong theMaterials, - in short theKeepNonlimitShapes); + in ListOfGO theTools, + in ListOfGO theKeepInside, + in ListOfGO theRemoveInside, + in short theLimit, + in boolean theRemoveWebs, + in ListOfLong theMaterials, + in short theKeepNonlimitShapes); /*! - * Perform partition operation. + * \brief Perform partition operation. + * * This method may be usefull if it is needed to make a partition for * a compound containing nonintersected shapes. Performance will be better * since intersection between shapes from compound is not performed. @@ -2038,59 +2586,61 @@ module GEOM * \return New GEOM_Object, containing the result shapes. */ GEOM_Object MakePartitionNonSelfIntersectedShape (in ListOfGO theShapes, - in ListOfGO theTools, - in ListOfGO theKeepInside, - in ListOfGO theRemoveInside, - in short theLimit, - in boolean theRemoveWebs, - in ListOfLong theMaterials, - in short theKeepNonlimitShapes); + in ListOfGO theTools, + in ListOfGO theKeepInside, + in ListOfGO theRemoveInside, + in short theLimit, + in boolean theRemoveWebs, + in ListOfLong theMaterials, + in short theKeepNonlimitShapes); /*! - * Perform partition of the Shape with the Plane + * \brief Perform partition of the Shape with the Plane * \param theShape Shape to be intersected. * \param thePlane Tool shape, to intersect theShape. * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeHalfPartition (in GEOM_Object theShape, - in GEOM_Object thePlane); + in GEOM_Object thePlane); }; + // # GEOM_ICurvesOperations: /*! - * GEOM_ICurvesOperations: Interface for curves creation. + * \brief Interface for curves creation. + * * Polyline, Circle, Spline (Bezier and Interpolation) */ interface GEOM_ICurvesOperations : GEOM_IOperations { /*! - * Create a circle with given center, normal vector and radius. + * \brief Create a circle with given center, normal vector and radius. * \param thePnt Circle center. * \param theVec Vector, normal to the plane of the circle. * \param theR Circle radius. * \return New GEOM_Object, containing the created circle. */ GEOM_Object MakeCirclePntVecR (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theR); + in GEOM_Object theVec, + in double theR); /*! - * Create a circle, passing through three given points + * \brief Create a circle, passing through three given points * \param thePnt1,thePnt2,thePnt3 Points, defining the circle. * \return New GEOM_Object, containing the created circle. */ GEOM_Object MakeCircleThreePnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3); + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); /*! - * Create a circle with given center, with a radius equals the distance from center to Point1 + * \brief Create a circle with given center, with a radius equals the distance from center to Point1 * and on a plane defined by all of three points. * \param thePnt1,thePnt2,thePnt3 Points, defining the circle. * \return New GEOM_Object, containing the created circle. */ GEOM_Object MakeCircleCenter2Pnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3); + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); /*! - * Create an ellipse with given center, normal vector and radiuses. + * \brief Create an ellipse with given center, normal vector and radiuses. * \param thePnt Ellipse center. * \param theVec Vector, normal to the plane of the ellipse. * \param theRMajor Major ellipse radius. @@ -2098,23 +2648,38 @@ module GEOM * \return New GEOM_Object, containing the created ellipse. */ GEOM_Object MakeEllipse (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theRMajor, - in double theRMinor); + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor); /*! - * Create an arc of circle, passing through three given points. + * \brief Create an ellipse with given center, normal vector, main axis vector and radiuses. + * \param thePnt Ellipse center. + * \param theVec Vector, normal to the plane of the ellipse. + * \param theRMajor Major ellipse radius. + * \param theRMinor Minor ellipse radius. + * \param theVecMaj Vector, direction of the ellipse's main axis. + * \return New GEOM_Object, containing the created ellipse. + */ + GEOM_Object MakeEllipseVec (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor, + in GEOM_Object theVecMaj); + + /*! + * \brief Create an arc of circle, passing through three given points. * \param thePnt1 Start point of the arc. * \param thePnt2 Middle point of the arc. * \param thePnt3 End point of the arc. * \return New GEOM_Object, containing the created arc. */ GEOM_Object MakeArc (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3); + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); /*! - * Create an arc of circle of center C from one point to another + * \brief Create an arc of circle of center C from one point to another * \param theCenter Center point of the arc. * \param thePnt1 Start point of the arc. * \param thePnt2 End point of the arc. @@ -2125,43 +2690,92 @@ module GEOM in GEOM_Object thePnt1, in GEOM_Object thePnt2, in boolean theSense); - + /*! - * Create an arc of ellipse of center C and two points P1 P2. + * \brief Create an arc of ellipse of center C and two points P1 P2. * \param theCenter Center point of the arc. * \param thePnt1 Major radius is distance from center to Pnt1. - * \param thePnt2 define a plane and Minor radius as a shortest distance from Pnt2 to vector Center->Pnt1. + * \param thePnt2 define a plane and Minor radius as a shortest + * distance from Pnt2 to vector Center->Pnt1. * \return New GEOM_Object, containing the created arc. */ GEOM_Object MakeArcOfEllipse (in GEOM_Object theCenter, - in GEOM_Object thePnt1, - in GEOM_Object thePnt2); + in GEOM_Object thePnt1, + in GEOM_Object thePnt2); /*! - * Create a polyline on the set of points. + * \brief Create a polyline on the set of points. * \param thePoints Sequence of points for the polyline. + * \param theIsClosed If TRUE, build a closed wire. * \return New GEOM_Object, containing the created polyline. */ - GEOM_Object MakePolyline (in ListOfGO thePoints); + GEOM_Object MakePolyline (in ListOfGO thePoints, + in boolean theIsClosed); /*! - * Create bezier curve on the set of points. + * \brief Create bezier curve on the set of points. * \param thePoints Sequence of points for the bezier curve. + * \param theIsClosed If TRUE, build a closed curve. * \return New GEOM_Object, containing the created bezier curve. */ - GEOM_Object MakeSplineBezier (in ListOfGO thePoints); + GEOM_Object MakeSplineBezier (in ListOfGO thePoints, + in boolean theIsClosed); /*! - * Create B-Spline curve on the set of points. + * \brief Create B-Spline curve on the set of points. * \param thePoints Sequence of points for the B-Spline curve. + * \param theIsClosed If TRUE, build a closed curve. + * \param theDoReordering If TRUE, the algo does not follow the order of + * \a thePoints but searches for the closest vertex. * \return New GEOM_Object, containing the created B-Spline curve. */ - GEOM_Object MakeSplineInterpolation (in ListOfGO thePoints); + GEOM_Object MakeSplineInterpolation (in ListOfGO thePoints, + in boolean theIsClosed, + in boolean theDoReordering); + + /*! + * \brief Creates a curve using the parametric definition of the basic points. + * \param thexExpr parametric equation of the coordinates X. + * \param theyExpr parametric equation of the coordinates Y. + * \param thezExpr parametric equation of the coordinates Z. + * \param theParamMin the minimal value of the parameter. + * \param theParamMax the maximum value of the parameter. + * \param theParamStep the step of the parameter. + * \param theCurveType the type of the curve. + * \return New GEOM_Object, containing the created curve. + */ + GEOM_Object MakeCurveParametric(in string thexExpr, + in string theyExpr, + in string thezExpr, + in double theParamMin, + in double theParamMax, + in double theParamStep, + in curve_type theCurveType); - /*! - * Create a sketcher (wire or face), following the textual description, - * passed through \a theCommand argument. \n + /*! + * \brief Creates a curve using the parametric definition of the basic points. + * \param thexExpr parametric equation of the coordinates X. + * \param theyExpr parametric equation of the coordinates Y. + * \param thezExpr parametric equation of the coordinates Z. + * \param theParamMin the minimal value of the parameter. + * \param theParamMax the maximum value of the parameter. + * \param theParamNbStep the number of steps of the parameter discretization. + * \param theCurveType the type of the curve. + * \return New GEOM_Object, containing the created curve. + */ + GEOM_Object MakeCurveParametricNew(in string thexExpr, + in string theyExpr, + in string thezExpr, + in double theParamMin, + in double theParamMax, + in long theParamNbStep, + in curve_type theCurveType); + + /*! + * \brief Create a sketcher (wire or face), following the textual description, + * passed through \a theCommand argument. + * * Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n * Format of the description string have to be the following: * @@ -2194,20 +2808,22 @@ module GEOM * \return New GEOM_Object, containing the created wire. */ GEOM_Object MakeSketcher (in string theCommand, in ListOfDouble theWorkingPlane); - + /*! - * Create a 3D sketcher, following the numerical description, - * passed through points created by \a theCoordinates argument. \n + * \brief Create a 3D sketcher, following the numerical description, + * passed through points created by \a theCoordinates argument. + * * Format of the description string have to be the following: * * "Make3DSketcher[x1, y1, z1, x2, y2, z2, ..., xN, yN, zN]" */ - + GEOM_Object Make3DSketcher (in ListOfDouble theCoordinates); /*! - * Create a sketcher (wire or face), following the textual description, - * passed through \a theCommand argument. \n + * \brief Create a sketcher (wire or face), following the textual description, + * passed through \a theCommand argument. + * * For format of the description string see the previous method.\n * \param theCommand String, defining the sketcher in local * coordinates of the working plane. @@ -2217,22 +2833,23 @@ module GEOM GEOM_Object MakeSketcherOnPlane (in string theCommand, in GEOM_Object theWorkingPlane); }; + // # GEOM_ILocalOperations: /*! - * GEOM_ILocalOperations: Interface for fillet and chamfer creation. + * \brief Interface for fillet and chamfer creation. */ interface GEOM_ILocalOperations : GEOM_IOperations { /*! - * Perform a fillet on all edges of the given shape. + * \brief Perform a fillet on all edges of the given shape. * \param theShape Shape, to perform fillet on. * \param theR Fillet radius. * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeFilletAll (in GEOM_Object theShape, - in double theR); + in double theR); /*! - * Perform a fillet on the specified edges of the given shape + * \brief Perform a fillet on the specified edges of the given shape * \param theShape Shape, to perform fillet on. * \param theR Fillet radius. * \param theEdges Global indices of edges to perform fillet on. @@ -2241,15 +2858,15 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeFilletEdges (in GEOM_Object theShape, - in double theR, - in ListOfLong theEdges); + in double theR, + in ListOfLong theEdges); GEOM_Object MakeFilletEdgesR1R2 (in GEOM_Object theShape, - in double theR1, - in double theR2, - in ListOfLong theEdges); + in double theR1, + in double theR2, + in ListOfLong theEdges); /*! - * Perform a fillet on all edges of the specified faces of the given shape. + * \brief Perform a fillet on all edges of the specified faces of the given shape. * \param theShape Shape, to perform fillet on. * \param theR Fillet radius. * \param theFaces Global indices of faces to perform fillet on. @@ -2258,16 +2875,16 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeFilletFaces (in GEOM_Object theShape, - in double theR, - in ListOfLong theFaces); - + in double theR, + in ListOfLong theFaces); + GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape, - in double theR1, - in double theR2, - in ListOfLong theFaces); - + in double theR1, + in double theR2, + in ListOfLong theFaces); + /*! - * Perform a fillet on face of the specified vertexes of the given shape. + * \brief Perform a fillet on a face or a shell at the specified vertexes. * \param theShape Shape, to perform fillet on. * \param theR Fillet radius. * \param theVertexes Global indices of vertexes to perform fillet on. @@ -2276,20 +2893,42 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeFillet2D (in GEOM_Object theShape, - in double theR, - in ListOfLong theVertexes); + in double theR, + in ListOfLong theVertexes); /*! - * Perform a symmetric chamfer on all edges of the given shape. + * \brief Perform a fillet on edges of the specified vertexes of the given wire. + * \param theShape Shape, to perform fillet on. + * \param theR Fillet radius. + * \param theVertexes Global indices of vertexes to perform fillet on. + * \note Global index of sub-shape can be obtained, using method + * GEOM_IShapesOperations.GetSubShapeIndex(). + * \note The list of vertices coudl be empty, in this case fillet fill be done + * at all vertices in given wire + * \param doIgnoreSecantVertices If FALSE, fillet radius is always limited + * by the length of the edges, nearest to the fillet vertex. + * But sometimes the next edge is C1 continuous with the one, nearest to + * the fillet point, and such two (or more) edges can be united to allow + * bigger radius. Set this flag to TRUE to allow collinear edges union, + * thus ignoring the secant vertex (vertices). + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeFillet1D (in GEOM_Object theShape, + in double theR, + in ListOfLong theVertexes, + in boolean doIgnoreSecantVertices); + + /*! + * \brief Perform a symmetric chamfer on all edges of the given shape. * \param theShape Shape, to perform chamfer on. * \param theD Chamfer size along each face. * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeChamferAll (in GEOM_Object theShape, - in double theD); + in double theD); /*! - * Perform a chamfer on edges, common to the specified faces. + * \brief Perform a chamfer on edges, common to the specified faces. * with distance D1 on the Face1 * \param theShape Shape, to perform chamfer on. * \param theD1 Chamfer size along \a theFace1. @@ -2300,18 +2939,18 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeChamferEdge (in GEOM_Object theShape, - in double theD1, in double theD2, - in long theFace1, in long theFace2); + in double theD1, in double theD2, + in long theFace1, in long theFace2); /*! - * The Same but with params theD = Chamfer Lenght + * \brief The Same but with params theD = Chamfer Lenght * and theAngle = Chamfer Angle (Angle in radians) */ GEOM_Object MakeChamferEdgeAD (in GEOM_Object theShape, - in double theD, in double theAngle, - in long theFace1, in long theFace2); + in double theD, in double theAngle, + in long theFace1, in long theFace2); /*! - * Perform a chamfer on all edges of the specified faces. + * \brief Perform a chamfer on all edges of the specified faces. * with distance D1 on the first specified face (if several for one edge) * \param theShape Shape, to perform chamfer on. * \param theD1 Chamfer size along face from \a theFaces. If both faces, @@ -2324,37 +2963,37 @@ module GEOM * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeChamferFaces (in GEOM_Object theShape, - in double theD1, in double theD2, - in ListOfLong theFaces); + in double theD1, in double theD2, + in ListOfLong theFaces); /*! * The Same but with params theD = Chamfer Lenght * and theAngle = Chamfer Angle (Angle in radians) */ GEOM_Object MakeChamferFacesAD (in GEOM_Object theShape, - in double theD, in double theAngle, - in ListOfLong theFaces); + in double theD, in double theAngle, + in ListOfLong theFaces); /*! - * Perform a chamfer on edges, + * \brief Perform a chamfer on edges, * with distance D1 on the first specified face (if several for one edge) * \param theShape Shape, to perform chamfer on. - * \param theD1 theD2 Chamfer size + * \param theD1,theD2 Chamfer size * \param theEdges Sequence of edges of \a theShape. * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeChamferEdges (in GEOM_Object theShape, - in double theD1, in double theD2, - in ListOfLong theEdges); + in double theD1, in double theD2, + in ListOfLong theEdges); /*! * The Same but with params theD = Chamfer Lenght * and theAngle = Chamfer Angle (Angle in radians) */ GEOM_Object MakeChamferEdgesAD (in GEOM_Object theShape, - in double theD, in double theAngle, - in ListOfLong theEdges); + in double theD, in double theAngle, + in ListOfLong theEdges); /*! - * Perform an Archimde operation on the given shape with given parameters. + * \brief Perform an Archimde operation on the given shape with given parameters. * The object presenting the resulting face is returned * \param theShape Shape to be put in water. * \param theWeight Weight og the shape. @@ -2364,25 +3003,28 @@ module GEOM * by a plane, corresponding to water level. */ GEOM_Object MakeArchimede (in GEOM_Object theShape, - in double theWeight, - in double theWaterDensity, - in double theMeshDeflection); + in double theWeight, + in double theWaterDensity, + in double theMeshDeflection); /*! - * Duplicates GEOM_IShapesOperations.GetSubShapeIndex(). + * \brief Duplicates GEOM_IShapesOperations.GetSubShapeIndex(). + * * Present here only for compatibility. */ long GetSubShapeIndex (in GEOM_Object theShape, in GEOM_Object theSubShape); }; + // # GEOM_IHealingOperations: /*! - * GEOM_IHealingOperations: Interface for shape healing operations. + * \brief Interface for shape healing operations + * * Shape Processing, SuppressFaces, etc. */ interface GEOM_IHealingOperations : GEOM_IOperations { /*! - * Apply a sequence of Shape Healing operators to the given object. + * \brief Apply a sequence of Shape Healing operators to the given object. * \param theShapes Shape to be processed. * \param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.). * \param theParameters List of names of parameters @@ -2392,13 +3034,15 @@ module GEOM * \return New GEOM_Object, containing processed shape. */ GEOM_Object ProcessShape (in GEOM_Object theShapes, - in string_array theOperators, - in string_array theParameters, - in string_array theValues); + in string_array theOperators, + in string_array theParameters, + in string_array theValues); /*! - * Get default sequence of operators, their parameters and parameters' values - * of Shape Process operation. In the current implementation the defaults are + * \brief Get default sequence of operators, their parameters and parameters' values + * of Shape Process operation. + * + * In the current implementation the defaults are * read from the file pointed by CSF_ShHealingDefaults environmental variable. * \param theOperators Output. Default list of names of operators. * \param theParameters Output. Default list of names of parameters. @@ -2406,10 +3050,11 @@ module GEOM * as parameters are listed in \a theParameters list. */ void GetShapeProcessParameters (out string_array theOperators, - out string_array theParameters, - out string_array theValues); + out string_array theParameters, + out string_array theValues); /*! - * Get parameters and parameters' values for the given Shape Process operation. + * \brief Get parameters and parameters' values for the given Shape Process operation. + * * In the current implementation the defaults are * read from the file pointed by CSF_ShHealingDefaults environmental variable. * \param theOperator Input. The operator's name. @@ -2418,11 +3063,11 @@ module GEOM * as parameters are listed in \a theParameters list. */ void GetOperatorParameters (in string theOperator, - out string_array theParameters, - out string_array theValues); + out string_array theParameters, + out string_array theValues); /*! - * Remove faces from the given object (shape). + * \brief Remove faces from the given object (shape). * \param theObject Shape to be processed. * \param theFaces Indices of faces to be removed, if EMPTY then the method * removes ALL faces of the given object. @@ -2431,7 +3076,7 @@ module GEOM GEOM_Object SuppressFaces (in GEOM_Object theObject, in short_array theFaces); /*! - * Close an open wire. + * \brief Close an open wire. * \param theObject Shape to be processed. * \param theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape, * if -1, then theObject itself is a wire. @@ -2440,10 +3085,10 @@ module GEOM * \return New GEOM_Object, containing processed shape. */ GEOM_Object CloseContour (in GEOM_Object theObject, in short_array theWires, - in boolean isCommonVertex); + in boolean isCommonVertex); /*! - * Remove internal wires and edges from the given object (face). + * \brief Remove internal wires and edges from the given object (face). * \param theObject Shape to be processed. * \param theWires Indices of wires to be removed, if EMPTY then the method * removes ALL internal wires of the given object. @@ -2452,7 +3097,7 @@ module GEOM GEOM_Object RemoveIntWires (in GEOM_Object theObject, in short_array theWires); /*! - * Remove internal closed contours (holes) from the given object. + * \brief Remove internal closed contours (holes) from the given object. * \param theObject Shape to be processed. * \param theWires Indices of wires to be removed, if EMPTY then the method * removes ALL internal holes of the given object @@ -2469,7 +3114,7 @@ module GEOM GEOM_Object Sew (in GEOM_Object theObject, in double theTolerance); /*! - * Addition of a point to a given edge object. + * \brief Addition of a point to a given edge object. * \param theObject Shape to be processed. * \param theEdgeIndex Index of edge to be divided within theObject's shape, * if -1, then theObject itself is the edge. @@ -2480,10 +3125,20 @@ module GEOM * \return New GEOM_Object, containing processed shape. */ GEOM_Object DivideEdge (in GEOM_Object theObject, in short theEdgeIndex, - in double theValue, in boolean isByParameter); + in double theValue, in boolean isByParameter); /*! - * Get a list of wires (wrapped in GEOM_Object-s), + * \brief Suppress the vertices in the wire in case if adjacent edges are C1 continuous. + * \param theWire Wire to minimize the number of C1 continuous edges in. + * \param theVertices A list of vertices to suppress. If the list + * is empty, all vertices in a wire will be assumed. + * \return New GEOM_Object with modified wire. + */ + GEOM_Object FuseCollinearEdgesWithinWire (in GEOM_Object theWire, + in ListOfGO theVertices); + + /*! + * \brief Get a list of wires (wrapped in GEOM_Object-s), * that constitute a free boundary of the given shape. * \param theObject Shape to get free boundary of. * \param theClosedWires Output. Closed wires on the free boundary of the given shape. @@ -2491,32 +3146,41 @@ module GEOM * \return FALSE, if an error(s) occured during the method execution. */ boolean GetFreeBoundary (in GEOM_Object theObject, - out ListOfGO theClosedWires, - out ListOfGO theOpenWires); + out ListOfGO theClosedWires, + out ListOfGO theOpenWires); /*! - * Change orientation of the given object. + * \brief Change orientation of the given object. * \param theObject Shape to be processed. * \return New GEOM_Object, containing processed shape. */ GEOM_Object ChangeOrientation (in GEOM_Object theObject); GEOM_Object ChangeOrientationCopy (in GEOM_Object theObject); + /*! + * \brief Try to limit tolerance of the given object by value \a theTolerance. + * \param theObject Shape to be processed. + * \param theTolerance Required tolerance value. + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object LimitTolerance (in GEOM_Object theObject, in double theTolerance); + }; + // # GEOM_IInsertOperations: /*! - * GEOM_IInsertOperations: Interface for shape insert operations (like copy, import). + * \brief Interface for shape insert operations (like copy, import). * */ interface GEOM_IInsertOperations : GEOM_IOperations { /*! - * Create a copy of the given object + * \brief Create a copy of the given object */ GEOM_Object MakeCopy (in GEOM_Object theOriginal); /*! - * Export the given shape into a file with given name. + * \brief Export the given shape into a file with given name. * \param theObject Shape to be stored in the file. * \param theFileName Name of the file to store the given shape in. * \param theFormatName Specify format for the shape storage. @@ -2525,89 +3189,151 @@ module GEOM void Export (in GEOM_Object theObject, in string theFileName, in string theFormatName); /*! - * Import a shape from the BRep or IGES or STEP file + * \brief Import a shape from the BRep or IGES or STEP file * (depends on given format) with given name. * \param theFileName The file, containing the shape. * \param theFormatName Specify format for the file reading. * Available formats can be obtained with ImportTranslators() method. + * If format 'IGES_SCALE' is used instead 'IGES' length unit will be + * set to 'meter' and result model will be scaled. * \return New GEOM_Object, containing the imported shape. */ - GEOM_Object Import (in string theFileName, in string theFormatName); + GEOM_Object ImportFile (in string theFileName, in string theFormatName); /*! - * Get the supported import formats and corresponding patterns for File dialog. + * \brief Get the supported import formats and corresponding patterns for File dialog. * \param theFormats Output. List of formats, available for import. * \param thePatterns Output. List of file patterns, corresponding to available formats. * \return Returns available formats and patterns through the arguments. */ void ImportTranslators (out string_array theFormats, - out string_array thePatterns); + out string_array thePatterns); /*! - * Get the supported export formats and corresponding patterns for File dialog. + * \brief Get the supported export formats and corresponding patterns for File dialog. * \param theFormats Output. List of formats, available for export. * \param thePatterns Output. List of file patterns, corresponding to available formats. * \return Returns available formats and patterns through the arguments. */ void ExportTranslators (out string_array theFormats, - out string_array thePatterns); + out string_array thePatterns); + + /*! + * \brief Load texture from file + * \param theTextureFile texture file name + * \return unique texture identifier + */ + long LoadTexture(in string theTextureFile); + + /*! + * \brief Add texture to the study + * \param theWidth texture width in pixels + * \param theHeight texture height in pixels + * \param theTexture texture byte array + * \return unique texture identifier + */ + long AddTexture(in long theWidth, in long theHeight, in SALOMEDS::TMPFile theTexture); + + /*! + * \brief Get previously loaded texture data + * \param theID texture identifier + * \param theWidth texture width in pixels + * \param theHeight texture height in pixels + * \return texture byte array + */ + SALOMEDS::TMPFile GetTexture(in long theID, out long theWidth, out long theHeight); + + /*! + * \brief Get list of all avaiable texture IDs + * \return list of all texture IDs avaiable for the current study + */ + ListOfLong GetAllTextures(); }; + // # GEOM_IKindOfShape: /*! - * GEOM_IKindOfShape: namespace for shape_kind enumeration. + * \brief Interface for shape_kind enumeration. */ interface GEOM_IKindOfShape { enum shape_kind { NO_SHAPE, - // COMPOSITEs + //COMPOSITEs COMPOUND, COMPSOLID, SHELL, WIRE, // SOLIDs - SPHERE, // full sphere - CYLINDER, // cylinder - BOX, // box with faces, parallel to global coordinate planes - ROTATED_BOX, // other box - TORUS, // full torus - CONE, // cone - POLYHEDRON, // solid, bounded by polygons - SOLID, // other solid + /*! full sphere */ + SPHERE, + /*! cylinder */ + CYLINDER, + /*! box with faces, parallel to global coordinate planes */ + BOX, + /*! other box */ + ROTATED_BOX, + /*! full torus */ + TORUS, + /*! cone */ + CONE, + /*! solid, bounded by polygons */ + POLYHEDRON, + /*! other solid */ + SOLID, // FACEs - SPHERE2D, // spherical face (closed) - CYLINDER2D, // cylindrical face with defined height - TORUS2D, // toroidal face (closed) - CONE2D, // conical face with defined height - DISK_CIRCLE, // planar, bounded by circle - DISK_ELLIPSE, // planar, bounded by ellipse - POLYGON, // planar, bounded by segments - PLANE, // infinite planar - PLANAR, // other planar - FACE, // other face + /*! spherical face (closed) */ + SPHERE2D, + /*! cylindrical face with defined height */ + CYLINDER2D, + /*! toroidal face (closed) */ + TORUS2D, + /*! conical face with defined height */ + CONE2D, + /*! planar, bounded by circle */ + DISK_CIRCLE, + /*! planar, bounded by ellipse */ + DISK_ELLIPSE, + /*! planar, bounded by segments */ + POLYGON, + /*! infinite planar */ + PLANE, + /*! other planar */ + PLANAR, + /*! other face */ + FACE, // EDGEs - CIRCLE, // full circle - ARC_CIRCLE, // arc of circle - ELLIPSE, // full ellipse - ARC_ELLIPSE, // arc of ellipse - LINE, // infinite segment - SEGMENT, // segment - EDGE, // other edge + /*! full circle */ + CIRCLE, + /*! arc of circle */ + ARC_CIRCLE, + /*! full ellipse */ + ELLIPSE, + /*! arc of ellipse */ + ARC_ELLIPSE, + /*! infinite segment */ + LINE, + /*! segment */ + SEGMENT, + /*! other edge */ + EDGE, // VERTEX - VERTEX + VERTEX, + // ADVANCED shapes + /*! all advanced shapes (temporary implementation) */ + ADVANCED }; }; - + // # GEOM_IMeasureOperations: /*! - * GEOM_IMeasureOperations: Interface for measurement (distance, whatis) and + * \brief Interface for measurement (distance, whatis) and * properties calculation (like Centre of Mass, Inertia, etc.). * */ interface GEOM_IMeasureOperations : GEOM_IOperations { /*! - * Get kind of theShape. + * \brief Get kind of theShape. * \param theShape Shape to get a kind of. * \param theIntegers Output. Integer and enumerated shape's parameters * (kind of surface, closed/unclosed, number of edges, etc.) @@ -2618,11 +3344,11 @@ module GEOM */ //short KindOfShape (in GEOM_Object theShape, GEOM_IKindOfShape::shape_kind KindOfShape (in GEOM_Object theShape, - out ListOfLong theIntegers, - out ListOfDouble theDoubles); + out ListOfLong theIntegers, + out ListOfDouble theDoubles); /*! - * Get position (LCS) of theShape. + * \brief Get position (LCS) of theShape. * \param theShape Shape to calculate position of. * \param Ox,Oy,Oz Output. Coordinates of shape's location origin. * Origin of the LCS is situated at the shape's center of mass. @@ -2633,12 +3359,12 @@ module GEOM * \return Returns position of the shape through the last nine arguments. */ void GetPosition (in GEOM_Object theShape, - out double Ox, out double Oy, out double Oz, - out double Zx, out double Zy, out double Zz, - out double Xx, out double Xy, out double Xz); + out double Ox, out double Oy, out double Oz, + out double Zx, out double Zy, out double Zz, + out double Xx, out double Xy, out double Xz); /*! - * Get summarized length of all wires, + * \brief Get summarized length of all wires, * area of surface and volume of the given shape. * \param theShape Shape to define properties of. * \param theLength Output. Summarized length of all wires of the given shape. @@ -2647,19 +3373,27 @@ module GEOM * \return Returns shape properties through the last three arguments. */ void GetBasicProperties (in GEOM_Object theShape, - out double theLength, - out double theSurfArea, - out double theVolume); + out double theLength, + out double theSurfArea, + out double theVolume); /*! - * Get a point, situated at the centre of mass of theShape. + * \brief Get a point, situated at the centre of mass of theShape. * \param theShape Shape to define centre of mass of. * \return New GEOM_Object, containing the created point. */ GEOM_Object GetCentreOfMass (in GEOM_Object theShape); + /* + * Get the vertex by index for 1D objects depends the edge/wire orientation + * \param theShape Shape (wire or edge) to find the vertex on it + * \param theIndex Index of vertex sub-shape + * \return New GEOM_Object, vertex. + */ + GEOM_Object GetVertexByIndex( in GEOM_Object theShape, in long index ); + /*! - * Get a vector, representing the normal of theFace. + * \brief Get a vector, representing the normal of theFace. * If the face is not planar, theOptionalPoint is obligatory. * \param theFace Shape (face) to define the normal of. * \param theOptionalPoint Shape (point) to define the normal at. @@ -2667,23 +3401,23 @@ module GEOM * \return New GEOM_Object, containing the created normal vector. */ GEOM_Object GetNormal (in GEOM_Object theFace, - in GEOM_Object theOptionalPoint); + in GEOM_Object theOptionalPoint); /*! - * Get inertia matrix and moments of inertia of theShape. + * \brief Get inertia matrix and moments of inertia of theShape. * \param theShape Shape to calculate inertia of. - * \param I(1-3)(1-3) Output. Components of the inertia matrix of the given shape. + * \param I11,I12,I13,I21,I22,I23,I31,I32,I33 Output. Components of the inertia matrix of the given shape. * \param Ix,Iy,Iz Output. Moments of inertia of the given shape. * \return Returns inertia through the last twelve arguments. */ void GetInertia (in GEOM_Object theShape, - out double I11, out double I12, out double I13, - out double I21, out double I22, out double I23, - out double I31, out double I32, out double I33, - out double Ix , out double Iy , out double Iz); + out double I11, out double I12, out double I13, + out double I21, out double I22, out double I23, + out double I31, out double I32, out double I33, + out double Ix , out double Iy , out double Iz); /*! - * Get parameters of bounding box of the given shape + * \brief Get parameters of bounding box of the given shape * \param theShape Shape to obtain bounding box of. * \param Xmin,Xmax Output. Limits of shape along OX axis. * \param Ymin,Ymax Output. Limits of shape along OY axis. @@ -2691,12 +3425,12 @@ module GEOM * \return Returns parameters of bounding box through the last six arguments. */ void GetBoundingBox (in GEOM_Object theShape, - out double Xmin, out double Xmax, - out double Ymin, out double Ymax, - out double Zmin, out double Zmax); + out double Xmin, out double Xmax, + out double Ymin, out double Ymax, + out double Zmin, out double Zmax); /*! - * Get min and max tolerances of sub-shapes of theShape + * \brief Get min and max tolerances of sub-shapes of theShape * \param theShape Shape, to get tolerances of. * \param FaceMin,FaceMax Output. Min and max tolerances of the faces. * \param EdgeMin,EdgeMax Output. Min and max tolerances of the edges. @@ -2704,60 +3438,93 @@ module GEOM * \return Returns shape tolerances through the last six arguments. */ void GetTolerance (in GEOM_Object theShape, - out double FaceMin, out double FaceMax, - out double EdgeMin, out double EdgeMax, - out double VertMin, out double VertMax); + out double FaceMin, out double FaceMax, + out double EdgeMin, out double EdgeMax, + out double VertMin, out double VertMax); /*! - * Check a topology of the given shape. + * \brief Check a topology of the given shape. * \param theShape Shape to check validity of. * \param theDescription Output. Description of problems in the shape, if they are. * \return TRUE, if the shape "seems to be valid" from the topological point of view. */ boolean CheckShape (in GEOM_Object theShape, - out string theDescription); + out string theDescription); /*! - * Check a topology and a geometry of the given shape. + * \brief Check a topology and a geometry of the given shape. * \param theShape Shape to check validity of. * \param theDescription Output. Description of problems in the shape, if they are. * \return TRUE, if the shape "seems to be valid". */ boolean CheckShapeWithGeometry (in GEOM_Object theShape, - out string theDescription); + out string theDescription); /*! - * Obtain description of the given shape + * \brief Check a topology of the given shape on self-intersections presence. + * \param theShape Shape to check validity of. + * \param theIntersections Output. List of intersected sub-shapes IDs, it contains pairs of IDs. + * \return TRUE, if the shape does not have any self-intersections. + */ + boolean CheckSelfIntersections (in GEOM_Object theShape, + out ListOfLong theIntersections); + + /*! + * \brief Check if the given shape can be an argument for MakeSolid operation + * \param theShape Shape to be described. + * \return Empty string if a solid can be made on this shape, error code otherwise. + */ + string IsGoodForSolid (in GEOM_Object theShape); + + /*! + * O\brief btain description of the given shape * \param theShape Shape to be described. * \return Description of the given shape. */ string WhatIs (in GEOM_Object theShape); /*! - * Get minimal distance between the given shapes. + * \brief Check if points defined by coords = [x1, y1, z1, x2, y2, z2, ...] are inside or on + * the shape theShape. + * \param theShape Shape to check. + * \param coords list of coordinates. + * \param tolerance tolerance. + * \return list of boolean. + */ + ListOfBool AreCoordsInside(in GEOM_Object theShape, in ListOfDouble coords, in double tolerance); + + /*! + * \brief Get minimal distance between the given shapes. * \param theShape1,theShape2 Shapes to find minimal distance between. * \param X1,Y1,Z1 Output. Coordinates of point on theShape1, nearest to theShape2. * \param X2,Y2,Z2 Output. Coordinates of point on theShape2, nearest to theShape1. * \return Value of the minimal distance between the given shapes. */ double GetMinDistance (in GEOM_Object theShape1, in GEOM_Object theShape2, - out double X1, out double Y1, out double Z1, - out double X2, out double Y2, out double Z2); + out double X1, out double Y1, out double Z1, + out double X2, out double Y2, out double Z2); /*! - * Get angle between the given lines or linear edges. + * \brief Get angle between the given lines or linear edges. * \param theShape1,theShape2 Shapes to find angle between. Lines or linear edges. * \return Value of the angle between the given shapes. */ double GetAngle (in GEOM_Object theShape1, in GEOM_Object theShape2); /*! - * Get point coordinates + * \brief Get angle between the given vectors. + * \param theShape1,theShape2 Vectors to find angle between. + * \return Value of the angle between the given vectors. + */ + double GetAngleBtwVectors (in GEOM_Object theShape1, in GEOM_Object theShape2); + + /*! + * \brief Get point coordinates */ void PointCoordinates (in GEOM_Object theShape, out double X, out double Y, out double Z); /*! - * Get radius of curvature of curve in the point determinated by param + * \brief Get radius of curvature of curve in the point determinated by param * \param theShape - curve. * \param theParam - parameter on curve * \return Value of curvature. @@ -2765,7 +3532,7 @@ module GEOM double CurveCurvatureByParam (in GEOM_Object theShape, in double theParam); /*! - * Get radius of curvature of curve in the given point + * \brief Get radius of curvature of curve in the given point * \param theShape - curve. * \param thePoint - point * \return Value of curvature. @@ -2773,17 +3540,17 @@ module GEOM double CurveCurvatureByPoint (in GEOM_Object theShape, in GEOM_Object thePoint); /*! - * Get max radius of curvature of surface in the point determinated by params + * \brief Get max radius of curvature of surface in the point determinated by params * \param theShape - surface. * \param theUParam - U-parameter on surface * \param theVParam - V-parameter on surface * \return Value of curvature. */ double MaxSurfaceCurvatureByParam (in GEOM_Object theShape, in double theUParam, - in double theVParam); + in double theVParam); /*! - * Get max radius of curvature of surface in the given point + * \brief Get max radius of curvature of surface in the given point * \param theShape - surface. * \param thePoint - point * \return Value of curvature. @@ -2791,17 +3558,17 @@ module GEOM double MaxSurfaceCurvatureByPoint (in GEOM_Object theShape, in GEOM_Object thePoint); /*! - * Get min radius of curvature of surface in the point determinated by params + * \brief Get min radius of curvature of surface in the point determinated by params * \param theShape - surface. * \param theUParam - U-parameter on surface * \param theVParam - V-parameter on surface * \return Value of curvature. */ double MinSurfaceCurvatureByParam (in GEOM_Object theShape, in double theUParam, - in double theVParam); + in double theVParam); /*! - * Get min radius of curvature of surface in the given point + * \brief Get min radius of curvature of surface in the given point * \param theShape - surface. * \param thePoint - point * \return Value of curvature. @@ -2810,93 +3577,267 @@ module GEOM }; - + // # GEOM_IGroupOperations: /*! - * GEOM_IGroupOperations: Interface for groups creation. + * \brief Interface for groups creation. */ interface GEOM_IGroupOperations : GEOM_IOperations { /*! - * Creates a new group which will store sub shapes of theMainShape - * \param theMainShape is a GEOM object on which the group is selected + * \brief Creates a new group which will store sub-shapes of theMainShape + * \param theMainShape is a GEOM_Object on which the group is selected * \param theShapeType defines a shape type of the group * \return a newly created GEOM group */ GEOM_Object CreateGroup (in GEOM_Object theMainShape, in long theShapeType); /*! - * Adds a sub object with ID theSubShapeId to the group - * \param theGroup is a GEOM group to which the new sub shape is added - * \param theSubShapeId is a sub shape ID in the main object. - * \note Use method GEOM_IShapesOperations.GetSubShapeIndex() to get an ID by the sub shape + * \brief Adds a sub-object with ID theSubShapeId to the group + * \param theGroup is a GEOM group to which the new sub-shape is added + * \param theSubShapeId is a sub-shape ID in the main object. + * \note Use method GEOM_IShapesOperations.GetSubShapeIndex() to get an ID by the sub-shape */ void AddObject (in GEOM_Object theGroup, in long theSubShapeId); /*! - * Removes a sub object with ID \a theSubShapeId from the group - * \param theGroup is a GEOM group from which the sub shape is removed. - * \param theSubShapeId is a sub shape ID in the main object. - * \note Use method GEOM_IShapesOperations.GetSubShapeIndex() to get an ID by the sub shape + * \brief Removes a sub-object with ID \a theSubShapeId from the group + * \param theGroup is a GEOM group from which the sub-shape is removed. + * \param theSubShapeId is a sub-shape ID in the main object. + * \note Use method GEOM_IShapesOperations.GetSubShapeIndex() to get an ID by the sub-shape */ void RemoveObject (in GEOM_Object theGroup, in long theSubShapeId); /*! - * Adds to the group all the given shapes. No errors, if some shapes are alredy included. - * \param theGroup is a GEOM group to which the new sub shapes are added. - * \param theSubShapes is a list of sub shapes to be added. + * \brief Adds to the group all the given shapes. No errors, if some shapes are alredy included. + * \param theGroup is a GEOM group to which the new sub-shapes are added. + * \param theSubShapes is a list of sub-shapes to be added. */ void UnionList (in GEOM_Object theGroup, in ListOfGO theSubShapes); /*! - * Removes from the group all the given shapes. No errors, if some shapes are not included. + * \brief Removes from the group all the given shapes. No errors, if some shapes are not included. * \param theGroup is a GEOM group from which the sub-shapes are removed. * \param theSubShapes is a list of sub-shapes to be removed. */ void DifferenceList (in GEOM_Object theGroup, in ListOfGO theSubShapes); /*! - * Adds to the group all the given shapes. No errors, if some shapes are alredy included. - * \param theGroup is a GEOM group to which the new sub shapes are added. - * \param theSubShapes is a list of IDs of sub shapes to be added. + * \brief Adds to the group all the given shapes. No errors, if some shapes are alredy included. + * \param theGroup is a GEOM group to which the new sub-shapes are added. + * \param theSubShapes is a list of IDs of sub-shapes to be added. */ void UnionIDs (in GEOM_Object theGroup, in ListOfLong theSubShapes); /*! - * Removes from the group all the given shapes. No errors, if some shapes are not included. + * \brief Removes from the group all the given shapes. No errors, if some shapes are not included. * \param theGroup is a GEOM group from which the sub-shapes are removed. * \param theSubShapes is a list of IDs of sub-shapes to be removed. */ void DifferenceIDs (in GEOM_Object theGroup, in ListOfLong theSubShapes); /*! - * Returns a type of sub objects stored in the group + * \brief Returns a type of sub-objects stored in the group * \param theGroup is a GEOM group which type is returned. */ long GetType (in GEOM_Object theGroup); /*! - * Returns a main shape associated with the group + * \brief Returns a main shape associated with the group * \param theGroup is a GEOM group for which a main shape object is requested - * \return a GEOM object which is a main shape for theGroup + * \return a GEOM_Object which is a main shape for theGroup */ GEOM_Object GetMainShape (in GEOM_Object theGroup); /*! - * Returns a list of sub objects ID stored in the group + * \brief Returns a list of sub-objects ID stored in the group * \param theGroup is a GEOM group for which a list of IDs is requested */ ListOfLong GetObjects (in GEOM_Object theGroup); }; + // # GEOM_IAdvancedOperations: + /*! + * \brief Interface for advanced modeling functions. + */ + interface GEOM_IAdvancedOperations : GEOM_IOperations + { + /*! + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShape (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in boolean theHexMesh); + /*! + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeWithPosition (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + /*! + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A chamfer is created + * on the junction of the pipes. + * + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theH Height of the chamfer. + * \param theW Width of the chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeChamfer (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theH, in double theW, in boolean theHexMesh); + /*! + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * + * A chamfer is created on the junction of the pipes. + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theH Height of the chamfer. + * \param theW Width of the chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeChamferWithPosition (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theH, in double theW, in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + /*! + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * + * A fillet is created on the junction of the pipes. + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theRF Radius of curvature of fillet. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeFillet (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRF, in boolean theHexMesh); + /*! + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * + * A fillet is created on the junction of the pipes. + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theRF Radius of curvature of fillet. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeFilletWithPosition (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRF, in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + /*! + * This function allows to create a disk already divided into blocks. It + * can be use to create divided pipes for later meshing in hexaedra. + * \param theR Radius of the disk + * \param theRatio Relative size of the central square diagonal against the disk diameter + * \param theOrientation Plane on which the disk will be built + * \return New GEOM_Object, containing the created shape. + */ + GEOM_Object MakeDividedDisk (in double theR, + in double theRatio, + in short theOrientation, + in pattern thePattern); + + /*! + * \brief Create a Disk prepared for hexa meshing with given center, normal vector and radius. + * \param thePnt disk center. + * \param theVec Vector, normal to the plane of the disk. + * \param theR Disk radius. + * \param theRatio Relative size of the central square diagonal against the disk diameter + * \return New GEOM_Object, containing the created disk. + */ + GEOM_Object MakeDividedDiskPntVecR ( in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theR, + in double theRatio, + in pattern thePattern); + + /*! + * Builds a cylinder prepared for hexa meshes + * \param theR Radius of the cylinder + * \param theH Height of the cylinder + * \return New GEOM_Object, containing the created shape. + */ + GEOM_Object MakeDividedCylinder (in double theR, + in double theH, + in pattern thePattern ); + + /*@@ insert new functions before this line @@ do not remove this line @@*/ + }; + // # GEOM_Gen: /*! - * GEOM_Gen: Interface to access other GEOM interfaces. - * Also contains some methods to access and manage GEOM objects. + * \brief Interface to access other GEOM interfaces. + * + * Also contains some methods to access and manage GEOM_Object. */ - interface GEOM_Gen : Engines::Component,SALOMEDS::Driver + interface GEOM_Gen : Engines::EngineComponent,SALOMEDS::Driver { /*! - * Undo/Redo Management + * \brief Undo/Redo Management */ void Undo (in long theStudyID); @@ -2904,58 +3845,112 @@ module GEOM void Redo (in long theStudyID); /*! - * Publishing management + * \brief Publishing management + * * Adds in theStudy a object theObject under with a name theName, * if theFather is not NULL the object is placed under thFather's SObject. * Returns a SObject where theObject is placed */ SALOMEDS::SObject AddInStudy (in SALOMEDS::Study theStudy, - in GEOM_Object theObject, - in string theName, - in GEOM_Object theFather); + in GEOM_Object theObject, + in string theName, + in GEOM_Object theFather); /*! - * Publish sub-shapes, standing for arguments and sub-shapes of arguments + * \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments + * * To be used from python scripts out of geompy.addToStudy (non-default usage) * \param theStudy the study, in which theObject is published already, * and in which the arguments will be published - * \param theObject published GEOM object, arguments of which will be published + * \param theObject published GEOM_Object, arguments of which will be published * \param theArgs list of GEOM_Object, operation arguments to be published. * If this list is empty, all operation arguments will be published - * \param theFindMethod method to search subshapes, corresponding to arguments and - * their subshapes. Value from enumeration GEOM::find_shape_method. + * \param theFindMethod method to search sub-shapes, corresponding to arguments and + * their sub-shapes. Value from enumeration GEOM::find_shape_method. * \param theInheritFirstArg set properties of the first argument for \a theObject. - * Do not publish subshapes in place of arguments, but only - * in place of subshapes of the first argument, + * Do not publish sub-shapes in place of arguments, but only + * in place of sub-shapes of the first argument, * because the whole shape corresponds to the first argument. * Mainly to be used after transformations, but it also can be * usefull after partition with one object shape, and some other * operations, where only the first argument has to be considered. * If theObject has only one argument shape, this flag is automatically * considered as True, not regarding really passed value. - * \return True in case of success, False otherwise. + * \param theAddPrefix add prefix "from_" to names of restored sub-shapes, + * and prefix "from_subshapes_of_" to names of partially restored sub-shapes. + * \return list of published sub-shapes */ - boolean RestoreSubShapesO (in SALOMEDS::Study theStudy, - in GEOM_Object theObject, - in ListOfGO theArgs, - in find_shape_method theFindMethod, - in boolean theInheritFirstArg); + ListOfGO RestoreSubShapesO (in SALOMEDS::Study theStudy, + in GEOM_Object theObject, + in ListOfGO theArgs, + in find_shape_method theFindMethod, + in boolean theInheritFirstArg, + in boolean theAddPrefix); /*! - * Publish sub-shapes, standing for arguments and sub-shapes of arguments - * To be used from GUI and from geompy.addToStudy. - * Work like the above method, but accepts study object theSObject instead of GEOM_Object. - * \param theSObject study object, referencing GEOM object, arguments of which will be published + * \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments + * + * To be used from python scripts out of geompy.addToStudy (non-default usage) + * \param theStudy the study, in which theObject is published already, + * and in which the arguments will be published + * \param theObject published GEOM_Object, arguments of which will be published + * \param theArgs list of GEOM_Object, operation arguments to be published. + * If this list is empty, all operation arguments will be published + * \param theFindMethod method to search sub-shapes, corresponding to arguments and + * their sub-shapes. Value from enumeration GEOM::find_shape_method. + * \param theInheritFirstArg set properties of the first argument for \a theObject. + * Do not publish sub-shapes in place of arguments, but only + * in place of sub-shapes of the first argument, + * because the whole shape corresponds to the first argument. + * Mainly to be used after transformations, but it also can be + * usefull after partition with one object shape, and some other + * operations, where only the first argument has to be considered. + * If theObject has only one argument shape, this flag is automatically + * considered as True, not regarding really passed value. + * \param theAddPrefix add prefix "from_" to names of restored sub-shapes, + * and prefix "from_subshapes_of_" to names of partially restored sub-shapes. + * \return list of published sub-shapes */ - boolean RestoreSubShapesSO (in SALOMEDS::Study theStudy, - in SALOMEDS::SObject theSObject, - in ListOfGO theArgs, - in find_shape_method theFindMethod, - in boolean theInheritFirstArg); + ListOfGO RestoreGivenSubShapesO (in SALOMEDS::Study theStudy, + in GEOM_Object theObject, + in ListOfGO theArgs, + in find_shape_method theFindMethod, + in boolean theInheritFirstArg, + in boolean theAddPrefix); /*! - * Methods to access interfaces for objects creation and transformation + * \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments + * + * To be used from GUI and from geompy.addToStudy. + * Work like the above method, but accepts study object theSObject instead of GEOM_Object. + * \param theStudy the study, in which theObject is published already, + * and in which the arguments will be published + * \param theSObject study object, referencing GEOM_Object, arguments of which will be published + * \param theArgs list of GEOM_Object, operation arguments to be published. + * If this list is empty, all operation arguments will be published + * \param theFindMethod method to search sub-shapes, corresponding to arguments and + * their sub-shapes. Value from enumeration GEOM::find_shape_method. + * \param theInheritFirstArg set properties of the first argument for \a theObject. + * Do not publish sub-shapes in place of arguments, but only + * in place of sub-shapes of the first argument, + * because the whole shape corresponds to the first argument. + * Mainly to be used after transformations, but it also can be + * usefull after partition with one object shape, and some other + * operations, where only the first argument has to be considered. + * If theObject has only one argument shape, this flag is automatically + * considered as True, not regarding really passed value. + * \param theAddPrefix add prefix "from_" to names of restored sub-shapes, + * and prefix "from_subshapes_of_" to names of partially restored sub-shapes. */ + ListOfGO RestoreSubShapesSO (in SALOMEDS::Study theStudy, + in SALOMEDS::SObject theSObject, + in ListOfGO theArgs, + in find_shape_method theFindMethod, + in boolean theInheritFirstArg, + in boolean theAddPrefix); + + // # 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); @@ -2968,61 +3963,68 @@ 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 - */ + // # Objects Management + /*! - * Removes the object from the GEOM component - * \param theObject is a GEOM object to be removed + * \brief Removes the object from the GEOM component + * \param theObject is a GEOM_Object to be removed */ void RemoveObject (in GEOM_Object theObject); /*! - * Returns an object defined by the study and its entry in the GEOM component + * \brief Returns an object defined by the study and its entry in the GEOM component * \param theStudyID is a SALOMEDS Study ID - * \param theEntry is an entry of the requested GEOM object in the GEOM component - * \note if the object has not previously been created a NULL GEOM object is returned + * \param theEntry is an entry of the requested GEOM_Object in the GEOM component + * \note if the object has not previously been created a NULL GEOM_Object is returned */ GEOM_Object GetObject (in long theStudyID, in string theEntry); /*! - * Add a sub shape defined by indices in \a theIndices - * (contains unique IDs of sub shapes inside theMainShape) - * \note The sub shape GEOM_Objects can has ONLY ONE function. + * \brief Add a sub-shape defined by indices in \a theIndices + * (contains unique IDs of sub-shapes inside \a theMainShape) + * \note The sub-shape GEOM_Object can has ONLY ONE function. * Don't try to apply modification operations on them. * \note Internal method */ GEOM_Object AddSubShape (in GEOM_Object theMainShape, in ListOfLong theIndices); + // # GEOM_Objects IOR Management + /*! - * GEOM object's IOR Management - */ - - /*! - * Returns a GEOM Object defined by its IOR - * \param theIOR a string containg an IOR of the requested GEOM object + * \brief Returns a GEOM_Object defined by its IOR + * \param theIOR a string containg an IOR of the requested GEOM_Object */ GEOM_Object GetIORFromString (in string theIOR); /*! - * Returns a string which contains an IOR of the GEOM object - * \param theObject is a GEOM object which IOR is requested + * \brief Returns a string which contains an IOR of the GEOM_Object + * \param theObject is a GEOM_Object which IOR is requested */ string GetStringFromIOR (in GEOM_Object theObject); /*! - * Returns a name with which a GEOM object was dumped into python script - * \param theStudyEntry is an entry of the GEOM object in the study + * \brief Returns a name with which a GEOM_Object was dumped into python script + * \param theStudyEntry is an entry of the GEOM_Object in the study */ string GetDumpName (in string theStudyEntry); /*! - * Returns all names with which a GEOM objects was dumped + * \brief Returns all names with which a GEOM_Object was dumped * into python script to avoid the same names in SMESH script */ string_array GetAllDumpNames(); + + /*! + * \brief Publishes the named sub-shapes of given object in the study. + * \param theStudy The study in which the object is published + * \param theObject The object which named sub-shapes are published + */ + ListOfGO PublishNamedShapesInStudy(in SALOMEDS::Study theStudy, + //in SObject theSObject, + in Object theObject); }; }; diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 4690e7e7e..36c204b1d 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -1,27 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : GEOM_Superv.idl // Author : Lucien PIGNOLONI -// + #ifndef __GEOM_SUPERV__ #define __GEOM_SUPERV__ @@ -32,301 +32,318 @@ module GEOM interface GEOM_List { }; - interface GEOM_Superv : Engines::Component,SALOMEDS::Driver + interface GEOM_Superv : Engines::EngineComponent,SALOMEDS::Driver { //-----------------------------------------------------------// - // Set current study ID // + // Set current study ID // //-----------------------------------------------------------// void SetStudyID (in long theStudyID) ; - + //-----------------------------------------------------------// - // Create ListOfGO and add items to it // + // Create ListOfGO and add items to it // //-----------------------------------------------------------// GEOM_List CreateListOfGO(); - void AddItemToListOfGO( inout GEOM_List theList, - in GEOM_Object theObject); + void AddItemToListOfGO( inout GEOM_List theList, + in GEOM_Object theObject); //-----------------------------------------------------------// - // Create ListOfLong and add items to it // + // Create ListOfLong and add items to it // //-----------------------------------------------------------// GEOM_List CreateListOfLong(); - void AddItemToListOfLong( inout GEOM_List theList, - in long theObject); + void AddItemToListOfLong( inout GEOM_List theList, + in long theObject); //-----------------------------------------------------------// - // Create ListOfDouble and add items to it // + // Create ListOfDouble and add items to it // //-----------------------------------------------------------// GEOM_List CreateListOfDouble(); - void AddItemToListOfDouble( inout GEOM_List theList, - in double theObject); + void AddItemToListOfDouble( inout GEOM_List theList, + in double theObject); //-----------------------------------------------------------// - // Primitives Construction : BasicOperations // + // Primitives Construction : BasicOperations // //-----------------------------------------------------------// GEOM_Object MakePointXYZ (in double theX, - in double theY, - in double theZ) ; + in double theY, + in double theZ); GEOM_Object MakePointWithReference (in GEOM_Object theReference, - in double theX, - in double theY, - in double theZ) ; + in double theX, + in double theY, + in double theZ); GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, - in double theParameter) ; + in double theParameter); + GEOM_Object MakePointOnCurveByLength (in GEOM_Object theRefCurve, + in double theLength, + in GEOM_Object theStartPoint); GEOM_Object MakeTangentOnCurve (in GEOM_Object theRefCurve, - in double theParameter); + in double theParameter); GEOM_Object MakeVectorDXDYDZ (in double theDX, - in double theDY, - in double theDZ) ; + in double theDY, + in double theDZ) ; GEOM_Object MakeVectorTwoPnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2) ; + in GEOM_Object thePnt2) ; GEOM_Object MakeLineTwoPnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2) ; + in GEOM_Object thePnt2) ; GEOM_Object MakeLineTwoFaces (in GEOM_Object theFace1, - in GEOM_Object theFace2) ; + in GEOM_Object theFace2) ; GEOM_Object MakePlaneThreePnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3, - in double theTrimSize) ; + in GEOM_Object thePnt2, + in GEOM_Object thePnt3, + in double theTrimSize) ; GEOM_Object MakePlanePntVec (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theTrimSize) ; + in GEOM_Object theVec, + in double theTrimSize) ; GEOM_Object MakePlaneFace (in GEOM_Object theFace, - in double theTrimSize) ; + in double theTrimSize) ; + GEOM_Object MakePlane2Vec (in GEOM_Object theVec1, + in GEOM_Object theVec2, + in double theTrimSize) ; + GEOM_Object MakePlaneLCS (in GEOM_Object theLCS, + in double theTrimSize, + in double theOrientation) ; GEOM_Object MakeMarker (in double theOX , in double theOY , in double theOZ, - in double theXDX, in double theXDY, in double theXDZ, - in double theYDX, in double theYDY, in double theYDZ) ; + in double theXDX, in double theXDY, in double theXDZ, + in double theYDX, in double theYDY, in double theYDZ) ; + + GEOM_Object MakeMarkerFromShape (in GEOM_Object theShape) ; + + GEOM_Object MakeMarkerPntTwoVec (in GEOM_Object theOrigin, + in GEOM_Object theXVec, + in GEOM_Object theYVec) ; /*! * Create a tangent plane to specified face in the point with specified parameters. * Values of parameters should be between 0. and 1.0 - * \param theFace - face for which tangent plane shuold be built. + * \param theFace - face for which tangent plane shuold be built. * \param theParameterU - value of parameter by U * \param theParameterV - value of parameter Vthe * \param theTrimSize - defines sizes of created face * \return New GEOM_Object, containing the face built on tangent plane. */ GEOM_Object MakeTangentPlaneOnFace(in GEOM_Object theFace, - in double theParameterU, - in double theParameterV, - in double theTrimSize); + in double theParameterU, + in double theParameterV, + in double theTrimSize); //-----------------------------------------------------------// // Primitives Construction : 3DPrimOperations // //-----------------------------------------------------------// GEOM_Object MakeBox (in double theX1, - in double theY1, - in double theZ1, - in double theX2, - in double theY2, - in double theZ2) ; - GEOM_Object MakeBoxDXDYDZ (in double theDX, - in double theDY, - in double theDZ) ; - GEOM_Object MakeBoxTwoPnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2) ; - GEOM_Object MakeFaceHW (in double theH, - in double theW, - in short theOrientation) ; - GEOM_Object MakeFaceObjHW (in GEOM_Object theObj, - in double theH, - in double theW) ; + in double theY1, + in double theZ1, + in double theX2, + in double theY2, + in double theZ2) ; + GEOM_Object MakeBoxDXDYDZ (in double theDX, + in double theDY, + in double theDZ) ; + GEOM_Object MakeBoxTwoPnt (in GEOM_Object thePnt1, + in GEOM_Object thePnt2) ; + GEOM_Object MakeFaceHW (in double theH, + in double theW, + in short theOrientation) ; + GEOM_Object MakeFaceObjHW (in GEOM_Object theObj, + in double theH, + in double theW) ; GEOM_Object MakeDiskPntVecR (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theR) ; + in GEOM_Object theVec, + in double theR) ; GEOM_Object MakeDiskThreePnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3) ; - GEOM_Object MakeDiskR (in double theR, - in short theOrientation) ; + in GEOM_Object thePnt2, + in GEOM_Object thePnt3) ; + GEOM_Object MakeDiskR (in double theR, + in short theOrientation) ; GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt, - in GEOM_Object theAxis, - in double theRadius, - in double theHeight) ; - GEOM_Object MakeCylinderRH (in double theR, - in double theH) ; + in GEOM_Object theAxis, + in double theRadius, + in double theHeight) ; + GEOM_Object MakeCylinderRH (in double theR, + in double theH) ; GEOM_Object MakeSphere (in double theX, - in double theY, - in double theZ, - in double theRadius) ; + in double theY, + in double theZ, + in double theRadius) ; GEOM_Object MakeSphereR (in double theR) ; - GEOM_Object MakeSpherePntR (in GEOM_Object thePnt, - in double theR) ; + GEOM_Object MakeSpherePntR (in GEOM_Object thePnt, + in double theR) ; GEOM_Object MakeTorusPntVecRR (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theRMajor, - in double theRMinor) ; + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor) ; GEOM_Object MakeTorusRR (in double theRMajor, - in double theRMinor) ; + in double theRMinor) ; GEOM_Object MakeConePntVecR1R2H (in GEOM_Object thePnt, - in GEOM_Object theAxis, - in double theR1, - in double theR2, - in double theHeight) ; - GEOM_Object MakeConeR1R2H (in double theR1, - in double theR2, - in double theHeight) ; + in GEOM_Object theAxis, + in double theR1, + in double theR2, + in double theHeight) ; + GEOM_Object MakeConeR1R2H (in double theR1, + in double theR2, + in double theHeight) ; GEOM_Object MakePrismVecH (in GEOM_Object theBase, - in GEOM_Object theVec, - in double theH) ; + in GEOM_Object theVec, + in double theH) ; GEOM_Object MakePrismVecH2Ways (in GEOM_Object theBase, - in GEOM_Object theVec, - in double theH) ; + in GEOM_Object theVec, + in double theH) ; GEOM_Object MakePrismTwoPnt (in GEOM_Object theBase, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2) ; + in GEOM_Object thePoint1, + in GEOM_Object thePoint2) ; GEOM_Object MakePrismTwoPnt2Ways (in GEOM_Object theBase, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2) ; - GEOM_Object MakePipe (in GEOM_Object theBase, - in GEOM_Object thePath) ; + in GEOM_Object thePoint1, + in GEOM_Object thePoint2) ; + GEOM_Object MakePipe (in GEOM_Object theBase, + in GEOM_Object thePath) ; GEOM_Object MakeRevolutionAxisAngle (in GEOM_Object theBase, - in GEOM_Object theAxis, - in double theAngle) ; + in GEOM_Object theAxis, + in double theAngle) ; GEOM_Object MakeRevolutionAxisAngle2Ways (in GEOM_Object theBase, - in GEOM_Object theAxis, - in double theAngle) ; + in GEOM_Object theAxis, + in double theAngle) ; GEOM_Object MakeFilling (in GEOM_Object theShape, - in long theMinDeg, in long theMaxDeg, - in double theTol2D, in double theTol3D, - in long theNbIter, in boolean theApprox) ; + in long theMinDeg, in long theMaxDeg, + in double theTol2D, in double theTol3D, + in long theNbIter, + in filling_oper_method theMethod, + in boolean theApprox) ; GEOM_Object MakeThruSections(in ListOfGO theSeqSections, - in boolean theModeSolid, - in double thePreci, + in boolean theModeSolid, + in double thePreci, in boolean theRuled); GEOM_Object MakePipeWithDifferentSections (in ListOfGO theSeqBases, - in ListOfGO theLocations, - in GEOM_Object thePath, - in boolean theWithContact , - in boolean theWithCorrection ); - + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); + GEOM_Object MakePipeWithShellSections (in ListOfGO theSeqBases, - in ListOfGO theSeqSubBases, - in ListOfGO theLocations, - in GEOM_Object thePath, - in boolean theWithContact , - in boolean theWithCorrection ); - + in ListOfGO theSeqSubBases, + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); + GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases, - in ListOfGO theLocations ); + in ListOfGO theLocations ); - GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase, - in GEOM_Object thePath, - in GEOM_Object theVec); + GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase, + in GEOM_Object thePath, + in GEOM_Object theVec); //-----------------------------------------------------------// // BooleanOperations // //-----------------------------------------------------------// GEOM_Object MakeBoolean (in GEOM_Object theShape1, - in GEOM_Object theShape2, - in long theOperation) ; + in GEOM_Object theShape2, + in long theOperation) ; GEOM_Object MakeFuse (in GEOM_Object theShape1, - in GEOM_Object theShape2) ; + in GEOM_Object theShape2) ; GEOM_Object MakePartition (in GEOM_List theShapes, - in GEOM_List theTools, - in GEOM_List theKeepInside, - in GEOM_List theRemoveInside, - in short theLimit, - in boolean theRemoveWebs, - in GEOM_List theMaterials, - in short theKeepNonlimitShapes); + in GEOM_List theTools, + in GEOM_List theKeepInside, + in GEOM_List theRemoveInside, + in short theLimit, + in boolean theRemoveWebs, + in GEOM_List theMaterials, + in short theKeepNonlimitShapes); GEOM_Object MakeHalfPartition (in GEOM_Object theShape, - in GEOM_Object thePlane) ; + in GEOM_Object thePlane) ; //-----------------------------------------------------------// // InsertOperations // //-----------------------------------------------------------// GEOM_Object MakeCopy (in GEOM_Object theOriginal) ; void Export (in GEOM_Object theObject, in string theFileName, in string theFormatName) ; - GEOM_Object Import (in string theFileName, in string theFormatName) ; + GEOM_Object ImportFile (in string theFileName, in string theFormatName) ; void ImportTranslators (out string_array theFormats, - out string_array thePatterns) ; + out string_array thePatterns) ; void ExportTranslators (out string_array theFormats, - out string_array thePatterns) ; + out string_array thePatterns) ; //-----------------------------------------------------------// // TransformOperations // //-----------------------------------------------------------// GEOM_Object TranslateTwoPoints (in GEOM_Object theObject, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2) ; + in GEOM_Object thePoint1, + in GEOM_Object thePoint2) ; GEOM_Object TranslateTwoPointsCopy (in GEOM_Object theObject, - in GEOM_Object thePoint1, + in GEOM_Object thePoint1, in GEOM_Object thePoint2) ; GEOM_Object TranslateDXDYDZ (in GEOM_Object theObject, - in double theDX, - in double theDY, - in double theDZ) ; + in double theDX, + in double theDY, + in double theDZ) ; GEOM_Object TranslateDXDYDZCopy (in GEOM_Object theObject, - in double theDX, - in double theDY, - in double theDZ) ; + in double theDX, + in double theDY, + in double theDZ) ; GEOM_Object TranslateVector (in GEOM_Object theObject, - in GEOM_Object theVector) ; + in GEOM_Object theVector) ; GEOM_Object TranslateVectorCopy (in GEOM_Object theObject, - in GEOM_Object theVector) ; + in GEOM_Object theVector) ; GEOM_Object TranslateVectorDistance (in GEOM_Object theObject, - in GEOM_Object theVector, - in double theDistance, - in boolean theCopy) ; + in GEOM_Object theVector, + in double theDistance, + in boolean theCopy) ; GEOM_Object MultiTranslate1D (in GEOM_Object theObject, - in GEOM_Object theVector, - in double theStep, - in long theNbTimes) ; + in GEOM_Object theVector, + in double theStep, + in long theNbTimes) ; GEOM_Object MultiTranslate2D (in GEOM_Object theObject, - in GEOM_Object theVector1, - in double theStep1, - in long theNbTimes1, - in GEOM_Object theVector2, - in double theStep2, - in long theNbTimes2) ; + in GEOM_Object theVector1, + in double theStep1, + in long theNbTimes1, + in GEOM_Object theVector2, + in double theStep2, + in long theNbTimes2) ; GEOM_Object Rotate (in GEOM_Object theObject, - in GEOM_Object theAxis, - in double theAngle) ; + in GEOM_Object theAxis, + in double theAngle) ; GEOM_Object RotateCopy (in GEOM_Object theObject, - in GEOM_Object theAxis, - in double theAngle) ; + in GEOM_Object theAxis, + in double theAngle) ; GEOM_Object RotateThreePoints (in GEOM_Object theObject, - in GEOM_Object theCentPoint, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); + in GEOM_Object theCentPoint, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); GEOM_Object RotateThreePointsCopy (in GEOM_Object theObject, - in GEOM_Object theCentPoint, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2); + in GEOM_Object theCentPoint, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); GEOM_Object MultiRotate1D (in GEOM_Object theObject, - in GEOM_Object theAxis, - in long theNbTimes) ; + in GEOM_Object theAxis, + in long theNbTimes) ; GEOM_Object MultiRotate2D (in GEOM_Object theObject, - in GEOM_Object theAxis, - in double theAngle, - in long theNbTimes1, - in double theStep, - in long theNbTimes2) ; - GEOM_Object MirrorPlane (in GEOM_Object theObject, - in GEOM_Object thePlane) ; - GEOM_Object MirrorPlaneCopy (in GEOM_Object theObject, - in GEOM_Object thePlane) ; - GEOM_Object MirrorAxis (in GEOM_Object theObject, - in GEOM_Object theAxis) ; - GEOM_Object MirrorAxisCopy (in GEOM_Object theObject, - in GEOM_Object theAxis) ; - GEOM_Object MirrorPoint (in GEOM_Object theObject, - in GEOM_Object thePoint) ; - GEOM_Object MirrorPointCopy (in GEOM_Object theObject, - in GEOM_Object thePoint) ; - GEOM_Object OffsetShape (in GEOM_Object theObject, - in double theOffset) ; - GEOM_Object OffsetShapeCopy (in GEOM_Object theObject, - in double theOffset) ; - GEOM_Object ScaleShape (in GEOM_Object theObject, - in GEOM_Object thePoint, - in double theFactor) ; - GEOM_Object ScaleShapeCopy (in GEOM_Object theObject, - in GEOM_Object thePoint, - in double theFactor) ; + in GEOM_Object theAxis, + in double theAngle, + in long theNbTimes1, + in double theStep, + in long theNbTimes2) ; + GEOM_Object MirrorPlane (in GEOM_Object theObject, + in GEOM_Object thePlane) ; + GEOM_Object MirrorPlaneCopy (in GEOM_Object theObject, + in GEOM_Object thePlane) ; + GEOM_Object MirrorAxis (in GEOM_Object theObject, + in GEOM_Object theAxis) ; + GEOM_Object MirrorAxisCopy (in GEOM_Object theObject, + in GEOM_Object theAxis) ; + GEOM_Object MirrorPoint (in GEOM_Object theObject, + in GEOM_Object thePoint) ; + GEOM_Object MirrorPointCopy (in GEOM_Object theObject, + in GEOM_Object thePoint) ; + GEOM_Object OffsetShape (in GEOM_Object theObject, + in double theOffset) ; + GEOM_Object OffsetShapeCopy (in GEOM_Object theObject, + in double theOffset) ; + GEOM_Object ScaleShape (in GEOM_Object theObject, + in GEOM_Object thePoint, + in double theFactor) ; + GEOM_Object ScaleShapeCopy (in GEOM_Object theObject, + in GEOM_Object thePoint, + in double theFactor) ; GEOM_Object ScaleShapeAlongAxes (in GEOM_Object theObject, in GEOM_Object thePoint, in double theFactorX, @@ -338,225 +355,276 @@ module GEOM in double theFactorY, in double theFactorZ); GEOM_Object PositionShape (in GEOM_Object theObject, - in GEOM_Object theStartLCS, - in GEOM_Object theEndLCS) ; + in GEOM_Object theStartLCS, + in GEOM_Object theEndLCS) ; GEOM_Object PositionShapeCopy (in GEOM_Object theObject, - in GEOM_Object theStartLCS, - in GEOM_Object theEndLCS) ; + in GEOM_Object theStartLCS, + in GEOM_Object theEndLCS) ; GEOM_Object PositionAlongPath (in GEOM_Object theObject, - in GEOM_Object thePath, - in double theDistance, - in boolean theCopy, - in boolean theReverse); + in GEOM_Object thePath, + in double theDistance, + in boolean theCopy, + in boolean theReverse); //-----------------------------------------------------------// // ShapesOperations // //-----------------------------------------------------------// - GEOM_Object MakeEdge (in GEOM_Object thePnt1, - in GEOM_Object thePnt2) ; - GEOM_Object MakeWire (in GEOM_List theEdgesAndWires) ; - GEOM_Object MakeFace (in GEOM_Object theWire, - in boolean isPlanarWanted) ; - GEOM_Object MakeFaceWires (in GEOM_List theWires, - in boolean isPlanarWanted) ; + GEOM_Object MakeEdge (in GEOM_Object thePnt1, + in GEOM_Object thePnt2) ; + GEOM_Object MakeEdgeOnCurveByLength (in GEOM_Object theRefCurve, + in double theLength, + in GEOM_Object theStartPoint); + GEOM_Object MakeWire (in GEOM_List theEdgesAndWires, + in double theTolerance) ; + GEOM_Object MakeFace (in GEOM_Object theWire, + in boolean isPlanarWanted) ; + GEOM_Object MakeFaceWires (in GEOM_List theWires, + in boolean isPlanarWanted) ; GEOM_Object MakeShell (in GEOM_List theFacesAndShells) ; GEOM_Object MakeSolidShell (in GEOM_Object theShell) ; GEOM_Object MakeSolidShells (in GEOM_List theShells) ; GEOM_Object MakeCompound (in GEOM_List theShapes) ; - GEOM_Object MakeGlueFaces (in GEOM_Object theShape, - in double theTolerance, - in boolean doKeepNonSolids); - GEOM_List GetGlueFaces (in GEOM_Object theShape, - in double theTolerance); - GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, - in double theTolerance, - in ListOfGO theFaces, - in boolean doKeepNonSolids); + GEOM_Object MakeGlueFaces (in GEOM_Object theShape, + in double theTolerance, + in boolean doKeepNonSolids); + GEOM_List GetGlueFaces (in GEOM_Object theShape, + in double theTolerance); + GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, + in double theTolerance, + in ListOfGO theFaces, + in boolean doKeepNonSolids, + in boolean doGlueAllEdges); GEOM_List MakeExplode (in GEOM_Object theShape, - in long theShapeType, - in boolean isSorted) ; + in long theShapeType, + in boolean isSorted) ; long NumberOfFaces (in GEOM_Object theShape) ; long NumberOfEdges (in GEOM_Object theShape) ; GEOM_Object ChangeOrientation (in GEOM_Object theShape) ; GEOM_List GetShapesOnShape (in GEOM_Object theCheckShape, - in GEOM_Object theShape, - in short theShapeType, - in shape_state theState); + in GEOM_Object theShape, + in short theShapeType, + in shape_state theState); GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape, - in GEOM_Object theShape, - in short theShapeType, - in shape_state theState); + in GEOM_Object theShape, + in short theShapeType, + in shape_state theState); //-----------------------------------------------------------// // BlocksOperations // //-----------------------------------------------------------// GEOM_Object MakeQuad4Vertices (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3, - in GEOM_Object thePnt4) ; + in GEOM_Object thePnt2, + in GEOM_Object thePnt3, + in GEOM_Object thePnt4) ; GEOM_Object MakeQuad (in GEOM_Object theEdge1, - in GEOM_Object theEdge2, - in GEOM_Object theEdge3, - in GEOM_Object theEdge4) ; + in GEOM_Object theEdge2, + in GEOM_Object theEdge3, + in GEOM_Object theEdge4) ; GEOM_Object MakeQuad2Edges (in GEOM_Object theEdge1, - in GEOM_Object theEdge2) ; + in GEOM_Object theEdge2) ; GEOM_Object MakeHexa (in GEOM_Object theFace1, - in GEOM_Object theFace2, - in GEOM_Object theFace3, - in GEOM_Object theFace4, - in GEOM_Object theFace5, - in GEOM_Object theFace6) ; + in GEOM_Object theFace2, + in GEOM_Object theFace3, + in GEOM_Object theFace4, + in GEOM_Object theFace5, + in GEOM_Object theFace6) ; GEOM_Object MakeHexa2Faces (in GEOM_Object theFace1, - in GEOM_Object theFace2) ; + in GEOM_Object theFace2) ; GEOM_Object GetPoint (in GEOM_Object theShape, - in double theX, - in double theY, - in double theZ, - in double theEpsilon) ; + in double theX, + in double theY, + in double theZ, + in double theEpsilon) ; GEOM_Object GetEdge (in GEOM_Object theShape, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2) ; + in GEOM_Object thePoint1, + in GEOM_Object thePoint2) ; GEOM_Object GetEdgeNearPoint (in GEOM_Object theShape, - in GEOM_Object thePoint) ; + in GEOM_Object thePoint) ; GEOM_Object GetFaceByPoints (in GEOM_Object theShape, - in GEOM_Object thePoint1, - in GEOM_Object thePoint2, - in GEOM_Object thePoint3, - in GEOM_Object thePoint4) ; + in GEOM_Object thePoint1, + in GEOM_Object thePoint2, + in GEOM_Object thePoint3, + in GEOM_Object thePoint4) ; GEOM_Object GetFaceByEdges (in GEOM_Object theShape, - in GEOM_Object theEdge1, - in GEOM_Object theEdge2) ; + in GEOM_Object theEdge1, + in GEOM_Object theEdge2) ; GEOM_Object GetOppositeFace (in GEOM_Object theBlock, - in GEOM_Object theFace) ; + in GEOM_Object theFace) ; GEOM_Object GetFaceNearPoint (in GEOM_Object theShape, - in GEOM_Object thePoint) ; + in GEOM_Object thePoint) ; GEOM_Object GetFaceByNormale (in GEOM_Object theBlock, - in GEOM_Object theVector) ; + in GEOM_Object theVector) ; boolean IsCompoundOfBlocks (in GEOM_Object theCompound, - in long theMinNbFaces, - in long theMaxNbFaces, - out long theNbBlocks) ; + in long theMinNbFaces, + in long theMaxNbFaces, + out long theNbBlocks) ; boolean CheckCompoundOfBlocks (in GEOM_Object theCompound, - out GEOM_IBlocksOperations::BCErrors theErrors) ; + out GEOM_IBlocksOperations::BCErrors theErrors) ; string PrintBCErrors (in GEOM_Object theCompound, - in GEOM_IBlocksOperations::BCErrors theErrors) ; + in GEOM_IBlocksOperations::BCErrors theErrors) ; GEOM_List ExplodeCompoundOfBlocks (in GEOM_Object theCompound, - in long theMinNbFaces, - in long theMaxNbFaces) ; + in long theMinNbFaces, + in long theMaxNbFaces) ; GEOM_Object GetBlockNearPoint (in GEOM_Object theCompound, - in GEOM_Object thePoint) ; + in GEOM_Object thePoint) ; GEOM_Object GetBlockByParts (in GEOM_Object theCompound, - in GEOM_List theParts) ; + in GEOM_List theParts) ; GEOM_List GetBlocksByParts (in GEOM_Object theCompound, - in GEOM_List theParts) ; + in GEOM_List theParts) ; GEOM_Object MakeMultiTransformation1D (in GEOM_Object theBlock, - in long theDirFace1, - in long theDirFace2, - in long theNbTimes) ; + in long theDirFace1, + in long theDirFace2, + in long theNbTimes) ; GEOM_Object MakeMultiTransformation2D (in GEOM_Object theBlock, - in long theDirFace1U, - in long theDirFace2U, - in long theNbTimesU, - in long theDirFace1V, - in long theDirFace2V, - in long theNbTimesV) ; + in long theDirFace1U, + in long theDirFace2U, + in long theNbTimesU, + in long theDirFace1V, + in long theDirFace2V, + in long theNbTimesV) ; //-----------------------------------------------------------// // CurvesOperations // //-----------------------------------------------------------// GEOM_Object MakeCirclePntVecR (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theR) ; + in GEOM_Object theVec, + in double theR) ; GEOM_Object MakeCircleThreePnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3) ; + in GEOM_Object thePnt2, + in GEOM_Object thePnt3) ; GEOM_Object MakeCircleCenter2Pnt (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3) ; + in GEOM_Object thePnt2, + in GEOM_Object thePnt3) ; GEOM_Object MakeEllipse (in GEOM_Object thePnt, - in GEOM_Object theVec, - in double theRMajor, - in double theRMinor) ; + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor) ; + GEOM_Object MakeEllipseVec (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor, + in GEOM_Object theVecMaj) ; GEOM_Object MakeArc (in GEOM_Object thePnt1, - in GEOM_Object thePnt2, - in GEOM_Object thePnt3) ; + in GEOM_Object thePnt2, + in GEOM_Object thePnt3) ; GEOM_Object MakeArcCenter (in GEOM_Object theCenter, in GEOM_Object thePnt1, in GEOM_Object thePnt2, in boolean theSense) ; GEOM_Object MakeArcOfEllipse (in GEOM_Object theCenter, - in GEOM_Object thePnt1, - in GEOM_Object thePnt2) ; - GEOM_Object MakePolyline (in GEOM_List thePoints) ; - GEOM_Object MakeSplineBezier (in GEOM_List thePoints) ; - GEOM_Object MakeSplineInterpolation (in GEOM_List thePoints) ; - GEOM_Object MakeSketcher (in string theCommand, - in GEOM_List theWorkingPlane) ; - + in GEOM_Object thePnt1, + in GEOM_Object thePnt2) ; + GEOM_Object MakePolyline (in GEOM_List thePoints, + in boolean theIsClosed) ; + GEOM_Object MakeSplineBezier (in GEOM_List thePoints, + in boolean theIsClosed) ; + GEOM_Object MakeSplineInterpolation (in GEOM_List thePoints, + in boolean theIsClosed, + in boolean theDoReordering) ; + GEOM_Object MakeSketcher (in string theCommand, + in GEOM_List theWorkingPlane) ; + //-----------------------------------------------------------// // LocalOperations // //-----------------------------------------------------------// GEOM_Object MakeFilletAll (in GEOM_Object theShape, - in double theR) ; + in double theR) ; GEOM_Object MakeFilletEdges (in GEOM_Object theShape, - in double theR, - in GEOM_List theEdges) ; + in double theR, + in GEOM_List theEdges) ; GEOM_Object MakeFilletEdgesR1R2 (in GEOM_Object theShape, - in double theR1, - in double theR2, - in GEOM_List theEdges) ; + in double theR1, + in double theR2, + in GEOM_List theEdges) ; GEOM_Object MakeFilletFaces (in GEOM_Object theShape, - in double theR, - in GEOM_List theFaces) ; + in double theR, + in GEOM_List theFaces) ; GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape, - in double theR1, - in double theR2, - in GEOM_List theFaces) ; + in double theR1, + in double theR2, + in GEOM_List theFaces) ; GEOM_Object MakeFillet2D (in GEOM_Object theShape, - in double theR, - in GEOM_List theVertexes) ; + in double theR, + in GEOM_List theVertexes) ; GEOM_Object MakeChamferAll (in GEOM_Object theShape, - in double theD) ; + in double theD) ; GEOM_Object MakeChamferEdge (in GEOM_Object theShape, - in double theD1, in double theD2, - in long theFace1, in long theFace2) ; + in double theD1, in double theD2, + in long theFace1, in long theFace2) ; GEOM_Object MakeChamferEdgeAD (in GEOM_Object theShape, - in double theD, in double theAngle, - in long theFace1, in long theFace2) ; + in double theD, in double theAngle, + in long theFace1, in long theFace2) ; GEOM_Object MakeChamferFaces (in GEOM_Object theShape, - in double theD1, in double theD2, - in GEOM_List theFaces) ; + in double theD1, in double theD2, + in GEOM_List theFaces) ; GEOM_Object MakeChamferFacesAD (in GEOM_Object theShape, - in double theD, in double theAngle, - in GEOM_List theFaces) ; + in double theD, in double theAngle, + in GEOM_List theFaces) ; GEOM_Object MakeChamferEdges (in GEOM_Object theShape, - in double theD1, in double theD2, - in GEOM_List theEdges) ; + in double theD1, in double theD2, + in GEOM_List theEdges) ; GEOM_Object MakeChamferEdgesAD (in GEOM_Object theShape, - in double theD, in double theAngle, - in GEOM_List theEdges) ; + in double theD, in double theAngle, + in GEOM_List theEdges) ; GEOM_Object MakeArchimede (in GEOM_Object theShape, - in double theWeight, - in double theWaterDensity, - in double theMeshDeflection) ; - long GetSubShapeIndex (in GEOM_Object theShape, - in GEOM_Object theSubShape) ; + in double theWeight, + in double theWaterDensity, + in double theMeshDeflection) ; + long GetSubShapeIndex (in GEOM_Object theShape, + in GEOM_Object theSubShape) ; //-----------------------------------------------------------// // GroupOperations // //-----------------------------------------------------------// - GEOM_Object CreateGroup (in GEOM_Object theMainShape, - in long theShapeType) ; - void AddObject (in GEOM_Object theGroup, - in long theSubShapeId) ; - void RemoveObject (in GEOM_Object theGroup, - in long theSubShapeId) ; + GEOM_Object CreateGroup (in GEOM_Object theMainShape, + in long theShapeType) ; + void AddObject (in GEOM_Object theGroup, + in long theSubShapeId) ; + void RemoveObject (in GEOM_Object theGroup, + in long theSubShapeId) ; long GetType (in GEOM_Object theGroup) ; GEOM_Object GetMainShape(in GEOM_Object theGroup) ; GEOM_List GetObjects(in GEOM_Object theGroup) ; - }; + //-----------------------------------------------------------// + // AdvancedOperations // + //-----------------------------------------------------------// + GEOM_List MakePipeTShape (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in boolean theHexMesh); + + GEOM_List MakePipeTShapeWithPosition (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + + GEOM_List MakePipeTShapeChamfer (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theH, in double theW, in boolean theHexMesh); + + GEOM_List MakePipeTShapeChamferWithPosition (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theH, in double theW, in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + + GEOM_List MakePipeTShapeFillet (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRF, in boolean theHexMesh); + + GEOM_List MakePipeTShapeFilletWithPosition (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRF, in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + + GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation, + in pattern thePattern); + + GEOM_Object MakeDividedCylinder (in double theR, in double theH, + in pattern thePattern); + + /*@@ insert new functions before this line @@ do not remove this line @@*/ + }; }; #endif diff --git a/idl/Makefile.am b/idl/Makefile.am index 258c691e9..22ae8e15c 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # This Makefile is responsible of generating the client and server # implementation of IDL interfaces for both C++ and python usage. # The building process of the C++ files is in charge of each source @@ -28,6 +26,8 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am BASEIDL_FILES = GEOM_Gen.idl GEOM_Superv.idl +BASEIDL_FILES_PY=$(BASEIDL_FILES:%.idl=%_idl.py) + # This variable defines the files to be installed dist_salomeidl_DATA = $(BASEIDL_FILES) @@ -41,7 +41,6 @@ nodist_libSalomeIDLGEOM_la_SOURCES = GEOM_GenSK.cc GEOM_SupervSK.cc nodist_salomeinclude_HEADERS = $(BASEIDL_FILES:%.idl=%.hh) libSalomeIDLGEOM_la_CPPFLAGS = \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @KERNEL_CXXFLAGS@ libSalomeIDLGEOM_la_LDFLAGS = -no-undefined -version-info=0:0:0 @@ -51,7 +50,7 @@ libSalomeIDLGEOM_la_LIBADD = $(STDLIB) @CORBA_LIBS@ $(KERNEL_LDFLAGS) -lSalomeI OMNIORB_IDL = @OMNIORB_IDL@ OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome -IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome -I$(top_builddir)/salome_adm/unix +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome IDLPYFLAGS = @IDLPYFLAGS@ -I$(KERNEL_ROOT_DIR)/idl/salome # potential problem on parallel make on the following - multiple outputs @@ -67,9 +66,15 @@ install-exec-local: $(BASEIDL_FILES:%=$(top_srcdir)/idl/%) $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ done -# uninstall-local removes too much, but it works in distcheck +# we want to remove only staff generated for IDL files and nothing more uninstall-local: - rm -rf $(DESTDIR)$(salomepythondir)/* + @for modulen in GEOM ; do \ + test -d $(DESTDIR)$(salomepythondir)/$${modulen} && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen} ; \ + test -d $(DESTDIR)$(salomepythondir)/$${modulen}__POA && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}__POA" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen}__POA ; \ + done ; \ + for filen in $(BASEIDL_FILES_PY) ; do \ + echo "Removing $(DESTDIR)$(salomepythondir)/$${filen}" && rm -f $(DESTDIR)$(salomepythondir)/$${filen}* ; \ + done mostlyclean-local: -rm -f *.hh *.cc .depidl diff --git a/resources/GEOMCatalog.xml.in b/resources/GEOMCatalog.xml.in index 7bf6f0297..e4c33f0de 100644 --- a/resources/GEOMCatalog.xml.in +++ b/resources/GEOMCatalog.xml.in @@ -1,6 +1,6 @@ + GetIAdvancedOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IAdvancedOperations + + + + + RemoveObject @@ -4178,6 +4203,48 @@ + + MakeEllipseVec + + + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theVec + GEOM_Object + unknown + + + theRMajor + double + unknown + + + theRMinor + double + unknown + + + theVecMaj + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + MakeArc @@ -4768,6 +4835,451 @@ + + + MakePipeTShape + + + unknown + 0 + + + theR1 + double + unknown + + + theW1 + double + unknown + + + theL1 + double + unknown + + + theR2 + double + unknown + + + theW2 + double + unknown + + + theL2 + double + unknown + + + theHewMesh + boolean + unknown + + + + + return + GEOM_List + unknown + + + + + + MakePipeTShapeWithPosition + + + unknown + 0 + + + theR1 + double + unknown + + + theW1 + double + unknown + + + theL1 + double + unknown + + + theR2 + double + unknown + + + theW2 + double + unknown + + + theL2 + double + unknown + + + theHewMesh + boolean + unknown + + + theP1 + GEOM_Object + unknown + + + theP2 + GEOM_Object + unknown + + + theP3 + GEOM_Object + unknown + + + + + return + GEOM_List + unknown + + + + + + MakePipeTShapeChamfer + + + unknown + 0 + + + theR1 + double + unknown + + + theW1 + double + unknown + + + theL1 + double + unknown + + + theR2 + double + unknown + + + theW2 + double + unknown + + + theL2 + double + unknown + + + theH + double + unknown + + + theR + double + unknown + + + theHewMesh + boolean + unknown + + + + + return + GEOM_List + unknown + + + + + + MakePipeTShapeChamferWithPosition + + + unknown + 0 + + + theR1 + double + unknown + + + theW1 + double + unknown + + + theL1 + double + unknown + + + theR2 + double + unknown + + + theW2 + double + unknown + + + theL2 + double + unknown + + + theH + double + unknown + + + theR + double + unknown + + + theHewMesh + boolean + unknown + + + theP1 + GEOM_Object + unknown + + + theP2 + GEOM_Object + unknown + + + theP3 + GEOM_Object + unknown + + + + + return + GEOM_List + unknown + + + + + + + + MakePipeTShapeFillet + + + unknown + 0 + + + theR1 + double + unknown + + + theW1 + double + unknown + + + theL1 + double + unknown + + + theR2 + double + unknown + + + theW2 + double + unknown + + + theL2 + double + unknown + + + theRF + double + unknown + + + theHewMesh + boolean + unknown + + + + + return + GEOM_List + unknown + + + + + + MakePipeTShapeFilletWithPosition + + + unknown + 0 + + + theR1 + double + unknown + + + theW1 + double + unknown + + + theL1 + double + unknown + + + theR2 + double + unknown + + + theW2 + double + unknown + + + theL2 + double + unknown + + + theRF + double + unknown + + + theHewMesh + boolean + unknown + + + theP1 + GEOM_Object + unknown + + + theP2 + GEOM_Object + unknown + + + theP3 + GEOM_Object + unknown + + + + + return + GEOM_List + unknown + + + + + + MakeDividedDisk + + + unknown + 0 + + + theR + double + Radius of the disk + + + theRatio + double + Relative size of the central square diagonal against the disk diameter + + + + + return + GEOM_Object + Result object + + + + + + MakeDividedCylinder + + + unknown + 0 + + + theR + double + Radius of the cylinder + + + theH + double + Height of the cylinder + + + + + return + GEOM_Object + Result object + + + + + diff --git a/resources/GEOM_en.xml b/resources/GEOM_en.xml index eda6f84a0..f435c1abb 100644 --- a/resources/GEOM_en.xml +++ b/resources/GEOM_en.xml @@ -1,7 +1,7 @@ - -
    - - - -
    -
    - - -
    -
    - - - - - - - - - -
    -
    diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in new file mode 100644 index 000000000..dd0dfdfd2 --- /dev/null +++ b/resources/SalomeApp.xml.in @@ -0,0 +1,77 @@ + + +
    + + + + + +
    +
    + + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    diff --git a/resources/build_edge_curve.png b/resources/build_edge_curve.png new file mode 100644 index 000000000..e87abea5c Binary files /dev/null and b/resources/build_edge_curve.png differ diff --git a/resources/build_edge_wire.png b/resources/build_edge_wire.png new file mode 100644 index 000000000..3c7b5383b Binary files /dev/null and b/resources/build_edge_wire.png differ diff --git a/resources/change_direction.png b/resources/change_direction.png new file mode 100644 index 000000000..fb34fedda Binary files /dev/null and b/resources/change_direction.png differ diff --git a/resources/check_self_intersections.png b/resources/check_self_intersections.png new file mode 100644 index 000000000..0330d6a48 Binary files /dev/null and b/resources/check_self_intersections.png differ diff --git a/resources/divided_disk.png b/resources/divided_disk.png new file mode 100644 index 000000000..585324fde Binary files /dev/null and b/resources/divided_disk.png differ diff --git a/resources/dividedcylinder.png b/resources/dividedcylinder.png new file mode 100644 index 000000000..a7de2f605 Binary files /dev/null and b/resources/dividedcylinder.png differ diff --git a/resources/dividedcylinder_r_h.png b/resources/dividedcylinder_r_h.png new file mode 100644 index 000000000..1b914b97d Binary files /dev/null and b/resources/dividedcylinder_r_h.png differ diff --git a/resources/dlg_pipetshape.png b/resources/dlg_pipetshape.png new file mode 100644 index 000000000..f84178dde Binary files /dev/null and b/resources/dlg_pipetshape.png differ diff --git a/resources/dlg_pipetshapechamfer.png b/resources/dlg_pipetshapechamfer.png new file mode 100644 index 000000000..a614fd79c Binary files /dev/null and b/resources/dlg_pipetshapechamfer.png differ diff --git a/resources/dlg_pipetshapechamferh.png b/resources/dlg_pipetshapechamferh.png new file mode 100644 index 000000000..d1f763787 Binary files /dev/null and b/resources/dlg_pipetshapechamferh.png differ diff --git a/resources/dlg_pipetshapechamferl1.png b/resources/dlg_pipetshapechamferl1.png new file mode 100644 index 000000000..d7afd1724 Binary files /dev/null and b/resources/dlg_pipetshapechamferl1.png differ diff --git a/resources/dlg_pipetshapechamferl2.png b/resources/dlg_pipetshapechamferl2.png new file mode 100644 index 000000000..e15207876 Binary files /dev/null and b/resources/dlg_pipetshapechamferl2.png differ diff --git a/resources/dlg_pipetshapechamferr1.png b/resources/dlg_pipetshapechamferr1.png new file mode 100644 index 000000000..880231d14 Binary files /dev/null and b/resources/dlg_pipetshapechamferr1.png differ diff --git a/resources/dlg_pipetshapechamferr2.png b/resources/dlg_pipetshapechamferr2.png new file mode 100644 index 000000000..f7310f384 Binary files /dev/null and b/resources/dlg_pipetshapechamferr2.png differ diff --git a/resources/dlg_pipetshapechamferw.png b/resources/dlg_pipetshapechamferw.png new file mode 100644 index 000000000..a4fa4a339 Binary files /dev/null and b/resources/dlg_pipetshapechamferw.png differ diff --git a/resources/dlg_pipetshapechamferw1.png b/resources/dlg_pipetshapechamferw1.png new file mode 100644 index 000000000..c966165a7 Binary files /dev/null and b/resources/dlg_pipetshapechamferw1.png differ diff --git a/resources/dlg_pipetshapechamferw2.png b/resources/dlg_pipetshapechamferw2.png new file mode 100644 index 000000000..13381df2c Binary files /dev/null and b/resources/dlg_pipetshapechamferw2.png differ diff --git a/resources/dlg_pipetshapefillet.png b/resources/dlg_pipetshapefillet.png new file mode 100644 index 000000000..1322e2500 Binary files /dev/null and b/resources/dlg_pipetshapefillet.png differ diff --git a/resources/dlg_pipetshapefilletl1.png b/resources/dlg_pipetshapefilletl1.png new file mode 100644 index 000000000..37e371256 Binary files /dev/null and b/resources/dlg_pipetshapefilletl1.png differ diff --git a/resources/dlg_pipetshapefilletl2.png b/resources/dlg_pipetshapefilletl2.png new file mode 100644 index 000000000..4c763a04e Binary files /dev/null and b/resources/dlg_pipetshapefilletl2.png differ diff --git a/resources/dlg_pipetshapefilletr1.png b/resources/dlg_pipetshapefilletr1.png new file mode 100644 index 000000000..d41479385 Binary files /dev/null and b/resources/dlg_pipetshapefilletr1.png differ diff --git a/resources/dlg_pipetshapefilletr2.png b/resources/dlg_pipetshapefilletr2.png new file mode 100644 index 000000000..883864ade Binary files /dev/null and b/resources/dlg_pipetshapefilletr2.png differ diff --git a/resources/dlg_pipetshapefilletrf.png b/resources/dlg_pipetshapefilletrf.png new file mode 100644 index 000000000..8de432bac Binary files /dev/null and b/resources/dlg_pipetshapefilletrf.png differ diff --git a/resources/dlg_pipetshapefilletw1.png b/resources/dlg_pipetshapefilletw1.png new file mode 100644 index 000000000..abb67aa22 Binary files /dev/null and b/resources/dlg_pipetshapefilletw1.png differ diff --git a/resources/dlg_pipetshapefilletw2.png b/resources/dlg_pipetshapefilletw2.png new file mode 100644 index 000000000..64ad6e77e Binary files /dev/null and b/resources/dlg_pipetshapefilletw2.png differ diff --git a/resources/dlg_pipetshapel1.png b/resources/dlg_pipetshapel1.png new file mode 100644 index 000000000..2895b0b24 Binary files /dev/null and b/resources/dlg_pipetshapel1.png differ diff --git a/resources/dlg_pipetshapel2.png b/resources/dlg_pipetshapel2.png new file mode 100644 index 000000000..a66a410e7 Binary files /dev/null and b/resources/dlg_pipetshapel2.png differ diff --git a/resources/dlg_pipetshaper1.png b/resources/dlg_pipetshaper1.png new file mode 100644 index 000000000..897db939e Binary files /dev/null and b/resources/dlg_pipetshaper1.png differ diff --git a/resources/dlg_pipetshaper2.png b/resources/dlg_pipetshaper2.png new file mode 100644 index 000000000..409f9e785 Binary files /dev/null and b/resources/dlg_pipetshaper2.png differ diff --git a/resources/dlg_pipetshapew1.png b/resources/dlg_pipetshapew1.png new file mode 100644 index 000000000..88fb6638b Binary files /dev/null and b/resources/dlg_pipetshapew1.png differ diff --git a/resources/dlg_pipetshapew2.png b/resources/dlg_pipetshapew2.png new file mode 100644 index 000000000..e27598e71 Binary files /dev/null and b/resources/dlg_pipetshapew2.png differ diff --git a/resources/draft.png b/resources/draft.png new file mode 100644 index 000000000..d99c8a605 Binary files /dev/null and b/resources/draft.png differ diff --git a/resources/extruded_boss.png b/resources/extruded_boss.png new file mode 100644 index 000000000..fca4e90d8 Binary files /dev/null and b/resources/extruded_boss.png differ diff --git a/resources/extruded_cut.png b/resources/extruded_cut.png new file mode 100644 index 000000000..21ae1cf2b Binary files /dev/null and b/resources/extruded_cut.png differ diff --git a/resources/feature_detect.png b/resources/feature_detect.png new file mode 100644 index 000000000..ea1e15492 Binary files /dev/null and b/resources/feature_detect.png differ diff --git a/resources/fillet1d.png b/resources/fillet1d.png new file mode 100644 index 000000000..c62a1769b Binary files /dev/null and b/resources/fillet1d.png differ diff --git a/resources/filletwire.png b/resources/filletwire.png new file mode 100644 index 000000000..961c17cc5 Binary files /dev/null and b/resources/filletwire.png differ diff --git a/resources/fuse_collinear_edges.png b/resources/fuse_collinear_edges.png new file mode 100644 index 000000000..52d8ff8da Binary files /dev/null and b/resources/fuse_collinear_edges.png differ diff --git a/resources/import_picture.png b/resources/import_picture.png new file mode 100644 index 000000000..a4b3ace98 Binary files /dev/null and b/resources/import_picture.png differ diff --git a/resources/limit_tolerance.png b/resources/limit_tolerance.png new file mode 100644 index 000000000..35f20804e Binary files /dev/null and b/resources/limit_tolerance.png differ diff --git a/resources/marker_1.png b/resources/marker_1.png new file mode 100755 index 000000000..8bbaa854e Binary files /dev/null and b/resources/marker_1.png differ diff --git a/resources/marker_10.png b/resources/marker_10.png new file mode 100755 index 000000000..aa7d85747 Binary files /dev/null and b/resources/marker_10.png differ diff --git a/resources/marker_11.png b/resources/marker_11.png new file mode 100755 index 000000000..ed1935ae1 Binary files /dev/null and b/resources/marker_11.png differ diff --git a/resources/marker_12.png b/resources/marker_12.png new file mode 100755 index 000000000..b6c09964b Binary files /dev/null and b/resources/marker_12.png differ diff --git a/resources/marker_13.png b/resources/marker_13.png new file mode 100755 index 000000000..16162a752 Binary files /dev/null and b/resources/marker_13.png differ diff --git a/resources/marker_2.png b/resources/marker_2.png new file mode 100755 index 000000000..f0d21091d Binary files /dev/null and b/resources/marker_2.png differ diff --git a/resources/marker_3.png b/resources/marker_3.png new file mode 100755 index 000000000..345d8abc1 Binary files /dev/null and b/resources/marker_3.png differ diff --git a/resources/marker_4.png b/resources/marker_4.png new file mode 100755 index 000000000..78c805532 Binary files /dev/null and b/resources/marker_4.png differ diff --git a/resources/marker_5.png b/resources/marker_5.png new file mode 100755 index 000000000..a994c1100 Binary files /dev/null and b/resources/marker_5.png differ diff --git a/resources/marker_6.png b/resources/marker_6.png new file mode 100755 index 000000000..967b93ecc Binary files /dev/null and b/resources/marker_6.png differ diff --git a/resources/marker_7.png b/resources/marker_7.png new file mode 100755 index 000000000..7a3eb90f6 Binary files /dev/null and b/resources/marker_7.png differ diff --git a/resources/marker_8.png b/resources/marker_8.png new file mode 100755 index 000000000..3b3ccc481 Binary files /dev/null and b/resources/marker_8.png differ diff --git a/resources/marker_9.png b/resources/marker_9.png new file mode 100755 index 000000000..0d7603681 Binary files /dev/null and b/resources/marker_9.png differ diff --git a/resources/origin_and_vectors.png b/resources/origin_and_vectors.png new file mode 100755 index 000000000..0c5fa9f72 Binary files /dev/null and b/resources/origin_and_vectors.png differ diff --git a/resources/pipetshape.png b/resources/pipetshape.png new file mode 100644 index 000000000..716964157 Binary files /dev/null and b/resources/pipetshape.png differ diff --git a/resources/pipetshape_import_icon.png b/resources/pipetshape_import_icon.png new file mode 100644 index 000000000..6bc087494 Binary files /dev/null and b/resources/pipetshape_import_icon.png differ diff --git a/resources/projection.png b/resources/projection.png new file mode 100644 index 000000000..6b22c1dc7 Binary files /dev/null and b/resources/projection.png differ diff --git a/resources/rectangle.png b/resources/rectangle.png new file mode 100644 index 000000000..9812d8e7d Binary files /dev/null and b/resources/rectangle.png differ diff --git a/resources/shading.png b/resources/shading.png index 27ca4e1d1..909df3d18 100755 Binary files a/resources/shading.png and b/resources/shading.png differ diff --git a/resources/shading_with_edges.png b/resources/shading_with_edges.png new file mode 100644 index 000000000..a452c544c Binary files /dev/null and b/resources/shading_with_edges.png differ diff --git a/resources/shared_shapes.png b/resources/shared_shapes.png new file mode 100644 index 000000000..23f804802 Binary files /dev/null and b/resources/shared_shapes.png differ diff --git a/resources/tree_pipetshape.png b/resources/tree_pipetshape.png new file mode 100644 index 000000000..96631a150 Binary files /dev/null and b/resources/tree_pipetshape.png differ diff --git a/resources/vector_mode.png b/resources/vector_mode.png new file mode 100644 index 000000000..69a88a107 Binary files /dev/null and b/resources/vector_mode.png differ diff --git a/resources/wireframe.png b/resources/wireframe.png new file mode 100644 index 000000000..e500831bc Binary files /dev/null and b/resources/wireframe.png differ diff --git a/src/ARCHIMEDE/ARCHIMEDE.pro b/src/ARCHIMEDE/ARCHIMEDE.pro deleted file mode 100644 index bbcdfab3f..000000000 --- a/src/ARCHIMEDE/ARCHIMEDE.pro +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMArchimede -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel - -CAS_MODELER = -L$${CASROOT}/Linux/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBO -lTKBool -lTKHLR -lTKFillet -lTKOffset -lTKFeat - -STDLIB = -lstdc++ - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${KERNEL_LDFLAGS} -lSALOMELocalTrace $${CAS_KERNEL} $${CAS_MODELER} -lTKMesh $${STDLIB} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = Archimede_VolumeSection.hxx - -SOURCES = Archimede_VolumeSection.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/ARCHIMEDE/Archimede_VolumeSection.cxx b/src/ARCHIMEDE/Archimede_VolumeSection.cxx index 922098934..0aee99aad 100644 --- a/src/ARCHIMEDE/Archimede_VolumeSection.cxx +++ b/src/ARCHIMEDE/Archimede_VolumeSection.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM ARCHIMEDE : algorithm implementation // File : Archimede_VolumeSection.cxx // Author : Nicolas REJNERI @@ -88,29 +89,29 @@ void VolumeSection::CenterOfGravity() TopoDS_Face F = TopoDS::Face(ex.Current()); Handle(Poly_Triangulation) Tr = BRep_Tool::Triangulation(F, L); if(Tr.IsNull()) - MESSAGE("Error, null layer" ) + MESSAGE("Error, null layer" ) nbNodes = Tr->NbNodes(); const TColgp_Array1OfPnt& Nodes = Tr->Nodes(); // Calcul des dimensions de la boite englobante du solide for(i=1;i<=nbNodes;i++) - { - InitPoint = Nodes(i).Transformed(L.Transformation()); - if(InitPoint.X() < Xmin) - Xmin = InitPoint.X(); - if(InitPoint.X() > Xmax) - Xmax = InitPoint.X(); - if(InitPoint.Y() < Ymin) - Ymin = InitPoint.Y(); - if(InitPoint.Y() > Ymax) - Ymax = InitPoint.Y(); - if(InitPoint.Z() < Zmin) - Zmin = InitPoint.Z(); - if(InitPoint.Z() > Zmax) - Zmax = InitPoint.Z(); - - } + { + InitPoint = Nodes(i).Transformed(L.Transformation()); + if(InitPoint.X() < Xmin) + Xmin = InitPoint.X(); + if(InitPoint.X() > Xmax) + Xmax = InitPoint.X(); + if(InitPoint.Y() < Ymin) + Ymin = InitPoint.Y(); + if(InitPoint.Y() > Ymax) + Ymax = InitPoint.Y(); + if(InitPoint.Z() < Zmin) + Zmin = InitPoint.Z(); + if(InitPoint.Z() > Zmax) + Zmax = InitPoint.Z(); + + } } // Creation du point d'initialisation, c'est € dire le centre de gravit‰ @@ -141,7 +142,7 @@ Standard_Real VolumeSection::CalculateVolume(Standard_Real Elevation) TopoDS_Face F = TopoDS::Face(ex.Current()); Handle(Poly_Triangulation) Tr = BRep_Tool::Triangulation(F, L); if(Tr.IsNull()) - MESSAGE("Error, null layer" ) + MESSAGE("Error, null layer" ) const Poly_Array1OfTriangle& triangles = Tr->Triangles(); Standard_Integer nbTriangles = Tr->NbTriangles(); nbNodes = Tr->NbNodes(); @@ -151,70 +152,70 @@ Standard_Real VolumeSection::CalculateVolume(Standard_Real Elevation) //en tenant compte des triangles coup‰s par le plan de section for (i=1;i<=nbTriangles;i++) - { - Determinant=0; - //Gardons la meme orientation des noeuds - if (F.Orientation() == TopAbs_REVERSED) - triangles(i).Get(noeud[0], noeud[2], noeud[1]); - else - triangles(i).Get(noeud[0], noeud[1], noeud[2]); - + { + Determinant=0; + //Gardons la meme orientation des noeuds + if (F.Orientation() == TopAbs_REVERSED) + triangles(i).Get(noeud[0], noeud[2], noeud[1]); + else + triangles(i).Get(noeud[0], noeud[1], noeud[2]); + P[0] = Nodes(noeud[0]).Transformed(L.Transformation()); - z[0] = P[0].Z(); - P[1] = Nodes(noeud[1]).Transformed(L.Transformation()); - z[1] = P[1].Z(); + z[0] = P[0].Z(); + P[1] = Nodes(noeud[1]).Transformed(L.Transformation()); + z[1] = P[1].Z(); P[2] = Nodes(noeud[2]).Transformed(L.Transformation()); z[2] = P[2].Z(); - // Determination des cas aux limites pour les triangles - Standard_Integer i,compteur=0; + // Determination des cas aux limites pour les triangles + Standard_Integer i,compteur=0; - for (i=0;i<=2;i++) - { + for (i=0;i<=2;i++) + { flag[i]=Standard_False; - if(z[i]>=Elevation) - { - flag[i]=Standard_True; - compteur++; - } - } - - switch(compteur) - { - case 0: - Determinant = ElementaryVolume(P[0],P[1],P[2]); - break; - - case 1: - for (i=0;i<=2;i++) - { - if (flag[i]==Standard_True) - { - gp_Pnt Result1 = Intersection(P[i],P[(i+1)%3],Elevation); - gp_Pnt Result2 = Intersection(P[i],P[(i+2)%3],Elevation); - Determinant = ElementaryVolume(Result1,P[(i+1)%3],P[(i+2)%3]) - + ElementaryVolume(Result1,P[(i+2)%3],Result2); - } - } - break; - - case 2: - for (i=0;i<=2;i++) - { - if (flag[i]==Standard_False) - { - gp_Pnt Result1 = Intersection(P[i],P[(i+1)%3],Elevation); - gp_Pnt Result2 = Intersection(P[i],P[(i+2)%3],Elevation); - Determinant = ElementaryVolume(P[i],Result1,Result2); - } - } - break; - - case 3: - break; - } - Volume += Determinant; - } + if(z[i]>=Elevation) + { + flag[i]=Standard_True; + compteur++; + } + } + + switch(compteur) + { + case 0: + Determinant = ElementaryVolume(P[0],P[1],P[2]); + break; + + case 1: + for (i=0;i<=2;i++) + { + if (flag[i]==Standard_True) + { + gp_Pnt Result1 = Intersection(P[i],P[(i+1)%3],Elevation); + gp_Pnt Result2 = Intersection(P[i],P[(i+2)%3],Elevation); + Determinant = ElementaryVolume(Result1,P[(i+1)%3],P[(i+2)%3]) + + ElementaryVolume(Result1,P[(i+2)%3],Result2); + } + } + break; + + case 2: + for (i=0;i<=2;i++) + { + if (flag[i]==Standard_False) + { + gp_Pnt Result1 = Intersection(P[i],P[(i+1)%3],Elevation); + gp_Pnt Result2 = Intersection(P[i],P[(i+2)%3],Elevation); + Determinant = ElementaryVolume(P[i],Result1,Result2); + } + } + break; + + case 3: + break; + } + Volume += Determinant; + } } return Volume; @@ -258,30 +259,30 @@ Standard_Real VolumeSection::Archimede(Standard_Real Constante , Standard_Real E else { while((Bsup-Binf)>Epsilon) - { - if((tempBinfVolume-Constante)*(tempCVolume-Constante)>0 && Abs(tempCVolume-Constante)>Epsilon) - { - Binf = c; - tempBinfVolume=tempCVolume; - - c = ((Binf*(tempBsupVolume-Constante))-(Bsup*(tempBinfVolume-Constante))) - /((tempBsupVolume-Constante)-(tempBinfVolume-Constante)); + { + if((tempBinfVolume-Constante)*(tempCVolume-Constante)>0 && Abs(tempCVolume-Constante)>Epsilon) + { + Binf = c; + tempBinfVolume=tempCVolume; + + c = ((Binf*(tempBsupVolume-Constante))-(Bsup*(tempBinfVolume-Constante))) + /((tempBsupVolume-Constante)-(tempBinfVolume-Constante)); tempCVolume=CalculateVolume(c); - } - else if((tempBinfVolume-Constante)*(tempCVolume-Constante)<0 && Abs(tempCVolume-Constante)>Epsilon) - { - Bsup = c; - tempBsupVolume =tempCVolume; + } + else if((tempBinfVolume-Constante)*(tempCVolume-Constante)<0 && Abs(tempCVolume-Constante)>Epsilon) + { + Bsup = c; + tempBsupVolume =tempCVolume; - c = ((Binf*(tempBsupVolume-Constante))-(Bsup*(tempBinfVolume-Constante))) - /((tempBsupVolume-Constante)-(tempBinfVolume-Constante)); + c = ((Binf*(tempBsupVolume-Constante))-(Bsup*(tempBinfVolume-Constante))) + /((tempBsupVolume-Constante)-(tempBinfVolume-Constante)); tempCVolume=CalculateVolume(c); - } - else - { - goto endMethod; - } - } + } + else + { + goto endMethod; + } + } goto endMethod; } diff --git a/src/ARCHIMEDE/Archimede_VolumeSection.hxx b/src/ARCHIMEDE/Archimede_VolumeSection.hxx index 70790e4f8..183443788 100644 --- a/src/ARCHIMEDE/Archimede_VolumeSection.hxx +++ b/src/ARCHIMEDE/Archimede_VolumeSection.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM ARCHIMEDE : algorithm implementation // File : Archimede_VolumeSection.hxx // Author : Nicolas REJNERI diff --git a/src/ARCHIMEDE/Makefile.am b/src/ARCHIMEDE/Makefile.am index 51f12a394..84d1a3560 100644 --- a/src/ARCHIMEDE/Makefile.am +++ b/src/ARCHIMEDE/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM ARCHIMEDE : algorithm implementation # File : Makefile.am # Author : Nicolas REJNERI diff --git a/src/AdvancedGUI/AdvancedGUI.cxx b/src/AdvancedGUI/AdvancedGUI.cxx new file mode 100644 index 000000000..2c478e469 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI.cxx @@ -0,0 +1,104 @@ +// Copyright (C) 2007-2012 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 +// + +// File : AdvancedGUI.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#include "AdvancedGUI.h" + +#include "GeometryGUI.h" +#include "GeometryGUI_Operations.h" + +#include +#include + +#include "AdvancedGUI_PipeTShapeDlg.h" +#include "AdvancedGUI_DividedDiskDlg.h" +#include "AdvancedGUI_DividedCylinderDlg.h" +//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// + +#include + +//======================================================================= +// function : AdvancedGUI() +// purpose : Constructor +//======================================================================= +AdvancedGUI::AdvancedGUI( GeometryGUI* parent ) : GEOMGUI( parent ) +{ +} + +//======================================================================= +// function : ~AdvancedGUI +// purpose : Destructor +//======================================================================= +AdvancedGUI::~AdvancedGUI() +{ +} + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) +{ + SalomeApp_Application* app = getGeometryGUI()->getApp(); + if ( !app ) return false; + + getGeometryGUI()->EmitSignalDeactivateDialog(); + + QDialog* aDlg = NULL; + + switch ( theCommandID ) { + case GEOMOp::OpPipeTShape: + aDlg = new AdvancedGUI_PipeTShapeDlg( getGeometryGUI(), parent ); + break; +// case GEOMOp::OpPipeTShapeGroups: +// aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent ); +// break; + case GEOMOp::OpDividedDisk: + aDlg = new AdvancedGUI_DividedDiskDlg( getGeometryGUI(), parent ); + break; + case GEOMOp::OpDividedCylinder: + aDlg = new AdvancedGUI_DividedCylinderDlg( getGeometryGUI(), parent ); + break; + //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// + default: + app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + break; + } + + if ( aDlg != NULL ) + aDlg->show(); + + return true; +} + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ +#ifdef WIN32 + __declspec( dllexport ) +#endif + GEOMGUI* GetLibGUI( GeometryGUI* parent ) + { + return new AdvancedGUI( parent ); + } +} diff --git a/src/AdvancedGUI/AdvancedGUI.h b/src/AdvancedGUI/AdvancedGUI.h new file mode 100644 index 000000000..710bb39ff --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI.h @@ -0,0 +1,41 @@ +// Copyright (C) 2007-2012 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 +// + +// File : AdvancedGUI.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#ifndef ADVANCEDGUI_H +#define ADVANCEDGUI_H + +#include "GEOMGUI.h" + +//================================================================================= +// class : AdvancedGUI +// purpose : +//================================================================================= +class AdvancedGUI : public GEOMGUI +{ +public: + AdvancedGUI( GeometryGUI* ); + ~AdvancedGUI(); + + bool OnGUIEvent( int, SUIT_Desktop* ); +}; + +#endif // ADVANCEDGUI_H diff --git a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx new file mode 100644 index 000000000..1d6d55edb --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx @@ -0,0 +1,266 @@ +// Copyright (C) 2007-2008 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 "AdvancedGUI_DividedCylinderDlg.h" + +#include +#include +#include + +#include +#include +#include +#include + +// OCCT Includes +#include +#include +#include +#include +#include + +#include + +//================================================================================= +// Constructor +//================================================================================= +AdvancedGUI_DividedCylinderDlg::AdvancedGUI_DividedCylinderDlg (GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ + QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DIVIDEDCYLINDER_R_H"))); + QPixmap imageSel (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_DIVIDEDCYLINDER_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDEDCYLINDER")); + mainFrame()->RadioButton1->setIcon(imageOp); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + GroupParams = new DlgRef_2Spin(centralWidget()); + GroupParams->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupParams->TextLabel1->setText(tr("GEOM_RADIUS")); + GroupParams->TextLabel2->setText(tr("GEOM_HEIGHT")); + + GroupPattern = new DlgRef_3Radio(centralWidget()); + GroupPattern->GroupBox1->setTitle(tr("GEOM_PATTERN")); + GroupPattern->RadioButton1->setText(tr("GEOM_SQUARE")); + GroupPattern->RadioButton2->setText(tr("GEOM_HEXAGON")); + GroupPattern->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + GroupPattern->RadioButton3->close(); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupParams); + layout->addWidget(GroupPattern); + /***************************************************************/ + + setHelpFileName("create_dividedcylinder_page.html"); + + Init(); +} + +//================================================================================= +// Destructor +//================================================================================= +AdvancedGUI_DividedCylinderDlg::~AdvancedGUI_DividedCylinderDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::Init() +{ + // Get setting of step value from file configuration + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + + // min, max, step and decimals for spin boxes & initial values + initSpinBox(GroupParams->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupParams->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" ); + + // init variables + double aRadius = 100; + double aHeight = 300; + GroupParams->SpinBox_DX->setValue(aRadius); + GroupParams->SpinBox_DY->setValue(aHeight); + + GroupPattern->RadioButton1->setChecked(true); + myPattern = GEOM::SQUARE; + + // Signal/slot connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + this, SLOT(SetDoubleSpinBoxStep(double))); + + connect(GroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(GroupPattern->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + connect(GroupPattern->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + + initName(tr("GEOM_DIVIDEDCYLINDER")); + + resize(minimumSizeHint()); + displayPreview(true); +} + +//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::SetDoubleSpinBoxStep (double step) +{ + //@@ set double spin box step for all spin boxes here @@// +} + +//================================================================================= +// function : RadioButtonClicked() +// purpose : Radio button management +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::RadioButtonClicked() +{ + QRadioButton* send = (QRadioButton*)sender(); + + // Division pattern + if (send == GroupPattern->RadioButton1) + myPattern = GEOM::SQUARE; + else if (send == GroupPattern->RadioButton2) + myPattern = GEOM::HEXAGON; + + displayPreview(true); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool AdvancedGUI_DividedCylinderDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + + return true; +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + displayPreview(true); +} + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::ValueChangedInSpinBox() +{ + //@@ connect custom spin boxes or other widget to this slot in the Init() method for automatic preview update @@// + displayPreview(true); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr AdvancedGUI_DividedCylinderDlg::createOperation() +{ + return getGeomEngine()->GetIAdvancedOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool AdvancedGUI_DividedCylinderDlg::isValid (QString& msg) +{ + bool ok = true; + + //@@ add custom validation actions here @@// + + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool AdvancedGUI_DividedCylinderDlg::execute (ObjectList& objects) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation()); + + //@@ retrieve input values from the widgets here @@// + CORBA::Double theR = GroupParams->SpinBox_DX->value(); + CORBA::Double theH = GroupParams->SpinBox_DY->value(); + + // call engine function + anObj = anOper->MakeDividedCylinder(theR, theH, myPattern); + res = !anObj->_is_nil(); + if (res && !IsPreview()) + { + QStringList aParameters; + aParameters << GroupParams->SpinBox_DX->text(); // R parameter + aParameters << GroupParams->SpinBox_DY->text(); // H parameter + if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + + if (res) + objects.push_back(anObj._retn()); + + return res; +} diff --git a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.h b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.h new file mode 100644 index 000000000..6cbf0363e --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.h @@ -0,0 +1,66 @@ +// Copyright (C) 2007-2008 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 ADVANCEDGUI_DIVIDEDCYLINDERDLG_H +#define ADVANCEDGUI_DIVIDEDCYLINDERDLG_H + +#include + +class DlgRef_2Spin; +class DlgRef_3Radio; + +//================================================================================= +// class : AdvancedGUI_DividedCylinderDlg +// purpose : +//================================================================================= +class AdvancedGUI_DividedCylinderDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + AdvancedGUI_DividedCylinderDlg( GeometryGUI*, QWidget* = 0 ); + ~AdvancedGUI_DividedCylinderDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + +private: + void Init(); + void enterEvent( QEvent* ); + +private: + DlgRef_2Spin* GroupParams; + DlgRef_3Radio* GroupPattern; + GEOM::pattern myPattern; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void ValueChangedInSpinBox(); + void SetDoubleSpinBoxStep( double ); + void RadioButtonClicked(); +}; + +#endif // ADVANCEDGUI_DIVIDEDCYLINDERDLG_H diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx new file mode 100644 index 000000000..85a4d099d --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx @@ -0,0 +1,458 @@ +// Copyright (C) 2007-2008 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 "AdvancedGUI_DividedDiskDlg.h" + +#include +#include +#include + +#include +#include +#include +#include + +// OCCT Includes +#include +#include +#include +#include +#include + +#include + +// enum +// { +// SQUARE, +// HEXAGON +// }; + +//================================================================================= +// Constructor +//================================================================================= +AdvancedGUI_DividedDiskDlg::AdvancedGUI_DividedDiskDlg (GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ +// QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DIVIDEDDISK_R_RATIO"))); + QPixmap imageOp1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DISK_R"))); + QPixmap imageOp2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DISK_PNT_VEC_R"))); + QPixmap imageSel (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_DIVIDEDDISK_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDEDDISK")); + mainFrame()->RadioButton1->setIcon(imageOp1); + mainFrame()->RadioButton2->setIcon(imageOp2); +// mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); +// mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + GroupParams = new DlgRef_1Spin(centralWidget()); + GroupParams->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupParams->TextLabel1->setText(tr("GEOM_RADIUS")); + + GroupOrientation = new DlgRef_3Radio(centralWidget()); + GroupOrientation->GroupBox1->setTitle(tr("GEOM_ORIENTATION")); + GroupOrientation->RadioButton1->setText(tr("GEOM_WPLANE_OXY")); + GroupOrientation->RadioButton2->setText(tr("GEOM_WPLANE_OYZ")); + GroupOrientation->RadioButton3->setText(tr("GEOM_WPLANE_OZX")); + + GroupPattern = new DlgRef_3Radio(centralWidget()); + GroupPattern->GroupBox1->setTitle(tr("GEOM_PATTERN")); + GroupPattern->RadioButton1->setText(tr("GEOM_SQUARE")); + GroupPattern->RadioButton2->setText(tr("GEOM_HEXAGON")); + GroupPattern->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + GroupPattern->RadioButton3->close(); + + GroupPntVecR = new DlgRef_2Sel1Spin(centralWidget()); + GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT")); + GroupPntVecR->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPntVecR->TextLabel3->setText(tr("GEOM_RADIUS")); + GroupPntVecR->PushButton1->setIcon(imageSel); + GroupPntVecR->PushButton2->setIcon(imageSel); + GroupPntVecR->LineEdit1->setReadOnly(true); + GroupPntVecR->LineEdit2->setReadOnly(true); + //@@ setup dialog box layout here @@// + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupParams); + layout->addWidget(GroupOrientation); + layout->addWidget(GroupPntVecR); + layout->addWidget(GroupPattern); + /***************************************************************/ + + setHelpFileName("create_divideddisk_page.html"); + + Init(); +} + +//================================================================================= +// Destructor +//================================================================================= +AdvancedGUI_DividedDiskDlg::~AdvancedGUI_DividedDiskDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::Init() +{ + // Get setting of step value from file configuration + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + + // min, max, step and decimals for spin boxes & initial values + initSpinBox(GroupParams->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPntVecR->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" ); + GroupParams ->SpinBox_DX->setValue(100); + GroupPntVecR->SpinBox_DX->setValue(100); + + GroupOrientation->RadioButton1->setChecked(true); + myOrientation = 1; + + GroupPattern->RadioButton1->setChecked(true); + myPattern = GEOM::SQUARE; + + // Signal/slot connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + this, SLOT(SetDoubleSpinBoxStep(double))); + + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPntVecR->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPntVecR->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPntVecR->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(GroupOrientation->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + connect(GroupOrientation->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + connect(GroupOrientation->RadioButton3, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + + connect(GroupPattern->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + connect(GroupPattern->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + + initName(tr("GEOM_DIVIDEDDISK")); + + ConstructorsClicked(0); +} + +//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void AdvancedGUI_DividedDiskDlg::SetDoubleSpinBoxStep (double step) +{ + //@@ set double spin box step for all spin boxes here @@// +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void AdvancedGUI_DividedDiskDlg::ConstructorsClicked (int constructorId) +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + switch (constructorId) { + case 0: + { + GroupPntVecR->hide(); + GroupParams->show(); + GroupOrientation->show(); + + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + globalSelection(); // close local contexts, if any + break; + } + case 1: + { + GroupParams->hide(); + GroupOrientation->hide(); + GroupPntVecR->show(); + + GroupPntVecR->PushButton1->click(); + break; + } + } + + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); + SelectionIntoArgument(); + + displayPreview(true); +} + +//================================================================================= +// function : RadioButtonClicked() +// purpose : Radio button management +//================================================================================= +void AdvancedGUI_DividedDiskDlg::RadioButtonClicked() +{ + QRadioButton* send = (QRadioButton*)sender(); + + // Orientation + if (send == GroupOrientation->RadioButton1) + myOrientation = 1; + else if ( send == GroupOrientation->RadioButton2) + myOrientation = 2; + else if ( send == GroupOrientation->RadioButton3) + myOrientation = 3; + + // Division pattern + else if (send == GroupPattern->RadioButton1) + myPattern = GEOM::SQUARE; + else if (send == GroupPattern->RadioButton2) + myPattern = GEOM::HEXAGON; + + displayPreview(true); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool AdvancedGUI_DividedDiskDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection is changed or on dialog initialization or activation +//================================================================================= +void AdvancedGUI_DividedDiskDlg::SelectionIntoArgument() +{ + if (getConstructorId() == 0) + return; + + erasePreview(); + myEditCurrentArgument->setText(""); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + if (aSelList.Extent() != 1) { + if (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint.nullify(); + else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir.nullify(); + return; + } + + TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPntVecR->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ){ + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + + myEditCurrentArgument->setText(aName); + + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + if (myEditCurrentArgument == GroupPntVecR->LineEdit1) { + myPoint = aSelectedObject; + if (myPoint && !myDir) + GroupPntVecR->PushButton2->click(); + } + else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) { + myDir = aSelectedObject; + if (myDir && !myPoint) + GroupPntVecR->PushButton1->click(); + } + } + displayPreview(true); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if (send == GroupPntVecR->PushButton1) { + myEditCurrentArgument = GroupPntVecR->LineEdit1; + + GroupPntVecR->PushButton2->setDown(false); + GroupPntVecR->LineEdit2->setEnabled(false); + } + else if (send == GroupPntVecR->PushButton2) { + myEditCurrentArgument = GroupPntVecR->LineEdit2; + + GroupPntVecR->PushButton1->setDown(false); + GroupPntVecR->LineEdit1->setEnabled(false); + } + + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + if (myEditCurrentArgument == GroupPntVecR->LineEdit2) { + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + } + else { + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + } + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); + + // seems we need it only to avoid preview disappearing, caused by selection mode change + displayPreview(true); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void AdvancedGUI_DividedDiskDlg::ValueChangedInSpinBox() +{ + displayPreview(true); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr AdvancedGUI_DividedDiskDlg::createOperation() +{ + return getGeomEngine()->GetIAdvancedOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool AdvancedGUI_DividedDiskDlg::isValid (QString& msg) +{ + bool ok = true; + + //@@ add custom validation actions here @@// + + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool AdvancedGUI_DividedDiskDlg::execute (ObjectList& objects) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation()); + CORBA::Double theRatio = 67; // About 2/3 + CORBA::Double theR = 0; + + switch (getConstructorId()) { + case 0: + theR = GroupParams->SpinBox_DX->value(); // init parameter value from dialog box ; + + // call engine function + anObj = anOper->MakeDividedDisk(theR, theRatio, myOrientation, myPattern); + res = !anObj->_is_nil(); + if (res && !IsPreview()) + { + QStringList aParameters; + aParameters << GroupParams->SpinBox_DX->text(); + if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + break; + case 1: + theR = GroupPntVecR->SpinBox_DX->value(); + + // call engine function + anObj = anOper->MakeDividedDiskPntVecR(myPoint.get(), myDir.get(), theR, theRatio, myPattern); + res = !anObj->_is_nil(); + if (res && !IsPreview()) + { + QStringList aParameters; + aParameters << GroupPntVecR->SpinBox_DX->text(); + if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + break; + } + + + if (res) + objects.push_back(anObj._retn()); + + return res; +} diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h new file mode 100644 index 000000000..6e1ceb599 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h @@ -0,0 +1,74 @@ +// Copyright (C) 2007-2008 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 ADVANCEDGUI_DIVIDEDDISKDLG_H +#define ADVANCEDGUI_DIVIDEDDISKDLG_H + +#include + +class DlgRef_1Spin; +class DlgRef_3Radio; +class DlgRef_2Sel1Spin; + +//================================================================================= +// class : AdvancedGUI_DividedDiskDlg +// purpose : +//================================================================================= +class AdvancedGUI_DividedDiskDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + AdvancedGUI_DividedDiskDlg( GeometryGUI*, QWidget* = 0 ); + ~AdvancedGUI_DividedDiskDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + +private: + void Init(); + void enterEvent( QEvent* ); + +private: + GEOM::GeomObjPtr myPoint, myDir; + DlgRef_1Spin* GroupParams; + DlgRef_3Radio* GroupOrientation; + DlgRef_3Radio* GroupPattern; + DlgRef_2Sel1Spin* GroupPntVecR; + int myOrientation; + GEOM::pattern myPattern; + +private slots: + void ConstructorsClicked ( int ); + void ClickOnOk(); + bool ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void ActivateThisDialog(); + void ValueChangedInSpinBox(); + void RadioButtonClicked(); + void SetDoubleSpinBoxStep( double ); +}; + +#endif // ADVANCEDGUI_DIVIDEDDISKDLG_H diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx new file mode 100644 index 000000000..bbf214274 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -0,0 +1,989 @@ +// Copyright (C) 2007-2012 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 "AdvancedGUI_PipeTShapeDlg.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// OCCT Includes +#include +#include +#include +#include +#include +#include +#include + +#include + +//================================================================================= +// Constructor +//================================================================================= +AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI, QWidget* parent) : + GEOMBase_Skeleton(theGeometryGUI, parent, false) { + QPixmap imageOp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE"))); + QPixmap imageSel(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + imageImp = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT")); + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); + + setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE_TSHAPE")); + mainFrame()->RadioButton1->setIcon(imageOp); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + QGridLayout* myMainLayout = new QGridLayout(centralWidget()); + myMainLayout->setMargin(0); + myMainLayout->setSpacing(6); + + tshapeScreenShotLabel = new QLabel(); + tshapeScreenShotLabel->setSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Expanding); + tshapeScreenShotLabel->setAlignment(Qt::AlignCenter); + tshapeScreenShotLabel->setMinimumSize(100, 100); + + MainTubeGroupParams = new DlgRef_3Spin(); + MainTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_MPIPE")); + MainTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R")); + MainTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W")); + MainTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L")); + + IncidentTubeGroupParams = new DlgRef_3Spin(); + IncidentTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_IPIPE")); + IncidentTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R")); + IncidentTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W")); + IncidentTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L")); + + ChamferGroupParams = new DlgRef_2Spin(); + ChamferGroupParams->GroupBox1->setCheckable(true); + ChamferGroupParams->GroupBox1->setChecked(false); + ChamferGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_CHAMFER")); + ChamferGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_H")); + ChamferGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_W")); + + FilletGroupParams = new DlgRef_1Spin(); + FilletGroupParams->GroupBox1->setCheckable(true); + FilletGroupParams->GroupBox1->setChecked(false); + FilletGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_FILLET")); + FilletGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R")); + + HexMeshCheckBox = new QCheckBox(); + HexMeshCheckBox->setText(tr("GEOM_PIPE_TSHAPE_HEX")); + HexMeshCheckBox->setChecked(true); + + JunctionPointsSel = new DlgRef_6Sel(); + JunctionPointsSel->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_POSITION")); + JunctionPointsSel->GroupBox1->setCheckable(true); + JunctionPointsSel->GroupBox1->setChecked(false); + JunctionPointsSel->PushButton1->setIcon(imageSel); + JunctionPointsSel->LineEdit1->setReadOnly(true); + JunctionPointsSel->LineEdit1->setText(""); + JunctionPointsSel->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P1")); + + JunctionPointsSel->PushButton2->setIcon(imageSel); + JunctionPointsSel->LineEdit2->setReadOnly(true); + JunctionPointsSel->LineEdit2->setText(""); + JunctionPointsSel->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P2")); + + JunctionPointsSel->PushButton3->setIcon(imageSel); + JunctionPointsSel->LineEdit3->setReadOnly(true); + JunctionPointsSel->LineEdit3->setText(""); + JunctionPointsSel->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P3")); + + JunctionPointsSel->PushButton4->setIcon(imageImp); + JunctionPointsSel->LineEdit4->setReadOnly(true); + JunctionPointsSel->LineEdit4->setText(""); + JunctionPointsSel->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1")); + + JunctionPointsSel->PushButton5->setIcon(imageImp); + JunctionPointsSel->LineEdit5->setReadOnly(true); + JunctionPointsSel->LineEdit5->setText(""); + JunctionPointsSel->TextLabel5->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2")); + + JunctionPointsSel->PushButton6->setAttribute(Qt::WA_DeleteOnClose); + JunctionPointsSel->PushButton6->close(); + JunctionPointsSel->LineEdit6->setAttribute(Qt::WA_DeleteOnClose); + JunctionPointsSel->LineEdit6->close(); + JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose); + JunctionPointsSel->TextLabel6->close(); + + // 1st row, height = 1, colspan = 3 + int rowPict = 0, colPict = 0, rowspanPict = 1, colspanPict = 3; + // 2nd row, height = 4, col 1 + int rowMain = rowspanPict, colMain = 0, rowspanMain = 2, colspanMain = 1; + int rowCham = rowspanPict + rowspanMain, colCham = 0, rowspanCham = 2, colspanCham = 1; + // 2nd row, height = 4, col 2 + int rowInc = rowspanPict, colInc = 1, rowspanInc = 2, colspanInc = 1; + int rowFill = rowspanPict + rowspanInc, colFill = 1, rowspanFill = 1, colspanFill = 1; + int rowHex = rowspanPict + rowspanInc + rowspanFill, colHex = 1, rowspanHex = 1, colspanHex = 1; + // 2nd row, height = 4, col 3 + int rowNewPosVal = rowspanPict, colNewPosVal = 2, rowspanNewPosVal = 4, colspanNewPosVal = 1; + + myMainLayout->addWidget(tshapeScreenShotLabel, rowPict, colPict, rowspanPict, colspanPict); + + myMainLayout->addWidget(MainTubeGroupParams, rowMain, colMain, rowspanMain, colspanMain); + myMainLayout->addWidget(FilletGroupParams, rowFill, colFill, rowspanFill, colspanFill); + myMainLayout->addWidget(HexMeshCheckBox, rowHex, colHex, rowspanHex, colspanHex); + + myMainLayout->addWidget(IncidentTubeGroupParams, rowInc, colInc, rowspanInc, colspanInc); + myMainLayout->addWidget(ChamferGroupParams, rowCham, colCham, rowspanCham, colspanCham); + + myMainLayout->addWidget(JunctionPointsSel, rowNewPosVal, colNewPosVal, rowspanNewPosVal, colspanNewPosVal); + /***************************************************************/ + + setHelpFileName("create_pipetshape_page.html"); + + Init(); +} + +//================================================================================= +// Destructor +//================================================================================= +AdvancedGUI_PipeTShapeDlg::~AdvancedGUI_PipeTShapeDlg() { + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::Init() { + // Get setting of step value from file configuration + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + + myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + myOkPoint1 = myOkPoint2 = myOkPoint3 = false; + + pipeTShapeGroupObjects.clear(); + + // min, max, step and decimals for spin boxes + initSpinBox(MainTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(MainTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(MainTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(IncidentTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(IncidentTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(IncidentTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(ChamferGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(ChamferGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision"); + initSpinBox(FilletGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision"); + + // init variables + MainTubeGroupParams->SpinBox_DX->setValue(80); + MainTubeGroupParams->SpinBox_DY->setValue(20); + MainTubeGroupParams->SpinBox_DZ->setValue(200); + IncidentTubeGroupParams->SpinBox_DX->setValue(50); + IncidentTubeGroupParams->SpinBox_DY->setValue(20); + IncidentTubeGroupParams->SpinBox_DZ->setValue(200); + ChamferGroupParams->SpinBox_DX->setValue(20); + ChamferGroupParams->SpinBox_DY->setValue(10); + FilletGroupParams->SpinBox_DX->setValue(20); + + CssNormal = QString("QDoubleSpinBox {"); + CssNormal.append(MainTubeGroupParams->SpinBox_DZ->styleSheet()); + CssNormal.append("}"); + CssNormal.append("\nQPushButton {"); + CssNormal.append(JunctionPointsSel->PushButton4->styleSheet()); + CssNormal.append("}"); + CssAcceptable = "QDoubleSpinBox, QPushButton {background-color: rgb(85, 170, 127)}"; + CssRefused = "QDoubleSpinBox, QPushButton {background-color: rgb(255, 0, 0)}"; + + showOnlyPreviewControl(); + + // Signal/slot connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); + // ValueChangedInSpinBox + connect(MainTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(MainTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(IncidentTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(IncidentTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(ChamferGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(ChamferGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(FilletGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + // ChamferOrFillet + connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool))); + connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool))); + // Preview +// connect(PreviewPushButton, SIGNAL(clicked()), this, SLOT(DisplayPreview())); + // Position + connect(JunctionPointsSel->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(SetPosition(bool))); + connect(JunctionPointsSel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(JunctionPointsSel->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(JunctionPointsSel->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + // ApplyNewDimensions + connect(JunctionPointsSel->PushButton4, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions())); + connect(JunctionPointsSel->PushButton5, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions())); + connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(UpdatePicture(QWidget*, QWidget*))); + //@@ put additional signal/slot connections here @@// + + initName(tr("GEOM_PIPE_TSHAPE")); + updateTshapeScreenshotLabel(); + processPreview(); +} + +//================================================================================= +// function : ApplyNewDimensions() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::ApplyNewDimensions() { + QPushButton* send = (QPushButton*) sender(); + + bool ok = false; + double newVal; + if (send == JunctionPointsSel->PushButton4) { + if (!JunctionPointsSel->LineEdit4->text().isEmpty()) { + newVal = JunctionPointsSel->LineEdit4->text().toDouble(&ok); + if (ok) { + disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0); + MainTubeGroupParams->SpinBox_DZ->setValue(newVal); + connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + MainTubeGroupParams->SpinBox_DZ->setToolTip(""); + MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);"); + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } + } + } + else if (send == JunctionPointsSel->PushButton5) { + if (!JunctionPointsSel->LineEdit5->text().isEmpty()) { + newVal = JunctionPointsSel->LineEdit5->text().toDouble(&ok); + if (ok) { + disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0); + IncidentTubeGroupParams->SpinBox_DZ->setValue(newVal); + connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + IncidentTubeGroupParams->SpinBox_DZ->setToolTip(""); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);"); + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } + } + } +} + +//================================================================================= +// function : UpdatePicture() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::UpdatePicture(QWidget* old, QWidget* now) { + + if (ChamferGroupParams->GroupBox1->isChecked()) + if (now == MainTubeGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R1")); + else if (now == MainTubeGroupParams->SpinBox_DY) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W1")); + else if (now == MainTubeGroupParams->SpinBox_DZ) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L1")); + else if (now == IncidentTubeGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R2")); + else if (now == IncidentTubeGroupParams->SpinBox_DY) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W2")); + else if (now == IncidentTubeGroupParams->SpinBox_DZ) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L2")); + else if (now == ChamferGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_H")); + else if (now == ChamferGroupParams->SpinBox_DY) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W")); + else + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER")); + else if (FilletGroupParams->GroupBox1->isChecked()) + if (now == MainTubeGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R1")); + else if (now == MainTubeGroupParams->SpinBox_DY) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W1")); + else if (now == MainTubeGroupParams->SpinBox_DZ) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L1")); + else if (now == IncidentTubeGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R2")); + else if (now == IncidentTubeGroupParams->SpinBox_DY) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W2")); + else if (now == IncidentTubeGroupParams->SpinBox_DZ) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L2")); + else if (now == FilletGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_RF")); + else + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET")); + else + if (now == MainTubeGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R1")); + else if (now == MainTubeGroupParams->SpinBox_DY) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W1")); + else if (now == MainTubeGroupParams->SpinBox_DZ) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L1")); + else if (now == IncidentTubeGroupParams->SpinBox_DX) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R2")); + else if (now == IncidentTubeGroupParams->SpinBox_DY) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W2")); + else if (now == IncidentTubeGroupParams->SpinBox_DZ) + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L2")); + else + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); + + updateTshapeScreenshotLabel(); +} + +//================================================================================= +// function : SetPosition() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::SetPosition(bool isChecked) { + if (isChecked) { + erasePreview(); + JunctionPointsSel->LineEdit4->setText(""); + JunctionPointsSel->LineEdit5->setText(""); +// connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT( +// SelectionIntoArgument())); + JunctionPointsSel->PushButton1->click(); + SelectionIntoArgument(); + } else { + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + JunctionPointsSel->LineEdit4->setText(""); + JunctionPointsSel->LineEdit5->setText(""); + processPreview(); + } +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox(double newValue) +{ + if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() { + + erasePreview(); +// myEditCurrentArgument->setText(""); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + if (aSelList.Extent() != 1) { + if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) + myOkPoint1 = false; + else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) + myOkPoint2 = false; + else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) + myOkPoint3 = false; + return; + myEditCurrentArgument->setText(""); + } + + // nbSel == 1 + if (aSelList.Extent() == 1) { + Handle(SALOME_InteractiveObject) anIO = aSelList.First(); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO); + if (!CORBA::is_nil(aSelectedObject)) { + QString aName = GEOMBase::GetName(aSelectedObject); + TopoDS_Shape aShape; + if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { + + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes(anIO, aMap); + if (aMap.Extent() == 1) { // Local Selection + int anIndex = aMap(1); + aName += QString(":vertex_%1").arg(anIndex); + + //Find SubShape Object in Father + GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); + + if (aFindedObject->_is_nil()) { // Object not found in study + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations(getStudyId()); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + } else { + aSelectedObject = aFindedObject; // get Object from study + } + GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE); + } else { // Global Selection + if (aShape.ShapeType() != TopAbs_VERTEX) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } + + if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) { + return; + } + myEditCurrentArgument->setText(aName); + if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) { + myPoint1 = aSelectedObject; + myOkPoint1 = true; + if (!myOkPoint2) + JunctionPointsSel->PushButton2->click(); + } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) { + myPoint2 = aSelectedObject; + myOkPoint2 = true; + if (!myOkPoint3) + JunctionPointsSel->PushButton3->click(); + } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) { + myPoint3 = aSelectedObject; + myOkPoint3 = true; + if (!myOkPoint1) + JunctionPointsSel->PushButton1->click(); + } + } + } + + if (myOkPoint1 && myOkPoint2 && myOkPoint3) { + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } + +// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First()); +// if (aSelectedObject->_is_nil()) +// return; +// +// myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); +// +// // clear selection +// disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); +// myGeomGUI->getApp()->selectionMgr()->clearSelected(); +// connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +// +// if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) { +// myPoint1 = aSelectedObject; +// myOkPoint1 = true; +// if (!myOkPoint2) +// JunctionPointsSel->PushButton2->click(); +// // P2GroupParams->PushButton1->click(); +// } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) { +// // } else if (myEditCurrentArgument == P2GroupParams->LineEdit1) { +// myPoint2 = aSelectedObject; +// myOkPoint2 = true; +// if (!myOkPoint3) +// JunctionPointsSel->PushButton3->click(); +// // P3GroupParams->PushButton1->click(); +// } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) { +// // } else if (myEditCurrentArgument == P3GroupParams->LineEdit1) { +// myPoint3 = aSelectedObject; +// myOkPoint3 = true; +// if (!myOkPoint1) +// JunctionPointsSel->PushButton1->click(); +// } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument() { + QPushButton* send = (QPushButton*) sender(); + + if (send == JunctionPointsSel->PushButton1) { + myEditCurrentArgument = JunctionPointsSel->LineEdit1; + JunctionPointsSel->PushButton2->setDown(false); + JunctionPointsSel->LineEdit2->setEnabled(false); + JunctionPointsSel->PushButton3->setDown(false); + JunctionPointsSel->LineEdit3->setEnabled(false); + } else if (send == JunctionPointsSel->PushButton2) { + myEditCurrentArgument = JunctionPointsSel->LineEdit2; + JunctionPointsSel->PushButton1->setDown(false); + JunctionPointsSel->LineEdit1->setEnabled(false); + JunctionPointsSel->PushButton3->setDown(false); + JunctionPointsSel->LineEdit3->setEnabled(false); + } else if (send == JunctionPointsSel->PushButton3) { + myEditCurrentArgument = JunctionPointsSel->LineEdit3; + JunctionPointsSel->PushButton1->setDown(false); + JunctionPointsSel->LineEdit1->setEnabled(false); + JunctionPointsSel->PushButton2->setDown(false); + JunctionPointsSel->LineEdit2->setEnabled(false); + } + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + myEditCurrentArgument->setText(""); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); + + JunctionPointsSel->LineEdit4->setText(""); + JunctionPointsSel->LineEdit5->setText(""); + + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); +// globalSelection(GEOM_POINT); + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + +//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::SetDoubleSpinBoxStep(double step) { + MainTubeGroupParams->SpinBox_DX->setSingleStep(step); + MainTubeGroupParams->SpinBox_DY->setSingleStep(step); + MainTubeGroupParams->SpinBox_DZ->setSingleStep(step); + IncidentTubeGroupParams->SpinBox_DX->setSingleStep(step); + IncidentTubeGroupParams->SpinBox_DY->setSingleStep(step); + IncidentTubeGroupParams->SpinBox_DZ->setSingleStep(step); + ChamferGroupParams->SpinBox_DX->setSingleStep(step); + ChamferGroupParams->SpinBox_DY->setSingleStep(step); + FilletGroupParams->SpinBox_DX->setSingleStep(step); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::ClickOnOk() { + setIsApplyAndClose( true ); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() { + if (!onAccept()) + return false; + + initName(); + + return true; +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog() { + GEOMBase_Skeleton::ActivateThisDialog(); + // globalSelection( GEOM_POINT); + // connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL( + // currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if (myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); +} + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) { + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : resizeEvent [REDEFINED] +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::resizeEvent(QResizeEvent */*event*/) { + QSize scaledSize = imagePipeTShape.size(); + scaledSize.scale(tshapeScreenShotLabel->size(), Qt::KeepAspectRatio); + if (!tshapeScreenShotLabel->pixmap() + || scaledSize != tshapeScreenShotLabel->pixmap()->size()) + updateTshapeScreenshotLabel(); +} + +//================================================================================= +// function : updateTshapeScreenshotLabel +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::updateTshapeScreenshotLabel() { + tshapeScreenShotLabel->setPixmap(imagePipeTShape.scaled(tshapeScreenShotLabel->size(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation)); +} + +//================================================================================= +// function : ChamferOrFillet() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) { + QGroupBox* send = (QGroupBox*) sender(); + + if (send == ChamferGroupParams->GroupBox1) { + if (send->isChecked()) { + disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0); + FilletGroupParams->GroupBox1->setChecked(false); + connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool))); + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER")); + } + else + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); + updateTshapeScreenshotLabel(); + if (myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } else if (send == FilletGroupParams->GroupBox1) { + if (send->isChecked()) { + disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0); + ChamferGroupParams->GroupBox1->setChecked(!send->isChecked()); + connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool))); + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET")); + } + else + imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); + updateTshapeScreenshotLabel(); + if (myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } + +} + +//================================================================================= +// function : DisplayPreview() +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::DisplayPreview(const bool activate, const bool update, const bool toRemoveFromEngine, + const double lineWidth, const int displayMode, const int color) { + isPreview = true; + QString msg; + if (!isValid(msg)) { + erasePreview(update); + isPreview = false; + return; + } + + erasePreview(false); + + try { + SUIT_OverrideCursor wc; + ObjectList objects; + bool hexMeshState = HexMeshCheckBox->isChecked(); + HexMeshCheckBox->setChecked(false); + if (!executeNoCheck(objects) || !getOperation()->IsDone()) { + wc.suspend(); + } else { + ObjectList::iterator it = objects.begin(); + GEOM::GEOM_Object_var obj = *it; + displayPreview(obj, true, activate, false, lineWidth, displayMode, color); + if (toRemoveFromEngine) + obj->UnRegister(); + } + HexMeshCheckBox->setChecked(hexMeshState); + } catch (const SALOME::SALOME_Exception& e) { + SalomeApp_Tools::QtCatchCorbaException(e); + } + + isPreview = false; + + if (update) + updateViewer(); +} +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() { + return getGeomEngine()->GetIAdvancedOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) { + bool ok = true; + + ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok; + ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok; + ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok; + ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok; + ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok; + ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok; + ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok; + ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok; + ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok; + + ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok; + ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok; + ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok; + ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok; + ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok; + ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok; + ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok; + ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok; + ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok; + + if (JunctionPointsSel->GroupBox1->isChecked()) + ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok; + + return ok; +} + +//================================================================================= +// function : CheckCompatiblePosition() +// purpose : +//================================================================================= +bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1, + GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) { + + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton4->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton5->setStyleSheet(CssNormal); + + CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value(); + CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value(); + + JunctionPointsSel->LineEdit4->setText(""); + JunctionPointsSel->LineEdit5->setText(""); + + MainTubeGroupParams->SpinBox_DZ->setToolTip(""); + IncidentTubeGroupParams->SpinBox_DZ->setToolTip(""); + + TopoDS_Shape aShape; + gp_Pnt P1, P2, P3; + if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); + else + return false; + + if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); + else + return false; + + if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); + else + return false; + + double d12 = P1.Distance(P2); + double d13 = P1.Distance(P3); + double d23 = P2.Distance(P3); + + if (Abs(d12) <= Precision::Confusion()) { +// SetErrorCode("Junctions points P1 and P2 are identical"); + return false; + } + if (Abs(d13) <= Precision::Confusion()) { +// SetErrorCode("Junctions points P1 and P3 are identical"); + return false; + } + if (Abs(d23) <= Precision::Confusion()) { +// SetErrorCode("Junctions points P2 and P3 are identical"); + return false; + } + + long double newL1 = 0.5 * d12; + long double newL2 = sqrt(pow(d13,2)-pow(newL1,2)); + + JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7)); + JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7)); + + if (fabs(newL1 - theL1) > Precision::Approximation()) { + if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) && + (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) { + disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0); + MainTubeGroupParams->SpinBox_DZ->setValue(newL1); + connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position"); + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable); + JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable); + } + else { + MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); + JunctionPointsSel->PushButton4->setStyleSheet(CssRefused); + } + } + else { + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton4->setStyleSheet(CssNormal); + } + + if (fabs(newL2 - theL2) > Precision::Approximation()) { + if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) && + (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) { + disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0); + IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2); + connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position"); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable); + JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable); + } + else { + IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); + JunctionPointsSel->PushButton5->setStyleSheet(CssRefused); + } + } + else { + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton5->setStyleSheet(CssNormal); + } + + return true; +} + +bool AdvancedGUI_PipeTShapeDlg::execute(ObjectList& objects) { + + if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + + return executeNoCheck(objects); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool AdvancedGUI_PipeTShapeDlg::executeNoCheck(ObjectList& objects) { + bool res = false; + + // GEOM::GEOM_Object_var anObj; + GEOM::ListOfGO_var anObj; + + GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation()); + + //@@ retrieve input values from the widgets here @@// + CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value(); + CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value(); + CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value(); + CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value(); + CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value(); + CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value(); + CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value(); + CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value(); + CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value(); + CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked(); + +// if (JunctionPointsSel->GroupBox1->isChecked()) { +// CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01); +// theL1 = MainTubeGroupParams->SpinBox_DZ->value(); +// theL2 = IncidentTubeGroupParams->SpinBox_DZ->value(); +// } + + // call engine function + if (ChamferGroupParams->GroupBox1->isChecked()) { + if (JunctionPointsSel->GroupBox1->isChecked()) + anObj = anOper->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, + theHexMesh, myPoint1, myPoint2, myPoint3); + else + anObj = anOper->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh); + } + else if (FilletGroupParams->GroupBox1->isChecked()) { + if (JunctionPointsSel->GroupBox1->isChecked()) + anObj = anOper->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, + theHexMesh, myPoint1, myPoint2, myPoint3); + else + anObj = anOper->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh); + } + else { + if (JunctionPointsSel->GroupBox1->isChecked()) + anObj = anOper->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, myPoint1, + myPoint2, myPoint3); + else + anObj = anOper->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh); + } + + res = anObj->length(); + if (!res) + return false; + + // res = !anObj->_is_nil(); + if (res && !IsPreview()) { + QStringList aParameters; + //@@ put stringified input parameters to the string list here to store in the data model for notebook @@// + aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter + aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter + aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter + aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter + aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter + aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter + if (ChamferGroupParams->GroupBox1->isChecked()) {// Chamfer parameter + aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter + aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter + } + if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter + aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter + + if (aParameters.count() > 0) + anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData()); + } + + objects.push_back(anObj[0]._retn()); + pipeTShapeGroupObjects.clear(); + for (int i = 1, n = anObj->length(); i < n; i++) { + pipeTShapeGroupObjects.push_back(anObj[i]._retn()); + } + + return objects.size() > 0; +} + +//================================================================================= +// function : restoreSubShapes +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject) { + SALOMEDS::GenericAttribute_var anAttr; + if (!theSObject->FindAttribute(anAttr, "AttributeIOR")) + return; + + SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + CORBA::String_var anIORso = anAttrIOR->Value(); + + // get Object from SObject + GEOM::GEOM_Object_var theFather = GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso)); + if (CORBA::is_nil(theFather)) + return; + + ObjectList::iterator it = pipeTShapeGroupObjects.begin(); + + for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) { + getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather); + } + +} + +//================================================================================= +// function : processPreview() +// purpose : Display preview if CheckBoxPreview is checked +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::processPreview() { + if(mainFrame()->CheckBoxPreview->isChecked()) + DisplayPreview(); + else + erasePreview(true); +} diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h new file mode 100644 index 000000000..04147ea96 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h @@ -0,0 +1,96 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef ADVANCEDGUI_PIPETSHAPEDLG_H +#define ADVANCEDGUI_PIPETSHAPEDLG_H + +#include + +class DlgRef_1Spin; +class DlgRef_2Spin; +class DlgRef_3Spin; +class DlgRef_3Sel; +class DlgRef_6Sel; +class QCheckBox; +class QLineEdit; +class QLabel; + +//================================================================================= +// class : AdvancedGUI_PipeTShapeDlg +// purpose : +//================================================================================= +class AdvancedGUI_PipeTShapeDlg: public GEOMBase_Skeleton { +Q_OBJECT + +public: + AdvancedGUI_PipeTShapeDlg(GeometryGUI*, QWidget* = 0); + ~AdvancedGUI_PipeTShapeDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid(QString&); + virtual bool execute(ObjectList&); + virtual void restoreSubShapes(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr); + +private: + void Init(); + void enterEvent(QEvent*); + void resizeEvent(QResizeEvent *event); + void updateTshapeScreenshotLabel(); + bool CheckCompatiblePosition(GEOM::GEOM_Object_var theP1, + GEOM::GEOM_Object_var theP2, + GEOM::GEOM_Object_var theP3, double theTolerance); + +private: + QPixmap imagePipeTShape; + QLabel* tshapeScreenShotLabel; + DlgRef_3Spin* MainTubeGroupParams; + DlgRef_3Spin* IncidentTubeGroupParams; + DlgRef_2Spin* ChamferGroupParams; + DlgRef_1Spin* FilletGroupParams; + DlgRef_6Sel* JunctionPointsSel; + QPixmap imageImp; + QString CssNormal, CssAcceptable, CssRefused; + QCheckBox* HexMeshCheckBox; + GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; + bool myOkPoint1, myOkPoint2, myOkPoint3; + bool isPreview; + ObjectList pipeTShapeGroupObjects; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void DisplayPreview(const bool activate = false, const bool update = true, + const bool toRemoveFromEngine = true, const double lineWidth = -1, + const int displayMode = -1, const int color = -1); + virtual void processPreview(); + void SetPosition(bool); + void ChamferOrFillet(bool); + void SetDoubleSpinBoxStep(double); + void ValueChangedInSpinBox( double ); + void UpdatePicture(QWidget* old, QWidget* now); + void ApplyNewDimensions(); + bool executeNoCheck( ObjectList& objects ); +}; + +#endif // ADVANCEDGUI_PIPETSHAPEDLG_H diff --git a/src/AdvancedGUI/Makefile.am b/src/AdvancedGUI/Makefile.am new file mode 100644 index 000000000..9301bd4ca --- /dev/null +++ b/src/AdvancedGUI/Makefile.am @@ -0,0 +1,89 @@ +# Copyright (C) 2007-2012 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 +# + +# 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 +salomeinclude_HEADERS = \ + AdvancedGUI.h + +ADVANCED_INCLUDES = +ADVANCED_INCLUDES += AdvancedGUI_PipeTShapeDlg.h +ADVANCED_INCLUDES += AdvancedGUI_DividedDiskDlg.h +ADVANCED_INCLUDES += AdvancedGUI_DividedCylinderDlg.h +##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@## + +salomeinclude_HEADERS += $(ADVANCED_INCLUDES) + +# Libraries targets +lib_LTLIBRARIES = libAdvancedGUI.la + +dist_libAdvancedGUI_la_SOURCES = \ + AdvancedGUI.h \ + AdvancedGUI.cxx + +ADVANCED_SOURCES = +ADVANCED_SOURCES += AdvancedGUI_PipeTShapeDlg.h AdvancedGUI_PipeTShapeDlg.cxx +ADVANCED_SOURCES += AdvancedGUI_DividedDiskDlg.h AdvancedGUI_DividedDiskDlg.cxx +ADVANCED_SOURCES += AdvancedGUI_DividedCylinderDlg.h AdvancedGUI_DividedCylinderDlg.cxx +##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@## + +dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES) + +MOC_FILES = + +ADVANCED_MOC_FILES = +ADVANCED_MOC_FILES += AdvancedGUI_PipeTShapeDlg_moc.cxx +ADVANCED_MOC_FILES += AdvancedGUI_DividedDiskDlg_moc.cxx +ADVANCED_MOC_FILES += AdvancedGUI_DividedCylinderDlg_moc.cxx +##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@## + +MOC_FILES += $(ADVANCED_MOC_FILES) + +nodist_libAdvancedGUI_la_SOURCES = \ + $(MOC_FILES) + +# additional information to compile and link file + +libAdvancedGUI_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(VTK_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(PYTHON_INCLUDES) \ + $(BOOST_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(srcdir)/../GEOMGUI \ + -I$(srcdir)/../DlgRef \ + -I$(srcdir)/../GEOMBase \ + -I$(srcdir)/../OBJECT \ + -I$(srcdir)/../GEOMClient \ + -I$(srcdir)/../GEOMImpl \ + -I$(srcdir)/../GEOMFiltersSelection \ + -I$(top_builddir)/src/DlgRef \ + -I$(top_builddir)/idl + +libAdvancedGUI_la_LDFLAGS = \ + ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ + ../GEOMBase/libGEOMBase.la diff --git a/src/BREPExport/BREPExport.cxx b/src/BREPExport/BREPExport.cxx index bce5d516e..6c125cac0 100644 --- a/src/BREPExport/BREPExport.cxx +++ b/src/BREPExport/BREPExport.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: BREPExport.cxx -// Created: Wed May 19 13:10:05 2004 -// Author: Pavel TELKOV -// + +// File: BREPExport.cxx +// Created: Wed May 19 13:10:05 2004 +// Author: Pavel TELKOV +// // #include "utilities.h" @@ -32,7 +33,7 @@ #include #ifdef WNT - #if defined BREPEXPORT_EXPORTS + #if defined BREPEXPORT_EXPORTS || defined BREPExport_EXPORTS #if defined WIN32 #define BREPEXPORT_EXPORT __declspec( dllexport ) #else diff --git a/src/BREPExport/BREPExport.pro b/src/BREPExport/BREPExport.pro deleted file mode 100644 index 72dc646d0..000000000 --- a/src/BREPExport/BREPExport.pro +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = BREPExport -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${KERNEL_LDFLAGS} -lSALOMELocalTrace $${STDLIB} $${CAS_LDPATH} -lTKBRep - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += BREPEXPORT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -SOURCES = BREPExport.cxx diff --git a/src/BREPExport/Makefile.am b/src/BREPExport/Makefile.am index 239baba5a..94f4ed160 100644 --- a/src/BREPExport/Makefile.am +++ b/src/BREPExport/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Pavel TELKOV # Modified by : Alexander BORODIN (OCN) - autotools usage diff --git a/src/BREPImport/BREPImport.cxx b/src/BREPImport/BREPImport.cxx index ecc09a6e2..287564270 100644 --- a/src/BREPImport/BREPImport.cxx +++ b/src/BREPImport/BREPImport.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: BREPImport.cxx -// Created: Wed May 19 14:29:52 2004 -// Author: Pavel TELKOV -// + +// File: BREPImport.cxx +// Created: Wed May 19 14:29:52 2004 +// Author: Pavel TELKOV +// // #include "utilities.h" @@ -31,9 +32,10 @@ #include #include +#include #ifdef WNT - #if defined BREPIMPORT_EXPORTS + #if defined BREPIMPORT_EXPORTS || defined BREPImport_EXPORTS #if defined WIN32 #define BREPIMPORT_EXPORT __declspec( dllexport ) #else @@ -61,7 +63,8 @@ extern "C" BREPIMPORT_EXPORT TopoDS_Shape Import (const TCollection_AsciiString& theFileName, const TCollection_AsciiString& /*theFormatName*/, - TCollection_AsciiString& theError) + TCollection_AsciiString& theError, + const TDF_Label&) { MESSAGE("Import BREP from file " << theFileName); TopoDS_Shape aShape; diff --git a/src/BREPImport/BREPImport.pro b/src/BREPImport/BREPImport.pro deleted file mode 100644 index dc2fe28d4..000000000 --- a/src/BREPImport/BREPImport.pro +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = BREPImport -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${KERNEL_LDFLAGS} -lSALOMELocalTrace $${STDLIB} $${CAS_LDPATH} -lTKBRep - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += BREPIMPORT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -SOURCES = BREPImport.cxx diff --git a/src/BREPImport/Makefile.am b/src/BREPImport/Makefile.am index 6d5eaf220..f531040e4 100644 --- a/src/BREPImport/Makefile.am +++ b/src/BREPImport/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Pavel TELKOV # Modified by : Alexander BORODIN (OCN) - autotools usage diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx index 47c7e1135..10ae19e27 100644 --- a/src/BasicGUI/BasicGUI.cxx +++ b/src/BasicGUI/BasicGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -33,10 +34,10 @@ #include "BasicGUI_CurveDlg.h" // Method CURVE #include "BasicGUI_VectorDlg.h" // Method VECTOR #include "BasicGUI_PlaneDlg.h" // Method PLANE -#include "BasicGUI_WorkingPlaneDlg.h" // Method WORKING PLANE -#include "BasicGUI_MarkerDlg.h" // Method REPAIR +#include "BasicGUI_MarkerDlg.h" // Method LOCAL COORDINATE SYSTEM #include +#include "GeometryGUI_Operations.h" #include #include @@ -81,34 +82,31 @@ bool BasicGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; switch ( theCommandID ) { - case 4011: // POINT + case GEOMOp::OpPoint: // POINT aDlg = new BasicGUI_PointDlg( getGeometryGUI(), parent ); break; - case 4012: // LINE + case GEOMOp::OpLine: // LINE aDlg = new BasicGUI_LineDlg( getGeometryGUI(), parent ); break; - case 4013: // CIRCLE + case GEOMOp::OpCircle: // CIRCLE aDlg = new BasicGUI_CircleDlg( getGeometryGUI(), parent ); break; - case 4014: // ELLIPSE + case GEOMOp::OpEllipse: // ELLIPSE aDlg = new BasicGUI_EllipseDlg( getGeometryGUI(), parent ); break; - case 4015: // ARC + case GEOMOp::OpArc: // ARC aDlg = new BasicGUI_ArcDlg( getGeometryGUI(), parent ); break ; - case 4016: // VECTOR + case GEOMOp::OpVector: // VECTOR aDlg = new BasicGUI_VectorDlg( getGeometryGUI(), parent ); break; - case 4017: // PLANE + case GEOMOp::OpPlane: // PLANE aDlg = new BasicGUI_PlaneDlg( getGeometryGUI(), parent ); break; - case 4018: // WORKING PLANE - aDlg = new BasicGUI_WorkingPlaneDlg( getGeometryGUI(), parent ); - break; - case 4019: // CURVE + case GEOMOp::OpCurve: // CURVE aDlg = new BasicGUI_CurveDlg( getGeometryGUI(), parent ); break; - case 4020: // REPAIR + case GEOMOp::OpLCS: // LOCAL COORDINATE SYSTEM aDlg = new BasicGUI_MarkerDlg( getGeometryGUI(), parent ); break; default: diff --git a/src/BasicGUI/BasicGUI.h b/src/BasicGUI/BasicGUI.h index 1b95e5fbf..203eb3599 100644 --- a/src/BasicGUI/BasicGUI.h +++ b/src/BasicGUI/BasicGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/BasicGUI/BasicGUI.pro b/src/BasicGUI/BasicGUI.pro deleted file mode 100644 index 2ef9147a0..000000000 --- a/src/BasicGUI/BasicGUI.pro +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = BasicGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../DlgRef ../GEOMGUI ../GEOMFiltersSelection ../GEOMBase ../GEOMImpl ../GEOMClient $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMBase -lGEOM $${GUI_LDFLAGS} -lsuit - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += BASICGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = BasicGUI_PointDlg.h -HEADERS += GEOM_BasicGUI.hxx - -SOURCES = BasicGUI.cxx -SOURCES += BasicGUI_PointDlg.cxx -SOURCES += BasicGUI_LineDlg.cxx -SOURCES += BasicGUI_CircleDlg.cxx -SOURCES += BasicGUI_EllipseDlg.cxx -SOURCES += BasicGUI_ArcDlg.cxx -SOURCES += BasicGUI_VectorDlg.cxx -SOURCES += BasicGUI_PlaneDlg.cxx -SOURCES += BasicGUI_WorkingPlaneDlg.cxx -SOURCES += BasicGUI_CurveDlg.cxx -SOURCES += BasicGUI_MarkerDlg.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 7326a37e2..abbcc3910 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_ArcDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -51,7 +52,7 @@ // TRUE to construct a modal dialog. //================================================================================= BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); @@ -158,7 +159,9 @@ void BasicGUI_ArcDlg::Init() /* init variables */ myEditCurrentArgument = Group3Pnts->LineEdit1; - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + myPoint1.nullify(); + myPoint2.nullify(); + myPoint3.nullify(); Group3Pnts2->CheckButton1->setChecked( false ); Group3Pnts->PushButton1->setDown(true); @@ -175,30 +178,18 @@ void BasicGUI_ArcDlg::Init() connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group3Pnts2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group3Pnts2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( Group3Pnts2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) ); connect( Group3Pnts3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group3Pnts3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group3Pnts3->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( Group3Pnts3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts3->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts3->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_ARC" ) ); @@ -213,6 +204,7 @@ void BasicGUI_ArcDlg::Init() //================================================================================= void BasicGUI_ArcDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -248,124 +240,87 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() if (aSelList.Extent() != 1) { switch (getConstructorId()) { case 0: - if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - return; + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3.nullify(); break; case 1: - if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - return; + if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1.nullify(); + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2.nullify(); + else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3.nullify(); break; case 2: - if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - return; + if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) myPoint1.nullify(); + else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) myPoint2.nullify(); + else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) myPoint3.nullify(); + break; + default: break; } + return; } - // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape - TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) // Local Selection - { - int anIndex = aMap(1); - aName += QString(":vertex_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else - aSelectedObject = aFindedObject; // get Object from study - } - else // Global Selection - { - if (aShape.ShapeType() != TopAbs_VERTEX) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); myEditCurrentArgument->setText(aName); - - if (!aSelectedObject->_is_nil()) { // clear selection if something selected - globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - } - switch ( getConstructorId() ) { case 0: - if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) { - myPoint1 = aSelectedObject; - if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) - Group3Pnts->PushButton2->click(); + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) { + myPoint1 = aSelectedObject; + if ( myPoint1 && !myPoint2 ) + Group3Pnts->PushButton2->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) { - myPoint2 = aSelectedObject; - if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) - Group3Pnts->PushButton3->click(); + myPoint2 = aSelectedObject; + if ( myPoint2 && !myPoint3 ) + Group3Pnts->PushButton3->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) { - myPoint3 = aSelectedObject; - if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) - Group3Pnts->PushButton1->click(); + myPoint3 = aSelectedObject; + if ( myPoint3 && !myPoint1 ) + Group3Pnts->PushButton1->click(); } break; case 1: if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) { - myPoint1 = aSelectedObject; - if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) - Group3Pnts2->PushButton2->click(); + myPoint1 = aSelectedObject; + if ( myPoint1 && !myPoint2 ) + Group3Pnts2->PushButton2->click(); } else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) { - myPoint2 = aSelectedObject; - if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) - Group3Pnts2->PushButton3->click(); + myPoint2 = aSelectedObject; + if ( myPoint2 && !myPoint3 ) + Group3Pnts2->PushButton3->click(); } else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) { - myPoint3 = aSelectedObject; - if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) - Group3Pnts2->PushButton1->click(); + myPoint3 = aSelectedObject; + if ( myPoint3 && !myPoint1 ) + Group3Pnts2->PushButton1->click(); } break; case 2: if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) { - myPoint1 = aSelectedObject; - if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) - Group3Pnts3->PushButton2->click(); + myPoint1 = aSelectedObject; + if ( myPoint1 && !myPoint2 ) + Group3Pnts3->PushButton2->click(); } else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) { - myPoint2 = aSelectedObject; - if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) - Group3Pnts3->PushButton3->click(); + myPoint2 = aSelectedObject; + if ( myPoint2 && !myPoint3 ) + Group3Pnts3->PushButton3->click(); } else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) { - myPoint3 = aSelectedObject; - if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) - Group3Pnts3->PushButton1->click(); + myPoint3 = aSelectedObject; + if ( myPoint3 && !myPoint1 ) + Group3Pnts3->PushButton1->click(); } break; } } - displayPreview(); + displayPreview(true); } @@ -462,23 +417,7 @@ void BasicGUI_ArcDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); send->setDown(true); - displayPreview(); -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_ArcDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 || - send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 || - send == Group3Pnts3->LineEdit1 || send == Group3Pnts3->LineEdit2 || send == Group3Pnts3->LineEdit3 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } @@ -491,9 +430,9 @@ void BasicGUI_ArcDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), - this, - SLOT(SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), + this, + SLOT(SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -517,49 +456,15 @@ GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation() return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); } -//================================================================================= -// function : isEqual -// purpose : it may also be needed to check for min distance between gp_Pnt-s... -//================================================================================= -static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) -{ - return thePnt1->_is_equivalent( thePnt2 ); -} - //================================================================================= // function : isValid // purpose : //================================================================================= bool BasicGUI_ArcDlg::isValid( QString& msg ) { - switch (getConstructorId()) { - case 0: - { - if (Group3Pnts->LineEdit1->text().trimmed().isEmpty() || - Group3Pnts->LineEdit2->text().trimmed().isEmpty() || - Group3Pnts->LineEdit3->text().trimmed().isEmpty()) - return false; - break; - } - case 1: - { - if (Group3Pnts2->LineEdit1->text().trimmed().isEmpty() || - Group3Pnts2->LineEdit2->text().trimmed().isEmpty() || - Group3Pnts2->LineEdit3->text().trimmed().isEmpty()) - return false; - break; - } - case 2: - { - if (Group3Pnts3->LineEdit1->text().trimmed().isEmpty() || - Group3Pnts3->LineEdit2->text().trimmed().isEmpty() || - Group3Pnts3->LineEdit3->text().trimmed().isEmpty()) - return false; - break; - } - } - return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && - !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + bool ok = myPoint1 && myPoint2 && myPoint3 && + myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3; + return ok; } //================================================================================= @@ -571,29 +476,31 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects ) bool res = false; GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() ); + switch ( getConstructorId() ) { case 0: { - if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) { - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArc( myPoint1, myPoint2, myPoint3 ); - res = true; + if ( myPoint1 && myPoint2 && myPoint3 ) { + anObj = anOper->MakeArc( myPoint1.get(), myPoint2.get(), myPoint3.get() ); + res = true; } break; } case 1: { bool Sense = Group3Pnts2->CheckButton1->isChecked(); - if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) { - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArcCenter( myPoint1, myPoint2, myPoint3, Sense ); - res = true; + if ( myPoint1 && myPoint2 && myPoint3 ) { + anObj = anOper->MakeArcCenter( myPoint1.get(), myPoint2.get(), myPoint3.get(), Sense ); + res = true; } break; } case 2: { - if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) { - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArcOfEllipse( myPoint1, myPoint2, myPoint3 ); - res = true; + if ( myPoint1 && myPoint2 && myPoint3 ) { + anObj = anOper->MakeArcOfEllipse( myPoint1.get(), myPoint2.get(), myPoint3.get() ); + res = true; } break; } @@ -612,12 +519,13 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) { disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); + myPoint1.nullify(); + myPoint2.nullify(); + myPoint3.nullify(); + switch ( constructorId ) { case 0: { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes - Group3Pnts->show(); Group3Pnts2->hide(); Group3Pnts3->hide(); @@ -630,16 +538,12 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) Group3Pnts->LineEdit1->setEnabled(true); Group3Pnts->LineEdit2->setEnabled(false); Group3Pnts->LineEdit3->setEnabled(false); - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); myEditCurrentArgument = Group3Pnts->LineEdit1; break; } case 1: { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes - Group3Pnts->hide(); Group3Pnts2->show(); Group3Pnts3->hide(); @@ -652,16 +556,12 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) Group3Pnts2->LineEdit1->setEnabled(true); Group3Pnts2->LineEdit2->setEnabled(false); Group3Pnts2->LineEdit3->setEnabled(false); - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); myEditCurrentArgument = Group3Pnts2->LineEdit1; break; } case 2: { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes - Group3Pnts->hide(); Group3Pnts2->hide(); Group3Pnts3->show(); @@ -674,25 +574,26 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) Group3Pnts3->LineEdit1->setEnabled(true); Group3Pnts3->LineEdit2->setEnabled(false); Group3Pnts3->LineEdit3->setEnabled(false); - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); myEditCurrentArgument = Group3Pnts3->LineEdit1; break; } } + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes + qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); myEditCurrentArgument->setFocus(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); - if ( CORBA::is_nil( myPoint1 ) ) - SelectionIntoArgument(); + SelectionIntoArgument(); - displayPreview(); + displayPreview(true); } //================================================================================= @@ -701,7 +602,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) //================================================================================= void BasicGUI_ArcDlg::ReverseSense() { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -710,24 +611,15 @@ void BasicGUI_ArcDlg::ReverseSense() //================================================================================= void BasicGUI_ArcDlg::addSubshapesToStudy() { - QMap objMap; - switch ( getConstructorId() ) { case 0: - objMap[Group3Pnts->LineEdit1->text()] = myPoint1; - objMap[Group3Pnts->LineEdit2->text()] = myPoint2; - objMap[Group3Pnts->LineEdit3->text()] = myPoint3; - break; case 1: - objMap[Group3Pnts2->LineEdit1->text()] = myPoint1; - objMap[Group3Pnts2->LineEdit2->text()] = myPoint2; - objMap[Group3Pnts2->LineEdit3->text()] = myPoint3; - break; case 2: - objMap[Group3Pnts3->LineEdit1->text()] = myPoint1; - objMap[Group3Pnts3->LineEdit2->text()] = myPoint2; - objMap[Group3Pnts3->LineEdit3->text()] = myPoint3; + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); + GEOMBase::PublishSubObject( myPoint3.get() ); + break; + default: break; } - addSubshapesToFather( objMap ); } diff --git a/src/BasicGUI/BasicGUI_ArcDlg.h b/src/BasicGUI/BasicGUI_ArcDlg.h index 49828b720..31ab4d73d 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.h +++ b/src/BasicGUI/BasicGUI_ArcDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_ArcDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BASICGUI_ARCDLG_H #define BASICGUI_ARCDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_3Sel; class DlgRef_3Sel1Check; @@ -55,7 +57,7 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; + GEOM::GeomObjPtr myPoint1, myPoint2, myPoint3; DlgRef_3Sel* Group3Pnts; DlgRef_3Sel1Check* Group3Pnts2; @@ -67,7 +69,6 @@ private slots: void ActivateThisDialog(); void ConstructorsClicked( int ); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ReverseSense(); diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 3c1858203..b69c3660c 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CircleDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -50,7 +51,7 @@ // TRUE to construct a modal dialog. //================================================================================= BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CIRCLE_PV" ) ) ); @@ -69,8 +70,8 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* pa GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() ); GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupPntVecR->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) + " (Origin by default)" ); - GroupPntVecR->TextLabel2->setText( tr( "GEOM_VECTOR" ) + " (Z axis by default)" ); + GroupPntVecR->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) + " " + tr( "GEOM_CENTER_DEFAULT" ) ); + GroupPntVecR->TextLabel2->setText( tr( "GEOM_VECTOR" ) + " " + tr( "GEOM_AXIS_DEFAULT" ) ); GroupPntVecR->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); GroupPntVecR->PushButton1->setIcon( image1 ); GroupPntVecR->PushButton2->setIcon( image1 ); @@ -149,16 +150,21 @@ void BasicGUI_CircleDlg::Init() /* init variables */ myEditCurrentArgument = GroupPntVecR->LineEdit1; - myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); - - // myGeomGUI->SetState( 0 ); + myPoint.nullify(); + myDir.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); + myPoint3.nullify(); + myPoint4.nullify(); + myPoint5.nullify(); + myPoint6.nullify(); /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes & initial values */ - initSpinBox( GroupPntVecR->SpinBox_DX, 0.000001, COORD_MAX, aStep, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPntVecR->SpinBox_DX, 0.000001, COORD_MAX, aStep, "length_precision" ); GroupPntVecR->SpinBox_DX->setValue( 100 ); /* signals and slots connections */ @@ -180,9 +186,6 @@ void BasicGUI_CircleDlg::Init() connect( GroupCenter2Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupCenter2Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPntVecR->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupPntVecR->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupPntVecR->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT(ValueChangedInSpinBox() ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); @@ -211,7 +214,14 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) { disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); + myPoint3.nullify(); + myPoint4.nullify(); + myPoint5.nullify(); + myPoint6.nullify(); switch ( constructorId ) { case 0: @@ -250,7 +260,7 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) case 2: { GroupPntVecR->hide(); - Group3Pnts->hide(); + Group3Pnts->hide(); GroupCenter2Pnts->show(); myEditCurrentArgument = GroupCenter2Pnts->LineEdit1; @@ -270,15 +280,16 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); + SelectionIntoArgument(); myEditCurrentArgument->setFocus(); globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); - displayPreview(); + displayPreview(true); } //================================================================================= @@ -287,6 +298,7 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) //================================================================================= void BasicGUI_CircleDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -318,110 +330,69 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() aSelMgr->selectedObjects( aList ); if ( aList.Extent() != 1 ) { - if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = GEOM::GEOM_Object::_nil(); + if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint.nullify(); + else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3.nullify(); + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4.nullify(); + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5.nullify(); + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6.nullify(); return; } - // nbSel == 1 - Handle(SALOME_InteractiveObject) anIO = aList.First(); - - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName( aSelectedObject ); - - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) - aNeedType = TopAbs_EDGE; - - // If selected Vertex or Edge on the some Shape Get selection Subshape - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(anIO, aMap); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap(1); - if ( aNeedType == TopAbs_EDGE ) - aName += QString( ":edge_%1" ).arg( anIndex ); - else - aName += QString( ":vertex_%1" ).arg( anIndex ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - } - else { // Global Selection - if ( aShape.ShapeType() != aNeedType ) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) ? + TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); myEditCurrentArgument->setText( aName ); - if (!aSelectedObject->_is_nil()) { // clear selection if something selected - globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); - } - if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) { myPoint = aSelectedObject; - if ( !myPoint->_is_nil() && myDir->_is_nil() ) - GroupPntVecR->PushButton2->click(); + if ( myPoint && !myDir ) + GroupPntVecR->PushButton2->click(); } else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) { myDir = aSelectedObject; - if ( !myDir->_is_nil() && myPoint->_is_nil() ) - GroupPntVecR->PushButton1->click(); + if ( myDir && !myPoint ) + GroupPntVecR->PushButton1->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) { myPoint1 = aSelectedObject; - if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) - Group3Pnts->PushButton2->click(); + if ( myPoint1 && !myPoint2 ) + Group3Pnts->PushButton2->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) { myPoint2 = aSelectedObject; - if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) - Group3Pnts->PushButton3->click(); + if ( myPoint2 && !myPoint3 ) + Group3Pnts->PushButton3->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) { myPoint3 = aSelectedObject; - if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) - Group3Pnts->PushButton1->click(); + if ( myPoint3 && !myPoint1 ) + Group3Pnts->PushButton1->click(); } else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) { myPoint4 = aSelectedObject; - if ( !myPoint4->_is_nil() && myPoint5->_is_nil() ) - GroupCenter2Pnts->PushButton2->click(); + if ( myPoint4 && !myPoint5 ) + GroupCenter2Pnts->PushButton2->click(); } else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) { myPoint5 = aSelectedObject; - if ( !myPoint5->_is_nil() && myPoint6->_is_nil() ) - GroupCenter2Pnts->PushButton3->click(); + if ( myPoint5 && !myPoint6 ) + GroupCenter2Pnts->PushButton3->click(); } else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) { myPoint6 = aSelectedObject; - if ( !myPoint6->_is_nil() && myPoint4->_is_nil() ) - GroupCenter2Pnts->PushButton1->click(); + if ( myPoint6 && !myPoint4 ) + GroupCenter2Pnts->PushButton1->click(); } } - displayPreview(); + displayPreview(true); } @@ -498,39 +469,15 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); - if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); - } - else { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - } + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) ? + TopAbs_EDGE : TopAbs_VERTEX; + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); send->setDown(true); - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_CircleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPntVecR->LineEdit1 || - send == GroupPntVecR->LineEdit2 || - send == Group3Pnts->LineEdit1 || - send == Group3Pnts->LineEdit2 || - send == Group3Pnts->LineEdit3 || - send == GroupCenter2Pnts->LineEdit1 || - send == GroupCenter2Pnts->LineEdit2 || - send == GroupCenter2Pnts->LineEdit3 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } @@ -543,7 +490,7 @@ void BasicGUI_CircleDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -565,7 +512,6 @@ void BasicGUI_CircleDlg::enterEvent( QEvent* ) //================================================================================= void BasicGUI_CircleDlg::DeactivateActiveDialog() { - // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -575,7 +521,7 @@ void BasicGUI_CircleDlg::DeactivateActiveDialog() //================================================================================= void BasicGUI_CircleDlg::ValueChangedInSpinBox() { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -601,36 +547,31 @@ GEOM::GEOM_IOperations_ptr BasicGUI_CircleDlg::createOperation() return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); } -//================================================================================= -// function : isEqual -// purpose : it may also be needed to check for min distance between gp_Pnt-s... -//================================================================================= -static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) -{ - return thePnt1->_is_equivalent( thePnt2 ); -} - //================================================================================= // function : isValid // purpose : //================================================================================= bool BasicGUI_CircleDlg::isValid( QString& msg ) { - const int id = getConstructorId(); - if ( id == 0 ) { - //return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0; - //nil point means origin of global CS - //nil vector means Z axis - bool ok = GroupPntVecR->SpinBox_DX->isValid(msg, !IsPreview()); - return getRadius() > 0 && ok; + bool ok = false; + switch( getConstructorId() ) { + case 0: + // nil point means origin of global CS + // nil vector means Z axis + ok = GroupPntVecR->SpinBox_DX->isValid(msg, !IsPreview()) && getRadius() > 0; + break; + case 1: + ok = myPoint1 && myPoint2 && myPoint3 && myPoint1 != myPoint2 && + myPoint1 != myPoint3 && myPoint2 != myPoint3; + break; + case 2: + ok = myPoint4 && myPoint5 && myPoint6 && myPoint4 != myPoint5 && + myPoint5 != myPoint6 && myPoint4 != myPoint6; + break; + default: + break; } - else if ( id == 1 ) - return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && - !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); - else if ( id == 2 ) - return !myPoint4->_is_nil() && !myPoint5->_is_nil() && !myPoint6->_is_nil() && - !isEqual( myPoint4, myPoint5 ) && !isEqual( myPoint5, myPoint6 ) && !isEqual( myPoint4, myPoint6 ); - return false; + return ok; } //================================================================================= @@ -643,23 +584,25 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() ); + switch ( getConstructorId() ) { case 0 : { QStringList aParameters; aParameters << GroupPntVecR->SpinBox_DX->text(); - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() ); + anObj = anOper->MakeCirclePntVecR( myPoint.get(), myDir.get(), getRadius() ); if ( !anObj->_is_nil() && !IsPreview() ) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); res = true; break; } case 1 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 ); + anObj = anOper->MakeCircleThreePnt( myPoint1.get(), myPoint2.get(), myPoint3.get() ); res = true; break; case 2: - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleCenter2Pnt( myPoint4, myPoint5, myPoint6 ); + anObj = anOper->MakeCircleCenter2Pnt( myPoint4.get(), myPoint5.get(), myPoint6.get() ); res = true; break; } @@ -679,25 +622,22 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_CircleDlg::addSubshapesToStudy() { - QMap objMap; - switch ( getConstructorId() ) { case 0: - if (!CORBA::is_nil(myPoint)) - objMap[GroupPntVecR->LineEdit1->text()] = myPoint; - if (!CORBA::is_nil(myDir)) - objMap[GroupPntVecR->LineEdit2->text()] = myDir; + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myDir.get() ); break; case 1: - objMap[Group3Pnts->LineEdit1->text()] = myPoint1; - objMap[Group3Pnts->LineEdit2->text()] = myPoint2; - objMap[Group3Pnts->LineEdit3->text()] = myPoint3; + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); + GEOMBase::PublishSubObject( myPoint3.get() ); break; case 2: - objMap[GroupCenter2Pnts->LineEdit1->text()] = myPoint4; - objMap[GroupCenter2Pnts->LineEdit2->text()] = myPoint5; - objMap[GroupCenter2Pnts->LineEdit3->text()] = myPoint6; + GEOMBase::PublishSubObject( myPoint4.get() ); + GEOMBase::PublishSubObject( myPoint5.get() ); + GEOMBase::PublishSubObject( myPoint6.get() ); break; + default: + break; } - addSubshapesToFather( objMap ); } diff --git a/src/BasicGUI/BasicGUI_CircleDlg.h b/src/BasicGUI/BasicGUI_CircleDlg.h index b1574fd6d..3e0f3e58d 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.h +++ b/src/BasicGUI/BasicGUI_CircleDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CircleDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BASICGUI_CIRCLEDLG_H #define BASICGUI_CIRCLEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_3Sel; class DlgRef_2Sel1Spin; @@ -57,7 +59,7 @@ private: double getRadius() const; private: - GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myPoint4, myPoint5, myPoint6; + GEOM::GeomObjPtr myPoint, myDir, myPoint1, myPoint2, myPoint3, myPoint4, myPoint5, myPoint6; DlgRef_2Sel1Spin* GroupPntVecR; DlgRef_3Sel* Group3Pnts; @@ -73,7 +75,6 @@ private slots: void SelectionIntoArgument(); void ConstructorsClicked( int ); - void LineEditReturnPressed(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(); void SetDoubleSpinBoxStep( double ); diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 05a7baf26..c964983ae 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -1,29 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CurveDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "BasicGUI_CurveDlg.h" +#include "BasicGUI_ParamCurveWidget.h" #include #include @@ -48,13 +50,13 @@ //================================================================================= // class : BasicGUI_CurveDlg() -// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the +// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POLYLINE" ) ) ); @@ -69,7 +71,21 @@ BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* pare mainFrame()->RadioButton2->setIcon( image3 ); mainFrame()->RadioButton3->setIcon( image2 ); - GroupPoints = new DlgRef_1Sel( centralWidget() ); + QGroupBox* creationModeCroup = new QGroupBox(this); + QButtonGroup* bg = new QButtonGroup(this); + + creationModeCroup->setTitle( tr( "GEOM_CURVE_CRMODE" ) ); + QHBoxLayout * creationModeLayout = new QHBoxLayout(creationModeCroup); + myBySelectionBtn = new QRadioButton( tr( "GEOM_CURVE_SELECTION" ) ,creationModeCroup ); + myAnaliticalBtn = new QRadioButton( tr( "GEOM_CURVE_ANALITICAL" ) ,creationModeCroup ); + + bg->addButton(myBySelectionBtn); + bg->addButton(myAnaliticalBtn); + + creationModeLayout->addWidget(myBySelectionBtn); + creationModeLayout->addWidget(myAnaliticalBtn); + + GroupPoints = new DlgRef_1Sel3Check( centralWidget() ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) ); @@ -78,9 +94,23 @@ BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton1->setChecked(false); + //GroupPoints->CheckButton1->hide(); + + GroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) ); + GroupPoints->CheckButton2->setChecked(false); + GroupPoints->CheckButton2->hide(); + + GroupPoints->CheckButton3->hide(); + + myParams = new BasicGUI_ParamCurveWidget( centralWidget() ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( creationModeCroup ); layout->addWidget( GroupPoints ); + layout->addWidget( myParams ); /***************************************************************/ setHelpFileName( "create_curve_page.html" ); @@ -107,29 +137,66 @@ void BasicGUI_CurveDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - myPoints = new GEOM::ListOfGO(); - myPoints->length( 0 ); + myPoints.clear(); globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - /* signals and slots connections */ - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog( ) ) ); - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + showOnlyPreviewControl(); + myBySelectionBtn->setChecked(true); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr ? resMgr->doubleValue( "Geometry", "SettingsGeomStep", 10. ) : 10.; + + double aMax( 100. ), aMin( 0.0 ); + + /* min, max, step and decimals for spin boxes & initial values */ + initSpinBox( myParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( myParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" ); + myParams->myPStep->setValue( 10 ); + myParams->myPStep->setMaximum( 999 ); + myParams->myPStep->setSingleStep( 10 ); + myParams->myPMin->setValue( aMin ); + myParams->myPMax->setValue( aMax ); + myParams->myPStep->setValue( step ); + myParams->myXExpr->setText("t"); + myParams->myYExpr->setText("t"); + myParams->myZExpr->setText("t"); - connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + myParams->hide(); - connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + /* signals and slots connections */ + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog( ) ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( GroupPoints->CheckButton1, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) ); + connect( GroupPoints->CheckButton2, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) ); + + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( myBySelectionBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) ); + connect( myAnaliticalBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) ); + + connect(myParams->myPMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myParams->myPMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myParams->myPStep, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); + + connect(myParams->myXExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); + connect(myParams->myYExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); + connect(myParams->myZExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished())); - connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; - initName( tr( "GEOM_CURVE" ) ); - ConstructorsClicked( 0 ); + resize(100,100); + ConstructorsClicked( 0 ); } //================================================================================= @@ -140,11 +207,30 @@ void BasicGUI_CurveDlg::ConstructorsClicked( int id ) { QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" ); mainFrame()->GroupConstructors->setTitle( aTitle ); - - myPoints = new GEOM::ListOfGO(); - myPoints->length( 0 ); + + if (id == 0) { // polyline (wire) + //GroupPoints->CheckButton1->hide(); + GroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) ); + GroupPoints->CheckButton2->hide(); + } + else if (id == 1) { // bezier + //GroupPoints->CheckButton1->hide(); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton2->hide(); + } + else { // b-spline + //GroupPoints->CheckButton1->show(); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton2->show(); + } + + myPoints.clear(); myEditCurrentArgument->setText( "" ); + qApp->processEvents(); + updateGeometry(); + resize( minimumSizeHint() ); + SelectionIntoArgument(); } @@ -154,24 +240,19 @@ void BasicGUI_CurveDlg::ConstructorsClicked( int id ) //================================================================================= void BasicGUI_CurveDlg::SetEditCurrentArgument() { - if ( sender() == GroupPoints->PushButton1 ) + if ( sender() == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } - //================================================================================= -// function : LineEditReturnPressed() +// function : CheckButtonToggled() // purpose : //================================================================================= -void BasicGUI_CurveDlg::LineEditReturnPressed() +void BasicGUI_CurveDlg::CheckButtonToggled() { - if ( sender() == GroupPoints->LineEdit1 ) - { - myEditCurrentArgument = GroupPoints->LineEdit1; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -180,6 +261,7 @@ void BasicGUI_CurveDlg::LineEditReturnPressed() //================================================================================= void BasicGUI_CurveDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -199,56 +281,29 @@ bool BasicGUI_CurveDlg::ClickOnApply() return true; } -//================================================================================= -/*! function : isPointInList() - * purpose : Check is point (theObject) in the list \a thePoints. - * \author enk - * \retval -1, if point not in list, else 1 in list - */ -//================================================================================= -static int isPointInList( std::list& thePoints, - GEOM::GEOM_Object_var& theObject ) -{ - int len = thePoints.size(); - - if ( len < 1 ) { - return -1; - } - - for ( std::list::iterator i = thePoints.begin(); i != thePoints.end(); i++ ) { - if ( std::string( (*i)->GetEntry() ) == std::string( theObject->GetEntry() ) ) { - return 1; - } - } - - return -1; -} -//================================================================================= -/*! function : removeUnnecessaryPnt() - * purpose : Remove unnecessary points from list \a theOldPoints - * \author enk - * \li \a theOldPoints - ordered sequence with unnecessary point - * \li \a theNewPoints - not ordered sequence with necessary points - */ -//================================================================================= -static void removeUnnecessaryPnt( std::list& theOldPoints, - GEOM::ListOfGO_var& theNewPoints ) +static void synchronize( QList& left, QList& right ) { - std::list objs_to_remove; - for ( std::list::iterator i = theOldPoints.begin(); i != theOldPoints.end(); i++ ) { + // 1. remove items from the "left" list that are not in the "right" list + QMutableListIterator it1( left ); + while ( it1.hasNext() ) { + GEOM::GeomObjPtr o1 = it1.next(); bool found = false; - for ( int j = 0; j < theNewPoints->length() && !found ; j++ ) { - if ( std::string( (*i)->GetEntry() ) == std::string( theNewPoints[j]->GetEntry() ) ) { - found = true; - } - } - if ( !found ) { - objs_to_remove.push_back( *i ); - //cout << "removed: " << (*i)->GetEntry() << endl; - } + QMutableListIterator it2( right ); + while ( it2.hasNext() && !found ) + found = o1 == it2.next(); + if ( !found ) + it1.remove(); } - for ( std::list::iterator i = objs_to_remove.begin(); i != objs_to_remove.end(); i++ ) { - theOldPoints.remove( *i ); + // 2. add items from the "right" list that are not in the "left" list (to keep selection order) + it1 = right; + while ( it1.hasNext() ) { + GEOM::GeomObjPtr o1 = it1.next(); + bool found = false; + QMutableListIterator it2( left ); + while ( it2.hasNext() && !found ) + found = o1 == it2.next(); + if ( !found ) + left << o1; } } @@ -258,99 +313,13 @@ static void removeUnnecessaryPnt( std::list& theOldPoints //================================================================================= void BasicGUI_CurveDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText( "" ); - - Standard_Boolean aRes = Standard_False; - - SalomeApp_Application* app = myGeomGUI->getApp(); - SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); - _PTR(Study) aDStudy = appStudy->studyDS(); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - - int anIndex; - TopoDS_Shape aShape; - TColStd_IndexedMapOfInteger aMapIndexes; - GEOM::GEOM_Object_var anObject; - std::list aList; - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - SALOME_ListIO selected; - aSelMgr->selectedObjects(selected, QString::null, false); - - int IOC = selected.Extent(); - // bool is_append = myPoints->length() < IOC; // if true - add point, else remove - // myPoints->length( IOC ); // this length may be greater than number of objects, - // that will actually be put into myPoints - - for (SALOME_ListIteratorOfListIO anIt (selected); anIt.More(); anIt.Next()) { - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { - aSelMgr->GetIndexes(anIt.Value(), aMapIndexes); - - if (aMapIndexes.Extent() > 0) { - for (int ii = 1; ii <= aMapIndexes.Extent(); ii++) { - anIndex = aMapIndexes(ii); - QString aName = GEOMBase::GetName( aSelectedObject ); - aName = aName + ":vertex_" + QString::number( anIndex ); - anObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - //Find Object in study - _PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) ); - bool inStudy = false; - _PTR(ChildIterator) iit( aDStudy->NewChildIterator( obj ) ); - for (; iit->More() && !inStudy; iit->Next()) { - _PTR(SObject) child( iit->Value() ); - QString aChildName = child->GetName().c_str(); - if ( aChildName == aName ) { - inStudy = true; - CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( iit->Value() ); - anObject = GEOM::GEOM_Object::_narrow( corbaObj ); - } - } - - if ( !inStudy ) - GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( aDStudy ), - anObject, aName.toLatin1().data(), aSelectedObject ); - - int pos = isPointInList( myOrderedSel, anObject ); - if ( pos == -1 ) { - myOrderedSel.push_back( anObject ); - } - // if (!inStudy) - aList.push_back(anObject); - } - } - else { // aMap.Extent() == 0 - int pos = isPointInList( myOrderedSel, aSelectedObject ); - if ( pos == -1 ) - myOrderedSel.push_back( aSelectedObject ); - aList.push_back( aSelectedObject ); - } - } - } - } - - myPoints->length( aList.size() ); - - int k = 0; - for ( std::list::iterator j = aList.begin(); j != aList.end(); j++ ) - myPoints[k++] = *j; - - if ( IOC == 0 ) - myOrderedSel.clear(); + QList points = getSelected( TopAbs_VERTEX, -1 ); + synchronize( myPoints, points ); + if ( !myPoints.isEmpty() ) + GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); else - removeUnnecessaryPnt( myOrderedSel, myPoints ); - - // if ( myOrderedSel.size() == myPoints->length() ) { - myPoints->length( myOrderedSel.size() ); - k = 0; - for ( std::list::iterator j = myOrderedSel.begin(); j != myOrderedSel.end(); j++ ) - myPoints[k++] = *j; - // } - - if ( myPoints->length() > 0 ) - GroupPoints->LineEdit1->setText( QString::number( myPoints->length() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); - -displayPreview(); + GroupPoints->LineEdit1->setText( "" ); + processPreview(); } @@ -362,7 +331,7 @@ void BasicGUI_CurveDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); @@ -405,7 +374,17 @@ GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation() //================================================================================= bool BasicGUI_CurveDlg::isValid( QString& msg ) { - return myPoints->length() > 1; + if( myBySelectionBtn->isChecked() ) + return myPoints.count() > 1; + else { + bool ok = myParams->myPMin->isValid( msg, !IsPreview() ) && + myParams->myPMax->isValid( msg, !IsPreview() ) && + myParams->myPStep->isValid( msg, !IsPreview() ); + ok &= !myParams->myXExpr->text().isEmpty(); + ok &= !myParams->myYExpr->text().isEmpty(); + ok &= !myParams->myZExpr->text().isEmpty(); + return ok; + } } //================================================================================= @@ -418,23 +397,115 @@ bool BasicGUI_CurveDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() ); + + GEOM::ListOfGO_var points = new GEOM::ListOfGO(); + points->length( myPoints.count() ); + for ( int i = 0; i < myPoints.count(); i++ ) + points[i] = myPoints[i].copy(); + switch ( getConstructorId() ) { case 0 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakePolyline( myPoints ); + if( myBySelectionBtn->isChecked() ) + anObj = anOper->MakePolyline( points.in(), GroupPoints->CheckButton1->isChecked() ); + else + anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), + qPrintable(myParams->myYExpr->text()), + qPrintable(myParams->myZExpr->text()), + myParams->myPMin->value(), + myParams->myPMax->value(), + myParams->myPStep->value(), + GEOM::Polyline); res = true; break; case 1 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSplineBezier( myPoints ); + if( myBySelectionBtn->isChecked() ) + anObj = anOper->MakeSplineBezier( points.in(), GroupPoints->CheckButton1->isChecked() ); + else + anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), + qPrintable(myParams->myYExpr->text()), + qPrintable(myParams->myZExpr->text()), + myParams->myPMin->value(), + myParams->myPMax->value(), + myParams->myPStep->value(), + GEOM::Bezier); + res = true; break; case 2 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSplineInterpolation( myPoints ); + if( myBySelectionBtn->isChecked() ) + anObj = anOper->MakeSplineInterpolation( points.in(), GroupPoints->CheckButton1->isChecked(), + GroupPoints->CheckButton2->isChecked() ); + else + anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()), + qPrintable(myParams->myYExpr->text()), + qPrintable(myParams->myZExpr->text()), + myParams->myPMin->value(), + myParams->myPMax->value(), + myParams->myPStep->value(), + GEOM::Interpolation); res = true; break; } - if ( !anObj->_is_nil() ) + if ( !anObj->_is_nil() ) { + if(myAnaliticalBtn->isChecked() && !IsPreview()) { + QStringList aParameters; + aParameters<myPMin->text(); + aParameters<myPMax->text(); + aParameters<myPStep->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } objects.push_back( anObj._retn() ); - + } + return res; } + +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void BasicGUI_CurveDlg::addSubshapesToStudy() +{ + for ( int i = 0; i < myPoints.count(); i++ ) + GEOMBase::PublishSubObject( myPoints[i].get() ); +} + +//================================================================================= +// function : CreationModeChanged +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::CreationModeChanged() { + const QObject* s = sender(); + GroupPoints->setVisible(myBySelectionBtn == s); + myParams->setVisible(myBySelectionBtn != s); + + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::ValueChangedInSpinBox(double/*theValue*/) +{ + processPreview(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::ValueChangedInSpinBox(int/*theValue*/) +{ + processPreview(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::OnEditingFinished() { + processPreview(); +} diff --git a/src/BasicGUI/BasicGUI_CurveDlg.h b/src/BasicGUI/BasicGUI_CurveDlg.h index 5c3730859..ce9a6a9e7 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.h +++ b/src/BasicGUI/BasicGUI_CurveDlg.h @@ -1,75 +1,86 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CurveDlg.h // Author : Alexander SLADKOV, Open CASCADE S.A.S. (alexander.sladkov@opencascade.com) -// + #ifndef BASICGUI_CURVEDLG_H #define BASICGUI_CURVEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" #include -class DlgRef_1Sel; +class DlgRef_1Sel3Check; +class QRadioButton; +class BasicGUI_ParamCurveWidget; //================================================================================= // class : BasicGUI_CurveDlg // purpose : //================================================================================= class BasicGUI_CurveDlg : public GEOMBase_Skeleton -{ +{ Q_OBJECT public: BasicGUI_CurveDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); ~BasicGUI_CurveDlg(); - + protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); + virtual void addSubshapesToStudy(); private: void Init(); void enterEvent( QEvent* ); private: - DlgRef_1Sel* GroupPoints; - GEOM::ListOfGO_var myPoints; - std::list myOrderedSel; //!< This list used for managing orderes selection + DlgRef_1Sel3Check* GroupPoints; + QList myPoints; + QRadioButton* myAnaliticalBtn; + QRadioButton* myBySelectionBtn; + BasicGUI_ParamCurveWidget* myParams; private slots: void ClickOnOk(); bool ClickOnApply(); - + void ActivateThisDialog(); - void DeactivateActiveDialog(); - + void DeactivateActiveDialog(); + void ConstructorsClicked( int ); - void LineEditReturnPressed(); + void CheckButtonToggled(); void SelectionIntoArgument(); void SetEditCurrentArgument(); + void CreationModeChanged(); + void ValueChangedInSpinBox(double/*theValue*/); + void ValueChangedInSpinBox(int /*theValue*/); + void OnEditingFinished(); }; #endif // BASICGUI_CURVEDLG_H diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index 9b9eb6c07..b480b74b6 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_EllipseDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -52,7 +53,7 @@ // TRUE to construct a modal dialog. //================================================================================= BasicGUI_EllipseDlg::BasicGUI_EllipseDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ELLIPSE_PV" ) ) ); @@ -68,19 +69,23 @@ BasicGUI_EllipseDlg::BasicGUI_EllipseDlg( GeometryGUI* theGeometryGUI, QWidget* mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_2Sel2Spin( centralWidget() ); + GroupPoints = new DlgRef_3Sel2Spin( centralWidget() ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupPoints->TextLabel1->setText( tr( "GEOM_CENTER" ) + " (Origin by default)" ); - GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) + " (Z axis by default)" ); - GroupPoints->TextLabel3->setText( tr( "GEOM_RADIUS_MAJOR" ) ); - GroupPoints->TextLabel4->setText( tr( "GEOM_RADIUS_MINOR" ) ); + GroupPoints->TextLabel1->setText( tr( "%1 (%2)" ).arg( tr( "GEOM_CENTER" ), tr( "ORIGIN_DEFAULT" ) ) ); + GroupPoints->TextLabel2->setText( tr( "%1 (%2)" ).arg( tr( "GEOM_VECTOR" ), tr( "Z_AXIS_DEFAULT" ) ) ); + GroupPoints->TextLabel3->setText( tr( "%1 (%2)" ).arg( tr( "GEOM_VECTOR_MAJOR" ), tr( "X_AXIS_DEFAULT" ) ) ); + GroupPoints->TextLabel4->setText( tr( "GEOM_RADIUS_MAJOR" ) ); + GroupPoints->TextLabel5->setText( tr( "GEOM_RADIUS_MINOR" ) ); GroupPoints->PushButton1->setIcon( image1 ); GroupPoints->PushButton2->setIcon( image1 ); + GroupPoints->PushButton3->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit3->setReadOnly( true ); GroupPoints->LineEdit1->setEnabled( true ); GroupPoints->LineEdit2->setEnabled( false ); + GroupPoints->LineEdit3->setEnabled( false ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); @@ -110,11 +115,11 @@ void BasicGUI_EllipseDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupPoints->PushButton1->setDown(true); - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); + myMajor.nullify(); /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); @@ -123,8 +128,8 @@ void BasicGUI_EllipseDlg::Init() double aMajorR( 200. ), aMinorR( 100. ); /* min, max, step and decimals for spin boxes & initial values */ - initSpinBox( GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupPoints->SpinBox_DY, 0.000001, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" ); + initSpinBox( GroupPoints->SpinBox_DY, 0.000001, COORD_MAX, step, "length_precision" ); GroupPoints->SpinBox_DX->setValue( aMajorR ); GroupPoints->SpinBox_DY->setValue( aMinorR ); @@ -137,9 +142,7 @@ void BasicGUI_EllipseDlg::Init() connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( GroupPoints->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupPoints->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); @@ -147,11 +150,16 @@ void BasicGUI_EllipseDlg::Init() connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_ELLIPSE" ) ); - displayPreview(); + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + + resize( minimumSizeHint() ); + SelectionIntoArgument(); + displayPreview(true); } //================================================================================= @@ -171,6 +179,7 @@ void BasicGUI_EllipseDlg::SetDoubleSpinBoxStep( double step ) //================================================================================= void BasicGUI_EllipseDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -188,18 +197,23 @@ bool BasicGUI_EllipseDlg::ClickOnApply() initName(); // reset - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); + myMajor.nullify(); GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit2->setText( "" ); + GroupPoints->LineEdit3->setText( "" ); GroupPoints->PushButton1->setDown(true); GroupPoints->PushButton2->setDown(false); + GroupPoints->PushButton3->setDown(false); GroupPoints->LineEdit1->setEnabled( true ); GroupPoints->LineEdit2->setEnabled( false ); + GroupPoints->LineEdit3->setEnabled( false ); myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - displayPreview(); + displayPreview(true); return true; } @@ -217,73 +231,38 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir = GEOM::GEOM_Object::_nil(); + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint.nullify(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir.nullify(); + else if (myEditCurrentArgument == GroupPoints->LineEdit3) myMajor.nullify(); return; } - Standard_Boolean aRes = Standard_False; - Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { - QString aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape - TopoDS_Shape aShape; - - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) - aNeedType = TopAbs_EDGE; - - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(anIO, aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - if (aNeedType == TopAbs_EDGE) - aName += QString(":edge_%1").arg(anIndex); - else - aName += QString(":vertex_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - } - else { // Global Selection - if (aShape.ShapeType() != aNeedType) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } - + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupPoints->LineEdit3 ) ? + TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); myEditCurrentArgument->setText( aName ); - - if (!aSelectedObject->_is_nil()) { // clear selection if something selected - globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); - } - if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { myPoint = aSelectedObject; - if ( !myPoint->_is_nil() && myDir->_is_nil() ) - GroupPoints->PushButton2->click(); + if ( myPoint && !myDir ) + GroupPoints->PushButton2->click(); } else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { - myDir = aSelectedObject; - if ( !myDir->_is_nil() && myPoint->_is_nil() ) - GroupPoints->PushButton1->click(); + myDir = aSelectedObject; + if ( myDir && !myMajor ) + GroupPoints->PushButton3->click(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) { + myMajor = aSelectedObject; + if ( myMajor && !myPoint ) + GroupPoints->PushButton1->click(); } } - displayPreview(); + displayPreview(true); } @@ -298,40 +277,38 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument() if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->PushButton2->setDown(false); + GroupPoints->PushButton3->setDown(false); GroupPoints->LineEdit1->setEnabled( true ); GroupPoints->LineEdit2->setEnabled( false ); + GroupPoints->LineEdit3->setEnabled( false ); } else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; GroupPoints->PushButton1->setDown(false); + GroupPoints->PushButton3->setDown(false); GroupPoints->LineEdit1->setEnabled( false ); GroupPoints->LineEdit2->setEnabled( true ); + GroupPoints->LineEdit3->setEnabled( false ); + } + else if ( send == GroupPoints->PushButton3 ) { + myEditCurrentArgument = GroupPoints->LineEdit3; + GroupPoints->PushButton1->setDown(false); + GroupPoints->PushButton2->setDown(false); + GroupPoints->LineEdit1->setEnabled( false ); + GroupPoints->LineEdit2->setEnabled( false ); + GroupPoints->LineEdit3->setEnabled( true ); } + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupPoints->LineEdit3 ) ? + TopAbs_EDGE : TopAbs_VERTEX; globalSelection(); // close local contexts, if any - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) - aNeedType = TopAbs_EDGE; localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); myEditCurrentArgument->setFocus(); //SelectionIntoArgument(); send->setDown(true); - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_EllipseDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } @@ -343,15 +320,17 @@ void BasicGUI_EllipseDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit2->setText( "" ); + GroupPoints->LineEdit3->setText( "" ); - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); //globalSelection( GEOM_POINT ); globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); @@ -383,7 +362,7 @@ void BasicGUI_EllipseDlg::enterEvent( QEvent* ) //================================================================================= void BasicGUI_EllipseDlg::ValueChangedInSpinBox( double newValue ) { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -401,18 +380,18 @@ GEOM::GEOM_IOperations_ptr BasicGUI_EllipseDlg::createOperation() //================================================================================= bool BasicGUI_EllipseDlg::isValid( QString& msg ) { - double aMajorR = GroupPoints->SpinBox_DX->value(); - double aMinorR = GroupPoints->SpinBox_DY->value(); - if ( aMajorR < aMinorR ) { - msg = tr( "GEOM_ELLIPSE_ERROR_1" ); - return false; + // nil point means origin of global CS + // nil vector means Z axis + bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ); + if ( ok ) { + double aMajorR = GroupPoints->SpinBox_DX->value(); + double aMinorR = GroupPoints->SpinBox_DY->value(); + if ( aMajorR < aMinorR ) { + msg = tr( "GEOM_ELLIPSE_ERROR_1" ); + ok = false; + } } - //return !myPoint->_is_nil() && !myDir->_is_nil(); - //nil point means origin of global CS - //nil vector means Z axis - bool ok = true; - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; return ok; } @@ -429,10 +408,13 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects ) aParameters<SpinBox_DX->text(); aParameters<SpinBox_DY->text(); - GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR ); + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = myMajor ? + anOper->MakeEllipseVec( myPoint.get(), myDir.get(), aMajorR, aMinorR, myMajor.get() ) : + anOper->MakeEllipse ( myPoint.get(), myDir.get(), aMajorR, aMinorR ); if ( !anObj->_is_nil() ) { if ( !IsPreview() ) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back( anObj._retn() ); } return true; @@ -444,12 +426,7 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_EllipseDlg::addSubshapesToStudy() { - QMap objMap; - - if (!CORBA::is_nil(myPoint)) - objMap[GroupPoints->LineEdit1->text()] = myPoint; - if (!CORBA::is_nil(myDir)) - objMap[GroupPoints->LineEdit2->text()] = myDir; - - addSubshapesToFather( objMap ); + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myDir.get() ); + GEOMBase::PublishSubObject( myMajor.get() ); } diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.h b/src/BasicGUI/BasicGUI_EllipseDlg.h index ab6ef7cb4..303cc5348 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.h +++ b/src/BasicGUI/BasicGUI_EllipseDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_EllipseDlg.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -26,9 +27,10 @@ #ifndef BASICGUI_ELLIPSEDLG_H #define BASICGUI_ELLIPSEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" -class DlgRef_2Sel2Spin; +class DlgRef_3Sel2Spin; //================================================================================= // class : BasicGUI_EllipseDlg @@ -54,9 +56,9 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myPoint, myDir; + GEOM::GeomObjPtr myPoint, myDir, myMajor; - DlgRef_2Sel2Spin* GroupPoints; + DlgRef_3Sel2Spin* GroupPoints; private slots: void ClickOnOk(); @@ -65,7 +67,6 @@ private slots: void ActivateThisDialog(); void DeactivateActiveDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox( double ); diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index 03159903b..42895f074 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_LineDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -50,7 +51,7 @@ // TRUE to construct a modal dialog. //================================================================================= BasicGUI_LineDlg::BasicGUI_LineDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) ); @@ -119,12 +120,13 @@ void BasicGUI_LineDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + myPoint1.nullify(); + myPoint2.nullify(); + myFace1.nullify(); + myFace2.nullify(); + GroupPoints->PushButton1->setDown(true); - - + /* signals and slots connections */ connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); @@ -139,13 +141,8 @@ void BasicGUI_LineDlg::Init() connect( GroupFaces->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupFaces->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupFaces->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupFaces->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_LINE" ) ); @@ -159,6 +156,7 @@ void BasicGUI_LineDlg::Init() //================================================================================= void BasicGUI_LineDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -189,14 +187,11 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId ) switch ( constructorId ) { case 0: { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText( "" ); GroupPoints->LineEdit2->setText( "" ); - myPoint1 = GEOM::GEOM_Object::_nil(); - myPoint2 = GEOM::GEOM_Object::_nil(); + myPoint1.nullify(); + myPoint2.nullify(); GroupPoints->PushButton1->setDown(true); GroupPoints->PushButton2->setDown(false); GroupPoints->LineEdit1->setEnabled(true); @@ -207,13 +202,10 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId ) } case 1: { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); - myEditCurrentArgument = GroupFaces->LineEdit1; myEditCurrentArgument->setText(""); - myFace1 = GEOM::GEOM_Object::_nil(); - myFace2 = GEOM::GEOM_Object::_nil(); + myFace1.nullify(); + myFace2.nullify(); GroupFaces->PushButton1->setDown(true); GroupFaces->PushButton2->setDown(false); GroupFaces->LineEdit1->setEnabled(true); @@ -224,10 +216,15 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId ) } } + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 || + myEditCurrentArgument == GroupFaces->LineEdit2 ) ? + TopAbs_FACE : TopAbs_VERTEX; + globalSelection(); // close local selection to clear it + localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); - SelectionIntoArgument(); } @@ -244,86 +241,47 @@ void BasicGUI_LineDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupFaces->LineEdit1) myFace1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupFaces->LineEdit2) myFace2 = GEOM::GEOM_Object::_nil(); - displayPreview(); + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify(); + else if (myEditCurrentArgument == GroupFaces->LineEdit1) myFace1.nullify(); + else if (myEditCurrentArgument == GroupFaces->LineEdit2) myFace2.nullify(); + displayPreview(true); return; } - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName( aSelectedObject ); - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupFaces->LineEdit1 || - myEditCurrentArgument == GroupFaces->LineEdit2 ) - aNeedType = TopAbs_FACE; - - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap( 1 ); - if ( aNeedType == TopAbs_FACE ) - aName += QString( ":face_%1" ).arg( anIndex ); - else - aName += QString( ":vertex_%1" ).arg( anIndex ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - } - else { // Global Selection - if ( aShape.ShapeType() != aNeedType ) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } - + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 || + myEditCurrentArgument == GroupFaces->LineEdit2 ) ? + TopAbs_FACE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); myEditCurrentArgument->setText( aName ); - - if (!aSelectedObject->_is_nil()) { // clear selection if something selected - globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); - } - if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { myPoint1 = aSelectedObject; - if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) - GroupPoints->PushButton2->click(); + if ( myPoint1 && !myPoint2 ) + GroupPoints->PushButton2->click(); } else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { myPoint2 = aSelectedObject; - if ( !myPoint2->_is_nil() && myPoint1->_is_nil() ) - GroupPoints->PushButton1->click(); + if ( myPoint2 && !myPoint1 ) + GroupPoints->PushButton1->click(); } else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) { myFace1 = aSelectedObject; - if ( !myFace1->_is_nil() && myFace2->_is_nil() ) - GroupFaces->PushButton2->click(); + if ( myFace1 && !myFace2 ) + GroupFaces->PushButton2->click(); } else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) { myFace2 = aSelectedObject; - if ( !myFace2->_is_nil() && myFace1->_is_nil() ) - GroupFaces->PushButton1->click(); + if ( myFace2 && !myFace1 ) + GroupFaces->PushButton1->click(); } } - displayPreview(); + displayPreview(true); } - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -356,35 +314,18 @@ void BasicGUI_LineDlg::SetEditCurrentArgument() GroupFaces->LineEdit2->setEnabled(true); } + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 || + myEditCurrentArgument == GroupFaces->LineEdit2 ) ? + TopAbs_FACE : TopAbs_VERTEX; globalSelection(); // close local selection to clear it - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupFaces->LineEdit1 || myEditCurrentArgument == GroupFaces->LineEdit2 ) - aNeedType = TopAbs_FACE; localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); send->setDown(true); - displayPreview(); + displayPreview(true); } - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_LineDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1; - else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2; - else if ( send == GroupFaces->LineEdit1 ) myEditCurrentArgument = GroupFaces->LineEdit1; - else if ( send == GroupFaces->LineEdit2 ) myEditCurrentArgument = GroupFaces->LineEdit2; - else return; - GEOMBase_Skeleton::LineEditReturnPressed(); -} - - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -393,7 +334,7 @@ void BasicGUI_LineDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -432,12 +373,18 @@ GEOM::GEOM_IOperations_ptr BasicGUI_LineDlg::createOperation() //================================================================================= bool BasicGUI_LineDlg::isValid( QString& msg ) { - const int id = getConstructorId(); - if ( id == 0 ) - return !myPoint1->_is_nil() && !myPoint2->_is_nil(); - else if ( id == 1 ) - return !myFace1->_is_nil() && !myFace2->_is_nil(); - return false; + bool ok = false; + switch ( getConstructorId() ) { + case 0 : + ok = myPoint1 && myPoint2; + break; + case 1: + ok = myFace1 && myFace2; + break; + default: + break; + } + return ok; } //================================================================================= @@ -448,13 +395,14 @@ bool BasicGUI_LineDlg::execute( ObjectList& objects ) { bool res = false; GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() ); switch ( getConstructorId() ) { case 0 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoPnt( myPoint1, myPoint2 ); + anObj = anOper->MakeLineTwoPnt( myPoint1.get(), myPoint2.get() ); res = true; break; case 1 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoFaces( myFace1, myFace2 ); + anObj = anOper->MakeLineTwoFaces( myFace1.get(), myFace2.get() ); res = true; break; } @@ -471,16 +419,16 @@ bool BasicGUI_LineDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_LineDlg::addSubshapesToStudy() { - QMap objMap; switch ( getConstructorId() ) { case 0 : - objMap[GroupPoints->LineEdit1->text()] = myPoint1; - objMap[GroupPoints->LineEdit2->text()] = myPoint2; + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); break; case 1 : - objMap[GroupFaces->LineEdit1->text()] = myFace1; - objMap[GroupFaces->LineEdit2->text()] = myFace2; + GEOMBase::PublishSubObject( myFace1.get() ); + GEOMBase::PublishSubObject( myFace2.get() ); + break; + default: break; } - addSubshapesToFather( objMap ); } diff --git a/src/BasicGUI/BasicGUI_LineDlg.h b/src/BasicGUI/BasicGUI_LineDlg.h index 5b716f206..5de775ed8 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.h +++ b/src/BasicGUI/BasicGUI_LineDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_LineDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BASICGUI_LINEDLG_H #define BASICGUI_LINEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel; @@ -54,10 +56,10 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myPoint1; - GEOM::GEOM_Object_var myPoint2; - GEOM::GEOM_Object_var myFace1; - GEOM::GEOM_Object_var myFace2; + GEOM::GeomObjPtr myPoint1; + GEOM::GeomObjPtr myPoint2; + GEOM::GeomObjPtr myFace1; + GEOM::GeomObjPtr myFace2; DlgRef_2Sel* GroupPoints; DlgRef_2Sel* GroupFaces; @@ -70,7 +72,6 @@ private slots: void DeactivateActiveDialog(); void ConstructorsClicked( int ); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); }; diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index ecd49f548..98c22720a 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_MarkerDlg.cxx // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) @@ -57,7 +58,7 @@ //================================================================================= BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* theParent ) : GEOMBase_Skeleton( theGeometryGUI, theParent, false, - Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) + Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) { QPixmap iconCS1 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) ); QPixmap iconCS2 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) ); @@ -167,6 +168,10 @@ BasicGUI_MarkerDlg::~BasicGUI_MarkerDlg() //================================================================================= void BasicGUI_MarkerDlg::Init() { + myShape.nullify(); + myPoint.nullify(); + myVectorX.nullify(); + myVectorY.nullify(); myBlockPreview = false; myConstructorId = -1; myEditCurrentArgument = Group1->LineEdit1; @@ -185,11 +190,6 @@ void BasicGUI_MarkerDlg::Init() connect( Group2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( Group1->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ); connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); @@ -197,7 +197,7 @@ void BasicGUI_MarkerDlg::Init() connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( onApply() ) ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); initName( tr( "LCS_NAME" ) ); @@ -205,7 +205,7 @@ void BasicGUI_MarkerDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) { - initSpinBox( anIter.value(), COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( anIter.value(), COORD_MIN, COORD_MAX, step, "length_precision" ); connect( anIter.value(), SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged( double ) ) ); } @@ -218,24 +218,6 @@ void BasicGUI_MarkerDlg::Init() myBlockPreview = false; ConstructorsClicked( 0 ); - - - //@ - /* - QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()-> - getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); - - VTKViewer_ViewFrame* aVTKFrame = dynamic_cast( aFrame ); - if ( aVTKFrame ) - { - aVTKFrame->AdjustTrihedrons( true ); - return; - } - - OCCViewer_ViewFrame* aOCCFrame = dynamic_cast( aFrame ); - if ( aOCCFrame ) - aOCCFrame->AdjustTrihedrons( true ); - */ } //================================================================================= @@ -248,7 +230,6 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); activate( GEOM_MARKER ); - displayPreview(); return; } @@ -276,6 +257,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) globalSelection( GEOM_ALLGEOM ); myEditCurrentArgument = Group1->LineEdit1; Group1->LineEdit1->setText( "" ); + myShape.nullify(); break; } case 2: @@ -295,16 +277,21 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) Group2->LineEdit1->setEnabled( true ); Group2->LineEdit2->setEnabled( false ); Group2->LineEdit3->setEnabled( false ); + myPoint.nullify(); + myVectorX.nullify(); + myVectorY.nullify(); break; } } + displayPreview(); + qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( onSelectionDone() ) ); + this, SLOT( onSelectionDone() ) ); onSelectionDone(); } @@ -314,6 +301,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) //================================================================================= void BasicGUI_MarkerDlg::onOk() { + setIsApplyAndClose( true ); if ( onApply() ) ClickOnCancel(); } @@ -339,66 +327,43 @@ bool BasicGUI_MarkerDlg::onApply() //================================================================================= void BasicGUI_MarkerDlg::onSelectionDone0() { - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; - Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_FACE ); + TopoDS_Shape aShape; + if ( aSelectedObject && aSelectedObject->GetType() == GEOM_MARKER && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + // Existing LCS selected + TopoDS_Face aFace = TopoDS::Face( aShape ); + Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) ); - if ( aRes && !aSelectedObj->_is_nil() ) { - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - // Existing LCS selected - if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE ) { - TopoDS_Face aFace = TopoDS::Face( aShape ); - Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) ); - - if ( !aPlane.IsNull() ) { - gp_Ax3 anAx3 = aPlane->Pln().Position(); - gp_Pnt aLoc = anAx3.Location(); - gp_Dir aXDir = anAx3.XDirection(); - gp_Dir aYDir = anAx3.YDirection(); - - myData[ X ]->setValue( aLoc.X() ); - myData[ Y ]->setValue( aLoc.Y() ); - myData[ Z ]->setValue( aLoc.Z() ); - - myData[ DX1 ]->setValue( aXDir.X() ); - myData[ DY1 ]->setValue( aXDir.Y() ); - myData[ DZ1 ]->setValue( aXDir.Z() ); - - myData[ DX2 ]->setValue( aYDir.X() ); - myData[ DY2 ]->setValue( aYDir.Y() ); - myData[ DZ2 ]->setValue( aYDir.Z() ); - aSelMgr->clearSelected(); - } - } - else { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( anIO, aMap ); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - aSelMgr->clearSelected(); // ??? - } - - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - myData[ X ]->setValue( aPnt.X() ); - myData[ Y ]->setValue( aPnt.Y() ); - myData[ Z ]->setValue( aPnt.Z() ); - } - } - } + if ( !aPlane.IsNull() ) { + gp_Ax3 anAx3 = aPlane->Pln().Position(); + gp_Pnt aLoc = anAx3.Location(); + gp_Dir aXDir = anAx3.XDirection(); + gp_Dir aYDir = anAx3.YDirection(); + + myData[ X ]->setValue( aLoc.X() ); + myData[ Y ]->setValue( aLoc.Y() ); + myData[ Z ]->setValue( aLoc.Z() ); + + myData[ DX1 ]->setValue( aXDir.X() ); + myData[ DY1 ]->setValue( aXDir.Y() ); + myData[ DZ1 ]->setValue( aXDir.Z() ); + + myData[ DX2 ]->setValue( aYDir.X() ); + myData[ DY2 ]->setValue( aYDir.Y() ); + myData[ DZ2 ]->setValue( aYDir.Z() ); } + displayPreview(); + return; + } + aSelectedObject = getSelected( TopAbs_VERTEX ); + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + myData[ X ]->setValue( aPnt.X() ); + myData[ Y ]->setValue( aPnt.Y() ); + myData[ Z ]->setValue( aPnt.Z() ); + displayPreview(); + return; } - - displayPreview(); } @@ -413,166 +378,49 @@ void BasicGUI_MarkerDlg::onSelectionDone() return; } - myEditCurrentArgument->setText( "" ); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; - Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - - if ( !CORBA::is_nil( aSelectedObj ) && aRes ) { - QString aName = GEOMBase::GetName( aSelectedObj ); - - if ( getConstructorId() == 1 ) { // by shape position - // Get shape's position - CORBA::Double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz, Yx, Yy, Yz; - Ox = Oy = Oz = Zx = Zy = Xy = Xz = Yx = Yz = 0; - Zz = Xx = Yy = 1.; - - GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = - myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); - aMeasureOp->GetPosition( aSelectedObj, Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz ); - - // Calculate Y direction - if ( aMeasureOp->IsDone() ) { - gp_Pnt aPnt ( Ox, Oy, Oz ); - gp_Dir aDirN ( Zx, Zy, Zz ); - gp_Dir aDirX ( Xx, Xy, Xz ); - gp_Ax3 anAx3 ( aPnt, aDirN, aDirX ); - - gp_Dir aDirY = anAx3.YDirection(); - aDirY.Coord(Yx,Yy,Yz); - } - - // Set values - myData[ X ]->setValue( Ox ); - myData[ Y ]->setValue( Oy ); - myData[ Z ]->setValue( Oz ); - - myData[ DX1 ]->setValue( Xx ); - myData[ DY1 ]->setValue( Xy ); - myData[ DZ1 ]->setValue( Xz ); - - myData[ DX2 ]->setValue( Yx ); - myData[ DY2 ]->setValue( Yy ); - myData[ DZ2 ]->setValue( Yz ); - - myEditCurrentArgument->setText( aName ); + TopAbs_ShapeEnum aNeedType; + if ( getConstructorId() == 1 ) // by shape position + aNeedType = TopAbs_SHAPE; + else if ( getConstructorId() == 2 ) // by point and two vectors + aNeedType = myEditCurrentArgument == Group2->LineEdit1 ? TopAbs_VERTEX : TopAbs_EDGE; + + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + if ( getConstructorId() == 1 ) { // by shape position + myShape = aSelectedObject; + } + else if ( getConstructorId() == 2 ) { // by point and two vectors + if ( myEditCurrentArgument == Group2->LineEdit1 ) { + myPoint = aSelectedObject; + if (myPoint && !myVectorX) + Group2->PushButton2->click(); + } + else if (myEditCurrentArgument == Group2->LineEdit2) { + myVectorX = aSelectedObject; + if (myVectorX && !myVectorY) + Group2->PushButton3->click(); } - else if ( getConstructorId() == 2 ) { // by point and two vectors - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) { - TopAbs_ShapeEnum aNeedType = TopAbs_EDGE; - if ( myEditCurrentArgument == Group2->LineEdit1 ) - aNeedType = TopAbs_VERTEX; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( anIO, aMap ); - - if ( !aMap.IsEmpty() ) { - int anIndex = aMap( 1 ); - if ( aNeedType == TopAbs_EDGE ) - aName += QString( "_edge_%1" ).arg( anIndex ); - else - aName += QString( "_vertex_%1" ).arg( anIndex ); - - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - } - - if ( myEditCurrentArgument == Group2->LineEdit1 ) { - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - myData[ X ]->setValue( aPnt.X() ); - myData[ Y ]->setValue( aPnt.Y() ); - myData[ Z ]->setValue( aPnt.Z() ); - myEditCurrentArgument->setText( aName ); - if (Group2->LineEdit2->text() == "") - Group2->PushButton2->click(); - } - else { - myData[ X ]->setValue( 0 ); - myData[ Y ]->setValue( 0 ); - myData[ Z ]->setValue( 0 ); - } - } - else if (myEditCurrentArgument == Group2->LineEdit2) { - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) { - gp_Pnt aP1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShape ) ) ); - gp_Pnt aP2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShape ) ) ); - gp_Dir aDir( gp_Vec( aP1, aP2 ) ); - - myData[ DX1 ]->setValue( aDir.X() ); - myData[ DY1 ]->setValue( aDir.Y() ); - myData[ DZ1 ]->setValue( aDir.Z() ); - myEditCurrentArgument->setText( aName ); - if (Group2->LineEdit3->text() == "") - Group2->PushButton3->click(); - } - else { - myData[ DX1 ]->setValue( 0 ); - myData[ DY1 ]->setValue( 0 ); - myData[ DZ1 ]->setValue( 0 ); - } - } - else if ( myEditCurrentArgument == Group2->LineEdit3 ) { - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) { - gp_Pnt aP1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShape ) ) ); - gp_Pnt aP2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShape ) ) ); - gp_Dir aDir(gp_Vec( aP1, aP2 )); - - myData[ DX2 ]->setValue( aDir.X() ); - myData[ DY2 ]->setValue( aDir.Y() ); - myData[ DZ2 ]->setValue( aDir.Z() ); - myEditCurrentArgument->setText( aName ); - if (Group2->LineEdit1->text() == "") - Group2->PushButton1->click(); - } - else { - myData[ DX2 ]->setValue( 0 ); - myData[ DY2 ]->setValue( 0 ); - myData[ DZ2 ]->setValue( 0 ); - } - } - } + else if ( myEditCurrentArgument == Group2->LineEdit3 ) { + myVectorY = aSelectedObject; + if (myVectorY && !myPoint) + Group2->PushButton1->click(); } } } else { if ( getConstructorId() == 1 ) { - myData[ X ]->setValue( 0 ); - myData[ Y ]->setValue( 0 ); - myData[ Z ]->setValue( 0 ); - - myData[ DX1 ]->setValue( 0 ); - myData[ DY1 ]->setValue( 0 ); - myData[ DZ1 ]->setValue( 0 ); - - myData[ DX2 ]->setValue( 0 ); - myData[ DY2 ]->setValue( 0 ); - myData[ DZ2 ]->setValue( 0 ); + myShape.nullify(); } else if ( getConstructorId() == 2 ) { - if ( myEditCurrentArgument == Group2->LineEdit1 ) { - myData[ X ]->setValue( 0 ); - myData[ Y ]->setValue( 0 ); - myData[ Z ]->setValue( 0 ); - } - else if ( myEditCurrentArgument == Group2->LineEdit2 ) { - myData[ DX1 ]->setValue( 0 ); - myData[ DY1 ]->setValue( 0 ); - myData[ DZ1 ]->setValue( 0 ); - } - else if ( myEditCurrentArgument == Group2->LineEdit3 ) { - myData[ DX2 ]->setValue( 0 ); - myData[ DY2 ]->setValue( 0 ); - myData[ DZ2 ]->setValue( 0 ); - } + if ( myEditCurrentArgument == Group2->LineEdit1 ) + myPoint.nullify(); + else if ( myEditCurrentArgument == Group2->LineEdit2 ) + myVectorX.nullify(); + else if ( myEditCurrentArgument == Group2->LineEdit3 ) + myVectorY.nullify(); } } @@ -625,18 +473,6 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument() onSelectionDone(); } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_MarkerDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); -} - //================================================================================= // function : onActivate() // purpose : @@ -645,7 +481,7 @@ void BasicGUI_MarkerDlg::onActivate() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( onSelectionDone() ) ); + this, SLOT( onSelectionDone() ) ); ConstructorsClicked( getConstructorId() ); } @@ -684,34 +520,33 @@ GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation() //================================================================================= bool BasicGUI_MarkerDlg::isValid( QString& msg ) { - const int id = getConstructorId(); - gp_Vec v1( myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value() ), - v2( myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() ); - - bool isOk = false; - // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution() - // Vectors shouldn't be checked for being orthogonal here! - if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) { - isOk = !v1.IsParallel( v2, Precision::Angular() ); - if ( !isOk ) - msg += tr( "VEC_PARALLEL" ); - } - - switch ( id ) { + bool ok = false; + switch ( getConstructorId() ) { case 0: { - bool ok = true; - for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) + gp_Vec v1( myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value() ), + v2( myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() ); + + // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution() + // Vectors shouldn't be checked for being orthogonal here! + if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) { + ok = !v1.IsParallel( v2, Precision::Angular() ); + if ( !ok ) + msg += tr( "VEC_PARALLEL" ); + } + for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end() && ok; ++anIter ) ok = anIter.value()->isValid( msg, !IsPreview()) && ok; - return isOk && ok; + break; } case 1: - return !Group1->LineEdit1->text().isEmpty() && isOk; + ok = myShape; + break; case 2: - return !Group2->LineEdit1->text().isEmpty() && - !Group2->LineEdit2->text().isEmpty() && - !Group2->LineEdit3->text().isEmpty() && isOk; + ok = myPoint && myVectorX && myVectorY; + break; + default: + break; } - return false; + return ok; } //================================================================================= @@ -720,30 +555,63 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg ) //================================================================================= bool BasicGUI_MarkerDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( - getOperation() )->MakeMarker( myData[ X ]->value(), myData[ Y ]->value(), myData[ Z ]->value(), - myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value(), - myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() ); + GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil(); QStringList aParameters; - aParameters<text(); - aParameters<text(); - aParameters<text(); - aParameters<text(); - aParameters<text(); - aParameters<text(); - aParameters<text(); - aParameters<text(); - aParameters<text(); + const int id = getConstructorId(); + if (id == 0) { + anObj = anOper->MakeMarker( myData[ X ]->value(), myData[ Y ]->value(), + myData[ Z ]->value(), myData[ DX1 ]->value(), + myData[ DY1 ]->value(), myData[ DZ1 ]->value(), + myData[ DX2 ]->value(), myData[ DY2 ]->value(), + myData[ DZ2 ]->value() ); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + } else if (id == 1) { + anObj = anOper->MakeMarkerFromShape( myShape.get() ); + } else if (id == 2) { + anObj = anOper->MakeMarkerPntTwoVec( myPoint.get(), myVectorX.get(), myVectorY.get() ); + } if ( !anObj->_is_nil() ) { - if ( !IsPreview() ) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + if ( !IsPreview() && id == 0) + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back( anObj._retn() ); } return true; } +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void BasicGUI_MarkerDlg::addSubshapesToStudy() +{ + switch ( getConstructorId() ) { + case 0 : + break; + case 1 : + GEOMBase::PublishSubObject( myShape.get() ); + break; + case 2: + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myVectorX.get() ); + GEOMBase::PublishSubObject( myVectorY.get() ); + break; + default: + break; + } + +} + //================================================================================= // function : onValueChanged // purpose : @@ -763,7 +631,7 @@ void BasicGUI_MarkerDlg::displayPreview ( const bool activate, const double lineWidth ) { if ( !myBlockPreview ) { - GEOMBase_Skeleton::displayPreview( activate, update, toRemoveFromEngine, lineWidth ); + GEOMBase_Skeleton::displayPreview( true, activate, update, toRemoveFromEngine, lineWidth ); if ( myConstructorId == 0 ) GEOMBase_Skeleton::activate( GEOM_MARKER ); } diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.h b/src/BasicGUI/BasicGUI_MarkerDlg.h index 364b0d737..9219db234 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.h +++ b/src/BasicGUI/BasicGUI_MarkerDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_MarkerDlg.h // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) @@ -26,7 +27,8 @@ #ifndef BASICGUI_MARKERDLG_H #define BASICGUI_MARKERDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" #include @@ -56,11 +58,17 @@ protected: const bool = true, const bool = true, const double = -1 ); + virtual void addSubshapesToStudy(); private: void enterEvent( QEvent* ); void onSelectionDone0(); + GEOM::GeomObjPtr myShape; + GEOM::GeomObjPtr myPoint; + GEOM::GeomObjPtr myVectorX; + GEOM::GeomObjPtr myVectorY; + private slots: void onOk(); bool onApply(); @@ -69,7 +77,6 @@ private slots: void onSelectionDone(); void onValueChanged( double ); void ConstructorsClicked( int ); - void LineEditReturnPressed(); void SetEditCurrentArgument(); private: diff --git a/src/BasicGUI/BasicGUI_ParamCurveWidget.cxx b/src/BasicGUI/BasicGUI_ParamCurveWidget.cxx new file mode 100644 index 000000000..ecdbd3467 --- /dev/null +++ b/src/BasicGUI/BasicGUI_ParamCurveWidget.cxx @@ -0,0 +1,99 @@ +// Copyright (C) 2007-2012 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 : BasicGUI_ParamCurveWidget.h +// Author : Roman NIKOLAEV (roman.nikolaev@opencascade.com) + +#include "BasicGUI_ParamCurveWidget.h" + +#include +#include +#include +#include + +#include +#include + + +BasicGUI_ParamCurveWidget::BasicGUI_ParamCurveWidget(QWidget* parent): + QWidget(parent) { + + QGridLayout* l = new QGridLayout( this ); + l->setSpacing( 0 ); + l->setMargin( 0 ); + + QGroupBox* groupBox = new QGroupBox( tr("GEOM_PCURVE_TITLE"), this ); + + QGridLayout* gridLayout = new QGridLayout( groupBox ); + gridLayout->setSpacing( 6 ); + gridLayout->setMargin( 11 ); + + //X Equation + QLabel* textLabel1 = new QLabel( tr("GEOM_PCURVE_X"), groupBox ); + myXExpr = new QLineEdit( groupBox ); + + //Y Equation + QLabel* textLabel2 = new QLabel(tr("GEOM_PCURVE_Y"), groupBox); + myYExpr = new QLineEdit( groupBox ); + + //Z Equation + QLabel* textLabel3 = new QLabel( tr("GEOM_PCURVE_Z"), groupBox ); + myZExpr = new QLineEdit( groupBox ); + + // Min and Max + QLabel* textLabel4 = new QLabel( tr("GEOM_PCURVE_MIN"), groupBox ); + myPMin = new SalomeApp_DoubleSpinBox( groupBox ); + + // Min and Max + QLabel* textLabel5 = new QLabel( tr("GEOM_PCURVE_MAX"), groupBox ); + myPMax = new SalomeApp_DoubleSpinBox( groupBox ); + + // Step + QLabel* textLabel6 = new QLabel( tr("GEOM_PCURVE_NBSTEP"), groupBox ); + myPStep = new SalomeApp_IntSpinBox( groupBox ); + + //Layout + gridLayout->addWidget(textLabel1, 0, 0, 1, 1); + gridLayout->addWidget(myXExpr, 0, 1, 1, 1); + + gridLayout->addWidget(textLabel2, 1, 0, 1, 1); + gridLayout->addWidget(myYExpr, 1, 1, 1, 1); + + gridLayout->addWidget(textLabel3, 2, 0, 1, 1); + gridLayout->addWidget(myZExpr, 2, 1, 1, 1); + + gridLayout->addWidget(textLabel4, 3, 0, 1, 1); + gridLayout->addWidget(myPMin, 3, 1, 1, 1); + + gridLayout->addWidget(textLabel5, 4, 0, 1, 1); + gridLayout->addWidget(myPMax, 4, 1, 1, 1); + + gridLayout->addWidget(textLabel6, 5, 0, 1, 1); + gridLayout->addWidget(myPStep, 5, 1, 1, 1); + + l->addWidget(groupBox, 0, 0, 1, 1); +} + + +BasicGUI_ParamCurveWidget::~BasicGUI_ParamCurveWidget(){ +} diff --git a/src/BasicGUI/BasicGUI_ParamCurveWidget.h b/src/BasicGUI/BasicGUI_ParamCurveWidget.h new file mode 100644 index 000000000..c941be550 --- /dev/null +++ b/src/BasicGUI/BasicGUI_ParamCurveWidget.h @@ -0,0 +1,53 @@ +// Copyright (C) 2007-2012 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 : BasicGUI_ParamCurveWidget.h +// Author : Roman NIKOLAEV (roman.nikolaev@opencascade.com) + +#ifndef BASICGUI_PARAM_CURVE_WIDGET_H +#define BASICGUI_PARAM_CURVE_WIDGET_H +#include + +class QLineEdit; +class SalomeApp_DoubleSpinBox; +class SalomeApp_IntSpinBox; + +class BasicGUI_ParamCurveWidget: public QWidget { + Q_OBJECT + + public: + BasicGUI_ParamCurveWidget(QWidget * parent = 0); + ~BasicGUI_ParamCurveWidget(); + + public: + QLineEdit* myXExpr; + QLineEdit* myYExpr; + QLineEdit* myZExpr; + + SalomeApp_DoubleSpinBox* myPMin; + SalomeApp_DoubleSpinBox* myPMax; + SalomeApp_IntSpinBox* myPStep; + +}; + +#endif //BASICGUI_PARAM_CURVE_WIDGET_H diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index 8d5b14f37..ec6f72235 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_PlaneDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -53,13 +54,15 @@ // TRUE to construct a modal dialog. //================================================================================= BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_PV" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_3PNTS" ) ) ); QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_FACE" ) ) ); QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_VECTOR" ) ) ); + QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_ORIGIN" ) ) ); setWindowTitle( tr( "GEOM_PLANE_TITLE" ) ); @@ -68,6 +71,10 @@ BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* pare mainFrame()->RadioButton1->setIcon( image0 ); mainFrame()->RadioButton2->setIcon( image1 ); mainFrame()->RadioButton3->setIcon( image2 ); + mainFrame()->RadioButton4->show(); + mainFrame()->RadioButton4->setIcon( image4 ); + mainFrame()->RadioButton5->show(); + mainFrame()->RadioButton5->setIcon( image5 ); GroupPntDir = new DlgRef_2Sel1Spin( centralWidget() ); GroupPntDir->GroupBox1->setTitle( tr( "GEOM_PLANE_PV" ) ); @@ -100,12 +107,8 @@ BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* pare Group3Pnts->LineEdit2->setEnabled( false ); Group3Pnts->LineEdit3->setEnabled( false ); - GroupFace = new DlgRef_3Radio1Sel1Spin( centralWidget() ); - GroupFace->RadioButton1->setText(tr("GEOM_FACE")); - GroupFace->RadioButton2->setText(tr("GEOM_LCS")); - GroupFace->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); - GroupFace->RadioButton3->close(); - GroupFace->GroupBox1->setTitle( tr( "GEOM_FACE_OR_LCS" ) ); + GroupFace = new DlgRef_1Sel1Spin( centralWidget() ); + GroupFace->GroupBox1->setTitle( tr( "GEOM_FACE" ) ); GroupFace->TextLabel1->setText( tr( "GEOM_SELECTION" ) ); GroupFace->TextLabel2->setText( tr( "GEOM_PLANE_SIZE" ) ); GroupFace->PushButton1->setIcon( image3 ); @@ -113,11 +116,38 @@ BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupFace->LineEdit1->setReadOnly( true ); + Group2Vec = new DlgRef_2Sel1Spin( centralWidget() ); + + Group2Vec->GroupBox1->setTitle( tr( "GEOM_WPLANE_VECTOR" ) ); + Group2Vec->TextLabel1->setText( tr( "GEOM_WPLANE_VX" ) ); + Group2Vec->TextLabel2->setText( tr( "GEOM_WPLANE_VZ" ) ); + Group2Vec->PushButton1->setIcon( image3 ); + Group2Vec->PushButton2->setIcon( image3 ); + Group2Vec->LineEdit1->setReadOnly( true ); + Group2Vec->LineEdit2->setReadOnly( true ); + Group2Vec->PushButton1->setDown( true ); + Group2Vec->LineEdit1->setEnabled( true ); + Group2Vec->LineEdit2->setEnabled( false ); + Group2Vec->TextLabel3->setText( tr( "GEOM_PLANE_SIZE" ) ); + + GroupLCS = new DlgRef_3Radio1Sel1Spin( centralWidget() ); + GroupLCS->GroupBox1->setTitle( tr( "GEOM_LCS" ) ); + GroupLCS->TextLabel1->setText( tr( "GEOM_SELECTION" ) ); + GroupLCS->TextLabel2->setText( tr( "GEOM_PLANE_SIZE" ) ); + GroupLCS->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) ); + GroupLCS->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) ); + GroupLCS->RadioButton3->setText( tr( "GEOM_WPLANE_OZX" ) ); + GroupLCS->LineEdit1->setReadOnly( true ); + GroupLCS->PushButton1->setIcon( image3 ); + GroupLCS->PushButton1->setDown( true ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->addWidget( GroupPntDir ); layout->addWidget( Group3Pnts ); layout->addWidget( GroupFace ); + layout->addWidget( Group2Vec ); + layout->addWidget( GroupLCS ); /***************************************************************/ setHelpFileName( "create_plane_page.html" ); @@ -143,11 +173,19 @@ void BasicGUI_PlaneDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPntDir->LineEdit1; - GroupFace->RadioButton1->setChecked(true); - - myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); + myPoint3.nullify(); + myFace.nullify(); + myLCS.nullify(); + myVec1.nullify(); + myVec2.nullify(); + // myGeomGUI->SetState( 0 ); + myOriginType = 1; /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); @@ -156,12 +194,16 @@ void BasicGUI_PlaneDlg::Init() double aTrimSize = 2000.0; /* min, max, step and decimals for spin boxes */ - initSpinBox( GroupPntDir->SpinBox_DX, 0.000001, COORD_MAX, aStep, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPntDir->SpinBox_DX, 0.000001, COORD_MAX, aStep, "length_precision" ); GroupPntDir->SpinBox_DX->setValue( aTrimSize ); - initSpinBox( Group3Pnts->SpinBox_DX, 0.000001, COORD_MAX, aStep, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( Group3Pnts->SpinBox_DX, 0.000001, COORD_MAX, aStep, "length_precision" ); Group3Pnts->SpinBox_DX->setValue( aTrimSize ); - initSpinBox( GroupFace->SpinBox_DX, 0.000001, COORD_MAX, aStep, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupFace->SpinBox_DX, 0.000001, COORD_MAX, aStep, "length_precision" ); GroupFace->SpinBox_DX->setValue( aTrimSize ); + initSpinBox( Group2Vec->SpinBox_DX, 0.000001, COORD_MAX, aStep, "length_precision" ); + Group2Vec->SpinBox_DX->setValue( aTrimSize ); + initSpinBox( GroupLCS->SpinBox_DX, 0.000001, COORD_MAX, aStep, "length_precision" ); + GroupLCS->SpinBox_DX->setValue( aTrimSize ); /* signals and slots connections */ connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); @@ -178,19 +220,18 @@ void BasicGUI_PlaneDlg::Init() connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupFace->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2Vec->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2Vec->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPntDir->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupPntDir->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupFace->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupFace->RadioButton1,SIGNAL( clicked() ), this, SLOT( SelectionTypeClicked() ) ); - connect( GroupFace->RadioButton2,SIGNAL( clicked() ), this, SLOT( SelectionTypeClicked() ) ); + connect( GroupLCS->RadioButton1, SIGNAL( clicked() ), this, SLOT( GroupClicked() ) ); + connect( GroupLCS->RadioButton2, SIGNAL( clicked() ), this, SLOT( GroupClicked() ) ); + connect( GroupLCS->RadioButton3, SIGNAL( clicked() ), this, SLOT( GroupClicked() ) ); connect( GroupPntDir->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( Group3Pnts->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupFace->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group2Vec->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupLCS->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); @@ -210,28 +251,10 @@ void BasicGUI_PlaneDlg::SetDoubleSpinBoxStep( double step ) GroupPntDir->SpinBox_DX->setSingleStep(step); Group3Pnts->SpinBox_DX->setSingleStep(step); GroupFace->SpinBox_DX->setSingleStep(step); + Group2Vec->SpinBox_DX->setSingleStep(step); + GroupLCS->SpinBox_DX->setSingleStep(step); } -//================================================================================= -// function : SelectionTypeClicked() -// purpose : Selection type radio buttons managment -//================================================================================= -void BasicGUI_PlaneDlg::SelectionTypeClicked() -{ - myFace = GEOM::GEOM_Object::_nil(); - if ( GroupFace->RadioButton1->isChecked()) { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); - } else if ( GroupFace->RadioButton2->isChecked()) { - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_PLANE ); - aMap.Add( GEOM_MARKER ); - globalSelection( aMap ); - } - displayPreview(); -} - - //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management @@ -239,7 +262,15 @@ void BasicGUI_PlaneDlg::SelectionTypeClicked() void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) { disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); - myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); + myPoint3.nullify(); + myFace.nullify(); + myLCS.nullify(); + myVec1.nullify(); + myVec2.nullify(); switch ( constructorId ) { case 0: /* plane from a point and a direction (vector, edge...) */ @@ -247,6 +278,8 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) Group3Pnts->hide(); GroupFace->hide(); GroupPntDir->show(); + Group2Vec->hide(); + GroupLCS->hide(); myEditCurrentArgument = GroupPntDir->LineEdit1; GroupPntDir->LineEdit1->setText( "" ); @@ -266,6 +299,8 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) GroupPntDir->hide(); GroupFace->hide(); Group3Pnts->show(); + Group2Vec->hide(); + GroupLCS->hide(); myEditCurrentArgument = Group3Pnts->LineEdit1; Group3Pnts->LineEdit1->setText( "" ); @@ -283,25 +318,53 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); break; } - case 2: /* plane from a planar face or LSC selection */ + case 2: /* plane from a planar face */ { GroupPntDir->hide(); Group3Pnts->hide(); GroupFace->show(); + Group2Vec->hide(); + GroupLCS->hide(); myEditCurrentArgument = GroupFace->LineEdit1; GroupFace->LineEdit1->setText( "" ); GroupFace->PushButton1->setDown( true ); - if ( GroupFace->RadioButton1->isChecked()) { - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); - } else if ( GroupFace->RadioButton2->isChecked()) { - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_PLANE ); - aMap.Add( GEOM_MARKER ); - globalSelection( aMap ); - } + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + break; + } + case 3: /* plane from a 2 Vectors */ + { + GroupPntDir->hide(); + Group3Pnts->hide(); + GroupFace->hide(); + Group2Vec->show(); + GroupLCS->hide(); + + myEditCurrentArgument = Group2Vec->LineEdit1; + Group2Vec->LineEdit1->setText( "" ); + Group2Vec->PushButton1->setDown( true ); + + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + break; + } + case 4: /* plane from a LCS */ + { + GroupPntDir->hide(); + Group3Pnts->hide(); + GroupFace->hide(); + Group2Vec->hide(); + GroupLCS->show(); + + myEditCurrentArgument = GroupLCS->LineEdit1; + GroupLCS->LineEdit1->setText( "" ); + GroupLCS->PushButton1->setDown( true ); + GroupLCS->RadioButton1->setChecked( true ); + myOriginType = 1; + + globalSelection(GEOM_MARKER); break; } } @@ -309,10 +372,12 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); + SelectionIntoArgument(); myEditCurrentArgument->setFocus(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); + displayPreview(true); } @@ -322,6 +387,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) //================================================================================= void BasicGUI_PlaneDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -341,6 +407,23 @@ bool BasicGUI_PlaneDlg::ClickOnApply() return true; } +//================================================================================= +// function : GroupClicked() +// purpose : OX OY OZ Radio button management +//================================================================================= +void BasicGUI_PlaneDlg::GroupClicked() +{ + QRadioButton* send = (QRadioButton*)sender(); + + if ( send == GroupLCS->RadioButton1 ) + myOriginType = 1; + else if ( send == GroupLCS->RadioButton2 ) + myOriginType = 2; + else if ( send == GroupLCS->RadioButton3 ) + myOriginType = 3; + displayPreview(true); +} + //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection has changed @@ -354,102 +437,73 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); - else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = GEOM::GEOM_Object::_nil(); + if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint.nullify(); + else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2.nullify(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3.nullify(); + else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace.nullify(); + else if ( myEditCurrentArgument == Group2Vec->LineEdit1 ) myVec1.nullify(); + else if ( myEditCurrentArgument == Group2Vec->LineEdit2 ) myVec2.nullify(); + else if ( myEditCurrentArgument == GroupLCS->LineEdit1 ) myLCS.nullify(); + displayPreview(true); return; } - // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName( aSelectedObject ); - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) - aNeedType = TopAbs_EDGE; - else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) - aNeedType = TopAbs_FACE; - - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap( 1 ); - if ( aNeedType == TopAbs_EDGE ) - aName += QString( ":edge_%1" ).arg( anIndex ); - else if (aNeedType == TopAbs_FACE) - aName += QString( ":face_%1" ).arg( anIndex ); - else - aName += QString( ":vertex_%1" ).arg( anIndex ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - } - else { // Global Selection - if ( aShape.ShapeType() != aNeedType ) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } - + TopAbs_ShapeEnum aNeedType; + if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2) + aNeedType = TopAbs_EDGE; + else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) + aNeedType = TopAbs_FACE; + else if ( myEditCurrentArgument == GroupLCS->LineEdit1 ) + aNeedType = TopAbs_FACE; + else + aNeedType = TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); myEditCurrentArgument->setText( aName ); - - /* if (!aSelectedObject->_is_nil()) { // clear selection if something selected - globalSelection(); - if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_PLANE ); - aMap.Add( GEOM_MARKER ); - globalSelection( aMap ); - } - else - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); - }*/ - - if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) { - myPoint = aSelectedObject; - if ( !myPoint->_is_nil() && myDir->_is_nil() ) - GroupPntDir->PushButton2->click(); + if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) { + myPoint = aSelectedObject; + if ( myPoint && !myDir ) + GroupPntDir->PushButton2->click(); } else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { - myDir = aSelectedObject; - if ( !myDir->_is_nil() && myPoint->_is_nil() ) - GroupPntDir->PushButton1->click(); + myDir = aSelectedObject; + if ( myDir && !myPoint ) + GroupPntDir->PushButton1->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) { myPoint1 = aSelectedObject; - if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) - Group3Pnts->PushButton2->click(); + if ( myPoint1 && !myPoint2 ) + Group3Pnts->PushButton2->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) { myPoint2 = aSelectedObject; - if ( !myPoint2->_is_nil() && myPoint3->_is_nil() ) - Group3Pnts->PushButton3->click(); + if ( myPoint2 && !myPoint3 ) + Group3Pnts->PushButton3->click(); } else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) { myPoint3 = aSelectedObject; - if ( !myPoint3->_is_nil() && myPoint1->_is_nil() ) - Group3Pnts->PushButton1->click(); + if ( myPoint3 && !myPoint1 ) + Group3Pnts->PushButton1->click(); } else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject; + else if ( myEditCurrentArgument == Group2Vec->LineEdit1 ) { + myVec1 = aSelectedObject; + if ( myVec1 && !myVec2 ) + Group2Vec->PushButton2->click(); + } else if ( myEditCurrentArgument == Group2Vec->LineEdit2 ) { + myVec2 = aSelectedObject; + if ( myVec2 && !myVec1 ) + Group2Vec->PushButton1->click(); + } else if ( myEditCurrentArgument == GroupLCS->LineEdit1 ) + myLCS = aSelectedObject; } - displayPreview(); + displayPreview(true); } @@ -501,18 +555,34 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() else if ( send == GroupFace->PushButton1 ) { myEditCurrentArgument = GroupFace->LineEdit1; GroupFace->PushButton1->setDown( true ); + } else if ( send == Group2Vec->PushButton1 ) { + myEditCurrentArgument = Group2Vec->LineEdit1; + Group2Vec->PushButton2->setDown( false ); + Group2Vec->LineEdit1->setEnabled( true ); + Group2Vec->LineEdit2->setEnabled( false ); + } else if ( send == Group2Vec->PushButton2 ) { + myEditCurrentArgument = Group2Vec->LineEdit2; + Group2Vec->PushButton1->setDown( false ); + Group2Vec->LineEdit1->setEnabled( false ); + Group2Vec->LineEdit2->setEnabled( true ); + } else if ( send == GroupLCS->PushButton1 ) { + myEditCurrentArgument = GroupLCS->LineEdit1; + GroupLCS->LineEdit1->setEnabled( true ); } myEditCurrentArgument->setFocus(); - if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { + if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || + myEditCurrentArgument == Group2Vec->LineEdit1 || + myEditCurrentArgument == Group2Vec->LineEdit2 ) { localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); - } - else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { + } else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { TColStd_MapOfInteger aMap; aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_MARKER ); globalSelection( aMap ); + } else if ( myEditCurrentArgument == GroupLCS->LineEdit1 ) { + globalSelection( GEOM_MARKER ); } else { // 3 Pnts localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); @@ -521,26 +591,7 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() // SelectionIntoArgument(); myEditCurrentArgument->setFocus(); send->setDown(true); - displayPreview(); -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_PlaneDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPntDir->LineEdit1 || - send == GroupPntDir->LineEdit2 || - send == Group3Pnts->LineEdit1 || - send == Group3Pnts->LineEdit2 || - send == Group3Pnts->LineEdit3 || - send == GroupFace->LineEdit1 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } @@ -552,9 +603,10 @@ void BasicGUI_PlaneDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); + SelectionIntoArgument(); } //================================================================================= @@ -583,7 +635,7 @@ void BasicGUI_PlaneDlg::enterEvent( QEvent* ) //================================================================================= void BasicGUI_PlaneDlg::ValueChangedInSpinBox( double newValue ) { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -596,6 +648,8 @@ double BasicGUI_PlaneDlg::getSize() const case 0 : return GroupPntDir->SpinBox_DX->value(); case 1 : return Group3Pnts->SpinBox_DX->value(); case 2 : return GroupFace->SpinBox_DX->value(); + case 3 : return Group2Vec->SpinBox_DX->value(); + case 4 : return GroupLCS->SpinBox_DX->value(); } return 0.; } @@ -610,6 +664,7 @@ QString BasicGUI_PlaneDlg::getSizeAsString() const case 0 : return GroupPntDir->SpinBox_DX->text(); case 1 : return Group3Pnts->SpinBox_DX->text(); case 2 : return GroupFace->SpinBox_DX->text(); + case 3 : return Group2Vec->SpinBox_DX->text(); } return QString(); } @@ -623,41 +678,41 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PlaneDlg::createOperation() return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); } -//================================================================================= -// function : isEqual -// purpose : it may also be needed to check for min distance between gp_Pnt-s... -//================================================================================= -static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) -{ - return thePnt1->_is_equivalent( thePnt2 ); -} - //================================================================================= // function : isValid // purpose : //================================================================================= bool BasicGUI_PlaneDlg::isValid( QString& msg ) { - const int id = getConstructorId(); + bool ok = false; if ( getSize() <= 0 ) { msg = QString( "Please, enter size greater than 0." ); - return false; } - - if ( id == 0 ) { - bool ok = GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() ); - return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) && ok; - } - else if ( id == 1 ) { - bool ok = Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() ); - return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) && - !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ) && ok; - } - else if ( id == 2 ) { - bool ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() ); - return !CORBA::is_nil( myFace ) && ok; + else { + switch ( getConstructorId() ) { + case 0: + ok = GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint && myDir; + break; + case 1: + ok = Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() ) && + myPoint1 && myPoint2 && myPoint3 && + myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3; + break; + case 2: + ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() ) && myFace; + break; + case 3: + ok = Group2Vec->SpinBox_DX->isValid( msg, !IsPreview() ) && + myVec1 && myVec2 && myVec1 != myVec2; + break; + case 4: + ok = GroupLCS->SpinBox_DX->isValid( msg, !IsPreview() ); + break; + default: + break; + } } - return false; + return ok; } //================================================================================= @@ -670,17 +725,27 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() ); + switch ( getConstructorId() ) { case 0 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlanePntVec( myPoint, myDir, getSize() ); + anObj = anOper->MakePlanePntVec( myPoint.get(), myDir.get(), getSize() ); res = true; break; case 1 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneThreePnt( myPoint1, myPoint2, myPoint3, getSize() ); + anObj = anOper->MakePlaneThreePnt( myPoint1.get(), myPoint2.get(), myPoint3.get(), getSize() ); res = true; break; case 2 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneFace( myFace, getSize() ); + anObj = anOper->MakePlaneFace( myFace.get(), getSize() ); + res = true; + break; + case 3 : + anObj = anOper->MakePlane2Vec( myVec1.get(), myVec2.get(), getSize() ); + res = true; + break; + case 4 : + anObj = anOper->MakePlaneLCS( myLCS.get(), getSize(), myOriginType ); res = true; break; } @@ -698,21 +763,27 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_PlaneDlg::addSubshapesToStudy() { - QMap objMap; - switch ( getConstructorId() ) { case 0: - objMap[GroupPntDir->LineEdit1->text()] = myPoint; - objMap[GroupPntDir->LineEdit2->text()] = myDir; + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myDir.get() ); break; case 1: - objMap[Group3Pnts->LineEdit1->text()] = myPoint1; - objMap[Group3Pnts->LineEdit2->text()] = myPoint2; - objMap[Group3Pnts->LineEdit3->text()] = myPoint3; + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); + GEOMBase::PublishSubObject( myPoint3.get() ); break; case 2: - objMap[GroupFace->LineEdit1->text()] = myFace; + GEOMBase::PublishSubObject( myFace.get() ); + break; + case 3: + GEOMBase::PublishSubObject( myVec1.get() ); + GEOMBase::PublishSubObject( myVec2.get() ); + break; + case 4: + GEOMBase::PublishSubObject( myLCS.get() ); break; + default: + break; } - addSubshapesToFather( objMap ); } diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.h b/src/BasicGUI/BasicGUI_PlaneDlg.h index 5d83df4e3..602dbdaec 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.h +++ b/src/BasicGUI/BasicGUI_PlaneDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_PlaneDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BASICGUI_PLANEDLG_H #define BASICGUI_PLANEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel1Spin; class DlgRef_2Sel1Spin; @@ -57,13 +59,16 @@ private: void enterEvent( QEvent* ); double getSize() const; QString getSizeAsString() const; + int myOriginType; private: - GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace; + GEOM::GeomObjPtr myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace, myVec1, myVec2, myLCS; DlgRef_2Sel1Spin* GroupPntDir; DlgRef_3Sel1Spin* Group3Pnts; - DlgRef_3Radio1Sel1Spin* GroupFace; + DlgRef_1Sel1Spin* GroupFace; + DlgRef_2Sel1Spin* Group2Vec; + DlgRef_3Radio1Sel1Spin* GroupLCS; private slots: void ClickOnOk(); @@ -73,12 +78,11 @@ private slots: void DeactivateActiveDialog(); void SelectionIntoArgument(); - void LineEditReturnPressed(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); void ValueChangedInSpinBox( double ); void SetDoubleSpinBoxStep( double ); - void SelectionTypeClicked(); + void GroupClicked(); }; #endif // BASICGUI_PLANEDLG_H diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 9b2f525ac..48682704b 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : BasicGUI_PointDlg.cxx -// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// GEOM GEOMGUI : GUI for Geometry component +// File : BasicGUI_PointDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + #include "BasicGUI_PointDlg.h" #include @@ -38,7 +39,12 @@ #include #include +#include +#include #include +#include +#include +#include #include #include @@ -49,108 +55,155 @@ #include #include +#define PARAM_VALUE 0 +#define COORD_VALUE 1 +#define LENGTH_VALUE 2 + +#define GEOM_POINT_XYZ 0 +#define GEOM_POINT_REF 1 +#define GEOM_POINT_EDGE 2 +#define GEOM_POINT_INTINT 3 +#define GEOM_POINT_SURF 4 + +#define SPACING 6 +#define MARGIN 9 + +enum { SelectEdge, SelectWire }; + //================================================================================= // class : BasicGUI_PointDlg() -// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the +// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) +BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), + myBusy (false) { - QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT") ) ); - QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_EDGE" ) ) ); - QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) ); - QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_LINES") ) ); - QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_FACE" ) ) ); - - setWindowTitle( tr( "GEOM_POINT_TITLE" ) ); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT"))); + QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_EDGE"))); + QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_REF"))); + QPixmap image4 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_LINES"))); + QPixmap image5 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_FACE"))); + QPixmap image6 (aResMgr->loadPixmap("GEOM", tr("ICO_LINE"))); + QPixmap image7 (aResMgr->loadPixmap("GEOM", tr("ICO_WIRE"))); + + setWindowTitle(tr("GEOM_POINT_TITLE")); /***************************************************************/ - mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POINTS" ) ); - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setIcon( image3 ); - mainFrame()->RadioButton3->setIcon( image1 ); + mainFrame()->GroupConstructors->setTitle(tr("GEOM_POINTS")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setIcon(image3); + mainFrame()->RadioButton3->setIcon(image1); mainFrame()->RadioButton4->show(); - mainFrame()->RadioButton4->setIcon( image4 ); + mainFrame()->RadioButton4->setIcon(image4); mainFrame()->RadioButton5->show(); - mainFrame()->RadioButton5->setIcon( image5 ); - - GroupXYZ = new DlgRef_3Spin( centralWidget() ); - GroupXYZ->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) ); - GroupXYZ->TextLabel1->setText( tr( "GEOM_X" ) ); - GroupXYZ->TextLabel2->setText( tr( "GEOM_Y" ) ); - GroupXYZ->TextLabel3->setText( tr( "GEOM_Z" ) ); - - GroupOnCurve = new DlgRef_1Sel1Spin( centralWidget() ); - GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_PARAM_POINT" ) ); - GroupOnCurve->TextLabel1->setText( tr( "GEOM_EDGE" ) ); - GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) ); - GroupOnCurve->PushButton1->setIcon( image2 ); - - GroupOnSurface = new DlgRef_1Sel2Spin( centralWidget() ); - GroupOnSurface->GroupBox1->setTitle( tr( "GEOM_PARAM_POINT" ) ); - GroupOnSurface->TextLabel1->setText( tr( "GEOM_FACE" ) ); - GroupOnSurface->TextLabel2->setText( tr( "GEOM_UPARAMETER" ) ); - GroupOnSurface->TextLabel3->setText( tr( "GEOM_VPARAMETER" ) ); - GroupOnSurface->PushButton1->setIcon( image2 ); - - GroupRefPoint = new DlgRef_1Sel3Spin( centralWidget() ); - GroupRefPoint->GroupBox1->setTitle( tr( "GEOM_REF_POINT" ) ); - GroupRefPoint->TextLabel1->setText( tr( "GEOM_POINT" ) ); - GroupRefPoint->PushButton1->setIcon( image2 ); - GroupRefPoint->TextLabel2->setText( tr( "GEOM_DX" ) ); - GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) ); - GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) ); - - GroupLineIntersection = new DlgRef_2Sel( centralWidget() ); - GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) ); - GroupLineIntersection->TextLabel1->setText( tr( "GEOM_LINE1" ) ); - GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) ); - GroupLineIntersection->PushButton1->setIcon( image2 ); - GroupLineIntersection->PushButton2->setIcon( image2 ); + mainFrame()->RadioButton5->setIcon(image5); + + myParamGroup = new QGroupBox(centralWidget()); + myParamCoord = new QButtonGroup(myParamGroup); + QHBoxLayout* boxLayout = new QHBoxLayout(myParamGroup); + boxLayout->setMargin(MARGIN); boxLayout->setSpacing(SPACING); + QRadioButton* btn = new QRadioButton(tr("GEOM_PARAM_VALUE"), myParamGroup); + myParamCoord->addButton(btn, PARAM_VALUE); + boxLayout->addWidget(btn); + btn = new QRadioButton(tr("GEOM_LENGTH_VALUE"), myParamGroup); + myParamCoord->addButton(btn, LENGTH_VALUE); + boxLayout->addWidget(btn); + btn = new QRadioButton(tr("GEOM_COORD_VALUE"), myParamGroup); + myParamCoord->addButton(btn, COORD_VALUE); + boxLayout->addWidget(btn); + myParamCoord->setExclusive(true); + myParamCoord->button(PARAM_VALUE)->setChecked(true); + + GroupXYZ = new DlgRef_3Spin(centralWidget()); + GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES")); + GroupXYZ->TextLabel1->setText(tr("GEOM_X")); + GroupXYZ->TextLabel2->setText(tr("GEOM_Y")); + GroupXYZ->TextLabel3->setText(tr("GEOM_Z")); + + GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget()); + GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE")); + GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE")); + GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT")); + GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER")); + GroupOnCurve->PushButton1->setIcon(image2); + GroupOnCurve->PushButton2->setIcon(image2); + + GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget()); + GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE")); + GroupOnSurface->TextLabel1->setText(tr("GEOM_FACE")); + GroupOnSurface->TextLabel2->setText(tr("GEOM_UPARAMETER")); + GroupOnSurface->TextLabel3->setText(tr("GEOM_VPARAMETER")); + GroupOnSurface->PushButton1->setIcon(image2); + + GroupRefPoint = new DlgRef_1Sel3Spin(centralWidget()); + GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT")); + GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT")); + GroupRefPoint->PushButton1->setIcon(image2); + GroupRefPoint->TextLabel2->setText(tr("GEOM_DX")); + GroupRefPoint->TextLabel3->setText(tr("GEOM_DY")); + GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ")); + + /* popup menu for line intersect buttons */ + myBtnPopup = new QMenu(this); + QIcon ico_line = QIcon(image6); + QIcon ico_wire = QIcon(image7); + myActions[myBtnPopup->addAction(ico_line, tr("GEOM_EDGE"))] = SelectEdge; + myActions[myBtnPopup->addAction(ico_wire, tr("GEOM_WIRE"))] = SelectWire; + + GroupLineIntersection = new DlgRef_2Sel(centralWidget()); + GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION")); + GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1")); + GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2")); + GroupLineIntersection->PushButton1->setIcon(image2); + GroupLineIntersection->PushButton1->setMenu(myBtnPopup); + GroupLineIntersection->PushButton2->setIcon(image2); + GroupLineIntersection->PushButton2->setMenu(myBtnPopup); GroupLineIntersection->LineEdit2->setEnabled(false); - myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES" ), centralWidget() ); - QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp ); - myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), myCoordGrp ), 0, 0 ); - myX = new QLineEdit( myCoordGrp ); - myCoordGrpLayout->addWidget( myX, 0, 1 ); - myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), myCoordGrp ), 1, 0 ); - myY = new QLineEdit( myCoordGrp ); - myCoordGrpLayout->addWidget( myY, 1, 1 ); - myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), myCoordGrp ), 2, 0 ); - myZ = new QLineEdit( myCoordGrp ); - myCoordGrpLayout->addWidget( myZ, 2, 1 ); - - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupXYZ ); - layout->addWidget( GroupOnCurve ); - layout->addWidget( GroupOnSurface ); - layout->addWidget( GroupRefPoint ); - layout->addWidget( GroupLineIntersection ); - layout->addWidget( myCoordGrp ); - - myX->setReadOnly( true ); - myY->setReadOnly( true ); - myZ->setReadOnly( true ); - - myX->setEnabled( false ); - myY->setEnabled( false ); - myZ->setEnabled( false ); + myCoordGrp = new QGroupBox(tr("GEOM_COORDINATES_RES"), centralWidget()); + QGridLayout* myCoordGrpLayout = new QGridLayout(myCoordGrp); + myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_X"), myCoordGrp), 0, 0); + myX = new QLineEdit(myCoordGrp); + myCoordGrpLayout->addWidget(myX, 0, 1); + myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Y"), myCoordGrp), 1, 0); + myY = new QLineEdit(myCoordGrp); + myCoordGrpLayout->addWidget(myY, 1, 1); + myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Z"), myCoordGrp), 2, 0); + myZ = new QLineEdit(myCoordGrp); + myCoordGrpLayout->addWidget(myZ, 2, 1); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(myParamGroup); + layout->addWidget(GroupXYZ); + layout->addWidget(GroupOnCurve); + layout->addWidget(GroupOnSurface); + layout->addWidget(GroupRefPoint); + layout->addWidget(GroupLineIntersection); + layout->addWidget(myCoordGrp); + + myX->setReadOnly(true); + myY->setReadOnly(true); + myZ->setReadOnly(true); + + myX->setEnabled(false); + myY->setEnabled(false); + myZ->setEnabled(false); QPalette aPal = myX->palette(); - aPal.setColor( QPalette::Disabled, QPalette::Text, QColor( 0, 0, 0 ) ) ; - myX->setPalette( aPal ); - myY->setPalette( aPal ); - myZ->setPalette( aPal ); + aPal.setColor(QPalette::Disabled, QPalette::Text, QColor(0, 0, 0)); + myX->setPalette(aPal); + myY->setPalette(aPal); + myZ->setPalette(aPal); + + setHelpFileName("create_point_page.html"); - setHelpFileName( "create_point_page.html" ); - Init(); } @@ -170,94 +223,97 @@ BasicGUI_PointDlg::~BasicGUI_PointDlg() //================================================================================= void BasicGUI_PointDlg::Init() { - GroupOnCurve->LineEdit1->setReadOnly( true ); - GroupOnSurface->LineEdit1->setReadOnly( true ); - GroupRefPoint->LineEdit1->setReadOnly( true ); - GroupLineIntersection->LineEdit1->setReadOnly( true ); - GroupLineIntersection->LineEdit2->setReadOnly( true ); - GroupLineIntersection->LineEdit1->setEnabled( true ); - GroupLineIntersection->LineEdit2->setEnabled( false ); + GroupOnCurve->LineEdit1->setReadOnly(true); + GroupOnCurve->LineEdit2->setReadOnly(true); + GroupOnSurface->LineEdit1->setReadOnly(true); + GroupRefPoint->LineEdit1->setReadOnly(true); + GroupLineIntersection->LineEdit1->setReadOnly(true); + GroupLineIntersection->LineEdit2->setReadOnly(true); + GroupLineIntersection->LineEdit1->setEnabled(true); + GroupLineIntersection->LineEdit2->setEnabled(false); - myEdge = GEOM::GEOM_Object::_nil(); - myRefPoint = GEOM::GEOM_Object::_nil(); + myEdge.nullify(); + myFace.nullify(); + myRefPoint.nullify(); + myLine1.nullify(); + myLine2.nullify(); + myNeedType = TopAbs_VERTEX; myEditCurrentArgument = 0; /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); - + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + /* min, max, step and decimals for spin boxes */ - initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - GroupXYZ->SpinBox_DX->setValue( 0.0 ); - GroupXYZ->SpinBox_DY->setValue( 0.0 ); - GroupXYZ->SpinBox_DZ->setValue( 0.0 ); - - initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - GroupRefPoint->SpinBox_DX->setValue( 0.0 ); - GroupRefPoint->SpinBox_DY->setValue( 0.0 ); - GroupRefPoint->SpinBox_DZ->setValue( 0.0 ); + initSpinBox(GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision"); + initSpinBox(GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision"); + initSpinBox(GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision"); + GroupXYZ->SpinBox_DX->setValue(0.0); + GroupXYZ->SpinBox_DY->setValue(0.0); + GroupXYZ->SpinBox_DZ->setValue(0.0); + + initSpinBox(GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision"); + initSpinBox(GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision"); + initSpinBox(GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision"); + GroupRefPoint->SpinBox_DX->setValue(0.0); + GroupRefPoint->SpinBox_DY->setValue(0.0); + GroupRefPoint->SpinBox_DZ->setValue(0.0); step = 0.1; - initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY - GroupOnCurve->SpinBox_DX->setValue( 0.5 ); + initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision"); + GroupOnCurve->SpinBox_DX->setValue(0.5); - initSpinBox( GroupOnSurface->SpinBox_DX, 0., 1., step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY - GroupOnSurface->SpinBox_DX->setValue( 0.5 ); - initSpinBox( GroupOnSurface->SpinBox_DY, 0., 1., step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY - GroupOnSurface->SpinBox_DY->setValue( 0.5 ); + initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision"); + GroupOnSurface->SpinBox_DX->setValue(0.5); + initSpinBox(GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision"); + GroupOnSurface->SpinBox_DY->setValue(0.5); /* signals and slots connections */ - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); - connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + connect(myParamCoord, SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int))); - connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupOnCurve->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupOnCurve->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupOnSurface->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupLineIntersection->PushButton1, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument())); + connect(GroupLineIntersection->PushButton2, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument())); - connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupOnSurface->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect(myBtnPopup, SIGNAL(triggered(QAction*)), this, SLOT(onBtnPopup(QAction*))); - connect( GroupLineIntersection->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupLineIntersection->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupLineIntersection->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupLineIntersection->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupOnSurface->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupOnSurface->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupXYZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupXYZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupXYZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupRefPoint->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect( GroupOnCurve->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupOnSurface->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupOnSurface->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupXYZ->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupXYZ->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupXYZ->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupRefPoint->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupRefPoint->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupRefPoint->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); - connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ), - this, SLOT(SelectionIntoArgument() ) ); + initName(tr("GEOM_VERTEX")); - - initName( tr( "GEOM_VERTEX" ) ); - - ConstructorsClicked( 0 ); + ConstructorsClicked(0); } //================================================================================= // function : SetDoubleSpinBoxStep() // purpose : Double spin box management //================================================================================= -void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step ) +void BasicGUI_PointDlg::SetDoubleSpinBoxStep(double step) { GroupOnCurve->SpinBox_DX->setSingleStep(step); GroupXYZ->SpinBox_DX->setSingleStep(step); @@ -266,8 +322,6 @@ void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step ) GroupRefPoint->SpinBox_DX->setSingleStep(step); GroupRefPoint->SpinBox_DY->setSingleStep(step); GroupRefPoint->SpinBox_DZ->setSingleStep(step); - GroupOnSurface->SpinBox_DX->setSingleStep(step); - GroupOnSurface->SpinBox_DY->setSingleStep(step); } @@ -276,138 +330,142 @@ void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step ) // purpose : Radio button management //================================================================================= void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) -{ - globalSelection(); // close local contexts, if any - - switch ( constructorId ) { - case 0: +{ + switch (constructorId) { + case GEOM_POINT_XYZ: { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - + globalSelection(); // close local contexts, if any + myNeedType = TopAbs_VERTEX; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + GroupRefPoint->hide(); GroupOnCurve->hide(); GroupLineIntersection->hide(); GroupOnSurface->hide(); - myCoordGrp->hide(); - + myParamGroup->hide(); GroupXYZ->show(); break; } - case 1: + case GEOM_POINT_REF: { + globalSelection(); // close local contexts, if any + myNeedType = TopAbs_VERTEX; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + myEditCurrentArgument = GroupRefPoint->LineEdit1; - myEditCurrentArgument->setText( "" ); - myRefPoint = GEOM::GEOM_Object::_nil(); - GroupRefPoint->PushButton1->setDown(true); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - + myEditCurrentArgument->setText(""); + myRefPoint.nullify(); + GroupRefPoint->PushButton1->setDown(true); + myParamGroup->hide(); GroupXYZ->hide(); GroupOnCurve->hide(); GroupLineIntersection->hide(); GroupOnSurface->hide(); - GroupRefPoint->show(); - myCoordGrp->show(); break; } - case 2: + case GEOM_POINT_EDGE: { + globalSelection(); // close local contexts, if any + myNeedType = TopAbs_EDGE; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + myEditCurrentArgument = GroupOnCurve->LineEdit1; - myEditCurrentArgument->setText( "" ); - myEdge = GEOM::GEOM_Object::_nil(); + myEditCurrentArgument->setText(""); + myEdge.nullify(); + myRefPoint.nullify(); GroupOnCurve->PushButton1->setDown(true); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); - - GroupXYZ->hide(); GroupRefPoint->hide(); GroupLineIntersection->hide(); GroupOnSurface->hide(); - + myParamGroup->show(); + myParamCoord->button(LENGTH_VALUE)->show(); + myParamCoord->button(PARAM_VALUE)->setChecked(true); GroupOnCurve->show(); - myCoordGrp->show(); + updateParamCoord(false); break; } - case 3: + case GEOM_POINT_INTINT: { + globalSelection(); // close local contexts, if any + myNeedType = TopAbs_EDGE; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + myEditCurrentArgument = GroupLineIntersection->LineEdit1; - GroupLineIntersection->LineEdit1->setText( "" ); - GroupLineIntersection->LineEdit2->setText( "" ); - GroupLineIntersection->LineEdit1->setEnabled( true ); - GroupLineIntersection->LineEdit2->setEnabled( false ); - myLine1 = GEOM::GEOM_Object::_nil(); - myLine2 = GEOM::GEOM_Object::_nil(); + GroupLineIntersection->LineEdit1->setText(""); + GroupLineIntersection->LineEdit2->setText(""); + GroupLineIntersection->LineEdit1->setEnabled(true); + GroupLineIntersection->LineEdit2->setEnabled(false); + myLine1.nullify(); + myLine2.nullify(); GroupLineIntersection->PushButton1->setDown(true); GroupLineIntersection->PushButton2->setDown(false); - - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); - + myParamGroup->hide(); GroupXYZ->hide(); GroupRefPoint->hide(); GroupOnCurve->hide(); GroupOnSurface->hide(); - myCoordGrp->hide(); - GroupLineIntersection->show(); break; } - case 4: + case GEOM_POINT_SURF: { + globalSelection(); // close local contexts, if any + myNeedType = TopAbs_FACE; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + myEditCurrentArgument = GroupOnSurface->LineEdit1; - myEditCurrentArgument->setText( "" ); - myFace = GEOM::GEOM_Object::_nil(); + myEditCurrentArgument->setText(""); + myFace.nullify(); GroupOnSurface->PushButton1->setDown(true); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); - - GroupXYZ->hide(); GroupRefPoint->hide(); GroupOnCurve->hide(); GroupLineIntersection->hide(); - + myParamGroup->show(); + myParamCoord->button(LENGTH_VALUE)->hide(); + myParamCoord->button(PARAM_VALUE)->setChecked(true); GroupOnSurface->show(); - myCoordGrp->show(); + updateParamCoord(false); break; } } - myX->setText( "" ); - myY->setText( "" ); - myZ->setText( "" ); + myX->setText(""); + myY->setText(""); + myZ->setText(""); - qApp->processEvents(); - updateGeometry(); - resize( minimumSizeHint() ); + QTimer::singleShot(50, this, SLOT(updateSize())); SelectionIntoArgument(); } - //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void BasicGUI_PointDlg::ClickOnOk() { - if ( onAccept() ) + setIsApplyAndClose(true); + if (onAccept()) ClickOnCancel(); } - //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= bool BasicGUI_PointDlg::ClickOnApply() { - if ( !onAccept() ) + if (!onAccept()) return false; - + initName(); - ConstructorsClicked( getConstructorId() ); + ConstructorsClicked(getConstructorId()); return true; } @@ -418,124 +476,89 @@ bool BasicGUI_PointDlg::ClickOnApply() //================================================================================= void BasicGUI_PointDlg::SelectionIntoArgument() { + erasePreview(); const int id = getConstructorId(); - if ( ( id == 1 || id == 2 || id == 4 ) && myEditCurrentArgument != 0 ) + if ((id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF) + && myEditCurrentArgument != 0) { - myEditCurrentArgument->setText( "" ); - myX->setText( "" ); - myY->setText( "" ); - myZ->setText( "" ); - myRefPoint = myEdge = myFace = GEOM::GEOM_Object::_nil(); + myEditCurrentArgument->setText(""); + myX->setText(""); + myY->setText(""); + myZ->setText(""); + myFace.nullify(); + if (myEditCurrentArgument == GroupOnCurve->LineEdit1) + myEdge.nullify(); + else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) + myRefPoint.nullify(); + } + else if (id == GEOM_POINT_INTINT) { + myEditCurrentArgument->setText(""); + if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) + myLine1.nullify(); + else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) + myLine2.nullify(); } - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; - Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName(aSelectedObject); - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - if ( id == 2 || id == 3 ) - aNeedType = TopAbs_EDGE; - else if ( id == 4 ) - aNeedType = TopAbs_FACE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(anIO, aMap); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap( 1 ); - if ( aNeedType == TopAbs_EDGE ) - aName += QString( ":edge_%1" ).arg( anIndex ); - else - aName += QString( ":vertex_%1" ).arg( anIndex ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ); - } - else { // Global Selection - if ( aShape.ShapeType() != aNeedType ) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - if ( id == 0 ) return; - } + GEOM::GeomObjPtr aSelectedObject = getSelected(myNeedType); + TopoDS_Shape aShape; + if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) { + QString aName = GEOMBase::GetName(aSelectedObject.get()); + myBusy = true; + if (id == GEOM_POINT_XYZ) { + gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); + GroupXYZ->SpinBox_DX->setValue(aPnt.X()); + GroupXYZ->SpinBox_DY->setValue(aPnt.Y()); + GroupXYZ->SpinBox_DZ->setValue(aPnt.Z()); + } + else if (id == GEOM_POINT_REF) { + myRefPoint = aSelectedObject; + GroupRefPoint->LineEdit1->setText(aName); + } + else if (id == GEOM_POINT_EDGE) { + myEditCurrentArgument->setText(aName); + if (myEditCurrentArgument == GroupOnCurve->LineEdit1) { + myEdge = aSelectedObject; + if (myEdge && !myRefPoint) { + GroupOnCurve->PushButton2->click(); } } - - if ( aShape.IsNull() || aShape.ShapeType() != aNeedType) - return; - - if ( id == 0 ) { - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - GroupXYZ->SpinBox_DX->setValue( aPnt.X() ); - GroupXYZ->SpinBox_DY->setValue( aPnt.Y() ); - GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() ); - } - else if ( id == 1 ) { + else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) { myRefPoint = aSelectedObject; - GroupRefPoint->LineEdit1->setText( aName ); - } - else if ( id == 2 ) { - myEdge = aSelectedObject; - GroupOnCurve->LineEdit1->setText( aName ); - } - else if ( id == 3 ) { - myEditCurrentArgument->setText( aName ); - globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); - if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) { - myLine1 = aSelectedObject; - if ( !myLine1->_is_nil() && myLine2->_is_nil() ) - GroupLineIntersection->PushButton2->click(); + if (myRefPoint && !myEdge) { + GroupOnCurve->PushButton1->click(); } - else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) { - myLine2 = aSelectedObject; - if ( !myLine2->_is_nil() && myLine1->_is_nil() ) - GroupLineIntersection->PushButton1->click(); + } + } + else if (id == GEOM_POINT_INTINT) { + myEditCurrentArgument->setText(aName); + if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) { + myLine1 = aSelectedObject; + if (myLine1 && !myLine2) { + GroupLineIntersection->PushButton2->setMenu(0); + GroupLineIntersection->PushButton2->click(); + GroupLineIntersection->PushButton2->setDown(true); + GroupLineIntersection->PushButton2->setMenu(myBtnPopup); } } - else if ( id == 4 ) - { - myFace = aSelectedObject; - GroupOnSurface->LineEdit1->setText( aName ); + else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) { + myLine2 = aSelectedObject; + if (myLine2 && !myLine1) { + GroupLineIntersection->PushButton1->setMenu(0); + GroupLineIntersection->PushButton1->click(); + GroupLineIntersection->PushButton1->setDown(true); + GroupLineIntersection->PushButton1->setMenu(myBtnPopup); + } } } + else if (id == GEOM_POINT_SURF) { + myFace = aSelectedObject; + GroupOnSurface->LineEdit1->setText(aName); + } + myBusy = false; } - - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_PointDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupRefPoint->LineEdit1 || - send == GroupOnCurve->LineEdit1 || - send == GroupLineIntersection->LineEdit1 || - send == GroupLineIntersection->LineEdit2 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } @@ -545,46 +568,60 @@ void BasicGUI_PointDlg::LineEditReturnPressed() //================================================================================= void BasicGUI_PointDlg::SetEditCurrentArgument() { - globalSelection(); // close local contexts, if any - QPushButton* send = (QPushButton*)sender(); - if ( send == GroupRefPoint->PushButton1 ) { + if (send == GroupRefPoint->PushButton1) { GroupRefPoint->LineEdit1->setFocus(); myEditCurrentArgument = GroupRefPoint->LineEdit1; - - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); } - else if ( send == GroupOnCurve->PushButton1 ) { + else if (send == GroupOnCurve->PushButton1) { GroupOnCurve->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit1; - - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + globalSelection(); // close local contexts, if any + myNeedType = TopAbs_EDGE; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + GroupOnCurve->PushButton2->setDown(false); + GroupOnCurve->LineEdit1->setEnabled(true); + GroupOnCurve->LineEdit2->setEnabled(false); + } + else if (send == GroupOnCurve->PushButton2) { + GroupOnCurve->LineEdit2->setFocus(); + myEditCurrentArgument = GroupOnCurve->LineEdit2; + globalSelection(); // close local contexts, if any + myNeedType = TopAbs_VERTEX; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + GroupOnCurve->PushButton1->setDown(false); + GroupOnCurve->LineEdit2->setEnabled(true); + GroupOnCurve->LineEdit1->setEnabled(false); } - else if ( send == GroupOnSurface->PushButton1 ) + else if (send == GroupOnSurface->PushButton1) { GroupOnSurface->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnSurface->LineEdit1; - - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); } - else if ( send == GroupLineIntersection->PushButton1 ) { + else if (send == GroupLineIntersection->PushButton1) { GroupLineIntersection->LineEdit1->setFocus(); myEditCurrentArgument = GroupLineIntersection->LineEdit1; - GroupLineIntersection->PushButton2->setDown( false ); + GroupLineIntersection->PushButton2->setDown(false); GroupLineIntersection->LineEdit1->setEnabled(true); GroupLineIntersection->LineEdit2->setEnabled(false); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } - else if ( send == GroupLineIntersection->PushButton2 ) { + else if (send == GroupLineIntersection->PushButton2) { GroupLineIntersection->LineEdit2->setFocus(); myEditCurrentArgument = GroupLineIntersection->LineEdit2; - GroupLineIntersection->PushButton1->setDown( false ); + GroupLineIntersection->PushButton1->setDown(false); GroupLineIntersection->LineEdit1->setEnabled(false); GroupLineIntersection->LineEdit2->setEnabled(true); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } send->setDown(true); + + if ((send == GroupLineIntersection->PushButton1 || + send == GroupLineIntersection->PushButton2) && !myBusy) + SelectionIntoArgument(); } @@ -592,9 +629,9 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() // function : enterEvent() // purpose : to reactivate this dialog box when mouse enter onto the window //================================================================================= -void BasicGUI_PointDlg::enterEvent( QEvent* ) +void BasicGUI_PointDlg::enterEvent(QEvent*) { - if ( !mainFrame()->GroupConstructors->isEnabled() ) + if (!mainFrame()->GroupConstructors->isEnabled()) ActivateThisDialog(); } @@ -603,11 +640,14 @@ void BasicGUI_PointDlg::enterEvent( QEvent* ) // function : ActivateThisDialog() // purpose : //================================================================================= -void BasicGUI_PointDlg::ActivateThisDialog( ) +void BasicGUI_PointDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - // myGeomGUI->SetState( 0 ); - ConstructorsClicked( getConstructorId() ); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked(getConstructorId()); } @@ -617,7 +657,7 @@ void BasicGUI_PointDlg::ActivateThisDialog( ) //================================================================================= void BasicGUI_PointDlg::DeactivateActiveDialog() { - // myGeomGUI->SetState( -1 ); + // myGeomGUI->SetState(-1); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -628,9 +668,19 @@ void BasicGUI_PointDlg::DeactivateActiveDialog() //================================================================================= void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue) { - displayPreview(); + displayPreview(true); } +//================================================================================= +// function : CheckBoxClicked() +// purpose : Check Boxes Management +//================================================================================= +void BasicGUI_PointDlg::CheckBoxClicked(int State) +{ + displayPreview(true); +} + + //================================================================================= // funcion : getParameter() // purpose : @@ -665,14 +715,14 @@ double BasicGUI_PointDlg::getVParameter() const // function : OnPointSelected // purpose : //================================================================================= -void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt ) +void BasicGUI_PointDlg::OnPointSelected(const gp_Pnt& thePnt) { - if ( getConstructorId() == 0 ) { - GroupXYZ->SpinBox_DX->setValue( thePnt.X() ); - GroupXYZ->SpinBox_DY->setValue( thePnt.Y() ); - GroupXYZ->SpinBox_DZ->setValue( thePnt.Z() ); + if (getConstructorId() == GEOM_POINT_XYZ) { + GroupXYZ->SpinBox_DX->setValue(thePnt.X()); + GroupXYZ->SpinBox_DY->setValue(thePnt.Y()); + GroupXYZ->SpinBox_DZ->setValue(thePnt.Z()); - displayPreview(); + displayPreview(true); } } @@ -682,60 +732,71 @@ void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt ) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation() { - return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); + return myGeomGUI->GetGeomGen()->GetIBasicOperations(getStudyId()); } //================================================================================= // function : isValid // purpose : //================================================================================= -bool BasicGUI_PointDlg::isValid( QString& msg ) +bool BasicGUI_PointDlg::isValid(QString& msg) { - const int id = getConstructorId(); - if ( id == 0 ) { - bool ok = true; - ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; - return ok; - } - else if ( id == 1 ) { - bool ok = true; - ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; - - return !myRefPoint->_is_nil() && ok; - } - else if ( id == 2 ) { - bool ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() ); - return !myEdge->_is_nil() && ok; - } - else if ( id == 3 ) - return ( !myLine1->_is_nil() && !myLine2->_is_nil() ); - else if ( id == 4 ) { - bool ok = true; - ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - return !myFace->_is_nil() && ok; - + bool ok = false; + switch (getConstructorId()) { + case GEOM_POINT_XYZ : + ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) && + GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) && + GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview()); + break; + case GEOM_POINT_REF: + ok = GroupRefPoint->SpinBox_DX->isValid(msg, !IsPreview()) && + GroupRefPoint->SpinBox_DY->isValid(msg, !IsPreview()) && + GroupRefPoint->SpinBox_DZ->isValid(msg, !IsPreview()) && + myRefPoint; + break; + case GEOM_POINT_EDGE: + if (myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE) + ok = GroupOnCurve->SpinBox_DX->isValid(msg, !IsPreview()); + else + ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) && + GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) && + GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview()); + ok = myEdge && ok; + break; + case GEOM_POINT_INTINT: + ok = myLine1 && myLine2; + break; + case GEOM_POINT_SURF: + if (myParamCoord->checkedId() == PARAM_VALUE) + ok = GroupOnSurface->SpinBox_DX->isValid(msg, !IsPreview()) && + GroupOnSurface->SpinBox_DY->isValid(msg, !IsPreview()); + else + ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) && + GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) && + GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview()); + ok = myFace && ok; + break; + default: + break; } - return false; + return ok; } //================================================================================= // function : execute // purpose : //================================================================================= -bool BasicGUI_PointDlg::execute( ObjectList& objects ) +bool BasicGUI_PointDlg::execute(ObjectList& objects) { bool res = false; GEOM::GEOM_Object_var anObj; QStringList aParameters; - switch ( getConstructorId() ) { - case 0 : + GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow(getOperation()); + + switch (getConstructorId()) { + case GEOM_POINT_XYZ : { double x = GroupXYZ->SpinBox_DX->value(); double y = GroupXYZ->SpinBox_DY->value(); @@ -744,12 +805,12 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) aParameters << GroupXYZ->SpinBox_DX->text(); aParameters << GroupXYZ->SpinBox_DY->text(); aParameters << GroupXYZ->SpinBox_DZ->text(); - - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x, y, z ); + + anObj = anOper->MakePointXYZ(x, y, z); res = true; break; } - case 1 : + case GEOM_POINT_REF : { double dx = GroupRefPoint->SpinBox_DX->value(); double dy = GroupRefPoint->SpinBox_DY->value(); @@ -758,61 +819,98 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) aParameters << GroupRefPoint->SpinBox_DX->text(); aParameters << GroupRefPoint->SpinBox_DY->text(); aParameters << GroupRefPoint->SpinBox_DZ->text(); - - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> - MakePointWithReference( myRefPoint, dx, dy, dz ); + + anObj = anOper->MakePointWithReference(myRefPoint.get(), dx, dy, dz); res = true; break; } - case 2 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> - MakePointOnCurve( myEdge, getParameter() ); - aParameters<SpinBox_DX->text(); - res = true; - break; - case 3 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> - MakePointOnLinesIntersection( myLine1, myLine2 ); - res = true; - break; - case 4 : - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> - MakePointOnSurface( myFace, getUParameter(), getVParameter() ); - aParameters<SpinBox_DX->text(); - aParameters<SpinBox_DY->text(); + case GEOM_POINT_EDGE : + { + if (myParamCoord->checkedId() == PARAM_VALUE) { + anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter()); + aParameters<SpinBox_DX->text(); + } + else if (myParamCoord->checkedId() == LENGTH_VALUE) { + anObj = anOper->MakePointOnCurveByLength(myEdge.get(), getParameter(), myRefPoint.get()); + aParameters<SpinBox_DX->text(); + } + else if (myParamCoord->checkedId() == COORD_VALUE) { + double x = GroupXYZ->SpinBox_DX->value(); + double y = GroupXYZ->SpinBox_DY->value(); + double z = GroupXYZ->SpinBox_DZ->value(); + + aParameters << GroupXYZ->SpinBox_DX->text(); + aParameters << GroupXYZ->SpinBox_DY->text(); + aParameters << GroupXYZ->SpinBox_DZ->text(); + + anObj = anOper->MakePointOnCurveByCoord(myEdge.get(), x, y, z); + } + res = true; + break; + } + case GEOM_POINT_INTINT : + anObj = anOper->MakePointOnLinesIntersection(myLine1.get(), myLine2.get()); + if (!anObj->_is_nil()) { + QString aName = getNewObjectName(); + if (anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex")) + initName(tr("GEOM_COMPOUND")); + else if (anObj->GetShapeType() == GEOM::VERTEX && aName.startsWith("Compound")) + initName(tr("GEOM_VERTEX")); + } res = true; break; + case GEOM_POINT_SURF : + { + if (myParamCoord->checkedId() == PARAM_VALUE) { + anObj = anOper->MakePointOnSurface(myFace.get(), getUParameter(), getVParameter()); + aParameters<SpinBox_DX->text(); + aParameters<SpinBox_DY->text(); + } else { + double x = GroupXYZ->SpinBox_DX->value(); + double y = GroupXYZ->SpinBox_DY->value(); + double z = GroupXYZ->SpinBox_DZ->value(); + + aParameters << GroupXYZ->SpinBox_DX->text(); + aParameters << GroupXYZ->SpinBox_DY->text(); + aParameters << GroupXYZ->SpinBox_DZ->text(); + + anObj = anOper->MakePointOnSurfaceByCoord(myFace.get(), x, y, z); + } + res = true; + break; + } } - - if(!anObj->_is_nil() && !IsPreview() && (getConstructorId()==0 || - getConstructorId() == 1 || - getConstructorId() == 2 || - getConstructorId() == 4) ) { - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + + const int id = getConstructorId(); + if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ || + id == GEOM_POINT_REF || + id == GEOM_POINT_EDGE || + id == GEOM_POINT_SURF)) { + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } - - if ( getConstructorId() == 1 || getConstructorId() == 2 || - getConstructorId() == 4 ) { + if (id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF) { TopoDS_Shape aShape; - if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && - aShape.ShapeType() == TopAbs_VERTEX ) { - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - myX->setText( QString( "%1" ).arg( aPnt.X() ) ); - myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); - myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); + if (GEOMBase::GetShape(anObj, aShape) && !aShape.IsNull() && + aShape.ShapeType() == TopAbs_VERTEX) { + gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue("Geometry", "length_precision", 6); + myX->setText(DlgRef::PrintDoubleValue(aPnt.X(), aPrecision)); + myY->setText(DlgRef::PrintDoubleValue(aPnt.Y(), aPrecision)); + myZ->setText(DlgRef::PrintDoubleValue(aPnt.Z(), aPrecision)); } else { - myX->setText( "" ); - myY->setText( "" ); - myZ->setText( "" ); + myX->setText(""); + myY->setText(""); + myZ->setText(""); } } - - if ( !anObj->_is_nil() ) { - objects.push_back( anObj._retn() ); + + if (!anObj->_is_nil()) { + objects.push_back(anObj._retn()); } - + return res; } @@ -822,24 +920,96 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_PointDlg::addSubshapesToStudy() { - QMap objMap; - - switch ( getConstructorId() ) { - case 0: + switch (getConstructorId()) { + case GEOM_POINT_REF: + GEOMBase::PublishSubObject(myRefPoint.get()); break; - case 1: - objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint; + case GEOM_POINT_EDGE: + GEOMBase::PublishSubObject(myEdge.get()); break; - case 2: - objMap[GroupOnCurve->LineEdit1->text()] = myEdge; + case GEOM_POINT_INTINT: + GEOMBase::PublishSubObject(myLine1.get()); + GEOMBase::PublishSubObject(myLine2.get()); break; - case 3: - objMap[GroupLineIntersection->LineEdit1->text()] = myLine1; - objMap[GroupLineIntersection->LineEdit2->text()] = myLine2; + case GEOM_POINT_SURF: + GEOMBase::PublishSubObject(myFace.get()); break; - case 4: - objMap[GroupOnSurface->LineEdit1->text()] = myFace; + default: break; } - addSubshapesToFather( objMap ); +} + +//================================================================================= +// function : ClickParamCoord() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ClickParamCoord(int id) +{ + updateParamCoord(true); + displayPreview(true); +} + +//================================================================================= +// function : updateParamCoord +// purpose : +//================================================================================= +void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate) +{ + bool isParam = myParamCoord->checkedId() == PARAM_VALUE; + bool isLength = myParamCoord->checkedId() == LENGTH_VALUE; + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + + const int id = getConstructorId(); + if (id == GEOM_POINT_EDGE) { + GroupOnCurve->TextLabel2->setVisible(isLength); + GroupOnCurve->PushButton2->setVisible(isLength); + GroupOnCurve->LineEdit2->setVisible(isLength); + GroupOnCurve->TextLabel3->setVisible(isParam || isLength); + GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength); + if (isParam){ + initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision"); + GroupOnCurve->SpinBox_DX->setValue(0.5); + GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER")); + } + else if (isLength){ + initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision"); + GroupOnCurve->SpinBox_DX->setValue(0.0); + GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH")); + } + } + else if (id == GEOM_POINT_SURF) { + GroupOnSurface->TextLabel2->setShown(isParam); + GroupOnSurface->TextLabel3->setShown(isParam); + GroupOnSurface->SpinBox_DX->setShown(isParam); + GroupOnSurface->SpinBox_DY->setShown(isParam); + } + + GroupXYZ->setShown(!isParam && !isLength); + + if (theIsUpdate) + QTimer::singleShot(50, this, SLOT(updateSize())); +} + +//================================================================================= +// function : onBtnPopup() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::onBtnPopup(QAction* a) +{ + globalSelection(); // close local contexts, if any + myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE; + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); +} + +//================================================================================= +// function : updateSize +// purpose : adjust dialog size to minimum +//================================================================================= +void BasicGUI_PointDlg::updateSize() +{ + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); } diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h index 1dfd48618..092a491b7 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.h +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -1,34 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_PointDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #ifndef BASICGUI_POINTDLG_H #define BASICGUI_POINTDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" +#include -class DlgRef_1Sel1Spin; +class DlgRef_2Sel1Spin; class DlgRef_3Spin; class DlgRef_2Sel; class DlgRef_1Sel3Spin; @@ -36,6 +39,9 @@ class DlgRef_1Sel2Spin; class QLineEdit; class QGroupBox; +class QButtonGroup; +class QMenu; +class QAction; class gp_Pnt; @@ -68,17 +74,20 @@ private: double getParameter() const; double getUParameter() const; double getVParameter() const; + void updateParamCoord(bool theIsUpdate); private: - GEOM::GEOM_Object_var myEdge; - GEOM::GEOM_Object_var myFace; - GEOM::GEOM_Object_var myRefPoint; - GEOM::GEOM_Object_var myLine1; - GEOM::GEOM_Object_var myLine2; - + GEOM::GeomObjPtr myEdge; + GEOM::GeomObjPtr myFace; + GEOM::GeomObjPtr myRefPoint; + GEOM::GeomObjPtr myLine1; + GEOM::GeomObjPtr myLine2; + + bool myBusy; + DlgRef_3Spin* GroupXYZ; DlgRef_1Sel3Spin* GroupRefPoint; - DlgRef_1Sel1Spin* GroupOnCurve; + DlgRef_2Sel1Spin* GroupOnCurve; DlgRef_2Sel* GroupLineIntersection; DlgRef_1Sel2Spin* GroupOnSurface; @@ -86,18 +95,29 @@ private: QLineEdit* myX; QLineEdit* myY; QLineEdit* myZ; + + QGroupBox* myParamGroup; + QButtonGroup* myParamCoord; + + QMenu* myBtnPopup; + QMap myActions; + + TopAbs_ShapeEnum myNeedType; private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); void DeactivateActiveDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); void ValueChangedInSpinBox( double ); void SetDoubleSpinBoxStep( double ); + void ClickParamCoord( int ); + void CheckBoxClicked( int ); + void onBtnPopup( QAction* ); + void updateSize(); }; #endif // BASICGUI_POINTDLG_H diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 23a1a8492..847e06c16 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_VectorDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -50,7 +51,7 @@ // TRUE to construct a modal dialog. //================================================================================= BasicGUI_VectorDlg::BasicGUI_VectorDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_VECTOR_2P" ) ) ); @@ -118,17 +119,17 @@ void BasicGUI_VectorDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - myPoint1 = GEOM::GEOM_Object::_nil(); - myPoint2 = GEOM::GEOM_Object::_nil(); + myPoint1.nullify(); + myPoint2.nullify(); /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes */ - initSpinBox( GroupDimensions->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY - initSpinBox( GroupDimensions->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY - initSpinBox( GroupDimensions->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 6 ); // VSR:TODO : DBL_DIGITS_DISPLAY + initSpinBox( GroupDimensions->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( GroupDimensions->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( GroupDimensions->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); double dx( 0. ), dy( 0. ), dz( 200. ); GroupDimensions->SpinBox_DX->setValue( dx ); @@ -149,9 +150,6 @@ void BasicGUI_VectorDlg::Init() connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupDimensions->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupDimensions->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); @@ -161,7 +159,7 @@ void BasicGUI_VectorDlg::Init() connect( GroupDimensions->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( ReverseVector( int ) ) ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr("GEOM_VECTOR") ); @@ -188,8 +186,8 @@ void BasicGUI_VectorDlg::SetDoubleSpinBoxStep( double step ) void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) { disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); - myPoint1 = GEOM::GEOM_Object::_nil(); - myPoint2 = GEOM::GEOM_Object::_nil(); + myPoint1.nullify(); + myPoint2.nullify(); switch ( constructorId ) { case 0: @@ -208,7 +206,7 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); break; } case 1: @@ -230,8 +228,9 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); + SelectionIntoArgument(); - displayPreview(); + displayPreview(true); } @@ -241,6 +240,7 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) //================================================================================= void BasicGUI_VectorDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -270,72 +270,37 @@ bool BasicGUI_VectorDlg::ClickOnApply() void BasicGUI_VectorDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) - myPoint1 = GEOM::GEOM_Object::_nil(); + myPoint1.nullify(); else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myPoint2 = GEOM::GEOM_Object::_nil(); + myPoint2.nullify(); return; } - // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { - QString aName = GEOMBase::GetName(aSelectedObject); - - TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { // Local Selection - int anIndex = aMap(1); - aName += QString(":vertex_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - } - else { // Global Selection - if (aShape.ShapeType() != TopAbs_VERTEX) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } - + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); myEditCurrentArgument->setText(aName); - - if (!aSelectedObject->_is_nil()) { // clear selection if something selected - globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); - } - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1) { myPoint1 = aSelectedObject; - if (!myPoint1->_is_nil() && myPoint2->_is_nil()) - GroupPoints->PushButton2->click(); + if (myPoint1 && !myPoint2) + GroupPoints->PushButton2->click(); } else if (myEditCurrentArgument == GroupPoints->LineEdit2) { myPoint2 = aSelectedObject; - if (!myPoint2->_is_nil() && myPoint1->_is_nil()) - GroupPoints->PushButton1->click(); + if (myPoint2 && !myPoint1) + GroupPoints->PushButton1->click(); } } - displayPreview(); + displayPreview(true); } //================================================================================= @@ -362,21 +327,7 @@ void BasicGUI_VectorDlg::SetEditCurrentArgument() globalSelection(); // close local selection to clear it localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); send->setDown(true); - displayPreview(); -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BasicGUI_VectorDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1; - else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2; - else return; - GEOMBase_Skeleton::LineEditReturnPressed(); + displayPreview(true); } @@ -389,7 +340,7 @@ void BasicGUI_VectorDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - + ConstructorsClicked( getConstructorId() ); } @@ -418,7 +369,7 @@ void BasicGUI_VectorDlg::enterEvent( QEvent* ) //================================================================================= void BasicGUI_VectorDlg::ValueChangedInSpinBox( double newValue ) { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -435,7 +386,7 @@ void BasicGUI_VectorDlg::ReverseVector( int state ) GroupDimensions->SpinBox_DY->setValue( dy ); GroupDimensions->SpinBox_DZ->setValue( dz ); - displayPreview(); + displayPreview(true); } //================================================================================= @@ -453,17 +404,16 @@ GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation() //================================================================================= bool BasicGUI_VectorDlg::isValid( QString& msg ) { + bool ok = false; if(getConstructorId() == 0) - return !myPoint1->_is_nil() && !myPoint2->_is_nil(); + ok = myPoint1 && myPoint2; else if(getConstructorId() == 1) { - bool ok = true; - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; - return ok; + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ); } - return false; + return ok; } //================================================================================= @@ -476,10 +426,12 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() ); + switch ( getConstructorId() ) { case 0 : { - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorTwoPnt( myPoint1, myPoint2 ); + anObj = anOper->MakeVectorTwoPnt( myPoint1.get(), myPoint2.get() ); res = true; break; } @@ -493,10 +445,10 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects ) aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); aParameters << GroupDimensions->SpinBox_DZ->text(); - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx, dy, dz ); + anObj = anOper->MakeVectorDXDYDZ( dx, dy, dz ); if ( !anObj->_is_nil() && !IsPreview() ) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); res = true; break; @@ -515,15 +467,8 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_VectorDlg::addSubshapesToStudy() { - QMap objMap; - - switch ( getConstructorId() ) { - case 0: - objMap[GroupPoints->LineEdit1->text()] = myPoint1; - objMap[GroupPoints->LineEdit2->text()] = myPoint2; - break; - case 1: - return; + if ( getConstructorId() == 0 ) { + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); } - addSubshapesToFather( objMap ); } diff --git a/src/BasicGUI/BasicGUI_VectorDlg.h b/src/BasicGUI/BasicGUI_VectorDlg.h index 747ef534b..0b60c6346 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.h +++ b/src/BasicGUI/BasicGUI_VectorDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_VectorDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BASICGUI_VECTORDLG_H #define BASICGUI_VECTORDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel; class DlgRef_3Spin1Check; @@ -54,8 +56,8 @@ private: void Init(); void enterEvent( QEvent* ); - GEOM::GEOM_Object_var myPoint1; - GEOM::GEOM_Object_var myPoint2; + GEOM::GeomObjPtr myPoint1; + GEOM::GeomObjPtr myPoint2; DlgRef_2Sel* GroupPoints; DlgRef_3Spin1Check* GroupDimensions; @@ -67,7 +69,6 @@ private slots: void ActivateThisDialog(); void DeactivateActiveDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 5fd3838c9..7ea8228af 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_WorkingPlaneDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -59,7 +60,7 @@ // TRUE to construct a modal dialog. //================================================================================= BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); @@ -174,7 +175,7 @@ void BasicGUI_WorkingPlaneDlg::Init() connect( myReverseCB, SIGNAL( clicked() ), this, SLOT( onReverse() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_WPLANE" ) ); @@ -263,6 +264,7 @@ void BasicGUI_WorkingPlaneDlg::GroupClicked( int groupId ) //================================================================================= void BasicGUI_WorkingPlaneDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -322,7 +324,7 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() if ( myEditCurrentArgument == Group1->LineEdit1 ) myFace = aSelectedObject; else if ( myEditCurrentArgument == Group2->LineEdit1 || - myEditCurrentArgument == Group2->LineEdit2 ) { + myEditCurrentArgument == Group2->LineEdit2 ) { if ( aRes && !aSelectedObject->_is_nil() ) { TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { @@ -332,18 +334,18 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() int anIndex = aMap( 1 ); aName = aName + ":edge_" + QString::number( anIndex ); - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - if ( myEditCurrentArgument == Group2->LineEdit1 ) - myVectX = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - else - myVectZ = aShapesOp->GetSubShape( aSelectedObject, anIndex ); + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + if ( myEditCurrentArgument == Group2->LineEdit1 ) + myVectX = aShapesOp->GetSubShape( aSelectedObject, anIndex ); + else + myVectZ = aShapesOp->GetSubShape( aSelectedObject, anIndex ); } else { - if ( aShape.ShapeType() != TopAbs_EDGE ) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + if ( aShape.ShapeType() != TopAbs_EDGE ) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + } } aSelMgr->clearSelected(); } @@ -401,7 +403,7 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); send->setDown(true); - displayPreview(); + displayPreview(true); } @@ -437,7 +439,7 @@ void BasicGUI_WorkingPlaneDlg::ActivateThisDialog( ) { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication( ) ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -476,7 +478,7 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) if ( id == 0 ) { // by planar face selection if ( CORBA::is_nil( myFace ) ) { if ( !showPreview ) - showError( "Face has to be selected" ); + showError( "Face has to be selected" ); return false; } @@ -498,14 +500,14 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) } else { if ( !showPreview ) - showError( "Wrong shape selected (has to be a planar face)" ); + showError( "Wrong shape selected (has to be a planar face)" ); return false; } } else if ( id == 1 ) { // by two vectors (Ox & Oz) if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) { if ( !showPreview ) - showError( "Two vectors have to be selected" ); + showError( "Two vectors have to be selected" ); return false; } @@ -514,9 +516,9 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) gp_Vec aVX, aVZ; if ( !GEOMBase::GetShape( myVectX, aVectX, TopAbs_EDGE ) || - !GEOMBase::GetShape( myVectZ, aVectZ, TopAbs_EDGE ) ) { + !GEOMBase::GetShape( myVectZ, aVectZ, TopAbs_EDGE ) ) { if ( !showPreview ) - showError( "Wrong shape selected (two vectors(edges) have to be selected)" ); + showError( "Wrong shape selected (two vectors(edges) have to be selected)" ); return false; } @@ -525,12 +527,12 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) if ( VX1.IsNull() || VX2.IsNull() ) { if ( !showPreview ) - showError( "Bad OX vector" ); + showError( "Bad OX vector" ); return false; } if ( VZ1.IsNull() || VZ2.IsNull() ) { if ( !showPreview ) - showError( "Bad OZ vector" ); + showError( "Bad OZ vector" ); return false; } @@ -539,12 +541,12 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) if ( aVX.Magnitude() < Precision::Confusion() ) { if ( !showPreview ) - showError( "Bad OX vector" ); + showError( "Bad OX vector" ); return false; } if ( aVZ.Magnitude() < Precision::Confusion() ) { if ( !showPreview ) - showError( "Bad OZ vector" ); + showError( "Bad OZ vector" ); return false; } @@ -553,7 +555,7 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview ) if ( aDirX.IsParallel( aDirZ, Precision::Angular() ) ) { if ( !showPreview ) - showError( "Parallel vectors selected" ); + showError( "Parallel vectors selected" ); return false; } diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h index e125b8c7c..bc43c0151 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_WorkingPlaneDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/BasicGUI/Makefile.am b/src/BasicGUI/Makefile.am index 2d364c18e..8c008f59f 100644 --- a/src/BasicGUI/Makefile.am +++ b/src/BasicGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : BasicGUI @@ -38,8 +36,11 @@ salomeinclude_HEADERS = \ BasicGUI_MarkerDlg.h \ BasicGUI_PlaneDlg.h \ BasicGUI_PointDlg.h \ - BasicGUI_VectorDlg.h \ - BasicGUI_WorkingPlaneDlg.h + BasicGUI_VectorDlg.h \ + BasicGUI_ParamCurveWidget.h +# +# OBSOLETE: BasicGUI_WorkingPlaneDlg.h +# # Libraries targets @@ -55,9 +56,12 @@ dist_libBasicGUI_la_SOURCES = \ BasicGUI_ArcDlg.cxx \ BasicGUI_VectorDlg.cxx \ BasicGUI_PlaneDlg.cxx \ - BasicGUI_WorkingPlaneDlg.cxx \ BasicGUI_CurveDlg.cxx \ - BasicGUI_MarkerDlg.cxx + BasicGUI_MarkerDlg.cxx \ + BasicGUI_ParamCurveWidget.cxx +# +# OBSOLETE: BasicGUI_WorkingPlaneDlg.cxx +# MOC_FILES = \ BasicGUI_PointDlg_moc.cxx \ @@ -67,9 +71,12 @@ MOC_FILES = \ BasicGUI_ArcDlg_moc.cxx \ BasicGUI_VectorDlg_moc.cxx \ BasicGUI_PlaneDlg_moc.cxx \ - BasicGUI_WorkingPlaneDlg_moc.cxx \ BasicGUI_CurveDlg_moc.cxx \ - BasicGUI_MarkerDlg_moc.cxx + BasicGUI_MarkerDlg_moc.cxx \ + BasicGUI_ParamCurveWidget_moc.cxx +# +# OBSOLETE: BasicGUI_WorkingPlaneDlg_moc.cxx +# nodist_libBasicGUI_la_SOURCES = \ $(MOC_FILES) @@ -86,6 +93,7 @@ libBasicGUI_la_CPPFLAGS = \ $(GUI_CXXFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ + $(OPENCV_INCLUDES) \ -I$(srcdir)/../OBJECT \ -I$(srcdir)/../DlgRef \ -I$(srcdir)/../GEOMGUI \ @@ -94,12 +102,13 @@ libBasicGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMClient \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libBasicGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ ../GEOMBase/libGEOMBase.la \ ../GEOMGUI/libGEOM.la \ - $(GUI_LDFLAGS) -lsuit + $(CAS_LDFLAGS) -lTKGeomBase \ + $(GUI_LDFLAGS) -lsuit \ + $(OPENCV_LIBS) diff --git a/src/BlocksGUI/BlocksGUI.cxx b/src/BlocksGUI/BlocksGUI.cxx index 547510dc8..0722f01f5 100644 --- a/src/BlocksGUI/BlocksGUI.cxx +++ b/src/BlocksGUI/BlocksGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BooleanGUI.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -32,6 +33,7 @@ #include "BlocksGUI_PropagateDlg.h" #include +#include "GeometryGUI_Operations.h" #include #include @@ -66,11 +68,11 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = 0; switch ( theCommandID ) { - case 9999: aDlg = new BlocksGUI_BlockDlg ( getGeometryGUI(), parent ); break; - case 9998: aDlg = new BlocksGUI_TrsfDlg ( getGeometryGUI(), parent ); break; - case 9997: aDlg = new BlocksGUI_QuadFaceDlg ( getGeometryGUI(), parent ); break; - case 9995: aDlg = new BlocksGUI_ExplodeDlg ( getGeometryGUI(), parent ); break; - case 99991: aDlg = new BlocksGUI_PropagateDlg( getGeometryGUI(), parent ); break; + case GEOMOp::OpHexaSolid: aDlg = new BlocksGUI_BlockDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpMultiTransform: aDlg = new BlocksGUI_TrsfDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpQuadFace: aDlg = new BlocksGUI_QuadFaceDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpExplodeBlock: aDlg = new BlocksGUI_ExplodeDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpPropagate: aDlg = new BlocksGUI_PropagateDlg( getGeometryGUI(), parent ); break; default: getGeometryGUI()->getApp()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; diff --git a/src/BlocksGUI/BlocksGUI.h b/src/BlocksGUI/BlocksGUI.h index b9d48fb0e..200268590 100644 --- a/src/BlocksGUI/BlocksGUI.h +++ b/src/BlocksGUI/BlocksGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx index 5ebb5f4ce..8c74aa391 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_BlockDlg.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -159,8 +160,12 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId) myConstructorId = constructorId; // init fields - myFace1 = myFace2 = GEOM::GEOM_Object::_nil(); - myFace3 = myFace4 = myFace5 = myFace6 = myFace1; + myFace1.nullify(); + myFace2.nullify(); + myFace3.nullify(); + myFace4.nullify(); + myFace5.nullify(); + myFace6.nullify(); switch (constructorId) { case 0: @@ -203,6 +208,7 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId) //================================================================================= void BlocksGUI_BlockDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -227,108 +233,82 @@ bool BlocksGUI_BlockDlg::ClickOnApply() void BlocksGUI_BlockDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == Group2F->LineEdit1) myFace1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group2F->LineEdit2) myFace2 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit1) myFace1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit2) myFace2 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit3) myFace3 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit4) myFace4 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit5) myFace5 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group6F->LineEdit6) myFace6 = GEOM::GEOM_Object::_nil(); - return; - } - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - // Get Selected object if selected subshape + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_FACE ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) // Local Selection - { - int anIndex = aMap(1); - aName += QString(":face_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == Group2F->LineEdit1 ) { + myFace1 = aSelectedObject; + if (!myFace2) Group2F->PushButton2->click(); } - else // Global Selection - { - if (aShape.ShapeType() != TopAbs_FACE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if ( myEditCurrentArgument == Group2F->LineEdit2 ) { + myFace2 = aSelectedObject; + if (!myFace1) Group2F->PushButton1->click(); + } + else if ( myEditCurrentArgument == Group6F->LineEdit1 ) { + myFace1 = aSelectedObject; + if (!myFace2) Group6F->PushButton2->click(); + else if (!myFace3) Group6F->PushButton3->click(); + else if (!myFace4) Group6F->PushButton4->click(); + else if (!myFace5) Group6F->PushButton5->click(); + else if (!myFace6) Group6F->PushButton6->click(); + } + else if ( myEditCurrentArgument == Group6F->LineEdit2 ) { + myFace2 = aSelectedObject; + if (!myFace3) Group6F->PushButton3->click(); + else if (!myFace4) Group6F->PushButton4->click(); + else if (!myFace5) Group6F->PushButton5->click(); + else if (!myFace6) Group6F->PushButton6->click(); + else if (!myFace1) Group6F->PushButton1->click(); + } + else if ( myEditCurrentArgument == Group6F->LineEdit3 ) { + myFace3 = aSelectedObject; + if (!myFace4) Group6F->PushButton4->click(); + else if (!myFace5) Group6F->PushButton5->click(); + else if (!myFace6) Group6F->PushButton6->click(); + else if (!myFace1) Group6F->PushButton1->click(); + else if (!myFace2) Group6F->PushButton2->click(); + } + else if ( myEditCurrentArgument == Group6F->LineEdit4 ) { + myFace4 = aSelectedObject; + if (!myFace5) Group6F->PushButton5->click(); + else if (!myFace6) Group6F->PushButton6->click(); + else if (!myFace1) Group6F->PushButton1->click(); + else if (!myFace2) Group6F->PushButton2->click(); + else if (!myFace3) Group6F->PushButton3->click(); + } + else if ( myEditCurrentArgument == Group6F->LineEdit5 ) { + myFace5 = aSelectedObject; + if (!myFace6) Group6F->PushButton6->click(); + else if (!myFace1) Group6F->PushButton1->click(); + else if (!myFace2) Group6F->PushButton2->click(); + else if (!myFace3) Group6F->PushButton3->click(); + else if (!myFace4) Group6F->PushButton4->click(); + } + else if ( myEditCurrentArgument == Group6F->LineEdit6 ) { + myFace6 = aSelectedObject; + if (!myFace1) Group6F->PushButton1->click(); + else if (!myFace2) Group6F->PushButton2->click(); + else if (!myFace3) Group6F->PushButton3->click(); + else if (!myFace4) Group6F->PushButton4->click(); + else if (!myFace5) Group6F->PushButton5->click(); } } - - myEditCurrentArgument->setText(aName); - - if (myEditCurrentArgument == Group2F->LineEdit1) { - myFace1 = aSelectedObject; - if (!myFace1->_is_nil() && myFace2->_is_nil()) - Group2F->PushButton2->click(); - } - else if (myEditCurrentArgument == Group2F->LineEdit2) { - myFace2 = aSelectedObject; - if (!myFace2->_is_nil() && myFace1->_is_nil()) - Group2F->PushButton1->click(); - } - else if (myEditCurrentArgument == Group6F->LineEdit1) { - myFace1 = aSelectedObject; - if (!myFace1->_is_nil() && myFace2->_is_nil()) - Group6F->PushButton2->click(); - } - else if (myEditCurrentArgument == Group6F->LineEdit2) { - myFace2 = aSelectedObject; - if (!myFace2->_is_nil() && myFace3->_is_nil()) - Group6F->PushButton3->click(); - } - else if (myEditCurrentArgument == Group6F->LineEdit3) { - myFace3 = aSelectedObject; - if (!myFace3->_is_nil() && myFace4->_is_nil()) - Group6F->PushButton4->click(); - } - else if (myEditCurrentArgument == Group6F->LineEdit4) { - myFace4 = aSelectedObject; - if (!myFace4->_is_nil() && myFace5->_is_nil()) - Group6F->PushButton5->click(); - } - else if (myEditCurrentArgument == Group6F->LineEdit5) { - myFace5 = aSelectedObject; - if (!myFace5->_is_nil() && myFace6->_is_nil()) - Group6F->PushButton6->click(); - } - else if (myEditCurrentArgument == Group6F->LineEdit6) { - myFace6 = aSelectedObject; - if (!myFace6->_is_nil() && myFace1->_is_nil()) - Group6F->PushButton1->click(); + else { + if (myEditCurrentArgument == Group2F->LineEdit1) myFace1.nullify(); + else if (myEditCurrentArgument == Group2F->LineEdit2) myFace2.nullify(); + else if (myEditCurrentArgument == Group6F->LineEdit1) myFace1.nullify(); + else if (myEditCurrentArgument == Group6F->LineEdit2) myFace2.nullify(); + else if (myEditCurrentArgument == Group6F->LineEdit3) myFace3.nullify(); + else if (myEditCurrentArgument == Group6F->LineEdit4) myFace4.nullify(); + else if (myEditCurrentArgument == Group6F->LineEdit5) myFace5.nullify(); + else if (myEditCurrentArgument == Group6F->LineEdit6) myFace6.nullify(); + myEditCurrentArgument->setText( "" ); } - displayPreview(); + displayPreview(true); } //================================================================================= @@ -423,7 +403,7 @@ void BlocksGUI_BlockDlg::ActivateThisDialog() localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); //Select Faces on All Shapes connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - displayPreview(); + displayPreview(true); } //================================================================================= @@ -449,17 +429,15 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool BlocksGUI_BlockDlg::isValid (QString&) +bool BlocksGUI_BlockDlg::isValid(QString&) { bool ok = false; switch (getConstructorId()) { case 0: - ok = !(myFace1->_is_nil() || myFace2->_is_nil()); + ok = myFace1 && myFace2; break; case 1: - ok = !(myFace1->_is_nil() || myFace2->_is_nil() || - myFace3->_is_nil() || myFace4->_is_nil() || - myFace5->_is_nil() || myFace6->_is_nil()); + ok = myFace1 && myFace2 && myFace3 && myFace4 && myFace5 && myFace6; break; default: break; @@ -477,20 +455,18 @@ bool BlocksGUI_BlockDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2)) { - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeHexa2Faces(myFace1, myFace2); + if ( myFace1 && myFace2 ) { + anObj = anOper->MakeHexa2Faces(myFace1.get(), myFace2.get()); res = true; } break; case 1: - if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2) && - !CORBA::is_nil(myFace3) && !CORBA::is_nil(myFace4) && - !CORBA::is_nil(myFace5) && !CORBA::is_nil(myFace6)) { - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeHexa(myFace1, myFace2, myFace3, myFace4, myFace5, myFace6); + if ( myFace1 && myFace2 && myFace3 && myFace4 && myFace5 && myFace6 ) { + anObj = anOper->MakeHexa(myFace1.get(), myFace2.get(), myFace3.get(), myFace4.get(), myFace5.get(), myFace6.get()); res = true; } break; @@ -508,21 +484,20 @@ bool BlocksGUI_BlockDlg::execute (ObjectList& objects) //================================================================================= void BlocksGUI_BlockDlg::addSubshapesToStudy() { - QMap objMap; - switch (getConstructorId()) { case 0: - objMap[Group2F->LineEdit1->text()] = myFace1; - objMap[Group2F->LineEdit2->text()] = myFace2; + GEOMBase::PublishSubObject( myFace1.get() ); + GEOMBase::PublishSubObject( myFace2.get() ); break; case 1: - objMap[Group6F->LineEdit1->text()] = myFace1; - objMap[Group6F->LineEdit2->text()] = myFace2; - objMap[Group6F->LineEdit3->text()] = myFace3; - objMap[Group6F->LineEdit4->text()] = myFace4; - objMap[Group6F->LineEdit5->text()] = myFace5; - objMap[Group6F->LineEdit6->text()] = myFace6; + GEOMBase::PublishSubObject( myFace1.get() ); + GEOMBase::PublishSubObject( myFace2.get() ); + GEOMBase::PublishSubObject( myFace3.get() ); + GEOMBase::PublishSubObject( myFace4.get() ); + GEOMBase::PublishSubObject( myFace5.get() ); + GEOMBase::PublishSubObject( myFace6.get() ); + break; + default: break; } - addSubshapesToFather(objMap); } diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.h b/src/BlocksGUI/BlocksGUI_BlockDlg.h index 23e372ba6..035894f28 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.h +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_BlockDlg.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -26,7 +27,8 @@ #ifndef BLOCKSGUI_BLOCKDLG_H #define BLOCKSGUI_BLOCKDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel; class DlgRef_6Sel; @@ -57,8 +59,8 @@ private: private: int myConstructorId; - GEOM::GEOM_Object_var myFace1, myFace2; - GEOM::GEOM_Object_var myFace3, myFace4, myFace5, myFace6; + GEOM::GeomObjPtr myFace1, myFace2; + GEOM::GeomObjPtr myFace3, myFace4, myFace5, myFace6; // to initialize the first selection field with a selected object on the dialog creation bool myInitial; diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx index 8dcbdbbeb..a03687eab 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_ExplodeDlg.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -121,7 +122,7 @@ void BlocksGUI_ExplodeDlg::Init() connect( myGrp1->CheckBox1, SIGNAL( stateChanged( int ) ), this, SLOT( SubShapeToggled() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); myConstructorId = -1; ConstructorsClicked( 0 ); @@ -162,6 +163,7 @@ void BlocksGUI_ExplodeDlg::ConstructorsClicked( int constructorId ) //================================================================================= void BlocksGUI_ExplodeDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -174,15 +176,15 @@ bool BlocksGUI_ExplodeDlg::ClickOnApply() { SUIT_Session::session()->activeApplication()->putInfo( tr( "" ) ); - // Explode all sub shapes + // Explode all sub-shapes if ( isAllSubShapes() ) { - // More than 30 subshapes : ask confirmation + // More than 30 sub-shapes : ask confirmation if ( myNbBlocks > 30 ) { if ( SUIT_MessageBox::warning( this, - tr( "GEOM_CONFIRM" ), - tr( "GEOM_CONFIRM_INFO" ).arg( myNbBlocks ), - tr( "GEOM_BUT_EXPLODE" ), - tr( "GEOM_BUT_CANCEL" ) ) != 0 ) + tr( "GEOM_CONFIRM" ), + tr( "GEOM_CONFIRM_INFO" ).arg( myNbBlocks ), + tr( "GEOM_BUT_EXPLODE" ), + tr( "GEOM_BUT_CANCEL" ) ) != 0 ) return false; /* aborted */ } } @@ -212,10 +214,9 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { + if ( GEOMBase::IsShape(anObj) ) { myObject = anObj; myGrp1->LineEdit1->setText(GEOMBase::GetName(anObj)); } @@ -249,7 +250,7 @@ void BlocksGUI_ExplodeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); } @@ -278,7 +279,7 @@ void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox() //================================================================================= // function : SubShapeToggled() -// purpose : Allow user selection of all or only selected sub shapes +// purpose : Allow user selection of all or only selected sub-shapes // : Called when 'myGrp1->CheckBox1' state change //================================================================================= void BlocksGUI_ExplodeDlg::SubShapeToggled() @@ -297,16 +298,16 @@ void BlocksGUI_ExplodeDlg::activateSelection() if ( isAllSubShapes() ) { // Sub-shapes selection disabled disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection( GEOM_ALLSHAPES ); if ( myObject->_is_nil() ) { SelectionIntoArgument(); } connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } else { - displayPreview( true, true, false ); + displayPreview( true, true, true, false ); globalSelection( GEOM_PREVIEW ); } } @@ -332,11 +333,11 @@ void BlocksGUI_ExplodeDlg::updateButtonState() myGrp1->TextBrowser1->setText( "" ); } else { - bool isOnlyBlocks = GEOM::GEOM_IBlocksOperations::_narrow - ( getOperation() )->IsCompoundOfBlocks( myObject, - myGrp1->SpinBox1->value(), - myGrp1->SpinBox2->value(), - myNbBlocks ); + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation()); + bool isOnlyBlocks = anOper->IsCompoundOfBlocks( myObject, + myGrp1->SpinBox1->value(), + myGrp1->SpinBox2->value(), + myNbBlocks ); if ( isOnlyBlocks ) myGrp1->TextBrowser1->setText( tr( "GEOM_NB_BLOCKS_NO_OTHERS" ).arg( myNbBlocks ) ); else @@ -401,12 +402,13 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects ) { GEOM::ListOfGO_var aList; + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation()); + switch ( getConstructorId() ) { case 0: - aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->ExplodeCompoundOfBlocks - ( myObject, - myGrp1->SpinBox1->value(), - myGrp1->SpinBox2->value() ); + aList = anOper->ExplodeCompoundOfBlocks( myObject, + myGrp1->SpinBox1->value(), + myGrp1->SpinBox2->value() ); break; } @@ -451,8 +453,8 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects ) CORBA::String_var objStr = myGeomGUI->getApp()->orb()->object_to_string( *anIter ); if ( selected.contains( QString( objStr.in() ) ) ) { - if ( !IsPreview() ) - (*anIter)->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + if ( !IsPreview() ) + (*anIter)->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back( *anIter ); } else @@ -472,7 +474,7 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aList[i] ); if ( !IsPreview() ) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back( anObj._retn() ); } } diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.h b/src/BlocksGUI/BlocksGUI_ExplodeDlg.h index 63b616a4d..6be87bef4 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.h +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_ExplodeDlg.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx index 07801d8a1..6b07b7afb 100644 --- a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_PropagateDlg.cxx // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) @@ -116,6 +117,7 @@ void BlocksGUI_PropagateDlg::Init() //================================================================================= void BlocksGUI_PropagateDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -155,9 +157,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument() if (aSelList.Extent() == 1) { Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( aRes ) + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( !CORBA::is_nil( myObject ) ) myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) ); } } @@ -239,7 +240,8 @@ bool BlocksGUI_PropagateDlg::isValid( QString& ) //================================================================================= bool BlocksGUI_PropagateDlg::execute( ObjectList& objects ) { - GEOM::ListOfGO_var aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->Propagate( myObject ); + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation()); + GEOM::ListOfGO_var aList = anOper->Propagate( myObject ); mainFrame()->ResultName->setText( "" ); if ( !aList->length() ) @@ -259,6 +261,8 @@ bool BlocksGUI_PropagateDlg::execute( ObjectList& objects ) void BlocksGUI_PropagateDlg::activateSelection() { TColStd_MapOfInteger aMap; + aMap.Add( GEOM_FACE ); + aMap.Add( GEOM_SHELL ); aMap.Add( GEOM_SOLID ); aMap.Add( GEOM_COMPOUND ); globalSelection( aMap ); @@ -266,7 +270,7 @@ void BlocksGUI_PropagateDlg::activateSelection() SelectionIntoArgument(); } connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } //================================================================ diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.h b/src/BlocksGUI/BlocksGUI_PropagateDlg.h index a4eaf5a83..72d9cd64a 100644 --- a/src/BlocksGUI/BlocksGUI_PropagateDlg.h +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_PropagateDlg.h // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx index 930af1c45..e78e01111 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_QuadFaceDlg.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -145,8 +146,10 @@ void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId) myConstructorId = constructorId; // init fields - myShape1 = myShape2 = GEOM::GEOM_Object::_nil(); - myShape3 = myShape4 = myShape1; + myShape1.nullify(); + myShape2.nullify(); + myShape3.nullify(); + myShape4.nullify(); // clear line edits QMap::iterator anIterLE; @@ -190,6 +193,7 @@ void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId) //================================================================================= void BlocksGUI_QuadFaceDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -225,123 +229,107 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument() } } - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - TopAbs_ShapeEnum aType = TopAbs_EDGE; if (aCurrFocus == Vertex1 || aCurrFocus == Vertex2 || aCurrFocus == Vertex3 || aCurrFocus == Vertex4) aType = TopAbs_VERTEX; - QString aName; - GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil(); - - if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - if (aResult && !anObj->_is_nil()) { - aName = GEOMBase::GetName(anObj); - - // Get Selected object if selected subshape - TopoDS_Shape aShape; - if (GEOMBase::GetShape(anObj, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) // Local Selection - { - int anIndex = aMap(1); - if (aType == TopAbs_VERTEX) - aName += QString(":vertex_%1").arg(anIndex); - else - aName += QString(":edge_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(anObj, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - anObj = aShapesOp->GetSubShape(anObj, anIndex); - } - else - anObj = aFindedObject; // get Object from study - } - else // Global Selection - { - if (aShape.ShapeType() != aType) { - anObj = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } + GEOM::GeomObjPtr aSelectedObject = getSelected( aType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + switch (aCurrFocus) { + // four vertices + case Vertex1: + myShape1 = aSelectedObject; + if (!myShape2) mySelBtn[Vertex2]->click(); + else if (!myShape3) mySelBtn[Vertex3]->click(); + else if (!myShape4) mySelBtn[Vertex4]->click(); + break; + case Vertex2: + myShape2 = aSelectedObject; + if (!myShape3) mySelBtn[Vertex3]->click(); + else if (!myShape4) mySelBtn[Vertex4]->click(); + else if (!myShape1) mySelBtn[Vertex1]->click(); + break; + case Vertex3: + myShape3 = aSelectedObject; + if (!myShape4) mySelBtn[Vertex4]->click(); + else if (!myShape1) mySelBtn[Vertex1]->click(); + else if (!myShape2) mySelBtn[Vertex2]->click(); + break; + case Vertex4: + myShape4 = aSelectedObject; + if (!myShape1) mySelBtn[Vertex1]->click(); + else if (!myShape2) mySelBtn[Vertex2]->click(); + else if (!myShape3) mySelBtn[Vertex3]->click(); + break; + // two edges + case Edge12: + myShape1 = aSelectedObject; + if (!myShape2) mySelBtn[Edge22]->click(); + break; + case Edge22: + myShape2 = aSelectedObject; + if (!myShape1) mySelBtn[Edge12]->click(); + break; + // four edges + case Edge14: + myShape1 = aSelectedObject; + if (!myShape2) mySelBtn[Edge24]->click(); + else if (!myShape3) mySelBtn[Edge34]->click(); + else if (!myShape4) mySelBtn[Edge44]->click(); + break; + case Edge24: + myShape2 = aSelectedObject; + if (!myShape3) mySelBtn[Edge34]->click(); + else if (!myShape4) mySelBtn[Edge44]->click(); + else if (!myShape1) mySelBtn[Edge14]->click(); + break; + case Edge34: + myShape3 = aSelectedObject; + if (!myShape4) mySelBtn[Edge44]->click(); + else if (!myShape1) mySelBtn[Edge14]->click(); + else if (!myShape2) mySelBtn[Edge24]->click(); + break; + case Edge44: + myShape4 = aSelectedObject; + if (!myShape1) mySelBtn[Edge14]->click(); + else if (!myShape2) mySelBtn[Edge24]->click(); + else if (!myShape3) mySelBtn[Edge34]->click(); + break; + default: + break; } } - - myEditCurrentArgument->setText(aName); - - switch (aCurrFocus) { - // four vertices - case Vertex1: - myShape1 = anObj; - if (!myShape1->_is_nil() && myShape2->_is_nil()) - mySelBtn[Vertex2]->click(); - break; - case Vertex2: - myShape2 = anObj; - if (!myShape2->_is_nil() && myShape3->_is_nil()) - mySelBtn[Vertex3]->click(); - break; - case Vertex3: - myShape3 = anObj; - if (!myShape3->_is_nil() && myShape4->_is_nil()) - mySelBtn[Vertex4]->click(); - break; - case Vertex4: - myShape4 = anObj; - if (!myShape4->_is_nil() && myShape1->_is_nil()) - mySelBtn[Vertex1]->click(); - break; - - // two edges - case Edge12: - myShape1 = anObj; - if (!myShape1->_is_nil() && myShape2->_is_nil()) - mySelBtn[Edge22]->click(); - break; - case Edge22: - myShape2 = anObj; - if (!myShape2->_is_nil() && myShape1->_is_nil()) - mySelBtn[Edge12]->click(); - break; - - // four edges - case Edge14: - myShape1 = anObj; - if (!myShape1->_is_nil() && myShape2->_is_nil()) - mySelBtn[Edge24]->click(); - break; - case Edge24: - myShape2 = anObj; - if (!myShape2->_is_nil() && myShape3->_is_nil()) - mySelBtn[Edge34]->click(); - break; - case Edge34: - myShape3 = anObj; - if (!myShape3->_is_nil() && myShape4->_is_nil()) - mySelBtn[Edge44]->click(); - break; - case Edge44: - myShape4 = anObj; - if (!myShape4->_is_nil() && myShape1->_is_nil()) - mySelBtn[Edge14]->click(); - break; - - default: - break; + else { + switch (aCurrFocus) { + case Vertex1: + case Edge12: + case Edge14: + myShape1.nullify(); + break; + case Vertex2: + case Edge22: + case Edge24: + myShape2.nullify(); + break; + case Vertex3: + case Edge34: + myShape3.nullify(); + break; + case Vertex4: + case Edge44: + myShape4.nullify(); + break; + default: + break; + } + myEditCurrentArgument->setText( "" ); } - displayPreview(); + displayPreview(true); } //================================================================================= @@ -424,7 +412,7 @@ void BlocksGUI_QuadFaceDlg::ActivateThisDialog() activateSelection(); // ?? - displayPreview(); + displayPreview(true); } //================================================================================= @@ -506,15 +494,13 @@ bool BlocksGUI_QuadFaceDlg::isValid (QString&) bool ok = false; switch (getConstructorId()) { case 0: - ok = (!myShape1->_is_nil() && !myShape2->_is_nil() && - !myShape3->_is_nil() && !myShape4->_is_nil()); + ok = myShape1 && myShape2 && myShape3 && myShape4; break; case 1: - ok = (!myShape1->_is_nil() && !myShape2->_is_nil()); + ok = myShape1 && myShape2; break; case 2: - ok = (!myShape1->_is_nil() && !myShape2->_is_nil() && - !myShape3->_is_nil() && !myShape4->_is_nil()); + ok = myShape1 && myShape2 && myShape3 && myShape4; break; default: break; @@ -532,20 +518,19 @@ bool BlocksGUI_QuadFaceDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeQuad4Vertices(myShape1, myShape2, myShape3, myShape4); + anObj = anOper->MakeQuad4Vertices(myShape1.get(), myShape2.get(), myShape3.get(), myShape4.get()); res = true; break; case 1: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeQuad2Edges(myShape1, myShape2); + anObj = anOper->MakeQuad2Edges(myShape1.get(), myShape2.get()); res = true; break; case 2: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeQuad(myShape1, myShape2, myShape3, myShape4); + anObj = anOper->MakeQuad(myShape1.get(), myShape2.get(), myShape3.get(), myShape4.get()); res = true; break; default: @@ -564,25 +549,24 @@ bool BlocksGUI_QuadFaceDlg::execute (ObjectList& objects) //================================================================================= void BlocksGUI_QuadFaceDlg::addSubshapesToStudy() { - QMap objMap; - switch (getConstructorId()) { case 0: - objMap[mySelName[Vertex1]->text()] = myShape1; - objMap[mySelName[Vertex2]->text()] = myShape2; - objMap[mySelName[Vertex3]->text()] = myShape3; - objMap[mySelName[Vertex4]->text()] = myShape4; + GEOMBase::PublishSubObject( myShape1.get() ); + GEOMBase::PublishSubObject( myShape2.get() ); + GEOMBase::PublishSubObject( myShape3.get() ); + GEOMBase::PublishSubObject( myShape4.get() ); break; case 1: - objMap[mySelName[Edge12]->text()] = myShape1; - objMap[mySelName[Edge22]->text()] = myShape2; + GEOMBase::PublishSubObject( myShape1.get() ); + GEOMBase::PublishSubObject( myShape2.get() ); break; case 2: - objMap[mySelName[Edge14]->text()] = myShape1; - objMap[mySelName[Edge24]->text()] = myShape2; - objMap[mySelName[Edge34]->text()] = myShape3; - objMap[mySelName[Edge44]->text()] = myShape4; + GEOMBase::PublishSubObject( myShape1.get() ); + GEOMBase::PublishSubObject( myShape2.get() ); + GEOMBase::PublishSubObject( myShape3.get() ); + GEOMBase::PublishSubObject( myShape4.get() ); + break; + default: break; } - addSubshapesToFather(objMap); } diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h index 1d55983f3..0375551df 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_QuadFaceDlg.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -26,7 +27,8 @@ #ifndef BLOCKSGUI_QUADFACEDLG_H #define BLOCKSGUI_QUADFACEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" #include @@ -68,10 +70,10 @@ private: private: int myConstructorId; - GEOM::GEOM_Object_var myShape1; - GEOM::GEOM_Object_var myShape2; - GEOM::GEOM_Object_var myShape3; - GEOM::GEOM_Object_var myShape4; + GEOM::GeomObjPtr myShape1; + GEOM::GeomObjPtr myShape2; + GEOM::GeomObjPtr myShape3; + GEOM::GeomObjPtr myShape4; // to initialize the first selection field with a selected object on the dialog creation bool myInitial; diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx index 9e5e91a97..9ba4e363d 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_TrsfDlg.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -111,13 +112,14 @@ BlocksGUI_TrsfDlg::~BlocksGUI_TrsfDlg() void BlocksGUI_TrsfDlg::Init() { // Set range of spinboxes - double SpecificStep = 1.0; - QMap::iterator anIter; + int SpecificStep = 1; + QMap::iterator anIter; for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) { - //anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); - initSpinBox(anIter.value(), 1.0, 999, SpecificStep, 3); + initSpinBox(anIter.value(), 1, 999, SpecificStep); } + showOnlyPreviewControl(); + // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -128,7 +130,7 @@ void BlocksGUI_TrsfDlg::Init() for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn) connect(anIterBtn.value(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - QMap::iterator anIterSpin; + QMap::iterator anIterSpin; for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin) connect(anIterSpin.value(), SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); @@ -166,16 +168,13 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId) myGrp2->hide(); myGrp1->show(); mySpinBox[SpinBox1]->setValue(2); - mySpinBox[SpinBox1]->setDecimals(0); mySelBtn[MainObj1]->click(); break; case 1: myGrp1->hide(); myGrp2->show(); mySpinBox[SpinBox2U]->setValue(2); - mySpinBox[SpinBox2U]->setDecimals(0); mySpinBox[SpinBox2V]->setValue(2); - mySpinBox[SpinBox2V]->setDecimals(0); mySelBtn[MainObj2]->click(); break; default: @@ -196,6 +195,7 @@ void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId) //================================================================================= void BlocksGUI_TrsfDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -243,10 +243,9 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() { // If selection of main object is activated if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { + if ( GEOMBase::IsShape(anObj) ) { aName = GEOMBase::GetName(anObj); } } @@ -260,9 +259,8 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() // If face selection is activated int anIndex = -1; if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { + anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( GEOMBase::IsShape(anObj) ) { aName = GEOMBase::GetName(anObj); TColStd_IndexedMapOfInteger anIndexes; aSelMgr->GetIndexes(aSelList.First(), anIndexes); @@ -275,7 +273,7 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() } myEditCurrentArgument->setText(aName); myFaces[aCurrFocus] = anIndex; - displayPreview(); + processPreview(); } switch (aCurrFocus) { @@ -393,7 +391,7 @@ void BlocksGUI_TrsfDlg::ActivateThisDialog() activateSelection(); // ?? - displayPreview(); + processPreview(); } //================================================================================= @@ -412,7 +410,7 @@ void BlocksGUI_TrsfDlg::enterEvent (QEvent*) //================================================================================= void BlocksGUI_TrsfDlg::ValueChangedInSpinBox(int) { - displayPreview(); + processPreview(); } //================================================================================= @@ -453,7 +451,7 @@ void BlocksGUI_TrsfDlg::createSpinWg (const QString& theLbl, const int theId) { QLabel* lab = new QLabel(theLbl, theParent); - mySpinBox[theId] = new SalomeApp_DoubleSpinBox(theParent); + mySpinBox[theId] = new SalomeApp_IntSpinBox(theParent); QGridLayout* l = 0; if (!theParent->layout()) { l = new QGridLayout(theParent); @@ -579,28 +577,28 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeMultiTransformation1D(myShape, - myFaces[Face1], myFaces[Face2], - mySpinBox[SpinBox1]->value()); + anObj = anOper->MakeMultiTransformation1D(myShape, + myFaces[Face1], myFaces[Face2], + mySpinBox[SpinBox1]->value()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << "" << ""; aParameters << mySpinBox[SpinBox1]->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; case 1: - anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> - MakeMultiTransformation2D (myShape, - myFaces[Face1U], myFaces[Face2U], - mySpinBox[SpinBox2U]->value(), - myFaces[Face1V], myFaces[Face2V], - mySpinBox[SpinBox2V]->value()); + anObj = anOper->MakeMultiTransformation2D (myShape, + myFaces[Face1U], myFaces[Face2U], + mySpinBox[SpinBox2U]->value(), + myFaces[Face1V], myFaces[Face2V], + mySpinBox[SpinBox2V]->value()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; @@ -608,7 +606,7 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects) aParameters << mySpinBox[SpinBox2U]->text(); aParameters << "" << ""; aParameters << mySpinBox[SpinBox2V]->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.h b/src/BlocksGUI/BlocksGUI_TrsfDlg.h index a0f823f14..605b2a07e 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.h +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BlocksGUI_TrsfDlg.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -30,7 +31,7 @@ #include -class SalomeApp_DoubleSpinBox; +class SalomeApp_IntSpinBox; class QGroupBox; class QPushButton; class QLineEdit; @@ -79,7 +80,7 @@ private: QMap mySelBtn; QMap mySelName; - QMap mySpinBox; + QMap mySpinBox; private slots: void ClickOnOk(); diff --git a/src/BlocksGUI/Makefile.am b/src/BlocksGUI/Makefile.am index 7ad9706cc..864a6c8b9 100644 --- a/src/BlocksGUI/Makefile.am +++ b/src/BlocksGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM BUILDGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -77,8 +75,7 @@ libBlocksGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libBlocksGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ diff --git a/src/BooleanGUI/BooleanGUI.cxx b/src/BooleanGUI/BooleanGUI.cxx index 4284340e3..5db2a56a9 100644 --- a/src/BooleanGUI/BooleanGUI.cxx +++ b/src/BooleanGUI/BooleanGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BooleanGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -27,6 +28,7 @@ #include "BooleanGUI_Dialog.h" #include +#include "GeometryGUI_Operations.h" #include //======================================================================= @@ -55,18 +57,20 @@ bool BooleanGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { getGeometryGUI()->EmitSignalDeactivateDialog(); - int anOperation = 0; - if ( theCommandID == 5011 ) - anOperation = FUSE; - else if ( theCommandID == 5012 ) - anOperation = COMMON; - else if ( theCommandID == 5013 ) - anOperation = CUT; - else if ( theCommandID == 5014 ) - anOperation = SECTION; - else + int anOperation = 0; + switch ( theCommandID ) { + case GEOMOp::OpFuse: + anOperation = FUSE; break; + case GEOMOp::OpCommon: + anOperation = COMMON; break; + case GEOMOp::OpCut: + anOperation = CUT; break; + case GEOMOp::OpSection: + anOperation = SECTION; break; + default: return false; - + } + QDialog* aDlg = new BooleanGUI_Dialog( anOperation, getGeometryGUI(), parent ); aDlg->show(); diff --git a/src/BooleanGUI/BooleanGUI.h b/src/BooleanGUI/BooleanGUI.h index d4868c358..4bd9f53bf 100644 --- a/src/BooleanGUI/BooleanGUI.h +++ b/src/BooleanGUI/BooleanGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BooleanGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/BooleanGUI/BooleanGUI.pro b/src/BooleanGUI/BooleanGUI.pro deleted file mode 100644 index 8e4baf4a1..000000000 --- a/src/BooleanGUI/BooleanGUI.pro +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = BuildGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../GEOMGUI ../DlgRef ../GEOMBase ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMFiltersSelection $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMBase - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += BOOLEANGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -SOURCES = BooleanGUI.cxx -SOURCES += BooleanGUI_Dialog.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 85e1f1990..a72aba04a 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BooleanGUI_Dialog.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -134,15 +135,13 @@ void BooleanGUI_Dialog::Init() myGroup->LineEdit1->setText(""); myGroup->LineEdit2->setText(""); - myObject1 = myObject2 = GEOM::GEOM_Object::_nil(); + myObject1.nullify(); + myObject2.nullify(); // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(myGroup->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(myGroup->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -161,6 +160,7 @@ void BooleanGUI_Dialog::Init() myGroup->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= @@ -169,6 +169,7 @@ void BooleanGUI_Dialog::Init() //================================================================================= void BooleanGUI_Dialog::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -196,22 +197,11 @@ void BooleanGUI_Dialog::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == myGroup->LineEdit1) myObject1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2 = GEOM::GEOM_Object::_nil(); - return; - } - - // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) - { - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_SHAPE ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); // clear selection disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); @@ -221,15 +211,19 @@ void BooleanGUI_Dialog::SelectionIntoArgument() if (myEditCurrentArgument == myGroup->LineEdit1) { myObject1 = aSelectedObject; - if (myObject2->_is_nil()) + if (!myObject2) myGroup->PushButton2->click(); } else if (myEditCurrentArgument == myGroup->LineEdit2) { myObject2 = aSelectedObject; - if (myObject1->_is_nil()) + if (!myObject1) myGroup->PushButton1->click(); } } + else { + if (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify(); + else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify(); + } } //================================================================================= @@ -260,19 +254,6 @@ void BooleanGUI_Dialog::SetEditCurrentArgument() send->setDown(true); } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BooleanGUI_Dialog::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == myGroup->LineEdit1 || send == myGroup->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } -} - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -282,8 +263,8 @@ void BooleanGUI_Dialog::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); - displayPreview(); + this, SLOT( SelectionIntoArgument() ) ); + processPreview(); } //================================================================================= @@ -311,13 +292,7 @@ GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation() //================================================================================= bool BooleanGUI_Dialog::isValid (QString&) { - //Handle(SALOME_InteractiveObject) IO = firstIObject(); - //Standard_Boolean testResult; - //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); - //if (!testResult || anObject->_is_nil()) - // return false; - - return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2); + return myObject1 && myObject2; } //================================================================================= @@ -328,8 +303,8 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects) { GEOM::GEOM_Object_var anObj; - anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())-> - MakeBoolean(myObject1, myObject2, myOperation); + GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); + anObj = anOper->MakeBoolean(myObject1.get(), myObject2.get(), myOperation); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); @@ -347,6 +322,7 @@ void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy, // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame - /*theInheritFirstArg=*/myOperation == BooleanGUI::CUT); // ? false + /*theInheritFirstArg=*/myOperation == BooleanGUI::CUT, + mainFrame()->CheckBoxAddPrefix->isChecked()); // ? false } } diff --git a/src/BooleanGUI/BooleanGUI_Dialog.h b/src/BooleanGUI/BooleanGUI_Dialog.h index c9ac5a5c2..d51d4250e 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.h +++ b/src/BooleanGUI/BooleanGUI_Dialog.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BooleanGUI_Dialog.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BOOLEANGUI_DIALOG_H #define BOOLEANGUI_DIALOG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel; @@ -40,7 +42,7 @@ class BooleanGUI_Dialog : public GEOMBase_Skeleton public: BooleanGUI_Dialog( const int, GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~BooleanGUI_Dialog(); protected: @@ -57,8 +59,8 @@ private: private: int myOperation; - GEOM::GEOM_Object_var myObject1; - GEOM::GEOM_Object_var myObject2; + GEOM::GeomObjPtr myObject1; + GEOM::GeomObjPtr myObject2; DlgRef_2Sel* myGroup; @@ -67,7 +69,6 @@ private slots: bool ClickOnApply(); void SetEditCurrentArgument(); void SelectionIntoArgument(); - void LineEditReturnPressed(); void ActivateThisDialog(); }; diff --git a/src/BooleanGUI/Makefile.am b/src/BooleanGUI/Makefile.am index fbea57437..45ffc15e5 100644 --- a/src/BooleanGUI/Makefile.am +++ b/src/BooleanGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM BOOLEANGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -68,8 +66,7 @@ libBooleanGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libBooleanGUI_la_LDFLAGS = \ ../GEOMBase/libGEOMBase.la diff --git a/src/BuildGUI/BuildGUI.cxx b/src/BuildGUI/BuildGUI.cxx index 643cbf11a..9964b2428 100644 --- a/src/BuildGUI/BuildGUI.cxx +++ b/src/BuildGUI/BuildGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BooleanGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -36,6 +37,7 @@ #include "BuildGUI_CompoundDlg.h" // Method COMPOUND #include +#include "GeometryGUI_Operations.h" //======================================================================= // function : BuildGUI() @@ -66,12 +68,12 @@ bool BuildGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = 0; switch ( theCommandID ) { - case 4081: aDlg = new BuildGUI_EdgeDlg ( getGeometryGUI(), parent ); break; - case 4082: aDlg = new BuildGUI_WireDlg ( getGeometryGUI(), parent ); break; - case 4083: aDlg = new BuildGUI_FaceDlg ( getGeometryGUI(), parent ); break; - case 4084: aDlg = new BuildGUI_ShellDlg ( getGeometryGUI(), parent ); break; - case 4085: aDlg = new BuildGUI_SolidDlg ( getGeometryGUI(), parent ); break; - case 4086: aDlg = new BuildGUI_CompoundDlg( getGeometryGUI(), parent ); break; + case GEOMOp::OpEdge: aDlg = new BuildGUI_EdgeDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpWire: aDlg = new BuildGUI_WireDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpFace: aDlg = new BuildGUI_FaceDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpShell: aDlg = new BuildGUI_ShellDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpSolid: aDlg = new BuildGUI_SolidDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpCompound: aDlg = new BuildGUI_CompoundDlg( getGeometryGUI(), parent ); break; default: getGeometryGUI()->getApp()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; diff --git a/src/BuildGUI/BuildGUI.h b/src/BuildGUI/BuildGUI.h index 1ae6aed71..5cbaaf3b1 100644 --- a/src/BuildGUI/BuildGUI.h +++ b/src/BuildGUI/BuildGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/BuildGUI/BuildGUI.pro b/src/BuildGUI/BuildGUI.pro deleted file mode 100644 index 4e3ff52c9..000000000 --- a/src/BuildGUI/BuildGUI.pro +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = BuildGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../GEOMGUI ../DlgRef ../GEOMBase ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMFiltersSelection $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMBase - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += BUILDGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -SOURCES = BuildGUI.cxx -SOURCES += BuildGUI_EdgeDlg.cxx -SOURCES += BuildGUI_WireDlg.cxx -SOURCES += BuildGUI_FaceDlg.cxx -SOURCES += BuildGUI_ShellDlg.cxx -SOURCES += BuildGUI_SolidDlg.cxx -SOURCES += BuildGUI_CompoundDlg.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.cxx b/src/BuildGUI/BuildGUI_CompoundDlg.cxx index 66ec085eb..b604e63c1 100644 --- a/src/BuildGUI/BuildGUI_CompoundDlg.cxx +++ b/src/BuildGUI/BuildGUI_CompoundDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_CompoundDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -98,20 +99,22 @@ void BuildGUI_CompoundDlg::Init() myEditCurrentArgument = GroupShapes->LineEdit1; GroupShapes->LineEdit1->setReadOnly( true ); - myOkShapes = false; + myShapes.clear(); mainFrame()->GroupBoxPublish->show(); + mainFrame()->CheckBoxPreview->hide(); /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( GroupShapes->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( ( (SalomeApp_Application*)(SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection( GEOM_ALLSHAPES ); initName( tr( "GEOM_COMPOUND" ) ); + SelectionIntoArgument(); } @@ -121,6 +124,7 @@ void BuildGUI_CompoundDlg::Init() //================================================================================= void BuildGUI_CompoundDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -147,22 +151,13 @@ bool BuildGUI_CompoundDlg::ClickOnApply() void BuildGUI_CompoundDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - QString aString = ""; /* name of selection */ - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); + myShapes = getSelected( TopAbs_SHAPE, -1 ); - myOkShapes = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); - if ( nbSel == 0 ) - return; - if ( nbSel != 1 ) - aString = QString( "%1_objects").arg( nbSel ); - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myShapes, true); - myEditCurrentArgument->setText( aString ); - myOkShapes = true; + if ( !myShapes.isEmpty() ) { + QString aName = myShapes.count() > 1 ? QString( "%1_objects").arg( myShapes.count() ) : GEOMBase::GetName( myShapes[0].get() ); + myEditCurrentArgument->setText( aName ); + } } @@ -192,7 +187,7 @@ void BuildGUI_CompoundDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } @@ -221,7 +216,7 @@ GEOM::GEOM_IOperations_ptr BuildGUI_CompoundDlg::createOperation() //================================================================================= bool BuildGUI_CompoundDlg::isValid( QString& ) { - return myOkShapes; + return !myShapes.isEmpty(); } //================================================================================= @@ -230,9 +225,14 @@ bool BuildGUI_CompoundDlg::isValid( QString& ) //================================================================================= bool BuildGUI_CompoundDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + + GEOM::ListOfGO_var objlist = new GEOM::ListOfGO(); + objlist->length( myShapes.count() ); + for ( int i = 0; i < myShapes.count(); i++ ) + objlist[i] = myShapes[i].copy(); - anObj = GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->MakeCompound( myShapes ); + GEOM::GEOM_Object_var anObj = anOper->MakeCompound( objlist ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -250,7 +250,8 @@ void BuildGUI_CompoundDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy, if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) { // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(), - /*theFindMethod=*/GEOM::FSM_GetSame, // ? GEOM::FSM_GetInPlace - /*theInheritFirstArg=*/false ); + /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame + /*theInheritFirstArg=*/false, + mainFrame()->CheckBoxAddPrefix->isChecked() ); } } diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.h b/src/BuildGUI/BuildGUI_CompoundDlg.h index 4aa6de210..8ab58a83f 100644 --- a/src/BuildGUI/BuildGUI_CompoundDlg.h +++ b/src/BuildGUI/BuildGUI_CompoundDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_CompoundDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BUILDGUI_COMPOUNDDLG_H #define BUILDGUI_COMPOUNDDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel; @@ -54,8 +56,7 @@ private: void enterEvent( QEvent* ); private: - GEOM::ListOfGO myShapes; - bool myOkShapes; + QList myShapes; DlgRef_1Sel* GroupShapes; diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index 1548635f4..7f596761b 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_EdgeDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "BuildGUI_EdgeDlg.h" #include @@ -35,6 +36,7 @@ #include #include +#include //================================================================================= // class : BuildGUI_EdgeDlg() @@ -46,38 +48,75 @@ BuildGUI_EdgeDlg::BuildGUI_EdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent) : GEOMBase_Skeleton(theGeometryGUI, parent) { - QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE"))); - QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE"))); + QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE_WIRE"))); + QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE_CURVE"))); setWindowTitle(tr("GEOM_EDGE_TITLE")); /***************************************************************/ mainFrame()->GroupConstructors->setTitle(tr("GEOM_EDGE")); - mainFrame()->RadioButton1->setIcon(image0); - mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); - mainFrame()->RadioButton2->close(); - mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); - mainFrame()->RadioButton3->close(); + mainFrame()->RadioButton1->setIcon(image1); + mainFrame()->RadioButton2->setIcon(image2); + mainFrame()->RadioButton3->setIcon(image3); - GroupPoints = new DlgRef_2Sel(centralWidget()); + // two points + GroupPoints = new DlgRef_2Sel(centralWidget()); GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg(1)); GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg(2)); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); - + GroupPoints->PushButton1->setIcon(image0); + GroupPoints->PushButton2->setIcon(image0); GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly(true); + // wire + + GroupWire = new DlgRef_1Sel2Spin(centralWidget()); + GroupWire->GroupBox1->setTitle(tr("GEOM_WIRE")); + GroupWire->TextLabel1->setText(tr("GEOM_WIRE")); + GroupWire->PushButton1->setIcon(image0); + GroupWire->LineEdit1->setReadOnly(true); + GroupWire->TextLabel2->setText(tr("GEOM_LINEAR_TOLERANCE")); + GroupWire->TextLabel3->setText(tr("GEOM_ANGULAR_TOLERANCE")); + double SpecificStep = 0.0001; + double prec1 = Precision::Confusion(); + double prec2 = Precision::Angular(); + initSpinBox(GroupWire->SpinBox_DX, prec1, MAX_NUMBER, SpecificStep, "len_tol_precision"); + initSpinBox(GroupWire->SpinBox_DY, prec2, MAX_NUMBER, SpecificStep, "ang_tol_precision"); + GroupWire->SpinBox_DX->setValue(prec1); + GroupWire->SpinBox_DY->setValue(prec2); + + // on curve + + GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget()); + GroupOnCurve->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE")); + GroupOnCurve->PushButton1->setIcon(image0); + GroupOnCurve->LineEdit1->setReadOnly(true); + GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT")); + GroupOnCurve->PushButton2->setIcon(image0); + GroupOnCurve->LineEdit2->setReadOnly(true); + GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH")); + double step = aResMgr->doubleValue("Geometry", "SettingsGeomStep", 100.0); + initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision"); + GroupOnCurve->SpinBox_DX->setValue(step); + + // layout + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); layout->addWidget(GroupPoints); + layout->addWidget(GroupWire); + layout->addWidget(GroupOnCurve); /***************************************************************/ setHelpFileName("create_edge_page.html"); - // Initialisation + // initialisation Init(); } @@ -97,28 +136,40 @@ BuildGUI_EdgeDlg::~BuildGUI_EdgeDlg() void BuildGUI_EdgeDlg::Init() { // init variables - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); + myPoint1.nullify(); + myPoint2.nullify(); + myWire.nullify(); + myCurve.nullify(); + myStartPoint.nullify(); - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - myOkPoint1 = myOkPoint2 = false; + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->PushButton1->setDown(true); + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); // signals and slots connections + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupWire->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupOnCurve->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); initName(tr("GEOM_EDGE")); - GroupPoints->PushButton1->click(); - SelectionIntoArgument(); + ConstructorsClicked(0); } //================================================================================= @@ -127,6 +178,7 @@ void BuildGUI_EdgeDlg::Init() //================================================================================= void BuildGUI_EdgeDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -141,11 +193,81 @@ bool BuildGUI_EdgeDlg::ClickOnApply() return false; initName(); - // activate selection and connect selection manager - GroupPoints->PushButton1->click(); + + myEditCurrentArgument->setText(""); + ConstructorsClicked(getConstructorId()); + return true; } +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BuildGUI_EdgeDlg::ConstructorsClicked(int constructorId) +{ + switch (constructorId) { + case 0: + { + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + myPoint1.nullify(); + myPoint2.nullify(); + GroupPoints->PushButton1->setDown(true); + GroupPoints->PushButton2->setDown(false); + GroupPoints->LineEdit1->setEnabled(true); + GroupPoints->LineEdit2->setEnabled(false); + GroupPoints->show(); + GroupWire->hide(); + GroupOnCurve->hide(); + break; + } + case 1: + { + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE); + + myEditCurrentArgument = GroupWire->LineEdit1; + GroupWire->LineEdit1->setText(""); + myWire.nullify(); + GroupWire->PushButton1->setDown(true); + GroupWire->LineEdit1->setEnabled(true); + GroupPoints->hide(); + GroupOnCurve->hide(); + GroupWire->show(); + break; + } + case 2: + { + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + + myEditCurrentArgument = GroupOnCurve->LineEdit1; + GroupOnCurve->LineEdit1->setText(""); + GroupOnCurve->LineEdit2->setText(""); + myCurve.nullify(); + myStartPoint.nullify(); + GroupOnCurve->PushButton1->setDown(true); + GroupOnCurve->PushButton2->setDown(false); + GroupOnCurve->LineEdit1->setEnabled(true); + GroupOnCurve->LineEdit2->setEnabled(false); + GroupPoints->hide(); + GroupWire->hide(); + GroupOnCurve->show(); + break; + } + } + + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); + SelectionIntoArgument(); +} + //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection is changed or on dialog initialization or activation @@ -160,41 +282,54 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myOkPoint1 = false; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myOkPoint2 = false; + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify(); + else if (myEditCurrentArgument == GroupWire->LineEdit1) myWire.nullify(); + else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) myCurve.nullify(); + else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) myStartPoint.nullify(); + displayPreview(true); return; } - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult || aSelectedObject->_is_nil()) - return; - - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - myPoint1 = aSelectedObject; - myOkPoint1 = true; - if (!myOkPoint2) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myPoint2 = aSelectedObject; - myOkPoint2 = true; - if (!myOkPoint1) - GroupPoints->PushButton1->click(); + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; + if (myEditCurrentArgument == GroupWire->LineEdit1) aNeedType = TopAbs_WIRE; + else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) aNeedType = TopAbs_EDGE; + GEOM::GeomObjPtr aSelectedObject = getSelected(aNeedType); + + TopoDS_Shape aShape; + if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) { + QString aName = GEOMBase::GetName(aSelectedObject.get()); + myEditCurrentArgument->setText(aName); + + globalSelection(); + localSelection(GEOM::GEOM_Object::_nil(), aNeedType); + + if (myEditCurrentArgument == GroupPoints->LineEdit1) { + myPoint1 = aSelectedObject; + if (myPoint1 && !myPoint2) + GroupPoints->PushButton2->click(); + } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + myPoint2 = aSelectedObject; + if (myPoint2 && !myPoint1) + GroupPoints->PushButton1->click(); + } + else if (myEditCurrentArgument == GroupWire->LineEdit1) { + myWire = aSelectedObject; + } + else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) { + myCurve = aSelectedObject; + if (myCurve && !myStartPoint) + GroupOnCurve->PushButton2->click(); + } + else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) { + myStartPoint = aSelectedObject; + if (myStartPoint && !myCurve) + GroupOnCurve->PushButton1->click(); + } } - displayPreview(); + displayPreview(true); } //================================================================================= @@ -204,7 +339,6 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument() void BuildGUI_EdgeDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - //globalSelection();//?? if (send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; @@ -216,33 +350,31 @@ void BuildGUI_EdgeDlg::SetEditCurrentArgument() GroupPoints->PushButton1->setDown(false); GroupPoints->LineEdit1->setEnabled(false); } + else if (send == GroupWire->PushButton1) { + myEditCurrentArgument = GroupWire->LineEdit1; + } + else if (send == GroupOnCurve->PushButton1) { + myEditCurrentArgument = GroupOnCurve->LineEdit1; + GroupOnCurve->PushButton2->setDown(false); + GroupOnCurve->LineEdit2->setEnabled(false); + + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + } + else if (send == GroupOnCurve->PushButton2) { + myEditCurrentArgument = GroupOnCurve->LineEdit2; + GroupOnCurve->PushButton1->setDown(false); + GroupOnCurve->LineEdit1->setEnabled(false); + + globalSelection(); // close local contexts, if any + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + } // enable line edit myEditCurrentArgument->setEnabled(true); myEditCurrentArgument->setFocus(); - // after setFocus(), because it will be setDown(false) when loses focus send->setDown(true); - - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - globalSelection(GEOM_POINT); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void BuildGUI_EdgeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } //================================================================================= @@ -253,10 +385,10 @@ void BuildGUI_EdgeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); - displayPreview(); + ConstructorsClicked(getConstructorId()); } //================================================================================= @@ -269,6 +401,15 @@ void BuildGUI_EdgeDlg::enterEvent (QEvent*) ActivateThisDialog(); } +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::ValueChangedInSpinBox(double newValue) +{ + displayPreview(true); +} + //================================================================================= // function : createOperation // purpose : @@ -282,9 +423,26 @@ GEOM::GEOM_IOperations_ptr BuildGUI_EdgeDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool BuildGUI_EdgeDlg::isValid (QString&) +bool BuildGUI_EdgeDlg::isValid (QString& msg) { - return myOkPoint1 && myOkPoint2; + bool ok = false; + switch (getConstructorId()) { + case 0: + ok = myPoint1 && myPoint2; + break; + case 1: + ok = GroupWire->SpinBox_DX->isValid(msg, !IsPreview()) && + GroupWire->SpinBox_DY->isValid(msg, !IsPreview()) && + myWire; + break; + case 2: + ok = GroupOnCurve->SpinBox_DX->isValid(msg, !IsPreview()) && + myCurve; + break; + default: + break; + } + return ok; } //================================================================================= @@ -293,12 +451,73 @@ bool BuildGUI_EdgeDlg::isValid (QString&) //================================================================================= bool BuildGUI_EdgeDlg::execute (ObjectList& objects) { + bool res = false; GEOM::GEOM_Object_var anObj; - anObj = GEOM::GEOM_IShapesOperations::_narrow(getOperation())->MakeEdge(myPoint1, myPoint2); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); + switch (getConstructorId()) { + case 0: + { + anObj = anOper->MakeEdge(myPoint1.get(), myPoint2.get()); + res = true; + break; + } + case 1: + { + double aLinearTolerance = GroupWire->SpinBox_DX->value(); + double anAngularTolerance = GroupWire->SpinBox_DY->value(); - return true; + QStringList aParameters; + aParameters << GroupWire->SpinBox_DX->text(); + aParameters << GroupWire->SpinBox_DY->text(); + + anObj = anOper->MakeEdgeWire(myWire.get(), aLinearTolerance, anAngularTolerance); + + if (!anObj->_is_nil() && !IsPreview()) + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + + res = true; + break; + } + case 2: + { + double aLength = GroupOnCurve->SpinBox_DX->value(); + + anObj = anOper->MakeEdgeOnCurveByLength(myCurve.get(), aLength, myStartPoint.get()); + + if (!anObj->_is_nil() && !IsPreview()) + anObj->SetParameters(GroupOnCurve->SpinBox_DX->text().toLatin1().constData()); + + res = true; + break; + } + } + + if (!anObj->_is_nil()) objects.push_back(anObj._retn()); + + return res; +} + +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void BuildGUI_EdgeDlg::addSubshapesToStudy() +{ + switch (getConstructorId()) { + case 0: + GEOMBase::PublishSubObject(myPoint1.get()); + GEOMBase::PublishSubObject(myPoint2.get()); + break; + case 1: + GEOMBase::PublishSubObject(myWire.get()); + break; + case 2: + GEOMBase::PublishSubObject(myCurve.get()); + GEOMBase::PublishSubObject(myStartPoint.get()); + break; + default: + break; + } } diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.h b/src/BuildGUI/BuildGUI_EdgeDlg.h index 17dda7703..c0f955079 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.h +++ b/src/BuildGUI/BuildGUI_EdgeDlg.h @@ -1,34 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_EdgeDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #ifndef BUILDGUI_EDGEDLG_H #define BUILDGUI_EDGEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" +class DlgRef_1Sel2Spin; class DlgRef_2Sel; +class DlgRef_2Sel1Spin; //================================================================================= // class : BuildGUI_EdgeDlg @@ -39,33 +43,38 @@ class BuildGUI_EdgeDlg : public GEOMBase_Skeleton Q_OBJECT public: - BuildGUI_EdgeDlg( GeometryGUI*, QWidget* = 0 ); + BuildGUI_EdgeDlg (GeometryGUI*, QWidget* = 0); ~BuildGUI_EdgeDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual void addSubshapesToStudy(); private: void Init(); - void enterEvent( QEvent* ); + void enterEvent (QEvent*); private: - GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points containing the edge */ - bool myOkPoint1; /* true when myPoint is defined */ - bool myOkPoint2; + GEOM::GeomObjPtr myPoint1, myPoint2; /* Points */ + GEOM::GeomObjPtr myWire; /* Wire */ + GEOM::GeomObjPtr myCurve; /* Edge */ + GEOM::GeomObjPtr myStartPoint; /* Point */ DlgRef_2Sel* GroupPoints; + DlgRef_1Sel2Spin* GroupWire; + DlgRef_2Sel1Spin* GroupOnCurve; private slots: + void ConstructorsClicked (int); void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); + void ValueChangedInSpinBox (double); }; #endif // BUILDGUI_EDGEDLG_H diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index e1adb30c6..72bf40bbf 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_FaceDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "BuildGUI_FaceDlg.h" #include @@ -32,11 +33,14 @@ #include #include -#include -#include #include #include +#include +#include +#include +#include + //================================================================================= // class : BuildGUI_FaceDlg() // purpose : Constructs a BuildGUI_FaceDlg which is a child of 'parent', with the @@ -100,6 +104,7 @@ void BuildGUI_FaceDlg::Init() GroupWire->LineEdit1->setReadOnly( true ); GroupWire->CheckButton1->setChecked( true ); + myWires.clear(); TColStd_MapOfInteger aMap; aMap.Add( GEOM_EDGE ); @@ -112,9 +117,10 @@ void BuildGUI_FaceDlg::Init() connect( GroupWire->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) ); connect( GroupWire->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_FACE" ) ); + SelectionIntoArgument(); } @@ -124,6 +130,7 @@ void BuildGUI_FaceDlg::Init() //================================================================================= void BuildGUI_FaceDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -150,26 +157,15 @@ bool BuildGUI_FaceDlg::ClickOnApply() void BuildGUI_FaceDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - QString aName; - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName); - - if ( aNbSel < 1) { - myWires.length(0); - return; + QList types; + types << TopAbs_EDGE << TopAbs_WIRE; + myWires = getSelected( types, -1 ); + + if ( !myWires.isEmpty() ) { + QString aName = myWires.count() > 1 ? QString( "%1_objects").arg( myWires.count() ) : GEOMBase::GetName( myWires[0].get() ); + myEditCurrentArgument->setText( aName ); } - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myWires); - if ( !myWires.length() ) - return; - if ( aNbSel != 1 ) - aName = tr( "%1_objects" ).arg( aNbSel ); - - myEditCurrentArgument->setText( aName ); } @@ -203,7 +199,7 @@ void BuildGUI_FaceDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); TColStd_MapOfInteger aMap; aMap.Add( GEOM_EDGE ); aMap.Add( GEOM_WIRE ); @@ -236,7 +232,7 @@ GEOM::GEOM_IOperations_ptr BuildGUI_FaceDlg::createOperation() //================================================================================= bool BuildGUI_FaceDlg::isValid( QString& ) { - return ( myWires.length() != 0 ); + return !myWires.isEmpty(); } //================================================================================= @@ -245,15 +241,26 @@ bool BuildGUI_FaceDlg::isValid( QString& ) //================================================================================= bool BuildGUI_FaceDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + + GEOM::ListOfGO_var objlist = new GEOM::ListOfGO(); + objlist->length( myWires.count() ); + for ( int i = 0; i < myWires.count(); i++ ) + objlist[i] = myWires[i].copy(); - bool isPlanarWanted = GroupWire->CheckButton1->isChecked(); - anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeFaceWires( myWires, isPlanarWanted ); + GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( objlist.in(), GroupWire->CheckButton1->isChecked() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); + if (!anObj->_is_nil()) { + objects.push_back(anObj._retn()); + + if (!anOper->IsDone() && QString(anOper->GetErrorCode()) == "MAKE_FACE_TOLERANCE_TOO_BIG") { + SUIT_OverrideCursor wc; + wc.suspend(); + QString msgw = QObject::tr(anOper->GetErrorCode()); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK")); + anOper->SetErrorCode("PAL_NO_ERROR"); + } + } return true; } - diff --git a/src/BuildGUI/BuildGUI_FaceDlg.h b/src/BuildGUI/BuildGUI_FaceDlg.h index 12bd7d713..f0ca76acd 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.h +++ b/src/BuildGUI/BuildGUI_FaceDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_FaceDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BUILDGUI_FACEDLG_H #define BUILDGUI_FACEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel1Check; @@ -53,7 +55,7 @@ private: void enterEvent( QEvent* ); private: - GEOM::ListOfGO myWires; + QList myWires; DlgRef_1Sel1Check* GroupWire; diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx index bd1cb125a..6555f45b9 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.cxx +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_ShellDlg.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -100,7 +101,7 @@ void BuildGUI_ShellDlg::Init() myEditCurrentArgument = GroupShell->LineEdit1; GroupShell->LineEdit1->setReadOnly( true ); - myOkFacesAndShells = false; + myFacesAndShells.clear(); TColStd_MapOfInteger aMap; aMap.Add( GEOM_SHELL ); @@ -110,7 +111,6 @@ void BuildGUI_ShellDlg::Init() QList aSubShapes; aSubShapes.append( GEOM_FACE ); globalSelection( aMap, aSubShapes ); - /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); @@ -119,9 +119,10 @@ void BuildGUI_ShellDlg::Init() connect( GroupShell->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_SHELL" ) ); + SelectionIntoArgument(); } @@ -131,6 +132,7 @@ void BuildGUI_ShellDlg::Init() //================================================================================= void BuildGUI_ShellDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -157,25 +159,15 @@ bool BuildGUI_ShellDlg::ClickOnApply() void BuildGUI_ShellDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - QString aString; - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - myOkFacesAndShells = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); - if ( nbSel == 0 ) - return; - if ( nbSel != 1 ) - aString = QString( "%1_objects ").arg( nbSel ); - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myFacesAndShells, true); - if ( !myFacesAndShells.length() ) - return; + QList types; + types << TopAbs_FACE << TopAbs_SHELL << TopAbs_COMPOUND; + myFacesAndShells = getSelected( types, -1 ); - myEditCurrentArgument->setText( aString ); - myOkFacesAndShells = true; + if ( !myFacesAndShells.isEmpty() ) { + QString aName = myFacesAndShells.count() > 1 ? QString( "%1_objects").arg( myFacesAndShells.count() ) : GEOMBase::GetName( myFacesAndShells[0].get() ); + myEditCurrentArgument->setText( aName ); + } } @@ -213,7 +205,7 @@ void BuildGUI_ShellDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); TColStd_MapOfInteger aMap; aMap.Add( GEOM_SHELL ); aMap.Add( GEOM_FACE ); @@ -250,7 +242,7 @@ GEOM::GEOM_IOperations_ptr BuildGUI_ShellDlg::createOperation() //================================================================================= bool BuildGUI_ShellDlg::isValid( QString& ) { - return myOkFacesAndShells; + return !myFacesAndShells.isEmpty(); } //================================================================================= @@ -259,10 +251,14 @@ bool BuildGUI_ShellDlg::isValid( QString& ) //================================================================================= bool BuildGUI_ShellDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + + GEOM::ListOfGO_var objlist = new GEOM::ListOfGO(); + objlist->length( myFacesAndShells.count() ); + for ( int i = 0; i < myFacesAndShells.count(); i++ ) + objlist[i] = myFacesAndShells[i].copy(); - anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeShell( myFacesAndShells ); + GEOM::GEOM_Object_var anObj = anOper->MakeShell( objlist.in() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/BuildGUI/BuildGUI_ShellDlg.h b/src/BuildGUI/BuildGUI_ShellDlg.h index d611afe24..e7814d38e 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.h +++ b/src/BuildGUI/BuildGUI_ShellDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_ShellDlg.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef BUILDGUI_SHELLDLG_H #define BUILDGUI_SHELLDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel; @@ -53,8 +55,7 @@ private: void enterEvent( QEvent* ); private: - GEOM::ListOfGO myFacesAndShells; - bool myOkFacesAndShells;/* to check when arguments is defined */ + QList myFacesAndShells; DlgRef_1Sel* GroupShell; diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx index 05b62c1a2..e8f4f63fc 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.cxx +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_SolidDlg.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. -// + #include "BuildGUI_SolidDlg.h" #include @@ -37,9 +38,11 @@ #include #include +#include + //================================================================================= // class : BuildGUI_SolidDlg() -// purpose : Constructs a BuildGUI_SolidDlg which is a child of 'parent', with the +// purpose : Constructs a BuildGUI_SolidDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -51,7 +54,7 @@ BuildGUI_SolidDlg::BuildGUI_SolidDlg( GeometryGUI* theGeometryGUI, QWidget* pare QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); setWindowTitle( tr( "GEOM_SOLID_TITLE" ) ); - + /***************************************************************/ mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SOLID" ) ); mainFrame()->RadioButton1->setIcon( image0 ); @@ -67,7 +70,7 @@ BuildGUI_SolidDlg::BuildGUI_SolidDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupSolid->CheckButton1->setText( tr( "GEOM_CREATE_SINGLE_SOLID" ) ); GroupSolid->PushButton1->setIcon( image1 ); GroupSolid->LineEdit1->setReadOnly( true ); - + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->addWidget( GroupSolid ); @@ -101,9 +104,15 @@ void BuildGUI_SolidDlg::Init() GroupSolid->LineEdit1->setReadOnly( true ); GroupSolid->CheckButton1->setChecked( true ); - myOkShells = false; + myShells.clear(); - globalSelection( GEOM_SHELL ); + //globalSelection( GEOM_SHELL ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_SHELL ); + aMap.Add( GEOM_COMPOUNDFILTER ); + QList aSubShapes; + aSubShapes.append( GEOM_SHELL ); + globalSelection( aMap, aSubShapes ); /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); @@ -113,9 +122,10 @@ void BuildGUI_SolidDlg::Init() connect( GroupSolid->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( EnableNameField( bool ) ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_SOLID" ) ); + SelectionIntoArgument(); } @@ -125,6 +135,7 @@ void BuildGUI_SolidDlg::Init() //================================================================================= void BuildGUI_SolidDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -135,17 +146,6 @@ void BuildGUI_SolidDlg::ClickOnOk() //================================================================================= bool BuildGUI_SolidDlg::ClickOnApply() { - for ( int i = 0, n = myShells.length(); i< n; i++ ) { - if ( !isClosed(i)) { - QString aName = GEOMBase::GetName( myShells[i] ); - SUIT_MessageBox::warning( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_SHAPE_UNCLOSED").arg(aName) , - QObject::tr("BUT_OK") ); - return false; - } - } - if ( !onAccept() ) return false; @@ -161,25 +161,16 @@ bool BuildGUI_SolidDlg::ClickOnApply() void BuildGUI_SolidDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - QString aString = ""; - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - myOkShells = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString); - if ( nbSel == 0 ) - return; - if ( nbSel != 1 ) - aString = tr( "%1_objects" ).arg( nbSel ); - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myShells); - if ( !myShells.length() ) - return; - - myEditCurrentArgument->setText( aString ); - myOkShells = true; + + //myShells = getSelected( TopAbs_SHELL, -1 ); + QList types; + types << TopAbs_SHELL << TopAbs_COMPOUND; + myShells = getSelected( types, -1 ); + + if ( !myShells.isEmpty() ) { + QString aName = myShells.count() > 1 ? QString( "%1_objects").arg( myShells.count() ) : GEOMBase::GetName( myShells[0].get() ); + myEditCurrentArgument->setText( aName ); + } } //================================================================================= @@ -191,8 +182,15 @@ void BuildGUI_SolidDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); if ( send != GroupSolid->PushButton1 ) return; - - globalSelection( GEOM_SHELL ); + + //globalSelection( GEOM_SHELL ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_SHELL ); + aMap.Add( GEOM_COMPOUNDFILTER ); + QList aSubShapes; + aSubShapes.append( GEOM_SHELL ); + globalSelection( aMap, aSubShapes ); + myEditCurrentArgument = GroupSolid->LineEdit1; myEditCurrentArgument->setFocus(); @@ -208,8 +206,15 @@ void BuildGUI_SolidDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - globalSelection( GEOM_SHELL ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + //globalSelection( GEOM_SHELL ); + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_SHELL ); + aMap.Add( GEOM_COMPOUNDFILTER ); + QList aSubShapes; + aSubShapes.append( GEOM_SHELL ); + globalSelection( aMap, aSubShapes ); } @@ -230,7 +235,7 @@ void BuildGUI_SolidDlg::enterEvent( QEvent* ) //================================================================================= void BuildGUI_SolidDlg::EnableNameField( bool toEnable ) { - mainFrame()->GroupBoxName->setEnabled( toEnable ); + mainFrame()->GroupBoxName->setEnabled( toEnable ); } //================================================================================= @@ -246,46 +251,62 @@ GEOM::GEOM_IOperations_ptr BuildGUI_SolidDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool BuildGUI_SolidDlg::isValid( QString& ) +bool BuildGUI_SolidDlg::isValid (QString& msg) { - return myOkShells; + bool ok = !myShells.isEmpty(); + + GEOM::MeasureOpPtr anOp; + anOp.take(myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId())); + + if (!GroupSolid->CheckButton1->isChecked() || myShells.count() == 1) { + for (int i = 0, n = myShells.count(); i < n && ok; i++) { + CORBA::String_var aRes = anOp->IsGoodForSolid(myShells[i].get()); + if (strlen(aRes.in())) { + msg = QObject::tr(aRes.in()).arg(GEOMBase::GetName(myShells[i].get())); + ok = false; + } + } + } + return ok; } +/* //================================================================================= // function : isClosed // purpose : Check the object 'i' in myShells list is closed or unclosed //================================================================================= -bool BuildGUI_SolidDlg::isClosed(int i) +bool BuildGUI_SolidDlg::isClosed( GEOM::GEOM_Object_ptr shell ) { - GEOM::GEOM_Object_var aShape = myShells[i]; + bool ok = false; + GEOM::GEOM_IKindOfShape::shape_kind aKind; GEOM::ListOfLong_var anInts; GEOM::ListOfDouble_var aDbls; - if (aShape->_is_nil()) { - MESSAGE ("Shape is NULL!!!"); - return false; - } + if ( !CORBA::is_nil( shell ) ) { + GEOM::MeasureOpPtr anOp; + anOp.take( myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ) ); - GEOM::GEOM_IMeasureOperations_ptr anOp = myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); + // Detect kind of shape and parameters + aKind = anOp->KindOfShape(shell, anInts, aDbls); - // GEOM::GEOM_IMeasureOperations_var anOp = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); - - // Detect kind of shape and parameters - aKind = anOp->KindOfShape(aShape, anInts, aDbls); - - if ( !anOp->IsDone() ) { - MESSAGE ("KindOfShape Operation is NOT DONE!!!"); - return false; + if ( anOp->IsDone() ) { + if ( anInts[0] == 1 ) + ok = true; + else if ( anInts[0] == 2 ) + ok = false; + } + else { + MESSAGE ("KindOfShape Operation is NOT DONE!!!"); + } } - - if ( anInts[0] == 1 ) - return true; - else if ( anInts[0] == 2 ) - return false; - - return false; + else { + MESSAGE ("Shape is NULL!!!"); + } + + return ok; } +*/ //================================================================================= // function : execute @@ -293,19 +314,22 @@ bool BuildGUI_SolidDlg::isClosed(int i) //================================================================================= bool BuildGUI_SolidDlg::execute( ObjectList& objects ) { - bool toCreateSingleSolid = GroupSolid->CheckButton1->isChecked(); - - if ( toCreateSingleSolid ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeSolidShells( myShells ); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + + if ( GroupSolid->CheckButton1->isChecked() ) { + GEOM::ListOfGO_var objlist = new GEOM::ListOfGO(); + objlist->length( myShells.count() ); + for ( int i = 0; i < myShells.count(); i++ ) + objlist[i] = myShells[i].copy(); + + GEOM::GEOM_Object_var anObj = anOper->MakeSolidShells( objlist.in() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else { - for ( int i = 0, n = myShells.length(); i< n; i++ ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeSolidShell( myShells[ i ] ); + for ( int i = 0, n = myShells.count(); i< n; i++ ) { + GEOM::GEOM_Object_var anObj = anOper->MakeSolidShell( myShells[ i ].get() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -314,4 +338,3 @@ bool BuildGUI_SolidDlg::execute( ObjectList& objects ) return true; } - diff --git a/src/BuildGUI/BuildGUI_SolidDlg.h b/src/BuildGUI/BuildGUI_SolidDlg.h index 3236ad4aa..dda578c38 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.h +++ b/src/BuildGUI/BuildGUI_SolidDlg.h @@ -1,32 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_SolidDlg.h // Author : Damien COQUERET, Open CASCADE S.A.S. -// + #ifndef BUILDGUI_SOLIDDLG_H #define BUILDGUI_SOLIDDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel1Check; @@ -50,15 +52,13 @@ protected: private: void Init(); - bool isClosed(int i); + //bool isClosed( GEOM::GEOM_Object_ptr shell ); void enterEvent( QEvent* ); private: - GEOM::ListOfGO myShells; - bool myOkShells; /* to check when arguments is defined and - all shells are closed */ + QList myShells; - DlgRef_1Sel1Check* GroupSolid; + DlgRef_1Sel1Check* GroupSolid; private slots: void ClickOnOk(); diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx index 05326e457..89c18a189 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.cxx +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_WireDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -35,8 +36,12 @@ #include #include #include +#include #include +#include +#include +#include //================================================================================= // class : BuildGUI_WireDlg() @@ -61,16 +66,29 @@ BuildGUI_WireDlg::BuildGUI_WireDlg( GeometryGUI* theGeometryGUI, QWidget* parent mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_1Sel( centralWidget() ); - - GroupPoints->GroupBox1->setTitle( tr( "GEOM_WIRE_CONNECT" ) ); - GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); - GroupPoints->PushButton1->setIcon( image1 ); - GroupPoints->LineEdit1->setReadOnly( true ); + GroupType = new DlgRef_3Radio( centralWidget() ); + GroupType->GroupBox1->setTitle( tr( "GEOM_OBJECT_TYPE" ) ); + GroupType->RadioButton1->setText( tr( "GEOM_EDGE" ) ); + GroupType->RadioButton2->setText( tr( "GEOM_WIRE" ) ); + GroupType->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + GroupType->RadioButton3->close(); + + GroupArgs = new DlgRef_1Sel1Spin( centralWidget() ); + GroupArgs->GroupBox1->setTitle( tr( "GEOM_WIRE_CONNECT" ) ); + GroupArgs->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + GroupArgs->PushButton1->setIcon( image1 ); + GroupArgs->LineEdit1->setReadOnly( true ); + + GroupArgs->TextLabel2->setText( tr( "GEOM_TOLERANCE" ) ); + double SpecificStep = 0.0001; + double prec = Precision::Confusion(); + initSpinBox(GroupArgs->SpinBox_DX, prec, MAX_NUMBER, SpecificStep, "len_tol_precision" ); + GroupArgs->SpinBox_DX->setValue(prec); QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupPoints ); + layout->addWidget( GroupType ); + layout->addWidget( GroupArgs ); /***************************************************************/ setHelpFileName( "create_wire_page.html" ); @@ -97,24 +115,29 @@ BuildGUI_WireDlg::~BuildGUI_WireDlg() void BuildGUI_WireDlg::Init() { /* init variables */ - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setReadOnly( true ); + myEditCurrentArgument = GroupArgs->LineEdit1; + GroupArgs->LineEdit1->setReadOnly( true ); + GroupType->RadioButton1->setChecked(true); - myOkEdgesAndWires = false; - - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_WIRE ); - aMap.Add( GEOM_EDGE ); - globalSelection( aMap ); + myEdgesAndWires.clear(); + + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( GroupArgs->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + connect( GroupType->RadioButton1, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) ); + connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) ); + + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); initName( tr( "GEOM_WIRE" ) ); + SelectionIntoArgument(); } @@ -124,6 +147,7 @@ void BuildGUI_WireDlg::Init() //================================================================================= void BuildGUI_WireDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -139,9 +163,30 @@ bool BuildGUI_WireDlg::ClickOnApply() return false; initName(); + TypeButtonClicked(); + myEdgesAndWires.clear(); + myEditCurrentArgument->setText( "" ); return true; } +//================================================================================= +// function : TypeBittonClicked() +// purpose : Radio button management +//================================================================================= +void BuildGUI_WireDlg::TypeButtonClicked() +{ + if ( GroupType->RadioButton1->isChecked() ) { + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + GroupArgs->TextLabel1->setText( tr( "GEOM_EDGE" ) ); + } + else if ( GroupType->RadioButton2->isChecked() ) { + globalSelection(); // close local contexts, if any + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE ); + GroupArgs->TextLabel1->setText( tr( "GEOM_WIRE" ) ); + } + SelectionIntoArgument(); +} //================================================================================= // function : SelectionIntoArgument() @@ -150,26 +195,15 @@ bool BuildGUI_WireDlg::ClickOnApply() void BuildGUI_WireDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - QString aString = ""; /* name of selection */ - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - myOkEdgesAndWires = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString); + QList types; + types << TopAbs_EDGE << TopAbs_WIRE; + myEdgesAndWires = getSelected( types, -1 ); - if ( nbSel == 0 ) - return; - if ( nbSel != 1 ) - aString = tr( "%1_objects" ).arg( nbSel ); - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myEdgesAndWires); - if ( !myEdgesAndWires.length() ) - return; - - myEditCurrentArgument->setText( aString ); - myOkEdgesAndWires = true; + if ( !myEdgesAndWires.isEmpty() ) { + QString aName = myEdgesAndWires.count() > 1 ? QString( "%1_objects").arg( myEdgesAndWires.count() ) : GEOMBase::GetName( myEdgesAndWires[0].get() ); + myEditCurrentArgument->setText( aName ); + } } @@ -180,14 +214,11 @@ void BuildGUI_WireDlg::SelectionIntoArgument() void BuildGUI_WireDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if ( send != GroupPoints->PushButton1 ) + if ( send != GroupArgs->PushButton1 ) return; - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_WIRE ); - aMap.Add( GEOM_EDGE ); - globalSelection( aMap ); - myEditCurrentArgument = GroupPoints->LineEdit1; + TypeButtonClicked(); + myEditCurrentArgument = GroupArgs->LineEdit1; myEditCurrentArgument->setFocus(); SelectionIntoArgument(); @@ -202,13 +233,19 @@ void BuildGUI_WireDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - TColStd_MapOfInteger aMap; - aMap.Add( GEOM_WIRE ); - aMap.Add( GEOM_EDGE ); - globalSelection( aMap ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + TypeButtonClicked(); } +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BuildGUI_WireDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} //================================================================================= // function : enterEvent() @@ -233,25 +270,38 @@ GEOM::GEOM_IOperations_ptr BuildGUI_WireDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool BuildGUI_WireDlg::isValid( QString& ) +bool BuildGUI_WireDlg::isValid (QString& msg) { - return myOkEdgesAndWires; + return GroupArgs->SpinBox_DX->isValid(msg, !IsPreview()) && !myEdgesAndWires.isEmpty(); } //================================================================================= // function : execute // purpose : //================================================================================= -bool BuildGUI_WireDlg::execute( ObjectList& objects ) +bool BuildGUI_WireDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); - anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeWire( myEdgesAndWires ); + GEOM::ListOfGO_var objlist = new GEOM::ListOfGO(); + objlist->length( myEdgesAndWires.count() ); + for ( int i = 0; i < myEdgesAndWires.count(); i++ ) + objlist[i] = myEdgesAndWires[i].copy(); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); + GEOM::GEOM_Object_var anObj = anOper->MakeWire(objlist.in(), GroupArgs->SpinBox_DX->value()); + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); return true; } +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void BuildGUI_WireDlg::addSubshapesToStudy() +{ + for ( int i = 0; i < myEdgesAndWires.count(); i++ ) + GEOMBase::PublishSubObject( myEdgesAndWires[i].get() ); +} diff --git a/src/BuildGUI/BuildGUI_WireDlg.h b/src/BuildGUI/BuildGUI_WireDlg.h index 616df0246..2b5521ab2 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.h +++ b/src/BuildGUI/BuildGUI_WireDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BuildGUI_WireDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,9 +27,11 @@ #ifndef BUILDGUI_WIREDLG_H #define BUILDGUI_WIREDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" -class DlgRef_1Sel; +class DlgRef_1Sel1Spin; +class DlgRef_3Radio; //================================================================================= // class : BuildGUI_WireDlg @@ -46,24 +49,27 @@ protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); + virtual bool execute( ObjectList& ); + virtual void addSubshapesToStudy(); private: void Init(); void enterEvent( QEvent* ); private: - GEOM::ListOfGO myEdgesAndWires; - bool myOkEdgesAndWires; /* to check when arguments is defined */ + QList myEdgesAndWires; - DlgRef_1Sel* GroupPoints; + DlgRef_1Sel1Spin* GroupArgs; + DlgRef_3Radio* GroupType; private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); + void DeactivateActiveDialog(); void SelectionIntoArgument(); void SetEditCurrentArgument(); + void TypeButtonClicked(); }; #endif // BUILDGUI_WIREDLG_H diff --git a/src/BuildGUI/Makefile.am b/src/BuildGUI/Makefile.am index d4f2af548..ad254d831 100644 --- a/src/BuildGUI/Makefile.am +++ b/src/BuildGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM BUILDGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -80,8 +78,7 @@ libBuildGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(top_builddir)/idl \ - -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/src/DlgRef libBuildGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 6b62fe2fe..07613982f 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -1,32 +1,36 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : DisplayGUI.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // #include "DisplayGUI.h" #include +#include "GeometryGUI_Operations.h" +#include #include #include +#include #include #include @@ -53,6 +57,9 @@ #include +#include +#include + #include //======================================================================= @@ -85,59 +92,58 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) SALOME_ListIO selected; Sel->selectedObjects( selected ); - switch (theCommandID) { - case 211: // MENU VIEW - WIREFRAME/SHADING - { - InvertDisplayMode(); - int newMode = GetDisplayMode(); - getGeometryGUI()->action( 211 )->setText - ( newMode == 1 ? tr( "GEOM_MEN_WIREFRAME" ) : tr("GEOM_MEN_SHADING") ); - getGeometryGUI()->menuMgr()->update(); - break; - } - case 212: // MENU VIEW - DISPLAY ALL - { - getGeometryGUI()->EmitSignalDeactivateDialog(); - DisplayAll(); - break; - } - case 213: // MENU VIEW - DISPLAY ONLY - { - getGeometryGUI()->EmitSignalDeactivateDialog(); - DisplayOnly(); - break; - } - case 214: // MENU VIEW - ERASE ALL - { - EraseAll(); - break; - } - case 215: // MENU VIEW - ERASE - { - Erase(); - break; - } - case 216: // MENU VIEW - DISPLAY - { - getGeometryGUI()->EmitSignalDeactivateDialog(); - Display(); - break; - } - case 80311: // POPUP VIEWER - WIREFRAME - { - ChangeDisplayMode( 0 ); - break; - } - case 80312: // POPUP VIEWER - SHADING - { - ChangeDisplayMode( 1 ); - break; - } + switch ( theCommandID ) { + case GEOMOp::OpDMWireframe: // MENU VIEW - DISPLAY MODE - WIREFRAME + SetDisplayMode( 0 ); + break; + case GEOMOp::OpDMShading: // MENU VIEW - DISPLAY MODE - SHADING + SetDisplayMode( 1 ); + break; + case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - DISPLAY MODE - SHADING WITH EDGES + SetDisplayMode( 2 ); + break; + case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL + getGeometryGUI()->EmitSignalDeactivateDialog(); + DisplayAll(); + break; + case GEOMOp::OpShowOnly: // POPUP MENU - SHOW ONLY + getGeometryGUI()->EmitSignalDeactivateDialog(); + DisplayOnly(); + break; + case GEOMOp::OpHideAll: // MENU VIEW - HIDE ALL + EraseAll(); + break; + case GEOMOp::OpHide: // POPUP MENU - HIDE + Erase(); + break; + case GEOMOp::OpShow: // POPUP MENU - SHOW + getGeometryGUI()->EmitSignalDeactivateDialog(); + Display(); + break; + case GEOMOp::OpSwitchVectors: // MENU VIEW - DISPLAY MODE - SHOW EDGE DIRECTION + SetVectorMode(!GetVectorMode()); + getGeometryGUI()->action( GEOMOp::OpSwitchVectors )->setText + ( GetVectorMode() ? tr("MEN_VECTOR_MODE_ON") : tr( "MEN_VECTOR_MODE_OFF" ) ); + getGeometryGUI()->menuMgr()->update(); + break; + case GEOMOp::OpWireframe: // POPUP MENU - DISPLAY MODE - WIREFRAME + ChangeDisplayMode( 0 ); + break; + case GEOMOp::OpShading: // POPUP MENU - DISPLAY MODE - SHADING + ChangeDisplayMode( 1 ); + break; + case GEOMOp::OpShadingWithEdges: // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES + ChangeDisplayMode( 2 ); + break; + case GEOMOp::OpTexture: // POPUP MENU - DISPLAY MODE - TEXTURE + ChangeDisplayMode( 3 ); + break; + case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION + ChangeDisplayMode( 4 ); + break; default: - { - app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); - break; - } + app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; } Sel->setSelectedObjects( selected ); return true; @@ -194,8 +200,8 @@ void DisplayGUI::EraseAll() SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); SUIT_ViewManager* vman = vw->getViewManager(); if ( vman->getType() == OCCViewer_Viewer::Type() || - vman->getType() == SVTK_Viewer::Type() ) { - GEOM_Displayer( appStudy ).EraseAll(); + vman->getType() == SVTK_Viewer::Type() ) { + GEOM_Displayer( appStudy ).EraseAll(); } } } @@ -240,25 +246,25 @@ void DisplayGUI::Display() if ( anIObject->hasEntry() ) { _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) ); if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) { - _PTR(SComponent) SC ( SO->GetFatherComponent() ); - // if component is selected - listIO.Clear(); - _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) ); - anIter->InitEx( true ); - while( anIter->More() ) { - _PTR(SObject) valSO ( anIter->Value() ); - _PTR(SObject) refSO; - if ( !valSO->ReferencedObject( refSO ) ) { - listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(), + _PTR(SComponent) SC ( SO->GetFatherComponent() ); + // if component is selected + listIO.Clear(); + _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) ); + anIter->InitEx( true ); + while( anIter->More() ) { + _PTR(SObject) valSO ( anIter->Value() ); + _PTR(SObject) refSO; + if ( !valSO->ReferencedObject( refSO ) ) { + listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(), SC->ComponentDataType().c_str(), valSO->GetName().c_str()) ); - } - anIter->Next(); - } - break; + } + anIter->Next(); + } + break; } else { - listIO.Append( anIObject ); + listIO.Append( anIObject ); } } else { @@ -298,25 +304,25 @@ void DisplayGUI::Erase() if ( anIObject->hasEntry() ) { _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) ); if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) { - _PTR(SComponent) SC ( SO->GetFatherComponent() ); - // if component is selected - listIO.Clear(); - _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) ); - anIter->InitEx( true ); - while( anIter->More() ) { - _PTR(SObject) valSO ( anIter->Value() ); - _PTR(SObject) refSO; - if ( !valSO->ReferencedObject( refSO ) ) { - listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(), + _PTR(SComponent) SC ( SO->GetFatherComponent() ); + // if component is selected + listIO.Clear(); + _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) ); + anIter->InitEx( true ); + while( anIter->More() ) { + _PTR(SObject) valSO ( anIter->Value() ); + _PTR(SObject) refSO; + if ( !valSO->ReferencedObject( refSO ) ) { + listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(), SC->ComponentDataType().c_str(), valSO->GetName().c_str()) ); - } - anIter->Next(); - } - break; + } + anIter->Next(); + } + break; } else { - listIO.Append( anIObject ); + listIO.Append( anIObject ); } } else { @@ -346,60 +352,115 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow ) if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView(); aView->SetDisplayMode( mode ); + GeometryGUI::Modified(); } else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - AIS_DisplayMode newmode = (mode == 1 ? AIS_Shaded : AIS_WireFrame); + + AIS_DisplayMode newmode; + switch (mode) { + case 0: + newmode = AIS_WireFrame; + break; + case 1: + newmode = AIS_Shaded; + break; + case 2: + newmode = AIS_DisplayMode( GEOM_AISShape::ShadingWithEdges ); + break; + case 3: + newmode = AIS_DisplayMode( GEOM_AISShape::TexturedShape ); + break; + default: + break; + } + AIS_ListOfInteractive List; ic->DisplayedObjects( List ); AIS_ListOfInteractive List1; ic->ObjectsInCollector( List1 ); List.Append( List1 ); - + AIS_ListIteratorOfListOfInteractive ite( List ); while( ite.More() ) { if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() ); - ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true ); + if(aSh->isTopLevel()) { + aSh->setPrevDisplayMode(Standard_Integer( newmode )); + } + else { + ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true ); + } } ite.Next(); } - + ic->SetDisplayMode( newmode, Standard_False ); + + GeometryGUI::Modified(); } } //===================================================================================== -// function : DisplayGUI::GetDisplayMode() -// purpose : Get display mode of the viewer (current viewer if - 0 ) +// function : DisplayGUI::SetVectorsMode() +// purpose : Set vector mode for the viewer //===================================================================================== -int DisplayGUI::GetDisplayMode( SUIT_ViewWindow* viewWindow ) +void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow ) { - int dispMode = 0; + SUIT_OverrideCursor(); + if ( !viewWindow ) viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow(); if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { - SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView(); - dispMode = aView->GetDisplayMode(); - } + viewWindow->setProperty( "VectorsMode", mode ); + SVTK_ViewWindow* vw = dynamic_cast( viewWindow ); + vtkActorCollection* allActors = vw->getRenderer()->GetActors(); + allActors->InitTraversal(); + while (vtkActor* actor = allActors->GetNextActor()) { + if (actor->GetVisibility()) { // only for visible actors + GEOM_Actor* aGeomActor = 0; + if ( actor->IsA( "GEOM_Actor" ) ) { + aGeomActor = GEOM_Actor::SafeDownCast( actor ); + if ( aGeomActor ) + aGeomActor->SetVectorMode( mode ); + } + } + } + GeometryGUI::Modified(); + } else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + viewWindow->setProperty( "VectorsMode", mode ); OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode(); - dispMode = (mode == AIS_WireFrame ? 0 : 1 ); + AIS_ListOfInteractive List; + ic->DisplayedObjects( List ); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector( List1 ); + List.Append( List1 ); + + AIS_ListIteratorOfListOfInteractive ite( List ); + while( ite.More() ) { + if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() ); + aSh->SetDisplayVectors(mode); + ic->RecomputePrsOnly(ite.Value()); + } + ite.Next(); + } + GeometryGUI::Modified(); } - return dispMode; } //===================================================================================== -// function : DisplayGUI::InvertDisplayMode() -// purpose : Invert display mode ( shadin <-> wireframe ) for the viewer -// (current viewer if = 0 ) +// function : DisplayGUI::GetVectorMode() +// purpose : Get the "show edge direction" mode of the viewer //===================================================================================== -void DisplayGUI::InvertDisplayMode( SUIT_ViewWindow* viewWindow ) +int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow ) { - SetDisplayMode( 1 - GetDisplayMode( viewWindow ) ); + if ( !viewWindow ) + viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow(); + return viewWindow->property( "VectorsMode" ).toBool(); } //===================================================================================== @@ -418,6 +479,11 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); if ( !aSelMgr ) return; + SalomeApp_Study* aStudy = dynamic_cast(app->activeStudy()); + + if(!aStudy) + return; + SUIT_OverrideCursor(); SALOME_ListIO aList; @@ -425,6 +491,8 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_ViewWindow* vw = dynamic_cast( viewWindow ); SVTK_View* aView = vw->getView(); + int mgrId = viewWindow->getViewManager()->getGlobalId(); + bool vectorMode = false; aSelMgr->selectedObjects( aList ); SALOME_ListIteratorOfListIO It( aList ); @@ -434,13 +502,31 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow SVTK_Prs* vtkPrs = stvkViewer ? dynamic_cast( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0; if ( vtkPrs && !vtkPrs->IsNull() ) { - if ( mode == 0 ) - aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); + if (mode == 0 ) + aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); else if ( mode == 1 ) - aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); + aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); + else if ( mode == 2 ) + aView->ChangeRepresentationToSurfaceWithEdges( vtkPrs->GetObjects() ); + else if ( mode == 4 ) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + while (vtkActor* anAct = anActors->GetNextActor()) { + GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct); + vectorMode = !aGeomActor->GetVectorMode(); + aGeomActor->SetVectorMode(vectorMode); + } + } + if(mode == 0 || mode == 1 || mode == 2) { + aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),DISPLAY_MODE_PROP, mode); + } + else if (mode == 4) { + aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode); + } } } aView->Repaint(); + GeometryGUI::Modified(); } else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); @@ -448,22 +534,47 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow aSelMgr->selectedObjects( aList ); SALOME_ListIteratorOfListIO It( aList ); + int mgrId = viewWindow->getViewManager()->getGlobalId(); + bool vectorMode = 0; for( ;It.More(); It.Next() ) { SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel()); SOCC_Prs* occPrs = dynamic_cast( soccViewer->CreatePrs( It.Value()->getEntry() ) ); if ( occPrs && !occPrs->IsNull() ) { - AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); - AIS_ListIteratorOfListOfInteractive interIter( shapes ); - for ( ; interIter.More(); interIter.Next() ) { - if ( mode == 0 ) - ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); - else if ( mode == 1 ) - ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); + AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); + AIS_ListIteratorOfListOfInteractive interIter( shapes ); + for ( ; interIter.More(); interIter.Next() ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); + if ( !aSh.IsNull() ) { + if(!aSh->isTopLevel()) { + if ( mode == 0 ) + ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); + else if ( mode == 1 ) + ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); + else if ( mode == 2 ) + ic->SetDisplayMode( interIter.Value(), GEOM_AISShape::ShadingWithEdges, false ); + else if ( mode == 3 ) + ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false ); + } else { + aSh->setPrevDisplayMode(mode); + } + if (mode == 4 ) { + vectorMode = !aSh->isShowVectors(); + aSh->SetDisplayVectors(vectorMode); + ic->RecomputePrsOnly(interIter.Value()); + } + } + } + if(mode == 0 || mode == 1 || mode == 2 || mode == 3) { + aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode); + } + else if (mode == 4) { + aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode); } } } ic->UpdateCurrentViewer(); + GeometryGUI::Modified(); } } diff --git a/src/DisplayGUI/DisplayGUI.h b/src/DisplayGUI/DisplayGUI.h index d9e089e2a..a52fe0352 100644 --- a/src/DisplayGUI/DisplayGUI.h +++ b/src/DisplayGUI/DisplayGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : DisplayGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -58,11 +59,13 @@ public: // DISPLAY MODE methods : 0 - wireframe, 1 - shading // Set display mode for the viewer (current viewer if - 0 ) void SetDisplayMode( const int, SUIT_ViewWindow* = 0 ); - // Get display mode of the viewer (current viewer if - 0 ) - int GetDisplayMode( SUIT_ViewWindow* = 0 ); - // Invert display mode ( shadin <-> wireframe ) for the viewer - // (current viewer if = 0 ) - void InvertDisplayMode( SUIT_ViewWindow* = 0 ); + + // VECTOR MODE methods + // Set vectror mode for the viewer + void SetVectorMode( const bool, SUIT_ViewWindow* = 0 ); + // Get vector mode of the viewer + int GetVectorMode( SUIT_ViewWindow* = 0 ); + // Invert vector mode ( shadin <-> wireframe ) for the viewer // Set display mode for selected objects in the viewer given // (current viewer if = 0 ) diff --git a/src/DisplayGUI/DisplayGUI.pro b/src/DisplayGUI/DisplayGUI.pro deleted file mode 100644 index c4ab18b6d..000000000 --- a/src/DisplayGUI/DisplayGUI.pro +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = DisplayGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -VTK_LIBS = -L$$(VTKHOME)/lib/vtk -L$$(VTKHOME)/lib/vtk/python -lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets -lGL -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lX11 -lXt - -QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMBase ../GEOMClient ../GEOMImpl ../GEOMGUI $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOM -lGEOMToolsGUI $${GUI_LDFLAGS} -lsuit -lSVTK -lSOCC -lSalomePrs -lSalomeApp $${VTK_LIBS} $${QT_MT_LIBS} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += DISPLAYGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = DisplayGUI.h - -SOURCES = DisplayGUI.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/DisplayGUI/Makefile.am b/src/DisplayGUI/Makefile.am index 434048fe1..a361cdb10 100644 --- a/src/DisplayGUI/Makefile.am +++ b/src/DisplayGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM DISPLAYGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -53,8 +51,7 @@ libDisplayGUI_la_CPPFLAGS = \ -I$(srcdir)/../OBJECT \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMClient \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libDisplayGUI_la_LDFLAGS = \ ../GEOMGUI/libGEOM.la \ diff --git a/src/DlgRef/DlgRef.cxx b/src/DlgRef/DlgRef.cxx index c22828f46..164f483b4 100644 --- a/src/DlgRef/DlgRef.cxx +++ b/src/DlgRef/DlgRef.cxx @@ -1,27 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : DlgRef.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #include "DlgRef.h" ////////////////////////////////////////// @@ -80,6 +78,20 @@ DlgRef_1Sel1Check::~DlgRef_1Sel1Check() { } +////////////////////////////////////////// +// DlgRef_1Sel1Frame +////////////////////////////////////////// + +DlgRef_1Sel1Frame::DlgRef_1Sel1Frame( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_1Sel1Frame::~DlgRef_1Sel1Frame() +{ +} + ////////////////////////////////////////// // DlgRef_1Sel1List1Check3Btn ////////////////////////////////////////// @@ -178,6 +190,20 @@ DlgRef_1Sel3Spin::~DlgRef_1Sel3Spin() { } +////////////////////////////////////////// +// DlgRef_1Sel3Spin2Check1Spin +////////////////////////////////////////// + +DlgRef_1Sel3Spin2Check1Spin::DlgRef_1Sel3Spin2Check1Spin( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_1Sel3Spin2Check1Spin::~DlgRef_1Sel3Spin2Check1Spin() +{ +} + ////////////////////////////////////////// // DlgRef_1Sel3Spin1Check ////////////////////////////////////////// @@ -192,6 +218,20 @@ DlgRef_1Sel3Spin1Check::~DlgRef_1Sel3Spin1Check() { } +////////////////////////////////////////// +// DlgRef_1Sel4Spin2Check +////////////////////////////////////////// + +DlgRef_1Sel4Spin2Check::DlgRef_1Sel4Spin2Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_1Sel4Spin2Check::~DlgRef_1Sel4Spin2Check() +{ +} + ////////////////////////////////////////// // DlgRef_1Sel4Spin ////////////////////////////////////////// @@ -290,6 +330,20 @@ DlgRef_2Sel1List1Check::~DlgRef_2Sel1List1Check() { } +////////////////////////////////////////// +// DlgRef_2Sel1List2Check +////////////////////////////////////////// + +DlgRef_2Sel1List2Check::DlgRef_2Sel1List2Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_2Sel1List2Check::~DlgRef_2Sel1List2Check() +{ +} + ////////////////////////////////////////// // DlgRef_2Sel1List ////////////////////////////////////////// @@ -318,6 +372,20 @@ DlgRef_2Sel1Spin2Check::~DlgRef_2Sel1Spin2Check() { } +////////////////////////////////////////// +// DlgRef_2Sel1Spin3Check1Spin +////////////////////////////////////////// + +DlgRef_2Sel1Spin3Check1Spin::DlgRef_2Sel1Spin3Check1Spin( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_2Sel1Spin3Check1Spin::~DlgRef_2Sel1Spin3Check1Spin() +{ +} + ////////////////////////////////////////// // DlgRef_2Sel1Spin ////////////////////////////////////////// @@ -332,6 +400,20 @@ DlgRef_2Sel1Spin::~DlgRef_2Sel1Spin() { } +////////////////////////////////////////// +// DlgRef_2Sel1SpinInt +////////////////////////////////////////// + +DlgRef_2Sel1SpinInt::DlgRef_2Sel1SpinInt( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_2Sel1SpinInt::~DlgRef_2Sel1SpinInt() +{ +} + ////////////////////////////////////////// // DlgRef_2Sel2List ////////////////////////////////////////// @@ -360,6 +442,20 @@ DlgRef_2Sel2Spin1Check::~DlgRef_2Sel2Spin1Check() { } +////////////////////////////////////////// +// DlgRef_2Sel2Spin3Check +////////////////////////////////////////// + +DlgRef_2Sel2Spin3Check::DlgRef_2Sel2Spin3Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_2Sel2Spin3Check::~DlgRef_2Sel2Spin3Check() +{ +} + ////////////////////////////////////////// // DlgRef_2Sel2Spin ////////////////////////////////////////// @@ -374,6 +470,34 @@ DlgRef_2Sel2Spin::~DlgRef_2Sel2Spin() { } +////////////////////////////////////////// +// DlgRef_2Sel2Spin1Push +////////////////////////////////////////// + +DlgRef_2Sel2Spin1Push::DlgRef_2Sel2Spin1Push( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_2Sel2Spin1Push::~DlgRef_2Sel2Spin1Push() +{ +} + +////////////////////////////////////////// +// DlgRef_2Sel2Spin2Push +////////////////////////////////////////// + +DlgRef_2Sel2Spin2Push::DlgRef_2Sel2Spin2Push( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_2Sel2Spin2Push::~DlgRef_2Sel2Spin2Push() +{ +} + ////////////////////////////////////////// // DlgRef_2Sel3Spin2Rb ////////////////////////////////////////// @@ -528,6 +652,20 @@ DlgRef_3Sel1Spin::~DlgRef_3Sel1Spin() { } +////////////////////////////////////////// +// DlgRef_3Sel2Spin +////////////////////////////////////////// + +DlgRef_3Sel2Spin::DlgRef_3Sel2Spin( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_3Sel2Spin::~DlgRef_3Sel2Spin() +{ +} + ////////////////////////////////////////// // DlgRef_3Sel3Spin1Check ////////////////////////////////////////// @@ -553,7 +691,37 @@ void DlgRef_3Sel3Spin1Check::ShowRows( int fromRow, int toRow, bool toShow ) int row, col, rowspan, colspan; gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan ); if ( w && row >= fromRow && row <= toRow ) - w->setVisible( toShow ); + w->setVisible( toShow ); + } + } +} + +////////////////////////////////////////// +// DlgRef_3Sel2Check3Spin +////////////////////////////////////////// + +DlgRef_3Sel2Check3Spin::DlgRef_3Sel2Check3Spin( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_3Sel2Check3Spin::~DlgRef_3Sel2Check3Spin() +{ +} + +void DlgRef_3Sel2Check3Spin::ShowRows( int fromRow, int toRow, bool toShow ) +{ + const int maxRows = 8; + + if ( toRow >= fromRow && fromRow >= 0 && toRow <= maxRows ) { + int c = gridLayout1->count(); + for ( int i = 0; i < c; i++ ) { + QWidget* w = gridLayout1->itemAt( i )->widget(); + int row, col, rowspan, colspan; + gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan ); + if ( w && row >= fromRow && row <= toRow ) + w->setVisible( toShow ); } } } @@ -583,7 +751,7 @@ void DlgRef_3Sel3Spin2Check::ShowRows( int fromRow, int toRow, bool toShow ) int row, col, rowspan, colspan; gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan ); if ( w && row >= fromRow && row <= toRow ) - w->setVisible( toShow ); + w->setVisible( toShow ); } } } @@ -644,6 +812,20 @@ DlgRef_3Spin::~DlgRef_3Spin() { } +////////////////////////////////////////// +// DlgRef_4Spin +////////////////////////////////////////// + +DlgRef_4Spin::DlgRef_4Spin( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_4Spin::~DlgRef_4Spin() +{ +} + ////////////////////////////////////////// // DlgRef_4Sel1List1Check ////////////////////////////////////////// @@ -697,7 +879,7 @@ void DlgRef_4Sel1Spin2Check::ShowRows( int fromRow, int toRow, bool toShow ) int row, col, rowspan, colspan; gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan ); if ( w && row >= fromRow && row <= toRow ) - w->setVisible( toShow ); + w->setVisible( toShow ); } } } @@ -752,39 +934,36 @@ QString DlgRef::PrintDoubleValue( double theValue, int thePrecision ) { const double prec = 1e-12; - if ( abs(theValue) < thePrecision) + if ( qAbs(theValue) < prec ) return "0"; - QString aRes; - aRes.setNum( theValue, 'g', thePrecision ); + QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( thePrecision ) ); if ( prec > 0 ) { int p = 0; while ( p < thePrecision ) { - aRes.setNum( theValue, 'g', p++ ); + QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( p++ ) ); double v = aRes.toDouble(); double err = qAbs( theValue - v ); if ( err > 0 && err <= prec ) - break; + break; } } // remove trailing zeroes - QString delim( "." ); - int idx = aRes.lastIndexOf( delim ); - if ( idx == -1 ) - return aRes; + QRegExp expre( QString( "(%1|%2)[+-]?[0-9]+$" ).arg( QLocale().exponential().toLower(), + QLocale().exponential().toUpper() ) ); - QString iPart = aRes.left( idx ); - QString fPart = aRes.mid( idx + 1 ); - - while ( !fPart.isEmpty() && fPart.at( fPart.length() - 1 ) == '0' ) - fPart.remove( fPart.length() - 1, 1 ); + int idx = aRes.indexOf( expre ); + QString aResExp = ""; + if ( idx >= 0 ) { + aResExp = aRes.mid( idx ); + aRes = aRes.left( idx ); + } - aRes = iPart; - if ( !fPart.isEmpty() ) - aRes += delim + fPart; + if ( aRes.contains( QLocale().decimalPoint() ) ) + aRes.remove( QRegExp( QString( "(\\%1|0)0*$" ).arg( QLocale().decimalPoint() ) ) ); - return aRes; + return aRes == "-0" ? QString( "0" ) : aRes + aResExp; } diff --git a/src/DlgRef/DlgRef.h b/src/DlgRef/DlgRef.h index d786fe841..bda6da5b5 100644 --- a/src/DlgRef/DlgRef.h +++ b/src/DlgRef/DlgRef.h @@ -1,32 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : DlgRef.h // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #ifndef GEOM_DLGREF_H #define GEOM_DLGREF_H #if defined WIN32 -# if defined DLGREF_EXPORTS +# if defined DLGREF_EXPORTS || defined DlgRef_EXPORTS # define DLGREF_EXPORT __declspec( dllexport ) # else # define DLGREF_EXPORT __declspec( dllimport ) @@ -42,7 +40,7 @@ #include "ui_DlgRef_1List1Spin1Btn_QTD.h" class DLGREF_EXPORT DlgRef_1List1Spin1Btn : public QWidget, - public Ui::DlgRef_1List1Spin1Btn_QTD + public Ui::DlgRef_1List1Spin1Btn_QTD { Q_OBJECT @@ -58,7 +56,7 @@ public: #include "ui_DlgRef_1Sel1Check1List_QTD.h" class DLGREF_EXPORT DlgRef_1Sel1Check1List : public QWidget, - public Ui::DlgRef_1Sel1Check1List_QTD + public Ui::DlgRef_1Sel1Check1List_QTD { Q_OBJECT @@ -74,7 +72,7 @@ public: #include "ui_DlgRef_1Sel1Check1Sel_QTD.h" class DLGREF_EXPORT DlgRef_1Sel1Check1Sel : public QWidget, - public Ui::DlgRef_1Sel1Check1Sel_QTD + public Ui::DlgRef_1Sel1Check1Sel_QTD { Q_OBJECT @@ -90,7 +88,7 @@ public: #include "ui_DlgRef_1Sel1Check_QTD.h" class DLGREF_EXPORT DlgRef_1Sel1Check : public QWidget, - public Ui::DlgRef_1Sel1Check_QTD + public Ui::DlgRef_1Sel1Check_QTD { Q_OBJECT @@ -99,6 +97,22 @@ public: ~DlgRef_1Sel1Check(); }; +////////////////////////////////////////// +// DlgRef_1Sel1Frame +////////////////////////////////////////// + +#include "ui_DlgRef_1Sel1Frame_QTD.h" + +class DLGREF_EXPORT DlgRef_1Sel1Frame : public QWidget, + public Ui::DlgRef_1Sel1Frame_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel1Frame( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_1Sel1Frame(); +}; + ////////////////////////////////////////// // DlgRef_1Sel1List1Check3Btn ////////////////////////////////////////// @@ -106,7 +120,7 @@ public: #include "ui_DlgRef_1Sel1List1Check3Btn_QTD.h" class DLGREF_EXPORT DlgRef_1Sel1List1Check3Btn : public QWidget, - public Ui::DlgRef_1Sel1List1Check3Btn_QTD + public Ui::DlgRef_1Sel1List1Check3Btn_QTD { Q_OBJECT @@ -122,7 +136,7 @@ public: #include "ui_DlgRef_1Sel1Spin1Check_QTD.h" class DLGREF_EXPORT DlgRef_1Sel1Spin1Check : public QWidget, - public Ui::DlgRef_1Sel1Spin1Check_QTD + public Ui::DlgRef_1Sel1Spin1Check_QTD { Q_OBJECT @@ -138,7 +152,7 @@ public: #include "ui_DlgRef_1Sel1Spin_QTD.h" class DLGREF_EXPORT DlgRef_1Sel1Spin : public QWidget, - public Ui::DlgRef_1Sel1Spin_QTD + public Ui::DlgRef_1Sel1Spin_QTD { Q_OBJECT @@ -213,6 +227,22 @@ public: ~DlgRef_1Sel3Spin(); }; +////////////////////////////////////////// +// DlgRef_1Sel3Spin2Check1Spin +////////////////////////////////////////// + +#include "ui_DlgRef_1Sel3Spin2Check1Spin_QTD.h" + +class DLGREF_EXPORT DlgRef_1Sel3Spin2Check1Spin : public QWidget, + public Ui::DlgRef_1Sel3Spin2Check1Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel3Spin2Check1Spin( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_1Sel3Spin2Check1Spin(); +}; + ////////////////////////////////////////// // DlgRef_1Sel3Spin1Check ////////////////////////////////////////// @@ -229,6 +259,22 @@ public: ~DlgRef_1Sel3Spin1Check(); }; +////////////////////////////////////////// +// DlgRef_1Sel4Spin2Check +////////////////////////////////////////// + +#include "ui_DlgRef_1Sel4Spin2Check_QTD.h" + +class DLGREF_EXPORT DlgRef_1Sel4Spin2Check : public QWidget, + public Ui::DlgRef_1Sel4Spin2Check_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel4Spin2Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_1Sel4Spin2Check(); +}; + ////////////////////////////////////////// // DlgRef_1Sel4Spin ////////////////////////////////////////// @@ -341,6 +387,22 @@ public: ~DlgRef_2Sel1List1Check(); }; +////////////////////////////////////////// +// DlgRef_2Sel1List2Check +////////////////////////////////////////// + +#include "ui_DlgRef_2Sel1List2Check_QTD.h" + +class DLGREF_EXPORT DlgRef_2Sel1List2Check : public QWidget, + public Ui::DlgRef_2Sel1List2Check_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel1List2Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_2Sel1List2Check(); +}; + ////////////////////////////////////////// // DlgRef_2Sel1List ////////////////////////////////////////// @@ -373,6 +435,22 @@ public: ~DlgRef_2Sel1Spin2Check(); }; +////////////////////////////////////////// +// DlgRef_2Sel1Spin3Check1Spin +////////////////////////////////////////// + +#include "ui_DlgRef_2Sel1Spin3Check1Spin_QTD.h" + +class DLGREF_EXPORT DlgRef_2Sel1Spin3Check1Spin : public QWidget, + public Ui::DlgRef_2Sel1Spin3Check1Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel1Spin3Check1Spin( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_2Sel1Spin3Check1Spin(); +}; + ////////////////////////////////////////// // DlgRef_2Sel1Spin ////////////////////////////////////////// @@ -389,6 +467,22 @@ public: ~DlgRef_2Sel1Spin(); }; +////////////////////////////////////////// +// DlgRef_2Sel1SpinInt +////////////////////////////////////////// + +#include "ui_DlgRef_2Sel1SpinInt_QTD.h" + +class DLGREF_EXPORT DlgRef_2Sel1SpinInt : public QWidget, + public Ui::DlgRef_2Sel1SpinInt_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel1SpinInt( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_2Sel1SpinInt(); +}; + ////////////////////////////////////////// // DlgRef_2Sel2List ////////////////////////////////////////// @@ -421,6 +515,22 @@ public: ~DlgRef_2Sel2Spin1Check(); }; +////////////////////////////////////////// +// DlgRef_2Sel2Spin3Check +////////////////////////////////////////// + +#include "ui_DlgRef_2Sel2Spin3Check_QTD.h" + +class DLGREF_EXPORT DlgRef_2Sel2Spin3Check : public QWidget, + public Ui::DlgRef_2Sel2Spin3Check_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin3Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_2Sel2Spin3Check(); +}; + ////////////////////////////////////////// // DlgRef_2Sel2Spin ////////////////////////////////////////// @@ -437,6 +547,38 @@ public: ~DlgRef_2Sel2Spin(); }; +////////////////////////////////////////// +// DlgRef_2Sel2Spin1Push +////////////////////////////////////////// + +#include "ui_DlgRef_2Sel2Spin1Push_QTD.h" + +class DLGREF_EXPORT DlgRef_2Sel2Spin1Push : public QWidget, + public Ui::DlgRef_2Sel2Spin1Push_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin1Push( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_2Sel2Spin1Push(); +}; + +////////////////////////////////////////// +// DlgRef_2Sel2Spin2Push +////////////////////////////////////////// + +#include "ui_DlgRef_2Sel2Spin2Push_QTD.h" + +class DLGREF_EXPORT DlgRef_2Sel2Spin2Push : public QWidget, + public Ui::DlgRef_2Sel2Spin2Push_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin2Push( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_2Sel2Spin2Push(); +}; + ////////////////////////////////////////// // DlgRef_2Sel3Spin2Rb ////////////////////////////////////////// @@ -613,6 +755,22 @@ public: ~DlgRef_3Sel1Spin(); }; +////////////////////////////////////////// +// DlgRef_3Sel2Spin +////////////////////////////////////////// + +#include "ui_DlgRef_3Sel2Spin_QTD.h" + +class DLGREF_EXPORT DlgRef_3Sel2Spin : public QWidget, + public Ui::DlgRef_3Sel2Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_3Sel2Spin( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_3Sel2Spin(); +}; + ////////////////////////////////////////// // DlgRef_3Sel3Spin1Check ////////////////////////////////////////// @@ -631,6 +789,24 @@ public: void ShowRows( int, int, bool = true ); }; +////////////////////////////////////////// +// DlgRef_3Sel2Check3Spin +////////////////////////////////////////// + +#include "ui_DlgRef_3Sel2Check3Spin_QTD.h" + +class DLGREF_EXPORT DlgRef_3Sel2Check3Spin : public QWidget, + public Ui::DlgRef_3Sel2Check3Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_3Sel2Check3Spin( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_3Sel2Check3Spin(); + + void ShowRows( int, int, bool = true ); +}; + ////////////////////////////////////////// // DlgRef_3Sel3Spin2Check ////////////////////////////////////////// @@ -713,6 +889,22 @@ public: ~DlgRef_3Spin(); }; +////////////////////////////////////////// +// DlgRef_4Spin +////////////////////////////////////////// + +#include "ui_DlgRef_4Spin_QTD.h" + +class DLGREF_EXPORT DlgRef_4Spin : public QWidget, + public Ui::DlgRef_4Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_4Spin( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_4Spin(); +}; + ////////////////////////////////////////// // DlgRef_4Sel1List1Check ////////////////////////////////////////// diff --git a/src/DlgRef/DlgRef.pro b/src/DlgRef/DlgRef.pro deleted file mode 100644 index 1abf89059..000000000 --- a/src/DlgRef/DlgRef.pro +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = DlgRef -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL - -INCLUDEPATH += $${QT_INCLUDES} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} - -LIBS += $${GUI_LDFLAGS} -lqtx $${STDLIB} $${QT_MT_LIBS} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += DLGREF_EXPORTS - -HEADERS = DlgRef_Skeleton_QTD.h -HEADERS += DlgRef_1Sel_QTD.h -HEADERS += DlgRef_2Sel_QTD.h -HEADERS += DlgRef_3Sel_QTD.h -HEADERS += DlgRef_1Sel1Check_QTD.h -HEADERS += DlgRef_1Sel3Check_QTD.h -HEADERS += DlgRef_1Sel1Check1List_QTD.h -HEADERS += DlgRef_1Sel1Spin_QTD.h -HEADERS += DlgRef_1Sel2Spin_QTD.h -HEADERS += DlgRef_1Sel3Spin_QTD.h -HEADERS += DlgRef_1Sel4Spin_QTD.h -HEADERS += DlgRef_1Sel5Spin_QTD.h -HEADERS += DlgRef_2Sel1Spin_QTD.h -HEADERS += DlgRef_2Sel2Spin_QTD.h -HEADERS += DlgRef_2Sel3Spin_QTD.h -HEADERS += DlgRef_1Sel1Spin1Check_QTD.h -HEADERS += DlgRef_1Sel3Spin1Check_QTD.h -HEADERS += DlgRef_2Sel1Spin2Check_QTD.h -HEADERS += DlgRef_2Sel2Spin1Check_QTD.h -HEADERS += DlgRef_2Sel4Spin1Check_QTD.h -HEADERS += DlgRef_3Sel4Spin2Check_QTD.h -HEADERS += DlgRef_4Sel1List_QTD.h -HEADERS += DlgRef_2Sel1List_QTD.h -HEADERS += DlgRef_1List1Spin1Btn_QTD.h -HEADERS += DlgRef_4Sel1List1Check_QTD.h -HEADERS += DlgRef_1Spin_QTD.h -HEADERS += DlgRef_2Spin_QTD.h -HEADERS += DlgRef_3Spin_QTD.h -HEADERS += DlgRef_3Spin1Check_QTD.h -HEADERS += DlgRef_3Sel3Spin1Check_QTD.h -HEADERS += DlgRef_4Sel1Spin2Check_QTD.h -HEADERS += DlgRef_4Sel1Spin3Check_QTD.h -HEADERS += DlgRef_SpinBox.h -HEADERS += DlgRef_1Sel1Spin.h -HEADERS += DlgRef_1Sel2Spin.h -HEADERS += DlgRef_1Sel3Spin.h -HEADERS += DlgRef_1Sel4Spin.h -HEADERS += DlgRef_1Sel5Spin.h -HEADERS += DlgRef_2Sel1Spin.h -HEADERS += DlgRef_2Sel2Spin.h -HEADERS += DlgRef_2Sel3Spin.h -HEADERS += DlgRef_1Sel1Spin1Check.h -HEADERS += DlgRef_1Sel3Spin1Check.h -HEADERS += DlgRef_2Sel1Spin2Check.h -HEADERS += DlgRef_2Sel2Spin1Check.h -HEADERS += DlgRef_2Sel4Spin1Check.h -HEADERS += DlgRef_3Sel4Spin2Check.h -HEADERS += DlgRef_3Sel3Spin1Check.h -HEADERS += DlgRef_1Spin.h -HEADERS += DlgRef_2Spin.h -HEADERS += DlgRef_3Spin.h -HEADERS += DlgRef_3Spin1Check.h -HEADERS += DlgRef_3Sel1Spin.h -HEADERS += DlgRef_1Sel_Ext.h -HEADERS += DlgRef_3Check_QTD.h -HEADERS += DlgRef_6Sel_QTD.h -HEADERS += DlgRef_4Sel1Spin2Check.h -HEADERS += DlgRef_3Sel1Check_QTD.h -HEADERS += GEOM_DlgRef.hxx - -SOURCES = DlgRef_SpinBox.cxx -SOURCES += DlgRef_1Sel1Spin.cxx -SOURCES += DlgRef_1Sel2Spin.cxx -SOURCES += DlgRef_1Sel3Spin.cxx -SOURCES += DlgRef_1Sel4Spin.cxx -SOURCES += DlgRef_1Sel5Spin.cxx -SOURCES += DlgRef_2Sel1Spin.cxx -SOURCES += DlgRef_2Sel2Spin.cxx -SOURCES += DlgRef_2Sel3Spin.cxx -SOURCES += DlgRef_1Sel1Spin1Check.cxx -SOURCES += DlgRef_1Sel3Spin1Check.cxx -SOURCES += DlgRef_2Sel1Spin2Check.cxx -SOURCES += DlgRef_2Sel2Spin1Check.cxx -SOURCES += DlgRef_2Sel4Spin1Check.cxx -SOURCES += DlgRef_3Sel4Spin2Check.cxx -SOURCES += DlgRef_3Sel3Spin1Check.cxx -SOURCES += DlgRef_1Spin.cxx -SOURCES += DlgRef_2Spin.cxx -SOURCES += DlgRef_3Spin.cxx -SOURCES += DlgRef_3Spin1Check.cxx -SOURCES += DlgRef_3Sel1Spin.cxx -SOURCES += DlgRef_4Sel1Spin2Check.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.ui b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.ui index 67e158a1b..a1d5853ca 100644 --- a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.ui @@ -31,10 +31,21 @@ 6 - - + + + + + 0 + 0 + 0 + 0 + + - + TL1 + + + false @@ -53,8 +64,11 @@ - - + + + + + 0 @@ -64,16 +78,13 @@ - TL1 + TL2 false - - - @@ -86,21 +97,10 @@ - - - - - 0 - 0 - 0 - 0 - - + + - TL2 - - - false + diff --git a/src/DlgRef/DlgRef_1Sel1Frame_QTD.ui b/src/DlgRef/DlgRef_1Sel1Frame_QTD.ui new file mode 100644 index 000000000..c4e51d14e --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Frame_QTD.ui @@ -0,0 +1,142 @@ + + + DlgRef_1Sel1Frame_QTD + + + + 0 + 0 + 265 + 149 + + + + + 0 + 0 + + + + + + + + 0 + + + 6 + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + TextLabel + + + + + + + + + + Qt::Vertical + + + + 20 + 61 + + + + + + + + + + + qPixmapFromMimeSource + + PushButton1 + LineEdit1 + PushButton2 + + + + diff --git a/src/DlgRef/DlgRef_1Sel1List1Check3Btn_QTD.ui b/src/DlgRef/DlgRef_1Sel1List1Check3Btn_QTD.ui index 366d2d6ee..562f2cef8 100644 --- a/src/DlgRef/DlgRef_1Sel1List1Check3Btn_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel1List1Check3Btn_QTD.ui @@ -72,53 +72,67 @@ - + - + + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + false + + + + + + + + 7 + 0 + 0 + 0 + + + + + - + - - - - + - + - - - - Qt::Vertical - - - - 20 - 21 - - - - diff --git a/src/DlgRef/DlgRef_1Sel3Spin2Check1Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel3Spin2Check1Spin_QTD.ui new file mode 100644 index 000000000..0eeeedded --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Spin2Check1Spin_QTD.ui @@ -0,0 +1,180 @@ + + + DlgRef_1Sel3Spin2Check1Spin_QTD + + + + 0 + 0 + 196 + 183 + + + + + + + + 0 + + + 6 + + + + + + + + + 6 + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + TL5 + + + false + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + SpinBox_DX + SpinBox_DY + SpinBox_DZ + SpinBox_SC + CheckBox1 + CheckBox2 + + + +
    diff --git a/src/DlgRef/DlgRef_1Sel4Spin2Check_QTD.ui b/src/DlgRef/DlgRef_1Sel4Spin2Check_QTD.ui new file mode 100644 index 000000000..a6c6a6391 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel4Spin2Check_QTD.ui @@ -0,0 +1,211 @@ + + DlgRef_1Sel4Spin2Check_QTD + + + + 0 + 0 + 156 + 120 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + 6 + + + + + + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + + 0 + 0 + + + + TL5 + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + SpinBox_DX + SpinBox_DY + SpinBox_DZ + SpinBox_SC + CheckBox1 + CheckBox2 + + + +
    diff --git a/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui index 5bb4e299c..43cbcba2b 100644 --- a/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel4Spin_QTD.ui @@ -72,7 +72,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -150,7 +150,7 @@ - + @@ -196,9 +196,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui index 3c50b200c..39c97be4f 100644 --- a/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui @@ -1,172 +1,187 @@ - + + DlgRef_1Sel5Spin1Check_QTD - - + + 0 0 - 165 - 125 + 200 + 162 - + - - + + 0 - - 0 - - - 0 - - - 0 - - - - + + + - - - - - + + + + + 0 0 - + TL1 - + false - - - - + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + 0 0 - - + + TL7 + + + false - - + + - - - - - - + + + + + + 0 0 - + TL2 - + false - - - - - - - + + + + 0 0 - + TL3 - + false - - + + - - - - + + + + 0 0 - + TL5 - + false - - - - - - - + + + + 0 0 - + TL6 - + false - - + + - - - - + + + + 0 0 - + TL4 - + false - - - - - - + + + + + + + + + + + + @@ -178,12 +193,18 @@ SalomeApp_DoubleSpinBox QDoubleSpinBox -
    SalomeApp_DoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    +
    + + SalomeApp_IntSpinBox + QSpinBox +
    SalomeApp_IntSpinBox.h
    PushButton1 LineEdit1 + ComboBox1 SpinBox1 SpinBox2 SpinBox4 diff --git a/src/DlgRef/DlgRef_1Sel5Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel5Spin_QTD.ui index eb2fd7743..1b945b5a8 100644 --- a/src/DlgRef/DlgRef_1Sel5Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel5Spin_QTD.ui @@ -108,7 +108,7 @@
    - + @@ -127,7 +127,7 @@ - + @@ -146,13 +146,13 @@ - + - + - + @@ -213,9 +213,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_2Sel1List2Check_QTD.ui b/src/DlgRef/DlgRef_2Sel1List2Check_QTD.ui new file mode 100644 index 000000000..8cc018c02 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1List2Check_QTD.ui @@ -0,0 +1,151 @@ + + + DlgRef_2Sel1List2Check_QTD + + + + 0 + 0 + 127 + 140 + + + + + + + + 0 + + + 0 + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + qPixmapFromMimeSource + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + ComboBox1 + CheckButton1 + CheckButton2 + + + + diff --git a/src/DlgRef/DlgRef_2Sel1Spin3Check1Spin_QTD.ui b/src/DlgRef/DlgRef_2Sel1Spin3Check1Spin_QTD.ui new file mode 100644 index 000000000..479e7bd81 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin3Check1Spin_QTD.ui @@ -0,0 +1,182 @@ + + + DlgRef_2Sel1Spin3Check1Spin_QTD + + + + 0 + 0 + 196 + 181 + + + + + + + + 0 + + + 0 + + + + + + + + + 6 + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + SpinBox_DX + SpinBox_DY + CheckBox1 + CheckBox2 + CheckBox3 + + + +
    diff --git a/src/DlgRef/DlgRef_2Sel1SpinInt_QTD.ui b/src/DlgRef/DlgRef_2Sel1SpinInt_QTD.ui new file mode 100644 index 000000000..c86bf826b --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1SpinInt_QTD.ui @@ -0,0 +1,169 @@ + + DlgRef_2Sel1SpinInt_QTD + + + + 0 + 0 + 156 + 99 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_IntSpinBox + QSpinBox +
    SalomeApp_IntSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + + + +
    diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui index 07800a567..6a0b63ac2 100644 --- a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui @@ -63,7 +63,7 @@
    - + @@ -177,6 +177,11 @@ QDoubleSpinBox
    SalomeApp_DoubleSpinBox.h
    + + SalomeApp_IntSpinBox + QSpinBox +
    SalomeApp_IntSpinBox.h
    +
    PushButton1 diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Push_QTD.ui b/src/DlgRef/DlgRef_2Sel2Spin1Push_QTD.ui new file mode 100644 index 000000000..d24095449 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin1Push_QTD.ui @@ -0,0 +1,156 @@ + + + DlgRef_2Sel2Spin1Push_QTD + + + + 0 + 0 + 281 + 150 + + + + + + + + 0 + + + 0 + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + + + + + + true + + + + + + + TL4 + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + SpinBox_DX + SpinBox_DY + + + +
    diff --git a/src/DlgRef/DlgRef_2Sel2Spin2Push_QTD.ui b/src/DlgRef/DlgRef_2Sel2Spin2Push_QTD.ui new file mode 100644 index 000000000..625ad9d62 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin2Push_QTD.ui @@ -0,0 +1,173 @@ + + + DlgRef_2Sel2Spin2Push_QTD + + + + 0 + 0 + 281 + 165 + + + + + + + + 0 + + + 0 + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + TL4 + + + + + + + + + + true + + + + + + + + + + + + + true + + + + + + + TL5 + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + SpinBox_DX + SpinBox_DY + + + +
    diff --git a/src/DlgRef/DlgRef_2Sel2Spin3Check_QTD.ui b/src/DlgRef/DlgRef_2Sel2Spin3Check_QTD.ui new file mode 100644 index 000000000..1d7620087 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin3Check_QTD.ui @@ -0,0 +1,208 @@ + + DlgRef_2Sel2Spin3Check_QTD + + + + 0 + 0 + 156 + 197 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + SpinBox_DX + SpinBox_DY + CheckBox1 + CheckBox2 + CheckBox3 + + + +
    diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui index 27e0b7e56..5d0afce71 100644 --- a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui @@ -63,13 +63,13 @@
    - + - + @@ -215,6 +215,11 @@ QDoubleSpinBox
    SalomeApp_DoubleSpinBox.h
    + + SalomeApp_IntSpinBox + QSpinBox +
    SalomeApp_IntSpinBox.h
    +
    PushButton1 diff --git a/src/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui b/src/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui index 74e1d6bcc..f6f82c007 100644 --- a/src/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui +++ b/src/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui @@ -37,7 +37,7 @@
    - + @@ -62,8 +62,8 @@ - - + + 0 @@ -71,31 +71,34 @@ - TL1 + TL2 false - - - - - 0 - 0 - + + + + + + + Qt::Vertical - - + + + 256 + 19 + - + - + - - + + 0 @@ -103,30 +106,35 @@ - TL2 + TL1 false - - - - - - - Qt::Vertical + + + + + 0 + 0 + - - - 256 - 19 - + + - + + TextLabel2 + SpinBox_DX + RadioButton1 + RadioButton2 + RadioButton3 + LineEdit1 + TextLabel1 + PushButton1
    @@ -141,8 +149,6 @@ - PushButton1 - LineEdit1 SpinBox_DX diff --git a/src/DlgRef/DlgRef_3Sel2Check3Spin_QTD.ui b/src/DlgRef/DlgRef_3Sel2Check3Spin_QTD.ui new file mode 100644 index 000000000..7d6b025ed --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel2Check3Spin_QTD.ui @@ -0,0 +1,225 @@ + + + DlgRef_3Sel2Check3Spin_QTD + + + + 0 + 0 + 196 + 216 + + + + + + + + 0 + + + + + + + + + 6 + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + 0 + 0 + + + + TL5 + + + false + + + + + + + + + + + 0 + 0 + + + + TL6 + + + false + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + PushButton3 + LineEdit3 + SpinBox1 + SpinBox2 + SpinBox3 + CheckBox1 + CheckBox2 + + + +
    diff --git a/src/DlgRef/DlgRef_3Sel2Spin_QTD.ui b/src/DlgRef/DlgRef_3Sel2Spin_QTD.ui new file mode 100644 index 000000000..509282969 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel2Spin_QTD.ui @@ -0,0 +1,199 @@ + + DlgRef_3Sel2Spin_QTD + + + + 0 + 0 + 120 + 177 + + + + + 0 + 0 + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + 0 + 0 + + + + TL5 + + + false + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + PushButton3 + LineEdit3 + SpinBox_DX + + + +
    diff --git a/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.ui b/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.ui index ac29be9fd..e04d28795 100644 --- a/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.ui @@ -75,13 +75,13 @@
    - + - + - + @@ -236,9 +236,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui index 41fcdd0d0..27e9963dd 100644 --- a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui @@ -56,13 +56,13 @@ 6
    - + - + @@ -254,6 +254,11 @@ QDoubleSpinBox
    SalomeApp_DoubleSpinBox.h
    + + SalomeApp_IntSpinBox + QSpinBox +
    SalomeApp_IntSpinBox.h
    +
    PushButton1 diff --git a/src/DlgRef/DlgRef_4Spin_QTD.ui b/src/DlgRef/DlgRef_4Spin_QTD.ui new file mode 100644 index 000000000..ae4643041 --- /dev/null +++ b/src/DlgRef/DlgRef_4Spin_QTD.ui @@ -0,0 +1,126 @@ + + + DlgRef_4Spin_QTD + + + + 0 + 0 + 342 + 91 + + + + + + + + 0 + + + 0 + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + SpinBox_DX1 + SpinBox_DY1 + SpinBox_DX2 + + + +
    diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.ui b/src/DlgRef/DlgRef_Skeleton_QTD.ui index 02624d442..4b52e61a2 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/DlgRef_Skeleton_QTD.ui @@ -121,7 +121,7 @@ - + @@ -129,6 +129,20 @@ + + + + + + + + + + + + + +
    @@ -210,6 +224,8 @@
    CheckBoxRestoreSS + CheckBoxAddPrefix + CheckBoxPreview buttonOk buttonApply buttonCancel diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index 3a4606f02..deaa27026 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -1,29 +1,27 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM DLGREF : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : DlgRef -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # Libraries targets @@ -42,6 +40,7 @@ UIC_FILES = \ ui_DlgRef_1Sel1Check1List_QTD.h \ ui_DlgRef_1Sel1Check1Sel_QTD.h \ ui_DlgRef_1Sel1Check_QTD.h \ + ui_DlgRef_1Sel1Frame_QTD.h \ ui_DlgRef_1Sel1List1Check3Btn_QTD.h \ ui_DlgRef_1Sel1Spin1Check_QTD.h \ ui_DlgRef_1Sel1Spin_QTD.h \ @@ -50,6 +49,8 @@ UIC_FILES = \ ui_DlgRef_1Sel3Check_QTD.h \ ui_DlgRef_1Sel3Spin_QTD.h \ ui_DlgRef_1Sel3Spin1Check_QTD.h \ + ui_DlgRef_1Sel3Spin2Check1Spin_QTD.h \ + ui_DlgRef_1Sel4Spin2Check_QTD.h \ ui_DlgRef_1Sel4Spin_QTD.h \ ui_DlgRef_1Sel5Spin1Check_QTD.h \ ui_DlgRef_1Sel5Spin_QTD.h \ @@ -57,12 +58,18 @@ UIC_FILES = \ ui_DlgRef_1SelExt_QTD.h \ ui_DlgRef_1Spin_QTD.h \ ui_DlgRef_2Sel1List1Check_QTD.h \ + ui_DlgRef_2Sel1List2Check_QTD.h \ ui_DlgRef_2Sel1List_QTD.h \ ui_DlgRef_2Sel1Spin2Check_QTD.h \ + ui_DlgRef_2Sel1Spin3Check1Spin_QTD.h \ ui_DlgRef_2Sel1Spin_QTD.h \ + ui_DlgRef_2Sel1SpinInt_QTD.h \ ui_DlgRef_2Sel2List_QTD.h \ ui_DlgRef_2Sel2Spin1Check_QTD.h \ + ui_DlgRef_2Sel2Spin3Check_QTD.h \ ui_DlgRef_2Sel2Spin_QTD.h \ + ui_DlgRef_2Sel2Spin1Push_QTD.h \ + ui_DlgRef_2Sel2Spin2Push_QTD.h \ ui_DlgRef_2Sel3Spin2Rb_QTD.h \ ui_DlgRef_2Sel3Spin_QTD.h \ ui_DlgRef_2Sel4Spin1Check_QTD.h \ @@ -73,7 +80,9 @@ UIC_FILES = \ ui_DlgRef_3Radio_QTD.h \ ui_DlgRef_3Radio1Sel1Spin_QTD.h \ ui_DlgRef_3Sel1Check_QTD.h \ + ui_DlgRef_3Sel2Check3Spin_QTD.h \ ui_DlgRef_3Sel1Spin_QTD.h \ + ui_DlgRef_3Sel2Spin_QTD.h \ ui_DlgRef_3Sel3Spin1Check_QTD.h \ ui_DlgRef_3Sel3Spin2Check_QTD.h \ ui_DlgRef_3Sel4Spin2Check_QTD.h \ @@ -84,9 +93,15 @@ UIC_FILES = \ ui_DlgRef_4Sel1List_QTD.h \ ui_DlgRef_4Sel1Spin2Check_QTD.h \ ui_DlgRef_4Sel1Spin3Check_QTD.h \ + ui_DlgRef_4Spin_QTD.h \ ui_DlgRef_6Sel_QTD.h \ ui_DlgRef_Skeleton_QTD.h +ADVANCED_UIC_FILES = +##@@ insert new functions before this line @@ do not remove this line @@## + +UIC_FILES += $(ADVANCED_UIC_FILES) + BUILT_SOURCES = $(UIC_FILES) nodist_libDlgRef_la_SOURCES = \ @@ -101,4 +116,5 @@ libDlgRef_la_CPPFLAGS = \ libDlgRef_la_LDFLAGS = \ $(STDLIB) \ - $(QT_MT_LIBS) + $(QT_MT_LIBS) \ + $(GUI_LDFLAGS) -lqtx -lSalomeApp diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx index 25e0103f6..eded6c0c9 100644 --- a/src/EntityGUI/EntityGUI.cxx +++ b/src/EntityGUI/EntityGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -26,19 +27,32 @@ #include "EntityGUI.h" #include +#include "GeometryGUI_Operations.h" +#include #include #include #include #include +#include +#include #include #include #include +#include +#include +#include +#include + +#include +#include -#include "EntityGUI_SketcherDlg.h" // Sketcher -#include "EntityGUI_3DSketcherDlg.h" // Sketcher -#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE +#include "EntityGUI_SketcherDlg.h" // Sketcher +#include "EntityGUI_3DSketcherDlg.h" // Sketcher +#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE +#include "EntityGUI_FeatureDetectorDlg.h" // Feature Detection +#include "EntityGUI_PictureImportDlg.h" // Import Picture in viewer //======================================================================= // function : EntityGUI() @@ -72,16 +86,24 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; switch ( theCommandID ) { - case 404: // SKETCHER + case GEOMOp::Op2dSketcher: // 2D SKETCHER getGeometryGUI()->ActiveWorkingPlane(); aDlg = new EntityGUI_SketcherDlg( getGeometryGUI(), parent ); break; - case 405: // 3D SKETCHER + case GEOMOp::Op3dSketcher: // 3D SKETCHER aDlg = new EntityGUI_3DSketcherDlg( getGeometryGUI(), parent ); break; - case 407: // EXPLODE : use ic + case GEOMOp::OpExplode: // EXPLODE aDlg = new EntityGUI_SubShapeDlg( getGeometryGUI(), parent ); break; +#ifdef WITH_OPENCV + case GEOMOp::OpFeatureDetect: // FEATURE DETECTION + aDlg = new EntityGUI_FeatureDetectorDlg( getGeometryGUI(), parent ); + break; +#endif + case GEOMOp::OpPictureImport: // IMPORT PICTURE IN VIEWER + aDlg = new EntityGUI_PictureImportDlg( getGeometryGUI(), parent ); + break; default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; @@ -92,6 +114,168 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) return true; } +//================================================================================= +// function : 0nMousePress() +// purpose : [static] manage mouse events +//================================================================================= +bool EntityGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow ) +{ + QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox(); + + // Create Point dialog, OCC viewer + if ( aDlg && + theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() && + pe->modifiers() != Qt::ControlModifier ) { + + gp_Pnt aPnt; + + if ( QString( aDlg->metaObject()->className() ).compare( "EntityGUI_SketcherDlg" ) == 0 ) + { + EntityGUI_SketcherDlg* aSketcherDlg = (EntityGUI_SketcherDlg*) aDlg; + ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(true); + if ( aSketcherDlg->acceptMouseEvent() ) { + OCCViewer_Viewer* anOCCViewer = + ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer(); + Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); + + ic->InitSelected(); + if ( pe->modifiers() == Qt::ShiftModifier ) + ic->ShiftSelect(); // Append selection + else + ic->Select(); // New selection + + ic->InitSelected(); + if ( ic->MoreSelected() ) { + TopoDS_Shape aShape = ic->SelectedShape(); + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) ); + } + else { + OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); + aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() ); + } + + Qt::KeyboardModifiers modifiers = pe->modifiers(); + aSketcherDlg->OnPointSelected( modifiers, aPnt ); // "feed" the point to point construction dialog + } // acceptMouseEvent() + } +#ifdef WITH_OPENCV + if ( QString( aDlg->metaObject()->className() ).compare( "EntityGUI_FeatureDetectorDlg" ) == 0 ) + { + EntityGUI_FeatureDetectorDlg* aCornerDlg = (EntityGUI_FeatureDetectorDlg*) aDlg; + if ( aCornerDlg->acceptMouseEvent() ) { + OCCViewer_Viewer* anOCCViewer = + ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer(); + Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); + + ic->InitSelected(); + ic->Select(); // New selection + + ic->InitSelected(); + TopoDS_Shape aShape; + if ( ic->MoreSelected() ) + aShape = ic->SelectedShape(); + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) ); + else + { + OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); + aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() ); + } + +// aCornerDlg->OnPointSelected( aPnt ); // "feed" the point to corner detection dialog + +// QPoint start = QPoint(pe->x(),pe->y()); + aCornerDlg->setStartPnt( aPnt ); + } // acceptMouseEvent() + + } +#endif + } + + return false; +} + +//================================================================================= +// function : 0nMouseRelease() +// purpose : [static] manage mouse events +//================================================================================= +bool EntityGUI::OnMouseRelease( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow ) +{ + ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(false); + QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox(); +#ifdef WITH_OPENCV + if ( aDlg && ( QString( aDlg->metaObject()->className() ).compare( "EntityGUI_FeatureDetectorDlg" ) == 0 ) && + theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() && + pe->modifiers() != Qt::ControlModifier ) + { + EntityGUI_FeatureDetectorDlg* aCornerDlg = (EntityGUI_FeatureDetectorDlg*) aDlg; + + gp_Pnt aPnt; + + if ( aCornerDlg->acceptMouseEvent() ) + { +// QPoint end = QPoint(pe->x(),pe->y()); + OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); + aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() ); + aCornerDlg->setEndPnt( aPnt ); + } + } +#endif + return false; +} + +//================================================================================= +// function : 0nMouseMove() +// purpose : [static] manage mouse events +//================================================================================= +bool EntityGUI::OnMouseMove( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow ) +{ + QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox(); + + if ( aDlg && QString( aDlg->metaObject()->className() ).compare( "EntityGUI_SketcherDlg" ) == 0 && + theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) + { + EntityGUI_SketcherDlg* aSketcherDlg = (EntityGUI_SketcherDlg*) aDlg; + if ( aSketcherDlg->acceptMouseEvent() ) + { + OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); + gp_Pnt aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() ); + + Qt::KeyboardModifiers modifiers = pe->modifiers(); + if (QApplication::mouseButtons() == Qt::LeftButton ) + aSketcherDlg->OnPointSelected( modifiers, aPnt, false ); // "feed" the point to point construction dialog + } + } + + return false; +} + +//======================================================================= +// function : ConvertClickToPoint() +// purpose : Returns the point clicked in 3D view +//======================================================================= +gp_Pnt EntityGUI::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView ) +{ + V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt; + aView->Eye( XEye, YEye, ZEye ); + + aView->At( XAt, YAt, ZAt ); + gp_Pnt EyePoint( XEye, YEye, ZEye ); + gp_Pnt AtPoint( XAt, YAt, ZAt ); + + gp_Vec EyeVector( EyePoint, AtPoint ); + gp_Dir EyeDir( EyeVector ); + + gp_Pln PlaneOfTheView = gp_Pln( AtPoint, EyeDir ); + Standard_Real X, Y, Z; + aView->Convert( x, y, X, Y, Z ); + gp_Pnt ConvertedPoint( X, Y, Z ); + + gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project( PlaneOfTheView, ConvertedPoint ); + gp_Pnt ResultPoint = ElSLib::Value( ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView ); + return ResultPoint; +} //===================================================================================== // function : DisplaySimulationShape() @@ -99,6 +283,7 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) //===================================================================================== void EntityGUI::DisplaySimulationShape( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) { + MESSAGE("EntityGUI::DisplaySimulationShape") SalomeApp_Application* app = getGeometryGUI()->getApp(); if ( !app ) return; @@ -147,6 +332,7 @@ void EntityGUI::DisplaySimulationShape( const TopoDS_Shape& S1, const TopoDS_Sha //================================================================================== void EntityGUI::EraseSimulationShape() { + MESSAGE("EntityGUI::EraseSimulationShape") SalomeApp_Application* app = getGeometryGUI()->getApp(); if ( !app ) return; @@ -195,13 +381,13 @@ bool EntityGUI::SObjectExist( const _PTR(SObject)& theFatherObject, const char* if ( SO->FindAttribute( anAttr, "AttributeIOR" ) ) { _PTR(AttributeIOR) anIOR ( anAttr ); if ( strcmp( anIOR->Value().c_str(), IOR ) == 0 ) - return true; + return true; } if ( SO->ReferencedObject( RefSO ) ) { if ( RefSO->FindAttribute( anAttr, "AttributeIOR" ) ) { _PTR(AttributeIOR) anIOR ( anAttr ); - if ( strcmp( anIOR->Value().c_str(), IOR ) == 0 ) - return true; + if ( strcmp( anIOR->Value().c_str(), IOR ) == 0 ) + return true; } } } diff --git a/src/EntityGUI/EntityGUI.h b/src/EntityGUI/EntityGUI.h index bc401c68c..7ab56f090 100644 --- a/src/EntityGUI/EntityGUI.h +++ b/src/EntityGUI/EntityGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -31,9 +32,11 @@ #include #include +#include class TopoDS_Shape; + //================================================================================= // class : EntityGUI // purpose : @@ -45,17 +48,23 @@ public : ~EntityGUI(); bool OnGUIEvent( int, SUIT_Desktop* ); + bool OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow ); + bool OnMouseMove( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow ); + bool OnMouseRelease( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow ); + + static gp_Pnt ConvertClickToPoint( int x, int y, Handle(V3d_View) aView ); void DisplaySimulationShape( const TopoDS_Shape&, const TopoDS_Shape& ); void EraseSimulationShape(); - // Methods for sub shapes explode + // Methods for sub-shapes explode bool SObjectExist( const _PTR(SObject)&, const char* ); public: // AIS shape used only during topo/geom simulations Handle(AIS_Shape) mySimulationShape1; Handle(AIS_Shape) mySimulationShape2; + }; #endif // ENTITYGUI_H diff --git a/src/EntityGUI/EntityGUI.pro b/src/EntityGUI/EntityGUI.pro deleted file mode 100644 index 4c46d5946..000000000 --- a/src/EntityGUI/EntityGUI.pro +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = EntityGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL - -CAS_TKTopAlgo = -L$${CASROOT}/Linux/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../GEOMGUI ../DlgRef ../GEOMBase ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMFiltersSelection ../SKETCHER $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMBase -lGEOMSketcher -lGEOM $${QT_MT_LIBS} $${CAS_TKTopAlgo} -lTKernel - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += ENTITYGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = GEOM_EntityGUI.hxx - -SOURCES = EntityGUI.cxx -SOURCES += EntityGUI_1Spin.cxx -SOURCES += EntityGUI_2Spin.cxx -SOURCES += EntityGUI_3Spin.cxx -SOURCES += EntityGUI_4Spin.cxx -SOURCES += EntityGUI_SketcherDlg.cxx -SOURCES += EntityGUI_SubShapeDlg.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/EntityGUI/EntityGUI_1Sel1Spin1Check_QTD.ui b/src/EntityGUI/EntityGUI_1Sel1Spin1Check_QTD.ui new file mode 100644 index 000000000..df1b68894 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel1Spin1Check_QTD.ui @@ -0,0 +1,140 @@ + + + EntityGUI_1Sel1Spin1Check_QTD + + + + 0 + 0 + 381 + 125 + + + + EntityGUI_2Spin_QTD + + + + 0 + + + 0 + + + + + Values + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + Create + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + + + 0 + + + 6 + + + + + Undo + + + + + + + Redo + + + + + + + + + CheckBox + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + SpinBox_DX + buttonApply + buttonUndo + buttonRedo + + + +
    diff --git a/src/EntityGUI/EntityGUI_1Sel1Spin_QTD.ui b/src/EntityGUI/EntityGUI_1Sel1Spin_QTD.ui new file mode 100644 index 000000000..a40875a0e --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel1Spin_QTD.ui @@ -0,0 +1,133 @@ + + + EntityGUI_1Sel1Spin_QTD + + + + 0 + 0 + 365 + 98 + + + + EntityGUI_2Spin_QTD + + + + 0 + + + 0 + + + + + Values + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + + + Create + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + + + 0 + + + 6 + + + + + Undo + + + + + + + Redo + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + SpinBox_DX + buttonApply + buttonUndo + buttonRedo + + + +
    diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.ui b/src/EntityGUI/EntityGUI_1Sel_QTD.ui index b5af6d132..4a6d21cbb 100644 --- a/src/EntityGUI/EntityGUI_1Sel_QTD.ui +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.ui @@ -1,108 +1,103 @@ - + + EntityGUI_1Sel_QTD - - + + 0 0 402 - 88 + 92 - + EntityGUI_1Sel_QTD - - + + 0 - + 0 - - - + + + Values - - + + 9 - + 6 - - - - 0 - - + + + 6 + + 0 + - - + + Undo - - + + Redo - - - - - 3 - 0 + + + + 0 0 - - - - - 0 - 0 + + + + 0 0 - + TL1 - + false - - - - - 0 - 0 + + + + 0 0 - + - - - + + + Create @@ -112,7 +107,7 @@ - + qPixmapFromMimeSource PushButton1 diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.ui b/src/EntityGUI/EntityGUI_1Spin_QTD.ui index 687f962dc..cf6a1ae99 100644 --- a/src/EntityGUI/EntityGUI_1Spin_QTD.ui +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.ui @@ -1,84 +1,83 @@ - + + EntityGUI_1Spin_QTD - - + + 0 0 - 268 - 88 + 270 + 92 - + EntityGUI_1Spin_QTD - - + + 0 - + 0 - - - + + + Values - - + + 9 - + 6 - - + + - - - + + + 0 - + 6 - - - + + + Redo - - - + + + Undo - - - + + + Create - - - - - 0 - 0 + + + + 0 0 - + TL1 - + false @@ -88,13 +87,13 @@ - + qPixmapFromMimeSource SalomeApp_DoubleSpinBox QDoubleSpinBox -
    SalomeApp_DoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/EntityGUI/EntityGUI_2Sel1Check_QTD.ui b/src/EntityGUI/EntityGUI_2Sel1Check_QTD.ui new file mode 100644 index 000000000..4d0f6d907 --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Sel1Check_QTD.ui @@ -0,0 +1,150 @@ + + + EntityGUI_2Sel1Check_QTD + + + + 0 + 0 + 366 + 119 + + + + EntityGUI_1Sel_QTD + + + + 0 + + + 0 + + + + + Values + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + + Create + + + + + + + TL2 + + + + + + + + + + + + + + + + + 6 + + + 0 + + + + + Undo + + + + + + + Redo + + + + + + + + + + + CheckBox + + + + + + + TextLabel + + + + + + + + + + + + qPixmapFromMimeSource + + PushButton1 + LineEdit1 + buttonApply + buttonUndo + buttonRedo + + + + diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.ui b/src/EntityGUI/EntityGUI_2Spin_QTD.ui index f28257dd4..d6c2aed3a 100644 --- a/src/EntityGUI/EntityGUI_2Spin_QTD.ui +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.ui @@ -1,105 +1,102 @@ - + + EntityGUI_2Spin_QTD - - + + 0 0 - 264 - 88 + 276 + 92 - + EntityGUI_2Spin_QTD - - + + 0 - + 0 - - - + + + Values - - + + 9 - + 6 - - + + - - + + - - - - - 0 - 0 + + + + 0 0 - + TL2 - + false - - - - - 0 - 0 + + + + 0 0 - + TL1 - + false - - - + + + 0 - + 6 - - - + + + Undo - - - + + + Redo - - - + + + Create @@ -109,13 +106,13 @@ - + qPixmapFromMimeSource SalomeApp_DoubleSpinBox QDoubleSpinBox -
    SalomeApp_DoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 134cbd3cf..53b0694e9 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -1,7 +1,4 @@ -// GEOM GEOMGUI : GUI for Geometry component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2012 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 @@ -19,36 +16,75 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI_3DSketcherDlg.cxx // Author : DMV, OCN // +#include +#include +#include #include "EntityGUI_3DSketcherDlg.h" #include "EntityGUI_Widgets.h" -#include +#include #include #include -#include -#include +#include #include -#include #include +#include #include #include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include +#include + +//OCCT includes +//#include +//#include +//#include +//#include #include #include -#include -#include +//#include +//#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// This include must be *AFTER* SOCC_ViewModel.h because +// of the constant ROTATE which is a #define in +// GEOMImpl_Types.hxx and an enum in SOCC_ViewModel.h +#include + +enum +{ + NONE, + TYPE_LENGTH, + TYPE_ANGLE, + TYPE_TWO_ANGLES +}; class Locker { @@ -67,11 +103,14 @@ private: // TRUE to construct a modal dialog. //================================================================================= EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl, - const double lineWidth ) + bool modal, Qt::WindowFlags fl, + const double lineWidth ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ), + myMode( -1 ), + myOK( false ), + myLineWidth( lineWidth ), myGeometryGUI( theGeometryGUI ), - myLineWidth( lineWidth ) + myLengthIORedoList() { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) ); @@ -91,7 +130,12 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q GroupType->GroupBox1->setTitle(tr("GEOM_COORDINATES_TYPE")); GroupType->RadioButton1->setText(tr("GEOM_SKETCHER_ABS")); GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL")); - GroupType->RadioButton3->close(); + GroupType->RadioButton3->setText(tr("Angles")); //TODO translation +// GroupType->RadioButton3->close(); + myTypeGroup = new QButtonGroup( this ); + myTypeGroup->addButton( GroupType->RadioButton1, 0 ); + myTypeGroup->addButton( GroupType->RadioButton2, 1 ); + myTypeGroup->addButton( GroupType->RadioButton3, 2 ); Group3Spin = new EntityGUI_3Spin( centralWidget() ); Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); @@ -101,6 +145,17 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) ); + + GroupAngles = new EntityGUI_Angles( centralWidget() ); + GroupAngles->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) ); + GroupAngles->buttonUndo->setIcon( image1 ); + GroupAngles->buttonRedo->setIcon( image2 ); + GroupAngles->checkBox->setText( tr( "Angle 2" ) ); //TODO translation + + GroupControls = new EntityGUI_Controls( centralWidget() ); + GroupControls->GroupBox1->setTitle(tr("GEOM_CONTROLS")); + GroupControls->CheckBox1->setText( tr( "Show length dimensions" ) ); //TODO translation + GroupControls->CheckBox2->setText( tr( "Show angle dimensions" ) ); //TODO translation buttonOk()->setText( tr( "GEOM_BUT_END_SKETCH" ) ); buttonApply()->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) ); @@ -109,10 +164,12 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->addWidget( GroupType ); layout->addWidget( Group3Spin ); + layout->addWidget( GroupAngles ); + layout->addWidget( GroupControls ); setHelpFileName( "create_3dsketcher_page.html" ); - resize(0,0); + resize(100,100); Init(); } @@ -134,20 +191,49 @@ EntityGUI_3DSketcherDlg::~EntityGUI_3DSketcherDlg() void EntityGUI_3DSketcherDlg::Init() { myOK = false; - + myOrientation = 1; + myPrsType = NONE; + + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + myAnglePrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + myLengthPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + + //TEST localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); +// globalSelection(GEOM_PREVIEW); /* Get setting of step value from file configuration */ double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); /* min, max, step and decimals for spin boxes */ - initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); + + initSpinBox( GroupAngles->SpinBox_DA , -180.0, 180.0, step, "angular_precision" ); + initSpinBox( GroupAngles->SpinBox_DA2, -90.0, 90.0, step, "angular_precision" ); + initSpinBox( GroupAngles->SpinBox_DL , COORD_MIN, COORD_MAX, step, "length_precision" ); - /* signals and slots connections */ - connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( PointClicked( int ) ) ); + Group3Spin->SpinBox_DX->setValue(0.0); + Group3Spin->SpinBox_DY->setValue(0.0); + Group3Spin->SpinBox_DZ->setValue(0.0); + + GroupAngles->SpinBox_DA->setValue(0.0); + GroupAngles->SpinBox_DA2->setValue(0.0); + GroupAngles->SpinBox_DL->setValue(0.0); + + GroupAngles->radioButton_1->setChecked(true); + GroupAngles->checkBox->setChecked(false); + GroupAngles->SpinBox_DA2->setEnabled(false); + + GroupControls->CheckBox1->setChecked( true ); + GroupControls->CheckBox2->setChecked( true ); + isLengthVisible = true; + isAngleVisible = true; + + GroupAngles->hide(); + /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); @@ -156,13 +242,28 @@ void EntityGUI_3DSketcherDlg::Init() connect( Group3Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) ); connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ; + + connect( GroupAngles->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) ); + connect( GroupAngles->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( GroupAngles->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ; - connect( GroupType->RadioButton1, SIGNAL( clicked() ), this, SLOT( TypeClicked() ) ); - connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeClicked() ) ); + connect( myTypeGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( TypeClicked( int ) ) ); connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + connect( GroupAngles->SpinBox_DA, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupAngles->SpinBox_DA2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupAngles->SpinBox_DL, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + connect( GroupAngles->radioButton_1, SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ; + connect( GroupAngles->radioButton_2, SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ; + connect( GroupAngles->radioButton_3, SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ; + + connect( GroupAngles->checkBox, SIGNAL( clicked ( bool ) ), this, SLOT( BoxChecked (bool) ) ) ; + connect( GroupControls->CheckBox1, SIGNAL( clicked ( bool ) ), this, SLOT( BoxChecked (bool) ) ) ; + connect( GroupControls->CheckBox2, SIGNAL( clicked ( bool ) ), this, SLOT( BoxChecked (bool) ) ) ; connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); @@ -172,42 +273,70 @@ void EntityGUI_3DSketcherDlg::Init() initName( tr( "GEOM_3DSKETCHER" ) ); UpdateButtonsState(); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } //================================================================================= // function : TypeClicked() // purpose : Radio button management //================================================================================= -void EntityGUI_3DSketcherDlg::TypeClicked() +void EntityGUI_3DSketcherDlg::TypeClicked( int mode ) { + if ( mode == myMode ) return; + + GroupAngles->hide(); + Group3Spin->show(); + bool blocked = Group3Spin->SpinBox_DX->signalsBlocked(); Group3Spin->SpinBox_DX->blockSignals(true); Group3Spin->SpinBox_DY->blockSignals(true); Group3Spin->SpinBox_DZ->blockSignals(true); // Get setting of step value from file configuration - double x, y, z; - GetLastPoints(x, y, z); - if ( GroupType->RadioButton1->isChecked() ) { // XY + XYZ xyz = getLastPoint(); + bool okx, oky, okz; + Group3Spin->SpinBox_DX->text().toDouble( &okx ); + Group3Spin->SpinBox_DY->text().toDouble( &oky ); + Group3Spin->SpinBox_DZ->text().toDouble( &okz ); + if ( mode == 0 ) { // XY Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) ); - Group3Spin->SpinBox_DX->setValue( x + Group3Spin->SpinBox_DX->value() ); - Group3Spin->SpinBox_DY->setValue( y + Group3Spin->SpinBox_DY->value() ); - Group3Spin->SpinBox_DZ->setValue( z + Group3Spin->SpinBox_DZ->value() ); + if (myMode == 1) + { + if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() ); + if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() ); + if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() ); + } Group3Spin->buttonApply->setFocus(); - } else if ( GroupType->RadioButton2->isChecked() ) { // DXDY + } + else if ( mode == 1) { // DXDY Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) ); Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) ); - Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - x ); - Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - y ); - Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - z ); + if (myMode == 0) + { + if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x ); + if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y ); + if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z ); + } Group3Spin->buttonApply->setFocus(); } + else if (mode == 2){ // Angles + Group3Spin->hide(); + GroupAngles->show(); + GroupAngles->buttonApply->setFocus(); + } + Group3Spin->SpinBox_DX->blockSignals(blocked); Group3Spin->SpinBox_DY->blockSignals(blocked); Group3Spin->SpinBox_DZ->blockSignals(blocked); + + myMode = mode; + + updateGeometry(); + resize(minimumSizeHint()); + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } //================================================================================= @@ -216,23 +345,56 @@ void EntityGUI_3DSketcherDlg::TypeClicked() //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnAddPoint() { - Locker lock( myOK ); - - double x, y, z; - GetCurrentPoints(x, y, z); - myPointsList.append(x); - myPointsList.append(y); - myPointsList.append(z); - + QString msg; + if ( !isValid( msg ) ) { + showError( msg ); + return; + } + + // Display and store angle dimensions interactive objects in Prs + if( GroupType->RadioButton3->isChecked() ) + { + double anAngle2 = 0.0; + if (GroupAngles->checkBox->isChecked()) + anAngle2 = GroupAngles->SpinBox_DA2->value(); + + // Store length dimensions + displayLength(GroupAngles->SpinBox_DL->value(), /*store =*/true); + // Store angle dimensions + displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, + GroupAngles->SpinBox_DL->value(), myOrientation, /*store =*/true); + } + + // Display and store store length dimension interactive object in Prs + if (GroupType->RadioButton1->isChecked() || + GroupType->RadioButton2->isChecked()) + { + displayLength(-1, /*store=*/true); + } + + myPointsList.append( getCurrentPoint() ); + myPrsTypeList.push_back( myPrsType ); + + // Clean redo lists myRedoList.clear(); - - if ( GroupType->RadioButton2->isChecked() ) { + myPrsTypeRedoList.clear(); + myLengthIORedoList.Clear(); + myAngleIORedoList.Clear(); + + if ( myMode == 1 ) { Group3Spin->SpinBox_DX->setValue( 0.0 ); Group3Spin->SpinBox_DY->setValue( 0.0 ); Group3Spin->SpinBox_DZ->setValue( 0.0 ); } - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + else if ( myMode == 2 ) + { + GroupAngles->SpinBox_DA->setValue( 0.0 ); + GroupAngles->SpinBox_DL->setValue( 0.0 ); + GroupAngles->SpinBox_DA2->setValue( 0.0 ); + } UpdateButtonsState(); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + } //================================================================================= @@ -241,11 +403,13 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint() //================================================================================= void EntityGUI_3DSketcherDlg::UpdateButtonsState() { - if ( !myPointsList.count() ) - GroupType->RadioButton1->setChecked( true ); - GroupType->RadioButton2->setEnabled( myPointsList.count() > 2 ); - Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 2 ); - Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 2 ); + if ( myPointsList.count() == 0 ) GroupType->RadioButton1->click(); + GroupType->RadioButton2->setEnabled( myPointsList.count() > 0 ); + GroupType->RadioButton3->setEnabled( myPointsList.count() > 0 ); + Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 0 ); + Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 0 ); + GroupAngles->buttonUndo->setEnabled( myPointsList.count() > 0 ); + GroupAngles->buttonRedo->setEnabled( myRedoList.count() > 0 ); } //================================================================================= @@ -254,18 +418,44 @@ void EntityGUI_3DSketcherDlg::UpdateButtonsState() //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnUndo() { - if (myPointsList.count() > 2) { - double x, y, z; - GetLastPoints(x, y, z); - myRedoList.append(x); - myRedoList.append(y); - myRedoList.append(z); - myPointsList.removeLast(); - myPointsList.removeLast(); - myPointsList.removeLast(); - + if (myPointsList.count() > 0) { + myRedoList.append( myPointsList.takeLast() ); UpdateButtonsState(); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + + // Erase dimensions presentations + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + + if (myPrsTypeList.back() != NONE) + { + // Remove last prepended IO + removeLastIOFromPrs( TYPE_LENGTH ); + } + if ( myPrsTypeList.back() == TYPE_ANGLE || + myPrsTypeList.back() == TYPE_TWO_ANGLES ) + { + // Remove first Angle IO from presentation + removeLastIOFromPrs( TYPE_ANGLE ); + if ( myPrsTypeList.back() == TYPE_TWO_ANGLES ) + { + // Remove second Angle IO + removeLastIOFromPrs( TYPE_ANGLE ); + } + } + + // Erase last action type and store it in redo list + myPrsTypeRedoList.push_back(myPrsTypeList.back()); + myPrsTypeList.pop_back(); + + // Display modified presentation + if (isLengthVisible) + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs); + if (isAngleVisible) + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + + updateViewer(); } } @@ -275,20 +465,85 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnRedo() { - int count = myRedoList.count(); - if ( count > 2 ) { - myPointsList.append( myRedoList[count-3] ); - myPointsList.append( myRedoList[count-2] ); - myPointsList.append( myRedoList[count-1] ); - myRedoList.removeLast(); - myRedoList.removeLast(); - myRedoList.removeLast(); - + if ( myRedoList.count() > 0) { + myPointsList.append( myRedoList.takeLast() ); UpdateButtonsState(); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + + // Erase dimensions presentations + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + + if ( myPrsTypeRedoList.back() != NONE ) + restoreLastIOToPrs( TYPE_LENGTH ); + + if ( myPrsTypeRedoList.back() == TYPE_ANGLE || + myPrsTypeRedoList.back() == TYPE_TWO_ANGLES ) + { + // Add a first IO from the Redo list + restoreLastIOToPrs( TYPE_ANGLE ); + if ( myPrsTypeRedoList.back() == TYPE_TWO_ANGLES ) + { + // Add a second IO from the Redo list + restoreLastIOToPrs( TYPE_ANGLE ); + } + } + + // Record last prs type + myPrsTypeList.push_back(myPrsTypeRedoList.back()); + myPrsTypeRedoList.pop_back(); + + // Display modified presentation + if (isLengthVisible) + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs); + if (isAngleVisible) + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + + updateViewer(); } } +//================================================================================= +// function : removeLastIO() +// purpose : +//================================================================================= +void EntityGUI_3DSketcherDlg::removeLastIOFromPrs(int type) +{ + AIS_ListOfInteractive anIOList; + + if (type == TYPE_LENGTH) + { + myLengthPrs->GetObjects(anIOList); + myLengthIORedoList.Prepend(anIOList.First()); // Store last prepended Length IO in redo list + myLengthPrs->RemoveFirst(); // Remove it from myLengthPrs + } + if (type == TYPE_ANGLE) + { + myAnglePrs->GetObjects(anIOList); + myAngleIORedoList.Prepend(anIOList.First()); // Store last prepended Angle IO in redo list + myAnglePrs->RemoveFirst(); // Remove it from myAnglePrs + } +} + +//================================================================================= +// function : restoreLastIO() +// purpose : +//================================================================================= +void EntityGUI_3DSketcherDlg::restoreLastIOToPrs(int type) +{ + if (type == TYPE_LENGTH) + { + myLengthPrs->PrependObject(myLengthIORedoList.First()); // Restore last removed IO + myLengthIORedoList.RemoveFirst(); // Remove it from redo list + } + if (type == TYPE_ANGLE) + { + myAnglePrs->PrependObject(myAngleIORedoList.First()); // Restore last removed IO + myAngleIORedoList.RemoveFirst(); // Remove it from redo list + } +} + //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed @@ -301,54 +556,52 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument() int nbSel = aSelList.Extent(); if ( nbSel == 1 ) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil(aSelectedObject) ) { TopoDS_Shape aShape; if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) - { - int anIndex = aMap(1); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes(aSelList.First(), aMap); + if (aMap.Extent() == 1) + { + int anIndex = aMap(1); + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + } } bool isOk = true; if ( aShape.ShapeType() != TopAbs_VERTEX ) - isOk = GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX); + isOk = GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX); if (isOk) { - gp_Pnt aPnt; - if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) { - // set coordinates to the Spin Boxes - double aX, aY, aZ; - aX = aPnt.X(); - aY = aPnt.Y(); - aZ = aPnt.Z(); - bool blocked = Group3Spin->SpinBox_DX->signalsBlocked(); - Group3Spin->SpinBox_DX->blockSignals(true); - Group3Spin->SpinBox_DY->blockSignals(true); - Group3Spin->SpinBox_DZ->blockSignals(true); - if ( GroupType->RadioButton1->isChecked() ) { - Group3Spin->SpinBox_DX->setValue( aX ); - Group3Spin->SpinBox_DY->setValue( aY ); - Group3Spin->SpinBox_DZ->setValue( aZ ); - } else if ( GroupType->RadioButton2->isChecked() ) { - double x, y, z; - GetLastPoints(x, y, z); - Group3Spin->SpinBox_DX->setValue( aX - x ); - Group3Spin->SpinBox_DY->setValue( aY - y ); - Group3Spin->SpinBox_DZ->setValue( aZ - z ); - } - Group3Spin->SpinBox_DX->blockSignals(blocked); - Group3Spin->SpinBox_DY->blockSignals(blocked); - Group3Spin->SpinBox_DZ->blockSignals(blocked); - } + gp_Pnt aPnt; + if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) { + // set coordinates to the Spin Boxes + double aX, aY, aZ; + aX = aPnt.X(); + aY = aPnt.Y(); + aZ = aPnt.Z(); + bool blocked = Group3Spin->SpinBox_DX->signalsBlocked(); + Group3Spin->SpinBox_DX->blockSignals(true); + Group3Spin->SpinBox_DY->blockSignals(true); + Group3Spin->SpinBox_DZ->blockSignals(true); + if ( GroupType->RadioButton1->isChecked() ) { + Group3Spin->SpinBox_DX->setValue( aX ); + Group3Spin->SpinBox_DY->setValue( aY ); + Group3Spin->SpinBox_DZ->setValue( aZ ); + } else if ( GroupType->RadioButton2->isChecked() ) { + XYZ xyz = getLastPoint(); + Group3Spin->SpinBox_DX->setValue( aX - xyz.x ); + Group3Spin->SpinBox_DY->setValue( aY - xyz.y ); + Group3Spin->SpinBox_DZ->setValue( aZ - xyz.z ); + } + Group3Spin->SpinBox_DX->blockSignals(blocked); + Group3Spin->SpinBox_DY->blockSignals(blocked); + Group3Spin->SpinBox_DZ->blockSignals(blocked); + } } } } - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } //================================================================================= @@ -375,10 +628,10 @@ void EntityGUI_3DSketcherDlg::ActivateThisDialog() myGeomGUI->SetActiveDialogBox( this ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -388,7 +641,61 @@ void EntityGUI_3DSketcherDlg::ActivateThisDialog() //================================================================================= void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox( double newValue ) { - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); +} + + +//================================================================================= +// function : BoxChecked() +// purpose : ChecBoxes management +//================================================================================= +void EntityGUI_3DSketcherDlg::BoxChecked( bool checked ) +{ + QCheckBox* send = (QCheckBox*) sender(); + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + if (send == GroupAngles->checkBox) + GroupAngles->SpinBox_DA2->setEnabled(checked); + + else if (send == GroupControls->CheckBox1) + { + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); + if(checked){ + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs); + isLengthVisible=true; + } + else + isLengthVisible=false; + } + else if (send == GroupControls->CheckBox2) + { + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + if(checked) + { + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + isAngleVisible=true; + } + else + isAngleVisible=false; + } + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); +} + +//================================================================================= +// function : ButtonClicked() +// purpose : +//================================================================================= +void EntityGUI_3DSketcherDlg::ButtonClicked( bool checked ) +{ + if (GroupAngles->radioButton_1->isChecked()) + myOrientation = 1; + else if (GroupAngles->radioButton_2->isChecked()) + myOrientation = 2; + else + myOrientation = 3; + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } //================================================================================= @@ -416,7 +723,11 @@ GEOM::GEOM_IOperations_ptr EntityGUI_3DSketcherDlg::createOperation() //================================================================================= bool EntityGUI_3DSketcherDlg::isValid( QString& msg ) { - return true; + bool ok = true; + ok = Group3Spin->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = Group3Spin->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = Group3Spin->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + return ok; } //================================================================================= @@ -427,47 +738,44 @@ bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects ) { GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble; if (!myOK || myPointsList.size() == 0) - aCoordsArray->length(myPointsList.size()+3); + aCoordsArray->length((myPointsList.size()+1)*3); else - aCoordsArray->length(myPointsList.size()); + aCoordsArray->length(myPointsList.size()*3); + + QStringList aParameters; int i = 0; - QList::const_iterator it; + QList::const_iterator it; for(it = myPointsList.begin(); it != myPointsList.end(); ++it ) { - aCoordsArray[i] = *it; - i++; + aCoordsArray[i++] = (*it).x; + aCoordsArray[i++] = (*it).y; + aCoordsArray[i++] = (*it).z; + aParameters << (*it).xt; + aParameters << (*it).yt; + aParameters << (*it).zt; } if (!myOK || myPointsList.size() == 0) { - double x, y, z; - GetCurrentPoints(x, y, z); - aCoordsArray[i] = x; - aCoordsArray[i+1] = y; - aCoordsArray[i+2] = z; + XYZ xyz = getCurrentPoint(); + aCoordsArray[i++] = xyz.x; + aCoordsArray[i++] = xyz.y; + aCoordsArray[i++] = xyz.z; + aParameters << xyz.xt; + aParameters << xyz.yt; + aParameters << xyz.zt; } - GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->Make3DSketcher( aCoordsArray ); + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->Make3DSketcher( aCoordsArray ); - if ( !anObj->_is_nil() ) + if ( !anObj->_is_nil() ) { + if ( !IsPreview() ) anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back( anObj._retn() ); + } return true; } -//================================================================================= -// function : initSpinBox() -// purpose : -//================================================================================= - -void EntityGUI_3DSketcherDlg::initSpinBox( QDoubleSpinBox* spinBox, - double min, double max, - double step, int decimals ) -{ - spinBox->setDecimals( decimals ); - spinBox->setRange( min, max ); - spinBox->setSingleStep( step ); -} - //================================================================================= // function : SetDoubleSpinBoxStep() // purpose : Double spin box management @@ -477,6 +785,9 @@ void EntityGUI_3DSketcherDlg::SetDoubleSpinBoxStep( double step ) Group3Spin->SpinBox_DX->setSingleStep(step); Group3Spin->SpinBox_DY->setSingleStep(step); Group3Spin->SpinBox_DZ->setSingleStep(step); + GroupAngles->SpinBox_DA->setSingleStep(step); + GroupAngles->SpinBox_DL->setSingleStep(step); + GroupAngles->SpinBox_DA2->setSingleStep(step); } //================================================================================= @@ -499,49 +810,100 @@ void EntityGUI_3DSketcherDlg::ClickOnOk() //================================================================================= bool EntityGUI_3DSketcherDlg::ClickOnApply() { - if (myPointsList.count() > 3) { - myPointsList.append(myPointsList[0]); - myPointsList.append(myPointsList[1]); - myPointsList.append(myPointsList[2]); + QString msg; + if ( !isValid( msg ) ) { + showError( msg ); + return false; } + if (myPointsList.count() > 0) + myPointsList.append(myPointsList[0]); + Locker lock( myOK ); if ( !onAccept() ) return false; - + ClickOnCancel(); return true; } //================================================================================= -// function : GetLastPoints() +// function : getLastPoint() // purpose : return last points from list //================================================================================= -void EntityGUI_3DSketcherDlg::GetLastPoints(double& x, double& y, double& z) +EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getLastPoint() const +{ + return myPointsList.count() > 0 ? myPointsList.last() : XYZ(); +} + +//================================================================================= +// function : getPenultimatePoint() +// purpose : return penultimate point from list +//================================================================================= +EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getPenultimatePoint() const { - int count = myPointsList.count(); - x = count > 2 ? myPointsList[count-3] : 0.0; - y = count > 2 ? myPointsList[count-2] : 0.0; - z = count > 2 ? myPointsList[count-1] : 0.0; + double size = myPointsList.count(); + return size > 1 ? myPointsList.at(size - 2) : XYZ(); } //================================================================================= -// function : GetCurrentPoints() +// function : getCurrentPoint() // purpose : returns current points //================================================================================= -void EntityGUI_3DSketcherDlg::GetCurrentPoints(double& x, double& y, double& z) +EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const { - if ( GroupType->RadioButton1->isChecked() ) { - x = Group3Spin->SpinBox_DX->value(); - y = Group3Spin->SpinBox_DY->value(); - z = Group3Spin->SpinBox_DZ->value(); - } else { // if (GroupType->RadioButton2->isChecked()) - GetLastPoints(x, y, z); - x += Group3Spin->SpinBox_DX->value(); - y += Group3Spin->SpinBox_DY->value(); - z += Group3Spin->SpinBox_DZ->value(); + XYZ xyz; + // Temporary way of doing this. To be changed with ordered improvement of the sketcher + if ( myMode == 2 ) + { + double anAngle = GroupAngles->SpinBox_DA->value() * M_PI/180.0; + double anAngle2 = 0.0; + double aLength = GroupAngles->SpinBox_DL->value(); + + if (GroupAngles->checkBox->isChecked()) + anAngle2 = GroupAngles->SpinBox_DA2->value() * M_PI/180.0; + + double aProjectedLength = aLength * cos(anAngle2); + + xyz = getLastPoint(); + if (GroupAngles->radioButton_1->isChecked()) + { + xyz.x += aProjectedLength * cos(anAngle); + xyz.y += aProjectedLength * sin(anAngle); + xyz.z += aLength * sin(anAngle2); + } + else if (GroupAngles->radioButton_2->isChecked()) + { + xyz.y += aProjectedLength * cos(anAngle); + xyz.z += aProjectedLength * sin(anAngle); + xyz.x += aLength * sin(anAngle2); + } + else + { + xyz.z += aProjectedLength * sin(anAngle); + xyz.x += aProjectedLength * cos(anAngle); + xyz.y += aLength * sin(anAngle2); + } + } + else + { + if ( myMode == 0 ) { + xyz.x = Group3Spin->SpinBox_DX->value(); + xyz.y = Group3Spin->SpinBox_DY->value(); + xyz.z = Group3Spin->SpinBox_DZ->value(); + } + else{ + xyz = getLastPoint(); + xyz.x += Group3Spin->SpinBox_DX->value(); + xyz.y += Group3Spin->SpinBox_DY->value(); + xyz.z += Group3Spin->SpinBox_DZ->value(); + } + xyz.xt = Group3Spin->SpinBox_DX->text(); + xyz.yt = Group3Spin->SpinBox_DY->text(); + xyz.zt = Group3Spin->SpinBox_DZ->text(); } + return xyz; } //================================================================ @@ -550,18 +912,24 @@ void EntityGUI_3DSketcherDlg::GetCurrentPoints(double& x, double& y, double& z) // Redefined from GEOMBase_Helper. //================================================================ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, - const bool append, - const bool activate, - const bool update, - const double lineWidth, - const int displayMode, - const int color ) -{ - // Set color for preview shape - getDisplayer()->SetColor( Quantity_NOC_RED ); - + const bool append, + const bool activate, + const bool update, + const double lineWidth, + const int displayMode, + const int color ) +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + + QColor aColor = resMgr->colorValue("Geometry","line_color",QColor(255,0,0)); + Quantity_NameOfColor line_color = SalomeApp_Tools::color( aColor ).Name(); + // set width of displayed shape - getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth ); + int lw = lineWidth; + if(lw == -1) { + lw = resMgr->integerValue("Geometry", "preview_edge_width", -1); + } + getDisplayer()->SetWidth( lw ); // Disable activation of selection getDisplayer()->SetToActivate( activate ); @@ -570,11 +938,14 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object ); getDisplayer()->SetName( objStr.in() ); - // Create wire from applayed object + // Create wire from applied object TopoDS_Shape anApplyedWire, aLastSegment; if ( !createShapes( object, anApplyedWire, aLastSegment ) ) return; + // Set color for preview shape + getDisplayer()->SetColor( line_color ); + // Build prs SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire ); if ( aPrs != 0 && !aPrs->IsNull() ) @@ -582,39 +953,364 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, getDisplayer()->SetColor( Quantity_NOC_VIOLET ); aPrs = getDisplayer()->BuildPrs( aLastSegment ); + if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); - + + getDisplayer()->SetColor( line_color ); + + // Display local trihedron if the mode is relatives coordinates or angles + if (myMode == 1 || myMode == 2) + displayTrihedron(2); + + // Display preview of suitable dimension presentations + if(myMode == 2) // ANGLES + { + double anAngle2 = 0.0; + if (GroupAngles->checkBox->isChecked()) + anAngle2 = GroupAngles->SpinBox_DA2->value(); + + displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, GroupAngles->SpinBox_DL->value(), myOrientation); + displayLength(GroupAngles->SpinBox_DL->value()); + } + if( myMode == 0 || myMode == 1 ) // COORDINATES + displayLength(); + getDisplayer()->UnsetName(); // Enable activation of displayed objects getDisplayer()->SetToActivate( true ); } +//================================================================ +// Function : displayTrihedron() +// Purpose : Method for displaying trihedron +//================================================================ +void EntityGUI_3DSketcherDlg::displayTrihedron(int selMode) +{ + // Add trihedron to preview + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + gp_Pnt P(getLastPoint().x,getLastPoint().y,getLastPoint().z); + Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(P,gp::DZ(),gp::DX()); + Handle(AIS_Trihedron) anIO = new AIS_Trihedron(anAxis); + anIO->SetSelectionMode(selMode); + + SOCC_Prs* aSPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + + if (aSPrs) + { + aSPrs->PrependObject(anIO); + GEOMBase_Helper::displayPreview( aSPrs, true, true ); + } +} + +//================================================================ +// Function : displayAngle() +// Purpose : Method for displaying angle dimensions +//================================================================ +void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, double theLength, int theOrientation, bool store) +{ + if( Abs(theAngle2 - 90.0) < Precision::Angular() || + theLength < Precision::Confusion() ) + return; + + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + XYZ Last = getLastPoint(); + XYZ Current = getCurrentPoint(); + + gp_Pnt Last_Pnt(Last.x,Last.y,Last.z); + gp_Pnt Current_Pnt(Current.x,Current.y,Current.z); + gp_Pnt P1, P2; + + bool twoAngles = GroupAngles->checkBox->isChecked(); + + switch(theOrientation) + { + case 1: //OXY + { + P1 = gp_Pnt(Last.x + theLength,Last.y,Last.z); // X direction + P2 = gp_Pnt(Last.x + theLength * cos(theAngle1 * M_PI / 180.), + Last.y + theLength * sin(theAngle1 * M_PI / 180.), + Last.z); + break; + } + case 2: //OYZ + { + P1 = gp_Pnt(Last.x, Last.y + theLength,Last.z); // Y direction + P2 = gp_Pnt(Last.x, + Last.y + theLength * cos(theAngle1 * M_PI / 180.), + Last.z + theLength * sin(theAngle1 * M_PI / 180.)); + break; + } + case 3: //OXZ + { + P1 = gp_Pnt( Last.x + theLength,Last.y,Last.z); // X direction + P2 = gp_Pnt( Last.x + theLength * cos(theAngle1 * M_PI / 180.) , + Last.y, + Last.z + theLength * sin(theAngle1 * M_PI / 180.)); + break; + } + } + + TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(P1); + TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(P2); + TopoDS_Vertex LastV = BRepBuilderAPI_MakeVertex(Last_Pnt); + TopoDS_Vertex CurV = BRepBuilderAPI_MakeVertex(Current_Pnt); + TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(LastV, V1); + TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(LastV, V2); + TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge(LastV, CurV); + + gce_MakePln gce_MP(Last_Pnt, P1, P2); + Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value()); + + // Covert angles to string + std::string Angle1_str = doubleToString(theAngle1); + std::string Angle2_str = doubleToString(theAngle2); + + // Create interactive object + Handle(AIS_AngleDimension) anAngleIO = new AIS_AngleDimension(anEdge1, anEdge2, aPlane, theAngle1 * M_PI / 180., + TCollection_ExtendedString(Angle1_str.c_str())); + anAngleIO->SetArrowSize( (theAngle1 * M_PI / 180) * (theLength/20) ); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); + + Handle(Prs3d_AngleAspect) asp = new Prs3d_AngleAspect(); + asp->LineAspect()->SetWidth(w); + anAngleIO->Attributes()->SetAngleAspect(asp); + + SOCC_Prs* aSPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + + if (store) + { + // Erase dimensions presentations + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + + myAnglePrs->PrependObject(anAngleIO); + myPrsType = TYPE_ANGLE; // Overwrite type with ANGLE + + // Display modified presentation + if (isAngleVisible) + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + } + else if(aSPrs) + { + aSPrs->AddObject(anAngleIO); + } + + if (twoAngles) + { + gce_MakePln gce_MP2(Last_Pnt, P2, Current_Pnt); + Handle(Geom_Plane) aPlane2 = new Geom_Plane(gce_MP2.Value()); + + Handle(AIS_AngleDimension) anAngle2IO = new AIS_AngleDimension(anEdge2, anEdge3, aPlane2, theAngle2 * M_PI / 180., + TCollection_ExtendedString(Angle2_str.c_str())); + anAngle2IO->SetArrowSize( (theAngle2 * M_PI / 180) * (theLength/20) ); + + anAngle2IO->Attributes()->SetAngleAspect(asp); + + if (store) + { + // Erase dimensions presentations + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + + myAnglePrs->PrependObject(anAngle2IO); + myPrsType = TYPE_TWO_ANGLES; // Overwrite type with TWO_ANGLES + + // Display modified presentation + if (isAngleVisible) + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + } + else if (aSPrs) + { + aSPrs->AddObject(anAngle2IO); + } + } + + if(!store && isAngleVisible) + { + GEOMBase_Helper::displayPreview( aSPrs, true, true ); + } +} + +//================================================================ +// Function : displayLength() +// Purpose : Method for displaying length dimensions +//================================================================ +void EntityGUI_3DSketcherDlg::displayLength(double theLength, bool store) +{ + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + XYZ Last = getLastPoint(); + XYZ Current = getCurrentPoint(); + XYZ Penultimate = getPenultimatePoint(); + + double aLength = 0.0; + + if( theLength < 0) // Calculate length if not given + { + aLength = sqrt((Last.x - Current.x)*(Last.x - Current.x) + + (Last.y - Current.y)*(Last.y - Current.y) + + (Last.z - Current.z)*(Last.z - Current.z)); + } + else + aLength = theLength; + + if (aLength Precision::Confusion() ) +// { +// MESSAGE("repere2") +// if ( Normal.Dot(gp::DX()) < 0.0 ){ +// MESSAGE("REVERSE on OX basis") +// Normal.Reverse(); +// } +// } +// else if ( Abs(Normal.Dot(gp::DY())) > Precision::Confusion() ) +// { +// MESSAGE("repere3") +// if ( Normal.Dot(gp::DY()) < 0.0 ){ +// MESSAGE("REVERSE on OY basis") +// Normal.Reverse(); +// } +// } + + gce_MakePln gce_MP(P1, Normal); + Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value()); + + Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension(aVert1, + aVert2, + aPlane, + aLength, + TCollection_ExtendedString(aLength_str.c_str())); + anIO->SetArrowSize(aLength/20); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); + Handle(Prs3d_LengthAspect) asp = new Prs3d_LengthAspect(); + asp->LineAspect()->SetWidth(w); + anIO->Attributes()->SetLengthAspect(asp); + + if (store) + { + // Erase length dimensions presentation + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); + + myLengthPrs->PrependObject(anIO); + myPrsType = TYPE_LENGTH; + + // Display modified presentation + if (isLengthVisible) + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs); + } + else if( isLengthVisible ) + { + SOCC_Prs* aSPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + if (aSPrs) + { + aSPrs->PrependObject(anIO); + GEOMBase_Helper::displayPreview( aSPrs, true, true ); + } + } +} + //================================================================ // Function : createShapes // Purpose : Create applyed wire, and last segment from entry object //================================================================ -bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, - TopoDS_Shape& theApplyedWire, - TopoDS_Shape& theLastSegment ) +bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr /*theObject*/, + TopoDS_Shape& theApplyedWire, + TopoDS_Shape& theLastSegment ) { + QList points; + foreach( XYZ xyz, myPointsList) { + gp_Pnt p(xyz.x, xyz.y, xyz.z); + if ( points.isEmpty() || points.last().Distance(p) > gp::Resolution()) + points << p; + } + + if ( points.count() == 1 ) { + // only one point is created + BRepBuilderAPI_MakeVertex mkVertex (points.last()); + theApplyedWire = mkVertex.Shape(); + } + else if ( points.count() > 1 ) { + // wire is created + BRepBuilderAPI_MakePolygon mkWire; + foreach( gp_Pnt p, points ) + mkWire.Add(p); + theApplyedWire = mkWire.Shape(); + } + + XYZ curxyz = getCurrentPoint(); + gp_Pnt curpnt(curxyz.x, curxyz.y, curxyz.z); + + if ( points.isEmpty() || points.last().Distance(curpnt) <= gp::Resolution() ) { + BRepBuilderAPI_MakeVertex mkVertex (curpnt); + theLastSegment = mkVertex.Shape(); + } + else { + BRepBuilderAPI_MakeEdge mkEdge(points.last(), curpnt); + theLastSegment = mkEdge.Shape(); + } + + /* VSR: old algorithm does not work properly, see bug 0020899 TopoDS_Shape aShape; - if ( !GEOMBase::GetShape( theObject, aShape ) || - aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX ) + if ( !GEOMBase::GetShape( theObject, aShape ) ) + return false; + + if( aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX ) return false; - if ( myOK ) { - theApplyedWire = aShape; + theApplyedWire = aShape; + if ( myOK ) return true; - } BRepBuilderAPI_MakeWire aBuilder; - TopExp_Explorer anExp( aShape, TopAbs_EDGE ); + TopExp_Explorer edgeExp( aShape, TopAbs_EDGE ); while ( 1 ) { - TopoDS_Shape anEdge = anExp.Current(); - anExp.Next(); - if ( anExp.More() ) // i.e. non-last edge + TopoDS_Shape anEdge = edgeExp.Current(); + edgeExp.Next(); + if ( edgeExp.More() ) // i.e. non-last edge aBuilder.Add( TopoDS::Edge( anEdge ) ); else { theLastSegment = anEdge; @@ -622,8 +1318,27 @@ bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, } } - if ( aBuilder.IsDone() ) + if ( aBuilder.IsDone() ) { theApplyedWire = aBuilder.Shape(); + } + else if ( !theLastSegment.IsNull() ) { + TopExp_Explorer vertexExp( theLastSegment, TopAbs_VERTEX ); + theApplyedWire = vertexExp.Current(); + } + */ return true; } + +//================================================================ +// Function : doubleToString +// Purpose : converts double to string +//================================================================ +std::string EntityGUI_3DSketcherDlg::doubleToString(double num) +{ + // truncate num + int digNum = 5; + char format = 'g'; // truncated to a number of significant digits + + return QString::number( num, format, digNum).toStdString(); +} diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.h b/src/EntityGUI/EntityGUI_3DSketcherDlg.h index 19cdb327d..af81a199d 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.h +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.h @@ -1,7 +1,4 @@ -// GEOM GEOMGUI : GUI for Geometry component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2012 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 @@ -19,18 +16,25 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI_3DSketcherDlg.h // Author : DMV, OCN // - #ifndef ENTITYGUI_3DSKETCHERDLG_H #define ENTITYGUI_3DSKETCHERDLG_H #include +class QButtonGroup; class QDoubleSpinBox; class EntityGUI_3Spin; +class EntityGUI_Angles; +class EntityGUI_Controls; class DlgRef_3Radio; +class SOCC_Prs; + +#include #ifndef COORD_MIN # define COORD_MIN -1e+15 @@ -47,15 +51,20 @@ class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton { Q_OBJECT + struct XYZ + { + XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; } + double x, y, z; + QString xt, yt, zt; + }; + typedef QList XYZList; + public: EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. ); ~EntityGUI_3DSketcherDlg(); protected: - void initSpinBox( QDoubleSpinBox*, - double, double, double = 0.1, - int = 3 ); - + // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); @@ -66,27 +75,56 @@ private: void enterEvent( QEvent* ); virtual void displayPreview( GEOM::GEOM_Object_ptr, - const bool = false, - const bool = false, - const bool = true, - const double = -1, - const int = -1, - const int = -1); + const bool = false, + const bool = false, + const bool = true, + const double = -1, + const int = -1, + const int = -1); + + void displayTrihedron( int ); + + void displayAngle( double, double, double, int, bool store = false ); + void displayLength( double theLength = -1.0, bool store = false ); bool createShapes( GEOM::GEOM_Object_ptr, - TopoDS_Shape&, - TopoDS_Shape& ); + TopoDS_Shape&, + TopoDS_Shape& ); + + XYZ getLastPoint() const; + XYZ getPenultimatePoint() const; + XYZ getCurrentPoint() const; + + std::string doubleToString( double ); + + void removeLastIOFromPrs( int ); + void restoreLastIOToPrs( int ); private: - QList myPointsList; - QList myRedoList; + XYZList myPointsList; + XYZList myRedoList; + AIS_ListOfInteractive myLengthIORedoList; + AIS_ListOfInteractive myAngleIORedoList; + int myPrsType; + std::list myPrsTypeList; + std::list myPrsTypeRedoList; EntityGUI_3Spin* Group3Spin; + EntityGUI_Angles* GroupAngles; + EntityGUI_Controls* GroupControls; DlgRef_3Radio* GroupType; + QButtonGroup* myTypeGroup; + int myMode; + int myOrientation; bool myOK; + bool isLengthVisible; + bool isAngleVisible; + double myLineWidth; GeometryGUI* myGeometryGUI; + SOCC_Prs* myAnglePrs; + SOCC_Prs* myLengthPrs; private slots: void ClickOnOk(); @@ -94,8 +132,6 @@ private slots: bool ClickOnApply(); // bool isSameAsPrevious(); void UpdateButtonsState(); - void GetLastPoints(double&, double&, double&); - void GetCurrentPoints(double&, double&, double&); void ClickOnUndo(); void ClickOnRedo(); @@ -103,8 +139,10 @@ private slots: void SelectionIntoArgument(); void DeactivateActiveDialog(); void ActivateThisDialog(); - void TypeClicked(); + void TypeClicked( int ); void ValueChangedInSpinBox( double ); + void ButtonClicked( bool ); + void BoxChecked ( bool ); void SetDoubleSpinBoxStep( double ); }; diff --git a/src/EntityGUI/EntityGUI_3Spin1Check_QTD.ui b/src/EntityGUI/EntityGUI_3Spin1Check_QTD.ui new file mode 100644 index 000000000..9dc92e222 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin1Check_QTD.ui @@ -0,0 +1,167 @@ + + + EntityGUI_3Spin1Check_QTD + + + + 0 + 0 + 270 + 149 + + + + EntityGUI_3Spin_QTD + + + + 0 + + + 0 + + + + + Values + + + + 9 + + + 6 + + + + + + + + 0 + + + 6 + + + + + Undo + + + + + + + Redo + + + + + + + + + Create + + + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + CheckBox + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + SpinBox_DX + SpinBox_DY + SpinBox_DZ + buttonApply + buttonUndo + buttonRedo + + + +
    diff --git a/src/EntityGUI/EntityGUI_4Spin1Check_QTD.ui b/src/EntityGUI/EntityGUI_4Spin1Check_QTD.ui new file mode 100644 index 000000000..b298c7c9d --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin1Check_QTD.ui @@ -0,0 +1,192 @@ + + + EntityGUI_4Spin1Check_QTD + + + + 0 + 0 + 384 + 189 + + + + EntityGUI_4Spin_QTD + + + + 0 + + + 0 + + + + + Values + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + + + Create + + + + + + + + 0 + 0 + + + + TL2 + + + false + + + + + + + + + + 0 + + + 6 + + + + + Redo + + + + + + + Undo + + + + + + + + + + 0 + 0 + + + + TL3 + + + false + + + + + + + + + + + 0 + 0 + + + + TL4 + + + false + + + + + + + + + + + + CheckBox + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + SpinBox_DX + SpinBox_DY + SpinBox_DZ + SpinBox_DS + buttonApply + buttonUndo + buttonRedo + + + +
    diff --git a/src/EntityGUI/EntityGUI_4Spin_QTD.ui b/src/EntityGUI/EntityGUI_4Spin_QTD.ui index 661beab41..e8f97689b 100644 --- a/src/EntityGUI/EntityGUI_4Spin_QTD.ui +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.ui @@ -1,147 +1,140 @@ - + + EntityGUI_4Spin_QTD - - + + 0 0 - 264 - 140 + 270 + 144 - + EntityGUI_4Spin_QTD - - + + 0 - + 0 - - - + + + Values - - + + 9 - + 6 - - + + - - + + - - + + - - + + - - - + + + 0 - + 6 - - - + + + Redo - - - + + + Undo - - - + + + Create - - - - - 0 - 0 + + + + 0 0 - + TL1 - + false - - - - - 0 - 0 + + + + 0 0 - + TL4 - + false - - - - - 0 - 0 + + + + 0 0 - + TL2 - + false - - - - - 0 - 0 + + + + 0 0 - + TL3 - + false @@ -151,13 +144,13 @@ - + qPixmapFromMimeSource SalomeApp_DoubleSpinBox QDoubleSpinBox -
    SalomeApp_DoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/EntityGUI/EntityGUI_Angles_QTD.ui b/src/EntityGUI/EntityGUI_Angles_QTD.ui new file mode 100644 index 000000000..41199563b --- /dev/null +++ b/src/EntityGUI/EntityGUI_Angles_QTD.ui @@ -0,0 +1,161 @@ + + + EntityGUI_Angles_QTD + + + + 0 + 0 + 351 + 148 + + + + EntityGUI_Angles_QTD + + + + 0 + + + 0 + + + + + Values + + + + + + + 0 + 0 + + + + Length + + + false + + + + + + + + + + Create + + + + + + + + 0 + 0 + + + + Angle + + + false + + + + + + + + + + 0 + + + 6 + + + + + Redo + + + + + + + Undo + + + + + + + + + + + OXY + + + + + + + OYZ + + + + + + + OXZ + + + + + + + + + CheckBox + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    + + SpinBox_DL + SpinBox_DA + radioButton_1 + radioButton_2 + radioButton_3 + checkBox + SpinBox_DA2 + buttonApply + buttonUndo + buttonRedo + + + +
    diff --git a/src/EntityGUI/EntityGUI_Controls_QTD.ui b/src/EntityGUI/EntityGUI_Controls_QTD.ui new file mode 100644 index 000000000..0c3222bea --- /dev/null +++ b/src/EntityGUI/EntityGUI_Controls_QTD.ui @@ -0,0 +1,49 @@ + + + EntityGUI_Controls_QTD + + + + 0 + 0 + 327 + 50 + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + qPixmapFromMimeSource + + + diff --git a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx new file mode 100644 index 000000000..d5f11d235 --- /dev/null +++ b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx @@ -0,0 +1,709 @@ +// Copyright (C) 2007-2012 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 : EntityGUI_SketcherDlg.cxx +// Author : Renaud NEDELEC, Open CASCADE S.A.S. + +// SALOME includes +#include "EntityGUI_FeatureDetectorDlg.h" +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +// OCCT includes +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include + +// C++ includes +#include +#include + +// boost includes +#include + +// Constructors +enum{ + CONTOURS, + CORNERS, + LINES +}; + +enum { + RADIO_BUTTONS, + MSG, + PUSH_BUTTON, +}; + +// // // View +// // enum { +// // XY, +// // YZ, +// // XZ +// // }; + + +//================================================================================= +// class : EntityGUI_FeatureDetectorDlg() +// purpose : Constructs a EntityGUI_FeatureDetectorDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +EntityGUI_FeatureDetectorDlg::EntityGUI_FeatureDetectorDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("OCCViewer", tr("ICON_OCCVIEWER_VIEW_DUMP"))); + + setWindowTitle(tr("GEOM_DETECT_TITLE")); + + /***************************************************************/ + + mainFrame()->GroupConstructors->setTitle(tr("GEOM_FEATURES")); + mainFrame()->RadioButton1->setText(tr("GEOM_CONTOURS")); + mainFrame()->RadioButton2->setText(tr("GEOM_CORNERS")); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + +// myViewGroup = new DlgRef_3Radio(centralWidget()); +// myViewGroup->GroupBox1->setTitle(tr("GEOM_VIEW")); +// myViewGroup->RadioButton1->setText(tr( "GEOM_TOP" )); +// myViewGroup->RadioButton2->setText(tr( "GEOM_FRONT")); +// myViewGroup->RadioButton3->setText(tr( "GEOM_LEFT" )); +// myViewButtonGroup = new QButtonGroup( this ); +// myViewButtonGroup->addButton( myViewGroup->RadioButton1, XY ); // Top view +// myViewButtonGroup->addButton( myViewGroup->RadioButton2, YZ ); // Front View +// myViewButtonGroup->addButton( myViewGroup->RadioButton3, XZ ); // Left View +// +// myViewGroup->hide(); + + // Widgets for the selection of the picture and the Region Of Interest + + + mySelectionGroup = new DlgRef_1Sel1Frame(centralWidget()); + + mySelectionGroup->PushButton1->setIcon(image0); + mySelectionGroup->PushButton1->setCheckable(true); + mySelectionGroup->PushButton1->setAutoExclusive(true); + + mySelectionGroup->PushButton2->setIcon(image1); + mySelectionGroup->PushButton2->setCheckable(true); + mySelectionGroup->PushButton2->setAutoExclusive(true); + + mySelectionGroup->TextLabel1->setText(tr( "GEOM_PICTURE" )); + mySelectionGroup->FrameLabel->setText(""); + + myOutputGroup = new DlgRef_3Radio(centralWidget()); + myOutputGroup->GroupBox1->setTitle(tr("GEOM_DETECT_OUTPUT")); + myOutputGroup->RadioButton2->setText(tr( "GEOM_POLYLINE" )); + myOutputGroup->RadioButton1->setText(tr( "GEOM_SPLINE")); + myOutputGroup->RadioButton3->hide(); + +// myOutputGroup->hide(); //caché pour la demo + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); +// layout->addWidget( myViewGroup); + layout->addWidget( mySelectionGroup); + layout->addWidget( myOutputGroup); + +// mainFrame()->GroupBoxName->hide(); + + // Build an instance of detection used to perform image processing operations + aDetector = new ShapeRec_FeatureDetector(); + + setHelpFileName( "shape_recognition_page.html" ); + + Init(); + +} + +//================================================================================= +// function : ~EntityGUI_FeatureDetectorDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +EntityGUI_FeatureDetectorDlg::~EntityGUI_FeatureDetectorDlg() +{ + +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void EntityGUI_FeatureDetectorDlg::Init() +{ + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); + connect( mySelectionGroup->PushButton2, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + connect( mySelectionGroup->PushButton1, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); +// connect( myViewButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( onViewClicked( int ) ) ); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),this, SLOT( SelectionIntoArgument() ) ); + + myConstructorId = 0; + mySelectionGroup->PushButton1->click(); + +// SetEditCurrentArgument(); + SelectionIntoArgument(); + + initName(tr("GEOM_CONTOURS")); + resize(100,100); + +// myViewGroup->RadioButton1->setChecked(true); + myOutputGroup->RadioButton1->setChecked(true); + + gp_Pnt aOrigin = gp_Pnt(0, 0, 0); + gp_Dir aDirZ = gp_Dir(0, 0, 1); + gp_Dir aDirX = gp_Dir(1, 0, 0); + + aGlobalCS = gp_Ax3(aOrigin, aDirZ, aDirX); + + myStartPnt = gp_Pnt(0,0,0); + myEndPnt = myStartPnt; + + myGeomGUI->SetWorkingPlane( aGlobalCS ); + myGeomGUI->ActiveWorkingPlane(); + + ConstructorsClicked(myConstructorId); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void EntityGUI_FeatureDetectorDlg::SelectionIntoArgument() +{ + + // TODO supprimer les lignes qui ne servent à rien le cas échéant + SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow(); + std::map< std::string , std::vector >::iterator AISit; + SOCC_Viewer* soccViewer = (SOCC_Viewer*)(theViewWindow->getViewManager()->getViewModel()); + + if (!myEditCurrentArgument->isEnabled()) + return; + + myEditCurrentArgument->setText( "" ); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + SALOME_ListIteratorOfListIO anIt( aSelList ); + + for( ; anIt.More(); anIt.Next() ) + if( !anIt.Value().IsNull() ) + { + myFaceEntry = anIt.Value()->getEntry(); + } + + if (aSelList.Extent() != 1) { + if (myEditCurrentArgument == mySelectionGroup->LineEdit1) + myFace.nullify(); + return; + } + + TopAbs_ShapeEnum aNeedType = TopAbs_FACE ; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + + if ( myEditCurrentArgument == mySelectionGroup->LineEdit1 ) { + myFace = aSelectedObject; + AISit = soccViewer->entry2aisobjects.find(myFaceEntry.toStdString()); + if (AISit == soccViewer->entry2aisobjects.end()) + return; + + Handle(AIS_InteractiveObject) myAIS = (*AISit).second[0]; + Handle(GEOM_AISShape) myAISShape; + if( myAIS->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { + myAISShape = Handle(GEOM_AISShape)::DownCast( myAIS ); + } + else + return ; + + std::string theImgFileName = myAISShape->TextureFile(); + if ( theImgFileName == "" ) + return ; + + // Setting the image caracteristics + aDetector->SetPath( theImgFileName ); + height = aDetector->GetImgHeight(); + width = aDetector->GetImgWidth(); + pictureLeft = -0.5 * width; // X coordinate of the top left corner of the background image in the view + pictureTop = 0.5 * height; // Y coordinate of both top corners + + } + } + +} + +//================================================================================= +// function : acceptMouseEvent() +// purpose : +//================================================================================= +bool EntityGUI_FeatureDetectorDlg::acceptMouseEvent() const +{ + return mySelectionGroup->PushButton2->isChecked(); +} + +//======================================================================= +// function : ClickOnOk() +// purpose : +//======================================================================= +void EntityGUI_FeatureDetectorDlg::ClickOnOk() +{ + setIsApplyAndClose( true ); + if (onAccept()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool EntityGUI_FeatureDetectorDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + +// initName(); + ConstructorsClicked(getConstructorId()); + return true; +} + +//================================================================================= +// function : onConstructorClicked(int) +// purpose : +//================================================================================= +void EntityGUI_FeatureDetectorDlg::ConstructorsClicked(int id) +{ + MESSAGE("Constructor id ="<show(); +// mySelectionGroup->show(); + myOutputGroup->hide(); +// mySelectionGroup->TextLabel2->setText(tr("GEOM_DETECT_ZONE")); + mySelectionGroup->TextLabel2->hide(); + mySelectionGroup->Frame->hide(); + mySelectionGroup->PushButton2->hide(); + initName(tr("GEOM_CORNERS")); + break; + case CONTOURS: +// myViewGroup->hide(); +// mySelectionGroup->hide(); +// mySelectionGroup->show(); + myOutputGroup->show(); + mySelectionGroup->TextLabel2->show(); + mySelectionGroup->Frame->show(); + mySelectionGroup->PushButton2->show(); + mySelectionGroup->TextLabel2->setText(tr("GEOM_COLOR_FILTER")); + initName(tr("GEOM_CONTOURS")); + break; + case LINES: +// myViewGroup->hide(); +// mySelectionGroup->hide(); +// mySelectionGroup->show(); + myOutputGroup->hide(); + mySelectionGroup->TextLabel2->setText(tr("")); + initName(tr("GEOM_LINES")); + break; + } +} + +// //================================================================================= +// // function : onViewClicked() +// // purpose : +// //================================================================================= +// void EntityGUI_FeatureDetectorDlg::onViewClicked(int id) +// { +// gp_Pnt aOrigin = gp_Pnt(0, 0, 0); +// gp_Dir aDirZ; +// gp_Dir aDirX; +// +// switch(id) +// { +// case XY: +// aDirZ = gp_Dir(0, 0, 1); +// aDirX = gp_Dir(1, 0, 0); +// break; +// case YZ: +// aDirZ = gp_Dir(1, 0, 0); +// aDirX = gp_Dir(0, 1, 0); +// break; +// case XZ: +// aDirZ = gp_Dir(0, -1, 0); +// aDirX = gp_Dir(1, 0 , 0); +// break; +// } +// +// myWPlane = gp_Ax3(aOrigin, aDirZ, aDirX); +// myGeomGUI->SetWorkingPlane( myWPlane ); +// myGeomGUI->ActiveWorkingPlane(); +// +// } + +//================================================================================= +// function : onButtonClicked() +// purpose : +//================================================================================= +void EntityGUI_FeatureDetectorDlg::onButtonClicked() +{ + QPushButton* send = (QPushButton*)sender(); + if (send == mySelectionGroup->PushButton2) + { + mySelectionGroup->LineEdit1->setEnabled(false); + } + else if (send == mySelectionGroup->PushButton1) + { + myStartPnt = gp_Pnt(0,0,0); + myEndPnt = myStartPnt; + myEditCurrentArgument = mySelectionGroup->LineEdit1; + mySelectionGroup->LineEdit1->setEnabled(true); + } +} + +//================================================================================= +// function : setStartPnt( const QPoint& ) +// purpose : +//================================================================================= +void EntityGUI_FeatureDetectorDlg::setStartPnt(const gp_Pnt& theStartPnt) +{ + myStartPnt = theStartPnt; + MESSAGE("myStartPnt = ("<GetImgHeight() > 0) + showImageSample(); +} + +//================================================================================= +// function : setSelectionRect() +// purpose : +//================================================================================= +bool EntityGUI_FeatureDetectorDlg::setSelectionRect() +{ + // Set detection rectangle in the background image coordinates system + double left = std::min( myStartPnt.X(), myEndPnt.X() ); + double top = std::max( myStartPnt.Y(), myEndPnt.Y() ); + double right = std::max( myStartPnt.X(), myEndPnt.X() ); + double bottom = std::min( myStartPnt.Y(), myEndPnt.Y() ); + + QPoint topLeft = QPoint(left - pictureLeft, pictureTop - top ); + QPoint bottomRight = QPoint(right - pictureLeft, pictureTop - bottom); + + myRect = QRect(topLeft, bottomRight); + + return (!myRect.isEmpty() && myRect.width() > 1); +} + +//================================================================================= +// function : showImageSample() +// purpose : Display a preview of the image sample selected by the user +//================================================================================= +void EntityGUI_FeatureDetectorDlg::showImageSample() +{ + // Cropp the image to the selection rectangle given by the user + aDetector->SetROI( myRect ); + std::string samplePicturePath = aDetector->CroppImage(); + + // Display the result + QPixmap pixmap(QString(samplePicturePath.c_str())); + mySelectionGroup->FrameLabel->setPixmap(pixmap); + mySelectionGroup->FrameLabel->setMask(pixmap.mask()); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr EntityGUI_FeatureDetectorDlg::createOperation() +{ + return myGeomGUI->GetGeomGen()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : execute() +// purpose : +//================================================================================= +bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_IBasicOperations_var aBasicOperations = myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); + GEOM::GEOM_IShapesOperations_var aShapesOperations = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + + if (myConstructorId == CORNERS) + { + double subPictureLeft; + double subPictureTop; + if( !myRect.isEmpty() ) + { + aDetector->SetROI( myRect ); + subPictureLeft = myStartPnt.X(); + subPictureTop = myStartPnt.Y(); + } + else + { + subPictureLeft = pictureLeft; + subPictureTop = pictureTop; + } + aDetector->ComputeCorners(); + CvPoint2D32f* corners = aDetector->GetCorners(); + int cornerCount = aDetector->GetCornerCount(); + int i; + + // Build the geom objects associated to the detected corners and returned by execute + if( !aBasicOperations->_is_nil() && !aShapesOperations->_is_nil() ) + { + GEOM::GEOM_Object_var aGeomCorner; + GEOM::ListOfGO_var geomCorners = new GEOM::ListOfGO(); + geomCorners->length( cornerCount ); + for (i = 0; i < cornerCount; i++) + { + double x = subPictureLeft + corners[i].x; + double y = subPictureTop - corners[i].y; + double z = 0; + + aGeomCorner = aBasicOperations->MakePointXYZ( x,y,z ); + + geomCorners[i] = aGeomCorner; + } + GEOM::GEOM_Object_var aCompound = aShapesOperations->MakeCompound(geomCorners); + if ( !aCompound->_is_nil() ) + { + // Dark blue color + SALOMEDS::Color aColor; + aColor.R = 0; + aColor.G = 0; + aColor.B = 0.8; + + aCompound->SetColor(aColor); + aCompound->SetMarkerStd(GEOM::MT_POINT,GEOM::MS_30); + objects.push_back( aCompound._retn() ); + res = true; + } + } + } + else if (myConstructorId == CONTOURS) + { + int method = 0 ; //CANNY + if( !myRect.isEmpty() && myRect.width() > 1 ) + { + aDetector->SetROI( myRect ); + method = 1 ; //COLORFILTER + } + + GEOM::GEOM_ICurvesOperations_var aCurveOperations = myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); + + aDetector->ComputeContours( method ); + std::vector< std::vector > contours = aDetector->GetContours(); + std::vector hierarchy = aDetector->GetContoursHierarchy(); + + std::vector< cv::Point > contour; + int idx = 0; + + GEOM::ListOfGO_var geomContours = new GEOM::ListOfGO(); + int contourCount = 0; + + bool insert; + + MESSAGE("hierarchy.size() =" << hierarchy.size()) + for( ; idx >= 0; idx = hierarchy[idx][0]) + { +// for(int count=0, child=idx; child>=0, count<1; child=hierarchy[idx][2], count++) +// { +// contour = contours[child]; + contour = contours[idx]; + std::vector< cv::Point >::iterator it; + std::vector< cv::Point >::iterator it_previous; + std::vector< cv::Point >::iterator it_next; + GEOM::GEOM_Object_var aGeomContourPnt; + GEOM::ListOfGO_var geomContourPnts = new GEOM::ListOfGO(); + + geomContourPnts->length( contour.size() ); + + int j = 0; + std::set< std::vector > existing_points; + std::pair< std::set< std::vector >::iterator,bool > pnt_it; + for ( it=contour.begin() ; it < contour.end(); it++ ) + { + int pnt_array[] = {it->x,it->y}; + std::vector pnt (pnt_array, pnt_array + sizeof(pnt_array) / sizeof(int) ); + + pnt_it=existing_points.insert(pnt); + if (pnt_it.second == true) // To avoid double points in the contours + { + insert = true; + if (it!=contour.begin()) // From the second point on perform some checking to avoid loops in the contours we build + { + it_previous = boost::prior(it); + it_next = boost::next(it); + + double u_v_scalar_product = (it->x - it_previous->x) * (it_next->x - it->x) + + (it->y - it_previous->y) * (it_next->y - it->y); + if (u_v_scalar_product < 0) + { + double u_v_det = (it->x - it_previous->x) * (it_next->y - it->y) - + (it->y - it_previous->y) * (it_next->x - it->x); + + double norme_u = sqrt ( (it->x - it_previous->x)*(it->x - it_previous->x) + + (it->y - it_previous->y)*(it->y - it_previous->y) ); + + double norme_v = sqrt ( (it->x - it_next->x)*(it->x - it_next->x) + + (it->y - it_next->y)*(it->y - it_next->y) ); + + double u_v_sinus = u_v_det / (norme_u * norme_v); + + if (fabs(u_v_sinus) < Precision::Confusion()) + { + insert = false; + } + } + } + double x = -0.5 *width + it->x; + double y = 0.5 *height - it->y; + double z = 0; + if (insert) + { + aGeomContourPnt = aBasicOperations->MakePointXYZ( x,y,z ); + geomContourPnts->length( j+1 ); + geomContourPnts[j] = aGeomContourPnt; + j++; + } + } + } + + GEOM::GEOM_Object_var aWire; + if(myOutputGroup->RadioButton2->isChecked()) + { + aWire = aCurveOperations->MakePolyline(geomContourPnts.in(), false); + } + else if(myOutputGroup->RadioButton1->isChecked()) + { + aWire = aCurveOperations->MakeSplineInterpolation(geomContourPnts.in(), /*closed =*/ false, /*reordering =*/ false); + } + else + return res; + + if ( !aWire->_is_nil() ) + { + geomContours->length(contourCount + 1); + geomContours[contourCount] = aWire; + contourCount++; + } +// } + } + GEOM::GEOM_Object_var aContoursCompound = aShapesOperations->MakeCompound(geomContours); + if ( !aContoursCompound->_is_nil() ) + { + objects.push_back( aContoursCompound._retn() ); + } + res=true; + } + + // TEST not very conclusive + +// else if(myConstructorId ==LINES) +// { +// aDetector->ComputeLines(); +// std::vector lines = aDetector->GetLines(); +// GEOM::GEOM_Object_var Pnt1; +// GEOM::GEOM_Object_var Pnt2; +// GEOM::GEOM_Object_var aLine; +// +// GEOM::ListOfGO_var geomLines = new GEOM::ListOfGO(); +// int linesCount=0; +// for( int i = 0; i < lines.size(); i++ ) +// { +// Pnt1 = aBasicOperations->MakePointXYZ( -0.5 *width + lines[i][0], 0.5 *height - lines[i][1], 0 ); +// Pnt2 = aBasicOperations->MakePointXYZ( -0.5 *width + lines[i][2], 0.5 *height - lines[i][3], 0 ); +// aLine = aBasicOperations->MakeLineTwoPnt( Pnt1, Pnt2 ); +// if ( !aLine->_is_nil() ) +// { +// geomLines->length(linesCount + 1); +// geomLines[linesCount] = aLine; +// linesCount++; +// } +// } +// GEOM::GEOM_Object_var aLinesCompound = aShapesOperations->MakeCompound(geomLines); +// if ( !aLinesCompound->_is_nil() ) +// { +// objects.push_back( aLinesCompound._retn() ); +// } +// +// res=true; +// } + + return res; +} diff --git a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.h b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.h new file mode 100644 index 000000000..2595142b9 --- /dev/null +++ b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.h @@ -0,0 +1,108 @@ +// Copyright (C) 2007-2012 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 : EntityGUI_SketcherDlg.cxx +// Author : Renaud NEDELEC, Open CASCADE S.A.S. + + +#include +#include +#include + +class QLineEdit; +class QCheckBox; +class QGroupBox; +class QPushButton; +class QLabel; +class QPoint; +class DlgRef_3Radio; +class DlgRef_1Sel; +class DlgRef_1Sel1Frame; + +class gp_Pnt; +class ShapeRec_FeatureDetector; + +//================================================================================= +// class : EntityGUI_Dlg +// purpose : +//================================================================================= +class EntityGUI_FeatureDetectorDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + EntityGUI_FeatureDetectorDlg(GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0); + ~EntityGUI_FeatureDetectorDlg(); + + bool acceptMouseEvent() const; + void setStartPnt ( const gp_Pnt& ); + void setEndPnt ( const gp_Pnt& ); + int getConstructorId() {return myConstructorId;}; + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool execute( ObjectList& ); + +private: + void Init(); + bool setSelectionRect(); + void showImageSample(); + + +private slots: + void SelectionIntoArgument(); + void ConstructorsClicked( int ); +// void onViewClicked( int ); + void onButtonClicked(); + void ClickOnOk(); + bool ClickOnApply(); + + +private: + ShapeRec_FeatureDetector* aDetector; + + gp_Ax3 myWPlane; + gp_Ax3 aGlobalCS; + + GEOM::GeomObjPtr myFace; + QString myFaceEntry; + + int myConstructorId; + + DlgRef_1Sel1Frame* mySelectionGroup; + DlgRef_1Sel* mySelWidget; + + // Output typeselection widget + DlgRef_3Radio* myOutputGroup;; + + gp_Pnt myStartPnt; + gp_Pnt myEndPnt; + QRect myRect; + + // Picture dimensions and position + int height; + int width; + double pictureLeft; + double pictureTop; +}; diff --git a/src/EntityGUI/EntityGUI_PictureImportDlg.cxx b/src/EntityGUI/EntityGUI_PictureImportDlg.cxx new file mode 100644 index 000000000..774e2c2b1 --- /dev/null +++ b/src/EntityGUI/EntityGUI_PictureImportDlg.cxx @@ -0,0 +1,205 @@ +// Copyright (C) 2007-2012 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 : EntityGUI_PictureImportDlg.cxx +// Author : Renaud NEDELEC, Open CASCADE S.A.S. +// +#include "EntityGUI_PictureImportDlg.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +// #include + +#include + +//================================================================================= +// class : EntityGUI_PictureImportDlg() +// purpose : Constructs a EntityGUI_PictureImportDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +EntityGUI_PictureImportDlg::EntityGUI_PictureImportDlg( GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl ) + : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) +{ + QPixmap image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_IMPORT_PICTURE"))); + setWindowTitle( tr( "GEOM_IMPORT_PICT_TITLE" ) ); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PICTURE" ) ); + + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + QGroupBox* GroupFileSel = new QGroupBox( centralWidget() ); + GroupFileSel->setTitle( tr( "GEOM_FILE" ) ); + QHBoxLayout* myFileSelGrpLayout = new QHBoxLayout(GroupFileSel ); + myPushButton = new QPushButton( GroupFileSel ); + myLineEdit = new QLineEdit( GroupFileSel ); + myPushButton->setText("..."); + + myFileSelGrpLayout->addWidget( myLineEdit, 1); + myFileSelGrpLayout->addWidget( myPushButton, 0); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin( 0 ); layout->setSpacing( 6 ); + layout->addWidget( GroupFileSel ); + + setHelpFileName( "import_picture_page.html" ); + + Init(); +} + + +//================================================================================= +// function : ~EntityGUI_PictureImportDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +EntityGUI_PictureImportDlg::~EntityGUI_PictureImportDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void EntityGUI_PictureImportDlg::Init() +{ + connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( myPushButton, SIGNAL( clicked() ), this, SLOT( FileSelectionClicked() ) ); + + resize(100,100); + + gp_Pnt aOrigin = gp_Pnt(0, 0, 0); + gp_Dir aDirZ = gp_Dir(0, 0, 1); + gp_Dir aDirX = gp_Dir(1, 0, 0); + + gp_Ax3 aGlobalCS = gp_Ax3(aOrigin, aDirZ, aDirX); + + myGeomGUI->SetWorkingPlane( aGlobalCS ); + myGeomGUI->ActiveWorkingPlane(); + + initName( tr( "GEOM_PICTURE" ) ); +} + +// ================================================================================= +// function : FileSelectionClicked() +// purpose : +// ================================================================================= +void EntityGUI_PictureImportDlg::FileSelectionClicked() +{ + QString selFile = QFileDialog::getOpenFileName(this,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES")); + if ( ! selFile.isEmpty() ) + myLineEdit->setText(selFile); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void EntityGUI_PictureImportDlg::ClickOnOk() +{ + MESSAGE("EntityGUI_PictureImportDlg::ClickOnOk()") + setIsApplyAndClose( true ); + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool EntityGUI_PictureImportDlg::ClickOnApply() +{ + MESSAGE("EntityGUI_PictureImportDlg::ClickOnApply()") + if ( !onAccept() ) + return false; + + initName(); + myLineEdit->setText( "" ); + + return true; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr EntityGUI_PictureImportDlg::createOperation() +{ + return myGeomGUI->GetGeomGen()->GetIBlocksOperations( getStudyId() ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool EntityGUI_PictureImportDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IBasicOperations_var aBasicOperations = myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); + GEOM::GEOM_IBlocksOperations_var aBlocksOperations = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() ); + QString theImgFileName = myLineEdit->text(); + if ( theImgFileName.isEmpty() ) + return res; + + QPixmap* pixmap = new QPixmap(theImgFileName); + int height = pixmap->height(); + int width = pixmap->width(); + + GEOM::GEOM_Object_var P1 = aBasicOperations->MakePointXYZ( -0.5*width, -0.5*height, 0 ); + GEOM::GEOM_Object_var P2 = aBasicOperations->MakePointXYZ( -0.5*width, 0.5*height, 0 ); + GEOM::GEOM_Object_var P3 = aBasicOperations->MakePointXYZ( 0.5*width, 0.5*height, 0 ); + GEOM::GEOM_Object_var P4 = aBasicOperations->MakePointXYZ( 0.5*width, -0.5*height, 0 ); + + GEOM::GEOM_Object_var aFace = aBlocksOperations->MakeQuad4Vertices(P1,P2,P3,P4); + getDisplayer()->SetTexture(theImgFileName.toStdString()); + + if ( !aFace->_is_nil() ) + { + objects.push_back( aFace._retn() ); + } + + res=true; + + + return res; +} + diff --git a/src/EntityGUI/EntityGUI_PictureImportDlg.h b/src/EntityGUI/EntityGUI_PictureImportDlg.h new file mode 100644 index 000000000..4fc9fb09b --- /dev/null +++ b/src/EntityGUI/EntityGUI_PictureImportDlg.h @@ -0,0 +1,74 @@ +// Copyright (C) 2007-2012 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 : EntityGUI_PictureImportDlg.h +// Author : Renaud NEDELEC, Open CASCADE S.A.S. +// +#ifndef BASICGUI_LINEDLG_H +#define BASICGUI_LINEDLG_H + +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" + +class QGroupBox; +//================================================================================= +// class : EntityGUI_PictureImportDlg +// purpose : +//================================================================================= +class EntityGUI_PictureImportDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + EntityGUI_PictureImportDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~EntityGUI_PictureImportDlg(); + +protected: +// // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); +// virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); +// virtual void addSubshapesToStudy(); + +private: + void Init(); +// void enterEvent( QEvent* ); + +private: + QGroupBox* GroupSelFile; + QPushButton* myPushButton; + QLineEdit* myLineEdit; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); +// +// void ActivateThisDialog(); +// void DeactivateActiveDialog(); + void FileSelectionClicked( ); +// +// void SelectionIntoArgument(); +// void SetEditCurrentArgument(); +}; + +#endif // BASICGUI_LINEDLG_H diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.ui b/src/EntityGUI/EntityGUI_Skeleton_QTD.ui index dd2529583..7fd1fb34f 100644 --- a/src/EntityGUI/EntityGUI_Skeleton_QTD.ui +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.ui @@ -1,103 +1,89 @@ - + + EntityGUI_Skeleton_QTD - - + + 0 0 - 363 - 234 + 390 + 236 - + + + 0 + 0 + + + Form - - - 0 - - - 0 - - + + 0 - - 0 - - + 6 - - 6 - - - - - + + + + 0 0 - + - - + + 6 - - 9 - - - 9 - - - 9 - - + 9 - - + + End Sketch - - + + Close Sketch - + Qt::Horizontal - - QSizePolicy::Expanding + + QSizePolicy::MinimumExpanding - + - 91 + 35 0 - - + + &Cancel - - + + &Help @@ -105,79 +91,58 @@ - - + + - - - - + + + + 0 0 - + Destination - - + + 9 - - 9 - - - 9 - - - 9 - - - 6 - - + 6 - - + + - - - - + + + + 0 0 - + Type - - + + 6 - - 9 - - - 9 - - - 9 - - + 9 - - + + Point - - + + Direction @@ -188,47 +153,45 @@ - - - - + + + + 0 0 - + Element Type - - + + 6 - - 9 - - - 9 - - - 9 - - + 9 - - + + Segment - - + + Arc + + + + Rectangle + + + diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 7f07b966f..d0333cd59 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -1,35 +1,44 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI_SketcherDlg.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. // #include "EntityGUI_SketcherDlg.h" #include "EntityGUI_Widgets.h" -#include +#include + +#include +#include +#include #include #include #include +#include +#include + +#include #include #include @@ -39,6 +48,8 @@ #include #include +#include + #include #include @@ -48,8 +59,16 @@ #include #include #include +#include #include +#include +#include + +#include + +#include + //================================================================================= // class : EntityGUI_SketcherDlg() // purpose : Constructs a EntityGUI_SketcherDlg which is a child of 'parent', with the @@ -58,8 +77,8 @@ // TRUE to construct a modal dialog. //================================================================================= EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, - bool modal, Qt::WindowFlags fl, - const double lineWidth ) + bool modal, Qt::WindowFlags fl, + const double lineWidth ) : QDialog( parent, fl ), myIsAllAdded( false ), myIsApply( false ), @@ -67,36 +86,85 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, myGeometryGUI( GUI ), myLineWidth( lineWidth ) { + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); setModal( modal ); setAttribute( Qt::WA_DeleteOnClose ); - + + // Disable rectangular selection +// SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow(); +// ((OCCViewer_ViewWindow*)theViewWindow)->setEnabledDrawMode( false ); +// MESSAGE("((OCCViewer_ViewWindow*)theViewWindow)->isEnabledDrawMode();"<<((OCCViewer_ViewWindow*)theViewWindow)->isEnabledDrawMode()) +// OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); +// vp->setSketchingEnabled( false ); +// MESSAGE("vp->isSketchingEnabled()"<isSketchingEnabled()) +// ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(true); +// OCCViewer_ViewSketcher* aViewSketcher = ((OCCViewer_ViewWindow*)theViewWindow)->getSketcher( OCCViewer_ViewWindow::Rect ); +// aViewSketcher->deactivate() +// aViewSketcher->setVisible(false); + +// this->setMouseTracking(false); + myGeometryGUI->SetActiveDialogBox(this); MainWidget = new EntityGUI_Skeleton( this ); QVBoxLayout* topLayout = new QVBoxLayout( this ); topLayout->setMargin( 9 ); topLayout->setSpacing( 6 ); - topLayout->addWidget( MainWidget ); MainWidget->buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ); - MainWidget->buttonEnd->setText( tr( "GEOM_BUT_END_SKETCH" ) ); + MainWidget->buttonEnd->setText( tr( "GEOM_BUT_CLOSE" ) ); MainWidget->buttonClose->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) ); MainWidget->buttonHelp->setText( tr( "GEOM_BUT_HELP" ) ); - QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) ); - QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) ); + QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) ); + QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) ); + QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) ); + QPixmap image4( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) ); + QPixmap image5 (aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image6 (aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_RECTANGLE" ) ) ); setWindowTitle( tr( "GEOM_SKETCHER_TITLE" ) ); MainWidget->GroupConstructors->setTitle( tr( "GEOM_SKETCHER_EL" ) ); - MainWidget->RadioButton1->setText( tr( "GEOM_SKETCHER_SEGMENT" ) ); - MainWidget->RadioButton2->setText( tr( "GEOM_SKETCHER_ARC" ) ); + MainWidget->RadioButton1->setText( "" ); + MainWidget->RadioButton1->setIcon( image3 ); + MainWidget->RadioButton2->setText( "" ); + MainWidget->RadioButton2->setIcon( image4 ); + MainWidget->RadioButton3->setText( "" ); + MainWidget->RadioButton3->setIcon( image6 ); MainWidget->GroupDest->setTitle( tr( "GEOM_SKETCHER_DEST" ) ); MainWidget->GroupDest1->setTitle( tr( "GEOM_SKETCHER_TYPE" ) ); MainWidget->RB_Dest1->setText( tr( "GEOM_SKETCHER_POINT" ) ); MainWidget->RB_Dest2->setText( tr( "GEOM_SKETCHER_DIR" ) ); /***************************************************************/ + + GroupBox1 = new QGroupBox(tr("GEOM_CS"), this); + QGridLayout* planeLayout = new QGridLayout(GroupBox1); + planeLayout->setSpacing(6); + planeLayout->setMargin(11); + + ComboBox1 = new QComboBox(GroupBox1); + planeLayout->addWidget(ComboBox1,0,0,1,2); + + planeButton = new QPushButton (GroupBox1); + planeButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) ); + planeLayout->addWidget(planeButton,0,2); + + selButton = new QPushButton (GroupBox1); + selButton->setIcon(image5); + planeLayout->addWidget(selButton,1,0); + + WPlaneLineEdit = new QLineEdit (GroupBox1); + WPlaneLineEdit->setReadOnly(true); + planeLayout->addWidget(WPlaneLineEdit,1,1,1,2); + + planeLayout->setColumnStretch(1,1); + + topLayout->addWidget(GroupBox1); + topLayout->addWidget( MainWidget ); + topLayout->setStretch( 1, 1); + GroupPt = new EntityGUI_Point( MainWidget->DestCnt ); GroupPt->GroupPoint->setTitle( tr( "GEOM_SKETCHER_POINT" ) ); @@ -104,6 +172,13 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, GroupPt->RB_Point2->setText( tr( "GEOM_SKETCHER_REL" ) ); GroupPt->RB_Point3->setText( tr( "GEOM_SKETCHER_SEL" ) ); + GroupPt2 = new EntityGUI_Point( MainWidget->DestCnt ); + + GroupPt2->GroupPoint->setTitle( tr( "GEOM_SKETCHER_ADD_PARAMS" ) ); + GroupPt2->RB_Point1->setText( tr( "GEOM_SKETCHER_NONE" ) ); + GroupPt2->RB_Point2->setText( tr( "GEOM_SKETCHER_RADIUS" ) ); + GroupPt2->RB_Point3->setText( tr( "GEOM_SKETCHER_CENTER" ) ); + GroupD1 = new EntityGUI_Dir1( MainWidget->DestCnt ); GroupD1->GroupDir1->setTitle( tr( "GEOM_SKETCHER_DIR" ) ); @@ -114,13 +189,12 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, GroupD2 = new EntityGUI_Dir2( MainWidget->DestCnt ); - GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIR" ) ); + GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIST" ) ); GroupD2->RB_Dir21->setText( tr( "GEOM_SKETCHER_LENGTH" ) ); GroupD2->RB_Dir22->setText( tr( "GEOM_SKETCHER_X" ) ); GroupD2->RB_Dir23->setText( tr( "GEOM_SKETCHER_Y" ) ); Group1Sel = new EntityGUI_1Sel( MainWidget->SkeletonCnt ); - Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_POINT2" ) ); Group1Sel->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); Group1Sel->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) ); @@ -129,6 +203,26 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, Group1Sel->buttonRedo->setIcon( image2 ); Group1Sel->LineEdit1->setReadOnly( true ); + Group2Sel = new EntityGUI_2Sel1Check( MainWidget->SkeletonCnt ); + Group2Sel->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); + Group2Sel->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) ); + Group2Sel->checkBox->setText( tr( "GEOM_REVERSE" ) ); + Group2Sel->PushButton1->setIcon( image0 ); + Group2Sel->PushButton2->setIcon( image0 ); + Group2Sel->buttonUndo->setIcon( image1 ); + Group2Sel->buttonRedo->setIcon( image2 ); + Group2Sel->LineEdit1->setReadOnly( true ); + Group2Sel->LineEdit2->setReadOnly( true ); + + Group1Sel1Spin = new EntityGUI_1Sel1Spin1Check( MainWidget->SkeletonCnt ); + Group1Sel1Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); + Group1Sel1Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) ); + Group1Sel1Spin->checkBox->setText( tr( "GEOM_REVERSE" ) ); + Group1Sel1Spin->PushButton1->setIcon( image0 ); + Group1Sel1Spin->buttonUndo->setIcon( image1 ); + Group1Sel1Spin->buttonRedo->setIcon( image2 ); + Group1Sel1Spin->LineEdit1->setReadOnly( true ); + Group1Spin = new EntityGUI_1Spin( MainWidget->SkeletonCnt ); Group1Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); Group1Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) ); @@ -141,31 +235,53 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, Group2Spin->buttonUndo->setIcon( image1 ); Group2Spin->buttonRedo->setIcon( image2 ); - Group3Spin = new EntityGUI_3Spin( MainWidget->SkeletonCnt ); + Group3Spin = new EntityGUI_3Spin1Check( MainWidget->SkeletonCnt ); Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); Group3Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) ); + Group3Spin->checkBox->setText( tr( "GEOM_REVERSE" ) ); Group3Spin->buttonUndo->setIcon( image1 ); Group3Spin->buttonRedo->setIcon( image2 ); - Group4Spin = new EntityGUI_4Spin( MainWidget->SkeletonCnt ); + Group4Spin = new EntityGUI_4Spin1Check( MainWidget->SkeletonCnt ); Group4Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); Group4Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) ); + Group4Spin->checkBox->setText( tr( "GEOM_REVERSE" ) ); Group4Spin->buttonUndo->setIcon( image1 ); Group4Spin->buttonRedo->setIcon( image2 ); + + GroupRect = new DlgRef_4Spin( MainWidget->SkeletonCnt ); + GroupRect->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) ); + GroupRect->TextLabel1->setText("X1:"); + GroupRect->TextLabel2->setText("Y1:"); + GroupRect->TextLabel3->setText("X2:"); + GroupRect->TextLabel4->setText("Y2:"); + + // Defines a palette for the error message on Group4Spin and Group2Sel + QPalette palette; + QColor color("red"); + palette.setColor(Group4Spin->label->foregroundRole(), color); + Group4Spin->label->setPalette(palette); + palette.setColor(Group2Sel->label->foregroundRole(), color); + Group2Sel->label->setPalette(palette); QGridLayout* DestCntLayout = new QGridLayout( MainWidget->DestCnt ); DestCntLayout->setMargin( 0 ); DestCntLayout->setSpacing( 6 ); - DestCntLayout->addWidget( GroupPt, 0, 0, 1, 2 ); - DestCntLayout->addWidget( GroupD1, 1, 0 ); - DestCntLayout->addWidget( GroupD2, 1, 1 ); + DestCntLayout->addWidget( GroupPt, 0, 0 ); + DestCntLayout->addWidget( GroupPt2, 0, 1 ); + DestCntLayout->addWidget( GroupD1, 0, 0 ); + DestCntLayout->addWidget( GroupD2, 0, 1 ); QVBoxLayout* SkeletonCntlayout = new QVBoxLayout( MainWidget->SkeletonCnt ); SkeletonCntlayout->setMargin( 0 ); SkeletonCntlayout->setSpacing( 6 ); SkeletonCntlayout->addWidget( Group1Sel, 0, 0 ); + SkeletonCntlayout->addWidget( Group2Sel, 0, 0 ); + SkeletonCntlayout->addWidget( Group1Sel1Spin, 0, 0 ); SkeletonCntlayout->addWidget( Group1Spin, 0, 0 ); SkeletonCntlayout->addWidget( Group2Spin, 0, 0 ); SkeletonCntlayout->addWidget( Group3Spin, 0, 0 ); SkeletonCntlayout->addWidget( Group4Spin, 0, 0 ); + SkeletonCntlayout->addWidget( GroupRect, 0, 0 ); + //SkeletonCntlayout->setStretch( 0, 1); /***************************************************************/ QButtonGroup* ButtonGroup = new QButtonGroup( this ); @@ -173,54 +289,84 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, ButtonGroup->addButton( MainWidget->RB_Dest2, 0 ); /* signals and slots connections */ - connect( MainWidget->buttonEnd, SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) ); - connect( MainWidget->buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) ); - connect( MainWidget->buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); - connect( MainWidget->buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); - - connect( Group1Sel->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( Group1Sel->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); - connect( Group1Sel->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); - connect( Group1Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( Group1Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); - connect( Group1Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); - connect( Group2Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( Group2Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); - connect( Group2Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); - connect( Group3Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); - connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ; - connect( Group4Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( Group4Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); - connect( Group4Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); - - connect( MainWidget->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( TypeClicked( int ) ) ); - connect( ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( DestClicked( int ) ) ); - connect( GroupPt->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( PointClicked( int ) ) ); - connect( GroupD1->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir1Clicked( int ) ) ); - connect( GroupD2->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir2Clicked( int ) )); - - connect( Group1Sel->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( Group1Sel->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - - connect( Group1Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - - connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); - - connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); - connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + connect( MainWidget->buttonEnd, SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) ); + connect( MainWidget->buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) ); + connect( MainWidget->buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( MainWidget->buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); + + connect( Group1Sel->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( Group1Sel->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( Group1Sel->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); + connect( Group2Sel->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( Group2Sel->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( Group2Sel->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); + connect( Group1Sel1Spin->buttonApply,SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( Group1Sel1Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( Group1Sel1Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); + connect( Group1Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( Group1Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( Group1Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); + connect( Group2Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( Group2Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( Group2Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); + connect( Group3Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ; + connect( Group4Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( Group4Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) ); + connect( Group4Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ); + + connect( MainWidget->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( TypeClicked( int ) ) ); + connect( ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( DestClicked( int ) ) ); + connect( GroupPt->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( PointClicked( int ) ) ); + connect( GroupPt2->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Point2Clicked( int ) ) ); + connect( GroupD1->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir1Clicked( int ) ) ); + connect( GroupD2->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir2Clicked( int ) )); + + connect( Group1Sel->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group1Sel->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( Group2Sel->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group2Sel->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group2Sel->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group2Sel->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( Group1Sel1Spin->LineEdit1,SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( Group1Sel1Spin->PushButton1,SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( Group1Sel1Spin->SpinBox_DX,SIGNAL( valueChanged( double ) ),this, SLOT( ValueChangedInSpinBox( double ) ) ); + + connect( Group1Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupRect->SpinBox_DX1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupRect->SpinBox_DX2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupRect->SpinBox_DY1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( GroupRect->SpinBox_DY2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + connect( Group3Spin->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) ); + connect( Group4Spin->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) ); + connect( Group2Sel->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) ); + connect( Group1Sel1Spin->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) ); + + connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ActivateLocalCS() ) ); + connect( planeButton, SIGNAL( clicked() ), this, SLOT( ActivateLocalCS() ) ); + connect( selButton, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); + + connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); // install event filter on spin-boxes to provide Apply action on Return pressed Group1Spin->SpinBox_DX->installEventFilter(this); + Group1Sel1Spin->SpinBox_DX->installEventFilter(this); Group2Spin->SpinBox_DX->installEventFilter(this); Group2Spin->SpinBox_DY->installEventFilter(this); Group3Spin->SpinBox_DX->installEventFilter(this); @@ -241,7 +387,10 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, //================================================================================= EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg() { +// SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow(); + myGeometryGUI->SetActiveDialogBox( 0 ); +// ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(false); } @@ -253,24 +402,27 @@ bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event) { if (event->type() == QEvent::KeyPress) { QKeyEvent* ke = (QKeyEvent*)event; - if (ke->key() == Qt::Key_Return) { + if ( ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter ) { if (object == Group1Spin->SpinBox_DX) { - Group1Spin->buttonApply->animateClick(); + Group1Spin->buttonApply->click(); + return true; + } else if (object == Group1Sel1Spin->SpinBox_DX) { + Group1Sel1Spin->buttonApply->click(); return true; } else if (object == Group2Spin->SpinBox_DX || object == Group2Spin->SpinBox_DY) { - Group2Spin->buttonApply->animateClick(); + Group2Spin->buttonApply->click(); return true; } else if (object == Group3Spin->SpinBox_DX || object == Group3Spin->SpinBox_DY || object == Group3Spin->SpinBox_DZ) { - Group3Spin->buttonApply->animateClick(); + Group3Spin->buttonApply->click(); return true; } else if (object == Group4Spin->SpinBox_DX || object == Group4Spin->SpinBox_DY || object == Group4Spin->SpinBox_DZ || object == Group4Spin->SpinBox_DS) { - Group4Spin->buttonApply->animateClick(); + Group4Spin->buttonApply->click(); return true; } } @@ -289,12 +441,17 @@ bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event) void EntityGUI_SketcherDlg::Init() { /* init variables */ - myEditCurrentArgument = Group1Sel->LineEdit1; + autoApply = false; + + myEditCurrentArgument = WPlaneLineEdit; // Initiate the parameters selection with the first WPlaneLineEdit + myCommand.append( "Sketcher" ); myUndoCommand.append( "Sketcher" ); mySketchState = FIRST_POINT; - globalSelection( GEOM_POINT ); + globalSelection( GEOM_FACE ); + + myCheckFlag = 0; myLastX1 = 0.0; myLastY1 = 0.0; @@ -302,34 +459,64 @@ void EntityGUI_SketcherDlg::Init() myLastY2 = 0.0; myHelpFileName = "create_sketcher_page.html"; + + GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() ); + myGlobalCS = aBasicOp->MakeMarker( 0,0,0, + 1,0,0, + 0,1,0 ); + myWPlane = myGlobalCS; + myLCSList.push_back( WPlaneToLCS(myGlobalCS) ); /* Get setting of step value from file configuration */ double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); /* min, max, step and decimals for spin boxes */ - initSpinBox( Group1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - + initSpinBox( Group1Sel1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); + // san: Note specific step values below! + initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" ); + + initSpinBox( GroupRect->SpinBox_DX1, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( GroupRect->SpinBox_DY1, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( GroupRect->SpinBox_DX2, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( GroupRect->SpinBox_DY2, COORD_MIN, COORD_MAX, step, "length_precision" ); + /* displays Dialog */ - MainWidget->GroupConstructors->setEnabled( false ); - MainWidget->GroupDest1->setEnabled( false ); + +// MainWidget->RadioButton1->setEnabled( false ); +// MainWidget->RadioButton2->setEnabled( false ); +// MainWidget->RadioButton3->setEnabled( true ); +// MainWidget->GroupDest1->setEnabled( false ); setEnabledUndo( false ); setEnabledRedo( false ); MainWidget->RadioButton1->setChecked( true ); - resize( 0, 0 ); + FindLocalCS(); TypeClicked( 0 ); + // If a face has already been selected use it. Placed after FindLocalCS to avoid clearing the combobox + // that should be filled with the possibly selected face + + OnFirstPoint(); + + SelectionIntoArgument(); + + resize(100,100); + + setPrefix(tr("GEOM_SKETCH")); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + ActivateLocalCS(); + + setIsWaitCursorEnabled( false ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -339,15 +526,20 @@ void EntityGUI_SketcherDlg::Init() //================================================================================= void EntityGUI_SketcherDlg::InitClick() { + MESSAGE("EntityGUI_SketcherDlg::InitClick()") disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 ); + myCheckFlag = 0; Group1Sel->hide(); + Group2Sel->hide(); + Group1Sel1Spin->hide(); Group1Spin->hide(); Group2Spin->hide(); Group3Spin->hide(); Group4Spin->hide(); - - resize( 0, 0 ); + GroupRect->hide(); + globalSelection(); // close local selection to clear it + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } @@ -358,18 +550,100 @@ void EntityGUI_SketcherDlg::InitClick() void EntityGUI_SketcherDlg::TypeClicked( int constructorId ) { myConstructorId = constructorId; + MainWidget->buttonEnd->setText(tr("GEOM_BUT_CLOSE")); + MainWidget->buttonClose->setEnabled(true); + if ( myConstructorId == 0 ) { // SEGMENT + GroupPt2->RB_Point1->setChecked( true ); + GroupPt ->setEnabled( true ); + GroupPt2->setEnabled( false ); + GroupD1->setEnabled( true ); GroupD2->setEnabled( true ); MainWidget->RB_Dest1->setEnabled( true ); MainWidget->RB_Dest1->setChecked( true ); + + MainWidget->GroupDest ->setEnabled( true ); + MainWidget->GroupDest1->setEnabled( true ); + MainWidget->GroupDest ->show(); + MainWidget->GroupDest1->show(); DestClicked( 1 ); + if (mySketchState == FIRST_POINT) + { + OnFirstPoint(); + } } else if ( myConstructorId == 1 ) { // ARC + GroupPt ->setEnabled( true ); + GroupPt2->setEnabled( true ); + GroupD2->RB_Dir21->setChecked( true ); + GroupD1->setEnabled( true ); GroupD2->setEnabled( false ); - MainWidget->RB_Dest1->setEnabled( false ); - MainWidget->RB_Dest2->setChecked( true ); - DestClicked( 0 ); + MainWidget->RB_Dest1->setEnabled( true ); + MainWidget->RB_Dest1->setChecked( true ); + + MainWidget->GroupDest ->setEnabled( true ); + MainWidget->GroupDest1->setEnabled( true ); + MainWidget->GroupDest ->show(); + MainWidget->GroupDest1->show(); + DestClicked( 1 ); + if (mySketchState == FIRST_POINT) + { + OnFirstPoint(); + } } + else if ( myConstructorId == 2 ) { // RECTANGLE + GroupPt ->setEnabled( false ); + GroupPt2->setEnabled( false ); + GroupD1 ->setEnabled( false ); + GroupD2 ->setEnabled( false ); + MainWidget->GroupDest ->setEnabled( false ); + MainWidget->GroupDest1->setEnabled( false ); + + GroupPt ->hide(); + GroupPt2->hide(); + GroupD1 ->hide(); + GroupD2 ->hide(); + MainWidget->GroupDest ->hide(); + MainWidget->GroupDest1->hide(); + + MainWidget->buttonEnd->setText(tr("Apply and Close")); + MainWidget->buttonClose->setEnabled(false); + + GroupRect->setEnabled( true ); + MainWidget->RadioButton1->setEnabled( true ); + MainWidget->RadioButton2->setEnabled( true ); + + RectClicked(); + } +} + +//================================================================================= +// function : RectClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::RectClicked() +{ + InitClick(); + + // Connect the selction manager (disconnected in InitClick()) + connect( myGeometryGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + GroupRect->show(); + + myX1=0; + myX2=10; + myY1=0; + myY2=10; + + GroupRect->SpinBox_DX1->setValue(myX1); + GroupRect->SpinBox_DY1->setValue(myY1); + GroupRect->SpinBox_DX2->setValue(myX2); + GroupRect->SpinBox_DY2->setValue(myY2); + + resize( minimumSizeHint() ); + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -380,6 +654,7 @@ void EntityGUI_SketcherDlg::TypeClicked( int constructorId ) void EntityGUI_SketcherDlg::DestClicked( int constructorId ) { GroupPt->hide(); + GroupPt2->hide(); GroupD1->hide(); GroupD2->hide(); @@ -387,6 +662,9 @@ void EntityGUI_SketcherDlg::DestClicked( int constructorId ) // Point GroupPt->RB_Point1->setChecked( true ); GroupPt->show(); + GroupPt2->show(); + Group3Spin->checkBox->show(); + Group4Spin->checkBox->show(); PointClicked( 1 ); // XY } else if ( constructorId == 0 ) { @@ -394,27 +672,49 @@ void EntityGUI_SketcherDlg::DestClicked( int constructorId ) GroupD1->RB_Dir11->setChecked( true ); GroupD1->show(); GroupD2->show(); + Group3Spin->checkBox->hide(); + Group4Spin->checkBox->hide(); Dir1Clicked( 2 ); // Angle } + resize( minimumSizeHint() ); } - //================================================================================= // function : PointClicked() // purpose : Radio button management //================================================================================= void EntityGUI_SketcherDlg::PointClicked( int constructorId ) { + MESSAGE("PointClicked") + myConstructorPntId = constructorId; + GroupPt->RB_Point3->setEnabled( true ); + int buttonId = GroupPt2->ButtonGroup->checkedId(); + if (buttonId >= 0){ // = If a button is checked + Point2Clicked(buttonId); + } + else{ + GroupPt2->RB_Point1->setChecked( true ); + Point2Clicked( 1 ); + } +} + +//================================================================================= +// function : Point2Clicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) +{ + MESSAGE("Point2Clicked") InitClick(); // Get setting of step value from file configuration double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); - if ( myConstructorId == 0 ) { // SEGMENT - if ( constructorId == 1 ) { // XY + if ( myConstructorPntId == 1 ) { // XY + if ( constructorId == 1 ){ // No additional parameter mySketchType = PT_ABS; - initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) ); Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); myX = 0.0; @@ -424,12 +724,57 @@ void EntityGUI_SketcherDlg::PointClicked( int constructorId ) Group2Spin->show(); Group2Spin->buttonApply->setFocus(); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } - else if ( constructorId == 0 ) { // DXDY + else if ( constructorId == 0 ){ // Point + radius + mySketchType = PT_ABS_RADIUS; + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" ); + Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) ); + Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + myX = 0.0; + Group3Spin->SpinBox_DX->setValue( myX ); + myY = 0.0; + Group3Spin->SpinBox_DY->setValue( myY ); + myRadius=0.0; + Group3Spin->SpinBox_DZ->setValue( myRadius ); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + } + else if ( constructorId == 2 ){ // Point + center + mySketchType = PT_ABS_CENTER; + initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" ); + Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X2" ) ); + Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_Y2" ) ); + Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER_X" ) ); + Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_Y" ) ); + myXc = 0.0; + Group4Spin->SpinBox_DX->setValue( myXc ); + myYc = 0.0; + Group4Spin->SpinBox_DY->setValue( myYc ); + myX = 0.0; + Group4Spin->SpinBox_DZ->setValue( myX ); + myY = 0.0; + Group4Spin->SpinBox_DS->setValue( myY ); + Group4Spin->show(); + Group4Spin->buttonApply->setFocus(); + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + } + + } + else if ( myConstructorPntId == 0 ) { // DXDY + if ( constructorId == 1 ){ // No additional parameter mySketchType = PT_RELATIVE; - initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) ); Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) ); myDX = 0.0; @@ -439,18 +784,93 @@ void EntityGUI_SketcherDlg::PointClicked( int constructorId ) Group2Spin->show(); Group2Spin->buttonApply->setFocus(); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + } + else if ( constructorId == 0 ){ // Point + radius + mySketchType = PT_REL_RADIUS; + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" ); + Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) ); + Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) ); + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + myDX = 10.0; + Group3Spin->SpinBox_DX->setValue( myDX ); + myDY = 0.0; + Group3Spin->SpinBox_DY->setValue( myDY ); + myRadius=5.0; + Group3Spin->SpinBox_DZ->setValue( myRadius ); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + } + else if ( constructorId == 2 ){ // Point + center + mySketchType = PT_REL_CENTER; + initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" ); + Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DX2" ) ); + Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_DY2" ) ); + Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER_DX" ) ); + Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_DY" ) ); + myDXc = 0.0; + Group4Spin->SpinBox_DX->setValue( myDXc ); + myDYc = 0.0; + Group4Spin->SpinBox_DY->setValue( myDYc ); + myDX = 0.0; + Group4Spin->SpinBox_DZ->setValue( myDX ); + myDY = 0.0; + Group4Spin->SpinBox_DS->setValue( myDY ); + Group4Spin->show(); + Group4Spin->buttonApply->setFocus(); + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } - else if ( constructorId == 2 ) { // Selection + + } + else if ( myConstructorPntId == 2 ) { // Selection + if ( constructorId == 1 ){ // No additional parameter mySketchType = PT_SEL; myEditCurrentArgument = Group1Sel->LineEdit1; - connect( myGeometryGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); Group1Sel->show(); Group1Sel->buttonApply->setFocus(); SelectionIntoArgument(); } + else if ( constructorId == 0 ){ // Point + radius + mySketchType = PT_SEL_RADIUS; + myEditCurrentArgument = Group1Sel1Spin->LineEdit1; + initSpinBox( Group1Sel1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step/10.0, "length_precision" ); + Group1Sel1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); + Group1Sel1Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + myRadius=0.0; + Group1Sel1Spin->SpinBox_DX->setValue( myRadius ); + + Group1Sel1Spin->show(); + Group1Sel1Spin->buttonApply->setFocus(); + SelectionIntoArgument(); + } + else if ( constructorId == 2 ){ // Point + center + mySketchType = PT_SEL_CENTER; + myEditCurrentArgument = Group2Sel->LineEdit1; + Group2Sel->TextLabel2->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); + Group2Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER2" ) ); + Group2Sel->LineEdit1->setEnabled(true); + Group2Sel->PushButton1->setDown(true); + Group2Sel->LineEdit2->setEnabled(false); + Group2Sel->PushButton2->setDown(false); + Group2Sel->show(); + Group2Sel->buttonApply->setFocus(); + SelectionIntoArgument(); + } + } + resize( minimumSizeHint() ); + connect( myGeometryGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + } @@ -461,8 +881,14 @@ void EntityGUI_SketcherDlg::PointClicked( int constructorId ) void EntityGUI_SketcherDlg::Dir1Clicked( int constructorId ) { myConstructorDirId = constructorId; - GroupD2->RB_Dir21->setChecked( true ); - Dir2Clicked( 2 ); + int dirButtonId = GroupD2->ButtonGroup->checkedId(); + if (dirButtonId >= 0){ // = If a button is checked + Dir2Clicked(dirButtonId); + } + else{ + GroupD2->RB_Dir21->setChecked( true ); + Dir2Clicked( 2 ); + } } @@ -483,27 +909,29 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId ) myY = 0.0; myLength = 100.0; if ( myConstructorDirId == 2 ) { // Angle - initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., "length_precision" ); Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); Group2Spin->SpinBox_DX->setValue( myAngle ); Group2Spin->buttonApply->setFocus(); Group2Spin->show(); if ( constructorId == 2 ) { // Length - mySketchType = DIR_ANGLE_LENGTH; - Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); - Group2Spin->SpinBox_DY->setValue( myLength ); + mySketchType = DIR_ANGLE_LENGTH; + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); + Group2Spin->SpinBox_DY->setValue( myLength ); } else if ( constructorId == 0 ) { // X - mySketchType = DIR_ANGLE_X; - Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_X3" ) ); - Group2Spin->SpinBox_DY->setValue( myX ); + mySketchType = DIR_ANGLE_X; + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" ); + Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_X3" ) ); + Group2Spin->SpinBox_DY->setValue( myX ); } else if ( constructorId == 1 ) { // Y - mySketchType = DIR_ANGLE_Y; - Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y3" ) ); - Group2Spin->SpinBox_DY->setValue( myY ); + mySketchType = DIR_ANGLE_Y; + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" ); + Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y3" ) ); + Group2Spin->SpinBox_DY->setValue( myY ); } } else if ( myConstructorDirId == 0 ) { // Perpendicular @@ -511,19 +939,19 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId ) Group1Spin->buttonApply->setFocus(); if ( constructorId == 2 ) { // Length - mySketchType = DIR_PER_LENGTH; - Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); - Group1Spin->SpinBox_DX->setValue( myLength ); + mySketchType = DIR_PER_LENGTH; + Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); + Group1Spin->SpinBox_DX->setValue( myLength ); } else if ( constructorId == 0 ) { // X - mySketchType = DIR_PER_X; - Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) ); - Group1Spin->SpinBox_DX->setValue( myX ); + mySketchType = DIR_PER_X; + Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) ); + Group1Spin->SpinBox_DX->setValue( myX ); } else if ( constructorId == 1 ) { // Y - mySketchType = DIR_PER_Y; - Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) ); - Group1Spin->SpinBox_DX->setValue( myY ); + mySketchType = DIR_PER_Y; + Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) ); + Group1Spin->SpinBox_DX->setValue( myY ); } } else if ( myConstructorDirId == 1 ) { // Tangent @@ -531,25 +959,25 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId ) Group1Spin->buttonApply->setFocus(); if ( constructorId == 2 ) { // Length - mySketchType = DIR_TAN_LENGTH; - Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); - Group1Spin->SpinBox_DX->setValue( myLength ); + mySketchType = DIR_TAN_LENGTH; + Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); + Group1Spin->SpinBox_DX->setValue( myLength ); } else if ( constructorId == 0 ) { // X - mySketchType = DIR_TAN_X; - Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) ); - Group1Spin->SpinBox_DX->setValue( myX ); + mySketchType = DIR_TAN_X; + Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) ); + Group1Spin->SpinBox_DX->setValue( myX ); } else if ( constructorId == 1 ) { // Y - mySketchType = DIR_TAN_Y; - Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) ); - Group1Spin->SpinBox_DX->setValue( myY ); + mySketchType = DIR_TAN_Y; + Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) ); + Group1Spin->SpinBox_DX->setValue( myY ); } } else if ( myConstructorDirId == 3 ) { // DXDY - initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) ); myDX = 0.0; @@ -560,93 +988,108 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId ) Group3Spin->buttonApply->setFocus(); if ( constructorId == 2 ) { // Length - mySketchType = DIR_DXDY_LENGTH; - Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); - Group3Spin->SpinBox_DZ->setValue( myLength ); + mySketchType = DIR_DXDY_LENGTH; + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_LENGTH2" ) ); + Group3Spin->SpinBox_DZ->setValue( myLength ); } else if ( constructorId == 0 ) { // X - mySketchType = DIR_DXDY_X; - Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X3" ) ); - Group3Spin->SpinBox_DZ->setValue( myX ); + mySketchType = DIR_DXDY_X; + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X3" ) ); + Group3Spin->SpinBox_DZ->setValue( myX ); } else if ( constructorId == 1 ) { // Y - mySketchType = DIR_DXDY_Y; - Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Y3" ) ); - Group3Spin->SpinBox_DZ->setValue( myY ); + mySketchType = DIR_DXDY_Y; + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Y3" ) ); + Group3Spin->SpinBox_DZ->setValue( myY ); } } } else if ( myConstructorId == 1 ) { // ARC if ( myConstructorDirId == 2 ) { // Angle if ( constructorId == 2 ) { // Length - mySketchType = DIR_ANGLE_LENGTH; - initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, 5., 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); - Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); - Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_ANGLE2" )); - Group3Spin->SpinBox_DX->setValue( myAngle ); - myRadius = 100.0; - Group3Spin->SpinBox_DY->setValue( myRadius ); - myLength = 30.0; - Group3Spin->SpinBox_DZ->setValue( myLength ); - Group3Spin->show(); - Group3Spin->buttonApply->setFocus(); + mySketchType = DIR_ANGLE_LENGTH; + initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., "angle_precision" ); + initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, 5., "angle_precision" ); + Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); + Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_ANGLE2" )); + Group3Spin->SpinBox_DX->setValue( myAngle ); + myRadius = 100.0; + Group3Spin->SpinBox_DY->setValue( myRadius ); + myLength = 30.0; + Group3Spin->SpinBox_DZ->setValue( myLength ); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 0 ) { // Perpendicular if ( constructorId == 2 ) { // Length - mySketchType = DIR_PER_LENGTH; - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); - Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); - myRadius = 100.0; - Group2Spin->SpinBox_DX->setValue( myRadius ); - myLength = 30.0; - Group2Spin->SpinBox_DY->setValue( myLength ); - Group2Spin->show(); - Group2Spin->buttonApply->setFocus(); + mySketchType = DIR_PER_LENGTH; + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" ); + Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); + myRadius = 100.0; + Group2Spin->SpinBox_DX->setValue( myRadius ); + myLength = 30.0; + Group2Spin->SpinBox_DY->setValue( myLength ); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 1 ) { // Tangent if ( constructorId == 2 ) { // Length - mySketchType = DIR_TAN_LENGTH; - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); - Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); - myRadius = 100.0; - Group2Spin->SpinBox_DX->setValue( myRadius ); - myLength = 30.0; - Group2Spin->SpinBox_DY->setValue( myLength ); - Group2Spin->show(); - Group2Spin->buttonApply->setFocus(); + mySketchType = DIR_TAN_LENGTH; + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" ); + Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); + myRadius = 100.0; + Group2Spin->SpinBox_DX->setValue( myRadius ); + myLength = 30.0; + Group2Spin->SpinBox_DY->setValue( myLength ); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 3 ) { // DXDY if ( constructorId == 2 ) { // Length - mySketchType = DIR_DXDY_LENGTH; - Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) ); - Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) ); - Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); - Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); - myDX = 0.0; - Group4Spin->SpinBox_DX->setValue( myDX ); - myDY = 0.0; - Group4Spin->SpinBox_DY->setValue( myDY ); - myRadius = 100.0; - Group4Spin->SpinBox_DZ->setValue( myRadius ); - myLength = 30.0; - Group4Spin->SpinBox_DS->setValue( myLength ); - Group4Spin->show(); - Group4Spin->buttonApply->setFocus(); + mySketchType = DIR_DXDY_LENGTH; + Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) ); + Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) ); + Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); + Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_ANGLE2" ) ); + initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" ); + initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" ); + myDX = 0.0; + Group4Spin->SpinBox_DX->setValue( myDX ); + myDY = 0.0; + Group4Spin->SpinBox_DY->setValue( myDY ); + myRadius = 100.0; + Group4Spin->SpinBox_DZ->setValue( myRadius ); + myLength = 30.0; + Group4Spin->SpinBox_DS->setValue( myLength ); + Group4Spin->show(); + Group4Spin->buttonApply->setFocus(); } } } + resize( minimumSizeHint() ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); +} + +//================================================================================= +// function : CheckBoxClicked() +// purpose : CheckBox management +//================================================================================= +void EntityGUI_SketcherDlg::CheckBoxClicked(int State) +{ + myCheckFlag = State; - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -666,11 +1109,12 @@ void EntityGUI_SketcherDlg::ClickOnCancel() //================================================================================= void EntityGUI_SketcherDlg::ClickOnEnd() { + MESSAGE("EntityGUI_SketcherDlg::ClickOnEnd()") if ( sender() == MainWidget->buttonClose ) { // Verify validity of commands if ( myCommand.count() <= 2 ) { SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), - tr( "GEOM_ERROR_STATUS" ), tr( "CANNOT_CLOSE" ), tr( "BUT_OK" ) ); + tr( "GEOM_ERROR_STATUS" ), tr( "CANNOT_CLOSE" ), tr( "BUT_OK" ) ); return; } @@ -688,20 +1132,33 @@ void EntityGUI_SketcherDlg::ClickOnEnd() myCommand.append( ":WW" ); } else { - // PAL16008 (Sketcher Validation should be equal to Apply&Close) - if ( Group1Spin->buttonApply->isEnabled() && Group1Spin->isVisible() || - Group2Spin->buttonApply->isEnabled() && Group2Spin->isVisible() || - Group3Spin->buttonApply->isEnabled() && Group3Spin->isVisible() || - Group4Spin->buttonApply->isEnabled() && Group4Spin->isVisible() || - Group1Sel ->buttonApply->isEnabled() && Group1Sel->isVisible() ) { + /*// PAL16008 (Sketcher Validation should be equal to Apply&Close) + if ( ( Group1Spin->buttonApply->isEnabled() && Group1Spin->isVisible() ) || + ( Group2Spin->buttonApply->isEnabled() && Group2Spin->isVisible() ) || + ( Group3Spin->buttonApply->isEnabled() && Group3Spin->isVisible() ) || + ( Group4Spin->buttonApply->isEnabled() && Group4Spin->isVisible() ) || + ( Group1Sel->buttonApply->isEnabled() && Group1Sel->isVisible() ) || + ( Group2Sel->buttonApply->isEnabled() && Group2Sel->isVisible() ) || + ( Group1Sel1Spin->buttonApply->isEnabled() && Group1Sel1Spin->isVisible() ) ) { ClickOnApply(); - } + }*/ +// ClickOnApply(); // TEST remove then myIsAllAdded = true; } + if (myConstructorId == 2) + { + QString aParameters; + myCommand.append( GetNewCommand( aParameters ) ); + mySketchState = NEXT_POINT; + if ( onAccept() ) + ClickOnCancel(); + } if ( myCommand.size() > 2 ) + { if ( !onAccept() ) return; + } close(); } @@ -712,12 +1169,19 @@ void EntityGUI_SketcherDlg::ClickOnEnd() //================================================================================= bool EntityGUI_SketcherDlg::ClickOnApply() { + MESSAGE("EntityGUI_SketcherDlg::ClickOnApply()") if ( sender() && sender()->inherits( "QPushButton" ) ) ( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948) +// addSubshapesToStudy(); + QString aParameters; myCommand.append( GetNewCommand( aParameters ) ); - mySketchState = NEXT_POINT; + if (mySketchState == FIRST_POINT) + { + mySketchState = NEXT_POINT; + OnNextPoint(); + } myUndoCommand.clear(); myUndoCommand.append( "Sketcher" ); @@ -725,13 +1189,11 @@ bool EntityGUI_SketcherDlg::ClickOnApply() myParameters.append( aParameters ); myUndoParameters.clear(); - MainWidget->GroupConstructors->setEnabled( true ); - MainWidget->GroupDest1->setEnabled( true ); setEnabledUndo( true ); setEnabledRedo( false ); myIsApply = true; - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); myIsApply = false; // Set focus to SpinBox_DX @@ -739,6 +1201,10 @@ bool EntityGUI_SketcherDlg::ClickOnApply() (Group1Spin->SpinBox_DX)->setFocus(); (Group1Spin->SpinBox_DX)->selectAll(); } + else if ( sender() == Group1Sel1Spin->buttonApply ) { + (Group1Sel1Spin->SpinBox_DX)->setFocus(); + (Group1Sel1Spin->SpinBox_DX)->selectAll(); + } else if ( sender() == Group2Spin->buttonApply ) { (Group2Spin->SpinBox_DX)->setFocus(); (Group2Spin->SpinBox_DX)->selectAll(); @@ -751,7 +1217,7 @@ bool EntityGUI_SketcherDlg::ClickOnApply() (Group4Spin->SpinBox_DX)->setFocus(); (Group4Spin->SpinBox_DX)->selectAll(); } - + return true; } @@ -773,9 +1239,9 @@ void EntityGUI_SketcherDlg::ClickOnHelp() #endif SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ), - QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ), - QObject::tr( "BUT_OK" ) ); + QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ), + QObject::tr( "BUT_OK" ) ); } } @@ -797,14 +1263,17 @@ void EntityGUI_SketcherDlg::ClickOnUndo() MainWidget->RadioButton1->setChecked( true ); TypeClicked( 0 ); - MainWidget->GroupConstructors->setEnabled( false ); - MainWidget->GroupDest1->setEnabled( false ); + connect( myGeometryGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + OnFirstPoint(); + setEnabledUndo( false ); } setEnabledRedo( true ); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } //================================================================================= @@ -820,15 +1289,15 @@ void EntityGUI_SketcherDlg::ClickOnRedo() myUndoParameters.pop_back(); mySketchState = NEXT_POINT; - - MainWidget->GroupConstructors->setEnabled( true ); - MainWidget->GroupDest1->setEnabled( true ); + + OnNextPoint(); + setEnabledUndo( true ); if ( myUndoCommand.count() == 1 ) setEnabledRedo( false ); - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } //================================================================================= @@ -838,6 +1307,8 @@ void EntityGUI_SketcherDlg::ClickOnRedo() void EntityGUI_SketcherDlg::setEnabledUndo( bool value ) { Group1Sel->buttonUndo->setEnabled( value ); + Group2Sel->buttonUndo->setEnabled( value ); + Group1Sel1Spin->buttonUndo->setEnabled( value ); Group1Spin->buttonUndo->setEnabled( value ); Group2Spin->buttonUndo->setEnabled( value ); Group3Spin->buttonUndo->setEnabled( value ); @@ -851,6 +1322,8 @@ void EntityGUI_SketcherDlg::setEnabledUndo( bool value ) void EntityGUI_SketcherDlg::setEnabledRedo( bool value ) { Group1Sel->buttonRedo->setEnabled( value ); + Group2Sel->buttonRedo->setEnabled( value ); + Group1Sel1Spin->buttonRedo->setEnabled( value ); Group1Spin->buttonRedo->setEnabled( value ); Group2Spin->buttonRedo->setEnabled( value ); Group3Spin->buttonRedo->setEnabled( value ); @@ -863,39 +1336,180 @@ void EntityGUI_SketcherDlg::setEnabledRedo( bool value ) //================================================================================= void EntityGUI_SketcherDlg::SelectionIntoArgument() { + MESSAGE("EntityGUI_SketcherDlg::SelectionIntoArgument") myEditCurrentArgument->setText( "" ); - myX = myLastX1; - myY = myLastY1; LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - - int nbSel = aSelList.Extent(); - if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { - TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { - gp_Trsf aTrans; - gp_Ax3 aWPlane = myGeometryGUI->GetWorkingPlane(); - - aTrans.SetTransformation(aWPlane); - BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False); - aShape = aTransformation.Shape(); - - gp_Pnt aPnt; - if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) { - myX = aPnt.X(); - myY = aPnt.Y(); - Group1Sel->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); - } + + this->activateWindow(); + + if (aSelList.Extent() == 0) + { + selButton->setDown(false); + WPlaneLineEdit->setEnabled(false); + WPlaneLineEdit->setText(tr("GEOM_SKETCHER_WPLANE")); + return; + } + else if (aSelList.Extent() != 1) + return; + + double tmpX = myX; + double tmpY = myY; + myX = myLastX1; + myY = myLastY1; + + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; + if (myEditCurrentArgument == WPlaneLineEdit) + aNeedType = TopAbs_FACE; + + + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + + if(aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) + && !aShape.IsNull()) + { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + if (myEditCurrentArgument==WPlaneLineEdit) + { + // Check if the face is planar + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); + GeomLib_IsPlanarSurface aPlanarCheck(aSurf, Precision::Confusion()); + + if (aPlanarCheck.IsPlanar()) + { + myEditCurrentArgument->setText(aName); + AddLocalCS(aSelectedObject.get()); + selButton->setDown(false); + WPlaneLineEdit->setEnabled(false); + TypeClicked( myConstructorId ); + } + else + { + myEditCurrentArgument->setText(tr("GEOM_SKETCHER_WPLANE")); + // The following leads to crash TODO : find a way to return a warning +// Standard_Failure::Raise(tr("GEOM_SKETCHER_NOT_PLANAR").toStdString().c_str()); + } + } + else + { + gp_Trsf aTrans; + gp_Ax3 aWPlane = GetActiveLocalCS(); + + aTrans.SetTransformation(aWPlane); + BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False); + aShape = aTransformation.Shape(); + + gp_Pnt aPnt; + if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) + { + myEditCurrentArgument->setText(aName); + myX = aPnt.X(); + myY = aPnt.Y(); + double Xcoord = myX; + double Ycoord = myY; + + switch (mySketchType) + { + case PT_ABS: + disconnect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + disconnect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + Group2Spin->SpinBox_DX->setValue(Xcoord); + Group2Spin->SpinBox_DY->setValue(Ycoord); + + connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + break; + + case PT_RELATIVE: + if (myLastX1 && myLastY1) + { + Xcoord = myX - myLastX1; + Ycoord = myY - myLastY1; + } + else if (mySketchState != FIRST_POINT) + { + Xcoord = myX - tmpX; + Ycoord = myY - tmpY; + } + Group2Spin->SpinBox_DX->setValue(Xcoord); + Group2Spin->SpinBox_DY->setValue(Ycoord); + break; + + case PT_ABS_RADIUS: + disconnect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + disconnect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + Group3Spin->SpinBox_DX->setValue(Xcoord); + Group3Spin->SpinBox_DY->setValue(Ycoord); + + connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + break; + + case PT_REL_RADIUS: + if (myLastX1 && myLastY1) + { + Xcoord = myX - myLastX1; + Ycoord = myY - myLastY1; + } + else if (mySketchState != FIRST_POINT) + { + Xcoord = myX - tmpX; + Ycoord = myY - tmpY; + } + Group3Spin->SpinBox_DX->setValue(Xcoord); + Group3Spin->SpinBox_DY->setValue(Ycoord); + break; + + case PT_ABS_CENTER: + disconnect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + disconnect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + + Group4Spin->SpinBox_DX->setValue(Xcoord); + Group4Spin->SpinBox_DY->setValue(Ycoord); + + connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + break; + + case PT_REL_CENTER: + if (myLastX1 && myLastY1) + { + Xcoord = myXc - myLastX1; + Ycoord = myYc - myLastY1; + } + else if (mySketchState != FIRST_POINT) + { + Xcoord = myXc - tmpX; + Ycoord = myYc - tmpY; + } + else + { + Xcoord = myXc; + Ycoord = myYc; + } + + Group4Spin->SpinBox_DX->setValue(Xcoord); + Group4Spin->SpinBox_DY->setValue(Ycoord); + break; + + } } } } - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + if(!autoApply){ + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + } + else { + ClickOnApply(); + autoApply = false; + } + } @@ -905,11 +1519,39 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() //================================================================================= void EntityGUI_SketcherDlg::SetEditCurrentArgument() { + TopAbs_ShapeEnum myNeedType = TopAbs_VERTEX; if ( sender() == Group1Sel->PushButton1 ) { myEditCurrentArgument = Group1Sel->LineEdit1; myEditCurrentArgument->setFocus(); } - SelectionIntoArgument(); + else if ( sender() == Group1Sel1Spin->PushButton1 ) { + myEditCurrentArgument = Group1Sel1Spin->LineEdit1; + myEditCurrentArgument->setFocus(); + } + else if ( sender() == Group2Sel->PushButton1 ) { + myEditCurrentArgument = Group2Sel->LineEdit1; + Group2Sel->PushButton2->setDown(false); + Group2Sel->PushButton1->setDown(true); + Group2Sel->LineEdit2->setEnabled(false); + Group2Sel->LineEdit1->setEnabled(true); + // myEditCurrentArgument->setFocus(); + } + else if ( sender() == Group2Sel->PushButton2 ) { + myEditCurrentArgument = Group2Sel->LineEdit2; + Group2Sel->PushButton1->setDown(false); + Group2Sel->PushButton2->setDown(true); + Group2Sel->LineEdit1->setEnabled(false); + Group2Sel->LineEdit2->setEnabled(true); + // myEditCurrentArgument->setFocus(); + } + else if ( sender() == selButton ) { + myNeedType = TopAbs_FACE; + myEditCurrentArgument = WPlaneLineEdit; + WPlaneLineEdit->setEnabled(true); + selButton->setDown(true); + } + globalSelection(); // close local selection to clear it + localSelection(GEOM::GEOM_Object::_nil(), myNeedType); } @@ -919,22 +1561,27 @@ void EntityGUI_SketcherDlg::SetEditCurrentArgument() //================================================================================= void EntityGUI_SketcherDlg::LineEditReturnPressed() { - if ( sender() == Group1Sel->LineEdit1 ) { + if ( sender() == Group1Sel->LineEdit1 ) myEditCurrentArgument = Group1Sel->LineEdit1; + else if ( sender() == Group1Sel1Spin->LineEdit1 ) + myEditCurrentArgument = Group1Sel1Spin->LineEdit1; + else if ( sender() == Group2Sel->LineEdit1 ) + myEditCurrentArgument = Group2Sel->LineEdit1; + else if ( sender() == Group2Sel->LineEdit2 ) + myEditCurrentArgument = Group2Sel->LineEdit2; + + /* User name of object input management */ + /* If successfull the selection is changed and signal emitted... */ + /* so SelectionIntoArgument() is automatically called. */ + const QString objectUserName = myEditCurrentArgument->text(); + QWidget* thisWidget = (QWidget*)this; - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text(); - QWidget* thisWidget = (QWidget*)this; - - LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); + LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); - if (GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, aSelList)) - myEditCurrentArgument->setText( objectUserName ); - } + if (GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, aSelList)) + myEditCurrentArgument->setText( objectUserName ); } @@ -959,20 +1606,38 @@ void EntityGUI_SketcherDlg::DeactivateActiveDialog() //================================================================================= void EntityGUI_SketcherDlg::ActivateThisDialog() { + MESSAGE("EntityGUI_SketcherDlg::ActivateThisDialog()") myGeometryGUI->EmitSignalDeactivateDialog(); setEnabled( true ); myGeometryGUI->SetActiveDialogBox( this ); connect( myGeometryGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); //myGeometryGUI->SetState( 0 ); - globalSelection( GEOM_POINT ); - - myEditCurrentArgument = Group1Sel->LineEdit1; +// globalSelection( GEOM_POINT ); + + myEditCurrentArgument = WPlaneLineEdit; myEditCurrentArgument->setFocus(); - - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + + if ( sender() == Group1Sel->LineEdit1 ) { + myEditCurrentArgument = Group1Sel->LineEdit1; + myEditCurrentArgument->setFocus(); + } + else if ( sender() == Group1Sel1Spin->LineEdit1 ) { + myEditCurrentArgument = Group1Sel1Spin->LineEdit1; + myEditCurrentArgument->setFocus(); + } + else if ( sender() == Group2Sel->LineEdit1 ) { + myEditCurrentArgument = Group2Sel->LineEdit1; + myEditCurrentArgument->setFocus(); + } + else if ( sender() == Group2Sel->LineEdit2 ) { + myEditCurrentArgument = Group2Sel->LineEdit2; + myEditCurrentArgument->setFocus(); + } + + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); } @@ -982,7 +1647,7 @@ void EntityGUI_SketcherDlg::ActivateThisDialog() //================================================================================= void EntityGUI_SketcherDlg::enterEvent( QEvent* ) { - if ( !MainWidget->GroupConstructors->isEnabled() ) + if ( !isEnabled() ) ActivateThisDialog(); } @@ -993,12 +1658,119 @@ void EntityGUI_SketcherDlg::enterEvent( QEvent* ) //================================================================================= void EntityGUI_SketcherDlg::closeEvent( QCloseEvent* e ) { + MESSAGE("EntityGUI_SketcherDlg::closeEvent") //myGeometryGUI->SetState( -1 ); disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 ); myGeometryGUI->getApp()->updateActions(); QDialog::closeEvent( e ); } +//================================================================================= +// function : OnPointSelected +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, const gp_Pnt& thePnt, + bool isStart ) +{ + // NOTE Basing the autoapply functionnality on the background picture has no sense anymore + // The import picture functionnality is now used for drawing on top of a picture + +// SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow(); +// OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); +// +// QString theImgFileName; +// vp->background().texture( theImgFileName ); ////////////// VSR: temporarily + + double x, y; + x = y = 0; + + BRepBuilderAPI_MakeVertex mkVertex (thePnt); + TopoDS_Shape aShape = mkVertex.Shape(); + + // Taking into account LocalCS + gp_Ax3 aWPlane = GetActiveLocalCS(); + gp_Trsf aTrans; + + aTrans.SetTransformation(aWPlane); + BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False); + aShape = aTransformation.Shape(); + + gp_Pnt aTrsfPnt; + GEOMBase::VertexToPoint( aShape, aTrsfPnt ); + + // NOTE autoapply disabled : doesn't seem useful anymore +// autoApply = ( (getPnt2ConstructorId() == 1) && (!theImgFileName.isEmpty()) ); // If no additional argument needed after selection and there is a backgroundimage + // -> apply automatically + + if ( getPnt1ConstructorId() == 0 ){ // Relative selection mode + x = aTrsfPnt.X() - myLastX1; + y = aTrsfPnt.Y() - myLastY1; + } + else { + x = aTrsfPnt.X(); + y = aTrsfPnt.Y(); + } + switch (getPnt2ConstructorId()){ + case 1: + Group2Spin->SpinBox_DX->setValue( x ); + Group2Spin->SpinBox_DY->setValue( y ); + Group2Spin->buttonApply->setFocus(); // Previous setFocus (during preview) may have been inoperative if it was disabled + break; + case 0: + Group3Spin->SpinBox_DX->setValue( x ); + Group3Spin->SpinBox_DY->setValue( y ); + Group3Spin->buttonApply->setFocus(); + break; + case 2: + if (modifiers == Qt::MetaModifier){ // Select center with Meta key + Group4Spin->SpinBox_DX->setValue( x ); + Group4Spin->SpinBox_DY->setValue( y ); + } + else{ // Select end point + Group4Spin->SpinBox_DZ->setValue( x ); + Group4Spin->SpinBox_DS->setValue( y ); + } + Group4Spin->buttonApply->setFocus(); + break; + } + if ( myConstructorId == 2 ) //RECTANGLE + { + if (isStart) + { + GroupRect->SpinBox_DX1->setValue( aTrsfPnt.X() ); + GroupRect->SpinBox_DY1->setValue( aTrsfPnt.Y() ); + GroupRect->SpinBox_DX2->setValue( aTrsfPnt.X() ); + GroupRect->SpinBox_DY2->setValue( aTrsfPnt.Y() ); + } + else + { + GroupRect->SpinBox_DX2->setValue( aTrsfPnt.X() ); + GroupRect->SpinBox_DY2->setValue( aTrsfPnt.Y() ); + } + } +} + +//================================================================================= +// function : OnFirstPoint +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::OnFirstPoint() +{ + MainWidget->RadioButton3->setEnabled( true ); + MainWidget->GroupDest1->setEnabled( false ); + GroupPt2->setEnabled( false ); +} + +//================================================================================= +// function : OnNextPoint +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::OnNextPoint() +{ + MainWidget->RadioButton3->setEnabled( false ); + MainWidget->GroupDest1->setEnabled( true ); + TypeClicked(myConstructorId); +} //================================================================================= // function : ValueChangedInSpinBox() @@ -1007,8 +1779,12 @@ void EntityGUI_SketcherDlg::closeEvent( QCloseEvent* e ) void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) { QObject* send = (QObject*)sender(); - Standard_Real vx, vy, vz, vs; - vx = vy = vz = vs = 0.0; + Standard_Real vx, vy, vz, vs, minRad, dx, dy; + vx = vy = vz = vs = minRad = dx = dy = 0.0; + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + double LastDecimal = 0.0; QString vxStr, vyStr, vzStr, vsStr; @@ -1019,6 +1795,9 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) if ( send == Group1Spin->SpinBox_DX ) { vx = newValue; vxStr = newValueStr; } + else if ( send == Group1Sel1Spin->SpinBox_DX ) { + vx = newValue; vxStr = newValueStr; + } else if ( send == Group2Spin->SpinBox_DX ) { vx = newValue; vxStr = newValueStr; vy = Group2Spin->SpinBox_DY->value(); vyStr = Group2Spin->SpinBox_DY->text(); @@ -1030,12 +1809,58 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) else if ( send == Group3Spin->SpinBox_DX ) { vx = newValue; vxStr = newValueStr; vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text(); + vz = Group3Spin->SpinBox_DZ->value(); + if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0) ) { + if (mySketchType == PT_ABS_RADIUS){ + dx = vx - myLastX1; + dy = vy - myLastY1; + } + else{ + dx = vx; + dy = vy; + } + minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation + if (aPrecision >= 0) // 'f' format in the QString + LastDecimal = aPrecision; + else // 'g' format in the Qstring + LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); + minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place + if ( Abs(vz) < minRad){ + if (vz < 0.0) + Group3Spin->SpinBox_DZ->setValue( - minRad ); + else + Group3Spin->SpinBox_DZ->setValue( minRad ); + } + } vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text(); } else if ( send == Group3Spin->SpinBox_DY ) { vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text(); vy = newValue; vyStr = newValueStr; vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text(); + if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0)){ + if (mySketchType == PT_ABS_RADIUS){ + dx = vx - myLastX1; + dy = vy - myLastY1; + } + else{ + dx = vx; + dy = vy; + } + minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation + if (aPrecision >= 0) // 'f' format in the QString + LastDecimal = aPrecision; + else // 'g' format in the QString + LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); + minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place + if ( Abs(vz) < minRad){ + if (vz < 0.0) + Group3Spin->SpinBox_DZ->setValue( - minRad ); + else + Group3Spin->SpinBox_DZ->setValue( minRad ); + } + } + vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text(); } else if ( send == Group3Spin->SpinBox_DZ ) { vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text(); @@ -1149,6 +1974,58 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) } } else if ( myConstructorId == 1 ) { // ARC + if ( mySketchType == PT_ABS ) { + myX = vx; + myY = vy; + myXStr = vxStr; + myYStr = vyStr; + } + else if ( mySketchType == PT_RELATIVE ) { + myDX = vx; + myDY = vy; + myDXStr = vxStr; + myDYStr = vyStr; + } + if ( mySketchType == PT_ABS_RADIUS ) { + myX = vx; + myY = vy; + myRadius=vz; + myXStr = vxStr; + myYStr = vyStr; + myRadiusStr = vzStr; + } + else if ( mySketchType == PT_REL_RADIUS ) { + myDX = vx; + myDY = vy; + myRadius=vz; + myDXStr = vxStr; + myDYStr = vyStr; + myRadiusStr = vzStr; + } + else if ( mySketchType == PT_SEL_RADIUS ) { + myRadius = vx; + myRadiusStr = vxStr; + } + if ( mySketchType == PT_ABS_CENTER ) { + myXc = vx; + myYc = vy; + myX = vz; + myY = vs; + myXcStr = vxStr; + myYcStr = vyStr; + myXStr = vzStr; + myYStr = vsStr; + } + else if ( mySketchType == PT_REL_CENTER ) { + myDXc = vx; + myDYc = vy; + myDX = vz; + myDY = vs; + myDXcStr = vxStr; + myDYcStr = vyStr; + myDXStr = vzStr; + myDYStr = vsStr; + } if ( mySketchType == DIR_ANGLE_LENGTH ) { myAngle = vx; myRadius = vy; @@ -1180,8 +2057,36 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) myLengthStr = vsStr; } } + else if ( myConstructorId == 2 ) { // RECTANGLE + myX1 = GroupRect->SpinBox_DX1->value(); myX1Str = GroupRect->SpinBox_DX1->text(); + myX2 = GroupRect->SpinBox_DX2->value(); myX2Str = GroupRect->SpinBox_DX2->text(); + myY1 = GroupRect->SpinBox_DY1->value(); myY1Str = GroupRect->SpinBox_DY1->text(); + myY2 = GroupRect->SpinBox_DY2->value(); myY2Str = GroupRect->SpinBox_DY2->text(); + } - GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + + if (!autoApply) + GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth ); + + double x, y, xc, yc; + x = y = xc = yc = 0.0; + if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_REL_CENTER ) + { + if ( mySketchType == PT_REL_CENTER ){ + x = myDX + myLastX1; + y = myDY + myLastY1; + xc = myDXc + myLastX1; + yc = myDYc + myLastY1; + } + else { + x = myX ; + y = myY ; + xc = myXc; + yc = myYc; + } + displayPntPreview(xc,yc); + displayPntPreview(x,y); + } } @@ -1193,106 +2098,149 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters ) { theParameters.clear(); QString myNewCommand = ":"; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand + char Format = 'f'; + if ( aPrecision < 0 ) // f --> DigNum is the number of digits after the decimal point + Format = 'g'; // g --> DigNum is the maximum number of significant digits + if ( mySketchState == FIRST_POINT ) { if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) { - myNewCommand = myNewCommand + "F " + QString::number( myX ) + " " + QString::number( myY ); + myNewCommand = myNewCommand + "F " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum); theParameters = myXStr + ":" + myYStr; } if ( mySketchType == PT_RELATIVE) { - myNewCommand = myNewCommand + "F " + QString::number( myDX ) + " " + QString::number( myDY ); + myNewCommand = myNewCommand + "F " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ); theParameters = myDXStr + ":" + myDYStr; } - return myNewCommand; + if (myConstructorId == 2 ) + myNewCommand = ":"; + else + return myNewCommand; } if ( myConstructorId == 0 ) { // SEGMENT if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) { - myNewCommand = myNewCommand + "TT " + QString::number( myX ) + " " + QString::number( myY ); + myNewCommand = myNewCommand + "TT " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum); theParameters = myXStr + ":" + myYStr; } if ( mySketchType == PT_RELATIVE) { - myNewCommand = myNewCommand + "T " + QString::number( myDX ) + " " + QString::number( myDY ); + myNewCommand = myNewCommand + "T " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ); theParameters = myDXStr + ":" + myDYStr; } if ( mySketchType == DIR_ANGLE_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); - myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength ); + myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength, Format, DigNum ); theParameters = myAngleStr + ":" + myLengthStr; } if ( mySketchType == DIR_ANGLE_X ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); - myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX ); + myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX, Format, DigNum); theParameters = myAngleStr + ":" + myXStr; } if ( mySketchType == DIR_ANGLE_Y ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); - myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY ); + myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY, Format, DigNum); theParameters = myAngleStr + ":" + myYStr; } if ( mySketchType == DIR_PER_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); - myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength ); + myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength, Format, DigNum ); theParameters = QString::number( 90.0 ) + ":" + myLengthStr; } if ( mySketchType == DIR_PER_X ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); - myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX ); + myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX, Format, DigNum); theParameters = QString::number( 90.0 ) + ":" + myXStr; } if ( mySketchType == DIR_PER_Y ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); - myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY ); + myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY, Format, DigNum); theParameters = QString::number( 90.0 ) + ":" + myYStr; } if ( mySketchType == DIR_TAN_LENGTH ) { - myNewCommand = myNewCommand + "L " + QString::number( myLength ); + myNewCommand = myNewCommand + "L " + QString::number( myLength, Format, DigNum ); theParameters = myLengthStr; } if ( mySketchType == DIR_TAN_X ) { - myNewCommand = myNewCommand + "IX " + QString::number( myX ); + myNewCommand = myNewCommand + "IX " + QString::number( myX, Format, DigNum); theParameters = myXStr; } if ( mySketchType == DIR_TAN_Y) { - myNewCommand = myNewCommand + "IY " + QString::number(myY); + myNewCommand = myNewCommand + "IY " + QString::number(myY, Format, DigNum); theParameters = myYStr; } if ( mySketchType == DIR_DXDY_LENGTH ) { - myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); - myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength ); + myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ); + myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength, Format, DigNum ); theParameters = myDXStr + ":" + myDYStr + ":" + myLengthStr; } if ( mySketchType == DIR_DXDY_X ) { - myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); - myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX ); + myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ); + myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX, Format, DigNum); theParameters = myDXStr + ":" + myDYStr + ":" + myXStr; } if ( mySketchType == DIR_DXDY_Y ) { - myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); - myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY ); + myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ); + myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY, Format, DigNum); theParameters = myDXStr + ":" + myDYStr + ":" + myYStr; } } else if ( myConstructorId == 1 ) { // ARC + if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) { + myNewCommand = myNewCommand + "AA " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum); + theParameters = myXStr + ":" + myYStr; + } + if ( mySketchType == PT_RELATIVE) { + myNewCommand = myNewCommand + "A " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ); + theParameters = myDXStr + ":" + myDYStr; + } + if ( mySketchType == PT_ABS_RADIUS || mySketchType == PT_SEL_RADIUS ) { + myNewCommand = myNewCommand + "UU " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myRadius , Format, DigNum)+ " " + QString::number( myCheckFlag ); + theParameters = myXStr + ":" + myYStr + ":" + myRadiusStr; + } + if ( mySketchType == PT_REL_RADIUS) { + myNewCommand = myNewCommand + "U " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myRadius, Format, DigNum )+ " " + QString::number( myCheckFlag ); + theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr; + } + if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_SEL_CENTER ) { + myNewCommand = myNewCommand + "EE " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myXc , Format, DigNum) + " " + QString::number( myYc , Format, DigNum)+ " " + QString::number( myCheckFlag ) + " " + QString::number( 0 ); + theParameters = myXStr + ":" + myYStr + ":" + myXcStr+ ":" + myYcStr; + } + if ( mySketchType == PT_REL_CENTER) { + myNewCommand = myNewCommand + "E " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myDXc, Format, DigNum )+ " " + QString::number( myDYc, Format, DigNum )+ " " + QString::number( myCheckFlag )+ " " + QString::number( 0 ); + theParameters = myDXStr + ":" + myDYStr + ":" + myDXcStr + ":" + myDYcStr ; + } if ( mySketchType == DIR_ANGLE_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); - myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum ); theParameters = myAngleStr + ":" + myRadiusStr + ":" + myLengthStr; } if ( mySketchType == DIR_PER_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); - myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum ); theParameters = QString::number( 90.0 ) + ":" + myRadiusStr + ":" + myLengthStr; } if ( mySketchType == DIR_TAN_LENGTH ) { - myNewCommand = myNewCommand + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + myNewCommand = myNewCommand + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum ); theParameters = myRadiusStr + ":" + myLengthStr; } if ( mySketchType == DIR_DXDY_LENGTH ) { - myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); - myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ); + myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum ); theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr + ":" + myLengthStr; } } + else if ( myConstructorId == 2 ) { // RECTANGLE + myNewCommand = myNewCommand + "F " + QString::number( myX1, Format, DigNum) + " " + QString::number( myY1, Format, DigNum) + + ":TT " + QString::number( myX1, Format, DigNum) + " " + QString::number( myY2, Format, DigNum) + + ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY2, Format, DigNum) + + ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum) + + ":WW"; + + theParameters = myX1Str + ":" + myY1Str + ":" + myX2Str + ":" + myY2Str ; + } return myNewCommand; } @@ -1317,6 +2265,9 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg ) if( Group1Spin->isVisible() ) { ok = Group1Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok; } + else if( Group1Sel1Spin->isVisible() ) { + ok = Group1Sel1Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok; + } else if( Group2Spin->isVisible() ) { ok = Group2Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok; ok = Group2Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok; @@ -1345,8 +2296,16 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg ) //================================================================================= bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) { + MESSAGE("EntityGUI_SketcherDlg::execute") + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand + char Format = 'f'; + if ( aPrecision < 0 ) // f --> DigNum is the number of digits after the decimal point + Format = 'g'; // g --> DigNum is the maximum number of significant digits + QString aParameters; - + if ( mySketchState == FIRST_POINT ) { myLastX2 = myX; myLastY2 = myY; @@ -1355,6 +2314,9 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) //Test if the current point is the same as the last one TopoDS_Shape myShape1, myShape2; + // Set "C" numeric locale + Kernel_Utils::Localizer loc; + //Last Shape QString Command1 = myCommand.join( "" ); Sketcher_Profile aProfile1( Command1.toAscii() ); @@ -1364,6 +2326,31 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) //Current Shape QString Command2 = Command1 + GetNewCommand( aParameters ); Sketcher_Profile aProfile2( Command2.toAscii() ); + + //Error Message + if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_REL_CENTER ){ + if (aProfile2.Error() > Precision::Confusion()){ + Group4Spin->label->show(); + Group4Spin->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( aProfile2.Error(), Format, DigNum)); + } + else{ + Group4Spin->label->hide(); + } + } + else + Group4Spin->label->hide(); + if ( mySketchType == PT_SEL_CENTER ){ + if (aProfile2.Error() > Precision::Confusion()){ + Group2Sel->label->show(); + Group2Sel->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( aProfile2.Error(), Format, DigNum)); + } + else{ + Group2Sel->label->hide(); + } + } + else + Group2Sel->label->hide(); + if ( aProfile2.IsDone() ) myShape2 = aProfile2.GetShape(); @@ -1376,16 +2363,16 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) TopoDS_Vertex V1, V2; gp_Pnt pt; if ( myShape1.ShapeType() == TopAbs_VERTEX ) { - //the last shape is the first point - pt = BRep_Tool::Pnt( TopoDS::Vertex( myShape1 ) ); - myLastX1 = pt.X(); - myLastY1 = pt.Y(); + //the last shape is the first point + pt = BRep_Tool::Pnt( TopoDS::Vertex( myShape1 ) ); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); } else { - TopExp::Vertices( TopoDS::Wire( myShape1 ), V1, V2 ); - pt = BRep_Tool::Pnt( V2 ); - myLastX1 = pt.X(); - myLastY1 = pt.Y(); + TopExp::Vertices( TopoDS::Wire( myShape1 ), V1, V2 ); + pt = BRep_Tool::Pnt( V2 ); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); } TopExp::Vertices( TopoDS::Wire( myShape2 ), V1, V2 ); pt = BRep_Tool::Pnt( V2 ); @@ -1396,13 +2383,20 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) QString cmd; if ( ( mySketchState != FIRST_POINT && - myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) { + myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) { cmd = myCommand.join( "" ); - if ( Group1Sel->isVisible() ) { Group1Sel->buttonApply->setEnabled( false ); //Group1Sel->buttonApply->setFocus(); } + if ( Group2Sel->isVisible() ) { + Group2Sel->buttonApply->setEnabled( false ); + //Group2Sel->buttonApply->setFocus(); + } + if ( Group1Sel1Spin->isVisible() ) { + Group1Sel1Spin->buttonApply->setEnabled( false ); + //Group1Sel1Spin->buttonApply->setFocus(); + } if ( Group1Spin->isVisible() ) { Group1Spin->buttonApply->setEnabled( false ); //Group1Spin->buttonApply->setFocus(); @@ -1425,50 +2419,41 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) if ( Group1Sel->isVisible() ) { Group1Sel->buttonApply->setEnabled( true ); - //Group1Sel->buttonApply->setFocus(); + } + if ( Group2Sel->isVisible() ) { + Group2Sel->buttonApply->setEnabled( true ); + } + if ( Group1Sel1Spin->isVisible() ) { + Group1Sel1Spin->buttonApply->setEnabled( true );; } if ( Group1Spin->isVisible() ) { Group1Spin->buttonApply->setEnabled( true ); - //Group1Spin->buttonApply->setFocus(); } if ( Group2Spin->isVisible() ) { Group2Spin->buttonApply->setEnabled( true ); - //Group2Spin->buttonApply->setFocus(); } if ( Group3Spin->isVisible() ) { Group3Spin->buttonApply->setEnabled( true ); - //Group3Spin->buttonApply->setFocus(); } if ( Group4Spin->isVisible() ) { Group4Spin->buttonApply->setEnabled( true ); - //Group4Spin->buttonApply->setFocus(); } } - gp_Ax3 myWPlane = myGeometryGUI->GetWorkingPlane(); - GEOM::ListOfDouble_var WPlane = new GEOM::ListOfDouble; - WPlane->length( 9 ); - WPlane[0] = myWPlane.Location().X(); - WPlane[1] = myWPlane.Location().Y(); - WPlane[2] = myWPlane.Location().Z(); - - WPlane[3] = myWPlane.Direction().X(); - WPlane[4] = myWPlane.Direction().Y(); - WPlane[5] = myWPlane.Direction().Z(); - - WPlane[6] = myWPlane.XDirection().X(); - WPlane[7] = myWPlane.XDirection().Y(); - WPlane[8] = myWPlane.XDirection().Z(); - - GEOM::GEOM_Object_var anObj = - GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.toLatin1(), WPlane ); - + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = NULL; + + int index = ComboBox1->currentIndex(); + if(index != -1 && !myWPlane->_is_nil()) // The combobox is not empty + { + anObj = anOper->MakeSketcherOnPlane( cmd.toLatin1().constData(), myWPlane ); + } if ( !anObj->_is_nil() ) { if( !IsPreview() ) { QStringList aCurrentParameters = myParameters; aCurrentParameters << aParameters; - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aCurrentParameters)); + anObj->SetParameters(aCurrentParameters.join(":").toLatin1().constData()); } objects.push_back( anObj._retn() ); @@ -1489,12 +2474,18 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, const double lineWidth, const int displayMode, const int color ) -{ - // Set color for preview shape - getDisplayer()->SetColor( Quantity_NOC_RED ); - +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + + QColor aColor = resMgr->colorValue("Geometry","line_color",QColor(255,0,0)); + Quantity_NameOfColor line_color = SalomeApp_Tools::color( aColor ).Name(); + // set width of displayed shape - getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth ); + int lw = lineWidth; + if(lw == -1) { + lw = resMgr->integerValue("Geometry", "preview_edge_width", -1); + } + getDisplayer()->SetWidth( lw ); // Disable activation of selection getDisplayer()->SetToActivate( activate ); @@ -1503,27 +2494,70 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object ); getDisplayer()->SetName( objStr.in() ); - // Create wire from applayed object + // Create wire from applied object TopoDS_Shape anApplyedWire, aLastSegment; if ( !createShapes( object, anApplyedWire, aLastSegment ) ) return; // Build prs + if( myConstructorId != 2) + getDisplayer()->SetColor( line_color ); + else + getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire ); if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); - getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + getDisplayer()->SetColor( Quantity_NOC_VIOLET ); aPrs = getDisplayer()->BuildPrs( aLastSegment ); + if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); + getDisplayer()->SetColor( line_color ); + getDisplayer()->UnsetName(); // Enable activation of displayed objects getDisplayer()->SetToActivate( true ); } +//================================================================ +// Function : displayPntPreview +// Purpose : creates a TopoDS_VERTEX and display a preview of it +//================================================================ +void EntityGUI_SketcherDlg::displayPntPreview(const double x, + const double y, + bool append, + bool update + ) +{ + // Get globalCS and working plane + gp_Ax3 globalCS = WPlaneToLCS( myGlobalCS ); + gp_Ax3 aWPlane = GetActiveLocalCS(); + + // Build point in localCS + gp_Pnt aPnt = gp_Pnt(x,y,0.0); + + // Get transfomation from local to global CS + gp_Trsf aTrans; + aTrans.SetTransformation(aWPlane, globalCS); + + BRepBuilderAPI_MakeVertex mkVertex (aPnt); + TopoDS_Shape aLocalVertex = mkVertex.Shape(); + + // Perform transformation + BRepBuilderAPI_Transform aTransformation (aLocalVertex, aTrans, Standard_False); + TopoDS_Shape aGlobalVertex = aTransformation.Shape(); + + // Build prs with vertex in globalCS + SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aGlobalVertex ); + if ( aPrs != 0 && !aPrs->IsNull() ) + GEOMBase_Helper::displayPreview( aPrs, append, update ); + +} + //================================================================ // Function : createShapes // Purpose : Create applyed wire, and last segment from entry object @@ -1533,15 +2567,17 @@ bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, TopoDS_Shape& theLastSegment ) { TopoDS_Shape aShape; - if ( !GEOMBase::GetShape( theObject, aShape ) || - aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX ) + if ( !GEOMBase::GetShape( theObject, aShape ) || + ( aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX ) ) return false; - if ( Group1Sel->isVisible() && !Group1Sel->buttonApply->isEnabled() || - Group1Spin->isVisible() && !Group1Spin->buttonApply->isEnabled() || - Group2Spin->isVisible() && !Group2Spin->buttonApply->isEnabled() || - Group3Spin->isVisible() && !Group3Spin->buttonApply->isEnabled() || - Group4Spin->isVisible() && !Group4Spin->buttonApply->isEnabled() ) { + if ( ( Group1Sel->isVisible() && !Group1Sel->buttonApply->isEnabled() )|| + ( Group2Sel->isVisible() && !Group2Sel->buttonApply->isEnabled() ) || + ( Group1Sel1Spin->isVisible() && !Group1Sel1Spin->buttonApply->isEnabled() ) || + ( Group1Spin->isVisible() && !Group1Spin->buttonApply->isEnabled() ) || + ( Group2Spin->isVisible() && !Group2Spin->buttonApply->isEnabled() ) || + ( Group3Spin->isVisible() && !Group3Spin->buttonApply->isEnabled() ) || + ( Group4Spin->isVisible() && !Group4Spin->buttonApply->isEnabled() ) ) { theApplyedWire = aShape; return true; } @@ -1565,6 +2601,19 @@ bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, return true; } +//================================================================================= +// function : acceptMouseEvent() +// purpose : +//================================================================================= +bool EntityGUI_SketcherDlg::acceptMouseEvent() const +{ + return ( (getPnt1ConstructorId() == 1 + || getPnt1ConstructorId() == 0 + || myConstructorId == 2) //accept mouse event only on absolute and relative selection mode + && !WPlaneLineEdit->isEnabled()); //or when the constructor is rectangle + //called by EntityGUI::OnMousePress() +} + //================================================================================= // function : keyPressEvent() // purpose : @@ -1581,13 +2630,31 @@ void EntityGUI_SketcherDlg::keyPressEvent( QKeyEvent* e ) } } +//================================================================================= +// function : initSpinBox() +// purpose : +//================================================================================= void EntityGUI_SketcherDlg::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, - double min, double max, - double step, int decimals ) + double min, double max, + double step, const char* quantity ) { - spinBox->setDecimals( decimals ); + // The same stuff as in GEOMBase_Skeleton::initSpinBox()! + // TODO: Think how to keep the single piece of code... + + // Obtain precision from preferences + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 ); + + spinBox->setPrecision( aPrecision ); + spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting, + // by default Qt rounds boundaries to 2 decimals at setRange spinBox->setRange( min, max ); spinBox->setSingleStep( step ); + + // Add a hint for the user saying how to tune precision + QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() ); + spinBox->setProperty( "validity_tune_hint", + QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) ); } //================================================================================= @@ -1597,13 +2664,185 @@ void EntityGUI_SketcherDlg::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, void EntityGUI_SketcherDlg::SetDoubleSpinBoxStep( double step ) { Group1Spin->SpinBox_DX->setSingleStep(step); + Group1Sel1Spin->SpinBox_DX->setSingleStep(step); Group2Spin->SpinBox_DX->setSingleStep(step); Group2Spin->SpinBox_DY->setSingleStep(step); Group3Spin->SpinBox_DX->setSingleStep(step); Group3Spin->SpinBox_DY->setSingleStep(step); Group3Spin->SpinBox_DZ->setSingleStep(step); - Group4Spin->SpinBox_DX->setSingleStep(step); - Group4Spin->SpinBox_DY->setSingleStep(step); Group4Spin->SpinBox_DZ->setSingleStep(step); - Group4Spin->SpinBox_DS->setSingleStep(step); + + // san: Do NOT override the step when a speicifc step value is used + // in some input fields! + //Group4Spin->SpinBox_DX->setSingleStep(step); + //Group4Spin->SpinBox_DY->setSingleStep(step); + //Group4Spin->SpinBox_DS->setSingleStep(step); +} + +//================================================================================= +// function : AddLocalCS() +// purpose : Add All Coordinates systems in study +//================================================================================= +void EntityGUI_SketcherDlg::AddLocalCS(GEOM::GEOM_Object_var aSelectedObject) +{ + QString aName = GEOMBase::GetName( aSelectedObject ); + + int index = ComboBox1->findText(aName, Qt::MatchExactly); + + if (index==-1) // If the working plane hasn't been added yet + { + myWPlaneList.push_back(aSelectedObject); + myWPlane = aSelectedObject; + addSubshapesToStudy(); + myLCSList.push_back(WPlaneToLCS(aSelectedObject)); + ComboBox1->addItem(aName); + index = ComboBox1->count(); + ComboBox1->setCurrentIndex(index-1); + } + else + { + ComboBox1->setCurrentIndex(index); + } + ActivateLocalCS(); +} + +//================================================================================= +// function : FindLocalCS() +// purpose : Find All Coordinates systems in study +//================================================================================= +void EntityGUI_SketcherDlg::FindLocalCS() +{ + ComboBox1->clear(); + myWPlaneList.clear(); + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return; + + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if ( !appStudy ) + return; + + _PTR(Study) aStudy = appStudy->studyDS(); + + //add Global CS + ComboBox1->addItem(tr("GEOM_GCS")); + myWPlaneList.push_back(myGlobalCS); + + // get GEOM component + CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() ); + _PTR(SObject) obj = aStudy->FindObjectIOR( geomIOR.in() ); + if (!obj) + return; + _PTR(SComponent) fc = obj->GetFatherComponent(); + QString geomComp = fc->GetID().c_str(); + _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toLatin1().data() ); + if ( !comp ) + return; + + // browse through all GEOM data tree + _PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) ); + for ( it->InitEx( true ); it->More(); it->Next() ) + { + _PTR(SObject) child( it->Value() ); + CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child ); + GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); + if( CORBA::is_nil( geomObj ) ) + continue; + if (geomObj->GetType() == GEOM_MARKER) + { + myWPlaneList.push_back(geomObj); + myLCSList.push_back(WPlaneToLCS(geomObj)); + ComboBox1->addItem(geomObj->GetName()); + } + } +} + +//================================================================================= +// function : WPlaneToLCS ( aWPlane ) +// purpose : +//================================================================================= +gp_Ax3 EntityGUI_SketcherDlg::WPlaneToLCS( GEOM::GEOM_Object_var geomObj ) +{ + TopoDS_Shape aShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), geomObj); + + gp_Ax3 aLCS; + if (CORBA::is_nil( geomObj ) || aShape.IsNull()) + { + MESSAGE("CORBA::is_nil( geomObj ) || aShape.IsNull()") + } + aLCS.Transform(aShape.Location().Transformation()); + if (aShape.ShapeType() == TopAbs_FACE) + { + GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = + myGeometryGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); + double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz; + aMeasureOp->GetPosition( geomObj, Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz); + if ( aMeasureOp->IsDone() ) + { + gp_Pnt aPnt ( Ox, Oy, Oz ); + gp_Dir aDirN ( Zx, Zy, Zz ); + gp_Dir aDirX ( Xx, Xy, Xz ); + aLCS = gp_Ax3( aPnt, aDirN, aDirX ); + } + } + return aLCS; +} + + +//================================================================================= +// function : getPnt1ConstructorId() +// purpose : +//================================================================================= +int EntityGUI_SketcherDlg::getPnt1ConstructorId() const +{ + int buttonId = GroupPt->ButtonGroup->checkedId(); +// MESSAGE("buttonId = "<ButtonGroup->checkedId(); +// MESSAGE("buttonId = "<currentIndex(); + if (ind == -1) + return myGeometryGUI->GetWorkingPlane(); + + gp_Ax3 aLCS = myLCSList.at(ind); + myWPlane = myWPlaneList.at(ind); + + return aLCS; +} + +//================================================================================= +// function : ActivateLocalCS() +// purpose : Activate & Fit Working plane +//================================================================================= +void EntityGUI_SketcherDlg::ActivateLocalCS() +{ + myGeometryGUI->SetWorkingPlane( GetActiveLocalCS() ); + myGeometryGUI->ActiveWorkingPlane(); +} + +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void EntityGUI_SketcherDlg::addSubshapesToStudy() +{ + GEOMBase::PublishSubObject(myWPlane); } diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h index 3a304abf1..d8bed62f3 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.h +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI_SketcherDlg.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -28,19 +29,27 @@ #include +#include +#include #include +#include + +#include class QLineEdit; class SalomeApp_DoubleSpinBox; class EntityGUI_1Sel; +class EntityGUI_2Sel1Check; +class EntityGUI_1Sel1Spin1Check; class EntityGUI_1Spin; class EntityGUI_2Spin; -class EntityGUI_3Spin; -class EntityGUI_4Spin; +class EntityGUI_3Spin1Check; +class EntityGUI_4Spin1Check; class EntityGUI_Point; class EntityGUI_Dir1; class EntityGUI_Dir2; class EntityGUI_Skeleton; +class DlgRef_4Spin; class GeometryGUI; #ifndef COORD_MIN @@ -60,21 +69,25 @@ class EntityGUI_SketcherDlg : public QDialog, GEOMBase_Helper public: EntityGUI_SketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, - const double = 2. ); + const double = -1 ); ~EntityGUI_SketcherDlg(); bool eventFilter (QObject* object, QEvent* event); + + bool acceptMouseEvent() const; // called by EntityGUI::OnMousePress() + void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt&, bool isStart = true ); protected: void initSpinBox( SalomeApp_DoubleSpinBox*, - double, double, double = 0.1, - int = 3 ); + double, double, double = 0.1, + const char* quantity = "length_precision" ); // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); - + virtual void addSubshapesToStudy(); + void closeEvent( QCloseEvent* ); void keyPressEvent( QKeyEvent* ); @@ -88,25 +101,38 @@ private: QString GetNewCommand( QString& ); virtual void displayPreview( GEOM::GEOM_Object_ptr, - const bool = false, - const bool = false, - const bool = true, - const double = -1, - const int = -1, - const int = -1); + const bool = false, + const bool = false, + const bool = true, + const double = -1, + const int = -1, + const int = -1); + + void displayPntPreview( const double = 0.0, + const double = 0.0, + bool /*append*/ = true, + bool /*update*/ = true + ); bool createShapes( GEOM::GEOM_Object_ptr, - TopoDS_Shape&, - TopoDS_Shape& ); + TopoDS_Shape&, + TopoDS_Shape& ); + int getPnt1ConstructorId() const; + int getPnt2ConstructorId() const; + void OnFirstPoint(); + void OnNextPoint(); + private: int myConstructorId; int myConstructorDirId; + int myConstructorPntId; int mySketchType; int mySketchState; bool myIsAllAdded; bool myIsApply; + bool autoApply; QLineEdit* myEditCurrentArgument; /* Current LineEdit */ @@ -117,11 +143,15 @@ private: QStringList myUndoParameters; Standard_Real myX, myY, myDX, myDY; + Standard_Real myX1, myY1, myX2, myY2; + Standard_Real myXc, myYc, myDXc, myDYc; Standard_Real myLength, myAngle, myRadius; Standard_Real myLastX1, myLastY1; Standard_Real myLastX2, myLastY2; QString myXStr, myYStr, myDXStr, myDYStr; + QString myX1Str, myY1Str, myX2Str, myY2Str; + QString myXcStr, myYcStr, myDXcStr, myDYcStr; QString myLengthStr, myAngleStr, myRadiusStr; QString myLastX1Str, myLastY1Str; QString myLastX2Str, myLastY2Str; @@ -129,14 +159,27 @@ private: EntityGUI_Skeleton* MainWidget; EntityGUI_Point* GroupPt; + EntityGUI_Point* GroupPt2; EntityGUI_Dir1* GroupD1; EntityGUI_Dir2* GroupD2; EntityGUI_1Sel* Group1Sel; + EntityGUI_2Sel1Check* Group2Sel; + EntityGUI_1Sel1Spin1Check* Group1Sel1Spin; EntityGUI_1Spin* Group1Spin; EntityGUI_2Spin* Group2Spin; - EntityGUI_3Spin* Group3Spin; - EntityGUI_4Spin* Group4Spin; + EntityGUI_3Spin1Check* Group3Spin; + EntityGUI_4Spin1Check* Group4Spin; + DlgRef_4Spin* GroupRect; + + QLabel* myErrLabel; + + QGroupBox* GroupBox1; + QComboBox* ComboBox1; + QPushButton* planeButton; + QPushButton* selButton; + + QLineEdit* WPlaneLineEdit; GeometryGUI* myGeometryGUI; @@ -144,14 +187,25 @@ private: double myLineWidth; + QList myLCSList; + GEOM::GEOM_Object_var myGlobalCS; + GEOM::GEOM_Object_var myWPlane; + QList< GEOM::GEOM_Object_var > myWPlaneList; + + int myCheckFlag; + + TopAbs_ShapeEnum myNeedType; + private: enum SketchState { FIRST_POINT, NEXT_POINT }; enum SketchType { PT_ABS, PT_RELATIVE, PT_SEL, - DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y, - DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y, - DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y, - DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y }; + PT_ABS_RADIUS,PT_REL_RADIUS,PT_SEL_RADIUS, + PT_ABS_CENTER,PT_REL_CENTER,PT_SEL_CENTER, + DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y, + DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y, + DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y, + DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y }; private slots: void ClickOnEnd(); @@ -166,12 +220,20 @@ private slots: void DeactivateActiveDialog(); void ActivateThisDialog(); void TypeClicked( int ); + void RectClicked(); void DestClicked( int ); void PointClicked( int ); + void Point2Clicked( int ); void Dir1Clicked( int ); void Dir2Clicked( int ); + void CheckBoxClicked( int ); void ValueChangedInSpinBox( double ); void SetDoubleSpinBoxStep( double ); + void AddLocalCS( GEOM::GEOM_Object_var ); + void FindLocalCS(); + gp_Ax3 GetActiveLocalCS(); + gp_Ax3 WPlaneToLCS( GEOM::GEOM_Object_var ); + void ActivateLocalCS(); }; #endif // ENTITYGUI_SKETCHERDLG_H diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index af81a31bb..5facd0411 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -1,50 +1,60 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI_SubShapeDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "EntityGUI_SubShapeDlg.h" #include #include #include +#include +#include +#include +#include +#include +#include + #include #include #include #include #include -#include -#include -#include -#include -#include +#include #include +#include #include +#include + +#include #include +#include + //================================================================================= // class : EntityGUI_SubShapeDlg // purpose : Constructs a EntityGUI_SubShapeDlg which is a child of 'parent', with the @@ -52,54 +62,64 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) +EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), + myWithShape(true), + myIsHiddenMain(false) { - QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUBSHAPE" ) ) ); - QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SUBSHAPE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); - setWindowTitle( tr( "GEOM_SUBSHAPE_TITLE" ) ); + setWindowTitle(tr("GEOM_SUBSHAPE_TITLE")); /***************************************************************/ - mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SUB_SHAPE" ) ); - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->GroupConstructors->setTitle(tr("GEOM_SUB_SHAPE")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton2->close(); - mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_1Sel1Check1List( centralWidget() ); - - GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupPoints->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - GroupPoints->TextLabel2->setText( tr( "GEOM_SUBSHAPE_TYPE" ) ); - GroupPoints->CheckButton1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) ); - GroupPoints->PushButton1->setIcon( image1 ); - GroupPoints->LineEdit1->setReadOnly( true ); - - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupPoints ); + GroupPoints = new DlgRef_1Sel1List1Check3Btn(centralWidget()); + + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_SUBSHAPE_TYPE")); + GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT")); + GroupPoints->PushButton1->setIcon(image1); + GroupPoints->PushButton2->setText(tr("SHOW_ONLY_SELECTED")); + GroupPoints->PushButton3->setText(tr("HIDE_SELECTED")); + GroupPoints->PushButton4->setText(tr("SHOW_ALL_SUB_SHAPES")); + GroupPoints->LineEdit1->setReadOnly(true); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupPoints); /***************************************************************/ - setHelpFileName( "create_explode_page.html" ); + setIsOptimizedBrowsing(true); + + setHelpFileName("create_explode_page.html"); mainFrame()->GroupBoxName->hide(); Init(); } - //================================================================================= // function : ~EntityGUI_SubShapeDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= EntityGUI_SubShapeDlg::~EntityGUI_SubShapeDlg() { + if (myIsHiddenMain) { + GEOM_Displayer* aDisplayer = getDisplayer(); + aDisplayer->Display(myObject); + myIsHiddenMain = false; + } } - //================================================================================= // function : Init() // purpose : @@ -112,41 +132,77 @@ void EntityGUI_SubShapeDlg::Init() myWithShape = true; - /* type for sub shape selection */ - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compound" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compsolid" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Solid" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shell" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Face" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Wire" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Edge" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Vertex" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shape" ); - - if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type() ) - GroupPoints->CheckButton1->setEnabled( false ); + /* type for sub-shape selection */ + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compound"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compsolid"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Solid"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shell"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Face"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Wire"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Edge"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Vertex"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape"); + + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) + GroupPoints->CheckButton1->setEnabled(false); /* signals and slots connections */ - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) ); - connect( GroupPoints->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( SubShapeToggled() ) ); + connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); - connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged( )), this, SLOT( SelectionIntoArgument() ) ); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(showOnlySelected())); - updateButtonState(); + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + updateButtonState(); + resize(100,100); SelectionIntoArgument(); } +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::enterEvent(QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + SubShapeToggled(); + updateButtonState(); +} + +//================================================================================= +//function : closeEvent +//purpose : remove temporary geom object +//================================================================================= +void EntityGUI_SubShapeDlg::closeEvent(QCloseEvent* e) +{ + erasePreview(true); + GEOMBase_Skeleton::closeEvent(e); +} //================================================================================= // function : ClickOnOk() @@ -154,35 +210,59 @@ void EntityGUI_SubShapeDlg::Init() //================================================================================= void EntityGUI_SubShapeDlg::ClickOnOk() { - if ( ClickOnApply() ) + setIsApplyAndClose(true); + + SUIT_Session::session()->activeApplication()->putInfo(""); + + /* Explode all sub-shapes */ + bool isOk = true; + if (isAllSubShapes()) { + /* More than 30 sub-shapes : ask confirmation */ + unsigned int nb = NumberOfSubShapes(myShape, shapeType()); + if (nb > 30) { + const QString caption = tr("GEOM_CONFIRM"); + const QString text = tr("GEOM_CONFIRM_INFO").arg(nb); + const QString button0 = tr("GEOM_BUT_EXPLODE"); + const QString button1 = tr("GEOM_BUT_CANCEL"); + + if (QMessageBox::warning(this, caption, text, button0, button1) != 0) + isOk = false; /* aborted */ + } + } + + if (isOk) + isOk = onAccept(); + + if (isOk) ClickOnCancel(); } - //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= bool EntityGUI_SubShapeDlg::ClickOnApply() { - SUIT_Session::session()->activeApplication()->putInfo( "" ); - - /* Explode all sub shapes */ - if ( isAllSubShapes() ) { - /* More than 30 subshapes : ask confirmation */ - unsigned int nb = NumberOfSubShapes( myShape, shapeType() ); - if ( nb > 30 ) { - const QString caption = tr( "GEOM_CONFIRM" ); - const QString text = tr( "GEOM_CONFIRM_INFO" ).arg( nb ); - const QString button0 = tr( "GEOM_BUT_EXPLODE" ); - const QString button1 = tr( "GEOM_BUT_CANCEL" ); - - if ( QMessageBox::warning( this, caption, text, button0, button1 ) != 0 ) + SUIT_Session::session()->activeApplication()->putInfo(""); + + /* Explode all sub-shapes */ + if (isAllSubShapes()) { + /* More than 30 sub-shapes : ask confirmation */ + unsigned int nb = NumberOfSubShapes(myShape, shapeType()); + if (nb > 30) { + const QString caption = tr("GEOM_CONFIRM"); + const QString text = tr("GEOM_CONFIRM_INFO").arg(nb); + const QString button0 = tr("GEOM_BUT_EXPLODE"); + const QString button1 = tr("GEOM_BUT_CANCEL"); + + if (QMessageBox::warning(this, caption, text, button0, button1) != 0) return false; /* aborted */ } } - - bool isOk = onAccept(); + + setIsDisableBrowsing( true ); + bool isOk = onAccept( true, true, false ); + setIsDisableBrowsing( false ); // restore selection, corresponding to current selection mode SubShapeToggled(); @@ -190,11 +270,9 @@ bool EntityGUI_SubShapeDlg::ClickOnApply() return isOk; } - //================================================================================= // function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 (LineEditC1A1) +// purpose : Called when selection has changed or other case //================================================================================= void EntityGUI_SubShapeDlg::SelectionIntoArgument() { @@ -213,25 +291,28 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() if (nbSel != 1) return; - TopoDS_Shape S; Handle(SALOME_InteractiveObject) IO = aSelList.First(); - if ( !IO->hasEntry() ) { - SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); + if (!IO->hasEntry()) { + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); updateButtonState(); return; } - if (!GEOMBase::GetTopoFromSelection(aSelList, S) || - S.IsNull() || - S.ShapeType() == TopAbs_VERTEX) { + if (myIsHiddenMain) { + GEOM_Displayer* aDisplayer = getDisplayer(); + aDisplayer->Display(myObject); + myIsHiddenMain = false; + } + + TopoDS_Shape S = GEOMBase::GetTopoFromSelection(aSelList); + if (S.IsNull() || S.ShapeType() == TopAbs_VERTEX) { myObject = GEOM::GEOM_Object::_nil(); updateButtonState(); return; } - Standard_Boolean testResult; - myObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); - if (!testResult || myObject->_is_nil()) { + myObject = GEOMBase::ConvertIOinGEOMObject(IO); + if (myObject->_is_nil()) { updateButtonState(); return; } @@ -249,7 +330,7 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() // Solving PAL5590 if (myShape.ShapeType() == TopAbs_COMPOUND) { unsigned int nb = NumberOfSubShapes(myShape, TopAbs_COMPOUND); - if ( nb > 0 ) + if (nb > 0) i++; } while (i <= myShape.ShapeType()) { @@ -264,35 +345,34 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() } } else { - if ( myWithShape == true ) { - GroupPoints->ComboBox1->removeItem( GroupPoints->ComboBox1->count() - 1 ); + if (myWithShape == true) { + GroupPoints->ComboBox1->removeItem(GroupPoints->ComboBox1->count() - 1); myWithShape = false; } } int count1 = GroupPoints->ComboBox1->count(); - if ( myWithShape ) + if (myWithShape) count1 = count1 - 1; - if ( SelectedShapeType > myShape.ShapeType() ) { - if ( SelectedShapeType == 8 ) { - if ( myShape.ShapeType() != TopAbs_COMPOUND ) { - GroupPoints->ComboBox1->setCurrentIndex( 0 ); + if (SelectedShapeType > myShape.ShapeType()) { + if (SelectedShapeType == 8) { + if (myShape.ShapeType() != TopAbs_COMPOUND) { + GroupPoints->ComboBox1->setCurrentIndex(0); ComboTextChanged(); } } else - GroupPoints->ComboBox1->setCurrentIndex( count1 - count + SelectedShapeType ); + GroupPoints->ComboBox1->setCurrentIndex(count1 - count + SelectedShapeType); } else { - GroupPoints->ComboBox1->setCurrentIndex( 0 ); + GroupPoints->ComboBox1->setCurrentIndex(0); ComboTextChanged(); } updateButtonState(); } - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -301,21 +381,20 @@ void EntityGUI_SubShapeDlg::SetEditCurrentArgument() { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; - - GroupPoints->CheckButton1->setChecked( false ); + + GroupPoints->CheckButton1->setChecked(false); SubShapeToggled(); SelectionIntoArgument(); } - //================================================================================= // function : LineEditReturnPressed() // purpose : //================================================================================= void EntityGUI_SubShapeDlg::LineEditReturnPressed() -{ +{ QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 ) + if (send == GroupPoints->LineEdit1) SetEditCurrentArgument(); else return; @@ -323,136 +402,104 @@ void EntityGUI_SubShapeDlg::LineEditReturnPressed() GEOMBase_Skeleton::LineEditReturnPressed(); } - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void EntityGUI_SubShapeDlg::DeactivateActiveDialog() -{ - if ( mainFrame()->GroupConstructors->isEnabled() ) { - GEOMBase_Skeleton::DeactivateActiveDialog(); - } -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void EntityGUI_SubShapeDlg::ActivateThisDialog() -{ - GEOMBase_Skeleton::ActivateThisDialog(); - connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - SubShapeToggled(); - updateButtonState(); -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void EntityGUI_SubShapeDlg::enterEvent( QEvent* ) -{ - if ( !mainFrame()->GroupConstructors->isEnabled() ) - ActivateThisDialog(); -} - //================================================================================= // function : ResetStateOfDialog() // purpose : Completely reset the state of method including local context //================================================================================= void EntityGUI_SubShapeDlg::ResetStateOfDialog() { + if (myIsHiddenMain) { + GEOM_Displayer* aDisplayer = getDisplayer(); + aDisplayer->Display(myObject); + myIsHiddenMain = false; + } myObject = GEOM::GEOM_Object::_nil(); myShape.Nullify(); - myEditCurrentArgument->setText( "" ); + myEditCurrentArgument->setText(""); int SelectedShapeType = GroupPoints->ComboBox1->currentIndex(); int count = GroupPoints->ComboBox1->count(); - if ( myWithShape ) + if (myWithShape) count = count - 1; - /* type for sub shape selection */ + /* type for sub-shape selection */ GroupPoints->ComboBox1->clear(); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compound" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Compsolid" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Solid" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shell" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Face" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Wire" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Edge" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Vertex" ); - GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shape" ); - + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compound"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Compsolid"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Solid"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shell"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Face"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Wire"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Edge"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Vertex"); + GroupPoints->ComboBox1->insertItem(GroupPoints->ComboBox1->count(), "Shape"); + myWithShape = true; - - GroupPoints->ComboBox1->setCurrentIndex( 8 - count + SelectedShapeType ); - ComboTextChanged(); + + GroupPoints->ComboBox1->setCurrentIndex(8 - count + SelectedShapeType); + + // to avoid recursion: SelectionIntoArgument->ResetStateOfDialog->ComboTextChanged->SubShapeToggled->activateSelection->(currentSelectionChanged)->SelectionIntoArgument + //ComboTextChanged(); updateButtonState(); } - //================================================================================= // function : SubShapeToggled() -// purpose : Allow user selection of all or only selected sub shapes +// purpose : Allow user selection of all or only selected sub-shapes // : Called when 'CheckButton1' state change //================================================================================= void EntityGUI_SubShapeDlg::SubShapeToggled() { - globalSelection( GEOM_ALLSHAPES ); + GroupPoints->PushButton2->setEnabled(!isAllSubShapes()); + GroupPoints->PushButton3->setEnabled(!isAllSubShapes()); + GroupPoints->PushButton4->setEnabled(!isAllSubShapes()); - if ( !isAllSubShapes() ) - localSelection( myObject, shapeType() ); + activateSelection(); } - //================================================================================= // function : ComboTextChanged() -// purpose : +// purpose : //================================================================================= void EntityGUI_SubShapeDlg::ComboTextChanged() { - /* Select sub shapes mode not checked */ + /* Select sub-shapes mode not checked */ updateButtonState(); - SubShapeToggled(); + SubShapeToggled(); } - //================================================================================= // function : NumberOfSubShapes() // purpose : //================================================================================= -unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes( const TopoDS_Shape& S, - const int shapeType ) const +unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes(const TopoDS_Shape& S, + const int shapeType) const { - if ( S.IsNull() ) + if (S.IsNull()) return 0; unsigned int index = 0; TopTools_MapOfShape M; - if ( S.ShapeType() == TopAbs_COMPOUND && - ( TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE || - TopAbs_ShapeEnum(shapeType) == TopAbs_COMPSOLID || - TopAbs_ShapeEnum(shapeType) == TopAbs_COMPOUND ) ) { - TopoDS_Iterator It( S, Standard_True, Standard_True ); - for ( ; It.More(); It.Next() ) { - if ( M.Add( It.Value() ) ) { - if ( TopAbs_ShapeEnum( shapeType ) == TopAbs_SHAPE || - TopAbs_ShapeEnum( shapeType ) == It.Value().ShapeType() ) { + if (S.ShapeType() == TopAbs_COMPOUND && + (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(shapeType) == TopAbs_COMPSOLID || + TopAbs_ShapeEnum(shapeType) == TopAbs_COMPOUND)) { + TopoDS_Iterator It(S, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + if (M.Add(It.Value())) { + if (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(shapeType) == It.Value().ShapeType()) { index++; } } } - } + } else { - TopExp_Explorer Exp ( S, TopAbs_ShapeEnum( shapeType ) ); - for ( ; Exp.More(); Exp.Next() ) { - if ( M.Add( Exp.Current() ) ) { + TopExp_Explorer Exp (S, TopAbs_ShapeEnum(shapeType)); + for (; Exp.More(); Exp.Next()) { + if (M.Add(Exp.Current())) { index++; } } @@ -468,13 +515,13 @@ unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes( const TopoDS_Shape& S, //================================================================================= void EntityGUI_SubShapeDlg::updateButtonState() { - if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() || - myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND ) { - GroupPoints->CheckButton1->setChecked( false ); - GroupPoints->CheckButton1->setEnabled( false ); + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() || + myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND) { + GroupPoints->CheckButton1->setChecked(false); + GroupPoints->CheckButton1->setEnabled(false); } else - GroupPoints->CheckButton1->setEnabled( true ); + GroupPoints->CheckButton1->setEnabled(true); } //================================================================================= @@ -494,26 +541,214 @@ int EntityGUI_SubShapeDlg::shapeType() const { int type = GroupPoints->ComboBox1->currentIndex(); - if ( myObject->_is_nil() ) + if (myObject->_is_nil()) return type; // Solving PAL5590 type += myShape.ShapeType() + 1; - if ( myShape.ShapeType() == TopAbs_COMPOUND && - NumberOfSubShapes( myShape, TopAbs_COMPOUND ) > 0 ) { + if (myShape.ShapeType() == TopAbs_COMPOUND && + NumberOfSubShapes(myShape, TopAbs_COMPOUND) > 0) { type--; } return type; } +//================================================================================= +// function : showOnlySelected +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::showOnlySelected() +{ + if (CORBA::is_nil(myObject) || isAllSubShapes()) + return; + + QPushButton* send = (QPushButton*)sender(); + if (send == GroupPoints->PushButton4) { + activateSelection(); + return; + } + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + GEOM_Displayer* aDisplayer = getDisplayer(); + + if (send == GroupPoints->PushButton3) { + aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true); + } + else { + // Mantis issue 0021421: do not hide main shape, if explode on VERTEX + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if (view) { + CORBA::String_var aMainEntry = myObject->GetStudyEntry(); + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO"); + if (view->isVisible(io)) myIsHiddenMain = true; + } + + aDisplayer->EraseAll(/*forced = false, updateViewer = true*/); + aDisplayer->Display(aSelList, true); + + // Mantis issue 0021421: do not hide main shape, if explode on VERTEX + if ((TopAbs_ShapeEnum)shapeType() == TopAbs_VERTEX && myIsHiddenMain) { + aDisplayer->Display(myObject); + } + } +} + +//================================================================================= +// function : getSelectedSubshapes +// purpose : +//================================================================================= +int EntityGUI_SubShapeDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex) +{ + theMapIndex.Clear(); + + SalomeApp_Application* app = myGeomGUI->getApp(); + if (!app || myObject->_is_nil()) + return 0; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + // try to find out and process the global selection + // (of not published objects and of published sub-shapes) + { + SALOME_ListIteratorOfListIO anIter (aSelList); + for (int i = 0; anIter.More(); anIter.Next(), i++) + { + Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); + QString anEntry = anIObj->getEntry(); + QString str = "_"; + int index = anEntry.lastIndexOf(str); + if (index > 0) // selection among special preview + { + anEntry.remove(0, index+1); + int anIndex = anEntry.toInt(); + if (anIndex) + theMapIndex.Add(anIndex); + } + else // selection among published shapes + { + SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); + if (!appStudy) return 0; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData())); + GEOM::GEOM_Object_var aGeomObj = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); + TopoDS_Shape aShape; + if (GEOMBase::GetShape(aGeomObj, aShape)) { + if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == (TopAbs_ShapeEnum)shapeType()) { + TopTools_IndexedMapOfShape aMainMap; + TopExp::MapShapes(myShape, aMainMap); + + TopExp_Explorer anExp (aShape, (TopAbs_ShapeEnum)shapeType()); + for (; anExp.More(); anExp.Next()) { + TopoDS_Shape aSubShape = anExp.Current(); + int anIndex = aMainMap.FindIndex(aSubShape); + if (anIndex >= 0) { + theMapIndex.Add(anIndex); + } + } + } + } + } + } // for aSelList + } + + return theMapIndex.Extent(); +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void EntityGUI_SubShapeDlg::activateSelection() +{ + bool isApply = ((QPushButton*)sender() == buttonApply()); + + if(!isApply) + erasePreview(false); + + // local selection + if (!myObject->_is_nil() && !isAllSubShapes()) + { + GEOM_Displayer* aDisplayer = getDisplayer(); + + // Mantis issue 0021421: do not hide main shape, if explode on VERTEX + if ((TopAbs_ShapeEnum)shapeType() == TopAbs_VERTEX) { + if (myIsHiddenMain) + aDisplayer->Display(myObject); + } + else { + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if (view) { + CORBA::String_var aMainEntry = myObject->GetStudyEntry(); + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO"); + if (view->isVisible(io)) { + aDisplayer->Erase(myObject, false, false); + myIsHiddenMain = true; + } + } + } + + if(!isApply) { + int prevDisplayMode = aDisplayer->SetDisplayMode(0); + + SUIT_ViewWindow* aViewWindow = 0; + SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); + if (activeStudy) + aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (aViewWindow == 0) return; + + SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); + if (aViewManager->getType() != OCCViewer_Viewer::Type() && + aViewManager->getType() != SVTK_Viewer::Type()) + return; + + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView == 0) return; + + //TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myObject); + + TopTools_IndexedMapOfShape aSubShapesMap; + TopExp::MapShapes(myShape, aSubShapesMap); + CORBA::String_var aMainEntry = myObject->GetStudyEntry(); + QString anEntryBase = aMainEntry.in(); + + TopExp_Explorer anExp (myShape, (TopAbs_ShapeEnum)shapeType()); + for (; anExp.More(); anExp.Next()) + { + TopoDS_Shape aSubShape = anExp.Current(); + int index = aSubShapesMap.FindIndex(aSubShape); + QString anEntry = anEntryBase + QString("_%1").arg(index); + + SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView); + if (aPrs) { + displayPreview(aPrs, true, false); // append, do not update + } + } + aDisplayer->UpdateViewer(); + aDisplayer->SetDisplayMode(prevDisplayMode); + } + } + + globalSelection(GEOM_ALLSHAPES); +} + //================================================================================= // function : createOperation // purpose : //================================================================================= GEOM::GEOM_IOperations_ptr EntityGUI_SubShapeDlg::createOperation() { - return getGeomEngine()->GetIShapesOperations( getStudyId() ); + return getGeomEngine()->GetIShapesOperations(getStudyId()); } //================================================================================= @@ -532,21 +767,12 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg) if (isAllSubShapes()) isOk = true; else { - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() == 1) { - Standard_Boolean testResult; - GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (testResult && !anObj->_is_nil()) { - TColStd_IndexedMapOfInteger aMapIndex; - aSelMgr->GetIndexes(aSelList.First(), aMapIndex); - isOk = aMapIndex.Extent() > 0; - if (!isOk) - msg += tr("NO_SUBSHAPES_SELECTED"); - } - } + TColStd_IndexedMapOfInteger aMapIndex; + int nbSel = getSelectedSubshapes(aMapIndex); + isOk = nbSel > 0; + + if (!isOk) + msg += tr("NO_SUBSHAPES_SELECTED"); } return isOk; @@ -558,54 +784,53 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg) //================================================================================= bool EntityGUI_SubShapeDlg::execute (ObjectList& objects) { - GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow(getOperation())-> - MakeExplode(myObject, shapeType(), true); - - if (!aList->length()) - return false; + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); - // Throw away sub-shapes not selected by user if not in preview mode - // and manual selection is active if (!isAllSubShapes()) { - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); + // manual selection + TColStd_IndexedMapOfInteger aMapIndex; + int nbSel = getSelectedSubshapes(aMapIndex); - if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + if (nbSel > 0) { + int i; - if (aResult && !anObj->_is_nil()) { - TColStd_IndexedMapOfInteger aMapIndex; - aSelMgr->GetIndexes(aSelList.First(), aMapIndex); + GEOM::ListOfLong_var anArray = new GEOM::ListOfLong; + anArray->length(nbSel); - GEOM::GEOM_ILocalOperations_var aLocOp = - getGeomEngine()->GetILocalOperations(getStudyId()); + for (i = 1; i <= nbSel; i++) + anArray[i - 1] = aMapIndex.FindKey(i); - for (int i = 0, n = aList->length(); i < n; i++) - if (aMapIndex.Contains(aLocOp->GetSubShapeIndex(myObject, aList[i]))) - objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); - } + GEOM::ListOfGO_var aList = anOper->MakeSubShapes(myObject, anArray); + int n = aList->length(); + for (i = 0; i < n; i++) + objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); } } - else + else { + GEOM::ListOfGO_var aList = anOper->ExtractSubShapes(myObject, shapeType(), true); + if (!aList->length()) + return false; for (int i = 0, n = aList->length(); i < n; i++) objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); - + } + return objects.size(); } //================================================================ // Function : getFather // Purpose : Get father object for object to be added in study -// ( called with addInStudy method ) +// (called with addInStudy method) //================================================================ -GEOM::GEOM_Object_ptr EntityGUI_SubShapeDlg::getFather( GEOM::GEOM_Object_ptr ) +GEOM::GEOM_Object_ptr EntityGUI_SubShapeDlg::getFather(GEOM::GEOM_Object_ptr) { return myObject; } +//================================================================ +// Function : getNewObjectName +// Purpose : +//================================================================ QString EntityGUI_SubShapeDlg::getNewObjectName() const { return QString::null; diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.h b/src/EntityGUI/EntityGUI_SubShapeDlg.h index 6dbd0cb8f..d9bf30a3f 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.h +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.h @@ -1,86 +1,96 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : EntityGUI_SubShapeDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #ifndef ENTITYGUI_SUBSHAPEDLG_H #define ENTITYGUI_SUBSHAPEDLG_H #include -class DlgRef_1Sel1Check1List; +#include + +class DlgRef_1Sel1List1Check3Btn; //================================================================================= // class : EntityGUI_SubShapeDlg // purpose : //================================================================================= class EntityGUI_SubShapeDlg : public GEOMBase_Skeleton -{ +{ Q_OBJECT public: - EntityGUI_SubShapeDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + EntityGUI_SubShapeDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0); ~EntityGUI_SubShapeDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); - virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr ); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); virtual QString getNewObjectName() const; + void closeEvent (QCloseEvent*); + private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void DeactivateActiveDialog(); void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void SubShapeToggled(); void ComboTextChanged(); + void showOnlySelected(); + private: void Init(); - void enterEvent( QEvent* ); + void enterEvent (QEvent*); void ResetStateOfDialog(); - unsigned int NumberOfSubShapes( const TopoDS_Shape&, - const int ) const; + unsigned int NumberOfSubShapes (const TopoDS_Shape&, + const int) const; + + void activateSelection(); + int getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex); void updateButtonState(); bool isAllSubShapes() const; int shapeType() const; -private: +private: TopoDS_Shape myShape; GEOM::GEOM_Object_var myObject; - - bool myWithShape; - - DlgRef_1Sel1Check1List* GroupPoints; - ObjectList myResult; + + bool myWithShape; + + bool myIsHiddenMain; + + DlgRef_1Sel1List1Check3Btn* GroupPoints; }; #endif // ENTITYGUI_SUBSHAPEDLG_H diff --git a/src/EntityGUI/EntityGUI_Widgets.cxx b/src/EntityGUI/EntityGUI_Widgets.cxx index 663d80d7e..ddaa42e3d 100644 --- a/src/EntityGUI/EntityGUI_Widgets.cxx +++ b/src/EntityGUI/EntityGUI_Widgets.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : EntityGUI_Widgets.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // @@ -39,6 +37,35 @@ EntityGUI_1Sel::~EntityGUI_1Sel() { } +////////////////////////////////////////// +// EntityGUI_2Sel1Check +////////////////////////////////////////// + +EntityGUI_2Sel1Check::EntityGUI_2Sel1Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +EntityGUI_2Sel1Check::~EntityGUI_2Sel1Check() +{ +} + + +////////////////////////////////////////// +// EntityGUI_1Sel1Spin1Check +////////////////////////////////////////// + +EntityGUI_1Sel1Spin1Check::EntityGUI_1Sel1Spin1Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +EntityGUI_1Sel1Spin1Check::~EntityGUI_1Sel1Spin1Check() +{ +} + ////////////////////////////////////////// // EntityGUI_1Spin ////////////////////////////////////////// @@ -81,6 +108,21 @@ EntityGUI_3Spin::~EntityGUI_3Spin() { } + +////////////////////////////////////////// +// EntityGUI_3Spin1Check +////////////////////////////////////////// + +EntityGUI_3Spin1Check::EntityGUI_3Spin1Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +EntityGUI_3Spin1Check::~EntityGUI_3Spin1Check() +{ +} + ////////////////////////////////////////// // EntityGUI_4Spin ////////////////////////////////////////// @@ -95,6 +137,21 @@ EntityGUI_4Spin::~EntityGUI_4Spin() { } + +////////////////////////////////////////// +// EntityGUI_4Spin1Check +////////////////////////////////////////// + +EntityGUI_4Spin1Check::EntityGUI_4Spin1Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +EntityGUI_4Spin1Check::~EntityGUI_4Spin1Check() +{ +} + ////////////////////////////////////////// // EntityGUI_Dir1 ////////////////////////////////////////// @@ -153,6 +210,34 @@ EntityGUI_Point::~EntityGUI_Point() { } +////////////////////////////////////////// +// EntityGUI_Angles +////////////////////////////////////////// + +EntityGUI_Angles::EntityGUI_Angles( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +EntityGUI_Angles::~EntityGUI_Angles() +{ +} + +////////////////////////////////////////// +// EntityGUI_Controls +////////////////////////////////////////// + +EntityGUI_Controls::EntityGUI_Controls( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +EntityGUI_Controls::~EntityGUI_Controls() +{ +} + ////////////////////////////////////////// // EntityGUI_Skeleton ////////////////////////////////////////// @@ -165,6 +250,7 @@ EntityGUI_Skeleton::EntityGUI_Skeleton( QWidget* parent, Qt::WindowFlags f ) ButtonGroup = new QButtonGroup( this ); ButtonGroup->addButton( RadioButton1, 0 ); ButtonGroup->addButton( RadioButton2, 1 ); + ButtonGroup->addButton( RadioButton3, 2 ); } EntityGUI_Skeleton::~EntityGUI_Skeleton() diff --git a/src/EntityGUI/EntityGUI_Widgets.h b/src/EntityGUI/EntityGUI_Widgets.h index 40cc20ed7..7e8f14e47 100644 --- a/src/EntityGUI/EntityGUI_Widgets.h +++ b/src/EntityGUI/EntityGUI_Widgets.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : EntityGUI_Widgets.h // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // @@ -41,6 +39,39 @@ public: ~EntityGUI_1Sel(); }; +////////////////////////////////////////// +// EntityGUI_2Sel1Check +////////////////////////////////////////// + +#include "ui_EntityGUI_2Sel1Check_QTD.h" + +class EntityGUI_2Sel1Check : public QWidget, + public Ui::EntityGUI_2Sel1Check_QTD +{ + Q_OBJECT + +public: + EntityGUI_2Sel1Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~EntityGUI_2Sel1Check(); +}; + + +////////////////////////////////////////// +// EntityGUI_1Sel1Spin1Check +////////////////////////////////////////// + +#include "ui_EntityGUI_1Sel1Spin1Check_QTD.h" + +class EntityGUI_1Sel1Spin1Check : public QWidget, + public Ui::EntityGUI_1Sel1Spin1Check_QTD +{ + Q_OBJECT + +public: + EntityGUI_1Sel1Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~EntityGUI_1Sel1Spin1Check(); +}; + ////////////////////////////////////////// // EntityGUI_1Spin ////////////////////////////////////////// @@ -105,6 +136,38 @@ public: ~EntityGUI_4Spin(); }; +////////////////////////////////////////// +// EntityGUI_3Spin1Check +////////////////////////////////////////// + +#include "ui_EntityGUI_3Spin1Check_QTD.h" + +class EntityGUI_3Spin1Check : public QWidget, + public Ui::EntityGUI_3Spin1Check_QTD +{ + Q_OBJECT + +public: + EntityGUI_3Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~EntityGUI_3Spin1Check(); +}; + +////////////////////////////////////////// +// EntityGUI_4Spin1Check +////////////////////////////////////////// + +#include "ui_EntityGUI_4Spin1Check_QTD.h" + +class EntityGUI_4Spin1Check : public QWidget, + public Ui::EntityGUI_4Spin1Check_QTD +{ + Q_OBJECT + +public: + EntityGUI_4Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~EntityGUI_4Spin1Check(); +}; + ////////////////////////////////////////// // EntityGUI_Dir1 ////////////////////////////////////////// @@ -159,6 +222,38 @@ public: QButtonGroup* ButtonGroup; }; +////////////////////////////////////////// +// EntityGUI_Angles +////////////////////////////////////////// + +#include "ui_EntityGUI_Angles_QTD.h" + +class EntityGUI_Angles : public QWidget, + public Ui::EntityGUI_Angles_QTD +{ + Q_OBJECT + +public: + EntityGUI_Angles( QWidget* = 0, Qt::WindowFlags = 0 ); + ~EntityGUI_Angles(); +}; + +////////////////////////////////////////// +// EntityGUI_Controls +////////////////////////////////////////// + +#include "ui_EntityGUI_Controls_QTD.h" + +class EntityGUI_Controls : public QWidget, + public Ui::EntityGUI_Controls_QTD +{ + Q_OBJECT + +public: + EntityGUI_Controls( QWidget* = 0, Qt::WindowFlags = 0 ); + ~EntityGUI_Controls(); +}; + ////////////////////////////////////////// // EntityGUI_Skeleton ////////////////////////////////////////// diff --git a/src/EntityGUI/Makefile.am b/src/EntityGUI/Makefile.am index f54555614..aece4f4a5 100644 --- a/src/EntityGUI/Makefile.am +++ b/src/EntityGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM ENTITYGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -26,6 +24,20 @@ # include $(top_srcdir)/adm_local/unix/make_common_starter.am +if WITH_OPENCV + FeatureDetectorDlg_Header = EntityGUI_FeatureDetectorDlg.h + FeatureDetectorDlg_Sources = EntityGUI_FeatureDetectorDlg.cxx + FeatureDetectorDlg_moc = EntityGUI_FeatureDetectorDlg_moc.cxx + Opencv_libs = $(OPENCV_LIBS) + Opencv_includes = $(OPENCV_INCLUDES) + ShapeRec_dir = $(srcdir)/../ShapeRecognition + ShapeRec_la = ../ShapeRecognition/libGEOMShapeRec.la +endif + +PictureImportDlg_Header = EntityGUI_PictureImportDlg.h +PictureImportDlg_Sources = EntityGUI_PictureImportDlg.cxx +PictureImportDlg_moc = EntityGUI_PictureImportDlg_moc.cxx + # Libraries targets lib_LTLIBRARIES = libEntityGUI.la @@ -35,34 +47,46 @@ salomeinclude_HEADERS = \ EntityGUI_Widgets.h \ EntityGUI_SketcherDlg.h \ EntityGUI_3DSketcherDlg.h \ - EntityGUI_SubShapeDlg.h + EntityGUI_SubShapeDlg.h \ + $(FeatureDetectorDlg_Header) \ + $(PictureImportDlg_Header) dist_libEntityGUI_la_SOURCES = \ EntityGUI.cxx \ EntityGUI_Widgets.cxx \ EntityGUI_SketcherDlg.cxx \ EntityGUI_3DSketcherDlg.cxx \ - EntityGUI_SubShapeDlg.cxx + EntityGUI_SubShapeDlg.cxx \ + $(FeatureDetectorDlg_Sources) \ + $(PictureImportDlg_Sources) MOC_FILES = \ EntityGUI_Widgets_moc.cxx \ EntityGUI_SketcherDlg_moc.cxx \ EntityGUI_3DSketcherDlg_moc.cxx \ - EntityGUI_SubShapeDlg_moc.cxx + EntityGUI_SubShapeDlg_moc.cxx \ + $(FeatureDetectorDlg_moc) \ + $(PictureImportDlg_moc) nodist_libEntityGUI_la_SOURCES = \ $(MOC_FILES) UIC_FILES = \ ui_EntityGUI_1Sel_QTD.h \ + ui_EntityGUI_2Sel1Check_QTD.h \ + ui_EntityGUI_1Sel1Spin1Check_QTD.h \ ui_EntityGUI_1Spin_QTD.h \ ui_EntityGUI_2Spin_QTD.h \ ui_EntityGUI_3Spin_QTD.h \ ui_EntityGUI_4Spin_QTD.h \ + ui_EntityGUI_3Spin1Check_QTD.h \ + ui_EntityGUI_4Spin1Check_QTD.h \ ui_EntityGUI_Dir1_QTD.h \ ui_EntityGUI_Dir2_QTD.h \ ui_EntityGUI_Point_QTD.h \ - ui_EntityGUI_Skeleton_QTD.h + ui_EntityGUI_Skeleton_QTD.h \ + ui_EntityGUI_Angles_QTD.h \ + ui_EntityGUI_Controls_QTD.h BUILT_SOURCES = $(UIC_FILES) @@ -78,6 +102,7 @@ libEntityGUI_la_CPPFLAGS = \ $(GUI_CXXFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ + $(Opencv_includes) \ -I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../DlgRef \ -I$(srcdir)/../GEOMBase \ @@ -86,15 +111,18 @@ libEntityGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(srcdir)/../SKETCHER \ + -I$(ShapeRec_dir) \ + -I$(srcdir)/../GEOM \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl + libEntityGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ ../GEOMBase/libGEOMBase.la \ ../SKETCHER/libGEOMSketcher.la \ ../GEOMGUI/libGEOM.la \ + $(ShapeRec_la) \ $(QT_MT_LIBS) \ - $(CAS_TKTopAlgo) -lTKernel - + $(CAS_TKTopAlgo) -lTKernel \ + $(Opencv_libs) diff --git a/src/GEOM/GEOM.pro b/src/GEOM/GEOM.pro deleted file mode 100644 index 5de328db0..000000000 --- a/src/GEOM/GEOM.pro +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMbasic -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$${CASROOT}/Linux/lib - -CAS_OCAF = -L$${CASROOT}/Linux/lib -lPTKernel -lTKernel -lTKCDF -lTKLCAF -lTKPCAF -lTKStdSchema - -CAS_OCAFVIS = -L$${CASROOT}/Linux/lib -lTKCAF -lStdPlugin -lStdLPlugin -lTKPLCAF -lTKPShape -lTKStdLSchema -lTKShapeSchema - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} $${BOOST_CPPFLAGS} ../../salome_adm/unix - -LIBS += $${KERNEL_LDFLAGS} -lSALOMELocalTrace $${STDLIB} $${CAS_LDPATH} -lTKXSBase $${CAS_OCAF} $${CAS_OCAFVIS} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = GEOM_Application.hxx -HEADERS += Handle_GEOM_Application.hxx -HEADERS += GEOM_Engine.hxx -HEADERS += GEOM_Function.hxx -HEADERS += GEOM_Object.hxx -HEADERS += GEOM_IOperations.hxx -HEADERS += GEOM_ISubShape.hxx -HEADERS += GEOM_Solver.hxx -HEADERS += GEOM_PythonDump.hxx -HEADERS += GEOM_DataMapOfAsciiStringTransient.hxx -HEADERS += Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx - -SOURCES = GEOM_Application.cxx -SOURCES += GEOM_Engine.cxx -SOURCES += GEOM_Function.cxx -SOURCES += GEOM_Object.cxx -SOURCES += GEOM_IOperations.cxx -SOURCES += GEOM_Solver.cxx -SOURCES += GEOM_SubShapeDriver.cxx -SOURCES += GEOM_PythonDump.cxx -SOURCES += GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx -SOURCES += GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx -SOURCES += GEOM_DataMapOfAsciiStringTransient_0.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOM/GEOM_Application.cxx b/src/GEOM/GEOM_Application.cxx index 4de898cb4..ab56603f6 100644 --- a/src/GEOM/GEOM_Application.cxx +++ b/src/GEOM/GEOM_Application.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include diff --git a/src/GEOM/GEOM_Application.hxx b/src/GEOM/GEOM_Application.hxx index 119f84d95..079d9dca3 100644 --- a/src/GEOM/GEOM_Application.hxx +++ b/src/GEOM/GEOM_Application.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_Application.hxx // Module : GEOM // diff --git a/src/GEOM/GEOM_Application.ixx b/src/GEOM/GEOM_Application.ixx index 8a2c33ff7..4e27bad7c 100644 --- a/src/GEOM/GEOM_Application.ixx +++ b/src/GEOM/GEOM_Application.ixx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_Application.ixx // Module : GEOM // @@ -47,10 +48,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Application_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOM_Application", - sizeof(GEOM_Application), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOM_Application), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOM/GEOM_Application.jxx b/src/GEOM/GEOM_Application.jxx index 87ed25a97..30bce69d1 100644 --- a/src/GEOM/GEOM_Application.jxx +++ b/src/GEOM/GEOM_Application.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_Application.jxx // Module : GEOM // diff --git a/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx index 1d590cd26..963dd1bd0 100644 --- a/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx +++ b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_HeaderFile #define _GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_HeaderFile diff --git a/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx index 9bc173990..31390b070 100644 --- a/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx +++ b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #ifndef _Standard_NoSuchObject_HeaderFile diff --git a/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx index f63d23b3b..011dc9fbc 100644 --- a/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx +++ b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile #define _GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile @@ -77,7 +78,7 @@ Standard_EXPORT ~GEOM_DataMapNodeOfDataMapOfAsciiStringTransient(); // Standard_EXPORT friend Handle_Standard_Type& GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_(); Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; protected: diff --git a/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx index 7dbb47f54..ecd72b16f 100644 --- a/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx +++ b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #ifndef _Standard_TypeMismatch_HeaderFile @@ -54,10 +55,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_DataMapNodeOfDataMapOfAsciiStringTran static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOM_DataMapNodeOfDataMapOfAsciiStringTransient", - sizeof(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx b/src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx index 1b4a70d4c..c2a3e3ce3 100644 --- a/src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx +++ b/src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_DataMapOfAsciiStringTransient_HeaderFile #define _GEOM_DataMapOfAsciiStringTransient_HeaderFile @@ -37,6 +38,7 @@ #ifndef _Standard_Boolean_HeaderFile #include #endif + class Standard_DomainError; class Standard_NoSuchObject; class TCollection_AsciiString; @@ -44,7 +46,6 @@ class Standard_Transient; class GEOM_DataMapNodeOfDataMapOfAsciiStringTransient; class GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient; - #ifndef _Standard_HeaderFile #include #endif @@ -52,6 +53,8 @@ class GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient; #include #endif +#include + class GEOM_DataMapOfAsciiStringTransient : public TCollection_BasicMap { public: @@ -68,6 +71,7 @@ public: { if (anAddress) Standard::Free((Standard_Address&)anAddress); } + // Methods PUBLIC // Standard_EXPORT GEOM_DataMapOfAsciiStringTransient(const Standard_Integer NbBuckets = 1); @@ -99,40 +103,18 @@ Standard_EXPORT Handle_Standard_Transient& ChangeFind(const TCollection_AsciiS return ChangeFind(K); } - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + Standard_EXPORT Standard_Address Find1 (const TCollection_AsciiString& K) const; + Standard_EXPORT Standard_Address ChangeFind1 (const TCollection_AsciiString& K); +#endif private: - // Methods PRIVATE // Standard_EXPORT GEOM_DataMapOfAsciiStringTransient(const GEOM_DataMapOfAsciiStringTransient& Other); - - - // Fields PRIVATE - // - - }; - - - - // other Inline functions and methods (like "C++: function call" methods) // - #endif diff --git a/src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx b/src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx index 4245895b5..d83dfa587 100644 --- a/src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx +++ b/src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #ifndef _Standard_DomainError_HeaderFile diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 67658d480..6efcaf7e0 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifdef WNT #pragma warning( disable:4786 ) #endif @@ -32,8 +33,12 @@ #include "GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx" #include "GEOM_PythonDump.hxx" +#include + #include "utilities.h" +#include + #include #include #include @@ -42,6 +47,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -52,13 +61,17 @@ #include #include +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#include +#else +#include #include +#endif + #include #include -#include -#include -#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -76,9 +89,12 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +typedef std::map< TCollection_AsciiString, TCollection_AsciiString > TSting2StringMap; +typedef std::map< TCollection_AsciiString, TObjectData > TSting2ObjDataMap; +typedef std::map< TCollection_AsciiString, TObjectData* > TSting2ObjDataPtrMap; + static GEOM_Engine* TheEngine = NULL; -using namespace std; static TCollection_AsciiString BuildIDFromObject(Handle(GEOM_Object)& theObject) { @@ -102,19 +118,84 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID) return aDocID.IntegerValue(); } -void ProcessFunction(Handle(GEOM_Function)& theFunction, - TCollection_AsciiString& theScript, - const TVariablesList& theVariables, - TDF_LabelMap& theProcessed, - std::set& theDumpedObjs); +bool ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TCollection_AsciiString& theAfterScript, + const TVariablesList& theVariables, + const bool theIsPublished, + TDF_LabelMap& theProcessed, + std::set& theIgnoreObjs, + bool& theIsDumpCollected); -void ReplaceVariables(TCollection_AsciiString& theCommand, +void ReplaceVariables(TCollection_AsciiString& theCommand, const TVariablesList& theVariables); +Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString); +void ReplaceEntriesByNames (TCollection_AsciiString& theScript, + TSting2ObjDataMap& aEntry2ObjData, + const bool theIsPublished, + TColStd_SequenceOfAsciiString& theObjListToPublish, + Standard_Integer& objectCounter, + Resource_DataMapOfAsciiStringAsciiString& aNameToEntry); -Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString); +void AddObjectColors (int theDocID, + TCollection_AsciiString& theScript, + const TSting2ObjDataMap& theEntry2ObjData); +void AddTextures (int theDocID, TCollection_AsciiString& theScript); + +void PublishObject (TObjectData& theObjectData, + TSting2ObjDataMap& theEntry2ObjData, + const TSting2ObjDataPtrMap& theStEntry2ObjDataPtr, + Resource_DataMapOfAsciiStringAsciiString& theNameToEntry, + std::map< int, TCollection_AsciiString >& theEntryToCmdMap, + std::set& theMapOfPublished); + +namespace +{ + //================================================================================ + /*! + * \brief Fix up the name of python variable + */ + //================================================================================ + + void healPyName( TCollection_AsciiString& pyName, + const TCollection_AsciiString& anEntry, + Resource_DataMapOfAsciiStringAsciiString& aNameToEntry) + { + const TCollection_AsciiString allowedChars + ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_"); + + if ( pyName.IsIntegerValue() ) { // pyName must not start with a digit + pyName.Insert( 1, 'a' ); + } + int p, p2=1; // replace not allowed chars + while ((p = pyName.FirstLocationNotInSet(allowedChars, p2, pyName.Length()))) { + pyName.SetValue(p, '_'); + p2=p; + } + if ( aNameToEntry.IsBound( pyName ) && anEntry != aNameToEntry( pyName )) + { // diff objects have same name - make a new name by appending a digit + TCollection_AsciiString aName2; + Standard_Integer i = 0; + do { + aName2 = pyName + "_" + ++i; + } while ( aNameToEntry.IsBound( aName2 ) && anEntry != aNameToEntry( aName2 )); + pyName = aName2; + } + } +} + +//======================================================================= +//function : GetTextureGUID +//purpose : +//======================================================================= +const Standard_GUID& GEOM_Engine::GetTextureGUID() +{ + static Standard_GUID anID("FF1BBB01-5D14-4df2-980B-3A668264EA17"); + return anID; +} //============================================================================= /*! @@ -138,7 +219,7 @@ void GEOM_Engine::SetEngine(GEOM_Engine* theEngine) { TheEngine = theEngine; } GEOM_Engine::GEOM_Engine() { TFunction_DriverTable::Get()->AddDriver(GEOM_Object::GetSubShapeID(), new GEOM_SubShapeDriver()); - + _OCAFApp = new GEOM_Application(); _UndoLimit = 10; } @@ -149,15 +230,24 @@ GEOM_Engine::GEOM_Engine() GEOM_Engine::~GEOM_Engine() { GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It(_objects); + std::list< Handle(GEOM_Object) > objs; for(; It.More(); It.Next()) - { - RemoveObject(Handle(GEOM_Object)::DownCast(It.Value())); - } + objs.push_back( Handle(GEOM_Object)::DownCast(It.Value()) ); + std::list< Handle(GEOM_Object) >::iterator objit; + for(objit = objs.begin(); objit != objs.end(); ++objit) + RemoveObject(*objit); //Close all documents not closed - for(Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr(_mapIDDocument); anItr.More(); anItr.Next()) +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + TColStd_DataMapIteratorOfDataMapOfIntegerTransient anItr (_mapIDDocument); +#else + Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr (_mapIDDocument); +#endif + for (; anItr.More(); anItr.Next()) + { Close(anItr.Key()); - + anItr.Initialize( _mapIDDocument ); // anItr becomes invalid at _mapIDDocument.UnBind(docId) + } _mapIDDocument.Clear(); _objects.Clear(); } @@ -167,17 +257,19 @@ GEOM_Engine::~GEOM_Engine() * GetDocument */ //============================================================================= -Handle(TDocStd_Document) GEOM_Engine::GetDocument(int theDocID) +Handle(TDocStd_Document) GEOM_Engine::GetDocument(int theDocID, bool force) { Handle(TDocStd_Document) aDoc; - if(!_mapIDDocument.IsBound(theDocID)) { + if(_mapIDDocument.IsBound(theDocID)) { + aDoc = Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID)); + } + else if (force) { _OCAFApp->NewDocument("SALOME_GEOM", aDoc); aDoc->SetUndoLimit(_UndoLimit); _mapIDDocument.Bind(theDocID, aDoc); TDataStd_Integer::Set(aDoc->Main(), theDocID); } - - return Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID)); + return aDoc; } //============================================================================= @@ -187,12 +279,16 @@ Handle(TDocStd_Document) GEOM_Engine::GetDocument(int theDocID) //============================================================================= int GEOM_Engine::GetDocID(Handle(TDocStd_Document) theDocument) { - if(theDocument.IsNull()) return -1; - for(Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr(_mapIDDocument); anItr.More(); anItr.Next()) - if(anItr.Value() == theDocument) return anItr.Key(); + if (theDocument.IsNull()) return -1; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + TColStd_DataMapIteratorOfDataMapOfIntegerTransient anItr (_mapIDDocument); +#else + Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr (_mapIDDocument); +#endif + for (; anItr.More(); anItr.Next()) + if (anItr.Value() == theDocument) return anItr.Key(); return -1; - } //============================================================================= @@ -200,17 +296,24 @@ int GEOM_Engine::GetDocID(Handle(TDocStd_Document) theDocument) * GetObject */ //============================================================================= -Handle(GEOM_Object) GEOM_Engine::GetObject(int theDocID, char* theEntry) +Handle(GEOM_Object) GEOM_Engine::GetObject(int theDocID, char* theEntry, bool force) { - TCollection_AsciiString anID = BuildID(theDocID, theEntry); - if(_objects.IsBound(anID)) return Handle(GEOM_Object)::DownCast(_objects(anID)); + Handle(GEOM_Object) anObject; - TDF_Label aLabel; - Handle(TDocStd_Document) aDoc = GetDocument(theDocID); - TDF_Tool::Label(aDoc->Main().Data(), theEntry, aLabel, Standard_True); - Handle(GEOM_Object) anObject = new GEOM_Object(aLabel); + TCollection_AsciiString anID = BuildID(theDocID, theEntry); - _objects.Bind(anID, anObject); + if (_objects.IsBound(anID)) { + anObject = Handle(GEOM_Object)::DownCast(_objects(anID)); + } + else if (force) { + Handle(TDocStd_Document) aDoc = GetDocument(theDocID, force); + if ( !aDoc.IsNull()) { + TDF_Label aLabel; + TDF_Tool::Label(aDoc->Main().Data(), theEntry, aLabel, Standard_True); + anObject = new GEOM_Object(aLabel); + _objects.Bind(anID, anObject); + } + } return anObject; } @@ -229,11 +332,12 @@ Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType) // if this label has been freed (object deleted) bool useExisting = false; TDF_Label aChild; - if (!_lastCleared.IsNull()) { - if (_lastCleared.Root() == aDoc->Main().Root()) { + if (_freeLabels.find(theDocID) != _freeLabels.end()) { + std::list& aFreeLabels = _freeLabels[theDocID]; + if (!aFreeLabels.empty()) { useExisting = true; - aChild = _lastCleared; - _lastCleared.Nullify(); + aChild = aFreeLabels.front(); + aFreeLabels.pop_front(); } } if (!useExisting) { @@ -260,7 +364,7 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices, bool isStandaloneOperation) { - if(theMainShape.IsNull() || theIndices.IsNull()) return NULL; + if (theMainShape.IsNull() || theIndices.IsNull()) return NULL; Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID()); Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); @@ -269,11 +373,13 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, // if this label has been freed (object deleted) bool useExisting = false; TDF_Label aChild; - if (!_lastCleared.IsNull()) { - if (_lastCleared.Root() == aDoc->Main().Root()) { + int aDocID = theMainShape->GetDocID(); + if (_freeLabels.find(aDocID) != _freeLabels.end()) { + std::list& aFreeLabels = _freeLabels[aDocID]; + if (!aFreeLabels.empty()) { useExisting = true; - aChild = _lastCleared; - _lastCleared.Nullify(); + aChild = aFreeLabels.front(); + aFreeLabels.pop_front(); } } if (!useExisting) { @@ -282,15 +388,15 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, } Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction(); - Handle(GEOM_Object) anObject = new GEOM_Object(aChild, 28); //28 is SUBSHAPE type + Handle(GEOM_Object) anObject = new GEOM_Object (aChild, 28); //28 is SUBSHAPE type Handle(GEOM_Function) aFunction = anObject->AddFunction(GEOM_Object::GetSubShapeID(), 1); - GEOM_ISubShape aSSI(aFunction); + GEOM_ISubShape aSSI (aFunction); aSSI.SetMainShape(aMainShape); aSSI.SetIndices(theIndices); try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif GEOM_Solver aSolver (GEOM_Engine::GetEngine()); @@ -305,11 +411,14 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, return NULL; } - //Put an object in the map of created objects + // Put an object in the map of created objects TCollection_AsciiString anID = BuildIDFromObject(anObject); - if(_objects.IsBound(anID)) _objects.UnBind(anID); + if (_objects.IsBound(anID)) _objects.UnBind(anID); _objects.Bind(anID, anObject); + // Put this sub-shape in the list of sub-shapes of theMainShape + aMainShape->AddSubShapeReference(aFunction); + GEOM::TPythonDump pd (aFunction); if (isStandaloneOperation) { @@ -333,15 +442,29 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, //============================================================================= bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) { - if (!theObject) return false; + if (theObject.IsNull()) return false; + + int aDocID = theObject->GetDocID(); + if(!_mapIDDocument.IsBound(aDocID)) + return false; // document is closed... //Remove an object from the map of available objects TCollection_AsciiString anID = BuildIDFromObject(theObject); if (_objects.IsBound(anID)) _objects.UnBind(anID); + // If sub-shape, remove it from the list of sub-shapes of its main shape + if (!theObject->IsMainShape()) { + Handle(GEOM_Function) aFunction = theObject->GetFunction(1); + GEOM_ISubShape aSSI (aFunction); + Handle(GEOM_Function) aMainShape = aSSI.GetMainShape(); + //If main shape is not null, then remove + if(!aMainShape.IsNull()) + aMainShape->RemoveSubShapeReference(aFunction); + } + int nb = theObject->GetNbFunctions(); Handle(TDataStd_TreeNode) aNode; - for (int i = 1; i<=nb; i++) { + for (int i = 1; i <= nb; i++) { Handle(GEOM_Function) aFunction = theObject->GetFunction(i); if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode)) aNode->Remove(); @@ -349,7 +472,10 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) TDF_Label aLabel = theObject->GetEntry(); aLabel.ForgetAllAttributes(Standard_True); - _lastCleared = aLabel; + + // Remember the label to reuse it then + std::list& aFreeLabels = _freeLabels[aDocID]; + aFreeLabels.push_back(aLabel); theObject.Nullify(); @@ -399,7 +525,11 @@ bool GEOM_Engine::Save(int theDocID, char* theFileName) bool GEOM_Engine::Load(int theDocID, char* theFileName) { Handle(TDocStd_Document) aDoc; - if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) { +#if OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher + if (_OCAFApp->Open(theFileName, aDoc) != PCDM_RS_OK) { +#else + if (_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) { +#endif return false; } @@ -433,7 +563,11 @@ void GEOM_Engine::Close(int theDocID) } for (Standard_Integer i=1; i<=aSeq.Length(); i++) _objects.UnBind(aSeq.Value(i)); - _lastCleared.Nullify(); + // Forget free labels for this document + TFreeLabelsList::iterator anIt = _freeLabels.find(theDocID); + if (anIt != _freeLabels.end()) { + _freeLabels.erase(anIt); + } _mapIDDocument.UnBind(theDocID); _OCAFApp->Close(aDoc); @@ -447,227 +581,223 @@ void GEOM_Engine::Close(int theDocID) */ //============================================================================= TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, - Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + std::vector& theObjectData, TVariablesList theVariables, bool isPublished, + bool isMultiFile, bool& aValidScript) { + // Set "C" numeric locale to save numbers correctly + Kernel_Utils::Localizer loc; + TCollection_AsciiString aScript; Handle(TDocStd_Document) aDoc = GetDocument(theDocID); - if (aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n"); + if (aDoc.IsNull()) + { + TCollection_AsciiString anEmptyScript; + if( isMultiFile ) + anEmptyScript = "def RebuildData(theStudy): pass\n"; + return anEmptyScript; + } - aScript = "import geompy\n"; + aScript = "import GEOM\n"; + aScript += "import geompy\n"; aScript += "import math\n"; aScript += "import SALOMEDS\n\n"; - aScript += "def RebuildData(theStudy):"; - aScript += "\n\tgeompy.init_geom(theStudy)"; + if( isMultiFile ) + aScript += "def RebuildData(theStudy):"; - Standard_Integer posToInsertGlobalVars = aScript.Length() + 1; + aScript += "\n\tgeompy.init_geom(theStudy)\n"; - Handle(TDataStd_TreeNode) aNode, aRoot; - Handle(GEOM_Function) aFunction; - TDF_LabelMap aCheckedFuncMap; - std::set anIgnoreObjMap; + AddTextures(theDocID, aScript); - if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) { - TDataStd_ChildNodeIterator Itr(aRoot); - for (; Itr.More(); Itr.Next()) { - aNode = Itr.Value(); - aFunction = GEOM_Function::GetFunction(aNode->Label()); - if (aFunction.IsNull()) { - MESSAGE ( "Null function !!!!" ); - continue; - } - ProcessFunction(aFunction, aScript, theVariables, aCheckedFuncMap, anIgnoreObjMap); - } - } + Standard_Integer posToInsertGlobalVars = aScript.Length() + 1; + + // a map containing copies of TObjectData from theObjectData + TSting2ObjDataMap aEntry2ObjData; + // contains pointers to TObjectData of either aEntry2ObjData or theObjectData; the latter + // occures when several StudyEntries correspond to one Entry + TSting2ObjDataPtrMap aStEntry2ObjDataPtr; - Resource_DataMapOfAsciiStringAsciiString aEntry2StEntry, aStEntry2Entry; - Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString anEntryToNameIt; - // build maps entry <-> studyEntry - for (anEntryToNameIt.Initialize( theObjectNames ); - anEntryToNameIt.More(); - anEntryToNameIt.Next()) + //Resource_DataMapOfAsciiStringAsciiString aEntry2StEntry, aStEntry2Entry, theObjectNames; + for (unsigned i = 0; i < theObjectData.size(); ++i ) { - const TCollection_AsciiString& aEntry = anEntryToNameIt.Key(); + TObjectData& data = theObjectData[i]; // look for an object by entry TDF_Label L; - TDF_Tool::Label( aDoc->GetData(), aEntry, L ); + TDF_Tool::Label( aDoc->GetData(), data._entry, L ); if ( L.IsNull() ) continue; Handle(GEOM_Object) obj = GEOM_Object::GetObject( L ); // fill maps if ( !obj.IsNull() ) { - TCollection_AsciiString aStudyEntry (obj->GetAuxData()); - aEntry2StEntry.Bind( aEntry, aStudyEntry); - aStEntry2Entry.Bind( aStudyEntry, aEntry ); + TSting2ObjDataMap::iterator ent2Data = + aEntry2ObjData.insert( std::make_pair( data._entry, data )).first; + + if ( ent2Data->second._studyEntry == data._studyEntry ) // Entry encounters 1st time + aStEntry2ObjDataPtr.insert( std::make_pair( data._studyEntry, & ent2Data->second )); + else + aStEntry2ObjDataPtr.insert( std::make_pair( data._studyEntry, & data )); } } - Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript); - Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = aScript.Length(); - Resource_DataMapOfAsciiStringAsciiString aNameToEntry, anEntryToBadName; + // collect objects entries to be published + TColStd_SequenceOfAsciiString aObjListToPublish; - //Replace entries by the names - TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"), - allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_"); - if (aLen == 0) anUpdatedScript = aScript; + // iterates on functions till critical (that requiers publication of objects) + Handle(TDataStd_TreeNode) aNode, aRoot; + Handle(GEOM_Function) aFunction; + TDF_LabelMap aCheckedFuncMap; + std::set< TCollection_AsciiString > anIgnoreObjMap; - for (Standard_Integer i = 1; i <= aLen; i+=2) { - anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1); - anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1)); - if (theObjectNames.IsBound(anEntry)) { - aName = theObjectNames.Find(anEntry); - // check validity of aName - bool isValidName = true; - if ( aName.IsIntegerValue() ) { // aName must not start with a digit - aName.Insert( 1, 'a' ); - isValidName = false; - } - int p, p2=1; // replace not allowed chars - while ((p = aName.FirstLocationNotInSet(allowedChars, p2, aName.Length()))) { - aName.SetValue(p, '_'); - p2=p; - isValidName = false; + TCollection_AsciiString aFuncScript; + + // Mantis issue 0020768 + Standard_Integer objectCounter = 0; + Resource_DataMapOfAsciiStringAsciiString aNameToEntry; + + if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) { + TDataStd_ChildNodeIterator Itr(aRoot); + for (; Itr.More(); Itr.Next()) { + aNode = Itr.Value(); + aFunction = GEOM_Function::GetFunction(aNode->Label()); + if (aFunction.IsNull()) { + MESSAGE ( "Null function !!!!" ); + continue; } - if ( aNameToEntry.IsBound( aName ) && anEntry != aNameToEntry( aName )) - { // diff objects have same name - make a new name by appending a digit - TCollection_AsciiString aName2; - Standard_Integer i = 0; - do { - aName2 = aName + "_" + ++i; - } while ( aNameToEntry.IsBound( aName2 ) && anEntry != aNameToEntry( aName2 )); - aName = aName2; - isValidName = false; + bool isDumpCollected = false; + TCollection_AsciiString aCurScript, anAfterScript; + if (!ProcessFunction(aFunction, aCurScript, anAfterScript, theVariables, + isPublished, aCheckedFuncMap, anIgnoreObjMap, + isDumpCollected )) + continue; + // add function description before dump + if (!aCurScript.IsEmpty()) + { + if ( aFunction->GetDriverGUID() == GEOM_Object::GetSubShapeID() ) + // avoid repeated SubShape...() command at the end + if (aFuncScript.Location( aCurScript, + aFuncScript.Length() - aCurScript.Length(), + aFuncScript.Length())) + continue; + aFuncScript += aCurScript; } - if ( !isValidName ) { - if ( isPublished ) - anEntryToBadName.Bind( anEntry, theObjectNames.Find(anEntry) ); - theObjectNames( anEntry ) = aName; + if (isDumpCollected ) { + // Replace entries by the names + ReplaceEntriesByNames( aFuncScript, aEntry2ObjData, isPublished, + aObjListToPublish, objectCounter, aNameToEntry ); + + // publish collected objects + std::map< int, TCollection_AsciiString > anEntryToCmdMap; // sort publishing commands by study entry + int i = 1, n = aObjListToPublish.Length(); + for ( ; i <= n; i++ ) + { + const TCollection_AsciiString& aEntry = aObjListToPublish.Value(i); + PublishObject( aEntry2ObjData[aEntry], aEntry2ObjData, aStEntry2ObjDataPtr, + aNameToEntry, anEntryToCmdMap, anIgnoreObjMap ); + } + // add publishing commands to the script + std::map< int, TCollection_AsciiString >::iterator anEntryToCmd = anEntryToCmdMap.begin(); + for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd ) + aFuncScript += anEntryToCmd->second; + + // PTv, 0020001 add result objects from RestoreGivenSubShapes into ignore list, + // because they will be published during command execution + int indx = anAfterScript.Search( "RestoreGivenSubShapes" ); + if ( indx == -1 ) + indx = anAfterScript.Search( "RestoreSubShapes" ); + if ( indx != -1 ) { + TCollection_AsciiString aSubStr = anAfterScript.SubString(1, indx); + Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aSubStr); + i = 1, n = aSeq->Length(); + for ( ; i <= n; i+=2) { + TCollection_AsciiString anEntry = + aSubStr.SubString(aSeq->Value(i), aSeq->Value(i+1)); + anIgnoreObjMap.insert(anEntry.ToCString()); + } + } + + aObjListToPublish.Clear(); + aScript += aFuncScript; + aFuncScript.Clear(); } + aFuncScript += anAfterScript; } - else { - do { - aName = aBaseName + TCollection_AsciiString(++objectCounter); - } while(aNameToEntry.IsBound(aName)); - theObjectNames.Bind(anEntry, aName); - } - aNameToEntry.Bind(aName, anEntry); // to detect same name of diff objects - - anUpdatedScript += aName; - aStart = aSeq->Value(i+1) + 1; } - //Add final part of the script - if (aLen && aSeq->Value(aLen) < aScriptLength) - anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865 - - // ouv : NPAL12872 - for (anEntryToNameIt.Initialize( theObjectNames ); - anEntryToNameIt.More(); - anEntryToNameIt.Next()) - { - const TCollection_AsciiString& aEntry = anEntryToNameIt.Key(); - const TCollection_AsciiString& aName = anEntryToNameIt.Value(); + // Replace entries by the names + aObjListToPublish.Clear(); + ReplaceEntriesByNames( aFuncScript, aEntry2ObjData, isPublished, aObjListToPublish, + objectCounter, aNameToEntry ); - TDF_Label L; - TDF_Tool::Label( aDoc->GetData(), aEntry, L ); - if ( L.IsNull() ) - continue; + aScript += aFuncScript; - Handle(GEOM_Object) obj = GEOM_Object::GetObject( L ); - if ( obj.IsNull() ) - continue; - - bool anAutoColor = obj->GetAutoColor(); - if ( anAutoColor ) - { - TCollection_AsciiString aCommand( "\n\t" ); - aCommand += aName + ".SetAutoColor(1)"; - anUpdatedScript += aCommand.ToCString(); - } - - SALOMEDS::Color aColor = obj->GetColor(); - if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) - { - TCollection_AsciiString aCommand( "\n\t" ); - aCommand += aName + ".SetColor(SALOMEDS.Color(" + aColor.R + "," + aColor.G + "," + aColor.B + "))"; - anUpdatedScript += aCommand.ToCString(); - } - } + // ouv : NPAL12872 + AddObjectColors( theDocID, aScript, aEntry2ObjData ); // Make script to publish in study + TSting2ObjDataPtrMap::iterator aStEntry2ObjDataPtrIt; if ( isPublished ) { - std::map< int, std::string > anEntryToCommandMap; // sort publishing commands by object entry - for (anEntryToNameIt.Initialize( theObjectNames ); - anEntryToNameIt.More(); - anEntryToNameIt.Next()) + std::map< int, TCollection_AsciiString > anEntryToCmdMap; // sort publishing commands by object entry + + for (aStEntry2ObjDataPtrIt = aStEntry2ObjDataPtr.begin(); + aStEntry2ObjDataPtrIt != aStEntry2ObjDataPtr.end(); + ++aStEntry2ObjDataPtrIt) { - const TCollection_AsciiString& aEntry = anEntryToNameIt.Key(); - const TCollection_AsciiString& aName = anEntryToNameIt.Value(); - if (anIgnoreObjMap.count(aEntry.ToCString())) + TObjectData* data = aStEntry2ObjDataPtrIt->second; + if ( anIgnoreObjMap.count( data->_entry )) continue; // should not be dumped - if ( !aEntry2StEntry.IsBound( aEntry )) - continue; // was not published - TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry; - - // find a father entry - const TCollection_AsciiString& aStudyEntry = aEntry2StEntry( aEntry ); - TCollection_AsciiString aFatherStudyEntry = - aStudyEntry.SubString( 1, aStudyEntry.SearchFromEnd(":") - 1 ); - if ( aStEntry2Entry.IsBound( aFatherStudyEntry )) - aFatherEntry = aStEntry2Entry( aFatherStudyEntry ); - - // make a command - if ( !aFatherEntry.IsEmpty() && theObjectNames.IsBound( aFatherEntry )) { - aCommand += "addToStudyInFather( "; - aCommand += theObjectNames( aFatherEntry ) + ", "; - } - else - aCommand += "addToStudy( "; - if ( anEntryToBadName.IsBound( aEntry )) - aCommand += aName + ", \"" + anEntryToBadName( aEntry ) + "\" )"; - else - aCommand += aName + ", \"" + aName + "\" )"; - - // bind a command to the last digit of the entry - int tag = - aEntry.SubString( aEntry.SearchFromEnd(":")+1, aEntry.Length() ).IntegerValue(); - anEntryToCommandMap.insert( std::make_pair( tag, aCommand.ToCString() )); + PublishObject( *data, aEntry2ObjData, aStEntry2ObjDataPtr, + aNameToEntry, anEntryToCmdMap, anIgnoreObjMap ); } - // add publishing commands to the script - std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin(); - for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand ) { - anUpdatedScript += (char*)anEntryToCommand->second.c_str(); - } + std::map< int, TCollection_AsciiString >::iterator anEntryToCmd = anEntryToCmdMap.begin(); + for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd ) + aScript += anEntryToCmd->second; } - //anUpdatedScript += "\n\tpass\n"; - anUpdatedScript += "\n"; + //RNV: issue 16219: EDF PAL 469: "RemoveFromStudy" Function + //Add unpublish command if need + TCollection_AsciiString unpublishCmd("\n"); + if(isMultiFile) + unpublishCmd += "\t"; + unpublishCmd += "geompy.hideInStudy("; + + for (aStEntry2ObjDataPtrIt = aStEntry2ObjDataPtr.begin(); + aStEntry2ObjDataPtrIt != aStEntry2ObjDataPtr.end(); + ++aStEntry2ObjDataPtrIt) + { + TObjectData* data = aStEntry2ObjDataPtrIt->second; + if ( data->_unpublished && !data->_pyName.IsEmpty() ) { + aScript += unpublishCmd + data->_pyName + ")"; + } + } + + //aScript += "\n\tpass\n"; + aScript += "\n"; aValidScript = true; // fill _studyEntry2NameMap and build globalVars TCollection_AsciiString globalVars; _studyEntry2NameMap.Clear(); - Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString aStEntryToEntryIt; - for (aStEntryToEntryIt.Initialize( aStEntry2Entry ); - aStEntryToEntryIt.More(); - aStEntryToEntryIt.Next() ) + for (aStEntry2ObjDataPtrIt = aStEntry2ObjDataPtr.begin(); + aStEntry2ObjDataPtrIt != aStEntry2ObjDataPtr.end(); + ++aStEntry2ObjDataPtrIt) { - const TCollection_AsciiString & name = theObjectNames( aStEntryToEntryIt.Value() ); - _studyEntry2NameMap.Bind (aStEntryToEntryIt.Key(), name ); + const TCollection_AsciiString& studyEntry = aStEntry2ObjDataPtrIt->first; + const TObjectData* data = aStEntry2ObjDataPtrIt->second; + _studyEntry2NameMap.Bind ( studyEntry, data->_pyName ); if ( !globalVars.IsEmpty() ) globalVars += ", "; - globalVars += name; + globalVars += data->_pyName; } - if ( !globalVars.IsEmpty() ) { + if ( isMultiFile && !globalVars.IsEmpty() ) { globalVars.Insert( 1, "\n\tglobal " ); - anUpdatedScript.Insert( posToInsertGlobalVars, globalVars ); + aScript.Insert( posToInsertGlobalVars, globalVars ); } - return anUpdatedScript; + return aScript; } //======================================================================= @@ -700,21 +830,152 @@ Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const return aRetSeq; } +#define TEXTURE_LABEL_ID 1 +#define TEXTURE_LABEL_FILE 2 +#define TEXTURE_LABEL_WIDTH 3 +#define TEXTURE_LABEL_HEIGHT 4 +#define TEXTURE_LABEL_DATA 5 + +int GEOM_Engine::addTexture(int theDocID, int theWidth, int theHeight, +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + const Handle(TColStd_HArray1OfByte)& theTexture, +#else + const Handle(TDataStd_HArray1OfByte)& theTexture, +#endif + const TCollection_AsciiString& theFileName) +{ + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); + + // NPAL18604: use existing label to decrease memory usage, + // if this label has been freed (object deleted) + bool useExisting = false; + TDF_Label aChild; + if (_freeLabels.find(theDocID) != _freeLabels.end()) { + std::list& aFreeLabels = _freeLabels[theDocID]; + if (!aFreeLabels.empty()) { + useExisting = true; + aChild = aFreeLabels.front(); + aFreeLabels.pop_front(); + } + } + if (!useExisting) { + // create new label + aChild = TDF_TagSource::NewChild(aDoc->Main()); + } + + aChild.ForgetAllAttributes(Standard_True); + Handle(TDataStd_TreeNode) node; + if ( !aChild.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), node ) ) + node = TDataStd_TreeNode::Set(aChild); + TDataStd_UAttribute::Set(aChild, GetTextureGUID()); + + static int aTextureID = 0; + + TDataStd_Integer::Set(aChild.FindChild(TEXTURE_LABEL_ID), ++aTextureID); + TDataStd_Comment::Set(aChild.FindChild(TEXTURE_LABEL_FILE), theFileName); + TDataStd_Integer::Set(aChild.FindChild(TEXTURE_LABEL_WIDTH), theWidth); + TDataStd_Integer::Set(aChild.FindChild(TEXTURE_LABEL_HEIGHT), theHeight); + + Handle(TDataStd_ByteArray) anAttr = + TDataStd_ByteArray::Set(aChild.FindChild(TEXTURE_LABEL_DATA), + theTexture.IsNull() ? 0 : theTexture->Lower(), + theTexture.IsNull() ? 0 : theTexture->Upper()); + anAttr->ChangeArray(theTexture); + + return aTextureID; +} + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +Handle(TColStd_HArray1OfByte) GEOM_Engine::getTexture(int theDocID, int theTextureID, +#else +Handle(TDataStd_HArray1OfByte) GEOM_Engine::getTexture(int theDocID, int theTextureID, +#endif + int& theWidth, int& theHeight, + TCollection_AsciiString& theFileName) +{ +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) anArray; +#else + Handle(TDataStd_HArray1OfByte) anArray; +#endif + theWidth = theHeight = 0; + + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + + TDF_ChildIterator anIterator(aDoc->Main(), Standard_True); + bool found = false; + for (; anIterator.More() && !found; anIterator.Next()) { + TDF_Label aTextureLabel = anIterator.Value(); + if (aTextureLabel.IsAttribute( GetTextureGUID())) { + TDF_Label anIDLabel = aTextureLabel.FindChild(TEXTURE_LABEL_ID, Standard_False); + Handle(TDataStd_Integer) anIdAttr; + if(!anIDLabel.IsNull() && anIDLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr) && + anIdAttr->Get() == theTextureID) { + TDF_Label aFileLabel = aTextureLabel.FindChild(TEXTURE_LABEL_FILE, Standard_False); + TDF_Label aWidthLabel = aTextureLabel.FindChild(TEXTURE_LABEL_WIDTH, Standard_False); + TDF_Label aHeightLabel = aTextureLabel.FindChild(TEXTURE_LABEL_HEIGHT, Standard_False); + TDF_Label aDataLabel = aTextureLabel.FindChild(TEXTURE_LABEL_DATA, Standard_False); + Handle(TDataStd_Integer) aWidthAttr, aHeightAttr; + Handle(TDataStd_ByteArray) aTextureAttr; + Handle(TDataStd_Comment) aFileAttr; + if (!aWidthLabel.IsNull() && aWidthLabel.FindAttribute(TDataStd_Integer::GetID(), aWidthAttr) && + !aHeightLabel.IsNull() && aHeightLabel.FindAttribute(TDataStd_Integer::GetID(), aHeightAttr) && + !aDataLabel.IsNull() && aDataLabel.FindAttribute(TDataStd_ByteArray::GetID(), aTextureAttr)) { + theWidth = aWidthAttr->Get(); + theHeight = aHeightAttr->Get(); + anArray = aTextureAttr->InternalArray(); + } + if (!aFileLabel.IsNull() && aFileLabel.FindAttribute(TDataStd_Comment::GetID(), aFileAttr)) + theFileName = aFileAttr->Get(); + found = true; + } + } + } + return anArray; +} + +std::list GEOM_Engine::getAllTextures(int theDocID) +{ + std::list id_list; + + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + + TDF_ChildIterator anIterator(aDoc->Main(), Standard_True); + for (; anIterator.More(); anIterator.Next()) { + TDF_Label aTextureLabel = anIterator.Value(); + if (aTextureLabel.IsAttribute( GetTextureGUID())) { + TDF_Label anIDLabel = aTextureLabel.FindChild(TEXTURE_LABEL_ID, Standard_False); + Handle(TDataStd_Integer) anIdAttr; + if(!anIDLabel.IsNull() && anIDLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr)) + id_list.push_back((int)anIdAttr->Get()); + } + } + return id_list; +} //=========================================================================== // Internal functions //=========================================================================== -void ProcessFunction(Handle(GEOM_Function)& theFunction, - TCollection_AsciiString& theScript, - const TVariablesList& theVariables, - TDF_LabelMap& theProcessed, - std::set& theIgnoreObjs) + +//============================================================================= +/*! + * ProcessFunction: Dump fucntion description into script + */ +//============================================================================= +bool ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TCollection_AsciiString& theAfterScript, + const TVariablesList& theVariables, + const bool theIsPublished, + TDF_LabelMap& theProcessed, + std::set& theIgnoreObjs, + bool& theIsDumpCollected) { - if (theFunction.IsNull()) return; + theIsDumpCollected = false; + if (theFunction.IsNull()) return false; - // not to process twice - if (theProcessed.Contains(theFunction->GetEntry())) return; - theProcessed.Add(theFunction->GetEntry()); + if (theProcessed.Contains(theFunction->GetEntry())) return false; // pass functions, that depends on nonexisting ones bool doNotProcess = false; @@ -750,20 +1011,49 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction, if (doNotProcess) { TCollection_AsciiString anObjEntry; TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry); - theIgnoreObjs.insert(anObjEntry.ToCString()); - return; + theIgnoreObjs.insert(anObjEntry); + return false; } + theProcessed.Add(theFunction->GetEntry()); TCollection_AsciiString aDescr = theFunction->GetDescription(); - if(aDescr.Length() == 0) return; + if(aDescr.Length() == 0) return false; //Check if its internal function which doesn't requires dumping - if(aDescr == "None") return; + if(aDescr == "None") return false; + + // 0020001 PTv, check for critical functions, which require dump of objects + if (theIsPublished) + { + // currently, there is only one function "RestoreGivenSubShapes", + // later this check could be replaced by iterations on list of such functions + if (aDescr.Search( "RestoreGivenSubShapes" ) != -1) + theIsDumpCollected = true; + else if (aDescr.Search( "RestoreSubShapes" ) != -1) + theIsDumpCollected = true; + } //Replace parameter by notebook variables ReplaceVariables(aDescr,theVariables); - theScript += "\n\t"; - theScript += aDescr; + if ( theIsDumpCollected ) { + int i = 1; + bool isBefore = true; + TCollection_AsciiString aSubStr = aDescr.Token("\n\t", i++); + while (!aSubStr.IsEmpty()) { + if (isBefore && + aSubStr.Search( "RestoreGivenSubShapes" ) == -1 && + aSubStr.Search( "RestoreSubShapes" ) == -1) + theScript += TCollection_AsciiString("\n\t") + aSubStr; + else + theAfterScript += TCollection_AsciiString("\n\t") + aSubStr; + aSubStr = aDescr.Token("\n\t", i++); + } + } + else { + theScript += "\n\t"; + theScript += aDescr; + } + return true; } //============================================================================= @@ -805,11 +1095,11 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin //============================================================================= /*! - * ReplaceVariables: Replace parameters of the function by variales from + * ReplaceVariables: Replace parameters of the function by variales from * Notebook if need */ //============================================================================= -void ReplaceVariables(TCollection_AsciiString& theCommand, +void ReplaceVariables(TCollection_AsciiString& theCommand, const TVariablesList& theVariables) { if (MYDEBUG) @@ -840,31 +1130,35 @@ void ReplaceVariables(TCollection_AsciiString& theCommand, if( aCommand.Search("=") != -1 ) // command returns an object anEntry = aCommand.Token("=",1); else { // command modifies the object - int aStartEntryPos = aCommand.Location(1,'(',1,aCommand.Length()); - int aEndEntryPos = aCommand.Location(1,',',aStartEntryPos,aCommand.Length()); - anEntry = aCommand.SubString(aStartEntryPos+1, aEndEntryPos-1); + if (int aStartEntryPos = aCommand.Location(1,'(',1,aCommand.Length())) + if (int aEndEntryPos = aCommand.Location(1,',',aStartEntryPos,aCommand.Length())) + anEntry = aCommand.SubString(aStartEntryPos+1, aEndEntryPos-1); } - //Remove white spaces anEntry.RightAdjust(); anEntry.LeftAdjust(); if(MYDEBUG) cout<<"Result entry : '" <= aVariables.size()) + Standard_Integer aNbSections = 1; + while( aVar.Location( aNbSections, ':', 1, aVar.Length() ) ) + aNbSections++; + aNbSections--; + + int aStartSectionPos = 0, aEndSectionPos = 0; + TCollection_AsciiString aSection, aReplacedSection; + for(Standard_Integer aSectionIndex = 1; aSectionIndex <= aNbSections; aSectionIndex++) { + aStartSectionPos = aVar.Location( aSectionIndex, ':', 1, aVar.Length() ) + 1; + if( aSectionIndex != aNbSections ) + aEndSectionPos = aVar.Location( aSectionIndex + 1, ':', 1, aVar.Length() ); + else + aEndSectionPos = aVar.Length(); + + aSection = aVar.SubString(aStartSectionPos, aEndSectionPos-1); + if(MYDEBUG) + cout<<"aSection: "<= aVariables.size()) + continue; + + aReplacedParameter = aVariables[iVar].myVariable; + if(aReplacedParameter.IsEmpty()) { + iVar++; + continue; + } + + if(aVariables[iVar].isVariable) { + aReplacedParameter.InsertBefore(1,"'"); + aReplacedParameter.InsertAfter(aReplacedParameter.Length(),"'"); + } + + if(MYDEBUG) + cout<<"aSection before : "<= aVariables.size()) - continue; + continue; aReplacedVar = aVariables[iVar].myVariable; if(aReplacedVar.IsEmpty()) { - iVar++; - continue; + iVar++; + continue; } if(aVariables[iVar].isVariable) { - aReplacedVar.InsertBefore(1,"\""); - aReplacedVar.InsertAfter(aReplacedVar.Length(),"\""); + aReplacedVar.InsertBefore(1,"\""); + aReplacedVar.InsertAfter(aReplacedVar.Length(),"\""); } aCommand.Remove(aStartPos, aEndPos - aStartPos); @@ -1052,6 +1354,279 @@ void ReplaceVariables(TCollection_AsciiString& theCommand, cout<<"Command : "<Length(), aStart = 1, aScriptLength = theScript.Length(); + + //Replace entries by the names + TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"), + allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_"); + if (aLen == 0) anUpdatedScript = theScript; + + for (Standard_Integer i = 1; i <= aLen; i+=2) { + anUpdatedScript += theScript.SubString(aStart, aSeq->Value(i)-1); + anEntry = theScript.SubString(aSeq->Value(i), aSeq->Value(i+1)); + theObjListToPublish.Append( anEntry ); + + TObjectData& data = aEntry2ObjData[ anEntry ]; + if ( data._pyName.IsEmpty() ) { // encounted for the 1st time + if ( !data._name.IsEmpty() ) { // published object + data._pyName = data._name; + healPyName( data._pyName, anEntry, aNameToEntry); + } + else { + do { + data._pyName = aBaseName + TCollection_AsciiString(++objectCounter); + } while(aNameToEntry.IsBound(data._pyName)); + } + } + + aNameToEntry.Bind(data._pyName, anEntry); // to detect same name of diff objects + + anUpdatedScript += data._pyName; + aStart = aSeq->Value(i+1) + 1; + } + + //Add final part of the script + if (aLen && aSeq->Value(aLen) < aScriptLength) + anUpdatedScript += theScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865 + + theScript = anUpdatedScript; +} + +//============================================================================= +/*! + * AddObjectColors: Add color to objects + */ +//============================================================================= +void AddObjectColors (int theDocID, + TCollection_AsciiString& theScript, + const TSting2ObjDataMap& theEntry2ObjData) +{ + GEOM_Engine* engine = GEOM_Engine::GetEngine(); + Handle(TDocStd_Document) aDoc = engine->GetDocument(theDocID); + + TSting2ObjDataMap::const_iterator anEntryToNameIt; + for (anEntryToNameIt = theEntry2ObjData.begin(); + anEntryToNameIt!= theEntry2ObjData.end(); + ++anEntryToNameIt) + { + const TCollection_AsciiString& aEntry = anEntryToNameIt->first; + const TCollection_AsciiString& aName = anEntryToNameIt->second._pyName; + + TDF_Label L; + TDF_Tool::Label( aDoc->GetData(), aEntry, L ); + if ( L.IsNull() ) + continue; + + Handle(GEOM_Object) obj = GEOM_Object::GetObject( L ); + if ( obj.IsNull() ) + continue; + + bool anAutoColor = obj->GetAutoColor(); + if ( anAutoColor ) + { + TCollection_AsciiString aCommand( "\n\t" ); + aCommand += aName + ".SetAutoColor(1)"; + theScript += aCommand.ToCString(); + } + + GEOM_Object::Color aColor = obj->GetColor(); + if ( aColor.R >= 0 && aColor.G >= 0 && aColor.B >= 0 ) + { + TCollection_AsciiString aCommand( "\n\t" ); + aCommand += aName + ".SetColor(SALOMEDS.Color(" + aColor.R + "," + aColor.G + "," + aColor.B + "))"; + theScript += aCommand.ToCString(); + } + + Aspect_TypeOfMarker aMarkerType = obj->GetMarkerType(); + if (aMarkerType >= Aspect_TOM_POINT && aMarkerType < Aspect_TOM_USERDEFINED) { + TCollection_AsciiString aCommand( "\n\t" ); + aCommand += aName + ".SetMarkerStd("; + switch (aMarkerType) { + case Aspect_TOM_POINT: aCommand += "GEOM.MT_POINT"; break; + case Aspect_TOM_PLUS: aCommand += "GEOM.MT_PLUS"; break; + case Aspect_TOM_STAR: aCommand += "GEOM.MT_STAR"; break; + case Aspect_TOM_O: aCommand += "GEOM.MT_O"; break; + case Aspect_TOM_X: aCommand += "GEOM.MT_X"; break; + case Aspect_TOM_O_POINT: aCommand += "GEOM.MT_O_POINT"; break; + case Aspect_TOM_O_PLUS: aCommand += "GEOM.MT_O_PLUS"; break; + case Aspect_TOM_O_STAR: aCommand += "GEOM.MT_O_STAR"; break; + case Aspect_TOM_O_X: aCommand += "GEOM.MT_O_X"; break; + case Aspect_TOM_BALL: aCommand += "GEOM.MT_BALL"; break; + case Aspect_TOM_RING1: aCommand += "GEOM.MT_RING1"; break; + case Aspect_TOM_RING2: aCommand += "GEOM.MT_RING2"; break; + case Aspect_TOM_RING3: aCommand += "GEOM.MT_RING3"; break; + default: aCommand += "GEOM.MT_NONE"; break; // just for completeness, should not get here + } + aCommand += ", "; + int aSize = (int)( obj->GetMarkerSize()/0.5 ) - 1; + switch (aSize) { + case 1: aCommand += "GEOM.MS_10"; break; + case 2: aCommand += "GEOM.MS_15"; break; + case 3: aCommand += "GEOM.MS_20"; break; + case 4: aCommand += "GEOM.MS_25"; break; + case 5: aCommand += "GEOM.MS_30"; break; + case 6: aCommand += "GEOM.MS_35"; break; + case 7: aCommand += "GEOM.MS_40"; break; + case 8: aCommand += "GEOM.MS_45"; break; + case 9: aCommand += "GEOM.MS_50"; break; + case 10: aCommand += "GEOM.MS_55"; break; + case 11: aCommand += "GEOM.MS_60"; break; + case 12: aCommand += "GEOM.MS_65"; break; + case 13: aCommand += "GEOM.MS_70"; break; + default: aCommand += "GEOM.MS_NONE"; break; + } + aCommand += ")"; + theScript += aCommand.ToCString(); + } + else if (aMarkerType == Aspect_TOM_USERDEFINED) { + int aMarkerTextureID = obj->GetMarkerTexture(); + if (aMarkerTextureID >= 0) { + TCollection_AsciiString aCommand( "\n\t" ); + aCommand += aName + ".SetMarkerTexture(texture_map["; + aCommand += aMarkerTextureID; + aCommand += "])"; + theScript += aCommand.ToCString(); + } + } + } +} + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +static TCollection_AsciiString pack_data (const Handle(TColStd_HArray1OfByte)& aData) +#else +static TCollection_AsciiString pack_data (const Handle(TDataStd_HArray1OfByte)& aData) +#endif +{ + TCollection_AsciiString stream; + if (!aData.IsNull()) { + for (Standard_Integer i = aData->Lower(); i <= aData->Upper(); i++) { + Standard_Byte byte = aData->Value(i); + TCollection_AsciiString strByte = ""; + for (int j = 0; j < 8; j++) + strByte.Prepend((byte & (1< allTextures = engine->getAllTextures(theDocID); + std::list::const_iterator it; + + if (allTextures.size() > 0) { + theScript += "\n\ttexture_map = {}\n"; + + for (it = allTextures.begin(); it != allTextures.end(); ++it) { + if (*it <= 0) continue; + Standard_Integer aWidth, aHeight; + TCollection_AsciiString aFileName; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture = +#else + Handle(TDataStd_HArray1OfByte) aTexture = +#endif + engine->getTexture(theDocID, *it, aWidth, aHeight, aFileName); + if (aWidth > 0 && aHeight > 0 && !aTexture.IsNull() && aTexture->Length() > 0 ) { + TCollection_AsciiString aCommand = "\n\t"; + aCommand += "texture_map["; aCommand += *it; aCommand += "] = "; + if (aFileName != "" ) { + aCommand += "geompy.LoadTexture(\""; + aCommand += aFileName.ToCString(); + aCommand += "\")"; + } + else { + aCommand += "geompy.AddTexture("; + aCommand += aWidth; aCommand += ", "; aCommand += aHeight; aCommand += ", \""; + aCommand += pack_data(aTexture); + aCommand += "\")"; + } + theScript += aCommand; + } + } + theScript += "\n"; + } +} + +//============================================================================= +/*! + * PublishObject: publish object in study script + */ +//============================================================================= +void PublishObject (TObjectData& theObjectData, + TSting2ObjDataMap& theEntry2ObjData, + const TSting2ObjDataPtrMap& theStEntry2ObjDataPtr, + Resource_DataMapOfAsciiStringAsciiString& theNameToEntry, + std::map< int, TCollection_AsciiString >& theEntryToCmdMap, + std::set< TCollection_AsciiString>& theIgnoreMap) +{ + if ( theObjectData._studyEntry.IsEmpty() ) + return; // was not published + if ( theIgnoreMap.count( theObjectData._entry ) ) + return; // not to publish + + TCollection_AsciiString aCommand("\n\tgeompy."); + + // find a father entry + TObjectData* aFatherData = 0; + TCollection_AsciiString aFatherStudyEntry = + theObjectData._studyEntry.SubString( 1, theObjectData._studyEntry.SearchFromEnd(":") - 1 ); + TSting2ObjDataPtrMap::const_iterator stEntry2DataPtr = + theStEntry2ObjDataPtr.find( aFatherStudyEntry ); + if ( stEntry2DataPtr != theStEntry2ObjDataPtr.end() ) + aFatherData = stEntry2DataPtr->second; + + const int geomObjDepth = 3; + + // treat multiply published object + if ( theObjectData._pyName.IsEmpty() ) + { + TObjectData& data0 = theEntry2ObjData[ theObjectData._entry ]; + if ( data0._pyName.IsEmpty() ) return; // something wrong + + theObjectData._pyName = theObjectData._name; + healPyName( theObjectData._pyName, theObjectData._entry, theNameToEntry); + + TCollection_AsciiString aCreationCommand("\n\t"); + aCreationCommand += theObjectData._pyName + " = " + data0._pyName; + + // store aCreationCommand before publishing commands + int tag = theObjectData._entry.Token( ":", geomObjDepth ).IntegerValue(); + theEntryToCmdMap.insert( std::make_pair( tag + 2*theEntry2ObjData.size(), aCreationCommand )); + } + + // make a command + if ( aFatherData && !aFatherData->_pyName.IsEmpty() ) { + aCommand += "addToStudyInFather( "; + aCommand += aFatherData->_pyName + ", "; + } + else { + aCommand += "addToStudy( "; + } + aCommand += theObjectData._pyName + ", '" + theObjectData._name + "' )"; + + // bind a command to the study entry + int tag = theObjectData._entry.Token( ":", geomObjDepth ).IntegerValue(); + theEntryToCmdMap.insert( std::make_pair( tag, aCommand )); + + theObjectData._studyEntry.Clear(); // not to publish any more +} + //================================================================================ /*! * \brief Constructor @@ -1086,7 +1661,7 @@ TState ObjectStates::GetCurrectState() const //================================================================================ /*! - * \brief Add new object state + * \brief Add new object state * \param theState - Object state (vector of notebook variable) */ //================================================================================ diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx index a9951b26c..4ae37dfec 100644 --- a/src/GEOM/GEOM_Engine.hxx +++ b/src/GEOM/GEOM_Engine.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_Engine_HXX_ #define _GEOM_Engine_HXX_ @@ -26,7 +27,14 @@ #include "GEOM_Object.hxx" #include "GEOM_DataMapOfAsciiStringTransient.hxx" -#include +#include + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif + #include #include #include @@ -34,7 +42,27 @@ #include #include +#include #include +#include + +/*! + * \brief Data of GEOM_Object + */ +struct TObjectData +{ + TCollection_AsciiString _entry; + TCollection_AsciiString _studyEntry; + TCollection_AsciiString _name; + TCollection_AsciiString _pyName; + bool _unpublished; +}; + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +class Handle_TColStd_HArray1OfByte; +#else +class Handle_TDataStd_HArray1OfByte; +#endif struct TVariable{ TCollection_AsciiString myVariable; @@ -51,13 +79,13 @@ typedef std::vector TAllStates; class ObjectStates { public: - ObjectStates(); + Standard_EXPORT ObjectStates(); ~ObjectStates(); TAllStates GetAllStates() const { return _states; } TState GetCurrectState() const; - void AddState(const TState &theState); + Standard_EXPORT void AddState(const TState &theState); void IncrementState(); private: @@ -67,6 +95,8 @@ private: typedef std::map TVariablesList; +typedef std::map > TFreeLabelsList; + class GEOM_Engine { public: @@ -77,7 +107,7 @@ class GEOM_Engine Standard_EXPORT static GEOM_Engine* GetEngine(); //Returns the OCAF document by its ID, if document doesn't exists it will be created - Standard_EXPORT Handle(TDocStd_Document) GetDocument(int theDocID); + Standard_EXPORT Handle(TDocStd_Document) GetDocument(int theDocID, bool force=true); //Returns the ID of the given OCAF document Standard_EXPORT int GetDocID(Handle(TDocStd_Document) theDocument); @@ -86,7 +116,7 @@ class GEOM_Engine Standard_EXPORT Handle(TDocStd_Application) GetApplication() { return _OCAFApp; } //Returns a pointer to GEOM_Object defined by a document and the entry - Standard_EXPORT Handle(GEOM_Object) GetObject(int theDocID, char* theEntry); + Standard_EXPORT Handle(GEOM_Object) GetObject(int theDocID, char* theEntry, bool force=true); //Adds a new object of the type theType in the OCAF document Standard_EXPORT Handle(GEOM_Object) AddObject(int theDocID, int theType); @@ -112,34 +142,59 @@ class GEOM_Engine //Applies an Redo to document with ID = theDocID Standard_EXPORT void Redo(int theDocID); - //Adds a new sub shape object of the MainShape object + //Adds a new sub-shape object of the MainShape object Standard_EXPORT Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, - Handle(TColStd_HArray1OfInteger) theIndices, - bool isStandaloneOperation = false); + Handle(TColStd_HArray1OfInteger) theIndices, + bool isStandaloneOperation = false); Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID, - Resource_DataMapOfAsciiStringAsciiString& theObjectNames, - TVariablesList theVariables, - bool isPublished, - bool& aValidScript); + std::vector& theObjectData, + TVariablesList theVariables, + bool isPublished, + bool isMultiFile, + bool& aValidScript); Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const; Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const; + Standard_EXPORT int addTexture(int theDocID, int theWidth, int theHeight, +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + const Handle(TColStd_HArray1OfByte)& theTexture, +#else + const Handle(TDataStd_HArray1OfByte)& theTexture, +#endif + const TCollection_AsciiString& theFileName = ""); + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Standard_EXPORT Handle(TColStd_HArray1OfByte) getTexture(int theDocID, int theTextureID, +#else + Standard_EXPORT Handle(TDataStd_HArray1OfByte) getTexture(int theDocID, int theTextureID, +#endif + int& theWidth, int& theHeight, + TCollection_AsciiString& theFileName); + + Standard_EXPORT std::list getAllTextures(int theDocID); + + static const Standard_GUID& GetTextureGUID(); + protected: Standard_EXPORT static void SetEngine(GEOM_Engine* theEngine); private: Handle(GEOM_Application) _OCAFApp; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + TColStd_DataMapOfIntegerTransient _mapIDDocument; +#else Interface_DataMapOfIntegerTransient _mapIDDocument; +#endif int _UndoLimit; GEOM_DataMapOfAsciiStringTransient _objects; Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap; - TDF_Label _lastCleared; + TFreeLabelsList _freeLabels; }; #endif diff --git a/src/GEOM/GEOM_Function.cxx b/src/GEOM/GEOM_Function.cxx index d10bd9daf..146863614 100644 --- a/src/GEOM/GEOM_Function.cxx +++ b/src/GEOM/GEOM_Function.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -26,6 +27,8 @@ #include #include +#include + #include "utilities.h" #include @@ -42,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -59,10 +63,21 @@ #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +// This modification was introduced in frame of Mantis issue 0021251. +// This line allows to keep shape orientation together with the shape itself. +// Otherwise orientation can be lost in some cases. +#define KEEP_ORIENTATION_0021251 + #define ARGUMENT_LABEL 1 #define RESULT_LABEL 2 #define DESCRIPTION_LABEL 3 #define HISTORY_LABEL 4 +#define SUBSHAPES_LABEL 5 // 0020756: GetGroups +#define NAMING_LABEL 6 // 0020750: Naming during STEP import + +#ifdef KEEP_ORIENTATION_0021251 +#define ORIENTATION_LABEL 7 // 0021251: TNaming_NamedShape doesn't store orientation +#endif #define ARGUMENTS _label.FindChild((ARGUMENT_LABEL)) #define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition)) @@ -122,6 +137,23 @@ GEOM_Function::GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& the aRoot->Append(aNode); } +//================================================================================ +/*! + * \brief Retuns true if this function is the last one in the study + */ +//================================================================================ + +bool GEOM_Function::IsLastFuntion() +{ + bool isLast = false; + + Handle(TDataStd_TreeNode) aNode; + if (_label.FindAttribute(GetFunctionTreeID(), aNode)) + isLast = !aNode->HasNext(); + + return isLast; +} + //============================================================================= /*! * GetOwner @@ -195,12 +227,12 @@ TopoDS_Shape GEOM_Function::GetValue() if (!isResult) { try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif GEOM_Solver aSolver(GEOM_Engine::GetEngine()); if (!aSolver.ComputeFunction(this)) { - MESSAGE("GEOM_Object::GetValue Error : Can't build a sub shape"); + MESSAGE("GEOM_Object::GetValue Error : Can't build a sub-shape"); return aShape; } } @@ -218,6 +250,15 @@ TopoDS_Shape GEOM_Function::GetValue() aShape = aNS->Get(); +#ifdef KEEP_ORIENTATION_0021251 + // 0021251: TNaming_NamedShape doesn't store orientation + TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL); + Handle(TDataStd_Integer) anInteger; + if (anOrientationLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) { + aShape.Orientation((TopAbs_Orientation)anInteger->Get()); + } +#endif + _isDone = true; return aShape; } @@ -231,10 +272,16 @@ void GEOM_Function::SetValue(TopoDS_Shape& theShape) { _isDone = false; TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL); - TNaming_Builder aBuilder(aResultLabel); + TNaming_Builder aBuilder (aResultLabel); aBuilder.Generated(theShape); +#ifdef KEEP_ORIENTATION_0021251 + // 0021251: TNaming_NamedShape doesn't store orientation + TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL); + TDataStd_Integer::Set(anOrientationLabel, (int)theShape.Orientation()); +#endif + // synchronisation between main shape and its sub-shapes TDF_Label aLabel = GetOwnerEntry(); if (aLabel.IsRoot()) return; @@ -470,8 +517,8 @@ TCollection_AsciiString GEOM_Function::GetString(int thePosition) void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference) { _isDone = false; - if(thePosition <= 0) return; - if(theReference.IsNull()) return; + if (thePosition <= 0) return; + if (theReference.IsNull()) return; TDF_Label anArgLabel = ARGUMENT(thePosition); TDF_Reference::Set(anArgLabel, theReference->GetEntry()); TDataStd_UAttribute::Set(anArgLabel, GetDependencyID()); @@ -669,6 +716,85 @@ void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq) } } +//============================================================================= +/*! + * AddSubShapeReference + */ +//============================================================================= +void GEOM_Function::AddSubShapeReference(Handle(GEOM_Function) theSubShape) +{ + _isDone = false; + + TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL); + + Handle(TDataStd_ExtStringList) aList; + if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) { + aList = new TDataStd_ExtStringList; + aSubShapesLabel.AddAttribute(aList); + } + + TCollection_AsciiString anEntry; + TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry); + aList->Append(anEntry); + + _isDone = true; +} + +//============================================================================= +/*! + * RemoveSubShapeReference + */ +//============================================================================= +void GEOM_Function::RemoveSubShapeReference(Handle(GEOM_Function) theSubShape) +{ + _isDone = false; + + TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL); + + Handle(TDataStd_ExtStringList) aList; + if (aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) { + TCollection_AsciiString anEntry; + TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry); + aList->Remove(anEntry); + } + + _isDone = true; +} + +//============================================================================= +/*! + * HasSubShapeReferences + */ +//============================================================================= +bool GEOM_Function::HasSubShapeReferences() +{ + _isDone = true; + + TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL); + return aSubShapesLabel.IsAttribute(TDataStd_ExtStringList::GetID()); +} + +//============================================================================= +/*! + * GetSubShapeReferences + */ +//============================================================================= +const TDataStd_ListOfExtendedString& GEOM_Function::GetSubShapeReferences() +{ + _isDone = false; + + TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL); + + Handle(TDataStd_ExtStringList) aList; + if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) { + aList = new TDataStd_ExtStringList; + aSubShapesLabel.AddAttribute(aList); + } + + _isDone = true; + return aList->List(); +} + //============================================================================= /*! * GetHistoryEntry @@ -712,6 +838,16 @@ TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label& theArgu return aHistoryCurLabel; } +//============================================================================= +/*! + * GetNamingEntry + */ +//============================================================================= +TDF_Label GEOM_Function::GetNamingEntry (const Standard_Boolean create) +{ + return _label.FindChild(NAMING_LABEL, create); +} + //======================================================================= //function : GEOM_Function_Type_ //purpose : @@ -720,17 +856,16 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_() { static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + if (aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); - + if (aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function", - sizeof(GEOM_Function), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOM_Function), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -750,5 +885,5 @@ const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standar } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOM/GEOM_Function.hxx b/src/GEOM/GEOM_Function.hxx index 3e1ea6970..a9633386d 100644 --- a/src/GEOM/GEOM_Function.hxx +++ b/src/GEOM/GEOM_Function.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_Function_HeaderFile #define _GEOM_Function_HeaderFile @@ -33,10 +34,10 @@ #endif #ifndef _Handle_MMgt_TShared_HeaderFile #include -#endif +#endif #ifndef _MMgt_TShared_HeaderFile #include -#endif +#endif #ifndef _Standard_GUID_HeaderFile #include #endif @@ -64,31 +65,31 @@ class Handle(MMgt_TShared); class GEOM_Function; #include - +#include Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function); class Handle(GEOM_Function) : public Handle(MMgt_TShared) { public: - inline void* operator new(size_t,void* anAddress) + inline void* operator new(size_t,void* anAddress) { return anAddress; } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); + inline void* operator new(size_t size) + { + return Standard::Allocate(size); } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } - Handle(GEOM_Function)():Handle(MMgt_TShared)() {} - Handle(GEOM_Function)(const Handle(GEOM_Function)& aHandle) : Handle(MMgt_TShared)(aHandle) + Handle(GEOM_Function)():Handle(MMgt_TShared)() {} + Handle(GEOM_Function)(const Handle(GEOM_Function)& aHandle) : Handle(MMgt_TShared)(aHandle) { } - Handle(GEOM_Function)(const GEOM_Function* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + Handle(GEOM_Function)(const GEOM_Function* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) { } @@ -104,18 +105,18 @@ class Handle(GEOM_Function) : public Handle(MMgt_TShared) { return *this; } - GEOM_Function* operator->() + GEOM_Function* operator->() { return (GEOM_Function *)ControlAccess(); } - GEOM_Function* operator->() const + GEOM_Function* operator->() const { return (GEOM_Function *)ControlAccess(); } Standard_EXPORT ~Handle(GEOM_Function)() {}; - + Standard_EXPORT static const Handle(GEOM_Function) DownCast(const Handle(Standard_Transient)& AnObject); }; @@ -124,24 +125,26 @@ class GEOM_Function : public MMgt_TShared public: - inline void* operator new(size_t,void* anAddress) + inline void* operator new(size_t,void* anAddress) { return anAddress; } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); + inline void* operator new(size_t size) + { + return Standard::Allocate(size); } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } // Type management // Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Function) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); } + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { return STANDARD_TYPE(GEOM_Function) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); } private: @@ -149,22 +152,22 @@ private: public: - //Returns a GUID for a function tree + //Returns a GUID for a function tree Standard_EXPORT static const Standard_GUID& GetFunctionTreeID(); - //Returns the ID which is associated with a reference to another function + //Returns the ID which is associated with a reference to another function Standard_EXPORT static const Standard_GUID& GetDependencyID(); //Finds and returns a function located on a label theEntry Standard_EXPORT static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry); - Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType); + Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType); Standard_EXPORT ~GEOM_Function() {;} Standard_EXPORT TDF_Label GetOwnerEntry(); - //Access to properties + //Access to properties //Returns a result of the function built by the function Driver Standard_EXPORT TopoDS_Shape GetValue(); @@ -176,7 +179,7 @@ public: Standard_EXPORT TDF_Label& GetEntry() { return _label; } //Returns the type of the function - Standard_EXPORT int GetType(); + Standard_EXPORT int GetType(); //Returns a function Driver GUID Standard_EXPORT Standard_GUID GetDriverGUID(); @@ -184,8 +187,8 @@ public: //Returns aPython description of the function Standard_EXPORT TCollection_AsciiString GetDescription(); - //Sets aPython description of the function - Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription); + //Sets aPython description of the function + Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription); //Access to arguments @@ -205,8 +208,8 @@ public: Standard_EXPORT void SetInteger(int thePosition, int theValue); //Returns an integer argument at position thePosition - Standard_EXPORT int GetInteger(int thePosition); - + Standard_EXPORT int GetInteger(int thePosition); + //Sets an integer array argument at position thePosition Standard_EXPORT void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray); @@ -220,18 +223,18 @@ public: Standard_EXPORT void SetString(int thePosition, const TCollection_AsciiString& theValue); //Returns a string argument at position thePosition - Standard_EXPORT TCollection_AsciiString GetString(int thePosition); - + Standard_EXPORT TCollection_AsciiString GetString(int thePosition); + //Returns a reference to other function argument at position thePosition - Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition); + Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition); //Set an array of ExtendedString Standard_EXPORT void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray); - + //Returns the array of ExtendedString Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition); - //Returns a GUID for a references tree + //Returns a GUID for a references tree Standard_EXPORT static const Standard_GUID& GetReferencesTreeID(); //Sets a list of references to other function arguments at position thePosition @@ -239,33 +242,44 @@ public: const Handle(TColStd_HSequenceOfTransient)& theRefList); //Returns a list of references to other function arguments at position thePosition - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition); //Sets a TopoDS_Shape argument at position thePosition //void SetShape(int thePosition, const TopoDS_Shape& theShape); - + //Returns a TopoDS_Shape argument at position thePosition - //TopoDS_Shape GetShape(int thePosition); - - //Returns true if the last method succided + //TopoDS_Shape GetShape(int thePosition); + + //Returns true if the last method succided Standard_EXPORT bool IsDone() { return _isDone; } + //Retuns true if this function is the last one in the study + Standard_EXPORT bool IsLastFuntion(); + //Returns a sequence of the external dependencies of this function Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq); + // Add/Remove/Check/Get subshape references + Standard_EXPORT void AddSubShapeReference (Handle(GEOM_Function) theSubShape); + Standard_EXPORT void RemoveSubShapeReference(Handle(GEOM_Function) theSubShape); + Standard_EXPORT bool HasSubShapeReferences(); + Standard_EXPORT const TDataStd_ListOfExtendedString& GetSubShapeReferences(); + //Returns top label of this function's history tree Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True); //Returns history label, corresponding to the label, //on which a reference on argument is stored Standard_EXPORT TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry, - const Standard_Boolean create = Standard_True); + const Standard_Boolean create = Standard_True); + + //Returns top label of this function's naming tree + Standard_EXPORT TDF_Label GetNamingEntry (const Standard_Boolean create = Standard_True); private: - - TDF_Label _label; - bool _isDone; + TDF_Label _label; + bool _isDone; }; #endif diff --git a/src/GEOM/GEOM_IOperations.cxx b/src/GEOM/GEOM_IOperations.cxx index 699a7b8f3..d7a381c16 100644 --- a/src/GEOM/GEOM_IOperations.cxx +++ b/src/GEOM/GEOM_IOperations.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include diff --git a/src/GEOM/GEOM_IOperations.hxx b/src/GEOM/GEOM_IOperations.hxx index 824cb60ed..14363f4cf 100644 --- a/src/GEOM/GEOM_IOperations.hxx +++ b/src/GEOM/GEOM_IOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IOperations_HXX_ #define _GEOM_IOperations_HXX_ diff --git a/src/GEOM/GEOM_ISubShape.hxx b/src/GEOM/GEOM_ISubShape.hxx index 492b96f56..fe6996741 100644 --- a/src/GEOM/GEOM_ISubShape.hxx +++ b/src/GEOM/GEOM_ISubShape.hxx @@ -1,35 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// NOTE: This is an intreface to a function for the Shapes -// (Wire, Face, Shell, Solid and Compound) creation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_Function.hxx" #include "TColStd_HSequenceOfTransient.hxx" #include "TColStd_HArray1OfInteger.hxx" -#define SHAPE_ARG_MAIN_SHAPE 1 -#define SHAPE_ARG_INDICES 2 -#define SHAPE_ARG_SORTED 3 +#define SHAPE_ARG_MAIN_SHAPE 1 +#define SHAPE_ARG_INDICES 2 class GEOM_ISubShape { diff --git a/src/GEOM/GEOM_Object.cxx b/src/GEOM/GEOM_Object.cxx index 672ce7835..88ca1b7b1 100644 --- a/src/GEOM/GEOM_Object.cxx +++ b/src/GEOM/GEOM_Object.cxx @@ -1,26 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include +#include "utilities.h" + #include #include #include @@ -31,11 +34,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -43,11 +48,16 @@ #include #define FUNCTION_LABEL(theNb) (_label.FindChild(1).FindChild((theNb))) -#define TYPE_LABEL 2 -#define FREE_LABEL 3 -#define TIC_LABEL 4 +#define TYPE_LABEL 2 +#define FREE_LABEL 3 +#define TIC_LABEL 4 #define COLOR_LABEL 5 #define AUTO_COLOR_LABEL 6 +#define MARKER_LABEL 7 + +#define MARKER_LABEL_TYPE 1 +#define MARKER_LABEL_SIZE 2 +#define MARKER_LABEL_ID 3 //======================================================================= //function : GetObjectID @@ -138,8 +148,14 @@ Handle(GEOM_Object) GEOM_Object::GetReferencedObject(TDF_Label& theLabel) */ //============================================================================= GEOM_Object::GEOM_Object(TDF_Label& theEntry) -: _label(theEntry), _ior("") + : _label(theEntry), _ior(""), _docID(-1) { + Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data()); + if(!aDoc.IsNull()) { + Handle(TDataStd_Integer) anID; + if(aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) _docID = anID->Get(); + } + if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root)) _root = TDataStd_TreeNode::Set(theEntry); } @@ -150,8 +166,14 @@ GEOM_Object::GEOM_Object(TDF_Label& theEntry) */ //============================================================================= GEOM_Object::GEOM_Object(TDF_Label& theEntry, int theType) -: _label(theEntry), _ior("") +: _label(theEntry), _ior(""), _docID(-1) { + Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data()); + if(!aDoc.IsNull()) { + Handle(TDataStd_Integer) anID; + if(aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) _docID = anID->Get(); + } + theEntry.ForgetAllAttributes(Standard_True); if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root)) @@ -162,6 +184,16 @@ GEOM_Object::GEOM_Object(TDF_Label& theEntry, int theType) TDataStd_UAttribute::Set(theEntry, GetObjectID()); } +//============================================================================= +/*! + * Destructor + */ +//============================================================================= +GEOM_Object::~GEOM_Object() +{ + MESSAGE("GEOM_Object::~GEOM_Object()"); +} + //============================================================================= /*! * GetType @@ -243,13 +275,7 @@ void GEOM_Object::IncrementTic() //============================================================================= int GEOM_Object::GetDocID() { - Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data()); - if(aDoc.IsNull()) return -1; - - Handle(TDataStd_Integer) anID; - if(!aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) return -1; - - return anID->Get(); + return _docID; } @@ -302,7 +328,7 @@ char* GEOM_Object::GetName() * SetColor */ //============================================================================= -void GEOM_Object::SetColor(const SALOMEDS::Color& theColor) +void GEOM_Object::SetColor(const GEOM_Object::Color& theColor) { Handle(TDataStd_RealArray) anArray = new TDataStd_RealArray(); anArray->Init( 1, 3 ); @@ -320,15 +346,15 @@ void GEOM_Object::SetColor(const SALOMEDS::Color& theColor) * GetColor */ //============================================================================= -SALOMEDS::Color GEOM_Object::GetColor() +GEOM_Object::Color GEOM_Object::GetColor() { Handle(TDataStd_RealArray) anArray; bool isFound = _label.FindChild(COLOR_LABEL).FindAttribute(TDataStd_RealArray::GetID(), anArray); - SALOMEDS::Color aColor; - aColor.R = isFound ? anArray->Value( 1 ) : 0.f; - aColor.G = isFound ? anArray->Value( 2 ) : 0.f; - aColor.B = isFound ? anArray->Value( 3 ) : 0.f; + GEOM_Object::Color aColor; + aColor.R = isFound ? anArray->Value( 1 ) : -1; + aColor.G = isFound ? anArray->Value( 2 ) : -1; + aColor.B = isFound ? anArray->Value( 3 ) : -1; return aColor; } @@ -338,7 +364,7 @@ SALOMEDS::Color GEOM_Object::GetColor() * SetAutoColor */ //============================================================================= -void GEOM_Object::SetAutoColor(CORBA::Boolean theAutoColor) +void GEOM_Object::SetAutoColor(bool theAutoColor) { TDataStd_Integer::Set(_label.FindChild(AUTO_COLOR_LABEL), (int)theAutoColor); } @@ -348,12 +374,102 @@ void GEOM_Object::SetAutoColor(CORBA::Boolean theAutoColor) * GetAutoColor */ //============================================================================= -CORBA::Boolean GEOM_Object::GetAutoColor() +bool GEOM_Object::GetAutoColor() { Handle(TDataStd_Integer) anAutoColor; if(!_label.FindChild(AUTO_COLOR_LABEL).FindAttribute(TDataStd_Integer::GetID(), anAutoColor)) return false; - return anAutoColor->Get(); + return bool(anAutoColor->Get()); +} + +//============================================================================= +/*! + * SetMarkerStd + */ +//============================================================================= +void GEOM_Object::SetMarkerStd(const Aspect_TypeOfMarker theType, double theSize) +{ + TDF_Label aMarkerLabel = _label.FindChild(MARKER_LABEL); + TDataStd_Integer::Set(aMarkerLabel.FindChild(MARKER_LABEL_TYPE), (int)theType); + TDataStd_Real::Set(aMarkerLabel.FindChild(MARKER_LABEL_SIZE), theSize); +} + +//============================================================================= +/*! + * SetMarkerTexture + */ +//============================================================================= +void GEOM_Object::SetMarkerTexture(int theTextureId) +{ + TDF_Label aMarkerLabel = _label.FindChild(MARKER_LABEL); + TDataStd_Integer::Set(aMarkerLabel.FindChild(MARKER_LABEL_TYPE), (int)Aspect_TOM_USERDEFINED); + TDataStd_Integer::Set(aMarkerLabel.FindChild(MARKER_LABEL_ID), theTextureId); +} + +//============================================================================= +/*! + * GetMarkerType + */ +//============================================================================= +Aspect_TypeOfMarker GEOM_Object::GetMarkerType() +{ + Standard_Integer aType = -1; + TDF_Label aMarkerLabel = _label.FindChild(MARKER_LABEL, Standard_False); + if(!aMarkerLabel.IsNull()) { + TDF_Label aTypeLabel = aMarkerLabel.FindChild(MARKER_LABEL_TYPE, Standard_False); + Handle(TDataStd_Integer) aTypeAttr; + if (!aTypeLabel.IsNull() && aTypeLabel.FindAttribute(TDataStd_Integer::GetID(), aTypeAttr)) + aType = aTypeAttr->Get(); + } + return (Aspect_TypeOfMarker)aType; +} + +//============================================================================= +/*! + * GetMarkerSize + */ +//============================================================================= +double GEOM_Object::GetMarkerSize() +{ + Standard_Real aSize = 0.; + TDF_Label aMarkerLabel = _label.FindChild(MARKER_LABEL, Standard_False); + if(!aMarkerLabel.IsNull()) { + TDF_Label aSizeLabel = aMarkerLabel.FindChild(MARKER_LABEL_SIZE, Standard_False); + Handle(TDataStd_Real) aSizeAttr; + if (!aSizeLabel.IsNull() && aSizeLabel.FindAttribute(TDataStd_Real::GetID(), aSizeAttr)) + aSize = aSizeAttr->Get(); + } + return aSize; +} + +//============================================================================= +/*! + * GetMarkerTexture + */ +//============================================================================= +int GEOM_Object::GetMarkerTexture() +{ + Standard_Integer anId = 0; + if ( GetMarkerType() == Aspect_TOM_USERDEFINED) { + TDF_Label aMarkerLabel = _label.FindChild(MARKER_LABEL, Standard_False); + if(!aMarkerLabel.IsNull()) { + TDF_Label aTypeLabel = aMarkerLabel.FindChild(MARKER_LABEL_ID, Standard_False); + Handle(TDataStd_Integer) anIdAttr; + if (!aTypeLabel.IsNull() && aTypeLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr)) + anId = anIdAttr->Get(); + } + } + return anId; +} + +//============================================================================= +/*! + * SetAuxData + */ +//============================================================================= +void GEOM_Object::UnsetMarker() +{ + SetMarkerStd((Aspect_TypeOfMarker)-1, 0.); } //============================================================================= @@ -426,10 +542,12 @@ bool GEOM_Object::IsMainShape() * AddFunction */ //============================================================================= -Handle(GEOM_Function) GEOM_Object::AddFunction(const Standard_GUID& theGUID, int theFunctionType) +Handle(GEOM_Function) GEOM_Object::AddFunction(const Standard_GUID& theGUID, + int theFunctionType, + bool allowSubShape) { Standard_Integer nb = GetNbFunctions(); - if(nb == 1 && theGUID == GetSubShapeID()) return NULL; //It's impossible to add a function to sub shape + if(!allowSubShape && nb == 1 && theGUID == GetSubShapeID()) return NULL; //It's impossible to add a function to sub-shape nb++; TDF_Label aChild = FUNCTION_LABEL(nb); @@ -556,10 +674,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Object_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOM_Object", - sizeof(GEOM_Object), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOM_Object), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOM/GEOM_Object.hxx b/src/GEOM/GEOM_Object.hxx index 67f309bb0..a913fb4f7 100644 --- a/src/GEOM/GEOM_Object.hxx +++ b/src/GEOM/GEOM_Object.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_Object_HeaderFile #define _GEOM_Object_HeaderFile @@ -55,10 +56,10 @@ #ifndef _TCollection_AsciiString_HeaderFile #include #endif +#ifndef _Aspect_TypeOfMarker_HeaderFile +#include +#endif -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) class Handle_TColStd_HSequenceOfTransient; class Standard_Transient; @@ -129,6 +130,16 @@ class Handle(GEOM_Object) : public Handle(MMgt_TShared) { class GEOM_Object : public MMgt_TShared { friend class GEOM_Engine; + + public: + struct Color { + //! Red component of the color + double R; + //! Green component of the color + double G; + //! Blue component of the color + double B; + }; public: inline void* operator new(size_t,void* anAddress) @@ -156,7 +167,7 @@ class GEOM_Object : public MMgt_TShared public: Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType); - Standard_EXPORT ~GEOM_Object() {;} + Standard_EXPORT ~GEOM_Object(); //Finds a GEOM_Object on the label theLabel Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel); @@ -167,7 +178,7 @@ class GEOM_Object : public MMgt_TShared //Returns a GEOM_Object common GUID Standard_EXPORT static const Standard_GUID& GetObjectID(); - //Returns a GUID associated with a sub shape object + //Returns a GUID associated with a sub-shape object Standard_EXPORT static const Standard_GUID& GetSubShapeID(); //########################################################### @@ -204,16 +215,34 @@ class GEOM_Object : public MMgt_TShared Standard_EXPORT char* GetName(); //Sets a color of this GEOM_Object - Standard_EXPORT void SetColor(const SALOMEDS::Color& theColor); + Standard_EXPORT void SetColor(const Color& theColor); //Returns a color of this GEOM_Object - Standard_EXPORT SALOMEDS::Color GetColor(); + Standard_EXPORT Color GetColor(); //Toggles an auto color mode on this GEOM_Object - Standard_EXPORT void SetAutoColor(CORBA::Boolean theAutoColor); + Standard_EXPORT void SetAutoColor(bool theAutoColor); //Returns a flag of auto color mode of this GEOM_Object - Standard_EXPORT CORBA::Boolean GetAutoColor(); + Standard_EXPORT bool GetAutoColor(); + + //Sets predefined point marker texture + Standard_EXPORT void SetMarkerStd(const Aspect_TypeOfMarker theType, double theSize); + + //Sets custom point marker texture + Standard_EXPORT void SetMarkerTexture(int theTextureId); + + //Gets point marker type + Standard_EXPORT Aspect_TypeOfMarker GetMarkerType(); + + //Gets point marker scale factor / size + Standard_EXPORT double GetMarkerSize(); + + //Gets custom marker texture ID + Standard_EXPORT int GetMarkerTexture(); + + //Unsets point marker + Standard_EXPORT void UnsetMarker(); //Sets an auxiliary data Standard_EXPORT void SetAuxData(const char* theData); @@ -228,10 +257,10 @@ class GEOM_Object : public MMgt_TShared Standard_EXPORT TCollection_AsciiString GetParameters() const; //########################################################### - // Sub shape methods + // Sub-shape methods //########################################################### - //Returns false if the object is a sub shape of another object + //Returns false if the object is a sub-shape of another object Standard_EXPORT bool IsMainShape(); //########################################################### @@ -250,7 +279,9 @@ class GEOM_Object : public MMgt_TShared //Adds a function with a driver GUID = theGUID and a type theFunctionType //to the function tree of this GEOM_Object - Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID, int theFunctionType); + Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID, + int theFunctionType, + bool allowSubShape=false); //Returns a number of functions of this GEOM_Object Standard_EXPORT int GetNbFunctions(); @@ -279,6 +310,9 @@ class GEOM_Object : public MMgt_TShared TDF_Label _label; TCollection_AsciiString _ior; TCollection_AsciiString _parameters; + int _docID; + + }; #endif diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx index 8f4143404..70022fc99 100644 --- a/src/GEOM/GEOM_PythonDump.cxx +++ b/src/GEOM/GEOM_PythonDump.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_PythonDump.hxx" #include @@ -43,14 +44,25 @@ namespace GEOM { if (--myCounter == 0) { TCollection_AsciiString aDescr; - if ( myAppend ) - aDescr = myFunction->GetDescription() + "\n\t"; + if ( myAppend ) { + aDescr = myFunction->GetDescription(); + if ( !aDescr.IsEmpty() ) aDescr += "\n\t"; + } std::string aString = myStream.str(); aDescr += (char *)aString.c_str(); myFunction->SetDescription( aDescr ); } } + TPythonDump& TPythonDump::operator<< (bool theArg) + { + if (theArg) + myStream << "True"; + else + myStream << "False"; + return *this; + } + TPythonDump& TPythonDump::operator<< (long int theArg) { myStream< #include @@ -60,11 +61,11 @@ bool GEOM_Solver::ComputeFunction(Handle(GEOM_Function) theFunction) Handle(TFunction_Driver) aDriver; if(!TFunction_DriverTable::Get()->FindDriver(aGUID, aDriver)) return false; - + aDriver->Init(theFunction->GetEntry()); - + TFunction_Logbook aLog; if(aDriver->Execute(aLog) == 0) return false; - + return true; } diff --git a/src/GEOM/GEOM_Solver.hxx b/src/GEOM/GEOM_Solver.hxx index acc4e1194..fc3d6caeb 100644 --- a/src/GEOM/GEOM_Solver.hxx +++ b/src/GEOM/GEOM_Solver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_Solver_HXX_ #define _GEOM_Solver_HXX_ diff --git a/src/GEOM/GEOM_SubShapeDriver.cxx b/src/GEOM/GEOM_SubShapeDriver.cxx index 12d62e5a1..fa2d4cdca 100644 --- a/src/GEOM/GEOM_SubShapeDriver.cxx +++ b/src/GEOM/GEOM_SubShapeDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -26,33 +27,15 @@ #include #include -#include #include -#include -#include #include -#include #include -#include -#include -#include #include -#include -#include #include -#include -#include #include -#include -#include -#include - -#include #include -#include - //======================================================================= //function : GEOM_SubShapeDriver @@ -87,34 +70,32 @@ Standard_Integer GEOM_SubShapeDriver::Execute(TFunction_Logbook& log) const TopoDS_Compound aCompound; TopoDS_Shape aShape; - if (anIndices->Length() == 1 && anIndices->Value(1) == -1) { //The empty subshape + if (anIndices->Length() == 1 && anIndices->Value(1) == -1) { //The empty sub-shape B.MakeCompound(aCompound); aShape = aCompound; - - } else { - + } + else { TopTools_IndexedMapOfShape aMapOfShapes; TopExp::MapShapes(aMainShape, aMapOfShapes); if (anIndices->Length() > 1) { - B.MakeCompound(aCompound); - for (int i = anIndices->Lower(); i<= anIndices->Upper(); i++) { - if (aMapOfShapes.Extent() < anIndices->Value(i)) - Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range"); - TopoDS_Shape aSubShape = aMapOfShapes.FindKey(anIndices->Value(i)); - if (aSubShape.IsNull()) continue; - B.Add(aCompound,aSubShape); + for (int i = anIndices->Lower(); i <= anIndices->Upper(); i++) { + if (aMapOfShapes.Extent() < anIndices->Value(i)) + Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range"); + TopoDS_Shape aSubShape = aMapOfShapes.FindKey(anIndices->Value(i)); + if (aSubShape.IsNull()) continue; + B.Add(aCompound,aSubShape); } aShape = aCompound; - - } else { - - if (aMapOfShapes.Extent() < anIndices->Value(1)) + } + else { + int i = anIndices->Lower(); + if (aMapOfShapes.Extent() < anIndices->Value(i)) Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range"); - aShape = aMapOfShapes.FindKey(anIndices->Value(1)); + aShape = aMapOfShapes.FindKey(anIndices->Value(i)); } } @@ -127,7 +108,6 @@ Standard_Integer GEOM_SubShapeDriver::Execute(TFunction_Logbook& log) const return 1; } - //======================================================================= //function : GEOM_SubShapeDriver_Type_ //purpose : @@ -136,19 +116,19 @@ Standard_EXPORT Handle_Standard_Type& GEOM_SubShapeDriver_Type_() { static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOM_SubShapeDriver", - sizeof(GEOM_SubShapeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOM_SubShapeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -167,5 +147,5 @@ const Handle(GEOM_SubShapeDriver) Handle(GEOM_SubShapeDriver)::DownCast(const Ha } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOM/GEOM_SubShapeDriver.hxx b/src/GEOM/GEOM_SubShapeDriver.hxx index fde1c6b16..f5646b839 100644 --- a/src/GEOM/GEOM_SubShapeDriver.hxx +++ b/src/GEOM/GEOM_SubShapeDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ShapeDriver.ixx // Module : GEOM // diff --git a/src/GEOM/Handle_GEOM_Application.hxx b/src/GEOM/Handle_GEOM_Application.hxx index f7f21d156..7a3b00bcc 100644 --- a/src/GEOM/Handle_GEOM_Application.hxx +++ b/src/GEOM/Handle_GEOM_Application.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : Handle_GEOM_Application.hxx // Module : GEOM // diff --git a/src/GEOM/Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx b/src/GEOM/Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx index 9458f5db4..74e7f3d12 100644 --- a/src/GEOM/Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx +++ b/src/GEOM/Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx // Module : GEOM // diff --git a/src/GEOM/Makefile.am b/src/GEOM/Makefile.am index 4ab7a8b7c..68f248fb6 100644 --- a/src/GEOM/Makefile.am +++ b/src/GEOM/Makefile.am @@ -1,30 +1,28 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Damien COQUERET (OCC) # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM # $Header: -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # Libraries targets @@ -66,17 +64,14 @@ salomeinclude_HEADERS = \ # additional information to compile and link file libGEOMbasic_la_CPPFLAGS = \ - $(CORBA_CXXFLAGS) \ - $(CORBA_INCLUDES) \ $(CAS_CPPFLAGS) \ $(KERNEL_CXXFLAGS) \ $(BOOST_CPPFLAGS) \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOMbasic_la_LDFLAGS = \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \ $(STDLIB) \ - $(CAS_LDPATH) -lTKXSBase \ + $(CAS_LDPATH) -lTKXSBase -lTKG3d \ $(CAS_OCAF) \ $(CAS_OCAFVIS) diff --git a/src/GEOMAlgo/BlockFix.cdl b/src/GEOMAlgo/BlockFix.cdl index 3edbd6ad5..961af6625 100644 --- a/src/GEOMAlgo/BlockFix.cdl +++ b/src/GEOMAlgo/BlockFix.cdl @@ -1,31 +1,29 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: BlockFix.cdl -- Created: Tue Dec 7 11:59:05 2004 -- Author: Pavel Durandin - - - - +-- package BlockFix uses @@ -44,19 +42,19 @@ uses is class SphereSpaceModifier; - + class UnionFaces; - + class UnionEdges; - + class BlockFixAPI; ---Purpose: API class to perform the fixing of the -- block - + class PeriodicSurfaceModifier; class CheckTool; - + RotateSphereSpace (S: Shape from TopoDS; Tol: Real) returns Shape from TopoDS; diff --git a/src/GEOMAlgo/BlockFix.cxx b/src/GEOMAlgo/BlockFix.cxx index a8c47b09d..0e4f9bb21 100644 --- a/src/GEOMAlgo/BlockFix.cxx +++ b/src/GEOMAlgo/BlockFix.cxx @@ -1,68 +1,88 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 -// -// File: BlockFix.cxx -// Created: Tue Dec 7 11:59:05 2004 -// Author: Pavel DURANDIN +// 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 + +// File: BlockFix.cxx +// Created: Tue Dec 7 11:59:05 2004 +// Author: Pavel DURANDIN + #include -#include -#include -#include -#include -#include -#include + +#include +#include + +#include #include -#include + #include -#include -#include -#include -#include + +#include +#include +#include #include -#include -#include -#include +#include +#include +#include + +#include +#include +#include +#include +#include + #include -#include -#include #include -#include -#include + +#include + +#include +#include +#include + +#include + #include +#include #include -#include -#include +#include +#include #include -#include +#include + +#include + #include +#include -#include -#include -#include -#include +#include -#include +#include +#include +#include +#include +#include + +#include +#include //======================================================================= //function : FixResult @@ -78,26 +98,26 @@ static void FixResult(const TopoDS_Shape& result, TopoDS_Face aFace = TopoDS::Face(aShape); TopLoc_Location L; Handle(Geom_Surface) Surf = BRep_Tool::Surface(aFace,L); - + if( Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) || Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ) { - + Standard_Integer nbWires = 0; for (TopExp_Explorer ex_w(aFace,TopAbs_WIRE); ex_w.More(); ex_w.Next()) { nbWires++; - Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(ex_w.Current()), - aFace, + Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(ex_w.Current()), + aFace, Precision::Confusion()); sfw->FixReorder(); if(sfw->StatusReorder ( ShapeExtend_FAIL )) continue; - + sfw->SetPrecision(2.*Tol); sfw->FixShifted(); - + Standard_Boolean isDone = sfw->LastFixStatus ( ShapeExtend_DONE ); isDone |= sfw->FixDegenerated(); - + // remove degenerated edges from not degenerated points ShapeAnalysis_Edge sae; Handle(ShapeExtend_WireData) sewd = sfw->WireData(); @@ -110,10 +130,10 @@ static void FixResult(const TopoDS_Shape& result, i--; } } - + //isDone |= sfw->FixLacking(); // commented by skl 22.03.2005 (PAL8395) - - // remove neighbour seam edges + + // remove neighbour seam edges if(isDone) { for( i = 1; iNbEdges();i++) { if(sewd->IsSeam(i) && sewd->IsSeam(i+1)) { @@ -128,8 +148,7 @@ static void FixResult(const TopoDS_Shape& result, sewd->Remove(sewd->NbEdges()); } } - - + if(isDone) { TopoDS_Wire ResWire = sfw->Wire(); Context->Replace(ex_w.Current(), ResWire); @@ -142,24 +161,17 @@ static void FixResult(const TopoDS_Shape& result, if(sff->FixOrientation()) Context->Replace(aFixedFace,sff->Face()); } - } } } - - - - //======================================================================= -//function : ConvertToAnalytical -//purpose : +//function : RotateSphereSpace +//purpose : //======================================================================= - TopoDS_Shape BlockFix::RotateSphereSpace (const TopoDS_Shape& S, - const Standard_Real Tol) + const Standard_Real Tol) { - // Create a modification description Handle(BlockFix_SphereSpaceModifier) SR = new BlockFix_SphereSpaceModifier; SR->SetTolerance(Tol); @@ -167,29 +179,146 @@ TopoDS_Shape BlockFix::RotateSphereSpace (const TopoDS_Shape& S, TopTools_DataMapOfShapeShape context; BRepTools_Modifier MD; TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD ); - + Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape; FixResult(result,RS,Tol); result = RS->Apply(result); - + ShapeFix_Edge sfe; for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) { TopoDS_Edge E = TopoDS::Edge(exp.Current()); sfe.FixVertexTolerance (E); } - + ShapeFix::SameParameter(result,Standard_False); return result; } +//======================================================================= +//function : RefillProblemFaces +//purpose : +//======================================================================= +TopoDS_Shape BlockFix::RefillProblemFaces (const TopoDS_Shape& aShape) +{ + Standard_Integer NbSamples = 10; + + TopTools_ListOfShape theFaces; + + TopExp_Explorer Explo(aShape, TopAbs_FACE); + for (; Explo.More(); Explo.Next()) + { + TopoDS_Face aFace = TopoDS::Face(Explo.Current()); + BRepAdaptor_Surface BAsurf(aFace); + GeomAbs_SurfaceType SurfType = BAsurf.GetType(); + if (SurfType >= GeomAbs_BezierSurface) + { + TopExp_Explorer fexp(aFace, TopAbs_EDGE); + for (; fexp.More(); fexp.Next()) + { + const TopoDS_Edge& anEdge = TopoDS::Edge(fexp.Current()); + if (BRep_Tool::Degenerated(anEdge)) + { + TopoDS_Vertex V1, V2; + TopExp::Vertices(anEdge, V1, V2); + if (V1.IsSame(V2)) + { + gp_Pnt aPnt = BRep_Tool::Pnt(V1); + Standard_Real TolV = BRep_Tool::Tolerance(V1); + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); + Handle(ShapeAnalysis_Surface) Analyser = new ShapeAnalysis_Surface(aSurf); + if (Analyser->IsDegenerated(aPnt, TolV)) + { + theFaces.Append(aFace); + break; + } + } + } + } + } + } + + //Now all problem faces are collected in the list "theFaces" + BRepTools_Substitution aSubst; + TopTools_ListIteratorOfListOfShape itl(theFaces); + for (; itl.More(); itl.Next()) + { + const TopoDS_Face& aFace = TopoDS::Face(itl.Value()); + BRepOffsetAPI_MakeFilling Filler; + for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next()) + { + const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current()); + if (!BRep_Tool::Degenerated(anEdge)) + Filler.Add(anEdge, GeomAbs_C0); + } + Standard_Real Umin, Umax, Vmin, Vmax; + BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax); + //Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); + Standard_Integer i, j; + for (i = 1; i < NbSamples; i++) + for (j = 1; j < NbSamples; j++) { + /* + gp_Pnt aPoint = aSurf->Value(Umin + i*(Umax-Umin)/NbSamples, + Vmin + j*(Vmax-Vmin)/NbSamples); + Filler.Add(aPoint); + */ + Filler.Add(Umin + i*(Umax-Umin)/NbSamples, + Vmin + j*(Vmax-Vmin)/NbSamples, + aFace, GeomAbs_G1); + } + + Filler.Build(); + if (Filler.IsDone()) + { + for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next()) + { + const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current()); + TopTools_ListOfShape Ledge; + if (!BRep_Tool::Degenerated(anEdge)) + { + const TopTools_ListOfShape& Ledges = Filler.Generated(anEdge); + if (!Ledges.IsEmpty()) { + TopoDS_Shape NewEdge = Ledges.First(); + Ledge.Append(NewEdge.Oriented(TopAbs_FORWARD)); + } + } + aSubst.Substitute(anEdge, Ledge); + } + TopTools_ListOfShape Lface; + TopoDS_Face NewFace = TopoDS::Face(Filler.Shape()); + NewFace.Orientation(TopAbs_FORWARD); + BRepAdaptor_Surface NewBAsurf(NewFace); + gp_Pnt MidPnt; + gp_Vec D1U, D1V, Normal, NewNormal; + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); + aSurf->D1((Umin+Umax)*0.5, (Vmin+Vmax)*0.5, MidPnt, D1U, D1V); + Normal = D1U ^ D1V; + NewBAsurf.D1((NewBAsurf.FirstUParameter() + NewBAsurf.LastUParameter())*0.5, + (NewBAsurf.FirstVParameter() + NewBAsurf.LastVParameter())*0.5, + MidPnt, D1U, D1V); + NewNormal = D1U ^ D1V; + if (Normal * NewNormal < 0.) + NewFace.Reverse(); + Lface.Append(NewFace); + aSubst.Substitute(aFace, Lface); + } + } + aSubst.Build(aShape); + + TopoDS_Shape Result = aShape; + if (aSubst.IsCopied(aShape)) + Result = aSubst.Copy(aShape).First(); + + BRepTools::RemoveUnusedPCurves(Result); + + return Result; +} //======================================================================= //function : FixRanges -//purpose : +//purpose : //======================================================================= - TopoDS_Shape BlockFix::FixRanges (const TopoDS_Shape& S, - const Standard_Real Tol) + const Standard_Real Tol) { // Create a modification description Handle(BlockFix_PeriodicSurfaceModifier) SR = new BlockFix_PeriodicSurfaceModifier; @@ -198,17 +327,17 @@ TopoDS_Shape BlockFix::FixRanges (const TopoDS_Shape& S, TopTools_DataMapOfShapeShape context; BRepTools_Modifier MD; TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD ); - + Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape; FixResult(result,RS,Tol); result = RS->Apply(result); - + ShapeFix_Edge sfe; for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) { TopoDS_Edge E = TopoDS::Edge(exp.Current()); sfe.FixVertexTolerance (E); } - + ShapeFix::SameParameter(result,Standard_False); return result; diff --git a/src/GEOMAlgo/BlockFix.hxx b/src/GEOMAlgo/BlockFix.hxx index 80b041429..34007be5c 100644 --- a/src/GEOMAlgo/BlockFix.hxx +++ b/src/GEOMAlgo/BlockFix.hxx @@ -1,30 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _BlockFix_HeaderFile #define _BlockFix_HeaderFile #ifndef _Standard_Real_HeaderFile #include #endif + class TopoDS_Shape; class BlockFix_SphereSpaceModifier; class BlockFix_UnionFaces; @@ -33,7 +35,6 @@ class BlockFix_BlockFixAPI; class BlockFix_PeriodicSurfaceModifier; class BlockFix_CheckTool; - #ifndef _Standard_HeaderFile #include #endif @@ -45,45 +46,26 @@ class BlockFix { public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static TopoDS_Shape RotateSphereSpace(const TopoDS_Shape& S,const Standard_Real Tol) ; -Standard_EXPORT static TopoDS_Shape FixRanges(const TopoDS_Shape& S,const Standard_Real Tol) ; - - - - + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Standard_EXPORT static TopoDS_Shape RotateSphereSpace(const TopoDS_Shape& S,const Standard_Real Tol); + Standard_EXPORT static TopoDS_Shape RefillProblemFaces(const TopoDS_Shape& S); + Standard_EXPORT static TopoDS_Shape FixRanges(const TopoDS_Shape& S,const Standard_Real Tol); protected: - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // +private: friend class BlockFix_SphereSpaceModifier; friend class BlockFix_UnionFaces; @@ -94,12 +76,6 @@ friend class BlockFix_CheckTool; }; - - - - // other Inline functions and methods (like "C++: function call" methods) -// - #endif diff --git a/src/GEOMAlgo/BlockFix.ixx b/src/GEOMAlgo/BlockFix.ixx index 700a7f37a..2ea228ff7 100644 --- a/src/GEOMAlgo/BlockFix.ixx +++ b/src/GEOMAlgo/BlockFix.ixx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include - + diff --git a/src/GEOMAlgo/BlockFix.jxx b/src/GEOMAlgo/BlockFix.jxx index 3c9000120..8649f8895 100644 --- a/src/GEOMAlgo/BlockFix.jxx +++ b/src/GEOMAlgo/BlockFix.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _TopoDS_Shape_HeaderFile #include #endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl b/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl index 6682c1881..8cb4c49ce 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl @@ -1,67 +1,68 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: BlockFix_BlockFixAPI.cdl -- Created: Tue Dec 7 17:56:09 2004 -- Author: Pavel Durandin - +-- class BlockFixAPI from BlockFix inherits TShared from MMgt - ---Purpose: + ---Purpose: uses Shape from TopoDS, - ReShape from ShapeBuild + ReShape from ShapeBuild is Create returns BlockFixAPI from BlockFix; ---Purpose: Empty constructor - + SetShape(me: mutable; Shape: Shape from TopoDS); ---Purpose: Sets the shape to be operated on ---C++: inline Perform(me: mutable); - ---Purpose: - + ---Purpose: + Shape(me) returns Shape from TopoDS; ---Purpose: Returns resulting shape. ---C++: inline - + Context(me:mutable) returns ReShape from ShapeBuild; - ---Purpose: Returns modifiable context for storing the + ---Purpose: Returns modifiable context for storing the -- mofifications ---C++: inline ---C++: return & - + Tolerance (me:mutable) returns Real; ---Purpose: Returns modifiable tolerance of recognition ---C++: inline ---C++: return & fields - + myContext : ReShape from ShapeBuild; myShape : Shape from TopoDS; myTolerance : Real from Standard; - + end BlockFixAPI from BlockFix; diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx index 62e33fd4e..3c82e4a84 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx @@ -1,67 +1,82 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 -// -// File: BlockFix_BlockFixAPI.cxx -// Created: Tue Dec 7 11:59:05 2004 -// Author: Pavel DURANDIN +// 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 + +// File: BlockFix_BlockFixAPI.cxx +// Created: Tue Dec 7 11:59:05 2004 +// Author: Pavel DURANDIN + #include + #include #include #include + +#include + +#include + #include //======================================================================= //function : ShapeConvert_CanonicAPI -//purpose : +//purpose : //======================================================================= BlockFix_BlockFixAPI::BlockFix_BlockFixAPI() { myTolerance = Precision::Confusion(); + myOptimumNbFaces = 6; } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= -void BlockFix_BlockFixAPI::Perform() +void BlockFix_BlockFixAPI::Perform() { - // processing spheres with degenerativities TopoDS_Shape aShape = Shape(); myShape = BlockFix::RotateSphereSpace(aShape,myTolerance); - + + // try to approximate non-canonic surfaces + // with singularities on boundaries by filling + myShape = BlockFix::RefillProblemFaces(myShape); + // faces unification BlockFix_UnionFaces aFaceUnifier; aFaceUnifier.GetTolerance() = myTolerance; - TopoDS_Shape aResult; - aResult = aFaceUnifier.Perform(myShape); - - + aFaceUnifier.GetOptimumNbFaces() = myOptimumNbFaces; + TopoDS_Shape aResult = aFaceUnifier.Perform(myShape); + + // avoid problem with degenerated edges appearance + // due to shape quality regress + ShapeUpgrade_RemoveLocations RemLoc; + RemLoc.Remove(aResult); + aResult = RemLoc.GetResult(); + + // edges unification BlockFix_UnionEdges anEdgeUnifier; myShape = anEdgeUnifier.Perform(aResult,myTolerance); - + TopoDS_Shape aRes = BlockFix::FixRanges(myShape,myTolerance); myShape = aRes; - } diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.hxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.hxx index 9bece72c4..7be25cc57 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.hxx +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _BlockFix_BlockFixAPI_HeaderFile #define _BlockFix_BlockFixAPI_HeaderFile @@ -41,77 +42,53 @@ #ifndef _MMgt_TShared_HeaderFile #include #endif + class ShapeBuild_ReShape; class TopoDS_Shape; -class BlockFix_BlockFixAPI : public MMgt_TShared { - +class BlockFix_BlockFixAPI : public MMgt_TShared +{ public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT BlockFix_BlockFixAPI(); - void SetShape(const TopoDS_Shape& Shape) ; -Standard_EXPORT void Perform() ; + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT BlockFix_BlockFixAPI(); + void SetShape(const TopoDS_Shape& Shape); + Standard_EXPORT void Perform(); TopoDS_Shape Shape() const; - Handle_ShapeBuild_ReShape& Context() ; - Standard_Real& Tolerance() ; -Standard_EXPORT ~BlockFix_BlockFixAPI(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& BlockFix_BlockFixAPI_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_ShapeBuild_ReShape myContext; -TopoDS_Shape myShape; -Standard_Real myTolerance; - - + Handle_ShapeBuild_ReShape& Context(); + Standard_Real& Tolerance(); + Standard_Integer& OptimumNbFaces(); + Standard_EXPORT ~BlockFix_BlockFixAPI(); + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& BlockFix_BlockFixAPI_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +private: + // Fields PRIVATE + // + Handle_ShapeBuild_ReShape myContext; + TopoDS_Shape myShape; + Standard_Real myTolerance; + Standard_Integer myOptimumNbFaces; }; - #include - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.ixx b/src/GEOMAlgo/BlockFix_BlockFixAPI.ixx index 1b68aba32..4d06a875e 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.ixx +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.ixx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #ifndef _Standard_TypeMismatch_HeaderFile @@ -26,7 +27,7 @@ #endif BlockFix_BlockFixAPI::~BlockFix_BlockFixAPI() {} - + Standard_EXPORT Handle_Standard_Type& BlockFix_BlockFixAPI_Type_() @@ -36,14 +37,14 @@ Standard_EXPORT Handle_Standard_Type& BlockFix_BlockFixAPI_Type_() if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); - + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; static Handle_Standard_Type _aType = new Standard_Type("BlockFix_BlockFixAPI", - sizeof(BlockFix_BlockFixAPI), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(BlockFix_BlockFixAPI), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -52,7 +53,7 @@ Standard_EXPORT Handle_Standard_Type& BlockFix_BlockFixAPI_Type_() // DownCast method // allow safe downcasting // -const Handle(BlockFix_BlockFixAPI) Handle(BlockFix_BlockFixAPI)::DownCast(const Handle(Standard_Transient)& AnObject) +const Handle(BlockFix_BlockFixAPI) Handle(BlockFix_BlockFixAPI)::DownCast(const Handle(Standard_Transient)& AnObject) { Handle(BlockFix_BlockFixAPI) _anOtherObject; @@ -64,13 +65,13 @@ const Handle(BlockFix_BlockFixAPI) Handle(BlockFix_BlockFixAPI)::DownCast(const return _anOtherObject ; } -const Handle(Standard_Type)& BlockFix_BlockFixAPI::DynamicType() const -{ - return STANDARD_TYPE(BlockFix_BlockFixAPI) ; +const Handle(Standard_Type)& BlockFix_BlockFixAPI::DynamicType() const +{ + return STANDARD_TYPE(BlockFix_BlockFixAPI) ; } -Standard_Boolean BlockFix_BlockFixAPI::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(BlockFix_BlockFixAPI) == AType || MMgt_TShared::IsKind(AType)); +Standard_Boolean BlockFix_BlockFixAPI::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(BlockFix_BlockFixAPI) == AType || MMgt_TShared::IsKind(AType)); } Handle_BlockFix_BlockFixAPI::~Handle_BlockFix_BlockFixAPI() {} diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx index 6dee401ac..945a6ed88 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _ShapeBuild_ReShape_HeaderFile #include #endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx index 883e4fec6..5992e1794 100644 --- a/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx @@ -1,29 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include //======================================================================= -//function : Shape -//purpose : +//function : SetShape +//purpose : //======================================================================= inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape) @@ -33,31 +34,40 @@ inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape) //======================================================================= //function : Shape -//purpose : +//purpose : //======================================================================= inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const { return myShape; } - + //======================================================================= //function : Context -//purpose : +//purpose : //======================================================================= inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context() { return myContext; } - + //======================================================================= //function : Tolerance -//purpose : +//purpose : //======================================================================= inline Standard_Real& BlockFix_BlockFixAPI::Tolerance() { return myTolerance; } - + +//======================================================================= +//function : OptimumNbFaces +//purpose : +//======================================================================= + +inline Standard_Integer& BlockFix_BlockFixAPI::OptimumNbFaces() +{ + return myOptimumNbFaces; +} diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cdl b/src/GEOMAlgo/BlockFix_CheckTool.cdl index 3af730581..c5423377f 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.cdl +++ b/src/GEOMAlgo/BlockFix_CheckTool.cdl @@ -1,32 +1,33 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: BlockFix_CheckTool.cdl -- Created: Fri Dec 17 10:36:58 2004 -- Author: Sergey KUUL - +-- class CheckTool from BlockFix ---Purpose: - + uses Shape from TopoDS, @@ -36,18 +37,18 @@ is Create returns CheckTool from BlockFix; ---Purpose: Empty constructor - + SetShape(me: in out; aShape: Shape from TopoDS); Perform(me: in out); - ---Purpose: - + ---Purpose: + NbPossibleBlocks(me) returns Integer; - + PossibleBlock(me; num: Integer) returns Shape from TopoDS; DumpCheckResult(me; S : in out OStream); - ---Purpose: Dumps results of checking + ---Purpose: Dumps results of checking fields @@ -62,5 +63,5 @@ fields myNbUE : Integer; myNbUFUE : Integer; myBadRanges : Integer; - + end CheckTool; diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cxx b/src/GEOMAlgo/BlockFix_CheckTool.cxx index a5d825255..674ef69dd 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.cxx +++ b/src/GEOMAlgo/BlockFix_CheckTool.cxx @@ -1,33 +1,36 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: BlockFix_CheckTool.cxx -// Created: 17.12.04 11:15:25 -// Author: Sergey KUUL + +// File: BlockFix_CheckTool.cxx +// Created: 17.12.04 11:15:25 +// Author: Sergey KUUL // #include +//#include +//#include + #include -#include -#include + #include #include #include @@ -54,7 +57,7 @@ BlockFix_CheckTool::BlockFix_CheckTool( ) //======================================================================= //function : SetShape -//purpose : +//purpose : //======================================================================= void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape) @@ -67,10 +70,10 @@ void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape) //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= -void BlockFix_CheckTool::Perform() +void BlockFix_CheckTool::Perform() { myNbSolids=0; myNbBlocks=0; @@ -78,33 +81,43 @@ void BlockFix_CheckTool::Perform() myNbUF=0; myNbUE=0; myNbUFUE=0; - TopExp_Explorer exps; - for(exps.Init(myShape, TopAbs_SOLID); exps.More(); exps.Next()) { + + TopExp_Explorer exps (myShape, TopAbs_SOLID); + TopTools_MapOfShape mapS; + for (; exps.More(); exps.Next()) { TopoDS_Solid aSolid = TopoDS::Solid(exps.Current()); + if (!mapS.Add(aSolid)) continue; myNbSolids++; Standard_Boolean IsBlock=Standard_True; Standard_Boolean MayBeUF=Standard_False; Standard_Boolean MayBeUE=Standard_False; Standard_Integer nf=0; - TopExp_Explorer expf; - for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) nf++; + TopExp_Explorer expf (aSolid, TopAbs_FACE); + TopTools_MapOfShape mapF; + for (; expf.More(); expf.Next()) { + if (mapF.Add(expf.Current())) + nf++; + } - if(nf<6) { - IsBlock=Standard_False; + if (nf < 6) { + IsBlock = Standard_False; } - else if(nf>6) { - IsBlock=Standard_False; + else if (nf > 6) { + IsBlock = Standard_False; // check faces unification TopTools_SequenceOfShape faces; - for( expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) { - TopoDS_Face aFace = TopoDS::Face(expf.Current()); - faces.Append(aFace); + mapF.Clear(); + for (expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) { + if (mapF.Add(expf.Current())) { + TopoDS_Face aFace = TopoDS::Face(expf.Current()); + faces.Append(aFace); + } } Standard_Boolean HasFacesForUnification = Standard_False; - for(Standard_Integer i=1; i0 ) { - IsBlock=Standard_False; + if (nbe == 12 && DegenEdges.Extent() > 0) { + IsBlock = Standard_False; myNbDegen++; myPossibleBlocks.Append(aSolid); continue; } - if(nbe<24) - IsBlock=Standard_False; - if(nbe>24) { - IsBlock=Standard_False; + if (nbe < 12) + IsBlock = Standard_False; + if (nbe > 12) { + IsBlock = Standard_False; // check edges unification // creating map of edge faces TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces; TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces); - for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) { + + mapF.Clear(); + for (expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) { TopoDS_Face aFace = TopoDS::Face(expf.Current()); + if (!mapF.Add(aFace)) continue; TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges; - for(expe.Init(aFace,TopAbs_EDGE); expe.More(); expe.Next()) { + + TopTools_MapOfShape mapEe; + for (expe.Init(aFace, TopAbs_EDGE); expe.More(); expe.Next()) { TopoDS_Edge edge = TopoDS::Edge(expe.Current()); - if(!aMapEdgeFaces.Contains(edge)) continue; + if (!mapEe.Add(edge)) continue; + if (!aMapEdgeFaces.Contains(edge)) continue; const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge); - TopTools_ListIteratorOfListOfShape anIter(aList); - for( ; anIter.More(); anIter.Next()) { + TopTools_ListIteratorOfListOfShape anIter (aList); + for (; anIter.More(); anIter.Next()) { TopoDS_Face face = TopoDS::Face(anIter.Value()); - if(face.IsSame(aFace)) continue; - if(aMapFacesEdges.Contains(face)) { + if (face.IsSame(aFace)) continue; + if (aMapFacesEdges.Contains(face)) { aMapFacesEdges.ChangeFromKey(face).Append(edge); } else { @@ -178,34 +197,33 @@ void BlockFix_CheckTool::Perform() } } } - Standard_Integer i=1; - for(; i<=aMapFacesEdges.Extent(); i++) { + Standard_Integer i = 1; + for (; i <= aMapFacesEdges.Extent(); i++) { const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i); - if(ListEdges.Extent()>1) break; + if (ListEdges.Extent() > 1) break; } - if(i<=aMapFacesEdges.Extent()) { - MayBeUE=Standard_True; + if (i <= aMapFacesEdges.Extent()) { + MayBeUE = Standard_True; break; } } } - if(IsBlock) + if (IsBlock) myNbBlocks++; else { - if(MayBeUF) { + if (MayBeUF) { myPossibleBlocks.Append(aSolid); - if(MayBeUE) + if (MayBeUE) myNbUFUE++; else myNbUF++; } - else if(MayBeUE) { + else if (MayBeUE) { myNbUE++; myPossibleBlocks.Append(aSolid); } } - } myHasCheck = Standard_True; @@ -214,7 +232,7 @@ void BlockFix_CheckTool::Perform() //======================================================================= //function : NbPossibleBlocks -//purpose : +//purpose : //======================================================================= Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const @@ -225,13 +243,13 @@ Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const //======================================================================= //function : PossibleBlock -//purpose : +//purpose : //======================================================================= TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const { TopoDS_Shape res; - if( num>0 && num<=myPossibleBlocks.Length() ) + if( num>0 && num<=myPossibleBlocks.Length() ) res = myPossibleBlocks.Value(num); return res; } @@ -239,7 +257,7 @@ TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const //======================================================================= //function : DumpCheckResult -//purpose : +//purpose : //======================================================================= void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const diff --git a/src/GEOMAlgo/BlockFix_CheckTool.hxx b/src/GEOMAlgo/BlockFix_CheckTool.hxx index 89c32a9fc..652319e42 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.hxx +++ b/src/GEOMAlgo/BlockFix_CheckTool.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _BlockFix_CheckTool_HeaderFile #define _BlockFix_CheckTool_HeaderFile @@ -51,20 +52,20 @@ class BlockFix_CheckTool { public: - void* operator new(size_t,void* anAddress) + void* operator new(size_t,void* anAddress) { return anAddress; } - void* operator new(size_t size) - { - return Standard::Allocate(size); + void* operator new(size_t size) + { + return Standard::Allocate(size); } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } // Methods PUBLIC - // + // Standard_EXPORT BlockFix_CheckTool(); Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ; Standard_EXPORT void Perform() ; @@ -79,17 +80,17 @@ Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const; protected: // Methods PROTECTED - // + // // Fields PROTECTED // -private: +private: // Methods PRIVATE - // + // // Fields PRIVATE diff --git a/src/GEOMAlgo/BlockFix_CheckTool.ixx b/src/GEOMAlgo/BlockFix_CheckTool.ixx index a0af6be71..d44f98056 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.ixx +++ b/src/GEOMAlgo/BlockFix_CheckTool.ixx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include - + diff --git a/src/GEOMAlgo/BlockFix_CheckTool.jxx b/src/GEOMAlgo/BlockFix_CheckTool.jxx index 017d344ba..7574af057 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.jxx +++ b/src/GEOMAlgo/BlockFix_CheckTool.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _TopoDS_Shape_HeaderFile #include #endif diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl index 06eedfc9f..374af919c 100644 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl +++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl @@ -1,33 +1,35 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +-- + -- File: BlockFix_PeriodicSurfaceModifier.cdl -- Created: Wed Dec 15 10:03:50 2004 -- Author: Sergey KUUL +-- +class PeriodicSurfaceModifier from BlockFix inherits Modification from BRepTools -class PeriodicSurfaceModifier from BlockFix inherits Modification from BRepTools - - ---Purpose: + ---Purpose: uses - Vertex from TopoDS, + Vertex from TopoDS, Edge from TopoDS, Face from TopoDS, Location from TopLoc, @@ -40,9 +42,9 @@ uses DataMapOfShapeInteger from TopTools is - + Create returns mutable PeriodicSurfaceModifier from BlockFix; - + SetTolerance(me: mutable; Toler: Real); ---Purpose: Sets the tolerance for recognition of geometry @@ -59,7 +61,7 @@ is -- the new tolerance. Otherwise, returns -- Standard_False, and , , are not -- significant. - + NewCurve(me: mutable; E : Edge from TopoDS; C : out Curve from Geom; L : out Location from TopLoc; @@ -93,10 +95,10 @@ is -- curve on surface on the face .In this case, -- is the new geometric support of the edge, the -- new location, the new tolerance. - -- + -- -- Otherwise, returns Standard_False, and , , -- are not significant. - -- + -- -- is the new edge created from . -- is the new face created from . They may be usefull. @@ -118,14 +120,14 @@ is returns Shape from GeomAbs; ---Purpose: Returns the continuity of between -- and . - -- + -- -- is the new edge created from . -- (resp. ) is the new face created from -- (resp. ). - -fields - + +fields + myTolerance : Real; myMapOfFaces : DataMapOfShapeInteger from TopTools; myMapOfSurfaces: IndexedMapOfTransient from TColStd; diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx index 5e523b68a..1e9f33ca0 100644 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx +++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: BlockFix_PeriodicSurfaceModifier.cxx // Created: 15.12.04 10:08:50 // Author: Sergey KUUL -// + #include #include @@ -48,7 +49,7 @@ BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier ( ) //======================================================================= //function : SetTolerance -//purpose : +//purpose : //======================================================================= void BlockFix_PeriodicSurfaceModifier::SetTolerance(const Standard_Real Tol) @@ -69,11 +70,11 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, Handle(Geom_Surface) S = aSurface; if(S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { - Handle(Geom_CylindricalSurface) aCyl = + Handle(Geom_CylindricalSurface) aCyl = Handle(Geom_CylindricalSurface)::DownCast(S); Standard_Real Umin, Umax, Vmin, Vmax; BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax); - if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) { + if (Umin < -Precision::PConfusion() || Umax > 2*M_PI + Precision::PConfusion()) { gp_Ax3 ax3 = aCyl->Position(); gp_Ax1 NDir = ax3.Axis(); gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion()); @@ -83,12 +84,12 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, return Standard_True; } } - + if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) { Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S); Standard_Real Umin, Umax, Vmin, Vmax; BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax); - if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) { + if (Umin < -Precision::PConfusion() || Umax > 2*M_PI + Precision::PConfusion()) { gp_Ax3 ax3 = aSphere->Position(); gp_Ax1 NDir = ax3.Axis(); gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion()); @@ -100,30 +101,30 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, return Standard_False; } - + //======================================================================= //function : NewSurface -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L,Standard_Real& Tol, Standard_Boolean& RevWires, - Standard_Boolean& RevFace) + Standard_Boolean& RevFace) { TopLoc_Location LS; Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS); - + if(ModifySurface(F, SIni, S)) { - + RevWires = Standard_False; RevFace = Standard_False; - + L = LS; Tol = BRep_Tool::Tolerance(F); - + Standard_Integer anIndex = myMapOfSurfaces.Add(S); myMapOfFaces.Bind(F,anIndex); return Standard_True; @@ -135,13 +136,13 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& //======================================================================= //function : NewCurve -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& /*E*/, Handle(Geom_Curve)& /*C*/, TopLoc_Location& /*L*/, - Standard_Real& /*Tol*/) + Standard_Real& /*Tol*/) { return Standard_False; } @@ -149,12 +150,12 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& / //======================================================================= //function : NewPoint -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& /*V*/, gp_Pnt& /*P*/, - Standard_Real& /*Tol*/) + Standard_Real& /*Tol*/) { return Standard_False; } @@ -162,7 +163,7 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& //======================================================================= //function : NewCurve2d -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& E, @@ -170,47 +171,47 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& const TopoDS_Edge& /*NewE*/, const TopoDS_Face& /*NewF*/, Handle(Geom2d_Curve)& C, - Standard_Real& Tol) + Standard_Real& Tol) { //check if undelying surface of the face was modified if(myMapOfFaces.IsBound(F)) { Standard_Integer anIndex = myMapOfFaces.Find(F); - + Handle(Geom_Surface) aNewSurf = Handle(Geom_Surface)::DownCast(myMapOfSurfaces.FindKey(anIndex)); - + Standard_Real f,l; TopLoc_Location LC, LS; Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l ); Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS); - + //taking into accound the orientation of the seam C = BRep_Tool::CurveOnSurface(E,F,f,l); Tol = BRep_Tool::Tolerance(E); - + BRep_Builder B; TopoDS_Edge TempE; B.MakeEdge(TempE); B.Add(TempE, TopExp::FirstVertex(E)); B.Add(TempE, TopExp::LastVertex(E)); - if(!C3d.IsNull()) + if(!C3d.IsNull()) B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion()); B.Range(TempE, f, l); - + Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge; Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(LS.Transformation())); TopLoc_Location LTemp; LTemp.Identity(); - + Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F); Standard_Real aWorkTol = 2*myTolerance+Tol; sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol)); sfe->FixSameParameter(TempE); - + //keep the orientation of original edge TempE.Orientation(E.Orientation()); C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l); - + //surface was modified return Standard_True; } @@ -221,13 +222,13 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& //======================================================================= //function : NewParameter -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Vertex& /*V*/, const TopoDS_Edge& /*E*/, Standard_Real& /*P*/, - Standard_Real& /*Tol*/) + Standard_Real& /*Tol*/) { return Standard_False; } @@ -235,7 +236,7 @@ Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Ver //======================================================================= //function : Continuity -//purpose : +//purpose : //======================================================================= GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E, @@ -243,7 +244,7 @@ GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E, const TopoDS_Face& F2, const TopoDS_Edge& /*NewE*/, const TopoDS_Face& /*NewF1*/, - const TopoDS_Face& /*NewF2*/) + const TopoDS_Face& /*NewF2*/) { return BRep_Tool::Continuity(E,F1,F2); } diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx index 248723046..39d2062ea 100644 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx +++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile #define _BlockFix_PeriodicSurfaceModifier_HeaderFile @@ -70,20 +71,20 @@ class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification { public: - void* operator new(size_t,void* anAddress) + void* operator new(size_t,void* anAddress) { return anAddress; } - void* operator new(size_t size) - { - return Standard::Allocate(size); + void* operator new(size_t size) + { + return Standard::Allocate(size); } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } // Methods PUBLIC - // + // Standard_EXPORT BlockFix_PeriodicSurfaceModifier(); Standard_EXPORT void SetTolerance(const Standard_Real Toler) ; Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ; @@ -101,22 +102,22 @@ Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier(); // Standard_EXPORT friend Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_(); Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; protected: // Methods PROTECTED - // + // // Fields PROTECTED // -private: +private: // Methods PRIVATE - // + // // Fields PRIVATE diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx index 5ab8be7b8..da3bdc95e 100644 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx +++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #ifndef _Standard_TypeMismatch_HeaderFile @@ -26,7 +27,7 @@ #endif BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier() {} - + Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_() @@ -38,14 +39,14 @@ Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_() if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("BlockFix_PeriodicSurfaceModifier", - sizeof(BlockFix_PeriodicSurfaceModifier), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(BlockFix_PeriodicSurfaceModifier), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -54,7 +55,7 @@ Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_() // DownCast method // allow safe downcasting // -const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject) +const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject) { Handle(BlockFix_PeriodicSurfaceModifier) _anOtherObject; @@ -66,13 +67,13 @@ const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceMo return _anOtherObject ; } -const Handle(Standard_Type)& BlockFix_PeriodicSurfaceModifier::DynamicType() const -{ - return STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) ; +const Handle(Standard_Type)& BlockFix_PeriodicSurfaceModifier::DynamicType() const +{ + return STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) ; } -Standard_Boolean BlockFix_PeriodicSurfaceModifier::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) == AType || BRepTools_Modification::IsKind(AType)); +Standard_Boolean BlockFix_PeriodicSurfaceModifier::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) == AType || BRepTools_Modification::IsKind(AType)); } Handle_BlockFix_PeriodicSurfaceModifier::~Handle_BlockFix_PeriodicSurfaceModifier() {} diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx index 72b3e9684..29c1c1e34 100644 --- a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx +++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _TopoDS_Face_HeaderFile #include #endif diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl index 157ee2e1e..da614611b 100644 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl +++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl @@ -1,36 +1,36 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: BlockFix_SphereSpaceModifier.cdl -- Created: Tue Dec 7 12:01:49 2004 -- Author: Pavel Durandin - - -class SphereSpaceModifier from BlockFix inherits Modification from BRepTools +-- +class SphereSpaceModifier from BlockFix inherits Modification from BRepTools ---Purpose: Rotation of the parametric space of the sphere in order -- to avoid the seam and degenerared edge within it uses - Vertex from TopoDS, + Vertex from TopoDS, Edge from TopoDS, Face from TopoDS, Location from TopLoc, @@ -43,9 +43,9 @@ uses DataMapOfShapeInteger from TopTools is - + Create returns mutable SphereSpaceModifier from BlockFix; - + SetTolerance(me: mutable; Toler: Real); ---Purpose: Sets the tolerance for recognition of geometry @@ -62,7 +62,7 @@ is -- the new tolerance. Otherwise, returns -- Standard_False, and , , are not -- significant. - + NewCurve(me: mutable; E : Edge from TopoDS; C : out Curve from Geom; L : out Location from TopLoc; @@ -96,10 +96,10 @@ is -- curve on surface on the face .In this case, -- is the new geometric support of the edge, the -- new location, the new tolerance. - -- + -- -- Otherwise, returns Standard_False, and , , -- are not significant. - -- + -- -- is the new edge created from . -- is the new face created from . They may be usefull. @@ -121,15 +121,15 @@ is returns Shape from GeomAbs; ---Purpose: Returns the continuity of between -- and . - -- + -- -- is the new edge created from . -- (resp. ) is the new face created from -- (resp. ). - + ForRotation(me: mutable; F: Face from TopoDS) returns Boolean; - -fields - + +fields + myTolerance : Real; myMapOfFaces : DataMapOfShapeInteger from TopTools; myMapOfSpheres: IndexedMapOfTransient from TColStd; diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx index a66e7b242..9e2db755a 100644 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx +++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: BlockFix.cxx -// Created: Tue Dec 7 11:59:05 2004 -// Author: Pavel DURANDIN +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: BlockFix.cxx +// Created: Tue Dec 7 11:59:05 2004 +// Author: Pavel DURANDIN + #include #include @@ -43,7 +44,7 @@ //======================================================================= //function : BlockFix_SphereSpaceModifier -//purpose : +//purpose : //======================================================================= BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier() @@ -54,7 +55,7 @@ BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier() //======================================================================= //function : SetTolerance -//purpose : +//purpose : //======================================================================= void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol) @@ -65,7 +66,7 @@ void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol) //======================================================================= //function : NewSurface -//purpose : +//purpose : //======================================================================= @@ -75,15 +76,15 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, { Handle(Geom_Surface) S = aSurface; if(S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - Handle(Geom_RectangularTrimmedSurface) RTS = + Handle(Geom_RectangularTrimmedSurface) RTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(S); S = RTS->BasisSurface(); } - + if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) { Standard_Real Umin, Umax, Vmin, Vmax; ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax); - Standard_Real PI2 = PI/2.; + Standard_Real PI2 = M_PI/2.; if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) { Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S); gp_Sphere sp = aSphere->Sphere(); @@ -118,109 +119,109 @@ static Standard_Boolean ModifySurface(const TopoDS_Face& aFace, } return Standard_False; } - + Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L,Standard_Real& Tol, Standard_Boolean& RevWires, - Standard_Boolean& RevFace) + Standard_Boolean& RevFace) { TopLoc_Location LS; Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS); - + //check if pole of the sphere in the parametric space if(ModifySurface(F, SIni, S)) { - + RevWires = Standard_False; RevFace = Standard_False; - + L = LS; Tol = BRep_Tool::Tolerance(F); - + Standard_Integer anIndex = myMapOfSpheres.Add(S); myMapOfFaces.Bind(F,anIndex); return Standard_True; } - + return Standard_False; } //======================================================================= //function : NewCurve -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/,Handle(Geom_Curve)& /*C*/, - TopLoc_Location& /*L*/,Standard_Real& /*Tol*/) + TopLoc_Location& /*L*/,Standard_Real& /*Tol*/) { return Standard_False; } //======================================================================= //function : NewPoint -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V*/, gp_Pnt& /*P*/, - Standard_Real& /*Tol*/) + Standard_Real& /*Tol*/) { return Standard_False; } //======================================================================= //function : NewCurve2d -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F, const TopoDS_Edge& /*NewE*/,const TopoDS_Face& /*NewF*/, - Handle(Geom2d_Curve)& C,Standard_Real& Tol) + Handle(Geom2d_Curve)& C,Standard_Real& Tol) { //check if undelying surface of the face was modified if(myMapOfFaces.IsBound(F)) { Standard_Integer anIndex = myMapOfFaces.Find(F); - + Handle(Geom_Surface) aNewSphere = Handle(Geom_Surface)::DownCast(myMapOfSpheres.FindKey(anIndex)); - + Standard_Real f,l; TopLoc_Location LC, LS; Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l ); Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS); - + //taking into accound the orientation of the seam C = BRep_Tool::CurveOnSurface(E,F,f,l); Tol = BRep_Tool::Tolerance(E); - + BRep_Builder B; TopoDS_Edge TempE; B.MakeEdge(TempE); B.Add(TempE, TopExp::FirstVertex(E)); B.Add(TempE, TopExp::LastVertex(E)); - if(!C3d.IsNull()) + if(!C3d.IsNull()) B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion()); B.Range(TempE, f, l); - + Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge; Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSphere->Transformed(LS.Transformation())); TopLoc_Location LTemp; LTemp.Identity(); - + Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F); Standard_Real aWorkTol = 2*myTolerance+Tol; sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol)); sfe->FixSameParameter(TempE); - + //keep the orientation of original edge TempE.Orientation(E.Orientation()); C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l); - + // shifting seam of sphere if(isClosed && !C.IsNull()) { Standard_Real f2,l2; - Handle(Geom2d_Curve) c22 = + Handle(Geom2d_Curve) c22 = BRep_Tool::CurveOnSurface(TopoDS::Edge(TempE.Reversed()),STemp, LTemp,f2,l2); Standard_Real dPreci = Precision::PConfusion()*Precision::PConfusion(); if((C->Value(f).SquareDistance(c22->Value(f2)) < dPreci) @@ -239,11 +240,11 @@ Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,c //======================================================================= //function : NewParameter -//purpose : +//purpose : //======================================================================= Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,const TopoDS_Edge& /*E*/, - Standard_Real& /*P*/,Standard_Real& /*Tol*/) + Standard_Real& /*P*/,Standard_Real& /*Tol*/) { return Standard_False; } @@ -251,12 +252,12 @@ Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& //======================================================================= //function : Continuity -//purpose : +//purpose : //======================================================================= GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1, const TopoDS_Face& F2,const TopoDS_Edge& /*NewE*/, - const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/) + const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/) { return BRep_Tool::Continuity(E,F1,F2); } diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx index acdb3bda8..fb11fdbae 100644 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx +++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _BlockFix_SphereSpaceModifier_HeaderFile #define _BlockFix_SphereSpaceModifier_HeaderFile @@ -70,20 +71,20 @@ class BlockFix_SphereSpaceModifier : public BRepTools_Modification { public: - void* operator new(size_t,void* anAddress) + void* operator new(size_t,void* anAddress) { return anAddress; } - void* operator new(size_t size) - { - return Standard::Allocate(size); + void* operator new(size_t size) + { + return Standard::Allocate(size); } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } // Methods PUBLIC - // + // Standard_EXPORT BlockFix_SphereSpaceModifier(); Standard_EXPORT void SetTolerance(const Standard_Real Toler) ; Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ; @@ -102,22 +103,22 @@ Standard_EXPORT ~BlockFix_SphereSpaceModifier(); // Standard_EXPORT friend Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_(); Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; protected: // Methods PROTECTED - // + // // Fields PROTECTED // -private: +private: // Methods PRIVATE - // + // // Fields PRIVATE diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx index 31ea8a258..482241f6d 100644 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx +++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #ifndef _Standard_TypeMismatch_HeaderFile @@ -26,7 +27,7 @@ #endif BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {} - + Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_() @@ -38,14 +39,14 @@ Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_() if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("BlockFix_SphereSpaceModifier", - sizeof(BlockFix_SphereSpaceModifier), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(BlockFix_SphereSpaceModifier), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -54,7 +55,7 @@ Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_() // DownCast method // allow safe downcasting // -const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject) +const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject) { Handle(BlockFix_SphereSpaceModifier) _anOtherObject; @@ -66,13 +67,13 @@ const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier): return _anOtherObject ; } -const Handle(Standard_Type)& BlockFix_SphereSpaceModifier::DynamicType() const -{ - return STANDARD_TYPE(BlockFix_SphereSpaceModifier) ; +const Handle(Standard_Type)& BlockFix_SphereSpaceModifier::DynamicType() const +{ + return STANDARD_TYPE(BlockFix_SphereSpaceModifier) ; } -Standard_Boolean BlockFix_SphereSpaceModifier::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(BlockFix_SphereSpaceModifier) == AType || BRepTools_Modification::IsKind(AType)); +Standard_Boolean BlockFix_SphereSpaceModifier::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(BlockFix_SphereSpaceModifier) == AType || BRepTools_Modification::IsKind(AType)); } Handle_BlockFix_SphereSpaceModifier::~Handle_BlockFix_SphereSpaceModifier() {} diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx index 1b3792c56..050734179 100644 --- a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx +++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _TopoDS_Face_HeaderFile #include #endif diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.cdl b/src/GEOMAlgo/BlockFix_UnionEdges.cdl index c943a6cfc..05a9f3870 100644 --- a/src/GEOMAlgo/BlockFix_UnionEdges.cdl +++ b/src/GEOMAlgo/BlockFix_UnionEdges.cdl @@ -1,48 +1,49 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: BlockFix_UnionEdges.cdl -- Created: Tue Dec 7 15:24:51 2004 -- Author: Sergey KUUL - +-- class UnionEdges from BlockFix - ---Purpose: - + ---Purpose: + uses - + Shape from TopoDS, ReShape from ShapeBuild is Create returns UnionEdges from BlockFix; - + Perform(me: in out; Shape: Shape from TopoDS; Tol : Real) - returns Shape from TopoDS; - + returns Shape from TopoDS; + fields myTolerance : Real; myContext : ReShape from ShapeBuild; - + end UnionEdges; diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.cxx b/src/GEOMAlgo/BlockFix_UnionEdges.cxx index 4ac917101..95a1a713e 100644 --- a/src/GEOMAlgo/BlockFix_UnionEdges.cxx +++ b/src/GEOMAlgo/BlockFix_UnionEdges.cxx @@ -1,54 +1,55 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 + // File: BlockFix_UnionEdges.cxx // Created: 07.12.04 15:27:30 // Author: Sergey KUUL -// + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include + #include #include #include -#include -#include + +#include +#include +#include +#include +#include +#include +#include +#include + #include #include + #include #include #include #include #include #include + #include #include #include @@ -57,17 +58,206 @@ #include #include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "utilities.h" //======================================================================= //function : BlockFix_UnionEdges() //purpose : Constructor //======================================================================= - BlockFix_UnionEdges::BlockFix_UnionEdges ( ) { } +//======================================================================= +//function : GlueEdgesWithPCurves +//purpose : Glues the pcurves of the sequence of edges +// and glues their 3d curves +//======================================================================= +static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain, + const TopoDS_Vertex& FirstVertex, + const TopoDS_Vertex& LastVertex) +{ + Standard_Integer i, j; + + TopoDS_Edge FirstEdge = TopoDS::Edge(aChain(1)); + //TColGeom2d_SequenceOfCurve PCurveSeq; + TColGeom_SequenceOfSurface SurfSeq; + //TopTools_SequenceOfShape LocSeq; + + BRep_ListIteratorOfListOfCurveRepresentation itr( (Handle(BRep_TEdge)::DownCast(FirstEdge.TShape()))->Curves() ); + for (; itr.More(); itr.Next()) + { + Handle(BRep_CurveRepresentation) CurveRep = itr.Value(); + if (CurveRep->IsCurveOnSurface()) + { + //PCurveSeq.Append(CurveRep->PCurve()); + SurfSeq.Append(CurveRep->Surface()); + /* + TopoDS_Shape aLocShape; + aLocShape.Location(CurveRep->Location()); + LocSeq.Append(aLocShape); + */ + } + } + + Standard_Real fpar, lpar; + BRep_Tool::Range(FirstEdge, fpar, lpar); + TopoDS_Edge PrevEdge = FirstEdge; + TopoDS_Vertex CV; + Standard_Real MaxTol = 0.; + + TopoDS_Edge ResEdge; + BRep_Builder BB; + + Standard_Integer nb_curve = aChain.Length(); //number of curves + TColGeom_Array1OfBSplineCurve tab_c3d(0,nb_curve-1); //array of the curves + TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2); //array of the tolerances + + TopoDS_Vertex PrevVertex = FirstVertex; + for (i = 1; i <= nb_curve; i++) + { + TopoDS_Edge anEdge = TopoDS::Edge(aChain(i)); + TopoDS_Vertex VF, VL; + TopExp::Vertices(anEdge, VF, VL); + Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex)); + + Standard_Real Tol1 = BRep_Tool::Tolerance(VF); + Standard_Real Tol2 = BRep_Tool::Tolerance(VL); + if (Tol1 > MaxTol) + MaxTol = Tol1; + if (Tol2 > MaxTol) + MaxTol = Tol2; + + if (i > 1) + { + TopExp::CommonVertex(PrevEdge, anEdge, CV); + Standard_Real Tol = BRep_Tool::Tolerance(CV); + tabtolvertex(i-2) = Tol; + } + + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar); + Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, fpar, lpar); + tab_c3d(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve); + GeomConvert::C0BSplineToC1BSplineCurve(tab_c3d(i-1), Precision::Confusion()); + if (ToReverse) + tab_c3d(i-1)->Reverse(); + PrevVertex = (ToReverse)? VF : VL; + PrevEdge = anEdge; + } + Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves + Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex + GeomConvert::ConcatC1(tab_c3d, + tabtolvertex, + ArrayOfIndices, + concatcurve, + Standard_False, + Precision::Confusion()); //C1 concatenation + + if (concatcurve->Length() > 1) + { + GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower())); + + for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++) + Concat.Add( concatcurve->Value(i), MaxTol, Standard_True ); + + concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve()); + } + Handle(Geom_BSplineCurve) ResCurve = concatcurve->Value(concatcurve->Lower()); + + TColGeom2d_SequenceOfBoundedCurve ResPCurves; + TopLoc_Location aLoc; + for (j = 1; j <= SurfSeq.Length(); j++) + { + TColGeom2d_Array1OfBSplineCurve tab_c2d(0,nb_curve-1); //array of the pcurves + + PrevVertex = FirstVertex; + PrevEdge = FirstEdge; + //TopLoc_Location theLoc = LocSeq(j).Location(); + for (i = 1; i <= nb_curve; i++) + { + TopoDS_Edge anEdge = TopoDS::Edge(aChain(i)); + TopoDS_Vertex VF, VL; + TopExp::Vertices(anEdge, VF, VL); + Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex)); + + /* + Handle(Geom2d_Curve) aPCurve = + BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), anEdge.Location()*theLoc, fpar, lpar); + */ + Handle(Geom2d_Curve) aPCurve = + BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), aLoc, fpar, lpar); + Handle(Geom2d_TrimmedCurve) aTrPCurve = new Geom2d_TrimmedCurve(aPCurve, fpar, lpar); + tab_c2d(i-1) = Geom2dConvert::CurveToBSplineCurve(aTrPCurve); + Geom2dConvert::C0BSplineToC1BSplineCurve(tab_c2d(i-1), Precision::Confusion()); + if (ToReverse) + tab_c2d(i-1)->Reverse(); + PrevVertex = (ToReverse)? VF : VL; + PrevEdge = anEdge; + } + Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves + Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex + Geom2dConvert::ConcatC1(tab_c2d, + tabtolvertex, + ArrayOfInd2d, + concatc2d, + Standard_False, + Precision::Confusion()); //C1 concatenation + + if (concatc2d->Length() > 1) + { + Geom2dConvert_CompCurveToBSplineCurve Concat2d(concatc2d->Value(concatc2d->Lower())); + + for (i = concatc2d->Lower()+1; i <= concatc2d->Upper(); i++) + Concat2d.Add( concatc2d->Value(i), MaxTol, Standard_True ); + + concatc2d->SetValue(concatc2d->Lower(), Concat2d.BSplineCurve()); + } + Handle(Geom2d_BSplineCurve) aResPCurve = concatc2d->Value(concatc2d->Lower()); + ResPCurves.Append(aResPCurve); + } + + ResEdge = BRepLib_MakeEdge(ResCurve, + FirstVertex, LastVertex, + ResCurve->FirstParameter(), ResCurve->LastParameter()); + BB.SameRange(ResEdge, Standard_False); + BB.SameParameter(ResEdge, Standard_False); + for (j = 1; j <= ResPCurves.Length(); j++) + { + BB.UpdateEdge(ResEdge, ResPCurves(j), SurfSeq(j), aLoc, MaxTol); + BB.Range(ResEdge, SurfSeq(j), aLoc, ResPCurves(j)->FirstParameter(), ResPCurves(j)->LastParameter()); + } + + BRepLib::SameParameter(ResEdge, MaxTol, Standard_True); + + return ResEdge; +} //======================================================================= //function : MergeEdges @@ -141,7 +331,11 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges, Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2); gp_Dir Dir1 = L1->Position().Direction(); gp_Dir Dir2 = L2->Position().Direction(); - if(!Dir1.IsEqual(Dir2,Precision::Angular())) continue; + //if(!Dir1.IsEqual(Dir2,Precision::Angular())) { + //if(!Dir1.IsParallel(Dir2,Precision::Angular())) { + if(!Dir1.IsParallel(Dir2,Tol)) { + continue; + } // can union lines => create new edge TopoDS_Vertex V1 = sae.FirstVertex(edge1); gp_Pnt PV1 = BRep_Tool::Pnt(V1); @@ -156,9 +350,9 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges, B.Add (E,V1); B.Add (E,V2); B.UpdateVertex(V1, 0., E, 0.); B.UpdateVertex(V2, dist, E, 0.); - ShapeFix_Edge sfe; - sfe.FixAddPCurve(E,aFace,Standard_False); - sfe.FixSameParameter(E); + //ShapeFix_Edge sfe; + //sfe.FixAddPCurve(E,aFace,Standard_False); + //sfe.FixSameParameter(E); aChain.Remove(j); aChain.SetValue(j,E); j--; @@ -169,7 +363,7 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges, Handle(Geom_Circle) C2 = Handle(Geom_Circle)::DownCast(c3d2); gp_Pnt P01 = C1->Location(); gp_Pnt P02 = C2->Location(); - if(P01.Distance(P02)>Precision::Confusion()) continue; + if (P01.Distance(P02) > Precision::Confusion()) continue; // can union circles => create new edge TopoDS_Vertex V1 = sae.FirstVertex(edge1); gp_Pnt PV1 = BRep_Tool::Pnt(V1); @@ -177,32 +371,56 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges, gp_Pnt PV2 = BRep_Tool::Pnt(V2); TopoDS_Vertex VM = sae.LastVertex(edge1); gp_Pnt PVM = BRep_Tool::Pnt(VM); - GC_MakeCircle MC(PV1,PVM,PV2); + GC_MakeCircle MC (PV1,PVM,PV2); Handle(Geom_Circle) C = MC.Value(); - gp_Pnt P0 = C->Location(); - gp_Dir D1(gp_Vec(P0,PV1)); - gp_Dir D2(gp_Vec(P0,PV2)); - Standard_Real fpar = C->XAxis().Direction().Angle(D1); - Standard_Real lpar = C->XAxis().Direction().Angle(D2); - Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar); TopoDS_Edge E; - B.MakeEdge (E,tc,Precision::Confusion()); - B.Add (E,V1); B.Add (E,V2); - B.UpdateVertex(V1, fpar, E, 0.); - B.UpdateVertex(V2, lpar, E, 0.); - ShapeFix_Edge sfe; - sfe.FixAddPCurve(E,aFace,Standard_False); - sfe.FixSameParameter(E); + if (!MC.IsDone() || C.IsNull()) { + // jfa for Mantis issue 0020228 + if (PV1.Distance(PV2) > Precision::Confusion()) continue; + // closed chain + C = C1; + B.MakeEdge (E,C,Precision::Confusion()); + B.Add(E,V1); + B.Add(E,V2); + } + else { + gp_Pnt P0 = C->Location(); + gp_Dir D1(gp_Vec(P0,PV1)); + gp_Dir D2(gp_Vec(P0,PV2)); + Standard_Real fpar = C->XAxis().Direction().Angle(D1); + if(fabs(fpar)>Precision::Confusion()) { + // check orientation + gp_Dir ND = C->XAxis().Direction().Crossed(D1); + if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) { + fpar = -fpar; + } + } + Standard_Real lpar = C->XAxis().Direction().Angle(D2); + if(fabs(lpar)>Precision::Confusion()) { + // check orientation + gp_Dir ND = C->XAxis().Direction().Crossed(D2); + if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) { + lpar = -lpar; + } + } + if (lpar < fpar) lpar += 2*M_PI; + Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar); + B.MakeEdge (E,tc,Precision::Confusion()); + B.Add(E,V1); + B.Add(E,V2); + B.UpdateVertex(V1, fpar, E, 0.); + B.UpdateVertex(V2, lpar, E, 0.); + } aChain.Remove(j); aChain.SetValue(j,E); j--; } } - if(j1) { + if (aChain.Length() > 1) { // second step: union edges with various curves // skl for bug 0020052 from Mantis: perform such unions // only if curves are bspline or bezier @@ -223,6 +441,8 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges, } if(NeedUnion) { MESSAGE ("can not make analitical union => make approximation"); + TopoDS_Edge E = GlueEdgesWithPCurves(aChain, VF, VL); + /* TopoDS_Wire W; B.MakeWire(W); for(j=1; j<=aChain.Length(); j++) { @@ -236,6 +456,7 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges, B.MakeEdge (E,bc,Precision::Confusion()); B.Add (E,VF); B.Add (E,VL); + */ aChain.SetValue(1,E); } else { @@ -248,51 +469,55 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges, return Standard_True; } - //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= - TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape, const Standard_Real Tol) { myContext = new ShapeBuild_ReShape; myTolerance = Tol; TopoDS_Shape aResult = myContext->Apply(Shape); - + // processing each solid - TopExp_Explorer exps; - for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) { - TopoDS_Solid aSolid = TopoDS::Solid(exps.Current()); + TopAbs_ShapeEnum aType = TopAbs_SOLID; + TopExp_Explorer exps (Shape, aType); + if (!exps.More()) { + aType = TopAbs_SHELL; + exps.Init(Shape, aType); + } + for (; exps.More(); exps.Next()) { + //TopoDS_Solid aSolid = TopoDS::Solid(exps.Current()); + TopoDS_Shape aSolid = exps.Current(); TopTools_IndexedMapOfShape ChangedFaces; - + // creating map of edge faces TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces; TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces); - + Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape; TopoDS_Shape aRes = aSolid; aRes = aContext->Apply(aSolid); // processing each face TopExp_Explorer exp; - for(exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) { + for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) { TopoDS_Face aFace = TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD))); TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges; - for(TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) { + for (TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) { TopoDS_Edge edge = TopoDS::Edge(expe.Current()); - if(!aMapEdgeFaces.Contains(edge)) continue; + if (!aMapEdgeFaces.Contains(edge)) continue; const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge); TopTools_ListIteratorOfListOfShape anIter(aList); - for( ; anIter.More(); anIter.Next()) { + for ( ; anIter.More(); anIter.Next()) { TopoDS_Face face = TopoDS::Face(anIter.Value()); TopoDS_Face face1 = TopoDS::Face(aContext->Apply(anIter.Value())); - if(face1.IsSame(aFace)) continue; - if(aMapFacesEdges.Contains(face)) { + if (face1.IsSame(aFace)) continue; + if (aMapFacesEdges.Contains(face)) { aMapFacesEdges.ChangeFromKey(face).Append(edge); } else { @@ -302,36 +527,36 @@ TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape, } } } - - for(Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) { + + for (Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) { const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i); TopTools_SequenceOfShape SeqEdges; TopTools_ListIteratorOfListOfShape anIter(ListEdges); - for( ; anIter.More(); anIter.Next()) { + for ( ; anIter.More(); anIter.Next()) { SeqEdges.Append(anIter.Value()); } - if(SeqEdges.Length()==1) continue; + if (SeqEdges.Length()==1) continue; TopoDS_Edge E; - if( MergeEdges(SeqEdges,aFace,Tol,E) ) { + if ( MergeEdges(SeqEdges,aFace,Tol,E) ) { // now we have only one edge - aChain.Value(1) // we have to replace old ListEdges with this new edge aContext->Replace(SeqEdges(1),E); - for(Standard_Integer j=2; j<=SeqEdges.Length(); j++) { + for (Standard_Integer j=2; j<=SeqEdges.Length(); j++) { aContext->Remove(SeqEdges(j)); } TopoDS_Face tmpF = TopoDS::Face(exp.Current()); - if( !ChangedFaces.Contains(tmpF) ) + if ( !ChangedFaces.Contains(tmpF) ) ChangedFaces.Add(tmpF); tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i)); - if( !ChangedFaces.Contains(tmpF) ) + if ( !ChangedFaces.Contains(tmpF) ) ChangedFaces.Add(tmpF); } } - + } // end processing each face - + // fix changed faces and replace them in the local context - for(Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) { + for (Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) { TopoDS_Face aFace = TopoDS::Face(aContext->Apply(ChangedFaces.FindKey(i))); Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace); sff->SetContext(myContext); @@ -342,11 +567,11 @@ TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape, aContext->Replace(aFace,sff->Face()); } - if(ChangedFaces.Extent()>0) { + if (ChangedFaces.Extent() > 0) { // fix changed shell and replace it in the local context TopoDS_Shape aRes1 = aContext->Apply(aRes); TopExp_Explorer expsh; - for(expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) { + for (expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) { TopoDS_Shell aShell = TopoDS::Shell(expsh.Current()); Handle(ShapeFix_Shell) sfsh = new ShapeFix_Shell; sfsh->FixFaceOrientation(aShell); diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.hxx b/src/GEOMAlgo/BlockFix_UnionEdges.hxx index 0c0bb19dd..b38e941fb 100644 --- a/src/GEOMAlgo/BlockFix_UnionEdges.hxx +++ b/src/GEOMAlgo/BlockFix_UnionEdges.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _BlockFix_UnionEdges_HeaderFile #define _BlockFix_UnionEdges_HeaderFile @@ -43,20 +44,20 @@ class BlockFix_UnionEdges { public: - void* operator new(size_t,void* anAddress) + void* operator new(size_t,void* anAddress) { return anAddress; } - void* operator new(size_t size) - { - return Standard::Allocate(size); + void* operator new(size_t size) + { + return Standard::Allocate(size); } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } // Methods PUBLIC - // + // Standard_EXPORT BlockFix_UnionEdges(); Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape,const Standard_Real Tol) ; @@ -67,17 +68,17 @@ Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape,const Standard_ protected: // Methods PROTECTED - // + // // Fields PROTECTED // -private: +private: // Methods PRIVATE - // + // // Fields PRIVATE diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.ixx b/src/GEOMAlgo/BlockFix_UnionEdges.ixx index 03646c839..27e87ac6c 100644 --- a/src/GEOMAlgo/BlockFix_UnionEdges.ixx +++ b/src/GEOMAlgo/BlockFix_UnionEdges.ixx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include - + diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.jxx b/src/GEOMAlgo/BlockFix_UnionEdges.jxx index 4b4c3b635..558e8d82b 100644 --- a/src/GEOMAlgo/BlockFix_UnionEdges.jxx +++ b/src/GEOMAlgo/BlockFix_UnionEdges.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _ShapeBuild_ReShape_HeaderFile #include #endif diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.cdl b/src/GEOMAlgo/BlockFix_UnionFaces.cdl index 14b0b02ae..371cb25ea 100644 --- a/src/GEOMAlgo/BlockFix_UnionFaces.cdl +++ b/src/GEOMAlgo/BlockFix_UnionFaces.cdl @@ -1,29 +1,29 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: BlockFix_UnionFaces.cdl -- Created: Tue Dec 7 17:15:42 2004 -- Author: Pavel Durandin - - +-- class UnionFaces from BlockFix uses @@ -35,31 +35,31 @@ is Create returns UnionFaces from BlockFix; ---Purpose: Empty constructor - + GetTolerance(me: in out) returns Real; ---Purpose: Returns modifiable tolerance - ---C++: return& - + ---C++: return& + Perform (me: in out; Shape: Shape from TopoDS) returns Shape from TopoDS; ---Purpose: Performs the unification of the fsces -- whith the same geometry - + IsSameDomain(me; aFace : Face from TopoDS; aChekedFace: Face from TopoDS) returns Boolean is virtual; ---Purpose: Returns true is surfaces have same geometrically domain -- with given tolerance - + MovePCurves(me; aTarget: in out Face from TopoDS; aSource: Face from TopoDS) is virtual; - ---Purpose: Creates pcurves on aTarget face for each edge from + ---Purpose: Creates pcurves on aTarget face for each edge from -- aSource one. fields myTolerance: Real; - + end; - + diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.cxx b/src/GEOMAlgo/BlockFix_UnionFaces.cxx index e513cbe59..c800fd421 100644 --- a/src/GEOMAlgo/BlockFix_UnionFaces.cxx +++ b/src/GEOMAlgo/BlockFix_UnionFaces.cxx @@ -1,31 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: BlockFix_UnionFaces.cxx -// Created: Tue Dec 7 17:15:42 2004 -// Author: Pavel DURANDIN +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File: BlockFix_UnionFaces.cxx +// Created: Tue Dec 7 17:15:42 2004 +// Author: Pavel DURANDIN + #include +#include + #include #include @@ -42,9 +44,16 @@ #include #include +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif + #include #include #include +#include #include #include @@ -59,7 +68,7 @@ #include #include #include -#include +#include #include #include #include @@ -67,33 +76,45 @@ #include +#include +#include + +#include #include #include -#include #include -#include -#include +#include +#include +#include #include +#include +#include +#include + #include #include #include - + +#include +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + //======================================================================= //function : BlockFix_UnionFaces -//purpose : +//purpose : //======================================================================= BlockFix_UnionFaces::BlockFix_UnionFaces() - : myTolerance(Precision::Confusion()) + : myTolerance(Precision::Confusion()), + myOptimumNbFaces(6) { } //======================================================================= -//function : GetTolearnce -//purpose : +//function : GetTolerance +//purpose : //======================================================================= Standard_Real& BlockFix_UnionFaces::GetTolerance() @@ -102,6 +123,17 @@ Standard_Real& BlockFix_UnionFaces::GetTolerance() } +//======================================================================= +//function : GetOptimumNbFaces +//purpose : +//======================================================================= + +Standard_Integer& BlockFix_UnionFaces::GetOptimumNbFaces() +{ + return myOptimumNbFaces; +} + + //======================================================================= //function : AddOrdinaryEdges //purpose : auxilary @@ -129,22 +161,22 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges, for(Standard_Integer i = 1; i <= edges.Length(); i++) { TopoDS_Shape current = edges(i); if(aNewEdges.Contains(current)) { - + aNewEdges.Remove(current); edges.Remove(i); i--; - + if(!isDropped) { isDropped = Standard_True; anIndex = i; } } } - + //add edges to the sequemce for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next()) edges.Append(anIter.Key()); - + return isDropped; } @@ -156,7 +188,7 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges, static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface) { if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - Handle(Geom_RectangularTrimmedSurface) rts = + Handle(Geom_RectangularTrimmedSurface) rts = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface); return rts->BasisSurface(); } @@ -166,7 +198,7 @@ static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface) //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) @@ -176,7 +208,7 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) // processing each solid TopExp_Explorer exps; - for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) { + for (exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) { TopoDS_Solid aSolid = TopoDS::Solid(exps.Current()); // creating map of edge faces @@ -185,28 +217,40 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) // map of processed shapes TopTools_MapOfShape aProcessed; - + Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape; - Standard_Integer NbModif=0; + Standard_Integer NbModif = 0; Standard_Boolean hasFailed = Standard_False; - Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.),0.1); - // processing each face + Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.), 0.1); + + // count faces + int nbf = 0; TopExp_Explorer exp; - //for( exp.Init(Shape, TopAbs_FACE); exp.More(); exp.Next()) { - for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) { + TopTools_MapOfShape mapF; + for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) { + if (mapF.Add(exp.Current())) + nbf++; + } + + bool doUnion = ((myOptimumNbFaces == 0) || + ((myOptimumNbFaces > 0) && (nbf > myOptimumNbFaces))); + + // processing each face + mapF.Clear(); + for (exp.Init(aSolid, TopAbs_FACE); exp.More() && doUnion; exp.Next()) { TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD)); - - if(aProcessed.Contains(aFace)) + + if (aProcessed.Contains(aFace)) continue; - + Standard_Integer dummy; TopTools_SequenceOfShape edges; AddOrdinaryEdges(edges,aFace,dummy); - + TopTools_SequenceOfShape faces; faces.Append(aFace); - + //surface and location to construct result TopLoc_Location aBaseLocation; Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation); @@ -214,73 +258,73 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) // find adjacent faces to union Standard_Integer i; - for( i = 1; i <= edges.Length(); i++) { + for (i = 1; i <= edges.Length(); i++) { TopoDS_Edge edge = TopoDS::Edge(edges(i)); - if(BRep_Tool::Degenerated(edge)) + if (BRep_Tool::Degenerated(edge)) continue; - + const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge); TopTools_ListIteratorOfListOfShape anIter(aList); - for( ; anIter.More(); anIter.Next()) { + for (; anIter.More(); anIter.Next()) { TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD)); - if(anCheckedFace.IsSame(aFace)) + if (anCheckedFace.IsSame(aFace)) continue; - - if(aProcessed.Contains(anCheckedFace)) + + if (aProcessed.Contains(anCheckedFace)) continue; - - if(IsSameDomain(aFace,anCheckedFace)) { - - if(aList.Extent() != 2) { + + if (IsSameDomain(aFace,anCheckedFace)) { + + if (aList.Extent() != 2) { // non mainfold case is not processed continue; } - + // replacing pcurves TopoDS_Face aMockUpFace; BRep_Builder B; B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.); MovePCurves(aMockUpFace,anCheckedFace); - - if(AddOrdinaryEdges(edges,aMockUpFace,dummy)) { + + if (AddOrdinaryEdges(edges,aMockUpFace,dummy)) { // sequence edges is modified i = dummy; } - + faces.Append(anCheckedFace); aProcessed.Add(anCheckedFace); break; } } } - + // all faces collected in the sequence. Perform union of faces - if(faces.Length() > 1) { + if (faces.Length() > 1) { NbModif++; TopoDS_Face aResult; BRep_Builder B; B.MakeFace(aResult,aBaseSurface,aBaseLocation,0); Standard_Integer nbWires = 0; - + // connecting wires - while(edges.Length()>0) { - + while (edges.Length()>0) { + Standard_Boolean isEdge3d = Standard_False; nbWires++; TopTools_MapOfShape aVertices; TopoDS_Wire aWire; B.MakeWire(aWire); - + TopoDS_Edge anEdge = TopoDS::Edge(edges(1)); edges.Remove(1); - + isEdge3d |= !BRep_Tool::Degenerated(anEdge); B.Add(aWire,anEdge); TopoDS_Vertex V1,V2; TopExp::Vertices(anEdge,V1,V2); aVertices.Add(V1); aVertices.Add(V2); - + Standard_Boolean isNewFound = Standard_False; do { isNewFound = Standard_False; @@ -298,10 +342,10 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) } } } while (isNewFound); - + // sorting any type of edges aWire = TopoDS::Wire(aContext->Apply(aWire)); - + TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD))); Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion()); sfw->FixReorder(); @@ -348,7 +392,7 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY()); } sawo.Perform(); - + // constructind one degenerative edge gp_XY aStart, anEnd, tmp; Standard_Integer nbFirst = sawo.Ordered(1); @@ -358,7 +402,7 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV); sawo.XY(nbFirst,aStart,tmp); sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd); - + gp_XY aVec = anEnd-aStart; Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart)); @@ -372,13 +416,11 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) B.Add(aW,E); B.Add(aResult,aW); } - } - + // perform substitution of face aContext->Replace(aContext->Apply(aFace),aResult); - - + ShapeFix_Face sff (aResult); //Intializing by tolerances sff.SetPrecision(myTolerance); @@ -390,74 +432,72 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) sff.SetContext(aContext); // Applying the fixes sff.Perform(); - if(sff.Status(ShapeExtend_FAIL)) + if(sff.Status(ShapeExtend_FAIL)) hasFailed = Standard_True; - + // breaking down to several faces TopoDS_Shape theResult = aContext->Apply(aResult); - for(TopExp_Explorer aFaceExp(theResult,TopAbs_FACE);aFaceExp.More();aFaceExp.Next()) { + for (TopExp_Explorer aFaceExp (theResult,TopAbs_FACE); aFaceExp.More(); aFaceExp.Next()) { TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD)); Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 ); grid->SetValue ( 1, 1, aBaseSurface ); Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid ); ShapeFix_ComposeShell CompShell; - CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision + CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision CompShell.SetContext( aContext ); - + TopTools_SequenceOfShape parts; ShapeFix_SequenceOfWireSegment wires; for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) { - Handle(ShapeExtend_WireData) sbwd = + Handle(ShapeExtend_WireData) sbwd = new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() )); ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED ); wires.Append(seg); } - + CompShell.DispatchWires ( parts,wires ); for (Standard_Integer j=1; j <= parts.Length(); j++ ) { ShapeFix_Face aFixOrient(TopoDS::Face(parts(j))); aFixOrient.SetContext(aContext); aFixOrient.FixOrientation(); } - + TopoDS_Shape CompRes; if ( faces.Length() !=1 ) { TopoDS_Shell S; B.MakeShell ( S ); - for ( i=1; i <= parts.Length(); i++ ) + for ( i=1; i <= parts.Length(); i++ ) B.Add ( S, parts(i) ); CompRes = S; } else CompRes = parts(1); - + aContext->Replace(aCurrent,CompRes); } - + // remove the remaining faces for(i = 2; i <= faces.Length(); i++) aContext->Remove(faces(i)); } - } - + } // end processing each face + //TopoDS_Shape aResult = Shape; - if(NbModif>0) { - TopoDS_Shape aResult = aSolid; - if(!hasFailed) { - aResult = aContext->Apply(aSolid); - - ShapeFix_Edge sfe; - for(exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) { - TopoDS_Edge E = TopoDS::Edge(exp.Current()); - sfe.FixVertexTolerance (E); - // ptv add fix same parameter - sfe.FixSameParameter(E, myTolerance); - } - - myContext->Replace(aSolid,aResult); + if (NbModif > 0 && !hasFailed) { + TopoDS_Shape aResult = aContext->Apply(aSolid); + + ShapeFix_Edge sfe; + for (exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) { + TopoDS_Edge E = TopoDS::Edge(exp.Current()); + sfe.FixVertexTolerance (E); + // ptv add fix same parameter + sfe.FixSameParameter(E, myTolerance); } + + myContext->Replace(aSolid, aResult); } -// else { - for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) { + //else + { + for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) { TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD)); Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire; sfw->SetContext(myContext); @@ -465,15 +505,14 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) sfw->SetMinTolerance(myTolerance); sfw->SetMaxTolerance(Max(1.,myTolerance*1000.)); sfw->SetFace(aFace); - for ( TopoDS_Iterator iter(aFace,Standard_False); iter.More(); iter.Next()) { - TopoDS_Wire wire = TopoDS::Wire ( iter.Value() ); + for (TopoDS_Iterator iter (aFace,Standard_False); iter.More(); iter.Next()) { + TopoDS_Wire wire = TopoDS::Wire(iter.Value()); sfw->Load(wire); sfw->FixReorder(); sfw->FixShifted(); } } -// } - + } } // end processing each solid aResShape = myContext->Apply(Shape); @@ -483,102 +522,163 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) //======================================================================= //function : IsSameDomain -//purpose : +//purpose : //======================================================================= +bool getCylinder (Handle(Geom_Surface)& theInSurface, gp_Cylinder& theOutCylinder) +{ + bool isCylinder = false; + + if (theInSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { + Handle(Geom_CylindricalSurface) aGC = Handle(Geom_CylindricalSurface)::DownCast(theInSurface); + + theOutCylinder = aGC->Cylinder(); + isCylinder = true; + } + else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) { + Handle(Geom_SurfaceOfRevolution) aRS = + Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface); + Handle(Geom_Curve) aBasis = aRS->BasisCurve(); + if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) { + Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis); + gp_Dir aDir = aRS->Direction(); + gp_Dir aBasisDir = aBasisLine->Position().Direction(); + if (aBasisDir.IsParallel(aDir, Precision::Confusion())) { + // basis line is parallel to the revolution axis: it is a cylinder + gp_Pnt aLoc = aRS->Location(); + Standard_Real aR = aBasisLine->Lin().Distance(aLoc); + gp_Ax3 aCylAx (aLoc, aDir); + + theOutCylinder = gp_Cylinder(aCylAx, aR); + isCylinder = true; + } + } + } + else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) { + Handle(Geom_SurfaceOfLinearExtrusion) aLES = + Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface); + Handle(Geom_Curve) aBasis = aLES->BasisCurve(); + if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) { + Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis); + gp_Dir aDir = aLES->Direction(); + gp_Dir aBasisDir = aBasisCircle->Position().Direction(); + if (aBasisDir.IsParallel(aDir, Precision::Confusion())) { + // basis circle is normal to the extrusion axis: it is a cylinder + gp_Pnt aLoc = aBasisCircle->Location(); + Standard_Real aR = aBasisCircle->Radius(); + gp_Ax3 aCylAx (aLoc, aDir); + + theOutCylinder = gp_Cylinder(aCylAx, aR); + isCylinder = true; + } + } + } + else { + } + + return isCylinder; +} + Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace, const TopoDS_Face& aCheckedFace) const { - //checking the same handless + //checking the same handles TopLoc_Location L1, L2; Handle(Geom_Surface) S1, S2; - + S1 = BRep_Tool::Surface(aFace,L1); S2 = BRep_Tool::Surface(aCheckedFace,L2); - + if (S1 == S2 && L1 == L2) return true; - // begin: planar case (improvement 20052) + // planar and cylindrical cases (IMP 20052) + Standard_Real aPrec = Precision::Confusion(); + S1 = BRep_Tool::Surface(aFace); S2 = BRep_Tool::Surface(aCheckedFace); - Handle(Geom_Plane) aGP1, aGP2; - Handle(Geom_RectangularTrimmedSurface) aGRTS1, aGRTS2; - Handle(Geom_OffsetSurface) aGOFS1, aGOFS2; - - aGRTS1 = Handle(Geom_RectangularTrimmedSurface)::DownCast(S1); - aGRTS2 = Handle(Geom_RectangularTrimmedSurface)::DownCast(S2); - - aGOFS1 = Handle(Geom_OffsetSurface)::DownCast(S1); - aGOFS2 = Handle(Geom_OffsetSurface)::DownCast(S2); - - if (!aGOFS1.IsNull()) { - aGP1 = Handle(Geom_Plane)::DownCast(aGOFS1->BasisSurface()); - } - else if (!aGRTS1.IsNull()) { - aGP1 = Handle(Geom_Plane)::DownCast(aGRTS1->BasisSurface()); - } - else { - aGP1 = Handle(Geom_Plane)::DownCast(S1); - } - - if (!aGOFS2.IsNull()) { - aGP2 = Handle(Geom_Plane)::DownCast(aGOFS2->BasisSurface()); - } - else if (!aGRTS2.IsNull()) { - aGP2 = Handle(Geom_Plane)::DownCast(aGRTS2->BasisSurface()); - } - else { - aGP2 = Handle(Geom_Plane)::DownCast(S2); - } - - if (!aGP1.IsNull() && !aGP2.IsNull()) { - // both surfaces are planar, check equality - Standard_Real A1, B1, C1, D1; - Standard_Real A2, B2, C2, D2; - aGP1->Coefficients(A1, B1, C1, D1); - aGP2->Coefficients(A2, B2, C2, D2); - - if (fabs(A1) > Precision::Confusion()) { - A1 = 1.0; - B1 /= A1; - C1 /= A1; - D1 /= A1; + S1 = ClearRts(S1); + S2 = ClearRts(S2); + + //Handle(Geom_OffsetSurface) aGOFS1, aGOFS2; + //aGOFS1 = Handle(Geom_OffsetSurface)::DownCast(S1); + //aGOFS2 = Handle(Geom_OffsetSurface)::DownCast(S2); + //if (!aGOFS1.IsNull()) S1 = aGOFS1->BasisSurface(); + //if (!aGOFS2.IsNull()) S2 = aGOFS2->BasisSurface(); + + // case of two elementary surfaces: use OCCT tool + // elementary surfaces: ConicalSurface, CylindricalSurface, + // Plane, SphericalSurface and ToroidalSurface + if (S1->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) && + S2->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) + { + Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(S1); + Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(S2); + + Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool(); + Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool(); + + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + IntPatch_ImpImpIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec); +#else + IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec); +#endif + if (!anIIInt.IsDone() || anIIInt.IsEmpty()) + return false; + + return anIIInt.TangentFaces(); } - else if (fabs(B1) > Precision::Confusion()) { - B1 = 1.0; - C1 /= B1; - D1 /= B1; - } - else { - C1 = 1.0; - D1 /= C1; + catch (Standard_Failure) { + return false; } + } - if (fabs(A2) > Precision::Confusion()) { - A2 = 1.0; - B2 /= A2; - C2 /= A2; - D2 /= A2; - } - else if (fabs(B2) > Precision::Confusion()) { - B2 = 1.0; - C2 /= B2; - D2 /= B2; - } - else { - C2 = 1.0; - D2 /= C2; + // case of two planar surfaces: + // all kinds of surfaces checked, including b-spline and bezier + GeomLib_IsPlanarSurface aPlanarityChecker1 (S1, aPrec); + if (aPlanarityChecker1.IsPlanar()) { + GeomLib_IsPlanarSurface aPlanarityChecker2 (S2, aPrec); + if (aPlanarityChecker2.IsPlanar()) { + gp_Pln aPln1 = aPlanarityChecker1.Plan(); + gp_Pln aPln2 = aPlanarityChecker2.Plan(); + + if (aPln1.Position().Direction().IsParallel(aPln2.Position().Direction(), aPrec) && + aPln1.Distance(aPln2) < aPrec) { + return true; + } } + } - if (fabs(A1 - A2) < Precision::Confusion() && - fabs(B1 - B2) < Precision::Confusion() && - fabs(C1 - C2) < Precision::Confusion() && - fabs(D1 - D2) < Precision::Confusion()) - return true; + // case of two cylindrical surfaces, at least one of which is a swept surface + // swept surfaces: SurfaceOfLinearExtrusion, SurfaceOfRevolution + if ((S1->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) || + S1->IsKind(STANDARD_TYPE(Geom_SweptSurface))) && + (S2->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) || + S2->IsKind(STANDARD_TYPE(Geom_SweptSurface)))) + { + gp_Cylinder aCyl1, aCyl2; + if (getCylinder(S1, aCyl1) && getCylinder(S2, aCyl2)) { + if (fabs(aCyl1.Radius() - aCyl2.Radius()) < aPrec) { + gp_Dir aDir1 = aCyl1.Position().Direction(); + gp_Dir aDir2 = aCyl2.Position().Direction(); + if (aDir1.IsParallel(aDir2, aPrec)) { + gp_Pnt aLoc1 = aCyl1.Location(); + gp_Pnt aLoc2 = aCyl2.Location(); + gp_Vec aVec12 (aLoc1, aLoc2); + if (aVec12.SquareMagnitude() < aPrec*aPrec || + aVec12.IsParallel(aDir1, aPrec)) { + return true; + } + } + } + } } - // end: planar case (improvement 20052) return false; } @@ -586,7 +686,7 @@ Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace, //======================================================================= //function : MovePCurves -//purpose : +//purpose : //======================================================================= void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget, @@ -594,17 +694,17 @@ void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget, { BRep_Builder B; for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) { - Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()), + Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()), aTarget, Precision::Confusion()); sfw->FixReorder(); Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL ); sfw->FixEdgeCurves(); if(isReoredFailed) continue; - + sfw->FixShifted(); sfw->FixDegenerated(); - + // remove degenerated edges from not degenerated points ShapeAnalysis_Edge sae; Handle(ShapeExtend_WireData) sewd = sfw->WireData(); @@ -615,7 +715,7 @@ void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget, i--; } } - + TopoDS_Wire ResWire = sfw->Wire(); B.Add(aTarget,ResWire); } diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.hxx b/src/GEOMAlgo/BlockFix_UnionFaces.hxx index 9cf0578d8..f676d5bcf 100644 --- a/src/GEOMAlgo/BlockFix_UnionFaces.hxx +++ b/src/GEOMAlgo/BlockFix_UnionFaces.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _BlockFix_UnionFaces_HeaderFile #define _BlockFix_UnionFaces_HeaderFile @@ -28,10 +29,6 @@ #ifndef _Standard_Boolean_HeaderFile #include #endif -class TopoDS_Shape; -class TopoDS_Face; - - #ifndef _Standard_HeaderFile #include #endif @@ -39,63 +36,55 @@ class TopoDS_Face; #include #endif -class BlockFix_UnionFaces { +class TopoDS_Shape; +class TopoDS_Face; +class BlockFix_UnionFaces +{ public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT BlockFix_UnionFaces(); -Standard_EXPORT Standard_Real& GetTolerance() ; -Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape) ; -Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace,const TopoDS_Face& aChekedFace) const; -Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget,const TopoDS_Face& aSource) const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myTolerance; - - + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT BlockFix_UnionFaces(); + + Standard_EXPORT Standard_Real& GetTolerance(); + + /* \brief To get/set the OptimumNbFaces parameter + * + * If a being processed solid has less than OptimumNbFaces + * faces, no union will be performed. + * By default this parameter is set to 6 (to correctly + * process blocks - hexahedral solids) + * Special values: 0 - do all possible unions, regardless the faces quantity, + * negative - do not perform any unions, regardless the faces quantity. + * + */ + Standard_EXPORT Standard_Integer& GetOptimumNbFaces(); + + Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape); + + Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace, + const TopoDS_Face& aChekedFace) const; + Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget, + const TopoDS_Face& aSource) const; + +private: + // Fields PRIVATE + // + Standard_Real myTolerance; + Standard_Integer myOptimumNbFaces; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.ixx b/src/GEOMAlgo/BlockFix_UnionFaces.ixx index 155eca0f5..c5299ca40 100644 --- a/src/GEOMAlgo/BlockFix_UnionFaces.ixx +++ b/src/GEOMAlgo/BlockFix_UnionFaces.ixx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include - + diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.jxx b/src/GEOMAlgo/BlockFix_UnionFaces.jxx index 7a735aac6..c89fc31fb 100644 --- a/src/GEOMAlgo/BlockFix_UnionFaces.jxx +++ b/src/GEOMAlgo/BlockFix_UnionFaces.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _TopoDS_Shape_HeaderFile #include #endif diff --git a/src/GEOMAlgo/FILES b/src/GEOMAlgo/FILES new file mode 100644 index 000000000..44aeb0c17 --- /dev/null +++ b/src/GEOMAlgo/FILES @@ -0,0 +1,169 @@ +GEOMAlgo_Builder_0.cxx +GEOMAlgo_Builder_1.cxx +GEOMAlgo_Builder_2.cxx +GEOMAlgo_Builder_3.cxx +GEOMAlgo_Builder_4.cxx +GEOMAlgo_ShapeInfoFiller_1.cxx +GEOMAlgo_Tools_1.cxx + +GEOMAlgo_Gluer2.hxx +GEOMAlgo_Gluer2.cxx +GEOMAlgo_Gluer2_1.cxx +GEOMAlgo_Gluer2_2.cxx +GEOMAlgo_Gluer2_3.cxx + +GEOMAlgo_GluerAlgo.hxx +GEOMAlgo_GluerAlgo.cxx + +GEOMAlgo_GlueDetector.hxx +GEOMAlgo_GlueDetector.cxx + +GEOMAlgo_GetInPlace.hxx +GEOMAlgo_GetInPlace.cxx +GEOMAlgo_GetInPlace_1.cxx +GEOMAlgo_GetInPlace_2.cxx +GEOMAlgo_GetInPlace_3.cxx + +GEOMAlgo_FinderShapeOnQuad.hxx +GEOMAlgo_FinderShapeOnQuad.cxx + +GEOMAlgo_WireSplitter.hxx +GEOMAlgo_WireSplitter.cxx +GEOMAlgo_WESScaler.hxx +GEOMAlgo_WESScaler.cxx +GEOMAlgo_WESCorrector.hxx +GEOMAlgo_WESCorrector.cxx +GEOMAlgo_WireEdgeSet.hxx +GEOMAlgo_WireEdgeSet.cxx +GEOMAlgo_GlueAnalyser.hxx +GEOMAlgo_GlueAnalyser.cxx +GEOMAlgo_Gluer.hxx +GEOMAlgo_Gluer.cxx +GEOMAlgo_FinderShapeOn2.hxx +GEOMAlgo_FinderShapeOn2.cxx +GEOMAlgo_FinderShapeOn1.hxx +GEOMAlgo_FinderShapeOn1.cxx +GEOMAlgo_FinderShapeOn.hxx +GEOMAlgo_FinderShapeOn.cxx +GEOMAlgo_ShapeAlgo.hxx +GEOMAlgo_ShapeAlgo.cxx +GEOMAlgo_SolidSolid.hxx +GEOMAlgo_SolidSolid.cxx +GEOMAlgo_ShellSolid.hxx +GEOMAlgo_ShellSolid.cxx +GEOMAlgo_VertexSolid.hxx +GEOMAlgo_VertexSolid.cxx +GEOMAlgo_WireSolid.hxx +GEOMAlgo_WireSolid.cxx +GEOMAlgo_ShapeSolid.hxx +GEOMAlgo_ShapeSolid.cxx +GEOMAlgo_Splitter.hxx +GEOMAlgo_Splitter.cxx +GEOMAlgo_Builder.hxx +GEOMAlgo_Builder.cxx +GEOMAlgo_BuilderShape.hxx +GEOMAlgo_BuilderShape.cxx +GEOMAlgo_BuilderArea.hxx +GEOMAlgo_BuilderArea.cxx +GEOMAlgo_BuilderFace.hxx +GEOMAlgo_BuilderFace.cxx +GEOMAlgo_BuilderSolid.hxx +GEOMAlgo_BuilderSolid.cxx +GEOMAlgo_ShapeInfoFiller.hxx +GEOMAlgo_ShapeInfoFiller.cxx +GEOMAlgo_Algo.hxx +GEOMAlgo_Algo.cxx +GEOMAlgo_ShapeSet.hxx +GEOMAlgo_ShapeSet.cxx +GEOMAlgo_SurfaceTools.hxx +GEOMAlgo_SurfaceTools.cxx +GEOMAlgo_State.hxx +GEOMAlgo_KindOfBounds.hxx +GEOMAlgo_KindOfClosed.hxx +GEOMAlgo_KindOfName.hxx +GEOMAlgo_KindOfShape.hxx +GEOMAlgo_ShapeInfo.hxx +GEOMAlgo_ShapeInfo.cxx +GEOMAlgo_CoupleOfShapes.hxx +GEOMAlgo_CoupleOfShapes.cxx +GEOMAlgo_BuilderTools.hxx +GEOMAlgo_BuilderTools.cxx +GEOMAlgo_Tools3D.hxx +GEOMAlgo_Tools3D.cxx +GEOMAlgo_Tools.hxx +GEOMAlgo_Tools.cxx +GEOMAlgo_PWireEdgeSet.hxx +GEOMAlgo_StateCollector.cxx +GEOMAlgo_StateCollector.hxx +GEOMAlgo_PassKey.hxx +GEOMAlgo_PassKey.cxx +GEOMAlgo_PassKeyMapHasher.hxx +GEOMAlgo_PassKeyMapHasher.cxx +GEOMAlgo_PassKeyShape.hxx +GEOMAlgo_PassKeyShape.cxx +GEOMAlgo_PassKeyShapeMapHasher.hxx +GEOMAlgo_PassKeyShapeMapHasher.cxx +GEOMAlgo_ClsfBox.hxx +GEOMAlgo_ClsfBox.cxx +GEOMAlgo_ClsfSolid.hxx +GEOMAlgo_ClsfSolid.cxx +GEOMAlgo_ClsfSurf.hxx +GEOMAlgo_ClsfSurf.cxx +GEOMAlgo_Clsf.hxx +GEOMAlgo_Clsf.cxx +GEOMAlgo_HAlgo.hxx +GEOMAlgo_HAlgo.cxx + +GEOMAlgo_ListOfCoupleOfShapes.hxx +GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx +GEOMAlgo_ListOfPnt.hxx +GEOMAlgo_ListIteratorOfListOfPnt.hxx +GEOMAlgo_DataMapOfShapeShapeSet.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx +GEOMAlgo_DataMapOfShapeReal.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx +GEOMAlgo_DataMapOfRealListOfShape.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx +GEOMAlgo_DataMapOfPassKeyInteger.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx +GEOMAlgo_DataMapOfPassKeyShapeShape.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx +GEOMAlgo_DataMapOfOrientedShapeShape.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx +GEOMAlgo_DataMapOfShapeMapOfShape.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx +GEOMAlgo_DataMapOfShapePnt.hxx +GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx +GEOMAlgo_IndexedDataMapOfShapeBox.hxx + +GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx +GEOMAlgo_IndexedDataMapOfShapeState.hxx +GEOMAlgo_IndexedDataMapOfIntegerShape.hxx +GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GEOMAlgo/GEOMAlgo.cdl b/src/GEOMAlgo/GEOMAlgo.cdl index aa7e93982..d2fbf9770 100755 --- a/src/GEOMAlgo/GEOMAlgo.cdl +++ b/src/GEOMAlgo/GEOMAlgo.cdl @@ -1,261 +1,342 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- -- File: GEOMAlgo.cdl -- Created: Sat Dec 04 12:36:22 2004 -- Author: Peter KURNEV --- --- -package GEOMAlgo - ---Purpose: +package GEOMAlgo + + ---Purpose: -uses - TCollection, - - TColgp, - Geom, - Bnd, - gp, +uses + TCollection, + + TColgp, + Geom, + Bnd, + gp, GeomAdaptor, TopAbs, - TopoDS, - TopTools, - IntTools, - BOPTools, - BOP, - - TColStd, - BOPTColStd, - BRepAlgo, - NMTDS, - NMTTools - -is + TopoDS, + TopTools, + IntTools, + BOPTools, + BOP, + + TColStd, + BOPTColStd, + BRepAlgo, + NMTDS, + NMTTools + +is + -- Enumerations + imported State from GEOMAlgo; + imported KindOfShape from GEOMAlgo; + imported KindOfName from GEOMAlgo; + imported KindOfBounds from GEOMAlgo; + imported KindOfClosed from GEOMAlgo; -- - -- enumerations + -- Gluer / GetInPlace + imported Gluer2 from GEOMAlgo; + imported GlueDetector from GEOMAlgo; + imported GluerAlgo from GEOMAlgo; + imported GetInPlace from GEOMAlgo; + -- Algos + imported WireSplitter from GEOMAlgo; + imported WESScaler from GEOMAlgo; + imported WESCorrector from GEOMAlgo; + imported WireEdgeSet from GEOMAlgo; + imported GlueAnalyser from GEOMAlgo; + imported Gluer from GEOMAlgo; + imported FinderShapeOn2 from GEOMAlgo; + imported FinderShapeOn1 from GEOMAlgo; + imported FinderShapeOn from GEOMAlgo; + imported ShapeAlgo from GEOMAlgo; + imported SolidSolid from GEOMAlgo; + imported ShellSolid from GEOMAlgo; + imported VertexSolid from GEOMAlgo; + imported WireSolid from GEOMAlgo; + imported ShapeSolid from GEOMAlgo; + imported Splitter from GEOMAlgo; + imported Builder from GEOMAlgo; + imported BuilderShape from GEOMAlgo; + imported BuilderSolid from GEOMAlgo; + imported BuilderFace from GEOMAlgo; + imported BuilderArea from GEOMAlgo; + imported ShapeInfoFiller from GEOMAlgo; + imported Algo from GEOMAlgo; + -- Data / Tools + imported ShapeSet from GEOMAlgo; + imported SurfaceTools from GEOMAlgo; + imported ShapeInfo from GEOMAlgo; + imported CoupleOfShapes from GEOMAlgo; + imported BuilderTools from GEOMAlgo; + imported Tools3D from GEOMAlgo; + imported Tools from GEOMAlgo; + imported PWireEdgeSet from GEOMAlgo; + imported StateCollector from GEOMAlgo; + imported PassKey from GEOMAlgo; + imported PassKeyMapHasher from GEOMAlgo; + imported PassKeyShape from GEOMAlgo; + imported PassKeyShapeMapHasher from GEOMAlgo; + imported ClsfBox from GEOMAlgo; + imported ClsfSurf from GEOMAlgo; + imported ClsfSolid from GEOMAlgo; + imported Clsf from GEOMAlgo; + imported HAlgo from GEOMAlgo; + + imported ListOfCoupleOfShapes from GEOMAlgo; + imported ListIteratorOfListOfCoupleOfShapes from GEOMAlgo; + imported ListOfPnt from GEOMAlgo; + imported ListIteratorOfListOfPnt from GEOMAlgo; + imported DataMapOfShapeShapeSet from GEOMAlgo; + imported DataMapIteratorOfDataMapOfShapeShapeSet from GEOMAlgo; + imported DataMapOfShapeReal from GEOMAlgo; + imported DataMapIteratorOfDataMapOfShapeReal from GEOMAlgo; + imported DataMapOfRealListOfShape from GEOMAlgo; + imported DataMapIteratorOfDataMapOfRealListOfShape from GEOMAlgo; + imported DataMapOfPassKeyInteger from GEOMAlgo; + imported DataMapIteratorOfDataMapOfPassKeyInteger from GEOMAlgo; + imported DataMapOfPassKeyShapeShape from GEOMAlgo; + imported DataMapIteratorOfDataMapOfPassKeyShapeShape from GEOMAlgo; + imported DataMapOfOrientedShapeShape from GEOMAlgo; + imported DataMapIteratorOfDataMapOfOrientedShapeShape from GEOMAlgo; + imported DataMapOfShapeMapOfShape from GEOMAlgo; + imported DataMapIteratorOfDataMapOfShapeMapOfShape from GEOMAlgo; + imported DataMapOfShapePnt from GEOMAlgo; + imported DataMapIteratorOfDataMapOfShapePnt from GEOMAlgo; + imported IndexedDataMapOfShapeBox from GEOMAlgo; + imported IndexedDataMapOfShapeShapeInfo from GEOMAlgo; + imported IndexedDataMapOfShapeState from GEOMAlgo; + imported IndexedDataMapOfIntegerShape from GEOMAlgo; + imported IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo; + + + -- Instantiations + + --class ListOfCoupleOfShapes + -- instantiates List from TCollection (CoupleOfShapes from GEOMAlgo); + + --class ListOfPnt + -- instantiates List from TCollection (Pnt from gp); -- - enumeration State is - ST_UNKNOWN, - ST_IN, - ST_OUT, - ST_ON, - ST_ONIN, - ST_ONOUT, - ST_INOUT - end State; + + --class DataMapOfShapeShapeSet instantiates + -- DataMap from TCollection(Shape from TopoDS, + -- ShapeSet from GEOMAlgo, + -- ShapeMapHasher from TopTools); + + --class DataMapOfShapeReal instantiates + -- DataMap from TCollection(Shape from TopoDS, + -- Real from Standard, + -- ShapeMapHasher from TopTools); + + + --class DataMapOfRealListOfShape instantiates + -- DataMap from TCollection(Real from Standard, + -- ListOfShape from TopTools, + -- MapRealHasher from TColStd); + + + --class DataMapOfPassKeyInteger + -- instantiates DataMap from TCollection (PassKey from GEOMAlgo, + -- Integer from Standard, + -- PassKeyMapHasher from GEOMAlgo); + + --class DataMapOfPassKeyShapeShape + -- instantiates DataMap from TCollection (PassKeyShape from GEOMAlgo, + -- Shape from TopoDS, + -- PassKeyShapeMapHasher from GEOMAlgo); + + --class DataMapOfOrientedShapeShape instantiates + -- DataMap from TCollection (Shape from TopoDS, + -- Shape from TopoDS, + -- OrientedShapeMapHasher from TopTools); + + + --class DataMapOfShapeMapOfShape instantiates + -- DataMap from TCollection (Shape from TopoDS, + -- MapOfShape from TopTools, + -- ShapeMapHasher from TopTools); + + --class DataMapOfShapePnt instantiates + -- DataMap from TCollection (Shape from TopoDS, + -- Pnt from gp, + -- ShapeMapHasher from TopTools); + -- - enumeration KindOfShape is - KS_UNKNOWN, - KS_SPHERE, - KS_CYLINDER, - KS_BOX, - KS_TORUS, - KS_CONE, - KS_ELLIPSE, - KS_PLANE, - KS_CIRCLE, - KS_LINE, - KS_DEGENERATED - end KindOfShape; - -- - enumeration KindOfName is - KN_UNKNOWN, - KN_SPHERE, - KN_CYLINDER, - KN_TORUS, - KN_CONE, - KN_ELLIPSE, - KN_CIRCLE, - KN_PLANE, - KN_LINE, - KN_BOX, - KN_SEGMENT, - KN_ARCCIRCLE, - KN_POLYGON, - KN_POLYHEDRON, - KN_DISKCIRCLE, - KN_DISKELLIPSE, - KN_RECTANGLE, - KN_TRIANGLE, - KN_QUADRANGLE, - KN_ARCELLIPSE - end KindOfName; + --class IndexedDataMapOfShapeBox + -- instantiates IndexedDataMap from TCollection (Shape from TopoDS, +-- Box from Bnd, +-- ShapeMapHasher from TopTools); + +-- class IndexedDataMapOfShapeShapeInfo +-- instantiates IndexedDataMap from TCollection (Shape from TopoDS, +-- ShapeInfo from GEOMAlgo, +-- ShapeMapHasher from TopTools); +-- class IndexedDataMapOfShapeState +-- instantiates IndexedDataMap from TCollection (Shape from TopoDS, +-- State from TopAbs, +-- ShapeMapHasher from TopTools); + + +-- +-- class IndexedDataMapOfIntegerShape +-- instantiates IndexedDataMap from TCollection (Integer from Standard, +-- Shape from TopoDS, +-- MapIntegerHasher from TColStd); + + +-- class IndexedDataMapOfPassKeyShapeListOfShape +-- instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo, +-- ListOfShape from TopTools, +-- PassKeyShapeMapHasher from GEOMAlgo); + + + + + + +end GEOMAlgo; + -- + -- enumerations + -- + --enumeration State is + -- ST_UNKNOWN, +-- ST_IN, +-- ST_OUT, +-- ST_ON, +-- ST_ONIN, +-- ST_ONOUT, +-- ST_INOUT +-- end State; + -- +-- enumeration KindOfShape is +-- KS_UNKNOWN, +-- KS_SPHERE, +-- KS_CYLINDER, +-- KS_BOX, +-- KS_TORUS, +-- KS_CONE, +-- KS_ELLIPSE, +-- KS_PLANE, +-- KS_CIRCLE, +-- KS_LINE, +-- KS_DEGENERATED +-- end KindOfShape; + -- +-- enumeration KindOfName is +-- KN_UNKNOWN, +-- KN_SPHERE, +-- KN_CYLINDER, +-- KN_TORUS, +-- KN_CONE, +-- KN_ELLIPSE, +-- KN_CIRCLE, +-- KN_PLANE, +-- KN_LINE, +-- KN_BOX, +-- KN_SEGMENT, +-- KN_ARCCIRCLE, +-- KN_POLYGON, +-- KN_POLYHEDRON, +-- KN_DISKCIRCLE, +-- KN_DISKELLIPSE, +-- KN_RECTANGLE, +-- KN_TRIANGLE, +-- KN_QUADRANGLE, +-- KN_ARCELLIPSE +-- end KindOfName; + -- + -- enumeration KindOfBounds is + -- KB_UNKNOWN, +-- KB_TRIMMED, + -- KB_INFINITE +-- end KindOfBounds; -- - enumeration KindOfBounds is - KB_UNKNOWN, - KB_TRIMMED, - KB_INFINITE - end KindOfBounds; +-- enumeration KindOfClosed is +-- KC_UNKNOWN, +-- KC_CLOSED, +-- KC_NOTCLOSED +-- end KindOfClosed; -- - enumeration KindOfClosed is - KC_UNKNOWN, - KC_CLOSED, - KC_NOTCLOSED - end KindOfClosed; + + --deferred class HAlgo; + --deferred class Clsf; + --class ClsfSurf; + --class ClsfBox; + --class ClsfSolid; + + -- + -- classes + -- + --deferred class Algo; + --deferred class ShapeAlgo; + -- + --class ShapeInfo; + --class ShapeInfoFiller; + --class CoupleOfShapes; + --class SurfaceTools; + --class Tools; + --class PassKey; + --class PassKeyMapHasher; + --class PassKeyShape; + --class PassKeyShapeMapHasher; + -- + -- finder on + --deferred class ShapeSolid; + --class WireSolid; + --class ShellSolid; + --class VertexSolid; + --class SolidSolid; + --class StateCollector; + -- - deferred class HAlgo; - deferred class Clsf; - class ClsfSurf; - class ClsfBox; - class FinderShapeOn2; - class PassKeyShapeMapHasher; - -- - -- classes - -- - deferred class Algo; - deferred class ShapeAlgo; - -- - class ShapeInfo; - class ShapeInfoFiller; - -- - -- gluer - class Gluer; - class Gluer1; - class GlueAnalyser; - class CoupleOfShapes; - class PassKey; - class PassKeyMapHasher; - class PassKeyShape; - - class SurfaceTools; - class Tools; - -- - -- finder on - deferred class ShapeSolid; - class WireSolid; - class ShellSolid; - class VertexSolid; - class SolidSolid; - class FinderShapeOn; - -- - class FinderShapeOn1; - class StateCollector; - -- adds - deferred class HAlgo; - deferred class Clsf; - class ClsfSurf; - class ClsfBox; - --modified by NIZNHY-PKV Mon Jan 29 10:27:44 2007f - class ClsfSolid; - --modified by NIZNHY-PKV Mon Jan 29 10:27:46 2007t - class FinderShapeOn2; - class PassKeyShapeMapHasher; + --class Gluer; + --class GlueAnalyser; + --class FinderShapeOn; + --class FinderShapeOn1; + --class FinderShapeOn2; + -- + -- Builder/Splitter + --deferred class BuilderShape; + --class Builder; + --class Splitter; + --class Tools3D; + --class BuilderTools; + --class ShapeSet; + + --deferred class BuilderArea; + --class BuilderFace; + --class BuilderSolid; + + --class WireSplitter; + --class WireEdgeSet; + --class WESCorrector; + --class WESScaler; -- - -- Builder/Splitter - deferred class BuilderShape; - - class Builder; - class Splitter; - class Tools3D; - class BuilderTools; - class ShapeSet; - - deferred class BuilderArea; - class BuilderFace; - class BuilderSolid; - - class WireSplitter; - class WireEdgeSet; - class WESCorrector; - -- -- Pointers - -- - pointer PWireEdgeSet to WireEdgeSet from GEOMAlgo; - -- - -- - -- Instantiations - class DataMapOfShapeShapeSet instantiates - DataMap from TCollection(Shape from TopoDS, - ShapeSet from GEOMAlgo, - ShapeMapHasher from TopTools); - - class DataMapOfShapeReal instantiates - DataMap from TCollection(Shape from TopoDS, - Real from Standard, - ShapeMapHasher from TopTools); - - - class DataMapOfRealListOfShape instantiates - DataMap from TCollection(Real from Standard, - ListOfShape from TopTools, - MapRealHasher from TColStd); -- - -- instantiations - - - class IndexedDataMapOfShapeBox - instantiates IndexedDataMap from TCollection (Shape from TopoDS, - Box from Bnd, - ShapeMapHasher from TopTools); - class IndexedDataMapOfIntegerShape - instantiates IndexedDataMap from TCollection (Integer from Standard, - Shape from TopoDS, - MapIntegerHasher from TColStd); - - class ListOfCoupleOfShapes - instantiates List from TCollection (CoupleOfShapes from GEOMAlgo); - - - class IndexedDataMapOfShapeState - instantiates IndexedDataMap from TCollection (Shape from TopoDS, - State from TopAbs, - ShapeMapHasher from TopTools); - class ListOfPnt - instantiates List from TCollection (Pnt from gp); - - class DataMapOfPassKeyInteger - instantiates DataMap from TCollection (PassKey from GEOMAlgo, - Integer from Standard, - PassKeyMapHasher from GEOMAlgo); - - class IndexedDataMapOfPassKeyShapeListOfShape - instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo, - ListOfShape from TopTools, - PassKeyShapeMapHasher from GEOMAlgo); - - class IndexedDataMapOfShapeShapeInfo - instantiates IndexedDataMap from TCollection (Shape from TopoDS, - ShapeInfo from GEOMAlgo, - ShapeMapHasher from TopTools); - - class DataMapOfPassKeyShapeShape - instantiates DataMap from TCollection (PassKeyShape from GEOMAlgo, - Shape from TopoDS, - PassKeyShapeMapHasher from GEOMAlgo); - - class DataMapOfShapeShapeSet instantiates - DataMap from TCollection(Shape from TopoDS, - ShapeSet from GEOMAlgo, - ShapeMapHasher from TopTools); - - class DataMapOfShapeReal instantiates - DataMap from TCollection(Shape from TopoDS, - Real from Standard, - ShapeMapHasher from TopTools); - - - class DataMapOfRealListOfShape instantiates - DataMap from TCollection(Real from Standard, - ListOfShape from TopTools, - MapRealHasher from TColStd); - -end GEOMAlgo; + --pointer PWireEdgeSet to WireEdgeSet from GEOMAlgo; + -- + -- diff --git a/src/GEOMAlgo/GEOMAlgo.pro b/src/GEOMAlgo/GEOMAlgo.pro deleted file mode 100644 index 8d8f69616..000000000 --- a/src/GEOMAlgo/GEOMAlgo.pro +++ /dev/null @@ -1,249 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMAlgo -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} ../NMTDS ../NMTTools - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lNMTTools $${STDLIB} $${CAS_LDPATH} -lTKBO -lTKShHealing -lTKBool -lTKMesh - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = BlockFix_BlockFixAPI.hxx -HEADERS += BlockFix_BlockFixAPI.lxx -HEADERS += BlockFix_CheckTool.hxx -HEADERS += Handle_BlockFix_BlockFixAPI.hxx -HEADERS += GEOMAlgo_Algo.hxx -HEADERS += GEOMAlgo_BuilderArea.hxx -HEADERS += GEOMAlgo_BuilderFace.hxx -HEADERS += GEOMAlgo_Builder.hxx -HEADERS += GEOMAlgo_BuilderShape.hxx -HEADERS += GEOMAlgo_BuilderSolid.hxx -HEADERS += GEOMAlgo_BuilderTools.hxx -HEADERS += GEOMAlgo_ClsfBox.hxx -HEADERS += GEOMAlgo_Clsf.hxx -HEADERS += GEOMAlgo_ClsfSurf.hxx -HEADERS += GEOMAlgo_CoupleOfShapes.hxx -HEADERS += GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx -HEADERS += GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx -HEADERS += GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx -HEADERS += GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx -HEADERS += GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx -HEADERS += GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx -HEADERS += GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx -HEADERS += GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx -HEADERS += GEOMAlgo_DataMapOfPassKeyInteger.hxx -HEADERS += GEOMAlgo_DataMapOfRealListOfShape.hxx -HEADERS += GEOMAlgo_DataMapOfShapeReal.hxx -HEADERS += GEOMAlgo_DataMapOfShapeShapeSet.hxx -HEADERS += GEOMAlgo_FinderShapeOn1.hxx -HEADERS += GEOMAlgo_FinderShapeOn2.hxx -HEADERS += GEOMAlgo_FinderShapeOn.hxx -HEADERS += GEOMAlgo_FinderShapeOnQuad.hxx -HEADERS += GEOMAlgo_GlueAnalyser.hxx -HEADERS += GEOMAlgo_Gluer.hxx -HEADERS += GEOMAlgo_HAlgo.hxx -HEADERS += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx -HEADERS += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx -HEADERS += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx -HEADERS += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx -HEADERS += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx -HEADERS += GEOMAlgo_IndexedDataMapOfIntegerShape.hxx -HEADERS += GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx -HEADERS += GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx -HEADERS += GEOMAlgo_IndexedDataMapOfShapeBox.hxx -HEADERS += GEOMAlgo_IndexedDataMapOfShapeState.hxx -HEADERS += GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx -HEADERS += GEOMAlgo_ListIteratorOfListOfPnt.hxx -HEADERS += GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx -HEADERS += GEOMAlgo_ListNodeOfListOfPnt.hxx -HEADERS += GEOMAlgo_ListOfCoupleOfShapes.hxx -HEADERS += GEOMAlgo_ListOfPnt.hxx -HEADERS += GEOMAlgo_PassKey.hxx -HEADERS += GEOMAlgo_PassKeyMapHasher.hxx -HEADERS += GEOMAlgo_PassKeyShape.hxx -HEADERS += GEOMAlgo_PassKeyShapeMapHasher.hxx -HEADERS += GEOMAlgo_PWireEdgeSet.hxx -HEADERS += GEOMAlgo_ShapeAlgo.hxx -HEADERS += GEOMAlgo_ShapeSet.hxx -HEADERS += GEOMAlgo_ShapeSolid.hxx -HEADERS += GEOMAlgo_ShellSolid.hxx -HEADERS += GEOMAlgo_SolidSolid.hxx -HEADERS += GEOMAlgo_Splitter.hxx -HEADERS += GEOMAlgo_StateCollector.hxx -HEADERS += GEOMAlgo_State.hxx -HEADERS += GEOMAlgo_SurfaceTools.hxx -HEADERS += GEOMAlgo_Tools3D.hxx -HEADERS += GEOMAlgo_Tools.hxx -HEADERS += GEOMAlgo_VertexSolid.hxx -HEADERS += GEOMAlgo_WESCorrector.hxx -HEADERS += GEOMAlgo_WireEdgeSet.hxx -HEADERS += GEOMAlgo_WireSolid.hxx -HEADERS += GEOMAlgo_WireSplitter.hxx -HEADERS += Handle_GEOMAlgo_ClsfBox.hxx -HEADERS += Handle_GEOMAlgo_Clsf.hxx -HEADERS += Handle_GEOMAlgo_ClsfSurf.hxx -HEADERS += Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx -HEADERS += Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx -HEADERS += Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx -HEADERS += Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx -HEADERS += Handle_GEOMAlgo_HAlgo.hxx -HEADERS += Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx -HEADERS += Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx -HEADERS += Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx -HEADERS += Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx -HEADERS += Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx -HEADERS += Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx -HEADERS += Handle_GEOMAlgo_ListNodeOfListOfPnt.hxx -HEADERS += GEOMAlgo_ClsfSolid.hxx -HEADERS += GEOMAlgo_ClsfSolid.ixx -HEADERS += GEOMAlgo_ClsfSolid.jxx -HEADERS += GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx -HEADERS += GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx -HEADERS += GEOMAlgo_DataMapOfPassKeyShapeShape.hxx -HEADERS += GEOMAlgo_Gluer1.cxx -HEADERS += GEOMAlgo_Gluer1.hxx -HEADERS += GEOMAlgo_Gluer1.ixx -HEADERS += GEOMAlgo_Gluer1.jxx -HEADERS += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx -HEADERS += GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx -HEADERS += GEOMAlgo_KindOfBounds.hxx -HEADERS += GEOMAlgo_KindOfClosed.hxx -HEADERS += GEOMAlgo_KindOfName.hxx -HEADERS += GEOMAlgo_KindOfShape.hxx -HEADERS += GEOMAlgo_ShapeInfo.hxx -HEADERS += GEOMAlgo_ShapeInfo.ixx -HEADERS += GEOMAlgo_ShapeInfo.jxx -HEADERS += GEOMAlgo_ShapeInfoFiller.hxx -HEADERS += GEOMAlgo_ShapeInfoFiller.ixx -HEADERS += GEOMAlgo_ShapeInfoFiller.jxx -HEADERS += Handle_GEOMAlgo_ClsfSolid.hxx -HEADERS += Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx -HEADERS += Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx - -SOURCES = BlockFix.cxx -SOURCES += BlockFix_BlockFixAPI.cxx -SOURCES += BlockFix_CheckTool.cxx -SOURCES += BlockFix_PeriodicSurfaceModifier.cxx -SOURCES += BlockFix_SphereSpaceModifier.cxx -SOURCES += BlockFix_UnionEdges.cxx -SOURCES += BlockFix_UnionFaces.cxx -SOURCES += GEOMAlgo_Algo.cxx -SOURCES += GEOMAlgo_Builder_0.cxx -SOURCES += GEOMAlgo_Builder_1.cxx -SOURCES += GEOMAlgo_Builder_2.cxx -SOURCES += GEOMAlgo_Builder_3.cxx -SOURCES += GEOMAlgo_Builder_4.cxx -SOURCES += GEOMAlgo_BuilderArea.cxx -SOURCES += GEOMAlgo_Builder.cxx -SOURCES += GEOMAlgo_BuilderFace.cxx -SOURCES += GEOMAlgo_BuilderShape.cxx -SOURCES += GEOMAlgo_BuilderSolid.cxx -SOURCES += GEOMAlgo_BuilderTools.cxx -SOURCES += GEOMAlgo_ClsfBox.cxx -SOURCES += GEOMAlgo_Clsf.cxx -SOURCES += GEOMAlgo_ClsfSurf.cxx -SOURCES += GEOMAlgo_CoupleOfShapes.cxx -SOURCES += GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx -SOURCES += GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_0.cxx -SOURCES += GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_0.cxx -SOURCES += GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_0.cxx -SOURCES += GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_0.cxx -SOURCES += GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_0.cxx -SOURCES += GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_0.cxx -SOURCES += GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_0.cxx -SOURCES += GEOMAlgo_DataMapOfPassKeyInteger_0.cxx -SOURCES += GEOMAlgo_DataMapOfRealListOfShape_0.cxx -SOURCES += GEOMAlgo_DataMapOfShapeReal_0.cxx -SOURCES += GEOMAlgo_DataMapOfShapeShapeSet_0.cxx -SOURCES += GEOMAlgo_FinderShapeOn1.cxx -SOURCES += GEOMAlgo_FinderShapeOn2.cxx -SOURCES += GEOMAlgo_FinderShapeOn.cxx -SOURCES += GEOMAlgo_FinderShapeOnQuad.cxx -SOURCES += GEOMAlgo_GlueAnalyser.cxx -SOURCES += GEOMAlgo_Gluer.cxx -SOURCES += GEOMAlgo_HAlgo.cxx -SOURCES += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapOfShapeState_0.cxx -SOURCES += GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx -SOURCES += GEOMAlgo_ListIteratorOfListOfPnt_0.cxx -SOURCES += GEOMAlgo_ListNodeOfListOfCoupleOfShapes_0.cxx -SOURCES += GEOMAlgo_ListNodeOfListOfPnt_0.cxx -SOURCES += GEOMAlgo_ListOfCoupleOfShapes_0.cxx -SOURCES += GEOMAlgo_ListOfPnt_0.cxx -SOURCES += GEOMAlgo_PassKey.cxx -SOURCES += GEOMAlgo_PassKeyMapHasher.cxx -SOURCES += GEOMAlgo_PassKeyShape.cxx -SOURCES += GEOMAlgo_PassKeyShapeMapHasher.cxx -SOURCES += GEOMAlgo_ShapeAlgo.cxx -SOURCES += GEOMAlgo_ShapeSet.cxx -SOURCES += GEOMAlgo_ShapeSolid.cxx -SOURCES += GEOMAlgo_ShellSolid.cxx -SOURCES += GEOMAlgo_SolidSolid.cxx -SOURCES += GEOMAlgo_Splitter.cxx -SOURCES += GEOMAlgo_StateCollector.cxx -SOURCES += GEOMAlgo_SurfaceTools.cxx -SOURCES += GEOMAlgo_Tools3D.cxx -SOURCES += GEOMAlgo_Tools.cxx -SOURCES += GEOMAlgo_VertexSolid.cxx -SOURCES += GEOMAlgo_WESCorrector.cxx -SOURCES += GEOMAlgo_WireEdgeSet.cxx -SOURCES += GEOMAlgo_WireSolid.cxx -SOURCES += GEOMAlgo_WireSplitter.cxx -SOURCES += GEOMAlgo_ClsfSolid.cxx -SOURCES += GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx -SOURCES += GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx -SOURCES += GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx -SOURCES += GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx -SOURCES += GEOMAlgo_ShapeInfoFiller_1.cxx -SOURCES += GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx -SOURCES += GEOMAlgo_ShapeInfo.cxx -SOURCES += GEOMAlgo_ShapeInfoFiller.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.cdl b/src/GEOMAlgo/GEOMAlgo_Algo.cdl deleted file mode 100755 index 32f3a1b33..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Algo.cdl +++ /dev/null @@ -1,58 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Algo.cdl --- Created: Sat Dec 04 12:37:56 2004 --- Author: Peter KURNEV --- --- -deferred class Algo from GEOMAlgo - - ---Purpose: - ---uses ---raises - -is - Initialize - returns Algo from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Algo();" - - Perform(me:out) - is deferred; - - CheckData(me:out) - is virtual protected; - - CheckResult(me:out) - is virtual protected; - - ErrorStatus (me) - returns Integer from Standard; - - WarningStatus (me) - returns Integer from Standard; - -fields - myErrorStatus : Integer from Standard is protected; - myWarningStatus : Integer from Standard is protected; - -end Algo; diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.cxx b/src/GEOMAlgo/GEOMAlgo_Algo.cxx index a3426fffe..f159c1a57 100755 --- a/src/GEOMAlgo/GEOMAlgo_Algo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Algo.cxx @@ -1,50 +1,52 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Algo.cxx -// Created: Sat Dec 04 12:39:47 2004 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_Algo.cxx +// Created: Sat Dec 04 12:39:47 2004 +// Author: Peter KURNEV +// // -#include +#include //======================================================================= -// function: -// purpose: +// function: +// purpose: //======================================================================= GEOMAlgo_Algo::GEOMAlgo_Algo() : myErrorStatus(1), - myWarningStatus(0) + myWarningStatus(0), + myComputeInternalShapes(Standard_True) {} //======================================================================= // function: ~ -// purpose: +// purpose: //======================================================================= GEOMAlgo_Algo::~GEOMAlgo_Algo() { } //======================================================================= // function: CheckData -// purpose: +// purpose: //======================================================================= void GEOMAlgo_Algo::CheckData() { @@ -52,7 +54,7 @@ } //======================================================================= // function: CheckResult -// purpose: +// purpose: //======================================================================= void GEOMAlgo_Algo::CheckResult() { @@ -60,7 +62,7 @@ } //======================================================================= // function: ErrorStatus -// purpose: +// purpose: //======================================================================= Standard_Integer GEOMAlgo_Algo::ErrorStatus()const { @@ -68,7 +70,7 @@ } //======================================================================= // function: WarningStatus -// purpose: +// purpose: //======================================================================= Standard_Integer GEOMAlgo_Algo::WarningStatus()const { @@ -77,3 +79,12 @@ // myErrorStatus // // 1 - object is just initialized + +//======================================================================= +//function : ComputeInternalShapes +//purpose : +//======================================================================= + void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag) +{ + myComputeInternalShapes = theFlag; +} diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.hxx b/src/GEOMAlgo/GEOMAlgo_Algo.hxx index a0df056ba..b82398fe1 100644 --- a/src/GEOMAlgo/GEOMAlgo_Algo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Algo.hxx @@ -1,112 +1,75 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_Algo.hxx +// Created: Sat Dec 04 12:39:47 2004 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_Algo_HeaderFile #define _GEOMAlgo_Algo_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT virtual void Perform() = 0; - - -Standard_EXPORT Standard_Integer ErrorStatus() const; - - -Standard_EXPORT Standard_Integer WarningStatus() const; +#include +#include +//======================================================================= +//class : GEOMAlgo_Algo +//purpose : +//======================================================================= +class GEOMAlgo_Algo +{ + public: + Standard_EXPORT + virtual void Perform() = 0; + Standard_EXPORT + Standard_Integer ErrorStatus() const; + Standard_EXPORT + Standard_Integer WarningStatus() const; + //! Allows to omit of creation of internal shapes (manifold topology).
    + //! Needed for the SALOME/TRIPOLI module.
    + Standard_EXPORT + void ComputeInternalShapes(const Standard_Boolean theFlag) ; protected: + Standard_EXPORT + GEOMAlgo_Algo(); - // Methods PROTECTED - // + Standard_EXPORT + virtual ~GEOMAlgo_Algo(); + Standard_EXPORT + virtual void CheckData() ; -Standard_EXPORT GEOMAlgo_Algo(); -Standard_EXPORT virtual ~GEOMAlgo_Algo(); - - -Standard_EXPORT virtual void CheckData() ; - - -Standard_EXPORT virtual void CheckResult() ; - - - // Fields PROTECTED - // -Standard_Integer myErrorStatus; -Standard_Integer myWarningStatus; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + virtual void CheckResult() ; + Standard_Integer myErrorStatus; + Standard_Integer myWarningStatus; + Standard_Boolean myComputeInternalShapes; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.ixx b/src/GEOMAlgo/GEOMAlgo_Algo.ixx deleted file mode 100644 index c45fc54ca..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Algo.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.jxx b/src/GEOMAlgo/GEOMAlgo_Algo.jxx deleted file mode 100644 index 5dcdb780c..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Algo.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_Algo_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.cdl b/src/GEOMAlgo/GEOMAlgo_Builder.cdl deleted file mode 100755 index 8bdcd4935..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Builder.cdl +++ /dev/null @@ -1,254 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Builder.cdl --- Created: --- Author: Peter KURNEV --- -class Builder from GEOMAlgo - inherits BuilderShape from GEOMAlgo - - ---Purpose: - -uses - ShapeEnum from TopAbs, - Shape from TopoDS, - - ListOfShape from TopTools, - IndexedDataMapOfShapeListOfShape from TopTools, - IndexedDataMapOfShapeShape from TopTools, - MapOfShape from TopTools, - Image from BRepAlgo, - - PaveFiller from NMTTools, - PPaveFiller from NMTTools - ---raises - -is - - Create - ---Purpose: Empty constructor - returns Builder from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Builder();" - - Perform(me:out) - ---Purpose: Performs calculations - is redefined; - - PerformWithFiller(me:out; - theDSF: PaveFiller from NMTTools) - ---Purpose: Performs calculations using prepared PaveFiller - -- object theDSF - is virtual; - - AddShape (me:out; - theShape: Shape from TopoDS) - ---Purpose: Adds argument theShape of the operation - is virtual; - - Clear(me:out) - ---Purpose: Clears internal fields and arguments - is virtual; - - Shapes(me) - ---Purpose: Returns the arguments of the operation - returns ListOfShape from TopTools; - ---C++: return const & - -- - -- History support - -- - Generated (me:out; - theS : Shape from TopoDS) - ---Purpose: Returns the list of shapes generated from the - -- shape theS. - returns ListOfShape from TopTools - is redefined; - ---C++: return const & - - Modified (me:out; - theS : Shape from TopoDS) - ---Purpose: Returns the list of shapes modified from the shape - -- theS. - returns ListOfShape from TopTools - is redefined; - ---C++: return const & - - IsDeleted (me:out; - theS : Shape from TopoDS) - ---Purpose: Returns true if the shape theS has been deleted. - returns Boolean from Standard - is redefined; - -- - -- protected methods - -- - PerformInternal(me:out; - theDSF: PaveFiller from NMTTools) - ---Purpose: Performs calculations using prepared DSFiller - -- object theDSF - is virtual protected; - - PrepareHistory (me:out) - ---Purpose: Prepare information for history support - is redefined protected; - - ClearInternals(me:out) - ---Purpose: Clears internal fields - is virtual protected; - - Prepare(me:out) - ---Purpose: Provides preparing actions - is virtual protected; - - PostTreat(me:out) - ---Purpose: Provides post-tratment actions - is virtual protected; - - AddShape1 (me:out; - theShape: Shape from TopoDS) - ---Purpose: Append the argument theShape to - -- typified lists of arguments myShapes1 - is protected; - - BuildResult(me:out; - theType: ShapeEnum from TopAbs) - ---Purpose: Build the resulting shapes of type theType - is virtual protected; - - -- Vertices - FillImagesVertices(me:out) - ---Purpose: Fill Images for vertices - is protected; - - -- Edges - FillImagesEdges(me:out) - ---Purpose: Fill Images for edges - is protected; - -- - -- Faces - FillImagesFaces(me:out) - ---Purpose: Fill Images for faces - is protected; - - FillIn2DParts(me:out) - ---Purpose: For each interferred face find split edges - -- that are in 2-D domain of the face - is protected; - - BuildSplitFaces(me:out) - ---Purpose: Build draft faces - is protected; - - FillSameDomainFaces(me:out) - ---Purpose: Among draft faces find same domain faces - is protected; - - FillImagesFaces1(me:out) - ---Purpose: Fill Images for faces - -- taking into account same domain faces - is protected; - - FillInternalVertices(me:out) - ---Purpose: Update Images for faces by - -- internal vertices - is protected; - -- - -- Wires, Shells, Compsolids, Compounds - FillImagesContainers(me:out; - theType:ShapeEnum from TopAbs) - ---Purpose: Fill Images for Wires, Shells, Compsolids, Compounds - is protected; - -- - -- Solids - FillImagesSolids(me:out) - ---Purpose: Fill Images for solids - is protected; - - FillIn3DParts(me:out) - ---Purpose: For each interferred solid find split faces - -- that are in 3-D domain of the solid - is protected; - - BuildSplitSolids(me:out) - ---Purpose: Build draft solids - is protected; - - FillInternalShapes(me:out) - ---Purpose: Update draft solids by - -- internal shells, edges, vertices - is protected; - - BuildDraftSolid(me:out; - theSolid: Shape from TopoDS; - theDraftSolid: out Shape from TopoDS; - theInternalFaces: out ListOfShape from TopTools) - ---Purpose: Build solid theDraftSolid that consists of - -- non-internal split faces of the solid - -- theSolid. - -- All splits of internal faces of - -- theSolid are in the list: theInternalFaces - is protected; - -- - -- debug methods - -- - AddCompound (me:out; - theShape: Shape from TopoDS); - ---Purpose: Adds arguments of the operation as - -- shapes of upper level of container shape theShape - Shapes1(me; - theType: Integer from Standard) - ---Purpose: Returns list of arguments of type theType - returns ListOfShape from TopTools; - ---C++: return const & - - Images(me) - ---Purpose: Returns image shapes - returns Image from BRepAlgo; - ---C++: return const & - - InParts(me; - theShape:Shape from TopoDS) - ---Purpose: Returns split-parts of shapes that have - -- state IN for the domain of shape theShape - returns ListOfShape from TopTools; - ---C++: return const & - - -- ===================================================== - -fields - myPaveFiller : PPaveFiller from NMTTools is protected; - myShapes : ListOfShape from TopTools is protected; - -- Common usage - myNbTypes : Integer from Standard is protected; - myMapFence : MapOfShape from TopTools is protected; - myShapes1 : ListOfShape from TopTools[9] is protected; - myImages : Image from BRepAlgo is protected; - myInParts : IndexedDataMapOfShapeListOfShape from TopTools is protected; - - -- Faces - mySplitFaces : Image from BRepAlgo is protected; - mySameDomainShapes: IndexedDataMapOfShapeShape from TopTools is protected; - -- solids - myDraftSolids : IndexedDataMapOfShapeShape from TopTools is protected; - myEntryPoint : Integer from Standard is protected; - -- -end Builder; - diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.cxx b/src/GEOMAlgo/GEOMAlgo_Builder.cxx index 8631ecd42..669274cfa 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.cxx @@ -1,29 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Builder.cxx -// Created: -// Author: Peter KURNEV +// File: GEOMAlgo_Builder.cxx +// Created: +// Author: Peter KURNEV // -#include +#include #include @@ -41,10 +41,11 @@ #include #include +#include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_Builder::GEOMAlgo_Builder() : @@ -56,7 +57,7 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_Builder::~GEOMAlgo_Builder() { @@ -69,7 +70,7 @@ } //======================================================================= //function : AddCompound -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::AddCompound(const TopoDS_Shape& theShape) { @@ -83,7 +84,7 @@ } //======================================================================= //function : AddShape -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::AddShape(const TopoDS_Shape& theShape) { @@ -93,7 +94,7 @@ } //======================================================================= //function : Shapes -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Shapes()const { @@ -101,7 +102,7 @@ } //======================================================================= //function : Clear -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::Clear() { @@ -110,7 +111,7 @@ } //======================================================================= //function : ClearInternals -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::ClearInternals() { @@ -129,7 +130,7 @@ } //======================================================================= //function : Prepare -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::Prepare() { @@ -157,31 +158,10 @@ AddShape1(aS); } } -//======================================================================= -//function : PostTreat -//purpose : -//======================================================================= - void GEOMAlgo_Builder::PostTreat() -{ - Standard_Integer aNbS; - TopoDS_Iterator aIt; - TopTools_ListOfShape aLS; - // - aIt.Initialize(myShape); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - aLS.Append(aS); - } - aNbS=aLS.Extent(); - if (aNbS==1) { - myShape=aLS.First(); - } - - BRepLib::SameParameter(myShape, 1.e-7, Standard_True); -} + //======================================================================= //function : AddShape1 -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::AddShape1(const TopoDS_Shape& theShape) { @@ -206,7 +186,7 @@ } //======================================================================= //function : BuildResult -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType) { @@ -223,26 +203,26 @@ aType=aS.ShapeType(); if (aType==theType) { if (myImages.HasImage(aS)){ - const TopTools_ListOfShape& aLSIm=myImages.Image(aS); - aItIm.Initialize(aLSIm); - for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aSIm=aItIm.Value(); - if (aM.Add(aSIm)) { - aBB.Add(myShape, aSIm); - } - } + const TopTools_ListOfShape& aLSIm=myImages.Image(aS); + aItIm.Initialize(aLSIm); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aSIm=aItIm.Value(); + if (aM.Add(aSIm)) { + aBB.Add(myShape, aSIm); + } + } } else { - if (aM.Add(aS)) { - aBB.Add(myShape, aS); - } + if (aM.Add(aS)) { + aBB.Add(myShape, aS); + } } } } } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::Perform() { @@ -270,7 +250,7 @@ } //======================================================================= //function : PerformWithFiller -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::PerformWithFiller(const NMTTools_PaveFiller& theDSF) { @@ -280,7 +260,7 @@ } //======================================================================= //function : PerformInternal -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::PerformInternal(const NMTTools_PaveFiller& pPF) { @@ -323,7 +303,7 @@ if (myErrorStatus) { return; } - + BuildResult(TopAbs_EDGE); if (myErrorStatus) { return; @@ -333,29 +313,29 @@ if (myErrorStatus) { return; } - + BuildResult(TopAbs_WIRE); if (myErrorStatus) { return; } - + // 3.4 Faces FillImagesFaces(); if (myErrorStatus) { return; } - + BuildResult(TopAbs_FACE); if (myErrorStatus) { return; } // 3.5 Shells - + FillImagesContainers(TopAbs_SHELL); if (myErrorStatus) { return; } - + BuildResult(TopAbs_SHELL); if (myErrorStatus) { return; @@ -365,7 +345,7 @@ if (myErrorStatus) { return; } - + BuildResult(TopAbs_SOLID); if (myErrorStatus) { return; @@ -375,7 +355,7 @@ if (myErrorStatus) { return; } - + BuildResult(TopAbs_COMPSOLID); if (myErrorStatus) { return; @@ -385,7 +365,7 @@ if (myErrorStatus) { return; } - + BuildResult(TopAbs_COMPOUND); if (myErrorStatus) { return; @@ -394,14 +374,43 @@ // 4.History PrepareHistory(); // - // 5 Post-treatment + // 5 Post-treatment PostTreat(); } // +// static +// void CorrectWires(const TopoDS_Shape& aS); +// +//======================================================================= +//function : PostTreat +//purpose : +//======================================================================= + void GEOMAlgo_Builder::PostTreat() +{ + Standard_Integer aNbS; + TopoDS_Iterator aIt; + TopTools_ListOfShape aLS; + // + aIt.Initialize(myShape); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + aLS.Append(aS); + } + aNbS=aLS.Extent(); + if (aNbS==1) { + myShape=aLS.First(); + } + + BRepLib::SameParameter(myShape, 1.e-7, Standard_True); + // + GEOMAlgo_Tools::CorrectWires(myShape); +} +// // myErrorStatus -// +// // 0 - Ok // 1 - The object is just initialized // 2 - PaveFiller is failed // 10 - No shapes to process // 30 - SolidBuilder failed + diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.hxx b/src/GEOMAlgo/GEOMAlgo_Builder.hxx index c5aa8f23d..47d175564 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder.hxx @@ -1,252 +1,224 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_Builder.cxx +// Created: +// Author: Peter KURNEV // #ifndef _GEOMAlgo_Builder_HeaderFile #define _GEOMAlgo_Builder_HeaderFile -#ifndef _NMTTools_PPaveFiller_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile #include -#endif -#ifndef _BRepAlgo_Image_HeaderFile #include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile #include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeShape_HeaderFile #include -#endif -#ifndef _GEOMAlgo_BuilderShape_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile +#include #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -class NMTTools_PaveFiller; -class TopoDS_Shape; -class TopTools_ListOfShape; -class BRepAlgo_Image; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_Builder : public GEOMAlgo_BuilderShape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Empty constructor
    -Standard_EXPORT GEOMAlgo_Builder(); -Standard_EXPORT virtual ~GEOMAlgo_Builder(); - -//! Performs calculations
    -Standard_EXPORT virtual void Perform() ; - -//! Performs calculations using prepared PaveFiller
    -//! object theDSF
    -Standard_EXPORT virtual void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ; - -//! Adds argument theShape of the operation
    -Standard_EXPORT virtual void AddShape(const TopoDS_Shape& theShape) ; - -//! Clears internal fields and arguments
    -Standard_EXPORT virtual void Clear() ; - -//! Returns the arguments of the operation
    -Standard_EXPORT const TopTools_ListOfShape& Shapes() const; - -//! Returns the list of shapes generated from the
    -//! shape theS.
    -Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ; - -//! Returns the list of shapes modified from the shape
    -//! theS.
    -Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ; - -//! Returns true if the shape theS has been deleted.
    -Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ; - -//! Adds arguments of the operation as
    -//! shapes of upper level of container shape theShape
    -Standard_EXPORT void AddCompound(const TopoDS_Shape& theShape) ; - -//! Returns list of arguments of type theType
    -Standard_EXPORT const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const; - -//! Returns image shapes
    -Standard_EXPORT const BRepAlgo_Image& Images() const; - -//! Returns split-parts of shapes that have
    -//! state IN for the domain of shape theShape
    -Standard_EXPORT const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const; - - - +#include +#include +//======================================================================= +//function : GEOMAlgo_Builder +//purpose : +//======================================================================= +class GEOMAlgo_Builder : public GEOMAlgo_BuilderShape +{ + public: + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_Builder(); + + Standard_EXPORT + virtual ~GEOMAlgo_Builder(); + + //! Performs calculations
    + Standard_EXPORT + virtual void Perform() ; + + //! Performs calculations using prepared PaveFiller
    + //! object theDSF
    + Standard_EXPORT + virtual void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ; + + //! Adds argument theShape of the operation
    + Standard_EXPORT + virtual void AddShape(const TopoDS_Shape& theShape) ; + + //! Clears internal fields and arguments
    + Standard_EXPORT + virtual void Clear() ; + + //! Returns the arguments of the operation
    + Standard_EXPORT + const TopTools_ListOfShape& Shapes() const; + + //! Returns the list of shapes generated from the
    + //! shape theS.
    + Standard_EXPORT + virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ; + + //! Returns the list of shapes modified from the shape
    + //! theS.
    + Standard_EXPORT + virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ; + + //! Returns true if the shape theS has been deleted.
    + Standard_EXPORT + virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ; + + //! Adds arguments of the operation as
    + //! shapes of upper level of container shape theShape
    + Standard_EXPORT + void AddCompound(const TopoDS_Shape& theShape) ; + + //! Returns list of arguments of type theType
    + Standard_EXPORT + const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const; + + //! Returns image shapes
    + Standard_EXPORT + const BRepAlgo_Image& Images() const; + + //! Returns split-parts of shapes that have
    + //! state IN for the domain of shape theShape
    + Standard_EXPORT + const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const; protected: - - // Methods PROTECTED - // - -//! Performs calculations using prepared DSFiller
    -//! object theDSF
    -Standard_EXPORT virtual void PerformInternal(const NMTTools_PaveFiller& theDSF) ; - -//! Prepare information for history support
    -Standard_EXPORT virtual void PrepareHistory() ; - -//! Clears internal fields
    -Standard_EXPORT virtual void ClearInternals() ; - -//! Provides preparing actions
    -Standard_EXPORT virtual void Prepare() ; - -//! Provides post-tratment actions
    -Standard_EXPORT virtual void PostTreat() ; - -//! Append the argument theShape to
    -//! typified lists of arguments myShapes1
    -Standard_EXPORT void AddShape1(const TopoDS_Shape& theShape) ; - -//! Build the resulting shapes of type theType
    -Standard_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType) ; - -//! Fill Images for vertices
    -Standard_EXPORT void FillImagesVertices() ; - -//! Fill Images for edges
    -Standard_EXPORT void FillImagesEdges() ; - -//! Fill Images for faces
    -Standard_EXPORT void FillImagesFaces() ; - -//! For each interferred face find split edges
    -//! that are in 2-D domain of the face
    -Standard_EXPORT void FillIn2DParts() ; - -//! Build draft faces
    -Standard_EXPORT void BuildSplitFaces() ; - -//! Among draft faces find same domain faces
    -Standard_EXPORT void FillSameDomainFaces() ; - -//! Fill Images for faces
    -//! taking into account same domain faces
    -Standard_EXPORT void FillImagesFaces1() ; - -//! Update Images for faces by
    -//! internal vertices
    -Standard_EXPORT void FillInternalVertices() ; - -//! Fill Images for Wires, Shells, Compsolids, Compounds
    -Standard_EXPORT void FillImagesContainers(const TopAbs_ShapeEnum theType) ; - -//! Fill Images for solids
    -Standard_EXPORT void FillImagesSolids() ; - -//! For each interferred solid find split faces
    -//! that are in 3-D domain of the solid
    -Standard_EXPORT void FillIn3DParts() ; - -//! Build draft solids
    -Standard_EXPORT void BuildSplitSolids() ; - -//! Update draft solids by
    -//! internal shells, edges, vertices
    -Standard_EXPORT void FillInternalShapes() ; - -//! Build solid theDraftSolid that consists of
    -//! non-internal split faces of the solid
    -//! theSolid.
    -//! All splits of internal faces of
    -//! theSolid are in the list: theInternalFaces
    -Standard_EXPORT void BuildDraftSolid(const TopoDS_Shape& theSolid,TopoDS_Shape& theDraftSolid,TopTools_ListOfShape& theInternalFaces) ; - - - // Fields PROTECTED - // -NMTTools_PPaveFiller myPaveFiller; -TopTools_ListOfShape myShapes; -Standard_Integer myNbTypes; -TopTools_MapOfShape myMapFence; -TopTools_ListOfShape myShapes1[9]; -BRepAlgo_Image myImages; -TopTools_IndexedDataMapOfShapeListOfShape myInParts; -BRepAlgo_Image mySplitFaces; -TopTools_IndexedDataMapOfShapeShape mySameDomainShapes; -TopTools_IndexedDataMapOfShapeShape myDraftSolids; -Standard_Integer myEntryPoint; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - + //! Performs calculations using prepared DSFiller
    + //! object theDSF
    + Standard_EXPORT + virtual void PerformInternal(const NMTTools_PaveFiller& theDSF) ; + + //! Prepare information for history support
    + Standard_EXPORT + virtual void PrepareHistory() ; + + //! Clears internal fields
    + Standard_EXPORT + virtual void ClearInternals() ; + + //! Provides preparing actions
    + Standard_EXPORT + virtual void Prepare() ; + + //! Provides post-tratment actions
    + Standard_EXPORT + virtual void PostTreat() ; + + //! Append the argument theShape to
    + //! typified lists of arguments myShapes1
    + Standard_EXPORT + void AddShape1(const TopoDS_Shape& theShape) ; + + //! Build the resulting shapes of type theType
    + Standard_EXPORT + virtual void BuildResult(const TopAbs_ShapeEnum theType) ; + + //! Fill Images for vertices
    + Standard_EXPORT + void FillImagesVertices() ; + + //! Fill Images for edges
    + Standard_EXPORT + void FillImagesEdges() ; + + //! Fill Images for faces
    + Standard_EXPORT + void FillImagesFaces() ; + + //! For each interferred face find split edges
    + //! that are in 2-D domain of the face
    + Standard_EXPORT + void FillIn2DParts() ; + + //! Build draft faces
    + Standard_EXPORT + void BuildSplitFaces() ; + + //! Among draft faces find same domain faces
    + Standard_EXPORT + void FillSameDomainFaces() ; + + //! Fill Images for faces
    + //! taking into account same domain faces
    + Standard_EXPORT + void FillImagesFaces1() ; + + //! Update Images for faces by
    + //! internal vertices
    + Standard_EXPORT + void FillInternalVertices() ; + + //! Fill Images for Wires, Shells, Compsolids, Compounds
    + Standard_EXPORT + void FillImagesContainers(const TopAbs_ShapeEnum theType) ; + + //! Fill Images for solids
    + Standard_EXPORT + void FillImagesSolids() ; + + //! For each interferred solid find split faces
    + //! that are in 3-D domain of the solid
    + Standard_EXPORT + void FillIn3DParts() ; + + //! Build draft solids
    + Standard_EXPORT + void BuildSplitSolids() ; + + //! Update draft solids by
    + //! internal shells, edges, vertices
    + Standard_EXPORT + void FillInternalShapes() ; + + //! Build solid theDraftSolid that consists of
    + //! non-internal split faces of the solid
    + //! theSolid.
    + //! All splits of internal faces of
    + //! theSolid are in the list: theInternalFaces
    + Standard_EXPORT + void BuildDraftSolid(const TopoDS_Shape& theSolid, + TopoDS_Shape& theDraftSolid, + TopTools_ListOfShape& theInternalFaces) ; + + + NMTTools_PPaveFiller myPaveFiller; + TopTools_ListOfShape myShapes; + Standard_Integer myNbTypes; + TopTools_MapOfShape myMapFence; + TopTools_ListOfShape myShapes1[9]; + BRepAlgo_Image myImages; + TopTools_IndexedDataMapOfShapeListOfShape myInParts; + BRepAlgo_Image mySplitFaces; + TopTools_IndexedDataMapOfShapeShape mySameDomainShapes; + TopTools_IndexedDataMapOfShapeShape myDraftSolids; + Standard_Integer myEntryPoint; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.ixx b/src/GEOMAlgo/GEOMAlgo_Builder.ixx deleted file mode 100644 index 7926e82e8..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Builder.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_Builder.jxx b/src/GEOMAlgo/GEOMAlgo_Builder.jxx deleted file mode 100644 index 2b50611b6..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Builder.jxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_PaveFiller_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _BRepAlgo_Image_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Builder_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderArea.cdl b/src/GEOMAlgo/GEOMAlgo_BuilderArea.cdl deleted file mode 100755 index beed084dd..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderArea.cdl +++ /dev/null @@ -1,103 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: ModGlue_BuilderArea.cdl --- Created: --- Author: Peter KURNEV --- -deferred class BuilderArea from GEOMAlgo - inherits Algo from GEOMAlgo - - ---Purpose: The root class for algorithms to build - -- faces/solids from set of edges/faces - -uses - Shape from TopoDS, - ListOfShape from TopTools, - MapOfOrientedShape from TopTools, - Context from IntTools, - PContext from IntTools - ---raises - -is - Initialize - ---Purpose: Empty constructor - returns BuilderArea from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_BuilderArea();" - - SetContext(me:out; - theContext:Context from IntTools); - ---Purpose: Sets cashed geometrical tools - - SetShapes(me:out; - theLS:ListOfShape from TopTools); - ---Purpose: Sets edges/faces to process - - Shapes(me) - ---Purpose: Returns edges/faces to process - returns ListOfShape from TopTools; - ---C++: return const & - - Loops(me) - ---Purpose: Returns wires/shells that have been built - returns ListOfShape from TopTools; - ---C++: return const & - - Areas(me) - ---Purpose: Returns faces/solids that have been built - returns ListOfShape from TopTools; - ---C++: return const & - - PerformShapesToAvoid(me:out) - ---Purpose: Collect the edges/faces that - -- a) are internal - -- b) are the same and have different orientation - is virtual protected; - - PerformLoops(me:out) - ---Purpose: Build draft faces/shells - -- a)myLoops - draft faces/shells that consist of - -- boundary edges/faces - -- b)myLoopsInternal - draft faces/shells that contains - -- inner edges/faces - is virtual protected; - - PerformAreas(me:out) - ---Purpose: Build draft faces/solids that contains boundary faces - is virtual protected; - - PerformInternalShapes(me:out) - ---Purpose: Build finalized faces/solids with internal wires/shells - is virtual protected; - - -fields - myShapes : ListOfShape from TopTools is protected; - myLoops : ListOfShape from TopTools is protected; - myLoopsInternal : ListOfShape from TopTools is protected; - myShapesToAvoid : MapOfOrientedShape from TopTools is protected; - myAreas : ListOfShape from TopTools is protected; - -- - myContext : PContext from IntTools is protected; - -end BuilderArea; - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderArea.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderArea.cxx index dbc4f51fb..d2dbd991b 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderArea.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderArea.cxx @@ -1,63 +1,82 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_BuilderArea.cxx -// Created: -// Author: Peter KURNEV + +// File: GEOMAlgo_BuilderArea.cxx +// Created: +// Author: Peter KURNEV // -#include +#include #include #include +#include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= - GEOMAlgo_BuilderArea::GEOMAlgo_BuilderArea() +GEOMAlgo_BuilderArea::GEOMAlgo_BuilderArea() : GEOMAlgo_Algo() { - myContext=NULL; } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= - GEOMAlgo_BuilderArea::~GEOMAlgo_BuilderArea() +GEOMAlgo_BuilderArea::~GEOMAlgo_BuilderArea() { } //======================================================================= //function : SetContext -//purpose : +//purpose : +//======================================================================= +void GEOMAlgo_BuilderArea::SetContext(const Handle(IntTools_Context)& theContext) +{ + myContext=theContext; +} +//======================================================================= +//function : Context +//purpose : //======================================================================= - void GEOMAlgo_BuilderArea::SetContext(const IntTools_Context& theContext) +const Handle(IntTools_Context)& GEOMAlgo_BuilderArea::Context()const { - myContext=(IntTools_Context*)&theContext; + return myContext; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_BuilderArea::Perform() +{ + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } } //======================================================================= //function : SetShapes -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderArea::SetShapes(const TopTools_ListOfShape& theLF) +void GEOMAlgo_BuilderArea::SetShapes(const TopTools_ListOfShape& theLF) { TopTools_ListIteratorOfListOfShape aIt; // @@ -70,54 +89,54 @@ } //======================================================================= //function : Shapes -//purpose : +//purpose : //======================================================================= - const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Shapes()const +const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Shapes()const { return myShapes; } //======================================================================= //function : Loops -//purpose : +//purpose : //======================================================================= - const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Loops()const +const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Loops()const { return myLoops; } //======================================================================= -//function : Solids -//purpose : +//function : Areas +//purpose : //======================================================================= - const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Areas()const +const TopTools_ListOfShape& GEOMAlgo_BuilderArea::Areas()const { return myAreas; } //======================================================================= //function :PerformShapesToAvoid -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderArea::PerformShapesToAvoid() +void GEOMAlgo_BuilderArea::PerformShapesToAvoid() { } //======================================================================= //function : PerformLoops -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderArea::PerformLoops() +void GEOMAlgo_BuilderArea::PerformLoops() { } //======================================================================= //function : PerformAreas -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderArea::PerformAreas() +void GEOMAlgo_BuilderArea::PerformAreas() { } //======================================================================= //function : PerformInternalShapes -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderArea::PerformInternalShapes() +void GEOMAlgo_BuilderArea::PerformInternalShapes() { } diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderArea.hxx b/src/GEOMAlgo/GEOMAlgo_BuilderArea.hxx index 91df68865..670517f32 100644 --- a/src/GEOMAlgo/GEOMAlgo_BuilderArea.hxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderArea.hxx @@ -1,146 +1,112 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: GEOMAlgo_BuilderArea.hxx +// Created: +// Author: Peter KURNEV +// + #ifndef _GEOMAlgo_BuilderArea_HeaderFile #define _GEOMAlgo_BuilderArea_HeaderFile -#ifndef _TopTools_ListOfShape_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_MapOfOrientedShape_HeaderFile #include -#endif -#ifndef _IntTools_PContext_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Algo_HeaderFile +#include #include -#endif -class IntTools_Context; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif +#include //! The root class for algorithms to build
    //! faces/solids from set of edges/faces
    -class GEOMAlgo_BuilderArea : public GEOMAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Sets cashed geometrical tools
    -Standard_EXPORT void SetContext(const IntTools_Context& theContext) ; - -//! Sets edges/faces to process
    -Standard_EXPORT void SetShapes(const TopTools_ListOfShape& theLS) ; - -//! Returns edges/faces to process
    -Standard_EXPORT const TopTools_ListOfShape& Shapes() const; - -//! Returns wires/shells that have been built
    -Standard_EXPORT const TopTools_ListOfShape& Loops() const; - -//! Returns faces/solids that have been built
    -Standard_EXPORT const TopTools_ListOfShape& Areas() const; - - - - - -protected: - - // Methods PROTECTED - // - -//! Empty constructor
    -Standard_EXPORT GEOMAlgo_BuilderArea(); -Standard_EXPORT virtual ~GEOMAlgo_BuilderArea(); - -//! Collect the edges/faces that
    -//! a) are internal
    -//! b) are the same and have different orientation
    -Standard_EXPORT virtual void PerformShapesToAvoid() ; - -//! Build draft faces/shells
    -//! a)myLoops - draft faces/shells that consist of
    -//! boundary edges/faces
    -//! b)myLoopsInternal - draft faces/shells that contains
    -//! inner edges/faces
    -Standard_EXPORT virtual void PerformLoops() ; - -//! Build draft faces/solids that contains boundary faces
    -Standard_EXPORT virtual void PerformAreas() ; - -//! Build finalized faces/solids with internal wires/shells
    -Standard_EXPORT virtual void PerformInternalShapes() ; - - - // Fields PROTECTED - // -TopTools_ListOfShape myShapes; -TopTools_ListOfShape myLoops; -TopTools_ListOfShape myLoopsInternal; -TopTools_MapOfOrientedShape myShapesToAvoid; -TopTools_ListOfShape myAreas; -IntTools_PContext myContext; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +//======================================================================= +//class : GEOMAlgo_BuilderArea +//purpose : +//======================================================================= +class GEOMAlgo_BuilderArea : public GEOMAlgo_Algo +{ + public: + //! Sets cashed geometrical tools
    + Standard_EXPORT + void SetContext(const Handle(IntTools_Context)& theContext) ; + + //! Returns cashed geometrical tools
    + Standard_EXPORT + const Handle_IntTools_Context& Context() const; + + //! Sets edges/faces to process
    + Standard_EXPORT + void SetShapes(const TopTools_ListOfShape& theLS) ; + + //! Returns edges/faces to process
    + Standard_EXPORT + const TopTools_ListOfShape& Shapes() const; + + //! Returns wires/shells that have been built
    + Standard_EXPORT + const TopTools_ListOfShape& Loops() const; + + //! Returns faces/solids that have been built
    + Standard_EXPORT + const TopTools_ListOfShape& Areas() const; + + Standard_EXPORT + virtual void Perform() ; + + protected: + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_BuilderArea(); + + Standard_EXPORT + virtual ~GEOMAlgo_BuilderArea(); + //! Collect the edges/faces that
    + //! a) are internal
    + //! b) are the same and have different orientation
    + + Standard_EXPORT + virtual void PerformShapesToAvoid() ; + + //! Build draft faces/shells
    + //! a)myLoops - draft faces/shells that consist of
    + //! boundary edges/faces
    + //! b)myLoopsInternal - draft faces/shells that contains
    + //! inner edges/faces
    + Standard_EXPORT + virtual void PerformLoops() ; + //! Build draft faces/solids that contains boundary faces
    + + Standard_EXPORT + virtual void PerformAreas() ; + + //! Build finalized faces/solids with internal wires/shells
    + Standard_EXPORT + virtual void PerformInternalShapes() ; + + TopTools_ListOfShape myShapes; + TopTools_ListOfShape myLoops; + TopTools_ListOfShape myLoopsInternal; + TopTools_MapOfOrientedShape myShapesToAvoid; + TopTools_ListOfShape myAreas; + Handle_IntTools_Context myContext; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderArea.ixx b/src/GEOMAlgo/GEOMAlgo_BuilderArea.ixx deleted file mode 100644 index 3b0db2c03..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderArea.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderArea.jxx b/src/GEOMAlgo/GEOMAlgo_BuilderArea.jxx deleted file mode 100644 index a33ada31e..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderArea.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _IntTools_Context_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_BuilderArea_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cdl b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cdl deleted file mode 100755 index 3c994ff20..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cdl +++ /dev/null @@ -1,82 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_BuilderFace.cdl --- Created: --- Author: Peter KURNEV --- -class BuilderFace from GEOMAlgo - inherits BuilderArea from GEOMAlgo - - ---Purpose: The algorithm to build faces from set of edges - -uses - Face from TopoDS - ---raises - -is - Create - ---Purpose: Empty constructor - returns BuilderFace from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_BuilderFace();" - - SetFace(me:out; - theFace:Face from TopoDS); - ---Purpose: Sets the face generatix - - Face(me) - ---Purpose: Returns the face generatix - returns Face from TopoDS; - ---C++: return const & - - Perform(me:out) - ---Purpose: Performs the algorithm - is redefined; - - PerformShapesToAvoid(me:out) - ---Purpose: Collect the edges that - -- a) are internal - -- b) are the same and have different orientation - is redefined protected; - - PerformLoops(me:out) - ---Purpose: Build draft wires - -- a)myLoops - draft wires that consist of - -- boundary edges - -- b)myLoopsInternal - draft wires that contains - -- inner edges - is redefined protected; - - PerformAreas(me:out) - ---Purpose: Build draft faces that contains boundary edges - is redefined protected; - - PerformInternalShapes(me:out) - ---Purpose: Build finalized faces with internals - is redefined protected; - - -fields - myFace : Face from TopoDS is protected; - -end BuilderFace; - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx index c6b7d4bf5..afae9cee4 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx @@ -1,29 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_BuilderFace.cxx -// Created: -// Author: Peter KURNEV + +// File: GEOMAlgo_BuilderFace.cxx +// Created: +// Author: Peter KURNEV // -#include +#include #include #include @@ -83,19 +84,19 @@ static Standard_Boolean IsGrowthWire(const TopoDS_Shape& , - const TopTools_IndexedMapOfShape& ); + const TopTools_IndexedMapOfShape& ); -static +static Standard_Boolean IsInside(const TopoDS_Shape& , - const TopoDS_Shape& , - IntTools_PContext& ); + const TopoDS_Shape& , + const Handle(IntTools_Context)& ); static void MakeInternalWires(const TopTools_MapOfShape& , - TopTools_ListOfShape& ); + TopTools_ListOfShape& ); //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_BuilderFace::GEOMAlgo_BuilderFace() : @@ -104,14 +105,14 @@ static } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_BuilderFace::~GEOMAlgo_BuilderFace() { } //======================================================================= //function : SetFace -//purpose : +//purpose : //======================================================================= void GEOMAlgo_BuilderFace::SetFace(const TopoDS_Face& theFace) { @@ -119,7 +120,7 @@ static } //======================================================================= //function : Face -//purpose : +//purpose : //======================================================================= const TopoDS_Face& GEOMAlgo_BuilderFace::Face()const { @@ -127,21 +128,18 @@ static } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_BuilderFace::Perform() { myErrorStatus=0; // - if (myContext==NULL) { - myErrorStatus=11;// Null Context - return; - } - // if (myFace.IsNull()) { myErrorStatus=12;// Null face generix return; } + // Initialize the context + GEOMAlgo_BuilderArea::Perform(); // PerformShapesToAvoid(); if (myErrorStatus) { @@ -165,7 +163,7 @@ static } //======================================================================= //function :PerformShapesToAvoid -//purpose : +//purpose : //======================================================================= void GEOMAlgo_BuilderFace::PerformShapesToAvoid() { @@ -187,11 +185,11 @@ static for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aE=aIt.Value(); if (!myShapesToAvoid.Contains(aE)) { - TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE); - } - else { - int a=0; + TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVE); } +// else { +// int a=0; +// } } aNbV=aMVE.Extent(); // @@ -202,33 +200,33 @@ static TopTools_ListOfShape& aLE=aMVE.ChangeFromKey(aV); aNbE=aLE.Extent(); if (!aNbE) { - continue; + continue; } // const TopoDS_Edge& aE1=TopoDS::Edge(aLE.First()); if (aNbE==1) { - if (BRep_Tool::Degenerated(aE1)) { - continue; - } - if (aV.Orientation()==TopAbs_INTERNAL) { - continue; - } - bFound=Standard_True; - myShapesToAvoid.Add(aE1); + if (BRep_Tool::Degenerated(aE1)) { + continue; + } + if (aV.Orientation()==TopAbs_INTERNAL) { + continue; + } + bFound=Standard_True; + myShapesToAvoid.Add(aE1); } else if (aNbE==2) { - const TopoDS_Edge& aE2=TopoDS::Edge(aLE.Last()); - if (aE2.IsSame(aE1)) { - TopoDS_Vertex aV1x, aV2x; - // - TopExp::Vertices(aE1, aV1x, aV2x); - if (aV1x.IsSame(aV2x)) { - continue; - } - bFound=Standard_True; - myShapesToAvoid.Add(aE1); - myShapesToAvoid.Add(aE2); - } + const TopoDS_Edge& aE2=TopoDS::Edge(aLE.Last()); + if (aE2.IsSame(aE1)) { + TopoDS_Vertex aV1x, aV2x; + // + TopExp::Vertices(aE1, aV1x, aV2x); + if (aV1x.IsSame(aV2x)) { + continue; + } + bFound=Standard_True; + myShapesToAvoid.Add(aE1); + myShapesToAvoid.Add(aE2); + } } }// for (i=1; i<=aNbE; ++i) { // @@ -236,12 +234,12 @@ static break; } // - }//while (1) + }//while (1) //printf(" EdgesToAvoid=%d, iCnt=%d\n", EdgesToAvoid.Extent(), iCnt); -} +} //======================================================================= //function : PerformLoops -//purpose : +//purpose : //======================================================================= void GEOMAlgo_BuilderFace::PerformLoops() { @@ -254,11 +252,11 @@ static TopTools_IndexedDataMapOfShapeListOfShape aVEMap; TopTools_MapOfOrientedShape aMAdded; TopoDS_Iterator aItW; - BRep_Builder aBB; + BRep_Builder aBB; GEOMAlgo_WireEdgeSet aWES; GEOMAlgo_WESCorrector aWESCor; // - // 1. Usual Wires + // 1. Usual Wires myLoops.Clear(); aWES.SetFace(myFace); // @@ -284,7 +282,7 @@ static //modified by NIZNHY-PKV Tue Aug 5 15:09:29 2008f // Post Treatment TopTools_MapOfOrientedShape aMEP; - // + // // a. collect all edges that are in loops aIt.Initialize (myLoops); for (; aIt.More(); aIt.Next()) { @@ -295,7 +293,7 @@ static aMEP.Add(aE); } } - // + // // b. collect all edges that are to avoid aItM.Initialize(myShapesToAvoid); for (; aItM.More(); aItM.Next()) { @@ -342,18 +340,18 @@ static // TopoDS_Iterator aItE(aE); for (; aItE.More()&&bFlag; aItE.Next()) { - const TopoDS_Vertex& aV = TopoDS::Vertex(aItE.Value()); - const TopTools_ListOfShape& aLE=aVEMap.FindFromKey(aV); - aIt.Initialize(aLE); - for (; aIt.More()&&bFlag; aIt.Next()) { - const TopoDS_Shape& aEx=aIt.Value(); - if (aMAdded.Add(aEx)) { - aBB.Add(aW, aEx); - if(aMAdded.Extent()==aNbEA) { - bFlag=!bFlag; - } - } - }//for (; aIt.More(); aIt.Next()) { + const TopoDS_Vertex& aV = TopoDS::Vertex(aItE.Value()); + const TopTools_ListOfShape& aLE=aVEMap.FindFromKey(aV); + aIt.Initialize(aLE); + for (; aIt.More()&&bFlag; aIt.Next()) { + const TopoDS_Shape& aEx=aIt.Value(); + if (aMAdded.Add(aEx)) { + aBB.Add(aW, aEx); + if(aMAdded.Extent()==aNbEA) { + bFlag=!bFlag; + } + } + }//for (; aIt.More(); aIt.Next()) { }//for (; aItE.More(); aItE.Next()) { }//for (; aItW.More(); aItW.Next()) { myLoopsInternal.Append(aW); @@ -361,7 +359,7 @@ static } //======================================================================= //function : PerformAreas -//purpose : +//purpose : //======================================================================= void GEOMAlgo_BuilderFace::PerformAreas() { @@ -369,7 +367,7 @@ static // Standard_Boolean bIsGrowth, bIsHole; Standard_Real aTol; - TopTools_ListOfShape aNewFaces, aHoleWires; + TopTools_ListOfShape aNewFaces, aHoleWires; TopoDS_Shape anInfinitePointShape; TopTools_DataMapOfShapeShape aInOutMap; TopTools_DataMapOfShapeListOfShape aMSH; @@ -400,22 +398,22 @@ static aNewFaces.Append (aFace); } else{ - // check if a wire is a hole + // check if a wire is a hole //XX //bIsHole=IsHole(aWire, myFace, myContext); bIsHole=GEOMAlgo_BuilderTools::IsHole(aWire, myFace); //XX if (bIsHole) { - aHoleWires.Append(aWire); - TopExp::MapShapes(aWire, TopAbs_EDGE, aMHE); + aHoleWires.Append(aWire); + TopExp::MapShapes(aWire, TopAbs_EDGE, aMHE); } else { - // make a growth face from a wire - TopoDS_Face aFace; - aBB.MakeFace(aFace, aS, aLoc, aTol); - aBB.Add (aFace, aWire); - // - aNewFaces.Append (aFace); + // make a growth face from a wire + TopoDS_Face aFace; + aBB.MakeFace(aFace, aS, aLoc, aTol); + aBB.Add (aFace, aWire); + // + aNewFaces.Append (aFace); } } } @@ -449,13 +447,13 @@ static if (aInOutMap.IsBound(aHole)){ const TopoDS_Shape& aF=aInOutMap(aHole); if (aMSH.IsBound(aF)) { - TopTools_ListOfShape& aLH=aMSH.ChangeFind(aF); - aLH.Append(aHole); + TopTools_ListOfShape& aLH=aMSH.ChangeFind(aF); + aLH.Append(aHole); } else { - TopTools_ListOfShape aLH; - aLH.Append(aHole); - aMSH.Bind(aF, aLH); + TopTools_ListOfShape aLH; + aLH.Append(aHole); + aMSH.Bind(aF, aLH); } } }// for (; aIt2.More(); aIt2.Next()) @@ -472,20 +470,20 @@ static aBB.Add (aF, aHole); } // - // update classifier + // update classifier aTol=BRep_Tool::Tolerance(aF); IntTools_FClass2d& aClsf=myContext->FClass2d(aF); aClsf.Init(aF, aTol); } // - // These aNewFaces are draft faces that + // These aNewFaces are draft faces that // do not contain any internal shapes // myAreas.Append(aNewFaces); } //======================================================================= //function : PerformInternalShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_BuilderFace::PerformInternalShapes() { @@ -495,11 +493,11 @@ static if (!aNbWI) {// nothing to do return; } - // + // //Standard_Real aTol; BRep_Builder aBB; TopTools_ListIteratorOfListOfShape aIt1, aIt2; - TopoDS_Iterator aIt; + TopoDS_Iterator aIt; TopTools_MapOfShape aME, aMEP; TopTools_MapIteratorOfMapOfShape aItME; TopTools_IndexedDataMapOfShapeListOfShape aMVE; @@ -531,7 +529,7 @@ static for (; aItME.More(); aItME.Next()) { const TopoDS_Edge& aE=TopoDS::Edge(aItME.Key()); if (IsInside(aE, aF, myContext)) { - aMEP.Add(aE); + aMEP.Add(aE); } } // @@ -561,10 +559,10 @@ static } //======================================================================= //function : MakeInternalWires -//purpose : +//purpose : //======================================================================= void MakeInternalWires(const TopTools_MapOfShape& theME, - TopTools_ListOfShape& theWires) + TopTools_ListOfShape& theWires) { TopTools_MapIteratorOfMapOfShape aItM; TopTools_MapOfShape aAddedMap; @@ -587,7 +585,7 @@ void MakeInternalWires(const TopTools_MapOfShape& theME, // // make a new shell TopoDS_Wire aW; - aBB.MakeWire(aW); + aBB.MakeWire(aW); aEE.Orientation(TopAbs_INTERNAL); aBB.Add(aW, aEE); // @@ -598,15 +596,15 @@ void MakeInternalWires(const TopTools_MapOfShape& theME, TopExp_Explorer aExp(aE, TopAbs_VERTEX); for (; aExp.More(); aExp.Next()) { const TopoDS_Shape& aV =aExp.Current(); - const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV); - aItE.Initialize(aLE); - for (; aItE.More(); aItE.Next()) { - TopoDS_Shape aEL=aItE.Value(); - if (aAddedMap.Add(aEL)){ - aEL.Orientation(TopAbs_INTERNAL); - aBB.Add(aW, aEL); - } - } + const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV); + aItE.Initialize(aLE); + for (; aItE.More(); aItE.Next()) { + TopoDS_Shape aEL=aItE.Value(); + if (aAddedMap.Add(aEL)){ + aEL.Orientation(TopAbs_INTERNAL); + aBB.Add(aW, aEL); + } + } } } theWires.Append(aW); @@ -614,15 +612,15 @@ void MakeInternalWires(const TopTools_MapOfShape& theME, } //======================================================================= //function : IsInside -//purpose : +//purpose : //======================================================================= Standard_Boolean IsInside(const TopoDS_Shape& theHole, - const TopoDS_Shape& theF2, - IntTools_PContext& theContext) + const TopoDS_Shape& theF2, + const Handle(IntTools_Context)& theContext) { Standard_Boolean bRet; Standard_Real aT, aU, aV; - + TopAbs_State aState; TopExp_Explorer aExp; TopTools_IndexedMapOfShape aME2; @@ -655,21 +653,21 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole, //======================================================================= //function : IsGrowthWire -//purpose : +//purpose : //======================================================================= Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire, - const TopTools_IndexedMapOfShape& theMHE) + const TopTools_IndexedMapOfShape& theMHE) { Standard_Boolean bRet; TopoDS_Iterator aIt; - // + // bRet=Standard_False; if (theMHE.Extent()) { aIt.Initialize(theWire); for(; aIt.More(); aIt.Next()) { const TopoDS_Shape& aE=aIt.Value(); if (theMHE.Contains(aE)) { - return !bRet; + return !bRet; } } } @@ -685,11 +683,11 @@ Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire, /* //======================================================================= //function : IsInside -//purpose : +//purpose : //======================================================================= Standard_Boolean IsInside(const TopoDS_Shape& theHole, - const TopoDS_Shape& theF2, - IntTools_PContext& theContext) + const TopoDS_Shape& theF2, + IntTools_PContext& theContext) { Standard_Real aT, aU, aV; TopExp_Explorer aExp; diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.hxx b/src/GEOMAlgo/GEOMAlgo_BuilderFace.hxx index 08cefeb9d..595436cda 100644 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.hxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderFace.hxx @@ -1,127 +1,91 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + +// Copyright (C) 2007-2012 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 // -// 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: GEOMAlgo_BuilderFace.hxx +// Created: +// Author: Peter KURNEV // #ifndef _GEOMAlgo_BuilderFace_HeaderFile #define _GEOMAlgo_BuilderFace_HeaderFile -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_BuilderArea_HeaderFile -#include -#endif -class TopoDS_Face; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif +#include +#include //! The algorithm to build faces from set of edges
    -class GEOMAlgo_BuilderFace : public GEOMAlgo_BuilderArea { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Empty constructor
    -Standard_EXPORT GEOMAlgo_BuilderFace(); -Standard_EXPORT virtual ~GEOMAlgo_BuilderFace(); - -//! Sets the face generatix
    -Standard_EXPORT void SetFace(const TopoDS_Face& theFace) ; - -//! Returns the face generatix
    -Standard_EXPORT const TopoDS_Face& Face() const; - -//! Performs the algorithm
    -Standard_EXPORT virtual void Perform() ; - - - - - -protected: - - // Methods PROTECTED - // - -//! Collect the edges that
    -//! a) are internal
    -//! b) are the same and have different orientation
    -Standard_EXPORT virtual void PerformShapesToAvoid() ; - -//! Build draft wires
    -//! a)myLoops - draft wires that consist of
    -//! boundary edges
    -//! b)myLoopsInternal - draft wires that contains
    -//! inner edges
    -Standard_EXPORT virtual void PerformLoops() ; - -//! Build draft faces that contains boundary edges
    -Standard_EXPORT virtual void PerformAreas() ; - -//! Build finalized faces with internals
    -Standard_EXPORT virtual void PerformInternalShapes() ; - - - // Fields PROTECTED - // -TopoDS_Face myFace; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +//======================================================================= +//class : GEOMAlgo_BuilderFace +//purpose : +//======================================================================= +class GEOMAlgo_BuilderFace : public GEOMAlgo_BuilderArea +{ + public: + + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_BuilderFace(); + + Standard_EXPORT + virtual ~GEOMAlgo_BuilderFace(); + + //! Sets the face generatix
    + Standard_EXPORT + void SetFace(const TopoDS_Face& theFace) ; + + //! Returns the face generatix
    + Standard_EXPORT + const TopoDS_Face& Face() const; + + //! Performs the algorithm
    + Standard_EXPORT + virtual void Perform() ; + + protected: + //! Collect the edges that
    + //! a) are internal
    + //! b) are the same and have different orientation
    + Standard_EXPORT + virtual void PerformShapesToAvoid() ; + + //! Build draft wires
    + //! a)myLoops - draft wires that consist of
    + //! boundary edges
    + //! b)myLoopsInternal - draft wires that contains
    + //! inner edges
    + Standard_EXPORT + virtual void PerformLoops() ; + + //! Build draft faces that contains boundary edges
    + Standard_EXPORT + virtual void PerformAreas() ; + + //! Build finalized faces with internals
    + Standard_EXPORT + virtual void PerformInternalShapes() ; + + + TopoDS_Face myFace; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.ixx b/src/GEOMAlgo/GEOMAlgo_BuilderFace.ixx deleted file mode 100644 index c3630db7b..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.jxx b/src/GEOMAlgo/GEOMAlgo_BuilderFace.jxx deleted file mode 100644 index 97dee3032..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_BuilderFace_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderShape.cdl b/src/GEOMAlgo/GEOMAlgo_BuilderShape.cdl deleted file mode 100755 index f1c1c22f1..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderShape.cdl +++ /dev/null @@ -1,114 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_BuilderShape.cdl --- Created: --- Author: Peter KURNEV --- -deferred class BuilderShape from GEOMAlgo - inherits Algo from GEOMAlgo - - ---Purpose: Root class for algorithms that has shape as result - -uses - Shape from TopoDS, - ListOfShape from TopTools, - MapOfShape from TopTools, - IndexedDataMapOfShapeListOfShape from TopTools - ---raises - -is - Initialize - ---Purpose: Empty constructor - returns BuilderShape from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_BuilderShape();" - - Shape(me) - ---Purpose: Returns the result of algorithm - returns Shape from TopoDS; - ---C++: return const & - - - ------------------------------------------------------------------ - --- The following methods are not implemented at this level. - -- An empty list is returned. - --- They are optional and can be redefined. - ------------------------------------------------------------------ - Generated (me:out; - theS : Shape from TopoDS) - ---Purpose: Returns the list of shapes generated from the - -- shape theS. - returns ListOfShape from TopTools - is virtual; - ---C++: return const & - - Modified (me:out; - theS : Shape from TopoDS) - ---Purpose: Returns the list of shapes modified from the - -- shape theS. - returns ListOfShape from TopTools - is virtual; - ---C++: return const & - - IsDeleted (me:out; - theS : Shape from TopoDS) - ---Purpose: Returns true if the shape theS has been deleted. - returns Boolean from Standard - is virtual; - - HasDeleted (me) - ---Purpose: Returns true if the at least one shape(or subshape) - -- of arguments has been deleted. - returns Boolean from Standard; - - HasGenerated (me) - ---Purpose: Returns true if the at least one shape(or subshape) - -- of arguments has generated shapes. - returns Boolean from Standard; - - HasModified (me) - ---Purpose: Returns true if the at least one shape(or subshape) - -- of arguments has modified shapes. - returns Boolean from Standard; - - PrepareHistory (me:out) - ---Purpose: Prepare information for history support - is virtual protected; - ---modified by NIZNHY-PKV Thu Dec 7 11:13:17 2006f - ImagesResult(me) - returns IndexedDataMapOfShapeListOfShape from TopTools; - ---C++: return const & ---modified by NIZNHY-PKV Thu Dec 7 11:13:20 2006t -fields - myShape : Shape from TopoDS is protected; - -- - myHistShapes : ListOfShape from TopTools is protected; - myMapShape : MapOfShape from TopTools is protected; - myHasDeleted : Boolean from Standard is protected; - myHasGenerated : Boolean from Standard is protected; - myHasModified : Boolean from Standard is protected; ---modified by NIZNHY-PKV Thu Dec 7 11:13:10 2006f - myImagesResult : IndexedDataMapOfShapeListOfShape from TopTools is protected; ---modified by NIZNHY-PKV Thu Dec 7 11:13:13 2006t -end BuilderShape; - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderShape.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderShape.cxx index 5d09fde72..5abac4efc 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderShape.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderShape.cxx @@ -1,32 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_BuilderShape.cxx -// Created: -// Author: Peter KURNEV + +// File: GEOMAlgo_BuilderShape.cxx +// Created: +// Author: Peter KURNEV // -#include +#include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_BuilderShape::GEOMAlgo_BuilderShape() : @@ -38,14 +39,14 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_BuilderShape::~GEOMAlgo_BuilderShape() { } //======================================================================= //function : Shape -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_BuilderShape::Shape() const { @@ -54,7 +55,7 @@ // //======================================================================= //function : Generated -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_BuilderShape::Generated(const TopoDS_Shape& ) { @@ -63,7 +64,7 @@ } //======================================================================= //function : Modified -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_BuilderShape::Modified(const TopoDS_Shape& ) { @@ -72,18 +73,18 @@ } //======================================================================= //function : IsDeleted -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_BuilderShape::IsDeleted(const TopoDS_Shape& theS) { Standard_Boolean bRet; // bRet=!myMapShape.Contains(theS); - return bRet; + return bRet; } //======================================================================= //function : HasDeleted -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_BuilderShape::HasDeleted()const { @@ -91,7 +92,7 @@ } //======================================================================= //function : HasGenerated -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_BuilderShape::HasGenerated()const { @@ -99,7 +100,7 @@ } //======================================================================= //function : HasModified -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_BuilderShape::HasModified()const { @@ -107,7 +108,7 @@ } //======================================================================= //function : PrepareHistory -//purpose : +//purpose : //======================================================================= void GEOMAlgo_BuilderShape::PrepareHistory() { @@ -123,7 +124,7 @@ //modified by NIZNHY-PKV Thu Dec 7 11:57:00 2006f //======================================================================= //function : ImagesResult -//purpose : +//purpose : //======================================================================= const TopTools_IndexedDataMapOfShapeListOfShape& GEOMAlgo_BuilderShape::ImagesResult()const { diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderShape.hxx b/src/GEOMAlgo/GEOMAlgo_BuilderShape.hxx index bf760dd97..2ae67470c 100644 --- a/src/GEOMAlgo/GEOMAlgo_BuilderShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderShape.hxx @@ -1,152 +1,105 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_BuilderShape.hxx +// Created: +// Author: Peter KURNEV // #ifndef _GEOMAlgo_BuilderShape_HeaderFile #define _GEOMAlgo_BuilderShape_HeaderFile -#ifndef _TopoDS_Shape_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile #include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Algo_HeaderFile #include -#endif -class TopoDS_Shape; -class TopTools_ListOfShape; -class TopTools_IndexedDataMapOfShapeListOfShape; -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - //! Root class for algorithms that has shape as result
    -class GEOMAlgo_BuilderShape : public GEOMAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Returns the result of algorithm
    -Standard_EXPORT const TopoDS_Shape& Shape() const; - -//! Returns the list of shapes generated from the
    -//! shape theS.
    -Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ; - -//! Returns the list of shapes modified from the
    -//! shape theS.
    -Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ; - -//! Returns true if the shape theS has been deleted.
    -Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ; - -//! Returns true if the at least one shape(or subshape)
    -//! of arguments has been deleted.
    -Standard_EXPORT Standard_Boolean HasDeleted() const; - -//! Returns true if the at least one shape(or subshape)
    -//! of arguments has generated shapes.
    -Standard_EXPORT Standard_Boolean HasGenerated() const; - -//! Returns true if the at least one shape(or subshape)
    -//! of arguments has modified shapes.
    -Standard_EXPORT Standard_Boolean HasModified() const; - - -Standard_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape& ImagesResult() const; - - - - +//======================================================================= +//class : GEOMAlgo_BuilderShape +//purpose : +//======================================================================= +class GEOMAlgo_BuilderShape : public GEOMAlgo_Algo +{ + public: + //! Returns the result of algorithm
    + Standard_EXPORT + const TopoDS_Shape& Shape() const; + + //! Returns the list of shapes generated from the
    + //! shape theS.
    + Standard_EXPORT + virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ; + + //! Returns the list of shapes modified from the
    + //! shape theS.
    + Standard_EXPORT + virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ; + + //! Returns true if the shape theS has been deleted.
    + Standard_EXPORT + virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ; + + //! Returns true if the at least one shape(or sub-shape)
    + //! of arguments has been deleted.
    + Standard_EXPORT + Standard_Boolean HasDeleted() const; + + //! Returns true if the at least one shape(or sub-shape)
    + //! of arguments has generated shapes.
    + Standard_EXPORT + Standard_Boolean HasGenerated() const; + + //! Returns true if the at least one shape(or sub-shape)
    + //! of arguments has modified shapes.
    + Standard_EXPORT + Standard_Boolean HasModified() const; + + Standard_EXPORT + const TopTools_IndexedDataMapOfShapeListOfShape& ImagesResult() const; protected: + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_BuilderShape(); - // Methods PROTECTED - // - -//! Empty constructor
    -Standard_EXPORT GEOMAlgo_BuilderShape(); -Standard_EXPORT virtual ~GEOMAlgo_BuilderShape(); - -//! Prepare information for history support
    -Standard_EXPORT virtual void PrepareHistory() ; - - - // Fields PROTECTED - // -TopoDS_Shape myShape; -TopTools_ListOfShape myHistShapes; -TopTools_MapOfShape myMapShape; -Standard_Boolean myHasDeleted; -Standard_Boolean myHasGenerated; -Standard_Boolean myHasModified; -TopTools_IndexedDataMapOfShapeListOfShape myImagesResult; - + Standard_EXPORT + virtual ~GEOMAlgo_BuilderShape(); -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + //! Prepare information for history support
    + Standard_EXPORT + virtual void PrepareHistory() ; + TopoDS_Shape myShape; + TopTools_ListOfShape myHistShapes; + TopTools_MapOfShape myMapShape; + Standard_Boolean myHasDeleted; + Standard_Boolean myHasGenerated; + Standard_Boolean myHasModified; + TopTools_IndexedDataMapOfShapeListOfShape myImagesResult; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderShape.ixx b/src/GEOMAlgo/GEOMAlgo_BuilderShape.ixx deleted file mode 100644 index 754725182..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderShape.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderShape.jxx b/src/GEOMAlgo/GEOMAlgo_BuilderShape.jxx deleted file mode 100644 index 4470c4034..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderShape.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_BuilderShape_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cdl b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cdl deleted file mode 100755 index 8773aee80..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cdl +++ /dev/null @@ -1,69 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_BuilderSolid.cdl --- Created: --- Author: Peter KURNEV --- -class BuilderSolid from GEOMAlgo - inherits BuilderArea from GEOMAlgo - - ---Purpose: The algorithm to build solids from set of faces - ---uses ---raises - -is - Create - ---Purpose: Empty constructor - returns BuilderSolid from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_BuilderSolid();" - - - Perform(me:out) - ---Purpose: Performs the algorithm - is redefined; - - PerformShapesToAvoid(me:out) - ---Purpose: Collect the faces that - -- a) are internal - -- b) are the same and have different orientation - is redefined protected; - - PerformLoops(me:out) - ---Purpose: Build draft shells - -- a)myLoops - draft shells that consist of - -- boundary faces - -- b)myLoopsInternal - draft shells that contains - -- inner faces - is redefined protected; - - PerformAreas(me:out) - ---Purpose: Build draft solids that contains boundary faces - is redefined protected; - - PerformInternalShapes(me:out) - ---Purpose: Build finalized solids with internal shells - is redefined protected; - ---fields - -end BuilderSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx index 6ea231c3e..cd8c54625 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx @@ -1,29 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_BuilderSolid.cxx -// Created: -// Author: Peter KURNEV + +// File: GEOMAlgo_BuilderSolid.cxx +// Created: +// Author: Peter KURNEV // -#include +#include #include #include @@ -82,52 +83,56 @@ // static Standard_Boolean IsGrowthShell(const TopoDS_Shape& , - const TopTools_IndexedMapOfShape& ); + const TopTools_IndexedMapOfShape& ); static Standard_Boolean IsHole(const TopoDS_Shape& , - IntTools_PContext& ); + const Handle(IntTools_Context)& ); static Standard_Boolean IsInside(const TopoDS_Shape& , - const TopoDS_Shape& , - IntTools_PContext& ); + const TopoDS_Shape& , + const Handle(IntTools_Context)& ); static void MakeInternalShells(const TopTools_MapOfShape& , - TopTools_ListOfShape& ); + TopTools_ListOfShape& ); + +static + Standard_Boolean IsClosedShell(const TopoDS_Shell& ); -//modified by NIZNHY-PKV Tue Aug 5 15:06:50 2008f static - Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell); -//modified by NIZNHY-PKV Tue Aug 5 15:06:57 2008t + Standard_Boolean RefineShell(const TopoDS_Shell& , + TopoDS_Shell& ); //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= - GEOMAlgo_BuilderSolid::GEOMAlgo_BuilderSolid() +GEOMAlgo_BuilderSolid::GEOMAlgo_BuilderSolid() : GEOMAlgo_BuilderArea() { } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= - GEOMAlgo_BuilderSolid::~GEOMAlgo_BuilderSolid() +GEOMAlgo_BuilderSolid::~GEOMAlgo_BuilderSolid() { } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderSolid::Perform() +void GEOMAlgo_BuilderSolid::Perform() { myErrorStatus=0; // + // Initialize the context + GEOMAlgo_BuilderArea::Perform(); // TopoDS_Compound aC; BRep_Builder aBB; TopTools_ListIteratorOfListOfShape aIt; - + aBB.MakeCompound(aC); aIt.Initialize(myShapes); for(; aIt.More(); aIt.Next()) { @@ -135,12 +140,6 @@ static aBB.Add(aC, aF); } // - // - if (myContext==NULL) { - myErrorStatus=11;// Null Context - return; - } - // PerformShapesToAvoid(); if (myErrorStatus) { return; @@ -154,16 +153,18 @@ static if (myErrorStatus) { return; } - PerformInternalShapes(); - if (myErrorStatus) { - return; + if (myComputeInternalShapes) { + PerformInternalShapes(); + if (myErrorStatus) { + return; + } } } //======================================================================= //function :PerformShapesToAvoid -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderSolid::PerformShapesToAvoid() +void GEOMAlgo_BuilderSolid::PerformShapesToAvoid() { Standard_Boolean bFound; Standard_Integer i, iCnt, aNbE, aNbF; @@ -184,89 +185,91 @@ static for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aF=aIt.Value(); if (!myShapesToAvoid.Contains(aF)) { - TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF); + TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF); } + /* else { int a=0; } + */ } aNbE=aMEF.Extent(); // // 2. myFacesToAvoid for (i=1; i<=aNbE; ++i) { - const TopoDS_Edge& aE=TopoDS::Edge(aMEF.FindKey(i)); + const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aMEF.FindKey(i))); if (BRep_Tool::Degenerated(aE)) { - continue; + continue; } // TopTools_ListOfShape& aLF=aMEF.ChangeFromKey(aE); // aNbF=aLF.Extent(); if (!aNbF) { - continue; + continue; } // aOrE=aE.Orientation(); // - const TopoDS_Face& aF1=TopoDS::Face(aLF.First()); + const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First())); if (aNbF==1) { - if (aOrE==TopAbs_INTERNAL) { - continue; - } - bFound=Standard_True; - myShapesToAvoid.Add(aF1); + if (aOrE==TopAbs_INTERNAL) { + continue; + } + bFound=Standard_True; + myShapesToAvoid.Add(aF1); } else if (aNbF==2) { - const TopoDS_Face& aF2=TopoDS::Face(aLF.Last()); - if (aF2.IsSame(aF1)) { - if (BRep_Tool::IsClosed(aE, aF1)) { - continue; - } - // - if (aOrE==TopAbs_INTERNAL) { - continue; - } - // - bFound=Standard_True; - myShapesToAvoid.Add(aF1); - myShapesToAvoid.Add(aF2); - } + const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last())); + if (aF2.IsSame(aF1)) { + if (BRep_Tool::IsClosed(aE, aF1)) { + continue; + } + // + if (aOrE==TopAbs_INTERNAL) { + continue; + } + // + bFound=Standard_True; + myShapesToAvoid.Add(aF1); + myShapesToAvoid.Add(aF2); + } } - //DEB + /*//DEB else { - TopTools_ListIteratorOfListOfShape aItLF; - // - aItLF.Initialize (aLF); - for (; aItLF.More(); aItLF.Next()) { - const TopoDS_Shape& aFx=aItLF.Value(); - int a=0; - } + TopTools_ListIteratorOfListOfShape aItLF; + // + aItLF.Initialize (aLF); + for (; aItLF.More(); aItLF.Next()) { + const TopoDS_Shape& aFx=aItLF.Value(); + int a=0; + } } - //DEB + *///DEB }// for (i=1; i<=aNbE; ++i) { // if (!bFound) { break; } // - }//while (1) -} + }//while (1) +} //======================================================================= //function : PerformLoops -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderSolid::PerformLoops() +void GEOMAlgo_BuilderSolid::PerformLoops() { myErrorStatus=0; // myLoops.Clear(); // - Standard_Integer aNbLF, aNbOff, aNbFP, aNbFA; + Standard_Integer aNbLF, aNbOff, aNbFP; TopAbs_Orientation anOr; TopoDS_Edge aEL; BRep_Builder aBB; NMTTools_CoupleOfShape aCSOff; - TopTools_MapOfOrientedShape AddedFacesMap;//, aMFP; + TopTools_MapOfOrientedShape AddedFacesMap; TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP; TopTools_ListIteratorOfListOfShape aItF, aIt; TopTools_MapIteratorOfMapOfOrientedShape aItM; @@ -303,108 +306,104 @@ static // loop on faces added to Shell; add their neighbor faces to Shell and so on TopoDS_Iterator aItAddedF (aShell); for (; aItAddedF.More(); aItAddedF.Next()) { - const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value()); + const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value())); // // loop on edges of aF; find a good neighbor face of aF by aE TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); for (; aEdgeExp.More(); aEdgeExp.Next()) { - const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current()); - // - //1 - if (aMEFP.Contains(aE)) { - const TopTools_ListOfShape& aLFP=aMEFP.FindFromKey(aE); - aNbFP=aLFP.Extent(); - if (aNbFP>1) { - continue; - } - } - //2 - anOr=aE.Orientation(); - if (anOr==TopAbs_INTERNAL) { - continue; - } - //3 - if (BRep_Tool::Degenerated(aE)) { - continue; - } - // - // candidate faces list + const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aEdgeExp.Current())); + // + //1 + if (aMEFP.Contains(aE)) { + const TopTools_ListOfShape& aLFP=aMEFP.FindFromKey(aE); + aNbFP=aLFP.Extent(); + if (aNbFP>1) { + continue; + } + } + //2 + anOr=aE.Orientation(); + if (anOr==TopAbs_INTERNAL) { + continue; + } + //3 + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + // candidate faces list const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); - aNbLF=aLF.Extent(); + aNbLF=aLF.Extent(); if (!aNbLF) { continue; - } - // - // try to select one of neighbors - // check if a face already added to Shell shares E - Standard_Boolean bFound; - TopTools_ListIteratorOfListOfShape aItLF; - NMTTools_ListOfCoupleOfShape aLCSOff; - // - aItLF.Initialize(aLF); - for (; aItLF.More(); aItLF.Next()) { - const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value()); - if (myShapesToAvoid.Contains(aFL)) { - continue; - } - if (aF.IsSame(aFL)) { - continue; - } - if (AddedFacesMap.Contains(aFL)){ - continue; - } - // - bFound=GEOMAlgo_Tools3D::GetEdgeOff(aE, aFL, aEL); - if (!bFound) { - continue; - } - // - aCSOff.SetShape1(aEL); - aCSOff.SetShape2(aFL); - aLCSOff.Append(aCSOff); - }//for (; aItLF.More(); aItLF.Next()) { - // - aNbOff=aLCSOff.Extent(); - if (!aNbOff){ - continue; - } - // - TopoDS_Face aSelF; - if (aNbOff==1) { - aSelF=TopoDS::Face(aLCSOff.First().Shape2()); - } - else if (aNbOff>1){ - GEOMAlgo_Tools3D::GetFaceOff(aE, aF, aLCSOff, aSelF); - } - // - if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) { + } + // + // try to select one of neighbors + // check if a face already added to Shell shares E + Standard_Boolean bFound; + TopTools_ListIteratorOfListOfShape aItLF; + NMTTools_ListOfCoupleOfShape aLCSOff; + // + aItLF.Initialize(aLF); + for (; aItLF.More(); aItLF.Next()) { + const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItLF.Value())); + if (myShapesToAvoid.Contains(aFL)) { + continue; + } + if (aF.IsSame(aFL)) { + continue; + } + if (AddedFacesMap.Contains(aFL)){ + continue; + } + // + bFound=GEOMAlgo_Tools3D::GetEdgeOff(aE, aFL, aEL); + if (!bFound) { + continue; + } + // + aCSOff.SetShape1(aEL); + aCSOff.SetShape2(aFL); + aLCSOff.Append(aCSOff); + }//for (; aItLF.More(); aItLF.Next()) { + // + aNbOff=aLCSOff.Extent(); + if (!aNbOff){ + continue; + } + // + TopoDS_Face aSelF; + if (aNbOff==1) { + aSelF=*((TopoDS_Face*)(&aLCSOff.First().Shape2())); + } + else if (aNbOff>1){ + GEOMAlgo_Tools3D::GetFaceOff(aE, aF, aLCSOff, aSelF); + } + // + if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) { aBB.Add(aShell, aSelF); - TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP); - } - } // for (; aEdgeExp.More(); aEdgeExp.Next()) { + TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP); + } + } // for (; aEdgeExp.More(); aEdgeExp.Next()) { } //for (; aItAddedF.More(); aItAddedF.Next()) { - //modified by NIZNHY-PKV Tue Aug 5 15:07:08 2008f - //myLoops.Append(aShell); + // if (IsClosedShell(aShell)) { myLoops.Append(aShell); } - /* else { - TopoDS_Iterator aItS; - aItS.Initialize(aShell); - for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aFs=aItS.Value(); - aMFP.Add(aFs); + Standard_Boolean bRefine; + TopoDS_Shell aShx; + // + bRefine=RefineShell(aShell, aShx); + if (bRefine) { + myLoops.Append(aShx); } } - */ - //modified by NIZNHY-PKV Tue Aug 5 15:07:30 2008t } // for (; aItF.More(); aItF.Next()) { - //modified by NIZNHY-PKV Tue Aug 5 15:07:35 2008f // // Post Treatment TopTools_MapOfOrientedShape aMP; - // + // // a. collect all edges that are in loops aIt.Initialize (myLoops); for (; aIt.More(); aIt.Next()) { @@ -415,15 +414,15 @@ static aMP.Add(aF); } } - // - // b. collect all edges that are to avoid + // + // b. collect all faces that are to avoid aItM.Initialize(myShapesToAvoid); for (; aItM.More(); aItM.Next()) { const TopoDS_Shape& aF=aItM.Key(); aMP.Add(aF); } // - // c. add all edges that are not processed to myShapesToAvoid + // c. add all faces that are not processed to myShapesToAvoid aIt.Initialize (myShapes); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aF=aIt.Value(); @@ -431,7 +430,6 @@ static myShapesToAvoid.Add(aF); } } - //modified by NIZNHY-PKV Tue Aug 5 15:07:44 2008t //================================================= // // 2.Internal Shells @@ -441,56 +439,56 @@ static aEFMap.Clear(); AddedFacesMap.Clear(); // - aNbFA=myShapesToAvoid.Extent(); - // - aItM.Initialize(myShapesToAvoid); - for (; aItM.More(); aItM.Next()) { - const TopoDS_Shape& aFF=aItM.Key(); - TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap); - } - // - aItM.Initialize(myShapesToAvoid); - for (; aItM.More(); aItM.Next()) { - const TopoDS_Shape& aFF=aItM.Key(); - if (!AddedFacesMap.Add(aFF)) { - continue; + if (myComputeInternalShapes) { + aItM.Initialize(myShapesToAvoid); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aFF=aItM.Key(); + TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap); } // - // make a new shell - TopoDS_Shell aShell; - aBB.MakeShell(aShell); - aBB.Add(aShell, aFF); - // - TopoDS_Iterator aItAddedF (aShell); - for (; aItAddedF.More(); aItAddedF.Next()) { - const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value()); + aItM.Initialize(myShapesToAvoid); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aFF=aItM.Key(); + if (!AddedFacesMap.Add(aFF)) { + continue; + } // - TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); - for (; aEdgeExp.More(); aEdgeExp.Next()) { - const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current()); - const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); - aItF.Initialize(aLF); - for (; aItF.More(); aItF.Next()) { - const TopoDS_Face& aFL=TopoDS::Face(aItF.Value()); - if (AddedFacesMap.Add(aFL)){ - aBB.Add(aShell, aFL); - } - } + // make a new shell + TopoDS_Shell aShell; + aBB.MakeShell(aShell); + aBB.Add(aShell, aFF); + // + TopoDS_Iterator aItAddedF (aShell); + for (; aItAddedF.More(); aItAddedF.Next()) { + const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value())); + // + TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); + for (; aEdgeExp.More(); aEdgeExp.Next()) { + const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current())); + const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); + aItF.Initialize(aLF); + for (; aItF.More(); aItF.Next()) { + const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value())); + if (AddedFacesMap.Add(aFL)){ + aBB.Add(aShell, aFL); + } + } + } } + myLoopsInternal.Append(aShell); } - myLoopsInternal.Append(aShell); } } //======================================================================= //function : PerformAreas -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderSolid::PerformAreas() +void GEOMAlgo_BuilderSolid::PerformAreas() { myErrorStatus=0; // Standard_Boolean bIsGrowthShell, bIsHole; - TopTools_ListOfShape aNewSolids, aHoleShells; + TopTools_ListOfShape aNewSolids, aHoleShells; TopoDS_Shape anInfinitePointShape; TopTools_DataMapOfShapeShape aInOutMap; TopTools_DataMapOfShapeListOfShape aMSH; @@ -517,21 +515,19 @@ static } else{ // check if a shell is a hole - //XX bIsHole=IsHole(aShell, myContext); - //bIsHole=GEOMAlgo_BuilderTools::IsHole(aShell); - //XX + // if (bIsHole) { - aHoleShells.Append(aShell); - TopExp::MapShapes(aShell, TopAbs_FACE, aMHF); + aHoleShells.Append(aShell); + TopExp::MapShapes(aShell, TopAbs_FACE, aMHF); } else { - // make a growth solid from a shell - TopoDS_Solid Solid; - aBB.MakeSolid(Solid); - aBB.Add (Solid, aShell); - // - aNewSolids.Append (Solid); + // make a growth solid from a shell + TopoDS_Solid Solid; + aBB.MakeSolid(Solid); + aBB.Add (Solid, aShell); + // + aNewSolids.Append (Solid); } } } @@ -565,13 +561,13 @@ static if (aInOutMap.IsBound(aHole)){ const TopoDS_Shape& aSolid=aInOutMap(aHole); if (aMSH.IsBound(aSolid)) { - TopTools_ListOfShape& aLH=aMSH.ChangeFind(aSolid); - aLH.Append(aHole); + TopTools_ListOfShape& aLH=aMSH.ChangeFind(aSolid); + aLH.Append(aHole); } else { - TopTools_ListOfShape aLH; - aLH.Append(aHole); - aMSH.Bind(aSolid, aLH); + TopTools_ListOfShape aLH; + aLH.Append(aHole); + aMSH.Bind(aSolid, aLH); } //aBB.Add (aSolid, aHole); } @@ -580,7 +576,7 @@ static // 3. Add aHoles to Solids aItMSH.Initialize(aMSH); for (; aItMSH.More(); aItMSH.Next()) { - TopoDS_Solid aSolid=TopoDS::Solid(aItMSH.Key()); + TopoDS_Solid aSolid=*((TopoDS_Solid*)(&aItMSH.Key())); // const TopTools_ListOfShape& aLH=aItMSH.Value(); aShellIt.Initialize(aLH); @@ -595,16 +591,16 @@ static // } // - // These aNewSolids are draft solids that + // These aNewSolids are draft solids that // do not contain any internal shapes // myAreas.Append(aNewSolids); } //======================================================================= //function : PerformInternalShapes -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_BuilderSolid::PerformInternalShapes() +void GEOMAlgo_BuilderSolid::PerformInternalShapes() { myErrorStatus=0; // @@ -612,11 +608,12 @@ static if (!aNbFI) {// nothing to do return; } - // + // + Standard_Integer bFlag; BRep_Builder aBB; TopTools_ListIteratorOfListOfShape aShellIt, aSolidIt; - TopoDS_Iterator aIt; - TopTools_MapOfShape aMF, aMFP; + TopoDS_Iterator aIt; + TopTools_MapOfShape aMF, aMFP, aMFS; TopTools_MapIteratorOfMapOfShape aItMF; TopTools_IndexedDataMapOfShapeListOfShape aMEF; TopTools_ListOfShape aLSI; @@ -636,8 +633,18 @@ static // 2 Process solids aSolidIt.Initialize(myAreas); for ( ; aSolidIt.More(); aSolidIt.Next()) { - TopoDS_Solid& aSolid=TopoDS::Solid(aSolidIt.Value()); + TopoDS_Solid& aSolid=*((TopoDS_Solid*)(&aSolidIt.Value())); // + //modified by NIZNHY-PKV Wed Mar 07 08:52:18 2012f + aMFS.Clear(); + { + TopExp_Explorer aExp(aSolid, TopAbs_FACE); + while (aExp.More()) { + aMFS.Add(aExp.Current()); + aExp.Next(); + } + } + //modified by NIZNHY-PKV Wed Mar 07 08:52:20 2012t aMEF.Clear(); TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMEF); // @@ -645,10 +652,18 @@ static aMFP.Clear(); aItMF.Initialize(aMF); for (; aItMF.More(); aItMF.Next()) { - const TopoDS_Face& aF=TopoDS::Face(aItMF.Key()); - if (GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, *myContext)) { - aMFP.Add(aF); + const TopoDS_Face& aF=*((TopoDS_Face*)(&aItMF.Key())); + //modified by NIZNHY-PKV Wed Mar 07 08:54:56 2012f + if (!aMFS.Contains(aF)) { + bFlag=GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, myContext); + if (bFlag) { + aMFP.Add(aF); + } } + //if (GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, myContext)) { + // aMFP.Add(aF); + //} + //modified by NIZNHY-PKV Wed Mar 07 08:56:07 2012t } // // 2.2 Make Internal Shells @@ -678,10 +693,10 @@ static //======================================================================= //function : MakeInternalShells -//purpose : +//purpose : //======================================================================= void MakeInternalShells(const TopTools_MapOfShape& theMF, - TopTools_ListOfShape& theShells) + TopTools_ListOfShape& theShells) { TopTools_MapIteratorOfMapOfShape aItM; TopTools_MapOfShape aAddedFacesMap; @@ -704,7 +719,7 @@ void MakeInternalShells(const TopTools_MapOfShape& theMF, // // make a new shell TopoDS_Shell aShell; - aBB.MakeShell(aShell); + aBB.MakeShell(aShell); aFF.Orientation(TopAbs_INTERNAL); aBB.Add(aShell, aFF); // @@ -715,15 +730,15 @@ void MakeInternalShells(const TopTools_MapOfShape& theMF, TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); for (; aEdgeExp.More(); aEdgeExp.Next()) { const TopoDS_Shape& aE =aEdgeExp.Current(); - const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE); - aItF.Initialize(aLF); - for (; aItF.More(); aItF.Next()) { - TopoDS_Shape aFL=aItF.Value(); - if (aAddedFacesMap.Add(aFL)){ - aFL.Orientation(TopAbs_INTERNAL); - aBB.Add(aShell, aFL); - } - } + const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE); + aItF.Initialize(aLF); + for (; aItF.More(); aItF.Next()) { + TopoDS_Shape aFL=aItF.Value(); + if (aAddedFacesMap.Add(aFL)){ + aFL.Orientation(TopAbs_INTERNAL); + aBB.Add(aShell, aFL); + } + } } } theShells.Append(aShell); @@ -731,10 +746,10 @@ void MakeInternalShells(const TopTools_MapOfShape& theMF, } //======================================================================= //function : IsHole -//purpose : +//purpose : //======================================================================= Standard_Boolean IsHole(const TopoDS_Shape& theS2, - IntTools_PContext& theContext) + const Handle(IntTools_Context)& theContext) { TopoDS_Solid *pS2=(TopoDS_Solid *)&theS2; BRepClass3d_SolidClassifier& aClsf=theContext->SolidClassifier(*pS2); @@ -745,11 +760,11 @@ Standard_Boolean IsHole(const TopoDS_Shape& theS2, } //======================================================================= //function : IsInside -//purpose : +//purpose : //======================================================================= Standard_Boolean IsInside(const TopoDS_Shape& theS1, - const TopoDS_Shape& theS2, - IntTools_PContext& theContext) + const TopoDS_Shape& theS2, + const Handle(IntTools_Context)& theContext) { TopExp_Explorer aExp; TopAbs_State aState; @@ -765,36 +780,35 @@ Standard_Boolean IsInside(const TopoDS_Shape& theS1, else { TopTools_IndexedMapOfShape aBounds; const TopoDS_Face& aF = TopoDS::Face(aExp.Current()); - aState=GEOMAlgo_Tools3D::ComputeState(aF, *pS2, 1.e-14, aBounds, *theContext); + aState=GEOMAlgo_Tools3D::ComputeState(aF, *pS2, 1.e-14, aBounds, theContext); } return (aState==TopAbs_IN); } //======================================================================= //function : IsGrowthShell -//purpose : +//purpose : //======================================================================= Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell, - const TopTools_IndexedMapOfShape& theMHF) + const TopTools_IndexedMapOfShape& theMHF) { Standard_Boolean bRet; TopoDS_Iterator aIt; - // + // bRet=Standard_False; if (theMHF.Extent()) { aIt.Initialize(theShell); for(; aIt.More(); aIt.Next()) { const TopoDS_Shape& aF=aIt.Value(); if (theMHF.Contains(aF)) { - return !bRet; + return !bRet; } } } return bRet; } -//modified by NIZNHY-PKV Tue Aug 5 15:07:50 2008f //======================================================================= //function : IsClosedShell -//purpose : +//purpose : //======================================================================= Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell) { @@ -803,27 +817,24 @@ Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell) TopoDS_Iterator aIt; TopExp_Explorer aExp; TopTools_MapOfShape aM; - // + // bRet=Standard_False; aIt.Initialize(theShell); for(; aIt.More(); aIt.Next()) { const TopoDS_Face& aF=TopoDS::Face(aIt.Value()); aExp.Init(aF, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { - const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); + const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aExp.Current())); if (BRep_Tool::Degenerated(aE)) { - continue; - } - /* - if (BRep_Tool::IsClosed(aE, aF)) { - continue; + continue; } - */ + // if (aE.Orientation()==TopAbs_INTERNAL) { - continue; + continue; } + // if (!aM.Add(aE)) { - aM.Remove(aE); + aM.Remove(aE); } } } @@ -834,8 +845,87 @@ Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell) } return bRet; } -//modified by NIZNHY-PKV Tue Aug 5 15:08:07 2008t -//BRepTools::Write(aFF, "ff"); +//======================================================================= +//function : RefineShell +//purpose : +//======================================================================= +Standard_Boolean RefineShell(const TopoDS_Shell& aShell, + TopoDS_Shell& aShx) + +{ + Standard_Boolean bRet; + Standard_Integer i, aNbE, aNbF; + TopAbs_Orientation aOrE; + TopTools_IndexedDataMapOfShapeListOfShape aMEF; + TopTools_MapOfOrientedShape aMFx; + // + bRet=Standard_False; + // + TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF); + aNbE=aMEF.Extent(); + for (i=1; i<=aNbE; ++i) { + const TopoDS_Edge &aE=*((TopoDS_Edge*)(&aMEF.FindKey(i))); + // + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + aOrE=aE.Orientation(); + // + const TopTools_ListOfShape& aLF=aMEF(i); + aNbF=aLF.Extent(); + if (!aNbF) { + continue; + } + // + const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First())); + if (aNbF==1) { + if (aOrE==TopAbs_INTERNAL) { + continue; + } + aMFx.Add(aF1); + } + // + else if (aNbF==2) { + const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last())); + if (aF2.IsSame(aF1)) { + if (BRep_Tool::IsClosed(aE, aF1)) { + continue; + } + if (aOrE==TopAbs_INTERNAL) { + continue; + } + aMFx.Add(aF1); + aMFx.Add(aF2); + } + } + } + // + aNbF=aMFx.Extent(); + if (!aNbF) { + return bRet; + } + // + BRep_Builder aBB; + TopoDS_Iterator aIt; + // + aNbF=0; + aBB.MakeShell(aShx); + aIt.Initialize(aShell); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + if (!aMFx.Contains(aF)) { + aBB.Add(aShx, aF); + ++aNbF; + } + } + // + if (aNbF) { + bRet=IsClosedShell(aShx); + } + // + return bRet; +} // // ErrorStatus : // 11 - Null Context diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.hxx b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.hxx index be21d28b2..650528fa7 100644 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.hxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.hxx @@ -1,116 +1,77 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_BuilderSolid.hxx +// Created: +// Author: Peter KURNEV // #ifndef _GEOMAlgo_BuilderSolid_HeaderFile #define _GEOMAlgo_BuilderSolid_HeaderFile -#ifndef _GEOMAlgo_BuilderArea_HeaderFile -#include -#endif - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif +#include //! The algorithm to build solids from set of faces
    -class GEOMAlgo_BuilderSolid : public GEOMAlgo_BuilderArea { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Empty constructor
    -Standard_EXPORT GEOMAlgo_BuilderSolid(); -Standard_EXPORT virtual ~GEOMAlgo_BuilderSolid(); - -//! Performs the algorithm
    -Standard_EXPORT virtual void Perform() ; - - - - - -protected: - - // Methods PROTECTED - // - -//! Collect the faces that
    -//! a) are internal
    -//! b) are the same and have different orientation
    -Standard_EXPORT virtual void PerformShapesToAvoid() ; - -//! Build draft shells
    -//! a)myLoops - draft shells that consist of
    -//! boundary faces
    -//! b)myLoopsInternal - draft shells that contains
    -//! inner faces
    -Standard_EXPORT virtual void PerformLoops() ; - -//! Build draft solids that contains boundary faces
    -Standard_EXPORT virtual void PerformAreas() ; - -//! Build finalized solids with internal shells
    -Standard_EXPORT virtual void PerformInternalShapes() ; - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - +//======================================================================= +//function : GEOMAlgo_BuilderSolid +//purpose : +//======================================================================= +class GEOMAlgo_BuilderSolid : public GEOMAlgo_BuilderArea +{ + public: + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_BuilderSolid(); + + Standard_EXPORT + virtual ~GEOMAlgo_BuilderSolid(); + + //! Performs the algorithm
    + Standard_EXPORT + virtual void Perform() ; + + protected: + //! Collect the faces that
    + //! a) are internal
    + //! b) are the same and have different orientation
    + Standard_EXPORT + virtual void PerformShapesToAvoid() ; + + //! Build draft shells
    + //! a)myLoops - draft shells that consist of
    + //! boundary faces
    + //! b)myLoopsInternal - draft shells that contains
    + //! inner faces
    + Standard_EXPORT + virtual void PerformLoops() ; + + //! Build draft solids that contains boundary faces
    + Standard_EXPORT + virtual void PerformAreas() ; + + //! Build finalized solids with internal shells
    + Standard_EXPORT + virtual void PerformInternalShapes() ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.ixx b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.ixx deleted file mode 100644 index c4209997c..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.jxx b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.jxx deleted file mode 100644 index 7660e31d6..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_BuilderSolid_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderTools.cdl b/src/GEOMAlgo/GEOMAlgo_BuilderTools.cdl deleted file mode 100755 index 5a3c3e162..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderTools.cdl +++ /dev/null @@ -1,48 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_BuilderTools.cdl --- Created: --- Author: Peter KURNEV --- --- -class BuilderTools from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS - ---raises - -is - IsHole(myclass; - aW: Shape from TopoDS; - aF: Shape from TopoDS) - returns Boolean from Standard; - - IsHole(myclass; - aShell: Shape from TopoDS) - returns Boolean from Standard; - ---fields - -end BuilderTools; diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx index 1ecab1312..a40c07a37 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_BuilderTools.cxx -// Created: -// Author: Peter KURNEV -// -// -#include + +// File: GEOMAlgo_BuilderTools.cxx +// Author: Peter KURNEV + +#include + +#include #include @@ -52,25 +53,30 @@ #include #include +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version +#include +#include +#endif + #include #include #include #include #include -static +static Standard_Integer ComputeProps(const TopoDS_Face& aF, - Standard_Real& aA, - Standard_Real& aV); + Standard_Real& aA, + Standard_Real& aV); static void BuildTriangulation(const TopoDS_Face& aF); //======================================================================= //function : IsHole -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_BuilderTools::IsHole(const TopoDS_Shape& aW, - const TopoDS_Shape& aFace) + const TopoDS_Shape& aFace) { Standard_Boolean bIsHole; Standard_Integer i, aNbS; @@ -78,7 +84,7 @@ static Standard_Real aU1, aU2, aU, dU; Standard_Real aX1, aY1, aX0, aY0; TopAbs_Orientation aOr; - + gp_Pnt2d aP2D0, aP2D1; Handle(Geom2d_Curve) aC2D; TopoDS_Face aF, aFF; @@ -92,11 +98,11 @@ static // aS=0.; aItW.Initialize(aW); - for (; aItW.More(); aItW.Next()) { + for (; aItW.More(); aItW.Next()) { const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value()); aOr=aE.Orientation(); - if (!(aOr==TopAbs_FORWARD || - aOr==TopAbs_REVERSED)) { + if (!(aOr==TopAbs_FORWARD || + aOr==TopAbs_REVERSED)) { continue; } // @@ -129,17 +135,17 @@ static aP2D0.Coord(aX0, aY0); aP2D1.Coord(aX1, aY1); // - aS=aS+(aY0+aY1)*(aX1-aX0); + aS=aS+(aY0+aY1)*(aX1-aX0); // aP2D0=aP2D1; } - }//for (; aItW.More(); aItW.Next()) { + }//for (; aItW.More(); aItW.Next()) { bIsHole=(aS>0.); return bIsHole; } //======================================================================= //function : IsHole -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_BuilderTools::IsHole(const TopoDS_Shape& aShell) { @@ -165,11 +171,11 @@ static } //======================================================================= //function : ComputeProps -//purpose : +//purpose : //======================================================================= Standard_Integer ComputeProps(const TopoDS_Face& aF, - Standard_Real& aA, - Standard_Real& aV) + Standard_Real& aA, + Standard_Real& aV) { Standard_Integer j, i, i1, i2, aNbNodes, aNbTrigs, n[3]; Standard_Real aAi, aVi; @@ -225,7 +231,7 @@ Standard_Integer ComputeProps(const TopoDS_Face& aF, Standard_Real aSx, aZx; gp_Dir aDN(aVN); if (aOr==TopAbs_REVERSED) { - aDN.Reverse(); + aDN.Reverse(); } // aSx=aAi*aDN.Z(); @@ -238,7 +244,7 @@ Standard_Integer ComputeProps(const TopoDS_Face& aF, } //======================================================================= //function : BuildTriangulation -//purpose : +//purpose : //======================================================================= void BuildTriangulation(const TopoDS_Face& aF) { @@ -269,11 +275,18 @@ void BuildTriangulation(const TopoDS_Face& aF) aDiscret=aCoeff*dMax; // BRepMesh_FastDiscret aMesher(aDiscret, - aAngle, - aBox, - bWithShare, - Standard_True, - Standard_False, - Standard_True); + aAngle, + aBox, + bWithShare, + Standard_True, + Standard_False, + Standard_True); + +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + TopTools_IndexedDataMapOfShapeListOfShape anAncestors; + TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, anAncestors); + aMesher.Add(aF, anAncestors); +#else aMesher.Add(aF); +#endif } diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderTools.hxx b/src/GEOMAlgo/GEOMAlgo_BuilderTools.hxx index fcadbf4a8..b0d13c9fe 100644 --- a/src/GEOMAlgo/GEOMAlgo_BuilderTools.hxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderTools.hxx @@ -1,98 +1,48 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef _GEOMAlgo_BuilderTools_HeaderFile -#define _GEOMAlgo_BuilderTools_HeaderFile -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class TopoDS_Shape; +// File: GEOMAlgo_BuilderTools.hxx +// Author: Peter KURNEV +#ifndef _GEOMAlgo_BuilderTools_HeaderFile +#define _GEOMAlgo_BuilderTools_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_BuilderTools { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Boolean IsHole(const TopoDS_Shape& aW,const TopoDS_Shape& aF) ; - - -Standard_EXPORT static Standard_Boolean IsHole(const TopoDS_Shape& aShell) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +#include +#include + +//======================================================================= +//class : GEOMAlgo_BuilderTools +//purpose : +//======================================================================= +class GEOMAlgo_BuilderTools +{ + public: + Standard_EXPORT + static Standard_Boolean IsHole(const TopoDS_Shape& aW, + const TopoDS_Shape& aF) ; + + Standard_EXPORT + static Standard_Boolean IsHole(const TopoDS_Shape& aShell) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderTools.ixx b/src/GEOMAlgo/GEOMAlgo_BuilderTools.ixx deleted file mode 100644 index daa0bae98..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderTools.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderTools.jxx b/src/GEOMAlgo/GEOMAlgo_BuilderTools.jxx deleted file mode 100644 index 5b843c4a3..000000000 --- a/src/GEOMAlgo/GEOMAlgo_BuilderTools.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_BuilderTools_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx index 57fb373fd..b0fe28966 100644 --- a/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_0.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -34,7 +35,7 @@ //======================================================================= //function : Shapes1 -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Shapes1(const Standard_Integer theType)const { @@ -42,7 +43,7 @@ } //======================================================================= //function : Images -//purpose : +//purpose : //======================================================================= const BRepAlgo_Image& GEOMAlgo_Builder::Images()const { @@ -50,7 +51,7 @@ } //======================================================================= //function : InParts -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::InParts(const TopoDS_Shape& theS)const { diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx index b84058616..aa4f7ef53 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Builder_1.cxx -// Created: -// Author: Peter KURNEV + +// File: GEOMAlgo_Builder_1.cxx +// Created: +// Author: Peter KURNEV // #include // @@ -64,16 +65,16 @@ static void FillImagesCompounds(const TopTools_MapOfShape& , - BRepAlgo_Image& ); + BRepAlgo_Image& ); static void FillImagesCompound(const TopoDS_Shape& , - BRepAlgo_Image& , - TopTools_MapOfShape& ); + BRepAlgo_Image& , + TopTools_MapOfShape& ); //======================================================================= //function : FillImagesVertices -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::FillImagesVertices() { @@ -90,19 +91,19 @@ static if (aV.ShapeType()==TopAbs_VERTEX) { iV=pPF->FindSDVertex(i); if (iV) { - const TopoDS_Shape& aVSD=aDS.Shape(iV); - if (!myImages.HasImage(aV)) { - myImages.Bind(aV, aVSD); - // - mySameDomainShapes.Add(aV, aVSD); - } + const TopoDS_Shape& aVSD=aDS.Shape(iV); + if (!myImages.HasImage(aV)) { + myImages.Bind(aV, aVSD); + // + mySameDomainShapes.Add(aV, aVSD); + } } } } } //======================================================================= // function: FillImagesEdges -// purpose: +// purpose: //======================================================================= void GEOMAlgo_Builder::FillImagesEdges() { @@ -111,11 +112,10 @@ static const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool(); - NMTTools_CommonBlockPool& aCBP=pPF->ChangeCommonBlockPool(); - IntTools_Context& aCtx=pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx=pPF->Context(); // Standard_Boolean bToReverse; - Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB; + Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB, aNbLB; TColStd_ListIteratorOfListOfInteger aItLB; TColStd_ListOfInteger aLB; TopoDS_Edge aEE, aESpR; @@ -149,31 +149,32 @@ static nSp=aPB.Edge(); const TopoDS_Shape& aSp=aDS.Shape(nSp); // - //modified by NIZNHY-PKV Fri Nov 30 10:40:36 2007 f - //const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB); const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB); - //modified by NIZNHY-PKV Fri Nov 30 10:40:48 2007t + //modified by NIZNHY-PKV Wed Oct 27 11:19:30 2010f + aNbLB=aLB.Extent(); + if (aIsCB && aNbLB<2) { + aIsCB=0; + } + //modified by NIZNHY-PKV Wed Oct 27 11:19:34 2010t + // nSpR=aPBR.Edge(); const TopoDS_Shape& aSpR=aDS.Shape(nSpR); - //modified by NIZNHY-PKV Fri Nov 30 10:41:39 2007f - //if (aSpR.IsSame(aSp) && aSpR.IsSame(aE)) { if (aSpR.IsSame(aSp) && aSpR.IsSame(aE) && !aIsCB) { - //modified by NIZNHY-PKV Fri Nov 30 10:41:46 2007t - continue; + continue; } // aESpR=TopoDS::Edge(aSpR); bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aESpR, aEE, aCtx); if (bToReverse) { - aESpR.Reverse(); + aESpR.Reverse(); } aLSp.Append(aESpR); // aItLB.Initialize(aLB); for (; aItLB.More(); aItLB.Next()) { - nSpx=aItLB.Value(); - const TopoDS_Shape& aSpx=aDS.Shape(nSpx); - mySameDomainShapes.Add(aSpx ,aSpR); + nSpx=aItLB.Value(); + const TopoDS_Shape& aSpx=aDS.Shape(nSpx); + mySameDomainShapes.Add(aSpx ,aSpR); } // // @@ -181,38 +182,34 @@ static else { aIt.Initialize(aLPB); for (; aIt.More(); aIt.Next()) { - const BOPTools_PaveBlock& aPB=aIt.Value(); - //modified by NIZNHY-PKV Fri Nov 30 10:42:15 2007f - //const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB); - const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB); - //modified by NIZNHY-PKV Fri Nov 30 10:42:20 2007t - nSpR=aPBR.Edge(); - const TopoDS_Shape& aSpR=aDS.Shape(nSpR); - // - aESpR=TopoDS::Edge(aSpR); - bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aESpR, aEE, aCtx); - if (bToReverse) { - aESpR.Reverse(); - } - aLSp.Append(aESpR); - // - aItLB.Initialize(aLB); - for (; aItLB.More(); aItLB.Next()) { - nSpx=aItLB.Value(); - const TopoDS_Shape& aSpx=aDS.Shape(nSpx); - mySameDomainShapes.Add(aSpx ,aSpR); - } - // + const BOPTools_PaveBlock& aPB=aIt.Value(); + const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB); + nSpR=aPBR.Edge(); + const TopoDS_Shape& aSpR=aDS.Shape(nSpR); + // + aESpR=TopoDS::Edge(aSpR); + bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aESpR, aEE, aCtx); + if (bToReverse) { + aESpR.Reverse(); + } + aLSp.Append(aESpR); + // + aItLB.Initialize(aLB); + for (; aItLB.More(); aItLB.Next()) { + nSpx=aItLB.Value(); + const TopoDS_Shape& aSpx=aDS.Shape(nSpx); + mySameDomainShapes.Add(aSpx ,aSpR); + } } } // myImages.Bind(aE, aLSp); - + }//for (i=1; i<=aNb; ++i) } //======================================================================= // function: FillImagesContainers -// purpose: +// purpose: //======================================================================= void GEOMAlgo_Builder::FillImagesContainers(const TopAbs_ShapeEnum theType) { @@ -223,13 +220,13 @@ static TopAbs_ShapeEnum aType; BRep_Builder aBB; TopoDS_Iterator aIt; - TopTools_ListIteratorOfListOfShape aItIm; + TopTools_ListIteratorOfListOfShape aItIm; TopTools_MapOfShape aMS; TopTools_MapIteratorOfMapOfShape aItS; // const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // aNbS=aDS.NumberOfShapesOfTheObject(); for (i=1; i<=aNbS; ++i) { @@ -254,8 +251,8 @@ static for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aF=aIt.Value(); if (myImages.HasImage(aF)) { - bInterferred=!bInterferred; - break; + bInterferred=!bInterferred; + break; } } if (!bInterferred){ @@ -269,31 +266,31 @@ static for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aF=aIt.Value(); if (myImages.HasImage(aF)) { - const TopTools_ListOfShape& aLFIm=myImages.Image(aF); - aItIm.Initialize(aLFIm); - for (; aItIm.More(); aItIm.Next()) { - TopoDS_Shape aFIm=aItIm.Value(); - // - bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFIm, aF, aCtx); - if (bToReverse) { - aFIm.Reverse(); - } - aBB.Add(aCIm, aFIm); - } + const TopTools_ListOfShape& aLFIm=myImages.Image(aF); + aItIm.Initialize(aLFIm); + for (; aItIm.More(); aItIm.Next()) { + TopoDS_Shape aFIm=aItIm.Value(); + // + bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFIm, aF, aCtx); + if (bToReverse) { + aFIm.Reverse(); + } + aBB.Add(aCIm, aFIm); + } } else { - aBB.Add(aCIm, aF); + aBB.Add(aCIm, aF); } } - myImages.Bind(aC, aCIm); + myImages.Bind(aC, aCIm); }// for (; aItS.More(); aItS.Next()) { } //======================================================================= // function: FillImagesCompounds -// purpose: +// purpose: //======================================================================= void FillImagesCompounds(const TopTools_MapOfShape& theMS, - BRepAlgo_Image& theImages) + BRepAlgo_Image& theImages) { TopTools_MapOfShape aMFP; TopTools_MapIteratorOfMapOfShape aItS; @@ -306,18 +303,18 @@ void FillImagesCompounds(const TopTools_MapOfShape& theMS, } //======================================================================= //function : FillImagesCompound -//purpose : +//purpose : //======================================================================= void FillImagesCompound(const TopoDS_Shape& theS, - BRepAlgo_Image& theImages, - TopTools_MapOfShape& theMFP) -{ + BRepAlgo_Image& theImages, + TopTools_MapOfShape& theMFP) +{ Standard_Boolean bInterferred; TopAbs_ShapeEnum aTypeX; TopAbs_Orientation aOrX; TopoDS_Iterator aIt; BRep_Builder aBB; - TopTools_ListIteratorOfListOfShape aItIm; + TopTools_ListIteratorOfListOfShape aItIm; // if (!theMFP.Add(theS)) { return; @@ -350,14 +347,14 @@ void FillImagesCompound(const TopoDS_Shape& theS, const TopTools_ListOfShape& aLFIm=theImages.Image(aSX); aItIm.Initialize(aLFIm); for (; aItIm.More(); aItIm.Next()) { - TopoDS_Shape aSXIm=aItIm.Value(); - aSXIm.Orientation(aOrX); - aBB.Add(aCIm, aSXIm); + TopoDS_Shape aSXIm=aItIm.Value(); + aSXIm.Orientation(aOrX); + aBB.Add(aCIm, aSXIm); } } else { aBB.Add(aCIm, aSX); } } - theImages.Bind(theS, aCIm); + theImages.Bind(theS, aCIm); } diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx index 45e7543b4..09809f8cd 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx @@ -1,28 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: GEOMAlgo_Builder_2.cxx -// Created: -// Author: Peter KURNEV +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File: GEOMAlgo_Builder_2.cxx +// Author: Peter KURNEV + #include #include @@ -69,6 +68,8 @@ #include #include +#include + #include #include #include @@ -83,18 +84,34 @@ #include #include #include -#include + +#include +// +#include +#include +#include +#include +#include +#include +#include +#include static void UpdateCandidates(const Standard_Integer , - const Standard_Integer , - NMTTools_IndexedDataMapOfIndexedMapOfInteger& ); + const Standard_Integer , + NMTTools_IndexedDataMapOfIndexedMapOfInteger& ); + +//modified by NIZNHY-PKV Thu Feb 16 12:24:52 2012f +static + Standard_Boolean IsClosed(const TopoDS_Edge& , + const TopoDS_Face& ); +//modified by NIZNHY-PKV Thu Feb 16 12:24:56 2012t //======================================================================= //function : FillImagesFaces -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_Builder::FillImagesFaces() +void GEOMAlgo_Builder::FillImagesFaces() { myErrorStatus=0; // @@ -104,11 +121,12 @@ static FillImagesFaces1(); FillInternalVertices(); } + //======================================================================= // function: FillIn2DParts -// purpose: +// purpose: //======================================================================= - void GEOMAlgo_Builder::FillIn2DParts() +void GEOMAlgo_Builder::FillIn2DParts() { const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; @@ -141,20 +159,16 @@ static aLSpIn.Clear(); // // 1. In Parts - for (j=1; j<=aNbCBP; ++j) { - NMTTools_ListOfCommonBlock& aLCB=aCBP(j); - aItCB.Initialize(aLCB); - for (; aItCB.More(); aItCB.Next()) { - NMTTools_CommonBlock& aCB=aItCB.Value(); - if (aCB.IsPaveBlockOnFace(nF)) { - const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(); - nSpIn=aPB1.Edge(); - const TopoDS_Shape& aSpIn=aDS.Shape(nSpIn); - if (aMFence.Add(aSpIn)){ - aLSpIn.Append(aSpIn); - } - } - } + BOPTools_ListOfPaveBlock aLPBIn; + // + pPF->RealSplitsInFace(nF, aLPBIn); + // + aItPB.Initialize(aLPBIn); + for (; aItPB.More(); aItPB.Next()) { + const BOPTools_PaveBlock& aPB1=aItPB.Value(); + nSpIn=aPB1.Edge(); + const TopoDS_Shape& aSpIn=aDS.Shape(nSpIn); + aLSpIn.Append(aSpIn); } // // 2. Section Parts @@ -162,24 +176,24 @@ static BOPTools_SSInterference& aFF=aFFs(j); aFF.Indices(n1, n2); if (!(n1==nF || n2==nF)) { - continue; + continue; } BOPTools_SequenceOfCurves& aSC=aFF.Curves(); aNbCurves=aSC.Length(); if (!aNbCurves) { - continue; + continue; } // const BOPTools_Curve& aBC=aSC(1); const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks(); aItPB.Initialize(aLPB); for (; aItPB.More(); aItPB.Next()) { - const BOPTools_PaveBlock& aPBSc=aItPB.Value(); - nSpSc=aPBSc.Edge(); - const TopoDS_Shape& aSpSc=aDS.Shape(nSpSc); - if (aMFence.Add(aSpSc)){ - aLSpIn.Append(aSpSc); - } + const BOPTools_PaveBlock& aPBSc=aItPB.Value(); + nSpSc=aPBSc.Edge(); + const TopoDS_Shape& aSpSc=aDS.Shape(nSpSc); + if (aMFence.Add(aSpSc)){ + aLSpIn.Append(aSpSc); + } } } aNbSpIn=aLSpIn.Extent(); @@ -188,17 +202,18 @@ static } }//for (nF=1; nF<=aNbS; ++nF) { } + //======================================================================= // function: BuildSplitFaces -// purpose: +// purpose: //======================================================================= - void GEOMAlgo_Builder::BuildSplitFaces() +void GEOMAlgo_Builder::BuildSplitFaces() { const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // Standard_Boolean bToReverse, bIsClosed, bIsDegenerated; Standard_Integer i, aNb, aNbF, nF; @@ -232,8 +247,8 @@ static for (; anExp.More(); anExp.Next()) { const TopoDS_Shape& aE=anExp.Current(); if (myImages.HasImage(aE)) { - aMFP.Add(i); - break; + aMFP.Add(i); + break; } } // @@ -243,17 +258,18 @@ static // aNbFFs=aFFs.Extent(); for (j=1; j<=aNbFFs; ++j) { - BOPTools_SSInterference& aFFj=aFFs(j); - aFFj.Indices(n1, n2); - if (!(n1==i || n2==i)) { - continue; - } - // - const TColStd_ListOfInteger& aLSE=aFFj.SharedEdges(); - aNbSE=aLSE.Extent(); - if (aNbSE) { - aMFP.Add(i); - } + BOPTools_SSInterference& aFFj=aFFs(j); + aFFj.Indices(n1, n2); + if (!(n1==i || n2==i)) { + continue; + } + // + const TColStd_ListOfInteger& aLSE=aFFj.SharedEdges(); + aNbSE=aLSE.Extent(); + if (aNbSE) { + aMFP.Add(i); + break; + } } } //=== @@ -271,7 +287,7 @@ static // aMFence.Clear(); // - // 2.1. Fill WES + // 2.1. Fill WES GEOMAlgo_WireEdgeSet aWES; aWES.SetFace(aFF); // @@ -282,62 +298,65 @@ static anOriE=aE.Orientation(); // if (!myImages.HasImage(aE)) { - if (anOriE==TopAbs_INTERNAL) { - aEE=aE; - aEE.Orientation(TopAbs_FORWARD); - aWES.AddStartElement(aEE); - aEE.Orientation(TopAbs_REVERSED); - aWES.AddStartElement(aEE); - } - else { - aWES.AddStartElement(aE); - } - continue; + if (anOriE==TopAbs_INTERNAL) { + aEE=aE; + aEE.Orientation(TopAbs_FORWARD); + aWES.AddStartElement(aEE); + aEE.Orientation(TopAbs_REVERSED); + aWES.AddStartElement(aEE); + } + else { + aWES.AddStartElement(aE); + } + continue; } // bIsDegenerated=BRep_Tool::Degenerated(aE); - bIsClosed=BRep_Tool::IsClosed(aE, aF); + //modified by NIZNHY-PKV Wed Mar 07 07:46:09 2012f + bIsClosed=IsClosed(aE, aF); + //bIsClosed=BRep_Tool::IsClosed(aE, aF); + //modified by NIZNHY-PKV Wed Mar 07 07:46:13 2012t // const TopTools_ListOfShape& aLIE=myImages.Image(aE); aIt.Initialize(aLIE); for (; aIt.More(); aIt.Next()) { - aSp=TopoDS::Edge(aIt.Value()); - // - if (bIsDegenerated) { - aSp.Orientation(anOriE); - aWES.AddStartElement(aSp); - continue; - } - // - if (anOriE==TopAbs_INTERNAL) { - aSp.Orientation(TopAbs_FORWARD); - aWES.AddStartElement(aSp); - aSp.Orientation(TopAbs_REVERSED); - aWES.AddStartElement(aSp); - continue; - } - // - if (bIsClosed){ - if (aMFence.Add(aSp)) { - // - if (!BRep_Tool::IsClosed(aSp, aF)){ - BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF); - } - // - aSp.Orientation(TopAbs_FORWARD); - aWES.AddStartElement(aSp); - aSp.Orientation(TopAbs_REVERSED); - aWES.AddStartElement(aSp); - } - continue; - }// if (aMFence.Add(aSp)) - // - aSp.Orientation(anOriE); - bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, aCtx); - if (bToReverse) { - aSp.Reverse(); - } - aWES.AddStartElement(aSp); + aSp=TopoDS::Edge(aIt.Value()); + // + if (bIsDegenerated) { + aSp.Orientation(anOriE); + aWES.AddStartElement(aSp); + continue; + } + // + if (anOriE==TopAbs_INTERNAL) { + aSp.Orientation(TopAbs_FORWARD); + aWES.AddStartElement(aSp); + aSp.Orientation(TopAbs_REVERSED); + aWES.AddStartElement(aSp); + continue; + } + // + if (bIsClosed){ + if (aMFence.Add(aSp)) { + // + if (!BRep_Tool::IsClosed(aSp, aF)){ + BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF); + } + // + aSp.Orientation(TopAbs_FORWARD); + aWES.AddStartElement(aSp); + aSp.Orientation(TopAbs_REVERSED); + aWES.AddStartElement(aSp); + } + continue; + }// if (aMFence.Add(aSp)) + // + aSp.Orientation(anOriE); + bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, aCtx); + if (bToReverse) { + aSp.Reverse(); + } + aWES.AddStartElement(aSp); }// for (; aIt.More(); aIt.Next()) { }// for (; anExp.More(); anExp.Next()) { // @@ -346,80 +365,71 @@ static const TopTools_ListOfShape& aLE=myInParts.FindFromKey(aF); aIt.Initialize(aLE); for (; aIt.More(); aIt.Next()) { - aSp=TopoDS::Edge(aIt.Value()); - // - aSp.Orientation(TopAbs_FORWARD); - aWES.AddStartElement(aSp); - // - aSp.Orientation(TopAbs_REVERSED); - aWES.AddStartElement(aSp); + aSp=TopoDS::Edge(aIt.Value()); + // + aSp.Orientation(TopAbs_FORWARD); + aWES.AddStartElement(aSp); + // + aSp.Orientation(TopAbs_REVERSED); + aWES.AddStartElement(aSp); } } // // 2.2. Build images Faces - GEOMAlgo_BuilderFace aBF; + TopTools_ListOfShape aLFR; + GEOMAlgo_ShapeSet aS1, aS2; // - aBF.SetFace(aFF); - aBF.SetContext(aCtx); const TopTools_ListOfShape& aSE=aWES.StartElements(); - // - //DEB f - /* - { - TopoDS_Compound aCx; - BRep_Builder aBBx; - TopTools_ListIteratorOfListOfShape aItx; - // - aBBx.MakeCompound(aCx); - aBBx.Add(aCx, aFF); - aItx.Initialize(aSE); - for (; aItx.More(); aItx.Next()) { - TopoDS_Shape& aEx=aItx.Value(); - aBBx.Add(aCx, aEx); - } - int a=0; + aS1.Add(aSE); + aS2.Add(aFF, TopAbs_EDGE); + if (aS1.IsEqual(aS2)) { + aLFR.Append(aF); } - */ - //DEB t - // - aBF.SetShapes(aSE); - // - aBF.Perform(); - // - const TopTools_ListOfShape& aLF=aBF.Areas(); - // - TopTools_ListOfShape aLFR; - // - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - TopoDS_Shape& aFR=aIt.Value(); - if (anOriF==TopAbs_REVERSED) { - aFR.Orientation(TopAbs_REVERSED); + else { + GEOMAlgo_BuilderFace aBF; + // + aBF.SetFace(aFF); + aBF.SetContext(aCtx); + aBF.SetShapes(aSE); + // <-DEB + aBF.Perform(); + // + const TopTools_ListOfShape& aLF=aBF.Areas(); + aIt.Initialize(aLF); + for (; aIt.More(); aIt.Next()) { + TopoDS_Shape& aFR=aIt.Value(); + if (anOriF==TopAbs_REVERSED) { + aFR.Orientation(TopAbs_REVERSED); + } + aLFR.Append(aFR); } - aLFR.Append(aFR); } // // 2.3. Collect draft images Faces mySplitFaces.Bind(aF, aLFR); }//for (i=1; i<=aNbF; ++i) } + //======================================================================= // function: FillSameDomainFaces -// purpose: +// purpose: //======================================================================= - void GEOMAlgo_Builder::FillSameDomainFaces() +void GEOMAlgo_Builder::FillSameDomainFaces() { + Standard_Boolean bIsSDF, bHasImage1, bHasImage2, bForward; + Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC, aNbSE; + Standard_Integer aNbF1, aNbF2, i2s, aNbSD; + TopTools_MapOfShape aMFence; + TopTools_ListOfShape aLX1, aLX2; + TopTools_ListIteratorOfListOfShape aItF1, aItF2; + NMTTools_ListOfCoupleOfShape aLCS; + // const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // - Standard_Boolean bIsSDF; - Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC, aNbSE; - TopTools_MapOfShape aMFence; - TopTools_ListIteratorOfListOfShape aItF1, aItF2; - NMTTools_ListOfCoupleOfShape aLCS; // //mySameDomainShapes.Clear(); // @@ -457,79 +467,194 @@ static // the faces are suspected to be SDF. // Try to find SDF among images of nF1, nF2 aMFence.Clear(); - const TopTools_ListOfShape& aLF1=mySplitFaces.Image(aF1); - const TopTools_ListOfShape& aLF2=mySplitFaces.Image(aF2); // + //-------------------------------------------------------- + bHasImage1=mySplitFaces.HasImage(aF1); + bHasImage2=mySplitFaces.HasImage(aF2); + // + aLX1.Clear(); + if (!bHasImage1) { + aLX1.Append(aF1); + } + // + aLX2.Clear(); + if (!bHasImage2) { + aLX2.Append(aF2); + } + // + const TopTools_ListOfShape& aLF1r=(bHasImage1)? mySplitFaces.Image(aF1) : aLX1; + const TopTools_ListOfShape& aLF2r=(bHasImage2)? mySplitFaces.Image(aF2) : aLX2; + // + TopTools_DataMapOfIntegerShape aMIS; + TColStd_ListIteratorOfListOfInteger aItLI; + NMTDS_BoxBndTreeSelector aSelector; + NMTDS_BoxBndTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + aNbF1=aLF1r.Extent(); + aNbF2=aLF2r.Extent(); + bForward=(aNbF1DS(); NMTTools_PaveFiller* pPF=myPaveFiller; NMTDS_InterfPool* pIP=pPF->IP(); - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // - BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); BOPTools_CArray1OfVSInterference& aVFs=pIP->VSInterferences(); BOPTools_CArray1OfESInterference& aEFs=pIP->ESInterferences(); const NMTTools_IndexedDataMapOfIndexedMapOfInteger& aMAV=pPF->AloneVertices(); // - Standard_Boolean bHasImage; - Standard_Integer i, j, nF, aNbS, nV, nVSD, n1, n2, iFlag; + Standard_Boolean bHasImage; + Standard_Integer i, j, nF, aNbS, nV, nVSD, n1, n2, iFlag; Standard_Integer aNbVFs, aNbAVF, aNbEFs, aNbVC, aNbE, aNbV; Standard_Real aU1, aU2, aTol; NMTTools_IndexedDataMapOfIndexedMapOfInteger aMFMV; @@ -659,13 +792,13 @@ static const TColStd_IndexedMapOfInteger& aMAVF=aMAV.FindFromKey(nF); aNbAVF=aMAVF.Extent(); for (j=1; j<=aNbAVF; ++j) { - nV=aMAVF(j); - nVSD=pPF->FindSDVertex(nV); - if (nVSD) { - nV=nVSD; - } - // - UpdateCandidates(nF, nV, aMFMV); + nV=aMAVF(j); + nVSD=pPF->FindSDVertex(nV); + if (nVSD) { + nV=nVSD; + } + // + UpdateCandidates(nF, nV, aMFMV); } } // @@ -676,12 +809,12 @@ static nV=aExp.Current(); const TopoDS_Shape& aV=aDS.Shape(nV); if (aV.Orientation()==TopAbs_INTERNAL) { - nVSD=pPF->FindSDVertex(nV); - if (nVSD) { - nV=nVSD; - } - // - UpdateCandidates(nF, nV, aMFMV); + nVSD=pPF->FindSDVertex(nV); + if (nVSD) { + nV=nVSD; + } + // + UpdateCandidates(nF, nV, aMFMV); } } // @@ -705,25 +838,25 @@ static const TopTools_ListOfShape& aLFx=myImages.Image(aF); aIt.Initialize(aLFx); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aFx=aIt.Value(); - TopExp::MapShapesAndAncestors(aFx, TopAbs_VERTEX, TopAbs_EDGE, aMVE); + const TopoDS_Shape& aFx=aIt.Value(); + TopExp::MapShapesAndAncestors(aFx, TopAbs_VERTEX, TopAbs_EDGE, aMVE); } } - else { + else { Standard_Boolean bFaceToProcess; // TopExp::MapShapesAndAncestors(aF, TopAbs_VERTEX, TopAbs_EDGE, aMVE); bFaceToProcess=Standard_False; for (j=1; j<=aNbVC; ++j) { - nV=aMVC(j); - const TopoDS_Shape& aV=aDS.Shape(nV); - if (!aMVE.Contains(aV)) { - bFaceToProcess=!bFaceToProcess; - break; - } + nV=aMVC(j); + const TopoDS_Shape& aV=aDS.Shape(nV); + if (!aMVE.Contains(aV)) { + bFaceToProcess=!bFaceToProcess; + break; + } } if (!bFaceToProcess) { - continue; + continue; } }// else // @@ -731,11 +864,11 @@ static nV=aMVC(j); const TopoDS_Shape& aV=aDS.Shape(nV); if (aMVE.Contains(aV)) { - const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV); - aNbE=aLE.Extent(); - if (aNbE) { - continue; - } + const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aV); + aNbE=aLE.Extent(); + if (aNbE) { + continue; + } } aLV.Append(aV); } @@ -745,52 +878,53 @@ static // 3. Try to put vertices into the face(s) aItV.Initialize(aLV); for (; aItV.More(); aItV.Next()) { - TopoDS_Vertex aV=TopoDS::Vertex(aItV.Value()); - aV.Orientation(TopAbs_INTERNAL); - // - bHasImage=myImages.HasImage(aF); - if (bHasImage) { - const TopTools_ListOfShape& aLFx=myImages.Image(aF); - aIt.Initialize(aLFx); - for (; aIt.More(); aIt.Next()) { - TopoDS_Face aFx=TopoDS::Face(aIt.Value()); - // update classifier - IntTools_FClass2d& aClsf=aCtx.FClass2d(aFx); - aClsf.Init(aFx, aTol); - // - iFlag=aCtx.ComputeVS (aV, aFx, aU1, aU2); - if (!iFlag) { - aBB.Add(aFx, aV); - break; - } - } - } - else { - const TopoDS_Face& aFx=TopoDS::Face(aF); - // update classifier - IntTools_FClass2d& aClsf=aCtx.FClass2d(aFx); - aClsf.Init(aFx, aTol); - // - iFlag=aCtx.ComputeVS (aV, aFx, aU1, aU2); - if (!iFlag) { - TopoDS_Face aFz; - // - GEOMAlgo_Tools3D::CopyFace(aFx, aFz); - aBB.Add(aFz, aV); - myImages.Bind(aF, aFz); - } - } + TopoDS_Vertex aV=TopoDS::Vertex(aItV.Value()); + aV.Orientation(TopAbs_INTERNAL); + // + bHasImage=myImages.HasImage(aF); + if (bHasImage) { + const TopTools_ListOfShape& aLFx=myImages.Image(aF); + aIt.Initialize(aLFx); + for (; aIt.More(); aIt.Next()) { + TopoDS_Face aFx=TopoDS::Face(aIt.Value()); + // update classifier + IntTools_FClass2d& aClsf=aCtx->FClass2d(aFx); + aClsf.Init(aFx, aTol); + // + iFlag=aCtx->ComputeVS (aV, aFx, aU1, aU2); + if (!iFlag) { + aBB.Add(aFx, aV); + break; + } + } + } + else { + const TopoDS_Face& aFx=TopoDS::Face(aF); + // update classifier + IntTools_FClass2d& aClsf=aCtx->FClass2d(aFx); + aClsf.Init(aFx, aTol); + // + iFlag=aCtx->ComputeVS (aV, aFx, aU1, aU2); + if (!iFlag) { + TopoDS_Face aFz; + // + GEOMAlgo_Tools3D::CopyFace(aFx, aFz); + aBB.Add(aFz, aV); + myImages.Bind(aF, aFz); + } + } }// for (; aItV.More(); aItV.Next()) { }// if (aNbV) { }// for (nF=1; nF<=aNb; ++nF) { } + //======================================================================= // function: UpdateCandidates -// purpose: +// purpose: //======================================================================= void UpdateCandidates(const Standard_Integer theNF, - const Standard_Integer theNV, - NMTTools_IndexedDataMapOfIndexedMapOfInteger& theMFMV) + const Standard_Integer theNV, + NMTTools_IndexedDataMapOfIndexedMapOfInteger& theMFMV) { if (theMFMV.Contains(theNF)) { TColStd_IndexedMapOfInteger& aMV=theMFMV.ChangeFromKey(theNF); @@ -802,3 +936,56 @@ void UpdateCandidates(const Standard_Integer theNF, theMFMV.Add(theNF, aMV); } } + +//======================================================================= +//function : IsClosed +//purpose : +//======================================================================= +Standard_Boolean IsClosed(const TopoDS_Edge& aE, + const TopoDS_Face& aF) +{ + Standard_Boolean bRet; + // + bRet=BRep_Tool::IsClosed(aE, aF); + if (bRet) { + Standard_Integer iCnt; + TopoDS_Shape aE1; + // + bRet=!bRet; + iCnt=0; + TopExp_Explorer aExp(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aEx=aExp.Current(); + // + if (aEx.IsSame(aE)) { + ++iCnt; + if (iCnt==1) { + aE1=aEx; + } + else if (iCnt==2){ + aE1.Reverse(); + bRet=(aE1==aEx); + break; + } + } + } + } + return bRet; +} + +/* + { + TopoDS_Compound aCx; + BRep_Builder aBBx; + TopTools_ListIteratorOfListOfShape aItx; + // + aBBx.MakeCompound(aCx); + aBBx.Add(aCx, aFF); + aItx.Initialize(aSE); + for (; aItx.More(); aItx.Next()) { + TopoDS_Shape& aEx=aItx.Value(); + aBBx.Add(aCx, aEx); + } + int a=0; + } + */ diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx index 1a3b5b566..066cc9c7d 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx @@ -1,28 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: GEOMAlgo_Builder_3.cxx -// Created: -// Author: Peter KURNEV +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : GEOMAlgo_Builder_3.cxx +// Created : +// Author : Peter KURNEV + #include #include @@ -70,11 +70,11 @@ static void OwnInternalShapes(const TopoDS_Shape& , - TopTools_IndexedMapOfShape& ); + TopTools_IndexedMapOfShape& ); //======================================================================= //function : FillImagesSolids -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::FillImagesSolids() { @@ -86,23 +86,22 @@ static } //======================================================================= //function : BuildDraftSolid -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid, - TopoDS_Shape& theDraftSolid, - TopTools_ListOfShape& theLIF) +void GEOMAlgo_Builder::BuildDraftSolid (const TopoDS_Shape& theSolid, + TopoDS_Shape& theDraftSolid, + TopTools_ListOfShape& theLIF) { myErrorStatus=0; // - const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // Standard_Boolean bToReverse; Standard_Integer iFlag; TopAbs_Orientation aOrF, aOrSh, aOrSd; TopoDS_Iterator aIt1, aIt2; - TopTools_ListIteratorOfListOfShape aItS; + TopTools_ListIteratorOfListOfShape aItS; BRep_Builder aBB; TopoDS_Shell aShD; TopoDS_Shape aFSDx, aFx; @@ -128,49 +127,49 @@ static aOrF=aF.Orientation(); // if (myImages.HasImage(aF)) { - const TopTools_ListOfShape& aLSp=myImages.Image(aF); - aItS.Initialize(aLSp); - for (; aItS.More(); aItS.Next()) { - aFx=aItS.Value(); - // - if (mySameDomainShapes.Contains(aFx)) { - aFSDx=mySameDomainShapes.FindFromKey(aFx); - // - if (aOrF==TopAbs_INTERNAL) { - aFSDx.Orientation(aOrF); - theLIF.Append(aFSDx); - } - else { - bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFSDx, aF, aCtx); - if (bToReverse) { - aFSDx.Reverse(); - } - // - iFlag=1; - aBB.Add(aShD, aFSDx); - } - }// if (mySameDomainShapes.Contains(aFx)) { - else { - aFx.Orientation(aOrF); - if (aOrF==TopAbs_INTERNAL) { - theLIF.Append(aFx); - } - else{ - iFlag=1; - aBB.Add(aShD, aFx); - } - } - } + const TopTools_ListOfShape& aLSp=myImages.Image(aF); + aItS.Initialize(aLSp); + for (; aItS.More(); aItS.Next()) { + aFx=aItS.Value(); + // + if (mySameDomainShapes.Contains(aFx)) { + aFSDx=mySameDomainShapes.FindFromKey(aFx); + // + if (aOrF==TopAbs_INTERNAL) { + aFSDx.Orientation(aOrF); + theLIF.Append(aFSDx); + } + else { + bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aFSDx, aF, aCtx); + if (bToReverse) { + aFSDx.Reverse(); + } + // + iFlag=1; + aBB.Add(aShD, aFSDx); + } + }// if (mySameDomainShapes.Contains(aFx)) { + else { + aFx.Orientation(aOrF); + if (aOrF==TopAbs_INTERNAL) { + theLIF.Append(aFx); + } + else{ + iFlag=1; + aBB.Add(aShD, aFx); + } + } + } } //if (myImages.HasImage(aF)) { // else { - if (aOrF==TopAbs_INTERNAL) { - theLIF.Append(aF); - } - else{ - iFlag=1; - aBB.Add(aShD, aF); - } + if (aOrF==TopAbs_INTERNAL) { + theLIF.Append(aF); + } + else{ + iFlag=1; + aBB.Add(aShD, aF); + } } } //for (; aIt2.More(); aIt2.Next()) { // @@ -181,7 +180,7 @@ static } //======================================================================= //function : FillIn3DParts -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::FillIn3DParts() { @@ -189,19 +188,19 @@ static // const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // Standard_Boolean bIsIN, bHasImage; - Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;// k, - TopAbs_ShapeEnum aType; + Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF; + TopAbs_ShapeEnum aType; TopAbs_State aState; TopTools_IndexedMapOfShape aMSolids, aMS, aMFaces, aMFIN; TopTools_MapOfShape aMFDone; TopTools_IndexedDataMapOfShapeListOfShape aMEF; - TopTools_ListIteratorOfListOfShape aItS; + TopTools_ListIteratorOfListOfShape aItS; TopoDS_Iterator aIt, aItF; BRep_Builder aBB; - TopoDS_Solid aSolidSp; + TopoDS_Solid aSolidSp; TopoDS_Face aFP; // myDraftSolids.Clear(); @@ -211,35 +210,35 @@ static const TopoDS_Shape& aS=aDS.Shape(i); // aType=aS.ShapeType(); - if (aType==TopAbs_SOLID) { + if (aType==TopAbs_SOLID) { // all solids from DS aMSolids.Add(aS); } else if (aType==TopAbs_FACE) { // all faces (originals from DS or theirs images) if (myImages.HasImage(aS)) { - const TopTools_ListOfShape& aLS=myImages.Image(aS); - aItS.Initialize(aLS); - for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aFx=aItS.Value(); - // - if (mySameDomainShapes.Contains(aFx)) { - const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aFx); - aMFaces.Add(aFSDx); - } - else { - aMFaces.Add(aFx); - } - } + const TopTools_ListOfShape& aLS=myImages.Image(aS); + aItS.Initialize(aLS); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aFx=aItS.Value(); + // + if (mySameDomainShapes.Contains(aFx)) { + const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aFx); + aMFaces.Add(aFSDx); + } + else { + aMFaces.Add(aFx); + } + } } else { - if (mySameDomainShapes.Contains(aS)) { - const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aS); - aMFaces.Add(aFSDx); - } - else { - aMFaces.Add(aS); - } + if (mySameDomainShapes.Contains(aS)) { + const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aS); + aMFaces.Add(aFSDx); + } + else { + aMFaces.Add(aS); + } } } } @@ -268,22 +267,25 @@ static const TopoDS_Shape& aShell=aIt.Value(); // if (myImages.HasImage(aShell)) { - bHasImage=Standard_True; - // - const TopTools_ListOfShape& aLS=myImages.Image(aShell); - aItS.Initialize(aLS); - for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aSx=aItS.Value(); - aMS.Add(aSx); - TopExp::MapShapes(aSx, TopAbs_FACE, aMS); - TopExp::MapShapes(aSx, TopAbs_EDGE, aMS); - TopExp::MapShapesAndAncestors(aSx, TopAbs_EDGE, TopAbs_FACE, aMEF); - } + bHasImage=Standard_True; + // + const TopTools_ListOfShape& aLS=myImages.Image(aShell); + aItS.Initialize(aLS); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aSx=aItS.Value(); + aMS.Add(aSx); + TopExp::MapShapes(aSx, TopAbs_FACE, aMS); + TopExp::MapShapes(aSx, TopAbs_EDGE, aMS); + TopExp::MapShapesAndAncestors(aSx, TopAbs_EDGE, TopAbs_FACE, aMEF); + } } else { - //aMS.Add(aShell); - TopExp::MapShapes(aShell, TopAbs_FACE, aMS); - TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF); + //aMS.Add(aShell); + TopExp::MapShapes(aShell, TopAbs_FACE, aMS); + //modified by NIZNHY-PKV Fri Dec 03 11:18:45 2010f + TopExp::MapShapes(aShell, TopAbs_EDGE, aMS); + //modified by NIZNHY-PKV Fri Dec 03 11:18:51 2010t + TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF); } } // @@ -298,30 +300,30 @@ static for (j=1; j<=aNbFaces; ++j) { const TopoDS_Shape& aFace=aMFaces(j); if (!aMS.Contains(aFace)) { - TopExp::MapShapesAndAncestors(aFace, TopAbs_EDGE, TopAbs_FACE, aMEFP); + TopExp::MapShapesAndAncestors(aFace, TopAbs_EDGE, TopAbs_FACE, aMEFP); } } // // among all faces from aMEFP select these that have same edges - // with the solid (i.e aMEF). These faces will be treated first + // with the solid (i.e aMEF). These faces will be treated first // to prevent the usage of 3D classifier. - // The full list of faces to process is aLFP1. + // The full list of faces to process is aLFP1. aNbEFP=aMEFP.Extent(); for (j=1; j<=aNbEFP; ++j) { const TopoDS_Shape& aE=aMEFP.FindKey(j); // if (aMEF.Contains(aE)) { // !! - const TopTools_ListOfShape& aLF=aMEFP(j); - aItFP.Initialize(aLF); - for (; aItFP.More(); aItFP.Next()) { - const TopoDS_Shape& aF=aItFP.Value(); - if (aMFence.Add(aF)) { - aLFP1.Append(aF); - } - } + const TopTools_ListOfShape& aLF=aMEFP(j); + aItFP.Initialize(aLF); + for (; aItFP.More(); aItFP.Next()) { + const TopoDS_Shape& aF=aItFP.Value(); + if (aMFence.Add(aF)) { + aLFP1.Append(aF); + } + } } else { - aLEx.Append(aE); + aLEx.Append(aE); } } // @@ -331,10 +333,10 @@ static const TopTools_ListOfShape& aLF=aMEFP.FindFromKey(aE); aItFP.Initialize(aLF); for (; aItFP.More(); aItFP.Next()) { - const TopoDS_Shape& aF=aItFP.Value(); - if (aMFence.Add(aF)) { - aLFP2.Append(aF); - } + const TopoDS_Shape& aF=aItFP.Value(); + if (aMFence.Add(aF)) { + aLFP2.Append(aF); + } } } aLFP1.Append(aLFP2); @@ -346,9 +348,9 @@ static for (; aItFP.More(); aItFP.Next()) { const TopoDS_Shape& aSP=aItFP.Value(); if (!aMFDone.Add(aSP)) { - continue; + continue; } - + // // first face to process aFP=TopoDS::Face(aSP); @@ -360,30 +362,30 @@ static aLFP.Append(aFP); aItS.Initialize(aLFP1); for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aSk=aItS.Value(); - if (!aMFDone.Contains(aSk)) { - aLFP.Append(aSk); - } + const TopoDS_Shape& aSk=aItS.Value(); + if (!aMFDone.Contains(aSk)) { + aLFP.Append(aSk); + } } // - // Connexity Block that spreads from aFP the Bound + // Connexity Block that spreads from aFP the Bound // or till the end of the block itself aLCBF.Clear(); GEOMAlgo_Tools3D::MakeConnexityBlock(aLFP, aMS, aLCBF); // - // fill states for the Connexity Block + // fill states for the Connexity Block aItS.Initialize(aLCBF); for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aSx=aItS.Value(); - aMFDone.Add(aSx); - if (aState==TopAbs_IN) { - aMFIN.Add(aSx); - } + const TopoDS_Shape& aSx=aItS.Value(); + aMFDone.Add(aSx); + if (aState==TopAbs_IN) { + aMFIN.Add(aSx); + } } // aNbFPx=aMFDone.Extent(); if (aNbFPx==aNbFP) { - break; + break; } }//for (; aItFP.More(); aItFP.Next()) // @@ -392,14 +394,14 @@ static aNbFIN=aMFIN.Extent(); if (aNbFIN || aNbLIF) { for (j=1; j<=aNbFIN; ++j) { - const TopoDS_Shape& aFIN=aMFIN(j); - aLFIN.Append(aFIN); + const TopoDS_Shape& aFIN=aMFIN(j); + aLFIN.Append(aFIN); } // aItS.Initialize(aLIF); for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aFIN=aItS.Value(); - aLFIN.Append(aFIN); + const TopoDS_Shape& aFIN=aItS.Value(); + aLFIN.Append(aFIN); } // myInParts.Add(aSolid, aLFIN); @@ -411,15 +413,15 @@ static } //======================================================================= //function : BuildSplitSolids -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::BuildSplitSolids() { myErrorStatus=0; - // + // const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // Standard_Integer i, aNbS, iErr; TopExp_Explorer aExp; @@ -431,8 +433,6 @@ static GEOMAlgo_DataMapOfShapeShapeSet aMSS; GEOMAlgo_ShapeSet aSSi; // - //modified by NIZNHY-PKV Wed Dec 6 17:08:03 2006f - // // 0. Find same domain solids for non-interferred solids aNbS=aDS.NumberOfShapesOfTheObject(); for (i=1; i<=aNbS; ++i) { @@ -451,13 +451,11 @@ static aSSi.Add(aS, TopAbs_FACE); // aMSS.Bind(aS, aSSi); - } //for (i=1; i<=aNbS; ++i) - // - //modified by NIZNHY-PKV Wed Dec 6 17:08:09 2006t + } //for (i=1; i<=aNbS; ++i) // // 1. Build solids for interferred source solids - // aSB.SetContext(aCtx); + aSB.ComputeInternalShapes(myComputeInternalShapes); aNbS=myDraftSolids.Extent(); for (i=1; i<=aNbS; ++i) { const TopoDS_Shape& aS =myDraftSolids.FindKey(i); @@ -467,7 +465,7 @@ static // // 1.1 Fill Shell Faces Set aSFS.Clear(); - + aExp.Init(aSD, TopAbs_FACE); for (; aExp.More(); aExp.Next()) { const TopoDS_Shape& aF=aExp.Current(); @@ -488,35 +486,41 @@ static aNbSFS=aSFS.Extent(); // // 1.2 - // Check whether aSFS contains a subsets of faces - // of solids that have been already built. + // Check whether aSFS contains a subsets of faces + // of solids that have been already built. // If yes, shrink aSFS by these subsets. aSSi.Clear(); aSSi.Add(aSFS); // aItSS.Initialize(aMSS); for (; aItSS.More(); aItSS.Next()) { - const TopoDS_Shape& aSR=aItSS.Key(); + const TopoDS_Shape& aSR=aItSS.Key(); const GEOMAlgo_ShapeSet& aSSR=aItSS.Value(); if (aSSi.Contains(aSSR)) { - // the aSR is SD solid for aS - aSSi.Subtract(aSSR); - // update images - if(myImages.HasImage(aS)) { - myImages.Add(aS, aSR); - } - else { - myImages.Bind(aS, aSR); - } - // - // update SD Shapes - mySameDomainShapes.Add(aSR, aSR); + // the aSR is SD solid for aS + aSSi.Subtract(aSSR); + // update images + if(myImages.HasImage(aS)) { + myImages.Add(aS, aSR); + } + else { + myImages.Bind(aS, aSR); + } + // + // update SD Shapes + mySameDomainShapes.Add(aSR, aSR); } } const TopTools_ListOfShape& aSFS1=aSSi.GetSet(); aNbSFS=aSFS1.Extent(); + //modified by NIZNHY-PKV Wed Oct 27 09:53:15 2010f + if (!aNbSFS) { + continue; + } + //modified by NIZNHY-PKV Wed Oct 27 09:53:18 2010t // // 1.3 Build new solids + aSB.SetContext(aCtx); aSB.SetShapes(aSFS1); aSB.Perform(); iErr=aSB.ErrorStatus(); @@ -527,7 +531,7 @@ static // const TopTools_ListOfShape& aLSR=aSB.Areas(); // - // 1.4 Collect resulting solids and theirs set of faces + // 1.4 Collect resulting solids and theirs set of faces aIt.Initialize(aLSR); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aSR=aIt.Value(); @@ -535,8 +539,8 @@ static aSSi.Clear(); aExp.Init(aSR, TopAbs_FACE); for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aF=aExp.Current(); - aSSi.Add(aF); + const TopoDS_Shape& aF=aExp.Current(); + aSSi.Add(aF); } aMSS.Bind(aSR, aSSi); } @@ -549,42 +553,10 @@ static myImages.Bind(aS, aLSR); } } // for (i=1; i<=aNbS; ++i) { - //modified by NIZNHY-PKV Wed Dec 6 17:07:47 2006f - /* - // - // 2. Find same domain solids for non-interferred solids - aNbS=aDS.NumberOfShapesOfTheObject(); - for (i=1; i<=aNbS; ++i) { - const TopoDS_Shape& aS=aDS.Shape(i); - if (aS.ShapeType()!=TopAbs_SOLID) { - continue; - } - if (!aMFence.Add(aS)) { - continue; - } - if(myImages.HasImage(aS)) { - continue; - } - // - aSSi.Clear(); - aSSi.Add(aS, TopAbs_FACE); - // - aItSS.Initialize(aMSS); - for (; aItSS.More(); aItSS.Next()) { - const TopoDS_Shape& aSR=aItSS.Key(); - const GEOMAlgo_ShapeSet& aSSR=aItSS.Value(); - if (aSSi.Contains(aSSR)) { - myImages.Bind(aS, aSR); - break; - } - } - } //for (i=1; i<=aNbS; ++i) - */ - //modified by NIZNHY-PKV Wed Dec 6 17:07:55 2006t } //======================================================================= -//function :FillInternalShapes -//purpose : +//function :FillInternalShapes +//purpose : //======================================================================= void GEOMAlgo_Builder::FillInternalShapes() { @@ -592,7 +564,7 @@ static // const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; - IntTools_Context& aCtx= pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx= pPF->Context(); // //Standard_Boolean bHasImage; Standard_Integer i, j, jT, aNbS, aNbSI, aNbSx, aNbSd; @@ -609,7 +581,7 @@ static // // 1. Shapes to process // - // 1.1 Shapes from pure arguments aMSI + // 1.1 Shapes from pure arguments aMSI // 1.1.1 vertex, edge for (i=0; i<2; ++i) { jT=(Standard_Integer)aT[i]; @@ -618,12 +590,12 @@ static for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aS=aIt.Value(); if (aMFence.Add(aS)) { - aLSI.Append(aS); + aLSI.Append(aS); } } } // 1.1.2 wire - { + { jT=(Standard_Integer)TopAbs_WIRE; const TopTools_ListOfShape &aLW=myShapes1[jT]; aIt.Initialize(aLW); @@ -631,14 +603,14 @@ static const TopoDS_Shape& aW=aIt.Value(); aItS.Initialize(aW); for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aE=aItS.Value(); - if (aMFence.Add(aE)) { - aLSI.Append(aE); - } + const TopoDS_Shape& aE=aItS.Value(); + if (aMFence.Add(aE)) { + aLSI.Append(aE); + } } } } - // 1.1.3 theirs images/sources + // 1.1.3 theirs images/sources aIt1.Initialize(aLSI); for (; aIt1.More(); aIt1.Next()) { const TopoDS_Shape& aS=aIt1.Value(); @@ -646,8 +618,8 @@ static const TopTools_ListOfShape &aLSp=myImages.Image(aS); aIt.Initialize(aLSp); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSI=aIt.Value(); - aMSI.Add(aSI); + const TopoDS_Shape& aSI=aIt.Value(); + aMSI.Add(aSI); } } else { @@ -672,58 +644,58 @@ static // aNbSx=aMx.Extent(); for (j=1; j<=aNbSx; ++j) { - const TopoDS_Shape& aSI=aMx(j); - if (myImages.HasImage(aSI)) { - const TopTools_ListOfShape &aLSp=myImages.Image(aSI); - aIt.Initialize(aLSp); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSp=aIt.Value(); - aMSI.Add(aSp); - } - } - else { - aMSI.Add(aSI); - } + const TopoDS_Shape& aSI=aMx(j); + if (myImages.HasImage(aSI)) { + const TopTools_ListOfShape &aLSp=myImages.Image(aSI); + aIt.Initialize(aLSp); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSp=aIt.Value(); + aMSI.Add(aSp); + } + } + else { + aMSI.Add(aSI); + } } // // build aux map from splits of solids if (myImages.HasImage(aS)) { - const TopTools_ListOfShape &aLSp=myImages.Image(aS); - aIt.Initialize(aLSp); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSp=aIt.Value(); - if (aMFence.Add(aSp)) { - TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_EDGE, aMSx); - TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_FACE, aMSx); - TopExp::MapShapesAndAncestors(aSp, TopAbs_EDGE , TopAbs_FACE, aMSx); - aLSd.Append(aSp); - } - } + const TopTools_ListOfShape &aLSp=myImages.Image(aS); + aIt.Initialize(aLSp); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSp=aIt.Value(); + if (aMFence.Add(aSp)) { + TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_EDGE, aMSx); + TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_FACE, aMSx); + TopExp::MapShapesAndAncestors(aSp, TopAbs_EDGE , TopAbs_FACE, aMSx); + aLSd.Append(aSp); + } + } } else { - if (aMFence.Add(aS)) { - TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_EDGE, aMSx); - TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_FACE, aMSx); - TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE , TopAbs_FACE, aMSx); - aLSd.Append(aS); - aMSOr.Add(aS); - } + if (aMFence.Add(aS)) { + TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_EDGE, aMSx); + TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_FACE, aMSx); + TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE , TopAbs_FACE, aMSx); + aLSd.Append(aS); + aMSOr.Add(aS); + } } }//if (aType==TopAbs_SOLID) } // aNbSd=aLSd.Extent(); // - // 3. Some shapes of aMSI can be already tied with faces of + // 3. Some shapes of aMSI can be already tied with faces of // split solids - aItM.Initialize(aMSI); + aItM.Initialize(aMSI); for (; aItM.More(); aItM.Next()) { const TopoDS_Shape& aSI=aItM.Key(); if (aMSx.Contains(aSI)) { const TopTools_ListOfShape &aLSx=aMSx.FindFromKey(aSI); aNbSx=aLSx.Extent(); if (aNbSx) { - aMSI.Remove(aSI); + aMSI.Remove(aSI); } } } @@ -740,46 +712,46 @@ static for (; aIt.More(); aIt.Next()) { TopoDS_Solid aSd=TopoDS::Solid(aIt.Value()); // - aItM.Initialize(aMSI); + aItM.Initialize(aMSI); for (; aItM.More(); aItM.Next()) { TopoDS_Shape aSI=aItM.Key(); aSI.Orientation(TopAbs_INTERNAL); // aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx); if (aState==TopAbs_IN) { - // - if(aMSOr.Contains(aSd)) { - // - TopoDS_Solid aSdx; - // - aBB.MakeSolid(aSdx); - aItS.Initialize(aSd); - for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aSh=aItS.Value(); - aBB.Add(aSdx, aSh); - } - // - aBB.Add(aSdx, aSI); - // - myImages.Bind(aSd, aSdx); - aMSOr.Remove(aSd); - aSd=aSdx; - } - else { - aBB.Add(aSd, aSI); - } - // - aMSI.Remove(aSI); + // + if(aMSOr.Contains(aSd)) { + // + TopoDS_Solid aSdx; + // + aBB.MakeSolid(aSdx); + aItS.Initialize(aSd); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aSh=aItS.Value(); + aBB.Add(aSdx, aSh); + } + // + aBB.Add(aSdx, aSI); + // + myImages.Bind(aSd, aSdx); + aMSOr.Remove(aSd); + aSd=aSdx; + } + else { + aBB.Add(aSd, aSI); + } + // + aMSI.Remove(aSI); } //if (aState==TopAbs_IN) { }// for (; aItM.More(); aItM.Next()) { }//for (; aIt1.More(); aIt1.Next()) { } //======================================================================= //function : OwnInternalShapes -//purpose : +//purpose : //======================================================================= void OwnInternalShapes(const TopoDS_Shape& theS, - TopTools_IndexedMapOfShape& theMx) + TopTools_IndexedMapOfShape& theMx) { TopoDS_Iterator aIt; // @@ -794,4 +766,3 @@ static // // ErrorStatus // 30 - SolidBuilder failed - diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx index bc755e492..5672fe1fd 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_4.cxx @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Builder_4.cxx -// Created: -// Author: Peter KURNEV + +// File: GEOMAlgo_Builder_4.cxx +// Created: +// Author: Peter KURNEV // #include @@ -42,17 +43,16 @@ static void MapShapes(const TopoDS_Shape& aS, - TopTools_MapOfShape& aM); + TopTools_MapOfShape& aM); //======================================================================= //function : Generated -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Generated(const TopoDS_Shape& theS) { - const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; - IntTools_Context& aCtx=pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx=pPF->Context(); // Standard_Boolean bHasImage, bToReverse; TopAbs_ShapeEnum aType; @@ -71,28 +71,28 @@ static // aType=theS.ShapeType(); // - if (aType==TopAbs_EDGE || aType==TopAbs_FACE || - aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + if (aType==TopAbs_EDGE || aType==TopAbs_FACE || + aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { const TopTools_ListOfShape& aLSp=myImages.Image(theS); aIt.Initialize(aLSp); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aSp=aIt.Value(); if (mySameDomainShapes.Contains(aSp)) { - if (myMapShape.Contains(aSp)) { - TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp); - // - if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { - aSpR.Orientation(theS.Orientation()); - } - else { - bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSpR, theS, aCtx); - if (bToReverse) { - aSpR.Reverse(); - } - } - // - myHistShapes.Append(aSpR); - } + if (myMapShape.Contains(aSp)) { + TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp); + // + if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + aSpR.Orientation(theS.Orientation()); + } + else { + bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSpR, theS, aCtx); + if (bToReverse) { + aSpR.Reverse(); + } + } + // + myHistShapes.Append(aSpR); + } } } } @@ -101,13 +101,12 @@ static } //======================================================================= //function : Modified -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Builder::Modified(const TopoDS_Shape& theS) { - const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; - IntTools_Context& aCtx=pPF->ChangeContext(); + const Handle(IntTools_Context)& aCtx=pPF->Context(); // Standard_Boolean bHasImage, bToReverse; TopAbs_ShapeEnum aType; @@ -126,27 +125,27 @@ static // aType=theS.ShapeType(); // - if (aType==TopAbs_EDGE || aType==TopAbs_FACE || - aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + if (aType==TopAbs_EDGE || aType==TopAbs_FACE || + aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { const TopTools_ListOfShape& aLSp=myImages.Image(theS); aIt.Initialize(aLSp); for (; aIt.More(); aIt.Next()) { TopoDS_Shape aSp=aIt.Value(); if (!mySameDomainShapes.Contains(aSp)) { - if (myMapShape.Contains(aSp)) { - // - if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { - aSp.Orientation(theS.Orientation()); - } - else { - bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSp, theS, aCtx); - if (bToReverse) { - aSp.Reverse(); - } - } - // - myHistShapes.Append(aSp); - } + if (myMapShape.Contains(aSp)) { + // + if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + aSp.Orientation(theS.Orientation()); + } + else { + bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSp, theS, aCtx); + if (bToReverse) { + aSp.Reverse(); + } + } + // + myHistShapes.Append(aSp); + } } } } @@ -155,7 +154,7 @@ static } //======================================================================= //function : IsDeleted -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Builder::IsDeleted(const TopoDS_Shape& theS) { @@ -180,23 +179,23 @@ static } // aType=theS.ShapeType(); - if (aType==TopAbs_EDGE || aType==TopAbs_FACE || - aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + if (aType==TopAbs_EDGE || aType==TopAbs_FACE || + aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { const TopTools_ListOfShape& aLSp=myImages.Image(theS); aIt.Initialize(aLSp); for (; aIt.More(); aIt.Next()) { TopoDS_Shape aSp=aIt.Value(); // if (!mySameDomainShapes.Contains(aSp)) { - if (myMapShape.Contains(aSp)) { - return bRet; //false - } + if (myMapShape.Contains(aSp)) { + return bRet; //false + } } else { - TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp); - if (myMapShape.Contains(aSpR)) { - return bRet; //false - } + TopoDS_Shape aSpR=mySameDomainShapes.FindFromKey(aSp); + if (myMapShape.Contains(aSpR)) { + return bRet; //false + } } } } @@ -204,7 +203,7 @@ static } //======================================================================= //function : PrepareHistory -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Builder::PrepareHistory() { @@ -218,10 +217,10 @@ static TopTools_ListIteratorOfListOfShape aIt; TopTools_MapIteratorOfMapOfShape aItM; // - // 1. Clearing + // 1. Clearing GEOMAlgo_BuilderShape::PrepareHistory(); // - // 2. myMapShape - all shapes of result with theirs sub-shapes + // 2. myMapShape - all shapes of result with theirs sub-shapes MapShapes(myShape, myMapShape); // // 3. MS - all argument shapes with theirs sub-shapes @@ -244,68 +243,68 @@ static bHasImage=myImages.HasImage(aSx); if (!bHasImage) { if (myMapShape.Contains(aSx)) { - aLSx.Append(aSx); - myImagesResult.Add(aSx, aLSx); + aLSx.Append(aSx); + myImagesResult.Add(aSx, aLSx); } } else { const TopTools_ListOfShape& aLSp=myImages.Image(aSx); aIt.Initialize(aLSp); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSp=aIt.Value(); - if (myMapShape.Contains(aSp)) { - aLSx.Append(aSp); - } + const TopoDS_Shape& aSp=aIt.Value(); + if (myMapShape.Contains(aSp)) { + aLSx.Append(aSp); + } } myImagesResult.Add(aSx, aLSx); } // //modified by NIZNHY-PKV Thu Dec 7 11:34:10 2006t // - // 4.2 As it was + // 4.2 As it was if (!myHasDeleted) { myHasDeleted=IsDeleted(aSx);//xx } // if (!myHasGenerated || !myHasModified) { - if (aType==TopAbs_EDGE || aType==TopAbs_FACE || - aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { - //modified by NIZNHY-PKV Thu Dec 7 11:53:01 2006f - //bHasImage=myImages.HasImage(aSx); - //modified by NIZNHY-PKV Thu Dec 7 11:53:04 2006t - if (bHasImage) { - const TopTools_ListOfShape& aLSp=myImages.Image(aSx); - aIt.Initialize(aLSp); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSp=aIt.Value(); - // - if (myMapShape.Contains(aSp)) { - bContainsSD=mySameDomainShapes.Contains(aSp); - // - if (!myHasGenerated) { - if (bContainsSD) { - myHasGenerated=Standard_True; - } - } - if (!myHasModified) { - if (!bContainsSD) { - myHasModified=Standard_True; - } - } - } // if (myMapShape.Contains(aSp)) - } - } - } + if (aType==TopAbs_EDGE || aType==TopAbs_FACE || + aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + //modified by NIZNHY-PKV Thu Dec 7 11:53:01 2006f + //bHasImage=myImages.HasImage(aSx); + //modified by NIZNHY-PKV Thu Dec 7 11:53:04 2006t + if (bHasImage) { + const TopTools_ListOfShape& aLSp=myImages.Image(aSx); + aIt.Initialize(aLSp); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSp=aIt.Value(); + // + if (myMapShape.Contains(aSp)) { + bContainsSD=mySameDomainShapes.Contains(aSp); + // + if (!myHasGenerated) { + if (bContainsSD) { + myHasGenerated=Standard_True; + } + } + if (!myHasModified) { + if (!bContainsSD) { + myHasModified=Standard_True; + } + } + } // if (myMapShape.Contains(aSp)) + } + } + } } } - + } //======================================================================= //function : MapShapes -//purpose : +//purpose : //======================================================================= void MapShapes(const TopoDS_Shape& theS, - TopTools_MapOfShape& theM) + TopTools_MapOfShape& theM) { theM.Add(theS); TopoDS_Iterator anIt; diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.cdl b/src/GEOMAlgo/GEOMAlgo_Clsf.cdl deleted file mode 100644 index 75149cf28..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Clsf.cdl +++ /dev/null @@ -1,76 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Clsf.cdl --- Created: Wed Nov 22 10:19:29 2006 --- Author: Peter KURNEV --- --- -deferred class Clsf from GEOMAlgo - inherits HAlgo from GEOMAlgo - - ---Purpose: - -uses - State from TopAbs, - Pnt from gp, - Curve from Geom, - Surface from Geom - ---raises - -is - Initialize - returns mutable Clsf from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Clsf();" - - SetPnt(me:mutable; - aP:Pnt from gp); - - Pnt(me) - returns Pnt from gp; - ---C++:return const& - - SetTolerance(me:mutable; - aT:Real from Standard); - - Tolerance(me) - returns Real from Standard; - - State(me) - returns State from TopAbs; - - CanBeON(me; - aCT:Curve from Geom) - returns Boolean from Standard - is virtual; - - CanBeON(me; - aST:Surface from Geom) - returns Boolean from Standard - is virtual; - -fields - myState :State from TopAbs is protected; - myPnt :Pnt from gp is protected; - myTolerance:Real from Standard is protected; - -end Clsf; diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.cxx b/src/GEOMAlgo/GEOMAlgo_Clsf.cxx index 01d273327..9f3fe0acb 100644 --- a/src/GEOMAlgo/GEOMAlgo_Clsf.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Clsf.cxx @@ -1,34 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Classifier.cxx -// Created: Wed Nov 22 10:23:04 2006 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_Clsf.cxx +// Created: Wed Nov 22 10:23:04 2006 +// Author: Peter KURNEV +// // -#include +#include + +IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_Clsf, GEOMAlgo_HAlgo); +IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_Clsf, GEOMAlgo_HAlgo); //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_Clsf::GEOMAlgo_Clsf() : @@ -40,14 +44,14 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_Clsf::~GEOMAlgo_Clsf() { } //======================================================================= //function : SetTolerance -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Clsf::SetTolerance(const Standard_Real aT) { @@ -55,7 +59,7 @@ } //======================================================================= //function : Tolerance -//purpose : +//purpose : //======================================================================= Standard_Real GEOMAlgo_Clsf::Tolerance()const { @@ -63,7 +67,7 @@ } //======================================================================= //function : SetPnt -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Clsf::SetPnt(const gp_Pnt& aP) { @@ -71,7 +75,7 @@ } //======================================================================= //function : Pnt -//purpose : +//purpose : //======================================================================= const gp_Pnt& GEOMAlgo_Clsf::Pnt()const { @@ -79,7 +83,7 @@ } //======================================================================= //function : State -//purpose : +//purpose : //======================================================================= TopAbs_State GEOMAlgo_Clsf::State() const { @@ -87,7 +91,7 @@ } //======================================================================= //function : CanBeON -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Clsf::CanBeON(const Handle(Geom_Curve)& ) const { @@ -95,7 +99,7 @@ } //======================================================================= //function : CanBeON -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Clsf::CanBeON(const Handle(Geom_Surface)& ) const { diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.hxx b/src/GEOMAlgo/GEOMAlgo_Clsf.hxx index 70fbc60c9..017578386 100644 --- a/src/GEOMAlgo/GEOMAlgo_Clsf.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Clsf.hxx @@ -1,132 +1,87 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_Clsf.hxx +// Created: Wed Nov 22 10:23:04 2006 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_Clsf_HeaderFile #define _GEOMAlgo_Clsf_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile -#include -#endif - -#ifndef _TopAbs_State_HeaderFile +#include +//#include #include -#endif -#ifndef _gp_Pnt_HeaderFile #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -#ifndef _GEOMAlgo_HAlgo_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _Handle_Geom_Curve_HeaderFile #include -#endif -#ifndef _Handle_Geom_Surface_HeaderFile #include -#endif -class gp_Pnt; -class Geom_Curve; -class Geom_Surface; - - - -class GEOMAlgo_Clsf : public GEOMAlgo_HAlgo { - -public: - // Methods PUBLIC - // - - -Standard_EXPORT void SetPnt(const gp_Pnt& aP) ; - - -Standard_EXPORT const gp_Pnt& Pnt() const; - - -Standard_EXPORT void SetTolerance(const Standard_Real aT) ; +#include +#include +DEFINE_STANDARD_HANDLE(GEOMAlgo_Clsf, GEOMAlgo_HAlgo); -Standard_EXPORT Standard_Real Tolerance() const; +//======================================================================= +//class : GEOMAlgo_Clsf +//purpose : +//======================================================================= +class GEOMAlgo_Clsf : public GEOMAlgo_HAlgo +{ + public: + Standard_EXPORT + void SetPnt(const gp_Pnt& aP) ; + Standard_EXPORT + const gp_Pnt& Pnt() const; -Standard_EXPORT TopAbs_State State() const; + Standard_EXPORT + void SetTolerance(const Standard_Real aT) ; + Standard_EXPORT + Standard_Real Tolerance() const; -Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aCT) const; + Standard_EXPORT + TopAbs_State State() const; + Standard_EXPORT + virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aCT) const; -Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; -//Standard_EXPORT ~GEOMAlgo_Clsf(); + Standard_EXPORT + virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; + DEFINE_STANDARD_RTTI(GEOMAlgo_Clsf); + protected: + Standard_EXPORT + GEOMAlgo_Clsf(); + Standard_EXPORT + virtual ~GEOMAlgo_Clsf(); - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT GEOMAlgo_Clsf(); -Standard_EXPORT virtual ~GEOMAlgo_Clsf(); - - - // Fields PROTECTED - // -TopAbs_State myState; -gp_Pnt myPnt; -Standard_Real myTolerance; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + TopAbs_State myState; + gp_Pnt myPnt; + Standard_Real myTolerance; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.ixx b/src/GEOMAlgo/GEOMAlgo_Clsf.ixx deleted file mode 100644 index ed35cae59..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Clsf.ixx +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -//GEOMAlgo_Clsf::~GEOMAlgo_Clsf() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_Clsf_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_HAlgo); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_Clsf", - sizeof(GEOMAlgo_Clsf), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_Clsf) Handle(GEOMAlgo_Clsf)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_Clsf) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_Clsf))) { - _anOtherObject = Handle(GEOMAlgo_Clsf)((Handle(GEOMAlgo_Clsf)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_Clsf::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_Clsf) ; -} -//Standard_Boolean GEOMAlgo_Clsf::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_Clsf) == AType || GEOMAlgo_HAlgo::IsKind(AType)); -//} -//Handle_GEOMAlgo_Clsf::~Handle_GEOMAlgo_Clsf() {} - diff --git a/src/GEOMAlgo/GEOMAlgo_Clsf.jxx b/src/GEOMAlgo/GEOMAlgo_Clsf.jxx deleted file mode 100644 index df2281b67..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Clsf.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _gp_Pnt_HeaderFile -#include -#endif -#ifndef _Geom_Curve_HeaderFile -#include -#endif -#ifndef _Geom_Surface_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Clsf_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.cdl b/src/GEOMAlgo/GEOMAlgo_ClsfBox.cdl deleted file mode 100644 index deb9a6c86..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfBox.cdl +++ /dev/null @@ -1,71 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ClsfBox.cdl --- Created: Wed Nov 22 10:19:29 2006 --- Author: Peter KURNEV --- --- -class ClsfBox from GEOMAlgo - inherits Clsf from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS, - Curve from Geom, - Surface from Geom, - Surface from GeomAdaptor - ---raises - -is - Create - returns mutable ClsfBox from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ClsfBox();" - - SetBox(me:mutable; - aS:Shape from TopoDS); - - Box(me) - returns Shape from TopoDS; - ---C++: return const & - - Perform(me:mutable) - is redefined; - - CheckData(me:mutable) - is redefined; - - CanBeON(me; - aC:Curve from Geom) - returns Boolean from Standard - is redefined; - - CanBeON(me; - aST:Surface from Geom) - returns Boolean from Standard - is redefined; - -fields - myBox : Shape from TopoDS is protected; - myGAS : Surface from GeomAdaptor [6] is protected; -end ClsfBox; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx b/src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx index b74c54e3e..dbc3eec1c 100644 --- a/src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx @@ -1,30 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_ClsfSurf.cxx -// Created: Wed Nov 22 10:41:47 2006 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_ClsfBox.cxx +// Created: Wed Nov 22 10:41:47 2006 +// Author: Peter KURNEV +// // -#include +#include + #include #include #include @@ -41,9 +43,12 @@ #include #include +IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfBox, GEOMAlgo_Clsf) +IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfBox, GEOMAlgo_Clsf) + //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_ClsfBox::GEOMAlgo_ClsfBox() : @@ -52,14 +57,14 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ClsfBox::~GEOMAlgo_ClsfBox() { } //======================================================================= //function : SetBox -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfBox::SetBox(const TopoDS_Shape& aBox) { @@ -67,7 +72,7 @@ } //======================================================================= //function : Box -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_ClsfBox::Box() const { @@ -75,10 +80,10 @@ } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfBox::CheckData() -{ +{ Standard_Integer i, aNbF; TopAbs_ShapeEnum aTypeShape; TopAbs_Orientation aOr; @@ -117,7 +122,7 @@ aS=BRep_Tool::Surface(aF); myGAS[i-1].Load(aS); aType=myGAS[i-1].GetType(); - if (!aType==GeomAbs_Plane) { + if (!aType==GeomAbs_Plane) { myErrorStatus=13; // unallowed surface type return; } @@ -141,7 +146,7 @@ } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfBox::Perform() { @@ -157,7 +162,7 @@ } */ iNext=1; - aNbON=0; + aNbON=0; aNbIN=0; for(i=0; i // #ifndef _GEOMAlgo_ClsfBox_HeaderFile #define _GEOMAlgo_ClsfBox_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Handle_GEOMAlgo_ClsfBox_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile +#include +//#include #include -#endif -#ifndef _GeomAdaptor_Surface_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Clsf_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _Handle_Geom_Curve_HeaderFile #include -#endif -#ifndef _Handle_Geom_Surface_HeaderFile #include -#endif -class TopoDS_Shape; -class Geom_Curve; -class Geom_Surface; - - - -class GEOMAlgo_ClsfBox : public GEOMAlgo_Clsf { +#include +#include -public: - // Methods PUBLIC - // +DEFINE_STANDARD_HANDLE(GEOMAlgo_ClsfBox, GEOMAlgo_Clsf) +//======================================================================= +//function : GEOMAlgo_ClsfBox +//purpose : +//======================================================================= +class GEOMAlgo_ClsfBox : public GEOMAlgo_Clsf +{ + public: + Standard_EXPORT + GEOMAlgo_ClsfBox(); -Standard_EXPORT GEOMAlgo_ClsfBox(); -Standard_EXPORT virtual ~GEOMAlgo_ClsfBox(); + Standard_EXPORT + virtual ~GEOMAlgo_ClsfBox(); + Standard_EXPORT + void SetBox(const TopoDS_Shape& aS) ; -Standard_EXPORT void SetBox(const TopoDS_Shape& aS) ; + Standard_EXPORT + const TopoDS_Shape& Box() const; + Standard_EXPORT + virtual void Perform() ; -Standard_EXPORT const TopoDS_Shape& Box() const; + Standard_EXPORT + virtual void CheckData() ; + Standard_EXPORT + virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aC) const; -Standard_EXPORT virtual void Perform() ; + Standard_EXPORT + virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; + DEFINE_STANDARD_RTTI(GEOMAlgo_ClsfBox) -Standard_EXPORT virtual void CheckData() ; + protected: + TopoDS_Shape myBox; + GeomAdaptor_Surface myGAS[6]; -Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aC) const; +private: -Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; -//Standard_EXPORT ~GEOMAlgo_ClsfBox(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopoDS_Shape myBox; -GeomAdaptor_Surface myGAS[6]; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // }; @@ -119,7 +92,6 @@ private: // other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.ixx b/src/GEOMAlgo/GEOMAlgo_ClsfBox.ixx deleted file mode 100644 index 5cc2da30c..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfBox.ixx +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -//GEOMAlgo_ClsfBox::~GEOMAlgo_ClsfBox() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ClsfBox_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_Clsf); - static Handle_Standard_Type aType2 = STANDARD_TYPE(GEOMAlgo_HAlgo); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ClsfBox", - sizeof(GEOMAlgo_ClsfBox), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_ClsfBox) Handle(GEOMAlgo_ClsfBox)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_ClsfBox) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ClsfBox))) { - _anOtherObject = Handle(GEOMAlgo_ClsfBox)((Handle(GEOMAlgo_ClsfBox)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_ClsfBox::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_ClsfBox) ; -} -//Standard_Boolean GEOMAlgo_ClsfBox::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_ClsfBox) == AType || GEOMAlgo_Clsf::IsKind(AType)); -//} -//Handle_GEOMAlgo_ClsfBox::~Handle_GEOMAlgo_ClsfBox() {} - diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfBox.jxx b/src/GEOMAlgo/GEOMAlgo_ClsfBox.jxx deleted file mode 100644 index 90fc5e97a..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfBox.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Geom_Curve_HeaderFile -#include -#endif -#ifndef _Geom_Surface_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ClsfBox_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl deleted file mode 100755 index 0f4df1564..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl +++ /dev/null @@ -1,60 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ClsfSolid.cdl --- Created: Mon Jan 29 10:28:07 2007 --- Author: Peter KURNEV --- --- -class ClsfSolid from GEOMAlgo - inherits Clsf from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS - ---raises - -is - Create - returns mutable ClsfSolid from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ClsfSolid();" - - SetShape(me:mutable; - aS:Shape from TopoDS); - - Shape(me) - returns Shape from TopoDS; - ---C++: return const & - - Perform(me:mutable) - is redefined; - - CheckData(me:mutable) - is redefined; - - -fields - myShape: Shape from TopoDS is protected; - myPClsf: Address from Standard is protected; - -end ClsfSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx index f05fbaf92..35bb725ef 100755 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx @@ -1,30 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: GEOMAlgo_ClsfSolid.cxx -// Created: Mon Jan 29 10:35:46 2007 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_ClsfSolid.cxx +// Created: Mon Jan 29 10:35:46 2007 +// Author: Peter KURNEV +// // -#include +#include #include #include @@ -32,9 +30,12 @@ #include #include +IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfSolid, GEOMAlgo_Clsf) +IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfSolid, GEOMAlgo_Clsf) + //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_ClsfSolid::GEOMAlgo_ClsfSolid() : @@ -44,7 +45,7 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid() { @@ -57,7 +58,7 @@ } //======================================================================= //function : SetShape -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfSolid::SetShape(const TopoDS_Shape& aS) { @@ -65,7 +66,7 @@ } //======================================================================= //function : Shape -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_ClsfSolid::Shape()const { @@ -73,7 +74,7 @@ } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfSolid::CheckData() { @@ -91,7 +92,7 @@ // aType=myShape.ShapeType(); if (!(aType==TopAbs_SOLID || aType==TopAbs_SHELL)) { - myErrorStatus=12; + myErrorStatus=12; return; } // @@ -114,7 +115,7 @@ } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfSolid::Perform() { diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx index 5012fed2f..1715d88db 100644 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx @@ -1,108 +1,69 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: GEOMAlgo_ClsfSolid.hxx +// Created: Mon Jan 29 10:35:46 2007 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_ClsfSolid_HeaderFile #define _GEOMAlgo_ClsfSolid_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Handle_GEOMAlgo_ClsfSolid_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile +#include +//#include #include -#endif -#ifndef _Standard_Address_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Clsf_HeaderFile #include -#endif -class TopoDS_Shape; - - - -class GEOMAlgo_ClsfSolid : public GEOMAlgo_Clsf { - -public: - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ClsfSolid(); -Standard_EXPORT virtual ~GEOMAlgo_ClsfSolid(); - - -Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; - - -Standard_EXPORT const TopoDS_Shape& Shape() const; +DEFINE_STANDARD_HANDLE(GEOMAlgo_ClsfSolid, GEOMAlgo_Clsf) -Standard_EXPORT virtual void Perform() ; +//======================================================================= +//class : GEOMAlgo_ClsfSolid +//purpose : +//======================================================================= +class GEOMAlgo_ClsfSolid : public GEOMAlgo_Clsf +{ + public: + Standard_EXPORT + GEOMAlgo_ClsfSolid(); + Standard_EXPORT + virtual ~GEOMAlgo_ClsfSolid(); -Standard_EXPORT virtual void CheckData() ; -//Standard_EXPORT ~GEOMAlgo_ClsfSolid(); + Standard_EXPORT + void SetShape(const TopoDS_Shape& aS) ; + Standard_EXPORT + const TopoDS_Shape& Shape() const; + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + virtual void CheckData() ; - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopoDS_Shape myShape; -Standard_Address myPClsf; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + DEFINE_STANDARD_RTTI(GEOMAlgo_ClsfSolid) + protected: + TopoDS_Shape myShape; + Standard_Address myPClsf; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx deleted file mode 100644 index b777f32a4..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -//GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ClsfSolid_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_Clsf); - static Handle_Standard_Type aType2 = STANDARD_TYPE(GEOMAlgo_HAlgo); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ClsfSolid", - sizeof(GEOMAlgo_ClsfSolid), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_ClsfSolid) Handle(GEOMAlgo_ClsfSolid)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_ClsfSolid) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ClsfSolid))) { - _anOtherObject = Handle(GEOMAlgo_ClsfSolid)((Handle(GEOMAlgo_ClsfSolid)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_ClsfSolid::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_ClsfSolid) ; -} -//Standard_Boolean GEOMAlgo_ClsfSolid::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_ClsfSolid) == AType || GEOMAlgo_Clsf::IsKind(AType)); -//} -//Handle_GEOMAlgo_ClsfSolid::~Handle_GEOMAlgo_ClsfSolid() {} - diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx deleted file mode 100644 index 0c1f5add0..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ClsfSolid_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cdl b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cdl deleted file mode 100644 index d2b191cd3..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cdl +++ /dev/null @@ -1,71 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ClsfSurf.cdl --- Created: Wed Nov 22 10:19:29 2006 --- Author: Peter KURNEV --- --- -class ClsfSurf from GEOMAlgo - inherits Clsf from GEOMAlgo - - ---Purpose: - -uses - Curve from Geom, - Surface from Geom, - Surface from GeomAdaptor - ---raises - -is - Create - returns mutable ClsfSurf from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ClsfSurf();" - - SetSurface(me:mutable; - aS:Surface from Geom); - - Surface(me) - returns Surface from Geom; - ---C++: return const & - - Perform(me:mutable) - is redefined; - - CheckData(me:mutable) - is redefined; - - CanBeON(me; - aC:Curve from Geom) - returns Boolean from Standard - is redefined; - - CanBeON(me; - aST:Surface from Geom) - returns Boolean from Standard - is redefined; - -fields - myS : Surface from Geom is protected; - myGAS : Surface from GeomAdaptor is protected; - -end ClsfSurf; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cxx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cxx index 2d32d4448..cdc66dd14 100644 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.cxx @@ -1,37 +1,41 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_ClsfSurf.cxx -// Created: Wed Nov 22 10:41:47 2006 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_ClsfSurf.cxx +// Created: Wed Nov 22 10:41:47 2006 +// Author: Peter KURNEV +// // -#include +#include #include #include #include +IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfSurf, GEOMAlgo_Clsf); +IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfSurf, GEOMAlgo_Clsf); + //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_ClsfSurf::GEOMAlgo_ClsfSurf() : @@ -40,14 +44,14 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ClsfSurf::~GEOMAlgo_ClsfSurf() { } //======================================================================= //function : SetSurface -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfSurf::SetSurface(const Handle(Geom_Surface)& aS) { @@ -55,7 +59,7 @@ } //======================================================================= //function : Surface -//purpose : +//purpose : //======================================================================= const Handle(Geom_Surface)& GEOMAlgo_ClsfSurf::Surface() const { @@ -63,7 +67,7 @@ } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfSurf::CheckData() { @@ -78,15 +82,15 @@ // myGAS.Load(myS); aType=myGAS.GetType(); - if (!(aType==GeomAbs_Plane || - aType==GeomAbs_Cylinder || - aType==GeomAbs_Sphere)) { + if (!(aType==GeomAbs_Plane || + aType==GeomAbs_Cylinder || + aType==GeomAbs_Sphere)) { myErrorStatus=11; // unallowed surface type } } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ClsfSurf::Perform() { @@ -101,7 +105,7 @@ } //======================================================================= //function : CanBeON -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_ClsfSurf::CanBeON(const Handle(Geom_Curve)& aC) const { @@ -120,7 +124,7 @@ } //======================================================================= //function : CanBeON -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_ClsfSurf::CanBeON(const Handle(Geom_Surface)& aS1) const { diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.hxx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.hxx index 54925be60..e0dd97395 100644 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.hxx @@ -1,121 +1,81 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_ClsfSurf.hxx +// Created: Wed Nov 22 10:41:47 2006 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_ClsfSurf_HeaderFile #define _GEOMAlgo_ClsfSurf_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Handle_GEOMAlgo_ClsfSurf_HeaderFile -#include -#endif - -#ifndef _Handle_Geom_Surface_HeaderFile +#include +//#include #include -#endif -#ifndef _GeomAdaptor_Surface_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Clsf_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _Handle_Geom_Curve_HeaderFile #include -#endif -class Geom_Surface; -class Geom_Curve; - - - -class GEOMAlgo_ClsfSurf : public GEOMAlgo_Clsf { - -public: - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ClsfSurf(); -Standard_EXPORT virtual ~GEOMAlgo_ClsfSurf(); - - -Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ; - - -Standard_EXPORT const Handle_Geom_Surface& Surface() const; +#include +#include +DEFINE_STANDARD_HANDLE(GEOMAlgo_ClsfSurf, GEOMAlgo_Clsf) -Standard_EXPORT virtual void Perform() ; +//======================================================================= +// class : GEOMAlgo_ClsfSurf +//purpose : +//======================================================================= +class GEOMAlgo_ClsfSurf : public GEOMAlgo_Clsf +{ + public: + Standard_EXPORT + GEOMAlgo_ClsfSurf(); + Standard_EXPORT + virtual ~GEOMAlgo_ClsfSurf(); -Standard_EXPORT virtual void CheckData() ; + Standard_EXPORT + void SetSurface(const Handle(Geom_Surface)& aS) ; + Standard_EXPORT + const Handle_Geom_Surface& Surface() const; -Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aC) const; + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + virtual void CheckData() ; -Standard_EXPORT virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; -//Standard_EXPORT ~GEOMAlgo_ClsfSurf(); + Standard_EXPORT + virtual Standard_Boolean CanBeON(const Handle(Geom_Curve)& aC) const; + Standard_EXPORT + virtual Standard_Boolean CanBeON(const Handle(Geom_Surface)& aST) const; + DEFINE_STANDARD_RTTI(GEOMAlgo_ClsfSurf); - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Handle_Geom_Surface myS; -GeomAdaptor_Surface myGAS; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + protected: + Handle_Geom_Surface myS; + GeomAdaptor_Surface myGAS; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.ixx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.ixx deleted file mode 100644 index 2ffee719f..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.ixx +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -//GEOMAlgo_ClsfSurf::~GEOMAlgo_ClsfSurf() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ClsfSurf_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_Clsf); - static Handle_Standard_Type aType2 = STANDARD_TYPE(GEOMAlgo_HAlgo); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ClsfSurf", - sizeof(GEOMAlgo_ClsfSurf), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_ClsfSurf) Handle(GEOMAlgo_ClsfSurf)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_ClsfSurf) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ClsfSurf))) { - _anOtherObject = Handle(GEOMAlgo_ClsfSurf)((Handle(GEOMAlgo_ClsfSurf)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_ClsfSurf::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_ClsfSurf) ; -} -//Standard_Boolean GEOMAlgo_ClsfSurf::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_ClsfSurf) == AType || GEOMAlgo_Clsf::IsKind(AType)); -//} -//Handle_GEOMAlgo_ClsfSurf::~Handle_GEOMAlgo_ClsfSurf() {} - diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.jxx b/src/GEOMAlgo/GEOMAlgo_ClsfSurf.jxx deleted file mode 100644 index c0a70f3dc..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ClsfSurf.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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_Surface_HeaderFile -#include -#endif -#ifndef _Geom_Curve_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ClsfSurf_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cdl b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cdl deleted file mode 100644 index 54ff2d959..000000000 --- a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cdl +++ /dev/null @@ -1,66 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_CoupleOfShapes.cdl --- Created: Wed Dec 15 13:00:10 2004 --- Author: Peter KURNEV --- -class CoupleOfShapes from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS - ---raises - -is - Create - returns CoupleOfShapes from GEOMAlgo; - - SetShapes(me:out; - aS1: Shape from TopoDS; - aS2: Shape from TopoDS); - - SetShape1(me:out; - aS1: Shape from TopoDS); - - SetShape2(me:out; - aS2: Shape from TopoDS); - - Shapes(me; - aS1:out Shape from TopoDS; - aS2:out Shape from TopoDS); - - Shape1(me) - returns Shape from TopoDS; - ---C++:return const & - - Shape2(me) - returns Shape from TopoDS; - ---C++:return const & - -fields - - myShape1: Shape from TopoDS is protected; - myShape2: Shape from TopoDS is protected; - -end CoupleOfShapes; diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx index 1047c2ba5..0055a8228 100644 --- a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx +++ b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx @@ -1,59 +1,59 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_CoupleOfShapes.cxx -// Created: Wed Dec 15 13:03:52 2004 -// Author: Peter KURNEV -// +// File: GEOMAlgo_CoupleOfShapes.cxx +// Created: Wed Dec 15 13:03:52 2004 +// Author: Peter KURNEV +// // -#include +#include //======================================================================= //function : GEOMAlgo_CoupleOfShapes -//purpose : +//purpose : //======================================================================= GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() {} //======================================================================= //function : SetShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_CoupleOfShapes::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2) + const TopoDS_Shape& aS2) { myShape1=aS1; myShape2=aS2; } //======================================================================= //function : Shapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_CoupleOfShapes::Shapes(TopoDS_Shape& aS1, - TopoDS_Shape& aS2)const + TopoDS_Shape& aS2)const { aS1=myShape1; aS2=myShape2; } //======================================================================= //function : SetShape1 -//purpose : +//purpose : //======================================================================= void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape& aS1) { @@ -61,7 +61,7 @@ void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape& aS1) } //======================================================================= //function : SetShape2 -//purpose : +//purpose : //======================================================================= void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape& aS2) { @@ -69,7 +69,7 @@ void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape& aS2) } //======================================================================= //function : Shape1 -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape1()const { @@ -77,7 +77,7 @@ const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape1()const } //======================================================================= //function : Shape2 -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape2()const { diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.hxx b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.hxx index 46a62f754..7e346aa8d 100644 --- a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.hxx +++ b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.hxx @@ -1,115 +1,64 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// File: GEOMAlgo_CoupleOfShapes.hxx +// Created: Wed Dec 15 13:03:52 2004 +// Author: Peter KURNEV +// // + #ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile #define _GEOMAlgo_CoupleOfShapes_HeaderFile -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_CoupleOfShapes { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_CoupleOfShapes(); - - -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; - - -Standard_EXPORT void SetShape1(const TopoDS_Shape& aS1) ; - - -Standard_EXPORT void SetShape2(const TopoDS_Shape& aS2) ; - - -Standard_EXPORT void Shapes(TopoDS_Shape& aS1,TopoDS_Shape& aS2) const; - +#include -Standard_EXPORT const TopoDS_Shape& Shape1() const; +//======================================================================= +//class : GEOMAlgo_CoupleOfShapes +//purpose : +//======================================================================= +class GEOMAlgo_CoupleOfShapes +{ + public: + Standard_EXPORT + GEOMAlgo_CoupleOfShapes(); + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; -Standard_EXPORT const TopoDS_Shape& Shape2() const; + Standard_EXPORT + void SetShape1(const TopoDS_Shape& aS1) ; + Standard_EXPORT + void SetShape2(const TopoDS_Shape& aS2) ; + Standard_EXPORT + void Shapes(TopoDS_Shape& aS1,TopoDS_Shape& aS2) const; + Standard_EXPORT + const TopoDS_Shape& Shape1() const; + Standard_EXPORT + const TopoDS_Shape& Shape2() const; protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopoDS_Shape myShape1; -TopoDS_Shape myShape2; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + TopoDS_Shape myShape1; + TopoDS_Shape myShape2; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.ixx b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.ixx deleted file mode 100644 index 4567f905f..000000000 --- a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.jxx b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.jxx deleted file mode 100644 index cd50cfedb..000000000 --- a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx new file mode 100644 index 000000000..ed169e1c5 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx @@ -0,0 +1,32 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx +// Created: Wed Feb 22 11:05:01 2012 +// Author: +// + + +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape_HeaderFile + +#ifndef GEOMAlgo_DataMapOfOrientedShapeShape_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx index 854f60c7e..2ea6a30ad 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx @@ -1,117 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_HeaderFile -#define _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_HeaderFile +// File: GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx +// Created: Wed Feb 22 10:58:14 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class GEOMAlgo_PassKey; -class GEOMAlgo_PassKeyMapHasher; -class GEOMAlgo_DataMapOfPassKeyInteger; -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger; +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile +#include #endif - - -class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger(); - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger(const GEOMAlgo_DataMapOfPassKeyInteger& aMap); - - -Standard_EXPORT void Initialize(const GEOMAlgo_DataMapOfPassKeyInteger& aMap) ; - - -Standard_EXPORT const GEOMAlgo_PassKey& Key() const; - - -Standard_EXPORT const Standard_Integer& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx deleted file mode 100644 index 9cbe4e5a0..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile -#include -#endif - - -#define TheKey GEOMAlgo_PassKey -#define TheKey_hxx -#define TheItem Standard_Integer -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyInteger -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx index 19064241d..bda2348e2 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx @@ -1,115 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile -#define _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +// File: GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx +// Created: Wed Feb 22 11:01:34 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class GEOMAlgo_PassKeyShape; -class TopoDS_Shape; -class GEOMAlgo_PassKeyShapeMapHasher; -class GEOMAlgo_DataMapOfPassKeyShapeShape; -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile -#ifndef _Standard_HeaderFile -#include +#ifndef GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#include #endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape(); - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape(const GEOMAlgo_DataMapOfPassKeyShapeShape& aMap); - - -Standard_EXPORT void Initialize(const GEOMAlgo_DataMapOfPassKeyShapeShape& aMap) ; - - -Standard_EXPORT const GEOMAlgo_PassKeyShape& Key() const; - - -Standard_EXPORT const TopoDS_Shape& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx deleted file mode 100644 index 587e9edaa..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile -#include -#endif - - -#define TheKey GEOMAlgo_PassKeyShape -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx index d2aaa68a5..9bce78862 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx @@ -1,117 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile -#define _GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile +// File: GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx +// Created: Wed Feb 22 10:53:47 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TopTools_ListOfShape; -class TColStd_MapRealHasher; -class GEOMAlgo_DataMapOfRealListOfShape; -class GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape; +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef GEOMAlgo_DataMapOfRealListOfShape_HeaderFile +#include #endif - - -class GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape(); - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape(const GEOMAlgo_DataMapOfRealListOfShape& aMap); - - -Standard_EXPORT void Initialize(const GEOMAlgo_DataMapOfRealListOfShape& aMap) ; - - -Standard_EXPORT const Standard_Real& Key() const; - - -Standard_EXPORT const TopTools_ListOfShape& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_0.cxx deleted file mode 100644 index eae315c2c..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_0.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TColStd_MapRealHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfRealListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile -#include -#endif - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher TColStd_MapRealHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfRealListOfShape -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx new file mode 100644 index 000000000..5b19a5aeb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx @@ -0,0 +1,31 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx +// Created: Wed Feb 22 11:08:26 2012 +// Author: +// + + +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape_HeaderFile + +#ifndef GEOMAlgo_DataMapOfShapeMapOfShape_HeaderFile +#include +#endif +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx new file mode 100644 index 000000000..0eed7b26d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx @@ -0,0 +1,31 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx +// Created: Wed Feb 22 11:11:09 2012 +// Author: +// + + +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt_HeaderFile + +#ifndef GEOMAlgo_DataMapOfShapePnt_HeaderFile +#include +#endif +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx index 15bb79e4d..4fa86a84f 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx @@ -1,117 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile -#define _GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile +// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx +// Created: Wed Feb 22 10:49:11 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TopoDS_Shape; -class TopTools_ShapeMapHasher; -class GEOMAlgo_DataMapOfShapeReal; -class GEOMAlgo_DataMapNodeOfDataMapOfShapeReal; +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef GEOMAlgo_DataMapOfShapeReal_HeaderFile +#include #endif - -class GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal(); - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal(const GEOMAlgo_DataMapOfShapeReal& aMap); - - -Standard_EXPORT void Initialize(const GEOMAlgo_DataMapOfShapeReal& aMap) ; - - -Standard_EXPORT const TopoDS_Shape& Key() const; - - -Standard_EXPORT const Standard_Real& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_0.cxx deleted file mode 100644 index 60b2fd9d2..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_0.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfShapeReal_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Standard_Real -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeReal -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx index 77720cdb5..fad39a60b 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx @@ -1,115 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile -#define _GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile +// File: GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx +// Created: Wed Feb 22 08:39:02 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TopoDS_Shape; -class GEOMAlgo_ShapeSet; -class TopTools_ShapeMapHasher; -class GEOMAlgo_DataMapOfShapeShapeSet; -class GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet; +#ifndef GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile +#define GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile -#ifndef _Standard_HeaderFile -#include +#ifndef GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile +#include #endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet(); - - -Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet(const GEOMAlgo_DataMapOfShapeShapeSet& aMap); - - -Standard_EXPORT void Initialize(const GEOMAlgo_DataMapOfShapeShapeSet& aMap) ; - - -Standard_EXPORT const TopoDS_Shape& Key() const; - - -Standard_EXPORT const GEOMAlgo_ShapeSet& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_0.cxx deleted file mode 100644 index cdd9b3ebc..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_0.cxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeSet_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem GEOMAlgo_ShapeSet -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeShapeSet -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx deleted file mode 100644 index a16e26ba8..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile -#define _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class GEOMAlgo_PassKey; -class GEOMAlgo_PassKeyMapHasher; -class GEOMAlgo_DataMapOfPassKeyInteger; -class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger; - - - -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger(const GEOMAlgo_PassKey& K,const Standard_Integer& I,const TCollection_MapNodePtr& n); - - GEOMAlgo_PassKey& Key() const; - - Standard_Integer& Value() const; -//Standard_EXPORT ~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -GEOMAlgo_PassKey myKey; -Standard_Integer myValue; - - -}; - -#define TheKey GEOMAlgo_PassKey -#define TheKey_hxx -#define TheItem Standard_Integer -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyInteger -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_0.cxx deleted file mode 100644 index c1457e733..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_0.cxx +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_HeaderFile -#include -#endif -//GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger::~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger", - sizeof(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger) Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger))) { - _anOtherObject = Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)((Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger) ; -} -//Standard_Boolean GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger::~Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger() {} -#define TheKey GEOMAlgo_PassKey -#define TheKey_hxx -#define TheItem Standard_Integer -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyInteger -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx deleted file mode 100644 index e88ed19e0..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile -#define _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class GEOMAlgo_PassKeyShape; -class TopoDS_Shape; -class GEOMAlgo_PassKeyShapeMapHasher; -class GEOMAlgo_DataMapOfPassKeyShapeShape; -class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape; - - - -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape(const GEOMAlgo_PassKeyShape& K,const TopoDS_Shape& I,const TCollection_MapNodePtr& n); - - GEOMAlgo_PassKeyShape& Key() const; - - TopoDS_Shape& Value() const; -//Standard_EXPORT ~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -GEOMAlgo_PassKeyShape myKey; -TopoDS_Shape myValue; - - -}; - -#define TheKey GEOMAlgo_PassKeyShape -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx deleted file mode 100644 index f4e15a426..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile -#include -#endif -//GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape", - sizeof(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape))) { - _anOtherObject = Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)((Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) ; -} -//Standard_Boolean GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::~Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape() {} -#define TheKey GEOMAlgo_PassKeyShape -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx deleted file mode 100644 index 1ba3c8bc2..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile -#define _GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile -#include -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TopTools_ListOfShape; -class TColStd_MapRealHasher; -class GEOMAlgo_DataMapOfRealListOfShape; -class GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape; - - - -class GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape(const Standard_Real& K,const TopTools_ListOfShape& I,const TCollection_MapNodePtr& n); - - Standard_Real& Key() const; - - TopTools_ListOfShape& Value() const; -//Standard_EXPORT ~GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myKey; -TopTools_ListOfShape myValue; - - -}; - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher TColStd_MapRealHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfRealListOfShape -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_0.cxx deleted file mode 100644 index 9bcbe1201..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_0.cxx +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TColStd_MapRealHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfRealListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile -#include -#endif -//GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape::~GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape", - sizeof(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape) Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape))) { - _anOtherObject = Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)((Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape) ; -} -//Standard_Boolean GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape::~Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape() {} -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher TColStd_MapRealHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfRealListOfShape -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx deleted file mode 100644 index 5b418a034..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile -#define _GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TopoDS_Shape; -class TopTools_ShapeMapHasher; -class GEOMAlgo_DataMapOfShapeReal; -class GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal; - - - -class GEOMAlgo_DataMapNodeOfDataMapOfShapeReal : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_DataMapNodeOfDataMapOfShapeReal(const TopoDS_Shape& K,const Standard_Real& I,const TCollection_MapNodePtr& n); - - TopoDS_Shape& Key() const; - - Standard_Real& Value() const; -//Standard_EXPORT ~GEOMAlgo_DataMapNodeOfDataMapOfShapeReal(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey; -Standard_Real myValue; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Standard_Real -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeReal -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_0.cxx deleted file mode 100644 index 729f0996b..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_0.cxx +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfShapeReal_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile -#include -#endif -//GEOMAlgo_DataMapNodeOfDataMapOfShapeReal::~GEOMAlgo_DataMapNodeOfDataMapOfShapeReal() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_DataMapNodeOfDataMapOfShapeReal", - sizeof(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal) Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal))) { - _anOtherObject = Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)((Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_DataMapNodeOfDataMapOfShapeReal::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal) ; -} -//Standard_Boolean GEOMAlgo_DataMapNodeOfDataMapOfShapeReal::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal::~Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Standard_Real -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeReal -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx deleted file mode 100644 index b354f9719..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile -#define _GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeSet_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TopoDS_Shape; -class GEOMAlgo_ShapeSet; -class TopTools_ShapeMapHasher; -class GEOMAlgo_DataMapOfShapeShapeSet; -class GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet; - - - -class GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet(const TopoDS_Shape& K,const GEOMAlgo_ShapeSet& I,const TCollection_MapNodePtr& n); - - TopoDS_Shape& Key() const; - - GEOMAlgo_ShapeSet& Value() const; -//Standard_EXPORT ~GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey; -GEOMAlgo_ShapeSet myValue; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem GEOMAlgo_ShapeSet -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeShapeSet -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_0.cxx deleted file mode 100644 index b0e5fee23..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_0.cxx +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeSet_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile -#include -#endif -//GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet::~GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet", - sizeof(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet) Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet))) { - _anOtherObject = Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)((Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet) ; -} -//Standard_Boolean GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet::~Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem GEOMAlgo_ShapeSet -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeShapeSet -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfOrientedShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfOrientedShapeShape.hxx new file mode 100644 index 000000000..3126d0e4a --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfOrientedShapeShape.hxx @@ -0,0 +1,42 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_DataMapOfOrientedShapeShape.hxx +// Created: Wed Feb 22 11:03:36 2012 +// Author: +// + + +#ifndef GEOMAlgo_DataMapOfOrientedShapeShape_HeaderFile +#define GEOMAlgo_DataMapOfOrientedShapeShape_HeaderFile + +#include +#include + +#define _NCollection_MapHasher +#include + + +typedef NCollection_DataMap GEOMAlgo_DataMapOfOrientedShapeShape; +typedef GEOMAlgo_DataMapOfOrientedShapeShape::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape; + +#undef _NCollection_MapHasher + + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger.hxx index 4a48fe108..6ba58447b 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger.hxx @@ -1,156 +1,41 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile -#define _GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class GEOMAlgo_PassKey; -class GEOMAlgo_PassKeyMapHasher; -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger; -class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_DataMapOfPassKeyInteger : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapOfPassKeyInteger(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_DataMapOfPassKeyInteger& Assign(const GEOMAlgo_DataMapOfPassKeyInteger& Other) ; - GEOMAlgo_DataMapOfPassKeyInteger& operator =(const GEOMAlgo_DataMapOfPassKeyInteger& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_DataMapOfPassKeyInteger() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Boolean Bind(const GEOMAlgo_PassKey& K,const Standard_Integer& I) ; - +// File: GEOMAlgo_DataMapOfPassKeyInteger.hxx +// Created: Wed Feb 22 10:55:55 2012 +// Author: +// -Standard_EXPORT Standard_Boolean IsBound(const GEOMAlgo_PassKey& K) const; - - -Standard_EXPORT Standard_Boolean UnBind(const GEOMAlgo_PassKey& K) ; - - -Standard_EXPORT const Standard_Integer& Find(const GEOMAlgo_PassKey& K) const; - const Standard_Integer& operator()(const GEOMAlgo_PassKey& K) const -{ - return Find(K); -} - - - -Standard_EXPORT Standard_Integer& ChangeFind(const GEOMAlgo_PassKey& K) ; - Standard_Integer& operator()(const GEOMAlgo_PassKey& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_DataMapOfPassKeyInteger(const GEOMAlgo_DataMapOfPassKeyInteger& Other); - - - // Fields PRIVATE - // - - -}; +#ifndef GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile +#define GEOMAlgo_DataMapOfPassKeyInteger_HeaderFile +#include +#include +#include +#define _NCollection_MapHasher +#include +typedef NCollection_DataMap GEOMAlgo_DataMapOfPassKeyInteger; +typedef GEOMAlgo_DataMapOfPassKeyInteger::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger; -// other Inline functions and methods (like "C++: function call" methods) -// +#undef _NCollection_MapHasher #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger_0.cxx deleted file mode 100644 index 2b3a535cd..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyInteger_0.cxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_HeaderFile -#include -#endif - - -#define TheKey GEOMAlgo_PassKey -#define TheKey_hxx -#define TheItem Standard_Integer -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyInteger -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx index 28693baea..c9a030daa 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx @@ -1,157 +1,40 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile -#define _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class GEOMAlgo_PassKeyShape; -class TopoDS_Shape; -class GEOMAlgo_PassKeyShapeMapHasher; -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; -class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_DataMapOfPassKeyShapeShape : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape& Assign(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other) ; - GEOMAlgo_DataMapOfPassKeyShapeShape& operator =(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_DataMapOfPassKeyShapeShape() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Boolean Bind(const GEOMAlgo_PassKeyShape& K,const TopoDS_Shape& I) ; - +// File: GEOMAlgo_DataMapOfPassKeyShapeShape.hxx +// Created: Wed Feb 22 11:00:16 2012 +// Author: +// -Standard_EXPORT Standard_Boolean IsBound(const GEOMAlgo_PassKeyShape& K) const; +#ifndef GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#define GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile -Standard_EXPORT Standard_Boolean UnBind(const GEOMAlgo_PassKeyShape& K) ; +#include +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT const TopoDS_Shape& Find(const GEOMAlgo_PassKeyShape& K) const; - const TopoDS_Shape& operator()(const GEOMAlgo_PassKeyShape& K) const -{ - return Find(K); -} - - -Standard_EXPORT TopoDS_Shape& ChangeFind(const GEOMAlgo_PassKeyShape& K) ; - TopoDS_Shape& operator()(const GEOMAlgo_PassKeyShape& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +typedef NCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape; +typedef GEOMAlgo_DataMapOfPassKeyShapeShape::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape; #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx deleted file mode 100644 index 3ffd39769..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile -#include -#endif - - -#define TheKey GEOMAlgo_PassKeyShape -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfRealListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfRealListOfShape.hxx index 108370ac1..179402f9e 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfRealListOfShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfRealListOfShape.hxx @@ -1,159 +1,43 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapOfRealListOfShape_HeaderFile -#define _GEOMAlgo_DataMapOfRealListOfShape_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TopTools_ListOfShape; -class TColStd_MapRealHasher; -class GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape; -class GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_DataMapOfRealListOfShape : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapOfRealListOfShape(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_DataMapOfRealListOfShape& Assign(const GEOMAlgo_DataMapOfRealListOfShape& Other) ; - GEOMAlgo_DataMapOfRealListOfShape& operator =(const GEOMAlgo_DataMapOfRealListOfShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_DataMapOfRealListOfShape() -{ - Clear(); -} - - +// File: GEOMAlgo_DataMapOfRealListOfShape.hxx +// Created: Wed Feb 22 10:51:48 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Bind(const Standard_Real& K,const TopTools_ListOfShape& I) ; +#ifndef GEOMAlgo_DataMapOfRealListOfShape_HeaderFile +#define GEOMAlgo_DataMapOfRealListOfShape_HeaderFile -Standard_EXPORT Standard_Boolean IsBound(const Standard_Real& K) const; - - -Standard_EXPORT Standard_Boolean UnBind(const Standard_Real& K) ; - - -Standard_EXPORT const TopTools_ListOfShape& Find(const Standard_Real& K) const; - const TopTools_ListOfShape& operator()(const Standard_Real& K) const -{ - return Find(K); -} - - - -Standard_EXPORT TopTools_ListOfShape& ChangeFind(const Standard_Real& K) ; - TopTools_ListOfShape& operator()(const Standard_Real& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_DataMapOfRealListOfShape(const GEOMAlgo_DataMapOfRealListOfShape& Other); - - - // Fields PRIVATE - // - - -}; +#include +#include +#include +#define _NCollection_MapHasher +#include +typedef NCollection_DataMap GEOMAlgo_DataMapOfRealListOfShape; +typedef GEOMAlgo_DataMapOfRealListOfShape::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape; +#undef _NCollection_MapHasher -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfRealListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfRealListOfShape_0.cxx deleted file mode 100644 index 7edbd031f..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfRealListOfShape_0.cxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TColStd_MapRealHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_HeaderFile -#include -#endif - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher TColStd_MapRealHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfRealListOfShape -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeMapOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeMapOfShape.hxx new file mode 100644 index 000000000..510f4373c --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeMapOfShape.hxx @@ -0,0 +1,44 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_DataMapOfShapeMapOfShape.hxx +// Created: Wed Feb 22 11:07:16 2012 +// Author: +// + + +#ifndef GEOMAlgo_DataMapOfShapeMapOfShape_HeaderFile +#define GEOMAlgo_DataMapOfShapeMapOfShape_HeaderFile + + +#include +#include +#include + +#define _NCollection_MapHasher +#include + + +typedef NCollection_DataMap GEOMAlgo_DataMapOfShapeMapOfShape; +typedef GEOMAlgo_DataMapOfShapeMapOfShape::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape; + +#undef _NCollection_MapHasher + + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapePnt.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapePnt.hxx new file mode 100644 index 000000000..c552d1c81 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapePnt.hxx @@ -0,0 +1,44 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_DataMapOfShapePnt.hxx +// Created: Wed Feb 22 11:10:15 2012 +// Author: +// + + +#ifndef GEOMAlgo_DataMapOfShapePnt_HeaderFile +#define GEOMAlgo_DataMapOfShapePnt_HeaderFile + + +#include +#include +#include + +#define _NCollection_MapHasher +#include +#include + +typedef NCollection_DataMap GEOMAlgo_DataMapOfShapePnt; +typedef GEOMAlgo_DataMapOfShapePnt::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt; + +#undef _NCollection_MapHasher + + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeReal.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeReal.hxx index 7e121ac24..cc20d7e16 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeReal.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeReal.hxx @@ -1,159 +1,41 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapOfShapeReal_HeaderFile -#define _GEOMAlgo_DataMapOfShapeReal_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TopoDS_Shape; -class TopTools_ShapeMapHasher; -class GEOMAlgo_DataMapNodeOfDataMapOfShapeReal; -class GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_DataMapOfShapeReal : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapOfShapeReal(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_DataMapOfShapeReal& Assign(const GEOMAlgo_DataMapOfShapeReal& Other) ; - GEOMAlgo_DataMapOfShapeReal& operator =(const GEOMAlgo_DataMapOfShapeReal& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_DataMapOfShapeReal() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Boolean Bind(const TopoDS_Shape& K,const Standard_Real& I) ; +// File: GEOMAlgo_DataMapOfShapeReal.hxx +// Created: Wed Feb 22 10:47:23 2012 +// Author: +// -Standard_EXPORT Standard_Boolean IsBound(const TopoDS_Shape& K) const; - - -Standard_EXPORT Standard_Boolean UnBind(const TopoDS_Shape& K) ; - - -Standard_EXPORT const Standard_Real& Find(const TopoDS_Shape& K) const; - const Standard_Real& operator()(const TopoDS_Shape& K) const -{ - return Find(K); -} - - - -Standard_EXPORT Standard_Real& ChangeFind(const TopoDS_Shape& K) ; - Standard_Real& operator()(const TopoDS_Shape& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_DataMapOfShapeReal(const GEOMAlgo_DataMapOfShapeReal& Other); - - - // Fields PRIVATE - // - - -}; - +#ifndef GEOMAlgo_DataMapOfShapeReal_HeaderFile +#define GEOMAlgo_DataMapOfShapeReal_HeaderFile +#include +#include +#include +#define _NCollection_MapHasher +#include +typedef NCollection_DataMap GEOMAlgo_DataMapOfShapeReal; +typedef GEOMAlgo_DataMapOfShapeReal::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal; -// other Inline functions and methods (like "C++: function call" methods) -// +#undef _NCollection_MapHasher #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeReal_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeReal_0.cxx deleted file mode 100644 index 66ae1a35d..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeReal_0.cxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Standard_Real -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeReal -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeShapeSet.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeShapeSet.hxx index 8c372df0a..4430717c3 100644 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeShapeSet.hxx +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeShapeSet.hxx @@ -1,157 +1,42 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile -#define _GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TopoDS_Shape; -class GEOMAlgo_ShapeSet; -class TopTools_ShapeMapHasher; -class GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet; -class GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_DataMapOfShapeShapeSet : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_DataMapOfShapeShapeSet(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_DataMapOfShapeShapeSet& Assign(const GEOMAlgo_DataMapOfShapeShapeSet& Other) ; - GEOMAlgo_DataMapOfShapeShapeSet& operator =(const GEOMAlgo_DataMapOfShapeShapeSet& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_DataMapOfShapeShapeSet() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Boolean Bind(const TopoDS_Shape& K,const GEOMAlgo_ShapeSet& I) ; +// File: GEOMAlgo_DataMapOfShapeShapeSet.hxx +// Created: Wed Feb 22 08:36:15 2012 +// Author: +// -Standard_EXPORT Standard_Boolean IsBound(const TopoDS_Shape& K) const; +#ifndef GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile +#define GEOMAlgo_DataMapOfShapeShapeSet_HeaderFile +#include +#include +#include -Standard_EXPORT Standard_Boolean UnBind(const TopoDS_Shape& K) ; +#define _NCollection_MapHasher +#include -Standard_EXPORT const GEOMAlgo_ShapeSet& Find(const TopoDS_Shape& K) const; - const GEOMAlgo_ShapeSet& operator()(const TopoDS_Shape& K) const -{ - return Find(K); -} +typedef NCollection_DataMap GEOMAlgo_DataMapOfShapeShapeSet; +typedef GEOMAlgo_DataMapOfShapeShapeSet::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet; - - -Standard_EXPORT GEOMAlgo_ShapeSet& ChangeFind(const TopoDS_Shape& K) ; - GEOMAlgo_ShapeSet& operator()(const TopoDS_Shape& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_DataMapOfShapeShapeSet(const GEOMAlgo_DataMapOfShapeShapeSet& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +#undef _NCollection_MapHasher #endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeShapeSet_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeShapeSet_0.cxx deleted file mode 100644 index c583d68a4..000000000 --- a/src/GEOMAlgo/GEOMAlgo_DataMapOfShapeShapeSet_0.cxx +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeSet_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem GEOMAlgo_ShapeSet -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet -#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_Type_() -#define TCollection_DataMap GEOMAlgo_DataMapOfShapeShapeSet -#define TCollection_DataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl deleted file mode 100644 index 44be83e18..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl +++ /dev/null @@ -1,114 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_FinderShapeOn.cdl --- Created: Tue Jan 11 14:35:52 2005 --- Author: Peter KURNEV --- -class FinderShapeOn from GEOMAlgo - inherits ShapeAlgo from GEOMAlgo - - ---Purpose: - -uses - Surface from Geom, - ShapeEnum from TopAbs, - ListOfShape from TopTools, - DataMapOfShapeShape from TopTools, - Shape from TopoDS, - State from GEOMAlgo, - IndexedDataMapOfShapeState from GEOMAlgo - ---raises - -is - Create - returns FinderShapeOn from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn();" - - Perform(me:out) - is redefined; - - SetSurface(me:out; - aS:Surface from Geom); - - SetShapeType(me:out; - aST:ShapeEnum from TopAbs); - - SetState(me:out; - aSF:State from GEOMAlgo); - - Surface(me) - returns Surface from Geom; - ---C++: return const & - - ShapeType(me) - returns ShapeEnum from TopAbs; - - State(me) - returns State from GEOMAlgo; - - Shapes(me) - returns ListOfShape from TopTools; - ---C++: return const & - - -- - -- protected methods - -- - CheckData(me:out) - is redefined protected; - - MakeArgument1(me:out) - is protected; - - MakeArgument2(me:out) - is protected; - - Find(me:out) - is protected; - - Find(me:out; - aS:Shape from TopoDS) - is protected; - - FindVertices(me:out) - is protected; - - CopySource(myclass; - aS :Shape from TopoDS; - aImages : out DataMapOfShapeShape from TopTools; - aOriginals: out DataMapOfShapeShape from TopTools; - aSC : out Shape from TopoDS); - - - -fields - mySurface : Surface from Geom is protected; - myShapeType : ShapeEnum from TopAbs is protected; - myState : State from GEOMAlgo is protected; - myArg1 : Shape from TopoDS is protected; - myArg2 : Shape from TopoDS is protected; - myLS : ListOfShape from TopTools is protected; - myImages : DataMapOfShapeShape from TopTools is protected; - myMSS : IndexedDataMapOfShapeState from GEOMAlgo is protected; - myIsAnalytic : Boolean from Standard is protected; - -end FinderShapeOn; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx index 372edf653..4708ce554 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx @@ -1,30 +1,36 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_FinderShapeOn.cxx -// Created: Tue Jan 11 14:44:31 2005 -// Author: Peter KURNEV -// -// -#include + +// File: GEOMAlgo_FinderShapeOn.cxx +// Created: Tue Jan 11 14:44:31 2005 +// Author: Peter KURNEV + +#include + +#include + +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version +#include +#endif #include @@ -70,7 +76,7 @@ //======================================================================= //function : GEOMAlgo_FinderShapeOn -//purpose : +//purpose : //======================================================================= GEOMAlgo_FinderShapeOn::GEOMAlgo_FinderShapeOn() : @@ -83,14 +89,14 @@ GEOMAlgo_FinderShapeOn::GEOMAlgo_FinderShapeOn() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_FinderShapeOn::~GEOMAlgo_FinderShapeOn() { } //======================================================================= //function : SetSurface -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::SetSurface(const Handle(Geom_Surface)& aS) { @@ -98,7 +104,7 @@ void GEOMAlgo_FinderShapeOn::SetSurface(const Handle(Geom_Surface)& aS) } //======================================================================= //function : Surface -//purpose : +//purpose : //======================================================================= const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn::Surface() const { @@ -106,7 +112,7 @@ const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn::Surface() const } //======================================================================= //function : SetShapeType -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::SetShapeType(const TopAbs_ShapeEnum aType) { @@ -114,7 +120,7 @@ void GEOMAlgo_FinderShapeOn::SetShapeType(const TopAbs_ShapeEnum aType) } //======================================================================= //function : ShapeType -//purpose : +//purpose : //======================================================================= TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn::ShapeType()const { @@ -122,7 +128,7 @@ TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn::ShapeType()const } //======================================================================= //function : SetState -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::SetState(const GEOMAlgo_State aState) { @@ -130,7 +136,7 @@ void GEOMAlgo_FinderShapeOn::SetState(const GEOMAlgo_State aState) } //======================================================================= //function : State -//purpose : +//purpose : //======================================================================= GEOMAlgo_State GEOMAlgo_FinderShapeOn::State() const { @@ -138,7 +144,7 @@ GEOMAlgo_State GEOMAlgo_FinderShapeOn::State() const } //======================================================================= // function: Shapes -// purpose: +// purpose: //======================================================================= const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn::Shapes() const { @@ -164,7 +170,7 @@ const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn::Shapes() const } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::Perform() { @@ -182,6 +188,9 @@ void GEOMAlgo_FinderShapeOn::Perform() return; } // + // Initialize the context + GEOMAlgo_ShapeAlgo::Perform(); + // myIsAnalytic=GEOMAlgo_SurfaceTools::IsAnalytic(mySurface); // MakeArgument1(); @@ -207,10 +216,10 @@ void GEOMAlgo_FinderShapeOn::Perform() } //======================================================================= //function : FindVertices -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::FindVertices() -{ +{ Standard_Integer i, aNb, iErr; TopAbs_State aSt; TopAbs_Orientation aOr; @@ -225,7 +234,7 @@ void GEOMAlgo_FinderShapeOn::FindVertices() TopExp::MapShapes(myShape, myShapeType, aM); aNb=aM.Extent(); if (!aNb) { - myWarningStatus=10; // No found subshapes of type myShapeType + myWarningStatus=10; // No found sub-shapes of type myShapeType return; } // @@ -242,7 +251,7 @@ void GEOMAlgo_FinderShapeOn::FindVertices() } //======================================================================= //function : Find -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::Find() { @@ -254,7 +263,7 @@ void GEOMAlgo_FinderShapeOn::Find() // aNb=aM.Extent(); if (!aNb) { - myWarningStatus=10; // No found subshapes of type myShapeType + myWarningStatus=10; // No found sub-shapes of type myShapeType return; } // @@ -284,7 +293,7 @@ void GEOMAlgo_FinderShapeOn::Find() } //======================================================================= //function : Find -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS) { @@ -309,7 +318,7 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS) myErrorStatus=31; // DSFiller failed return; } - // + // // 2. Find shapes GEOMAlgo_ShapeSolid* pSS; GEOMAlgo_VertexSolid aVXS; @@ -334,7 +343,7 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS) pSS=&aSLS; break; default: - myErrorStatus=12; // unallowed subshape type + myErrorStatus=12; // unallowed sub-shape type return; } // @@ -350,21 +359,21 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS) const TopTools_ListOfShape& aLS=pSS->Shapes(aSts[i]); aIt.Initialize(aLS); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSImage=aIt.Value(); - if (myImages.IsBound(aSImage)) { - const TopoDS_Shape& aSx=myImages.Find(aSImage); - myMSS.Add(aSx, aSts[i]); + const TopoDS_Shape& aSImage=aIt.Value(); + if (myImages.IsBound(aSImage)) { + const TopoDS_Shape& aSx=myImages.Find(aSImage); + myMSS.Add(aSx, aSts[i]); } else { - myErrorStatus=33;// can not find original shape - return; + myErrorStatus=33;// can not find original shape + return; } } } } //======================================================================= //function : MakeArgument1 -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::MakeArgument1() { @@ -382,7 +391,11 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1() // // Argument 1 if (!myIsAnalytic) { +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + aMF.Init(mySurface, Standard_True, Precision::Confusion()); +#else aMF.Init(mySurface, Standard_True); +#endif aFErr=aMF.Error(); if (aFErr!=BRepLib_FaceDone) { myErrorStatus=20; // can not build the face @@ -403,24 +416,24 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1() switch (aType) { case TopAbs_VERTEX: { const TopoDS_Vertex& aVx=TopoDS::Vertex(aS); - aBB.UpdateVertex(aVx, myTolerance); + aBB.UpdateVertex(aVx, myTolerance); } - break; + break; case TopAbs_EDGE: { const TopoDS_Edge& aEx=TopoDS::Edge(aS); - aBB.UpdateEdge(aEx, myTolerance); + aBB.UpdateEdge(aEx, myTolerance); } - break; + break; case TopAbs_FACE: { const TopoDS_Face& aFx=TopoDS::Face(aS); - aBB.UpdateFace(aFx, myTolerance); + aBB.UpdateFace(aFx, myTolerance); } - break; + break; default: - break; + break; } } - } // + } // else { aBB.MakeFace(aFace, mySurface, myTolerance); } @@ -434,7 +447,7 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1() } //======================================================================= //function : MakeArgument2 -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::MakeArgument2() { @@ -451,7 +464,7 @@ void GEOMAlgo_FinderShapeOn::MakeArgument2() } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::CheckData() { @@ -468,14 +481,14 @@ void GEOMAlgo_FinderShapeOn::CheckData() } // if (!(myShapeType==TopAbs_VERTEX || - myShapeType==TopAbs_EDGE || - myShapeType==TopAbs_FACE || - myShapeType==TopAbs_SOLID)) { - myErrorStatus=12; // unallowed subshape type + myShapeType==TopAbs_EDGE || + myShapeType==TopAbs_FACE || + myShapeType==TopAbs_SOLID)) { + myErrorStatus=12; // unallowed sub-shape type return; } // - if (myState==GEOMAlgo_ST_UNKNOWN || + if (myState==GEOMAlgo_ST_UNKNOWN || myState==GEOMAlgo_ST_INOUT) { myErrorStatus=13; // unallowed state type return; @@ -484,12 +497,12 @@ void GEOMAlgo_FinderShapeOn::CheckData() // //======================================================================= //function : CopySource -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE, - TopTools_DataMapOfShapeShape& aImages, - TopTools_DataMapOfShapeShape& aOriginals, - TopoDS_Shape& aEx) + TopTools_DataMapOfShapeShape& aImages, + TopTools_DataMapOfShapeShape& aOriginals, + TopoDS_Shape& aEx) { Standard_Boolean bFree; TopAbs_ShapeEnum aType; @@ -524,7 +537,7 @@ void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE, const TopoDS_Shape& aV=aIt.Value(); TopoDS_Shape aVx; // - CopySource (aV, aImages, aOriginals, aVx); + CopySource (aV, aImages, aOriginals, aVx); // aVx.Orientation(aV.Orientation()); BB.Add(aEx, aVx); @@ -535,9 +548,10 @@ void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE, // //======================================================================= //function : BuildTriangulation -//purpose : +//purpose : //======================================================================= -bool GEOMAlgo_FinderShapeOn::BuildTriangulation (const TopoDS_Shape& theShape) +Standard_Boolean + GEOMAlgo_FinderShapeOn::BuildTriangulation (const TopoDS_Shape& theShape) { // calculate deflection Standard_Real aDeviationCoefficient = 0.001; @@ -590,8 +604,8 @@ bool GEOMAlgo_FinderShapeOn::BuildTriangulation (const TopoDS_Shape& theShape) // // 10 -mySurface=NULL // 11 -myShape=NULL -// 12 -unallowed type of subshapes -// 13 -unallowed state +// 12 -unallowed type of sub-shapes +// 13 -unallowed state // 20 -can not build the face // 30 -wrong args are used for DSFiller // 31 -DSFiller failed @@ -600,4 +614,4 @@ bool GEOMAlgo_FinderShapeOn::BuildTriangulation (const TopoDS_Shape& theShape) // // myWarningStatus // -// 10 -subshapes of type myShapeType can not be fond in myShape +// 10 - sub-shapes of type myShapeType can not be fond in myShape diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx index 632ad722f..a05b902b9 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.hxx @@ -1,175 +1,121 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: GEOMAlgo_FinderShapeOn.hxx +// Created: Tue Jan 11 14:44:31 2005 +// Author: Peter KURNEV + #ifndef _GEOMAlgo_FinderShapeOn_HeaderFile #define _GEOMAlgo_FinderShapeOn_HeaderFile -#ifndef _Handle_Geom_Surface_HeaderFile +#include +#include #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -#ifndef _GEOMAlgo_State_HeaderFile #include -#endif -#ifndef _TopoDS_Shape_HeaderFile #include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile #include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile #include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #include -#endif -class Geom_Surface; -class TopTools_ListOfShape; -class TopoDS_Shape; -class TopTools_DataMapOfShapeShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_FinderShapeOn : public GEOMAlgo_ShapeAlgo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_FinderShapeOn(); -Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn(); - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ; - - -Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ; - +#include +#include -Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ; +//======================================================================= +//function : GEOMAlgo_FinderShapeOn +//purpose : +//======================================================================= +class GEOMAlgo_FinderShapeOn : public GEOMAlgo_ShapeAlgo +{ + public: + Standard_EXPORT + GEOMAlgo_FinderShapeOn(); + Standard_EXPORT + virtual ~GEOMAlgo_FinderShapeOn(); -Standard_EXPORT const Handle_Geom_Surface& Surface() const; + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + void SetSurface(const Handle(Geom_Surface)& aS) ; -Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; + Standard_EXPORT + void SetShapeType(const TopAbs_ShapeEnum aST) ; + Standard_EXPORT + void SetState(const GEOMAlgo_State aSF) ; -Standard_EXPORT GEOMAlgo_State State() const; + Standard_EXPORT + const Handle_Geom_Surface& Surface() const; + Standard_EXPORT + TopAbs_ShapeEnum ShapeType() const; -Standard_EXPORT const TopTools_ListOfShape& Shapes() const; + Standard_EXPORT + GEOMAlgo_State State() const; + Standard_EXPORT + const TopTools_ListOfShape& Shapes() const; -Standard_EXPORT static void CopySource(const TopoDS_Shape& aS,TopTools_DataMapOfShapeShape& aImages,TopTools_DataMapOfShapeShape& aOriginals,TopoDS_Shape& aSC) ; + Standard_EXPORT + static void CopySource(const TopoDS_Shape& aS, + TopTools_DataMapOfShapeShape& aImages, + TopTools_DataMapOfShapeShape& aOriginals, + TopoDS_Shape& aSC) ; -Standard_EXPORT static bool BuildTriangulation (const TopoDS_Shape& theShape); + Standard_EXPORT + static Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ; protected: + Standard_EXPORT + virtual void CheckData() ; - // Methods PROTECTED - // - - -Standard_EXPORT virtual void CheckData() ; - - -Standard_EXPORT void MakeArgument1() ; - - -Standard_EXPORT void MakeArgument2() ; - - -Standard_EXPORT void Find() ; - + Standard_EXPORT + void MakeArgument1() ; -Standard_EXPORT void Find(const TopoDS_Shape& aS) ; + Standard_EXPORT + void MakeArgument2() ; + Standard_EXPORT + void Find() ; -Standard_EXPORT void FindVertices() ; + Standard_EXPORT + void Find(const TopoDS_Shape& aS) ; - - // Fields PROTECTED - // -Handle_Geom_Surface mySurface; -TopAbs_ShapeEnum myShapeType; -GEOMAlgo_State myState; -TopoDS_Shape myArg1; -TopoDS_Shape myArg2; -TopTools_ListOfShape myLS; -TopTools_DataMapOfShapeShape myImages; -GEOMAlgo_IndexedDataMapOfShapeState myMSS; -Standard_Boolean myIsAnalytic; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + void FindVertices() ; + Handle_Geom_Surface mySurface; + TopAbs_ShapeEnum myShapeType; + GEOMAlgo_State myState; + TopoDS_Shape myArg1; + TopoDS_Shape myArg2; + TopTools_ListOfShape myLS; + TopTools_DataMapOfShapeShape myImages; + GEOMAlgo_IndexedDataMapOfShapeState myMSS; + Standard_Boolean myIsAnalytic; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx deleted file mode 100644 index 2dfc0be17..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx deleted file mode 100644 index f7161c607..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2007-2008 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_Surface_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cdl b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cdl deleted file mode 100644 index cb9be924f..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cdl +++ /dev/null @@ -1,143 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_FinderShapeOn1.cdl --- Created: Fri Mar 4 10:26:54 2005 --- Author: Peter KURNEV --- -class FinderShapeOn1 from GEOMAlgo - inherits ShapeAlgo from GEOMAlgo - - ---Purpose: - -uses - Pnt from gp,-- - Surface from Geom, - Surface from GeomAdaptor, - - ShapeEnum from TopAbs, - State from TopAbs, - Face from TopoDS, - Edge from TopoDS, - ListOfShape from TopTools, - - State from GEOMAlgo, - ListOfPnt from GEOMAlgo, - IndexedDataMapOfShapeState from GEOMAlgo - ---raises - -is - Create - returns FinderShapeOn1 from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn1();" - - SetSurface(me:out; - aS:Surface from Geom); - - SetShapeType(me:out; - aST:ShapeEnum from TopAbs); - - SetState(me:out; - aSF:State from GEOMAlgo); - - SetNbPntsMin(me:out; - aNb:Integer from Standard); - - NbPntsMin(me) - returns Integer from Standard; - - SetNbPntsMax(me:out; - aNb:Integer from Standard); - - NbPntsMax(me) - returns Integer from Standard; - - Surface(me) - returns Surface from Geom; - ---C++: return const & - - ShapeType(me) - returns ShapeEnum from TopAbs; - - State(me) - returns State from GEOMAlgo; - - Perform(me:out) - is redefined; - - Shapes(me) - returns ListOfShape from TopTools; - ---C++: return const & - -- - -- protected methods - -- - CheckData(me:out) - is redefined protected; - - ProcessVertices(me:out) - is protected; - - ProcessEdges(me:out) - is protected; - - ProcessFaces(me:out) - is protected; - - ProcessSolids(me:out) - is protected; - - InnerPoints(me:out; - aF :Face from TopoDS; - aLP:out ListOfPnt from GEOMAlgo) - is protected; - - InnerPoints(me:out; - aE :Edge from TopoDS; - aLP:out ListOfPnt from GEOMAlgo) - is protected; - - InnerPoints(me:out; - aE :Edge from TopoDS; - aNbPnts: Integer from Standard; - aLP:out ListOfPnt from GEOMAlgo) - is protected; - - MSS (me) - returns IndexedDataMapOfShapeState from GEOMAlgo; - ---C++:return const & - - GetPointState(me:out; aP: Pnt from gp) - returns State from TopAbs is virtual protected; - -fields - mySurface : Surface from Geom is protected; - myShapeType : ShapeEnum from TopAbs is protected; - myState : State from GEOMAlgo is protected; - myNbPntsMin : Integer from Standard is protected; - myNbPntsMax : Integer from Standard is protected; - -- - myGAS : Surface from GeomAdaptor is protected; - myLS : ListOfShape from TopTools is protected; - -- - myMSS : IndexedDataMapOfShapeState from GEOMAlgo is protected; - -end FinderShapeOn1; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx index 24f5ed55e..9c943ac43 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx @@ -1,32 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_FinderShapeOn1.cxx -// Created: Fri Mar 4 10:31:06 2005 -// Author: Peter KURNEV -// -// -#include -#include +// File: GEOMAlgo_FinderShapeOn1.cxx +// Created: Fri Mar 4 10:31:06 2005 +// Author: Peter KURNEV + +#include + +#include #include #include @@ -80,7 +80,7 @@ //======================================================================= //function : GEOMAlgo_FinderShapeOn1 -//purpose : +//purpose : //======================================================================= GEOMAlgo_FinderShapeOn1::GEOMAlgo_FinderShapeOn1() : @@ -94,14 +94,14 @@ GEOMAlgo_FinderShapeOn1::GEOMAlgo_FinderShapeOn1() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_FinderShapeOn1::~GEOMAlgo_FinderShapeOn1() { } //======================================================================= //function : SetSurface -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::SetSurface(const Handle(Geom_Surface)& aS) { @@ -109,7 +109,7 @@ void GEOMAlgo_FinderShapeOn1::SetSurface(const Handle(Geom_Surface)& aS) } //======================================================================= //function : Surface -//purpose : +//purpose : //======================================================================= const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn1::Surface() const { @@ -117,7 +117,7 @@ const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn1::Surface() const } //======================================================================= //function : SetShapeType -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::SetShapeType(const TopAbs_ShapeEnum aType) { @@ -125,7 +125,7 @@ void GEOMAlgo_FinderShapeOn1::SetShapeType(const TopAbs_ShapeEnum aType) } //======================================================================= //function : ShapeType -//purpose : +//purpose : //======================================================================= TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn1::ShapeType()const { @@ -133,7 +133,7 @@ TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn1::ShapeType()const } //======================================================================= //function : SetState -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::SetState(const GEOMAlgo_State aState) { @@ -141,7 +141,7 @@ void GEOMAlgo_FinderShapeOn1::SetState(const GEOMAlgo_State aState) } //======================================================================= //function : State -//purpose : +//purpose : //======================================================================= GEOMAlgo_State GEOMAlgo_FinderShapeOn1::State() const { @@ -149,7 +149,7 @@ GEOMAlgo_State GEOMAlgo_FinderShapeOn1::State() const } //======================================================================= //function : SetNbPntsMin -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::SetNbPntsMin(const Standard_Integer aNb) { @@ -157,7 +157,7 @@ void GEOMAlgo_FinderShapeOn1::SetNbPntsMin(const Standard_Integer aNb) } //======================================================================= //function : NbPntsMin -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMin()const { @@ -165,7 +165,7 @@ Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMin()const } //======================================================================= //function : SetNbPntsMax -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::SetNbPntsMax(const Standard_Integer aNb) { @@ -173,7 +173,7 @@ void GEOMAlgo_FinderShapeOn1::SetNbPntsMax(const Standard_Integer aNb) } //======================================================================= //function : NbPntsMax -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMax()const { @@ -181,7 +181,7 @@ Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMax()const } //======================================================================= // function: MSS -// purpose: +// purpose: //======================================================================= const GEOMAlgo_IndexedDataMapOfShapeState& GEOMAlgo_FinderShapeOn1::MSS() const { @@ -189,7 +189,7 @@ const GEOMAlgo_IndexedDataMapOfShapeState& GEOMAlgo_FinderShapeOn1::MSS() const } //======================================================================= // function: Shapes -// purpose: +// purpose: //======================================================================= const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn1::Shapes() const { @@ -210,7 +210,7 @@ const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn1::Shapes() const } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::Perform() { @@ -224,6 +224,9 @@ void GEOMAlgo_FinderShapeOn1::Perform() return; } // + // Initialize the context + GEOMAlgo_ShapeAlgo::Perform(); + // // 1 ProcessVertices(); if(myErrorStatus) { @@ -252,12 +255,12 @@ void GEOMAlgo_FinderShapeOn1::Perform() } // // 4 - ProcessSolids(); + ProcessSolids(); // } //======================================================================= //function : ProcessVertices -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::ProcessVertices() { @@ -280,7 +283,7 @@ void GEOMAlgo_FinderShapeOn1::ProcessVertices() // if (myShapeType==TopAbs_VERTEX){ if (bIsConformState) { - myMSS.Add(aV, aSt); + myMSS.Add(aV, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { @@ -290,7 +293,7 @@ void GEOMAlgo_FinderShapeOn1::ProcessVertices() } //======================================================================= //function : ProcessEdges -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::ProcessEdges() { @@ -320,11 +323,11 @@ void GEOMAlgo_FinderShapeOn1::ProcessEdges() // bIsConformState=myMSS.Contains(aV); if (!bIsConformState) { - break;// vertex has non-conformed state + break;// vertex has non-conformed state } else { - aSt=myMSS.FindFromKey(aV); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aV); + aSC.AppendState(aSt); } } // @@ -333,13 +336,13 @@ void GEOMAlgo_FinderShapeOn1::ProcessEdges() } // if (BRep_Tool::Degenerated(aE)) { - myMSS.Add(aE, aSt); + myMSS.Add(aE, aSt); continue; } // if (myState==GEOMAlgo_ST_ON && aType1==GeomAbs_Sphere) { Standard_Real aT1, aT2; - Handle(Geom_Curve) aC; + Handle(Geom_Curve) aC; GeomAdaptor_Curve aGAC; GeomAbs_CurveType aType2; // @@ -348,48 +351,48 @@ void GEOMAlgo_FinderShapeOn1::ProcessEdges() // aType2=aGAC.GetType(); if (aType2==GeomAbs_Line) { - continue; + continue; } } // InnerPoints(aE, aLP); if (myErrorStatus) { - return; + return; } // bIsConformState=Standard_True; aIt.Initialize(aLP); for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { if (myNbPntsMax) { - if (iCnt > myNbPntsMax) { - break; - } + if (iCnt > myNbPntsMax) { + break; + } } // const gp_Pnt& aP=aIt.Value(); aSt = GetPointState( aP ); bIsToBreak=aSC.AppendState(aSt); if (bIsToBreak) { - break; + break; } } // - aSt=aSC.State(); + aSt=aSC.State(); // bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (myShapeType==TopAbs_EDGE) { if (bIsConformState) { - myMSS.Add(aE, aSt); + myMSS.Add(aE, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { myMSS.Add(aE, aSt); } - } // for (i=1; i<=aNb; ++i) next edge + } // for (i=1; i<=aNb; ++i) next edge } //======================================================================= //function : ProcessFaces -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::ProcessFaces() { @@ -421,7 +424,7 @@ void GEOMAlgo_FinderShapeOn1::ProcessFaces() aGAS.Load(aS); aType2=aGAS.GetType(); if (aType2!=aType1) { - continue; + continue; } } // @@ -430,11 +433,11 @@ void GEOMAlgo_FinderShapeOn1::ProcessFaces() const TopoDS_Shape& aE=aExp.Current(); bIsConformState=myMSS.Contains(aE); if (!bIsConformState) { - break;// edge has non-conformed state + break;// edge has non-conformed state } else { - aSt=myMSS.FindFromKey(aE); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aE); + aSC.AppendState(aSt); } } // @@ -451,35 +454,35 @@ void GEOMAlgo_FinderShapeOn1::ProcessFaces() aIt.Initialize(aLP); for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { if (myNbPntsMax) { - if (iCnt > myNbPntsMax) { - break; - } + if (iCnt > myNbPntsMax) { + break; + } } // const gp_Pnt& aP=aIt.Value(); aSt = GetPointState( aP ); bIsToBreak=aSC.AppendState(aSt); if (bIsToBreak) { - break; + break; } } // - aSt=aSC.State(); + aSt=aSC.State(); // bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (myShapeType==TopAbs_FACE) { if (bIsConformState) { - myMSS.Add(aF, aSt); + myMSS.Add(aF, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { myMSS.Add(aF, aSt); } - }// for (i=1; i<=aNb; ++i) next face + }// for (i=1; i<=aNb; ++i) next face } //======================================================================= //function : ProcessSolids -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::ProcessSolids() { @@ -503,11 +506,11 @@ void GEOMAlgo_FinderShapeOn1::ProcessSolids() const TopoDS_Shape& aF=aMF(j); bIsConformState=myMSS.Contains(aF); if (!bIsConformState) { - break;// face has non-conformed state + break;// face has non-conformed state } else { - aSt=myMSS.FindFromKey(aF); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aF); + aSC.AppendState(aSt); } } // @@ -515,7 +518,7 @@ void GEOMAlgo_FinderShapeOn1::ProcessSolids() continue; // face has non-conformed state,skip solid } // - aSt=aSC.State(); + aSt=aSC.State(); // bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (bIsConformState) { @@ -526,10 +529,10 @@ void GEOMAlgo_FinderShapeOn1::ProcessSolids() // //======================================================================= //function : InnerPoints -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, - GEOMAlgo_ListOfPnt& aLP) + GEOMAlgo_ListOfPnt& aLP) { myErrorStatus=0; // @@ -568,11 +571,11 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, // aPK.SetIds(n[k], n[k+1]); if (aMPKI.IsBound(aPK)) { - Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); - ++iCntX; + Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); + ++iCntX; } else { - aMPKI.Bind(aPK, 1); + aMPKI.Bind(aPK, 1); } } } @@ -584,24 +587,15 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, iCnt=aIt.Value(); if (iCnt==1) { const GEOMAlgo_PassKey& aPK=aIt.Key(); - //qf - /* - aNbMax=aPK.NbMax(); - pIds=(Standard_Integer*)aPK.Key(); - for (k=1; k<3; ++k) { - aNx=*(pIds+aNbMax-k); - aMBN.Add(aNx); - } - */ + // aNx=(Standard_Integer)aPK.Id(1); aMBN.Add(aNx); aNx=(Standard_Integer)aPK.Id(2); aMBN.Add(aNx); - //qt } } // - // inner nodes=all_nodes - boundary_nodes + // inner nodes=all_nodes - boundary_nodes j1=aNodes.Lower(); j2=aNodes.Upper(); for (j=j1; j<=j2; ++j) { @@ -613,7 +607,7 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, // aNb=aLP.Extent(); // - if (!aNb && myNbPntsMin) { + if (!aNb && myNbPntsMin) { // try to fill it yourself Standard_Boolean bIsDone; Standard_Integer aN1, aN2; @@ -629,118 +623,71 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, aNbLinks=aMPKI.Extent(); aIt.Initialize(aMPKI); for (; aIt.More(); aIt.Next()) { - iCnt=aIt.Value(); - if (iCnt>1) { - // take the first having occured inner link - // and discretize it - const GEOMAlgo_PassKey& aPK=aIt.Key(); - //qf - /* - aNbMax=aPK.NbMax(); - pIds=(Standard_Integer*)aPK.Key(); - aN1=*(pIds+aNbMax-1); - aN2=*(pIds+aNbMax-2); - */ - // - aN1=(Standard_Integer)aPK.Id(1); - aN2=(Standard_Integer)aPK.Id(2); - //qt - aP1=aNodes(aN1).Transformed(aTrsf); - aP2=aNodes(aN2).Transformed(aTrsf); - // - if (aType==GeomAbs_Cylinder) { - Standard_Real aTolSM; - gp_Cylinder aCyl; - // - aTolSM=1.523e-6;//~1.-cos(0.1 deg) - aCyl=aGAS.Cylinder(); - if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { - continue; - } - } - // - BRepLib_MakeEdge aBME(aP1, aP2); - bIsDone=aBME.IsDone(); - if (!bIsDone) { - myErrorStatus=30; //can not obtain the line fron the link - return; - } - // - const TopoDS_Shape& aSx=aBME.Shape(); - const TopoDS_Edge& aE=TopoDS::Edge(aSx); - // - InnerPoints(aE, myNbPntsMin, aLP); - break; - }// if (iCnt>1) + iCnt=aIt.Value(); + if (iCnt>1) { + // take the first having occured inner link + // and discretize it + const GEOMAlgo_PassKey& aPK=aIt.Key(); + // + aN1=(Standard_Integer)aPK.Id(1); + aN2=(Standard_Integer)aPK.Id(2); + // + aP1=aNodes(aN1).Transformed(aTrsf); + aP2=aNodes(aN2).Transformed(aTrsf); + // + if (aType==GeomAbs_Cylinder) { + Standard_Real aTolSM; + gp_Cylinder aCyl; + // + aTolSM=1.523e-6;//~1.-cos(0.1 deg) + aCyl=aGAS.Cylinder(); + if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { + continue; + } + } + // + BRepLib_MakeEdge aBME(aP1, aP2); + bIsDone=aBME.IsDone(); + if (!bIsDone) { + myErrorStatus=30; //can not obtain the line fron the link + return; + } + // + const TopoDS_Shape& aSx=aBME.Shape(); + const TopoDS_Edge& aE=TopoDS::Edge(aSx); + // + InnerPoints(aE, myNbPntsMin, aLP); + break; + }// if (iCnt>1) }// for (; aIt.More(); aIt.Next()) - }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) - }// if (!aNb && myNbPntsMin) { + }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) + }// if (!aNb && myNbPntsMin) { } +//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f //======================================================================= //function : InnerPoints -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE, - GEOMAlgo_ListOfPnt& aLP) + GEOMAlgo_ListOfPnt& aLP) { - myErrorStatus=0; + Standard_Integer aNbPntsMin; // - Standard_Integer j, aNbNodes, aIndex, aNb; - Handle(Poly_PolygonOnTriangulation) aPTE; - Handle(Poly_Triangulation) aTRE; - TopLoc_Location aLoc; - gp_Pnt aP; + myErrorStatus=0; + aNbPntsMin=21; // aLP.Clear(); - BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc); - if (aTRE.IsNull() || aPTE.IsNull()) { - Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc); - if (aPE.IsNull()) { - if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aE)) { - myErrorStatus=20; // no triangulation found - return; - } - aPE = BRep_Tool::Polygon3D(aE, aLoc); - } - const gp_Trsf& aTrsf=aLoc.Transformation(); - const TColgp_Array1OfPnt& aNodes=aPE->Nodes(); - // - aNbNodes=aPE->NbNodes(); - Standard_Integer low = aNodes.Lower(), up = aNodes.Upper(); - for (j=low+1; jNodes(); - // - aNbNodes=aPTE->NbNodes(); - const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); - for (j=2; jD0(aT, aP); aLP.Append(aP); } + */ + aNbT=aNbPntsMin+1; + dT=(aT2-aT1)/aNbT; + for (j=1; jD0(aT, aP); + aLP.Append(aP); + } + //modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn1::CheckData() { @@ -786,14 +744,14 @@ void GEOMAlgo_FinderShapeOn1::CheckData() } // if (!(myShapeType==TopAbs_VERTEX || - myShapeType==TopAbs_EDGE || - myShapeType==TopAbs_FACE || - myShapeType==TopAbs_SOLID)) { + myShapeType==TopAbs_EDGE || + myShapeType==TopAbs_FACE || + myShapeType==TopAbs_SOLID)) { myErrorStatus=12; // unallowed subshape type return; } // - if (myState==GEOMAlgo_ST_UNKNOWN || + if (myState==GEOMAlgo_ST_UNKNOWN || myState==GEOMAlgo_ST_INOUT) { myErrorStatus=13; // unallowed state type return; @@ -803,19 +761,19 @@ void GEOMAlgo_FinderShapeOn1::CheckData() // myGAS.Load(mySurface); aType=myGAS.GetType(); - if (!(aType==GeomAbs_Plane || - aType==GeomAbs_Cylinder || - aType==GeomAbs_Sphere)) { + if (!(aType==GeomAbs_Plane || + aType==GeomAbs_Cylinder || + aType==GeomAbs_Sphere)) { myErrorStatus=14; // unallowed surface type } } //======================================================================= //function : GetPointState -//purpose : +//purpose : //======================================================================= -TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP) +TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP) { TopAbs_State aSt; GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt); @@ -828,63 +786,70 @@ TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP) // // 10 -mySurface=NULL // 11 -myShape=NULL -// 12 -unallowed type of subshapes -// 13 -unallowed state +// 12 -unallowed type of subshapes +// 13 -unallowed state // 14 -unallowed surface type // 15 -unallowed surface type // 20- no triangulation found // 30- can not obtain the line from the link - +//modified by NIZNHY-PKV Thu Jan 26 10:01:14 2012f /* -// Chronometer -#include -#include - -Standard_STATIC(OSD_Chronometer, x_S_Chrono); -static void x_StartChrono(); -static void x_StopChrono(); -static Standard_Boolean x_IsToShow(); -// //======================================================================= -//function : x_StartChrono -//purpose : +//function : InnerPoints +//purpose : //======================================================================= -void x_StartChrono() +void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE, + GEOMAlgo_ListOfPnt& aLP) { - if (x_IsToShow()){ - x_S_Chrono().Reset(); - x_S_Chrono().Start(); + myErrorStatus=0; + // + Standard_Integer j, aNbNodes, aIndex, aNb; + Handle(Poly_PolygonOnTriangulation) aPTE; + Handle(Poly_Triangulation) aTRE; + TopLoc_Location aLoc; + gp_Pnt aP; + // + aLP.Clear(); + BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc); + if (aTRE.IsNull() || aPTE.IsNull()) { + Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc); + if (aPE.IsNull()) { + if (!GEOMAlgo_FinderShapeOn::BuildTriangulation(aE)) { + myErrorStatus=20; // no triangulation found + return; + } + aPE = BRep_Tool::Polygon3D(aE, aLoc); + } + const gp_Trsf& aTrsf=aLoc.Transformation(); + const TColgp_Array1OfPnt& aNodes=aPE->Nodes(); + // + aNbNodes=aPE->NbNodes(); + Standard_Integer low = aNodes.Lower(), up = aNodes.Upper(); + for (j=low+1; jNodes(); + // + aNbNodes=aPTE->NbNodes(); + const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); + for (j=2; j -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_State_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _GeomAdaptor_Surface_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile #include -#endif -#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #include -#endif -#ifndef _TopAbs_State_HeaderFile +#include + #include -#endif -class Geom_Surface; -class TopTools_ListOfShape; -class TopoDS_Face; -class GEOMAlgo_ListOfPnt; -class TopoDS_Edge; -class GEOMAlgo_IndexedDataMapOfShapeState; -class gp_Pnt; +#include +#include +#include +#include +#include +#include +#include + +#include -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_FinderShapeOn1 : public GEOMAlgo_ShapeAlgo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_FinderShapeOn1(); -Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn1(); - - -Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ; - - -Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ; - - -Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ; - - -Standard_EXPORT void SetNbPntsMin(const Standard_Integer aNb) ; - - -Standard_EXPORT Standard_Integer NbPntsMin() const; - - -Standard_EXPORT void SetNbPntsMax(const Standard_Integer aNb) ; - - -Standard_EXPORT Standard_Integer NbPntsMax() const; - - -Standard_EXPORT const Handle_Geom_Surface& Surface() const; - - -Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; - - -Standard_EXPORT GEOMAlgo_State State() const; - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT const TopTools_ListOfShape& Shapes() const; - - -Standard_EXPORT const GEOMAlgo_IndexedDataMapOfShapeState& MSS() const; - - - - - -protected: - - // Methods PROTECTED - // - +#include -Standard_EXPORT virtual void CheckData() ; +//======================================================================= +//function : GEOMAlgo_FinderShapeOn1 +//purpose : +//======================================================================= +class GEOMAlgo_FinderShapeOn1 : public GEOMAlgo_ShapeAlgo +{ + public: + Standard_EXPORT + GEOMAlgo_FinderShapeOn1(); + Standard_EXPORT + virtual ~GEOMAlgo_FinderShapeOn1(); -Standard_EXPORT void ProcessVertices() ; + Standard_EXPORT + void SetSurface(const Handle(Geom_Surface)& aS) ; + Standard_EXPORT + void SetShapeType(const TopAbs_ShapeEnum aST) ; -Standard_EXPORT void ProcessEdges() ; + Standard_EXPORT + void SetState(const GEOMAlgo_State aSF) ; + Standard_EXPORT + void SetNbPntsMin(const Standard_Integer aNb) ; -Standard_EXPORT void ProcessFaces() ; + Standard_EXPORT + Standard_Integer NbPntsMin() const; + Standard_EXPORT + void SetNbPntsMax(const Standard_Integer aNb) ; -Standard_EXPORT void ProcessSolids() ; + Standard_EXPORT + Standard_Integer NbPntsMax() const; + Standard_EXPORT + const Handle_Geom_Surface& Surface() const; -Standard_EXPORT void InnerPoints(const TopoDS_Face& aF,GEOMAlgo_ListOfPnt& aLP) ; + Standard_EXPORT + TopAbs_ShapeEnum ShapeType() const; + Standard_EXPORT + GEOMAlgo_State State() const; -Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,GEOMAlgo_ListOfPnt& aLP) ; + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + const TopTools_ListOfShape& Shapes() const; -Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,const Standard_Integer aNbPnts,GEOMAlgo_ListOfPnt& aLP) ; + Standard_EXPORT + const GEOMAlgo_IndexedDataMapOfShapeState& MSS() const; + protected: + Standard_EXPORT + virtual void CheckData() ; -Standard_EXPORT virtual TopAbs_State GetPointState(const gp_Pnt& aP) ; + Standard_EXPORT + void ProcessVertices() ; + Standard_EXPORT + void ProcessEdges() ; - // Fields PROTECTED - // -Handle_Geom_Surface mySurface; -TopAbs_ShapeEnum myShapeType; -GEOMAlgo_State myState; -Standard_Integer myNbPntsMin; -Standard_Integer myNbPntsMax; -GeomAdaptor_Surface myGAS; -TopTools_ListOfShape myLS; -GEOMAlgo_IndexedDataMapOfShapeState myMSS; + Standard_EXPORT + void ProcessFaces() ; + Standard_EXPORT + void ProcessSolids() ; -private: + Standard_EXPORT + void InnerPoints(const TopoDS_Face& aF, + GEOMAlgo_ListOfPnt& aLP) ; - // Methods PRIVATE - // + Standard_EXPORT + void InnerPoints(const TopoDS_Edge& aE, + GEOMAlgo_ListOfPnt& aLP) ; + Standard_EXPORT + void InnerPoints(const TopoDS_Edge& aE, + const Standard_Integer aNbPnts, + GEOMAlgo_ListOfPnt& aLP) ; - // Fields PRIVATE - // + Standard_EXPORT + virtual TopAbs_State GetPointState(const gp_Pnt& aP) ; + Handle_Geom_Surface mySurface; + TopAbs_ShapeEnum myShapeType; + GEOMAlgo_State myState; + Standard_Integer myNbPntsMin; + Standard_Integer myNbPntsMax; + GeomAdaptor_Surface myGAS; + TopTools_ListOfShape myLS; + GEOMAlgo_IndexedDataMapOfShapeState myMSS; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.ixx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.ixx deleted file mode 100644 index 9b9caa61c..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.jxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.jxx deleted file mode 100644 index 196f0e706..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.jxx +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2007-2008 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_Surface_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListOfPnt_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_FinderShapeOn1_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cdl b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cdl deleted file mode 100644 index 72d79265d..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cdl +++ /dev/null @@ -1,139 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_FinderShapeOn1.cdl --- Created: Fri Mar 4 10:26:54 2005 --- Author: Peter KURNEV --- --- -class FinderShapeOn2 from GEOMAlgo - inherits ShapeAlgo from GEOMAlgo - - ---Purpose: - -uses - Pnt from gp, - ShapeEnum from TopAbs, - State from TopAbs, - Face from TopoDS, - Edge from TopoDS, - ListOfShape from TopTools, - - State from GEOMAlgo, - ListOfPnt from GEOMAlgo, - IndexedDataMapOfShapeState from GEOMAlgo, - Clsf from GEOMAlgo - ---raises - -is - Create - returns FinderShapeOn2 from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn2();" - - SetClsf(me:out; - aClsf:Clsf from GEOMAlgo); - - Clsf(me) - returns Clsf from GEOMAlgo; - ---C++: return const & - - SetShapeType(me:out; - aST:ShapeEnum from TopAbs); - - ShapeType(me) - returns ShapeEnum from TopAbs; - - SetState(me:out; - aSF:State from GEOMAlgo); - - State(me) - returns State from GEOMAlgo; - - SetNbPntsMin(me:out; - aNb:Integer from Standard); - - NbPntsMin(me) - returns Integer from Standard; - - SetNbPntsMax(me:out; - aNb:Integer from Standard); - - NbPntsMax(me) - returns Integer from Standard; - - Perform(me:out) - is redefined; - - Shapes(me) - returns ListOfShape from TopTools; - ---C++: return const & - -- - -- protected methods - -- - CheckData(me:out) - is redefined protected; - - ProcessVertices(me:out) - is protected; - - ProcessEdges(me:out) - is protected; - - ProcessFaces(me:out) - is protected; - - ProcessSolids(me:out) - is protected; - - InnerPoints(me:out; - aF :Face from TopoDS; - aLP:out ListOfPnt from GEOMAlgo) - is protected; - - InnerPoints(me:out; - aE :Edge from TopoDS; - aLP:out ListOfPnt from GEOMAlgo) - is protected; - - InnerPoints(me:out; - aE :Edge from TopoDS; - aNbPnts: Integer from Standard; - aLP:out ListOfPnt from GEOMAlgo) - is protected; - - MSS (me) - returns IndexedDataMapOfShapeState from GEOMAlgo; - ---C++:return const & - - -fields - myShapeType : ShapeEnum from TopAbs is protected; - myState : State from GEOMAlgo is protected; - myNbPntsMin : Integer from Standard is protected; - myNbPntsMax : Integer from Standard is protected; - myClsf : Clsf from GEOMAlgo is protected; - -- - myLS : ListOfShape from TopTools is protected; - -- - myMSS : IndexedDataMapOfShapeState from GEOMAlgo is protected; - -end FinderShapeOn2; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx index b7f70f544..020703409 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_FinderShapeOn1.cxx -// Created: Fri Mar 4 10:31:06 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_FinderShapeOn2.cxx +// Created: Fri Mar 4 10:31:06 2005 +// Author: Peter KURNEV +// // -#include +#include #include @@ -80,7 +81,7 @@ //======================================================================= //function : GEOMAlgo_FinderShapeOn1 -//purpose : +//purpose : //======================================================================= GEOMAlgo_FinderShapeOn2::GEOMAlgo_FinderShapeOn2() : @@ -94,14 +95,14 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_FinderShapeOn2::~GEOMAlgo_FinderShapeOn2() { } //======================================================================= //function : SetClsf -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::SetClsf(const Handle(GEOMAlgo_Clsf)& aClsf) { @@ -109,7 +110,7 @@ } //======================================================================= //function : Clsf -//purpose : +//purpose : //======================================================================= const Handle(GEOMAlgo_Clsf)& GEOMAlgo_FinderShapeOn2::Clsf() const { @@ -117,7 +118,7 @@ } //======================================================================= //function : SetShapeType -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::SetShapeType(const TopAbs_ShapeEnum aType) { @@ -125,7 +126,7 @@ } //======================================================================= //function : ShapeType -//purpose : +//purpose : //======================================================================= TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn2::ShapeType()const { @@ -133,7 +134,7 @@ } //======================================================================= //function : SetState -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::SetState(const GEOMAlgo_State aState) { @@ -141,7 +142,7 @@ } //======================================================================= //function : State -//purpose : +//purpose : //======================================================================= GEOMAlgo_State GEOMAlgo_FinderShapeOn2::State() const { @@ -149,7 +150,7 @@ } //======================================================================= //function : SetNbPntsMin -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::SetNbPntsMin(const Standard_Integer aNb) { @@ -157,7 +158,7 @@ } //======================================================================= //function : NbPntsMin -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMin()const { @@ -165,7 +166,7 @@ } //======================================================================= //function : SetNbPntsMax -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::SetNbPntsMax(const Standard_Integer aNb) { @@ -173,7 +174,7 @@ } //======================================================================= //function : NbPntsMax -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMax()const { @@ -181,7 +182,7 @@ } //======================================================================= // function: MSS -// purpose: +// purpose: //======================================================================= const GEOMAlgo_IndexedDataMapOfShapeState& GEOMAlgo_FinderShapeOn2::MSS() const { @@ -189,7 +190,7 @@ } //======================================================================= // function: Shapes -// purpose: +// purpose: //======================================================================= const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn2::Shapes() const { @@ -210,7 +211,7 @@ } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::Perform() { @@ -224,6 +225,9 @@ return; } // + // Initialize the context + GEOMAlgo_ShapeAlgo::Perform(); + // myClsf->SetTolerance(myTolerance); // // 1 @@ -254,12 +258,12 @@ } // // 4 - ProcessSolids(); + ProcessSolids(); // } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::CheckData() { @@ -285,14 +289,14 @@ } // if (!(myShapeType==TopAbs_VERTEX || - myShapeType==TopAbs_EDGE || - myShapeType==TopAbs_FACE || - myShapeType==TopAbs_SOLID)) { - myErrorStatus=12; // unallowed subshape type + myShapeType==TopAbs_EDGE || + myShapeType==TopAbs_FACE || + myShapeType==TopAbs_SOLID)) { + myErrorStatus=12; // unallowed sub-shape type return; } // - if (myState==GEOMAlgo_ST_UNKNOWN || + if (myState==GEOMAlgo_ST_UNKNOWN || myState==GEOMAlgo_ST_INOUT) { myErrorStatus=13; // unallowed state type return; @@ -300,7 +304,7 @@ } //======================================================================= //function : ProcessVertices -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::ProcessVertices() { @@ -331,7 +335,7 @@ // if (myShapeType==TopAbs_VERTEX){ if (bIsConformState) { - myMSS.Add(aV, aSt); + myMSS.Add(aV, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { @@ -341,7 +345,7 @@ } //======================================================================= //function : ProcessEdges -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::ProcessEdges() { @@ -368,11 +372,11 @@ // bIsConformState=myMSS.Contains(aV); if (!bIsConformState) { - break;// vertex has non-conformed state + break;// vertex has non-conformed state } else { - aSt=myMSS.FindFromKey(aV); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aV); + aSC.AppendState(aSt); } } // @@ -381,34 +385,34 @@ } // if (BRep_Tool::Degenerated(aE)) { - myMSS.Add(aE, aSt); + myMSS.Add(aE, aSt); continue; } // if (myState==GEOMAlgo_ST_ON) { Standard_Boolean bCanBeON; Standard_Real aT1, aT2; - Handle(Geom_Curve) aC; + Handle(Geom_Curve) aC; // aC=BRep_Tool::Curve(aE, aT1, aT2); bCanBeON=myClsf->CanBeON(aC); if(!bCanBeON) { - continue; + continue; } } // InnerPoints(aE, aLP); if (myErrorStatus) { - return; + return; } // bIsConformState=Standard_True; aIt.Initialize(aLP); for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { if (myNbPntsMax) { - if (iCnt > myNbPntsMax) { - break; - } + if (iCnt > myNbPntsMax) { + break; + } } // const gp_Pnt& aP=aIt.Value(); @@ -417,34 +421,34 @@ myClsf->Perform(); iErr=myClsf->ErrorStatus(); if (iErr) { - myErrorStatus=40; // point can not be classified - return; + myErrorStatus=40; // point can not be classified + return; } // aSt=myClsf->State(); // bIsToBreak=aSC.AppendState(aSt); if (bIsToBreak) { - break; + break; } } // - aSt=aSC.State(); + aSt=aSC.State(); // bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (myShapeType==TopAbs_EDGE) { if (bIsConformState) { - myMSS.Add(aE, aSt); + myMSS.Add(aE, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { myMSS.Add(aE, aSt); } - } // for (i=1; i<=aNb; ++i) next edge + } // for (i=1; i<=aNb; ++i) next edge } //======================================================================= //function : ProcessFaces -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::ProcessFaces() { @@ -471,7 +475,7 @@ aS=BRep_Tool::Surface(aF); bCanBeON=myClsf->CanBeON(aS); if(!bCanBeON) { - continue; + continue; } } // @@ -480,11 +484,11 @@ const TopoDS_Shape& aE=aExp.Current(); bIsConformState=myMSS.Contains(aE); if (!bIsConformState) { - break;// edge has non-conformed state + break;// edge has non-conformed state } else { - aSt=myMSS.FindFromKey(aE); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aE); + aSC.AppendState(aSt); } } // @@ -501,9 +505,9 @@ aIt.Initialize(aLP); for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { if (myNbPntsMax) { - if (iCnt > myNbPntsMax) { - break; - } + if (iCnt > myNbPntsMax) { + break; + } } // const gp_Pnt& aP=aIt.Value(); @@ -512,34 +516,34 @@ myClsf->Perform(); iErr=myClsf->ErrorStatus(); if (iErr) { - myErrorStatus=40; // point can not be classified - return; + myErrorStatus=40; // point can not be classified + return; } // aSt=myClsf->State(); // bIsToBreak=aSC.AppendState(aSt); if (bIsToBreak) { - break; + break; } } // - aSt=aSC.State(); + aSt=aSC.State(); // bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (myShapeType==TopAbs_FACE) { if (bIsConformState) { - myMSS.Add(aF, aSt); + myMSS.Add(aF, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { myMSS.Add(aF, aSt); } - }// for (i=1; i<=aNb; ++i) next face + }// for (i=1; i<=aNb; ++i) next face } //======================================================================= //function : ProcessSolids -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::ProcessSolids() { @@ -563,11 +567,11 @@ const TopoDS_Shape& aF=aMF(j); bIsConformState=myMSS.Contains(aF); if (!bIsConformState) { - break;// face has non-conformed state + break;// face has non-conformed state } else { - aSt=myMSS.FindFromKey(aF); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aF); + aSC.AppendState(aSt); } } // @@ -575,7 +579,7 @@ continue; // face has non-conformed state,skip solid } // - aSt=aSC.State(); + aSt=aSC.State(); // bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (bIsConformState) { @@ -586,10 +590,10 @@ // //======================================================================= //function : InnerPoints -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Face& aF, - GEOMAlgo_ListOfPnt& aLP) + GEOMAlgo_ListOfPnt& aLP) { myErrorStatus=0; // @@ -628,11 +632,11 @@ // aPK.SetIds(n[k], n[k+1]); if (aMPKI.IsBound(aPK)) { - Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); - ++iCntX; + Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); + ++iCntX; } else { - aMPKI.Bind(aPK, 1); + aMPKI.Bind(aPK, 1); } } } @@ -649,8 +653,8 @@ aNbMax=aPK.NbMax(); pIds=(Standard_Integer*)aPK.Key(); for (k=1; k<3; ++k) { - aNx=*(pIds+aNbMax-k); - aMBN.Add(aNx); + aNx=*(pIds+aNbMax-k); + aMBN.Add(aNx); } */ aNx=(Standard_Integer)aPK.Id(1); @@ -661,7 +665,7 @@ } } // - // inner nodes=all_nodes - boundary_nodes + // inner nodes=all_nodes - boundary_nodes j1=aNodes.Lower(); j2=aNodes.Upper(); for (j=j1; j<=j2; ++j) { @@ -673,7 +677,7 @@ // aNb=aLP.Extent(); // - if (!aNb && myNbPntsMin) { + if (!aNb && myNbPntsMin) { // try to fill it yourself Standard_Boolean bIsDone; Standard_Integer aN1, aN2; @@ -689,59 +693,59 @@ aNbLinks=aMPKI.Extent(); aIt.Initialize(aMPKI); for (; aIt.More(); aIt.Next()) { - iCnt=aIt.Value(); - if (iCnt>1) { - // take the first having occured inner link - // and discretize it - const GEOMAlgo_PassKey& aPK=aIt.Key(); - //qf - /* - aNbMax=aPK.NbMax(); - pIds=(Standard_Integer*)aPK.Key(); - aN1=*(pIds+aNbMax-1); - aN2=*(pIds+aNbMax-2); - */ - // - aN1=(Standard_Integer)aPK.Id(1); - aN2=(Standard_Integer)aPK.Id(2); - //qt - aP1=aNodes(aN1).Transformed(aTrsf); - aP2=aNodes(aN2).Transformed(aTrsf); - // - if (aType==GeomAbs_Cylinder) { - Standard_Real aTolSM; - gp_Cylinder aCyl; - // - aTolSM=1.523e-6;//~1.-cos(0.1 deg) - aCyl=aGAS.Cylinder(); - if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { - continue; - } - } - // - BRepLib_MakeEdge aBME(aP1, aP2); - bIsDone=aBME.IsDone(); - if (!bIsDone) { - myErrorStatus=30; //can not obtain the line fron the link - return; - } - // - const TopoDS_Shape& aSx=aBME.Shape(); - const TopoDS_Edge& aE=TopoDS::Edge(aSx); - // - InnerPoints(aE, myNbPntsMin, aLP); - break; - }// if (iCnt>1) + iCnt=aIt.Value(); + if (iCnt>1) { + // take the first having occured inner link + // and discretize it + const GEOMAlgo_PassKey& aPK=aIt.Key(); + //qf + /* + aNbMax=aPK.NbMax(); + pIds=(Standard_Integer*)aPK.Key(); + aN1=*(pIds+aNbMax-1); + aN2=*(pIds+aNbMax-2); + */ + // + aN1=(Standard_Integer)aPK.Id(1); + aN2=(Standard_Integer)aPK.Id(2); + //qt + aP1=aNodes(aN1).Transformed(aTrsf); + aP2=aNodes(aN2).Transformed(aTrsf); + // + if (aType==GeomAbs_Cylinder) { + Standard_Real aTolSM; + gp_Cylinder aCyl; + // + aTolSM=1.523e-6;//~1.-cos(0.1 deg) + aCyl=aGAS.Cylinder(); + if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { + continue; + } + } + // + BRepLib_MakeEdge aBME(aP1, aP2); + bIsDone=aBME.IsDone(); + if (!bIsDone) { + myErrorStatus=30; //can not obtain the line fron the link + return; + } + // + const TopoDS_Shape& aSx=aBME.Shape(); + const TopoDS_Edge& aE=TopoDS::Edge(aSx); + // + InnerPoints(aE, myNbPntsMin, aLP); + break; + }// if (iCnt>1) }// for (; aIt.More(); aIt.Next()) - }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) - }// if (!aNb && myNbPntsMin) { + }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) + }// if (!aNb && myNbPntsMin) { } //======================================================================= //function : InnerPoints -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE, - GEOMAlgo_ListOfPnt& aLP) + GEOMAlgo_ListOfPnt& aLP) { myErrorStatus=0; // @@ -786,7 +790,7 @@ } // aNb=aLP.Extent(); - if (!aNb && myNbPntsMin) { + if (!aNb && myNbPntsMin) { // try to fill it yourself InnerPoints(aE, myNbPntsMin, aLP); aNb=aLP.Extent(); @@ -794,11 +798,11 @@ } //======================================================================= //function : InnerPoints -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE, - const Standard_Integer aNbPntsMin, - GEOMAlgo_ListOfPnt& aLP) + const Standard_Integer aNbPntsMin, + GEOMAlgo_ListOfPnt& aLP) { // try to fill it yourself Standard_Boolean bInf1, bInf2; @@ -832,8 +836,8 @@ // // 10 -myClsf=NULL // 11 -myShape=NULL -// 12 -unallowed type of subshapes -// 13 -unallowed state +// 12 -unallowed type of sub-shapes +// 13 -unallowed state // 15 -unallowed surface type // 20- no triangulation found // 30- can not obtain the line from the link diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx index 7eaa024a8..a70d04e2c 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.hxx @@ -1,189 +1,136 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_FinderShapeOn2.hxx +// Created: Fri Mar 4 10:31:06 2005 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_FinderShapeOn2_HeaderFile #define _GEOMAlgo_FinderShapeOn2_HeaderFile -#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#include #include -#endif -#ifndef _GEOMAlgo_State_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile +//#include +#include #include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile #include -#endif -#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #include -#endif -class GEOMAlgo_Clsf; -class TopTools_ListOfShape; -class TopoDS_Face; -class GEOMAlgo_ListOfPnt; -class TopoDS_Edge; -class GEOMAlgo_IndexedDataMapOfShapeState; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_FinderShapeOn2 : public GEOMAlgo_ShapeAlgo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_FinderShapeOn2(); -Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn2(); - - -Standard_EXPORT void SetClsf(const Handle(GEOMAlgo_Clsf)& aClsf) ; - - -Standard_EXPORT const Handle_GEOMAlgo_Clsf& Clsf() const; - - -Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ; - - -Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; - +#include +#include +#include +#include -Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ; +//======================================================================= +//function : GEOMAlgo_FinderShapeOn2 +//purpose : +//======================================================================= +class GEOMAlgo_FinderShapeOn2 : public GEOMAlgo_ShapeAlgo +{ + public: + Standard_EXPORT + GEOMAlgo_FinderShapeOn2(); + Standard_EXPORT + virtual ~GEOMAlgo_FinderShapeOn2(); -Standard_EXPORT GEOMAlgo_State State() const; + Standard_EXPORT + void SetClsf(const Handle(GEOMAlgo_Clsf)& aClsf) ; + Standard_EXPORT + const Handle_GEOMAlgo_Clsf& Clsf() const; -Standard_EXPORT void SetNbPntsMin(const Standard_Integer aNb) ; + Standard_EXPORT + void SetShapeType(const TopAbs_ShapeEnum aST) ; + Standard_EXPORT + TopAbs_ShapeEnum ShapeType() const; -Standard_EXPORT Standard_Integer NbPntsMin() const; + Standard_EXPORT + void SetState(const GEOMAlgo_State aSF) ; + Standard_EXPORT + GEOMAlgo_State State() const; -Standard_EXPORT void SetNbPntsMax(const Standard_Integer aNb) ; + Standard_EXPORT + void SetNbPntsMin(const Standard_Integer aNb) ; + Standard_EXPORT + Standard_Integer NbPntsMin() const; -Standard_EXPORT Standard_Integer NbPntsMax() const; - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT const TopTools_ListOfShape& Shapes() const; - - -Standard_EXPORT const GEOMAlgo_IndexedDataMapOfShapeState& MSS() const; + Standard_EXPORT + void SetNbPntsMax(const Standard_Integer aNb) ; + Standard_EXPORT + Standard_Integer NbPntsMax() const; + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + const TopTools_ListOfShape& Shapes() const; + Standard_EXPORT + const GEOMAlgo_IndexedDataMapOfShapeState& MSS() const; protected: + Standard_EXPORT + virtual void CheckData() ; - // Methods PROTECTED - // - - -Standard_EXPORT virtual void CheckData() ; - - -Standard_EXPORT void ProcessVertices() ; - - -Standard_EXPORT void ProcessEdges() ; - - -Standard_EXPORT void ProcessFaces() ; - + Standard_EXPORT + void ProcessVertices() ; -Standard_EXPORT void ProcessSolids() ; + Standard_EXPORT + void ProcessEdges() ; + Standard_EXPORT + void ProcessFaces() ; -Standard_EXPORT void InnerPoints(const TopoDS_Face& aF,GEOMAlgo_ListOfPnt& aLP) ; + Standard_EXPORT + void ProcessSolids() ; + Standard_EXPORT + void InnerPoints(const TopoDS_Face& aF, + GEOMAlgo_ListOfPnt& aLP) ; -Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,GEOMAlgo_ListOfPnt& aLP) ; + Standard_EXPORT + void InnerPoints(const TopoDS_Edge& aE, + GEOMAlgo_ListOfPnt& aLP) ; - -Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,const Standard_Integer aNbPnts,GEOMAlgo_ListOfPnt& aLP) ; - - - // Fields PROTECTED - // -TopAbs_ShapeEnum myShapeType; -GEOMAlgo_State myState; -Standard_Integer myNbPntsMin; -Standard_Integer myNbPntsMax; -Handle_GEOMAlgo_Clsf myClsf; -TopTools_ListOfShape myLS; -GEOMAlgo_IndexedDataMapOfShapeState myMSS; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + void InnerPoints(const TopoDS_Edge& aE, + const Standard_Integer aNbPnts, + GEOMAlgo_ListOfPnt& aLP) ; + TopAbs_ShapeEnum myShapeType; + GEOMAlgo_State myState; + Standard_Integer myNbPntsMin; + Standard_Integer myNbPntsMax; + Handle_GEOMAlgo_Clsf myClsf; + TopTools_ListOfShape myLS; + GEOMAlgo_IndexedDataMapOfShapeState myMSS; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.ixx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.ixx deleted file mode 100644 index d9cef81ac..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.jxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.jxx deleted file mode 100644 index 448209129..000000000 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.jxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_Clsf_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListOfPnt_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_FinderShapeOn2_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx index 3d32d628b..2c4d0afea 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMAlgo_FinderShapeOnQuad.cxx // Created : Mon Oct 17 17:31:45 2005 // Author : Edward AGAPOV (eap) @@ -88,7 +89,7 @@ GEOMAlgo_FinderShapeOnQuad::GEOMAlgo_FinderShapeOnQuad(const gp_Pnt & theTopLeft //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_FinderShapeOnQuad::CheckData() @@ -100,10 +101,10 @@ void GEOMAlgo_FinderShapeOnQuad::CheckData() //======================================================================= //function : GetPointState -//purpose : +//purpose : //======================================================================= -TopAbs_State GEOMAlgo_FinderShapeOnQuad::GetPointState(const gp_Pnt& aP) +TopAbs_State GEOMAlgo_FinderShapeOnQuad::GetPointState(const gp_Pnt& aP) { // Return IN if aP has TopAbs_IN with all sides. // In the case of concave quadrangle, return IN if diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx index 18fca9a53..e2239123b 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMAlgo_FinderShapeOnQuad.hxx // Created : Mon Oct 17 17:15:59 2005 // Author : Edward AGAPOV (eap) diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlace.cxx b/src/GEOMAlgo/GEOMAlgo_GetInPlace.cxx new file mode 100644 index 000000000..852f600e5 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlace.cxx @@ -0,0 +1,1151 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_GetInPlace.cxx +// Created: +// Author: Peter KURNEV + +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + + +#include +#include + + +static + void MapBRepShapes(const TopoDS_Shape& aS, + TopTools_IndexedMapOfShape& aM); + + +//======================================================================= +//function : GEOMAlgo_GetInPlace +//purpose : +//======================================================================= +GEOMAlgo_GetInPlace::GEOMAlgo_GetInPlace() +: + GEOMAlgo_GluerAlgo(), + GEOMAlgo_Algo() +{ + myTolerance=0.0001; + myTolMass=0.0001; + myTolCG=0.0001; + myFound=Standard_False; + myCheckGeometry=Standard_True; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_GetInPlace::~GEOMAlgo_GetInPlace() +{ +} +//======================================================================= +//function : SetTolMass +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::SetTolMass(const Standard_Real theTol) +{ + myTolMass=theTol; +} +//======================================================================= +//function : TolMass +//purpose : +//======================================================================= +Standard_Real GEOMAlgo_GetInPlace::TolMass()const +{ + return myTolMass; +} +//======================================================================= +//function : SetTolCG +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::SetTolCG(const Standard_Real theTol) +{ + myTolCG=theTol; +} +//======================================================================= +//function : TolCG +//purpose : +//======================================================================= +Standard_Real GEOMAlgo_GetInPlace::TolCG()const +{ + return myTolCG; +} +//======================================================================= +//function : IsFound +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_GetInPlace::IsFound()const +{ + return myFound; +} +//======================================================================= +//function : SetShapeWhere +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::SetShapeWhere(const TopoDS_Shape& theShape) +{ + myShapeWhere=theShape; +} +//======================================================================= +//function : ShapeWhere +//purpose : +//======================================================================= +const TopoDS_Shape& GEOMAlgo_GetInPlace::ShapeWhere()const +{ + return myShapeWhere; +} +//======================================================================= +//function : ShapesIn +//purpose : +//======================================================================= +const GEOMAlgo_DataMapOfShapeMapOfShape& GEOMAlgo_GetInPlace::ShapesIn()const +{ + return myShapesIn; +} +//======================================================================= +//function : ShapesOn +//purpose : +//======================================================================= +const GEOMAlgo_DataMapOfShapeMapOfShape& GEOMAlgo_GetInPlace::ShapesOn()const +{ + return myShapesOn; +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::Clear() +{ + myErrorStatus=0; + myWarningStatus=0; + // + GEOMAlgo_GluerAlgo::Clear(); + myIterator.Clear(); + myShapesIn.Clear(); + myShapesOn.Clear(); + myMapShapePnt.Clear(); +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::Perform() +{ + myFound=Standard_False; + myErrorStatus=0; + myWarningStatus=0; + // + Clear(); + if (myErrorStatus) { + return; + } + // + CheckData(); + if (myErrorStatus) { + return; + } + // + // Initialize the context + GEOMAlgo_GluerAlgo::Perform(); + // + Intersect(); + if (myErrorStatus) { + return; + } + // + PerformVV(); + if (myErrorStatus) { + return; + } + // + FillEdgesOn(); + if (myErrorStatus) { + return; + } + // + PerformVE(); + if (myErrorStatus) { + return; + } + // + PerformEE(); + if (myErrorStatus) { + return; + } + // + PerformVF(); + if (myErrorStatus) { + return; + } + // + FillFacesOn(); + if (myErrorStatus) { + return; + } + // + PerformEF(); + if (myErrorStatus) { + return; + } + // + PerformFF(); + if (myErrorStatus) { + return; + } + // + FillSolidsOn(); + if (myErrorStatus) { + return; + } + // + PerformZF(); + if (myErrorStatus) { + return; + } + // + PerformZZ(); + if (myErrorStatus) { + return; + } + // + FillImages(); + if (myErrorStatus) { + return; + } + // + CheckGProps(); + if (myErrorStatus) { + return; + } +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::CheckData() +{ + myErrorStatus=0; + myWarningStatus=0; + // + if (myArgument.IsNull()) { + myErrorStatus=2; + return; + } + // + if (myShapeWhere.IsNull()) { + myErrorStatus=3; + return; + } +} +//======================================================================= +//function : Intersect +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::Intersect() +{ + Standard_Integer i, j, aNbS1, aNbS2, aNbSD; + TColStd_ListIteratorOfListOfInteger aItLI; + TopTools_IndexedMapOfShape aMS1, aMS2; + TopTools_DataMapOfShapeListOfShape aDMSLS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; + TopTools_ListIteratorOfListOfShape aItLS; + NMTTools_CoupleOfShape aCS; + // + NMTDS_BoxBndTreeSelector aSelector; + NMTDS_BoxBndTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Clear(); + // + MapBRepShapes(myArgument, aMS1); + aNbS1=aMS1.Extent(); + for (i=1; i<=aNbS1; ++i) { + Bnd_Box aBox1; + // + const TopoDS_Shape& aS1=aMS1(i); + BRepBndLib::Add(aS1, aBox1); + //modified by NIZNHY-PKV Fri Jun 10 08:20:03 2011f + //aBox1.SetGap(myTolerance); + aBox1.Enlarge(myTolerance); + //modified by NIZNHY-PKV Fri Jun 10 08:20:06 2011t + // + aTreeFiller.Add(i, aBox1); + } + // + aTreeFiller.Fill(); + // + MapBRepShapes(myShapeWhere, aMS2); + aNbS2=aMS2.Extent(); + for (j=1; j<=aNbS2; ++j) { + Bnd_Box aBox2; + // + const TopoDS_Shape& aS2=aMS2(j); + BRepBndLib::Add(aS2, aBox2); + //modified by NIZNHY-PKV Fri Jun 10 08:20:23 2011f + //aBox2.SetGap(myTolerance); + aBox2.Enlarge(myTolerance); + //modified by NIZNHY-PKV Fri Jun 10 08:20:25 2011t + // + aSelector.Clear(); + aSelector.SetBox(aBox2); + aNbSD=aBBTree.Select(aSelector); + if (!aNbSD) { + continue; // it should not be + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + aItLI.Initialize(aLI); + for (; aItLI.More(); aItLI.Next()) { + i=aItLI.Value(); + const TopoDS_Shape& aS1=aMS1(i); + // + if (aDMSLS.IsBound(aS1)) { + TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aS1); + aLS.Append(aS2); + } + else { + TopTools_ListOfShape aLS; + // + aLS.Append(aS2); + aDMSLS.Bind(aS1, aLS); + } + } + }// for (j=1; j<=aNbS2; ++j) { + // + aItDMSLS.Initialize(aDMSLS); + for (; aItDMSLS.More(); aItDMSLS.Next()) { + const TopoDS_Shape& aS1=aItDMSLS.Key(); + const TopTools_ListOfShape& aLS2=aItDMSLS.Value(); + aCS.SetShape1(aS1); + aItLS.Initialize(aLS2); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aS2=aItLS.Value(); + aCS.SetShape2(aS2); + myIterator.AppendPair(aCS); + } + } +} +//======================================================================= +//function : PerformVV +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformVV() +{ + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Initialize(TopAbs_VERTEX, TopAbs_VERTEX); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aV1=aCS.Shape1(); + const TopoDS_Shape& aV2=aCS.Shape2(); + // + FillShapesOn(aV1, aV2); + } +} +//======================================================================= +//function : FillEdgesOn +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::FillEdgesOn() +{ + Standard_Integer i, aNbE; + TopoDS_Iterator aIt; + TopTools_IndexedMapOfShape aME; + TopTools_MapIteratorOfMapOfShape aItMS; + // + TopExp::MapShapes(myArgument, TopAbs_EDGE, aME); + aNbE=aME.Extent(); + for (i=1; i<=aNbE; ++i) { + const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(i)); + if (BRep_Tool::Degenerated(aE1)) { + continue; + } + // + aIt.Initialize(aE1); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aV1=aIt.Value(); + if (myShapesOn.IsBound(aV1)) { + const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aV1); + //aNbSOn=aMSOn.Extent(); + aItMS.Initialize(aMSOn); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aV2=aItMS.Key(); + FillShapesOn(aE1, aV2); + } + } + } + } +} +//======================================================================= +//function : PerformVE +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformVE() +{ + Standard_Boolean bFound; + // + myErrorStatus=0; + myWarningStatus=0; + // + // 2. Fill Shapes In + myIterator.Initialize(TopAbs_EDGE, TopAbs_VERTEX); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aE1=aCS.Shape1(); + const TopoDS_Shape& aV2=aCS.Shape2(); + // + if (myShapesOn.IsBound(aE1)) { + const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aE1); + if (aMSOn.Contains(aV2)) { + continue; + } + } + // + bFound=CheckCoincidence(aE1, aV2); + if (myErrorStatus) { + return; + } + if (bFound) { + FillShapesIn(aE1, aV2); + } + } +} +//======================================================================= +//function : PerformEE +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformEE() +{ + Standard_Boolean bHasOn, bHasIn, bFound; + TopoDS_Iterator aIt; + TopTools_MapOfShape aMSX; + // + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Initialize(TopAbs_EDGE, TopAbs_EDGE); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aE1=aCS.Shape1(); + const TopoDS_Shape& aE2=aCS.Shape2(); + // + bHasOn=myShapesOn.IsBound(aE1); + bHasIn=myShapesIn.IsBound(aE1); + const TopTools_MapOfShape& aMSOn=(bHasOn) ? myShapesOn.Find(aE1) : aMSX; + const TopTools_MapOfShape& aMSIn=(bHasIn) ? myShapesIn.Find(aE1) : aMSX; + // + bFound=Standard_True; + aIt.Initialize(aE2); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aV2=aIt.Value(); + if (!(aMSOn.Contains(aV2) || aMSIn.Contains(aV2))) { + bFound=!bFound; + break; + } + } + if (!bFound) { + continue; + } + // + bFound=CheckCoincidence(aE1, aE2); + if (myErrorStatus) { + return; + } + if (bFound) { + FillShapesIn(aE1, aE2); + } + } +} +//======================================================================= +//function : PerformVF +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformVF() +{ + Standard_Boolean bHasOn, bHasIn, bFound; + Standard_Integer i, aNbE; + TopTools_MapOfShape aMSX; + TopTools_IndexedMapOfShape aME; + // + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Initialize(TopAbs_FACE, TopAbs_VERTEX); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aF1=aCS.Shape1(); + const TopoDS_Shape& aV2=aCS.Shape2(); + // + aME.Clear(); + TopExp::MapShapes(aF1, TopAbs_EDGE, aME); + // + bFound=Standard_False; + aNbE=aME.Extent(); + for (i=1; i<=aNbE; ++i) { + const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(i)); + if (BRep_Tool::Degenerated(aE1)) { + continue; + } + // + bHasOn=myShapesOn.IsBound(aE1); + bHasIn=myShapesIn.IsBound(aE1); + const TopTools_MapOfShape& aMSOn=(bHasOn) ? myShapesOn.Find(aE1) : aMSX; + const TopTools_MapOfShape& aMSIn=(bHasIn) ? myShapesIn.Find(aE1) : aMSX; + bFound= (aMSOn.Contains(aV2) || aMSIn.Contains(aV2)); + if (bFound) { + break; + } + } + // + if (bFound) { + continue; + } + // + bFound=CheckCoincidence(aF1, aV2); + if (myErrorStatus) { + return; + } + if (bFound) { + FillShapesIn(aF1, aV2); + } + } +} +//======================================================================= +//function : FillFacesOn +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::FillFacesOn() +{ + Standard_Integer i, j, aNbF, aNbE; + TopoDS_Iterator aIt; + TopTools_IndexedMapOfShape aMF, aME; + TopTools_MapIteratorOfMapOfShape aItMS; + // + TopExp::MapShapes(myArgument, TopAbs_FACE, aMF); + aNbF=aMF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Face& aF1=*((TopoDS_Face*)&aMF(i)); + // + aME.Clear(); + TopExp::MapShapes(aF1, TopAbs_EDGE, aME); + aNbE=aME.Extent(); + for (j=1; j<=aNbE; ++j) { + const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(j)); + if (BRep_Tool::Degenerated(aE1)) { + continue; + } + // + if (myShapesOn.IsBound(aE1)) { + const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aE1); + aItMS.Initialize(aMSOn); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aS2=aItMS.Key(); + FillShapesOn(aF1, aS2); + } + } + // + if (myShapesIn.IsBound(aE1)) { + const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aE1); + aItMS.Initialize(aMSIn); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aS2=aItMS.Key(); + FillShapesOn(aF1, aS2); + } + } + }//for (j=1; j<=aNbE; ++j) { + }//for (i=1; i<=aNbF; ++i) { +} +//======================================================================= +//function : PerformEF +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformEF() +{ + Standard_Boolean bFound, bHasOnF, bHasInF; + TopoDS_Iterator aIt; + TopTools_MapOfShape aMSX; + // + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Initialize(TopAbs_FACE, TopAbs_EDGE); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aF1=aCS.Shape1(); + const TopoDS_Shape& aE2=aCS.Shape2(); + // + // 1. + bHasOnF=myShapesOn.IsBound(aF1); + const TopTools_MapOfShape& aMSOnF=(bHasOnF) ? myShapesOn.Find(aF1) : aMSX; + bFound=aMSOnF.Contains(aE2); + if (bFound) { + continue; + } + // + // 2. + bHasInF=myShapesIn.IsBound(aF1); + const TopTools_MapOfShape& aMSInF=(bHasInF) ? myShapesIn.Find(aF1) : aMSX; + // + aIt.Initialize(aE2); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aV2=aIt.Value(); + bFound=(aMSOnF.Contains(aV2) || aMSInF.Contains(aV2)); + if (!bFound) { + break; + } + } + if (!bFound) { + continue; + } + //------------------------------ + bFound=CheckCoincidence(aF1, aE2); + if (myErrorStatus) { + return; + } + if (bFound) { + FillShapesIn(aF1, aE2); + } + } +} +//======================================================================= +//function : PerformFF +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformFF() +{ + Standard_Boolean bFound, bHasOnF, bHasInF; + Standard_Integer i, aNbS2; + TopTools_MapOfShape aMSX; + TopTools_IndexedMapOfShape aMS2; + // + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Initialize(TopAbs_FACE, TopAbs_FACE); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aF1=aCS.Shape1(); + const TopoDS_Shape& aF2=aCS.Shape2(); + // + bHasOnF=myShapesOn.IsBound(aF1); + const TopTools_MapOfShape& aMSOnF=(bHasOnF) ? myShapesOn.Find(aF1) : aMSX; + // + bHasInF=myShapesIn.IsBound(aF1); + const TopTools_MapOfShape& aMSInF=(bHasInF) ? myShapesIn.Find(aF1) : aMSX; + // + aMS2.Clear(); + MapBRepShapes(aF2, aMS2); + // + bFound=Standard_False; + aNbS2=aMS2.Extent(); + for (i=1; i<=aNbS2; ++i) { + const TopoDS_Shape& aS2=aMS2(i); + if (aS2.IsSame(aF2)) { + continue; + } + bFound=(aMSOnF.Contains(aS2) || aMSInF.Contains(aS2)); + if (!bFound) { + break; + } + } + if (!bFound) { + continue; + } + // + bFound=CheckCoincidence(aF1, aF2); + if (myErrorStatus) { + return; + } + if (bFound) { + FillShapesIn(aF1, aF2); + } + } +} +//======================================================================= +//function : FillSolidsOn +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::FillSolidsOn() +{ + Standard_Integer i, j, aNbS, aNbF; + TopTools_IndexedMapOfShape aMS, aMF; + TopTools_MapIteratorOfMapOfShape aItMS; + // + TopExp::MapShapes(myArgument, TopAbs_SOLID, aMS); + // + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSD1=aMS(i); + // + aMF.Clear(); + TopExp::MapShapes(aSD1, TopAbs_FACE, aMF); + aNbF=aMF.Extent(); + for (j=1; j<=aNbF; ++j) { + const TopoDS_Shape& aF1=aMF(j); + // + if (myShapesOn.IsBound(aF1)) { + const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aF1); + aItMS.Initialize(aMSOn); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aS2=aItMS.Key(); + FillShapesOn(aSD1, aS2); + } + } + // + if (myShapesIn.IsBound(aF1)) { + const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aF1); + aItMS.Initialize(aMSIn); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aS2=aItMS.Key(); + FillShapesOn(aSD1, aS2); + } + } + }//for (j=1; j<=aNbF; ++j) { + }//for (i=1; i<=aNbS; ++i) { +} +//======================================================================= +//function : PerformZF +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformZF() +{ + Standard_Boolean bFound, bHasOnF; + TopTools_MapOfShape aMSX; + // + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Initialize(TopAbs_SOLID, TopAbs_FACE); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aSo1=aCS.Shape1(); + const TopoDS_Shape& aF2=aCS.Shape2(); + // + bHasOnF=myShapesOn.IsBound(aSo1); + const TopTools_MapOfShape& aMSOnF=(bHasOnF) ? myShapesOn.Find(aSo1) : aMSX; + bFound=aMSOnF.Contains(aF2); + if (bFound) { + continue; + } + //------------------------------ + bFound=CheckCoincidence(aSo1, aF2); + if (myErrorStatus) { + return; + } + if (bFound) { + FillShapesIn(aSo1, aF2); + } + } +} +//======================================================================= +//function : PerformZZ +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::PerformZZ() +{ + Standard_Boolean bFound, bHasOn, bHasIn; + Standard_Integer i, aNbS2, iCntOn, iCntIn, iCntOut; + TopTools_MapOfShape aMSX; + TopTools_IndexedMapOfShape aMS2; + // + myErrorStatus=0; + myWarningStatus=0; + // + myIterator.Initialize(TopAbs_SOLID, TopAbs_SOLID); + for (; myIterator.More(); myIterator.Next()) { + const NMTTools_CoupleOfShape& aCS=myIterator.Value(); + const TopoDS_Shape& aSo1=aCS.Shape1(); + const TopoDS_Shape& aSo2=aCS.Shape2(); + // + bHasOn=myShapesOn.IsBound(aSo1); + const TopTools_MapOfShape& aMSOn=(bHasOn) ? myShapesOn.Find(aSo1) : aMSX; + // + bHasIn=myShapesIn.IsBound(aSo1); + const TopTools_MapOfShape& aMSIn=(bHasIn) ? myShapesIn.Find(aSo1) : aMSX; + // + aMS2.Clear(); + TopExp::MapShapes(aSo2, TopAbs_FACE, aMS2); + // + iCntIn=0; + iCntOn=0; + iCntOut=0; + bFound=Standard_False; + aNbS2=aMS2.Extent(); + for (i=1; i<=aNbS2; ++i) { + const TopoDS_Shape& aF2=aMS2(i); + // + if (aMSIn.Contains(aF2)) { + ++iCntIn; + bFound=Standard_True; + break; + } + else if (!aMSOn.Contains(aF2)) { + ++iCntOut; + bFound=Standard_False;// out + break; + } + else { + ++iCntOn; //on + } + } + // + if (!bFound && iCntOut) { + continue; + } + // + if (!iCntIn) { + bFound=CheckCoincidence(aSo1, aSo2); + if (myErrorStatus) { + return; + } + } + if (bFound) { + FillShapesIn(aSo1, aSo2); + } + }// for (; myIterator.More(); myIterator.Next()) { +} +//======================================================================= +//function : FillImages +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::FillImages() +{ + Standard_Integer i, aNbS, aNbSx, aNbSi; + TopAbs_ShapeEnum aType; + TopoDS_Iterator aIt; + TopTools_ListOfShape aLSx; + TopTools_ListIteratorOfListOfShape aItLS; + TopTools_IndexedMapOfShape aMS; + TopTools_MapIteratorOfMapOfShape aItMS; + // + myErrorStatus=0; + myWarningStatus=0; + // + myImages.Clear(); + // + // 1. Vertices + aMS.Clear(); + TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aV=aMS(i); + if (myShapesOn.IsBound(aV)) { + const TopTools_MapOfShape& aMSx=myShapesOn.Find(aV); + aNbSx=aMSx.Extent(); + // + aLSx.Clear(); + aItMS.Initialize(aMSx); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aVx=aItMS.Key(); + aLSx.Append(aVx); + } + // + myImages.Bind(aV, aLSx); + } + } + // + // 2. Edges + aMS.Clear(); + TopExp::MapShapes(myArgument, TopAbs_EDGE, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aE=aMS(i); + if (myShapesIn.IsBound(aE)) { + const TopTools_MapOfShape& aMSx=myShapesIn.Find(aE); + aNbSx=aMSx.Extent(); + // + aLSx.Clear(); + aItMS.Initialize(aMSx); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aEx=aItMS.Key(); + aType=aEx.ShapeType(); + if (aType==TopAbs_EDGE){ + aLSx.Append(aEx); + } + } + // + myImages.Bind(aE, aLSx); + } + } + // + // 3. Wires + aMS.Clear(); + TopExp::MapShapes(myArgument, TopAbs_WIRE, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aW=aMS(i); + aLSx.Clear(); + aIt.Initialize(aW); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE=aIt.Value(); + if (myImages.IsBound(aE)) { + const TopTools_ListOfShape& aLSi=myImages.Find(aE); + aNbSi=aLSi.Extent(); + // + aItLS.Initialize(aLSi); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aEi=aItLS.Value(); + aLSx.Append(aEi); + } + } + } + myImages.Bind(aW, aLSx); + } + // + // 4. Faces + aMS.Clear(); + TopExp::MapShapes(myArgument, TopAbs_FACE, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aF=aMS(i); + if (myShapesIn.IsBound(aF)) { + const TopTools_MapOfShape& aMSx=myShapesIn.Find(aF); + aNbSx=aMSx.Extent(); + // + aLSx.Clear(); + aItMS.Initialize(aMSx); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aFx=aItMS.Key(); + aType=aFx.ShapeType(); + if (aType==TopAbs_FACE){ + aLSx.Append(aFx); + } + } + // + myImages.Bind(aF, aLSx); + } + } + // + // 5. Shells + aMS.Clear(); + TopExp::MapShapes(myArgument, TopAbs_SHELL, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSh=aMS(i); + aLSx.Clear(); + aIt.Initialize(aSh); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + if (myImages.IsBound(aF)) { + const TopTools_ListOfShape& aLSi=myImages.Find(aF); + aNbSi=aLSi.Extent(); + // + aItLS.Initialize(aLSi); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aFi=aItLS.Value(); + aLSx.Append(aFi); + } + } + } + myImages.Bind(aSh, aLSx); + } + // + // 6. Solids + aMS.Clear(); + TopExp::MapShapes(myArgument, TopAbs_SOLID, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aZ=aMS(i); + if (myShapesIn.IsBound(aZ)) { + const TopTools_MapOfShape& aMSx=myShapesIn.Find(aZ); + aNbSx=aMSx.Extent(); + // + aLSx.Clear(); + aItMS.Initialize(aMSx); + for (; aItMS.More(); aItMS.Next()) { + const TopoDS_Shape& aZx=aItMS.Key(); + aType=aZx.ShapeType(); + if (aType==TopAbs_SOLID){ + aLSx.Append(aZx); + } + } + // + myImages.Bind(aZ, aLSx); + } + } + // + // 7. CompSolids + aMS.Clear(); + TopExp::MapShapes(myArgument, TopAbs_COMPSOLID, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aCs=aMS(i); + aLSx.Clear(); + aIt.Initialize(aCs); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aZ=aIt.Value(); + if (myImages.IsBound(aZ)) { + const TopTools_ListOfShape& aLSi=myImages.Find(aZ); + aNbSi=aLSi.Extent(); + // + aItLS.Initialize(aLSi); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aZi=aItLS.Value(); + aLSx.Append(aZi); + } + } + } + myImages.Bind(aCs, aLSx); + } + // + // 8. Compounds + aType=myArgument.ShapeType(); + if (aType==TopAbs_COMPOUND) { + FillImagesCompound(myArgument); + } +} +//======================================================================= +//function : FillImagesCompound +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::FillImagesCompound(const TopoDS_Shape& aS) +{ + TopAbs_ShapeEnum aType; + TopoDS_Iterator aIt; + TopTools_ListOfShape aLSx; + TopTools_ListIteratorOfListOfShape aItLS; + // + aIt.Initialize(aS); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSx=aIt.Value(); + aType=aSx.ShapeType(); + // + if (aType==TopAbs_COMPOUND) { + FillImagesCompound(aSx); + } + // + if (myImages.IsBound(aSx)) { + const TopTools_ListOfShape& aLSi=myImages.Find(aSx); + aItLS.Initialize(aLSi); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aSi=aItLS.Value(); + aLSx.Append(aSi); + } + } + } + myImages.Bind(aS, aLSx); +} + +//======================================================================= +//function : FillShapesIn +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::FillShapesIn(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) +{ + if (myShapesIn.IsBound(aS1)) { + TopTools_MapOfShape& aMS=myShapesIn.ChangeFind(aS1); + aMS.Add(aS2); + } + else { + TopTools_MapOfShape aMS; + // + aMS.Add(aS2); + myShapesIn.Bind(aS1, aMS); + } +} +//======================================================================= +//function : FillShapesOn +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::FillShapesOn(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) +{ + if (myShapesOn.IsBound(aS1)) { + TopTools_MapOfShape& aMS=myShapesOn.ChangeFind(aS1); + aMS.Add(aS2); + } + else { + TopTools_MapOfShape aMS; + // + aMS.Add(aS2); + myShapesOn.Bind(aS1, aMS); + } +} +//======================================================================= +//function : MapBRepShapes +//purpose : +//======================================================================= +void MapBRepShapes(const TopoDS_Shape& aS, + TopTools_IndexedMapOfShape& aM) +{ + Standard_Boolean bDegenerated; + TopAbs_ShapeEnum aType; + TopoDS_Iterator aIt; + // + aType=aS.ShapeType(); + if (aType==TopAbs_VERTEX || aType==TopAbs_EDGE || + aType==TopAbs_FACE || aType==TopAbs_SOLID) { + bDegenerated=Standard_False; + if (aType==TopAbs_EDGE) { + TopoDS_Edge *pE=(TopoDS_Edge*)&aS; + bDegenerated=BRep_Tool::Degenerated(*pE); + } + if (!bDegenerated) { + aM.Add(aS); + } + } + // + aIt.Initialize(aS); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSx=aIt.Value(); + aType=aSx.ShapeType(); + MapBRepShapes(aSx, aM); + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlace.hxx b/src/GEOMAlgo/GEOMAlgo_GetInPlace.hxx new file mode 100644 index 000000000..a8ff2a558 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlace.hxx @@ -0,0 +1,324 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_GetInPlace.hxx +// Created: +// Author: Peter KURNEV + +#ifndef _GEOMAlgo_GetInPlace_HeaderFile +#define _GEOMAlgo_GetInPlace_HeaderFile + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +//======================================================================= +/** + * The implementation of iterator of intersected shapes + * for Get In Place Algorithm. + * The intersection is in terms of 3D bounding boxes. + */ +//======================================================================= +//class : GEOMAlgo_GetInPlaceIterator +//purpose : +//======================================================================= +class GEOMAlgo_GetInPlaceIterator { + public: + /** + * Constructor. + */ + //Standard_EXPORT + GEOMAlgo_GetInPlaceIterator(); + + /** + * Destructor. + */ + //Standard_EXPORT + virtual ~GEOMAlgo_GetInPlaceIterator(); + + /** + * Clear the internal content. + */ + //Standard_EXPORT + void Clear() ; + + /** + * Append the pair of intersected shapes. + * @param theCS + * The pair of intersected shapes. + */ + //Standard_EXPORT + void AppendPair(const NMTTools_CoupleOfShape& theCS) ; + + /** + * Initialize the iterator. + * @param theT1 + * The type of (sub)shape What. + * @param theT2 + * The type of (sub)shape Where. + */ + //Standard_EXPORT + void Initialize(const TopAbs_ShapeEnum theT1, + const TopAbs_ShapeEnum theT2) ; + /** + * Check the existence of pairs to iterare. + * @return + * Standard_True if there are pairs to iterare. + */ + //Standard_EXPORT + Standard_Boolean More() const; + + /** + * Shift to the next pair. + */ + //Standard_EXPORT + void Next() ; + + /** + * Returns the pair of intersected shapes. + * @return + * The pair of intersected shapes. + */ + //Standard_EXPORT + const NMTTools_CoupleOfShape& Value() const; + +protected: + Standard_Integer myDim; + NMTTools_ListOfCoupleOfShape myLists[10]; + NMTTools_ListOfCoupleOfShape myEmptyList; + NMTTools_ListIteratorOfListOfCoupleOfShape myIterator; + +private: +}; + + +//======================================================================= +/** + * The implementation of Get In Place Algorithm. + * The algorithm provides the search the argument [What] + * in the shape [Where]. + */ +//======================================================================= +//class : GEOMAlgo_GetInPlace +//purpose : +//======================================================================= +class GEOMAlgo_GetInPlace : public GEOMAlgo_GluerAlgo, + public GEOMAlgo_Algo +{ + public: + /** + * Constructor. + */ + Standard_EXPORT + GEOMAlgo_GetInPlace(); + /** + * Destructor. + */ + Standard_EXPORT + virtual ~GEOMAlgo_GetInPlace(); + /** + * Modifier. Sets the shape where the search is intended. + * @param theShape + * The shape where the search is intended. + */ + Standard_EXPORT + virtual void SetShapeWhere(const TopoDS_Shape& theShape) ; + + /** + * Selector. Returns the shape where the search is intended. + * @return + * The shape where the search is intended. + */ + Standard_EXPORT + const TopoDS_Shape& ShapeWhere() const; + + /** + * Modifier. Sets the tolerance of mass. + * @param theTol + * The value tolerance of mass. + */ + Standard_EXPORT + void SetTolMass(const Standard_Real theTol) ; + + /** + * Selector. Returns the value tolerance of mass. + * @return + * The value tolerance of mass. + */ + Standard_EXPORT + Standard_Real TolMass() const; + + /** + * Modifier. Sets the tolerance of center of gravily. + * @param theTol + * The value tolerance of center of gravily. + */ + Standard_EXPORT + void SetTolCG(const Standard_Real theTol) ; + + /** + * Selector. Returns the tolerance of center of gravily. + * @return + * The value tolerance of center of gravily. + */ + Standard_EXPORT + Standard_Real TolCG() const; + + /** + * Perform the algorithm. + */ + Standard_EXPORT + virtual void Perform() ; + + /** + * Returns state of the search. + * @return + * Standard_True if the argument is found. + */ + Standard_EXPORT + Standard_Boolean IsFound() const; + + /** + * Checks data + */ + Standard_EXPORT + virtual void CheckData() ; + + /** + * Clear the internal content. + */ + Standard_EXPORT + virtual void Clear() ; + + /** + * Returns the map of shapes IN. + * @return + ** Returns the map of shapes IN. + * The Key - the (sub)shape of the argument [What]. + * The Item- the (sub)shapes of the shape [Where] that have + * the state IN in respect of [What]. + */ + Standard_EXPORT + const GEOMAlgo_DataMapOfShapeMapOfShape& ShapesIn() const; + + /** + * Returns the map of shapes ON. + * @return + * Returns the map of shapes ON. + * The Key - the (sub)shape of the argument [What]. + * The Item- the (sub)shapes of the shape [Where] that have + * the state ON in respect of [What]. + */ + Standard_EXPORT + const GEOMAlgo_DataMapOfShapeMapOfShape& ShapesOn() const; + +protected: + Standard_EXPORT + void Intersect() ; + + Standard_EXPORT + void PerformVV() ; + + Standard_EXPORT + void PerformVE() ; + + Standard_EXPORT + void PerformEE() ; + + Standard_EXPORT + void PerformVF() ; + + Standard_EXPORT + void PerformEF() ; + + Standard_EXPORT + void PerformFF() ; + + Standard_EXPORT + void FillEdgesOn() ; + + Standard_EXPORT + void FillFacesOn() ; + + Standard_EXPORT + void FillSolidsOn() ; + + Standard_EXPORT + void PerformZF() ; + + Standard_EXPORT + void PerformZZ() ; + + Standard_EXPORT + void FillImages() ; + + Standard_EXPORT + void FillImagesCompound(const TopoDS_Shape& theS) ; + + Standard_EXPORT + void CheckGProps() ; + + Standard_EXPORT + void CheckGProps(const TopoDS_Shape& theS) ; + + Standard_EXPORT + void FillShapesIn(const TopoDS_Shape& theS1, + const TopoDS_Shape& theS2) ; + + Standard_EXPORT + void FillShapesOn(const TopoDS_Shape& theS1, + const TopoDS_Shape& theS2) ; + + Standard_EXPORT + Standard_Boolean CheckCoincidence(const TopoDS_Shape& theS1, + const TopoDS_Shape& theS2); + + + TopoDS_Shape myShapeWhere; + GEOMAlgo_GetInPlaceIterator myIterator; + GEOMAlgo_DataMapOfShapeMapOfShape myShapesIn; + GEOMAlgo_DataMapOfShapeMapOfShape myShapesOn; + Standard_Real myTolMass; + Standard_Real myTolCG; + Standard_Boolean myFound; + GEOMAlgo_DataMapOfShapePnt myMapShapePnt; + +private: +}; + + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx b/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx new file mode 100644 index 000000000..25f418db4 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx @@ -0,0 +1,402 @@ +// Copyright (C) 2007-2012 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 +// + +// File: GEOMAlgo_GetInPlace_1.cxx +// Author: Peter KURNEV + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include + + + +static + Standard_Integer PntInEdge(const TopoDS_Edge& aF, + gp_Pnt& aP); +static + Standard_Integer PntInEdge(const TopoDS_Edge& aF, + gp_Pnt& aP, + Standard_Real& aT); +static + Standard_Integer PntInFace(const TopoDS_Face& aF, + gp_Pnt& aP); +static + Standard_Integer PntInFace(const TopoDS_Face& aF, + gp_Pnt& aP, + gp_Pnt2d& theP2D); +static + Standard_Integer PntInSolid(const TopoDS_Solid& aZ, + const Standard_Real aTol, + gp_Pnt& aP); + + +//======================================================================= +//function : CheckCoincidence +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_GetInPlace::CheckCoincidence(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) +{ + Standard_Boolean bOk; + Standard_Integer iErr; + Standard_Real aTol2; + TopAbs_ShapeEnum aType1, aType2; + TopAbs_State aState; + gp_Pnt aP1, aP2; + // + myErrorStatus=0; + // + iErr=0; + bOk=Standard_False; + aTol2=myTolerance*myTolerance; + aType1=aS1.ShapeType(); + aType2=aS2.ShapeType(); + // + // 1. A point on shape #2 -> aP2 + if (myMapShapePnt.IsBound(aS2)) { + aP2=myMapShapePnt.Find(aS2); + } + else {//else 1 + if (aType2==TopAbs_VERTEX) { + const TopoDS_Vertex& aV2=*((TopoDS_Vertex*)&aS2); + aP2=BRep_Tool::Pnt(aV2); + } + // + else if (aType2==TopAbs_EDGE) { + const TopoDS_Edge& aE2=*((TopoDS_Edge*)&aS2); + iErr=PntInEdge(aE2, aP2); + } + // + else if (aType2==TopAbs_FACE) { + const TopoDS_Face& aF2=*((TopoDS_Face*)&aS2); + iErr=PntInFace(aF2, aP2); + } + // + else if (aType2==TopAbs_SOLID) { + const TopoDS_Solid& aZ2=*((TopoDS_Solid*)&aS2); + iErr=PntInSolid(aZ2, myTolerance, aP2); + } + // + else { + iErr=1; + } + // + if (iErr) { + myErrorStatus=50; + return bOk; + } + // + myMapShapePnt.Bind(aS2, aP2); + } //else 1 + // + // 2. Project the point aP2 on shape #1 and check + if (aType1==TopAbs_EDGE) { + Standard_Integer aNbPoints; + Standard_Real aDmin, aT, aT1, aT2, dT; + // + const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aS1); + // + GeomAPI_ProjectPointOnCurve& aPPC=myContext->ProjPC(aE1); + aPPC.Perform(aP2); + aNbPoints=aPPC.NbPoints(); + if (aNbPoints) { + aDmin=aPPC.LowerDistance(); + aT=aPPC.LowerDistanceParameter(); + if (aDmin < myTolerance) { + dT=1.e-12; + BRep_Tool::Curve(aE1, aT1, aT2); + if(aT > (aT1-dT) && aT < (aT2+dT)) { + bOk=Standard_True; + } + } + } + //else { + // iErr=2; + //} + }//if (aType1==TopAbs_EDGE) { + // + else if (aType1==TopAbs_FACE) { + const TopoDS_Face& aF1=*((TopoDS_Face*)&aS1); + // + bOk=myContext->IsValidPointForFace(aP2, aF1, myTolerance); + } + // + else if (aType1==TopAbs_SOLID) { + const TopoDS_Solid& aZ1=*((TopoDS_Solid*)&aS1); + // + BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aZ1); + aSC.Perform(aP2, myTolerance); + aState=aSC.State(); + bOk=(aState==TopAbs_IN); + } + // + if (iErr) { + myErrorStatus=50; + } + // + return bOk; +} +//======================================================================= +// +//======================================================================= +//function : PntInEdge +//purpose : +//======================================================================= +Standard_Integer PntInEdge(const TopoDS_Edge& aE, + gp_Pnt& aP) + +{ + Standard_Integer iErr; + Standard_Real aT; + // + iErr=PntInEdge(aE, aP, aT); + // + return iErr; +} +//======================================================================= +//function : PntInEdge +//purpose : +//======================================================================= +Standard_Integer PntInEdge(const TopoDS_Edge& aE, + gp_Pnt& aP, + Standard_Real& aT) +{ + Standard_Integer iErr; + Standard_Real aT1, aT2; + Handle(Geom_Curve) aC3D; + // + iErr=0; + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + aT=IntTools_Tools::IntermediatePoint(aT1, aT2); + aC3D->D0(aT, aP); + // + return iErr; +} +//======================================================================= +//function : PntInSolid +//purpose : +//======================================================================= +Standard_Integer PntInSolid(const TopoDS_Solid& aZ, + const Standard_Real aTol, + gp_Pnt& aP) +{ + Standard_Integer iErr; + Standard_Real aUx, aVx, aCoef; + gp_Pnt aPx; + gp_Pnt2d aP2Dx; + gp_Vec aDNx; + + TopoDS_Face aF; + TopExp_Explorer aExp; + // + iErr=0; + aCoef=10.; + // + aExp.Init (aZ, TopAbs_FACE); + for (; aExp.More() ; aExp.Next()) { + aF=*((TopoDS_Face*)&aExp.Current()); + break; + } + // + iErr=PntInFace(aF, aPx, aP2Dx); + if (iErr) { + return iErr; + } + // + aP2Dx.Coord(aUx, aVx); + BOPTools_Tools2D::FaceNormal(aF, aUx, aVx, aDNx); + aDNx.Reverse(); + // + aP.SetXYZ(aPx.XYZ()+aCoef*aTol*aDNx.XYZ()); + // + return iErr; +} +//======================================================================= +//function : PntInFace +//purpose : +//======================================================================= +Standard_Integer PntInFace(const TopoDS_Face& aF, + gp_Pnt& aP) +{ + Standard_Integer iErr; + // + gp_Pnt2d aP2Dx; + // + iErr=PntInFace(aF, aP, aP2Dx); + // + return iErr; +} +//======================================================================= +//function : PntInFace +//purpose : +//======================================================================= +Standard_Integer PntInFace(const TopoDS_Face& aF, + gp_Pnt& theP, + gp_Pnt2d& theP2D) +{ + Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint; + Standard_Integer iErr, aIx, aNbDomains, i; + Standard_Real aUMin, aUMax, aVMin, aVMax; + Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT; + Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D; + gp_Dir2d aD2D (0., 1.); + gp_Pnt2d aP2D; + gp_Pnt aPx; + Handle(Geom2d_Curve) aC2D; + Handle(Geom2d_TrimmedCurve) aCT2D; + Handle(Geom2d_Line) aL2D; + Handle(Geom_Surface) aS; + TopAbs_Orientation aOrE; + TopoDS_Face aFF; + TopExp_Explorer aExp; + // + aTolHatch2D=1.e-8; + aTolHatch3D=1.e-8; + aTotArcIntr=1.e-10; + aTolTangfIntr=1.e-10; + // + Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr); + Geom2dHatch_Hatcher aHatcher(aIntr, + aTolHatch2D, aTolHatch3D, + Standard_True, Standard_False); + // + iErr=0; + aEpsT=1.e-12; + // + aFF=aF; + aFF.Orientation (TopAbs_FORWARD); + // + aS=BRep_Tool::Surface(aFF); + BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax); + // + // 1 + aExp.Init (aFF, TopAbs_EDGE); + for (; aExp.More() ; aExp.Next()) { + const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current()); + aOrE=aE.Orientation(); + // + aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2); + if (aC2D.IsNull() ) { + iErr=1; + return iErr; + } + if (fabs(aU1-aU2) < aEpsT) { + iErr=2; + return iErr; + } + // + aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2); + aHatcher.AddElement(aCT2D, aOrE); + }// for (; aExp.More() ; aExp.Next()) { + // + // 2 + aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax); + aP2D.SetCoord(aUx, 0.); + aL2D=new Geom2d_Line (aP2D, aD2D); + Geom2dAdaptor_Curve aHCur(aL2D); + // + aIx=aHatcher.AddHatching(aHCur) ; + // + // 3. + aHatcher.Trim(); + bIsDone=aHatcher.TrimDone(aIx); + if (!bIsDone) { + iErr=3; + return iErr; + } + // + aHatcher.ComputeDomains(aIx); + bIsDone=aHatcher.IsDone(aIx); + if (!bIsDone) { + iErr=4; + return iErr; + } + // + // 4. + aNbDomains=aHatcher.NbDomains(aIx); + for (i=1; i<=aNbDomains; ++i) { + const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; + bHasFirstPoint=aDomain.HasFirstPoint(); + if (!bHasFirstPoint) { + iErr=5; + return iErr; + } + // + aV1=aDomain.FirstPoint().Parameter(); + // + bHasSecondPoint=aDomain.HasSecondPoint(); + if (!bHasSecondPoint) { + iErr=6; + return iErr; + } + // + aV2=aDomain.SecondPoint().Parameter(); + // + aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); + // + break; + } + // + aS->D0(aUx, aVx, aPx); + // + theP2D.SetCoord(aUx, aVx); + theP=aPx; + // + return iErr; +} + diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlace_2.cxx b/src/GEOMAlgo/GEOMAlgo_GetInPlace_2.cxx new file mode 100644 index 000000000..3114f3688 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlace_2.cxx @@ -0,0 +1,232 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_GetInPlace_2.cxx +// Created: +// Author: Peter KURNEV + +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include + + +static + Standard_Integer Dimension(const TopAbs_ShapeEnum aType); +static + void PointProperties(const TopoDS_Shape& aS, + GProp_GProps& aGProps); + +//======================================================================= +//function : CheckGProps +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::CheckGProps() +{ + myFound=Standard_False; + CheckGProps(myArgument); +} +//======================================================================= +//function : CheckGProps +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlace::CheckGProps(const TopoDS_Shape& aS1) +{ + Standard_Boolean bOnlyClosed; + Standard_Integer iDim, aNbS2; + Standard_Real aMass1, aMass2, aD2, aTolCG2, dM; + TopAbs_ShapeEnum aType1; + gp_Pnt aCG1, aCG2; + TopoDS_Iterator aIt; + TopoDS_Compound aC2; + BRep_Builder aBB; + TopTools_ListIteratorOfListOfShape aItLS; + // + myErrorStatus=0; + // + aType1=aS1.ShapeType(); + if (aType1==TopAbs_COMPOUND) { + aIt.Initialize(aS1); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS1x=aIt.Value(); + CheckGProps(aS1x); + if (!myFound) { + return; + } + } + } + // + iDim=Dimension(aType1); + // + if (!myImages.IsBound(aS1)) { + // it should not be. + return; + } + const TopTools_ListOfShape& aLS2=myImages.Find(aS1); + aNbS2=aLS2.Extent(); + if (!aNbS2) { + // it should not be. + return; + } + // + aBB.MakeCompound(aC2); + aItLS.Initialize(aLS2); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aS2x=aItLS.Value(); + aBB.Add(aC2, aS2x); + } + //------------------------- + GProp_GProps aG1, aG2; + // + aTolCG2=myTolCG*myTolCG; + bOnlyClosed=Standard_False; + // + if (iDim==0) { + PointProperties(aS1, aG1); + PointProperties(aC2, aG2); + } + else if (iDim==1) { + BRepGProp::LinearProperties(aS1, aG1); + BRepGProp::LinearProperties(aC2, aG2); + } + else if (iDim==2) { + BRepGProp::SurfaceProperties(aS1, aG1); + BRepGProp::SurfaceProperties(aC2, aG2); + } + else if (iDim==3) { + BRepGProp::VolumeProperties(aS1, aG1, bOnlyClosed); + BRepGProp::VolumeProperties(aC2, aG2, bOnlyClosed); + } + // + aMass1=aG1.Mass(); + aMass2=aG2.Mass(); + aCG1=aG1.CentreOfMass(); + aCG2=aG2.CentreOfMass(); + // + dM=fabs(aMass1-aMass2); + if (aMass1 > myTolMass) { + dM=dM/aMass1; + } + // + aD2=aCG1.SquareDistance(aCG2); + // + if ((dM > myTolMass) || (aD2 > aTolCG2)) { + myFound=Standard_False; + return; + } + myFound=Standard_True; +} +//======================================================================= +//function : Dimension +//purpose : +//======================================================================= +Standard_Integer Dimension(const TopAbs_ShapeEnum aType) +{ + Standard_Integer iDim; + // + iDim=-1; + switch (aType) { + case TopAbs_VERTEX: + iDim=0; + break; + case TopAbs_EDGE: + case TopAbs_WIRE: + iDim=1; + break; + case TopAbs_FACE: + case TopAbs_SHELL: + iDim=2; + break; + case TopAbs_SOLID: + case TopAbs_COMPSOLID: + iDim=3; + break; + default: + break; + } + return iDim; +} +//======================================================================= +//class : GEOMAlgo_GProps +//purpose : +//======================================================================= +class GEOMAlgo_GProps : public GProp_GProps { + public: + GEOMAlgo_GProps() : GProp_GProps() { + }; + // + GEOMAlgo_GProps(const gp_Pnt& aPLoc) : GProp_GProps(aPLoc) { + }; + // + ~GEOMAlgo_GProps() { + }; + // + void SetMass(const Standard_Real aMass) { + dim=aMass; + } + // + void SetCG(const gp_Pnt& aPCG) { + g=aPCG; + } +}; +//======================================================================= +//function : PointProperties +//purpose : +//======================================================================= +void PointProperties(const TopoDS_Shape& aS, GProp_GProps& aGProps) +{ + Standard_Integer i, aNbS; + Standard_Real aDensity; + gp_Pnt aPX; + TopTools_IndexedMapOfShape aMS; + // + aDensity=1.; + // + TopExp::MapShapes(aS, TopAbs_VERTEX, aMS); + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + GEOMAlgo_GProps aGPropsX; + // + const TopoDS_Vertex& aVX=*((TopoDS_Vertex*)&aMS(i)); + aPX=BRep_Tool::Pnt(aVX); + aGPropsX.SetMass(1.); + aGPropsX.SetCG(aPX); + aGProps.Add(aGPropsX, aDensity); + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlace_3.cxx b/src/GEOMAlgo/GEOMAlgo_GetInPlace_3.cxx new file mode 100644 index 000000000..3cc870da4 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlace_3.cxx @@ -0,0 +1,172 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_GetInPlaceIterator.cxx +// Created: +// Author: Peter KURNEV + +#include + +#include + +static + Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2); + +//======================================================================= +//function : +//purpose : +//======================================================================= +GEOMAlgo_GetInPlaceIterator::GEOMAlgo_GetInPlaceIterator() +{ + myDim=10; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_GetInPlaceIterator::~GEOMAlgo_GetInPlaceIterator() +{ +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlaceIterator::Clear() +{ + Standard_Integer i; + // + for (i=0; i=0) { + myLists[iX].Append(theCS); + } +} +//======================================================================= +//function : ShapeWhere +//purpose : +//======================================================================= +void GEOMAlgo_GetInPlaceIterator::Initialize(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + Standard_Integer iX; + // + iX=TypeToInteger(aType1, aType2); + if (iX>=0) { + myIterator.Initialize(myLists[iX]); + } + else { + myIterator.Initialize(myEmptyList); + } +} +//======================================================================= +// function: More +// purpose: +//======================================================================= +Standard_Boolean GEOMAlgo_GetInPlaceIterator::More()const +{ + return myIterator.More(); +} +//======================================================================= +// function: Next +// purpose: +//======================================================================= +void GEOMAlgo_GetInPlaceIterator::Next() +{ + myIterator.Next(); +} +//======================================================================= +// function: Value +// purpose: +//======================================================================= +const NMTTools_CoupleOfShape& GEOMAlgo_GetInPlaceIterator::Value()const +{ + return myIterator.Value(); +} +//======================================================================= +//function : TypeToInteger +//purpose : +//======================================================================= +Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + Standard_Integer iRet, iT1, iT2, iX; + // + iRet=-1; + // + if (aType1==TopAbs_VERTEX) { + if (aType2==TopAbs_VERTEX) { + iRet=0; + } + } + else if (aType1==TopAbs_EDGE) { + if (aType2==TopAbs_VERTEX) { + iRet=1; + } + else if (aType2==TopAbs_EDGE) { + iRet=2; + } + } + else if (aType1==TopAbs_FACE) { + if (aType2==TopAbs_VERTEX) { + iRet=3; + } + else if (aType2==TopAbs_EDGE) { + iRet=4; + } + else if (aType2==TopAbs_FACE) { + iRet=5; + } + } + // So_1,*_2 + else if (aType1==TopAbs_SOLID) { + if (aType2==TopAbs_VERTEX) { + iRet=6; + } + else if (aType2==TopAbs_EDGE) { + iRet=7; + } + else if (aType2==TopAbs_FACE) { + iRet=8; + } + else if (aType2==TopAbs_SOLID) { + iRet=9; + } + } + return iRet; +} diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl deleted file mode 100644 index 925d094c5..000000000 --- a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl +++ /dev/null @@ -1,82 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_GlueAnalyser.cdl --- Created: Wed Dec 15 11:03:03 2004 --- Author: Peter KURNEV --- --- -class GlueAnalyser from GEOMAlgo - inherits Gluer from GEOMAlgo - ---Purpose: - -uses - ShapeEnum from TopAbs, - ListOfShape from TopTools, - ListOfCoupleOfShapes from GEOMAlgo - ---raises - -is - Create - returns GlueAnalyser from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_GlueAnalyser();" - - Perform(me:out) - is redefined; - - HasSolidsToGlue(me) - returns Boolean from Standard; - - SolidsToGlue(me) - returns ListOfCoupleOfShapes from GEOMAlgo; - ---C++:return const & - - HasSolidsAlone(me) - returns Boolean from Standard; - - SolidsAlone(me) - returns ListOfShape from TopTools; - ---C++:return const & - - DetectVertices(me:out) - is protected; - - DetectEdges(me:out) - is protected; - - DetectFaces(me:out) - is protected; - - DetectShapes(me:out; - aType:ShapeEnum from TopAbs) - is protected; - - DetectSolids (me:out) - is protected; - - - -fields - mySolidsToGlue : ListOfCoupleOfShapes from GEOMAlgo is protected; - mySolidsAlone : ListOfShape from TopTools is protected; - -end GlueAnalyser; diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx index 8a7124c31..1d5b99e36 100644 --- a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx +++ b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx @@ -1,30 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_GlueDetector.cxx -// Created: Wed Dec 15 11:08:09 2004 -// Author: Peter KURNEV -// -// -#include + +// File: GEOMAlgo_GlueDetector.cxx +// Created: Wed Dec 15 11:08:09 2004 +// Author: Peter KURNEV + +#include #include #include @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -60,8 +61,8 @@ #include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_GlueAnalyser::GEOMAlgo_GlueAnalyser() : @@ -69,13 +70,13 @@ {} //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_GlueAnalyser::~GEOMAlgo_GlueAnalyser() {} //======================================================================= //function : HasSolidsToGlue -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsToGlue()const { @@ -83,7 +84,7 @@ } //======================================================================= //function : HasSolidsAlone -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsAlone()const { @@ -91,7 +92,7 @@ } //======================================================================= //function : SolidsToGlue -//purpose : +//purpose : //======================================================================= const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_GlueAnalyser::SolidsToGlue()const { @@ -99,7 +100,7 @@ } //======================================================================= //function : SolidsAlone -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_GlueAnalyser::SolidsAlone()const { @@ -107,7 +108,7 @@ } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_GlueAnalyser::Perform() { @@ -122,6 +123,9 @@ return; } // + // Initialize the context + GEOMAlgo_ShapeAlgo::Perform(); + // InnerTolerance(); if (myErrorStatus) { return; @@ -149,7 +153,7 @@ } //======================================================================= //function : DetectVertices -//purpose : +//purpose : //======================================================================= void GEOMAlgo_GlueAnalyser::DetectVertices() { @@ -180,11 +184,11 @@ const TopoDS_Shape& aV=aMV(i); Bnd_Box aBox; // - aBox.SetGap(myTol); + aBox.SetGap(myTol); BRepBndLib::Add(aV, aBox); aHAB->SetValue(i, aBox); aMIS.Add(i, aV); - aMSB.Add(aV, aBox); + aMSB.Add(aV, aBox); } // aBSB.Initialize(aHAB); @@ -200,7 +204,7 @@ const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV); aNbVSD=aLI.Extent(); if (!aNbVSD) { - myErrorStatus=3; // it must not be + myErrorStatus=3; // it must not be return; } // @@ -212,7 +216,7 @@ aIndex=aIt.Value(); const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex); if(!j) { - aVF=aVx; + aVF=aVx; } aLVSD.Append(aVx); aMVProcessed.Add(aVx); @@ -229,14 +233,14 @@ for (; aItS.More(); aItS.Next()) { const TopoDS_Shape& aVSD=aItS.Value(); if (!myOrigins.IsBound(aVSD)) { - myOrigins.Bind(aVSD, aV); + myOrigins.Bind(aVSD, aV); } } } } //======================================================================= //function : DetectFaces -//purpose : +//purpose : //======================================================================= void GEOMAlgo_GlueAnalyser::DetectFaces() { @@ -244,7 +248,7 @@ } //======================================================================= //function : DetectEdges -//purpose : +//purpose : //======================================================================= void GEOMAlgo_GlueAnalyser::DetectEdges() { @@ -252,7 +256,7 @@ } //======================================================================= //function : DetectShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_GlueAnalyser::DetectShapes(const TopAbs_ShapeEnum aType) { @@ -270,7 +274,7 @@ aNbF=aMF.Extent(); for (i=1; i<=aNbF; ++i) { const TopoDS_Shape& aS=aMF(i); - // + // //aPKF.Clear();//qft if (aType==TopAbs_FACE) { const TopoDS_Face& aF=TopoDS::Face(aS); @@ -323,14 +327,14 @@ for (; aItS.More(); aItS.Next()) { const TopoDS_Shape& aFSD=aItS.Value(); if (!myOrigins.IsBound(aFSD)) { - myOrigins.Bind(aFSD, aNewShape); + myOrigins.Bind(aFSD, aNewShape); } } } } //======================================================================= //function : DetectSolids -//purpose : +//purpose : //======================================================================= void GEOMAlgo_GlueAnalyser::DetectSolids() { @@ -370,13 +374,13 @@ aFx[1]=aLF.Last(); for (i=0; i<2; ++i) { if (!aMFS.Contains(aFx[i])) { - continue;// it must not be so + continue;// it must not be so } // const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aFx[i]); aNbS=aLS.Extent(); if (aNbS!=1) { - continue; + continue; } aSx[i]=aLS.First(); } @@ -403,7 +407,7 @@ // mySolidsToGlue.Clear(); mySolidsAlone.Clear(); - + // aNbC=aMPKLS.Extent(); if (!aNbC) { diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.hxx b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.hxx index 45d174918..359407edb 100644 --- a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.hxx +++ b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.hxx @@ -1,141 +1,87 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: GEOMAlgo_GlueDetector.hxx +// Created: Wed Dec 15 11:08:09 2004 +// Author: Peter KURNEV + #ifndef _GEOMAlgo_GlueAnalyser_HeaderFile #define _GEOMAlgo_GlueAnalyser_HeaderFile -#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Gluer_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -class GEOMAlgo_ListOfCoupleOfShapes; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_GlueAnalyser : public GEOMAlgo_Gluer { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_GlueAnalyser(); -Standard_EXPORT virtual ~GEOMAlgo_GlueAnalyser(); - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT Standard_Boolean HasSolidsToGlue() const; +//======================================================================= +//function : GEOMAlgo_GlueAnalyser +//purpose : +//======================================================================= +class GEOMAlgo_GlueAnalyser : public GEOMAlgo_Gluer +{ + public: + Standard_EXPORT + GEOMAlgo_GlueAnalyser(); -Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& SolidsToGlue() const; + Standard_EXPORT + virtual ~GEOMAlgo_GlueAnalyser(); + Standard_EXPORT + virtual void Perform() ; -Standard_EXPORT Standard_Boolean HasSolidsAlone() const; + Standard_EXPORT + Standard_Boolean HasSolidsToGlue() const; + Standard_EXPORT + const GEOMAlgo_ListOfCoupleOfShapes& SolidsToGlue() const; -Standard_EXPORT const TopTools_ListOfShape& SolidsAlone() const; + Standard_EXPORT + Standard_Boolean HasSolidsAlone() const; + Standard_EXPORT + const TopTools_ListOfShape& SolidsAlone() const; + protected: + Standard_EXPORT + void DetectVertices() ; + Standard_EXPORT + void DetectEdges() ; + Standard_EXPORT + void DetectFaces() ; -protected: + Standard_EXPORT + void DetectShapes(const TopAbs_ShapeEnum aType) ; - // Methods PROTECTED - // - - -Standard_EXPORT void DetectVertices() ; - - -Standard_EXPORT void DetectEdges() ; - - -Standard_EXPORT void DetectFaces() ; - - -Standard_EXPORT void DetectShapes(const TopAbs_ShapeEnum aType) ; - - -Standard_EXPORT void DetectSolids() ; - - - // Fields PROTECTED - // -GEOMAlgo_ListOfCoupleOfShapes mySolidsToGlue; -TopTools_ListOfShape mySolidsAlone; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + void DetectSolids() ; + GEOMAlgo_ListOfCoupleOfShapes mySolidsToGlue; + TopTools_ListOfShape mySolidsAlone; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.ixx b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.ixx deleted file mode 100644 index 6a279b7ef..000000000 --- a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.jxx b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.jxx deleted file mode 100644 index bc6388ba6..000000000 --- a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_GlueAnalyser_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx b/src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx new file mode 100644 index 000000000..fb8d5dfdc --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx @@ -0,0 +1,612 @@ +// Copyright (C) 2007-2012 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 +// + +// File: GEOMAlgo_GlueDetector.cxx +// Author: Peter KURNEV + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +// +#include +#include +#include +#include + +//modified by NIZNHY-PKV Tue Mar 13 10:25:47 2012f +static + Standard_Integer CheckAncesstors + (const TopoDS_Shape& aVSD, + const TopTools_MapOfShape& aMVSD, + const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape& aMEV, + TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ); +//modified by NIZNHY-PKV Tue Mar 13 10:25:50 2012t + +//======================================================================= +//function : +//purpose : +//======================================================================= +GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector() +: + GEOMAlgo_GluerAlgo(), + GEOMAlgo_Algo() +{} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() +{} +//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f +//======================================================================= +//function : StickedShapes +//purpose : +//======================================================================= +const TopTools_IndexedDataMapOfShapeListOfShape& + GEOMAlgo_GlueDetector::StickedShapes() +{ + return myStickedShapes; +} +//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + myStickedShapes.Clear(); + // + CheckData(); + if (myErrorStatus) { + return; + } + // + // Initialize the context + GEOMAlgo_GluerAlgo::Perform(); + // + DetectVertices(); + if (myErrorStatus) { + return; + } + // + //modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f + CheckDetected(); + if (myErrorStatus) { + return; + } + //modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t + // + DetectEdges(); + if (myErrorStatus) { + return; + } + // + DetectFaces(); + if (myErrorStatus) { + return; + } +} +//======================================================================= +//function : DetectVertices +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::DetectVertices() +{ + Standard_Integer j, i, aNbV, aNbVSD; + Standard_Real aTolV; + gp_Pnt aPV; + TColStd_ListIteratorOfListOfInteger aIt; + TopoDS_Shape aVF; + TopTools_IndexedMapOfShape aMV; + TopTools_MapOfShape aMVProcessed; + TopTools_ListIteratorOfListOfShape aItS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + TopTools_DataMapOfShapeListOfShape aMVV; + GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; + NMTDS_IndexedDataMapOfShapeBndSphere aMSB; + NMTDS_BndSphereTreeSelector aSelector; + NMTDS_BndSphereTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + myErrorStatus=0; + // + TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMV); + aNbV=aMV.Extent(); + if (!aNbV) { + myErrorStatus=2; // no vertices in source shape + return; + } + // + for (i=1; i<=aNbV; ++i) { + NMTDS_BndSphere aBox; + // + const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i)); + aPV=BRep_Tool::Pnt(aV); + aTolV=BRep_Tool::Tolerance(aV); + // + aBox.SetGap(myTolerance); + aBox.SetCenter(aPV); + aBox.SetRadius(aTolV); + // + aTreeFiller.Add(i, aBox); + // + aMIS.Add(i, aV); + aMSB.Add(aV, aBox); + } + // + aTreeFiller.Fill(); + // + //--------------------------------------------------- + // Chains + for (i=1; i<=aNbV; ++i) { + const TopoDS_Shape& aV=aMV(i); + // + if (aMVProcessed.Contains(aV)) { + continue; + } + // + Standard_Integer aNbIP, aIP, aNbIP1, aIP1; + TopTools_ListOfShape aLVSD; + TColStd_MapOfInteger aMIP, aMIP1, aMIPC; + TColStd_MapIteratorOfMapOfInteger aIt1; + // + aMIP.Add(i); + while(1) { + aNbIP=aMIP.Extent(); + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + if (aMIPC.Contains(aIP)) { + continue; + } + // + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP); + // + aSelector.Clear(); + aSelector.SetBox(aBoxVP); + // + aNbVSD=aBBTree.Select(aSelector); + if (!aNbVSD) { + continue; // it shoild not be so [at least IP itself] + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + aIP1=aIt.Value(); + if (aMIP.Contains(aIP1)) { + continue; + } + aMIP1.Add(aIP1); + } //for (; aIt.More(); aIt.Next()) { + }//for(; aIt1.More(); aIt1.Next()) { + // + aNbIP1=aMIP1.Extent(); + if (!aNbIP1) { + break; + } + // + aIt1.Initialize(aMIP); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIPC.Add(aIP); + } + // + aMIP.Clear(); + aIt1.Initialize(aMIP1); + for(; aIt1.More(); aIt1.Next()) { + aIP=aIt1.Key(); + aMIP.Add(aIP); + } + aMIP1.Clear(); + }// while(1) + // + // Fill myImages + aNbIP=aMIPC.Extent(); + // + if (!aNbIP) {// no SD vertices is found + aMVProcessed.Add(aV); + continue; + } + //else { // SD vertices founded [ aMIPC ] + aIt1.Initialize(aMIPC); + for(j=0; aIt1.More(); aIt1.Next(), ++j) { + aIP=aIt1.Key(); + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + if (!j) { + aVF=aVP; + } + aLVSD.Append(aVP); + aMVProcessed.Add(aVP); + } + //} + myImages.Bind(aVF, aLVSD); + }// for (i=1; i<=aNbV; ++i) { + //------------------------------ + // Origins + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aV=aItIm.Key(); + const TopTools_ListOfShape& aLVSD=aItIm.Value(); + aItS.Initialize(aLVSD); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aVSD=aItS.Value(); + if (!myOrigins.IsBound(aVSD)) { + myOrigins.Bind(aVSD, aV); + } + } + } +} +//======================================================================= +//function : DetectFaces +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::DetectFaces() +{ + DetectShapes(TopAbs_FACE); +} +//======================================================================= +//function : DetectEdges +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::DetectEdges() +{ + DetectShapes(TopAbs_EDGE); +} +//======================================================================= +//function : DetectShapes +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType) +{ + Standard_Boolean bDegenerated; + Standard_Integer i, aNbF, aNbSDF, iErr; + TopTools_IndexedMapOfShape aMF; + TopTools_ListIteratorOfListOfShape aItLS; + GEOMAlgo_PassKeyShape aPKF; + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF; + // + myErrorStatus=0; + // + TopExp::MapShapes(myArgument, aType, aMF); + // + aNbF=aMF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aS=aMF(i); + // + if (aType==TopAbs_FACE) { + const TopoDS_Face& aF=*((TopoDS_Face*)&aS); + FacePassKey(aF, aPKF); + } + else if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aE=*((TopoDS_Edge*)&aS); + EdgePassKey(aE, aPKF); + } + // + if (myErrorStatus) { + return; + } + // + if (aMPKLF.Contains(aPKF)) { + TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF); + aLSDF.Append(aS); + } + else { + TopTools_ListOfShape aLSDF; + // + aLSDF.Append(aS); + aMPKLF.Add(aPKF, aLSDF); + } + } + // check geometric coincidence + if (myCheckGeometry) { + iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTolerance, myContext); + if (iErr) { + myErrorStatus=200; + return; + } + } + // + // Images/Origins + aNbF=aMPKLF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopTools_ListOfShape& aLSDF=aMPKLF(i); + aNbSDF=aLSDF.Extent(); + if (!aNbSDF) { + myErrorStatus=4; // it must not be + } + // + if (aNbSDF==1) { + continue; + } + // + const TopoDS_Shape& aS1=aLSDF.First(); + // + if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aS1); + bDegenerated=BRep_Tool::Degenerated(aE1); + if (bDegenerated) { + continue; + } + } + // + myImages.Bind(aS1, aLSDF); + // + // origins + aItLS.Initialize(aLSDF); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aFSD=aItLS.Value(); + if (!myOrigins.IsBound(aFSD)) { + myOrigins.Bind(aFSD, aS1); + } + } + }// for (i=1; i<=aNbF; ++i) +} +//======================================================================= +//function : FacePassKey +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF, + GEOMAlgo_PassKeyShape& aPK) +{ + Standard_Integer i, aNbE; + TopoDS_Shape aER; + TopTools_ListOfShape aLE; + TopTools_IndexedMapOfShape aME; + // + TopExp::MapShapes(aF, TopAbs_EDGE, aME); + // + aNbE=aME.Extent(); + for (i=1; i<=aNbE; ++i) { + const TopoDS_Shape& aE=aME(i); + // + const TopoDS_Edge& aEE=*((TopoDS_Edge*)&aE); + if (BRep_Tool::Degenerated(aEE)) { + continue; + } + // + if (myOrigins.IsBound(aE)) { + aER=myOrigins.Find(aE); + } + else { + aER=aE; + } + aLE.Append(aER); + } + aPK.SetShapes(aLE); +} +//======================================================================= +//function : EdgePassKey +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE, + GEOMAlgo_PassKeyShape& aPK) +{ + TopAbs_Orientation aOr; + TopoDS_Shape aVR; + TopoDS_Iterator aIt; + TopTools_ListOfShape aLV; + // + aIt.Initialize(aE); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aV=aIt.Value(); + aOr=aV.Orientation(); + if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) { + if (myOrigins.IsBound(aV)) { + aVR=myOrigins.Find(aV); + } + else { + aVR=aV; + } + aLV.Append(aVR); + } + } + // + aPK.SetShapes(aLV); +} +//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f +//======================================================================= +//function : CheckDetected +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::CheckDetected() +{ + TopoDS_Iterator aItA; + TopExp_Explorer aExp; + TopTools_ListOfShape aLV; + TopTools_MapOfShape aMFence; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + TopTools_IndexedDataMapOfShapeListOfShape aMVE, aMEV; + // + // 1. aMVE, aMEV + TopExp::MapShapesAndAncestors(myArgument, TopAbs_VERTEX, TopAbs_EDGE, aMVE); + // + aExp.Init(myArgument, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aE=aExp.Current(); + // + aLV.Clear(); + aMFence.Clear(); + aItA.Initialize(aE); + for (; aItA.More(); aItA.Next()) { + const TopoDS_Shape& aV=aItA.Value(); + if (aMFence.Add(aV)) { + aLV.Append(aV); + } + } + // + aMEV.Add(aE, aLV); + } + // 2. Checking + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + //const TopoDS_Shape& aV=aItIm.Key(); + const TopTools_ListOfShape& aLVSD=aItIm.Value(); + CheckDetected(aLVSD, aMVE, aMEV); + } +} +//======================================================================= +//function : CheckDetected +//purpose : +//======================================================================= +void GEOMAlgo_GlueDetector::CheckDetected + (const TopTools_ListOfShape& aLVSD, + const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape& aMEV) +{ + Standard_Integer i, aNbVSD, aNbA, iRet; + TopAbs_ShapeEnum aTypeS, aTypeA[2]; + TopExp_Explorer aExp, aExpA; + TopTools_MapOfShape aMFence, aMVSD; + TopTools_ListOfShape aLV; + TopTools_ListIteratorOfListOfShape aItLS; + // + myErrorStatus=0; + // + aNbVSD=aLVSD.Extent(); + if (aNbVSD < 2) { + return ; + } + // + aItLS.Initialize(aLVSD); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aVSD=aItLS.Value(); + aMVSD.Add(aVSD); + } + // + aItLS.Initialize(aLVSD); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aVSD=aItLS.Value(); + // + iRet=CheckAncesstors(aVSD, aMVSD, aMVE, aMEV, myStickedShapes); + if (iRet) { + // Sticked shapes detected + myWarningStatus=2; + } + } +} +//======================================================================= +//function : CheckAncesstors +//purpose : +//======================================================================= +Standard_Integer CheckAncesstors + (const TopoDS_Shape& aVSD, + const TopTools_MapOfShape& aMVSD, + const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape& aMEV, + TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ) +{ + Standard_Address pLE, pLV, pLVZ; + Standard_Integer iRet, aNbVX; + TopTools_ListIteratorOfListOfShape aItLE, aItLV; + TopTools_MapOfShape aMFence; + TopTools_ListOfShape aLVX; + // + iRet=0; + // + pLE=aMVE.FindFromKey1(aVSD); + if (!pLE) { + return iRet; + } + // + const TopTools_ListOfShape& aLE=*((TopTools_ListOfShape*)pLE); + aItLE.Initialize(aLE); + for (; aItLE.More(); aItLE.Next()) { + const TopoDS_Shape& aE=aItLE.Value(); + // + pLV=aMEV.FindFromKey1(aE); + if (!pLV) { + continue; // it should be not so + } + // + aLVX.Clear(); + const TopTools_ListOfShape& aLV=*((TopTools_ListOfShape*)pLV); + aItLV.Initialize(aLV); + for (; aItLV.More(); aItLV.Next()) { + const TopoDS_Shape& aV=aItLV.Value(); + if (!aV.IsSame(aVSD)) { + if (aMVSD.Contains(aV)) { + if (aMFence.Add(aV)) { + aLVX.Append(aV); + } + } + } + } + // + aNbVX=aLVX.Extent(); + if (!aNbVX) { + continue; + } + // + iRet=1; + // + pLVZ=aMEVZ.FindFromKey1(aE); + if (!pLVZ) { + aMEVZ.Add(aE, aLVX); + } + else { + TopTools_ListOfShape& aLVZ=*((TopTools_ListOfShape*)pLVZ); + aLVZ.Append(aLVX); + } + } + // + return iRet; +} +//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t diff --git a/src/GEOMAlgo/GEOMAlgo_GlueDetector.hxx b/src/GEOMAlgo/GEOMAlgo_GlueDetector.hxx new file mode 100644 index 000000000..dc588eacd --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GlueDetector.hxx @@ -0,0 +1,100 @@ +// Copyright (C) 2007-2012 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 +// + +// File: GEOMAlgo_GlueDetector.hxx +// Author: Peter KURNEV + +#ifndef _GEOMAlgo_GlueDetector_HeaderFile +#define _GEOMAlgo_GlueDetector_HeaderFile + +#include +#include + +#include + +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_GlueDetector +//purpose : +//======================================================================= +class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo, + public GEOMAlgo_Algo +{ +public: + Standard_EXPORT + GEOMAlgo_GlueDetector(); + + Standard_EXPORT virtual + ~GEOMAlgo_GlueDetector(); + + Standard_EXPORT virtual + void Perform() ; + +//modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f + Standard_EXPORT + const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes(); +//modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t +//------------------------------------------------ +protected: + Standard_EXPORT + void DetectVertices() ; + + Standard_EXPORT + void DetectEdges() ; + + Standard_EXPORT + void DetectFaces() ; + + Standard_EXPORT + void DetectShapes(const TopAbs_ShapeEnum aType) ; + + Standard_EXPORT + void EdgePassKey(const TopoDS_Edge& aE, + GEOMAlgo_PassKeyShape& aPK) ; + + Standard_EXPORT + void FacePassKey(const TopoDS_Face& aF, + GEOMAlgo_PassKeyShape& aPK) ; + + //modified by NIZNHY-PKV Tue Mar 13 09:53:03 2012f + Standard_EXPORT + void CheckDetected(); + // + Standard_EXPORT + void CheckDetected + (const TopTools_ListOfShape& aLVSD, + const TopTools_IndexedDataMapOfShapeListOfShape& aMVE, + const TopTools_IndexedDataMapOfShapeListOfShape& aMEV); + + + protected: + TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes; + //modified by NIZNHY-PKV Tue Mar 13 09:53:08 2012t + +}; +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cdl b/src/GEOMAlgo/GEOMAlgo_Gluer.cdl deleted file mode 100755 index 76631ff57..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cdl +++ /dev/null @@ -1,160 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Gluer.cdl --- Created: Sat Dec 04 12:41:32 2004 --- Author: Peter KURNEV --- --- -class Gluer from GEOMAlgo - inherits ShapeAlgo from GEOMAlgo - - ---Purpose: - -uses - ShapeEnum from TopAbs, - Shape from TopoDS, - Edge from TopoDS, - Face from TopoDS, - Vertex from TopoDS, - ListOfShape from TopTools, - DataMapOfShapeShape from TopTools, - DataMapOfShapeListOfShape from TopTools, - Context from IntTools, - PassKeyShape from GEOMAlgo - ---raises - -is - Create - returns Gluer from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Gluer();" - - SetCheckGeometry (me:out; - aFlag:Boolean from Standard); - - CheckGeometry (me) - returns Boolean from Standard; - - Perform(me:out) - is redefined; - - AloneShapes(me) - returns Integer from Standard; - - --modified by NIZNHY-PKV Fri Jan 21 14:16:58 2005f- - Modified(me:out; - S : Shape from TopoDS) - returns ListOfShape from TopTools; - ---C++: return const & - - Generated(me:out; - S : Shape from TopoDS) - returns ListOfShape from TopTools; - ---C++: return const & - - IsDeleted (me:out; - S : Shape from TopoDS) - returns Boolean from Standard; - --modified by NIZNHY-PKV Fri Jan 21 14:17:04 2005t - - CheckData(me:out) - is redefined protected; - - CheckResult (me:out) - is redefined protected; - - MakeVertices(me:out) - is protected; - - MakeEdges(me:out) - is protected; - - MakeFaces(me:out) - is protected; - - MakeShapes(me:out; - aType:ShapeEnum from TopAbs) - is protected; - - MakeShells(me:out) - is protected; - - MakeSolids(me:out) - is protected; - - InnerTolerance(me:out) - is protected; - - EdgePassKey(me:out; - aE:Edge from TopoDS; - aPK:out PassKeyShape from GEOMAlgo) - is protected; - - FacePassKey(me:out; - aF:Face from TopoDS; - aPK:out PassKeyShape from GEOMAlgo) - is protected; - - MakeVertex(me:out; - aLV : ListOfShape from TopTools; - aNewV: out Vertex from TopoDS) - is protected; - MakeEdge(me:out; - aEdge : Edge from TopoDS; - aNewEdge: out Edge from TopoDS) - is protected; - - MakeFace(me:out; - aFace : Face from TopoDS; - aNewEdge: out Face from TopoDS) - is protected; - - IsToReverse(me:out; - aFR : Face from TopoDS; - aF : Face from TopoDS) - returns Boolean from Standard - is protected; - - HasNewSubShape(me; - aS : Shape from TopoDS) - returns Boolean from Standard - is protected; --- - Images(me) - returns DataMapOfShapeListOfShape from TopTools; - ---C++:return const & - - Origins(me) - returns DataMapOfShapeShape from TopTools; - ---C++:return const & - -fields - myCheckGeometry : Boolean from Standard is protected; - myTol : Real from Standard is protected; - myImages : DataMapOfShapeListOfShape from TopTools is protected; - myOrigins : DataMapOfShapeShape from TopTools is protected; - myNbAlone : Integer from Standard is protected; ----- - myGenerated : ListOfShape from TopTools is protected; ----- - -end Gluer; diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx index a147c90b0..322d1ba31 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: GEOMAlgo_Gluer.cxx // Created: Sat Dec 04 12:45:53 2004 // Author: Peter KURNEV // // -#include +#include #include #include @@ -83,18 +84,23 @@ #include #include -#include +#include #include #include // -static +#include +#include +#include + +// +static void GetSubShapes(const TopoDS_Shape& aS, TopTools_IndexedMapOfShape& aMSS); //======================================================================= //function : GEOMAlgo_Gluer -//purpose : +//purpose : //======================================================================= GEOMAlgo_Gluer::GEOMAlgo_Gluer() : @@ -108,14 +114,14 @@ GEOMAlgo_Gluer::GEOMAlgo_Gluer() } //======================================================================= //function : ~GEOMAlgo_Gluer -//purpose : +//purpose : //======================================================================= GEOMAlgo_Gluer::~GEOMAlgo_Gluer() { } //======================================================================= //function : SetCheckGeometry -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::SetCheckGeometry(const Standard_Boolean aFlag) { @@ -123,7 +129,7 @@ void GEOMAlgo_Gluer::SetCheckGeometry(const Standard_Boolean aFlag) } //======================================================================= //function : CheckGeometry -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const { @@ -131,15 +137,23 @@ Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const } //======================================================================= //function : SetKeepNonSolids -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::SetKeepNonSolids(const Standard_Boolean aFlag) { myKeepNonSolids=aFlag; } //======================================================================= +//function : KeepNonSolids +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer::KeepNonSolids()const +{ + return myKeepNonSolids; +} +//======================================================================= //function : AloneShapes -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_Gluer::AloneShapes()const { @@ -147,7 +161,7 @@ Standard_Integer GEOMAlgo_Gluer::AloneShapes()const } //======================================================================= //function : Images -//purpose : +//purpose : //======================================================================= const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer::Images()const { @@ -155,7 +169,7 @@ const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer::Images()const } //======================================================================= //function : Origins -//purpose : +//purpose : //======================================================================= const TopTools_DataMapOfShapeShape& GEOMAlgo_Gluer::Origins()const { @@ -163,15 +177,19 @@ const TopTools_DataMapOfShapeShape& GEOMAlgo_Gluer::Origins()const } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::Perform() { + const Standard_Integer aNb=8; + Standard_Integer i; + // myErrorStatus=0; myWarningStatus=0; // - Standard_Integer i; - const Standard_Integer aNb=8; + // Initialize the context + GEOMAlgo_ShapeAlgo::Perform(); + // void (GEOMAlgo_Gluer::* pF[aNb])()={ &GEOMAlgo_Gluer::CheckData, &GEOMAlgo_Gluer::InnerTolerance, &GEOMAlgo_Gluer::MakeVertices, &GEOMAlgo_Gluer::MakeEdges, @@ -186,15 +204,18 @@ void GEOMAlgo_Gluer::Perform() } } } + //======================================================================= //function : MakeVertices -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::MakeVertices() { myErrorStatus=0; // Standard_Integer j, i, aNbV, aNbVSD; + Standard_Real aTolV; + gp_Pnt aPV; TColStd_ListIteratorOfListOfInteger aIt; TopoDS_Shape aVF; TopoDS_Vertex aVnew; @@ -203,12 +224,14 @@ void GEOMAlgo_Gluer::MakeVertices() TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; TopTools_DataMapOfShapeListOfShape aMVV; GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; - GEOMAlgo_IndexedDataMapOfShapeBox aMSB; - // - NMTDS_BoxBndTreeSelector aSelector; - NMTDS_BoxBndTree aBBTree; - NCollection_UBTreeFiller aTreeFiller(aBBTree); + //modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f + //GEOMAlgo_IndexedDataMapOfShapeBox aMSB; + NMTDS_IndexedDataMapOfShapeBndSphere aMSB; + //modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t // + NMTDS_BndSphereTreeSelector aSelector; + NMTDS_BndSphereTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); // TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV); aNbV=aMV.Extent(); @@ -218,16 +241,20 @@ void GEOMAlgo_Gluer::MakeVertices() } // for (i=1; i<=aNbV; ++i) { - const TopoDS_Shape& aV=aMV(i); - Bnd_Box aBox; + NMTDS_BndSphere aBox; + // + const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i)); + aPV=BRep_Tool::Pnt(aV); + aTolV=BRep_Tool::Tolerance(aV); // - aBox.SetGap(myTol); - BRepBndLib::Add(aV, aBox); + aBox.SetGap(myTol); + aBox.SetCenter(aPV); + aBox.SetRadius(aTolV); // aTreeFiller.Add(i, aBox); // aMIS.Add(i, aV); - aMSB.Add(aV, aBox); + aMSB.Add(aV, aBox); } // aTreeFiller.Fill(); @@ -235,7 +262,7 @@ void GEOMAlgo_Gluer::MakeVertices() //------------------------------ // Chains for (i=1; i<=aNbV; ++i) { - const TopoDS_Shape& aV=aMV(i); + const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i)); // if (aMVProcessed.Contains(aV)) { continue; @@ -257,17 +284,21 @@ void GEOMAlgo_Gluer::MakeVertices() } // const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); - const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); + //modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f + const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP); + //const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); + //modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t // aSelector.Clear(); aSelector.SetBox(aBoxVP); // aNbVSD=aBBTree.Select(aSelector); if (!aNbVSD) { - continue; // it must not be + continue; // it must not be } // const TColStd_ListOfInteger& aLI=aSelector.Indices(); + // aIt.Initialize(aLI); for (; aIt.More(); aIt.Next()) { aIP1=aIt.Value(); @@ -326,7 +357,7 @@ void GEOMAlgo_Gluer::MakeVertices() aMV.Clear(); aItIm.Initialize(myImages); for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aV=aItIm.Key(); + const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aItIm.Key()); const TopTools_ListOfShape& aLVSD=aItIm.Value(); aNbVSD=aLVSD.Extent(); if (aNbVSD>1) { @@ -367,7 +398,7 @@ void GEOMAlgo_Gluer::MakeVertices() } //======================================================================= //function : MakeSubShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape, TopTools_MapOfShape& theMS, @@ -381,16 +412,13 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape, theMS.Add(theShape); // if (theShape.ShapeType() == TopAbs_COMPOUND || - theShape.ShapeType() == TopAbs_COMPSOLID) - { + theShape.ShapeType() == TopAbs_COMPSOLID) { TopoDS_Iterator It (theShape, Standard_True, Standard_True); - for (; It.More(); It.Next()) - { + for (; It.More(); It.Next()) { MakeSubShapes(It.Value(), theMS, theResult); } } - else if (theShape.ShapeType() == TopAbs_SOLID) - { + else if (theShape.ShapeType() == TopAbs_SOLID) { // build a solid TopoDS_Solid aNewSolid; TopExp_Explorer aExpS, aExp; @@ -418,13 +446,10 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape, // aBB.Add(theResult, aNewSolid); } - else if (theShape.ShapeType() == TopAbs_WIRE) - { - if (myKeepNonSolids) - { + else if (theShape.ShapeType() == TopAbs_WIRE) { + if (myKeepNonSolids) { // just add image - if (!myOrigins.IsBound(theShape)) - { + if (!myOrigins.IsBound(theShape)) { // build wire const TopoDS_Wire& aW=TopoDS::Wire(theShape); // @@ -469,8 +494,7 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape, } else { - if (myKeepNonSolids) - { + if (myKeepNonSolids) { // just add image const TopoDS_Shape& aShapeR = myOrigins.Find(theShape); aBB.Add(theResult, aShapeR); @@ -479,7 +503,7 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape, } //======================================================================= //function : MakeSolids -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::MakeSolids() { @@ -503,7 +527,7 @@ void GEOMAlgo_Gluer::MakeSolids() } //======================================================================= //function : MakeShells -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::MakeShells() { @@ -551,7 +575,7 @@ void GEOMAlgo_Gluer::MakeShells() } //======================================================================= //function : MakeFaces -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::MakeFaces() { @@ -559,7 +583,7 @@ void GEOMAlgo_Gluer::MakeFaces() } //======================================================================= //function : MakeEdges -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::MakeEdges() { @@ -567,7 +591,7 @@ void GEOMAlgo_Gluer::MakeEdges() } //======================================================================= //function : MakeShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) { @@ -586,7 +610,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) aNbF=aMF.Extent(); for (i=1; i<=aNbF; ++i) { const TopoDS_Shape& aS=aMF(i); - // + // if (aType==TopAbs_FACE) { const TopoDS_Face& aF=TopoDS::Face(aS); FacePassKey(aF, aPKF); @@ -613,7 +637,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) } // check geometric coincidence if (myCheckGeometry) { - iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); + iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); if (iErr) { myErrorStatus=200; return; @@ -634,7 +658,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) // bHasNewSubShape=Standard_True; // prevent creation of a new shape if there are not - // new subshapes of aSS among the originals + // new sub-shapes of aSS among the originals if (aNbSDF==1) { bHasNewSubShape=HasNewSubShape(aS1); if (!bHasNewSubShape) { @@ -643,7 +667,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) } } // - if (bHasNewSubShape) { + if (bHasNewSubShape) { if (aType==TopAbs_FACE) { TopoDS_Face aNewFace; // @@ -673,7 +697,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) } //======================================================================= //function : CheckResult -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::CheckResult() { @@ -681,9 +705,9 @@ void GEOMAlgo_Gluer::CheckResult() // if (myResult.IsNull()) { myErrorStatus=6; - return; + return; } - // + // Standard_Boolean bFound; Standard_Integer i, j, aNbS, aNbFS, aNbSx; TopTools_IndexedMapOfShape aMS, aMFS; @@ -692,7 +716,7 @@ void GEOMAlgo_Gluer::CheckResult() TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFR); TopExp::MapShapes(myResult, TopAbs_SOLID, aMS); // - + myNbAlone=0; aNbS=aMS.Extent(); for (i=1; i<=aNbS; ++i) { @@ -724,7 +748,7 @@ void GEOMAlgo_Gluer::CheckResult() } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::CheckData() { @@ -732,12 +756,12 @@ void GEOMAlgo_Gluer::CheckData() // if (myShape.IsNull()) { myErrorStatus=5; - return; + return; } } //======================================================================= //function : InnerTolerance -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Gluer::InnerTolerance() { @@ -770,9 +794,9 @@ void GEOMAlgo_Gluer::InnerTolerance() } //======================================================================= //function : FacePassKey -//purpose : +//purpose : //======================================================================= -void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, +void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, GEOMAlgo_PassKeyShape& aPK) { Standard_Integer i, aNbE; @@ -795,9 +819,9 @@ void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, } //======================================================================= //function : EdgePassKey -//purpose : +//purpose : //======================================================================= -void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, +void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, GEOMAlgo_PassKeyShape& aPK) { TopoDS_Vertex aV1, aV2; @@ -814,9 +838,9 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, } //======================================================================= //function : MakeVertex -//purpose : +//purpose : //======================================================================= -void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV, +void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV, TopoDS_Vertex& aNewVertex) { Standard_Integer aNbV; @@ -860,9 +884,9 @@ void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV, } //======================================================================= //function : MakeEdge -//purpose : +//purpose : //======================================================================= -void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, +void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, TopoDS_Edge& aNewEdge) { myErrorStatus=0; @@ -909,14 +933,14 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, } // else { - BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); + BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); } } //======================================================================= //function : MakeFace -//purpose : +//purpose : //======================================================================= -void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, +void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, TopoDS_Face& aNewFace) { myErrorStatus=0; @@ -958,8 +982,8 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax); } BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD); - - // orient image + + // orient image bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext); if (bIsToReverse) { aER.Reverse(); @@ -984,7 +1008,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, } //======================================================================= //function : IsToReverse -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR, const TopoDS_Face& aF) @@ -1011,7 +1035,7 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR, aC3D=BRep_Tool::Curve(aE, aT1, aT2); aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); aC3D->D0(aT, aP); - myContext.ProjectPointOnEdge(aP, aER, aTR); + myContext->ProjectPointOnEdge(aP, aER, aTR); // BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF); if (aF.Orientation()==TopAbs_REVERSED) { @@ -1030,7 +1054,7 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR, } //======================================================================= //function : HasNewSubShape -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const { @@ -1063,7 +1087,7 @@ Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const } //======================================================================= //function : GetSubShapes -//purpose : +//purpose : //======================================================================= void GetSubShapes(const TopoDS_Shape& aS, TopTools_IndexedMapOfShape& aMSS) @@ -1087,9 +1111,9 @@ void GetSubShapes(const TopoDS_Shape& aS, } //======================================================================= //function : Modified -//purpose : +//purpose : //======================================================================= -const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) +const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) { TopAbs_ShapeEnum aType; // @@ -1097,11 +1121,11 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) // aType=aS.ShapeType(); if (aType==TopAbs_VERTEX || - aType==TopAbs_EDGE || - aType==TopAbs_WIRE || - aType==TopAbs_FACE || - aType==TopAbs_SHELL || - aType==TopAbs_SOLID) { + aType==TopAbs_EDGE || + aType==TopAbs_WIRE || + aType==TopAbs_FACE || + aType==TopAbs_SHELL || + aType==TopAbs_SOLID) { if(myOrigins.IsBound(aS)) { const TopoDS_Shape& aSnew=myOrigins.Find(aS); if (!aSnew.IsSame(aS)) { @@ -1114,7 +1138,7 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) } //======================================================================= //function : Generated -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Gluer::Generated(const TopoDS_Shape& ) { @@ -1123,7 +1147,7 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer::Generated(const TopoDS_Shape& ) } //======================================================================= //function : IsDeleted -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Gluer::IsDeleted (const TopoDS_Shape& aS) { @@ -1134,10 +1158,11 @@ Standard_Boolean GEOMAlgo_Gluer::IsDeleted (const TopoDS_Shape& aS) // return bRet; } + // // ErrorStatus // -// 1 - the object is just initialized +// 1 - the object is just initialized // 2 - no vertices found in source shape // 3 - nb same domain vertices for the vertex Vi =0 // 4 - nb same domain edges(faces) for the edge Ei(face Fi) =0 diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.hxx b/src/GEOMAlgo/GEOMAlgo_Gluer.hxx index 980424de0..406004e7c 100644 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.hxx @@ -1,220 +1,164 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + +// Copyright (C) 2007-2012 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 // -// 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: GEOMAlgo_Gluer.hxx +// Created: Sat Dec 04 12:45:53 2004 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_Gluer_HeaderFile #define _GEOMAlgo_Gluer_HeaderFile -#ifndef _Standard_Boolean_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile #include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile #include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -#ifndef _TopoDS_Compound_HeaderFile +#include +#include +#include +#include +#include +#include #include -#endif -class TopTools_ListOfShape; -class TopoDS_Shape; -class TopoDS_Edge; -class GEOMAlgo_PassKeyShape; -class TopoDS_Face; -class TopoDS_Vertex; -class TopTools_DataMapOfShapeListOfShape; -class TopTools_DataMapOfShapeShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - +//======================================================================= +//class : GEOMAlgo_Gluer +//purpose : +//======================================================================= class GEOMAlgo_Gluer : public GEOMAlgo_ShapeAlgo { - public: + Standard_EXPORT + GEOMAlgo_Gluer(); - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_Gluer(); -Standard_EXPORT virtual ~GEOMAlgo_Gluer(); - - -Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ; - - -Standard_EXPORT Standard_Boolean CheckGeometry() const; - - -Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean aFlag) ; - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT Standard_Integer AloneShapes() const; + Standard_EXPORT + virtual ~GEOMAlgo_Gluer(); + Standard_EXPORT + void SetCheckGeometry(const Standard_Boolean aFlag) ; -Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ; + Standard_EXPORT + Standard_Boolean CheckGeometry() const; + Standard_EXPORT + void SetKeepNonSolids(const Standard_Boolean aFlag) ; -Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ; + Standard_EXPORT + Standard_Boolean KeepNonSolids() const; + Standard_EXPORT + virtual void Perform() ; -Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S) ; + Standard_EXPORT + Standard_Integer AloneShapes() const; + Standard_EXPORT + const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ; -Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const; + Standard_EXPORT + const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ; + Standard_EXPORT + Standard_Boolean IsDeleted(const TopoDS_Shape& S) ; -Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const; + Standard_EXPORT + const TopTools_DataMapOfShapeListOfShape& Images() const; + Standard_EXPORT + const TopTools_DataMapOfShapeShape& Origins() const; + protected: + Standard_EXPORT + virtual void CheckData() ; + Standard_EXPORT + virtual void CheckResult() ; + Standard_EXPORT + void MakeVertices() ; -protected: + Standard_EXPORT + void MakeEdges() ; - // Methods PROTECTED - // + Standard_EXPORT + void MakeFaces() ; + Standard_EXPORT + void MakeShapes(const TopAbs_ShapeEnum aType) ; -Standard_EXPORT virtual void CheckData() ; + Standard_EXPORT + void MakeShells() ; + Standard_EXPORT + void MakeSolids() ; -Standard_EXPORT virtual void CheckResult() ; + Standard_EXPORT + void InnerTolerance() ; + Standard_EXPORT + void EdgePassKey(const TopoDS_Edge& aE, + GEOMAlgo_PassKeyShape& aPK) ; -Standard_EXPORT void MakeVertices() ; + Standard_EXPORT + void FacePassKey(const TopoDS_Face& aF, + GEOMAlgo_PassKeyShape& aPK) ; + Standard_EXPORT + void MakeVertex(const TopTools_ListOfShape& aLV, + TopoDS_Vertex& aNewV) ; -Standard_EXPORT void MakeEdges() ; + Standard_EXPORT + void MakeEdge(const TopoDS_Edge& aEdge, + TopoDS_Edge& aNewEdge) ; + Standard_EXPORT + void MakeFace(const TopoDS_Face& aFace, + TopoDS_Face& aNewEdge) ; -Standard_EXPORT void MakeFaces() ; + Standard_EXPORT + Standard_Boolean IsToReverse(const TopoDS_Face& aFR, + const TopoDS_Face& aF) ; + Standard_EXPORT + Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const; -Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ; - - -Standard_EXPORT void MakeShells() ; - - -Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& theShape, - TopTools_MapOfShape& theMS, - TopoDS_Compound& theResult); - - -Standard_EXPORT void MakeSolids() ; - - -Standard_EXPORT void InnerTolerance() ; - - -Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,GEOMAlgo_PassKeyShape& aPK) ; - - -Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,GEOMAlgo_PassKeyShape& aPK) ; - - -Standard_EXPORT void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex& aNewV) ; - - -Standard_EXPORT void MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ; - - -Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& aNewEdge) ; - - -Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ; - - -Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const; - - - // Fields PROTECTED - // -Standard_Boolean myCheckGeometry; -Standard_Boolean myKeepNonSolids; -Standard_Real myTol; -TopTools_DataMapOfShapeListOfShape myImages; -TopTools_DataMapOfShapeShape myOrigins; -Standard_Integer myNbAlone; -TopTools_ListOfShape myGenerated; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + void MakeSubShapes(const TopoDS_Shape& aS, + TopTools_MapOfShape& aM, + TopoDS_Compound& aC) ; + Standard_Boolean myCheckGeometry; + Standard_Boolean myKeepNonSolids; + Standard_Real myTol; + TopTools_DataMapOfShapeListOfShape myImages; + TopTools_DataMapOfShapeShape myOrigins; + Standard_Integer myNbAlone; + TopTools_ListOfShape myGenerated; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.ixx b/src/GEOMAlgo/GEOMAlgo_Gluer.ixx deleted file mode 100644 index 574d72d81..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.jxx b/src/GEOMAlgo/GEOMAlgo_Gluer.jxx deleted file mode 100644 index 86f3f36ab..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.jxx +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Gluer_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl b/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl deleted file mode 100755 index de00fbc0b..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Gluer1.cdl --- Created: Wed Jan 24 11:37:31 2007 --- Author: Peter KURNEV --- --- -class Gluer1 from GEOMAlgo - inherits Gluer from GEOMAlgo - - ---Purpose: - -uses - ListOfCoupleOfShapes from GEOMAlgo, - DataMapOfPassKeyShapeShape from GEOMAlgo - ---raises - -is - Create - returns Gluer1 from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Gluer1();" - - SetFacesToUnglue(me:out; - aLCS:ListOfCoupleOfShapes from GEOMAlgo); - - FacesToUnglue(me) - returns ListOfCoupleOfShapes from GEOMAlgo; - ---C++: return const& - - GluedFaces(me) - returns ListOfCoupleOfShapes from GEOMAlgo; - ---C++: return const& - - RejectedFaces(me) - returns ListOfCoupleOfShapes from GEOMAlgo; - ---C++: return const& - - Perform(me:out) - is redefined; - - UnglueFaces(me:out); - - FillGluedFaces(me:out) - is protected; - -fields - myGluedFaces :ListOfCoupleOfShapes from GEOMAlgo is protected; - myFacesToUnglue :ListOfCoupleOfShapes from GEOMAlgo is protected; - myRejectedFaces :ListOfCoupleOfShapes from GEOMAlgo is protected; - myMapGN :DataMapOfPassKeyShapeShape from GEOMAlgo is protected; - -end Gluer1; diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx deleted file mode 100755 index fbcec0512..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx +++ /dev/null @@ -1,543 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: GEOMAlgo_Gluer1.cxx -// Created: Wed Jan 24 11:52:27 2007 -// Author: Peter KURNEV -// -// -#include - -#include - -#include - -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -//======================================================================= -//class : GEOMAlgo_CoupleOfInteger -//purpose : -//======================================================================= -class GEOMAlgo_CoupleOfInteger { - // - public: - // - GEOMAlgo_CoupleOfInteger() { - myInt1=0; - myInt2=0; - } - // - ~GEOMAlgo_CoupleOfInteger() { - } - // - void SetValues(const Standard_Integer aI1, - const Standard_Integer aI2) { - myInt1=aI1; - myInt2=aI2; - } - // - void SetValue1(const Standard_Integer aI1) { - myInt1=aI1; - } - // - void SetValue2(const Standard_Integer aI1) { - myInt1=aI1; - } - // - void Values(Standard_Integer& aI1, - Standard_Integer& aI2) const { - aI1=myInt1; - aI2=myInt2; - } - // - Standard_Integer Value1()const { - return myInt1; - } - // - Standard_Integer Value2()const { - return myInt2; - } - // - protected: - Standard_Integer myInt1; - Standard_Integer myInt2; -}; -// -//======================================================================= -// -static - void SortShell(const Standard_Integer , - GEOMAlgo_CoupleOfInteger* ); -static - void RefineSolid(const TopoDS_Shape& , - const TopTools_DataMapOfShapeShape& , - TopTools_DataMapOfShapeShape& ); -static - void MakeFaceToReplace(const TopoDS_Face& , - TopoDS_Face& ); -// -//======================================================================= -//function : GEOMAlgo_Gluer1 -//purpose : -//======================================================================= - GEOMAlgo_Gluer1::GEOMAlgo_Gluer1() -: - GEOMAlgo_Gluer() -{ -} -//======================================================================= -//function : -//purpose : -//======================================================================= - GEOMAlgo_Gluer1::~GEOMAlgo_Gluer1() -{ -} -//======================================================================= -//function : SetFacesToUnglue -//purpose : -//======================================================================= - void GEOMAlgo_Gluer1::SetFacesToUnglue(const GEOMAlgo_ListOfCoupleOfShapes& aLCS) -{ - myFacesToUnglue=aLCS; -} -//======================================================================= -//function : FacesToUnglue -//purpose : -//======================================================================= - const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::FacesToUnglue()const -{ - return myFacesToUnglue; -} -//======================================================================= -//function : GluedFaces -//purpose : -//======================================================================= - const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::GluedFaces()const -{ - return myGluedFaces; -} -//======================================================================= -//function : RejectedFaces -//purpose : -//======================================================================= - const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::RejectedFaces()const -{ - return myRejectedFaces; -} -//======================================================================= -//function : Perform -//purpose : -//======================================================================= - void GEOMAlgo_Gluer1::Perform() -{ - // 1. - GEOMAlgo_Gluer::Perform(); - if (myErrorStatus) { - return; - } - // - FillGluedFaces(); - if (myErrorStatus) { - return; - } -} -//======================================================================= -//function : FillGluedFaces -//purpose : -//======================================================================= - void GEOMAlgo_Gluer1::FillGluedFaces() -{ - myErrorStatus=0; - // - Standard_Integer aNbIm, aNbS, i; - TopAbs_ShapeEnum aType; - TopTools_ListIteratorOfListOfShape aItLS; - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; - GEOMAlgo_CoupleOfShapes aCS; - GEOMAlgo_PassKeyShape aPKS; - // - myMapGN.Clear(); - myGluedFaces.Clear(); - // - aNbIm=myImages.Extent(); - aItIm.Initialize(myImages); - for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aSnew=aItIm.Key(); - aType=aSnew.ShapeType(); - if (aType!=TopAbs_FACE) { - continue; - } - // - const TopTools_ListOfShape& aLS=aItIm.Value(); - aNbS=aLS.Extent(); - if (aNbS!=2) { - continue; - } - // - TopoDS_Shape aSold[2]; - aItLS.Initialize(aLS); - for (i=0; aItLS.More(); aItLS.Next(), ++i) { - const TopoDS_Shape& aSi=aItLS.Value(); - aSold[i]=aItLS.Value(); - } - // - aCS.SetShapes(aSold[0], aSold[1]); - myGluedFaces.Append(aCS); - // - aPKS.Clear(); - aPKS.SetShapes(aSold[0], aSold[1]); - myMapGN.Bind(aPKS, aSnew); - } -} -//======================================================================= -//function : UnglueFaces -//purpose : -//======================================================================= - void GEOMAlgo_Gluer1::UnglueFaces() -{ - if (myErrorStatus) { - return; - } - // - Standard_Boolean bFound; - Standard_Integer i, aNbUN, aNbS, aNbF, iX; - TopTools_IndexedDataMapOfShapeListOfShape aMFSR, aMFS, aMSF; - TopTools_ListIteratorOfListOfShape aItLS, aItLS1; - GEOMAlgo_PassKeyShape aPKS; - GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; - GEOMAlgo_DataMapOfPassKeyShapeShape aMapUN; - GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape aItUN; - GEOMAlgo_CoupleOfInteger *pIx; - // - if (myResult.IsNull()) { - myErrorStatus=200; // no result - return; - } - myWarningStatus=0; - myRejectedFaces.Clear(); - // - // 0. Fill map [Face]/Solid for myResult: aMFSR - TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFSR); - // - // 1. Fill Faces to process: aMapUN : [Fold1, Fold2] / Fnew - aNbUN=myFacesToUnglue.Extent(); - if (!aNbUN) { - // all faces that can be unglued will be unglued - aMapUN=myMapGN; - myFacesToUnglue=myGluedFaces; - } - else { - aItCS.Initialize(myFacesToUnglue); - for (; aItCS.More(); aItCS.Next()) { - const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value(); - const TopoDS_Shape& aS1=aCS.Shape1(); - const TopoDS_Shape& aS2=aCS.Shape2(); - aPKS.Clear(); - aPKS.SetShapes(aS1, aS2); - if (!myMapGN.IsBound(aPKS)) { - //some faces, wanted to unglue, are not glued at all; - myWarningStatus=2; - myRejectedFaces.Append(aCS); - continue; - } - // - const TopoDS_Shape& aFN=myMapGN.Find(aPKS); - aMapUN.Bind(aPKS, aFN); - } - } - // - // 2 Fill map FN/Solids for myResult: aMFS - aNbUN=aMapUN.Extent(); - aItUN.Initialize(aMapUN); - for (; aItUN.More(); aItUN.Next()) { - const TopoDS_Shape& aFN=aItUN.Value(); - if (!aMFSR.Contains(aFN)) { - myWarningStatus=3; // how can it be - continue; - } - // - const TopTools_ListOfShape& aLS=aMFSR.FindFromKey(aFN); - aNbS=aLS.Extent(); - if (aNbS!=2) { - // wrong result: More than 2 solids shared one face - myWarningStatus=4; - continue; - } - aMFS.Add(aFN, aLS); - } - // - // 3 Fill map Solids/FN for myResult: aMSF - aNbUN=aMFS.Extent(); - for (i=1; i<=aNbUN; ++i) { - const TopoDS_Shape& aFN=aMFS.FindKey(i); - const TopTools_ListOfShape& aLS=aMFS(i); - aItLS.Initialize(aLS); - for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aS=aItLS.Value(); - if (aMSF.Contains(aS)) { - TopTools_ListOfShape& aLF=aMSF.ChangeFromKey(aS); - aLF.Append(aFN); - } - else { - TopTools_ListOfShape aLF; - aLF.Append(aFN); - aMSF.Add(aS, aLF); - } - } - } - // - // 4 Sort indices of aMSF - aNbS=aMSF.Extent(); - if (aNbS<2) { - // wrong number of solids that have shared face - myWarningStatus=5; - } - // - pIx=new GEOMAlgo_CoupleOfInteger[aNbS]; - // - for (i=1; i<=aNbS; ++i) { - const TopTools_ListOfShape& aLF=aMSF(i); - aNbF=aLF.Extent(); - pIx[i-1].SetValues(aNbF, i); - } - SortShell(aNbS, pIx); - // - // 5 Refine solids - // - TopTools_DataMapOfShapeShape aMFNFN2, aMFNFD; - TopTools_DataMapIteratorOfDataMapOfShapeShape aItMSS; - TopTools_MapOfShape aMFNP; - TopTools_IndexedMapOfShape aMFD; - // - for (iX=aNbS-1; iX>=0; --iX) { - i=pIx[iX].Value2(); - // solid from myResult aSN - const TopoDS_Shape& aSN=aMSF.FindKey(i); - // - // candidates to be faces to replace for aSN - const TopTools_ListOfShape& aLFN=aMSF(i); - aNbF=aLFN.Extent(); - // - // original solid for aSN -> aSD - const TopTools_ListOfShape& aLSD=myImages.Find(aSN); - const TopoDS_Shape& aSD=aLSD.First(); - // - // faces of original solid -> aMFD - aMFD.Clear(); - TopExp::MapShapes(aSD, TopAbs_FACE, aMFD); - // - // faces to replace for aSN [FN]/FD -> aMFNFD - aMFNFD.Clear(); - aItLS.Initialize(aLFN); - for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aFN=aItLS.Value(); - if (!aMFNP.Add(aFN)) { - continue; - } - // - // original face from original solid -> FD - TopoDS_Shape aFD; - // - bFound=Standard_False; - const TopTools_ListOfShape& aLFD=myImages.Find(aFN); - aItLS1.Initialize(aLFD); - for (; aItLS1.More(); aItLS1.Next()) { - const TopoDS_Shape& aFDx=aItLS1.Value(); - if (aMFD.Contains(aFDx)) { - aFD=aFDx; - bFound=Standard_True; - break; - } - } - //if (!bFound) {...} - aMFNFD.Bind(aFN, aFD); - } // for (; aItLS.More(); aItLS.Next()) { - // - aNbF=aMFNFD.Extent(); - if (!aNbF) { - // nothing to do here - continue; - } - // update solid SN (and its shells) - RefineSolid(aSN, aMFNFD, aMFNFN2); - // - // update myOrigins / myImages - aItMSS.Initialize(aMFNFD); - for (; aItMSS.More(); aItMSS.Next()) { - const TopoDS_Shape& aFN=aItMSS.Key(); // face removed from aSN - const TopoDS_Shape& aFD=aItMSS.Value(); // old face from aSD - const TopoDS_Shape& aFN2=aMFNFN2.Find(aFN);// face added to aSN - // - // myOrigins - myOrigins.ChangeFind(aFD)=aFN2; - // - // myImages - TopTools_ListOfShape aLFDx; - // - TopTools_ListOfShape& aLFD=myImages.ChangeFind(aFN); - aItLS.Initialize(aLFD); - for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aFDx=aItLS.Value(); - if (!aFDx.IsSame(aFD)) { - aLFDx.Append(aFDx); - } - } - aLFD=aLFDx; - // - aLFDx.Clear(); - aLFDx.Append(aFD); - myImages.Bind(aFN2, aLFDx); - } // for (; aItMSS.More(); aItMSS.Next()) { - } // for (iX=aNbS-1; iX>=0; --iX) { - // - delete [] pIx; -} -//======================================================================= -// function: RefineSolid -// purpose : replace faces (aMFN) of solid aSd by new ones -//======================================================================= -void RefineSolid(const TopoDS_Shape& aSd, - const TopTools_DataMapOfShapeShape& aMFNFD, - TopTools_DataMapOfShapeShape& aMFNFN2) -{ - TopoDS_Shape *pSh; - TopoDS_Face aF2; - TopoDS_Iterator aItSd, aItSh; - BRep_Builder aBB; - TopTools_ListOfShape aLF; - TopTools_ListIteratorOfListOfShape aItLF; - // - aItSd.Initialize(aSd); - for (; aItSd.More(); aItSd.Next()) { - const TopoDS_Shape& aSh=aItSd.Value(); - pSh=(TopoDS_Shape *)&aSh; - pSh->Free(Standard_True); - aLF.Clear(); - aItSh.Initialize(*pSh); - for (; aItSh.More(); aItSh.Next()) { - const TopoDS_Shape& aF=aItSh.Value(); - if (aMFNFD.IsBound(aF)) { - aLF.Append(aF); - } - } - // - aItLF.Initialize(aLF); - for (; aItLF.More(); aItLF.Next()) { - const TopoDS_Face& aF=TopoDS::Face(aItLF.Value()); - // - MakeFaceToReplace(aF, aF2); - // - aMFNFN2.Bind(aF, aF2); - aBB.Remove(*pSh, aF); - aBB.Add(*pSh, aF2); - } - pSh->Free(Standard_False); - } -} -//======================================================================= -//function : MakeFaceToReplace -//purpose : -//======================================================================= -void MakeFaceToReplace(const TopoDS_Face& aF, - TopoDS_Face& aFR) -{ - Standard_Real aTol; - Handle(Geom_Surface) aS; - TopLoc_Location aLoc; - TopoDS_Face aFFWD, aFnew; - TopoDS_Iterator aItF; - BRep_Builder aBB; - // - aFFWD=aF; - aFFWD.Orientation(TopAbs_FORWARD); - aS=BRep_Tool::Surface(aFFWD, aLoc); - aTol=BRep_Tool::Tolerance(aFFWD); - // - aBB.MakeFace (aFnew, aS, aLoc, aTol); - aItF.Initialize(aFFWD); - for (; aItF.More(); aItF.Next()) { - const TopoDS_Shape& aW=aItF.Value(); - aBB.Add(aFnew, aW); - } - aFnew.Orientation(aF.Orientation()); - aFR=aFnew; -} -//======================================================================= -// function: SortShell -// purpose : -//======================================================================= -void SortShell(const Standard_Integer n, - GEOMAlgo_CoupleOfInteger* a) -{ - Standard_Integer nd, i, j, l, d=1; - GEOMAlgo_CoupleOfInteger x; - // - while(d<=n) { - d*=2; - } - // - while (d) { - d=(d-1)/2; - // - nd=n-d; - for (i=0; i -1) { - goto m30; - } - }//if (a[l] < a[j]){ - }//for (i=0; i -#endif -#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Gluer_HeaderFile -#include -#endif -class GEOMAlgo_ListOfCoupleOfShapes; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_Gluer1 : public GEOMAlgo_Gluer { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_Gluer1(); -Standard_EXPORT virtual ~GEOMAlgo_Gluer1(); - - -Standard_EXPORT void SetFacesToUnglue(const GEOMAlgo_ListOfCoupleOfShapes& aLCS) ; - - -Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& FacesToUnglue() const; - - -Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& GluedFaces() const; - - -Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& RejectedFaces() const; - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT void UnglueFaces() ; - - - - - -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT void FillGluedFaces() ; - - - // Fields PROTECTED - // -GEOMAlgo_ListOfCoupleOfShapes myGluedFaces; -GEOMAlgo_ListOfCoupleOfShapes myFacesToUnglue; -GEOMAlgo_ListOfCoupleOfShapes myRejectedFaces; -GEOMAlgo_DataMapOfPassKeyShapeShape myMapGN; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx b/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx deleted file mode 100644 index 8081a3d03..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx b/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx deleted file mode 100644 index 307f27e7f..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Gluer1_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer2.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer2.cxx new file mode 100644 index 000000000..0a7b969bf --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer2.cxx @@ -0,0 +1,650 @@ +// Copyright (C) 2007-2012 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 +// + +// File: GEOMAlgo_Gluer2.cxx +// Author: Peter KURNEV + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GEOMAlgo_Gluer2 +//purpose : +//======================================================================= +GEOMAlgo_Gluer2::GEOMAlgo_Gluer2() +: + GEOMAlgo_GluerAlgo(), + GEOMAlgo_BuilderShape() +{ + myTolerance=0.0001; +} +//======================================================================= +//function : ~GEOMAlgo_Gluer2 +//purpose : +//======================================================================= +GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2() +{ +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::Clear() +{ + myErrorStatus=0; + myWarningStatus=0; + // + GEOMAlgo_GluerAlgo::Clear(); + // + myImagesDetected.Clear(); + myOriginsDetected.Clear(); + myShapesToGlue.Clear(); + myImagesToWork.Clear(); + myOriginsToWork.Clear(); + myKeepNonSolids=Standard_False; + //modified by NIZNHY-PKV Tue Mar 13 13:38:28 2012f + myDetector.Clear(); + //modified by NIZNHY-PKV Tue Mar 13 13:38:30 2012t +} +//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f +//======================================================================= +//function : StickedShapes +//purpose : +//======================================================================= +const TopTools_IndexedDataMapOfShapeListOfShape& + GEOMAlgo_Gluer2::StickedShapes() +{ + return myDetector.StickedShapes(); +} +//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t +//======================================================================= +//function : SetShapesToGlue +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) +{ + myShapesToGlue=aM; +} +//======================================================================= +//function : ShapesToGlue +//purpose : +//======================================================================= +const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesToGlue()const +{ + return myShapesToGlue; +} +//======================================================================= +//function : SetKeepNonSolids +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::SetKeepNonSolids(const Standard_Boolean aFlag) +{ + myKeepNonSolids=aFlag; +} +//======================================================================= +//function : KeepNonSolids +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer2::KeepNonSolids()const +{ + return myKeepNonSolids; +} +//======================================================================= +//function : ShapesDetected +//purpose : +//======================================================================= +const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesDetected()const +{ + return myImagesDetected; +} +//======================================================================= +//function : ImagesToWork +//purpose : +//======================================================================= +const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ImagesToWork()const +{ + return myImagesToWork; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + // + CheckData(); + if (myErrorStatus) { + return; + } + // + // Initialize the context + GEOMAlgo_GluerAlgo::Perform(); + // + PerformShapesToWork(); + if (myErrorStatus) { + return; + } + if (myWarningStatus==1) { + // no shapes to glue + myShape=myArgument; + return; + } + // + FillVertices(); + if (myErrorStatus) { + return; + } + // + FillEdges(); + if (myErrorStatus) { + return; + } + // + FillWires(); + if (myErrorStatus) { + return; + } + // + FillFaces(); + if (myErrorStatus) { + return; + } + // + FillShells(); + if (myErrorStatus) { + return; + } + // + FillSolids(); + if (myErrorStatus) { + return; + } + // + FillCompSolids(); + if (myErrorStatus) { + return; + } + // + FillCompounds(); + if (myErrorStatus) { + return; + } + // + BuildResult(); + if (myErrorStatus) { + return; + } + // + PrepareHistory(); + if (myErrorStatus) { + return; + } + // + BRepLib::SameParameter(myShape, myTolerance, Standard_True); +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::CheckData() +{ + Standard_Integer aNbSG, i; + TopAbs_ShapeEnum aType, aTypeX; + TopTools_ListIteratorOfListOfShape aItLS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; + // + myErrorStatus=0; + myWarningStatus=0; + // + aNbSG=myShapesToGlue.Extent(); + if (aNbSG) { + // Check myShapesToGlue + aItDMSLS.Initialize(myShapesToGlue); + for (; aItDMSLS.More(); aItDMSLS.Next()) { + //const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape& aLSG=aItDMSLS.Value(); + aItLS.Initialize(aLSG); + for (i=0; aItLS.More(); aItLS.Next(), ++i) { + const TopoDS_Shape& aSG=aItLS.Value(); + aTypeX=aSG.ShapeType(); + if (!i) { + aType=aTypeX; + if (!(aType==TopAbs_VERTEX || + aType==TopAbs_EDGE || + aType==TopAbs_FACE)) { + myErrorStatus=21;// non-brep shapes + return; + } + continue; + } + if (aTypeX!=aType) { + myErrorStatus=20;// non-homogeneous shapes + return; + } + } + } + }// if (aNbSG) { +} +//======================================================================= +//function : FillEdges +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillEdges() +{ + FillBRepShapes(TopAbs_EDGE); +} +//======================================================================= +//function : FillFaces +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillFaces() +{ + FillBRepShapes(TopAbs_FACE); +} +//======================================================================= +//function : FillWires +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillWires() +{ + FillContainers(TopAbs_WIRE); +} +//======================================================================= +//function : FillShells +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillShells() +{ + FillContainers(TopAbs_SHELL); +} +//======================================================================= +//function : FillSolids +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillSolids() +{ + FillContainers(TopAbs_SOLID); +} +//======================================================================= +//function : FillCompSolids +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillCompSolids() +{ + FillContainers(TopAbs_COMPSOLID); +} +//======================================================================= +//function : FillVertices +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillVertices() +{ + TopAbs_ShapeEnum aType; + TopoDS_Vertex aVnew; + TopTools_ListIteratorOfListOfShape aItLS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; + // + myErrorStatus=0; + myWarningStatus=0; + // + aItDMSLS.Initialize(myImagesToWork); + for (; aItDMSLS.More(); aItDMSLS.Next()) { + const TopoDS_Shape& aSkey=aItDMSLS.Key(); + aType=aSkey.ShapeType(); + if (aType!=TopAbs_VERTEX) { + continue; + } + // + const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + // + GEOMAlgo_Gluer2::MakeVertex(aLSD, aVnew); + // + myImages.Bind(aVnew, aLSD); + // + aItLS.Initialize(aLSD); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aV=aItLS.Value(); + myOrigins.Bind(aV, aVnew); + } + } +} +//======================================================================= +//function : FillBRepShapes +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillBRepShapes(const TopAbs_ShapeEnum theType) +{ + Standard_Boolean bHasImage, bIsToWork; + Standard_Integer i, aNbE; + TopoDS_Iterator aItS; + TopoDS_Shape aEnew; + TopTools_IndexedMapOfShape aME; + TopTools_MapOfShape aMFence; + TopTools_ListIteratorOfListOfShape aItLS; + // + myErrorStatus=0; + myWarningStatus=0; + // + TopExp::MapShapes(myArgument, theType, aME); + // + aNbE=aME.Extent(); + for (i=1; i<=aNbE; ++i) { + const TopoDS_Shape& aE=aME(i); + // + if (!aMFence.Add(aE)) { + continue; + } + // + bIsToWork=myOriginsToWork.IsBound(aE); + bHasImage=HasImage(aE); + if (!bHasImage && !bIsToWork) { + continue; + } + // + MakeBRepShapes(aE, aEnew); + // + //myImages / myOrigins + if (bIsToWork) { + const TopoDS_Shape& aSkey=myOriginsToWork.Find(aE); + const TopTools_ListOfShape& aLSD=myImagesToWork.Find(aSkey); + // + myImages.Bind(aEnew, aLSD); + // + aItLS.Initialize(aLSD); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aEx=aItLS.Value(); + myOrigins.Bind(aEx, aEnew); + // + aMFence.Add(aEx); + } + } + else { + TopTools_ListOfShape aLSD; + // + aLSD.Append(aE); + myImages.Bind(aEnew, aLSD); + myOrigins.Bind(aE, aEnew); + } + }//for (i=1; i<=aNbF; ++i) { +} +//======================================================================= +//function : FillContainers +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType) +{ + Standard_Boolean bHasImage, bToReverse; + Standard_Integer i, aNbW; + TopoDS_Shape aWnew, aEnew; + TopoDS_Iterator aItS; + BRep_Builder aBB; + TopTools_IndexedMapOfShape aMW; + TopTools_MapOfShape aMFence; + // + myErrorStatus=0; + myWarningStatus=0; + // + TopExp::MapShapes(myArgument, aType, aMW); + // + aNbW=aMW.Extent(); + for (i=1; i<=aNbW; ++i) { + const TopoDS_Shape& aW=aMW(i); + // + if (!aMFence.Add(aW)) { + continue; + } + // + bHasImage=HasImage(aW); + if (!bHasImage) { + continue; + } + // + GEOMAlgo_Tools3D::MakeContainer(aType, aWnew); + aWnew.Orientation(aW.Orientation()); + // + aItS.Initialize(aW); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aE=aItS.Value(); + if (myOrigins.IsBound(aE)) { + aEnew=myOrigins.Find(aE); + // + bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aEnew, aE, myContext); + if (bToReverse) { + aEnew.Reverse(); + } + // + aBB.Add(aWnew, aEnew); + } + else { + aBB.Add(aWnew, aE); + } + } + // + //myImages / myOrigins + TopTools_ListOfShape aLSD; + // + aLSD.Append(aW); + myImages.Bind(aWnew, aLSD); + myOrigins.Bind(aW, aWnew); + // + }//for (i=1; i<=aNbE; ++i) { +} +//======================================================================= +//function : FillCompounds +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillCompounds() +{ + TopAbs_ShapeEnum aType; + TopoDS_Iterator aItC; + // + myErrorStatus=0; + myWarningStatus=0; + // + aItC.Initialize(myArgument); + for (; aItC.More(); aItC.Next()) { + const TopoDS_Shape& aCx=aItC.Value(); + aType=aCx.ShapeType(); + if (aType==TopAbs_COMPOUND) { + FillCompound(aCx); + } + } +} +//======================================================================= +//function : FillCompound +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC) +{ + Standard_Boolean bHasImage; + TopAbs_ShapeEnum aType; + TopoDS_Shape aCnew, aCXnew; + TopoDS_Iterator aItC; + BRep_Builder aBB; + // + bHasImage=HasImage(aC); + if (!bHasImage) { + return; + } + // + GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew); + // + aItC.Initialize(aC); + for (; aItC.More(); aItC.Next()) { + const TopoDS_Shape& aCX=aItC.Value(); + aType=aCX.ShapeType(); + // + if (aType==TopAbs_COMPOUND) { + FillCompound(aCX); + } + // + if (myOrigins.IsBound(aCX)) { + aCXnew=myOrigins.Find(aCX); + aCXnew.Orientation(aCX.Orientation()); + aBB.Add(aCnew, aCXnew); + } + else { + aBB.Add(aCnew, aCX); + } + } + // + //myImages / myOrigins + TopTools_ListOfShape aLSD; + // + aLSD.Append(aC); + myImages.Bind(aCnew, aLSD); + myOrigins.Bind(aC, aCnew); +} +//======================================================================= +//function : HasImage +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer2::HasImage(const TopoDS_Shape& aC) +{ + Standard_Boolean bRet; + TopAbs_ShapeEnum aType; + TopoDS_Iterator aItC; + // + bRet=Standard_False; + aItC.Initialize(aC); + for (; aItC.More(); aItC.Next()) { + const TopoDS_Shape& aCx=aItC.Value(); + aType=aCx.ShapeType(); + // + if (aType==TopAbs_COMPOUND) { + bRet=HasImage(aCx); + if (bRet) { + return bRet; + } + } + else { + bRet=myOrigins.IsBound(aCx); + if (bRet) { + return bRet; + } + } + } + // + bRet=myOrigins.IsBound(aC); + // + return bRet; +} +//======================================================================= +//function : BuildResult +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::BuildResult() +{ + Standard_Boolean bHasImage; + TopoDS_Shape aCnew, aCXnew; + TopoDS_Iterator aItC; + BRep_Builder aBB; + // + myErrorStatus=0; + myWarningStatus=0; + // + aItC.Initialize(myArgument); + for (; aItC.More(); aItC.Next()) { + const TopoDS_Shape& aCx=aItC.Value(); + bHasImage=HasImage(aCx); + if (bHasImage) { + break; + } + } + // + if (!bHasImage) { + myShape=myArgument; + return; + } + // + GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew); + // + aItC.Initialize(myArgument); + for (; aItC.More(); aItC.Next()) { + const TopoDS_Shape& aCX=aItC.Value(); + if (myOrigins.IsBound(aCX)) { + aCXnew=myOrigins.Find(aCX); + aCXnew.Orientation(aCX.Orientation()); + aBB.Add(aCnew, aCXnew); + } + else { + aBB.Add(aCnew, aCX); + } + } + // + if (!myKeepNonSolids) { + Standard_Integer i, aNb; + TopoDS_Shape aCnew1; + TopTools_IndexedMapOfShape aM; + // + GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew1); + // + TopExp::MapShapes(aCnew, TopAbs_SOLID, aM); + + aNb=aM.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=aM(i); + aBB.Add(aCnew1, aS); + } + aCnew=aCnew1; + } + // + myShape=aCnew; +} +//-------------------------------------------------------- +// +// ErrorStatus +// 11 - GEOMAlgo_GlueDetector failed +// 13 - PerformImagesToWork failed +// 14 - PerformImagesToWork failed +// +// WarningStatus +// 1 - no shapes to glue +// 2 - sticked shapes are detected. +// The value of myTolerance is so large that +// subshapes of a shape becomes intefere +// (e.g. vertices of an edge). +// In the case +// the result is can not be obtained diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer2.hxx b/src/GEOMAlgo/GEOMAlgo_Gluer2.hxx new file mode 100644 index 000000000..f380802b9 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer2.hxx @@ -0,0 +1,188 @@ +// Copyright (C) 2007-2012 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 +// + +// File: GEOMAlgo_Gluer2.hxx +// Author: Peter KURNEV + +#ifndef _GEOMAlgo_Gluer2_HeaderFile +#define _GEOMAlgo_Gluer2_HeaderFile + +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +//======================================================================= +//class : GEOMAlgo_Gluer2 +//purpose : +//======================================================================= +class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo, + public GEOMAlgo_BuilderShape { +public: + + Standard_EXPORT + GEOMAlgo_Gluer2(); + + Standard_EXPORT + virtual ~GEOMAlgo_Gluer2(); + + Standard_EXPORT + void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) ; + + Standard_EXPORT + const TopTools_DataMapOfShapeListOfShape& ShapesToGlue() const; + + Standard_EXPORT + void SetKeepNonSolids(const Standard_Boolean theFlag) ; + + Standard_EXPORT + Standard_Boolean KeepNonSolids() const; + + Standard_EXPORT virtual void Clear() ; + + Standard_EXPORT + virtual void Perform() ; + + Standard_EXPORT + virtual void CheckData() ; + + Standard_EXPORT + void Detect() ; + + Standard_EXPORT + const TopTools_DataMapOfShapeListOfShape& ShapesDetected() const; + + Standard_EXPORT + const TopTools_DataMapOfShapeListOfShape& ImagesToWork() const; + + Standard_EXPORT + virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ; + + Standard_EXPORT + virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ; + + Standard_EXPORT + virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ; + + Standard_EXPORT + static void MakeVertex(const TopTools_ListOfShape& theLV, + TopoDS_Vertex& theV) ; + + Standard_EXPORT + static void MapBRepShapes(const TopoDS_Shape& theS, + TopTools_MapOfShape& theM) ; + + Standard_EXPORT + static void MapShapes(const TopoDS_Shape& theS, + TopTools_MapOfShape& theM) ; + +//modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f + Standard_EXPORT + const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes(); +//modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t +//------------------------------------------------ +protected: + Standard_EXPORT + void PerformShapesToWork() ; + + Standard_EXPORT + void FillVertices() ; + + Standard_EXPORT + void FillEdges() ; + + Standard_EXPORT + void FillWires() ; + + Standard_EXPORT + void FillFaces() ; + + Standard_EXPORT + void FillShells() ; + + Standard_EXPORT + void FillSolids() ; + + Standard_EXPORT + void FillCompSolids() ; + + Standard_EXPORT + void FillCompounds() ; + + Standard_EXPORT + void BuildResult() ; + + Standard_EXPORT + void FillBRepShapes(const TopAbs_ShapeEnum theType) ; + + Standard_EXPORT + void FillContainers(const TopAbs_ShapeEnum theType) ; + + Standard_EXPORT + void FillCompound(const TopoDS_Shape& theC) ; + + Standard_EXPORT + virtual void PrepareHistory() ; + + Standard_EXPORT + Standard_Boolean HasImage(const TopoDS_Shape& theC) ; + + Standard_EXPORT + void MakeBRepShapes(const TopoDS_Shape& theS, + TopoDS_Shape& theSnew) ; + + Standard_EXPORT + void MakeEdge(const TopoDS_Edge& theE, + TopoDS_Edge& theEnew) ; + + Standard_EXPORT + void MakeFace(const TopoDS_Face& theF, + TopoDS_Face& theFnew) ; + + Standard_EXPORT + void TreatPair(const NMTTools_CoupleOfShape& theCS, + NMTTools_ListOfCoupleOfShape& theLCS) ; + +protected: + TopTools_DataMapOfShapeListOfShape myShapesToGlue; + TopTools_DataMapOfShapeListOfShape myImagesDetected; + TopTools_DataMapOfShapeShape myOriginsDetected; + TopTools_DataMapOfShapeListOfShape myImagesToWork; + TopTools_DataMapOfShapeShape myOriginsToWork; + Standard_Boolean myKeepNonSolids; + //modified by NIZNHY-PKV Tue Mar 13 13:30:40 2012f + GEOMAlgo_GlueDetector myDetector; + //modified by NIZNHY-PKV Tue Mar 13 13:30:43 2012t +private: +}; +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer2_1.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer2_1.cxx new file mode 100644 index 000000000..400613da7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer2_1.cxx @@ -0,0 +1,323 @@ +// Copyright (C) 2007-2012 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 +// + +// File: GEOMAlgo_Gluer2_1.cxx +// Author: Peter KURNEV + +#include + +#include +#include + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +//======================================================================= +//function : MakeBRepShapes +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape& theS, + TopoDS_Shape& theSnew) +{ + TopAbs_ShapeEnum aType; + // + aType=theS.ShapeType(); + if (aType==TopAbs_EDGE) { + TopoDS_Edge aEE, aEEnew; + // + aEE=*((TopoDS_Edge*)&theS); + MakeEdge(aEE, aEEnew); + if (myErrorStatus) { + return; + } + // + theSnew=aEEnew; + } + else if (aType==TopAbs_FACE) { + TopoDS_Face aFF, aFFnew; + // + aFF=*((TopoDS_Face*)&theS); + MakeFace(aFF, aFFnew); + if (myErrorStatus) { + return; + } + // + theSnew=aFFnew; + } +} +//======================================================================= +//function : MakeFace +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF, + TopoDS_Face& theFnew) +{ + Standard_Boolean bIsToReverse, bIsUPeriodic; + Standard_Integer iRet; + Standard_Real aTol, aUMin, aUMax, aVMin, aVMax; + TopAbs_Orientation aOrE; + Handle(Geom_Surface) aS; + TopLoc_Location aLoc; + TopoDS_Shape aW, aWr; + TopoDS_Edge aEx; + TopoDS_Face aFF, aFnew; + TopoDS_Iterator aItW, aItE; + BRep_Builder aBB; + TopTools_ListOfShape aLEr; + TopTools_ListIteratorOfListOfShape aItLE; + // + myErrorStatus=0; + // + aFF=theF; + aFF.Orientation(TopAbs_FORWARD); + // + aTol=BRep_Tool::Tolerance(aFF); + aS=BRep_Tool::Surface(aFF, aLoc); + bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS); + BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax); + // + aBB.MakeFace (aFnew, aS, aLoc, aTol); + // + aItW.Initialize(aFF); + for (; aItW.More(); aItW.Next()) { + const TopoDS_Shape& aW=aItW.Value(); + // + if (!myOrigins.IsBound(aW)) { + aBB.Add(aFnew, aW); + continue; + } + // + aWr=myOrigins.Find(aW); + // + // clear contents of Wr + aLEr.Clear(); + aItE.Initialize(aWr); + for (; aItE.More(); aItE.Next()) { + const TopoDS_Shape& aEr=aItE.Value(); + aLEr.Append(aEr); + } + // + aItLE.Initialize(aLEr); + for (; aItLE.More(); aItLE.Next()) { + const TopoDS_Shape& aEr=aItLE.Value(); + aBB.Remove(aWr, aEr); + } + // + // refill contents of Wr + aItE.Initialize(aW); + for (; aItE.More(); aItE.Next()) { + const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aItE.Value())); + // + aEx=aE; + if (myOrigins.IsBound(aE)) { + aEx=*((TopoDS_Edge*)(&myOrigins.Find(aE))); + } + // + if (!BRep_Tool::Degenerated(aEx)) { + aEx.Orientation(TopAbs_FORWARD); + if (bIsUPeriodic) { + GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax); + } + // + //modified by NIZNHY-PKV Fri Feb 03 11:18:17 2012f + iRet=GEOMAlgo_Tools::BuildPCurveForEdgeOnFace(aE, aEx, aFF, myContext); + if (iRet) { + continue; + } + //BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEx, aFF); + //modified by NIZNHY-PKV Fri Feb 03 11:18:20 2012t + // + bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aEx, aE, myContext); + if (bIsToReverse) { + aEx.Reverse(); + } + } + else { + aEx.Orientation(aE.Orientation()); + } + aBB.Add(aWr, aEx); + }// for (; aItE.More(); aItE.Next()) { + // + aBB.Add(aFnew, aWr); + }// for (; aItW.More(); aItW.Next()) { + theFnew=aFnew; +} +//======================================================================= +//function : MakeEdge +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE, + TopoDS_Edge& aNewEdge) +{ + myErrorStatus=0; + // + Standard_Boolean bIsDE; + Standard_Real aT1, aT2; + TopoDS_Vertex aV1, aV2, aVR1, aVR2; + TopoDS_Edge aEx; + // + bIsDE=BRep_Tool::Degenerated(aE); + // + aEx=aE; + aEx.Orientation(TopAbs_FORWARD); + // + TopExp::Vertices(aEx, aV1, aV2); + // + aT1=BRep_Tool::Parameter(aV1, aEx); + aT2=BRep_Tool::Parameter(aV2, aEx); + // + aVR1=aV1; + if (myOrigins.IsBound(aV1)) { + aVR1=*((TopoDS_Vertex*)&myOrigins.Find(aV1)); + } + aVR1.Orientation(TopAbs_FORWARD); + // + aVR2=aV2; + if (myOrigins.IsBound(aV2)) { + aVR2=*((TopoDS_Vertex*)&myOrigins.Find(aV2)); + } + aVR2.Orientation(TopAbs_REVERSED); + // + if (!bIsDE) { + BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); + } + else { + Standard_Real aTol; + BRep_Builder aBB; + TopoDS_Edge E; + // + aTol=BRep_Tool::Tolerance(aE); + // + E=aEx; + E.EmptyCopy(); + // + aBB.Add (E, aVR1); + aBB.Add (E, aVR2); + aBB.Range(E, aT1, aT2); + aBB.Degenerated(E, Standard_True); + aBB.UpdateEdge(E, aTol); + // + aNewEdge=E; + } +} +//======================================================================= +//function : MakeVertex +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape& aLV, + TopoDS_Vertex& aNewVertex) +{ + Standard_Integer aNbV; + Standard_Real aTolV, aD, aDmax; + gp_XYZ aGC; + gp_Pnt aP3D, aPGC; + TopoDS_Vertex aVx; + BRep_Builder aBB; + TopTools_ListIteratorOfListOfShape aIt; + // + aNbV=aLV.Extent(); + if (!aNbV) { + return; + } + // + // center of gravity + aGC.SetCoord(0.,0.,0.); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + aVx=*((TopoDS_Vertex*)(&aIt.Value())); + aP3D=BRep_Tool::Pnt(aVx); + aGC+=aP3D.XYZ(); + } + aGC/=(Standard_Real)aNbV; + aPGC.SetXYZ(aGC); + // + // tolerance value + aDmax=-1.; + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + aVx=*((TopoDS_Vertex*)(&aIt.Value())); + aP3D=BRep_Tool::Pnt(aVx); + aTolV=BRep_Tool::Tolerance(aVx); + aD=aPGC.Distance(aP3D)+aTolV; + if (aD>aDmax) { + aDmax=aD; + } + } + // + aBB.MakeVertex (aNewVertex, aPGC, aDmax); +} +//======================================================================= +//function : MapBRepShapes +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::MapBRepShapes(const TopoDS_Shape& aS, + TopTools_MapOfShape& aM) +{ + //Standard_Boolean bHasBRep; + TopAbs_ShapeEnum aType; + TopoDS_Iterator aIt; + // + aType=aS.ShapeType(); + if (aType==TopAbs_VERTEX || + aType==TopAbs_EDGE || + aType==TopAbs_FACE) { + aM.Add(aS); + } + // + aIt.Initialize(aS); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSx=aIt.Value(); + aType=aSx.ShapeType(); + GEOMAlgo_Gluer2::MapBRepShapes(aSx, aM); + } +} + +// +// ErrorStatus +// +// 40 - GEOMAlgo_GlueDetector is failed diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer2_2.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer2_2.cxx new file mode 100644 index 000000000..375036bfc --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer2_2.cxx @@ -0,0 +1,156 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_Gluer2_2.cxx +// Created: +// Author: Peter KURNEV +// +// +#include + +#include + +#include +#include + +#include +#include + +//======================================================================= +//function : PrepareHistory +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::PrepareHistory() +{ + //Standard_Boolean bHasImage, bContainsSD; + // + // 1. Clearing + GEOMAlgo_BuilderShape::PrepareHistory(); + // + if(myShape.IsNull()) { + return; + } + // + GEOMAlgo_Gluer2::MapShapes(myShape, myMapShape); + // +} +//======================================================================= +//function : Generated +//purpose : +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_Gluer2::Generated(const TopoDS_Shape& ) +{ + myHistShapes.Clear(); + return myHistShapes; +} +//======================================================================= +//function : Modified +//purpose : +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS) +{ + Standard_Boolean bIsDeleted, bHasImage, bToReverse; + TopAbs_ShapeEnum aType; + TopoDS_Shape aSim; + // + myHistShapes.Clear(); + // + aType=theS.ShapeType(); + if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE || + aType==TopAbs_FACE || aType==TopAbs_SOLID)) { + return myHistShapes; + } + // + bIsDeleted=IsDeleted(theS); + if (bIsDeleted) { + return myHistShapes; + } + // + bHasImage=myOrigins.IsBound(theS); + if (!bHasImage) { + return myHistShapes; + } + // + aSim=myOrigins.Find(theS); + if (aSim.IsSame(theS)){ + return myHistShapes; + } + // + if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { + aSim.Orientation(theS.Orientation()); + } + else { + bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSim, theS, myContext); + if (bToReverse) { + aSim.Reverse(); + } + } + // + myHistShapes.Append(aSim); + // + return myHistShapes; +} +//======================================================================= +//function : IsDeleted +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape& theS) +{ + Standard_Boolean bRet, bContains, bHasImage; + // + bRet=Standard_False; + // + if (theS.IsNull()) { + return !bRet; //true + } + // + bContains=myMapShape.Contains(theS); + if (bContains) { + return bRet; //false + } + // + bHasImage=myOrigins.IsBound(theS); + if (bHasImage) { + const TopoDS_Shape& aSim=myOrigins.Find(theS); + bContains=myMapShape.Contains(aSim); + if (bContains) { + return bRet; //false + } + } + // + return !bRet; //true +} +//======================================================================= +//function : MapShapes +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape& theS, + TopTools_MapOfShape& theM) +{ + TopoDS_Iterator aIt; + // + theM.Add(theS); + aIt.Initialize(theS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSx=aIt.Value(); + GEOMAlgo_Gluer2::MapShapes(aSx, theM); + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer2_3.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer2_3.cxx new file mode 100644 index 000000000..5ccb17521 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer2_3.cxx @@ -0,0 +1,360 @@ +// Copyright (C) 2007-2012 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 +// + +// File: GEOMAlgo_Gluer2_3.cxx +// Author: Peter KURNEV + +#include + +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + + +static + void MapShapes1(const TopoDS_Shape& aS, + const TopAbs_ShapeEnum aType, + TopTools_IndexedMapOfShape& aM); + +//======================================================================= +//function : Detect +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::Detect() +{ + Standard_Boolean bCheckGeometry; + Standard_Integer iErr, aNbSD; + TopTools_ListIteratorOfListOfShape aItLS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; + //GEOMAlgo_GlueDetector aDetector; + // + myErrorStatus=0; + myWarningStatus=0; + // + myImagesDetected.Clear(); + myOriginsDetected.Clear(); + // + bCheckGeometry=Standard_True; + // + //modified by NIZNHY-PKV Tue Mar 13 13:33:35 2012f + myDetector.Clear(); + myDetector.SetContext(myContext); + //modified by NIZNHY-PKV Tue Mar 13 13:33:38 2012t + myDetector.SetArgument(myArgument); + myDetector.SetTolerance(myTolerance); + myDetector.SetCheckGeometry(bCheckGeometry); + // + myDetector.Perform(); + iErr=myDetector.ErrorStatus(); + if (iErr) { + // Detector is failed + myErrorStatus=11; + return; + } + //modified by NIZNHY-PKV Tue Mar 13 13:40:36 2012f + iErr=myDetector.WarningStatus(); + if (iErr) { + // Sticked shapes are detected + myWarningStatus=2; + } + //modified by NIZNHY-PKV Tue Mar 13 13:40:39 2012t + // + const TopTools_DataMapOfShapeListOfShape& aImages=myDetector.Images(); + aItDMSLS.Initialize(aImages); + for (; aItDMSLS.More(); aItDMSLS.Next()) { + const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + aNbSD=aLSD.Extent(); + myImagesDetected.Bind(aSkey, aLSD); + } + // + aItDMSLS.Initialize(myImagesDetected); + for (; aItDMSLS.More(); aItDMSLS.Next()) { + const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + aItLS.Initialize(aLSD); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aSx=aItLS.Value(); + myOriginsDetected.Bind(aSx, aSkey); + } + } +} +//======================================================================= +//function : PerformShapesToWork +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::PerformShapesToWork() +{ + Standard_Integer aNbSG, i, j, k, aNbC, aNb, aNbSD; + TopTools_ListIteratorOfListOfShape aItLS1, aItLS2; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; + NMTTools_CoupleOfShape aCS; + NMTTools_ListOfCoupleOfShape aLCS; + NMTTools_ListIteratorOfListOfCoupleOfShape aItCS; + // + myErrorStatus=0; + myWarningStatus=0; + // + myImagesToWork.Clear(); + myOriginsToWork.Clear(); + // + aNbSD=myImagesDetected.Extent(); + if (!aNbSD) {// no shapes to glue detected + myWarningStatus=1; + return; + } + // + aNbSG=myShapesToGlue.Extent(); + if (!aNbSG) { + // glue all possible + myImagesToWork=myImagesDetected; + // + aItDMSLS.Initialize(myImagesToWork); + for (; aItDMSLS.More(); aItDMSLS.Next()) { + const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape& aLSD=aItDMSLS.Value(); + aItLS1.Initialize(aLSD); + for (; aItLS1.More(); aItLS1.Next()) { + const TopoDS_Shape& aSx=aItLS1.Value(); + myOriginsToWork.Bind(aSx, aSkey); + } + } + return; + }// if (!aNbSG) { + // + // 1. Make pairs + aItDMSLS.Initialize(myShapesToGlue); + for (k=0; aItDMSLS.More(); aItDMSLS.Next(), ++k) { + //const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape& aLSG=aItDMSLS.Value(); + aItLS1.Initialize(aLSG); + for (i=0; aItLS1.More(); aItLS1.Next(), ++i) { + aItLS2.Initialize(aLSG); + for (j=0; aItLS2.More(); aItLS2.Next(), ++j) { + if (j>i) { + const TopoDS_Shape& aSG1=aItLS1.Value(); + const TopoDS_Shape& aSG2=aItLS2.Value(); + aCS.SetShape1(aSG1); + aCS.SetShape2(aSG2); + TreatPair(aCS, aLCS); + } + } + } + } + // + // 2. Find Chains + TopTools_ListOfShape aLSX; + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC; + // + NMTTools_Tools::FindChains(aLCS, aMC); + // + // 3. myImagesToWork, myOriginsToWork + aNbC=aMC.Extent(); + for (i=1; i<=aNbC; ++i) { + const TopoDS_Shape& aSkey=aMC.FindKey(i); + const TopTools_IndexedMapOfShape& aM=aMC(i); + aLSX.Clear(); + aNb=aM.Extent(); + for (j=1; j<=aNb; ++j) { + const TopoDS_Shape& aS=aM(j); + aLSX.Append(aS); + myOriginsToWork.Bind(aS, aSkey); + } + myImagesToWork.Bind(aSkey, aLSX); + } +} +//======================================================================= +//function : TreatPair +//purpose : +//======================================================================= +void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS, + NMTTools_ListOfCoupleOfShape& aLCS) +{ + if (myErrorStatus) { + return; + } + // + Standard_Integer i, aNbS1, aNbS2, aNbS; + TopAbs_ShapeEnum aType, aTypeS; + TopTools_ListIteratorOfListOfShape aItLS; + TopTools_IndexedMapOfShape aMS1, aMS2; + TopTools_DataMapOfShapeListOfShape aDMSLS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; + NMTTools_CoupleOfShape aCSS; + // + // 1. Checking the pair on whether it can be glued at all + // 1.1 + const TopoDS_Shape& aS1=aCS.Shape1(); + if (!myOriginsDetected.IsBound(aS1)) { + myErrorStatus=30; + return; + } + const TopoDS_Shape& aSkey1=myOriginsDetected.Find(aS1); + // 1.2 + const TopoDS_Shape& aS2=aCS.Shape2(); + if (!myOriginsDetected.IsBound(aS2)) { + myErrorStatus=30; + return; + } + const TopoDS_Shape& aSkey2=myOriginsDetected.Find(aS2); + // 1.3 + if (!aSkey1.IsSame(aSkey2)) { + myErrorStatus=33; + return; + } + // + // 2. Append the pair to the aLCS + aLCS.Append(aCS); + // + // 3. Treatment the sub-shapes of the pair + aType=aS1.ShapeType(); + if (aType==TopAbs_VERTEX) { + return; + } + aTypeS=TopAbs_EDGE; + if (aType==aTypeS) { + aTypeS=TopAbs_VERTEX; + } + // + MapShapes1(aS1, aTypeS, aMS1); + MapShapes1(aS2, aTypeS, aMS2); + // + aNbS1=aMS1.Extent(); + aNbS2=aMS2.Extent(); + if (aNbS1!=aNbS2) { + myErrorStatus=31; + return; + } + // + // 1. + for (i=1; i<=aNbS1; ++i) { + const TopoDS_Shape& aSS1=aMS1(i); + if (aMS2.Contains(aSS1)) { + continue; + } + // + if (!myOriginsDetected.IsBound(aSS1)) { + myErrorStatus=30; + return; + } + // + const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS1); + if (aDMSLS.IsBound(aSkey)) { + TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey); + aLS.Append(aSS1); + } + else { + TopTools_ListOfShape aLS; + // + aLS.Append(aSS1); + aDMSLS.Bind(aSkey, aLS); + } + } + // + // 2. + for (i=1; i<=aNbS2; ++i) { + const TopoDS_Shape& aSS2=aMS2(i); + if (aMS1.Contains(aSS2)) { + continue; + } + // + if (!myOriginsDetected.IsBound(aSS2)) { + myErrorStatus=30; + return; + } + // + const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS2); + if (aDMSLS.IsBound(aSkey)) { + TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey); + aLS.Append(aSS2); + } + else { + TopTools_ListOfShape aLS; + // + aLS.Append(aSS2); + aDMSLS.Bind(aSkey, aLS); + } + } + // + // 3. + aItDMSLS.Initialize(aDMSLS); + for (; aItDMSLS.More(); aItDMSLS.Next()) { + //const TopoDS_Shape& aSkey=aItDMSLS.Key(); + const TopTools_ListOfShape& aLS=aItDMSLS.Value(); + aNbS=aLS.Extent(); + if (aNbS!=2) { + myErrorStatus=32; + return; + } + // + const TopoDS_Shape& aSS1=aLS.First(); + const TopoDS_Shape& aSS2=aLS.Last(); + aCSS.SetShape1(aSS1); + aCSS.SetShape2(aSS2); + TreatPair(aCSS, aLCS); + } +} +//======================================================================= +//function : MapShapes1 +//purpose : +//======================================================================= +void MapShapes1(const TopoDS_Shape& aS, + const TopAbs_ShapeEnum aType, + TopTools_IndexedMapOfShape& aM) +{ + TopExp_Explorer aExp; + + aExp.Init (aS, aType); + for ( ;aExp.More(); aExp.Next()) { + const TopoDS_Shape aSx=aExp.Current(); + if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aSx); + if (BRep_Tool::Degenerated(aEx)) { + continue; + } + } + aM.Add(aSx); + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx new file mode 100644 index 000000000..fe6f82a2c --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx @@ -0,0 +1,146 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_GluerAlgo.cxx +// Created: +// Author: Peter KURNEV +// +// +#include +#include + + +//======================================================================= +//function : GEOMAlgo_GluerAlgo +//purpose : +//======================================================================= +GEOMAlgo_GluerAlgo::GEOMAlgo_GluerAlgo() +{ + myTolerance=0.0001; + myCheckGeometry=Standard_True; +} +//======================================================================= +//function : ~GEOMAlgo_GluerAlgo +//purpose : +//======================================================================= +GEOMAlgo_GluerAlgo::~GEOMAlgo_GluerAlgo() +{ +} +//======================================================================= +//function : SetArgument +//purpose : +//======================================================================= +void GEOMAlgo_GluerAlgo::SetArgument(const TopoDS_Shape& theShape) +{ + myArgument=theShape; +} +//======================================================================= +//function : Argument +//purpose : +//======================================================================= +const TopoDS_Shape& GEOMAlgo_GluerAlgo::Argument()const +{ + return myArgument; +} +//======================================================================= +//function : SetTolerance +//purpose : +//======================================================================= +void GEOMAlgo_GluerAlgo::SetTolerance(const Standard_Real aT) +{ + myTolerance=aT; +} +//======================================================================= +//function : Tolerance +//purpose : +//======================================================================= +Standard_Real GEOMAlgo_GluerAlgo::Tolerance()const +{ + return myTolerance; +} + +//======================================================================= +//function : SetCheckGeometry +//purpose : +//======================================================================= +void GEOMAlgo_GluerAlgo::SetCheckGeometry(const Standard_Boolean aFlag) +{ + myCheckGeometry=aFlag; +} +//======================================================================= +//function : CheckGeometry +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const +{ + return myCheckGeometry; +} +//======================================================================= +//function : SetContext +//purpose : +//======================================================================= +void GEOMAlgo_GluerAlgo::SetContext(const Handle(IntTools_Context)& theContext) +{ + myContext=theContext; +} +//======================================================================= +//function : Context +//purpose : +//======================================================================= +const Handle(IntTools_Context)& GEOMAlgo_GluerAlgo::Context() +{ + return myContext; +} +//======================================================================= +//function : Images +//purpose : +//======================================================================= +const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_GluerAlgo::Images()const +{ + return myImages; +} +//======================================================================= +//function : Origins +//purpose : +//======================================================================= +const TopTools_DataMapOfShapeShape& GEOMAlgo_GluerAlgo::Origins()const +{ + return myOrigins; +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +void GEOMAlgo_GluerAlgo::Clear() +{ + myImages.Clear(); + myOrigins.Clear(); +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_GluerAlgo::Perform() +{ + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx new file mode 100644 index 000000000..97f9b9ad1 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx @@ -0,0 +1,98 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_GluerAlgo.hxx +// Created: +// Author: Peter KURNEV +// +// +#ifndef _GEOMAlgo_GluerAlgo_HeaderFile +#define _GEOMAlgo_GluerAlgo_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//class : GEOMAlgo_GluerAlgo +//purpose : +//======================================================================= +class GEOMAlgo_GluerAlgo { +public: + + Standard_EXPORT + GEOMAlgo_GluerAlgo(); + + Standard_EXPORT + virtual ~GEOMAlgo_GluerAlgo(); + + Standard_EXPORT + virtual void SetArgument(const TopoDS_Shape& theShape) ; + + Standard_EXPORT + const TopoDS_Shape& Argument() const; + + Standard_EXPORT + void SetTolerance(const Standard_Real aT) ; + + Standard_EXPORT + Standard_Real Tolerance() const; + + Standard_EXPORT + void SetCheckGeometry(const Standard_Boolean aFlag) ; + + Standard_EXPORT + Standard_Boolean CheckGeometry() const; + + Standard_EXPORT + virtual void Perform() ; + + Standard_EXPORT + virtual void Clear() ; + + Standard_EXPORT + void SetContext(const Handle(IntTools_Context)&) ; + + Standard_EXPORT + const Handle(IntTools_Context)& Context() ; + + Standard_EXPORT + const TopTools_DataMapOfShapeListOfShape& Images() const; + + Standard_EXPORT + const TopTools_DataMapOfShapeShape& Origins() const; + +protected: + TopoDS_Shape myArgument; + Standard_Real myTolerance; + Standard_Boolean myCheckGeometry; + Handle(IntTools_Context) myContext; + TopTools_DataMapOfShapeListOfShape myImages; + TopTools_DataMapOfShapeShape myOrigins; + +private: +}; +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.cdl b/src/GEOMAlgo/GEOMAlgo_HAlgo.cdl deleted file mode 100644 index b9e77ab42..000000000 --- a/src/GEOMAlgo/GEOMAlgo_HAlgo.cdl +++ /dev/null @@ -1,58 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Algo.cdl --- Created: Sat Dec 04 12:37:56 2004 --- Author: Peter KURNEV --- --- -deferred class HAlgo from GEOMAlgo - inherits TShared from MMgt - ---Purpose: - ---uses ---raises - -is - Initialize - returns mutable HAlgo from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_HAlgo();" - - Perform(me:mutable) - is deferred; - - CheckData(me:mutable) - is virtual; - - CheckResult(me:mutable) - is virtual; - - ErrorStatus (me) - returns Integer from Standard; - - WarningStatus (me) - returns Integer from Standard; - -fields - myErrorStatus : Integer from Standard is protected; - myWarningStatus : Integer from Standard is protected; - -end HAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.cxx b/src/GEOMAlgo/GEOMAlgo_HAlgo.cxx index 69dfa4ac6..b07876a31 100644 --- a/src/GEOMAlgo/GEOMAlgo_HAlgo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_HAlgo.cxx @@ -1,34 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Algo.cxx -// Created: Sat Dec 04 12:39:47 2004 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_Hlgo.cxx +// Created: Sat Dec 04 12:39:47 2004 +// Author: Peter KURNEV +// // -#include +#include + +IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_HAlgo, MMgt_TShared); +IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_HAlgo, MMgt_TShared); //======================================================================= -// function: -// purpose: +// function: +// purpose: //======================================================================= GEOMAlgo_HAlgo::GEOMAlgo_HAlgo() : @@ -37,14 +41,14 @@ {} //======================================================================= // function: ~ -// purpose: +// purpose: //======================================================================= GEOMAlgo_HAlgo::~GEOMAlgo_HAlgo() { } //======================================================================= // function: CheckData -// purpose: +// purpose: //======================================================================= void GEOMAlgo_HAlgo::CheckData() { @@ -52,7 +56,7 @@ } //======================================================================= // function: CheckResult -// purpose: +// purpose: //======================================================================= void GEOMAlgo_HAlgo::CheckResult() { @@ -60,7 +64,7 @@ } //======================================================================= // function: ErrorStatus -// purpose: +// purpose: //======================================================================= Standard_Integer GEOMAlgo_HAlgo::ErrorStatus()const { @@ -68,7 +72,7 @@ } //======================================================================= // function: WarningStatus -// purpose: +// purpose: //======================================================================= Standard_Integer GEOMAlgo_HAlgo::WarningStatus()const { diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.hxx b/src/GEOMAlgo/GEOMAlgo_HAlgo.hxx index c7002b5da..52340ed2e 100644 --- a/src/GEOMAlgo/GEOMAlgo_HAlgo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_HAlgo.hxx @@ -1,107 +1,75 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: GEOMAlgo_HAlgo.hxx +// Created: Sat Dec 04 12:39:47 2004 +// Author: Peter KURNEV +// +// + #ifndef _GEOMAlgo_HAlgo_HeaderFile #define _GEOMAlgo_HAlgo_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Handle_GEOMAlgo_HAlgo_HeaderFile -#include -#endif - -#ifndef _Standard_Integer_HeaderFile +#include +//#include #include -#endif -#ifndef _MMgt_TShared_HeaderFile #include -#endif - - - -class GEOMAlgo_HAlgo : public MMgt_TShared { - -public: - // Methods PUBLIC - // - - -Standard_EXPORT virtual void Perform() = 0; - - -Standard_EXPORT virtual void CheckData() ; - - -Standard_EXPORT virtual void CheckResult() ; +DEFINE_STANDARD_HANDLE(GEOMAlgo_HAlgo, MMgt_TShared); -Standard_EXPORT Standard_Integer ErrorStatus() const; +//======================================================================= +//class : GEOMAlgo_HAlgo +//purpose : +//======================================================================= +class GEOMAlgo_HAlgo : public MMgt_TShared +{ + public: + Standard_EXPORT + virtual void Perform() = 0; + Standard_EXPORT + virtual void CheckData() ; -Standard_EXPORT Standard_Integer WarningStatus() const; -//Standard_EXPORT ~GEOMAlgo_HAlgo(); + Standard_EXPORT + virtual void CheckResult() ; + Standard_EXPORT + Standard_Integer ErrorStatus() const; + Standard_EXPORT + Standard_Integer WarningStatus() const; + DEFINE_STANDARD_RTTI(GEOMAlgo_HAlgo); - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + protected: + Standard_EXPORT + GEOMAlgo_HAlgo(); -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT GEOMAlgo_HAlgo(); -Standard_EXPORT virtual ~GEOMAlgo_HAlgo(); - - - // Fields PROTECTED - // -Standard_Integer myErrorStatus; -Standard_Integer myWarningStatus; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + virtual ~GEOMAlgo_HAlgo(); + Standard_Integer myErrorStatus; + Standard_Integer myWarningStatus; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.ixx b/src/GEOMAlgo/GEOMAlgo_HAlgo.ixx deleted file mode 100644 index 810ccc9e2..000000000 --- a/src/GEOMAlgo/GEOMAlgo_HAlgo.ixx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -//GEOMAlgo_HAlgo::~GEOMAlgo_HAlgo() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_HAlgo_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_HAlgo", - sizeof(GEOMAlgo_HAlgo), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_HAlgo) Handle(GEOMAlgo_HAlgo)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_HAlgo) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_HAlgo))) { - _anOtherObject = Handle(GEOMAlgo_HAlgo)((Handle(GEOMAlgo_HAlgo)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_HAlgo::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_HAlgo) ; -} -//Standard_Boolean GEOMAlgo_HAlgo::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_HAlgo) == AType || MMgt_TShared::IsKind(AType)); -//} -//Handle_GEOMAlgo_HAlgo::~Handle_GEOMAlgo_HAlgo() {} - diff --git a/src/GEOMAlgo/GEOMAlgo_HAlgo.jxx b/src/GEOMAlgo/GEOMAlgo_HAlgo.jxx deleted file mode 100644 index 6be6b1b67..000000000 --- a/src/GEOMAlgo/GEOMAlgo_HAlgo.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_HAlgo_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx deleted file mode 100644 index 965ff0a27..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#include -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class TColStd_MapIntegerHasher; -class GEOMAlgo_IndexedDataMapOfIntegerShape; - - - -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape(const Standard_Integer& K1,const Standard_Integer K2,const TopoDS_Shape& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - Standard_Integer& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - TopoDS_Shape& Value() const; -//Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myKey1; -Standard_Integer myKey2; -TopoDS_Shape myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx deleted file mode 100644 index 300973d78..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile -#include -#endif -//GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape", - sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape))) { - _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) ; -} -//Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape() {} -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx deleted file mode 100644 index c4f5752fc..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile -#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class GEOMAlgo_PassKey; -class TopTools_ListOfShape; -class GEOMAlgo_PassKeyMapHasher; -class GEOMAlgo_IndexedDataMapOfPassKeyListOfShape; - - -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape : public TCollection_MapNode { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape(const GEOMAlgo_PassKey& K1,const Standard_Integer K2,const TopTools_ListOfShape& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - GEOMAlgo_PassKey& Key1() const; - Standard_Integer& Key2() const; - TCollection_MapNodePtr& Next2() const; - TopTools_ListOfShape& Value() const; -Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -GEOMAlgo_PassKey myKey1; -Standard_Integer myKey2; -TopTools_ListOfShape myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey GEOMAlgo_PassKey -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx deleted file mode 100644 index 3703fb54a..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_HeaderFile -#include -#endif -GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape", - sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape))) { - _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) ; -} -Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape() {} -#define TheKey GEOMAlgo_PassKey -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx deleted file mode 100644 index 71466b812..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class GEOMAlgo_PassKeyShape; -class TopTools_ListOfShape; -class GEOMAlgo_PassKeyShapeMapHasher; -class GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape; - - - -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape(const GEOMAlgo_PassKeyShape& K1,const Standard_Integer K2,const TopTools_ListOfShape& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - GEOMAlgo_PassKeyShape& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - TopTools_ListOfShape& Value() const; -//Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -GEOMAlgo_PassKeyShape myKey1; -Standard_Integer myKey2; -TopTools_ListOfShape myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey GEOMAlgo_PassKeyShape -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx deleted file mode 100644 index fa5437fc8..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#include -#endif -//GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape", - sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape))) { - _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape) ; -} -//Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape() {} -#define TheKey GEOMAlgo_PassKeyShape -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx deleted file mode 100644 index d01bc565d..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Bnd_Box_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class Bnd_Box; -class TopTools_ShapeMapHasher; -class GEOMAlgo_IndexedDataMapOfShapeBox; - - - -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox(const TopoDS_Shape& K1,const Standard_Integer K2,const Bnd_Box& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - TopoDS_Shape& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - Bnd_Box& Value() const; -//Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey1; -Standard_Integer myKey2; -Bnd_Box myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Bnd_Box -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeBox -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx deleted file mode 100644 index 06f91398d..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Bnd_Box_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeBox_HeaderFile -#include -#endif -//GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox", - sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox))) { - _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) ; -} -//Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Bnd_Box -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeBox -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx deleted file mode 100644 index e974bb3c6..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile -#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeInfo_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class GEOMAlgo_ShapeInfo; -class TopTools_ShapeMapHasher; -class GEOMAlgo_IndexedDataMapOfShapeShapeInfo; - - - -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo(const TopoDS_Shape& K1,const Standard_Integer K2,const GEOMAlgo_ShapeInfo& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - TopoDS_Shape& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - GEOMAlgo_ShapeInfo& Value() const; -//Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey1; -Standard_Integer myKey2; -GEOMAlgo_ShapeInfo myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem GEOMAlgo_ShapeInfo -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx deleted file mode 100644 index 799e63395..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeInfo_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile -#include -#endif -//GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo", - sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo))) { - _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) ; -} -//Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem GEOMAlgo_ShapeInfo -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx deleted file mode 100644 index ab44e2fe2..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_HeaderFile -#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopAbs_State_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class TopTools_ShapeMapHasher; -class GEOMAlgo_IndexedDataMapOfShapeState; - - - -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState(const TopoDS_Shape& K1,const Standard_Integer K2,const TopAbs_State& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - TopoDS_Shape& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - TopAbs_State& Value() const; -//Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey1; -Standard_Integer myKey2; -TopAbs_State myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem TopAbs_State -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeState -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_0.cxx deleted file mode 100644 index eb0fcc7db..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_0.cxx +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile -#include -#endif -//GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState", - sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState))) { - _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState) ; -} -//Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem TopAbs_State -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeState -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx index a89e0146a..125122452 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx @@ -1,171 +1,44 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile -#define _GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class TColStd_MapIntegerHasher; -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_IndexedDataMapOfIntegerShape : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfIntegerShape(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfIntegerShape& Assign(const GEOMAlgo_IndexedDataMapOfIntegerShape& Other) ; - GEOMAlgo_IndexedDataMapOfIntegerShape& operator =(const GEOMAlgo_IndexedDataMapOfIntegerShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_IndexedDataMapOfIntegerShape() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const Standard_Integer& K,const TopoDS_Shape& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const Standard_Integer& K,const TopoDS_Shape& T) ; - - -Standard_EXPORT void RemoveLast() ; +// File: GEOMAlgo_IndexedDataMapOfIntegerShape.hxx +// Created: Wed Feb 22 11:22:18 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const Standard_Integer& K) const; +#ifndef GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile +#define GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile -Standard_EXPORT const Standard_Integer& FindKey(const Standard_Integer I) const; +#include +#include +#include -Standard_EXPORT const TopoDS_Shape& FindFromIndex(const Standard_Integer I) const; - const TopoDS_Shape& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} - - - -Standard_EXPORT TopoDS_Shape& ChangeFromIndex(const Standard_Integer I) ; - TopoDS_Shape& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const Standard_Integer& K) const; - - -Standard_EXPORT const TopoDS_Shape& FindFromKey(const Standard_Integer& K) const; - - -Standard_EXPORT TopoDS_Shape& ChangeFromKey(const Standard_Integer& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfIntegerShape(const GEOMAlgo_IndexedDataMapOfIntegerShape& Other); - - - // Fields PRIVATE - // - - -}; - +#define _NCollection_MapHasher +#include +typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfIntegerShape; +#undef _NCollection_MapHasher -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx deleted file mode 100644 index 232a19d13..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx deleted file mode 100644 index de91f020f..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_HeaderFile -#define _GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class GEOMAlgo_PassKey; -class TopTools_ListOfShape; -class GEOMAlgo_PassKeyMapHasher; -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class GEOMAlgo_IndexedDataMapOfPassKeyListOfShape : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyListOfShape(const Standard_Integer NbBuckets = 1); -Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Assign(const GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Other) ; - GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& operator =(const GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~GEOMAlgo_IndexedDataMapOfPassKeyListOfShape() -{ - Clear(); -} - -Standard_EXPORT Standard_Integer Add(const GEOMAlgo_PassKey& K,const TopTools_ListOfShape& I) ; -Standard_EXPORT void Substitute(const Standard_Integer I,const GEOMAlgo_PassKey& K,const TopTools_ListOfShape& T) ; -Standard_EXPORT void RemoveLast() ; -Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_PassKey& K) const; -Standard_EXPORT const GEOMAlgo_PassKey& FindKey(const Standard_Integer I) const; -Standard_EXPORT const TopTools_ListOfShape& FindFromIndex(const Standard_Integer I) const; - const TopTools_ListOfShape& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} - -Standard_EXPORT TopTools_ListOfShape& ChangeFromIndex(const Standard_Integer I) ; - TopTools_ListOfShape& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - -Standard_EXPORT Standard_Integer FindIndex(const GEOMAlgo_PassKey& K) const; -Standard_EXPORT const TopTools_ListOfShape& FindFromKey(const GEOMAlgo_PassKey& K) const; -Standard_EXPORT TopTools_ListOfShape& ChangeFromKey(const GEOMAlgo_PassKey& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyListOfShape(const GEOMAlgo_IndexedDataMapOfPassKeyListOfShape& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx deleted file mode 100644 index ff1528304..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile -#include -#endif - - -#define TheKey GEOMAlgo_PassKey -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyListOfShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx index 7bf5b4b4e..5c22084a6 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx @@ -1,172 +1,43 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#define _GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class GEOMAlgo_PassKeyShape; -class TopTools_ListOfShape; -class GEOMAlgo_PassKeyShapeMapHasher; -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& Assign(const GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& Other) ; - GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& operator =(const GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const GEOMAlgo_PassKeyShape& K,const TopTools_ListOfShape& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const GEOMAlgo_PassKeyShape& K,const TopTools_ListOfShape& T) ; - - -Standard_EXPORT void RemoveLast() ; +// File: GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx +// Created: Wed Feb 22 11:24:27 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_PassKeyShape& K) const; +#ifndef GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile +#define GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile +#include +#include +#include -Standard_EXPORT const GEOMAlgo_PassKeyShape& FindKey(const Standard_Integer I) const; +#define _NCollection_MapHasher +#include -Standard_EXPORT const TopTools_ListOfShape& FindFromIndex(const Standard_Integer I) const; - const TopTools_ListOfShape& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} +typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape; +#undef _NCollection_MapHasher -Standard_EXPORT TopTools_ListOfShape& ChangeFromIndex(const Standard_Integer I) ; - TopTools_ListOfShape& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const GEOMAlgo_PassKeyShape& K) const; - - -Standard_EXPORT const TopTools_ListOfShape& FindFromKey(const GEOMAlgo_PassKeyShape& K) const; - - -Standard_EXPORT TopTools_ListOfShape& ChangeFromKey(const GEOMAlgo_PassKeyShape& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape(const GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx deleted file mode 100644 index 89b23d6a1..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#include -#endif - - -#define TheKey GEOMAlgo_PassKeyShape -#define TheKey_hxx -#define TheItem TopTools_ListOfShape -#define TheItem_hxx -#define Hasher GEOMAlgo_PassKeyShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBox.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBox.hxx index 8660ceb8f..7cd8010fe 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBox.hxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBox.hxx @@ -1,172 +1,44 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_IndexedDataMapOfShapeBox_HeaderFile -#define _GEOMAlgo_IndexedDataMapOfShapeBox_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class Bnd_Box; -class TopTools_ShapeMapHasher; -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_IndexedDataMapOfShapeBox : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeBox(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeBox& Assign(const GEOMAlgo_IndexedDataMapOfShapeBox& Other) ; - GEOMAlgo_IndexedDataMapOfShapeBox& operator =(const GEOMAlgo_IndexedDataMapOfShapeBox& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_IndexedDataMapOfShapeBox() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const Bnd_Box& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const Bnd_Box& T) ; - - -Standard_EXPORT void RemoveLast() ; +// File: GEOMAlgo_IndexedDataMapOfShapeBox.hxx +// Created: Wed Feb 22 11:14:14 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; +#ifndef GEOMAlgo_IndexedDataMapOfShapeBox_HeaderFile +#define GEOMAlgo_IndexedDataMapOfShapeBox_HeaderFile -Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; +#include +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT const Bnd_Box& FindFromIndex(const Standard_Integer I) const; - const Bnd_Box& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} +typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeBox; +#undef _NCollection_MapHasher -Standard_EXPORT Bnd_Box& ChangeFromIndex(const Standard_Integer I) ; - Bnd_Box& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} -Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; - - -Standard_EXPORT const Bnd_Box& FindFromKey(const TopoDS_Shape& K) const; - - -Standard_EXPORT Bnd_Box& ChangeFromKey(const TopoDS_Shape& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeBox(const GEOMAlgo_IndexedDataMapOfShapeBox& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx deleted file mode 100644 index d8b986624..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Bnd_Box_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Bnd_Box -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeBox -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx index 3051acc43..09be03fe8 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx @@ -1,172 +1,43 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile -#define _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class GEOMAlgo_ShapeInfo; -class TopTools_ShapeMapHasher; -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_IndexedDataMapOfShapeShapeInfo : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Assign(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other) ; - GEOMAlgo_IndexedDataMapOfShapeShapeInfo& operator =(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_IndexedDataMapOfShapeShapeInfo() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const GEOMAlgo_ShapeInfo& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const GEOMAlgo_ShapeInfo& T) ; - - -Standard_EXPORT void RemoveLast() ; +// File: GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx +// Created: Wed Feb 22 11:16:54 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; +#ifndef GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile +#define GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile -Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; +#include +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT const GEOMAlgo_ShapeInfo& FindFromIndex(const Standard_Integer I) const; - const GEOMAlgo_ShapeInfo& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} +typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo; +#undef _NCollection_MapHasher -Standard_EXPORT GEOMAlgo_ShapeInfo& ChangeFromIndex(const Standard_Integer I) ; - GEOMAlgo_ShapeInfo& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; - - -Standard_EXPORT const GEOMAlgo_ShapeInfo& FindFromKey(const TopoDS_Shape& K) const; - - -Standard_EXPORT GEOMAlgo_ShapeInfo& ChangeFromKey(const TopoDS_Shape& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx deleted file mode 100644 index 61e566417..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeInfo_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem GEOMAlgo_ShapeInfo -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeState.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeState.hxx index 59fa7a7cb..35f5d3650 100644 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeState.hxx +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeState.hxx @@ -1,174 +1,60 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +/// Copyright (C) 2007-2012 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 +/// // -// 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile -#define _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _TopAbs_State_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class TopTools_ShapeMapHasher; -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_IndexedDataMapOfShapeState : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeState(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeState& Assign(const GEOMAlgo_IndexedDataMapOfShapeState& Other) ; - GEOMAlgo_IndexedDataMapOfShapeState& operator =(const GEOMAlgo_IndexedDataMapOfShapeState& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_IndexedDataMapOfShapeState() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const TopAbs_State& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const TopAbs_State& T) ; - - -Standard_EXPORT void RemoveLast() ; +// File: GEOMAlgo_IndexedDataMapOfShapeState.hxx +// Created: Wed Feb 22 11:19:56 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; +#ifndef GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile +#define GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile -Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; - - -Standard_EXPORT const TopAbs_State& FindFromIndex(const Standard_Integer I) const; - const TopAbs_State& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} - - - -Standard_EXPORT TopAbs_State& ChangeFromIndex(const Standard_Integer I) ; - TopAbs_State& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; - - -Standard_EXPORT const TopAbs_State& FindFromKey(const TopoDS_Shape& K) const; - - -Standard_EXPORT TopAbs_State& ChangeFromKey(const TopoDS_Shape& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeState(const GEOMAlgo_IndexedDataMapOfShapeState& Other); - - - // Fields PRIVATE - // - - -}; +#include +#include +#include +#define _NCollection_MapHasher +#include +typedef NCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeState; +#undef _NCollection_MapHasher -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeState_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeState_0.cxx deleted file mode 100644 index 26f31af15..000000000 --- a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeState_0.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem TopAbs_State -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState -#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_Type_() -#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeState -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx index 6ae789d88..83646c9ef 100644 --- a/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx +++ b/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx @@ -1,35 +1,35 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMAlgo_KindOfBounds_HeaderFile #define _GEOMAlgo_KindOfBounds_HeaderFile -enum GEOMAlgo_KindOfBounds { - GEOMAlgo_KB_UNKNOWN, +enum GEOMAlgo_KindOfBounds { +GEOMAlgo_KB_UNKNOWN, GEOMAlgo_KB_TRIMMED, GEOMAlgo_KB_INFINITE }; - #ifndef _Standard_PrimitiveTypes_HeaderFile #include #endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx index d3ac58477..fecd41494 100644 --- a/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx +++ b/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx @@ -1,35 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef _GEOMAlgo_KindOfClosed_HeaderFile #define _GEOMAlgo_KindOfClosed_HeaderFile -enum GEOMAlgo_KindOfClosed { - GEOMAlgo_KC_UNKNOWN, +enum GEOMAlgo_KindOfClosed { +GEOMAlgo_KC_UNKNOWN, GEOMAlgo_KC_CLOSED, GEOMAlgo_KC_NOTCLOSED }; - #ifndef _Standard_PrimitiveTypes_HeaderFile #include #endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx index e4a8316bc..8c4241edd 100644 --- a/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx +++ b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMAlgo_KindOfName_HeaderFile #define _GEOMAlgo_KindOfName_HeaderFile -enum GEOMAlgo_KindOfName { - GEOMAlgo_KN_UNKNOWN, +enum GEOMAlgo_KindOfName { +GEOMAlgo_KN_UNKNOWN, GEOMAlgo_KN_SPHERE, GEOMAlgo_KN_CYLINDER, GEOMAlgo_KN_TORUS, @@ -46,7 +47,6 @@ GEOMAlgo_KN_QUADRANGLE, GEOMAlgo_KN_ARCELLIPSE }; - #ifndef _Standard_PrimitiveTypes_HeaderFile #include #endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx index cf40274d4..8642b2231 100644 --- a/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx @@ -1,30 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 _GEOMAlgo_KindOfShape_HeaderFile #define _GEOMAlgo_KindOfShape_HeaderFile - -enum GEOMAlgo_KindOfShape { - GEOMAlgo_KS_UNKNOWN, +enum GEOMAlgo_KindOfShape { +GEOMAlgo_KS_UNKNOWN, GEOMAlgo_KS_SPHERE, GEOMAlgo_KS_CYLINDER, GEOMAlgo_KS_BOX, @@ -34,10 +33,12 @@ GEOMAlgo_KS_ELLIPSE, GEOMAlgo_KS_PLANE, GEOMAlgo_KS_CIRCLE, GEOMAlgo_KS_LINE, -GEOMAlgo_KS_DEGENERATED +GEOMAlgo_KS_DEGENERATED, +//modified by NIZNHY-PKV Tue Jul 03 10:28:09 2012f +GEOMAlgo_KS_BSPLINE +//modified by NIZNHY-PKV Tue Jul 03 10:28:11 2012t }; - #ifndef _Standard_PrimitiveTypes_HeaderFile #include #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx b/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx index 9464a35f3..8c19aa07e 100644 --- a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx @@ -1,143 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile -#define _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoMoreObject; -class Standard_NoSuchObject; -class GEOMAlgo_ListOfCoupleOfShapes; -class GEOMAlgo_CoupleOfShapes; -class GEOMAlgo_ListNodeOfListOfCoupleOfShapes; +// File: GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx +// Created: Wed Feb 22 08:26:34 2012 +// Author: +// +#ifndef GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile +#define GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef GEOMAlgo_ListOfCoupleOfShapes_HeaderFile +#include #endif - -class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ListIteratorOfListOfCoupleOfShapes(); - - -Standard_EXPORT GEOMAlgo_ListIteratorOfListOfCoupleOfShapes(const GEOMAlgo_ListOfCoupleOfShapes& L); - - -Standard_EXPORT void Initialize(const GEOMAlgo_ListOfCoupleOfShapes& L) ; - - Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; - - -Standard_EXPORT GEOMAlgo_CoupleOfShapes& Value() const; - - -friend class GEOMAlgo_ListOfCoupleOfShapes; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Address current; -Standard_Address previous; - - -}; - -#define Item GEOMAlgo_CoupleOfShapes -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_() -#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx b/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx deleted file mode 100644 index 3ded9dfbb..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoMoreObject_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile -#include -#endif - - -#define Item GEOMAlgo_CoupleOfShapes -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_() -#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes -#define TCollection_List_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfPnt.hxx b/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfPnt.hxx index 1c1b7ca2c..ff1f10c7e 100644 --- a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfPnt.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfPnt.hxx @@ -1,143 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_ListIteratorOfListOfPnt_HeaderFile -#define _GEOMAlgo_ListIteratorOfListOfPnt_HeaderFile +// File: GEOMAlgo_ListIteratorOfListOfPnt.hxx +// Created: Wed Feb 22 08:33:12 2012 +// Author: +// -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_ListNodeOfListOfPnt_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoMoreObject; -class Standard_NoSuchObject; -class GEOMAlgo_ListOfPnt; -class gp_Pnt; -class GEOMAlgo_ListNodeOfListOfPnt; +#ifndef GEOMAlgo_ListIteratorOfListOfPnt_HeaderFile +#define GEOMAlgo_ListIteratorOfListOfPnt_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef GEOMAlgo_ListOfPnt_HeaderFile +#include #endif - -class GEOMAlgo_ListIteratorOfListOfPnt { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ListIteratorOfListOfPnt(); - - -Standard_EXPORT GEOMAlgo_ListIteratorOfListOfPnt(const GEOMAlgo_ListOfPnt& L); - - -Standard_EXPORT void Initialize(const GEOMAlgo_ListOfPnt& L) ; - - Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; - - -Standard_EXPORT gp_Pnt& Value() const; - - -friend class GEOMAlgo_ListOfPnt; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Address current; -Standard_Address previous; - - -}; - -#define Item gp_Pnt -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfPnt -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfPnt_Type_() -#define TCollection_List GEOMAlgo_ListOfPnt -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfPnt_0.cxx b/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfPnt_0.cxx deleted file mode 100644 index 69d459655..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListIteratorOfListOfPnt_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoMoreObject_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListOfPnt_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListNodeOfListOfPnt_HeaderFile -#include -#endif - - -#define Item gp_Pnt -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfPnt -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfPnt_Type_() -#define TCollection_List GEOMAlgo_ListOfPnt -#define TCollection_List_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx b/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx deleted file mode 100644 index 04439ff5e..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile -#define _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class GEOMAlgo_CoupleOfShapes; -class GEOMAlgo_ListOfCoupleOfShapes; -class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes; - - - -class GEOMAlgo_ListNodeOfListOfCoupleOfShapes : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_ListNodeOfListOfCoupleOfShapes(const GEOMAlgo_CoupleOfShapes& I,const TCollection_MapNodePtr& n); - - GEOMAlgo_CoupleOfShapes& Value() const; -//Standard_EXPORT ~GEOMAlgo_ListNodeOfListOfCoupleOfShapes(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -GEOMAlgo_CoupleOfShapes myValue; - - -}; - -#define Item GEOMAlgo_CoupleOfShapes -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_() -#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfCoupleOfShapes_0.cxx b/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfCoupleOfShapes_0.cxx deleted file mode 100644 index d8786cc70..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfCoupleOfShapes_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile -#include -#endif -//GEOMAlgo_ListNodeOfListOfCoupleOfShapes::~GEOMAlgo_ListNodeOfListOfCoupleOfShapes() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ListNodeOfListOfCoupleOfShapes", - sizeof(GEOMAlgo_ListNodeOfListOfCoupleOfShapes), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes))) { - _anOtherObject = Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)((Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_ListNodeOfListOfCoupleOfShapes::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) ; -} -//Standard_Boolean GEOMAlgo_ListNodeOfListOfCoupleOfShapes::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes::~Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes() {} -#define Item GEOMAlgo_CoupleOfShapes -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_() -#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes -#define TCollection_List_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfPnt.hxx b/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfPnt.hxx deleted file mode 100644 index 908c29be4..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfPnt.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_ListNodeOfListOfPnt_HeaderFile -#define _GEOMAlgo_ListNodeOfListOfPnt_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_ListNodeOfListOfPnt_HeaderFile -#include -#endif - -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class gp_Pnt; -class GEOMAlgo_ListOfPnt; -class GEOMAlgo_ListIteratorOfListOfPnt; - - - -class GEOMAlgo_ListNodeOfListOfPnt : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -GEOMAlgo_ListNodeOfListOfPnt(const gp_Pnt& I,const TCollection_MapNodePtr& n); - - gp_Pnt& Value() const; -//Standard_EXPORT ~GEOMAlgo_ListNodeOfListOfPnt(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -gp_Pnt myValue; - - -}; - -#define Item gp_Pnt -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfPnt -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfPnt_Type_() -#define TCollection_List GEOMAlgo_ListOfPnt -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfPnt_0.cxx b/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfPnt_0.cxx deleted file mode 100644 index 3587b7daa..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListNodeOfListOfPnt_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListOfPnt_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListIteratorOfListOfPnt_HeaderFile -#include -#endif -//GEOMAlgo_ListNodeOfListOfPnt::~GEOMAlgo_ListNodeOfListOfPnt() {} - - - -Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ListNodeOfListOfPnt_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ListNodeOfListOfPnt", - sizeof(GEOMAlgo_ListNodeOfListOfPnt), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(GEOMAlgo_ListNodeOfListOfPnt) Handle(GEOMAlgo_ListNodeOfListOfPnt)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMAlgo_ListNodeOfListOfPnt) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfPnt))) { - _anOtherObject = Handle(GEOMAlgo_ListNodeOfListOfPnt)((Handle(GEOMAlgo_ListNodeOfListOfPnt)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& GEOMAlgo_ListNodeOfListOfPnt::DynamicType() const -{ - return STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfPnt) ; -} -//Standard_Boolean GEOMAlgo_ListNodeOfListOfPnt::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfPnt) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_GEOMAlgo_ListNodeOfListOfPnt::~Handle_GEOMAlgo_ListNodeOfListOfPnt() {} -#define Item gp_Pnt -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfPnt -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfPnt_Type_() -#define TCollection_List GEOMAlgo_ListOfPnt -#define TCollection_List_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_ListOfCoupleOfShapes.hxx b/src/GEOMAlgo/GEOMAlgo_ListOfCoupleOfShapes.hxx index 0a4be4cc8..53954a6a8 100644 --- a/src/GEOMAlgo/GEOMAlgo_ListOfCoupleOfShapes.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ListOfCoupleOfShapes.hxx @@ -1,197 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile -#define _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes; -class GEOMAlgo_CoupleOfShapes; -class GEOMAlgo_ListNodeOfListOfCoupleOfShapes; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_ListOfCoupleOfShapes { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ListOfCoupleOfShapes(); - - -Standard_EXPORT void Assign(const GEOMAlgo_ListOfCoupleOfShapes& Other) ; - void operator=(const GEOMAlgo_ListOfCoupleOfShapes& Other) -{ - Assign(Other); -} - - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_ListOfCoupleOfShapes() -{ - Clear(); -} - - - Standard_Boolean IsEmpty() const; - - -Standard_EXPORT void Prepend(const GEOMAlgo_CoupleOfShapes& I) ; - - -Standard_EXPORT void Prepend(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& theIt) ; - - -Standard_EXPORT void Prepend(GEOMAlgo_ListOfCoupleOfShapes& Other) ; - - -Standard_EXPORT void Append(const GEOMAlgo_CoupleOfShapes& I) ; - - -Standard_EXPORT void Append(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& theIt) ; - - -Standard_EXPORT void Append(GEOMAlgo_ListOfCoupleOfShapes& Other) ; +// File: GEOMAlgo_ListOfCoupleOfShapes.hxx +// Created: Wed Feb 22 08:23:27 2012 +// Author: +// -Standard_EXPORT GEOMAlgo_CoupleOfShapes& First() const; +#ifndef GEOMAlgo_ListOfCoupleOfShapes_HeaderFile +#define GEOMAlgo_ListOfCoupleOfShapes_HeaderFile +#include +#include -Standard_EXPORT GEOMAlgo_CoupleOfShapes& Last() const; - - -Standard_EXPORT void RemoveFirst() ; - - -Standard_EXPORT void Remove(GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ; - - -Standard_EXPORT void InsertBefore(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ; - - -Standard_EXPORT void InsertBefore(GEOMAlgo_ListOfCoupleOfShapes& Other,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ; - - -Standard_EXPORT void InsertAfter(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ; - - -Standard_EXPORT void InsertAfter(GEOMAlgo_ListOfCoupleOfShapes& Other,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ; - - -friend class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_ListOfCoupleOfShapes(const GEOMAlgo_ListOfCoupleOfShapes& Other); - - - // Fields PRIVATE - // -Standard_Address myFirst; -Standard_Address myLast; - - -}; - -#define Item GEOMAlgo_CoupleOfShapes -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_() -#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - +typedef NCollection_List GEOMAlgo_ListOfCoupleOfShapes; +typedef GEOMAlgo_ListOfCoupleOfShapes::Iterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes; #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ListOfCoupleOfShapes_0.cxx b/src/GEOMAlgo/GEOMAlgo_ListOfCoupleOfShapes_0.cxx deleted file mode 100644 index 82d3fc5e7..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListOfCoupleOfShapes_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile -#include -#endif - - -#define Item GEOMAlgo_CoupleOfShapes -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_() -#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes -#define TCollection_List_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_ListOfPnt.hxx b/src/GEOMAlgo/GEOMAlgo_ListOfPnt.hxx index 5e425bce3..385ebee9d 100644 --- a/src/GEOMAlgo/GEOMAlgo_ListOfPnt.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ListOfPnt.hxx @@ -1,197 +1,35 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _GEOMAlgo_ListOfPnt_HeaderFile -#define _GEOMAlgo_ListOfPnt_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_GEOMAlgo_ListNodeOfListOfPnt_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class GEOMAlgo_ListIteratorOfListOfPnt; -class gp_Pnt; -class GEOMAlgo_ListNodeOfListOfPnt; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_ListOfPnt { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ListOfPnt(); - - -Standard_EXPORT void Assign(const GEOMAlgo_ListOfPnt& Other) ; - void operator=(const GEOMAlgo_ListOfPnt& Other) -{ - Assign(Other); -} - - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT void Clear() ; -~GEOMAlgo_ListOfPnt() -{ - Clear(); -} - - - Standard_Boolean IsEmpty() const; - - -Standard_EXPORT void Prepend(const gp_Pnt& I) ; - - -Standard_EXPORT void Prepend(const gp_Pnt& I,GEOMAlgo_ListIteratorOfListOfPnt& theIt) ; - - -Standard_EXPORT void Prepend(GEOMAlgo_ListOfPnt& Other) ; - - -Standard_EXPORT void Append(const gp_Pnt& I) ; - - -Standard_EXPORT void Append(const gp_Pnt& I,GEOMAlgo_ListIteratorOfListOfPnt& theIt) ; - +// File: GEOMAlgo_ListOfPnt.hxx +// Created: Wed Feb 22 08:31:47 2012 +// Author: +// -Standard_EXPORT void Append(GEOMAlgo_ListOfPnt& Other) ; +#ifndef GEOMAlgo_ListOfPnt_HeaderFile +#define GEOMAlgo_ListOfPnt_HeaderFile -Standard_EXPORT gp_Pnt& First() const; +#include +#include - -Standard_EXPORT gp_Pnt& Last() const; - - -Standard_EXPORT void RemoveFirst() ; - - -Standard_EXPORT void Remove(GEOMAlgo_ListIteratorOfListOfPnt& It) ; - - -Standard_EXPORT void InsertBefore(const gp_Pnt& I,GEOMAlgo_ListIteratorOfListOfPnt& It) ; - - -Standard_EXPORT void InsertBefore(GEOMAlgo_ListOfPnt& Other,GEOMAlgo_ListIteratorOfListOfPnt& It) ; - - -Standard_EXPORT void InsertAfter(const gp_Pnt& I,GEOMAlgo_ListIteratorOfListOfPnt& It) ; - - -Standard_EXPORT void InsertAfter(GEOMAlgo_ListOfPnt& Other,GEOMAlgo_ListIteratorOfListOfPnt& It) ; - - -friend class GEOMAlgo_ListIteratorOfListOfPnt; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT GEOMAlgo_ListOfPnt(const GEOMAlgo_ListOfPnt& Other); - - - // Fields PRIVATE - // -Standard_Address myFirst; -Standard_Address myLast; - - -}; - -#define Item gp_Pnt -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfPnt -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfPnt_Type_() -#define TCollection_List GEOMAlgo_ListOfPnt -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// +typedef NCollection_List GEOMAlgo_ListOfPnt; +typedef GEOMAlgo_ListOfPnt::Iterator GEOMAlgo_ListIteratorOfListOfPnt; #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ListOfPnt_0.cxx b/src/GEOMAlgo/GEOMAlgo_ListOfPnt_0.cxx deleted file mode 100644 index 3f3344f5e..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ListOfPnt_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListIteratorOfListOfPnt_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ListNodeOfListOfPnt_HeaderFile -#include -#endif - - -#define Item gp_Pnt -#define Item_hxx -#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_hxx -#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfPnt -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfPnt -#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfPnt_Type_() -#define TCollection_List GEOMAlgo_ListOfPnt -#define TCollection_List_hxx -#include - diff --git a/src/GEOMAlgo/GEOMAlgo_PWireEdgeSet.hxx b/src/GEOMAlgo/GEOMAlgo_PWireEdgeSet.hxx index 058553ba1..f803f847f 100644 --- a/src/GEOMAlgo/GEOMAlgo_PWireEdgeSet.hxx +++ b/src/GEOMAlgo/GEOMAlgo_PWireEdgeSet.hxx @@ -1,23 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_PWireEdgeSet.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_PWireEdgeSet_HeaderFile #define _GEOMAlgo_PWireEdgeSet_HeaderFile diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.cdl b/src/GEOMAlgo/GEOMAlgo_PassKey.cdl deleted file mode 100755 index a4b217a34..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKey.cdl +++ /dev/null @@ -1,100 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_PassKey.cdl --- Created: Mon Nov 20 12:16:13 2006 --- Author: Peter KURNEV --- --- -class PassKey from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS, - IndexedMapOfInteger from TColStd, - ListOfInteger from TColStd - ---raises - -is - Create - returns PassKey from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_PassKey();" - - Create(Other:PassKey from GEOMAlgo) - returns PassKey from GEOMAlgo; - - Assign(me:out; - Other : PassKey from GEOMAlgo) - returns PassKey from GEOMAlgo; - ---C++: alias operator = - ---C++: return & - - Clear(me:out); --- - SetIds(me:out; - aI1 :Integer from Standard); - - SetIds(me:out; - aI1 :Integer from Standard; - aI2 :Integer from Standard); - - SetIds(me:out; - aI1 :Integer from Standard; - aI2 :Integer from Standard; - aI3 :Integer from Standard); - - SetIds(me:out; - aI1 :Integer from Standard; - aI2 :Integer from Standard; - aI3 :Integer from Standard; - aI4 :Integer from Standard); - - SetIds(me:out; - aLS :ListOfInteger from TColStd); - - NbIds(me) - returns Integer from Standard; - - IsEqual(me; - aOther:PassKey from GEOMAlgo) - returns Boolean from Standard; - - HashCode(me; - Upper : Integer from Standard) - returns Integer from Standard; - - Id(me; - aIndex: Integer from Standard) - returns Integer from Standard; - - - Dump(me; - aHex:Integer from Standard=0); - - -fields - myNbIds: Integer from Standard is protected; - mySum : Integer from Standard is protected; - myMap : IndexedMapOfInteger from TColStd is protected; - -end PassKey; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.cxx b/src/GEOMAlgo/GEOMAlgo_PassKey.cxx index 254ca6e59..8f6f949e4 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKey.cxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKey.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Algo.cxx -// Created: Sat Dec 04 12:39:47 2004 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_PassKey.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include #include #include @@ -32,24 +33,24 @@ #include #ifdef WNT -#pragma warning( disable : 4101) +#pragma warning( disable : 4101) #endif static Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv); + const Standard_Integer aDiv); //======================================================================= //function : -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKey::GEOMAlgo_PassKey() { - Clear(); + Clear(); } //======================================================================= //function : -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKey::GEOMAlgo_PassKey(const GEOMAlgo_PassKey& aOther) { @@ -59,7 +60,7 @@ static } //======================================================================= //function :Assign -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKey& GEOMAlgo_PassKey::Assign(const GEOMAlgo_PassKey& aOther) { @@ -70,14 +71,14 @@ static } //======================================================================= //function :~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKey::~GEOMAlgo_PassKey() { } //======================================================================= //function :Clear -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKey::Clear() { @@ -87,10 +88,10 @@ static } //======================================================================= //function :SetIds -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1) - + { Clear(); myNbIds=1; @@ -99,10 +100,10 @@ static } //======================================================================= //function :SetIds -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1, - const Standard_Integer aId2) + const Standard_Integer aId2) { TColStd_ListOfInteger aLI; // @@ -112,11 +113,11 @@ static } //======================================================================= //function :SetIds -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1, - const Standard_Integer aId2, - const Standard_Integer aId3) + const Standard_Integer aId2, + const Standard_Integer aId3) { TColStd_ListOfInteger aLI; // @@ -127,13 +128,13 @@ static } //======================================================================= //function :SetIds -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1, - const Standard_Integer aId2, - const Standard_Integer aId3, - const Standard_Integer aId4) -{ + const Standard_Integer aId2, + const Standard_Integer aId3, + const Standard_Integer aId4) +{ TColStd_ListOfInteger aLI; // aLI.Append(aId1); @@ -144,7 +145,7 @@ static } //======================================================================= //function :SetIds -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKey::SetIds(const TColStd_ListOfInteger& aLI) { @@ -166,7 +167,7 @@ static } //======================================================================= //function :NbIds -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_PassKey::NbIds()const { @@ -174,7 +175,7 @@ static } //======================================================================= //function :Id -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_PassKey::Id(const Standard_Integer aIndex) const { @@ -185,7 +186,7 @@ static } //======================================================================= //function :IsEqual -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_PassKey::IsEqual(const GEOMAlgo_PassKey& aOther) const { @@ -207,7 +208,7 @@ static } //======================================================================= //function : HashCode -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_PassKey::HashCode(const Standard_Integer aUpper) const { @@ -215,17 +216,17 @@ static } //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKey::Dump(const Standard_Integer )const { } //======================================================================= // function: NormalizedId -// purpose : +// purpose : //======================================================================= Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv) + const Standard_Integer aDiv) { Standard_Integer aMax, aTresh, aIdRet; // diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.hxx b/src/GEOMAlgo/GEOMAlgo_PassKey.hxx index ce79e29d3..9a992f205 100644 --- a/src/GEOMAlgo/GEOMAlgo_PassKey.hxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKey.hxx @@ -1,149 +1,104 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_PassKey.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_PassKey_HeaderFile #define _GEOMAlgo_PassKey_HeaderFile -#ifndef _Standard_Integer_HeaderFile +#include +#include #include -#endif -#ifndef _TColStd_IndexedMapOfInteger_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class TColStd_ListOfInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - +#include +//======================================================================= +//class : GEOMAlgo_PassKey +//purpose : +//======================================================================= class GEOMAlgo_PassKey { + public: + Standard_EXPORT + GEOMAlgo_PassKey(); -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_PassKey(); -Standard_EXPORT virtual ~GEOMAlgo_PassKey(); - - -Standard_EXPORT GEOMAlgo_PassKey(const GEOMAlgo_PassKey& Other); - - -Standard_EXPORT GEOMAlgo_PassKey& Assign(const GEOMAlgo_PassKey& Other) ; - GEOMAlgo_PassKey& operator =(const GEOMAlgo_PassKey& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void Clear() ; - - -Standard_EXPORT void SetIds(const Standard_Integer aI1) ; + Standard_EXPORT + virtual ~GEOMAlgo_PassKey(); + Standard_EXPORT + GEOMAlgo_PassKey(const GEOMAlgo_PassKey& Other); -Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2) ; + Standard_EXPORT + GEOMAlgo_PassKey& Assign(const GEOMAlgo_PassKey& Other) ; + GEOMAlgo_PassKey& operator =(const GEOMAlgo_PassKey& Other) { + return Assign(Other); + } -Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3) ; + Standard_EXPORT + void Clear() ; + Standard_EXPORT + void SetIds(const Standard_Integer aI1) ; -Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3,const Standard_Integer aI4) ; + Standard_EXPORT + void SetIds(const Standard_Integer aI1, + const Standard_Integer aI2) ; + Standard_EXPORT + void SetIds(const Standard_Integer aI1, + const Standard_Integer aI2, + const Standard_Integer aI3) ; -Standard_EXPORT void SetIds(const TColStd_ListOfInteger& aLS) ; + Standard_EXPORT + void SetIds(const Standard_Integer aI1, + const Standard_Integer aI2, + const Standard_Integer aI3, + const Standard_Integer aI4) ; + Standard_EXPORT + void SetIds(const TColStd_ListOfInteger& aLS) ; -Standard_EXPORT Standard_Integer NbIds() const; + Standard_EXPORT + Standard_Integer NbIds() const; + Standard_EXPORT + Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aOther) const; -Standard_EXPORT Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aOther) const; + Standard_EXPORT + Standard_Integer HashCode(const Standard_Integer Upper) const; + Standard_EXPORT + Standard_Integer Id(const Standard_Integer aIndex) const; -Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; - - -Standard_EXPORT Standard_Integer Id(const Standard_Integer aIndex) const; - - -Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Standard_Integer myNbIds; -Standard_Integer mySum; -TColStd_IndexedMapOfInteger myMap; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - + Standard_EXPORT + void Dump(const Standard_Integer aHex = 0) const; + protected: + Standard_Integer myNbIds; + Standard_Integer mySum; + TColStd_IndexedMapOfInteger myMap; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.ixx b/src/GEOMAlgo/GEOMAlgo_PassKey.ixx deleted file mode 100644 index 4b098cfda..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKey.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.jxx b/src/GEOMAlgo/GEOMAlgo_PassKey.jxx deleted file mode 100644 index 4a975175e..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKey.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TColStd_ListOfInteger_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKey_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl deleted file mode 100755 index 3bcef2436..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl +++ /dev/null @@ -1,48 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_PassKeyMapHasher.cdl --- Created: --- Author: Peter KURNEV --- --- -class PassKeyMapHasher from GEOMAlgo - - ---Purpose: - -uses - PassKey from GEOMAlgo - ---raises - -is - HashCode(myclass; - aPKey : PassKey from GEOMAlgo; - Upper : Integer from Standard) - returns Integer from Standard; - - - IsEqual(myclass; - aPKey1 : PassKey from GEOMAlgo; - aPKey2 : PassKey from GEOMAlgo) - returns Boolean from Standard; - -end PassKeyMapHasher; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx index 8db75c81c..32e62875c 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx @@ -1,46 +1,47 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_PassKeyMapHasher.cxx -// Created: -// Author: Peter KURNEV -// + +// File: GEOMAlgo_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include //======================================================================= //function : HashCode -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_PassKeyMapHasher::HashCode(const GEOMAlgo_PassKey& aPK, - const Standard_Integer Upper) + const Standard_Integer Upper) { return aPK.HashCode(Upper); } //======================================================================= //function :IsEqual -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_PassKeyMapHasher::IsEqual(const GEOMAlgo_PassKey& aPK1, - const GEOMAlgo_PassKey& aPK2) + const GEOMAlgo_PassKey& aPK2) { return aPK1.IsEqual(aPK2); } diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.hxx b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.hxx index 82cf8ff39..0b3039f1e 100644 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.hxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.hxx @@ -1,101 +1,51 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_PassKeyMapHasher.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile #define _GEOMAlgo_PassKeyMapHasher_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class GEOMAlgo_PassKey; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - +#include +#include +#include +//======================================================================= +//class : GEOMAlgo_PassKeyMapHasher +//purpose : +//======================================================================= class GEOMAlgo_PassKeyMapHasher { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Integer HashCode(const GEOMAlgo_PassKey& aPKey,const Standard_Integer Upper) ; - - -Standard_EXPORT static Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aPKey1,const GEOMAlgo_PassKey& aPKey2) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + public: + Standard_EXPORT + static Standard_Integer HashCode(const GEOMAlgo_PassKey& aPKey, + const Standard_Integer Upper) ; + + Standard_EXPORT + static Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aPKey1, + const GEOMAlgo_PassKey& aPKey2) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.ixx b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.ixx deleted file mode 100644 index c21de3f68..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.jxx b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.jxx deleted file mode 100644 index 7b8138bd1..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_PassKey_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl deleted file mode 100755 index b7a60b138..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl +++ /dev/null @@ -1,96 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_PassKeyShape.cdl --- Created: --- Author: Peter KURNEV --- --- -class PassKeyShape from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS, - ListOfShape from TopTools, - IndexedMapOfShape from TopTools - ---raises - -is - Create - returns PassKeyShape from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_PassKeyShape();" - - Create(Other:PassKeyShape from GEOMAlgo) - returns PassKeyShape from GEOMAlgo; - - Assign(me:out; - Other : PassKeyShape from GEOMAlgo) - returns PassKeyShape from GEOMAlgo; - ---C++: alias operator = - ---C++: return & - - SetShapes(me:out; - aS :Shape from TopoDS); - - SetShapes(me:out; - aS1 :Shape from TopoDS; - aS2 :Shape from TopoDS); - - SetShapes(me:out; - aS1 :Shape from TopoDS; - aS2 :Shape from TopoDS; - aS3 :Shape from TopoDS); - - SetShapes(me:out; - aS1 :Shape from TopoDS; - aS2 :Shape from TopoDS; - aS3 :Shape from TopoDS; - aS4 :Shape from TopoDS); - - SetShapes(me:out; - aLS :ListOfShape from TopTools); - - Clear(me:out); - - - NbIds(me) - returns Integer from Standard; - - IsEqual(me; - aOther:PassKeyShape from GEOMAlgo) - returns Boolean from Standard; - - HashCode(me; - Upper : Integer from Standard) - returns Integer from Standard; - - Dump(me; - aHex:Integer from Standard=0); - -fields - myNbIds:Integer from Standard is protected; - mySum :Integer from Standard is protected; - myUpper:Integer from Standard is protected; - myMap :IndexedMapOfShape from TopTools is protected; - -end PassKeyShape; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx index 41debf27e..3aa4f4b04 100755 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx @@ -1,41 +1,42 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_PassKeyShape.cxx -// Created: -// Author: Peter KURNEV -// + +// File: GEOMAlgo_PassKeyShape.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include #include #include -static +static Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv); + const Standard_Integer aDiv); //======================================================================= //function : -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape() { @@ -43,7 +44,7 @@ static } //======================================================================= //function : -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& aOther) { @@ -54,14 +55,14 @@ static } //======================================================================= //function :~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() { } //======================================================================= //function :Assign -//purpose : +//purpose : //======================================================================= GEOMAlgo_PassKeyShape& GEOMAlgo_PassKeyShape::Assign(const GEOMAlgo_PassKeyShape& aOther) { @@ -73,7 +74,7 @@ static } //======================================================================= //function :Clear -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKeyShape::Clear() { @@ -83,10 +84,10 @@ static } //======================================================================= //function :SetShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1) - + { Standard_Integer aHC; // @@ -98,10 +99,10 @@ static } //======================================================================= //function :SetShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2) + const TopoDS_Shape& aS2) { TopTools_ListOfShape aLS; // @@ -111,11 +112,11 @@ static } //======================================================================= //function :SetShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3) + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) { TopTools_ListOfShape aLS; // @@ -126,12 +127,12 @@ static } //======================================================================= //function :SetShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3, - const TopoDS_Shape& aS4) + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) { TopTools_ListOfShape aLS; // @@ -143,7 +144,7 @@ static } //======================================================================= //function :SetShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKeyShape::SetShapes(const TopTools_ListOfShape& aLS) { @@ -166,7 +167,7 @@ static } //======================================================================= //function :NbIds -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_PassKeyShape::NbIds()const { @@ -174,7 +175,7 @@ static } //======================================================================= //function :IsEqual -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_PassKeyShape::IsEqual(const GEOMAlgo_PassKeyShape& aOther) const { @@ -196,7 +197,7 @@ static } //======================================================================= //function : HashCode -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_PassKeyShape::HashCode(const Standard_Integer aUpper) const { @@ -204,17 +205,17 @@ static } //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= void GEOMAlgo_PassKeyShape::Dump(const Standard_Integer)const { } //======================================================================= // function: NormalizedId -// purpose : +// purpose : //======================================================================= Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv) + const Standard_Integer aDiv) { Standard_Integer aMax, aTresh, aIdRet; // diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx index 529fa3ae1..1f886be33 100644 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.hxx @@ -1,148 +1,105 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + +// Copyright (C) 2007-2012 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 // -// 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: GEOMAlgo_PassKeyShape.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_PassKeyShape_HeaderFile #define _GEOMAlgo_PassKeyShape_HeaderFile -#ifndef _Standard_Integer_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class TopoDS_Shape; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif +#include +#include +//======================================================================= +//class : GEOMAlgo_PassKeyShape +//purpose : +//======================================================================= class GEOMAlgo_PassKeyShape { + public: + Standard_EXPORT + GEOMAlgo_PassKeyShape(); -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_PassKeyShape(); -Standard_EXPORT virtual ~GEOMAlgo_PassKeyShape(); - - -Standard_EXPORT GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& Other); - - -Standard_EXPORT GEOMAlgo_PassKeyShape& Assign(const GEOMAlgo_PassKeyShape& Other) ; - GEOMAlgo_PassKeyShape& operator =(const GEOMAlgo_PassKeyShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS) ; - - -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; + Standard_EXPORT + virtual ~GEOMAlgo_PassKeyShape(); + Standard_EXPORT + GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& Other); -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3) ; + Standard_EXPORT + GEOMAlgo_PassKeyShape& Assign(const GEOMAlgo_PassKeyShape& Other) ; + GEOMAlgo_PassKeyShape& operator =(const GEOMAlgo_PassKeyShape& Other) { + return Assign(Other); + } -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3,const TopoDS_Shape& aS4) ; + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS) ; + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) ; -Standard_EXPORT void SetShapes(const TopTools_ListOfShape& aLS) ; + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) ; + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) ; -Standard_EXPORT void Clear() ; + Standard_EXPORT + void SetShapes(const TopTools_ListOfShape& aLS) ; + Standard_EXPORT + void Clear() ; -Standard_EXPORT Standard_Integer NbIds() const; - - -Standard_EXPORT Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const; - - -Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; - - -Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; - + Standard_EXPORT + Standard_Integer NbIds() const; + Standard_EXPORT + Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const; + Standard_EXPORT + Standard_Integer HashCode(const Standard_Integer Upper) const; + Standard_EXPORT + void Dump(const Standard_Integer aHex = 0) const; protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Standard_Integer myNbIds; -Standard_Integer mySum; -Standard_Integer myUpper; -TopTools_IndexedMapOfShape myMap; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + Standard_Integer myNbIds; + Standard_Integer mySum; + Standard_Integer myUpper; + TopTools_IndexedMapOfShape myMap; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.ixx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.ixx deleted file mode 100644 index 94c1a74fa..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.jxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.jxx deleted file mode 100644 index 37f591564..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cdl deleted file mode 100644 index becd85f7b..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cdl +++ /dev/null @@ -1,48 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_PassKeyMapHasher.cdl --- Created: --- Author: Peter KURNEV --- --- -class PassKeyShapeMapHasher from GEOMAlgo - - ---Purpose: - -uses - PassKeyShape from GEOMAlgo - ---raises - -is - HashCode(myclass; - aPKey : PassKeyShape from GEOMAlgo; - Upper : Integer from Standard) - returns Integer from Standard; - - - IsEqual(myclass; - aPKey1 : PassKeyShape from GEOMAlgo; - aPKey2 : PassKeyShape from GEOMAlgo) - returns Boolean from Standard; - -end PassKeyShapeMapHasher; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx index 036cddde9..d90110080 100644 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.cxx @@ -1,46 +1,47 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_PassKeyMapHasher.cxx -// Created: -// Author: Peter KURNEV -// + +// File: GEOMAlgo_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include //======================================================================= //function : HashCode -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_PassKeyShapeMapHasher::HashCode(const GEOMAlgo_PassKeyShape& aPK, - const Standard_Integer Upper) + const Standard_Integer Upper) { return aPK.HashCode(Upper); } //======================================================================= //function :IsEqual -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_PassKeyShapeMapHasher::IsEqual(const GEOMAlgo_PassKeyShape& aPK1, - const GEOMAlgo_PassKeyShape& aPK2) + const GEOMAlgo_PassKeyShape& aPK2) { return aPK1.IsEqual(aPK2); } diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx index 7dcdd4670..41f15bf3e 100644 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.hxx @@ -1,101 +1,52 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_PassKeyMapHasher.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile #define _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class GEOMAlgo_PassKeyShape; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_PassKeyShapeMapHasher { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey,const Standard_Integer Upper) ; - - -Standard_EXPORT static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1,const GEOMAlgo_PassKeyShape& aPKey2) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +#include +#include +#include + +//======================================================================= +//class : GEOMAlgo_PassKeyShapeMapHasher +//purpose : +//======================================================================= +class GEOMAlgo_PassKeyShapeMapHasher +{ + public: + Standard_EXPORT + static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey, + const Standard_Integer Upper) ; + + Standard_EXPORT + static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1, + const GEOMAlgo_PassKeyShape& aPKey2) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.ixx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.ixx deleted file mode 100644 index 3115037ae..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.jxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.jxx deleted file mode 100644 index df8089e56..000000000 --- a/src/GEOMAlgo/GEOMAlgo_PassKeyShapeMapHasher.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_PassKeyShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cdl deleted file mode 100644 index 36ede4369..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cdl +++ /dev/null @@ -1,65 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ShapeAlgo.cdl --- Created: Tue Dec 7 12:05:19 2004 --- Author: Peter KURNEV --- -deferred class ShapeAlgo from GEOMAlgo - inherits Algo from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS, - Context from IntTools - ---raises - -is - Initialize - returns ShapeAlgo from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeAlgo();" - - SetShape(me:out; - aS:Shape from TopoDS); - - SetTolerance(me:out; - aT:Real from Standard); - - Shape(me) - returns Shape from TopoDS; - ---C++:return const & - - Tolerance(me) - returns Real from Standard; - - Result(me) - returns Shape from TopoDS; - ---C++:return const & - -fields - myShape : Shape from TopoDS is protected; - myTolerance : Real from Standard is protected; - myResult : Shape from TopoDS is protected; - myContext : Context from IntTools is protected; - -end ShapeAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx index 9e93ba6ca..b24f71b7a 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx @@ -1,52 +1,70 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_ShapeAlgo.cxx -// Created: Tue Dec 7 12:06:54 2004 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_ShapeAlgo.cxx +// Created: Tue Dec 7 12:06:54 2004 +// Author: Peter KURNEV +// // -#include +#include +#include //======================================================================= //function : GEOMAlgo_ShapeAlgo -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShapeAlgo::GEOMAlgo_ShapeAlgo() -: +: GEOMAlgo_Algo() { myTolerance=0.0001; } - + //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShapeAlgo::~GEOMAlgo_ShapeAlgo() { } //======================================================================= +//function : SetContext +//purpose : +//======================================================================= +void GEOMAlgo_ShapeAlgo::SetContext(const Handle(IntTools_Context)& theContext) +{ + myContext=theContext; +} +//======================================================================= +//function : Context +//purpose : +//======================================================================= +const Handle(IntTools_Context)& GEOMAlgo_ShapeAlgo::Context()const +{ + return myContext; +} +//======================================================================= //function : SetShape -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeAlgo::SetShape(const TopoDS_Shape& aS) { @@ -54,7 +72,7 @@ void GEOMAlgo_ShapeAlgo::SetShape(const TopoDS_Shape& aS) } //======================================================================= //function : Shape -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Shape()const { @@ -62,7 +80,7 @@ const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Shape()const } //======================================================================= //function : SetTolerance -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeAlgo::SetTolerance(const Standard_Real aT) { @@ -70,7 +88,7 @@ void GEOMAlgo_ShapeAlgo::SetTolerance(const Standard_Real aT) } //======================================================================= //function : Tolerance -//purpose : +//purpose : //======================================================================= Standard_Real GEOMAlgo_ShapeAlgo::Tolerance()const { @@ -78,9 +96,19 @@ Standard_Real GEOMAlgo_ShapeAlgo::Tolerance()const } //======================================================================= //function : Result -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Result()const { return myResult; } +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_ShapeAlgo::Perform() +{ + if (myContext.IsNull()) { + myContext=new IntTools_Context; + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx index f8a385f34..98a8c0b3f 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx @@ -1,124 +1,85 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_ShapeAlgo.hxx +// Created: Tue Dec 7 12:06:54 2004 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #define _GEOMAlgo_ShapeAlgo_HeaderFile -#ifndef _TopoDS_Shape_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -#ifndef _IntTools_Context_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Algo_HeaderFile +#include #include -#endif -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_ShapeAlgo : public GEOMAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; +//======================================================================= +//class : GEOMAlgo_ShapeAlgo +//purpose : +//======================================================================= +class GEOMAlgo_ShapeAlgo : public GEOMAlgo_Algo +{ + public: -Standard_EXPORT void SetTolerance(const Standard_Real aT) ; + //! Sets cashed geometrical tools
    + Standard_EXPORT + void SetContext(const Handle(IntTools_Context)& theContext) ; + //! Returns cashed geometrical tools
    + Standard_EXPORT + const Handle_IntTools_Context& Context() const; -Standard_EXPORT const TopoDS_Shape& Shape() const; + Standard_EXPORT + void SetShape(const TopoDS_Shape& aS) ; + Standard_EXPORT + void SetTolerance(const Standard_Real aT) ; -Standard_EXPORT Standard_Real Tolerance() const; - - -Standard_EXPORT const TopoDS_Shape& Result() const; - + Standard_EXPORT + const TopoDS_Shape& Shape() const; + Standard_EXPORT + Standard_Real Tolerance() const; + Standard_EXPORT + const TopoDS_Shape& Result() const; + Standard_EXPORT + virtual void Perform() ; protected: + Standard_EXPORT + GEOMAlgo_ShapeAlgo(); - // Methods PROTECTED - // - - -Standard_EXPORT GEOMAlgo_ShapeAlgo(); -Standard_EXPORT virtual ~GEOMAlgo_ShapeAlgo(); - - - // Fields PROTECTED - // -TopoDS_Shape myShape; -Standard_Real myTolerance; -TopoDS_Shape myResult; -IntTools_Context myContext; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + virtual ~GEOMAlgo_ShapeAlgo(); + TopoDS_Shape myShape; + Standard_Real myTolerance; + TopoDS_Shape myResult; + Handle_IntTools_Context myContext; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.ixx deleted file mode 100644 index 58a281fef..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.jxx deleted file mode 100644 index b5fda6902..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl deleted file mode 100644 index 9115582b4..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl +++ /dev/null @@ -1,208 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ShapeInfo.cdl --- Created: Mon Apr 2 14:04:24 2007 --- Author: Peter KURNEV --- -class ShapeInfo from GEOMAlgo - - ---Purpose: - -uses - Pnt from gp, - Dir from gp, - Ax2 from gp, - Ax3 from gp, - - ShapeEnum from TopAbs, - Shape from TopoDS, - - KindOfShape from GEOMAlgo, - KindOfBounds from GEOMAlgo, - KindOfClosed from GEOMAlgo, - KindOfName from GEOMAlgo ---raises - -is - Create - returns ShapeInfo from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeInfo();" - - Reset(me:out); - - SetType(me:out; - aType:ShapeEnum from TopAbs); - - Type(me) - returns ShapeEnum from TopAbs; - - SetNbSubShapes(me:out; - aType:ShapeEnum from TopAbs; - aNb :Integer from Standard); - - NbSubShapes(me; - aType:ShapeEnum from TopAbs) - returns Integer from Standard; - - SetKindOfShape (me:out; - aT:KindOfShape from GEOMAlgo); - - KindOfShape (me) - returns KindOfShape from GEOMAlgo; - - SetKindOfName (me:out; - aT: KindOfName from GEOMAlgo); - - KindOfName(me) - returns KindOfName from GEOMAlgo; - - SetKindOfBounds (me:out; - aT:KindOfBounds from GEOMAlgo); - - KindOfBounds (me) - returns KindOfBounds from GEOMAlgo; - - SetKindOfClosed (me:out; - aT:KindOfClosed from GEOMAlgo); - - KindOfClosed(me) - returns KindOfClosed from GEOMAlgo; - - SetLocation (me:out; - aP: Pnt from gp); - - Location (me) - returns Pnt from gp; - ---C++: return const& - - SetDirection (me:out; - aD:Dir from gp); - - Direction (me) - returns Dir from gp; - ---C++: return const& - - SetPosition (me:out; - aAx2 : Ax2 from gp); - - SetPosition (me:out; - aAx3 : Ax3 from gp); - - Position (me) - returns Ax3 from gp; - ---C++: return const& - - SetPnt1 (me:out; - aP: Pnt from gp); - - Pnt1 (me) - returns Pnt from gp; - ---C++: return const& - - SetPnt2 (me:out; - aP: Pnt from gp); - - Pnt2 (me) - returns Pnt from gp; - ---C++: return const& - - SetRadius1 (me:out; - aR: Real from Standard); - - Radius1(me) - returns Real from Standard; - - SetRadius2 (me:out; - aR: Real from Standard); - - Radius2(me) - returns Real from Standard; - - SetLength(me:out; - aL: Real from Standard); - - Length(me) - returns Real from Standard; - - SetWidth(me:out; - aW: Real from Standard); - - Width(me) - returns Real from Standard; - - SetHeight(me:out; - aH: Real from Standard); - - Height(me) - returns Real from Standard; - -- - -- Dump - -- - Dump(me); - - DumpVertex(me) - is protected; - - DumpEdge(me) - is protected; - - DumpWire(me) - is protected; - - DumpFace(me) - is protected; - - DumpShell(me) - is protected; - - DumpSolid(me) - is protected; - - DumpCompSolid(me) - is protected; - - DumpCompound(me) - is protected; - -fields - myType : ShapeEnum from TopAbs is protected; - myNbSubShapes : Integer from Standard[9] is protected; - myKindOfShape : KindOfShape from GEOMAlgo is protected; - myKindOfName : KindOfName from GEOMAlgo is protected; - myKindOfBounds : KindOfBounds from GEOMAlgo is protected; - myKindOfClosed : KindOfClosed from GEOMAlgo is protected; - -- - myLocation : Pnt from gp is protected; - myDirection : Dir from gp is protected; - myPosition : Ax3 from gp is protected; - -- - myRadius1 : Real from Standard is protected; - myRadius2 : Real from Standard is protected; - myLength : Real from Standard is protected; - myWidth : Real from Standard is protected; - myHeight : Real from Standard is protected; - -- - myPnt1 : Pnt from gp is protected; - myPnt2 : Pnt from gp is protected; - -- - myNbTypes : Integer from Standard is protected; -end ShapeInfo; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx index e34a909fd..991e4c0a6 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx @@ -1,46 +1,42 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +#include static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType); static void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS); static - void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC); + void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC); static void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB); static void DumpKindOfName(const GEOMAlgo_KindOfName aKS); static - void DumpPosition(const gp_Ax3& aAx3); + void DumpPosition(const gp_Ax3& aAx3); static void DumpLocation(const gp_Pnt& aP); static void DumpDirection(const gp_Dir& aD); //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo() { @@ -48,14 +44,14 @@ static } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo() { } //======================================================================= //function : Reset -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeInfo::Reset() { @@ -84,15 +80,15 @@ static } //======================================================================= //function : SetType -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType) + void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType) { myType=aType; } //======================================================================= //function : Type -//purpose : +//purpose : //======================================================================= TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const { @@ -100,13 +96,13 @@ static } //======================================================================= //function : SetNbSubShapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType, - const Standard_Integer aNb) + const Standard_Integer aNb) { Standard_Integer iN; - + iN=TypeToInteger(aType); if (iN>=0 && iN=0 && iN +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _GEOMAlgo_KindOfShape_HeaderFile #include -#endif -#ifndef _GEOMAlgo_KindOfName_HeaderFile #include -#endif -#ifndef _GEOMAlgo_KindOfBounds_HeaderFile #include -#endif -#ifndef _GEOMAlgo_KindOfClosed_HeaderFile #include -#endif -#ifndef _gp_Pnt_HeaderFile #include -#endif -#ifndef _gp_Dir_HeaderFile #include -#endif -#ifndef _gp_Ax3_HeaderFile #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -class gp_Pnt; -class gp_Dir; -class gp_Ax2; -class gp_Ax3; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_ShapeInfo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ShapeInfo(); -Standard_EXPORT virtual ~GEOMAlgo_ShapeInfo(); - - -Standard_EXPORT void Reset() ; - - -Standard_EXPORT void SetType(const TopAbs_ShapeEnum aType) ; - - -Standard_EXPORT TopAbs_ShapeEnum Type() const; - - -Standard_EXPORT void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ; - - -Standard_EXPORT Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const; - - -Standard_EXPORT void SetKindOfShape(const GEOMAlgo_KindOfShape aT) ; - - -Standard_EXPORT GEOMAlgo_KindOfShape KindOfShape() const; - - -Standard_EXPORT void SetKindOfName(const GEOMAlgo_KindOfName aT) ; - +#include -Standard_EXPORT GEOMAlgo_KindOfName KindOfName() const; -Standard_EXPORT void SetKindOfBounds(const GEOMAlgo_KindOfBounds aT) ; +//======================================================================= +//class : GEOMAlgo_ShapeInfo +//purpose : +//======================================================================= +class GEOMAlgo_ShapeInfo +{ + public: + Standard_EXPORT + GEOMAlgo_ShapeInfo(); + Standard_EXPORT + virtual ~GEOMAlgo_ShapeInfo(); -Standard_EXPORT GEOMAlgo_KindOfBounds KindOfBounds() const; + Standard_EXPORT + void Reset() ; + Standard_EXPORT + void SetType(const TopAbs_ShapeEnum aType) ; -Standard_EXPORT void SetKindOfClosed(const GEOMAlgo_KindOfClosed aT) ; + Standard_EXPORT + TopAbs_ShapeEnum Type() const; + Standard_EXPORT + void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ; -Standard_EXPORT GEOMAlgo_KindOfClosed KindOfClosed() const; + Standard_EXPORT + Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const; + Standard_EXPORT + void SetKindOfShape(const GEOMAlgo_KindOfShape aT) ; -Standard_EXPORT void SetLocation(const gp_Pnt& aP) ; + Standard_EXPORT + GEOMAlgo_KindOfShape KindOfShape() const; + Standard_EXPORT + void SetKindOfName(const GEOMAlgo_KindOfName aT) ; -Standard_EXPORT const gp_Pnt& Location() const; + Standard_EXPORT + GEOMAlgo_KindOfName KindOfName() const; + Standard_EXPORT + void SetKindOfBounds(const GEOMAlgo_KindOfBounds aT) ; -Standard_EXPORT void SetDirection(const gp_Dir& aD) ; + Standard_EXPORT + GEOMAlgo_KindOfBounds KindOfBounds() const; + Standard_EXPORT + void SetKindOfClosed(const GEOMAlgo_KindOfClosed aT) ; -Standard_EXPORT const gp_Dir& Direction() const; + Standard_EXPORT + GEOMAlgo_KindOfClosed KindOfClosed() const; + Standard_EXPORT + void SetLocation(const gp_Pnt& aP) ; -Standard_EXPORT void SetPosition(const gp_Ax2& aAx2) ; + Standard_EXPORT + const gp_Pnt& Location() const; + Standard_EXPORT + void SetDirection(const gp_Dir& aD) ; -Standard_EXPORT void SetPosition(const gp_Ax3& aAx3) ; + Standard_EXPORT + const gp_Dir& Direction() const; + Standard_EXPORT + void SetPosition(const gp_Ax2& aAx2) ; -Standard_EXPORT const gp_Ax3& Position() const; + Standard_EXPORT + void SetPosition(const gp_Ax3& aAx3) ; + Standard_EXPORT + const gp_Ax3& Position() const; -Standard_EXPORT void SetPnt1(const gp_Pnt& aP) ; + Standard_EXPORT + void SetPnt1(const gp_Pnt& aP) ; + Standard_EXPORT + const gp_Pnt& Pnt1() const; -Standard_EXPORT const gp_Pnt& Pnt1() const; + Standard_EXPORT + void SetPnt2(const gp_Pnt& aP) ; + Standard_EXPORT + const gp_Pnt& Pnt2() const; -Standard_EXPORT void SetPnt2(const gp_Pnt& aP) ; + Standard_EXPORT + void SetRadius1(const Standard_Real aR) ; + Standard_EXPORT + Standard_Real Radius1() const; -Standard_EXPORT const gp_Pnt& Pnt2() const; + Standard_EXPORT + void SetRadius2(const Standard_Real aR) ; + Standard_EXPORT + Standard_Real Radius2() const; -Standard_EXPORT void SetRadius1(const Standard_Real aR) ; + Standard_EXPORT + void SetLength(const Standard_Real aL) ; + Standard_EXPORT + Standard_Real Length() const; -Standard_EXPORT Standard_Real Radius1() const; + Standard_EXPORT + void SetWidth(const Standard_Real aW) ; + Standard_EXPORT + Standard_Real Width() const; -Standard_EXPORT void SetRadius2(const Standard_Real aR) ; + Standard_EXPORT + void SetHeight(const Standard_Real aH) ; + Standard_EXPORT + Standard_Real Height() const; -Standard_EXPORT Standard_Real Radius2() const; + Standard_EXPORT + void Dump() const; + protected: + Standard_EXPORT + void DumpVertex() const; -Standard_EXPORT void SetLength(const Standard_Real aL) ; + Standard_EXPORT + void DumpEdge() const; + Standard_EXPORT + void DumpWire() const; -Standard_EXPORT Standard_Real Length() const; + Standard_EXPORT + void DumpFace() const; + Standard_EXPORT + void DumpShell() const; -Standard_EXPORT void SetWidth(const Standard_Real aW) ; + Standard_EXPORT + void DumpSolid() const; + Standard_EXPORT + void DumpCompSolid() const; -Standard_EXPORT Standard_Real Width() const; - - -Standard_EXPORT void SetHeight(const Standard_Real aH) ; - - -Standard_EXPORT Standard_Real Height() const; - - -Standard_EXPORT void Dump() const; - - - - - -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT void DumpVertex() const; - - -Standard_EXPORT void DumpEdge() const; - - -Standard_EXPORT void DumpWire() const; - - -Standard_EXPORT void DumpFace() const; - - -Standard_EXPORT void DumpShell() const; - - -Standard_EXPORT void DumpSolid() const; - - -Standard_EXPORT void DumpCompSolid() const; - - -Standard_EXPORT void DumpCompound() const; - - - // Fields PROTECTED - // -TopAbs_ShapeEnum myType; -Standard_Integer myNbSubShapes[9]; -GEOMAlgo_KindOfShape myKindOfShape; -GEOMAlgo_KindOfName myKindOfName; -GEOMAlgo_KindOfBounds myKindOfBounds; -GEOMAlgo_KindOfClosed myKindOfClosed; -gp_Pnt myLocation; -gp_Dir myDirection; -gp_Ax3 myPosition; -Standard_Real myRadius1; -Standard_Real myRadius2; -Standard_Real myLength; -Standard_Real myWidth; -Standard_Real myHeight; -gp_Pnt myPnt1; -gp_Pnt myPnt2; -Standard_Integer myNbTypes; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + void DumpCompound() const; + TopAbs_ShapeEnum myType; + Standard_Integer myNbSubShapes[9]; + GEOMAlgo_KindOfShape myKindOfShape; + GEOMAlgo_KindOfName myKindOfName; + GEOMAlgo_KindOfBounds myKindOfBounds; + GEOMAlgo_KindOfClosed myKindOfClosed; + gp_Pnt myLocation; + gp_Dir myDirection; + gp_Ax3 myPosition; + Standard_Real myRadius1; + Standard_Real myRadius2; + Standard_Real myLength; + Standard_Real myWidth; + Standard_Real myHeight; + gp_Pnt myPnt1; + gp_Pnt myPnt2; + Standard_Integer myNbTypes; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx deleted file mode 100644 index e7ae2d9ae..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx deleted file mode 100644 index 2ad3d50e7..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2007-2008 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 _gp_Pnt_HeaderFile -#include -#endif -#ifndef _gp_Dir_HeaderFile -#include -#endif -#ifndef _gp_Ax2_HeaderFile -#include -#endif -#ifndef _gp_Ax3_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeInfo_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl deleted file mode 100644 index df956fd5d..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl +++ /dev/null @@ -1,150 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ShapeInfoFiller.cdl --- Created: Mon Apr 2 15:05:34 2007 --- Author: Peter KURNEV --- -class ShapeInfoFiller from GEOMAlgo - inherits Algo from GEOMAlgo - - ---Purpose: - -uses - Pln from gp, - Sphere from gp, - Cylinder from gp, - Cone from gp, - Torus from gp, - - Shape from TopoDS, - Face from TopoDS, - Solid from TopoDS, - - ShapeInfo from GEOMAlgo, - KindOfName from GEOMAlgo, - IndexedDataMapOfShapeShapeInfo from GEOMAlgo - ---raises - -is - - Create - returns ShapeInfoFiller from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeInfoFiller();" - - SetShape(me:out; - aS:Shape from TopoDS); - - Shape(me) - returns Shape from TopoDS; - ---C++:return const & - - SetTolerance(me:out; - aT:Real from Standard); - - Tolerance(me) - returns Real from Standard; - - Info(me) - returns ShapeInfo from GEOMAlgo; - ---C++:return const & - - Info(me; - aS:Shape from TopoDS) - returns ShapeInfo from GEOMAlgo; - ---C++:return const & - - Perform(me:out) - is redefined; - - CheckData(me:out) - is redefined protected; - - FillNbSubShapes(me:out; - aS:Shape from TopoDS; - aInfo: out ShapeInfo from GEOMAlgo) - is protected; - - FillSubShapes(me:out; - aS:Shape from TopoDS) - is protected; - - FillShape(me:out; - aS:Shape from TopoDS) - is protected; - - FillVertex(me:out; - aS:Shape from TopoDS) - is protected; - - FillEdge(me:out; - aS:Shape from TopoDS) - is protected; - - FillFace(me:out; - aS:Shape from TopoDS) - is protected; - - FillSolid(me:out; - aS:Shape from TopoDS) - is protected; - - FillContainer(me:out; - aS:Shape from TopoDS) - is protected; - - - FillDetails(me:out; - aF:Face from TopoDS; - aPln:Pln from gp) - is protected; - - FillDetails(me:out; - aF:Face from TopoDS; - aSph:Sphere from gp) - is protected; - - FillDetails(me:out; - aF:Face from TopoDS; - aCyl:Cylinder from gp) - is protected; - - FillDetails(me:out; - aF:Face from TopoDS; - aCone:Cone from gp) - is protected; - - FillDetails(me:out; - aF:Face from TopoDS; - aTorus:Torus from gp) - is protected; - - FillDetails(me:out; - aS:Solid from TopoDS) - is protected; - -fields - myShape : Shape from TopoDS is protected; - myEmptyInfo : ShapeInfo from GEOMAlgo is protected; - myMapInfo : IndexedDataMapOfShapeShapeInfo from GEOMAlgo is protected; - myTolerance : Real from Standard is protected; -end ShapeInfoFiller; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx index 4c5690521..a599ca89e 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx @@ -1,76 +1,62 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include #include #include #include #include - -#include -#include - -#include -#include -#include - -#include -#include - -#include #include #include #include -#include -#include -#include -#include -#include -#include -#include #include #include -#include #include #include #include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -static - Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT); -static - Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST); -static - Standard_Integer NbWires(const TopoDS_Face& aF); -static - Standard_Integer NbShells(const TopoDS_Solid& aS); +#include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller() : @@ -80,14 +66,14 @@ static } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller() { } //======================================================================= //function : SetTolerance -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT) { @@ -95,7 +81,7 @@ static } //======================================================================= //function : Tolerance -//purpose : +//purpose : //======================================================================= Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const { @@ -103,15 +89,15 @@ static } //======================================================================= //function : SetShape -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS) + void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS) { myShape=aS; } //======================================================================= //function : Shape -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const { @@ -119,15 +105,15 @@ static } //======================================================================= //function : Info -//purpose : +//purpose : //======================================================================= const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const { - return Info(myShape); + return Info(myShape); } //======================================================================= //function : Info -//purpose : +//purpose : //======================================================================= const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info(const TopoDS_Shape& aS) const { @@ -137,12 +123,12 @@ static return aInfo; } } - return myEmptyInfo; + return myEmptyInfo; } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::CheckData() { @@ -155,9 +141,9 @@ static } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::Perform() + void GEOMAlgo_ShapeInfoFiller::Perform() { myErrorStatus=0; // @@ -171,8 +157,8 @@ static FillShape(myShape); } //======================================================================= -//function :FillShape -//purpose : +//function :FillShape +//purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS) { @@ -184,7 +170,7 @@ static case TopAbs_VERTEX: FillVertex(aS); break; - // + // case TopAbs_EDGE: FillEdge(aS); break; @@ -203,30 +189,30 @@ static case TopAbs_COMPOUND: FillContainer(aS); break; - // + // default: break; } } //======================================================================= -//function :FillSubShapes -//purpose : +//function :FillSubShapes +//purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS) { TopoDS_Iterator aIt; // aIt.Initialize(aS); - for (; aIt.More(); aIt.Next()){ + for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aSx=aIt.Value(); FillShape(aSx); } } //======================================================================= //function : FillContainer -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS) + void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS) { myErrorStatus=0; // @@ -269,9 +255,9 @@ static } //======================================================================= //function : FillSolid -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS) + void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS) { Standard_Integer aNbShells; TopoDS_Solid aSd; @@ -293,7 +279,7 @@ static // aSd=TopoDS::Solid(aS); // - aNbShells=NbShells(aSd); + aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd); if (aNbShells>1) { return; } @@ -301,18 +287,18 @@ static FillDetails(aSd); } //======================================================================= -//function :FillFace -//purpose : +//function :FillFace +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS) + void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS) { myErrorStatus=0; // Standard_Boolean bIsAllowedType; - Standard_Integer aNbWires;//, iRet + Standard_Integer aNbWires;//, iRet Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2; Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2; - gp_Pnt aP0; + gp_Pnt aP0; gp_Dir aDN; gp_Ax3 aAx3; GeomAbs_SurfaceType aST; @@ -337,12 +323,12 @@ static // aF=TopoDS::Face(aS); // - aNbWires=NbWires(aF); + aNbWires=GEOMAlgo_ShapeInfoFiller::NbWires(aF); // aSurf=BRep_Tool::Surface(aF); GeomAdaptor_Surface aGAS(aSurf); aST=aGAS.GetType(); - bIsAllowedType=IsAllowedType(aST); + bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aST); if (!bIsAllowedType) { return; } @@ -360,7 +346,9 @@ static aInfo.SetLocation(aP0); aInfo.SetPosition(aAx3); // - if (aNbWires>1) return; + if (aNbWires>1) { + return; + } // //aSurf->Bounds(aUMin, aUMax, aVMin, aVMax); BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); @@ -394,14 +382,16 @@ static aInfo.SetPosition(aAx3); aInfo.SetRadius1(aR1); // - if (aNbWires>1) return; + if (aNbWires>1) { + return; + } // aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); // FillDetails(aF, aSphere); }// else if (aST==GeomAbs_Sphere) { - // + // // 3. Cylinder else if (aST==GeomAbs_Cylinder) { gp_Cylinder aCyl; @@ -416,7 +406,9 @@ static aInfo.SetPosition(aAx3); aInfo.SetRadius1(aR1); // - if (aNbWires>1) return; + if (aNbWires>1) { + return; + } // BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); bInfU1=Precision::IsNegativeInfinite(aUMin); @@ -433,7 +425,7 @@ static } FillDetails(aF, aCyl); } - // + // // 4. Cone else if (aST==GeomAbs_Cone) { gp_Cone aCone; @@ -448,7 +440,9 @@ static aInfo.SetPosition(aAx3); //aInfo.SetRadius1(aR1); // - if (aNbWires>1) return; + if (aNbWires>1) { + return; + } // BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); bInfU1=Precision::IsNegativeInfinite(aUMin); @@ -465,7 +459,7 @@ static } FillDetails(aF, aCone); } - // + // // 5. Torus else if (aST==GeomAbs_Torus) { gp_Torus aTorus; @@ -482,7 +476,9 @@ static aInfo.SetRadius1(aR1); aInfo.SetRadius2(aR2); // - if (aNbWires>1) return; + if (aNbWires>1) { + return; + } // aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); // @@ -490,10 +486,10 @@ static } } //======================================================================= -//function :FillEdge -//purpose : +//function :FillEdge +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) { myErrorStatus=0; // @@ -533,13 +529,54 @@ static aC3D=BRep_Tool::Curve(aE, aT1, aT2); GeomAdaptor_Curve aGAC(aC3D); aCT=aGAC.GetType(); - bIsAllowedType=IsAllowedType(aCT); + bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aCT); if (!bIsAllowedType) { FillSubShapes(aS); return; } + //modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f + // BSplineCurve + if (aCT==GeomAbs_BSplineCurve) { + Standard_Integer aNbKnots, aNbPoles, aDegree; + Standard_Real aLength; + gp_XYZ aXYZ1, aXYZ2, aXYZc; + Handle(Geom_BSplineCurve) aBSp; + // + aBSp=aGAC.BSpline(); + aNbKnots=aBSp->NbKnots(); + aNbPoles=aBSp->NbPoles(); + aDegree =aBSp->Degree(); + if (!(aDegree==1 && aNbKnots==2 && aNbPoles==2)) { + return; // unallowed B-Spline curve + } + // + aInfo.SetKindOfShape(GEOMAlgo_KS_BSPLINE); + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT); + aGAC.D0(aT1, aP1); + aGAC.D0(aT2, aP2); + aInfo.SetPnt1(aP1); + aInfo.SetPnt2(aP2); + // + aLength=aP1.Distance(aP2); + aInfo.SetLength(aLength); + // + aXYZ1=aP1.XYZ(); + aXYZ2=aP2.XYZ(); + aXYZc=aXYZ1+aXYZ2; + aXYZc.Multiply(0.5); + aPc.SetXYZ(aXYZc); + aInfo.SetLocation(aPc); + // + gp_Vec aVec(aPc, aP2); + gp_Dir aDir(aVec); + aInfo.SetDirection(aDir); + } + //modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t // Line - if (aCT==GeomAbs_Line) { + else if (aCT==GeomAbs_Line) { Standard_Boolean bInf1, bInf2; Standard_Real aLength; gp_Lin aLin; @@ -618,7 +655,7 @@ static aInfo.SetKindOfName(GEOMAlgo_KN_ARCCIRCLE); // gp_Vec aVecX(aP, aP1); - gp_Dir aDirX(aVecX); + gp_Dir aDirX(aVecX); gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX); aInfo.SetPosition(aAx2new); } @@ -660,7 +697,7 @@ static aInfo.SetKindOfName(GEOMAlgo_KN_ARCELLIPSE); // gp_Vec aVecX(aP, aP1); - gp_Dir aDirX(aVecX); + gp_Dir aDirX(aVecX); gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX); aInfo.SetPosition(aAx2new); } @@ -669,10 +706,10 @@ static FillSubShapes(aS); } //======================================================================= -//function :FillVertex -//purpose : +//function :FillVertex +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS) + void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS) { myErrorStatus=0; // @@ -697,16 +734,16 @@ static } //======================================================================= //function : FillNbSubshapes -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS, - GEOMAlgo_ShapeInfo& aInfo) + GEOMAlgo_ShapeInfo& aInfo) { myErrorStatus=0; // Standard_Integer i, aNb, aNbS; TopTools_IndexedMapOfShape aM; - TopAbs_ShapeEnum aST; + TopAbs_ShapeEnum aST; TopAbs_ShapeEnum aTypes[]= { //TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX TopAbs_COMPOUND, @@ -718,7 +755,7 @@ static TopAbs_EDGE, TopAbs_VERTEX }; - + // aST=aS.ShapeType(); aNb=sizeof(aTypes)/sizeof(aTypes[0]); @@ -733,10 +770,10 @@ static } } //======================================================================= -//function :NbShells -//purpose : +//function :NbShells +//purpose : //======================================================================= -Standard_Integer NbShells(const TopoDS_Solid& aSd) +Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd) { Standard_Integer iCnt; TopoDS_Iterator aIt; @@ -744,7 +781,7 @@ Standard_Integer NbShells(const TopoDS_Solid& aSd) iCnt=0; // aIt.Initialize(aSd); - for (; aIt.More(); aIt.Next()){ + for (; aIt.More(); aIt.Next()) { //const TopoDS_Shape& aSh=aIt.Value(); ++iCnt; } @@ -752,9 +789,9 @@ Standard_Integer NbShells(const TopoDS_Solid& aSd) } //======================================================================= //function : NbWires -//purpose : +//purpose : //======================================================================= -Standard_Integer NbWires(const TopoDS_Face& aF) +Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF) { Standard_Integer iCnt; TopoDS_Iterator aIt; @@ -762,7 +799,7 @@ Standard_Integer NbWires(const TopoDS_Face& aF) iCnt=0; // aIt.Initialize(aF); - for (; aIt.More(); aIt.Next()){ + for (; aIt.More(); aIt.Next()) { //const TopoDS_Shape& aW=aIt.Value(); ++iCnt; } @@ -770,14 +807,17 @@ Standard_Integer NbWires(const TopoDS_Face& aF) } //======================================================================= //function : IsAllowedType -//purpose : +//purpose : //======================================================================= -Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT) +Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType aCT) { Standard_Boolean bRet; Standard_Integer i, aNb; GeomAbs_CurveType aTypes[]={ - GeomAbs_Line, GeomAbs_Circle, GeomAbs_Ellipse + GeomAbs_Line, + GeomAbs_Circle, + GeomAbs_Ellipse, + GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft }; // bRet=Standard_False; @@ -785,19 +825,18 @@ Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT) for (i=0; i -#endif -#ifndef _GEOMAlgo_ShapeInfo_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Algo_HeaderFile -#include -#endif -class TopoDS_Shape; -class GEOMAlgo_ShapeInfo; -class TopoDS_Face; -class gp_Pln; -class gp_Sphere; -class gp_Cylinder; -class gp_Cone; -class gp_Torus; -class TopoDS_Solid; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_ShapeInfoFiller : public GEOMAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ShapeInfoFiller(); -Standard_EXPORT virtual ~GEOMAlgo_ShapeInfoFiller(); - - -Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; - - -Standard_EXPORT const TopoDS_Shape& Shape() const; - - -Standard_EXPORT void SetTolerance(const Standard_Real aT) ; - - -Standard_EXPORT Standard_Real Tolerance() const; - - -Standard_EXPORT const GEOMAlgo_ShapeInfo& Info() const; - - -Standard_EXPORT const GEOMAlgo_ShapeInfo& Info(const TopoDS_Shape& aS) const; - - -Standard_EXPORT virtual void Perform() ; - - - - - -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT virtual void CheckData() ; - - -Standard_EXPORT void FillNbSubShapes(const TopoDS_Shape& aS,GEOMAlgo_ShapeInfo& aInfo) ; - +#include -Standard_EXPORT void FillSubShapes(const TopoDS_Shape& aS) ; +#include +#include +#include +#include +#include +#include +#include -Standard_EXPORT void FillShape(const TopoDS_Shape& aS) ; +#include +#include +#include +#include +#include +#include -Standard_EXPORT void FillVertex(const TopoDS_Shape& aS) ; +//======================================================================= +//class : GEOMAlgo_ShapeInfoFiller +//purpose : +//======================================================================= +class GEOMAlgo_ShapeInfoFiller : public GEOMAlgo_Algo +{ + public: + Standard_EXPORT + GEOMAlgo_ShapeInfoFiller(); + Standard_EXPORT + virtual ~GEOMAlgo_ShapeInfoFiller(); -Standard_EXPORT void FillEdge(const TopoDS_Shape& aS) ; + Standard_EXPORT + void SetShape(const TopoDS_Shape& aS) ; + Standard_EXPORT + const TopoDS_Shape& Shape() const; -Standard_EXPORT void FillFace(const TopoDS_Shape& aS) ; + Standard_EXPORT + void SetTolerance(const Standard_Real aT) ; + Standard_EXPORT + Standard_Real Tolerance() const; -Standard_EXPORT void FillSolid(const TopoDS_Shape& aS) ; + Standard_EXPORT + const GEOMAlgo_ShapeInfo& Info() const; + Standard_EXPORT + const GEOMAlgo_ShapeInfo& Info(const TopoDS_Shape& aS) const; -Standard_EXPORT void FillContainer(const TopoDS_Shape& aS) ; + Standard_EXPORT + virtual void Perform() ; + protected: + Standard_EXPORT + virtual void CheckData() ; -Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Pln& aPln) ; + Standard_EXPORT + void FillNbSubShapes(const TopoDS_Shape& aS,GEOMAlgo_ShapeInfo& aInfo) ; + Standard_EXPORT + void FillSubShapes(const TopoDS_Shape& aS) ; -Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Sphere& aSph) ; + Standard_EXPORT + void FillShape(const TopoDS_Shape& aS) ; + Standard_EXPORT + void FillVertex(const TopoDS_Shape& aS) ; -Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Cylinder& aCyl) ; + Standard_EXPORT + void FillEdge(const TopoDS_Shape& aS) ; + Standard_EXPORT + void FillFace(const TopoDS_Shape& aS) ; -Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Cone& aCone) ; + Standard_EXPORT + void FillSolid(const TopoDS_Shape& aS) ; + Standard_EXPORT + void FillContainer(const TopoDS_Shape& aS) ; -Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Torus& aTorus) ; + Standard_EXPORT + void FillDetails(const TopoDS_Face& aF,const gp_Pln& aPln) ; + Standard_EXPORT + void FillDetails(const TopoDS_Face& aF,const gp_Sphere& aSph) ; -Standard_EXPORT void FillDetails(const TopoDS_Solid& aS) ; + Standard_EXPORT + void FillDetails(const TopoDS_Face& aF,const gp_Cylinder& aCyl) ; + Standard_EXPORT + void FillDetails(const TopoDS_Face& aF,const gp_Cone& aCone) ; - // Fields PROTECTED - // -TopoDS_Shape myShape; -GEOMAlgo_ShapeInfo myEmptyInfo; -GEOMAlgo_IndexedDataMapOfShapeShapeInfo myMapInfo; -Standard_Real myTolerance; + Standard_EXPORT + void FillDetails(const TopoDS_Face& aF,const gp_Torus& aTorus) ; + Standard_EXPORT + void FillDetails(const TopoDS_Solid& aS) ; -private: + //modified by NIZNHY-PKV Tue Jul 03 13:31:43 2012f + Standard_EXPORT + Standard_Boolean TreatStepSphere(const TopoDS_Solid& aS); - // Methods PRIVATE - // + Standard_EXPORT static + Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT); + Standard_EXPORT static + Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST); - // Fields PRIVATE - // + Standard_EXPORT static + Standard_Integer NbWires(const TopoDS_Face& aF); + Standard_EXPORT static + Standard_Integer NbShells(const TopoDS_Solid& aS); + //modified by NIZNHY-PKV Tue Jul 03 13:31:49 2012t + TopoDS_Shape myShape; + GEOMAlgo_ShapeInfo myEmptyInfo; + GEOMAlgo_IndexedDataMapOfShapeShapeInfo myMapInfo; + Standard_Real myTolerance; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx deleted file mode 100644 index 99038a856..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx deleted file mode 100644 index e7edb1ea6..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeInfo_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _gp_Pln_HeaderFile -#include -#endif -#ifndef _gp_Sphere_HeaderFile -#include -#endif -#ifndef _gp_Cylinder_HeaderFile -#include -#endif -#ifndef _gp_Cone_HeaderFile -#include -#endif -#ifndef _gp_Torus_HeaderFile -#include -#endif -#ifndef _TopoDS_Solid_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeInfoFiller_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx index 152a4f3ad..ec0b27c00 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx @@ -1,27 +1,26 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include #include +#include +#include #include #include @@ -33,6 +32,8 @@ #include +#include + #include #include #include @@ -47,18 +48,25 @@ #include #include + #include +#include +#include #include -#include -#include + +static + Standard_Boolean IsEqual(const gp_Sphere& aSp1, + const gp_Sphere& aSp2, + const Standard_Real aTolDst); //======================================================================= //function : FillDetails -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) +void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) { + Standard_Boolean bIsStepSphere; Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX; TopoDS_Shape aFCyl, aFCon; TopTools_IndexedMapOfShape aMF; @@ -79,17 +87,26 @@ GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); aKNF=aInfoF.KindOfName(); // mb: sphere, torus if (aKNF==GEOMAlgo_KN_SPHERE || - aKNF==GEOMAlgo_KN_TORUS) { + aKNF==GEOMAlgo_KN_TORUS) { aInfo.SetKindOfName(aKNF); aInfo.SetLocation(aInfoF.Location()); aInfo.SetPosition(aInfoF.Position()); aInfo.SetRadius1(aInfoF.Radius1()); if(aKNF==GEOMAlgo_KN_TORUS) { - aInfo.SetRadius2(aInfoF.Radius2()); + aInfo.SetRadius2(aInfoF.Radius2()); } return; } } + //modified by NIZNHY-PKV Tue Jul 03 13:23:55 2012f + else if (aNbF==2) { + // specific solid that should be treated as a sphere + bIsStepSphere=TreatStepSphere(aSd); + if (bIsStepSphere) { + return; + } + } + //modified by NIZNHY-PKV Tue Jul 03 13:23:57 2012t // aNbCyl=0; aNbCon=0; @@ -99,7 +116,7 @@ for (i=1; i<=aNbF; ++i) { const TopoDS_Shape& aF=aMF(i); GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); - aKNF=aInfoF.KindOfName(); + aKNF=aInfoF.KindOfName(); if (aKNF==GEOMAlgo_KN_CYLINDER) { aFCyl=aF; ++aNbCyl; @@ -112,11 +129,10 @@ ++aNbCrc; } else if (aKNF==GEOMAlgo_KN_POLYGON || - aKNF==GEOMAlgo_KN_TRIANGLE || - aKNF==GEOMAlgo_KN_QUADRANGLE) { + aKNF==GEOMAlgo_KN_TRIANGLE || + aKNF==GEOMAlgo_KN_QUADRANGLE) { ++aNbPgn; - - } + } else if (aKNF==GEOMAlgo_KN_RECTANGLE) { ++aNbPgn; ++aNbRct; @@ -127,7 +143,7 @@ if (aNbCyl==1 && aNbCrc==2 && aNbX==aNbF) { // cylinder (as they understand it) GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aFCyl); - aKNF=aInfoF.KindOfName(); + aKNF=aInfoF.KindOfName(); aInfo.SetKindOfName(aKNF); aInfo.SetLocation(aInfoF.Location()); aInfo.SetPosition(aInfoF.Position()); @@ -140,7 +156,7 @@ if (aNbCon==1 && (aNbCrc==1 || aNbCrc==2) && aNbX==aNbF) { // cone GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aFCon); - aKNF=aInfoF.KindOfName(); + aKNF=aInfoF.KindOfName(); aInfo.SetKindOfName(aKNF); aInfo.SetLocation(aInfoF.Location()); aInfo.SetPosition(aInfoF.Position()); @@ -150,10 +166,14 @@ return; } // + if (aNbF!=aNbPgn) { + return;// -> GEOMAlgo_KN_UNKNOWN + } if (aNbPgn!=6) { aInfo.SetKindOfName(GEOMAlgo_KN_POLYHEDRON); return; } + // aNbPgn==6 if (aNbPgn!=aNbRct) { aInfo.SetKindOfName(GEOMAlgo_KN_POLYHEDRON); return; @@ -200,7 +220,7 @@ // for (j=i+1; j<=aNbF; ++j) { if (aMp.Contains(j)) { - continue; + continue; } // const TopoDS_Shape& aFj=aMF(j); @@ -208,11 +228,16 @@ const gp_Dir& aDNj=aIFj.Position().Direction(); // aDot=aDNi*aDNj; + //modified by NIZNHY-PKV Tue Jul 03 10:01:56 2012f + if (aDot<0.) { + aDot=-aDot; + } + //modified by NIZNHY-PKV Tue Jul 03 10:01:52 2012t if (fabs(1.-aDot)<0.0001) { - aMp.Add(i); - aMp.Add(j); - aMFi.Add(aFi); - break; + aMp.Add(i); + aMp.Add(j); + aMFi.Add(aFi); + break; } // } @@ -264,10 +289,10 @@ } //======================================================================= //function : FillDetails -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Pln& aPln) +void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Pln& aPln) { Standard_Integer aNbV, aNbE, i, j; Standard_Real aDot, aD0, aD1, aLength, aWidth; @@ -336,7 +361,7 @@ const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); aKNE=aInfoE.KindOfName(); if (aKNE!=GEOMAlgo_KN_SEGMENT) { - return; + return; } } // @@ -348,11 +373,11 @@ aXYZc.SetCoord(0.,0.,0.); TopExp::MapShapes(aF, TopAbs_VERTEX, aMV); for (i=1; i<=aNbV; ++i) { - const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); - aP=BRep_Tool::Pnt(aV); - const gp_XYZ& aXYZ=aP.XYZ(); - aXYZc=aXYZc+aXYZ; - aPx[i-1]=aP; + const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); + aP=BRep_Tool::Pnt(aV); + const gp_XYZ& aXYZ=aP.XYZ(); + aXYZc=aXYZc+aXYZ; + aPx[i-1]=aP; } aXYZc.Divide(3.); // @@ -394,12 +419,12 @@ j=(i==3) ? 0 : i+1; aDot=aDx[i]*aDx[j]; if (fabs (aDot) > myTolerance) { - aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); - return; + aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); + return; } } // - // rectangle + // rectangle aInfo.SetKindOfName(GEOMAlgo_KN_RECTANGLE); // // shift location to the center and calc. sizes @@ -446,20 +471,20 @@ gp_Ax3 aAx3(aAx2); aInfo.SetPosition(aAx3); } - + return; } //======================================================================= //function : FillDetails -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Sphere& ) +void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Sphere& ) { Standard_Integer aNbV, aNbE, aNbSE, aNbDE; - TopoDS_Edge aE; + TopoDS_Edge aE; TopExp_Explorer aExp; - TopTools_MapOfShape aM; + TopTools_MapOfShape aM; GEOMAlgo_KindOfShape aKS, aKSE; // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); @@ -486,10 +511,10 @@ aKSE=aInfoE.KindOfShape(); // if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; + ++aNbSE; } else if (aKSE==GEOMAlgo_KS_DEGENERATED) { - ++aNbDE; + ++aNbDE; } } } @@ -501,10 +526,10 @@ } //======================================================================= //function : FillDetails -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Cone& )//aCone) +void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Cone& )//aCone) { Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i; Standard_Real aR[3], aHeight; @@ -550,34 +575,34 @@ aKCE=aInfoE.KindOfClosed(); aKSE=aInfoE.KindOfShape(); if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { - aPC[i]=aInfoE.Location(); - aR[i]=aInfoE.Radius1(); - // - aIt.Initialize(aE); - for (; aIt.More(); aIt.Next()) { - aVD=TopoDS::Vertex(aIt.Value()); - break; - } - aPX[i]=BRep_Tool::Pnt(aVD); - // - ++i; - ++aNbCE; + aPC[i]=aInfoE.Location(); + aR[i]=aInfoE.Radius1(); + // + aIt.Initialize(aE); + for (; aIt.More(); aIt.Next()) { + aVD=TopoDS::Vertex(aIt.Value()); + break; + } + aPX[i]=BRep_Tool::Pnt(aVD); + // + ++i; + ++aNbCE; } else if (aKNE==GEOMAlgo_KN_SEGMENT) { - if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; - } + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } } else if (aKSE==GEOMAlgo_KS_DEGENERATED) { - aIt.Initialize(aE); - for (; aIt.More(); aIt.Next()) { - aVD=TopoDS::Vertex(aIt.Value()); - break; - } - // - aPD=BRep_Tool::Pnt(aVD); - // - ++aNbDE; + aIt.Initialize(aE); + for (; aIt.More(); aIt.Next()) { + aVD=TopoDS::Vertex(aIt.Value()); + break; + } + // + aPD=BRep_Tool::Pnt(aVD); + // + ++aNbDE; } } } @@ -630,10 +655,10 @@ } //======================================================================= //function : FillDetails -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Cylinder& aCyl) +void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Cylinder& aCyl) { Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE; Standard_Real aT0, aT1, aHeight; @@ -644,7 +669,7 @@ GEOMAlgo_KindOfShape aKS; GEOMAlgo_KindOfName aKN, aKNE; GEOMAlgo_KindOfClosed aKCE; - // + // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); aKN=GEOMAlgo_KN_UNKNOWN; aInfo.SetKindOfName(aKN); @@ -675,13 +700,13 @@ aKNE=aInfoE.KindOfName(); aKCE=aInfoE.KindOfClosed(); if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { - aPC[aNbCE]=aInfoE.Location(); - ++aNbCE; + aPC[aNbCE]=aInfoE.Location(); + ++aNbCE; } else if (aKNE==GEOMAlgo_KN_SEGMENT) { - if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; - } + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } } } } @@ -715,15 +740,15 @@ //======================================================================= //function : FillDetails -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Torus& ) +void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Torus& ) { Standard_Integer aNbV, aNbE, aNbSE; - TopoDS_Edge aE; + TopoDS_Edge aE; TopExp_Explorer aExp; - TopTools_MapOfShape aM; + TopTools_MapOfShape aM; GEOMAlgo_KindOfShape aKS; // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); @@ -745,9 +770,8 @@ for (; aExp.More(); aExp.Next()) { aE=TopoDS::Edge(aExp.Current()); if (aM.Add(aE)) { - //const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; + ++aNbSE; } } } @@ -757,3 +781,121 @@ } aInfo.SetKindOfName(GEOMAlgo_KN_TORUS); } +//modified by NIZNHY-PKV Tue Jul 03 13:29:41 2012f +//======================================================================= +//function : TreatStepSphere +//purpose : +//======================================================================= +Standard_Boolean + GEOMAlgo_ShapeInfoFiller::TreatStepSphere(const TopoDS_Solid& aSd) +{ + Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual; + Standard_Integer j; + Standard_Real aTolAng, aTolLin; + Standard_Real aVolume, aVolumeS, dV, aArea, aAreaS, dA; + gp_Sphere aSphere[2]; + GeomAbs_SurfaceType aST; + Handle(Geom_Surface) aS; + GeomAdaptor_Surface aGAS; + TopExp_Explorer aExp; + // + bRet=Standard_False; + aTolLin=Precision::Confusion(); + aTolAng=Precision::Angular(); + // + aExp.Init(aSd, TopAbs_FACE); + for (j=0; aExp.More(); aExp.Next(), ++j) { + const TopoDS_Face& aF=*((TopoDS_Face*)&aExp.Current()); + aS=BRep_Tool::Surface(aF); + aGAS.Load(aS); + aST=aGAS.GetType(); + bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aST); + if (!bIsAllowedType) { + return bRet; + } + // + if (aST!=GeomAbs_Sphere) { + return bRet; + } + // + aSphere[j]=aGAS.Sphere(); + } + // + bIsEqual=IsEqual(aSphere[0], aSphere[1], aTolLin); + if (!bIsEqual) { + return bRet; + } + // + //-------------------------------- + GProp_GProps aGProps; + // + bOnlyClosed=Standard_False; + // + aVolume=aSphere[0].Volume(); + // + BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed); + aVolumeS=aGProps.Mass(); + if (aVolumeS<0.) { + aVolumeS=-aVolumeS; + } + // + dV=fabs(aVolumeS-aVolume); + if (dV>aTolLin) { + return bRet; + } + //-------------------------------- + aArea=aSphere[0].Area(); + // + BRepGProp::SurfaceProperties(aSd, aGProps); + aAreaS=aGProps.Mass(); + // + dA=fabs(aAreaS-aArea); + if (dA>aTolLin) { + return bRet; + } + // + //-------------------------------- + gp_Pnt aP0; + gp_Ax3 aAx3; + Standard_Real aR1; + // + aP0=aSphere[0].Location(); + aAx3=aSphere[0].Position(); + aR1=aSphere[0].Radius(); + // + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd); + // + aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aR1); + // + return !bRet;// true +} +//======================================================================= +//function : IsEqual +//purpose : +//======================================================================= +Standard_Boolean IsEqual(const gp_Sphere& aSp1, + const gp_Sphere& aSp2, + const Standard_Real aTolLin) +{ + Standard_Boolean bRet; + Standard_Real aR1, aR2, aD2; + // + bRet=Standard_False; + aR1=aSp1.Radius(); + aR2=aSp2.Radius(); + if (fabs(aR1-aR2)>aTolLin) { + return bRet; + } + // + const gp_Pnt& aPC1=aSp1.Position().Location(); + const gp_Pnt& aPC2=aSp2.Position().Location(); + // + aD2=aPC1.SquareDistance(aPC2); + bRet=(aD2 +#include #include @@ -31,15 +32,15 @@ #include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_ShapeSet::GEOMAlgo_ShapeSet() { } //======================================================================= //function : Clear -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeSet::Clear() { @@ -48,7 +49,7 @@ } //======================================================================= //function : Add -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape) { @@ -58,10 +59,10 @@ } //======================================================================= //function : Add -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeSet::Add(const TopoDS_Shape& theShape, - const TopAbs_ShapeEnum theType) + const TopAbs_ShapeEnum theType) { TopExp_Explorer aExp; // @@ -75,7 +76,7 @@ } //======================================================================= //function : Add -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeSet::Add(const TopTools_ListOfShape& theLS) { @@ -90,27 +91,16 @@ } } //======================================================================= -//function :GetSet -//purpose : +//function :GetSet +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const { - /* - TopTools_ListOfShape *pL; - TopTools_MapIteratorOfMapOfOrientedShape aIt; - // - pL=(TopTools_ListOfShape *)&myList; - pL->Clear(); - aIt.Initialize(myMap); - for (; aIt.More(); aIt.Next()) { - pL->Append(aIt.Key()); - } - */ return myList; } //======================================================================= //function : Contains -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_ShapeSet::Contains(const GEOMAlgo_ShapeSet& theOther)const { @@ -127,7 +117,7 @@ if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) { bRet=myMap.Contains(aF); if (!bRet) { - break; + break; } } } @@ -135,20 +125,10 @@ } //======================================================================= //function : Subtract -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther) { - /* - TopTools_MapIteratorOfMapOfOrientedShape aIt; - // - aIt.Initialize(theOther.myMap); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Key(); - myMap.Remove(aS); - } - */ - // TopTools_ListIteratorOfListOfShape aIt; TopTools_ListOfShape aLS; // @@ -158,10 +138,40 @@ const TopoDS_Shape& aS=aIt.Value(); if (!theOther.myMap.Contains(aS)) { if(myMap.Add(aS)){ - aLS.Append(aS); + aLS.Append(aS); } } } // myList=aLS; } +//modified by NIZNHY-PKV Wed Oct 28 13:51:36 2010f +//======================================================================= +//function : IsEqual +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_ShapeSet::IsEqual(const GEOMAlgo_ShapeSet& theOther)const +{ + Standard_Boolean bRet; + Standard_Integer aNb1, aNb2; + TopTools_ListIteratorOfListOfShape aIt; + // + bRet=Standard_True; + aNb1=myList.Extent(); + const TopTools_ListOfShape& aLS2=theOther.GetSet(); + aNb2=aLS2.Extent(); + if (aNb1!=aNb2) { + return !bRet; + } + // + aIt.Initialize(myList); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + if(!theOther.myMap.Contains(aS)) { + bRet=!bRet; + break; + } + } + return bRet; +} +//modified by NIZNHY-PKV Wed Oct 28 13:51:38 2010t diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx b/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx index 72d00d5b1..b304a8bba 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx @@ -1,131 +1,92 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_ShapeSet.hxx +// Created: +// Author: Peter KURNEV // #ifndef _GEOMAlgo_ShapeSet_HeaderFile #define _GEOMAlgo_ShapeSet_HeaderFile -#ifndef _TopTools_MapOfOrientedShape_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class TopTools_ListOfShape; -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif +#include //! Implementation some formal
    //! opereations with Set of shapes
    -class GEOMAlgo_ShapeSet { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Empty constructor
    -Standard_EXPORT GEOMAlgo_ShapeSet(); - -//! Adds shapes from the list theLS to the Set
    -Standard_EXPORT void Add(const TopTools_ListOfShape& theLS) ; - -//! Adds shape theShape to the Set
    -Standard_EXPORT void Add(const TopoDS_Shape& theShape) ; - -//! Adds sub-shapes of shape theShape,
    -//! that have type theType to the Set
    -Standard_EXPORT void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ; - -//! Removes shapes of theSet from the Set
    -Standard_EXPORT void Subtract(const GEOMAlgo_ShapeSet& theSet) ; - -//! Clears internal fields
    -Standard_EXPORT void Clear() ; - -//! Returns True if the Set contains
    -//! all shapes of theSet
    -Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const; - -//! Returns the Set
    -Standard_EXPORT const TopTools_ListOfShape& GetSet() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopTools_MapOfOrientedShape myMap; -TopTools_ListOfShape myList; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +//======================================================================= +//class : GEOMAlgo_ShapeSet +//purpose : +//======================================================================= +class GEOMAlgo_ShapeSet +{ + public: + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_ShapeSet(); + + //! Adds shapes from the list theLS to the Set
    + Standard_EXPORT + void Add(const TopTools_ListOfShape& theLS) ; + + //! Adds shape theShape to the Set
    + Standard_EXPORT + void Add(const TopoDS_Shape& theShape) ; + + //! Adds sub-shapes of shape theShape,
    + //! that have type theType to the Set
    + Standard_EXPORT + void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ; + + //! Removes shapes of theSet from the Set
    + Standard_EXPORT + void Subtract(const GEOMAlgo_ShapeSet& theSet) ; + + //! Clears internal fields
    + Standard_EXPORT void Clear() ; + + //! Returns True if the Set contains
    + //! all shapes of theSet
    + Standard_EXPORT + Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const; + + //! Returns the Set
    + Standard_EXPORT + const TopTools_ListOfShape& GetSet() const; + + //! Returns True if the Set==theSet
    + Standard_EXPORT + Standard_Boolean IsEqual(const GEOMAlgo_ShapeSet& theOther) const; + + Standard_Boolean operator ==(const GEOMAlgo_ShapeSet& theOther) const { + return IsEqual(theOther); + } + + protected: + TopTools_MapOfOrientedShape myMap; + TopTools_ListOfShape myList; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSet.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeSet.ixx deleted file mode 100644 index 984facf18..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSet.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSet.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeSet.jxx deleted file mode 100644 index 927257846..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSet.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeSet_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl deleted file mode 100644 index 84fb33d37..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl +++ /dev/null @@ -1,66 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ShapeSolid.cdl --- Created: Thu Jan 13 12:44:07 2005 --- Author: Peter KURNEV --- -deferred class ShapeSolid from GEOMAlgo - inherits Algo from GEOMAlgo - - ---Purpose: - -uses - State from TopAbs, - ListOfShape from TopTools, - PDSFiller from BOPTools, - DSFiller from BOPTools ---raises - -is - Initialize - returns ShapeSolid from GEOMAlgo; - - - SetFiller(me:out; - aDSF:DSFiller from BOPTools); - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid();" - - - Shapes(me; - aState:State from TopAbs) - returns ListOfShape from TopTools; - ---C++: return const & - - BuildResult (me:out) - is deferred protected; - - Prepare(me:out) - is deferred protected; - -fields - myLSIN : ListOfShape from TopTools is protected; - myLSOUT : ListOfShape from TopTools is protected; - myLSON : ListOfShape from TopTools is protected; - myRank : Integer from Standard is protected; - myDSFiller : PDSFiller from BOPTools is protected; - -end ShapeSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx index 1883de4a0..04f69b29a 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx @@ -1,37 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_ShapeSolid.cxx -// Created: Thu Jan 13 12:54:48 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_ShapeSolid.cxx +// Created: Thu Jan 13 12:54:48 2005 +// Author: Peter KURNEV +// // -#include +#include #include #include //======================================================================= //function : GEOMAlgo_ShapeSolid -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShapeSolid::GEOMAlgo_ShapeSolid() : @@ -42,14 +43,14 @@ GEOMAlgo_ShapeSolid::GEOMAlgo_ShapeSolid() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShapeSolid::~GEOMAlgo_ShapeSolid() { } //======================================================================= //function : SetFiller -//purpose : +//purpose : //======================================================================= void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller) { @@ -57,7 +58,7 @@ void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller) } //======================================================================= // function: Shapes -// purpose: +// purpose: //======================================================================= const TopTools_ListOfShape& GEOMAlgo_ShapeSolid::Shapes(const TopAbs_State aState) const { @@ -72,10 +73,10 @@ const TopTools_ListOfShape& GEOMAlgo_ShapeSolid::Shapes(const TopAbs_State aStat break; case TopAbs_ON: pL=&myLSON; - break; + break; default: pL=&myLSON; - break; + break; } return *pL; } diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx index a913d917c..47e3edac7 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.hxx @@ -1,126 +1,73 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_ShapeSolid.hxx +// Created: Thu Jan 13 12:54:48 2005 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_ShapeSolid_HeaderFile #define _GEOMAlgo_ShapeSolid_HeaderFile -#ifndef _TopTools_ListOfShape_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _BOPTools_PDSFiller_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Algo_HeaderFile #include -#endif -#ifndef _TopAbs_State_HeaderFile #include -#endif -class BOPTools_DSFiller; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_ShapeSolid : public GEOMAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT void SetFiller(const BOPTools_DSFiller& aDSF) ; -Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid(); - - -Standard_EXPORT const TopTools_ListOfShape& Shapes(const TopAbs_State aState) const; - +#include +//======================================================================= +//function : GEOMAlgo_ShapeSolid +//purpose : +//======================================================================= +class GEOMAlgo_ShapeSolid : public GEOMAlgo_Algo +{ + public: + Standard_EXPORT + void SetFiller(const BOPTools_DSFiller& aDSF) ; + Standard_EXPORT + virtual ~GEOMAlgo_ShapeSolid(); + Standard_EXPORT + const TopTools_ListOfShape& Shapes(const TopAbs_State aState) const; protected: + Standard_EXPORT + GEOMAlgo_ShapeSolid(); - // Methods PROTECTED - // - - -Standard_EXPORT GEOMAlgo_ShapeSolid(); - - -Standard_EXPORT virtual void BuildResult() = 0; - - -Standard_EXPORT virtual void Prepare() = 0; - - - // Fields PROTECTED - // -TopTools_ListOfShape myLSIN; -TopTools_ListOfShape myLSOUT; -TopTools_ListOfShape myLSON; -Standard_Integer myRank; -BOPTools_PDSFiller myDSFiller; - + Standard_EXPORT + virtual void BuildResult() = 0; -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + virtual void Prepare() = 0; + TopTools_ListOfShape myLSIN; + TopTools_ListOfShape myLSOUT; + TopTools_ListOfShape myLSON; + Standard_Integer myRank; + BOPTools_PDSFiller myDSFiller; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx deleted file mode 100644 index 22f64b475..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx deleted file mode 100644 index e21210348..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _BOPTools_DSFiller_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShapeSolid_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl deleted file mode 100644 index 43aac10ac..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl +++ /dev/null @@ -1,52 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_ShellSolid.cdl --- Created: Wed Jan 12 12:45:20 2005 --- Author: Peter KURNEV --- -class ShellSolid from GEOMAlgo - inherits ShapeSolid from GEOMAlgo - ---Purpose: - ---uses ---raises - -is - Create - returns ShellSolid from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShellSolid();" - - Perform (me:out) - is redefined; - - Prepare(me:out) - is redefined protected; - - BuildResult (me:out) - is redefined protected; - - DetectSDFaces(me:out) - is protected; - ---fields - -end ShellSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx index c4dca68d0..c032c1111 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_ShellSolid.cxx -// Created: Wed Jan 12 12:49:45 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_ShellSolid.cxx +// Created: Wed Jan 12 12:49:45 2005 +// Author: Peter KURNEV +// // -#include +#include #include @@ -74,7 +75,7 @@ //======================================================================= //function : GEOMAlgo_ShellSolid -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShellSolid::GEOMAlgo_ShellSolid() : @@ -83,16 +84,16 @@ GEOMAlgo_ShellSolid::GEOMAlgo_ShellSolid() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_ShellSolid::~GEOMAlgo_ShellSolid() { } //======================================================================= -// function: -// purpose: +// function: +// purpose: //======================================================================= -void GEOMAlgo_ShellSolid::Perform() +void GEOMAlgo_ShellSolid::Perform() { myErrorStatus=0; // @@ -123,12 +124,12 @@ void GEOMAlgo_ShellSolid::Perform() } //======================================================================= // function: Prepare -// purpose: +// purpose: //======================================================================= -void GEOMAlgo_ShellSolid::Prepare() +void GEOMAlgo_ShellSolid::Prepare() { const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); - // + // // 1 States BOPTools_SolidStateFiller aStateFiller(aPaveFiller); aStateFiller.Do(); @@ -146,9 +147,9 @@ void GEOMAlgo_ShellSolid::Prepare() } //================================================================================= // function: BuildResult -// purpose: +// purpose: //================================================================================= -void GEOMAlgo_ShellSolid::BuildResult() +void GEOMAlgo_ShellSolid::BuildResult() { Standard_Boolean bIsTouchCase; Standard_Integer i, j, nF1, nF2, aNbFFs, aNbS, aNbCurves, nSp, iRank1; @@ -217,7 +218,7 @@ void GEOMAlgo_ShellSolid::BuildResult() const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks(); aNbS=aSectEdges.Extent(); if (aNbS) { - break; + break; } } // @@ -229,7 +230,7 @@ void GEOMAlgo_ShellSolid::BuildResult() for (; anExp.More(); anExp.Next()) { const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current()); if (BRep_Tool::Degenerated(aE)) { - continue; + continue; } // nE=aDS.ShapeIndex(aE, myRank); @@ -237,53 +238,53 @@ void GEOMAlgo_ShellSolid::BuildResult() aNbPB=aLPB.Extent(); // if (aNbPB<2) { - nSp=nE; - if (aNbPB) { - const BOPTools_PaveBlock& aPB=aLPB.First(); - nSp=aPB.Edge(); - } - const TopoDS_Shape& aSp=aDS.Shape(nSp); - // - aState=aDS.GetState(nSp); - if (aState==BooleanOperations_IN) { - myLSIN.Append(aF1); - } - else if (aState==BooleanOperations_OUT) { - myLSOUT.Append(aF1); - } - else if (aState==BooleanOperations_ON) { - Standard_Real aTol; - TopAbs_State aSt; - // - //const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape((iRank1==myRank)? nF2 : nF1)); - //aTol=BRep_Tool::Tolerance(aF2); - aTol=1.e-7; - // - BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP3D); - const TopoDS_Solid& aRefSolid=(myRank==1) ? - TopoDS::Solid(aDS.Tool()) : TopoDS::Solid(aDS.Object()); - // - BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)& aPaveFiller; - IntTools_Context& aCtx=pPF->ChangeContext(); - // - BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aRefSolid); - aSC.Perform(aP3D, aTol); - aSt=aSC.State(); - if (aSt==TopAbs_IN) { - myLSIN.Append(aF1); - } - else if (aSt==TopAbs_OUT) { - myLSOUT.Append(aF1); - } - } - break; - } // if (aNbPB<2) { + nSp=nE; + if (aNbPB) { + const BOPTools_PaveBlock& aPB=aLPB.First(); + nSp=aPB.Edge(); + } + /*const TopoDS_Shape& aSp=*/aDS.Shape(nSp); + // + aState=aDS.GetState(nSp); + if (aState==BooleanOperations_IN) { + myLSIN.Append(aF1); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aF1); + } + else if (aState==BooleanOperations_ON) { + Standard_Real aTol; + TopAbs_State aSt; + // + //const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape((iRank1==myRank)? nF2 : nF1)); + //aTol=BRep_Tool::Tolerance(aF2); + aTol=1.e-7; + // + BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP3D); + const TopoDS_Solid& aRefSolid=(myRank==1) ? + TopoDS::Solid(aDS.Tool()) : TopoDS::Solid(aDS.Object()); + // + BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)& aPaveFiller; + const Handle(IntTools_Context)& aCtx=pPF->Context(); + // + BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aRefSolid); + aSC.Perform(aP3D, aTol); + aSt=aSC.State(); + if (aSt==TopAbs_IN) { + myLSIN.Append(aF1); + } + else if (aSt==TopAbs_OUT) { + myLSOUT.Append(aF1); + } + } + break; + } // if (aNbPB<2) { } //for (; anExp.More(); anExp.Next()) - } + } } //======================================================================= // function: DetectSDFaces -// purpose: +// purpose: //======================================================================= void GEOMAlgo_ShellSolid::DetectSDFaces() { @@ -298,9 +299,9 @@ void GEOMAlgo_ShellSolid::DetectSDFaces() aNb=aFFs.Extent(); for (i=1; i<=aNb; i++) { bFlag=Standard_False; - + BOPTools_SSInterference& aFF=aFFs(i); - + nF1=aFF.Index1(); nF2=aFF.Index2(); const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1)); @@ -313,11 +314,11 @@ void GEOMAlgo_ShellSolid::DetectSDFaces() if (!aNbSps) { continue; } - + const BOPTools_PaveBlock& aPB=aLPB.First(); const TopoDS_Edge& aSpE=TopoDS::Edge(aDS.Shape(aPB.Edge())); - - BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1); + + BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1); BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2); iSenseFlag=BOPTools_Tools3D::SenseFlag (aDNF1, aDNF2); // @@ -326,13 +327,13 @@ void GEOMAlgo_ShellSolid::DetectSDFaces() // TopoDS_Face aF1FWD=aF1; aF1FWD.Orientation (TopAbs_FORWARD); - + BOP_WireEdgeSet aWES (aF1FWD); BOP_SDFWESFiller aWESFiller(nF1, nF2, *myDSFiller); aWESFiller.SetSenseFlag(iSenseFlag); aWESFiller.SetOperation(BOP_COMMON); aWESFiller.Do(aWES); - + BOP_FaceBuilder aFB; aFB.Do(aWES); const TopTools_ListOfShape& aLF=aFB.NewFaces(); @@ -340,31 +341,31 @@ void GEOMAlgo_ShellSolid::DetectSDFaces() iZone=0; TopTools_ListIteratorOfListOfShape anIt(aLF); for (; anIt.More(); anIt.Next()) { - const TopoDS_Shape& aFR=anIt.Value(); + const TopoDS_Shape& aFR=anIt.Value(); - if (aFR.ShapeType()==TopAbs_FACE) { - const TopoDS_Face& aFaceResult=TopoDS::Face(aFR); - // - Standard_Boolean bIsValidIn2D, bNegativeFlag; - bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag); - if (bIsValidIn2D) { - //if(CheckSameDomainFaceInside(aFaceResult, aF2)) { - iZone=1; - break; - //} - } - // - } + if (aFR.ShapeType()==TopAbs_FACE) { + const TopoDS_Face& aFaceResult=TopoDS::Face(aFR); + // + Standard_Boolean bIsValidIn2D, bNegativeFlag; + bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag); + if (bIsValidIn2D) { + //if(CheckSameDomainFaceInside(aFaceResult, aF2)) { + iZone=1; + break; + //} + } + // + } } - - if (iZone) { - bFlag=Standard_True; - aFF.SetStatesMap(aWESFiller.StatesMap()); + + if (iZone) { + bFlag=Standard_True; + aFF.SetStatesMap(aWESFiller.StatesMap()); } - + }// if (iSenseFlag) - + aFF.SetTangentFacesFlag(bFlag); aFF.SetSenseFlag (iSenseFlag); - }// end of for (i=1; i<=aNb; i++) + }// end of for (i=1; i<=aNb; i++) } diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx index b00ac92c7..941405861 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.hxx @@ -1,107 +1,61 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_ShellSolid.hxx +// Created: Wed Jan 12 12:49:45 2005 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_ShellSolid_HeaderFile #define _GEOMAlgo_ShellSolid_HeaderFile -#ifndef _GEOMAlgo_ShapeSolid_HeaderFile -#include -#endif - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_ShellSolid : public GEOMAlgo_ShapeSolid { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_ShellSolid(); -Standard_EXPORT virtual ~GEOMAlgo_ShellSolid(); - - -Standard_EXPORT virtual void Perform() ; - - - - - -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT virtual void Prepare() ; - - -Standard_EXPORT virtual void BuildResult() ; - - -Standard_EXPORT void DetectSDFaces() ; - - - // Fields PROTECTED - // - +#include -private: +//======================================================================= +//class : GEOMAlgo_ShellSolid +//purpose : +//======================================================================= +class GEOMAlgo_ShellSolid : public GEOMAlgo_ShapeSolid +{ + public: + Standard_EXPORT + GEOMAlgo_ShellSolid(); - // Methods PRIVATE - // + Standard_EXPORT + virtual ~GEOMAlgo_ShellSolid(); + Standard_EXPORT + virtual void Perform() ; - // Fields PRIVATE - // + protected: + Standard_EXPORT + virtual void Prepare() ; + Standard_EXPORT + virtual void BuildResult() ; + Standard_EXPORT + void DetectSDFaces() ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx deleted file mode 100644 index d34ab8352..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShellSolid.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx deleted file mode 100644 index 587bf30e3..000000000 --- a/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_ShellSolid_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl deleted file mode 100644 index 2722c9a73..000000000 --- a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl +++ /dev/null @@ -1,57 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_SolidSolid.cdl --- Created: Wed Jan 26 12:05:14 2005 --- Author: Peter KURNEV --- -class SolidSolid from GEOMAlgo - inherits ShellSolid from GEOMAlgo - - ---Purpose: - -uses - Shape from TopoDS - ---raises - -is - Create - returns SolidSolid from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_SolidSolid();" - - Perform (me:out) - is redefined; - - BuildResult (me:out) - is redefined protected; - - SetShape2 (me:out; - aS: Shape from TopoDS); - - Shape2 (me) - returns Shape from TopoDS; - ---C++: return const & - -fields - myS2: Shape from TopoDS is protected; - -end SolidSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx index b64df9d55..31ea5d161 100644 --- a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_SolidSolid.cxx -// Created: Wed Jan 26 12:06:26 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_SolidSolid.cxx +// Created: Wed Jan 26 12:06:26 2005 +// Author: Peter KURNEV +// // -#include +#include #include @@ -43,7 +44,7 @@ //======================================================================= //function : GEOMAlgo_SolidSolid -//purpose : +//purpose : //======================================================================= GEOMAlgo_SolidSolid::GEOMAlgo_SolidSolid() : @@ -52,32 +53,32 @@ GEOMAlgo_SolidSolid::GEOMAlgo_SolidSolid() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_SolidSolid::~GEOMAlgo_SolidSolid() { } //======================================================================= // function: SetShape2 -// purpose: +// purpose: //======================================================================= void GEOMAlgo_SolidSolid::SetShape2(const TopoDS_Shape& aS2) { myS2=aS2; -} +} //======================================================================= // function: Shape2 -// purpose: +// purpose: //======================================================================= const TopoDS_Shape& GEOMAlgo_SolidSolid::Shape2()const { return myS2; -} +} //======================================================================= // function: Perform -// purpose: +// purpose: //======================================================================= -void GEOMAlgo_SolidSolid::Perform() +void GEOMAlgo_SolidSolid::Perform() { myErrorStatus=0; try { @@ -107,9 +108,9 @@ void GEOMAlgo_SolidSolid::Perform() } //================================================================================= // function: BuildResult -// purpose: +// purpose: //================================================================================= -void GEOMAlgo_SolidSolid::BuildResult() +void GEOMAlgo_SolidSolid::BuildResult() { myErrorStatus=0; // @@ -121,7 +122,7 @@ void GEOMAlgo_SolidSolid::BuildResult() GEOMAlgo_IndexedDataMapOfShapeState aMFS; // // 1. classify the faces - GEOMAlgo_ShellSolid::BuildResult(); + GEOMAlgo_ShellSolid::BuildResult(); // // 2. fill Shape-State map aIt.Initialize(myLSIN); @@ -162,40 +163,40 @@ void GEOMAlgo_SolidSolid::BuildResult() for(j=1; j // #ifndef _GEOMAlgo_SolidSolid_HeaderFile #define _GEOMAlgo_SolidSolid_HeaderFile -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_ShellSolid_HeaderFile -#include -#endif -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_SolidSolid : public GEOMAlgo_ShellSolid { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_SolidSolid(); -Standard_EXPORT virtual ~GEOMAlgo_SolidSolid(); - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT void SetShape2(const TopoDS_Shape& aS) ; - +#include +#include -Standard_EXPORT const TopoDS_Shape& Shape2() const; +//======================================================================= +//function : GEOMAlgo_SolidSolid +//purpose : +//======================================================================= +class GEOMAlgo_SolidSolid : public GEOMAlgo_ShellSolid +{ + public: + Standard_EXPORT + GEOMAlgo_SolidSolid(); + Standard_EXPORT + virtual ~GEOMAlgo_SolidSolid(); + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + void SetShape2(const TopoDS_Shape& aS) ; + Standard_EXPORT + const TopoDS_Shape& Shape2() const; protected: - - // Methods PROTECTED - // - - -Standard_EXPORT virtual void BuildResult() ; - - - // Fields PROTECTED - // -TopoDS_Shape myS2; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + virtual void BuildResult() ; + TopoDS_Shape myS2; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx b/src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx deleted file mode 100644 index a17ae72e2..000000000 --- a/src/GEOMAlgo/GEOMAlgo_SolidSolid.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx b/src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx deleted file mode 100644 index 41feab2d2..000000000 --- a/src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_SolidSolid_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cdl b/src/GEOMAlgo/GEOMAlgo_Splitter.cdl deleted file mode 100755 index 449ab9ace..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cdl +++ /dev/null @@ -1,102 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Splitter.cdl --- Created: --- Author: Peter KURNEV --- -class Splitter from GEOMAlgo - inherits Builder from GEOMAlgo - - ---Purpose: Implementation of Gluing Operation Algorithm (GA) - -uses - - ShapeEnum from TopAbs, - Shape from TopoDS, - ListOfShape from TopTools, - MapOfShape from TopTools - ---raises - -is - - Create - ---Purpose: Empty constructor - returns Splitter from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Splitter();" - - Clear(me:out) - ---Purpose: Clears internal fields and arguments - is redefined; - - AddTool (me:out; - theShape: Shape from TopoDS) - ---Purpose: Adds Tool argument theShape of the operation - is virtual; - - Tools(me) - ---Purpose: Returns the arguments of the operation - returns ListOfShape from TopTools; - ---C++: return const & - - SetLimit(me:out; - aLimit:ShapeEnum from TopAbs); - - Limit(me) - returns ShapeEnum from TopAbs; - - SetLimitMode(me:out; - aLimitMode:Integer from Standard); - - LimitMode(me) - returns Integer from Standard; - - -- - -- Protected methods - -- - BuildResult(me:out; - theType: ShapeEnum from TopAbs) - ---Purpose: Build the resulting shapes of type theType - is redefined protected; - - PostTreat(me:out) - ---Purpose: Provides post-tratment actions - is redefined protected; - - -- ===================================================== - -- - -- Debug methods - -- - AddToolCompound (me:out; - theShape: Shape from TopoDS); - ---Purpose: Adds Tool arguments of the operation as - -- shapes of upper level of container shape theShape - -- ===================================================== - -fields - myTools : ListOfShape from TopTools is protected; - myMapTools : MapOfShape from TopTools is protected; - myLimit : ShapeEnum from TopAbs is protected; - myLimitMode : Integer from Standard is protected; - -end Splitter; - diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx index 34b284b55..7411dce89 100755 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx @@ -1,30 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Splitter.cxx -// Created: -// Author: Peter KURNEV -// + +// File: GEOMAlgo_Splitter.cxx +// Author: Peter KURNEV // -#include +#include #include @@ -45,13 +44,13 @@ #include -static - void TreatCompound(const TopoDS_Shape& aC, - TopTools_ListOfShape& aLSX); +static + void TreatCompound(const TopoDS_Shape& aC, + TopTools_ListOfShape& aLSX); //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_Splitter::GEOMAlgo_Splitter() : @@ -62,14 +61,14 @@ static } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_Splitter::~GEOMAlgo_Splitter() { } //======================================================================= //function : AddToolCompound -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Splitter::AddToolCompound(const TopoDS_Shape& theShape) { @@ -83,7 +82,7 @@ static } //======================================================================= //function : AddTool -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Splitter::AddTool(const TopoDS_Shape& theShape) { @@ -95,7 +94,7 @@ static } //======================================================================= //function : Tools -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_Splitter::Tools()const { @@ -103,15 +102,15 @@ static } //======================================================================= //function : SetLimit -//purpose : +//purpose : //======================================================================= - void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit) + void GEOMAlgo_Splitter::SetLimit(const TopAbs_ShapeEnum aLimit) { myLimit=aLimit; } //======================================================================= //function : Limit -//purpose : +//purpose : //======================================================================= TopAbs_ShapeEnum GEOMAlgo_Splitter::Limit()const { @@ -119,7 +118,7 @@ static } //======================================================================= //function : SetLimitMode -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Splitter::SetLimitMode(const Standard_Integer aMode) { @@ -127,7 +126,7 @@ static } //======================================================================= //function : LimitMode -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_Splitter::LimitMode()const { @@ -135,7 +134,7 @@ static } //======================================================================= //function : Clear -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Splitter::Clear() { @@ -146,7 +145,7 @@ static } //======================================================================= //function : BuildResult -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) { @@ -163,26 +162,26 @@ static aType=aS.ShapeType(); if (aType==theType && !myMapTools.Contains(aS)) { if (myImages.HasImage(aS)) { - const TopTools_ListOfShape& aLSIm=myImages.Image(aS); - aItIm.Initialize(aLSIm); - for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aSIm=aItIm.Value(); - if (aM.Add(aSIm)) { - aBB.Add(myShape, aSIm); - } - } + const TopTools_ListOfShape& aLSIm=myImages.Image(aS); + aItIm.Initialize(aLSIm); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aSIm=aItIm.Value(); + if (aM.Add(aSIm)) { + aBB.Add(myShape, aSIm); + } + } } else { - if (aM.Add(aS)) { - aBB.Add(myShape, aS); - } + if (aM.Add(aS)) { + aBB.Add(myShape, aS); + } } } } } //======================================================================= //function : PostTreat -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Splitter::PostTreat() { @@ -200,7 +199,7 @@ static const TopoDS_Shape& aS=aMx(i); aBB.Add(aC, aS); } - //modified by NIZNHY-PKV Thu Feb 15 17:09:32 2007f + // if (myLimitMode) { Standard_Integer iType, iLimit, iTypeX; TopAbs_ShapeEnum aType, aTypeX; @@ -208,63 +207,77 @@ static TopTools_ListIteratorOfListOfShape aIt, aItX, aItIm; TopTools_MapOfShape aM; // - iLimit=(Standard_Integer)myLimit; + iLimit=(Standard_Integer)myLimit; // // 1. Collect the shapes to process aLSP aIt.Initialize(myShapes); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - if (myMapTools.Contains(aS)) { - continue; - } - // - aType=aS.ShapeType(); - iType=(Standard_Integer)aType; - // - if (iType>iLimit) { - aLSP.Append(aS); - } - // - else if (aType==TopAbs_COMPOUND) { - aLSX.Clear(); - // - TreatCompound(aS, aLSX); - // - aItX.Initialize(aLSX); - for (; aItX.More(); aItX.Next()) { - const TopoDS_Shape& aSX=aItX.Value(); - aTypeX=aSX.ShapeType(); - iTypeX=(Standard_Integer)aTypeX; - // - if (iTypeX>iLimit) { - aLSP.Append(aSX); - } - } - } + const TopoDS_Shape& aS=aIt.Value(); + if (myMapTools.Contains(aS)) { + continue; + } + // + aType=aS.ShapeType(); + iType=(Standard_Integer)aType; + // + if (iType>iLimit) { + aLSP.Append(aS); + } + // + else if (aType==TopAbs_COMPOUND) { + aLSX.Clear(); + // + TreatCompound(aS, aLSX); + // + aItX.Initialize(aLSX); + for (; aItX.More(); aItX.Next()) { + const TopoDS_Shape& aSX=aItX.Value(); + aTypeX=aSX.ShapeType(); + iTypeX=(Standard_Integer)aTypeX; + // + if (iTypeX>iLimit) { + aLSP.Append(aSX); + } + } + } }// for (; aIt.More(); aIt.Next()) { // + //modified by NIZNHY-PKV Fri Oct 30 11:07:08 2009 f + aMx.Clear(); + TopExp::MapShapes(aC, aMx); + //modified by NIZNHY-PKV Fri Oct 30 11:12:30 2009t + // // 2. Add them to aC aIt.Initialize(aLSP); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - if (myImages.HasImage(aS)) { - const TopTools_ListOfShape& aLSIm=myImages.Image(aS); - aItIm.Initialize(aLSIm); - for (; aItIm.More(); aItIm.Next()) { - const TopoDS_Shape& aSIm=aItIm.Value(); - if (aM.Add(aSIm)) { - aBB.Add(aC, aSIm); - } - } - } - else { - if (aM.Add(aS)) { - aBB.Add(aC, aS); - } - } + const TopoDS_Shape& aS=aIt.Value(); + if (myImages.HasImage(aS)) { + const TopTools_ListOfShape& aLSIm=myImages.Image(aS); + aItIm.Initialize(aLSIm); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aSIm=aItIm.Value(); + if (aM.Add(aSIm)) { + //modified by NIZNHY-PKV Fri Oct 30 11:09:57 2009f + if (!aMx.Contains(aSIm)) { + aBB.Add(aC, aSIm); + } + //aBB.Add(aC, aSIm); + //modified by NIZNHY-PKV Fri Oct 30 11:10:02 2009 + } + } + } + else { + if (aM.Add(aS)) { + //modified by NIZNHY-PKV Fri Oct 30 11:10:46 2009f + if (!aMx.Contains(aS)) { + aBB.Add(aC, aS); + } + //aBB.Add(aC, aS); + //modified by NIZNHY-PKV Fri Oct 30 11:11:00 2009t + } + } } }// if (myLimitMode) { - //modified by NIZNHY-PKV Thu Feb 15 17:09:34 2007t myShape=aC; }//if (myLimit!=TopAbs_SHAPE) { // @@ -272,10 +285,10 @@ static } //======================================================================= //function : TreatCompound -//purpose : +//purpose : //======================================================================= -void TreatCompound(const TopoDS_Shape& aC1, - TopTools_ListOfShape& aLSX) +void TreatCompound(const TopoDS_Shape& aC1, + TopTools_ListOfShape& aLSX) { Standard_Integer aNbC1; TopAbs_ShapeEnum aType; @@ -292,14 +305,14 @@ void TreatCompound(const TopoDS_Shape& aC1, // aItC.Initialize(aC); for (; aItC.More(); aItC.Next()) { - const TopoDS_Shape& aS=aItC.Value(); - aType=aS.ShapeType(); - if (aType==TopAbs_COMPOUND) { - aLC1.Append(aS); - } - else { - aLSX.Append(aS); - } + const TopoDS_Shape& aS=aItC.Value(); + aType=aS.ShapeType(); + if (aType==TopAbs_COMPOUND) { + aLC1.Append(aS); + } + else { + aLSX.Append(aS); + } } } // @@ -318,7 +331,7 @@ void TreatCompound(const TopoDS_Shape& aC1, } // // myErrorStatus -// +// // 0 - Ok // 1 - The object is just initialized // 2 - PaveFiller is failed diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.hxx b/src/GEOMAlgo/GEOMAlgo_Splitter.hxx index d5ceaaf8b..469080fe6 100644 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.hxx @@ -1,145 +1,97 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: GEOMAlgo_Splitter.hxx +// +// Author: Peter KURNEV // #ifndef _GEOMAlgo_Splitter_HeaderFile #define _GEOMAlgo_Splitter_HeaderFile -#ifndef _TopTools_ListOfShape_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Builder_HeaderFile #include -#endif -class TopoDS_Shape; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif +#include //! Implementation of Gluing Operation Algorithm (GA)
    -class GEOMAlgo_Splitter : public GEOMAlgo_Builder { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Empty constructor
    -Standard_EXPORT GEOMAlgo_Splitter(); -Standard_EXPORT virtual ~GEOMAlgo_Splitter(); - -//! Clears internal fields and arguments
    -Standard_EXPORT virtual void Clear() ; - -//! Adds Tool argument theShape of the operation
    -Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape) ; - -//! Returns the arguments of the operation
    -Standard_EXPORT const TopTools_ListOfShape& Tools() const; - - -Standard_EXPORT void SetLimit(const TopAbs_ShapeEnum aLimit) ; - - -Standard_EXPORT TopAbs_ShapeEnum Limit() const; - - -Standard_EXPORT void SetLimitMode(const Standard_Integer aLimitMode) ; - - -Standard_EXPORT Standard_Integer LimitMode() const; - -//! Adds Tool arguments of the operation as
    -//! shapes of upper level of container shape theShape
    -//! =====================================================
    -Standard_EXPORT void AddToolCompound(const TopoDS_Shape& theShape) ; - - - - - -protected: - - // Methods PROTECTED - // - -//! Build the resulting shapes of type theType
    -Standard_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType) ; - -//! Provides post-tratment actions
    -Standard_EXPORT virtual void PostTreat() ; - - - // Fields PROTECTED - // -TopTools_ListOfShape myTools; -TopTools_MapOfShape myMapTools; -TopAbs_ShapeEnum myLimit; -Standard_Integer myLimitMode; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +//======================================================================= +//function : GEOMAlgo_Splitter +//purpose : +//======================================================================= +class GEOMAlgo_Splitter : public GEOMAlgo_Builder +{ + public: + + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_Splitter(); + + Standard_EXPORT + virtual ~GEOMAlgo_Splitter(); + + //! Clears internal fields and arguments
    + Standard_EXPORT + virtual void Clear() ; + + //! Adds Tool argument theShape of the operation
    + Standard_EXPORT + virtual void AddTool(const TopoDS_Shape& theShape) ; + + //! Returns the arguments of the operation
    + Standard_EXPORT + const TopTools_ListOfShape& Tools() const; + + Standard_EXPORT + void SetLimit(const TopAbs_ShapeEnum aLimit) ; + + Standard_EXPORT + TopAbs_ShapeEnum Limit() const; + + Standard_EXPORT + void SetLimitMode(const Standard_Integer aLimitMode) ; + + Standard_EXPORT + Standard_Integer LimitMode() const; + //! Adds Tool arguments of the operation as
    + //! shapes of upper level of container shape theShape
    + //! =====================================================
    + Standard_EXPORT + void AddToolCompound(const TopoDS_Shape& theShape) ; + + protected: + //! Build the resulting shapes of type theType
    + Standard_EXPORT + virtual void BuildResult(const TopAbs_ShapeEnum theType) ; + //! Provides post-tratment actions
    + Standard_EXPORT + virtual void PostTreat() ; + + + TopTools_ListOfShape myTools; + TopTools_MapOfShape myMapTools; + TopAbs_ShapeEnum myLimit; + Standard_Integer myLimitMode; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.ixx b/src/GEOMAlgo/GEOMAlgo_Splitter.ixx deleted file mode 100644 index 9837af7dc..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.jxx b/src/GEOMAlgo/GEOMAlgo_Splitter.jxx deleted file mode 100644 index d12cbbdd8..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Splitter_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_State.hxx b/src/GEOMAlgo/GEOMAlgo_State.hxx index 05359bd44..423d494b2 100644 --- a/src/GEOMAlgo/GEOMAlgo_State.hxx +++ b/src/GEOMAlgo/GEOMAlgo_State.hxx @@ -1,39 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef _GEOMAlgo_State_HeaderFile -#define _GEOMAlgo_State_HeaderFile -enum GEOMAlgo_State { - GEOMAlgo_ST_UNKNOWN, -GEOMAlgo_ST_IN, -GEOMAlgo_ST_OUT, -GEOMAlgo_ST_ON, -GEOMAlgo_ST_ONIN, -GEOMAlgo_ST_ONOUT, -GEOMAlgo_ST_INOUT +#ifndef _GEOMAlgo_State_HeaderFile +#define _GEOMAlgo_State_HeaderFile +enum GEOMAlgo_State { + GEOMAlgo_ST_UNKNOWN, + GEOMAlgo_ST_IN, + GEOMAlgo_ST_OUT, + GEOMAlgo_ST_ON, + GEOMAlgo_ST_ONIN, + GEOMAlgo_ST_ONOUT, + GEOMAlgo_ST_INOUT }; - #ifndef _Standard_PrimitiveTypes_HeaderFile #include #endif diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.cdl b/src/GEOMAlgo/GEOMAlgo_StateCollector.cdl deleted file mode 100644 index ae01b2c5f..000000000 --- a/src/GEOMAlgo/GEOMAlgo_StateCollector.cdl +++ /dev/null @@ -1,49 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_StateCollector.cdl --- Created: Thu Mar 10 09:39:25 2005 --- Author: Peter KURNEV --- -class StateCollector from GEOMAlgo - - ---Purpose: - -uses - State from TopAbs - ---raises - -is - Create - returns StateCollector from GEOMAlgo; - - AppendState(me:out; - aSt:State from TopAbs) - returns Boolean from Standard; - - State(me) - returns State from TopAbs; - -fields - myCounter:Integer from Standard[3]; - -end StateCollector; diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.cxx b/src/GEOMAlgo/GEOMAlgo_StateCollector.cxx index 5f43ce8d3..5e593541f 100644 --- a/src/GEOMAlgo/GEOMAlgo_StateCollector.cxx +++ b/src/GEOMAlgo/GEOMAlgo_StateCollector.cxx @@ -1,36 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_StateCollector.cxx -// Created: Thu Mar 10 09:42:11 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_StateCollector.cxx +// Created: Thu Mar 10 09:42:11 2005 +// Author: Peter KURNEV +// // -#include +#include //======================================================================= //function : GEOMAlgo_StateCollector -//purpose : +//purpose : //======================================================================= -GEOMAlgo_StateCollector::GEOMAlgo_StateCollector() +GEOMAlgo_StateCollector::GEOMAlgo_StateCollector() { myCounter[0]=0; myCounter[1]=0; @@ -38,9 +39,9 @@ GEOMAlgo_StateCollector::GEOMAlgo_StateCollector() } //======================================================================= //function : AppendState -//purpose : +//purpose : //======================================================================= -Standard_Boolean GEOMAlgo_StateCollector::AppendState(const TopAbs_State aSt) +Standard_Boolean GEOMAlgo_StateCollector::AppendState(const TopAbs_State aSt) { Standard_Boolean bIsToBreak; // @@ -50,7 +51,7 @@ Standard_Boolean GEOMAlgo_StateCollector::AppendState(const TopAbs_State aSt) break; case TopAbs_OUT: ++myCounter[1]; - break; + break; case TopAbs_ON: ++myCounter[2]; break; @@ -63,9 +64,9 @@ Standard_Boolean GEOMAlgo_StateCollector::AppendState(const TopAbs_State aSt) } //======================================================================= //function : State -//purpose : +//purpose : //======================================================================= -TopAbs_State GEOMAlgo_StateCollector::State()const +TopAbs_State GEOMAlgo_StateCollector::State()const { TopAbs_State aSt; // diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.hxx b/src/GEOMAlgo/GEOMAlgo_StateCollector.hxx index 51e6ac87f..5ac5a96cf 100644 --- a/src/GEOMAlgo/GEOMAlgo_StateCollector.hxx +++ b/src/GEOMAlgo/GEOMAlgo_StateCollector.hxx @@ -1,107 +1,56 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_StateCollector.hxx +// Created: Thu Mar 10 09:42:11 2005 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_StateCollector_HeaderFile #define _GEOMAlgo_StateCollector_HeaderFile -#ifndef _Standard_Integer_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _TopAbs_State_HeaderFile #include -#endif - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_StateCollector { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_StateCollector(); - - -Standard_EXPORT Standard_Boolean AppendState(const TopAbs_State aSt) ; +//======================================================================= +// class : GEOMAlgo_StateCollector +//purpose : +//======================================================================= +class GEOMAlgo_StateCollector +{ + public: + Standard_EXPORT + GEOMAlgo_StateCollector(); -Standard_EXPORT TopAbs_State State() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myCounter[3]; + Standard_EXPORT + Standard_Boolean AppendState(const TopAbs_State aSt) ; + Standard_EXPORT + TopAbs_State State() const; + protected: + Standard_Integer myCounter[3]; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.ixx b/src/GEOMAlgo/GEOMAlgo_StateCollector.ixx deleted file mode 100644 index f777e3344..000000000 --- a/src/GEOMAlgo/GEOMAlgo_StateCollector.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.jxx b/src/GEOMAlgo/GEOMAlgo_StateCollector.jxx deleted file mode 100644 index 3bdd7984c..000000000 --- a/src/GEOMAlgo/GEOMAlgo_StateCollector.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_StateCollector_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cdl b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cdl deleted file mode 100644 index 9478097b4..000000000 --- a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cdl +++ /dev/null @@ -1,96 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_SurfaceTools.cdl --- Created: Thu Jan 27 11:03:49 2005 --- Author: Peter KURNEV --- -class SurfaceTools from GEOMAlgo - - ---Purpose: - -uses - Pnt from gp, - Pln from gp, - Cylinder from gp, - Sphere from gp, - Surface from Geom, - Surface from GeomAdaptor, - State from TopAbs, - State from GEOMAlgo - ---raises - -is - - - IsAnalytic(myclass; - aS:Surface from Geom) - returns Boolean from Standard; - - IsCoaxial(myclass; - aP1 : Pnt from gp; - aP2 : Pnt from gp; - aCyl : Cylinder from gp; - aTol : Real from Standard) - returns Boolean from Standard; - - IsConformState(myclass; - aST1:State from TopAbs; - aST2:State from GEOMAlgo) - returns Boolean from Standard; - - GetState(myclass; - aP:Pnt from gp; - aS:Surface from GeomAdaptor; - aTol:Real from Standard; - aSt:out State from TopAbs) - returns Integer from Standard; - - GetState(myclass; - aP:Pnt from gp; - aS:Surface from Geom; - aTol:Real from Standard; - aSt:out State from TopAbs) - returns Integer from Standard; - - Distance(myclass; - aP:Pnt from gp; - aPln:Pln from gp) - returns Real from Standard; - - Distance(myclass; - aP:Pnt from gp; - aCyl:Cylinder from gp) - returns Real from Standard; - - Distance(myclass; - aP:Pnt from gp; - aSph:Sphere from gp) - returns Real from Standard; - - ReverseState(myclass; - aSt: State from TopAbs) - returns State from TopAbs; - ---fields - -end SurfaceTools; diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx index 9039a1f18..f9d0f036b 100644 --- a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_SurfaceTools.cxx -// Created: Thu Jan 27 11:05:16 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_SurfaceTools.cxx +// Created: Thu Jan 27 11:05:16 2005 +// Author: Peter KURNEV +// // -#include +#include #include @@ -44,12 +45,12 @@ //======================================================================= //function : GetState -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, - const GeomAdaptor_Surface& aGAS, - const Standard_Real aTol, - TopAbs_State& aState) + const GeomAdaptor_Surface& aGAS, + const Standard_Real aTol, + TopAbs_State& aState) { Standard_Integer iErr; Standard_Real aDp, aR; @@ -68,19 +69,19 @@ aR=0.; aDp=GEOMAlgo_SurfaceTools::Distance(aP, aPln); break; - - case GeomAbs_Cylinder: + + case GeomAbs_Cylinder: aCyl=aGAS.Cylinder(); aR=aCyl.Radius(); aDp=GEOMAlgo_SurfaceTools::Distance(aP, aCyl); - break; + break; - case GeomAbs_Sphere: + case GeomAbs_Sphere: aSph=aGAS.Sphere(); aR=aSph.Radius(); aDp=GEOMAlgo_SurfaceTools::Distance(aP, aSph); break; - + default: iErr=1; // unprocessed surface type break; @@ -100,12 +101,12 @@ } //======================================================================= //function : GetState -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, - const Handle(Geom_Surface)& aSurf, - const Standard_Real aTol, - TopAbs_State& aState) + const Handle(Geom_Surface)& aSurf, + const Standard_Real aTol, + TopAbs_State& aState) { Standard_Integer iErr; GeomAdaptor_Surface aGAS; @@ -119,7 +120,7 @@ } //======================================================================= //function : ReverseState -//purpose : +//purpose : //======================================================================= TopAbs_State GEOMAlgo_SurfaceTools::ReverseState(const TopAbs_State aState) { @@ -140,10 +141,10 @@ } //======================================================================= //function : Distance -//purpose : +//purpose : //======================================================================= -Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, - const gp_Sphere& aSph) +Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, + const gp_Sphere& aSph) { Standard_Real aD; // @@ -154,10 +155,10 @@ Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, } //======================================================================= //function : Distance -//purpose : +//purpose : //======================================================================= -Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, - const gp_Cylinder& aCyl) +Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, + const gp_Cylinder& aCyl) { Standard_Real aD; // @@ -169,10 +170,10 @@ Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, } //======================================================================= //function : Distance -//purpose : +//purpose : //======================================================================= -Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, - const gp_Pln& aPL) +Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, + const gp_Pln& aPL) { Standard_Real aD; // @@ -187,12 +188,12 @@ Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP, } //======================================================================= //function : IsCoaxial -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1, - const gp_Pnt& aP2, - const gp_Cylinder& aCyl, - const Standard_Real aTol) + const gp_Pnt& aP2, + const gp_Cylinder& aCyl, + const Standard_Real aTol) { Standard_Boolean bRet=Standard_False; Standard_Real aSM; @@ -212,7 +213,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1, } //======================================================================= //function : IsAnalytic -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& aSurf) { @@ -222,44 +223,44 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& a // aGAS.Load(aSurf); aType=aGAS.GetType(); - bRet=(aType==GeomAbs_Plane || - aType==GeomAbs_Cylinder || - aType==GeomAbs_Sphere); + bRet=(aType==GeomAbs_Plane || + aType==GeomAbs_Cylinder || + aType==GeomAbs_Sphere); return bRet; } //======================================================================= //function : IsConformState -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState(const TopAbs_State aST1, - const GEOMAlgo_State aST2) + const GEOMAlgo_State aST2) { Standard_Boolean bRet=Standard_False; // switch (aST2) { case GEOMAlgo_ST_IN: if (aST1==TopAbs_IN) { - bRet=!bRet; + bRet=!bRet; } break; case GEOMAlgo_ST_OUT: if (aST1==TopAbs_OUT) { - bRet=!bRet; + bRet=!bRet; } break; case GEOMAlgo_ST_ON: if (aST1==TopAbs_ON) { - bRet=!bRet; + bRet=!bRet; } break; case GEOMAlgo_ST_ONIN: if (aST1==TopAbs_ON || aST1==TopAbs_IN) { - bRet=!bRet; + bRet=!bRet; } break; case GEOMAlgo_ST_ONOUT: if (aST1==TopAbs_ON || aST1==TopAbs_OUT) { - bRet=!bRet; + bRet=!bRet; } break; default: diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.hxx b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.hxx index fbcd3ebbe..565a95172 100644 --- a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.hxx +++ b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.hxx @@ -1,139 +1,94 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_SurfaceTools.hxx +// Created: Thu Jan 27 11:05:16 2005 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_SurfaceTools_HeaderFile #define _GEOMAlgo_SurfaceTools_HeaderFile -#ifndef _Standard_Boolean_HeaderFile +#include +#include #include -#endif -#ifndef _Handle_Geom_Surface_HeaderFile #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -#ifndef _TopAbs_State_HeaderFile #include -#endif -#ifndef _GEOMAlgo_State_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -class Geom_Surface; -class gp_Pnt; -class gp_Cylinder; -class GeomAdaptor_Surface; -class gp_Pln; -class gp_Sphere; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_SurfaceTools { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Boolean IsAnalytic(const Handle(Geom_Surface)& aS) ; - - -Standard_EXPORT static Standard_Boolean IsCoaxial(const gp_Pnt& aP1,const gp_Pnt& aP2,const gp_Cylinder& aCyl,const Standard_Real aTol) ; - - -Standard_EXPORT static Standard_Boolean IsConformState(const TopAbs_State aST1,const GEOMAlgo_State aST2) ; - - -Standard_EXPORT static Standard_Integer GetState(const gp_Pnt& aP,const GeomAdaptor_Surface& aS,const Standard_Real aTol,TopAbs_State& aSt) ; - - -Standard_EXPORT static Standard_Integer GetState(const gp_Pnt& aP,const Handle(Geom_Surface)& aS,const Standard_Real aTol,TopAbs_State& aSt) ; - - -Standard_EXPORT static Standard_Real Distance(const gp_Pnt& aP,const gp_Pln& aPln) ; - - -Standard_EXPORT static Standard_Real Distance(const gp_Pnt& aP,const gp_Cylinder& aCyl) ; - - -Standard_EXPORT static Standard_Real Distance(const gp_Pnt& aP,const gp_Sphere& aSph) ; - - -Standard_EXPORT static TopAbs_State ReverseState(const TopAbs_State aSt) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - +#include +#include +#include +#include +#include +#include + + +//======================================================================= +//function : GEOMAlgo_SurfaceTools +//purpose : +//======================================================================= +class GEOMAlgo_SurfaceTools +{ + public: + Standard_EXPORT + static Standard_Boolean IsAnalytic(const Handle(Geom_Surface)& aS) ; + + Standard_EXPORT + static Standard_Boolean IsCoaxial(const gp_Pnt& aP1, + const gp_Pnt& aP2, + const gp_Cylinder& aCyl, + const Standard_Real aTol) ; + + Standard_EXPORT + static Standard_Boolean IsConformState(const TopAbs_State aST1, + const GEOMAlgo_State aST2) ; + + Standard_EXPORT + static Standard_Integer GetState(const gp_Pnt& aP, + const GeomAdaptor_Surface& aS, + const Standard_Real aTol,TopAbs_State& aSt) ; + + Standard_EXPORT + static Standard_Integer GetState(const gp_Pnt& aP, + const Handle(Geom_Surface)& aS, + const Standard_Real aTol, + TopAbs_State& aSt) ; + + Standard_EXPORT + static Standard_Real Distance(const gp_Pnt& aP, + const gp_Pln& aPln) ; + + Standard_EXPORT + static Standard_Real Distance(const gp_Pnt& aP, + const gp_Cylinder& aCyl) ; + + Standard_EXPORT + static Standard_Real Distance(const gp_Pnt& aP, + const gp_Sphere& aSph) ; + + Standard_EXPORT + static TopAbs_State ReverseState(const TopAbs_State aSt) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.ixx b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.ixx deleted file mode 100644 index 53cb8c9ad..000000000 --- a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.jxx b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.jxx deleted file mode 100644 index 716140b2d..000000000 --- a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.jxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2008 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_Surface_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _gp_Cylinder_HeaderFile -#include -#endif -#ifndef _GeomAdaptor_Surface_HeaderFile -#include -#endif -#ifndef _gp_Pln_HeaderFile -#include -#endif -#ifndef _gp_Sphere_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_SurfaceTools_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.cdl b/src/GEOMAlgo/GEOMAlgo_Tools.cdl deleted file mode 100644 index 6624245a4..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Tools.cdl +++ /dev/null @@ -1,112 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Tools.cdl --- Created: Mon Dec 6 11:26:02 2004 --- Author: Peter KURNEV --- -class Tools from GEOMAlgo - - ---Purpose: - -uses - Pnt from gp, - Surface from Geom, - ShapeEnum from TopAbs, - Edge from TopoDS, - Face from TopoDS, - Shape from TopoDS, - ListOfShape from TopTools, - IndexedDataMapOfShapeListOfShape from TopTools, - Context from IntTools, - IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo --qft - ---raises - -is - IsCompositeShape(myclass; - aS :Shape from TopoDS) - returns Boolean from Standard; - - RefineSDShapes(myclass; - aMSD:out IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo; --qft - aTol:Real from Standard; - aCtx:out Context from IntTools) - returns Integer from Standard; - - FindSDShapes(myclass; - aLE :ListOfShape from TopTools; - aTol:Real from Standard; - aMEE:out IndexedDataMapOfShapeListOfShape from TopTools; - aCtx:out Context from IntTools) - returns Integer from Standard; - - FindSDShapes(myclass; - aE1 :Shape from TopoDS; - aLE :ListOfShape from TopTools; - aTol :Real from Standard; - aLESD :out ListOfShape from TopTools; - aCtx :out Context from IntTools) - returns Integer from Standard; - - ProjectPointOnShape(myclass; - aP1: Pnt from gp; - aS :Shape from TopoDS; - aP2:out Pnt from gp; - aCtx :out Context from IntTools) - returns Boolean from Standard; - - PointOnShape(myclass; - aS :Shape from TopoDS; - aP3D:out Pnt from gp); - - PointOnEdge(myclass; - aE :Edge from TopoDS; - aP3D:out Pnt from gp); - - PointOnEdge(myclass; - aE :Edge from TopoDS; - aT :Real from Standard; - aP3D:out Pnt from gp); - - PointOnFace(myclass; - aF :Face from TopoDS; - aP3D:out Pnt from gp); - - PointOnFace(myclass; - aF :Face from TopoDS; - aU :Real from Standard; - aV :Real from Standard; - aP3D:out Pnt from gp); - - RefinePCurveForEdgeOnFace (myclass; - aE : Edge from TopoDS; - aF : Face from TopoDS; - aU1 : Real from Standard; - aU2 : Real from Standard); - - IsUPeriodic(myclass; - aS:Surface from Geom) - returns Boolean from Standard; - ---fields - -end Tools; diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.cxx b/src/GEOMAlgo/GEOMAlgo_Tools.cxx index bad8a3c15..8ae8a8e8f 100644 --- a/src/GEOMAlgo/GEOMAlgo_Tools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools.cxx @@ -1,40 +1,47 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Tools.cxx -// Created: Mon Dec 6 11:35:29 2004 -// Author: Peter KURNEV -// -// -#include +// File: GEOMAlgo_Tools.cxx +// Created: Mon Dec 6 11:35:29 2004 +// Author: Peter KURNEV + +#include + +#include #include #include +#include +#include -#include -#include #include +#include + +#include +#include + #include #include +#include #include @@ -54,16 +61,16 @@ #include #include -#include //qft -#include //qft +#include +#include -static +static void GetCount(const TopoDS_Shape& aS, - Standard_Integer& iCnt); + Standard_Integer& iCnt); //======================================================================= //function : IsCompositeShape -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Tools::IsCompositeShape(const TopoDS_Shape& aS) { @@ -80,10 +87,10 @@ Standard_Boolean GEOMAlgo_Tools::IsCompositeShape(const TopoDS_Shape& aS) //======================================================================= //function : GetCount -//purpose : +//purpose : //======================================================================= void GetCount(const TopoDS_Shape& aS, - Standard_Integer& iCnt) + Standard_Integer& iCnt) { TopoDS_Iterator aIt; TopAbs_ShapeEnum aTS; @@ -101,17 +108,17 @@ void GetCount(const TopoDS_Shape& aS, aIt.Initialize(aS); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aSx=aIt.Value(); - GetCount(aSx, iCnt); + GetCount(aSx, iCnt); } } //======================================================================= //function : RefineSDShapes -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE, - const Standard_Real aTol, - IntTools_Context& aCtx) + const Standard_Real aTol, + const Handle(IntTools_Context)& aCtx) { Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd; TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd; @@ -130,19 +137,19 @@ void GetCount(const TopoDS_Shape& aS, // aNbEE=aMEE.Extent(); if (aNbEE==1) { - continue; // nothing to do + continue; // nothing to do } // for (j=1; j<=aNbEE; ++j) { TopTools_ListOfShape& aLEE=aMEE.ChangeFromIndex(j); // if (j==1) { - aLSDE.Clear(); - aLSDE.Append(aLEE); + aLSDE.Clear(); + aLSDE.Append(aLEE); } else { - const TopoDS_Shape& aE1=aLEE.First(); - aMEToAdd.Add(aE1, aLEE); + const TopoDS_Shape& aE1=aLEE.First(); + aMEToAdd.Add(aE1, aLEE); } } } @@ -169,12 +176,12 @@ void GetCount(const TopoDS_Shape& aS, } //======================================================================= //function : FindSDShapes -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE, - const Standard_Real aTol, - TopTools_IndexedDataMapOfShapeListOfShape& aMEE, - IntTools_Context& aCtx) + const Standard_Real aTol, + TopTools_IndexedDataMapOfShapeListOfShape& aMEE, + const Handle(IntTools_Context)& aCtx) { Standard_Integer aNbE, aNbEProcessed, aNbESD, iErr; TopTools_ListOfShape aLESD; @@ -185,11 +192,11 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE, aNbE=aLE.Extent(); if (!aNbE) { return 3; // Err - } + } //modified by NIZNHY-PKV Thu Dec 30 10:56:52 2004 f if (aNbE==1) { return 0; // Nothing to do - } + } //modified by NIZNHY-PKV Thu Dec 30 10:56:56 2004 t // while(1) { @@ -203,37 +210,37 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE, const TopoDS_Shape& aS=aIt.Value(); // if (aMProcessed.Contains(aS)) { - continue; + continue; } // //modified by NIZNHY-PKV Thu Dec 30 10:57:01 2004 f aType=aS.ShapeType(); if (aType==TopAbs_EDGE) { - const TopoDS_Edge& aE=TopoDS::Edge(aS); - if (BRep_Tool::Degenerated(aE)) { - aMProcessed.Add(aE); - continue; - } + const TopoDS_Edge& aE=TopoDS::Edge(aS); + if (BRep_Tool::Degenerated(aE)) { + aMProcessed.Add(aE); + continue; + } } //modified by NIZNHY-PKV Thu Dec 30 10:57:03 2004 t // aLESD.Clear(); iErr=GEOMAlgo_Tools::FindSDShapes(aS, aLE, aTol, aLESD, aCtx); if (iErr) { - return 2; // Err + return 2; // Err } // aNbESD=aLESD.Extent(); if (!aNbESD) { - return 1; // Err + return 1; // Err } // aMEE.Add(aS, aLESD); // aIt1.Initialize(aLESD); for (; aIt1.More(); aIt1.Next()) { - const TopoDS_Shape& aE1=aIt1.Value(); - aMProcessed.Add(aE1); + const TopoDS_Shape& aE1=aIt1.Value(); + aMProcessed.Add(aE1); } } } @@ -241,13 +248,13 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE, } //======================================================================= //function : FindSDShapes -//purpose : +//purpose : //======================================================================= Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopoDS_Shape& aE1, - const TopTools_ListOfShape& aLE, - const Standard_Real aTol, - TopTools_ListOfShape& aLESD, - IntTools_Context& aCtx) + const TopTools_ListOfShape& aLE, + const Standard_Real aTol, + TopTools_ListOfShape& aLESD, + const Handle(IntTools_Context)& aCtx) { Standard_Boolean bIsDone; Standard_Real aTol2, aD2; @@ -266,11 +273,12 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopoDS_Shape& aE1, else { bIsDone=GEOMAlgo_Tools::ProjectPointOnShape(aP1, aE2, aP2, aCtx); if (!bIsDone) { - return 1; + //return 1; + continue; // jfa BUG 20361 } aD2=aP1.SquareDistance(aP2); if(aD2ProjectPointOnEdge(aP1, aE2, aT2); + } + if (!bIsDone) { + return bIsDone; + } + // + GEOMAlgo_Tools::PointOnEdge(aE2, aT2, aP2); } - // - GEOMAlgo_Tools::PointOnEdge(aE2, aT2, aP2); - } break; // - case TopAbs_FACE: { - const TopoDS_Face& aF2=TopoDS::Face(aS); - GeomAPI_ProjectPointOnSurf& aProj=aCtx.ProjPS(aF2); - // - aProj.Perform(aP1); - bIsDone=aProj.IsDone(); - if (!bIsDone) { - return bIsDone; + case TopAbs_FACE: + { + const TopoDS_Face& aF2 = TopoDS::Face(aS); + GeomAPI_ProjectPointOnSurf& aProj = aCtx->ProjPS(aF2); + // + aProj.Perform(aP1); + bIsDone = aProj.IsDone(); + if (!bIsDone) { + return bIsDone; + } + // + aP2 = aProj.NearestPoint(); } - // - aP2=aProj.NearestPoint(); - } break; - // + // default: break; // Err - } + } return bIsDone; } //======================================================================= //function : PointOnShape -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Tools::PointOnShape(const TopoDS_Shape& aS, - gp_Pnt& aP3D) + gp_Pnt& aP3D) { TopAbs_ShapeEnum aType; // @@ -346,35 +367,35 @@ void GEOMAlgo_Tools::PointOnShape(const TopoDS_Shape& aS, GEOMAlgo_Tools::PointOnFace(aF, aP3D); } break; - // + // default: break; // Err } } //======================================================================= //function : PointOnFace -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF, - gp_Pnt& aP3D) + gp_Pnt& aP3D) { Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax; // BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); // - aU=BOPTools_Tools2D::IntermediatePoint(aUMin, aUMax); - aV=BOPTools_Tools2D::IntermediatePoint(aVMin, aVMax); + aU=BOPTools_Tools2D::IntermediatePoint(aUMin, aUMax); + aV=BOPTools_Tools2D::IntermediatePoint(aVMin, aVMax); // GEOMAlgo_Tools::PointOnFace(aF, aU, aV, aP3D); } //======================================================================= //function : PointOnFace -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF, - const Standard_Real aU, - const Standard_Real aV, - gp_Pnt& aP3D) + const Standard_Real aU, + const Standard_Real aV, + gp_Pnt& aP3D) { Handle(Geom_Surface) aS; // @@ -383,10 +404,10 @@ void GEOMAlgo_Tools::PointOnFace(const TopoDS_Face& aF, } //======================================================================= //function : PointOnEdge -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE, - gp_Pnt& aP3D) + gp_Pnt& aP3D) { Standard_Real aTx, aT1, aT2; // @@ -396,11 +417,11 @@ void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE, } //======================================================================= //function : PointOnEdge -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE, - const Standard_Real aT, - gp_Pnt& aP3D) + const Standard_Real aT, + gp_Pnt& aP3D) { Standard_Real aT1, aT2; Handle(Geom_Curve) aC3D; @@ -410,21 +431,19 @@ void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE, } //======================================================================= //function : RefinePCurveForEdgeOnFace -//purpose : +//purpose : //======================================================================= void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aUMin, - const Standard_Real aUMax) + const TopoDS_Face& aF, + const Standard_Real aUMin, + const Standard_Real aUMax) { - Standard_Real aT1, aT2, aTx, aUx, aTol, aTwoPI; + Standard_Real aT1, aT2, aTx, aUx, aTol; gp_Pnt2d aP2D; Handle(Geom_Surface) aS; Handle(Geom2d_Curve) aC2D; BRep_Builder aBB; // - aTwoPI=PI+PI; - // aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2); if (!aC2D.IsNull()) { if (BRep_Tool::IsClosed(aE, aF)) { @@ -438,13 +457,13 @@ void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, Handle(Geom2d_Curve) aC2Dx; // aTol=BRep_Tool::Tolerance(aE); - aBB.UpdateEdge(aE, aC2Dx, aF, aTol); + aBB.UpdateEdge(aE, aC2Dx, aF, aTol); } } } //======================================================================= //function : IsUPeriodic -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS) { @@ -455,8 +474,140 @@ Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS) aGAS.Load(aS); aType=aGAS.GetType(); bRet=(aType==GeomAbs_Cylinder|| - aType==GeomAbs_Cone || - aType==GeomAbs_Sphere); + aType==GeomAbs_Cone || + aType==GeomAbs_Sphere); // return bRet; } + +//modified by NIZNHY-PKV Fri Feb 03 11:16:35 2012f +//======================================================================= +//function : BuildPCurveForEdgeOnFace +//purpose : +//======================================================================= +Standard_Integer + GEOMAlgo_Tools::BuildPCurveForEdgeOnFace(const TopoDS_Edge& aEold, + const TopoDS_Edge& aEnew, + const TopoDS_Face& aF, + const Handle(IntTools_Context)& aCtx) +{ + Standard_Boolean bIsClosed, bUClosed, bHasOld; + Standard_Integer iRet, aNbPoints; + Standard_Real aTS, aTS1, aTS2, aT, aT1, aT2, aScPr, aTol; + Standard_Real aU, aV, aUS1, aVS1, aUS2, aVS2; + gp_Pnt aP; + gp_Pnt2d aP2DS1, aP2DS2, aP2D; + gp_Vec2d aV2DS1, aV2DS2; + Handle(Geom2d_Curve) aC2D, aC2DS1, aC2DS2; + Handle(Geom_Surface) aS; + TopoDS_Edge aES; + // + iRet=0; + // + bHasOld=BOPTools_Tools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol); + if (bHasOld) { + return iRet; + } + // + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEnew, aF); + aC2D=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2); + if (aC2D.IsNull()){ + iRet=1; + return iRet; + } + // + bIsClosed=BRep_Tool::IsClosed(aEold, aF); + if (!bIsClosed) { + return iRet; + } + // + aTol=1.e-7; + // + // 1. bUClosed - direction of closeness + // + aES=aEold; + aES.Orientation(TopAbs_FORWARD); + aC2DS1=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2); + // + aES.Orientation(TopAbs_REVERSED); + aC2DS2=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2); + // + aTS=BOPTools_Tools2D::IntermediatePoint(aTS1, aTS2); + // + aC2DS1->D1(aTS, aP2DS1, aV2DS1); + aC2DS2->D1(aTS, aP2DS2, aV2DS2); + // + gp_Vec2d aV2DS12(aP2DS1, aP2DS2); + gp_Dir2d aD2DS12(aV2DS12); + const gp_Dir2d& aD2DX=gp::DX2d(); + // + aScPr=aD2DS12*aD2DX; + bUClosed=Standard_True; + if (fabs(aScPr) < aTol) { + bUClosed=!bUClosed; + } + // + // 2. aP2D - point on curve aC2D, that corresponds to aP2DS1 + aP2DS1.Coord(aUS1, aVS1); + aP2DS2.Coord(aUS2, aVS2); + // + aS=BRep_Tool::Surface(aF); + aS->D0(aUS1, aVS1, aP); + // + GeomAPI_ProjectPointOnCurve& aProjPC=aCtx->ProjPC(aEnew); + // + aProjPC.Perform(aP); + aNbPoints=aProjPC.NbPoints(); + if (!aNbPoints) { + iRet=2; + return iRet; + } + // + aT=aProjPC.LowerDistanceParameter(); + + // + // 3. Build the second 2D curve + Standard_Boolean bRevOrder; + gp_Vec2d aV2DT, aV2D; + Handle(Geom2d_Curve) aC2Dnew; + Handle(Geom2d_TrimmedCurve) aC2DTnew; + BRep_Builder aBB; + // + aC2D->D1(aT, aP2D, aV2D); + aP2D.Coord(aU, aV); + // + aC2Dnew=Handle(Geom2d_Curve)::DownCast(aC2D->Copy()); + aC2DTnew = new Geom2d_TrimmedCurve(aC2Dnew, aT1, aT2); + // + aV2DT=aV2DS12; + if (!bUClosed) { // V Closed + if (fabs(aV-aVS2)Translate(aV2DT); + // + // 4 Order the 2D curves + bRevOrder=Standard_False; + aScPr=aV2D*aV2DS1; + if(aScPr<0.) { + bRevOrder=!bRevOrder; + } + // + // 5. Update the edge + aTol=BRep_Tool::Tolerance(aEnew); + if (!bRevOrder) { + aBB.UpdateEdge(aEnew, aC2D, aC2DTnew, aF, aTol); + } + else { + aBB.UpdateEdge(aEnew, aC2DTnew, aC2D , aF, aTol); + } + // + return iRet; +} diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.hxx b/src/GEOMAlgo/GEOMAlgo_Tools.hxx index 700972411..d4345eec7 100644 --- a/src/GEOMAlgo/GEOMAlgo_Tools.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools.hxx @@ -1,145 +1,121 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: GEOMAlgo_Tools.hxx +// Created: Mon Dec 6 11:35:29 2004 +// Author: Peter KURNEV + #ifndef _GEOMAlgo_Tools_HeaderFile #define _GEOMAlgo_Tools_HeaderFile -#ifndef _Standard_Boolean_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -#ifndef _Handle_Geom_Surface_HeaderFile +#include #include -#endif -class TopoDS_Shape; -class GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape; -class IntTools_Context; -class TopTools_ListOfShape; -class TopTools_IndexedDataMapOfShapeListOfShape; -class gp_Pnt; -class TopoDS_Edge; -class TopoDS_Face; -class Geom_Surface; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class GEOMAlgo_Tools { - +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//class : GEOMAlgo_Tools +//purpose : +//======================================================================= +class GEOMAlgo_Tools + { public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ; - - -Standard_EXPORT static Standard_Integer RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,const Standard_Real aTol,IntTools_Context& aCtx) ; - - -Standard_EXPORT static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,const Standard_Real aTol,TopTools_IndexedDataMapOfShapeListOfShape& aMEE,IntTools_Context& aCtx) ; - - -Standard_EXPORT static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,const TopTools_ListOfShape& aLE,const Standard_Real aTol,TopTools_ListOfShape& aLESD,IntTools_Context& aCtx) ; - - -Standard_EXPORT static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,const TopoDS_Shape& aS,gp_Pnt& aP2,IntTools_Context& aCtx) ; - - -Standard_EXPORT static void PointOnShape(const TopoDS_Shape& aS,gp_Pnt& aP3D) ; - - -Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,gp_Pnt& aP3D) ; - - -Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,const Standard_Real aT,gp_Pnt& aP3D) ; - - -Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,gp_Pnt& aP3D) ; - - -Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,const Standard_Real aU,const Standard_Real aV,gp_Pnt& aP3D) ; - - -Standard_EXPORT static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Standard_Real aU1,const Standard_Real aU2) ; - - -Standard_EXPORT static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface)& aS) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - + Standard_EXPORT + static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ; + + Standard_EXPORT + static Standard_Integer RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD, + const Standard_Real aTol, + const Handle(IntTools_Context)& aCtx) ; + + Standard_EXPORT + static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE, + const Standard_Real aTol, + TopTools_IndexedDataMapOfShapeListOfShape& aMEE, + const Handle(IntTools_Context)& aCtx) ; + + Standard_EXPORT + static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1, + const TopTools_ListOfShape& aLE, + const Standard_Real aTol, + TopTools_ListOfShape& aLESD, + const Handle(IntTools_Context)& aCtx) ; + + Standard_EXPORT + static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1, + const TopoDS_Shape& aS,gp_Pnt& aP2, + const Handle(IntTools_Context)& aCtx) ; + + Standard_EXPORT + static void PointOnShape(const TopoDS_Shape& aS, + gp_Pnt& aP3D) ; + + Standard_EXPORT + static void PointOnEdge(const TopoDS_Edge& aE, + gp_Pnt& aP3D) ; + + Standard_EXPORT + static void PointOnEdge(const TopoDS_Edge& aE, + const Standard_Real aT,gp_Pnt& aP3D) ; + + Standard_EXPORT + static void PointOnFace(const TopoDS_Face& aF, + gp_Pnt& aP3D) ; + + Standard_EXPORT + static void PointOnFace(const TopoDS_Face& aF, + const Standard_Real aU, + const Standard_Real aV, + gp_Pnt& aP3D) ; + + Standard_EXPORT + static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const Standard_Real aU1, + const Standard_Real aU2) ; + + Standard_EXPORT + static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface)& aS) ; + + Standard_EXPORT + static Standard_Boolean CorrectWires(const TopoDS_Shape& aS) ; + + Standard_EXPORT + static Standard_Integer BuildPCurveForEdgeOnFace(const TopoDS_Edge& aE, + const TopoDS_Edge& aEold, + const TopoDS_Face& aF, + const Handle(IntTools_Context)& aCtx) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.ixx b/src/GEOMAlgo/GEOMAlgo_Tools.ixx deleted file mode 100644 index 6e05fe29e..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Tools.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.jxx b/src/GEOMAlgo/GEOMAlgo_Tools.jxx deleted file mode 100644 index 5ff48c3d3..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Tools.jxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#include -#endif -#ifndef _IntTools_Context_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _Geom_Surface_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Tools_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.cdl b/src/GEOMAlgo/GEOMAlgo_Tools3D.cdl deleted file mode 100755 index 0bbc2fc20..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.cdl +++ /dev/null @@ -1,238 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_Tools3D.cdl --- Created: --- Author: Peter KURNEV --- -class Tools3D from GEOMAlgo - - ---Purpose: Auxiliary tools for Algorithms - -uses - State from TopAbs, - ShapeEnum from TopAbs, - Pnt from gp, - Shape from TopoDS, - Vertex from TopoDS, - Edge from TopoDS, - Face from TopoDS, - Solid from TopoDS, - - ListOfShape from TopTools, - IndexedMapOfShape from TopTools, - IndexedDataMapOfShapeListOfShape from TopTools, - Context from IntTools, - ListOfCoupleOfShape from NMTTools - ---raises - -is - IsSplitToReverse(myclass; - theSplit : Shape from TopoDS; - theShape : Shape from TopoDS; - theContext:out Context from IntTools) - ---Purpose: Returns True if the shape theSplit has opposite - -- direction than theShape - -- theContext - cashed geometrical tools - returns Boolean from Standard; - - IsSplitToReverse(myclass; - theSplit : Face from TopoDS; - theShape : Face from TopoDS; - theContext:out Context from IntTools) - ---Purpose: Returns True if normal direction of the face - -- theShape is not the same as for the face - -- theSplit - -- theContext - cashed geometrical tools - returns Boolean from Standard; - - IsSplitToReverse(myclass; - theEdge : Edge from TopoDS; - theSplit : Edge from TopoDS; - theContext:out Context from IntTools) - ---Purpose: Returns True if tangent direction of the edge - -- theEdge is not the same as for the edge - -- theSplit - -- theContext - cashed geometrical tools - returns Boolean from Standard; - - Sense (myclass; - theF1: Face from TopoDS; - theF2: Face from TopoDS) - ---Purpose: For the couple of faces theF1, theF2 - -- computes sense value - -- Returns 0 if the faces are not sensible - -- Returns 1 if the faces have same sense - -- Returns 2 if the faces have opposite sense - returns Integer from Standard; - - CopyFace(myclass; - theF1: Face from TopoDS; - theF2:out Face from TopoDS); - ---Purpose: Makes new face theF2 from surface and wires - -- of the face theF1 - - MakeContainer(myclass; - theType:ShapeEnum from TopAbs; - theShape:out Shape from TopoDS); - ---Purpose: Makes empty shape theShape of the type theType - - - MakeConnexityBlock(myclass; - theLS :ListOfShape from TopTools; - theMapAvoid:IndexedMapOfShape from TopTools; - theLSCB :out ListOfShape from TopTools); - ---Purpose: For the list of faces theLS build block - -- theLSCB in terms of connexity by edges - -- theMapAvoid - set of edges to avoid for - -- the treatment - - ComputeStateByOnePoint(myclass; - theShape :Shape from TopoDS; - theSolid :Solid from TopoDS; - theTol :Real from Standard; - theContext:out Context from IntTools) - ---Purpose: Computes the 3-D state of the shape theShape - -- toward solid theSolid. - -- theTol - value of precision of computation - -- theContext- cahed geometrical tools - -- Returns 3-D state. - returns State from TopAbs; - - ComputeState(myclass; - thePoint :Pnt from gp; - theSolid :Solid from TopoDS; - theTol :Real from Standard; - theContext:out Context from IntTools) - ---Purpose: Computes the 3-D state of the point thePoint - -- toward solid theSolid. - -- theTol - value of precision of computation - -- theContext- cahed geometrical tools - -- Returns 3-D state. - returns State from TopAbs; - - ComputeState(myclass; - theVertex:Vertex from TopoDS; - theSolid :Solid from TopoDS; - theTol :Real from Standard; - theContext:out Context from IntTools) - ---Purpose: Computes the 3-D state of the vertex theVertex - -- toward solid theSolid. - -- theTol - value of precision of computation - -- theContext- cahed geometrical tools - -- Returns 3-D state. - returns State from TopAbs; - - ComputeState(myclass; - theEdge :Edge from TopoDS; - theSolid :Solid from TopoDS; - theTol :Real from Standard; - theContext:out Context from IntTools) - ---Purpose: Computes the 3-D state of the edge theEdge - -- toward solid theSolid. - -- theTol - value of precision of computation - -- theContext- cahed geometrical tools - -- Returns 3-D state. - returns State from TopAbs; - - ComputeState(myclass; - theFace :Face from TopoDS; - theSolid :Solid from TopoDS; - theTol :Real from Standard; - theBounds:IndexedMapOfShape from TopTools; - theContext:out Context from IntTools) - ---Purpose: Computes the 3-D state of the face theFace - -- toward solid theSolid. - -- theTol - value of precision of computation - -- theBounds - set of edges of theFace to avoid - -- theContext- cahed geometrical tools - -- Returns 3-D state. - returns State from TopAbs; - - IsInternalFace(myclass; - theFace :Face from TopoDS; - theEdge :Edge from TopoDS; - theFace1 :Face from TopoDS; - theFace2 :Face from TopoDS) - ---Purpose: Returns True if the face theFace is inside of the - -- couple of faces theFace1, theFace2. - -- The faces theFace, theFace1, theFace2 must - -- share the edge theEdge - returns Boolean from Standard; - - IsInternalFace(myclass; - theFace :Face from TopoDS; - theEdge :Edge from TopoDS; - theLF :ListOfShape from TopTools) - ---Purpose: Returns True if the face theFace is inside of the - -- appropriate couple of faces (from the set theLF) . - -- The faces of the set theLF and theFace must - -- share the edge theEdge - returns Boolean from Standard; - - IsInternalFace(myclass; - theFace :Face from TopoDS; - theSolid :Solid from TopoDS; - theMEF :IndexedDataMapOfShapeListOfShape from TopTools; - theTol :Real from Standard; - theContext:out Context from IntTools) - ---Purpose: Returns True if the face theFace is inside the - -- solid theSolid. - -- theMEF - Map Edge/Faces for theSolid - -- theTol - value of precision of computation - -- theContext- cahed geometrical tools - returns Boolean from Standard; - - - GetFaceOff(myclass; - theEdge :Edge from TopoDS; - theFace :Face from TopoDS; - theLCEF :ListOfCoupleOfShape from NMTTools; - theFaceOff :out Face from TopoDS); - ---Purpose: For the face theFace and its edge theEdge - -- finds the face suitable to produce shell. - -- theLCEF - set of faces to search. All faces - -- from theLCEF must share edge theEdge - - GetEdgeOnFace (myclass; - theEdge :Edge from TopoDS; - theFace :Face from TopoDS; - theEdgeOnF :out Edge from TopoDS) - ---Purpose: For the face theFace gets the edge theEdgeOnF - -- that is the same as theEdge - -- Returns True if such edge exists - -- Returns False if there is no such edge - returns Boolean from Standard; - - GetEdgeOff (myclass; - theEdge :Edge from TopoDS; - theFace :Face from TopoDS; - theEdgeOff :out Edge from TopoDS) - ---Purpose: Returns True if the face theFace contains - -- the edge theEdge but with opposite orientation. - -- If the method returns True theEdgeOff is the - -- edge founded - returns Boolean from Standard; - ---fields -end Tools3D; - diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx b/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx index f990d80f6..81d7b75e1 100755 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools3D.cxx @@ -1,29 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Tools3D.cxx -// Created: -// Author: Peter KURNEV -// -#include +// File : GEOMAlgo_Tools3D.cxx +// Created : +// Author : Peter KURNEV + +#include #include @@ -33,10 +33,19 @@ #include #include #include +#include #include #include + #include +#include +#include + +#include +#include +#include + #include #include @@ -69,6 +78,7 @@ #include #include +#include #include #include @@ -86,27 +96,38 @@ #include #include // +#include + +// static Standard_Boolean FindFacePairs (const TopoDS_Edge& , - const TopTools_ListOfShape& , - NMTTools_ListOfCoupleOfShape& ); + const TopTools_ListOfShape& , + NMTTools_ListOfCoupleOfShape& ); static Standard_Real AngleWithRef(const gp_Dir& , - const gp_Dir& , - const gp_Dir& ); + const gp_Dir& , + const gp_Dir& ); + +static + void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE, + const TopoDS_Face& aF, + Standard_Real aT, + gp_Pnt& aPF, + gp_Dir& aDNF, + const Handle(IntTools_Context)& aCtx); //======================================================================= //function : IsInternalFace -//purpose : +//purpose : //======================================================================= - Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, - const TopoDS_Solid& theSolid, - const TopTools_IndexedDataMapOfShapeListOfShape& theMEF, - const Standard_Real theTol, - IntTools_Context& theContext) +Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, + const TopoDS_Solid& theSolid, + const TopTools_IndexedDataMapOfShapeListOfShape& theMEF, + const Standard_Real theTol, + const Handle(IntTools_Context)& theContext) { Standard_Boolean bRet; Standard_Integer aNbF; @@ -123,7 +144,7 @@ static if (!theMEF.Contains(aE)) { continue; } - // + // const TopTools_ListOfShape& aLF=theMEF.FindFromKey(aE); aNbF=aLF.Extent(); if (!aNbF) { @@ -132,7 +153,7 @@ static else if (aNbF==1) { // aE is internal edge on aLF.First() const TopoDS_Face& aF1=TopoDS::Face(aLF.First()); - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF1); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF1, theContext); return bRet; } else if (aNbF==2) { @@ -140,16 +161,16 @@ static const TopoDS_Face& aF2=TopoDS::Face(aLF.Last()); // if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) { - // treat as it was for 1 face - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF2); - return bRet; + // treat as it was for 1 face + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF2, theContext); + return bRet; } } if (aNbF%2) { return bRet; // it can not be so } else { // aNbF=2,4,6,8,... - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF, theContext); return bRet; } }//for(; aExp.More(); aExp.Next()) { @@ -167,11 +188,12 @@ static } //======================================================================= //function : IsInternalFace -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, - const TopoDS_Edge& theEdge, - const TopTools_ListOfShape& theLF) + const TopoDS_Edge& theEdge, + const TopTools_ListOfShape& theLF, + const Handle(IntTools_Context)& theContext) { Standard_Boolean bRet; Standard_Boolean aNbF; @@ -182,7 +204,7 @@ static if (aNbF==2) { const TopoDS_Face& aF1=TopoDS::Face(theLF.First()); const TopoDS_Face& aF2=TopoDS::Face(theLF.Last()); - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2, theContext); return bRet; } // @@ -198,9 +220,9 @@ static // const TopoDS_Face& aF1=TopoDS::Face(aCSFF.Shape1()); const TopoDS_Face& aF2=TopoDS::Face(aCSFF.Shape2()); - bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2); + bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, theEdge, aF1, aF2, theContext); if (bRet) { - return bRet; + return bRet; } } } @@ -208,15 +230,17 @@ static } //======================================================================= //function : IsInternalFace -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, - const TopoDS_Edge& theEdge, - const TopoDS_Face& theFace1, - const TopoDS_Face& theFace2) + const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace1, + const TopoDS_Face& theFace2, + const Handle(IntTools_Context)& theContext) { Standard_Boolean bRet; - Standard_Real aT1, aT2, aT, aDt2D, aDt2Dx;//aD1, aD2, + Standard_Real aT1, aT2, aT, aDt2D, aDt2Dx; + Standard_Real aA12, aA1x, aTwoPI; gp_Pnt aPx, aPF, aPF1, aPF2; gp_Pnt2d aP2D, aPF2D; gp_Dir aDNF1, aDNF2; @@ -231,7 +255,7 @@ static aDt2D=BOPTools_Tools3D::MinStepIn2d(); aDt2Dx=10.*aDt2D; BOPTools_Tools3D::PointNearEdge (theEdge, theFace, aT, aDt2Dx, aPF2D, aPF); - // + // // 2. E1, E2 GEOMAlgo_Tools3D::GetEdgeOnFace(theEdge, theFace1, aE1); if (aE1.Orientation()==TopAbs_INTERNAL) { @@ -251,73 +275,44 @@ static // 3 bRet=Standard_False; // - //modified by NIZNHY-PKV Mon Nov 13 12:12:53 2006f + GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1, theContext); + GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2, theContext); // - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1); - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2); + aTwoPI = 2.*M_PI; + gp_Vec aVBF (aPx, aPF ); + gp_Vec aVBF1(aPx, aPF1); + gp_Vec aVBF2(aPx, aPF2); // - { - Standard_Real aA12, aA1x, aTwoPI; - // - aTwoPI=2.*PI; - gp_Vec aVBF (aPx, aPF ); - gp_Vec aVBF1(aPx, aPF1); - gp_Vec aVBF2(aPx, aPF2); - // - gp_Dir aDTF1; - gp_Dir aDBF (aVBF); - gp_Dir aDBF1(aVBF1); - gp_Dir aDBF2(aVBF2); - // - aDTF1=aDNF1^aDBF1; - //aA12=aDBF1.AngleWithRef(aDBF2, aDTF1); - aA12=AngleWithRef(aDBF1, aDBF2, aDTF1); - if (aA12<0.) { - aA12=aA12+aTwoPI; - } - //aA1x=aDBF1.AngleWithRef(aDBF , aDTF1); - aA1x=AngleWithRef(aDBF1, aDBF , aDTF1); - if (aA1x<0.) { - aA1x=aA1x+aTwoPI; - } - // - if (aA1xSolidClassifier(theRef); aSC.Perform(theP, theTol); // aState=aSC.State(); @@ -578,11 +570,11 @@ static } //======================================================================= // function: IsSplitToReverse -// purpose: +// purpose: //======================================================================= Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Shape& theSp, - const TopoDS_Shape& theSr, - IntTools_Context& theCtx) + const TopoDS_Shape& theSr, + const Handle(IntTools_Context)& theCtx) { Standard_Boolean bRet; TopAbs_ShapeEnum aType; @@ -612,11 +604,11 @@ static } //======================================================================= //function :IsSplitToReverse -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Face& theFSp, - const TopoDS_Face& theFSr, - IntTools_Context& theContext) + const TopoDS_Face& theFSr, + const Handle(IntTools_Context)& theContext) { Standard_Boolean bRet, bFound, bInFace; Standard_Real aT1, aT2, aT, aU, aV, aScPr; @@ -645,21 +637,47 @@ static aESp=TopoDS::Edge(anExp.Current()); if (!BRep_Tool::Degenerated(aESp)) { if (!BRep_Tool::IsClosed(aESp, theFSp)) { - bFound=!bFound; - break; + bFound=!bFound; + break; } } } + // + //modified by NIZNHY-PKV Tue Nov 22 10:50:30 2011f if (!bFound) { - return bRet; + Standard_Boolean bFlag; + Standard_Integer iErr; + gp_Pnt2d aP2DFSp; + // + iErr=GEOMAlgo_Tools3D::PntInFace(theFSp, aPFSp, aP2DFSp); + if (iErr) { + return bRet; + } + // + aP2DFSp.Coord(aU, aV); + bFlag=BOPTools_Tools3D::GetNormalToSurface(aSp, aU, aV, aDNFSp); + if (!bFlag) { + return bRet; + } + } + else { + BRep_Tool::Range(aESp, aT1, aT2); + aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); + BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp); } // + /* + if (!bFound) { + return bRet; + } BRep_Tool::Range(aESp, aT1, aT2); aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp); + */ + //modified by NIZNHY-PKV Tue Nov 22 10:50:37 2011t // - // Parts of theContext.ComputeVS(..) - GeomAPI_ProjectPointOnSurf& aProjector=theContext.ProjPS(theFSr); + // Parts of theContext.ComputeVS(..) + GeomAPI_ProjectPointOnSurf& aProjector=theContext->ProjPS(theFSr); aProjector.Perform(aPFSp); if (!aProjector.IsDone()) { return bRet; @@ -667,15 +685,15 @@ static // aProjector.LowerDistanceParameters(aU, aV); gp_Pnt2d aP2D(aU, aV); - bInFace=theContext.IsPointInFace (theFSr, aP2D); + bInFace=theContext->IsPointInFace (theFSr, aP2D); if (!bInFace) { return bRet; } // aSr->D1(aU, aV, aPFSr, aD1U, aD1V); - gp_Dir aDD1U(aD1U); + gp_Dir aDD1U(aD1U); gp_Dir aDD1V(aD1V); - gp_Dir aDNFSr=aDD1U^aDD1V; + gp_Dir aDNFSr=aDD1U^aDD1V; if (theFSr.Orientation()==TopAbs_REVERSED){ aDNFSr.Reverse(); } @@ -687,11 +705,11 @@ static } //======================================================================= //function :IsSplitToReverse -//purpose : +//purpose : //======================================================================= Standard_Boolean GEOMAlgo_Tools3D::IsSplitToReverse(const TopoDS_Edge& theSplit, - const TopoDS_Edge& theEdge, - IntTools_Context& theContext) + const TopoDS_Edge& theEdge, + const Handle(IntTools_Context)& theContext) { Standard_Boolean bRet, aFlag, bIsDegenerated; Standard_Real aTE, aTS, aScPr, aTa, aTb, aT1, aT2; @@ -702,8 +720,8 @@ static // bRet=Standard_False; // - bIsDegenerated=(BRep_Tool::Degenerated(theSplit) || - BRep_Tool::Degenerated(theEdge)); + bIsDegenerated=(BRep_Tool::Degenerated(theSplit) || + BRep_Tool::Degenerated(theEdge)); if (bIsDegenerated) { return bRet; } @@ -723,7 +741,7 @@ static aFlag=BOPTools_Tools2D::EdgeTangent(theSplit, aTS, aVS); gp_Dir aDTS(aVS); // - aFlag=theContext.ProjectPointOnEdge(aP, theEdge, aTE); + aFlag=theContext->ProjectPointOnEdge(aP, theEdge, aTE); aFlag=BOPTools_Tools2D::EdgeTangent(theEdge, aTE, aVE); gp_Dir aDTE(aVE); // @@ -735,10 +753,10 @@ static //======================================================================= // function: Sense -// purpose: +// purpose: //======================================================================= Standard_Integer GEOMAlgo_Tools3D::Sense (const TopoDS_Face& theF1, - const TopoDS_Face& theF2) + const TopoDS_Face& theF2) { Standard_Integer iSense=0; gp_Dir aDNF1, aDNF2; @@ -750,7 +768,7 @@ static aE1=TopoDS::Edge(anExp.Current()); if (!BRep_Tool::Degenerated(aE1)) { if (!BRep_Tool::IsClosed(aE1, theF1)) { - break; + break; } } } @@ -760,10 +778,10 @@ static aE2=TopoDS::Edge(anExp.Current()); if (!BRep_Tool::Degenerated(aE2)) { if (!BRep_Tool::IsClosed(aE2, theF2)) { - if (aE2.IsSame(aE1)) { - iSense=1; - break; - } + if (aE2.IsSame(aE1)) { + iSense=1; + break; + } } } } @@ -781,10 +799,10 @@ static } //======================================================================= // function: CopyFace -// purpose: +// purpose: //======================================================================= void GEOMAlgo_Tools3D::CopyFace (const TopoDS_Face& theF1, - TopoDS_Face& theF2) + TopoDS_Face& theF2) { Standard_Real aTol; TopLoc_Location aLoc; @@ -807,10 +825,10 @@ static } //======================================================================= // function: MakeContainer -// purpose: +// purpose: //======================================================================= void GEOMAlgo_Tools3D::MakeContainer(const TopAbs_ShapeEnum theType, - TopoDS_Shape& theC) + TopoDS_Shape& theC) { BRep_Builder aBB; // @@ -833,7 +851,7 @@ static TopoDS_Solid aSolid; aBB.MakeSolid(aSolid); theC=aSolid; - } + } break; // // @@ -841,7 +859,7 @@ static TopoDS_Shell aShell; aBB.MakeShell(aShell); theC=aShell; - } + } break; // case TopAbs_WIRE: { @@ -857,11 +875,11 @@ static } //======================================================================= // function: MakeConnexityBlock. -// purpose: +// purpose: //======================================================================= void GEOMAlgo_Tools3D::MakeConnexityBlock (const TopTools_ListOfShape& theLFIn, - const TopTools_IndexedMapOfShape& theMEAvoid, - TopTools_ListOfShape& theLCB) + const TopTools_IndexedMapOfShape& theMEAvoid, + TopTools_ListOfShape& theLCB) { Standard_Integer aNbF, aNbAdd1; TopExp_Explorer aExp; @@ -874,7 +892,7 @@ static aNbF=theLFIn.Extent(); aIt.Initialize(theLFIn); for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aF=aIt.Value(); + const TopoDS_Shape& aF=aIt.Value(); TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF); } // @@ -891,23 +909,23 @@ static //aMAdd1.Clear(); aExp.Init(aF, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aE=aExp.Current(); - if (theMEAvoid.Contains(aE)){ - continue; - } - // - const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE); - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aFx=aIt.Value(); - if (aFx.IsSame(aF)) { - continue; - } - if (aMCB.Contains(aFx)) { - continue; - } - aMAdd1.Add(aFx); - } + const TopoDS_Shape& aE=aExp.Current(); + if (theMEAvoid.Contains(aE)){ + continue; + } + // + const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE); + aIt.Initialize(aLF); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aFx=aIt.Value(); + if (aFx.IsSame(aF)) { + continue; + } + if (aMCB.Contains(aFx)) { + continue; + } + aMAdd1.Add(aFx); + } }//for (; aExp.More(); aExp.Next()){ aMCB.Add(aF); }// for (; aItM.More(); aItM.Next()) { @@ -925,7 +943,7 @@ static } // }//while(1) { - + // aNbF=aMCB.Extent(); aItM.Initialize(aMCB); @@ -934,14 +952,13 @@ static theLCB.Append(aF); } } - //======================================================================= //function : FindFacePairs -//purpose : +//purpose : //======================================================================= Standard_Boolean FindFacePairs (const TopoDS_Edge& theE, - const TopTools_ListOfShape& thLF, - NMTTools_ListOfCoupleOfShape& theLCFF) + const TopTools_ListOfShape& thLF, + NMTTools_ListOfCoupleOfShape& theLCFF) { Standard_Boolean bFound; Standard_Integer i, aNbCEF; @@ -958,7 +975,7 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE, // // Preface aLCEF aItLF.Initialize(thLF); - for (; aItLF.More(); aItLF.Next()) { + for (; aItLF.More(); aItLF.Next()) { const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value()); // bFound=GEOMAlgo_Tools3D::GetEdgeOnFace(theE, aFL, aEL); @@ -985,16 +1002,16 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE, aOr=aEx.Orientation(); // if (!i) { - aOrC=TopAbs::Reverse(aOr); - aE1=TopoDS::Edge(aEx); - aF1=TopoDS::Face(aFx); - aMFP.Add(aFx); - continue; + aOrC=TopAbs::Reverse(aOr); + aE1=TopoDS::Edge(aEx); + aF1=TopoDS::Face(aFx); + aMFP.Add(aFx); + continue; } // if (aOr==aOrC) { - aLCEFx.Append(aCSx); - aMFP.Add(aFx); + aLCEFx.Append(aCSx); + aMFP.Add(aFx); } } // @@ -1017,7 +1034,7 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE, const NMTTools_CoupleOfShape& aCSx=aIt.Value(); const TopoDS_Shape& aFx=aCSx.Shape2(); if (!aMFP.Contains(aFx)) { - aLCEF.Append(aCSx); + aLCEF.Append(aCSx); } } // @@ -1029,16 +1046,16 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE, // //======================================================================= //function : AngleWithRef -//purpose : +//purpose : //======================================================================= Standard_Real AngleWithRef(const gp_Dir& theD1, - const gp_Dir& theD2, - const gp_Dir& theDRef) + const gp_Dir& theD2, + const gp_Dir& theDRef) { Standard_Real aCosinus, aSinus, aBeta, aHalfPI, aScPr; gp_XYZ aXYZ; // - aHalfPI=0.5*PI; + aHalfPI=0.5*M_PI; // const gp_XYZ& aXYZ1=theD1.XYZ(); const gp_XYZ& aXYZ2=theD2.XYZ(); @@ -1051,7 +1068,7 @@ Standard_Real AngleWithRef(const gp_Dir& theD1, aBeta=aHalfPI*(1.-aCosinus); } else { - aBeta=2.*PI-aHalfPI*(3.+aCosinus); + aBeta=2.*M_PI-aHalfPI*(3.+aCosinus); } // aScPr=aXYZ.Dot(theDRef.XYZ()); @@ -1060,98 +1077,225 @@ Standard_Real AngleWithRef(const gp_Dir& theD1, } return aBeta; } -// -/* -static - void Path(const TopoDS_Shape& , - const TopoDS_Shape& , - const TopTools_IndexedDataMapOfShapeListOfShape& , - const TopTools_IndexedMapOfShape& , - TopTools_IndexedMapOfShape& ); - //======================================================================= -// function: MakeConnexityBlock. -// purpose: +//function : GetApproxNormalToFaceOnEdge +//purpose : //======================================================================= - void GEOMAlgo_Tools3D::MakeConnexityBlock (const TopTools_ListOfShape& theLFIn, - const TopTools_IndexedMapOfShape& theMEAvoid, - TopTools_ListOfShape& theLCB) +void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx, + const TopoDS_Face& aFx, + Standard_Real aT, + gp_Pnt& aPF, + gp_Dir& aDNF, + const Handle(IntTools_Context)& aCtx) { - Standard_Integer j, aNbF; - TopTools_IndexedDataMapOfShapeListOfShape aEFMap; - TopTools_IndexedMapOfShape aMFP, aCBMap; - TopTools_ListIteratorOfListOfShape aIt; - TopExp_Explorer aExp; - TopAbs_ShapeEnum aType; - // - aIt.Initialize(theLFIn); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aF=aIt.Value(); - aType=aF.ShapeType(); - TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aEFMap); + Standard_Boolean bReverse; + Standard_Real aT1, aT2, dT, aU, aV; + gp_Dir aDTT, aDNFT, aDBT; + gp_Pnt aPFT, aPFx; + Handle(Geom_Curve) aC3D; + Handle(Geom_Surface) aS; + GeomAdaptor_Surface aGAS; + GeomAbs_SurfaceType aTS; + TopoDS_Face aF; + TopoDS_Edge aE; + // + bReverse=Standard_False; + aF=aFx; + aE=aEx; + if (aF.Orientation()==TopAbs_REVERSED){ + bReverse=!bReverse; + aE.Reverse(); + // + aF.Orientation(TopAbs_FORWARD); } // - aCBMap.Clear(); - const TopoDS_Shape& aF=theLFIn.First(); + // Point at aT + aC3D =BRep_Tool::Curve(aE, aT1, aT2); + aC3D->D0(aT, aPFT); // - aCBMap.Add(aF); + // Normal at aT + BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNFT); + + // Tangent at aT + BOPTools_Tools3D::GetTangentToEdge(aE, aT, aDTT); // - aExp.Init(aF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()){ - const TopoDS_Shape& aE=aExp.Current(); - if (theMEAvoid.Contains(aE)){ - continue; + // Binormal at aT + aDBT=aDNFT^aDTT; + // + dT=BOPTools_Tools3D::MinStepIn2d();//~1.e-5; + dT=10.*dT; + //---------------------------------------------- + { + aS=BRep_Tool::Surface(aF); + aGAS.Load(aS); + aTS=aGAS.GetType(); + if (aTS==GeomAbs_BSplineSurface || + aTS==GeomAbs_BezierSurface || + aTS==GeomAbs_Plane){ + Standard_Real aTolEx, aTolFx, aTol, dUR, dVR, dR; + // + aTolEx=BRep_Tool::Tolerance(aEx); + aTolFx=BRep_Tool::Tolerance(aFx); + aTol=2.*aTolEx+aTolFx; + dUR=aGAS.UResolution(aTol); + dVR=aGAS.VResolution(aTol); + dR=(dUR>dVR)? dUR : dVR; + if (dR>dT) { + dT=dR; + } } - // - const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aF1=aIt.Value(); - if (!aF1.IsSame(aF)) { - Path (aE, aF1, aEFMap, theMEAvoid, aCBMap); + else if (GeomAbs_Torus || + aTS==GeomAbs_Cylinder){ + Standard_Real aTolEx, aTolFx, aTol; + // + aTolEx=BRep_Tool::Tolerance(aEx); + aTolFx=BRep_Tool::Tolerance(aFx); + aTol=2.*aTolEx+aTolFx; + if (aTol>dT) { + dT=aTol; } } } + //---------------------------------------------- // - aNbF=aCBMap.Extent(); - for (j=1; j<=aNbF; ++j) { - const TopoDS_Shape& aFx=aCBMap(j); - theLCB.Append(aFx); + aPFx.SetXYZ(aPFT.XYZ()+dT*aDBT.XYZ()); + // + aPF=aPFx; + aDNF=aDNFT; + if (bReverse) { + aDNF.Reverse(); + } + // + GeomAPI_ProjectPointOnSurf& aProjector=aCtx->ProjPS(aF); + // + aProjector.Perform(aPFx); + if(aProjector.IsDone()) { + aProjector.LowerDistanceParameters (aU, aV); + aS->D0(aU, aV, aPF); + BOPTools_Tools3D::GetNormalToSurface (aS, aU, aV, aDNF); + if (bReverse){ + aDNF.Reverse(); + } } } + +//modified by NIZNHY-PKV Tue Nov 22 10:36:59 2011f //======================================================================= -// function: Path -// purpose: +//function : PntInFace +//purpose : //======================================================================= -void Path(const TopoDS_Shape& theE1, - const TopoDS_Shape& theF1, - const TopTools_IndexedDataMapOfShapeListOfShape& theEFMap, - const TopTools_IndexedMapOfShape& theMEAvoid, - TopTools_IndexedMapOfShape& theCBMap) +Standard_Integer GEOMAlgo_Tools3D::PntInFace(const TopoDS_Face& aF, + gp_Pnt& theP, + gp_Pnt2d& theP2D) { - TopTools_ListIteratorOfListOfShape aIt; + Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint; + Standard_Integer iErr, aIx, aNbDomains, i; + Standard_Real aUMin, aUMax, aVMin, aVMax; + Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT; + Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D; + gp_Dir2d aD2D (0., 1.); + gp_Pnt2d aP2D; + gp_Pnt aPx; + Handle(Geom2d_Curve) aC2D; + Handle(Geom2d_TrimmedCurve) aCT2D; + Handle(Geom2d_Line) aL2D; + Handle(Geom_Surface) aS; + TopAbs_Orientation aOrE; + TopoDS_Face aFF; TopExp_Explorer aExp; // - if (theCBMap.Contains(theF1)){ - return; + aTolHatch2D=1.e-8; + aTolHatch3D=1.e-8; + aTotArcIntr=1.e-10; + aTolTangfIntr=1.e-10; + // + Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr); + Geom2dHatch_Hatcher aHatcher(aIntr, + aTolHatch2D, aTolHatch3D, + Standard_True, Standard_False); + // + iErr=0; + aEpsT=1.e-12; + // + aFF=aF; + aFF.Orientation (TopAbs_FORWARD); + // + aS=BRep_Tool::Surface(aFF); + BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax); + // + // 1 + aExp.Init (aFF, TopAbs_EDGE); + for (; aExp.More() ; aExp.Next()) { + const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current()); + aOrE=aE.Orientation(); + // + aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2); + if (aC2D.IsNull() ) { + iErr=1; + return iErr; + } + if (fabs(aU1-aU2) < aEpsT) { + iErr=2; + return iErr; + } + // + aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2); + aHatcher.AddElement(aCT2D, aOrE); + }// for (; aExp.More() ; aExp.Next()) { + // + // 2 + aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax); + aP2D.SetCoord(aUx, 0.); + aL2D=new Geom2d_Line (aP2D, aD2D); + Geom2dAdaptor_Curve aHCur(aL2D); + // + aIx=aHatcher.AddHatching(aHCur) ; + // + // 3. + aHatcher.Trim(); + bIsDone=aHatcher.TrimDone(aIx); + if (!bIsDone) { + iErr=3; + return iErr; } - theCBMap.Add(theF1); - // - aExp.Init(theF1, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()){ - const TopoDS_Shape& aE=aExp.Current(); - if (!aE.IsSame(theE1)){ - if (theMEAvoid.Contains(aE)) { - continue; - } - // - const TopTools_ListOfShape& aLF=theEFMap.FindFromKey(aE); - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aF=aIt.Value(); - Path (aE, aF, theEFMap, theMEAvoid, theCBMap); - } + // + aHatcher.ComputeDomains(aIx); + bIsDone=aHatcher.IsDone(aIx); + if (!bIsDone) { + iErr=4; + return iErr; + } + // + // 4. + aNbDomains=aHatcher.NbDomains(aIx); + for (i=1; i<=aNbDomains; ++i) { + const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; + bHasFirstPoint=aDomain.HasFirstPoint(); + if (!bHasFirstPoint) { + iErr=5; + return iErr; + } + // + aV1=aDomain.FirstPoint().Parameter(); + // + bHasSecondPoint=aDomain.HasSecondPoint(); + if (!bHasSecondPoint) { + iErr=6; + return iErr; } + // + aV2=aDomain.SecondPoint().Parameter(); + // + aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); + // + break; } + // + aS->D0(aUx, aVx, aPx); + // + theP2D.SetCoord(aUx, aVx); + theP=aPx; + // + return iErr; } -*/ +//modified by NIZNHY-PKV Tue Nov 22 10:37:01 2011t diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx b/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx index 42cd68861..d23d73b60 100644 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools3D.hxx @@ -1,224 +1,240 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : GEOMAlgo_Tools3D.hxx +// Created : +// Author : Peter KURNEV + #ifndef _GEOMAlgo_Tools3D_HeaderFile #define _GEOMAlgo_Tools3D_HeaderFile -#ifndef _Standard_Boolean_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile +#include #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -#ifndef _TopAbs_State_HeaderFile #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -class TopoDS_Shape; -class IntTools_Context; -class TopoDS_Face; -class TopoDS_Edge; -class TopTools_ListOfShape; -class TopTools_IndexedMapOfShape; -class TopoDS_Solid; -class gp_Pnt; -class TopoDS_Vertex; -class TopTools_IndexedDataMapOfShapeListOfShape; -class NMTTools_ListOfCoupleOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + //! Auxiliary tools for Algorithms
    +//======================================================================= +//class : GEOMAlgo_Tools3D +//purpose : +//======================================================================= class GEOMAlgo_Tools3D { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Returns True if the shape theSplit has opposite
    -//! direction than theShape
    -//! theContext - cashed geometrical tools
    -Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit,const TopoDS_Shape& theShape,IntTools_Context& theContext) ; - -//! Returns True if normal direction of the face
    -//! theShape is not the same as for the face
    -//! theSplit
    -//! theContext - cashed geometrical tools
    -Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit,const TopoDS_Face& theShape,IntTools_Context& theContext) ; - -//! Returns True if tangent direction of the edge
    -//! theEdge is not the same as for the edge
    -//! theSplit
    -//! theContext - cashed geometrical tools
    -Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theEdge,const TopoDS_Edge& theSplit,IntTools_Context& theContext) ; - -//! For the couple of faces theF1, theF2
    -//! computes sense value
    -//! Returns 0 if the faces are not sensible
    -//! Returns 1 if the faces have same sense
    -//! Returns 2 if the faces have opposite sense
    -Standard_EXPORT static Standard_Integer Sense(const TopoDS_Face& theF1,const TopoDS_Face& theF2) ; - -//! Makes new face theF2 from surface and wires
    -//! of the face theF1
    -Standard_EXPORT static void CopyFace(const TopoDS_Face& theF1,TopoDS_Face& theF2) ; - -//! Makes empty shape theShape of the type theType
    -Standard_EXPORT static void MakeContainer(const TopAbs_ShapeEnum theType,TopoDS_Shape& theShape) ; - -//! For the list of faces theLS build block
    -//! theLSCB in terms of connexity by edges
    -//! theMapAvoid - set of edges to avoid for
    -//! the treatment
    -Standard_EXPORT static void MakeConnexityBlock(const TopTools_ListOfShape& theLS,const TopTools_IndexedMapOfShape& theMapAvoid,TopTools_ListOfShape& theLSCB) ; - -//! Computes the 3-D state of the shape theShape
    -//! toward solid theSolid.
    -//! theTol - value of precision of computation
    -//! theContext- cahed geometrical tools
    -//! Returns 3-D state.
    -Standard_EXPORT static TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ; - -//! Computes the 3-D state of the point thePoint
    -//! toward solid theSolid.
    -//! theTol - value of precision of computation
    -//! theContext- cahed geometrical tools
    -//! Returns 3-D state.
    -Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ; - -//! Computes the 3-D state of the vertex theVertex
    -//! toward solid theSolid.
    -//! theTol - value of precision of computation
    -//! theContext- cahed geometrical tools
    -//! Returns 3-D state.
    -Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ; - -//! Computes the 3-D state of the edge theEdge
    -//! toward solid theSolid.
    -//! theTol - value of precision of computation
    -//! theContext- cahed geometrical tools
    -//! Returns 3-D state.
    -Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ; - -//! Computes the 3-D state of the face theFace
    -//! toward solid theSolid.
    -//! theTol - value of precision of computation
    -//! theBounds - set of edges of theFace to avoid
    -//! theContext- cahed geometrical tools
    -//! Returns 3-D state.
    -Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Face& theFace,const TopoDS_Solid& theSolid,const Standard_Real theTol,const TopTools_IndexedMapOfShape& theBounds,IntTools_Context& theContext) ; - -//! Returns True if the face theFace is inside of the
    -//! couple of faces theFace1, theFace2.
    -//! The faces theFace, theFace1, theFace2 must
    -//! share the edge theEdge
    -Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopoDS_Face& theFace1,const TopoDS_Face& theFace2) ; - -//! Returns True if the face theFace is inside of the
    -//! appropriate couple of faces (from the set theLF) .
    -//! The faces of the set theLF and theFace must
    -//! share the edge theEdge
    -Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopTools_ListOfShape& theLF) ; - -//! Returns True if the face theFace is inside the
    -//! solid theSolid.
    -//! theMEF - Map Edge/Faces for theSolid
    -//! theTol - value of precision of computation
    -//! theContext- cahed geometrical tools
    -Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Solid& theSolid,const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,const Standard_Real theTol,IntTools_Context& theContext) ; - -//! For the face theFace and its edge theEdge
    -//! finds the face suitable to produce shell.
    -//! theLCEF - set of faces to search. All faces
    -//! from theLCEF must share edge theEdge
    -Standard_EXPORT static void GetFaceOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,const NMTTools_ListOfCoupleOfShape& theLCEF,TopoDS_Face& theFaceOff) ; - -//! For the face theFace gets the edge theEdgeOnF
    -//! that is the same as theEdge
    -//! Returns True if such edge exists
    -//! Returns False if there is no such edge
    -Standard_EXPORT static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOnF) ; - -//! Returns True if the face theFace contains
    -//! the edge theEdge but with opposite orientation.
    -//! If the method returns True theEdgeOff is the
    -//! edge founded
    -Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOff) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + public: + //! Returns True if the shape theSplit has opposite
    + //! direction than theShape
    + //! theContext - cashed geometrical tools
    + Standard_EXPORT + static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit, + const TopoDS_Shape& theShape, + const Handle(IntTools_Context)& theContext) ; + + //! Returns True if normal direction of the face
    + //! theShape is not the same as for the face
    + //! theSplit
    + //! theContext - cashed geometrical tools
    + Standard_EXPORT + static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit, + const TopoDS_Face& theShape, + const Handle(IntTools_Context)& theContext) ; + + //! Returns True if tangent direction of the edge
    + //! theEdge is not the same as for the edge
    + //! theSplit
    + //! theContext - cashed geometrical tools
    + Standard_EXPORT + static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theEdge, + const TopoDS_Edge& theSplit, + const Handle(IntTools_Context)& theContext) ; + + //! For the couple of faces theF1, theF2
    + //! computes sense value
    + //! Returns 0 if the faces are not sensible
    + //! Returns 1 if the faces have same sense
    + //! Returns 2 if the faces have opposite sense
    + Standard_EXPORT + static Standard_Integer Sense(const TopoDS_Face& theF1, + const TopoDS_Face& theF2) ; + + //! Makes new face theF2 from surface and wires
    + //! of the face theF1
    + Standard_EXPORT + static void CopyFace(const TopoDS_Face& theF1, + TopoDS_Face& theF2) ; + + //! Makes empty shape theShape of the type theType
    + Standard_EXPORT + static void MakeContainer(const TopAbs_ShapeEnum theType, + TopoDS_Shape& theShape) ; + + //! For the list of faces theLS build block
    + //! theLSCB in terms of connexity by edges
    + //! theMapAvoid - set of edges to avoid for
    + //! the treatment
    + Standard_EXPORT + static void MakeConnexityBlock(const TopTools_ListOfShape& theLS, + const TopTools_IndexedMapOfShape& theMapAvoid, + TopTools_ListOfShape& theLSCB) ; + + //! Computes the 3-D state of the shape theShape
    + //! toward solid theSolid.
    + //! theTol - value of precision of computation
    + //! theContext- cahed geometrical tools
    + //! Returns 3-D state.
    + Standard_EXPORT + static TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape, + const TopoDS_Solid& theSolid, + const Standard_Real theTol, + const Handle(IntTools_Context)& theContext) ; + + //! Computes the 3-D state of the point thePoint
    + //! toward solid theSolid.
    + //! theTol - value of precision of computation
    + //! theContext- cahed geometrical tools
    + //! Returns 3-D state.
    + Standard_EXPORT + static TopAbs_State ComputeState(const gp_Pnt& thePoint, + const TopoDS_Solid& theSolid, + const Standard_Real theTol, + const Handle(IntTools_Context)& theContext) ; + + //! Computes the 3-D state of the vertex theVertex
    + //! toward solid theSolid.
    + //! theTol - value of precision of computation
    + //! theContext- cahed geometrical tools
    + //! Returns 3-D state.
    + Standard_EXPORT + static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex, + const TopoDS_Solid& theSolid, + const Standard_Real theTol, + const Handle(IntTools_Context)& theContext) ; + + //! Computes the 3-D state of the edge theEdge
    + //! toward solid theSolid.
    + //! theTol - value of precision of computation
    + //! theContext- cahed geometrical tools
    + //! Returns 3-D state.
    + Standard_EXPORT + static TopAbs_State ComputeState(const TopoDS_Edge& theEdge, + const TopoDS_Solid& theSolid, + const Standard_Real theTol, + const Handle(IntTools_Context)& theContext) ; + + //! Computes the 3-D state of the face theFace
    + //! toward solid theSolid.
    + //! theTol - value of precision of computation
    + //! theBounds - set of edges of theFace to avoid
    + //! theContext- cahed geometrical tools
    + //! Returns 3-D state.
    + Standard_EXPORT + static TopAbs_State ComputeState(const TopoDS_Face& theFace, + const TopoDS_Solid& theSolid, + const Standard_Real theTol, + const TopTools_IndexedMapOfShape& theBounds, + const Handle(IntTools_Context)& theContext) ; + + //! Returns True if the face theFace is inside of the
    + //! couple of faces theFace1, theFace2.
    + //! The faces theFace, theFace1, theFace2 must
    + //! share the edge theEdge
    + Standard_EXPORT + static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace, + const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace1, + const TopoDS_Face& theFace2, + const Handle(IntTools_Context)& theContext) ; + + //! Returns True if the face theFace is inside of the
    + //! appropriate couple of faces (from the set theLF) .
    + //! The faces of the set theLF and theFace must
    + //! share the edge theEdge
    + Standard_EXPORT + static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace, + const TopoDS_Edge& theEdge, + const TopTools_ListOfShape& theLF, + const Handle(IntTools_Context)& theContext) ; + + //! Returns True if the face theFace is inside the
    + //! solid theSolid.
    + //! theMEF - Map Edge/Faces for theSolid
    + //! theTol - value of precision of computation
    + //! theContext- cahed geometrical tools
    + Standard_EXPORT + static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace, + const TopoDS_Solid& theSolid, + const TopTools_IndexedDataMapOfShapeListOfShape& theMEF, + const Standard_Real theTol, + const Handle(IntTools_Context)& theContext) ; + + //! For the face theFace and its edge theEdge
    + //! finds the face suitable to produce shell.
    + //! theLCEF - set of faces to search. All faces
    + //! from theLCEF must share edge theEdge
    + Standard_EXPORT + static void GetFaceOff(const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace, + const NMTTools_ListOfCoupleOfShape& theLCEF, + TopoDS_Face& theFaceOff) ; + + //! For the face theFace gets the edge theEdgeOnF
    + //! that is the same as theEdge
    + //! Returns True if such edge exists
    + //! Returns False if there is no such edge
    + Standard_EXPORT + static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace, + TopoDS_Edge& theEdgeOnF) ; + + //! Returns True if the face theFace contains
    + //! the edge theEdge but with opposite orientation.
    + //! If the method returns True theEdgeOff is the
    + //! edge founded
    + Standard_EXPORT + static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge, + const TopoDS_Face& theFace, + TopoDS_Edge& theEdgeOff) ; + + //! Computes a point inside the face .
    + //! - 2D representation of
    + //! on the surface of
    + //! Returns 0 in case of success.
    + Standard_EXPORT + static Standard_Integer PntInFace(const TopoDS_Face& theF, + gp_Pnt& theP, + gp_Pnt2d& theP2D) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.ixx b/src/GEOMAlgo/GEOMAlgo_Tools3D.ixx deleted file mode 100644 index 76dbf81ed..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_Tools3D.jxx b/src/GEOMAlgo/GEOMAlgo_Tools3D.jxx deleted file mode 100644 index 328d5bb72..000000000 --- a/src/GEOMAlgo/GEOMAlgo_Tools3D.jxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _IntTools_Context_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Solid_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_Tools3D_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Tools_1.cxx b/src/GEOMAlgo/GEOMAlgo_Tools_1.cxx new file mode 100644 index 000000000..5dc71b41c --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Tools_1.cxx @@ -0,0 +1,352 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_Tools_1.cxx +// Created: Thu May 6 10:46:21 2010 +// Author: Peter KURNEV + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static + inline Standard_Boolean IsEqual(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) { + return TopTools_ShapeMapHasher::IsEqual(aS1, aS2); +} +// +static + Standard_Boolean CorrectWire(const TopoDS_Wire& aW, + const TopoDS_Face& aF); + +//======================================================================= +//function : CorrectWires +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Tools::CorrectWires(const TopoDS_Shape& aShape) +{ + Standard_Boolean bRet; + TopoDS_Iterator aItF; + TopExp_Explorer aExp; + TopTools_MapOfShape aMF; + GeomAdaptor_Surface aGAS; + GeomAbs_SurfaceType aTS; + TopLoc_Location aLoc; + // + bRet=Standard_False; + // + aExp.Init(aShape, TopAbs_FACE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Face& aF=*((TopoDS_Face*)&aExp.Current()); + if (aMF.Add(aF)) { + const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF, aLoc); + aGAS.Load(aS); + aTS=aGAS.GetType(); + //modified by NIZNHY-PKV Mon Jul 02 13:58:30 2012f + if (aTS==GeomAbs_Cylinder || aTS==GeomAbs_Plane || aTS==GeomAbs_BSplineSurface) { + //if (aTS==GeomAbs_Cylinder || aTS==GeomAbs_Plane) { + //modified by NIZNHY-PKV Mon Jul 02 13:58:33 2012t + aItF.Initialize(aF); + for (; aItF.More(); aItF.Next()) { + const TopoDS_Wire& aW=*((TopoDS_Wire*)&aItF.Value()); + if (CorrectWire(aW, aF)) { + bRet=Standard_True; + } + } + } + } + } + return bRet; +} + +//======================================================================= +//class: GEOMAlgo_InfoEdge +//purpose : +//======================================================================= +class GEOMAlgo_InfoEdge { + public: + // + GEOMAlgo_InfoEdge() { + myErrorStatus=0; + myTolInt=1.0e-10; + }; + // + ~GEOMAlgo_InfoEdge(){ + }; + // + void Init(const TopoDS_Edge& aE, + const TopoDS_Face& aF); + // + void SetTolInt(const Standard_Real aTolInt) { + myTolInt=aTolInt; + }; + // + const Standard_Real TolInt() const { + return myTolInt; + } + // + const Geom2dAdaptor_Curve& Adaptor() const { + return myGAC2D; + } + // + const IntRes2d_Domain& Domain()const { + return myDomain; + } + // + const Handle(Geom2d_Curve)& CurveOnSurface()const { + return myC2D; + } + // + const Handle(Geom_Curve)& Curve()const { + return myC3D; + } + // + Standard_Integer ErrorStatus()const { + return myErrorStatus; + } + // + protected: + Standard_Integer myErrorStatus; + Standard_Real myTolInt; + Geom2dAdaptor_Curve myGAC2D; + IntRes2d_Domain myDomain; + Handle(Geom2d_Curve) myC2D; + Handle(Geom_Curve) myC3D; +}; +// +typedef NCollection_DataMap GEOMAlgo_DataMapOfShapeInfoEdge; +typedef GEOMAlgo_DataMapOfShapeInfoEdge::Iterator GEOMAlgo_DataMapIteratorOfDataMapOfShapeInfoEdge; + +//======================================================================= +//function : Init +//purpose : +//======================================================================= + void GEOMAlgo_InfoEdge::Init(const TopoDS_Edge& aE, + const TopoDS_Face& aF) +{ + Standard_Real aT1, aT2, aT1x, aT2x; + gp_Pnt2d aP2D1, aP2D2; + // + myErrorStatus=0; + // + myC3D=BRep_Tool::Curve(aE, aT1, aT2); + myC2D=BRep_Tool::CurveOnSurface(aE ,aF, aT1, aT2); + if (!myC2D.IsNull() && aT2>aT1) { + myGAC2D.Load(myC2D); + if(!myGAC2D.IsPeriodic()) { + aT1x=myGAC2D.FirstParameter(); + aT2x=myGAC2D.LastParameter(); + if(aT1x > aT1) { + aT1=aT1x; + } + if(aT2x < aT2) { + aT2=aT2x; + } + } + // + BRep_Tool::UVPoints(aE, aF, aP2D1, aP2D2); + myDomain.SetValues(aP2D1, aT1, myTolInt, aP2D2, aT2, myTolInt); + } + else { + myErrorStatus=10; + return; + } +} + +//======================================================================= +//function : CorrectWire +//purpose : +//======================================================================= +Standard_Boolean CorrectWire(const TopoDS_Wire& aW, + const TopoDS_Face& aF) +{ + Standard_Boolean bRet; + Standard_Real aTolInt; + Standard_Integer iErr, aNbV, aNbE; + TopoDS_Iterator aItW, aItE; + Geom2dInt_GInter aInter; + GEOMAlgo_DataMapOfShapeInfoEdge aDMEIE; + TopTools_DataMapOfShapeListOfShape aDMVLE; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMVLE; + // + bRet=Standard_False; + aTolInt=1.0e-10; + // + aItW.Initialize(aW); + for (; aItW.More(); aItW.Next()) { + const TopoDS_Edge& aE=*((TopoDS_Edge*)&aItW.Value()); + + aItE.Initialize(aE); + for (aNbV=0; aItE.More(); aItE.Next(), ++aNbV) { + } + if (aNbV<2) { + return bRet; // + } + // + if (!aDMEIE.IsBound(aE)) { + GEOMAlgo_InfoEdge aInfoEdge; + // + aInfoEdge.Init (aE, aF); + iErr=aInfoEdge.ErrorStatus(); + if (iErr) { + return bRet; // + } + // + aDMEIE.Bind(aE, aInfoEdge); + } + // + aItE.Initialize(aE); + for (; aItE.More(); aItE.Next()) { + const TopoDS_Shape& aV=aItE.Value(); + if (aDMVLE.IsBound(aV)) { + TopTools_ListOfShape& aLE=aDMVLE.ChangeFind(aV); + aLE.Append(aE); + } + else { + TopTools_ListOfShape aLE; + aLE.Append(aE); + aDMVLE.Bind(aV, aLE); + } + } + } + // + // 2 + Standard_Real aTolV, aD1, aD2, aDmax, aCoeff; + gp_Pnt aPV; + Handle(Geom_Surface) aS; + BRep_Builder aBB; + // + aCoeff=1.1; + aS=BRep_Tool::Surface(aF); + // + aItDMVLE.Initialize(aDMVLE); + for(; aItDMVLE.More(); aItDMVLE.Next()) { + const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aItDMVLE.Key()); + const TopTools_ListOfShape& aLE=aItDMVLE.Value(); + aNbE=aLE.Extent(); + if (aNbE!=2) { + continue; + } + // + aPV=BRep_Tool::Pnt(aV); + aTolV=BRep_Tool::Tolerance(aV); + // + const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aLE.First()); + const GEOMAlgo_InfoEdge& aIE1=aDMEIE.Find(aE1); + const Geom2dAdaptor_Curve& aGAC1=aIE1.Adaptor(); + const IntRes2d_Domain& aDomain1=aIE1.Domain(); + // + const TopoDS_Edge& aE2=*((TopoDS_Edge*)&aLE.Last()); + const GEOMAlgo_InfoEdge& aIE2=aDMEIE.Find(aE2); + const Geom2dAdaptor_Curve& aGAC2=aIE2.Adaptor(); + const IntRes2d_Domain& aDomain2=aIE2.Domain(); + // + aInter.Perform(aGAC1, aDomain1,aGAC2, aDomain2, aTolInt, aTolInt); + if(!aInter.IsDone()) { + continue; + } + // + Standard_Integer i, aNbP; + Standard_Real aIP_ParamOnFirst, aIP_ParamOnSecond, aDTresh, aDT; + gp_Pnt aP3D1, aP3D2; + gp_Pnt2d aP2D1, aP2D2; + IntRes2d_Transition aTr1, aTr2; + // + aDTresh=0.001; + // + aNbP=aInter.NbPoints(); + for (i=1; i<=aNbP; ++i) { + const IntRes2d_IntersectionPoint& aIP = aInter.Point(i); + aIP_ParamOnFirst = aIP.ParamOnFirst(); + aIP_ParamOnSecond = aIP.ParamOnSecond(); + aTr1 =aIP.TransitionOfFirst(); + aTr2 =aIP.TransitionOfSecond(); + if(aTr1.PositionOnCurve()==IntRes2d_Middle || + aTr2.PositionOnCurve()==IntRes2d_Middle) { + // + const Handle(Geom_Curve)& aC3D1=aIE1.Curve(); + if (!aC3D1.IsNull()) { + aP3D1=aC3D1->Value(aIP_ParamOnFirst); + } + else { + aP2D1=aGAC1.Value(aIP_ParamOnFirst); + aS->D0(aP2D1.X(), aP2D1.Y(), aP3D1); + } + // + const Handle(Geom_Curve)& aC3D2=aIE2.Curve(); + if (!aC3D2.IsNull()) { + aP3D2=aC3D2->Value(aIP_ParamOnSecond); + } + else { + aP2D2=aGAC2.Value(aIP_ParamOnSecond); + aS->D0(aP2D2.X(), aP2D2.Y(), aP3D2); + } + // + aD1=aPV.Distance(aP3D1); + aD2=aPV.Distance(aP3D2); + aDmax=(aD1>aD2)? aD1 : aD2; + if (aDmax>aCoeff*aTolV) { + //modified by NIZNHY-PKV Mon Jul 02 13:56:35 2012f + aDT=10.*aTolV; + if (aDT + +// File: GEOMAlgo_VertexSolid.cxx +// Created: Wed Jan 12 16:36:40 2005 +// Author: Peter KURNEV +// // -#include +#include #include @@ -59,7 +60,7 @@ //======================================================================= //function : GEOMAlgo_VertexSolid -//purpose : +//purpose : //======================================================================= GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid() : @@ -68,14 +69,14 @@ GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_VertexSolid::~GEOMAlgo_VertexSolid() { } //======================================================================= // function: Perform -// purpose: +// purpose: //======================================================================= void GEOMAlgo_VertexSolid::Perform() { @@ -103,7 +104,7 @@ void GEOMAlgo_VertexSolid::Perform() myRank=(aNbF) ? 2 : 1; // bIsNewFiller=myDSFiller->IsNewFiller(); - + if (bIsNewFiller) { Prepare(); myDSFiller->SetNewFiller(!bIsNewFiller); @@ -114,10 +115,10 @@ void GEOMAlgo_VertexSolid::Perform() catch (Standard_Failure) { myErrorStatus = 12; } -} +} //======================================================================= // function: Prepare -// purpose: +// purpose: //======================================================================= void GEOMAlgo_VertexSolid::Prepare() { @@ -134,16 +135,15 @@ void GEOMAlgo_VertexSolid::Prepare() BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*) &aIP; BOPTools_CArray1OfVVInterference& aVVs=pIP->VVInterferences(); const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller(); - BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF; - IntTools_Context& aCtx=pPF->ChangeContext(); + BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF; + const Handle(IntTools_Context)& aCtx=pPF->Context(); // const TopoDS_Shape& aObj=aDS.Object(); const TopoDS_Shape& aTool=aDS.Tool(); // const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj); - const TopoDS_Shape& aSV =(myRank==1)? aObj : aTool; // - BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aSolid); + BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); // iBeg=1; iEnd=aDS.NumberOfShapesOfTheObject(); @@ -162,8 +162,8 @@ void GEOMAlgo_VertexSolid::Prepare() // aState=aDS.GetState(i); if (aState==BooleanOperations_ON || - aState==BooleanOperations_IN || - aState==BooleanOperations_OUT) { + aState==BooleanOperations_IN || + aState==BooleanOperations_OUT) { continue; } // @@ -173,16 +173,16 @@ void GEOMAlgo_VertexSolid::Prepare() BOPTools_VVInterference& aVV=aVVs(j); aVV.Indices(n1, n2); if (n1==i || n2==i) { - pDS->SetState (n1, BooleanOperations_ON); - pDS->SetState (n2, BooleanOperations_ON); - iFound=1; - break; - } + pDS->SetState (n1, BooleanOperations_ON); + pDS->SetState (n2, BooleanOperations_ON); + iFound=1; + break; + } } if (iFound) { continue; } - // + // aP3D=BRep_Tool::Pnt(aV); aTol=1.E-7; aSC.Perform(aP3D, aTol); @@ -197,7 +197,7 @@ void GEOMAlgo_VertexSolid::Prepare() } //======================================================================= // function: BuildResult -// purpose: +// purpose: //======================================================================= void GEOMAlgo_VertexSolid::BuildResult() { diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx index 9514f5239..5e10a6060 100644 --- a/src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.hxx @@ -1,104 +1,58 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: GEOMAlgo_VertexSolid.hxx +// Created: Wed Jan 12 16:36:40 2005 +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_VertexSolid_HeaderFile #define _GEOMAlgo_VertexSolid_HeaderFile -#ifndef _GEOMAlgo_ShapeSolid_HeaderFile -#include -#endif - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_VertexSolid : public GEOMAlgo_ShapeSolid { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_VertexSolid(); -Standard_EXPORT virtual ~GEOMAlgo_VertexSolid(); - - -Standard_EXPORT virtual void Perform() ; - +#include +//======================================================================= +//class : GEOMAlgo_VertexSolid +//purpose : +//======================================================================= +class GEOMAlgo_VertexSolid : public GEOMAlgo_ShapeSolid +{ + public: + Standard_EXPORT + GEOMAlgo_VertexSolid(); + Standard_EXPORT + virtual ~GEOMAlgo_VertexSolid(); + Standard_EXPORT + virtual void Perform() ; protected: + Standard_EXPORT + virtual void Prepare() ; - // Methods PROTECTED - // - - -Standard_EXPORT virtual void Prepare() ; - - -Standard_EXPORT virtual void BuildResult() ; - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + Standard_EXPORT + virtual void BuildResult() ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx deleted file mode 100644 index 0ce665520..000000000 --- a/src/GEOMAlgo/GEOMAlgo_VertexSolid.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx deleted file mode 100644 index 9a546c6e5..000000000 --- a/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_VertexSolid_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cdl b/src/GEOMAlgo/GEOMAlgo_WESCorrector.cdl deleted file mode 100755 index 7b433dd10..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cdl +++ /dev/null @@ -1,83 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_WESCorrector.cdl --- Created: --- Author: Peter KURNEV --- -class WESCorrector from GEOMAlgo - inherits Algo from GEOMAlgo - - ---Purpose: - --- The algorithm to change the Wire Edges Set (WES) contents. - -- The NewWES will contain only wires instead of wires and edges. - -- -uses - WireEdgeSet from GEOMAlgo, - PWireEdgeSet from GEOMAlgo, - ListOfConnexityBlock from BOP - -is - Create - returns WESCorrector from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_WESCorrector();" - ---Purpose: - -- Empty constructor; - -- - - SetWES (me:out; - aWES: WireEdgeSet from GEOMAlgo); - ---Purpose: - -- Modifier - -- - Perform (me:out) - is redefined; - ---Purpose: - --- Performs the algorithm that consists of two steps - --- 1. Make conexity blocks ( DoConnexityBlocks() ) - --- 2. Make corrections ( DoCorrections() ) - --- - - WES (me:out) - returns WireEdgeSet from GEOMAlgo; - ---C++: return & - ---Purpose: - --- Selector - --- - NewWES (me:out) - returns WireEdgeSet from GEOMAlgo; - ---C++: return & - ---Purpose: - --- Selector - --- - DoConnexityBlocks(me:out) - is protected; - - DoCorrections(me:out) - is protected; - -fields - - myWES : PWireEdgeSet from GEOMAlgo is protected; - myNewWES : WireEdgeSet from GEOMAlgo is protected; - myConnexityBlocks : ListOfConnexityBlock from BOP is protected; - -end WESCorrector; diff --git a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx b/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx index b56d73ced..83fea18f7 100755 --- a/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WESCorrector.cxx @@ -1,32 +1,35 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTAlgo_WESCorrector.cxx -// Created: -// Author: Peter KURNEV -// -// -#include +// File: NMTAlgo_WESCorrector.cxx +// Author: Peter KURNEV + +#include + +#include + +#include #include + #include #include #include @@ -34,6 +37,7 @@ #include #include +#include #include #include @@ -52,15 +56,20 @@ #include #include #include +#include + +static + void MakeWire(const TopTools_ListOfShape& aLE, + TopoDS_Wire& newWire); static - void MakeWire(const TopTools_ListOfShape& aLE, - TopoDS_Wire& newWire); + Standard_Boolean IsToScale(const TopoDS_Face& aF, + Standard_Real& aScale); //======================================================================= -// function: -// purpose: +// function: +// purpose: //======================================================================= GEOMAlgo_WESCorrector::GEOMAlgo_WESCorrector() : @@ -69,14 +78,14 @@ static } //======================================================================= // function: ~ -// purpose: +// purpose: //======================================================================= GEOMAlgo_WESCorrector::~GEOMAlgo_WESCorrector() { } //======================================================================= // function: SetWES -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WESCorrector::SetWES (const GEOMAlgo_WireEdgeSet& aWES) { @@ -85,23 +94,23 @@ static } //======================================================================= // function: WES -// purpose: +// purpose: //======================================================================= - GEOMAlgo_WireEdgeSet& GEOMAlgo_WESCorrector::WES () + GEOMAlgo_WireEdgeSet& GEOMAlgo_WESCorrector::WES () { return *myWES; } //======================================================================= // function: NewWES -// purpose: +// purpose: //======================================================================= - GEOMAlgo_WireEdgeSet& GEOMAlgo_WESCorrector::NewWES () + GEOMAlgo_WireEdgeSet& GEOMAlgo_WESCorrector::NewWES () { return myNewWES; } //======================================================================= // function: Perform -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WESCorrector::Perform() { @@ -112,7 +121,7 @@ static } //======================================================================= // function: DoConnexityBlocks -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WESCorrector::DoConnexityBlocks() { @@ -139,7 +148,7 @@ static } } // - // 2. + // 2. aNbV=aMVE.Extent(); for (i=1; i<=aNbV; ++i) { const TopoDS_Shape& aV=aMVE.FindKey(i); @@ -156,7 +165,7 @@ static // //------------------------------------- goal: aMEC aMEC.Clear(); // aMEC - edges of CB - aMVP.Clear(); // aMVP - vertices to process right now + aMVP.Clear(); // aMVP - vertices to process right now aMVAdd.Clear(); // aMVAdd vertices to process on next step of while(1) // aMVP.Add(aV); @@ -164,36 +173,36 @@ static while(1) { aNbVP=aMVP.Extent(); for (j=1; j<=aNbVP; ++j) { - const TopoDS_Shape& aVP=aMVP(j); - const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aVP); - aIt.Initialize(aLE); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aE=aIt.Value(); - if (aMEC.Contains(aE)) { - continue; - } - aMEC.Add(aE); - // - aItE.Initialize(aE); - for (; aItE.More(); aItE.Next()) { - const TopoDS_Shape& aVE=aItE.Value(); - if (!aMVS.Contains(aVE)) { - aMVS.Add(aVE); - aMVAdd.Add(aVE); - } - } - } - }//for (j=1; j<=aNbVP; ++j) + const TopoDS_Shape& aVP=aMVP(j); + const TopTools_ListOfShape& aLE=aMVE.FindFromKey(aVP); + aIt.Initialize(aLE); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE=aIt.Value(); + if (aMEC.Contains(aE)) { + continue; + } + aMEC.Add(aE); + // + aItE.Initialize(aE); + for (; aItE.More(); aItE.Next()) { + const TopoDS_Shape& aVE=aItE.Value(); + if (!aMVS.Contains(aVE)) { + aMVS.Add(aVE); + aMVAdd.Add(aVE); + } + } + } + }//for (j=1; j<=aNbVP; ++j) // aNbVP=aMVAdd.Extent(); if (!aNbVP) { - break; // from while(1) + break; // from while(1) } // aMVP.Clear(); for (j=1; j<=aNbVP; ++j) { - const TopoDS_Shape& aVE=aMVAdd(j); - aMVP.Add(aVE); + const TopoDS_Shape& aVE=aMVAdd(j); + aMVP.Add(aVE); } aMVAdd.Clear(); }// while(1) { @@ -203,30 +212,28 @@ static TopTools_IndexedDataMapOfShapeListOfShape aMVER; // bRegular=Standard_True; - + // aNbC=aMEC.Extent(); for (j=1; j<=aNbC; ++j) { aER=aMEC(j); // if (aMER.Contains(aER)) { - aER.Orientation(TopAbs_FORWARD); - aLEC.Append(aER); - aER.Orientation(TopAbs_REVERSED); - aLEC.Append(aER); - // - //modified by NIZNHY-PKV Tue Nov 28 12:02:29 2006f - //bClosed=BRep_Tool::IsClosed(TopoDS::Edge(aER), myWES->Face()); - //if (!bClosed) { - bRegular=Standard_False; - //} - //modified by NIZNHY-PKV Tue Nov 28 12:02:33 2006t + aER.Orientation(TopAbs_FORWARD); + aLEC.Append(aER); + aER.Orientation(TopAbs_REVERSED); + aLEC.Append(aER); + // + bRegular=Standard_False; } else { - aLEC.Append(aER); + aLEC.Append(aER); } // if (bRegular) { - TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER); + const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aER); + if (!BRep_Tool::Degenerated(aEx)) { + TopExp::MapShapesAndAncestors(aER, TopAbs_VERTEX, TopAbs_EDGE, aMVER); + } } }//for (j=1; j<=aNbC; ++j) { // @@ -235,20 +242,20 @@ static // aNbVR=aMVER.Extent(); for (k=1; k<=aNbVR; ++k) { - const TopTools_ListOfShape& aLER=aMVER(k); - aNbER=aLER.Extent(); - if (aNbER==1) { - const TopoDS_Edge& aEx=TopoDS::Edge(aER); - bClosed=BRep_Tool::IsClosed(aEx, myWES->Face()); - if (!bClosed) { - bRegular=!bRegular; - break; - } - } - if (aNbER>2) { - bRegular=!bRegular; - break; - } + const TopTools_ListOfShape& aLER=aMVER(k); + aNbER=aLER.Extent(); + if (aNbER==1) { + const TopoDS_Edge& aEx=TopoDS::Edge(aER); + bClosed=BRep_Tool::IsClosed(aEx, myWES->Face()); + if (!bClosed) { + bRegular=!bRegular; + break; + } + } + if (aNbER>2) { + bRegular=!bRegular; + break; + } } } // @@ -261,25 +268,28 @@ static //======================================================================= // function: DoCorrections -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WESCorrector::DoCorrections() { - Standard_Boolean bIsRegular, bIsNothingToDo; + Standard_Boolean bIsRegular, bIsNothingToDo, bToScale; Standard_Integer iErr; + Standard_Real aScale; TopoDS_Wire aW; BOP_ListIteratorOfListOfConnexityBlock aCBIt; + GEOMAlgo_WESScaler aWSC; // const TopoDS_Face& aF=myWES->Face(); // + bToScale=IsToScale(aF, aScale); + // myNewWES.SetFace(aF); aCBIt.Initialize(myConnexityBlocks); for (; aCBIt.More(); aCBIt.Next()) { const BOP_ConnexityBlock& aCB=aCBIt.Value(); const TopTools_ListOfShape& aLE=aCB.Shapes(); - + // bIsRegular=aCB.IsRegular(); - if (bIsRegular) { MakeWire(aLE, aW); myNewWES.AddShape (aW); @@ -288,38 +298,93 @@ static // GEOMAlgo_WireSplitter aWS; // - aWS.SetFace(aF); - aWS.SetEdges(aLE); - // - aWS.Perform(); - iErr=aWS.ErrorStatus(); - if (iErr) { - continue; - } - bIsNothingToDo=aWS.IsNothingToDo(); - if (bIsNothingToDo) { - MakeWire(aLE, aW); - myNewWES.AddShape (aW); - continue; - } + if(bToScale) { + TopoDS_Shape aE; + TopTools_ListIteratorOfListOfShape aIt; + BOPTColStd_ListIteratorOfListOfListOfShape aItLLSS; + // + aWSC.SetScale(aScale); + aWSC.SetFace(aF); + aWSC.SetEdges(aLE); + // + aWSC.Perform(); + iErr=aWSC.ErrorStatus(); + if (iErr) { + return; + } + // + const TopoDS_Face& aFS=aWSC.FaceScaled(); + const TopTools_ListOfShape& aLES=aWSC.EdgesScaled(); + // + aWS.SetFace(aFS); + aWS.SetEdges(aLES); + // + aWS.Perform(); + iErr=aWS.ErrorStatus(); + if (iErr) { + continue; + } + // + bIsNothingToDo=aWS.IsNothingToDo(); + if (bIsNothingToDo) { + MakeWire(aLE, aW); + myNewWES.AddShape (aW); + continue; + } + // + const BOPTColStd_ListOfListOfShape& aLLSS=aWS.Shapes(); + aItLLSS.Initialize(aLLSS); + for (; aItLLSS.More(); aItLLSS.Next()) { + TopTools_ListOfShape aLS; + // + const TopTools_ListOfShape& aLSS=aItLLSS.Value(); + aIt.Initialize(aLSS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aES=aIt.Value(); + aE=aWSC.Origin(aES); + aLS.Append(aE); + } + // + MakeWire(aLS, aW); + myNewWES.AddShape (aW); + } + }//if(bToScale) // - const BOPTColStd_ListOfListOfShape& aSSS=aWS.Shapes(); - - BOPTColStd_ListIteratorOfListOfListOfShape aWireIt(aSSS); - for (; aWireIt.More(); aWireIt.Next()) { - const TopTools_ListOfShape& aLEx=aWireIt.Value(); + else { + aWS.SetFace(aF); + aWS.SetEdges(aLE); // - MakeWire(aLEx, aW); - myNewWES.AddShape (aW); - } + aWS.Perform(); + iErr=aWS.ErrorStatus(); + if (iErr) { + continue; + } + bIsNothingToDo=aWS.IsNothingToDo(); + if (bIsNothingToDo) { + MakeWire(aLE, aW); + myNewWES.AddShape (aW); + continue; + } + // + const BOPTColStd_ListOfListOfShape& aSSS=aWS.Shapes(); + // + BOPTColStd_ListIteratorOfListOfListOfShape aWireIt(aSSS); + for (; aWireIt.More(); aWireIt.Next()) { + const TopTools_ListOfShape& aLEx=aWireIt.Value(); + // + MakeWire(aLEx, aW); + myNewWES.AddShape (aW); + } + }// else } } + //======================================================================= // function: MakeWire -// purpose: +// purpose: //======================================================================= - void MakeWire(const TopTools_ListOfShape& aLE, - TopoDS_Wire& newWire) + void MakeWire(const TopTools_ListOfShape& aLE, + TopoDS_Wire& newWire) { BRep_Builder aBB; aBB.MakeWire(newWire); @@ -330,3 +395,35 @@ static aBB.Add(newWire, aE); } } + +//======================================================================= +//function : IsToScale +//purpose : +//======================================================================= +Standard_Boolean IsToScale(const TopoDS_Face& aF, + Standard_Real& aScale) +{ + Standard_Boolean bRet; + Standard_Real aV1, aV2, dV, aTr; + GeomAbs_SurfaceType aType; + BRepAdaptor_Surface aBAS; + // + bRet=Standard_False; + aScale=1.; + // + aBAS.Initialize(aF); + aType=aBAS.GetType(); + if (aType==GeomAbs_Cylinder) { + aTr=1.e5; + aV1=aBAS.FirstVParameter(); + aV2=aBAS.LastVParameter(); + dV=aV2-aV1; + // + if (dV>aTr) { + bRet=!bRet; + aScale=1./aTr; + return bRet; + } + } + return bRet; +} diff --git a/src/GEOMAlgo/GEOMAlgo_WESCorrector.hxx b/src/GEOMAlgo/GEOMAlgo_WESCorrector.hxx index 4fef49e1a..8348935fc 100644 --- a/src/GEOMAlgo/GEOMAlgo_WESCorrector.hxx +++ b/src/GEOMAlgo/GEOMAlgo_WESCorrector.hxx @@ -1,136 +1,87 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + +// Copyright (C) 2007-2012 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 // -// 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// File: NMTAlgo_WESCorrector.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _GEOMAlgo_WESCorrector_HeaderFile #define _GEOMAlgo_WESCorrector_HeaderFile -#ifndef _GEOMAlgo_PWireEdgeSet_HeaderFile +#include +#include #include -#endif -#ifndef _GEOMAlgo_WireEdgeSet_HeaderFile #include -#endif -#ifndef _BOP_ListOfConnexityBlock_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Algo_HeaderFile #include -#endif -class GEOMAlgo_WireEdgeSet; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif //! The algorithm to change the Wire Edges Set (WES) contents.
    //! The NewWES will contain only wires instead of wires and edges.
    -class GEOMAlgo_WESCorrector : public GEOMAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -//! Empty constructor;
    -//!
    -Standard_EXPORT GEOMAlgo_WESCorrector(); -Standard_EXPORT virtual ~GEOMAlgo_WESCorrector(); - - -//! Modifier
    -Standard_EXPORT void SetWES(const GEOMAlgo_WireEdgeSet& aWES) ; - - -//! Performs the algorithm that consists of two steps
    -//! 1. Make conexity blocks ( DoConnexityBlocks() )
    -//! 2. Make corrections ( DoCorrections() )
    -Standard_EXPORT virtual void Perform() ; - - -//! Selector
    -Standard_EXPORT GEOMAlgo_WireEdgeSet& WES() ; - - -//! Selector
    -Standard_EXPORT GEOMAlgo_WireEdgeSet& NewWES() ; - - - - +//======================================================================= +//class : GEOMAlgo_WESCorrector +//purpose : +//======================================================================= +class GEOMAlgo_WESCorrector : public GEOMAlgo_Algo +{ + public: + //! Empty constructor;
    + //!
    + Standard_EXPORT + GEOMAlgo_WESCorrector(); + + Standard_EXPORT + virtual ~GEOMAlgo_WESCorrector(); + + //! Modifier
    + Standard_EXPORT + void SetWES(const GEOMAlgo_WireEdgeSet& aWES) ; + + //! Performs the algorithm that consists of two steps
    + //! 1. Make conexity blocks ( DoConnexityBlocks() )
    + //! 2. Make corrections ( DoCorrections() )
    + Standard_EXPORT + virtual void Perform() ; + + //! Selector
    + Standard_EXPORT + GEOMAlgo_WireEdgeSet& WES() ; + + //! Selector
    + Standard_EXPORT + GEOMAlgo_WireEdgeSet& NewWES() ; protected: + Standard_EXPORT + void DoConnexityBlocks() ; - // Methods PROTECTED - // - - -Standard_EXPORT void DoConnexityBlocks() ; - - -Standard_EXPORT void DoCorrections() ; - - - // Fields PROTECTED - // -GEOMAlgo_PWireEdgeSet myWES; -GEOMAlgo_WireEdgeSet myNewWES; -BOP_ListOfConnexityBlock myConnexityBlocks; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + void DoCorrections() ; + GEOMAlgo_PWireEdgeSet myWES; + GEOMAlgo_WireEdgeSet myNewWES; + BOP_ListOfConnexityBlock myConnexityBlocks; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_WESCorrector.ixx b/src/GEOMAlgo/GEOMAlgo_WESCorrector.ixx deleted file mode 100644 index 3e166ac8b..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WESCorrector.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_WESCorrector.jxx b/src/GEOMAlgo/GEOMAlgo_WESCorrector.jxx deleted file mode 100644 index 0b46e1d00..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WESCorrector.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_WireEdgeSet_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_WESCorrector_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WESScaler.cxx b/src/GEOMAlgo/GEOMAlgo_WESScaler.cxx new file mode 100644 index 000000000..aea8c7fad --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WESScaler.cxx @@ -0,0 +1,267 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_WESScaler.cxx +// Created: +// Author: +// + + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_WESScaler::GEOMAlgo_WESScaler() +: + GEOMAlgo_Algo() +{ + myScale=1.; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_WESScaler::~GEOMAlgo_WESScaler() +{ +} +//======================================================================= +// function: SetScale +// purpose: +//======================================================================= + void GEOMAlgo_WESScaler::SetScale (const Standard_Real aScale) +{ + myScale=aScale; +} +//======================================================================= +// function: Scale +// purpose: +//======================================================================= + Standard_Real GEOMAlgo_WESScaler::Scale()const +{ + return myScale; +} +//======================================================================= +// function: SetFace +// purpose: +//======================================================================= + void GEOMAlgo_WESScaler::SetFace(const TopoDS_Face& aF) +{ + myFace=aF; +} +//======================================================================= +// function: Face +// purpose: +//======================================================================= + const TopoDS_Face& GEOMAlgo_WESScaler::Face()const +{ + return myFace; +} +//======================================================================= +// function: SetEdges +// purpose: +//======================================================================= + void GEOMAlgo_WESScaler::SetEdges(const TopTools_ListOfShape& aLE) +{ + myEdges=aLE; +} +//======================================================================= +// function: Edges +// purpose: +//======================================================================= + const TopTools_ListOfShape& GEOMAlgo_WESScaler::Edges()const +{ + return myEdges; +} +//======================================================================= +// function: FaceScaled +// purpose: +//======================================================================= + const TopoDS_Face& GEOMAlgo_WESScaler::FaceScaled()const +{ + return myFaceScaled; +} +//======================================================================= +// function: EdgesScaled +// purpose: +//======================================================================= + const TopTools_ListOfShape& GEOMAlgo_WESScaler::EdgesScaled()const +{ + return myEdgesScaled; +} +//======================================================================= +// function: Image +// purpose: +//======================================================================= + const TopoDS_Shape& GEOMAlgo_WESScaler::Image (const TopoDS_Shape& aS) const +{ + if (myImages.IsBound(aS)) { + return myImages.Find(aS); + } + return myShapeTmp; +} +//======================================================================= +// function: Origin +// purpose: +//======================================================================= + const TopoDS_Shape& GEOMAlgo_WESScaler::Origin (const TopoDS_Shape& aS) const +{ + if (myOrigins.IsBound(aS)) { + return myOrigins.Find(aS); + } + return myShapeTmp; +} +//======================================================================= +// function: Images +// purpose: +//======================================================================= + const GEOMAlgo_DataMapOfOrientedShapeShape& GEOMAlgo_WESScaler::Images () const +{ + return myImages; +} +//======================================================================= +// function: Origins +// purpose: +//======================================================================= + const GEOMAlgo_DataMapOfOrientedShapeShape& GEOMAlgo_WESScaler::Origins () const +{ + return myOrigins; +} +//======================================================================= +// function: CheckData +// purpose: +//======================================================================= + void GEOMAlgo_WESScaler::CheckData() +{ + myErrorStatus=0; + // + if(myFace.IsNull()) { + myErrorStatus=2; + return; + } + if(!myEdges.Extent()) { + myErrorStatus=3; + return; + } + if (myScale<=0.){ + myErrorStatus=4; + } +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= + void GEOMAlgo_WESScaler::Perform() +{ + Standard_Boolean bIsDone; + Standard_Integer i; + gp_Pnt aP; + gp_Trsf aTrsf; + TopAbs_Orientation aOr; + TopoDS_Shape aFC, aFR, aER; + TopoDS_Wire aWE; + TopoDS_Iterator aItS; + BRep_Builder aBB; + TopTools_ListIteratorOfListOfShape aIt; + // + // 0. CheckData + CheckData(); + if(myErrorStatus) { + return; + } + // + myImages.Clear(); + myOrigins.Clear(); + myEdgesScaled.Clear(); + // + // 1. aFC + aFC=myFace.EmptyCopied(); + // + aBB.MakeWire(aWE); + aIt.Initialize(myEdges); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE=aIt.Value(); + aBB.Add(aWE, aE); + } + aBB.Add(aFC, aWE); + // + aItS.Initialize(myFace); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aW=aItS.Value(); + aBB.Add(aFC, aW); + } + // + // 2. Scale aFC + aP.SetCoord(0.,0.,0.); + aTrsf.SetScale(aP, myScale); + // + BRepBuilderAPI_Transform aBT(aTrsf); + aBT.Perform(aFC); + bIsDone=aBT.IsDone(); + if (!bIsDone) { + myErrorStatus=10; + return; + } + // + const TopoDS_Shape& aSR=aBT.Shape(); + // + // Refined image face FR + aFR=aSR.EmptyCopied(); + aItS.Initialize(aSR); + for (i=0; aItS.More(); aItS.Next(),++i) { + const TopoDS_Shape& aWR=aItS.Value(); + if (i) { + aBB.Add(aFR, aWR); + } + } + myFaceScaled=*((TopoDS_Face*)&aFR); + // + // 3. Fill Images, Origins, EdgesScaled + aIt.Initialize(myEdges); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE=aIt.Value(); + aOr=aE.Orientation(); + // + aER=aBT.ModifiedShape(aE); + if(aER.IsNull()) { + myErrorStatus=11; + return; + } + // + aER.Orientation(aOr); + myImages.Bind(aE, aER); + myOrigins.Bind(aER, aE); + // + myEdgesScaled.Append(aER); + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_WESScaler.hxx b/src/GEOMAlgo/GEOMAlgo_WESScaler.hxx new file mode 100644 index 000000000..bd1d1d5ee --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WESScaler.hxx @@ -0,0 +1,110 @@ +// Copyright (C) 2007-2012 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 +// +// File: GEOMAlgo_WESScaler.hxx +// Created: +// Author: +// + +#ifndef _GEOMAlgo_WESScaler_HeaderFile +#define _GEOMAlgo_WESScaler_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_WESScaler +//purpose : +//======================================================================= +class GEOMAlgo_WESScaler : public GEOMAlgo_Algo +{ +public: + //! Empty constructor
    + Standard_EXPORT + GEOMAlgo_WESScaler(); + + Standard_EXPORT + virtual ~GEOMAlgo_WESScaler(); + + //! Modifier
    + Standard_EXPORT + void SetScale(const Standard_Real aWES) ; + + //! Selector
    + Standard_EXPORT + Standard_Real Scale() const; + + Standard_EXPORT + void SetFace(const TopoDS_Face& aF) ; + + Standard_EXPORT + const TopoDS_Face& Face() const; + + Standard_EXPORT + void SetEdges(const TopTools_ListOfShape& aLE) ; + + Standard_EXPORT + const TopTools_ListOfShape& Edges() const; + + //! Performs the algorithm
    + Standard_EXPORT + virtual void Perform() ; + + Standard_EXPORT + const TopoDS_Face& FaceScaled() const; + + Standard_EXPORT + const TopTools_ListOfShape& EdgesScaled() const; + + Standard_EXPORT + const TopoDS_Shape& Image(const TopoDS_Shape& aS) const; + + Standard_EXPORT + const TopoDS_Shape& Origin(const TopoDS_Shape& aS) const; + + //! Selector
    + Standard_EXPORT + const GEOMAlgo_DataMapOfOrientedShapeShape& Images() const; + + //! Selector
    + Standard_EXPORT + const GEOMAlgo_DataMapOfOrientedShapeShape& Origins() const; + + protected: + + //! Performs the algorithm
    + Standard_EXPORT virtual void CheckData() ; + + + Standard_Real myScale; + TopoDS_Face myFace; + TopTools_ListOfShape myEdges; + TopoDS_Face myFaceScaled; + TopTools_ListOfShape myEdgesScaled; + GEOMAlgo_DataMapOfOrientedShapeShape myImages; + GEOMAlgo_DataMapOfOrientedShapeShape myOrigins; + TopoDS_Shape myShapeTmp; +}; + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.cdl b/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.cdl deleted file mode 100755 index 89153b277..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.cdl +++ /dev/null @@ -1,69 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_WireEdgeSet.cdl --- Created: --- Author: Peter KURNEV --- --- -class WireEdgeSet from GEOMAlgo - - ---Purpose: - -uses - Face from TopoDS, - Shape from TopoDS, - ListOfShape from TopTools ---raises - -is - Create - returns WireEdgeSet from GEOMAlgo; - - Clear(me:out); - - SetFace(me:out; - aF:Face from TopoDS); - - Face(me) - returns Face from TopoDS; - ---C++: return const & - - AddStartElement(me:out; - sS: Shape from TopoDS); - - StartElements(me) - returns ListOfShape from TopTools; - ---C++: return const & - - AddShape(me:out; - sS:Shape from TopoDS); - - Shapes(me) - returns ListOfShape from TopTools; - ---C++: return const & - -fields - myFace : Face from TopoDS is protected; - myStartShapes : ListOfShape from TopTools is protected; - myShapes : ListOfShape from TopTools is protected; - -end WireEdgeSet; diff --git a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.cxx b/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.cxx index 8e5936281..5a39f0e10 100755 --- a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.cxx @@ -1,34 +1,35 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_WireEdgeSet.cxx -// Created: -// Author: Peter KURNEV -// + +// File: GEOMAlgo_WireEdgeSet.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= GEOMAlgo_WireEdgeSet::GEOMAlgo_WireEdgeSet() { @@ -37,7 +38,7 @@ //======================================================================= //function : Clear -//purpose : +//purpose : //======================================================================= void GEOMAlgo_WireEdgeSet::Clear() { @@ -46,7 +47,7 @@ } //======================================================================= //function : SetFace -//purpose : +//purpose : //======================================================================= void GEOMAlgo_WireEdgeSet::SetFace(const TopoDS_Face& aF) { @@ -54,15 +55,15 @@ } //======================================================================= //function : Face -//purpose : +//purpose : //======================================================================= - const TopoDS_Face& GEOMAlgo_WireEdgeSet::Face()const + const TopoDS_Face& GEOMAlgo_WireEdgeSet::Face()const { return myFace; } //======================================================================= //function : AddStartElement -//purpose : +//purpose : //======================================================================= void GEOMAlgo_WireEdgeSet::AddStartElement(const TopoDS_Shape& aE) { @@ -70,7 +71,7 @@ } //======================================================================= //function : StartElements -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_WireEdgeSet::StartElements()const { @@ -78,7 +79,7 @@ } //======================================================================= //function : AddShape -//purpose : +//purpose : //======================================================================= void GEOMAlgo_WireEdgeSet::AddShape(const TopoDS_Shape& aW) { @@ -86,7 +87,7 @@ } //======================================================================= //function : Shapes -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& GEOMAlgo_WireEdgeSet::Shapes()const { diff --git a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.hxx b/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.hxx index 3025b44f5..97708870e 100644 --- a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.hxx +++ b/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.hxx @@ -1,124 +1,73 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef _GEOMAlgo_WireEdgeSet_HeaderFile -#define _GEOMAlgo_WireEdgeSet_HeaderFile -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -class TopoDS_Face; -class TopoDS_Shape; -class TopTools_ListOfShape; +// File: GEOMAlgo_WireEdgeSet.hxx +// Created: +// Author: Peter KURNEV +// +// +#ifndef _GEOMAlgo_WireEdgeSet_HeaderFile +#define _GEOMAlgo_WireEdgeSet_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - +#include +#include +#include +//======================================================================= +//function : GEOMAlgo_WireEdgeSet +//purpose : +//======================================================================= class GEOMAlgo_WireEdgeSet { + public: + Standard_EXPORT + GEOMAlgo_WireEdgeSet(); -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_WireEdgeSet(); - - -Standard_EXPORT void Clear() ; - - -Standard_EXPORT void SetFace(const TopoDS_Face& aF) ; - - -Standard_EXPORT const TopoDS_Face& Face() const; - + Standard_EXPORT + void Clear() ; -Standard_EXPORT void AddStartElement(const TopoDS_Shape& sS) ; + Standard_EXPORT + void SetFace(const TopoDS_Face& aF) ; + Standard_EXPORT + const TopoDS_Face& Face() const; -Standard_EXPORT const TopTools_ListOfShape& StartElements() const; - - -Standard_EXPORT void AddShape(const TopoDS_Shape& sS) ; - - -Standard_EXPORT const TopTools_ListOfShape& Shapes() const; - + Standard_EXPORT + void AddStartElement(const TopoDS_Shape& sS) ; + Standard_EXPORT + const TopTools_ListOfShape& StartElements() const; + Standard_EXPORT + void AddShape(const TopoDS_Shape& sS) ; + Standard_EXPORT + const TopTools_ListOfShape& Shapes() const; protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopoDS_Face myFace; -TopTools_ListOfShape myStartShapes; -TopTools_ListOfShape myShapes; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + TopoDS_Face myFace; + TopTools_ListOfShape myStartShapes; + TopTools_ListOfShape myShapes; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.ixx b/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.ixx deleted file mode 100644 index 68e641785..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.jxx b/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.jxx deleted file mode 100644 index 1c8f96a17..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireEdgeSet.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_WireEdgeSet_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl b/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl deleted file mode 100644 index 3079bb44a..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl +++ /dev/null @@ -1,49 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_WireSolid.cdl --- Created: Wed Jan 12 10:17:00 2005 --- Author: Peter KURNEV - -class WireSolid from GEOMAlgo - inherits ShapeSolid from GEOMAlgo - ---Purpose: - ---uses ---raises - -is - Create - returns WireSolid from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_WireSolid();" - - Perform (me:out) - is redefined; - - Prepare(me:out) - is redefined protected; - - BuildResult (me:out) - is redefined protected; - ---fields - -end WireSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx index 62c3f4e20..3acfda53c 100644 --- a/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_WireSolid.cxx -// Created: Wed Jan 12 10:19:31 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_WireSolid.cxx +// Created: Wed Jan 12 10:19:31 2005 +// Author: Peter KURNEV +// // -#include +#include #include @@ -46,23 +47,23 @@ //======================================================================= //function : GEOMAlgo_WireSolid -//purpose : +//purpose : //======================================================================= GEOMAlgo_WireSolid::GEOMAlgo_WireSolid() -: +: GEOMAlgo_ShapeSolid() { } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_WireSolid::~GEOMAlgo_WireSolid() { } //======================================================================= // function: Perform -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WireSolid::Perform() { @@ -81,7 +82,7 @@ void GEOMAlgo_WireSolid::Perform() Standard_Boolean bIsNewFiller; // bIsNewFiller=myDSFiller->IsNewFiller(); - + if (bIsNewFiller) { Prepare(); myDSFiller->SetNewFiller(!bIsNewFiller); @@ -92,10 +93,10 @@ void GEOMAlgo_WireSolid::Perform() catch (Standard_Failure) { myErrorStatus= 12; } -} +} //======================================================================= // function: Prepare -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WireSolid::Prepare() { @@ -107,7 +108,7 @@ void GEOMAlgo_WireSolid::Prepare() } //======================================================================= // function: BuildResult -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WireSolid::BuildResult() { @@ -138,34 +139,34 @@ void GEOMAlgo_WireSolid::BuildResult() aNbPB=aLPB.Extent(); // if (!aNbPB) { - aState=aDS.GetState(i); - // - if (aState==BooleanOperations_IN) { - myLSIN.Append(aE); - } - else if (aState==BooleanOperations_OUT) { - myLSOUT.Append(aE); - } - else if (aState==BooleanOperations_ON) { - myLSON.Append(aE); - } + aState=aDS.GetState(i); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aE); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aE); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aE); + } } // else if (aNbPB==1) { - const BOPTools_PaveBlock& aPB=aLPB.First(); - nSp=aPB.Edge(); - const TopoDS_Shape& aSp=aDS.Shape(nSp); - aState=aDS.GetState(nSp); - // - if (aState==BooleanOperations_IN) { - myLSIN.Append(aE); - } - else if (aState==BooleanOperations_OUT) { - myLSOUT.Append(aE); - } - else if (aState==BooleanOperations_ON) { - myLSON.Append(aE); - } + const BOPTools_PaveBlock& aPB=aLPB.First(); + nSp=aPB.Edge(); + /*const TopoDS_Shape& aSp=*/aDS.Shape(nSp); + aState=aDS.GetState(nSp); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aE); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aE); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aE); + } } } } diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.hxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.hxx index 58af52ede..93a5463ed 100644 --- a/src/GEOMAlgo/GEOMAlgo_WireSolid.hxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.hxx @@ -1,104 +1,58 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef _GEOMAlgo_WireSolid_HeaderFile -#define _GEOMAlgo_WireSolid_HeaderFile -#ifndef _GEOMAlgo_ShapeSolid_HeaderFile -#include -#endif +// File: GEOMAlgo_WireSolid.hxx +// Created: Wed Jan 12 10:19:31 2005 +// Author: Peter KURNEV +// +#ifndef _GEOMAlgo_WireSolid_HeaderFile +#define _GEOMAlgo_WireSolid_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class GEOMAlgo_WireSolid : public GEOMAlgo_ShapeSolid { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_WireSolid(); -Standard_EXPORT virtual ~GEOMAlgo_WireSolid(); - - -Standard_EXPORT virtual void Perform() ; - - - - - -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT virtual void Prepare() ; - - -Standard_EXPORT virtual void BuildResult() ; - - - // Fields PROTECTED - // - - -private: +#include - // Methods PRIVATE - // +//======================================================================= +//class : GEOMAlgo_WireSolid +//purpose : +//======================================================================= +class GEOMAlgo_WireSolid : public GEOMAlgo_ShapeSolid +{ + public: + Standard_EXPORT + GEOMAlgo_WireSolid(); + Standard_EXPORT + virtual ~GEOMAlgo_WireSolid(); - // Fields PRIVATE - // + Standard_EXPORT + virtual void Perform() ; + protected: + Standard_EXPORT + virtual void Prepare() ; + Standard_EXPORT + virtual void BuildResult() ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.ixx b/src/GEOMAlgo/GEOMAlgo_WireSolid.ixx deleted file mode 100644 index 32aa1fbfd..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireSolid.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx deleted file mode 100644 index cba4ece22..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _GEOMAlgo_WireSolid_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cdl b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cdl deleted file mode 100755 index a5da76898..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cdl +++ /dev/null @@ -1,88 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: GEOMAlgo_WireSplitter.cdl --- Created: --- Author: Peter KURNEV --- --- -class WireSplitter from GEOMAlgo - inherits Algo from GEOMAlgo - - ---Purpose: - --- the algorithm to split multiconnexed set of edges - --- wires on a face onto simple connexed wires - --- . -uses - Face from TopoDS, - Vertex from TopoDS, - Edge from TopoDS, - - SequenceOfPnt2d from TColgp, - SequenceOfShape from TopTools, - ListOfShape from TopTools, - - ListOfListOfShape from BOPTColStd, - - EdgeInfo from BOP, - IndexedDataMapOfVertexListEdgeInfo from BOP - ---raises - -is - Create - returns WireSplitter from GEOMAlgo; - ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_WireSplitter();" - - SetFace (me:out; - aF: Face from TopoDS); - - SetEdges (me:out; - aLE:ListOfShape from TopTools); - - Edges (me) - returns ListOfShape from TopTools; - ---C++: return const & - - Perform (me:out) - is redefined; - - IsNothingToDo (me) - returns Boolean from Standard; - - Face (me) - returns Face from TopoDS; - ---C++: return const & - - Shapes (me) - returns ListOfListOfShape from BOPTColStd; - ---C++: return const & - -fields - myFace : Face from TopoDS is protected; - myIsDone : Boolean from Standard is protected; - myNothingToDo: Boolean from Standard is protected; - myShapes : ListOfListOfShape from BOPTColStd is protected; - mySmartMap : IndexedDataMapOfVertexListEdgeInfo from BOP is protected; - myEdges : ListOfShape from TopTools is protected; - -end WireSplitter; - diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx index ddfe74f80..b9a452053 100755 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSplitter.cxx @@ -1,30 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_WireSplitter.cxx -// Created: -// Author: Peter KURNEV -// -// -#include + +// File: GEOMAlgo_WireSplitter.cxx +// Author: Peter KURNEV + +#include #include #include @@ -45,7 +44,6 @@ #include #include - #include #include #include @@ -53,8 +51,6 @@ #include #include - - #include #include #include @@ -73,15 +69,15 @@ static void Path (const GeomAdaptor_Surface& aGAS, - const TopoDS_Face& myFace, - const TopoDS_Vertex& aVa, - const TopoDS_Edge& aEOuta, - BOP_EdgeInfo& anEdgeInfo, - TopTools_SequenceOfShape& aLS, - TopTools_SequenceOfShape& aVertVa, - TColgp_SequenceOfPnt2d& aCoordVa, - BOPTColStd_ListOfListOfShape& myShapes, - BOP_IndexedDataMapOfVertexListEdgeInfo& mySmartMap); + const TopoDS_Face& myFace, + const TopoDS_Vertex& aVa, + const TopoDS_Edge& aEOuta, + BOP_EdgeInfo& anEdgeInfo, + TopTools_SequenceOfShape& aLS, + TopTools_SequenceOfShape& aVertVa, + TColgp_SequenceOfPnt2d& aCoordVa, + BOPTColStd_ListOfListOfShape& myShapes, + BOP_IndexedDataMapOfVertexListEdgeInfo& mySmartMap); static @@ -90,40 +86,45 @@ static static void GetNextVertex(const TopoDS_Vertex& aV, - const TopoDS_Edge& aE, - TopoDS_Vertex& aV1); + const TopoDS_Edge& aE, + TopoDS_Vertex& aV1); static Standard_Real ClockWiseAngle(const Standard_Real aAngleIn, - const Standard_Real aAngleOut); + const Standard_Real aAngleOut); static Standard_Real AngleIn(const TopoDS_Edge& aEIn, - const BOP_ListOfEdgeInfo& aLEInfo); + const BOP_ListOfEdgeInfo& aLEInfo); static Standard_Real Angle2D (const TopoDS_Vertex& aV, - const TopoDS_Edge& anEdge, - const TopoDS_Face& myFace, - const GeomAdaptor_Surface& aGAS, - const Standard_Boolean aFlag); + const TopoDS_Edge& anEdge, + const TopoDS_Face& myFace, + const GeomAdaptor_Surface& aGAS, + const Standard_Boolean aFlag); static gp_Pnt2d Coord2d (const TopoDS_Vertex& aV1, - const TopoDS_Edge& aE1, - const TopoDS_Face& aF); + const TopoDS_Edge& aE1, + const TopoDS_Face& aF); static gp_Pnt2d Coord2dVf (const TopoDS_Edge& aE, - const TopoDS_Face& aF); + const TopoDS_Face& aF); static Standard_Real Tolerance2D (const TopoDS_Vertex& aV, - const GeomAdaptor_Surface& aGAS); + const GeomAdaptor_Surface& aGAS); + +//modified by NIZNHY-PKV Thu Apr 19 09:04:59 2012f static - Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& ); -// + Standard_Integer NbWaysOut(const TopoDS_Edge& aEOuta, + const BOP_ListOfEdgeInfo& aLEInfo); +//static +// Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& ); +//modified by NIZNHY-PKV Thu Apr 19 09:04:53 2012t //======================================================================= -// function: -// purpose: +// function: +// purpose: //======================================================================= GEOMAlgo_WireSplitter::GEOMAlgo_WireSplitter() : @@ -133,14 +134,14 @@ static } //======================================================================= // function: ~ -// purpose: +// purpose: //======================================================================= GEOMAlgo_WireSplitter::~GEOMAlgo_WireSplitter() { } //======================================================================= // function: SetFace -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WireSplitter::SetFace(const TopoDS_Face& aFace) { @@ -148,7 +149,7 @@ static } //======================================================================= // function: Face -// purpose: +// purpose: //======================================================================= const TopoDS_Face& GEOMAlgo_WireSplitter::Face()const { @@ -156,7 +157,7 @@ static } //======================================================================= // function: SetEdges -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WireSplitter::SetEdges(const TopTools_ListOfShape& aLE) { @@ -176,7 +177,7 @@ static } //======================================================================= // function: Edges -// purpose: +// purpose: //======================================================================= const TopTools_ListOfShape& GEOMAlgo_WireSplitter::Edges()const { @@ -184,7 +185,7 @@ static } //======================================================================= // function: IsNothingToDo -// purpose: +// purpose: //======================================================================= Standard_Boolean GEOMAlgo_WireSplitter::IsNothingToDo()const { @@ -192,7 +193,7 @@ static } //======================================================================= // function: Shapes -// purpose: +// purpose: //======================================================================= const BOPTColStd_ListOfListOfShape& GEOMAlgo_WireSplitter::Shapes()const { @@ -200,7 +201,7 @@ static } //======================================================================= // function: Perform -// purpose: +// purpose: //======================================================================= void GEOMAlgo_WireSplitter::Perform() { @@ -210,7 +211,7 @@ static Standard_Integer index, i, aNb, aCntIn, aCntOut; Standard_Boolean anIsIn; Standard_Real anAngle; - + BOP_ListOfEdgeInfo emptyInfo; TopTools_ListIteratorOfListOfShape anItList; // @@ -231,22 +232,22 @@ static index = mySmartMap.FindIndex(aVertex); if (!index) { - index=mySmartMap.Add(aVertex, emptyInfo); + index=mySmartMap.Add(aVertex, emptyInfo); } - + BOP_ListOfEdgeInfo& aListOfEInfo=mySmartMap(index); BOP_EdgeInfo aEInfo; aEInfo.SetEdge(anEdge); - + TopAbs_Orientation anOr=aVertex.Orientation(); if (anOr==TopAbs_FORWARD) { - aEInfo.SetInFlag(Standard_False); + aEInfo.SetInFlag(Standard_False); } else if (anOr==TopAbs_REVERSED) { - aEInfo.SetInFlag(Standard_True); + aEInfo.SetInFlag(Standard_True); } aListOfEInfo.Append(aEInfo); @@ -255,9 +256,9 @@ static // aNb=mySmartMap.Extent(); // - // 2. myNothingToDo + // 2. myNothingToDo myNothingToDo=Standard_True; - + for (i=1; i<=aNb; i++) { aCntIn=0; aCntOut=0; @@ -267,10 +268,10 @@ static const BOP_EdgeInfo& anEdgeInfo=anIt.Value(); anIsIn=anEdgeInfo.IsIn(); if (anIsIn) { - aCntIn++; + aCntIn++; } else { - aCntOut++; + aCntOut++; } } if (aCntIn!=1 || aCntOut!=1) { @@ -282,27 +283,27 @@ static // Each vertex has one edge In and one - Out. Good. But it is not enought // to consider that nothing to do with this. We must check edges on TShape // coinsidence. If there are such edges there is something to do with. - // + // if (myNothingToDo) { Standard_Integer aNbE, aNbMapEE; TopTools_IndexedDataMapOfShapeListOfShape aMapEE; aNbE=myEdges.Extent(); - + anItList.Initialize(myEdges); for (; anItList.More(); anItList.Next()) { const TopoDS_Shape& aE = anItList.Value(); - + if (!aMapEE.Contains(aE)) { - TopTools_ListOfShape aLEx; - aLEx.Append(aE); - aMapEE.Add(aE, aLEx); + TopTools_ListOfShape aLEx; + aLEx.Append(aE); + aMapEE.Add(aE, aLEx); } else { - TopTools_ListOfShape& aLEx=aMapEE.ChangeFromKey(aE); - aLEx.Append(aE); + TopTools_ListOfShape& aLEx=aMapEE.ChangeFromKey(aE); + aLEx.Append(aE); } } - + Standard_Boolean bFlag; bFlag=Standard_True; aNbMapEE=aMapEE.Extent(); @@ -310,25 +311,25 @@ static const TopTools_ListOfShape& aLEx=aMapEE(i); aNbE=aLEx.Extent(); if (aNbE==1) { - // usual case - continue; + // usual case + continue; } else if (aNbE==2){ - const TopoDS_Shape& aE1=aLEx.First(); - const TopoDS_Shape& aE2=aLEx.Last(); - if (aE1.IsSame(aE2)) { - bFlag=Standard_False; - break; - } + const TopoDS_Shape& aE1=aLEx.First(); + const TopoDS_Shape& aE2=aLEx.Last(); + if (aE1.IsSame(aE2)) { + bFlag=Standard_False; + break; + } } else { - bFlag=Standard_False; - break; + bFlag=Standard_False; + break; } } myNothingToDo=myNothingToDo && bFlag; } - // + // // if (myNothingToDo) { myErrorStatus=0; @@ -351,50 +352,50 @@ static // anIsIn=anEdgeInfo.IsIn(); if (anIsIn) { - // - aVV.Orientation(TopAbs_REVERSED); - anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_True); + // + aVV.Orientation(TopAbs_REVERSED); + anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_True); } - // + // else { // OUT - // - aVV.Orientation(TopAbs_FORWARD); - anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_False); + // + aVV.Orientation(TopAbs_FORWARD); + anAngle=Angle2D (aVV, aE, myFace, aGAS, Standard_False); } anEdgeInfo.SetAngle(anAngle); - + } } // // 4. Do // Standard_Boolean anIsOut, anIsNotPassed; - + TopTools_SequenceOfShape aLS, aVertVa; TColgp_SequenceOfPnt2d aCoordVa; - + BOP_ListIteratorOfListOfEdgeInfo anIt; for (i=1; i<=aNb; i++) { const TopoDS_Vertex aVa=TopoDS::Vertex (mySmartMap.FindKey(i)); const BOP_ListOfEdgeInfo& aLEInfo=mySmartMap(i); - + anIt.Initialize(aLEInfo); for (; anIt.More(); anIt.Next()) { BOP_EdgeInfo& anEdgeInfo=anIt.Value(); const TopoDS_Edge& aEOuta=anEdgeInfo.Edge(); - + anIsOut=!anEdgeInfo.IsIn(); anIsNotPassed=!anEdgeInfo.Passed(); - + if (anIsOut && anIsNotPassed) { - // - aLS.Clear(); - aVertVa.Clear(); - aCoordVa.Clear(); - // - Path(aGAS, myFace, aVa, aEOuta, anEdgeInfo, aLS, - aVertVa, aCoordVa, myShapes, mySmartMap); + // + aLS.Clear(); + aVertVa.Clear(); + aCoordVa.Clear(); + // + Path(aGAS, myFace, aVa, aEOuta, anEdgeInfo, aLS, + aVertVa, aCoordVa, myShapes, mySmartMap); } } } @@ -404,22 +405,22 @@ static TopoDS_Vertex aV1, aV2; BOPTColStd_ListOfListOfShape aShapes; BOPTColStd_ListIteratorOfListOfListOfShape anItW(myShapes); - + for (; anItW.More(); anItW.Next()) { TopTools_IndexedMapOfShape aMV, aME; const TopTools_ListOfShape& aLE=anItW.Value(); TopTools_ListIteratorOfListOfShape anItE(aLE); for (; anItE.More(); anItE.Next()) { - const TopoDS_Edge& aE=TopoDS::Edge(anItE.Value()); - aME.Add(aE); - TopExp::Vertices(aE, aV1, aV2); - aMV.Add(aV1); - aMV.Add(aV2); + const TopoDS_Edge& aE=TopoDS::Edge(anItE.Value()); + aME.Add(aE); + TopExp::Vertices(aE, aV1, aV2); + aMV.Add(aV1); + aMV.Add(aV2); } aNbV=aMV.Extent(); aNbE=aME.Extent(); if (aNbV<=aNbE) { - aShapes.Append(aLE); + aShapes.Append(aLE); } } // @@ -435,24 +436,23 @@ static } //======================================================================= // function: Path -// purpose: +// purpose: //======================================================================= void Path (const GeomAdaptor_Surface& aGAS, - const TopoDS_Face& myFace, - const TopoDS_Vertex& aVa, - const TopoDS_Edge& aEOuta, - BOP_EdgeInfo& anEdgeInfo, - TopTools_SequenceOfShape& aLS, - TopTools_SequenceOfShape& aVertVa, - TColgp_SequenceOfPnt2d& aCoordVa, - BOPTColStd_ListOfListOfShape& myShapes, - BOP_IndexedDataMapOfVertexListEdgeInfo& mySmartMap) - + const TopoDS_Face& myFace, + const TopoDS_Vertex& aVa, + const TopoDS_Edge& aEOuta, + BOP_EdgeInfo& anEdgeInfo, + TopTools_SequenceOfShape& aLS, + TopTools_SequenceOfShape& aVertVa, + TColgp_SequenceOfPnt2d& aCoordVa, + BOPTColStd_ListOfListOfShape& myShapes, + BOP_IndexedDataMapOfVertexListEdgeInfo& mySmartMap) { - Standard_Integer i,j, aNb, aNbj; + Standard_Integer i,j, aNb, aNbj, iCnt; Standard_Real aTol, anAngleIn, anAngleOut, anAngle, aMinAngle; Standard_Real aTol2D, aTol2D2; - Standard_Real aTol2, aD2;//, aTolUVb, aTolVVb; + Standard_Real aTol2, aD2; Standard_Boolean anIsSameV2d, anIsSameV, anIsFound, anIsOut, anIsNotPassed; BOP_ListIteratorOfListOfEdgeInfo anIt; TopoDS_Vertex aVb; @@ -462,7 +462,7 @@ static // // append block // - // Do not escape through edge from which you enter + // Do not escape through edge from which you enter aNb=aLS.Length(); if (aNb==1) { const TopoDS_Shape& anEPrev=aLS(aNb); @@ -475,17 +475,15 @@ static anEdgeInfo.SetPassed(Standard_True); aLS.Append(aEOuta); aVertVa.Append(aVa); - + TopoDS_Vertex pVa=aVa; pVa.Orientation(TopAbs_FORWARD); gp_Pnt2d aPa=Coord2d(pVa, aEOuta, myFace); aCoordVa.Append(aPa); - + GetNextVertex (pVa, aEOuta, aVb); gp_Pnt2d aPb=Coord2d(aVb, aEOuta, myFace); - - //const BOP_ListOfEdgeInfo& aLEInfoVb=mySmartMap.FindFromKey(aVb); // aTol=2.*Tolerance2D(aVb, aGAS); aTol2=10.*aTol*aTol; @@ -506,45 +504,45 @@ static anIsSameV2d=Standard_False; if (anIsSameV) { - anIsSameV2d = Standard_True; - // - aD2=aPaPrev.SquareDistance(aPb); - anIsSameV2d =aD2 aTol2D2){ - continue; + continue; } // - // anAngleOut=anEI.Angle(); // anAngle=ClockWiseAngle(anAngleIn, anAngleOut); if (anAngle < aMinAngle) { - aMinAngle=anAngle; - pEdgeInfo=&anEI; - anIsFound=Standard_True; + aMinAngle=anAngle; + pEdgeInfo=&anEI; + anIsFound=Standard_True; } } - } // for (; anIt.More(); anIt.Next()) + } // for (; anIt.More(); anIt.Next()) // if (!anIsFound) { // no way to go . (Error) return; } - + // aEOutb=pEdgeInfo->Edge(); // - Path (aGAS, myFace, aVb, aEOutb, *pEdgeInfo, aLS, - aVertVa, aCoordVa, myShapes, mySmartMap); + Path (aGAS, myFace, aVb, aEOutb, *pEdgeInfo, aLS, + aVertVa, aCoordVa, myShapes, mySmartMap); } //======================================================================= // function: Coord2dVf // purpose: //======================================================================= gp_Pnt2d Coord2dVf (const TopoDS_Edge& aE, - const TopoDS_Face& aF) + const TopoDS_Face& aF) { Standard_Real aCoord=99.; gp_Pnt2d aP2D1(aCoord, aCoord); @@ -651,7 +646,7 @@ static // purpose: //======================================================================= Standard_Real Tolerance2D (const TopoDS_Vertex& aV, - const GeomAdaptor_Surface& aGAS) + const GeomAdaptor_Surface& aGAS) { Standard_Real aTol2D, anUr, aVr, aTolV3D; GeomAbs_SurfaceType aType; @@ -682,8 +677,8 @@ static // purpose: //======================================================================= gp_Pnt2d Coord2d (const TopoDS_Vertex& aV1, - const TopoDS_Edge& aE1, - const TopoDS_Face& aF) + const TopoDS_Edge& aE1, + const TopoDS_Face& aF) { Standard_Real aT, aFirst, aLast; Handle(Geom2d_Curve) aC2D; @@ -700,7 +695,7 @@ static // purpose: //======================================================================= Standard_Real AngleIn(const TopoDS_Edge& aEIn, - const BOP_ListOfEdgeInfo& aLEInfo) + const BOP_ListOfEdgeInfo& aLEInfo) { Standard_Real anAngleIn; Standard_Boolean anIsIn; @@ -725,9 +720,9 @@ static // purpose: //======================================================================= Standard_Real ClockWiseAngle(const Standard_Real aAngleIn, - const Standard_Real aAngleOut) + const Standard_Real aAngleOut) { - Standard_Real aTwoPi=Standard_PI+Standard_PI; + Standard_Real aTwoPi = M_PI+M_PI; Standard_Real dA, A1, A2, AIn, AOut ; AIn=aAngleIn; @@ -735,25 +730,27 @@ static if (AIn >= aTwoPi) { AIn=AIn-aTwoPi; } - + if (AOut >= aTwoPi) { AOut=AOut-aTwoPi; } - A1=AIn+Standard_PI; - + A1 = AIn + M_PI; + if (A1 >= aTwoPi) { A1=A1-aTwoPi; } - + A2=AOut; - + dA=A1-A2; if (dA <= 0.) { dA=aTwoPi+dA; + if (dA <= 1.e-14) { + dA=aTwoPi; + } } //xx - //else if (dA <= 1.e-15) { else if (dA <= 1.e-14) { dA=aTwoPi; } @@ -761,11 +758,11 @@ static } //======================================================================= // function: GetNextVertex -// purpose: +// purpose: //======================================================================= void GetNextVertex(const TopoDS_Vertex& aV, - const TopoDS_Edge& aE, - TopoDS_Vertex& aV1) + const TopoDS_Edge& aE, + TopoDS_Vertex& aV1) { TopoDS_Iterator aIt; // @@ -781,13 +778,13 @@ static } //======================================================================= // function: Angle2D -// purpose: +// purpose: //======================================================================= Standard_Real Angle2D (const TopoDS_Vertex& aV, - const TopoDS_Edge& anEdge, - const TopoDS_Face& myFace, - const GeomAdaptor_Surface& aGAS, - const Standard_Boolean aFlag) + const TopoDS_Edge& anEdge, + const TopoDS_Face& myFace, + const GeomAdaptor_Surface& aGAS, + const Standard_Boolean aFlag) { Standard_Real aFirst, aLast, aToler, dt, aTV, aTV1, anAngle, aTX; gp_Pnt2d aPV, aPV1; @@ -799,19 +796,16 @@ static return 0.; } // - BOPTools_Tools2D::CurveOnSurface (anEdge, myFace, aC2D, - aFirst, aLast, aToler, Standard_True); + BOPTools_Tools2D::CurveOnSurface (anEdge, myFace, aC2D, + aFirst, aLast, aToler, Standard_True); //dt=1.e-7; - //modified by NIZNHY-PKV Wed Sep 10 14:06:04 2008f - //dt=Tolerance2D(aV, aGAS); dt=2.*Tolerance2D(aV, aGAS); - //modified by NIZNHY-PKV Wed Sep 10 14:06:07 2008t // aTX=0.25*(aLast - aFirst); if(dt > aTX) { // to save direction of the curve as much as it possible // in the case of big tolerances - dt = aTX; + dt = aTX; } // if (fabs (aTV-aFirst) < fabs(aTV - aLast)) { @@ -840,7 +834,7 @@ static } //======================================================================= // function: Angle -// purpose: +// purpose: //======================================================================= Standard_Real Angle (const gp_Dir2d& aDir2D) { @@ -848,14 +842,40 @@ Standard_Real Angle (const gp_Dir2d& aDir2D) Standard_Real anAngle = aRefDir.Angle(aDir2D); if (anAngle < 0.) - anAngle += Standard_PI + Standard_PI; + anAngle += M_PI + M_PI; return anAngle; } -// +//modified by NIZNHY-PKV Thu Apr 19 09:02:04 2012f //======================================================================= // function: NbWaysOut -// purpose: +// purpose: +//======================================================================= +Standard_Integer NbWaysOut(const TopoDS_Edge& aEOuta, + const BOP_ListOfEdgeInfo& aLEInfo) +{ + Standard_Boolean bIsOut, bIsNotPassed; + Standard_Integer iCnt=0; + BOP_ListIteratorOfListOfEdgeInfo anIt; + // + anIt.Initialize(aLEInfo); + for (; anIt.More(); anIt.Next()) { + BOP_EdgeInfo& aEI=anIt.Value(); + const TopoDS_Edge& aE=aEI.Edge(); + bIsOut=!aEI.IsIn(); + bIsNotPassed=!aEI.Passed(); + if (bIsOut && bIsNotPassed) { + if (!aE.IsSame(aEOuta)) { + iCnt++; + } + } + } + return iCnt; +} +/* +//======================================================================= +// function: NbWaysOut +// purpose: //======================================================================= Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& aLEInfo) { @@ -875,3 +895,5 @@ Standard_Integer NbWaysOut(const BOP_ListOfEdgeInfo& aLEInfo) } return iCnt; } +*/ +//modified by NIZNHY-PKV Thu Apr 19 09:01:57 2012t diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.hxx b/src/GEOMAlgo/GEOMAlgo_WireSplitter.hxx index 24c2da7bc..cbfc9ff05 100644 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.hxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSplitter.hxx @@ -1,143 +1,84 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: GEOMAlgo_WireSplitter.hxx +// Author: Peter KURNEV + #ifndef _GEOMAlgo_WireSplitter_HeaderFile #define _GEOMAlgo_WireSplitter_HeaderFile -#ifndef _TopoDS_Face_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _BOPTColStd_ListOfListOfShape_HeaderFile #include -#endif -#ifndef _BOP_IndexedDataMapOfVertexListEdgeInfo_HeaderFile #include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile #include -#endif -#ifndef _GEOMAlgo_Algo_HeaderFile #include -#endif -class TopoDS_Face; -class TopTools_ListOfShape; -class BOPTColStd_ListOfListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - //! the algorithm to split multiconnexed set of edges
    //! wires on a face onto simple connexed wires
    //! .
    -class GEOMAlgo_WireSplitter : public GEOMAlgo_Algo { - +//======================================================================= +//class : GEOMAlgo_WireSplitter +//purpose : +//======================================================================= +class GEOMAlgo_WireSplitter : public GEOMAlgo_Algo +{ public: + Standard_EXPORT + GEOMAlgo_WireSplitter(); - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT GEOMAlgo_WireSplitter(); -Standard_EXPORT virtual ~GEOMAlgo_WireSplitter(); - - -Standard_EXPORT void SetFace(const TopoDS_Face& aF) ; - - -Standard_EXPORT void SetEdges(const TopTools_ListOfShape& aLE) ; + Standard_EXPORT + virtual ~GEOMAlgo_WireSplitter(); + Standard_EXPORT + void SetFace(const TopoDS_Face& aF) ; -Standard_EXPORT const TopTools_ListOfShape& Edges() const; + Standard_EXPORT + void SetEdges(const TopTools_ListOfShape& aLE) ; + Standard_EXPORT + const TopTools_ListOfShape& Edges() const; -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT Standard_Boolean IsNothingToDo() const; - - -Standard_EXPORT const TopoDS_Face& Face() const; - - -Standard_EXPORT const BOPTColStd_ListOfListOfShape& Shapes() const; - + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + Standard_Boolean IsNothingToDo() const; + Standard_EXPORT + const TopoDS_Face& Face() const; + Standard_EXPORT + const BOPTColStd_ListOfListOfShape& Shapes() const; protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopoDS_Face myFace; -Standard_Boolean myIsDone; -Standard_Boolean myNothingToDo; -BOPTColStd_ListOfListOfShape myShapes; -BOP_IndexedDataMapOfVertexListEdgeInfo mySmartMap; -TopTools_ListOfShape myEdges; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + TopoDS_Face myFace; + Standard_Boolean myIsDone; + Standard_Boolean myNothingToDo; + BOPTColStd_ListOfListOfShape myShapes; + BOP_IndexedDataMapOfVertexListEdgeInfo mySmartMap; + TopTools_ListOfShape myEdges; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.ixx b/src/GEOMAlgo/GEOMAlgo_WireSplitter.ixx deleted file mode 100644 index 668dcb466..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/GEOMAlgo/GEOMAlgo_WireSplitter.jxx b/src/GEOMAlgo/GEOMAlgo_WireSplitter.jxx deleted file mode 100644 index 415548656..000000000 --- a/src/GEOMAlgo/GEOMAlgo_WireSplitter.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _BOPTColStd_ListOfListOfShape_HeaderFile -#include -#endif -#ifndef _GEOMAlgo_WireSplitter_HeaderFile -#include -#endif diff --git a/src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx b/src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx index 9a67a925a..3fce5be46 100644 --- a/src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx +++ b/src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _Handle_BlockFix_BlockFixAPI_HeaderFile #define _Handle_BlockFix_BlockFixAPI_HeaderFile @@ -41,24 +42,24 @@ Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_BlockFixAPI); class Handle(BlockFix_BlockFixAPI) : public Handle(MMgt_TShared) { public: - void* operator new(size_t,void* anAddress) + void* operator new(size_t,void* anAddress) { return anAddress; } - void* operator new(size_t size) - { - return Standard::Allocate(size); + void* operator new(size_t size) + { + return Standard::Allocate(size); } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } - Handle(BlockFix_BlockFixAPI)():Handle(MMgt_TShared)() {} - Handle(BlockFix_BlockFixAPI)(const Handle(BlockFix_BlockFixAPI)& aHandle) : Handle(MMgt_TShared)(aHandle) + Handle(BlockFix_BlockFixAPI)():Handle(MMgt_TShared)() {} + Handle(BlockFix_BlockFixAPI)(const Handle(BlockFix_BlockFixAPI)& aHandle) : Handle(MMgt_TShared)(aHandle) { } - Handle(BlockFix_BlockFixAPI)(const BlockFix_BlockFixAPI* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + Handle(BlockFix_BlockFixAPI)(const BlockFix_BlockFixAPI* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) { } @@ -74,18 +75,18 @@ class Handle(BlockFix_BlockFixAPI) : public Handle(MMgt_TShared) { return *this; } - BlockFix_BlockFixAPI* operator->() + BlockFix_BlockFixAPI* operator->() { return (BlockFix_BlockFixAPI *)ControlAccess(); } - BlockFix_BlockFixAPI* operator->() const + BlockFix_BlockFixAPI* operator->() const { return (BlockFix_BlockFixAPI *)ControlAccess(); } Standard_EXPORT ~Handle(BlockFix_BlockFixAPI)(); - + Standard_EXPORT static const Handle(BlockFix_BlockFixAPI) DownCast(const Handle(Standard_Transient)& AnObject); }; #endif diff --git a/src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx b/src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx index 2b0556bab..1cb29e022 100644 --- a/src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx +++ b/src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile #define _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile @@ -41,24 +42,24 @@ Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_PeriodicSurfaceModi class Handle(BlockFix_PeriodicSurfaceModifier) : public Handle(BRepTools_Modification) { public: - void* operator new(size_t,void* anAddress) + void* operator new(size_t,void* anAddress) { return anAddress; } - void* operator new(size_t size) - { - return Standard::Allocate(size); + void* operator new(size_t size) + { + return Standard::Allocate(size); } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } - Handle(BlockFix_PeriodicSurfaceModifier)():Handle(BRepTools_Modification)() {} - Handle(BlockFix_PeriodicSurfaceModifier)(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle) + Handle(BlockFix_PeriodicSurfaceModifier)():Handle(BRepTools_Modification)() {} + Handle(BlockFix_PeriodicSurfaceModifier)(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle) { } - Handle(BlockFix_PeriodicSurfaceModifier)(const BlockFix_PeriodicSurfaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem) + Handle(BlockFix_PeriodicSurfaceModifier)(const BlockFix_PeriodicSurfaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem) { } @@ -74,18 +75,18 @@ class Handle(BlockFix_PeriodicSurfaceModifier) : public Handle(BRepTools_Modific return *this; } - BlockFix_PeriodicSurfaceModifier* operator->() + BlockFix_PeriodicSurfaceModifier* operator->() { return (BlockFix_PeriodicSurfaceModifier *)ControlAccess(); } - BlockFix_PeriodicSurfaceModifier* operator->() const + BlockFix_PeriodicSurfaceModifier* operator->() const { return (BlockFix_PeriodicSurfaceModifier *)ControlAccess(); } Standard_EXPORT ~Handle(BlockFix_PeriodicSurfaceModifier)(); - + Standard_EXPORT static const Handle(BlockFix_PeriodicSurfaceModifier) DownCast(const Handle(Standard_Transient)& AnObject); }; #endif diff --git a/src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx b/src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx index 784bc139f..33dc8a198 100644 --- a/src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx +++ b/src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _Handle_BlockFix_SphereSpaceModifier_HeaderFile #define _Handle_BlockFix_SphereSpaceModifier_HeaderFile @@ -41,24 +42,24 @@ Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_SphereSpaceModifier class Handle(BlockFix_SphereSpaceModifier) : public Handle(BRepTools_Modification) { public: - void* operator new(size_t,void* anAddress) + void* operator new(size_t,void* anAddress) { return anAddress; } - void* operator new(size_t size) - { - return Standard::Allocate(size); + void* operator new(size_t size) + { + return Standard::Allocate(size); } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } - Handle(BlockFix_SphereSpaceModifier)():Handle(BRepTools_Modification)() {} - Handle(BlockFix_SphereSpaceModifier)(const Handle(BlockFix_SphereSpaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle) + Handle(BlockFix_SphereSpaceModifier)():Handle(BRepTools_Modification)() {} + Handle(BlockFix_SphereSpaceModifier)(const Handle(BlockFix_SphereSpaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle) { } - Handle(BlockFix_SphereSpaceModifier)(const BlockFix_SphereSpaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem) + Handle(BlockFix_SphereSpaceModifier)(const BlockFix_SphereSpaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem) { } @@ -74,18 +75,18 @@ class Handle(BlockFix_SphereSpaceModifier) : public Handle(BRepTools_Modificatio return *this; } - BlockFix_SphereSpaceModifier* operator->() + BlockFix_SphereSpaceModifier* operator->() { return (BlockFix_SphereSpaceModifier *)ControlAccess(); } - BlockFix_SphereSpaceModifier* operator->() const + BlockFix_SphereSpaceModifier* operator->() const { return (BlockFix_SphereSpaceModifier *)ControlAccess(); } Standard_EXPORT ~Handle(BlockFix_SphereSpaceModifier)(); - + Standard_EXPORT static const Handle(BlockFix_SphereSpaceModifier) DownCast(const Handle(Standard_Transient)& AnObject); }; #endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_Clsf.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_Clsf.hxx deleted file mode 100644 index 7db50df1d..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_Clsf.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_Clsf_HeaderFile -#define _Handle_GEOMAlgo_Clsf_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_GEOMAlgo_HAlgo_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(GEOMAlgo_HAlgo); -class GEOMAlgo_Clsf; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_Clsf); - -class Handle(GEOMAlgo_Clsf) : public Handle(GEOMAlgo_HAlgo) { - public: - Handle(GEOMAlgo_Clsf)():Handle(GEOMAlgo_HAlgo)() {} - Handle(GEOMAlgo_Clsf)(const Handle(GEOMAlgo_Clsf)& aHandle) : Handle(GEOMAlgo_HAlgo)(aHandle) - { - } - - Handle(GEOMAlgo_Clsf)(const GEOMAlgo_Clsf* anItem) : Handle(GEOMAlgo_HAlgo)((GEOMAlgo_HAlgo *)anItem) - { - } - - Handle(GEOMAlgo_Clsf)& operator=(const Handle(GEOMAlgo_Clsf)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_Clsf)& operator=(const GEOMAlgo_Clsf* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_Clsf* operator->() const - { - return (GEOMAlgo_Clsf *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_Clsf)(); - - Standard_EXPORT static const Handle(GEOMAlgo_Clsf) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfBox.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfBox.hxx deleted file mode 100644 index 82c8df8b5..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfBox.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_ClsfBox_HeaderFile -#define _Handle_GEOMAlgo_ClsfBox_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(GEOMAlgo_Clsf); -class GEOMAlgo_ClsfBox; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ClsfBox); - -class Handle(GEOMAlgo_ClsfBox) : public Handle(GEOMAlgo_Clsf) { - public: - Handle(GEOMAlgo_ClsfBox)():Handle(GEOMAlgo_Clsf)() {} - Handle(GEOMAlgo_ClsfBox)(const Handle(GEOMAlgo_ClsfBox)& aHandle) : Handle(GEOMAlgo_Clsf)(aHandle) - { - } - - Handle(GEOMAlgo_ClsfBox)(const GEOMAlgo_ClsfBox* anItem) : Handle(GEOMAlgo_Clsf)((GEOMAlgo_Clsf *)anItem) - { - } - - Handle(GEOMAlgo_ClsfBox)& operator=(const Handle(GEOMAlgo_ClsfBox)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_ClsfBox)& operator=(const GEOMAlgo_ClsfBox* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_ClsfBox* operator->() const - { - return (GEOMAlgo_ClsfBox *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_ClsfBox)(); - - Standard_EXPORT static const Handle(GEOMAlgo_ClsfBox) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx deleted file mode 100644 index ae126bd84..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_ClsfSolid_HeaderFile -#define _Handle_GEOMAlgo_ClsfSolid_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(GEOMAlgo_Clsf); -class GEOMAlgo_ClsfSolid; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ClsfSolid); - -class Handle(GEOMAlgo_ClsfSolid) : public Handle(GEOMAlgo_Clsf) { - public: - Handle(GEOMAlgo_ClsfSolid)():Handle(GEOMAlgo_Clsf)() {} - Handle(GEOMAlgo_ClsfSolid)(const Handle(GEOMAlgo_ClsfSolid)& aHandle) : Handle(GEOMAlgo_Clsf)(aHandle) - { - } - - Handle(GEOMAlgo_ClsfSolid)(const GEOMAlgo_ClsfSolid* anItem) : Handle(GEOMAlgo_Clsf)((GEOMAlgo_Clsf *)anItem) - { - } - - Handle(GEOMAlgo_ClsfSolid)& operator=(const Handle(GEOMAlgo_ClsfSolid)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_ClsfSolid)& operator=(const GEOMAlgo_ClsfSolid* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_ClsfSolid* operator->() const - { - return (GEOMAlgo_ClsfSolid *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_ClsfSolid)(); - - Standard_EXPORT static const Handle(GEOMAlgo_ClsfSolid) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSurf.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSurf.hxx deleted file mode 100644 index 0dc562e39..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSurf.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_ClsfSurf_HeaderFile -#define _Handle_GEOMAlgo_ClsfSurf_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(GEOMAlgo_Clsf); -class GEOMAlgo_ClsfSurf; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ClsfSurf); - -class Handle(GEOMAlgo_ClsfSurf) : public Handle(GEOMAlgo_Clsf) { - public: - Handle(GEOMAlgo_ClsfSurf)():Handle(GEOMAlgo_Clsf)() {} - Handle(GEOMAlgo_ClsfSurf)(const Handle(GEOMAlgo_ClsfSurf)& aHandle) : Handle(GEOMAlgo_Clsf)(aHandle) - { - } - - Handle(GEOMAlgo_ClsfSurf)(const GEOMAlgo_ClsfSurf* anItem) : Handle(GEOMAlgo_Clsf)((GEOMAlgo_Clsf *)anItem) - { - } - - Handle(GEOMAlgo_ClsfSurf)& operator=(const Handle(GEOMAlgo_ClsfSurf)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_ClsfSurf)& operator=(const GEOMAlgo_ClsfSurf* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_ClsfSurf* operator->() const - { - return (GEOMAlgo_ClsfSurf *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_ClsfSurf)(); - - Standard_EXPORT static const Handle(GEOMAlgo_ClsfSurf) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx deleted file mode 100644 index 802db426b..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile -#define _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger); - -class Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)& operator=(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)& operator=(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger* operator->() const - { - return (GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger)(); - - Standard_EXPORT static const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx deleted file mode 100644 index 5bce8fb7b..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile -#define _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape); - -class Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& operator=(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& operator=(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* operator->() const - { - return (GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(); - - Standard_EXPORT static const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx deleted file mode 100644 index 7d6201498..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile -#define _Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape); - -class Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)(const GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)& operator=(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)& operator=(const GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape* operator->() const - { - return (GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape)(); - - Standard_EXPORT static const Handle(GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx deleted file mode 100644 index 3d04a64dd..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile -#define _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_DataMapNodeOfDataMapOfShapeReal; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal); - -class Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)(const GEOMAlgo_DataMapNodeOfDataMapOfShapeReal* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)& operator=(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)& operator=(const GEOMAlgo_DataMapNodeOfDataMapOfShapeReal* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_DataMapNodeOfDataMapOfShapeReal* operator->() const - { - return (GEOMAlgo_DataMapNodeOfDataMapOfShapeReal *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal)(); - - Standard_EXPORT static const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeReal) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx deleted file mode 100644 index 4d8ebab5d..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile -#define _Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet); - -class Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)(const GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)& operator=(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)& operator=(const GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet* operator->() const - { - return (GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet)(); - - Standard_EXPORT static const Handle(GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_HAlgo.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_HAlgo.hxx deleted file mode 100644 index b267e794e..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_HAlgo.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_HAlgo_HeaderFile -#define _Handle_GEOMAlgo_HAlgo_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_MMgt_TShared_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(MMgt_TShared); -class GEOMAlgo_HAlgo; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_HAlgo); - -class Handle(GEOMAlgo_HAlgo) : public Handle(MMgt_TShared) { - public: - Handle(GEOMAlgo_HAlgo)():Handle(MMgt_TShared)() {} - Handle(GEOMAlgo_HAlgo)(const Handle(GEOMAlgo_HAlgo)& aHandle) : Handle(MMgt_TShared)(aHandle) - { - } - - Handle(GEOMAlgo_HAlgo)(const GEOMAlgo_HAlgo* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) - { - } - - Handle(GEOMAlgo_HAlgo)& operator=(const Handle(GEOMAlgo_HAlgo)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_HAlgo)& operator=(const GEOMAlgo_HAlgo* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_HAlgo* operator->() const - { - return (GEOMAlgo_HAlgo *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_HAlgo)(); - - Standard_EXPORT static const Handle(GEOMAlgo_HAlgo) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx deleted file mode 100644 index 90167a8ef..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape); - -class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape* operator->() const - { - return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)(); - - Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx deleted file mode 100644 index 02eff4be3..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile -#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape); - -class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) : public Handle(TCollection_MapNode) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* operator->() - { - return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape *)ControlAccess(); - } - - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape* operator->() const - { - return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape)(); - - Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx deleted file mode 100644 index e23bce049..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile -#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape); - -class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape* operator->() const - { - return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape)(); - - Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx deleted file mode 100644 index 9576d62eb..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox); - -class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox* operator->() const - { - return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)(); - - Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx deleted file mode 100644 index f60329b5d..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile -#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo); - -class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* operator->() const - { - return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(); - - Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx deleted file mode 100644 index fb305154f..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_HeaderFile -#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState); - -class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState* operator->() const - { - return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState)(); - - Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx deleted file mode 100644 index 974b6fe64..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile -#define _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_ListNodeOfListOfCoupleOfShapes; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes); - -class Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)(const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)(const GEOMAlgo_ListNodeOfListOfCoupleOfShapes* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& operator=(const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& operator=(const GEOMAlgo_ListNodeOfListOfCoupleOfShapes* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_ListNodeOfListOfCoupleOfShapes* operator->() const - { - return (GEOMAlgo_ListNodeOfListOfCoupleOfShapes *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)(); - - Standard_EXPORT static const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ListNodeOfListOfPnt.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ListNodeOfListOfPnt.hxx deleted file mode 100644 index fc587d37b..000000000 --- a/src/GEOMAlgo/Handle_GEOMAlgo_ListNodeOfListOfPnt.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_GEOMAlgo_ListNodeOfListOfPnt_HeaderFile -#define _Handle_GEOMAlgo_ListNodeOfListOfPnt_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class GEOMAlgo_ListNodeOfListOfPnt; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfPnt); - -class Handle(GEOMAlgo_ListNodeOfListOfPnt) : public Handle(TCollection_MapNode) { - public: - Handle(GEOMAlgo_ListNodeOfListOfPnt)():Handle(TCollection_MapNode)() {} - Handle(GEOMAlgo_ListNodeOfListOfPnt)(const Handle(GEOMAlgo_ListNodeOfListOfPnt)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(GEOMAlgo_ListNodeOfListOfPnt)(const GEOMAlgo_ListNodeOfListOfPnt* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(GEOMAlgo_ListNodeOfListOfPnt)& operator=(const Handle(GEOMAlgo_ListNodeOfListOfPnt)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMAlgo_ListNodeOfListOfPnt)& operator=(const GEOMAlgo_ListNodeOfListOfPnt* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMAlgo_ListNodeOfListOfPnt* operator->() const - { - return (GEOMAlgo_ListNodeOfListOfPnt *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(GEOMAlgo_ListNodeOfListOfPnt)(); - - Standard_EXPORT static const Handle(GEOMAlgo_ListNodeOfListOfPnt) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/GEOMAlgo/Makefile.am b/src/GEOMAlgo/Makefile.am index 4f0ddc371..dacba0542 100644 --- a/src/GEOMAlgo/Makefile.am +++ b/src/GEOMAlgo/Makefile.am @@ -1,40 +1,36 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 GEOMAlgo : tools for Glue Faces algorithm -# File : Makefile.in -# Author : Julia DOROVSKIKH -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : GEOM -# $Header$ +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + +# GEOM GEOMAlgo : tools for Glue Faces algorithm +# File : Makefile.am +# Author : Julia DOROVSKIKH +# Module : GEOM + include $(top_srcdir)/adm_local/unix/make_common_starter.am # Libraries targets lib_LTLIBRARIES = libGEOMAlgo.la dist_libGEOMAlgo_la_SOURCES = \ - BlockFix.cxx \ BlockFix_BlockFixAPI.cxx \ BlockFix_CheckTool.cxx \ + BlockFix.cxx \ BlockFix_PeriodicSurfaceModifier.cxx \ BlockFix_SphereSpaceModifier.cxx \ BlockFix_UnionEdges.cxx \ @@ -53,49 +49,34 @@ dist_libGEOMAlgo_la_SOURCES = \ GEOMAlgo_BuilderTools.cxx \ GEOMAlgo_ClsfBox.cxx \ GEOMAlgo_Clsf.cxx \ + GEOMAlgo_ClsfSolid.cxx \ GEOMAlgo_ClsfSurf.cxx \ GEOMAlgo_CoupleOfShapes.cxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_0.cxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_0.cxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_0.cxx \ - GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_0.cxx \ - GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_0.cxx \ - GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_0.cxx \ - GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_0.cxx \ - GEOMAlgo_DataMapOfPassKeyInteger_0.cxx \ - GEOMAlgo_DataMapOfRealListOfShape_0.cxx \ - GEOMAlgo_DataMapOfShapeReal_0.cxx \ - GEOMAlgo_DataMapOfShapeShapeSet_0.cxx \ GEOMAlgo_FinderShapeOn1.cxx \ GEOMAlgo_FinderShapeOn2.cxx \ GEOMAlgo_FinderShapeOn.cxx \ GEOMAlgo_FinderShapeOnQuad.cxx \ + GEOMAlgo_GetInPlace_1.cxx \ + GEOMAlgo_GetInPlace_2.cxx \ + GEOMAlgo_GetInPlace_3.cxx \ + GEOMAlgo_GetInPlace.cxx \ GEOMAlgo_GlueAnalyser.cxx \ + GEOMAlgo_GlueDetector.cxx \ + GEOMAlgo_Gluer2_1.cxx \ + GEOMAlgo_Gluer2_2.cxx \ + GEOMAlgo_Gluer2_3.cxx \ + GEOMAlgo_Gluer2.cxx \ + GEOMAlgo_GluerAlgo.cxx \ GEOMAlgo_Gluer.cxx \ - GEOMAlgo_Gluer1.cxx \ GEOMAlgo_HAlgo.cxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_0.cxx \ - GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx \ - GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx \ - GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx \ - GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx \ - GEOMAlgo_IndexedDataMapOfShapeState_0.cxx \ - GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx \ - GEOMAlgo_ListIteratorOfListOfPnt_0.cxx \ - GEOMAlgo_ListNodeOfListOfCoupleOfShapes_0.cxx \ - GEOMAlgo_ListNodeOfListOfPnt_0.cxx \ - GEOMAlgo_ListOfCoupleOfShapes_0.cxx \ - GEOMAlgo_ListOfPnt_0.cxx \ GEOMAlgo_PassKey.cxx \ GEOMAlgo_PassKeyMapHasher.cxx \ GEOMAlgo_PassKeyShape.cxx \ GEOMAlgo_PassKeyShapeMapHasher.cxx \ GEOMAlgo_ShapeAlgo.cxx \ + GEOMAlgo_ShapeInfo.cxx \ + GEOMAlgo_ShapeInfoFiller_1.cxx \ + GEOMAlgo_ShapeInfoFiller.cxx \ GEOMAlgo_ShapeSet.cxx \ GEOMAlgo_ShapeSolid.cxx \ GEOMAlgo_ShellSolid.cxx \ @@ -103,22 +84,15 @@ dist_libGEOMAlgo_la_SOURCES = \ GEOMAlgo_Splitter.cxx \ GEOMAlgo_StateCollector.cxx \ GEOMAlgo_SurfaceTools.cxx \ + GEOMAlgo_Tools_1.cxx \ GEOMAlgo_Tools3D.cxx \ GEOMAlgo_Tools.cxx \ GEOMAlgo_VertexSolid.cxx \ GEOMAlgo_WESCorrector.cxx \ + GEOMAlgo_WESScaler.cxx \ GEOMAlgo_WireEdgeSet.cxx \ GEOMAlgo_WireSolid.cxx \ - GEOMAlgo_WireSplitter.cxx \ - GEOMAlgo_ClsfSolid.cxx \ - GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx \ - GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx \ - GEOMAlgo_ShapeInfoFiller_1.cxx \ - GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx \ - GEOMAlgo_ShapeInfo.cxx \ - GEOMAlgo_ShapeInfoFiller.cxx + GEOMAlgo_WireSplitter.cxx # header files salomeinclude_HEADERS = \ @@ -148,183 +122,81 @@ salomeinclude_HEADERS = \ Handle_BlockFix_SphereSpaceModifier.hxx \ Handle_BlockFix_PeriodicSurfaceModifier.hxx \ GEOMAlgo_Algo.hxx \ - GEOMAlgo_Algo.ixx \ - GEOMAlgo_Algo.jxx \ GEOMAlgo_BuilderArea.hxx \ - GEOMAlgo_BuilderArea.ixx \ - GEOMAlgo_BuilderArea.jxx \ GEOMAlgo_BuilderFace.hxx \ - GEOMAlgo_BuilderFace.ixx \ - GEOMAlgo_BuilderFace.jxx \ GEOMAlgo_Builder.hxx \ - GEOMAlgo_Builder.ixx \ - GEOMAlgo_Builder.jxx \ GEOMAlgo_BuilderShape.hxx \ - GEOMAlgo_BuilderShape.ixx \ - GEOMAlgo_BuilderShape.jxx \ GEOMAlgo_BuilderSolid.hxx \ - GEOMAlgo_BuilderSolid.ixx \ - GEOMAlgo_BuilderSolid.jxx \ GEOMAlgo_BuilderTools.hxx \ - GEOMAlgo_BuilderTools.ixx \ - GEOMAlgo_BuilderTools.jxx \ GEOMAlgo_ClsfBox.hxx \ - GEOMAlgo_ClsfBox.ixx \ - GEOMAlgo_ClsfBox.jxx \ GEOMAlgo_Clsf.hxx \ - GEOMAlgo_Clsf.ixx \ - GEOMAlgo_Clsf.jxx \ + GEOMAlgo_ClsfSolid.hxx \ GEOMAlgo_ClsfSurf.hxx \ - GEOMAlgo_ClsfSurf.ixx \ - GEOMAlgo_ClsfSurf.jxx \ GEOMAlgo_CoupleOfShapes.hxx \ - GEOMAlgo_CoupleOfShapes.ixx \ - GEOMAlgo_CoupleOfShapes.jxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx \ - GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx \ - GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx \ - GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx \ - GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx \ - GEOMAlgo_DataMapOfPassKeyInteger.hxx \ - GEOMAlgo_DataMapOfRealListOfShape.hxx \ - GEOMAlgo_DataMapOfShapeReal.hxx \ - GEOMAlgo_DataMapOfShapeShapeSet.hxx \ - GEOMAlgo_FinderShapeOn1.ixx \ + GEOMAlgo_DataMapIteratorOfDataMapOfOrientedShapeShape.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfShapeMapOfShape.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfShapePnt.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx \ + GEOMAlgo_DataMapOfOrientedShapeShape.hxx \ + GEOMAlgo_DataMapOfPassKeyInteger.hxx \ + GEOMAlgo_DataMapOfPassKeyShapeShape.hxx \ + GEOMAlgo_DataMapOfRealListOfShape.hxx \ + GEOMAlgo_DataMapOfShapeMapOfShape.hxx \ + GEOMAlgo_DataMapOfShapePnt.hxx \ + GEOMAlgo_DataMapOfShapeReal.hxx \ + GEOMAlgo_DataMapOfShapeShapeSet.hxx \ GEOMAlgo_FinderShapeOn1.hxx \ - GEOMAlgo_FinderShapeOn1.jxx \ GEOMAlgo_FinderShapeOn2.hxx \ - GEOMAlgo_FinderShapeOn2.ixx \ - GEOMAlgo_FinderShapeOn2.jxx \ GEOMAlgo_FinderShapeOn.hxx \ - GEOMAlgo_FinderShapeOn.ixx \ - GEOMAlgo_FinderShapeOn.jxx \ GEOMAlgo_FinderShapeOnQuad.hxx \ + GEOMAlgo_GetInPlace.hxx \ GEOMAlgo_GlueAnalyser.hxx \ - GEOMAlgo_GlueAnalyser.ixx \ - GEOMAlgo_GlueAnalyser.jxx \ + GEOMAlgo_GlueDetector.hxx \ + GEOMAlgo_Gluer2.hxx \ + GEOMAlgo_GluerAlgo.hxx \ GEOMAlgo_Gluer.hxx \ - GEOMAlgo_Gluer.ixx \ - GEOMAlgo_Gluer.jxx \ - GEOMAlgo_Gluer1.hxx \ - GEOMAlgo_Gluer1.ixx \ - GEOMAlgo_Gluer1.jxx \ GEOMAlgo_HAlgo.hxx \ - GEOMAlgo_HAlgo.ixx \ - GEOMAlgo_HAlgo.jxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx \ GEOMAlgo_IndexedDataMapOfIntegerShape.hxx \ - GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx \ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx \ GEOMAlgo_IndexedDataMapOfShapeBox.hxx \ + GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx \ GEOMAlgo_IndexedDataMapOfShapeState.hxx \ - GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \ - GEOMAlgo_ListIteratorOfListOfPnt.hxx \ - GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx \ - GEOMAlgo_ListNodeOfListOfPnt.hxx \ - GEOMAlgo_ListOfCoupleOfShapes.hxx \ - GEOMAlgo_ListOfPnt.hxx \ + GEOMAlgo_KindOfBounds.hxx \ + GEOMAlgo_KindOfClosed.hxx \ + GEOMAlgo_KindOfName.hxx \ + GEOMAlgo_KindOfShape.hxx \ + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \ + GEOMAlgo_ListIteratorOfListOfPnt.hxx \ + GEOMAlgo_ListOfCoupleOfShapes.hxx \ + GEOMAlgo_ListOfPnt.hxx \ GEOMAlgo_PassKey.hxx \ - GEOMAlgo_PassKey.ixx \ - GEOMAlgo_PassKey.jxx \ GEOMAlgo_PassKeyMapHasher.hxx \ - GEOMAlgo_PassKeyMapHasher.ixx \ - GEOMAlgo_PassKeyMapHasher.jxx \ GEOMAlgo_PassKeyShape.hxx \ - GEOMAlgo_PassKeyShape.ixx \ - GEOMAlgo_PassKeyShape.jxx \ GEOMAlgo_PassKeyShapeMapHasher.hxx \ - GEOMAlgo_PassKeyShapeMapHasher.ixx \ - GEOMAlgo_PassKeyShapeMapHasher.jxx \ GEOMAlgo_PWireEdgeSet.hxx \ GEOMAlgo_ShapeAlgo.hxx \ - GEOMAlgo_ShapeAlgo.ixx \ - GEOMAlgo_ShapeAlgo.jxx \ + GEOMAlgo_ShapeInfo.hxx \ + GEOMAlgo_ShapeInfoFiller.hxx \ GEOMAlgo_ShapeSet.hxx \ - GEOMAlgo_ShapeSet.ixx \ - GEOMAlgo_ShapeSet.jxx \ GEOMAlgo_ShapeSolid.hxx \ - GEOMAlgo_ShapeSolid.ixx \ - GEOMAlgo_ShapeSolid.jxx \ GEOMAlgo_ShellSolid.hxx \ - GEOMAlgo_ShellSolid.ixx \ - GEOMAlgo_ShellSolid.jxx \ GEOMAlgo_SolidSolid.hxx \ - GEOMAlgo_SolidSolid.ixx \ - GEOMAlgo_SolidSolid.jxx \ GEOMAlgo_Splitter.hxx \ - GEOMAlgo_Splitter.ixx \ - GEOMAlgo_Splitter.jxx \ GEOMAlgo_StateCollector.hxx \ - GEOMAlgo_StateCollector.ixx \ - GEOMAlgo_StateCollector.jxx \ GEOMAlgo_State.hxx \ GEOMAlgo_SurfaceTools.hxx \ - GEOMAlgo_SurfaceTools.ixx \ - GEOMAlgo_SurfaceTools.jxx \ GEOMAlgo_Tools3D.hxx \ - GEOMAlgo_Tools3D.ixx \ - GEOMAlgo_Tools3D.jxx \ GEOMAlgo_Tools.hxx \ - GEOMAlgo_Tools.ixx \ - GEOMAlgo_Tools.jxx \ GEOMAlgo_VertexSolid.hxx \ - GEOMAlgo_VertexSolid.ixx \ - GEOMAlgo_VertexSolid.jxx \ GEOMAlgo_WESCorrector.hxx \ - GEOMAlgo_WESCorrector.ixx \ - GEOMAlgo_WESCorrector.jxx \ + GEOMAlgo_WESScaler.hxx \ GEOMAlgo_WireEdgeSet.hxx \ - GEOMAlgo_WireEdgeSet.ixx \ - GEOMAlgo_WireEdgeSet.jxx \ GEOMAlgo_WireSolid.hxx \ - GEOMAlgo_WireSolid.ixx \ - GEOMAlgo_WireSolid.jxx \ - GEOMAlgo_WireSplitter.hxx \ - GEOMAlgo_WireSplitter.ixx \ - GEOMAlgo_WireSplitter.jxx \ - Handle_GEOMAlgo_ClsfBox.hxx \ - Handle_GEOMAlgo_Clsf.hxx \ - Handle_GEOMAlgo_ClsfSurf.hxx \ - Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx \ - Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx \ - Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx \ - Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx \ - Handle_GEOMAlgo_HAlgo.hxx \ - Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ - Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx \ - Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx \ - Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ - Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx \ - Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx \ - Handle_GEOMAlgo_ListNodeOfListOfPnt.hxx \ - GEOMAlgo_ClsfSolid.hxx \ - GEOMAlgo_ClsfSolid.ixx \ - GEOMAlgo_ClsfSolid.jxx \ - GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx \ - GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx \ - GEOMAlgo_DataMapOfPassKeyShapeShape.hxx \ - GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx \ - GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx \ - GEOMAlgo_KindOfBounds.hxx \ - GEOMAlgo_KindOfClosed.hxx \ - GEOMAlgo_KindOfName.hxx \ - GEOMAlgo_KindOfShape.hxx \ - GEOMAlgo_ShapeInfo.hxx \ - GEOMAlgo_ShapeInfo.ixx \ - GEOMAlgo_ShapeInfo.jxx \ - GEOMAlgo_ShapeInfoFiller.hxx \ - GEOMAlgo_ShapeInfoFiller.ixx \ - GEOMAlgo_ShapeInfoFiller.jxx \ - Handle_GEOMAlgo_ClsfSolid.hxx \ - Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx \ - Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx + GEOMAlgo_WireSplitter.hxx libGEOMAlgo_la_CPPFLAGS = \ $(CAS_CPPFLAGS) \ @@ -335,7 +207,8 @@ libGEOMAlgo_la_CPPFLAGS = \ libGEOMAlgo_la_LDFLAGS = \ ../NMTTools/libNMTTools.la \ $(STDLIB) \ - $(CAS_LDPATH) -lTKBO -lTKShHealing -lTKBool -lTKMesh + $(CAS_LDPATH) -lTKBO -lTKShHealing -lTKBool -lTKMesh -lTKOffset \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace # extra distributed files CDL_FILES = \ @@ -346,46 +219,8 @@ CDL_FILES = \ BlockFix_SphereSpaceModifier.cdl \ BlockFix_UnionEdges.cdl \ BlockFix_UnionFaces.cdl \ - GEOMAlgo.cdl \ - GEOMAlgo_Algo.cdl \ - GEOMAlgo_Builder.cdl \ - GEOMAlgo_BuilderArea.cdl \ - GEOMAlgo_BuilderFace.cdl \ - GEOMAlgo_BuilderShape.cdl \ - GEOMAlgo_BuilderSolid.cdl \ - GEOMAlgo_BuilderTools.cdl \ - GEOMAlgo_Clsf.cdl \ - GEOMAlgo_ClsfBox.cdl \ - GEOMAlgo_ClsfSolid.cdl \ - GEOMAlgo_ClsfSurf.cdl \ - GEOMAlgo_CoupleOfShapes.cdl \ - GEOMAlgo_FinderShapeOn.cdl \ - GEOMAlgo_FinderShapeOn1.cdl \ - GEOMAlgo_FinderShapeOn2.cdl \ - GEOMAlgo_GlueAnalyser.cdl \ - GEOMAlgo_Gluer.cdl \ - GEOMAlgo_Gluer1.cdl \ - GEOMAlgo_HAlgo.cdl \ - GEOMAlgo_PassKey.cdl \ - GEOMAlgo_PassKeyMapHasher.cdl \ - GEOMAlgo_PassKeyShape.cdl \ - GEOMAlgo_PassKeyShapeMapHasher.cdl \ - GEOMAlgo_ShapeAlgo.cdl \ - GEOMAlgo_ShapeInfo.cdl \ - GEOMAlgo_ShapeInfoFiller.cdl \ - GEOMAlgo_ShapeSet.cdl \ - GEOMAlgo_ShapeSolid.cdl \ - GEOMAlgo_ShellSolid.cdl \ - GEOMAlgo_SolidSolid.cdl \ - GEOMAlgo_Splitter.cdl \ - GEOMAlgo_StateCollector.cdl \ - GEOMAlgo_SurfaceTools.cdl \ - GEOMAlgo_Tools.cdl \ - GEOMAlgo_Tools3D.cdl \ - GEOMAlgo_VertexSolid.cdl \ - GEOMAlgo_WESCorrector.cdl \ - GEOMAlgo_WireEdgeSet.cdl \ - GEOMAlgo_WireSolid.cdl \ - GEOMAlgo_WireSplitter.cdl + GEOMAlgo.cdl -EXTRA_DIST += $(CDL_FILES) +EXTRA_DIST += \ + $(CDL_FILES) \ + FILES diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index e34e4587f..1df7a528c 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMBase.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -35,6 +36,8 @@ #include #include #include +#include +#include #include #include @@ -69,40 +72,31 @@ //===================================================================================== // function : GetShapeFromIOR() -// purpose : exist also as static method ! +// purpose : Get shape data by the specified IOR //===================================================================================== -TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) +TopoDS_Shape GEOMBase::GetShapeFromIOR( const QString& IOR ) { - TopoDS_Shape result; - if(IOR.trimmed().isEmpty()) - return result; - - CORBA::Object_var obj = SalomeApp_Application::orb()->string_to_object(IOR.toLatin1().data()); - if(CORBA::is_nil(obj)) - return result; - GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj ); - if (GeomObject->_is_nil()) - return result; - - result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject); - return result; + GEOM::GEOM_Object_var geomObj = GEOMBase::GetObjectFromIOR( IOR ); + TopoDS_Shape shape; + GetShape( geomObj, shape, TopAbs_SHAPE ); + return shape; } //===================================================================================== // function : GetIndex() -// purpose : Get the index of a sub shape in a main shape : index start at 1 +// purpose : Get the index of a sub-shape in a main shape : index start at 1 //===================================================================================== -int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int /*ShapeType*/) +int GEOMBase::GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape ) { - if(shape.IsNull() || subshape.IsNull()) - return -1; - - TopTools_IndexedMapOfShape anIndices; - TopExp::MapShapes(shape, anIndices); - if(anIndices.Contains(subshape)) return anIndices.FindIndex(subshape); - - return -1; + int idx = -1; + if ( !shape.IsNull() && !subshape.IsNull() ) { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes( shape, anIndices ); + if ( anIndices.Contains( subshape ) ) + idx = anIndices.FindIndex( subshape ); + } + return idx; } @@ -110,82 +104,64 @@ int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, // function : GetTopoFromSelection() // purpose : Define tds from a single selection and retuen true //======================================================================= -bool GEOMBase::GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds) +TopoDS_Shape GEOMBase::GetTopoFromSelection( const SALOME_ListIO& IObjects ) { - if(aList.Extent() != 1) - return false; - - Handle(SALOME_InteractiveObject) IO = aList.First(); - /* case SObject */ - if(IO->hasEntry()) { - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return false; - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); - _PTR(GenericAttribute) anAttr; - if( obj ) { - if(obj->FindAttribute(anAttr, "AttributeIOR")) { - _PTR(AttributeIOR) anIOR ( anAttr ); - tds = GetShapeFromIOR(anIOR->Value().c_str()); - if(tds.IsNull()) - return false; - else - return true; + TopoDS_Shape shape; + if ( IObjects.Extent() == 1 ){ + Handle(SALOME_InteractiveObject) IO = IObjects.First(); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( IO->hasEntry() && study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectID( IO->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj && obj->FindAttribute( anAttr, "AttributeIOR" ) ) { + _PTR(AttributeIOR) anIOR( anAttr ); + shape = GetShapeFromIOR( anIOR->Value().c_str() ); } } } - - return false; + return shape; } //======================================================================= // function : GetNameOfSelectedIObjects() // purpose : Define the name geom++ or other name of mono or multi sel. //======================================================================= -int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList, - QString& theName, - const bool theShapesOnly ) +int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects, + QString& name, + const bool shapesOnly ) { - if ( !theShapesOnly ) - { - int nbSel = aList.Extent(); - if ( nbSel == 1 ) - { - Handle(SALOME_InteractiveObject) anIObj = aList.First(); - if(anIObj->hasEntry()) { - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return nbSel; - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) ); - - _PTR(GenericAttribute) anAttr; - - if ( obj && obj->FindAttribute( anAttr, "AttributeName") ) - { - _PTR(AttributeName) aNameAttr ( anAttr ); - theName = aNameAttr->Value().c_str(); - } - } + int nbSel = 0; + name = ""; // clear output name + + if ( !shapesOnly ) { + nbSel = IObjects.Extent(); + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) anIObj = IObjects.First(); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( anIObj->hasEntry() && study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectID( anIObj->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) { + _PTR(AttributeName) aNameAttr ( anAttr ); + name = aNameAttr->Value().c_str(); } - else - theName = QObject::tr("%1_objects").arg(nbSel); - - return nbSel; - } - else - { - GEOM::ListOfGO anObjs; - ConvertListOfIOInListOfGO( aList, anObjs, theShapesOnly ); - if ( anObjs.length() == 1 ) { - theName = GetName( anObjs[ 0 ] ); } - else - theName = QString( "%1_objects" ).arg( anObjs.length() ); - - return anObjs.length(); } + } + else { + GEOM::ListOfGO anObjs; + ConvertListOfIOInListOfGO( IObjects, anObjs, shapesOnly ); + nbSel = anObjs.length(); + if ( nbSel == 1 ) + name = GetName( anObjs[ 0 ] ); + } + + if ( nbSel > 1 ) + name = QObject::tr( "%1_objects" ).arg( nbSel ); + + return nbSel; } @@ -193,101 +169,113 @@ int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList, // function : GetShapeTypeString() // purpose : for a single shape //================================================================================= -bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString) +QString GEOMBase::GetShapeTypeString(const TopoDS_Shape& shape) { - if(aShape.IsNull()) { - aTypeString = "aNullShape"; - return false; - } - switch(aShape.ShapeType()) - { + QString aTypeString; + if ( !shape.IsNull() ) { + switch ( shape.ShapeType() ) { case TopAbs_COMPOUND: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUND").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_COMPOUND" ); + break; } - case TopAbs_COMPSOLID: + case TopAbs_COMPSOLID: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUNDSOLID").toLatin1().constData()) ; - return true ; + aTypeString = QObject::tr( "GEOM_COMPOUNDSOLID" ); + break; } case TopAbs_SOLID: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SOLID").toLatin1().constData()) ; - return true ; + aTypeString = QObject::tr( "GEOM_SOLID" ); + break; } case TopAbs_SHELL: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHELL").toLatin1().constData()) ; - return true ; + aTypeString = QObject::tr( "GEOM_SHELL" ); + break; } case TopAbs_FACE: { - BRepAdaptor_Surface surf(TopoDS::Face(aShape)); - if(surf.GetType() == GeomAbs_Plane) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_PLANE").toLatin1().constData()); - return true; - } - else if(surf.GetType() == GeomAbs_Cylinder) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCYLINDER").toLatin1().constData()); - return true; - } - else if(surf.GetType() == GeomAbs_Sphere) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFSPHERE").toLatin1().constData()); - return true ; - } - else if(surf.GetType() == GeomAbs_Torus) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFTORUS").toLatin1().constData()); - return true ; - } - else if(surf.GetType() == GeomAbs_Cone) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCONE").toLatin1().constData()); - return true ; - } - else { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_FACE").toLatin1().constData()); - return true; + BRepAdaptor_Surface surf( TopoDS::Face( shape ) ); + switch ( surf.GetType() ) { + case GeomAbs_Plane: + { + aTypeString = QObject::tr( "GEOM_PLANE" ); + break; + } + case GeomAbs_Cylinder: + { + aTypeString = QObject::tr( "GEOM_SURFCYLINDER" ); + break; + } + case GeomAbs_Sphere: + { + aTypeString = QObject::tr( "GEOM_SURFSPHERE" ); + break; + } + case GeomAbs_Torus: + { + aTypeString = QObject::tr( "GEOM_SURFTORUS" ); + break; + } + case GeomAbs_Cone: + { + aTypeString = QObject::tr( "GEOM_SURFCONE" ); + break; + } + default: + { + aTypeString = QObject::tr( "GEOM_FACE" ); + break; + } } + break; } case TopAbs_WIRE: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_WIRE").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_WIRE" ); + break; } case TopAbs_EDGE: { - BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); - if(curv.GetType() == GeomAbs_Line) { - if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) - aTypeString = CORBA::string_dup(QObject::tr("GEOM_LINE").toLatin1().constData()); - else - aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toLatin1().constData()); - return true; - } - else if(curv.GetType() == GeomAbs_Circle) { - if(curv.IsClosed()) - aTypeString = CORBA::string_dup(QObject::tr("GEOM_CIRCLE").toLatin1().constData()); - else - aTypeString = CORBA::string_dup(QObject::tr("GEOM_ARC").toLatin1().constData()); - return true; - } - else { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toLatin1().constData()); - return true; + BRepAdaptor_Curve curv( TopoDS::Edge( shape ) ); + switch ( curv.GetType() ) { + case GeomAbs_Line: + { + aTypeString = ( qAbs( curv.FirstParameter() ) >= 1E6 || qAbs( curv.LastParameter() ) >= 1E6 ) ? + QObject::tr( "GEOM_LINE" ) : QObject::tr( "GEOM_EDGE" ); + break; + } + case GeomAbs_Circle: + { + aTypeString = curv.IsClosed() ? QObject::tr( "GEOM_CIRCLE" ) : QObject::tr( "GEOM_ARC" ); + break; + } + default: + { + aTypeString = QObject::tr( "GEOM_EDGE" ); + break; + } } + break; } case TopAbs_VERTEX: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_VERTEX").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_VERTEX" ); + break; } case TopAbs_SHAPE: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHAPE").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_SHAPE" ); + break; + } + default: + { + break; } } - return false; + } + return aTypeString; } @@ -295,54 +283,46 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& // function : ConvertIORinGEOMAISShape() // purpose : //======================================================================= -Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Standard_Boolean& testResult, bool onlyInActiveView) +Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const QString& IOR, bool onlyInActiveView) { - Handle(GEOM_AISShape) resultShape; - testResult = false; - - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return resultShape; - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); - if ( !anObj ) - return resultShape; - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (aVW && aVW->getViewManager()->getType() == OCCViewer_Viewer::Type()) { - Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - List.Append(List1); - - AIS_ListIteratorOfListOfInteractive ite(List); - while(ite.More()) { - if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if(aSh->hasIO()) { - Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO()); - if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { - if(!onlyInActiveView || - aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { - testResult = true; - resultShape = aSh; - return resultShape; + Handle(GEOM_AISShape) shape; + + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectIOR( IOR.toLatin1().constData() ) ); + if ( obj ) { + QList views; + if ( onlyInActiveView ) + views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ); + else + views = SUIT_Session::session()->activeApplication()->desktop()->windows(); + foreach ( SUIT_ViewWindow* view, views ) { + if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + Handle(AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext(); + + AIS_ListOfInteractive displayed; + ic->DisplayedObjects( displayed ); + ic->ObjectsInCollector( displayed ); + + AIS_ListIteratorOfListOfInteractive it( displayed ); + while ( it.More() && shape.IsNull() ) { + if ( it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { + Handle(GEOM_AISShape) sh = Handle(GEOM_AISShape)::DownCast( it.Value() ); + if ( !sh.IsNull() && sh->hasIO() ) { + Handle(SALOME_InteractiveObject) IO = Handle(SALOME_InteractiveObject)::DownCast( sh->getIO() ); + if ( !IO.IsNull() && IO->hasEntry() && obj->GetID() == IO->getEntry() ) + shape = sh; } } + it.Next(); } } - ite.Next(); + if ( !shape.IsNull() ) break; } } } - return resultShape; + return shape; } @@ -350,96 +330,83 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Stand // function : ConvertIORinGEOMActor() // purpose : //======================================================================= -GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& testResult, bool onlyInActiveView) +GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const QString& IOR, bool onlyInActiveView) { - testResult = false; - - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return GEOM_Actor::New(); - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); - if ( !anObj ) - return GEOM_Actor::New(); - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (aVW && aVW->getViewManager()->getType() == SVTK_Viewer::Type()) { - SVTK_ViewWindow* aVTKViewWindow = dynamic_cast( aVW ); - if( !aVTKViewWindow ) - continue; - vtkRenderer* Renderer = aVTKViewWindow->getRenderer(); - vtkActorCollection* theActors = Renderer->GetActors(); - theActors->InitTraversal(); - vtkActor *ac = theActors->GetNextActor(); - while(!(ac==NULL)) { - if( ac->IsA("GEOM_Actor")) { - GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(ac); - if(anActor->hasIO()) { - Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(anActor->getIO()); - if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { - if(!onlyInActiveView || - aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { - testResult = true; - return anActor; + GEOM_Actor* actor = 0; + + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectIOR( IOR.toLatin1().constData() ) ); + if ( obj ) { + QList views; + if ( onlyInActiveView ) + views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ); + else + views = SUIT_Session::session()->activeApplication()->desktop()->windows(); + foreach ( SUIT_ViewWindow* view, views ) { + if ( view && view->getViewManager()->getType() == SVTK_Viewer::Type() ) { + SVTK_ViewWindow* aVTKViewWindow = dynamic_cast( view ); + if( !aVTKViewWindow ) + continue; + vtkRenderer* Renderer = aVTKViewWindow->getRenderer(); + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor* a = theActors->GetNextActor(); + while( a && !actor ) { + if ( a->IsA( "GEOM_Actor" ) ) { + GEOM_Actor* ga = GEOM_Actor::SafeDownCast( a ); + if ( ga && ga->hasIO() ) { + Handle(SALOME_InteractiveObject) IO = Handle(SALOME_InteractiveObject)::DownCast( ga->getIO() ); + if ( !IO.IsNull() && IO->hasEntry() && obj->GetID() == IO->getEntry() ) + actor = ga; } } + a = theActors->GetNextActor(); } } - ac = theActors->GetNextActor(); + if ( actor ) break; } } } - testResult = false; - return GEOM_Actor::New(); + return actor; } //======================================================================= // function : GetAIS() // purpose : //======================================================================= -Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveObject)& theIO, - const bool isOnlyInActiveView ) +Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveObject)& IO, + bool onlyInActiveView, bool onlyGeom ) { - if ( theIO.IsNull() || !theIO->hasEntry() ) - return Handle(AIS_InteractiveObject)(); - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (!aVW || aVW->getViewManager()->getType() != OCCViewer_Viewer::Type()) - continue; - Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive aList; - anIC->DisplayedObjects( aList ); - anIC->ObjectsInCollector( aList ); - - AIS_ListIteratorOfListOfInteractive anIter( aList ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() ); - - if( !anObj.IsNull() && strcmp( anObj->getEntry(), theIO->getEntry() ) == 0 ) - { - if( isOnlyInActiveView ) - { - if ( aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ) - return anIter.Value(); + Handle(AIS_InteractiveObject) aisObject; + + if ( !IO.IsNull() && IO->hasEntry() ) { + QList views; + if ( onlyInActiveView ) + views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ); + else + views = SUIT_Session::session()->activeApplication()->desktop()->windows(); + + foreach ( SUIT_ViewWindow* view, views ) { + if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_Viewer* occViewer=(OCCViewer_Viewer*)view->getViewManager()->getViewModel(); + SOCC_Viewer* soccViewer = dynamic_cast(occViewer); + if (soccViewer) { + SOCC_Prs* occPrs = dynamic_cast( soccViewer->CreatePrs( IO->getEntry() ) ); + if ( occPrs && !occPrs->IsNull() ) { + AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); + if( !shapes.Extent() ) continue; + aisObject=shapes.First(); + delete occPrs; + } } - else - return anIter.Value(); } - } + if ( !aisObject.IsNull() ) break; + } // foreach } - return Handle(AIS_InteractiveObject)(); + return aisObject; } @@ -447,93 +414,9 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO // function : ConvertIOinGEOMAISShape() // purpose : //======================================================================= -Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView) -{ - Handle(GEOM_AISShape) res; - - if ( !IO->hasEntry() ) - { - testResult = false; - return res; - } - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (aVW && aVW->getViewManager()->getType() == OCCViewer_Viewer::Type()) { - Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - List.Append(List1); - - AIS_ListIteratorOfListOfInteractive ite(List); - while(ite.More()) - { - if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) - { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if( aSh->hasIO() ) - { - if( strcmp( aSh->getIO()->getEntry(), IO->getEntry() ) == 0 ) - { - if(onlyInActiveView) - { - if(aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) - { - testResult = true; - return aSh; - } - } - else - { - testResult = true; - return aSh; - } - } - } - } - ite.Next(); - } - } - } - testResult = false; - return res; -} - - -//======================================================================= -// function : ConvertIOinGEOMShape() -// purpose : -//======================================================================= -GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) +Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO, bool onlyInActiveView ) { - GEOM::GEOM_Object_var aShape; - testResult = false; - - /* case SObject */ - if(IO->hasEntry()) { - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return GEOM::GEOM_Object::_nil(); - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); - _PTR(GenericAttribute) anAttr; - if(obj) { - if(obj->FindAttribute(anAttr, "AttributeIOR")) { - _PTR(AttributeIOR) anIOR ( anAttr ); - aShape = GeometryGUI::GetGeomGen()->GetIORFromString(anIOR->Value().c_str()); - if(!CORBA::is_nil(aShape)) - testResult = true; - return aShape._retn(); - } - } - } - return GEOM::GEOM_Object::_nil(); + return Handle(GEOM_AISShape)::DownCast( GetAIS( IO, onlyInActiveView, true ) ); } @@ -541,35 +424,20 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_Interac // function : ConvertListOfIOInListOfIOR() // purpose : //======================================================================= -void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::string_array& listIOR) +QStringList GEOMBase::ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects ) { - int nbSel = aList.Extent(); - listIOR.length(nbSel); - int j=0; - SALOME_ListIteratorOfListIO It(aList); - SalomeApp_Study* appStudy = dynamic_cast - ( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return; - _PTR(Study) aStudy = appStudy->studyDS(); - - for (int i=0; It.More(); It.Next(), i++) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - if (IObject->hasEntry()) { - _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); - _PTR(GenericAttribute) anAttr; - if (obj && obj->FindAttribute(anAttr, "AttributeIOR")) { - _PTR(AttributeIOR) anIOR (anAttr); - //CORBA::Object_var theObj = dynamic_cast - // (aStudy.get())->ConvertIORToObject(anIOR->Value()); - CORBA::Object_var theObj = GeometryGUI::ClientSObjectToObject(obj); - if (!CORBA::is_nil(theObj) && theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) { - listIOR[j] = CORBA::string_dup(anIOR->Value().c_str()); - j++; - } - } + QStringList iors; + SALOME_ListIteratorOfListIO it( IObjects ); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + for ( ; it.More(); it.Next() ) { + GEOM::GEOM_Object_var geomObj = ConvertIOinGEOMObject( it.Value() ); + if ( !CORBA::is_nil( geomObj ) ) + iors.append( GetIORFromObject( geomObj ) ); } } - listIOR.length(j); + return iors; } @@ -577,29 +445,23 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::stri // function : ConvertIOinGEOMObject() // purpose : //======================================================================= -GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& theIO, - Standard_Boolean& theResult ) +GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO ) { - theResult = Standard_False; - GEOM::GEOM_Object_var aReturnObject; - if ( !theIO.IsNull() ) - { - const char* anEntry = theIO->getEntry(); - - SalomeApp_Study* appStudy = dynamic_cast - ( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return GEOM::GEOM_Object::_nil(); - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) aSObj ( aStudy->FindObjectID( anEntry ) ); - - if (aSObj) - { - aReturnObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); - theResult = !CORBA::is_nil( aReturnObject ); + GEOM::GEOM_Object_var object; + + if ( !IO.IsNull() && IO->hasEntry() ) { + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectID( IO->getEntry() ) ); + if ( obj ) { + CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj ); + if ( !CORBA::is_nil( corbaObj ) ) + object = GEOM::GEOM_Object::_narrow( corbaObj ); + } } } - return aReturnObject._retn(); + return object._retn(); } @@ -607,83 +469,74 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter // function : ConvertListOfIOInListOfGO() // purpose : //======================================================================= -void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList, - GEOM::ListOfGO& theListGO, - const bool theShapesOnly ) +void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects, + GEOM::ListOfGO& geomObjects, + bool shapesOnly ) { - int nbSel = theList.Extent(); - theListGO.length( nbSel ); - SALOME_ListIteratorOfListIO anIter( theList ); - - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return; - _PTR(Study) aStudy = appStudy->studyDS(); - - int j = 0; - for ( int i=0; anIter.More(); anIter.Next(), i++ ) - { - Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); - _PTR(SObject) aSObj ( aStudy->FindObjectID( anIObj->getEntry() ) ); - - if ( aSObj ) - { - GEOM::GEOM_Object_var aGeomObj = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); - if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) ) - theListGO[ j++ ] = aGeomObj; + geomObjects.length( 0 ); + + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + + geomObjects.length( IObjects.Extent() ); + SALOME_ListIteratorOfListIO it( IObjects ); + + int i = 0; + for ( ; it.More(); it.Next() ) { + GEOM::GEOM_Object_var geomObj = ConvertIOinGEOMObject( it.Value() ); + if ( !CORBA::is_nil( geomObj ) && ( !shapesOnly || IsShape( geomObj ) ) ) + geomObjects[ i++ ] = geomObj; } + geomObjects.length( i ); } - - theListGO.length( j ); } + //================================================================================= // function : CreateArrowForLinearEdge() // purpose : Create a cone topology to be used to display an arrow in the middle // : of an edge showing its orientation. (For simulation and Viewer OCC only) //================================================================================= -bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) +TopoDS_Shape GEOMBase::CreateArrowForLinearEdge( const TopoDS_Shape& shape ) { - if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type() || tds.ShapeType() != TopAbs_EDGE) - return false; - - OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort(); - Handle( V3d_View) view3d = vp3d->getView(); - Standard_Real Width, Height; - view3d->Size(Width, Height); - const Standard_Real aHeight = (Width + Height) / 50.0; - - try { - Standard_Real first, last; - Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last); - if(!curv->IsCN(1)) - return false; - - const Standard_Real param = (first+last) / 2.0; - gp_Pnt middleParamPoint; - gp_Vec V1; - curv->D1( param, middleParamPoint, V1); - if(V1.Magnitude() < Precision::Confusion()) - return false; - - /* Topology orientation not geom orientation */ - if(tds.Orientation() == TopAbs_REVERSED) - V1 *= -1.0; - - gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1)); - const Standard_Real radius1 = aHeight / 5.0; - if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) { - ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); - return true; + TopoDS_Shape ArrowCone; + + SUIT_ViewWindow* view = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() && shape.ShapeType() == TopAbs_EDGE ) { + Handle(V3d_View) view3d = ((OCCViewer_ViewWindow*)view)->getViewPort()->getView(); + Standard_Real Width, Height; + view3d->Size( Width, Height ); + const Standard_Real aHeight = (Width + Height) / 50.0; + + try { + Standard_Real first, last; + Handle(Geom_Curve) curv = BRep_Tool::Curve( TopoDS::Edge( shape ), first, last ); + if ( curv->IsCN(1) ) { + const Standard_Real param = ( first+last ) / 2.0; + gp_Pnt middleParamPoint; + gp_Vec V1; + curv->D1( param, middleParamPoint, V1 ); + if ( V1.Magnitude() > Precision::Confusion() ) { + /* Topology orientation not geom orientation */ + if ( shape.Orientation() == TopAbs_REVERSED ) + V1 *= -1.0; + + gp_Ax2 anAxis( middleParamPoint, gp_Dir( V1 ) ); + const Standard_Real radius1 = aHeight / 5.0; + if ( radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion() ) + ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); + } + } + } + catch ( Standard_Failure ) { + // OCC failures are hard to catch in GUI. + // This is because of the position for #include that is very critical to find + // in SALOME environment : compilation error ! } } - catch(Standard_Failure) { - // OCC failures are hard to catch in GUI. - // This because of the position for #include that is very critic to find - // in SALOME environment : compilation error ! - } - return false; + + return ArrowCone; } @@ -691,11 +544,11 @@ bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& A // function : VertexToPoint() // purpose : If S can be converted in a gp_Pnt returns true and the result is P //================================================================================= -bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) +bool GEOMBase::VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point ) { - if(S.IsNull() || S.ShapeType() != TopAbs_VERTEX) + if ( shape.IsNull() || shape.ShapeType() != TopAbs_VERTEX ) return false; - P = BRep_Tool::Pnt(TopoDS::Vertex(S)); + point = BRep_Tool::Pnt( TopoDS::Vertex( shape ) ); return true; } @@ -704,12 +557,11 @@ bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) // function : GetBipointDxDyDz() // purpose : //================================================================================= -void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) +void GEOMBase::GetBipointDxDyDz( const gp_Pnt& point1, const gp_Pnt& point2, double& dx, double& dy, double& dz ) { - dx = P2.X() - P1.X(); - dy = P2.Y() - P1.Y(); - dz = P2.Z() - P1.Z(); - return; + dx = point2.X() - point1.X(); + dy = point2.Y() - point1.Y(); + dz = point2.Z() - point1.Z(); } @@ -719,20 +571,25 @@ void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, do // : distance is sufficient, returns true else returns false. // : Resulting points are respectively P1 and P2 //================================================================================= -bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) +bool GEOMBase::LinearEdgeExtremities( const TopoDS_Shape& shape, gp_Pnt& point1, gp_Pnt& point2 ) { - if(S.IsNull() || S.ShapeType() != TopAbs_EDGE) + if ( shape.IsNull() || shape.ShapeType() != TopAbs_EDGE ) return false; - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - if(curv.GetType() != GeomAbs_Line) + + BRepAdaptor_Curve curv( TopoDS::Edge( shape ) ); + if ( curv.GetType() != GeomAbs_Line ) return false; + + gp_Pnt p1, p2; - curv.D0(curv.FirstParameter(), P1); - curv.D0(curv.LastParameter(), P2); + curv.D0( curv.FirstParameter(), p1 ); + curv.D0( curv.LastParameter(), p2 ); - if(P1.Distance(P2) <= Precision::Confusion()) + if ( p1.Distance( p2 ) <= Precision::Confusion() ) return false; + point1 = p1; + point2 = p2; return true; } @@ -743,38 +600,36 @@ bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& // : The selection is changed. Dialog box will receive the // : corresponding signal to manage this event. //======================================================================= -bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, const SALOME_ListIO& aList) +bool GEOMBase::SelectionByNameInDialogs( QWidget* widget, const QString& objectUserName, const SALOME_ListIO& /*IObjects*/ ) { /* Find SObject with name in component GEOM */ - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return false; - _PTR(Study) ST = appStudy->studyDS(); - - std::vector<_PTR(SObject)> listSO; - listSO = ST->FindObjectByName(objectUserName.toStdString(), "GEOM"); - - if(listSO.size() < 1) { - const QString caption = QObject::tr("GEOM_WRN_WARNING"); - const QString text = QObject::tr("GEOM_NAME_INCORRECT"); - const QString button0 = QObject::tr("GEOM_BUT_OK"); - SUIT_MessageBox::critical(aWidget, caption, text, button0); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !study ) return false; + _PTR(Study) studyDS = study->studyDS(); + + std::vector<_PTR(SObject)> listSO = studyDS->FindObjectByName( objectUserName.toStdString(), "GEOM" ); + + if ( listSO.size() < 1 ) { + SUIT_MessageBox::critical( widget, + QObject::tr( "GEOM_WRN_WARNING" ), + QObject::tr( "GEOM_NAME_INCORRECT" ), + QObject::tr( "GEOM_BUT_OK" ) ); return false; } + /* More than one object with same name */ - if(listSO.size() > 1) { - const QString caption = QObject::tr("GEOM_WRN_WARNING"); - const QString text = QObject::tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"); - const QString button0 = QObject::tr("GEOM_BUT_OK") ; - SUIT_MessageBox::critical(aWidget, caption, text, button0) ; - listSO.clear(); + if ( listSO.size() > 1 ) { + SUIT_MessageBox::critical( widget, + QObject::tr("GEOM_WRN_WARNING"), + QObject::tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"), + QObject::tr("GEOM_BUT_OK") ); return false; } - _PTR(SObject) theObj ( listSO[0] ); /* Create a SALOME_InteractiveObject with a SALOME::SObject */ - char* aCopyobjectUserName = CORBA::string_dup(objectUserName.toLatin1().constData()); - Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(theObj->GetID().c_str(), "GEOM", aCopyobjectUserName); - delete(aCopyobjectUserName); + Handle(SALOME_InteractiveObject) IO = new SALOME_InteractiveObject( listSO[0]->GetID().c_str(), + "GEOM", + objectUserName.toLatin1().constData() ); /* Add as a selected object */ /* Clear any previous selection : */ @@ -789,13 +644,12 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU // function : DefineDlgPosition() // purpose : Define x and y the default position for a dialog box //======================================================================= -bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) +void GEOMBase::DefineDlgPosition( QWidget* dlg, int& x, int& y ) { /* Here the position is on the bottom right corner - 10 */ - SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop(); - x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10); - y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10); - return true; + SUIT_Desktop* d = SUIT_Session::session()->activeApplication()->desktop(); + x = abs( d->x() + d->size().width() - dlg->size().width() - 10 ); + y = abs( d->y() + d->size().height() - dlg->size().height() - 10 ); } @@ -803,35 +657,47 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) // function : GetDefaultName() // purpose : Generates default names //======================================================================= -QString GEOMBase::GetDefaultName(const QString& theOperation) +QString GEOMBase::GetDefaultName( const QString& operation, bool extractPrefix ) { QString aName = ""; // collect all object names of GEOM component - SalomeApp_Study* appStudy = - dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return aName; - _PTR(Study) aStudy = appStudy->studyDS(); - - std::set aSet; - _PTR(SComponent) aGeomCompo (aStudy->FindComponent("GEOM")); - if (aGeomCompo) { - _PTR(ChildIterator) it (aStudy->NewChildIterator(aGeomCompo)); - _PTR(SObject) obj; - for (it->InitEx(true); it->More(); it->Next()) { - obj = it->Value(); - aSet.insert(obj->GetName()); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + + std::set names; + _PTR(SComponent) component( studyDS->FindComponent( "GEOM" ) ); + if ( component ) { + _PTR(ChildIterator) it( studyDS->NewChildIterator( component ) ); + for ( it->InitEx( true ); it->More(); it->Next() ) { + names.insert( it->Value()->GetName() ); + } } - } - // build a unique name - int aNumber = 0; - bool isUnique = false; - while (!isUnique) { - aName = theOperation + "_" + QString::number(++aNumber); - isUnique = (aSet.count(aName.toStdString()) == 0); + // build a unique name + int aNumber = 0; + bool isUnique = false; + QString prefix = operation; + + if ( extractPrefix ) { + QStringList parts = prefix.split( "_", QString::KeepEmptyParts ); + if ( parts.count() > 1 ) { + bool ok; + aNumber = parts.last().toLong( &ok ); + if ( ok ) { + parts.removeLast(); + prefix = parts.join( "_" ); + aNumber--; + } + } + } + + while ( !isUnique ) { + aName = prefix + "_" + QString::number( ++aNumber ); + isUnique = ( names.count( aName.toStdString()) == 0 ); + } } - return aName; } @@ -840,19 +706,19 @@ QString GEOMBase::GetDefaultName(const QString& theOperation) // function : ShowErrorMessage() // purpose : Shows message box with error code and comment //======================================================================= -void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment) +void GEOMBase::ShowErrorMessage( const QString& errorCode, const QString& comment ) { - QString anErrorCode(theErrorCode); - QString aComment(theComment); - - QString aText = ""; - if (!anErrorCode.isEmpty()) - aText.append("\n" + QObject::tr(anErrorCode.toLatin1().constData())); - if (!aComment.isEmpty()) - aText.append("\n" + QString(theComment)); - - SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); + QStringList text; + text << QObject::tr( "GEOM_PRP_ABORT" ); + if ( !errorCode.isEmpty() ) + text << QObject::tr( errorCode.toLatin1().constData() ); + if ( !comment.isEmpty() ) + text << QObject::tr( comment.toLatin1().constData() ); + + SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr( "GEOM_ERROR" ), + text.join( "\n" ), + QObject::tr( "GEOM_BUT_OK" ) ); } @@ -860,75 +726,163 @@ void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment // function : GetObjectFromIOR() // purpose : returns a GEOM_Object by given IOR (string) //======================================================================= -GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const char* theIOR ) +GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const QString& IOR ) { - GEOM::GEOM_Object_var anObject; - if ( theIOR == NULL || strlen( theIOR ) == 0 ) - return anObject._retn(); // returning nil object - - anObject = GEOM::GEOM_Object::_narrow( SalomeApp_Application::orb()->string_to_object( theIOR ) ); - return anObject._retn(); + GEOM::GEOM_Object_var geomObj; + if ( !IOR.isEmpty() ) { + CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object( IOR.toLatin1().constData() ); + if ( !CORBA::is_nil( corbaObj ) ) + geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); + } + return geomObj._retn(); } //======================================================================= // function : GetIORFromObject() // purpose : returns IOR of a given GEOM_Object //======================================================================= -char* GEOMBase::GetIORFromObject( const GEOM::GEOM_Object_ptr& theObject ) +QString GEOMBase::GetIORFromObject( GEOM::GEOM_Object_ptr object ) { - if ( CORBA::is_nil( theObject ) ) - return NULL; - - return SalomeApp_Application::orb()->object_to_string( theObject ); + QString IOR; + if ( !CORBA::is_nil( object ) ) { + CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( object ); + IOR = anIOR.in(); + } + return IOR; } //======================================================================= // function : GetShape() // purpose : returns a TopoDS_Shape stored in GEOM_Object //======================================================================= -bool GEOMBase::GetShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType ) +bool GEOMBase::GetShape( GEOM::GEOM_Object_ptr object, TopoDS_Shape& shape, const TopAbs_ShapeEnum type ) { - if ( !CORBA::is_nil( theObject ) ) - { - TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObject ); - if ( !aTopoDSShape.IsNull() && ( theType == TopAbs_SHAPE || theType == aTopoDSShape.ShapeType() ) ) - { - theShape = aTopoDSShape; - return true; - } + shape = TopoDS_Shape(); + if ( !CORBA::is_nil( object ) ) { + TopAbs_ShapeEnum stype = (TopAbs_ShapeEnum)( object->GetShapeType() ); + if ( type == TopAbs_SHAPE || type == stype ) + shape = GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), object ); } - return false; + return !shape.IsNull(); } //======================================================================= // function : GetName() // purpose : Get name of object //======================================================================= -QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj ) +QString GEOMBase::GetName( GEOM::GEOM_Object_ptr object ) { - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - - if ( appStudy ) - { - CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( theObj ); - if ( strcmp(anIOR.in(), "") != 0 ) - { - _PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( std::string( anIOR ) ) ); - + QString name; + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + + if ( !CORBA::is_nil( object ) ) { + // 1. search if object is already published in the study + CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( object ); + if ( study && strcmp( IOR.in(), "" ) != 0 ) { + _PTR(SObject) aSObj( study->studyDS()->FindObjectIOR( std::string( IOR.in() ) ) ); _PTR(GenericAttribute) anAttr; - - if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) - { - _PTR(AttributeName) aNameAttr ( anAttr ); - return QString( aNameAttr->Value().c_str() ); + if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) { + _PTR(AttributeName) aNameAttr( anAttr ); + name = aNameAttr->Value().c_str(); + } + } + + // 2. if object is not found in the study, try default name + if ( name.isEmpty() ) { + if ( object->IsMainShape() ) { + name = GetDefaultName( "geomObj" ); + } + else { + GEOM::GEOM_Object_var mainShape = object->GetMainShape(); + if ( !CORBA::is_nil( mainShape ) ) { + GEOM::ListOfLong_var indices = object->GetSubShapeIndices(); + if ( indices->length() > 0 ) { + TopAbs_ShapeEnum type = (TopAbs_ShapeEnum)( object->GetShapeType() ); + name = QString( "%1:%2_%3" ).arg( GetName( mainShape.in() ) ) + .arg( TypeName( type ) ).arg( indices[0] ); + } + } } } } - return QString(""); + return name; +} + +//======================================================================= +// function : IsShape() +// purpose : Return TRUE if object is valid and has shape +//======================================================================= +bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr object ) +{ + return !object->_is_nil() && object->IsShape(); +} + +//======================================================================= +// function : TypeName() +// purpose : Get string representation for the shape type +//======================================================================= +QString GEOMBase::TypeName( TopAbs_ShapeEnum type ) +{ + QString name = "shape"; + switch( type ) { + case TopAbs_COMPSOLID: + name = "compsolid"; break; + case TopAbs_COMPOUND: + name = "compound"; break; + case TopAbs_SOLID: + name = "solid"; break; + case TopAbs_SHELL: + name = "shell"; break; + case TopAbs_FACE: + name = "face"; break; + case TopAbs_WIRE: + name = "wire"; break; + case TopAbs_EDGE: + name = "edge"; break; + case TopAbs_VERTEX: + name = "vertex"; break; + default: + break; + } + return name; +} + +//================================================================ +// Function : GetEntry +// Purpose : Get study entry for the given object (if it is published) +//================================================================ +QString GEOMBase::GetEntry( GEOM::GEOM_Object_ptr object ) +{ + QString entry; + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study && !CORBA::is_nil( object ) ) { + QString objIOR = GetIORFromObject( object ); + if ( !objIOR.isEmpty() ) { + _PTR(SObject) SO( study->studyDS()->FindObjectIOR( objIOR.toLatin1().constData() ) ); + if ( SO ) + entry = SO->GetID().c_str(); + } + } + return entry; } -bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj ) +//================================================================ +// Function : PublishSubObject +// Purpose : Publish sub-shape under the main object +//================================================================ +void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object ) { - return !theObj->_is_nil() && theObj->IsShape(); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study && !CORBA::is_nil( object ) ) { + _PTR(Study) studyDS = study->studyDS(); + QString entry = GetEntry( object ); + GEOM::GEOM_Object_var father = object->GetMainShape(); + QString fatherEntry = GetEntry( father ); + if ( entry.isEmpty() && !CORBA::is_nil( father ) && !fatherEntry.isEmpty() ) { + QString name = GetName( object ); + GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( studyDS ), + object, name.toLatin1().data(), father.in() ); + } + } } diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index 360fd1318..84ab6ee14 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMBase.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -53,69 +54,85 @@ class GEOMBASE_EXPORT GEOMBase { public : /* Selection and objects management */ - static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType); - static TopoDS_Shape GetShapeFromIOR(QString IOR); - static bool GetShape(const GEOM::GEOM_Object_ptr&, TopoDS_Shape&, - const TopAbs_ShapeEnum = TopAbs_SHAPE); - static bool GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds); - static int GetNameOfSelectedIObjects(const SALOME_ListIO& aList, QString& aName, - const bool theShapesOnly = false); - static bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString); + static int GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape ); + static TopoDS_Shape GetShapeFromIOR( const QString& IOR ); + static bool GetShape( GEOM::GEOM_Object_ptr object, + TopoDS_Shape& shape, + const TopAbs_ShapeEnum type = TopAbs_SHAPE ); + static TopoDS_Shape GetTopoFromSelection( const SALOME_ListIO& IObjects ); + static int GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects, + QString& name, + const bool shapesOnly = false ); + static QString GetShapeTypeString( const TopoDS_Shape& shape ); /* Convertions */ - static GEOM::GEOM_Object_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult); - static Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult, - bool onlyInActiveView = false); + static Handle(GEOM_AISShape) + ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO, + bool onlyInActiveView = false ); - static Handle(AIS_InteractiveObject) GetAIS(const Handle(SALOME_InteractiveObject)& theIO, - const bool isOnlyInActiveView = false); - static void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, - GEOM::string_array& listIOR); + static Handle(AIS_InteractiveObject) + GetAIS( const Handle(SALOME_InteractiveObject)& IO, + bool onlyInActiveView = false, + bool onlyGeom = false ); + static QStringList ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects ); - static Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView = false); - static GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult, - bool onlyInActiveView = false); + static Handle(GEOM_AISShape) + ConvertIORinGEOMAISShape( const QString& IOR, + bool onlyInActiveView = false ); + static GEOM_Actor* ConvertIORinGEOMActor( const QString& IOR, + bool onlyInActiveView = false ); - static GEOM::GEOM_Object_ptr ConvertIOinGEOMObject(const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult); + static GEOM::GEOM_Object_ptr + ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO ); - static void ConvertListOfIOInListOfGO(const SALOME_ListIO& aList, - GEOM::ListOfGO& listGO, - const bool theShapesOnly = false); + static void ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects, + GEOM::ListOfGO& geomObjects, + bool shapesOnly = false ); - static GEOM::GEOM_Object_ptr GetObjectFromIOR(const char* theIOR); + static GEOM::GEOM_Object_ptr + GetObjectFromIOR( const QString& IOR ); - static char* GetIORFromObject(const GEOM::GEOM_Object_ptr& theObject); + static QString GetIORFromObject( GEOM::GEOM_Object_ptr object ); /* Geometry */ - static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P); + static bool VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point ); /* Used just by Plane and Prism */ - static bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2); - static void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz); + static bool LinearEdgeExtremities( const TopoDS_Shape& shape, + gp_Pnt& point1, gp_Pnt& point2 ); + static void GetBipointDxDyDz( const gp_Pnt& point1, const gp_Pnt& point2, + double& dx, double& dy, double& dz ); /* Simulation management */ - static bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone); + static TopoDS_Shape CreateArrowForLinearEdge( const TopoDS_Shape& tds ); /* Generates default names */ - static bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, - const SALOME_ListIO& aList); + static bool SelectionByNameInDialogs( QWidget* widget, + const QString& userObjectName, + const SALOME_ListIO& IObjects ); /* Shows message box with error code */ - static bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); + static void DefineDlgPosition( QWidget* dlg, int& x, int& y ); /* This method generates default names for results of geometrical operations */ - static QString GetDefaultName(const QString& theOperation); + static QString GetDefaultName( const QString& operation, bool extractPrefix = false ); + /* Shows message box with error code and comment */ - static void ShowErrorMessage(const char* theErrorCode, const char* theComment = 0); + static void ShowErrorMessage( const QString& errorCode, const QString& comment = QString() ); /* Gets name of object */ - static QString GetName(GEOM::GEOM_Object_ptr); + static QString GetName( GEOM::GEOM_Object_ptr object ); + + /* Check if object has shape */ + static bool IsShape( GEOM::GEOM_Object_ptr object ); + + /* Get string representation of shape type */ + static QString TypeName( TopAbs_ShapeEnum type ); + + /* Get study entry for the given object */ + static QString GetEntry( GEOM::GEOM_Object_ptr object ); - static bool IsShape(GEOM::GEOM_Object_ptr theObj); + /* Publish sub-shape under the main object */ + static void PublishSubObject( GEOM::GEOM_Object_ptr object ); }; #endif // GEOMBASE_H diff --git a/src/GEOMBase/GEOMBase.pro b/src/GEOMBase/GEOMBase.pro deleted file mode 100644 index bd3592ae0..000000000 --- a/src/GEOMBase/GEOMBase.pro +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMBase -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -CAS_LDPATH = -L$${CASROOT}/Linux/lib - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMGUI ../DlgRef $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/idl -lSalomeIDLGEOM -L$$(GEOM_ROOT_DIR)/lib -lGEOM -lDlgRef $${KERNEL_LDFLAGS} -lOpUtil $${GUI_LDFLAGS} -lsuit -lOCCViewer -lVTKViewer -lSVTK -lSalomePrs -lSalomeApp -lCAM $${CAS_LDPATH} -lTKPrim - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += GEOMBASE_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = GEOMBase.h -HEADERS += GEOMBase_Skeleton.h -HEADERS += GEOMBase_Helper.h -HEADERS += GEOM_Operation.h -HEADERS += GEOM_GEOMBase.hxx - -SOURCES = GEOMBase.cxx -SOURCES += GEOMBase_Skeleton.cxx -SOURCES += GEOMBase_aParameterDlg.cxx -SOURCES += GEOMBase_Helper.cxx -SOURCES += GEOM_Operation.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 326998aed..8fea8899a 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// GEOM GEOMGUI : GUI for Geometry component -// File : GEOMBase_Helper.cxx -// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMBase_Helper.cxx +// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) // #include "GEOMBase_Helper.h" #include "GEOMBase.h" @@ -36,6 +37,7 @@ #include #include #include +#include #include #include @@ -43,6 +45,7 @@ #include #include #include +#include #include @@ -51,6 +54,11 @@ #include #include +#include + +//To disable automatic genericobj management, the following line should be commented. +//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +#define WITHGENERICOBJ //================================================================ // Function : getActiveView @@ -80,7 +88,9 @@ GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine() // Purpose : //================================================================ GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop ) - : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ) + : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ), + myIsApplyAndClose( false ), myIsOptimizedBrowsing( false ), myIsWaitCursorEnabled( true ), + myIsDisableBrowsing(false) { } @@ -90,7 +100,8 @@ GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop ) //================================================================ GEOMBase_Helper::~GEOMBase_Helper() { - if ( !SUIT_Session::session()->activeApplication()->desktop() ) + //rnv: Fix for the "IPAL21922 : WinTC5.1.4: incorrect quit salome" + if ( !SUIT_Session::session()->activeApplication() || !SUIT_Session::session()->activeApplication()->desktop() ) return; if ( myPreview.size() ) @@ -103,9 +114,11 @@ GEOMBase_Helper::~GEOMBase_Helper() if(aGeomGUI) globalSelection(aGeomGUI->getLocalSelectionMode() , true ); } - + if (myDisplayer) delete myDisplayer; + if ( !CORBA::is_nil( myOperation ) ) + myOperation->UnRegister(); } //================================================================ @@ -131,8 +144,10 @@ void GEOMBase_Helper::display( GEOM::GEOM_Object_ptr object, const bool updateVi { // Unset color of shape ( this color may be set during preview displaying ) // Default color will be used - getDisplayer()->UnsetColor(); +// getDisplayer()->UnsetColor(); getDisplayer()->UnsetWidth(); + + MESSAGE("GEOMBase_Helper::display myTexture = "<GetTexture()) // Enable activisation of selection getDisplayer()->SetToActivate( true ); @@ -162,9 +177,10 @@ void GEOMBase_Helper::erase( const ObjectList& objList, const bool updateView ) void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView ) { if ( !object->_is_nil() ) { - std::string entry = getEntry( object ); + QString entry = getEntry( object ); getDisplayer()->Erase( new SALOME_InteractiveObject( - entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ).toLatin1().constData() ) ), true, updateView ); + entry.toLatin1().constData(), + "GEOM", strdup( GEOMBase::GetName( object ).toLatin1().constData() ) ), true, updateView ); } } @@ -173,8 +189,8 @@ void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView // Purpose : //================================================================ void GEOMBase_Helper::redisplay( const ObjectList& objList, - const bool withChildren, - const bool updateView ) + const bool withChildren, + const bool updateView ) { ObjectList::const_iterator it = objList.begin(); for ( ; it != objList.end(); it++ ) { @@ -189,8 +205,8 @@ void GEOMBase_Helper::redisplay( const ObjectList& objList, // Purpose : //================================================================ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, - const bool withChildren, - const bool updateView ) + const bool withChildren, + const bool updateView ) { if ( !object->_is_nil() ) { // Unset color of shape ( this color may be set during preview displaying ) @@ -201,9 +217,9 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, // Enable activisation of selection getDisplayer()->SetToActivate( true ); - std::string entry = getEntry( object ); + QString entry = getEntry( object ); getDisplayer()->Redisplay(new SALOME_InteractiveObject - (entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object).toLatin1().constData())), false); + (entry.toLatin1().constData(), "GEOM", strdup(GEOMBase::GetName(object).toLatin1().constData())), false); } if ( withChildren ) { @@ -213,18 +229,18 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(object); _PTR(SObject) aSObj (aStudy->FindObjectIOR(std::string(objStr.in()))); if ( aSObj ) { - _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); - for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { - GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); + for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { + GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow (GeometryGUI::ClientSObjectToObject(anIt->Value())); - if ( !CORBA::is_nil( aChild ) ) { - if ( !aChild->_is_nil() ) { - std::string entry = getEntry( aChild ); - getDisplayer()->Redisplay( new SALOME_InteractiveObject( - entry.c_str(), "GEOM", strdup( GEOMBase::GetName( aChild ).toLatin1().constData() ) ), false ); - } - } - } + if ( !CORBA::is_nil( aChild ) ) { + if ( !aChild->_is_nil() ) { + QString entry = getEntry( aChild ); + getDisplayer()->Redisplay( new SALOME_InteractiveObject( + entry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( aChild ).toLatin1().constData() ) ), false ); + } + } + } } } } @@ -237,13 +253,19 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, // Function : displayPreview // Purpose : Method for displaying preview based on execute() results //================================================================ -void GEOMBase_Helper::displayPreview( const bool activate, +void GEOMBase_Helper::displayPreview( const bool display, + const bool activate, const bool update, const bool toRemoveFromEngine, - const double lineWidth, - const int displayMode, + const double lineWidth, + const int displayMode, const int color ) { + if(!display) { + erasePreview( update ); + return; + } + isPreview = true; QString msg; if ( !isValid( msg ) ) @@ -258,15 +280,20 @@ void GEOMBase_Helper::displayPreview( const bool activate, try { SUIT_OverrideCursor wc; ObjectList objects; + + if ( !isWaitCursorEnabled() ) + wc.suspend(); + if ( !execute( objects ) || !getOperation()->IsDone() ) { wc.suspend(); } else { for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { - displayPreview( *it, true, activate, false, lineWidth, displayMode, color ); + GEOM::GEOM_Object_var obj=*it; + displayPreview( obj, true, activate, false, lineWidth, displayMode, color ); if ( toRemoveFromEngine ) - getGeomEngine()->RemoveObject( *it ); + obj->UnRegister(); } } } @@ -288,16 +315,21 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, const bool append, const bool activate, const bool update, - const double lineWidth, - const int displayMode, + const double lineWidth, + const int displayMode, const int color ) { // Set color for preview shape getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color ); // set width of displayed shape - getDisplayer()->SetWidth( lineWidth ); - + int lw = lineWidth; + if(lw == -1) { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + lw = resMgr->integerValue("Geometry", "preview_edge_width", -1); + } + getDisplayer()->SetWidth( lw ); + // set display mode of displayed shape int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode ); @@ -340,7 +372,7 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs, if ( myViewWindow == 0 ) return; - + // Display prs SUIT_ViewManager* aViewManager = myViewWindow->getViewManager(); if ( aViewManager->getType() == OCCViewer_Viewer::Type() || @@ -349,7 +381,7 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs, SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); SALOME_View* aView = dynamic_cast(aViewModel); if (aView) - aView->Display( prs ); + aView->Display( prs ); } // Add prs to the preview list @@ -372,15 +404,15 @@ void GEOMBase_Helper::erasePreview( const bool update ) for ( PrsList::iterator anIter = myPreview.begin(); anIter != myPreview.end(); ++anIter ) { if ( vfOK ) { - SUIT_ViewManager* aViewManager = myViewWindow->getViewManager(); - if ( aViewManager->getType() == OCCViewer_Viewer::Type() || - aViewManager->getType() == SVTK_Viewer::Type() ) - { - SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); - SALOME_View* aView = dynamic_cast(aViewModel); - if (aView) - aView->Erase( *anIter, true ); - } + SUIT_ViewManager* aViewManager = myViewWindow->getViewManager(); + if ( aViewManager->getType() == OCCViewer_Viewer::Type() || + aViewManager->getType() == SVTK_Viewer::Type() ) + { + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView) + aView->Erase( *anIter, true ); + } } delete *anIter; } @@ -427,7 +459,7 @@ void GEOMBase_Helper::activate( const int theType ) //================================================================ // Function : localSelection -// Purpose : Activate selection of subshapes in accordance with mode +// Purpose : Activate selection of sub-shapes in accordance with mode // theMode is from TopAbs_ShapeEnum //================================================================ void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMode ) @@ -440,10 +472,10 @@ void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMo GEOM::GEOM_Object_ptr anObj = *anIter; if ( anObj->_is_nil() ) continue; - std::string aEntry = getEntry( anObj ); - if ( aEntry != "" ) + QString anEntry = getEntry( anObj ); + if ( anEntry != "" ) aListOfIO.Append( new SALOME_InteractiveObject( - aEntry.c_str(), "GEOM", strdup( GEOMBase::GetName( anObj ).toLatin1().constData() ) ) ); + anEntry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( anObj ).toLatin1().constData() ) ) ); } getDisplayer()->LocalSelection( aListOfIO, theMode ); @@ -451,7 +483,7 @@ void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMo //================================================================ // Function : localSelection -// Purpose : Activate selection of subshapes in accordance with mode +// Purpose : Activate selection of sub-shapes in accordance with mode // theMode is from TopAbs_ShapeEnum //================================================================ void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode ) @@ -470,7 +502,7 @@ void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode //================================================================ // Function : globalSelection -// Purpose : Activate selection of subshapes. Set selection filters +// Purpose : Activate selection of sub-shapes. Set selection filters // in accordance with mode. theMode is from GEOMImpl_Types //================================================================ void GEOMBase_Helper::globalSelection( const int theMode, const bool update ) @@ -480,23 +512,23 @@ void GEOMBase_Helper::globalSelection( const int theMode, const bool update ) //================================================================ // Function : globalSelection -// Purpose : Activate selection of subshapes. Set selection filters +// Purpose : Activate selection of sub-shapes. Set selection filters // in accordance with mode. theMode is from GEOMImpl_Types //================================================================ void GEOMBase_Helper::globalSelection( const TColStd_MapOfInteger& theModes, - const bool update ) + const bool update ) { getDisplayer()->GlobalSelection( theModes, update ); } //================================================================ // Function : globalSelection -// Purpose : Activate selection of subshapes. Set selection filters +// Purpose : Activate selection of sub-shapes. Set selection filters // in accordance with mode. theMode is from GEOMImpl_Types //================================================================ void GEOMBase_Helper::globalSelection( const TColStd_MapOfInteger& theModes, const QList& subShapes, - const bool update ) + const bool update ) { getDisplayer()->GlobalSelection( theModes, update, &subShapes ); } @@ -505,14 +537,14 @@ void GEOMBase_Helper::globalSelection( const TColStd_MapOfInteger& theModes, // Function : addInStudy // Purpose : Add object in study //================================================================ -void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theName ) +QString GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theName ) { if ( !hasCommand() ) - return; + return QString(); _PTR(Study) aStudy = getStudy()->studyDS(); if ( !aStudy || theObj->_is_nil() ) - return; + return QString(); SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy(aStudy); @@ -521,9 +553,16 @@ void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theN SALOMEDS::SObject_var aSO = getGeomEngine()->AddInStudy(aStudyDS, theObj, theName, aFatherObj); + QString anEntry; + if ( !aSO->_is_nil() ) + anEntry = aSO->GetID(); + // Each dialog is responsible for this method implementation, // default implementation does nothing restoreSubShapes(aStudyDS, aSO); + aSO->UnRegister(); + + return anEntry; } //================================================================ @@ -599,7 +638,7 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const { anApp = it.next(); if ( anApp && anApp->desktop() == aDesktop ) - break; + break; } return dynamic_cast(anApp->activeStudy()); @@ -609,18 +648,15 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const // Function : getEntry // Purpose : //================================================================ -char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const +QString GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const { SalomeApp_Study* study = getStudy(); if ( study ) { - char * objIOR = GEOMBase::GetIORFromObject( object ); - std::string IOR( objIOR ); - free( objIOR ); - if ( IOR != "" ) { - _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); - if ( SO ) { - return (char*) TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString(); - } + QString objIOR = GEOMBase::GetIORFromObject( object ); + if ( objIOR != "" ) { + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( objIOR.toLatin1().constData() ) ); + if ( SO ) + return QString::fromStdString(SO->GetID()); } } return ""; @@ -648,7 +684,7 @@ void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj ); TCollection_AsciiString asciiIOR( (char *)IOR.in() ); - GEOM_Client().RemoveShapeFromBuffer( asciiIOR ); + GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR ); if ( !getStudy() || !getStudy()->studyDS() ) return; @@ -664,7 +700,7 @@ void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { _PTR(AttributeIOR) anIOR ( anAttr ); TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); - GEOM_Client().RemoveShapeFromBuffer( asciiIOR ); + GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR ); } } } @@ -677,7 +713,10 @@ bool GEOMBase_Helper::openCommand() { bool res = false; if ( !getStudy() || hasCommand() ) + { + MESSAGE("Getting out from openCommand()") return res; + } GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() ); if ( !anOp->_is_nil() ) { @@ -685,6 +724,10 @@ bool GEOMBase_Helper::openCommand() myCommand->start(); res = true; } + else + { + MESSAGE("anOp->_is_nil() = true") + } return res; } @@ -699,6 +742,7 @@ bool GEOMBase_Helper::abortCommand() return false; myCommand->abort(); + delete myCommand; // I don't know where to delete this object here ? myCommand = 0; return true; @@ -714,6 +758,7 @@ bool GEOMBase_Helper::commitCommand( const char* ) return false; myCommand->commit(); + delete myCommand; // I don't know where to delete this object here ? myCommand = 0; return true; @@ -725,6 +770,7 @@ bool GEOMBase_Helper::commitCommand( const char* ) //================================================================ bool GEOMBase_Helper::hasCommand() const { + bool res = (bool) myCommand; return (bool)myCommand; } @@ -753,8 +799,8 @@ bool GEOMBase_Helper::checkViewWindow() QListIterator it( aViewWindowsList ); while ( it.hasNext() ) { - if ( myViewWindow == it.next() ) - return true; + if ( myViewWindow == it.next() ) + return true; } } myViewWindow = 0; @@ -767,19 +813,23 @@ bool GEOMBase_Helper::checkViewWindow() // It perfroms user input validation, then it // performs a proper operation and manages transactions, etc. //================================================================ -bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) +bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, bool erasePreviewFlag ) { SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return false; + if ( !appStudy ) + { + MESSAGE("appStudy is empty") + return false; + } _PTR(Study) aStudy = appStudy->studyDS(); bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); SUIT_MessageBox::warning ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return false; } @@ -788,8 +838,11 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) showError( msg ); return false; } + + if(erasePreviewFlag) + erasePreview( false ); - erasePreview( false ); + bool result = false; try { if ( ( !publish && !useTransaction ) || openCommand() ) { @@ -797,63 +850,79 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) SUIT_Session::session()->activeApplication()->putInfo( "" ); ObjectList objects; if ( !execute( objects ) || !getOperation()->IsDone() ) { - wc.suspend(); - abortCommand(); - showError(); + wc.suspend(); + abortCommand(); + showError(); } else { - addSubshapesToStudy(); // add Subshapes if local selection - const int nbObjs = objects.size(); + addSubshapesToStudy(); // add Sub-shapes if local selection + const int nbObjs = objects.size(); + QStringList anEntryList; int aNumber = 1; - for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { - if ( publish ) { - QString aName = getNewObjectName(); - if ( nbObjs > 1 ) { + for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { + GEOM::GEOM_Object_var obj=*it; + if ( publish ) { + QString aName = getNewObjectName(); + if ( nbObjs > 1 ) { if (aName.isEmpty()) - aName = getPrefix(*it); + aName = getPrefix(obj); if (nbObjs <= 30) { // Try to find a unique name - aName = GEOMBase::GetDefaultName(aName); + aName = GEOMBase::GetDefaultName(aName, extractPrefix()); } else { // Don't check name uniqueness in case of numerous objects aName = aName + "_" + QString::number(aNumber++); } - } else { - // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() - if ( aName.isEmpty() ) - aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); - } - addInStudy( *it, aName.toLatin1().constData() ); + } else { + // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() + if ( aName.isEmpty() ) + aName = GEOMBase::GetDefaultName( getPrefix( obj ) ); + } + anEntryList << addInStudy( obj, aName.toLatin1().constData() ); // updateView=false - display( *it, false ); - } - else { + display( obj, false ); +#ifdef WITHGENERICOBJ + // obj has been published in study. Its refcount has been incremented. + // It is safe to decrement its refcount + // so that it will be destroyed when the entry in study will be removed + obj->UnRegister(); +#endif + } + else { // asv : fix of PAL6454. If publish==false, then the original shape // was modified, and need to be re-cached in GEOM_Client before redisplay - clearShapeBuffer( *it ); + clearShapeBuffer( obj ); // withChildren=true, updateView=false - redisplay( *it, true, false ); + redisplay( obj, true, false ); } - } - - if ( nbObjs ) { - commitCommand(); - updateObjBrowser(); - SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); - } - else - abortCommand(); + } + + if ( nbObjs ) { + commitCommand(); + updateObjBrowser(); + if( SUIT_Application* anApp = SUIT_Session::session()->activeApplication() ) { + LightApp_Application* aLightApp = dynamic_cast( anApp ); + if(aLightApp && !isDisableBrowsing() ) + aLightApp->browseObjects( anEntryList, isApplyAndClose(), isOptimizedBrowsing() ); + anApp->putInfo( QObject::tr("GEOM_PRP_DONE") ); + } + result = true; + } + else + abortCommand(); } } } catch( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); abortCommand(); + MESSAGE("Exception catched") } updateViewer(); - return true; + MESSAGE("result ="<activeApplication()->desktop(), - QObject::tr( "GEOM_ERROR_STATUS" ), - msg, - QObject::tr( "BUT_OK" ) ); + QObject::tr( "GEOM_ERROR_STATUS" ), + msg, + QObject::tr( "BUT_OK" ) ); } //================================================================ @@ -942,6 +1011,17 @@ QString GEOMBase_Helper::getNewObjectName() const return QString::null; } +//================================================================ +// Function : extractPrefix +// Purpose : Redefine this method to return \c true if necessary +// to extract prefix when generating new name for the +// object(s) being created +//================================================================ +bool GEOMBase_Helper::extractPrefix() const +{ + return false; +} + //================================================================ // Function : getPrefix // Purpose : Get prefix for name of created object @@ -951,11 +1031,6 @@ QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const if ( !myPrefix.isEmpty() || theObj->_is_nil() ) return myPrefix; - //TopoDS_Shape aShape; - //if ( !GEOMBase::GetShape( theObj, aShape ) ) - // return ""; - // - //long aType = aShape.ShapeType(); GEOM::shape_type aType = theObj->GetShapeType(); switch ( aType ) @@ -984,7 +1059,7 @@ SUIT_Desktop* GEOMBase_Helper::getDesktop() const //================================================================ // Function : selectObjects -// Purpose : Selects list of objects +// Purpose : Selects list of objects //================================================================ bool GEOMBase_Helper::selectObjects( ObjectList& objects ) { @@ -992,12 +1067,11 @@ bool GEOMBase_Helper::selectObjects( ObjectList& objects ) ObjectList::iterator anIter; for ( anIter = objects.begin(); anIter != objects.end(); ++anIter ) { - std::string entry = getEntry( *anIter ); - QString aEntry( entry.c_str() ); - LightApp_DataOwner* anOwher = new LightApp_DataOwner( aEntry ); + QString anEntry = getEntry( *anIter ); + LightApp_DataOwner* anOwher = new LightApp_DataOwner( anEntry ); aList.append( anOwher ); } - + SUIT_Session* session = SUIT_Session::session(); SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); if ( !app ) @@ -1006,12 +1080,12 @@ bool GEOMBase_Helper::selectObjects( ObjectList& objects ) LightApp_SelectionMgr* aMgr = app->selectionMgr(); if ( !aMgr ) return false; - + aMgr->setSelected( aList, false ); - + return true; } - + //================================================================ // Function : findObjectInFather // Purpose : It should return an object if its founded in study or @@ -1024,8 +1098,8 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather (GEOM::GEOM_Object_ptr dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); _PTR(Study) aDStudy = appStudy->studyDS(); - std::string IOR = GEOMBase::GetIORFromObject( theFather ); - _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR ) ); + QString IOR = GEOMBase::GetIORFromObject( theFather ); + _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR.toLatin1().constData() ) ); bool inStudy = false; GEOM::GEOM_Object_var aReturnObject; @@ -1040,50 +1114,265 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather (GEOM::GEOM_Object_ptr } if (inStudy) return aReturnObject._retn(); - + return GEOM::GEOM_Object::_nil(); } + +//================================================================ +// Function : findObjectInFather +// Purpose : It should return an object if its founded in study or +// return Null object if the object is not founded +//================================================================ +GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr theFather, + int theIndex ) +{ + GEOM::GEOM_Object_var object; + bool found = false; + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + QString IOR = GEOMBase::GetIORFromObject( theFather ); + _PTR(SObject) sobject( studyDS->FindObjectIOR( IOR.toLatin1().constData() ) ); + if ( sobject ) { + _PTR(ChildIterator) it( studyDS->NewChildIterator( sobject ) ); + for ( ; it->More() && !found; it->Next() ) { + GEOM::GEOM_Object_var cobject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( it->Value() ) ); + if ( !CORBA::is_nil( cobject ) ) { + GEOM::ListOfLong_var indices = cobject->GetSubShapeIndices(); + int length = indices->length(); + for ( int i = 0; i < length && !found; i++ ) { + if ( indices[i] == theIndex ) { + object = cobject; + found = true; + } + } + } + } + } + } + + return object._retn(); +} + //================================================================ // Function : addSubshapesToStudy -// Purpose : Virtual method to add subshapes if needs -//================================================================ +// Purpose : Virtual method to add sub-shapes if needs +//================================================================ void GEOMBase_Helper::addSubshapesToStudy() { //Impemented in Dialogs, called from Accept method } //================================================================ -// Function : addSubshapesToFather -// Purpose : Method to add Father Subshapes to Study if it`s not exist -//================================================================ -void GEOMBase_Helper::addSubshapesToFather( QMap& theMap ) +// Function : getSelected +// Purpose : Get selected object by specified type +// +// Returns valid object if only one object of the specified type is selected +// (no matter global or local selection is activated). If \a type is TopAbs_SHAPE, +// geometrical object of any valid type is expected. +// +// \param type type of the object to be obtained from selection +// \return selected geometrical object or nil object if selection is not satisfactory +//================================================================ +GEOM::GeomObjPtr GEOMBase_Helper::getSelected( TopAbs_ShapeEnum type ) { - //GetStudyDS - SalomeApp_Application* app = - dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); - _PTR(Study) aDStudy = appStudy->studyDS(); + QList types; + types << type; + return getSelected( types ); +} - GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() ); - - for( QMap::Iterator it = theMap.begin(); it != theMap.end(); it++ ) - { - if ( !anOp->_is_nil() ) { - GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.value() ); - if ( !aFatherObj->_is_nil() ) { - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() ); - - //Add Object to study if its not exist - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) - GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy), - it.value(), it.key().toLatin1().data(), aFatherObj ); +//================================================================ +// Function : getSelected +// Purpose : Get selected object by specified types +// +// Returns valid object if only one object of the specified type is selected +// (no matter global or local selection is activated). The list of allowed +// shape types is passed via \a types. If \a types includes TopAbs_SHAPE, +// geometrical object of any valid type is expected. +// +// \param types list of allowed shape types for the objects to be obtained from selection +// \return selected geometrical object or nil object if selection is not satisfactory +//================================================================ +GEOM::GeomObjPtr GEOMBase_Helper::getSelected( const QList& types ) +{ + QList selected = getSelected( types, 1 ); + return selected.count() > 0 ? selected[0] : GEOM::GeomObjPtr(); +} + +//================================================================ +// Function : getSelected +// Purpose : Get selected object(s) by specified type +// +// Returns list of selected objects if selection satisfies specifies selection options. +// (no matter global or local selection is activated). If \a type is TopAbs_SHAPE, +// geometrical objects of any valid type are expected. +// +// The \a type parameter specifies allowed type of the object(s) being selected. +// The \a count parameter specifies exact number of the objects to be retrieved from selection. +// The \a strict parameter specifies policy being applied to the selection. +// If \a count < 0, then any number of the selected objects is valid (including 0). +// In this case, if \a strict is \c true (default), all selected objects should satisfy +// the specified \a type. +// If \a count > 0, only specified number of the objects is retrieved from the selection. +// In this case, if \a strict is \c true (default), function returns empty list if total number of selected +// objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false), +// function returns valid list of objects if at least \a count objects satisfy specified \a type. +// +// \param type type of the object(s) to be obtained from selection +// \param count number of items to be retrieved from selection +// \param strict selection policy +// \return list of selected geometrical objects or empty list if selection is not satisfactory +//================================================================ +QList GEOMBase_Helper::getSelected( TopAbs_ShapeEnum type, int count, bool strict ) +{ + QList types; + types << type; + return getSelected( types, count, strict ); +} + +static bool typeInList( TopAbs_ShapeEnum type, const QList& types ) +{ + bool ok = false; + for ( int i = 0; i < types.count() && !ok; i++ ) + ok = types[i] == TopAbs_SHAPE || types[i] == type; + return ok; +} + +//================================================================ +// Function : getSelected +// Purpose : Get selected objects by specified types +// +// Returns list of selected objects if selection satisfies specifies selection options. +// (no matter global or local selection is activated). If \a types includes TopAbs_SHAPE, +// geometrical objects of any valid type are expected. +// +// The \a types parameter specifies allowed types of the object(s) being selected. +// The \a count parameter specifies exact number of the objects to be retrieved from selection. +// The \a strict parameter specifies policy being applied to the selection. +// If \a count < 0, then any number of the selected objects is valid (including 0). +// In this case, if \a strict is \c true (default), all selected objects should satisfy +// the specified \a type. +// If \a count > 0, only specified number of the objects is retrieved from the selection. +// In this case, if \a strict is \c true (default), function returns empty list if total number of selected +// objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false), +// function returns valid list of objects if at least \a count objects satisfy specified \a type. +// +// \param types list of allowed shape types for the objects to be obtained from selection +// \param count number of items to be retrieved from selection +// \param strict selection policy +// \return list of selected geometrical objects or empty list if selection is not satisfactory +//================================================================ +QList GEOMBase_Helper::getSelected( const QList& types, int count, bool strict ) +{ + SUIT_Session* session = SUIT_Session::session(); + QList result; + + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) { + LightApp_SelectionMgr* selMgr = app->selectionMgr(); + if ( selMgr ) { + SALOME_ListIO selected; + selMgr->selectedObjects( selected ); + SALOME_ListIteratorOfListIO it( selected ); + bool stopped = false; + for ( ; it.More() && !stopped; it.Next() ) { + Handle(SALOME_InteractiveObject) IO = it.Value(); + GEOM::GeomObjPtr object = GEOMBase::ConvertIOinGEOMObject( IO ); + if ( object ) { + TColStd_IndexedMapOfInteger subShapes; + selMgr->GetIndexes( IO, subShapes ); + int nbSubShapes = subShapes.Extent(); + if ( nbSubShapes == 0 ) { + // global selection + if ( typeInList( (TopAbs_ShapeEnum)(object->GetShapeType()), types ) ) { + result << object; + if ( count > 0 ) { + if ( strict && result.count() > count ) { + result.clear(); + stopped = true; + } + else if ( !strict && result.count() == count ) + stopped = true; + } + } + else if ( strict ) { + result.clear(); + stopped = true; + } + } + else { + // local selection + for ( int i = 1; i <= nbSubShapes && !stopped; i++ ) { + int idx = subShapes( i ); + GEOM::GeomObjPtr subShape = findObjectInFather( object.get(), idx ); + if ( !subShape ) { + // sub-shape is not yet published in the study + GEOM::ShapesOpPtr shapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + subShape.take( shapesOp->GetSubShape( object.get(), idx ) ); // take ownership! + } + if ( typeInList( (TopAbs_ShapeEnum)(subShape->GetShapeType()), types ) ) { + result << subShape; + if ( count > 0 ) { + if ( strict && result.count() > count ) { + result.clear(); + stopped = true; + } + else if ( !strict && result.count() == count ) + stopped = true; + } + } + else if ( strict ) { + result.clear(); + stopped = true; + } + } + } } } - else { - //cout << " anOperations is NULL! " << endl; - } } -} + } + return result; +} - +//================================================================ +// Function : setIsApplyAndClose +// Purpose : Set value of the flag indicating that the dialog is +// accepted by Apply & Close button +//================================================================ +void GEOMBase_Helper::setIsApplyAndClose( const bool theFlag ) +{ + myIsApplyAndClose = theFlag; +} + +//================================================================ +// Function : isApplyAndClose +// Purpose : Get value of the flag indicating that the dialog is +// accepted by Apply & Close button +//================================================================ +bool GEOMBase_Helper::isApplyAndClose() const +{ + return myIsApplyAndClose; +} + +//================================================================ +// Function : setIsOptimizedBrowsing +// Purpose : Set value of the flag switching to optimized +// browsing mode (to select the first published +// object only) +//================================================================ +void GEOMBase_Helper::setIsOptimizedBrowsing( const bool theFlag ) +{ + myIsOptimizedBrowsing = theFlag; +} + +//================================================================ +// Function : isOptimizedBrowsing +// Purpose : Get value of the flag switching to optimized +// browsing mode (to select the first published +// object only) +//================================================================ +bool GEOMBase_Helper::isOptimizedBrowsing() const +{ + return myIsOptimizedBrowsing; +} diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index d8bc391d4..5d32fd268 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMBase_Helper.h // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) @@ -27,6 +28,7 @@ #define GEOMBASE_HELPER_H #include "GEOM_GEOMBase.hxx" +#include "GEOM_GenericObjPtr.h" #include #include @@ -70,7 +72,8 @@ protected: void redisplay ( const ObjectList&, const bool = true, const bool = true ); void redisplay ( GEOM::GEOM_Object_ptr, const bool = true, const bool = true ); - virtual void displayPreview ( const bool activate = false, + virtual void displayPreview ( const bool display, + const bool activate = false, const bool update = true, const bool toRemoveFromEngine = true, const double lineWidth = -1, @@ -87,8 +90,8 @@ protected: const int displayMode = -1, const int color = -1 ); void displayPreview ( const SALOME_Prs* prs, - const bool append = false, - const bool = true ); + const bool append = false, + const bool = true ); void erasePreview ( const bool = true ); void localSelection( const ObjectList&, const int ); @@ -102,7 +105,7 @@ protected: void prepareSelection( const ObjectList&, const int ); void prepareSelection( GEOM::GEOM_Object_ptr, const int ); - void addInStudy ( GEOM::GEOM_Object_ptr, const char* theName ); + QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName ); bool openCommand (); bool abortCommand (); @@ -114,7 +117,7 @@ protected: SalomeApp_Study* getStudy () const; bool checkViewWindow (); - bool onAccept( const bool publish = true, const bool useTransaction = true ); + bool onAccept( const bool publish = true, const bool useTransaction = true, bool erasePreviewFlag = true); // This method should be called from "OK" button handler. // == true means that objects returned by execute() // should be published in a study. @@ -161,12 +164,17 @@ protected: // as a top-level object. virtual QString getNewObjectName() const; + virtual bool extractPrefix() const; virtual void addSubshapesToStudy(); GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, const QString& theName ); - //This Metod to find SubObject in theFather Object by Name (theName) + GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, int theIndex ); + // These methods are used to find published sub-object (sub-shape) in the parent object (main shape) - void addSubshapesToFather( QMap& theMap ); + GEOM::GeomObjPtr getSelected( TopAbs_ShapeEnum type ); + GEOM::GeomObjPtr getSelected( const QList& types ); + QList getSelected( TopAbs_ShapeEnum type, int count, bool strict = true ); + QList getSelected( const QList& types, int count, bool strict = true ); void SetIsPreview(const bool thePreview) {isPreview = thePreview;} bool IsPreview() {return isPreview;} @@ -174,8 +182,20 @@ protected: GEOM_Displayer* getDisplayer(); SUIT_Desktop* getDesktop() const; + virtual void setIsApplyAndClose( const bool theFlag ); + virtual bool isApplyAndClose() const; + + virtual void setIsOptimizedBrowsing( const bool theFlag ); + virtual bool isOptimizedBrowsing() const; + + virtual void setIsWaitCursorEnabled( const bool theFlag ) {myIsWaitCursorEnabled = theFlag;} + virtual bool isWaitCursorEnabled() const {return myIsWaitCursorEnabled ;} + virtual void setIsDisableBrowsing( const bool theFlag ) { myIsDisableBrowsing = theFlag; } + virtual bool isDisableBrowsing() const { return myIsDisableBrowsing; } + + private: - char* getEntry ( GEOM::GEOM_Object_ptr ) const; + QString getEntry( GEOM::GEOM_Object_ptr ) const; void clearShapeBuffer( GEOM::GEOM_Object_ptr ); private: @@ -190,6 +210,11 @@ private: bool isPreview; SALOME_ListIO mySelected; SUIT_Desktop* myDesktop; + bool myIsApplyAndClose; + bool myIsOptimizedBrowsing; + bool myIsWaitCursorEnabled; + bool myIsDisableBrowsing; //This flag enable/disable selection + //in the Object Browser newly created objects. }; diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index ad5d365d0..57be34955 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMBase_Skeleton.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -51,7 +52,7 @@ // true to construct a modal dialog. //================================================================================= GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : QDialog( parent, fl ), GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( theGeometryGUI ), @@ -71,6 +72,8 @@ GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* pare myMainFrame->GroupBoxPublish->setTitle( tr( "GEOM_PUBLISH_RESULT_GRP" ) ); myMainFrame->CheckBoxRestoreSS->setText( tr( "GEOM_RESTORE_SUB_SHAPES" ) ); + myMainFrame->CheckBoxAddPrefix->setText( tr( "GEOM_RSS_ADD_FREFIX" ) ); + myMainFrame->CheckBoxPreview->setText( tr("GEOM_PREVIEW") ); buttonCancel()->setText( tr( "GEOM_BUT_CLOSE" ) ); buttonOk()->setText( tr( "GEOM_BUT_APPLY_AND_CLOSE" ) ); @@ -123,12 +126,20 @@ void GEOMBase_Skeleton::Init() // connect help button on a private slot that displays help information connect( buttonHelp(), SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); + connect( myMainFrame->CheckBoxPreview, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); + /* displays Dialog */ myMainFrame->RadioButton1->setChecked( true ); myMainFrame->RadioButton4->hide(); myMainFrame->RadioButton5->hide(); myMainFrame->CheckBoxRestoreSS->setChecked( false ); + myMainFrame->CheckBoxAddPrefix->setChecked( true ); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + bool aPrv = (resMgr == 0) ? false : resMgr->booleanValue( "Geometry", "geom_preview", false ); + + myMainFrame->CheckBoxPreview->setChecked( aPrv ); myMainFrame->GroupBoxPublish->hide(); } @@ -137,7 +148,7 @@ void GEOMBase_Skeleton::Init() // purpose : //================================================================================= void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, - int min, int max, int step ) + int min, int max, int step ) { spinBox->setRange( min, max ); spinBox->setSingleStep( step ); @@ -148,14 +159,23 @@ void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, // purpose : //================================================================================= void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, - double min, double max, - double step, int decimals ) + double min, double max, + double step, const char* quantity ) { - spinBox->setPrecision( decimals ); - spinBox->setDecimals( decimals ); // it's necessary to set decimals before the range setting, + // Obtain precision from preferences + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 ); + + spinBox->setPrecision( aPrecision ); + spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting, // by default Qt rounds boundaries to 2 decimals at setRange spinBox->setRange( min, max ); spinBox->setSingleStep( step ); + + // Add a hint for the user saying how to tune precision + QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() ); + spinBox->setProperty( "validity_tune_hint", + QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) ); } //================================================================================= @@ -164,7 +184,7 @@ void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, // In this case PublishInStudy isn't called, so we need to update object's attributes manually //================================================================================= void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj, - const QStringList& theParameters) + const QStringList& theParameters) { SALOMEDS::Study_var aStudy = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS()); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); @@ -289,12 +309,37 @@ int GEOMBase_Skeleton::getConstructorId() const return -1; } +//================================================================================= +// function : setConstructorId( id ) +// purpose : +//================================================================================= void GEOMBase_Skeleton::setConstructorId( const int id ) { if ( myRBGroup && myRBGroup->button( id ) ) myRBGroup->button( id )->setChecked( true ); } +//================================================================================= +// function : unsetConstructorId +// purpose : +//================================================================================= +void GEOMBase_Skeleton::unsetConstructorId() +{ + // 0020428: EDF 906 GEOM : Performance for Group creation in GEOM + // uncheck all buttons + // workaround, because setChecked( false ) does not result in Qt4 + bool isExclusive = myRBGroup->exclusive(); + myRBGroup->setExclusive( false ); + QList btnList = myRBGroup->buttons(); + for ( int j = 0; j < 2; j++ ) + { + QList::const_iterator it = btnList.constBegin(); + for ( ; it != btnList.constEnd(); ++it ) + (*it)->setCheckable( j == 1 ); + } + myRBGroup->setExclusive( isExclusive ); +} + //================================================================================= // function : ClickOnHelp() // purpose : @@ -312,9 +357,9 @@ void GEOMBase_Skeleton::ClickOnHelp() platform = "application"; #endif SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ), - QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ), - QObject::tr( "BUT_OK" ) ); + QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ), + QObject::tr( "BUT_OK" ) ); } } @@ -372,3 +417,22 @@ void GEOMBase_Skeleton::keyPressEvent( QKeyEvent* e ) ClickOnHelp(); } } + +//================================================================================= +// function : showOnlyPreviewControl() +// purpose : display only CheckBoxPreview check box, +// hide CheckBoxRestoreSS and CheckBoxAddPrefix +//================================================================================= +void GEOMBase_Skeleton::showOnlyPreviewControl(){ + mainFrame()->GroupBoxPublish->show(); + mainFrame()->CheckBoxRestoreSS->hide(); + mainFrame()->CheckBoxAddPrefix->hide(); +} + +//================================================================================= +// function : processPreview() +// purpose : Display preview if CheckBoxPreview is checked +//================================================================================= +void GEOMBase_Skeleton::processPreview() { + displayPreview(mainFrame()->CheckBoxPreview->isChecked()); +} diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index a9f2c5aa2..bb6d75434 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMBase_Skeleton.h // Author : Damine COQUERET, Open CASCADE S.A.S. @@ -60,7 +61,7 @@ private: protected: void initSpinBox( QSpinBox*, int, int, int = 1 ); - void initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, int = 3 ); + void initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, const char* = "length_precision" ); void updateAttributes( GEOM::GEOM_Object_ptr, const QStringList& ); @@ -81,7 +82,12 @@ protected: /*! set selected "constructor" radio button id */ void setConstructorId( const int ); + /*! unset selection on all "constructor" radio buttons + */ + void unsetConstructorId(); + void showOnlyPreviewControl(); + void setHelpFileName( const QString& ); DlgRef_Skeleton* mainFrame(); @@ -101,6 +107,7 @@ protected: protected slots: virtual void ClickOnCancel(); + virtual void processPreview(); void LineEditReturnPressed(); void DeactivateActiveDialog(); void ActivateThisDialog(); diff --git a/src/GEOMBase/GEOM_GEOMBase.hxx b/src/GEOMBase/GEOM_GEOMBase.hxx index 8f19982a4..343fc4d39 100755 --- a/src/GEOMBase/GEOM_GEOMBase.hxx +++ b/src/GEOMBase/GEOM_GEOMBase.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_GEOMBase.hxx // Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) // @@ -26,7 +27,7 @@ #define GEOM_GEOMBASE_HXX #if defined WIN32 -# if defined GEOMBASE_EXPORTS +# if defined GEOMBASE_EXPORTS || defined GEOMBase_EXPORTS # define GEOMBASE_EXPORT __declspec( dllexport ) # else # define GEOMBASE_EXPORT __declspec( dllimport ) diff --git a/src/GEOMBase/GEOM_GenericObjPtr.cxx b/src/GEOMBase/GEOM_GenericObjPtr.cxx new file mode 100644 index 000000000..11d483133 --- /dev/null +++ b/src/GEOMBase/GEOM_GenericObjPtr.cxx @@ -0,0 +1,33 @@ +// Copyright (C) 2007-2012 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 +// +// File : GEOM_GenericObjPtr.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#include "GEOM_GenericObjPtr.h" + +namespace GEOM +{ + template<> bool GenericObjPtr::isSame( GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight ) + { + return !CORBA::is_nil( theLeft ) && !CORBA::is_nil( theRight ) && theLeft->IsSame( theRight ); + } +} diff --git a/src/GEOMBase/GEOM_GenericObjPtr.h b/src/GEOMBase/GEOM_GenericObjPtr.h new file mode 100644 index 000000000..b4ece1236 --- /dev/null +++ b/src/GEOMBase/GEOM_GenericObjPtr.h @@ -0,0 +1,236 @@ +// Copyright (C) 2007-2012 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 +// +// File : GEOM_GenericObjPtr.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#ifndef GEOM_GenericObjPtr_H +#define GEOM_GenericObjPtr_H + +#include "GEOM_GEOMBase.hxx" + +#include "SALOMEconfig.h" +#include CORBA_SERVER_HEADER(GEOM_Gen) + +namespace GEOM +{ + /*! + \class GenericObjPtr + \brief A smart pointer for the SALOME GenericObj interface. + + This class can be used in conjunction with the references to the CORBA objects which + interfaces are inherited from the SALOME::GenericObj CORBA interface. + + The smart pointer class automatically invokes Register() / UnRegister() functions of th + interface in order to prevent memory leaks and other such problems caused by improper + usage of the CORBA references. + + Smart pointers can be easily copied, stored within class as data members, passed to the + functions requiring native CORBA reference as parameters, etc. + + Usage: + - If you want to assign the smart pointer to the CORBA _var type variable, use copy() + function to make a copy of the stored CORBA object. Otherwise you might cause Segmentation + Fault error. + - To pass the smart pointer to the function that requires CORBA _ptr type parameter, + use get() function. + - If you want to take an ownership on the CORBA object, use take() function. + In case of SALOME Generic object this is useful when some function returns newly created + object that should be removed by the caller as soon as the object is no more required. + For example, function GetSubShape() of the GEOM_IShapesOperation interface always creates + new servant object and returns new object reference to it. If the object is not published + in the study, it has to be destroyed and the coresponding servant should be deleted. + + Examples: + \code + typedef GEOM::GenericObjPtr MyIPtr; + void MyInterface_ptr foo(); + void MyInterface_ptr bar( MyInterface_ptr p ); + + MyIPtr v1; // create empty (nil) pointer + MyIPtr v2 = foo(); // get some CORBA reference and store it within the smart pointer + v1 = v2; // copy smart pointer (reference counter is incremented) + v2 = bar( v1.get() ); // pass smart pointer to the function + MyInterface_var var = v2.copy(); // initialize _var variable with the smart pointer contents + v1.take( foo() ); // take ownership on the newly created object + \endcode + */ + + template class GenericObjPtr + { + typedef typename TInterface::_var_type TInterfaceVar; + typedef typename TInterface::_ptr_type TInterfacePtr; + + private: + TInterfaceVar myObject; + + private: + //! Increment counter for the object. + void Register() + { + if ( !CORBA::is_nil( this->myObject ) ) + this->myObject->Register(); + } + + //! Decrement counter for the object. + void UnRegister() + { + if ( !CORBA::is_nil( this->myObject ) ) { + this->myObject->UnRegister(); + this->myObject = TInterface::_nil(); + } + } + + public: + //! Initialize pointer to nil generic object reference. + GenericObjPtr() + {} + + //! Initialize pointer to the given generic object reference. + GenericObjPtr( TInterfacePtr theObject ) + { + this->myObject = TInterface::_duplicate( theObject ); + this->Register(); + } + + //! Initialize pointer with a new reference to the same object referenced by given pointer. + GenericObjPtr( const GenericObjPtr& thePointer ) + { + this->myObject = thePointer.myObject; + this->Register(); + } + + //! Destroy pointer and remove the reference to the object. + ~GenericObjPtr() + { + this->UnRegister(); + } + + //! Assign object to reference and remove reference to an old object. + GenericObjPtr& operator=( TInterfacePtr theObject ) + { + this->UnRegister(); + this->myObject = TInterface::_duplicate( theObject ); + this->Register(); + return *this; + } + + //! Assign object to reference and remove reference to an old object. + GenericObjPtr& operator=( const GenericObjPtr& thePointer ) + { + this->UnRegister(); + this->myObject = thePointer.myObject; + this->Register(); + return *this; + } + + static bool isSame( TInterfacePtr theLeft, TInterfacePtr theRight ) + { + return theLeft->_is_equivalent( theRight ); + } + + //! Check equivalence + bool operator==( TInterfacePtr theObject ) + { + return isSame( this->myObject, theObject ); + } + + //! Check equivalence + bool operator==( const GenericObjPtr& thePointer ) + { + return isSame( this->myObject, thePointer.get() );; + } + + //! Check difference + bool operator!=( TInterfacePtr theObject ) + { + return !isSame( this->myObject, theObject ); + } + + //! Check difference + bool operator!=( const GenericObjPtr& thePointer ) + { + return !isSame( this->myObject, thePointer.get() );; + } + + //! Provides normal pointer target member access using operator ->. + TInterfacePtr operator->() const + { + return this->get(); + } + + //! Check validity of the pointer. + operator bool() const + { + return !this->isNull(); + } + + //! Initialize pointer to the given generic object reference and take ownership on it. + void take( TInterfacePtr theObject ) + { + this->UnRegister(); + this->myObject = TInterface::_duplicate( theObject ); + } + + //! Get the contained object. + TInterfacePtr get() const + { + return this->myObject; + } + + //! Make the copy of the contained object and return it (caller becomes owner of the CORBA reference). + TInterfacePtr copy() const + { + return TInterface::_duplicate( this->myObject ); + } + + //! Check if pointer is null. + bool isNull() const + { + return CORBA::is_nil( this->myObject ); + } + + //! Nullify pointer. + void nullify() + { + this->UnRegister(); + } + }; + + typedef GenericObjPtr GeomObjPtr; + typedef GenericObjPtr BasicOpPtr; + typedef GenericObjPtr TransformOpPtr; + typedef GenericObjPtr I3DPrimOpPtr; + typedef GenericObjPtr ShapesOpPtr; + typedef GenericObjPtr BlocksOpPtr; + typedef GenericObjPtr BooleanOpPtr; + typedef GenericObjPtr CurvesOpPtr; + typedef GenericObjPtr LocalOpPtr; + typedef GenericObjPtr HealingOpPtr; + typedef GenericObjPtr InsertOpPtr; + typedef GenericObjPtr MeasureOpPtr; + typedef GenericObjPtr GroupOpPtr; + typedef GenericObjPtr AdvancedOpPtr; + + template<> bool GEOMBASE_EXPORT GenericObjPtr::isSame( GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight ); +} + +#endif // GEOM_GenericObjPtr_H diff --git a/src/GEOMBase/GEOM_Operation.cxx b/src/GEOMBase/GEOM_Operation.cxx index 060f4e26d..da43f6770 100644 --- a/src/GEOMBase/GEOM_Operation.cxx +++ b/src/GEOMBase/GEOM_Operation.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOM_Operation.cxx // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) diff --git a/src/GEOMBase/GEOM_Operation.h b/src/GEOMBase/GEOM_Operation.h index 39e9fd682..bc33e9d60 100644 --- a/src/GEOMBase/GEOM_Operation.h +++ b/src/GEOMBase/GEOM_Operation.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOM_Operation.h // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) diff --git a/src/GEOMBase/Makefile.am b/src/GEOMBase/Makefile.am index 5c7b9bdb9..c66a80519 100644 --- a/src/GEOMBase/Makefile.am +++ b/src/GEOMBase/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOMBASE : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -35,13 +33,15 @@ salomeinclude_HEADERS = \ GEOMBase_Skeleton.h \ GEOMBase_Helper.h \ GEOM_Operation.h \ - GEOM_GEOMBase.hxx + GEOM_GEOMBase.hxx \ + GEOM_GenericObjPtr.h dist_libGEOMBase_la_SOURCES = \ GEOMBase.cxx \ GEOMBase_Skeleton.cxx \ GEOMBase_Helper.cxx \ - GEOM_Operation.cxx + GEOM_Operation.cxx \ + GEOM_GenericObjPtr.cxx MOC_FILES = \ GEOMBase_Skeleton_moc.cxx @@ -61,14 +61,14 @@ libGEOMBase_la_CPPFLAGS = \ $(GUI_CXXFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ + $(OPENCV_INCLUDES) \ -I$(srcdir)/../OBJECT \ -I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../DlgRef \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOMBase_la_LDFLAGS = \ ../../idl/libSalomeIDLGEOM.la \ @@ -76,4 +76,5 @@ libGEOMBase_la_LDFLAGS = \ ../DlgRef/libDlgRef.la \ $(KERNEL_LDFLAGS) -lOpUtil \ $(GUI_LDFLAGS) -lsuit -lOCCViewer -lVTKViewer -lSVTK -lSalomePrs -lSalomeApp -lCAM \ - $(CAS_LDPATH) -lTKPrim + $(CAS_LDPATH) -lTKPrim \ + $(OPENCV_LIBS) diff --git a/src/GEOMClient/GEOMClient.pro b/src/GEOMClient/GEOMClient.pro deleted file mode 100644 index db1ca7959..000000000 --- a/src/GEOMClient/GEOMClient.pro +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMClient -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -CAS_TKTopAlgo = -L$${CASROOT}/Linux/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo - -CORBA_LIBS = -L$$(OMNIORBDIR)/lib -lomniORB4 -lomniDynamic4 -lCOS4 -lCOSDynamic4 -lomnithread - -STDLIB = -lstdc++ - -INCLUDEPATH += $${CORBA_INCLUDES} $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} $$(GEOM_ROOT_DIR)/idl ../../salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/idl -lSalomeIDLGEOM -L$$(GEOM_ROOT_DIR)/lib -lGEOMbasic $${KERNEL_LDFLAGS} -lSalomeIDLKernel -lOpUtil $${CAS_TKTopAlgo} $${CORBA_LIBS} $${STDLIB} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += GEOMCLIENT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = GEOM_Client.hxx - -SOURCES = GEOM_Client.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOMClient/GEOM_Client.cxx b/src/GEOMClient/GEOM_Client.cxx index 88bd374a3..52e007c28 100644 --- a/src/GEOMClient/GEOM_Client.cxx +++ b/src/GEOMClient/GEOM_Client.cxx @@ -1,35 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client // File : GEOM_Client.cxx // Author : Yves FRICAUD/Lucien PIGNOLONI // Module : GEOM -// $Header$ -// + #include #include -#include +#include #include "GEOM_Client.hxx" #include @@ -57,36 +55,34 @@ #define HST_CLIENT_LEN 256 - - //======================================================================= // function : Load() -// purpose : +// purpose : //======================================================================= TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape ) { - std::string hst_client = Kernel_Utils::GetHostname(); - - Engines::Container_var ctn_server = geom->GetContainerRef(); - long pid_server = ctn_server->getPID(); - - if ( (pid_client==pid_server) && (strcmp(hst_client.c_str(), ctn_server->getHostName())==0) ) { - TopoDS_Shape* S = (TopoDS_Shape*)(aShape->getShape()); - return(*S); - } else { - /* get sequence of bytes of resulting brep shape from GEOM server */ - TopoDS_Shape S; - SALOMEDS::TMPFile_var SeqFile = aShape->GetShapeStream(); - int sizebuf = SeqFile->length(); - char* buf; - buf = (char*) &SeqFile[0]; - std::istrstream streamBrep(buf,sizebuf); - BRep_Builder aBuilder; - BRepTools::Read(S, streamBrep, aBuilder); - return(S); - }; -} + std::string hst_client = Kernel_Utils::GetHostname(); + + Engines::Container_var ctn_server = geom->GetContainerRef(); + long pid_server = ctn_server->getPID(); + CORBA::String_var hostname = ctn_server->getHostName(); + if ( pid_client == pid_server && !strcmp(hst_client.c_str(), hostname.in()) ) { + TopoDS_Shape* S = (TopoDS_Shape*)(aShape->getShape()); + return(*S); + } else { + /* get sequence of bytes of resulting brep shape from GEOM server */ + TopoDS_Shape S; + SALOMEDS::TMPFile_var SeqFile = aShape->GetShapeStream(); + /*int sizebuf = */SeqFile->length(); + char* buf; + buf = (char*) &SeqFile[0]; + std::istringstream streamBrep(buf); + BRep_Builder aBuilder; + BRepTools::Read(S, streamBrep, aBuilder); + return(S); + } +} //======================================================================= // function : Create() @@ -94,7 +90,7 @@ TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr a //======================================================================= GEOM_Client::GEOM_Client() { - pid_client = + pid_client = #ifdef WNT (long)_getpid(); #else @@ -104,41 +100,68 @@ GEOM_Client::GEOM_Client() //======================================================================= // function : Create() -// purpose : +// purpose : Copy constructor +//======================================================================= +GEOM_Client::GEOM_Client(const GEOM_Client& client) +{ + _mySubShapes = client._mySubShapes; + myShapesMap = client.myShapesMap; + pid_client = client.pid_client; +} + +//======================================================================= +// function : Create() +// purpose : //======================================================================= GEOM_Client::GEOM_Client(Engines::Container_ptr client) { pid_client = client->getPID(); } +//======================================================================= +// function : get_client() +// purpose : Static method to have the only one instance of GEOM_Client +//======================================================================= +#ifdef SINGLE_CLIENT +GEOM_Client& GEOM_Client::get_client() +{ + static GEOM_Client a; + return a; +} +#else +GEOM_Client GEOM_Client::get_client() +{ + return GEOM_Client(); +} +#endif + //======================================================================= // function : Find() -// purpose : +// purpose : //======================================================================= -Standard_Integer GEOM_Client::Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) +Standard_Boolean GEOM_Client::Find (const TCollection_AsciiString& IOR, TopoDS_Shape& S) { - for ( Standard_Integer i = 1; i<= myIORs.Length(); i++ ) { - if (myIORs.Value(i).IsEqual(IOR)) { - S = myShapes.Value(i); - return i; - } + if (myShapesMap.count(IOR) != 0) { + S = myShapesMap[IOR]; + return Standard_True; } - return 0; + return Standard_False; } //======================================================================= // function : Find() -// purpose : +// purpose : //======================================================================= -Standard_Integer GEOM_Client::Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) +Standard_Boolean GEOM_Client::Find (const TopoDS_Shape& S, TCollection_AsciiString& IOR) { - for ( Standard_Integer i = 1; i<= myShapes.Length(); i++ ) { - if (myShapes.Value(i) == S) { - IOR = myIORs.Value(i); - return i; + std::map< TCollection_AsciiString, TopoDS_Shape >::const_iterator it; + for (it = myShapesMap.begin(); it != myShapesMap.end(); ++it) { + if ((*it).second == S) { + IOR = (*it).first; + return Standard_True; } } - return 0; + return Standard_False; } //======================================================================= @@ -147,8 +170,7 @@ Standard_Integer GEOM_Client::Find( const TopoDS_Shape& S, TCollection_AsciiStri //======================================================================= void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S ) { - myIORs.Append(IOR); - myShapes.Append(S); + myShapesMap[IOR] = S; } //======================================================================= @@ -157,30 +179,26 @@ void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& //======================================================================= void GEOM_Client::RemoveShapeFromBuffer( const TCollection_AsciiString& IOR) { - if( myIORs.IsEmpty() ) - return ; - - TopoDS_Shape S ; - Standard_Integer anIndex = Find( IOR, S ) ; - if( anIndex != 0 ) { - myIORs.Remove(anIndex) ; - myShapes.Remove(anIndex) ; + if (myShapesMap.size() == 0) + return; + + if (myShapesMap.count(IOR) != 0) { + myShapesMap.erase(IOR); + _mySubShapes.erase(IOR); } - return ; } - //======================================================================= // function : ClearClientBuffer() // purpose : purge buffer //======================================================================= void GEOM_Client::ClearClientBuffer() { - if( myIORs.IsEmpty() ) - return ; - myIORs.Clear() ; - myShapes.Clear() ; - return ; + if (myShapesMap.size() == 0) + return; + + _mySubShapes.clear(); + myShapesMap.clear(); } //======================================================================= @@ -189,21 +207,21 @@ void GEOM_Client::ClearClientBuffer() //======================================================================= unsigned int GEOM_Client::BufferLength() { - return myIORs.Length() ; + return myShapesMap.size(); } - //======================================================================= // function : GetShape() -// purpose : +// purpose : //======================================================================= TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape ) { TopoDS_Shape S; - TCollection_AsciiString IOR = geom->GetStringFromIOR(aShape); - Standard_Integer anIndex = Find(IOR, S); + CORBA::String_var anIOR = geom->GetStringFromIOR(aShape); + TCollection_AsciiString IOR = (char*)anIOR.in(); + Standard_Boolean anIndex = Find(IOR, S); - if (anIndex != 0) return S; + if (anIndex) return S; /******* in case of a MAIN GEOM::SHAPE ********/ if (aShape->IsMainShape()) { @@ -217,20 +235,32 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p TopoDS_Shape aMainShape = GetShape (geom, aShape->GetMainShape()); GEOM::ListOfLong_var list = aShape->GetSubShapeIndices(); - TopTools_IndexedMapOfShape anIndices; - TopExp::MapShapes(aMainShape, anIndices); + CORBA::String_var aMainIOR = geom->GetStringFromIOR(aShape->GetMainShape()); + TCollection_AsciiString mainIOR = (char*)aMainIOR.in(); + + //find subshapes only one time + if (_mySubShapes.count(mainIOR) == 0) + { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aMainShape, anIndices); + Standard_Integer ii = 1, nbSubSh = anIndices.Extent(); + for (; ii <= nbSubSh; ii++) + { + _mySubShapes[mainIOR].push_back(anIndices.FindKey(ii)); + } + } /* Case of only one subshape */ if (list->length() == 1 && list[0] > 0) { - S = anIndices.FindKey(list[0]); + S = _mySubShapes[mainIOR][list[0]-1]; } else { BRep_Builder B; TopoDS_Compound aCompound; B.MakeCompound(aCompound); for (int i = 0; i < list->length(); i++) { - if (0 < list[i] && list[i] <= anIndices.Extent()) { - TopoDS_Shape aSubShape = anIndices.FindKey(list[i]); + if (0 < list[i] && list[i] <= _mySubShapes[mainIOR].size()) { + TopoDS_Shape aSubShape = _mySubShapes[mainIOR][list[i]-1]; B.Add(aCompound, aSubShape); } } diff --git a/src/GEOMClient/GEOM_Client.hxx b/src/GEOMClient/GEOM_Client.hxx index ba7a9ef6d..717efb331 100644 --- a/src/GEOMClient/GEOM_Client.hxx +++ b/src/GEOMClient/GEOM_Client.hxx @@ -1,36 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client // File : GEOM_Client.hxx // Author : Yves FRICAUD // Module : GEOM -// $Header$ -// + #ifndef _GEOM_Client_HeaderFile #define _GEOM_Client_HeaderFile #include #include CORBA_SERVER_HEADER(GEOM_Gen) -# + +#ifdef HAVE_FINITE +#undef HAVE_FINITE // E.A. fix a warning about redefinition of HAVE_FINITE in re-inclusion of Standard_values.h +#endif #ifndef _TColStd_SequenceOfAsciiString_HeaderFile #include #endif @@ -40,10 +41,10 @@ #ifndef _Standard_Integer_HeaderFile #include #endif + class TCollection_AsciiString; class TopoDS_Shape; - #ifndef _Standard_HeaderFile #include #endif @@ -52,7 +53,7 @@ class TopoDS_Shape; #endif #ifdef WNT - #if defined GEOMCLIENT_EXPORTS + #if defined GEOMCLIENT_EXPORTS || defined GEOMClient_EXPORTS #if defined WIN32 #define GEOMCLIENT_EXPORT __declspec( dllexport ) #else @@ -69,54 +70,79 @@ class TopoDS_Shape; #define GEOMCLIENT_EXPORT #endif +#include +#include +#include +#include + +/* + * if define SINGLE_CLIENT is not commented, the method get_client always returns the same GEOM_Client object (singleton object) + * and the SHAPE_READER macro can be used to define an object that is always this singleton object + * if define SINGLE_CLIENT is commented, we get the old way to define the GEOM_Client objects : get_client returns a new object + * and the SHAPE_READER macro defines also a new object + */ +#define SINGLE_CLIENT + //===================================================================== // GEOM_Client : class definition //===================================================================== class GEOMCLIENT_EXPORT GEOM_Client { -public: - - inline void* operator new(size_t,void* anAddress) + public: + + inline void* operator new(size_t,void* anAddress) { return anAddress; } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); + inline void* operator new(size_t size) + { + return Standard::Allocate(size); } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); } // Methods PUBLIC - // - //Standard_EXPORT + // + //Standard_EXPORT GEOM_Client(); - //Standard_EXPORT + //Standard_EXPORT GEOM_Client(Engines::Container_ptr client); - //Standard_EXPORT - Standard_Integer Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ; - //Standard_EXPORT - Standard_Integer Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ; - //Standard_EXPORT + //Standard_EXPORT + GEOM_Client(const GEOM_Client& client); + //Standard_EXPORT + Standard_Boolean Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ; + //Standard_EXPORT + Standard_Boolean Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ; + //Standard_EXPORT void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S ) ; - //Standard_EXPORT + //Standard_EXPORT TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape ); - //Standard_EXPORT + //Standard_EXPORT void RemoveShapeFromBuffer( const TCollection_AsciiString& IOR ) ; - //Standard_EXPORT + //Standard_EXPORT void ClearClientBuffer() ; - //Standard_EXPORT + //Standard_EXPORT unsigned int BufferLength() ; TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape); +#ifdef SINGLE_CLIENT + static GEOM_Client& get_client(); +#else + static GEOM_Client get_client(); +#endif -private: + private: // Fields PRIVATE // - TColStd_SequenceOfAsciiString myIORs ; - TopTools_SequenceOfShape myShapes ; + std::map< TCollection_AsciiString , std::vector > _mySubShapes; + std::map< TCollection_AsciiString , TopoDS_Shape > myShapesMap; long pid_client; }; +#ifdef SINGLE_CLIENT +#define SHAPE_READER(obj) GEOM_Client& obj=GEOM_Client::get_client() +#else +#define SHAPE_READER(obj) GEOM_Client obj +#endif #endif diff --git a/src/GEOMClient/Makefile.am b/src/GEOMClient/Makefile.am index 6db3208fe..b3addc3b2 100644 --- a/src/GEOMClient/Makefile.am +++ b/src/GEOMClient/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client # File : Makefile.in # Author : Patrick GOLDBRONN (CEA) @@ -46,13 +44,12 @@ libGEOMClient_la_CPPFLAGS = \ $(CORBA_INCLUDES) \ $(CAS_CPPFLAGS) \ $(KERNEL_CXXFLAGS) \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOMClient_la_LDFLAGS = \ ../../idl/libSalomeIDLGEOM.la \ ../GEOM/libGEOMbasic.la \ - $(KERNEL_LDFLAGS) -lSalomeIDLKernel -lOpUtil \ + $(KERNEL_LDFLAGS) -lSalomeIDLKernel -lSALOMEBasics -lOpUtil \ $(CAS_TKTopAlgo) # \ diff --git a/src/GEOMDS/GEOMDS_Commands.cxx b/src/GEOMDS/GEOMDS_Commands.cxx deleted file mode 100644 index 315aa6ca5..000000000 --- a/src/GEOMDS/GEOMDS_Commands.cxx +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright (C) 2007-2008 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 GEOMDS : implementation of Geometry component data structure and Geometry documents management -// File : GeomDS_Commands.cxx -// Author : Yves FRICAUD/Lucien PIGNOLONI -// Module : GEOM -// $Header$ -// -using namespace std; -#include "utilities.h" -#include "GEOMDS_Commands.ixx" - -#include -#include -#include -#include -#include -#include -#include - - -//======================================================================= -//function : GEOMDS_Commands -//purpose : -//======================================================================= -GEOMDS_Commands::GEOMDS_Commands(const TDF_Label& Main) - : myLab(Main) -{ -} - - -//======================================================================= -// function : Generated() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::Generated(const TopoDS_Shape& S, - const TCollection_ExtendedString& Name) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Generated(S); - TDataStd_Name::Set(NewLab,Name); - return NewLab; -} - - - -//======================================================================= -// function : Generated() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::Generated(const TopoDS_Shape& S1, - const TopoDS_Shape& S2, - const TCollection_ExtendedString& Name) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Generated(S1,S2); - TDataStd_Name::Set(NewLab,Name); - return NewLab; -} - - - -//======================================================================= -// function : AddShape() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::AddShape(const TopoDS_Shape& S, - const TCollection_ExtendedString& Name) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab,Name); - return NewLab; -} - - -//======================================================================= -// function : AddIndependentShape() -// purpose : SAME than AddShape() : will be renamed later -//======================================================================= -TDF_Label GEOMDS_Commands::AddIndependentShape(const TopoDS_Shape& S, - const TCollection_AsciiString& nameIOR) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab, nameIOR); - return NewLab; -} - - -//======================================================================= -// function : AddDependentShape() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::AddDependentShape(const TopoDS_Shape& S, - const TCollection_AsciiString& nameIOR, - const TDF_Label& mainLab) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab, nameIOR); - /* NewLab has a reference attribute to mainLab (the main shape in fact) */ - TDF_Reference::Set(NewLab, mainLab) ; - return NewLab; -} - - - -//======================================================================= -// function : AddConstructiveElement() -// purpose : -//======================================================================= -TDF_Label GEOMDS_Commands::AddConstructiveElement(const TopoDS_Shape& S, - const TCollection_ExtendedString& nameIOR, - const GEOMDS_ConstructiveType& aType) -{ - TDF_Label NewLab = myLab.NewChild(); - TNaming_Builder B(NewLab); - B.Select(S,S); - TDataStd_Name::Set(NewLab, nameIOR); - /* Add the Attribute Constructive Element coded with a TDataStd_Integer from an enum */ - TDataStd_Integer::Set(NewLab, Standard_Integer(aType)); - return NewLab; -} - - -//======================================================================= -// function : AddIORNameAttribute() -// purpose : Add attribute TDataStd_Name to a label -// : this attribute represents the name/IOR of object -// : Return false if attribute exist before -//======================================================================= -Standard_Boolean GEOMDS_Commands::AddIORNameAttribute(const TDF_Label& aLabel, - const TCollection_ExtendedString& nameIOR) -{ - if( this->HasIOR(aLabel) ) - return false ; - TDataStd_Name::Set(aLabel, nameIOR); - return true ; -} - - - -//======================================================================= -// function : IsConstructiveElement() 1/2 -// purpose : Return true if 'aLabel' is a constructive element -//======================================================================= -Standard_Boolean GEOMDS_Commands::IsConstructiveElement(const TDF_Label& aLabel) -{ - Handle(TDataStd_Integer) anAttType ; - if( aLabel.FindAttribute(TDataStd_Integer::GetID(), anAttType ) ) - return true ; - return false; -} - - -//======================================================================= -// function : IsConstructiveElement() 2/2 -// purpose : Return true if 'aLabel' is a constructive element and return the -// : topology ' returnTopo' and type 'returnType' -//======================================================================= -Standard_Boolean GEOMDS_Commands::IsConstructiveElement(const TDF_Label& aLabel, - TopoDS_Shape& returnTopo, - GEOMDS_ConstructiveType& returnType) -{ - Handle(TDataStd_Integer) anAttType ; - Handle(TNaming_NamedShape) anAttTopo ; - - if( aLabel.FindAttribute(TDataStd_Integer::GetID(), anAttType) && aLabel.FindAttribute(TNaming_NamedShape::GetID(), anAttTopo)) { - - returnTopo = TNaming_Tool::GetShape(anAttTopo) ; - returnType = GEOMDS_ConstructiveType( anAttType->Get() ) ; - return true ; - } - return false; -} - - -//======================================================================= -// function : GetShape() -// purpose : return true and 'returnTopo' if a topology is found on 'aLabel' -//======================================================================= -Standard_Boolean GEOMDS_Commands::GetShape(const TDF_Label& aLabel, - TopoDS_Shape& returnTopo) -{ - Handle(TNaming_NamedShape) anAttTopo ; - if( aLabel.FindAttribute(TNaming_NamedShape::GetID(), anAttTopo)) { - returnTopo = TNaming_Tool::GetShape(anAttTopo) ; - return true ; - } - return false; -} - - -//======================================================================= -// function : IsDependentShape() -// purpose : return true if the shape in the label is dependant (a sub shape) -//======================================================================= -Standard_Boolean GEOMDS_Commands::IsDependentShape(const TDF_Label& aLabel) -{ - Handle(TDF_Reference) anAttRef ; - if( aLabel.FindAttribute(TDF_Reference::GetID(), anAttRef)) - return true ; - return false; -} - - - -//======================================================================= -// function : GetMainShapeLabel() -// purpose : return true if an attribute Reference is found for 'aLabel' -// : so 'returnMainLabel' is defined. 'aLabel' is supposed to be -// : a dependent object, otherwise return false. -//======================================================================= -Standard_Boolean GEOMDS_Commands::GetMainShapeLabel(const TDF_Label& aLabel, - TDF_Label& returnMainLabel) -{ - Handle(TDF_Reference) anAttRef ; - if( aLabel.FindAttribute(TDF_Reference::GetID(), anAttRef)) { - returnMainLabel = anAttRef->Get() ; - return true ; - } - return false; -} - - -//======================================================================= -// function : ClearAllIOR() -// purpose : Clear all IOR from aLabel usually the main label. -// : Useful before reconstruction after a load of a document. -// : IOR is the attribute often called 'name' or 'nameIOR' -//======================================================================= -Standard_Boolean GEOMDS_Commands::ClearAllIOR(const TDF_Label& aLabel) -{ - TDF_ChildIterator it; - Handle(TDataStd_Name) anAttName ; - bool notTested = false ; - for( it.Initialize(aLabel, Standard_False); it.More(); it.Next() ) { - TDF_Label L = it.Value() ; - if( L.FindAttribute(TDataStd_Name::GetID(), anAttName) ) { - notTested = L.ForgetAttribute(TDataStd_Name::GetID()) ; - if(notTested) - MESSAGE("in GEOMDS_Commands::ClearAllIOR : IOR CLEARED" ) - ClearAllIOR(L); - } - } - return true ; -} - - -//======================================================================= -// function : HasIOR() -// purpose : Return true is 'aLabel' has an attribute IOR (nameIOR) -//======================================================================= -Standard_Boolean GEOMDS_Commands::HasIOR(const TDF_Label& aLabel) -{ - Handle(TDataStd_Name) anAttName ; - if( !aLabel.FindAttribute(TDataStd_Name::GetID(), anAttName) ) - return false ; - return true ; -} - -//======================================================================= -// function : ReturnNameIOR() -// purpose : Return true is 'aLabel' has an attribute IOR (nameIOR) -// : and define 'returnNameIOR' -//======================================================================= -Standard_Boolean GEOMDS_Commands::ReturnNameIOR(const TDF_Label& aLabel, - TCollection_ExtendedString& returnNameIOR) -{ - Handle(TDataStd_Name) anAttName ; - if( !aLabel.FindAttribute(TDataStd_Name::GetID(), anAttName) ) - return false ; - else { - returnNameIOR = anAttName->Get() ; - return true ; - } -} diff --git a/src/GEOMDS/GEOMDS_Commands.jxx b/src/GEOMDS/GEOMDS_Commands.jxx deleted file mode 100644 index 662528e63..000000000 --- a/src/GEOMDS/GEOMDS_Commands.jxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2008 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 GEOMDS : implementation of Geometry component data structure and Geometry documents management -// File : GEOMDS_Commands.jxx -// Module : GEOM -// -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _GEOMDS_Commands_HeaderFile -#include "GEOMDS_Commands.hxx" -#endif diff --git a/src/GEOMFiltersSelection/GEOMFiltersSelection.pro b/src/GEOMFiltersSelection/GEOMFiltersSelection.pro deleted file mode 100644 index 7654802e5..000000000 --- a/src/GEOMFiltersSelection/GEOMFiltersSelection.pro +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMFiltersSelection -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${QT_INCLUDES} $${CAS_CPPFLAGS} $${BOOST_CPPFLAGS} $${GUI_CXXFLAGS} $${KERNEL_CXXFLAGS} $${CORBA_CXXFLAGS} $${CORBA_INCLUDES} ../GEOMClient $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/idl -lSalomeIDLGEOM -L$$(GEOM_ROOT_DIR)/lib -lGEOMClient $${GUI_LDFLAGS} -lsuit -lSalomeApp -lSalomeSession $${KERNEL_LDFLAGS} -lSalomeLifeCycleCORBA -lSalomeContainer -lTOOLSDS - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = GEOM_SelectionFilter.h -HEADERS += GEOM_EdgeFilter.h -HEADERS += GEOM_FaceFilter.h -HEADERS += GEOM_TypeFilter.h -HEADERS += GEOM_PreviewFilter.h -HEADERS += GEOM_LogicalFilter.h -HEADERS += GEOM_OCCFilter.h - -SOURCES = GEOM_SelectionFilter.cxx -SOURCES += GEOM_EdgeFilter.cxx -SOURCES += GEOM_FaceFilter.cxx -SOURCES += GEOM_TypeFilter.cxx -SOURCES += GEOM_PreviewFilter.cxx -SOURCES += GEOM_LogicalFilter.cxx -SOURCES += GEOM_OCCFilter.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOMFiltersSelection/GEOM_CompoundFilter.cxx b/src/GEOMFiltersSelection/GEOM_CompoundFilter.cxx index 7f598cc6c..ee6b3a6ce 100644 --- a/src/GEOMFiltersSelection/GEOM_CompoundFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_CompoundFilter.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOM_CompoundFilter : filter selector for the viewer // File : GEOM_CompoundFilter.cxx // Author : Roman NIKOLAEV diff --git a/src/GEOMFiltersSelection/GEOM_CompoundFilter.h b/src/GEOMFiltersSelection/GEOM_CompoundFilter.h index ea174a813..8a4ad1173 100644 --- a/src/GEOMFiltersSelection/GEOM_CompoundFilter.h +++ b/src/GEOMFiltersSelection/GEOM_CompoundFilter.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_COMPOUNDFILTER_H #define GEOM_COMPOUNDFILTER_H #include "GEOM_SelectionFilter.h" diff --git a/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx b/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx index c47f8b793..1217b7363 100644 --- a/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_EdgeFilter.h" #include @@ -55,7 +56,7 @@ bool GEOM_EdgeFilter::isShapeOk( const TopoDS_Shape& theShape ) const { BRepAdaptor_Curve aCurve( TopoDS::Edge( theShape ) ); GeomAbs_CurveType aType = aCurve.GetType(); - + switch ( myKind ) { case StdSelect_AnyEdge: return Standard_True; diff --git a/src/GEOMFiltersSelection/GEOM_EdgeFilter.h b/src/GEOMFiltersSelection/GEOM_EdgeFilter.h index 9977bdf65..305043d38 100644 --- a/src/GEOMFiltersSelection/GEOM_EdgeFilter.h +++ b/src/GEOMFiltersSelection/GEOM_EdgeFilter.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_EDGEFILTER_H #define GEOM_EDGEFILTER_H diff --git a/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx b/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx index 9b126852c..a7e517850 100644 --- a/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_FaceFilter.h" #include @@ -55,7 +56,7 @@ bool GEOM_FaceFilter::isShapeOk( const TopoDS_Shape& theShape ) const { BRepAdaptor_Surface aSurf( TopoDS::Face( theShape ) ); GeomAbs_SurfaceType aType = aSurf.GetType(); - + switch ( myKind ) { case StdSelect_AnyFace: return Standard_True; @@ -64,10 +65,10 @@ bool GEOM_FaceFilter::isShapeOk( const TopoDS_Shape& theShape ) const case StdSelect_Sphere: return ( aType == GeomAbs_Sphere); case StdSelect_Torus: return ( aType == GeomAbs_Torus); case StdSelect_Revol: return ( aType == GeomAbs_Cylinder || - aType == GeomAbs_Cone || - aType == GeomAbs_Torus || - aType == GeomAbs_Sphere || - aType == GeomAbs_SurfaceOfRevolution ); + aType == GeomAbs_Cone || + aType == GeomAbs_Torus || + aType == GeomAbs_Sphere || + aType == GeomAbs_SurfaceOfRevolution ); case StdSelect_Cone: return ( aType == GeomAbs_Cone); } } diff --git a/src/GEOMFiltersSelection/GEOM_FaceFilter.h b/src/GEOMFiltersSelection/GEOM_FaceFilter.h index 9f68f01a8..ff493286b 100644 --- a/src/GEOMFiltersSelection/GEOM_FaceFilter.h +++ b/src/GEOMFiltersSelection/GEOM_FaceFilter.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_FACEFILTER_H #define GEOM_FACEFILTER_H diff --git a/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx b/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx index 1f54c3854..152ed3328 100644 --- a/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_LogicalFilter.h" //======================================================================= diff --git a/src/GEOMFiltersSelection/GEOM_LogicalFilter.h b/src/GEOMFiltersSelection/GEOM_LogicalFilter.h index d0ba7c683..f4e2708f4 100644 --- a/src/GEOMFiltersSelection/GEOM_LogicalFilter.h +++ b/src/GEOMFiltersSelection/GEOM_LogicalFilter.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_LOGICALFILTER_H #define GEOM_LOGICALFILTER_H diff --git a/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx b/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx index 75027c74c..d4a5b43db 100644 --- a/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_OCCFilter.h" #include diff --git a/src/GEOMFiltersSelection/GEOM_OCCFilter.h b/src/GEOMFiltersSelection/GEOM_OCCFilter.h index c21fd356b..12eb978b4 100644 --- a/src/GEOMFiltersSelection/GEOM_OCCFilter.h +++ b/src/GEOMFiltersSelection/GEOM_OCCFilter.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_OCCFILTER_H #define GEOM_OCCFILTER_H diff --git a/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx b/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx index 40ce102be..ed3f34777 100644 --- a/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_PreviewFilter.h" #include diff --git a/src/GEOMFiltersSelection/GEOM_PreviewFilter.h b/src/GEOMFiltersSelection/GEOM_PreviewFilter.h index 68b7f4644..8054810b3 100644 --- a/src/GEOMFiltersSelection/GEOM_PreviewFilter.h +++ b/src/GEOMFiltersSelection/GEOM_PreviewFilter.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_PREVIEW_FILTER_H #define GEOM_PREVIEW_FILTER_H diff --git a/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx index a8360dc51..35fc57020 100644 --- a/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_SelectionFilter.h" #include "GEOM_Client.hxx" @@ -65,6 +66,19 @@ bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const if ( getShape( obj, shape ) ) return contains( shape.ShapeType() ) && isShapeOk( shape ); } + + // IMP 0020435: fine local selection + { + const LightApp_DataOwner* owner = dynamic_cast(sOwner); + if (owner) { + QString entry = owner->entry(); + int index = entry.lastIndexOf("_"); + if (index > 0) { + return true; + } + } + } + return false; } @@ -72,7 +86,8 @@ bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const // function : getObject // purpose : //======================================================================= -GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject( const SUIT_DataOwner* sOwner, const bool extractReference ) const +GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject (const SUIT_DataOwner* sOwner, + const bool extractReference) const { GEOM::GEOM_Object_var anObj; @@ -119,18 +134,18 @@ bool GEOM_SelectionFilter::getShape (const GEOM::GEOM_Object_ptr& theObject, SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() ); static GEOM::GEOM_Gen_var geomGen; if(CORBA::is_nil( geomGen )) { - Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); - geomGen = GEOM::GEOM_Gen::_narrow( comp ); + Engines::EngineComponent_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); + geomGen = GEOM::GEOM_Gen::_narrow( comp ); } if ( !CORBA::is_nil( geomGen ) ) { - TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject ); + TopoDS_Shape aTopoDSShape = GEOM_Client::get_client().GetShape( geomGen, theObject ); - if ( !aTopoDSShape.IsNull() ) - { - theShape = aTopoDSShape; - return true; - } + if ( !aTopoDSShape.IsNull() ) + { + theShape = aTopoDSShape; + return true; + } } } } diff --git a/src/GEOMFiltersSelection/GEOM_SelectionFilter.h b/src/GEOMFiltersSelection/GEOM_SelectionFilter.h index aca520747..d05a19fd3 100644 --- a/src/GEOMFiltersSelection/GEOM_SelectionFilter.h +++ b/src/GEOMFiltersSelection/GEOM_SelectionFilter.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_SELECTIONFILTER_H #define GEOM_SELECTIONFILTER_H diff --git a/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx b/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx index a9bbde738..d1e6821cf 100644 --- a/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_TypeFilter.h" //======================================================================= @@ -50,9 +51,9 @@ bool GEOM_TypeFilter::isOk( const SUIT_DataOwner* sOwner ) const if ( !CORBA::is_nil( obj ) ) { if (!myIsShapeType) - return obj->GetType() == type(); + return obj->GetType() == type(); else - return obj->GetShapeType() == type(); + return obj->GetShapeType() == type(); } return false; diff --git a/src/GEOMFiltersSelection/GEOM_TypeFilter.h b/src/GEOMFiltersSelection/GEOM_TypeFilter.h index d1e57fb9a..67fac3498 100644 --- a/src/GEOMFiltersSelection/GEOM_TypeFilter.h +++ b/src/GEOMFiltersSelection/GEOM_TypeFilter.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_TYPEFILTER_H #define GEOM_TYPEFILTER_H diff --git a/src/GEOMFiltersSelection/Makefile.am b/src/GEOMFiltersSelection/Makefile.am index d84453a4e..ff104eef4 100644 --- a/src/GEOMFiltersSelection/Makefile.am +++ b/src/GEOMFiltersSelection/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOMFiltersSelection : filter selector for the viewer # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -62,11 +60,12 @@ libGEOMFiltersSelection_la_CPPFLAGS = \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ -I$(srcdir)/../GEOMClient \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOMFiltersSelection_la_LDFLAGS = \ + $(QT_MT_LIBS) \ + $(CAS_KERNEL) -lTKG3d -lTKV3d -lTKService \ ../../idl/libSalomeIDLGEOM.la \ ../GEOMClient/libGEOMClient.la \ - $(GUI_LDFLAGS) -lsuit -lSalomeApp -lSalomeSession \ + $(GUI_LDFLAGS) -lsuit -lSalomeApp -lSalomeSession -lSalomeObject -lLightApp \ $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeContainer -lTOOLSDS diff --git a/src/GEOMGUI/GEOMGUI.cxx b/src/GEOMGUI/GEOMGUI.cxx index c6797a789..b87f89833 100644 --- a/src/GEOMGUI/GEOMGUI.cxx +++ b/src/GEOMGUI/GEOMGUI.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMGUI.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #include "GEOMGUI.h" #include "GeometryGUI.h" @@ -75,6 +76,15 @@ bool GEOMGUI::OnMouseMove( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_V return TRUE; } +//================================================================================= +// class : GEOMGUI::OnMouseMove +// purpose : Mouse move event processing +//================================================================================= +bool GEOMGUI::OnMouseRelease( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ ) +{ + return TRUE; +} + //================================================================================= // class : GEOMGUI::OnKeyPress // purpose : Key press event processing @@ -108,4 +118,3 @@ GeometryGUI* GEOMGUI::getGeometryGUI() { return myGeometryGUI; } - diff --git a/src/GEOMGUI/GEOMGUI.h b/src/GEOMGUI/GEOMGUI.h index afb014ab2..87b76ed24 100644 --- a/src/GEOMGUI/GEOMGUI.h +++ b/src/GEOMGUI/GEOMGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMGUI.h // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) @@ -53,6 +54,7 @@ public : virtual bool OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* ); virtual bool OnMouseMove( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* ); + virtual bool OnMouseRelease( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* ); virtual bool OnKeyPress( QKeyEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* ); virtual void activate( SUIT_Desktop* parent ); diff --git a/src/GEOMGUI/GEOMGUI.pro b/src/GEOMGUI/GEOMGUI.pro deleted file mode 100644 index 9e95a0a26..000000000 --- a/src/GEOMGUI/GEOMGUI.pro +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOM -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMFiltersSelection ../GEOMClient ../GEOMImpl $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMClient -lGEOMObject $${KERNEL_LDFLAGS} -lSalomeLifeCycleCORBA $${GUI_LDFLAGS} -lOCCViewer -lVTKViewer -lCAM -lSOCC -lSVTK -lEvent - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += GEOMGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = GeometryGUI.h -HEADERS += GEOMGUI.h -HEADERS += GEOM_Displayer.h -HEADERS += GEOMGUI_OCCSelector.h -HEADERS += GEOMGUI_Selection.h -HEADERS += GeometryGUI_Swig.hxx -HEADERS += GeometryGUI_Swig.i -HEADERS += GEOM_GEOMGUI.hxx - -SOURCES = GeometryGUI.cxx -SOURCES += GEOMGUI.cxx -SOURCES += GEOM_Displayer.cxx -SOURCES += GEOMGUI_OCCSelector.cxx -SOURCES += GEOMGUI_Selection.cxx -SOURCES += GeometryGUI_Swig.cxx - -TRANSLATIONS = GEOM_images.ts \ - GEOM_msg_en.ts \ - GEOM_msg_fr.ts - -includes.files = $$HEADERS -includes.path = ../../include - -resources.files = *.qm -resources.path = ../../resources - -INSTALLS += includes resources diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx index 6fed25fa8..e2008bfa8 100644 --- a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMGUI_OCCSelector.cxx // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com) // @@ -50,7 +51,7 @@ //================================================================ // Function : GEOMGUI_OCCSelector -// Purpose : +// Purpose : //================================================================ GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr ) : LightApp_OCCSelector( viewer, mgr ) @@ -59,7 +60,7 @@ GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_Selecti //================================================================ // Function : ~GEOMGUI_OCCSelector -// Purpose : +// Purpose : //================================================================ GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector() { @@ -67,7 +68,7 @@ GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector() //================================================================ // Function : getSelection -// Purpose : +// Purpose : //================================================================ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const { @@ -113,11 +114,12 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const if (!entryStr.isEmpty()) { + Handle(SALOME_InteractiveObject) anIO = Handle(SALOME_InteractiveObject)::DownCast(io->GetOwner()); LightApp_DataOwner* owner; if (index > -1) // Local Selection owner = new LightApp_DataSubOwner (entryStr, index); - else // Global Selection - owner = new LightApp_DataOwner (entryStr); + else if ( !anIO.IsNull() ) // Global Selection + owner = new LightApp_DataOwner( anIO ); aList.append(SUIT_DataOwnerPtr(owner)); } @@ -133,8 +135,11 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const if ( !entryStr.isEmpty() ) { - LightApp_DataOwner* owner = new LightApp_DataOwner( entryStr ); - aList.append( SUIT_DataOwnerPtr( owner ) ); + Handle(SALOME_InteractiveObject) anIO = Handle(SALOME_InteractiveObject)::DownCast(io->GetOwner()); + if ( !anIO.IsNull() ) { + LightApp_DataOwner* owner = new LightApp_DataOwner( anIO ); + aList.append( SUIT_DataOwnerPtr( owner ) ); + } } } } @@ -149,11 +154,11 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const //================================================================ // Function : getEntityOwners -// Purpose : +// Purpose : //================================================================ static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, - const Handle(AIS_InteractiveContext)& theIC, - SelectMgr_IndexedMapOfOwner& theMap ) + const Handle(AIS_InteractiveContext)& theIC, + SelectMgr_IndexedMapOfOwner& theMap ) { if ( theObj.IsNull() || theIC.IsNull() ) return; @@ -172,19 +177,19 @@ static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, for ( sel->Init(); sel->More(); sel->Next() ) { Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive(); if ( entity.IsNull() ) - continue; + continue; Handle(SelectMgr_EntityOwner) owner = - Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId()); + Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId()); if ( !owner.IsNull() ) - theMap.Add( owner ); + theMap.Add( owner ); } } } //================================================================ // Function : setSelection -// Purpose : +// Purpose : //================================================================ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) { @@ -195,11 +200,7 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) Handle(AIS_InteractiveContext) ic = vw->getAISContext(); // "entry - list_of_int" map for LOCAL selection -#ifndef WNT NCollection_DataMap indexesMap; -#else - NCollection_DataMap indexesMap; -#endif QMap globalSelMap; // only Key=entry from this map is used. value(int) is NOT used at all. SelectMgr_IndexedMapOfOwner ownersmap; // map of owners to be selected @@ -215,21 +216,17 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) if ( subOwner ) { QString entry = subOwner->entry(); -#ifndef WNT if ( indexesMap.IsBound( TCollection_AsciiString(entry.toLatin1().data()))) -#else - if ( indexesMap.IsBound( entry.toLatin1().data() ) ) -#endif { - TColStd_IndexedMapOfInteger& subIndexes = indexesMap.ChangeFind(entry.toLatin1().data()); - subIndexes.Add( subOwner->index() ); - //indexesMap.replace( entry, subIndexes ); + TColStd_IndexedMapOfInteger& subIndexes = indexesMap.ChangeFind(entry.toLatin1().data()); + subIndexes.Add( subOwner->index() ); + //indexesMap.replace( entry, subIndexes ); } else { - TColStd_IndexedMapOfInteger subIndexes; - subIndexes.Add( subOwner->index() ); - indexesMap.Bind(entry.toLatin1().data(), subIndexes); + TColStd_IndexedMapOfInteger subIndexes; + subIndexes.Add( subOwner->index() ); + indexesMap.Bind(entry.toLatin1().data(), subIndexes); } } else // the owner is NOT a sub owner, maybe it is a DataOwner == GLOBAL selection @@ -237,11 +234,11 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); if ( owner ) { - SalomeApp_Study* appStudy = + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - QString anEntry = appStudy->referencedToEntry( owner->entry() ); + QString anEntry = appStudy->referencedToEntry( owner->entry() ); - globalSelMap[anEntry] = 1; + globalSelMap[anEntry] = 1; } } } @@ -355,10 +352,10 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) const LightApp_DataOwner* owner = dynamic_cast( (*itr2).operator->() ); if ( owner ) { - SalomeApp_Study* appStudy = + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - QString anEntry = appStudy->referencedToEntry( owner->entry() ); - if (globalSelMap[anEntry] == 1) mySelectedExternals.append(*itr2); + QString anEntry = appStudy->referencedToEntry( owner->entry() ); + if (globalSelMap[anEntry] == 1) mySelectedExternals.append(*itr2); } } } diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.h b/src/GEOMGUI/GEOMGUI_OCCSelector.h index ff16ecf25..d082d4e86 100644 --- a/src/GEOMGUI/GEOMGUI_OCCSelector.h +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMGUI_OCCSelector.h // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com) diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index d89088f61..734234269 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMGUI_Selection.cxx // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com) // @@ -27,11 +28,17 @@ #include "GeometryGUI.h" #include "GEOM_Displayer.h" +#include "Material_Model.h" + +#include + #include #include -#include +#include "LightApp_DataOwner.h" + #include +#include #include #include @@ -41,20 +48,53 @@ #include #include #include +#include #include #include #include +#include +#include + // OCCT Includes #include #include #include +#include +#include +#include +#include +#include // VTK Includes #include +#define OCC_DISPLAY_MODE_TO_STRING( str, dm ) { \ + if ( dm == AIS_WireFrame ) \ + str = QString( "Wireframe" ); \ + else if ( dm == AIS_Shaded ) \ + str = QString( "Shading" ); \ + else if ( dm == GEOM_AISShape::ShadingWithEdges ) \ + str = QString( "ShadingWithEdges" ); \ + else if ( dm == GEOM_AISShape::TexturedShape ) \ + str = QString( "Texture" ); \ + else \ + str = QString(); } + +#define VTK_DISPLAY_MODE_TO_STRING( str, dm ) { \ + if ( dm == 0 ) \ + str = QString( "Wireframe" ); \ + else if ( dm == 1 ) \ + str = QString( "Shading" ); \ + else if ( dm == 3 ) \ + str = QString( "ShadingWithEdges" ); \ + else \ + str = QString(); } + +#define USE_VISUAL_PROP_MAP + GEOMGUI_Selection::GEOMGUI_Selection() : LightApp_Selection() { @@ -64,54 +104,137 @@ GEOMGUI_Selection::~GEOMGUI_Selection() { } -QVariant GEOMGUI_Selection::parameter( const QString& p ) const +void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* selMgr ) { - if ( p == "isOCC" ) return QVariant( activeViewType() == OCCViewer_Viewer::Type() ); - if ( p == "selectionmode" ){ - return QVariant(selectionMode()); + LightApp_Selection::init( context, selMgr ); + + myObjects.resize( count() ); + + SalomeApp_Study* appStudy = dynamic_cast( study() ); + if ( appStudy ) { + _PTR(Study) study = appStudy->studyDS(); + for ( int idx = 0; idx < count(); idx++ ) { + QString anEntry = entry( idx ); + if ( study && !anEntry.isEmpty() ) { + _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) ); + if ( aSO ) { + CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO ); + myObjects[idx] = GEOM::GEOM_Object::_narrow( varObj ); + } + } + } } - return LightApp_Selection::parameter( p ); } -QVariant GEOMGUI_Selection::parameter( const int ind, const QString& p ) const +//QVariant GEOMGUI_Selection::contextParameter( const QString& p ) const +QVariant GEOMGUI_Selection::parameter( const QString& p ) const +{ + QVariant v; + if ( p == "isOCC" ) + v = activeViewType() == OCCViewer_Viewer::Type(); + else if ( p == "selectionmode" ) + v = selectionMode(); + else if ( p == "hasImported" ) + v = hasImported(); + else if ( p == "allImported" ) + v = allImported(); + else + v = LightApp_Selection::parameter( p ); + return v; +} + +//QVariant GEOMGUI_Selection::objectParameter( const int idx, const QString& p ) const +QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const { -// if ( p == "isVisible" ) return QVariant( isVisible( ind ) ); -// parameter isVisible is calculated in base SalomeApp_Selection -// else - if( p == "type" ) - return QVariant( typeName( ind ) ); + QVariant v; + if ( p == "type" ) + v = typeName( idx ); + else if ( p == "typeid" ) + v = typeId( idx ); else if ( p == "displaymode" ) - return QVariant( displayMode( ind ) ); + v = displayMode( idx ); else if ( p == "isAutoColor" ) - return QVariant( isAutoColor( ind ) ); + v = isAutoColor( idx ); + else if ( p == "isVectorsMode" ) + v = isVectorsMode( idx ); + else if ( p == "topLevel" ) + v = topLevel( idx ); + else if ( p == "hasHiddenChildren" ) + v = hasHiddenChildren( idx ); + else if ( p == "hasShownChildren" ) + v = hasShownChildren( idx ); + else if ( p == "compoundOfVertices" ) + v = compoundOfVertices( idx ); + else if ( p == "imported" ) + v = isImported( idx ); + else if ( p == "isPhysicalMaterial" ) + v = isPhysicalMaterial(idx); else - return LightApp_Selection::parameter( ind, p ); + v = LightApp_Selection::parameter( idx, p ); + + return v; +} + +// the method to skip temporary objects from selection (called from LightApp) +bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner ) +{ + return !theOwner->entry().contains("_"); } QString GEOMGUI_Selection::typeName( const int index ) const { if ( isComponent( index ) ) return "Component"; + + static QString aGroup( "Group" ); + static QString aShape( "Shape" ); + static QString anUnknown( "Unknown" ); + GEOM::GEOM_Object_var anObj = getObject( index ); if ( !CORBA::is_nil( anObj ) ) { const int aGeomType = anObj->GetType(); if ( aGeomType == GEOM_GROUP ) - return "Group"; + return aGroup; else - return "Shape"; + return aShape; } - return "Unknown"; + return anUnknown; +} + +int GEOMGUI_Selection::typeId( const int index ) const +{ + int aType = -1; + GEOM::GEOM_Object_var anObj = getObject( index ); + if ( !CORBA::is_nil( anObj ) ) + aType = (int)anObj->GetShapeType(); + return aType; } bool GEOMGUI_Selection::isVisible( const int index ) const { - GEOM::GEOM_Object_var obj = getObject( index ); - SALOME_View* view = GEOM_Displayer::GetActiveView(); - if ( !CORBA::is_nil( obj ) && view ) { - Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" ); - return view->isVisible( io ); + bool res = false; + +#ifdef USE_VISUAL_PROP_MAP + bool found = false; + QVariant v = visibleProperty( entry( index ), VISIBILITY_PROP ); + if ( v.canConvert( QVariant::Bool ) ) { + res = v.toBool(); + found = true; } - return false; + + if ( !found ) { +#endif + GEOM::GEOM_Object_var obj = getObject( index ); + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if ( !CORBA::is_nil( obj ) && view ) { + Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" ); + res = view->isVisible( io ); + } +#ifdef USE_VISUAL_PROP_MAP + } +#endif + + return res; } bool GEOMGUI_Selection::isAutoColor( const int index ) const @@ -122,74 +245,256 @@ bool GEOMGUI_Selection::isAutoColor( const int index ) const return false; } +bool GEOMGUI_Selection::isImported( const int index ) const +{ + GEOM::GEOM_Object_var obj = getObject( index ); + if ( !CORBA::is_nil( obj ) ) + return obj->GetType() == GEOM_IMPORT; + return false; +} + +bool GEOMGUI_Selection::hasImported() const +{ + bool res = false; + for ( int i = 0; i < count() && !res; i++ ) + res = isImported( i ); + return res; +} + +bool GEOMGUI_Selection::allImported() const +{ + bool res = true; + for ( int i = 0; i < count() && res; i++ ) + res = isImported( i ); + return res; +} + +QVariant GEOMGUI_Selection::visibleProperty( const QString& entry, const QString& propName ) const +{ + QVariant v; + LightApp_Study* aStudy = study(); + if ( aStudy ) { + LightApp_Application* anApp = ::qobject_cast( aStudy->application() ); + if ( anApp && anApp->activeViewManager() ) { + int id = anApp->activeViewManager()->getGlobalId(); + v = aStudy->getObjectProperty( id, entry, propName, QVariant() ); + } + } + return v; +} + QString GEOMGUI_Selection::displayMode( const int index ) const { - SALOME_View* view = GEOM_Displayer::GetActiveView(); + QString res; QString viewType = activeViewType(); - if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { - SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); - if ( prs ) { - if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC - SOCC_Prs* occPrs = (SOCC_Prs*) prs; - AIS_ListOfInteractive lst; - occPrs->GetObjects( lst ); - if ( lst.Extent() ) { - Handle(AIS_InteractiveObject) io = lst.First(); - if ( !io.IsNull() ) { - int dm = io->DisplayMode(); - if ( dm == AIS_WireFrame ) - return "Wireframe"; - else if ( dm == AIS_Shaded ) - return "Shading"; - else { // return default display mode of AIS_InteractiveContext - OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*) SUIT_Session::session()->activeApplication()->desktop( - )->activeWindow()->getViewManager()->getViewModel(); - Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); - dm = ic->DisplayMode(); - if ( dm == AIS_WireFrame ) - return "Wireframe"; - else if ( dm == AIS_Shaded ) - return "Shading"; +#ifdef USE_VISUAL_PROP_MAP + QVariant v = visibleProperty( entry( index ), DISPLAY_MODE_PROP ); + if ( v.canConvert( QVariant::Int ) ) { + int dm = v.toInt(); + if ( viewType == OCCViewer_Viewer::Type() ) { + OCC_DISPLAY_MODE_TO_STRING( res, dm ); + } else if ( viewType == SVTK_Viewer::Type() ) { + VTK_DISPLAY_MODE_TO_STRING( res, dm ); + } + } + + if ( res.isEmpty() ) { +#endif + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { + SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + if ( prs ) { + if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC + SOCC_Prs* occPrs = (SOCC_Prs*) prs; + AIS_ListOfInteractive lst; + occPrs->GetObjects( lst ); + if ( lst.Extent() ) { + Handle(AIS_InteractiveObject) io = lst.First(); + if ( !io.IsNull() ) { + int dm; + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io); + if(!aSh.IsNull()) { + dm = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode(); + } else { + dm = io->DisplayMode(); + } + OCC_DISPLAY_MODE_TO_STRING( res, dm ); + if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext + OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()-> + desktop()->activeWindow()->getViewManager()->getViewModel(); + Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); + dm = ic->DisplayMode(); + OCC_DISPLAY_MODE_TO_STRING( res, dm ); + } } } } + else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK + SVTK_Prs* vtkPrs = dynamic_cast( prs ); + vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0; + if ( lst ) { + lst->InitTraversal(); + vtkActor* actor = lst->GetNextActor(); + if ( actor ) { + SALOME_Actor* salActor = dynamic_cast( actor ); + if ( salActor ) { + int dm = salActor->getDisplayMode(); + VTK_DISPLAY_MODE_TO_STRING( res, dm ); + } // if ( salome actor ) + } // if ( actor ) + } // if ( lst == vtkPrs->GetObjects() ) + } // if VTK } - else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK - SVTK_Prs* vtkPrs = dynamic_cast( prs ); - vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0; - if ( lst ) { - lst->InitTraversal(); - vtkActor* actor = lst->GetNextActor(); - if ( actor ) { - SALOME_Actor* salActor = dynamic_cast( actor ); - if ( salActor ) { - int dm = salActor->getDisplayMode(); - if ( dm == 0 ) - return "Wireframe"; - else if ( dm == 1 ) - return "Shading"; - } // if ( salome actor ) - } // if ( actor ) - } // if ( lst == vtkPrs->GetObjects() ) - } // if VTK } + +#ifdef USE_VISUAL_PROP_MAP } - return ""; +#endif + + return res; } -bool GEOMGUI_Selection::isComponent( const int index ) const +bool GEOMGUI_Selection::isVectorsMode( const int index ) const { + bool res = false; + +#ifdef USE_VISUAL_PROP_MAP + bool found = false; + QVariant v = visibleProperty( entry( index ), VECTOR_MODE_PROP ); + if ( v.canConvert( QVariant::Bool ) ) { + res = v.toBool(); + found = true; + } + + if ( !found ) { +#endif + SALOME_View* view = GEOM_Displayer::GetActiveView(); + QString viewType = activeViewType(); + if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { + SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + if ( prs ) { + if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC + SOCC_Prs* occPrs = (SOCC_Prs*) prs; + AIS_ListOfInteractive lst; + occPrs->GetObjects( lst ); + if ( lst.Extent() ) { + Handle(AIS_InteractiveObject) io = lst.First(); + if ( !io.IsNull() ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io); + if ( !aSh.IsNull() ) + res = aSh->isShowVectors(); + } + } + } else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK + SVTK_Prs* vtkPrs = dynamic_cast( prs ); + vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0; + if ( lst ) { + lst->InitTraversal(); + vtkActor* actor = lst->GetNextActor(); + if ( actor ) { + GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor); + if ( aGeomActor ) + res = aGeomActor->GetVectorMode(); + } + } + } + } + } +#ifdef USE_VISUAL_PROP_MAP + } +#endif + + return res; +} + +bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj ) +{ + bool ok = false; + if ( obj ) { + _PTR(ChildIterator) it ( obj->GetStudy()->NewChildIterator( obj ) ); + for ( ; it->More() && !ok; it->Next() ) { + _PTR(SObject) child = it->Value(); + if ( child ) { + _PTR(SObject) refObj; + if ( child->ReferencedObject( refObj ) ) continue; // omit references + if ( child->GetName() != "" ) ok = true; + } + } + } + return ok; +} + +bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj ) +{ + bool exp = true; + _PTR(GenericAttribute) anAttr; + if ( obj && obj->FindAttribute( anAttr, "AttributeExpandable" ) ) { + _PTR(AttributeExpandable) aAttrExp = anAttr; + exp = aAttrExp->IsExpandable(); + } + return exp; +} + +bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj ) +{ + bool ret = false; + /* SalomeApp_Study* appStudy = dynamic_cast - (SUIT_Session::session()->activeApplication()->activeStudy()); + (SUIT_Session::session()->activeApplication()->activeStudy());*/ + if ( /*appStudy && */!CORBA::is_nil( obj ) ) + ret = obj->GetShapeType() == GEOM::COMPOUND && obj->GetMaxShapeType() == GEOM::VERTEX; + return ret; +} - if ( appStudy && index >= 0 && index < count() ) { +bool GEOMGUI_Selection::hasHiddenChildren( const int index ) const +{ + bool OK = false; + SalomeApp_Study* appStudy = dynamic_cast( study() ); + + if ( appStudy ) { + QString anEntry = entry( index ); _PTR(Study) study = appStudy->studyDS(); + if ( study && !anEntry.isEmpty() ) { + _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) ); + OK = !expandable( aSO ) && hasChildren( aSO ); + } + } + return OK; +} + +bool GEOMGUI_Selection::hasShownChildren( const int index ) const +{ + bool OK = false; + SalomeApp_Study* appStudy = dynamic_cast( study() ); + + if ( appStudy ) { QString anEntry = entry( index ); + _PTR(Study) study = appStudy->studyDS(); + if ( study && !anEntry.isEmpty() ) { + _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) ); + OK = expandable( aSO ) && hasChildren( aSO ); + } + } + return OK; +} + +bool GEOMGUI_Selection::compoundOfVertices( const int index ) const +{ + GEOM::GEOM_Object_var obj = getObject( index ); + return isCompoundOfVertices( obj ); +} + +bool GEOMGUI_Selection::isComponent( const int index ) const +{ + SalomeApp_Study* appStudy = dynamic_cast( study() ); + if ( appStudy ) { + QString anEntry = entry( index ); + _PTR(Study) study = appStudy->studyDS(); if ( study && !anEntry.isNull() ) { _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) ); if ( aSO && aSO->GetFatherComponent() ) - return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR(); + return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR(); } } return false; @@ -197,43 +502,123 @@ bool GEOMGUI_Selection::isComponent( const int index ) const GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const { - SalomeApp_Study* appStudy = dynamic_cast - (SUIT_Session::session()->activeApplication()->activeStudy()); - - if (appStudy && index >= 0 && index < count()) { - _PTR(Study) study = appStudy->studyDS(); - QString anEntry = entry(index); - - if (study && !anEntry.isNull()) { - _PTR(SObject) aSO (study->FindObjectID(anEntry.toStdString())); - if (aSO) { - CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSO); - return GEOM::GEOM_Object::_narrow(anObj); - } - } - } - return GEOM::GEOM_Object::_nil(); + GEOM::GEOM_Object_var o; + if ( 0 <= index && index < myObjects.size() ) + o = GEOM::GEOM_Object::_duplicate( myObjects[index] ); + return o._retn(); } QString GEOMGUI_Selection::selectionMode() const { - SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) { + SalomeApp_Application* app = dynamic_cast( study()->application() ); + if ( app ) { GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); - if (aGeomGUI) { - switch (aGeomGUI->getLocalSelectionMode()) + if ( aGeomGUI ) { + switch ( aGeomGUI->getLocalSelectionMode() ) { - case GEOM_POINT : return "VERTEX"; - case GEOM_EDGE : return "EDGE"; - case GEOM_WIRE : return "WIRE"; - case GEOM_FACE : return "FACE"; - case GEOM_SHELL : return "SHELL"; - case GEOM_SOLID : return "SOLID"; - case GEOM_COMPOUND : return "COMPOUND"; - case GEOM_ALLOBJECTS : return "ALL"; - default: return ""; + case GEOM_POINT : return "VERTEX"; + case GEOM_EDGE : return "EDGE"; + case GEOM_WIRE : return "WIRE"; + case GEOM_FACE : return "FACE"; + case GEOM_SHELL : return "SHELL"; + case GEOM_SOLID : return "SOLID"; + case GEOM_COMPOUND : return "COMPOUND"; + case GEOM_ALLOBJECTS : return "ALL"; + default: return ""; } } } return ""; } + +bool GEOMGUI_Selection::topLevel( const int index ) const { + bool res = false; + +#ifdef USE_VISUAL_PROP_MAP + bool found = false; + QVariant v = visibleProperty( entry( index ), TOP_LEVEL_PROP ); + if ( v.canConvert() ) { + res = v.toBool(); + found = true; + } + + if ( !found ) { +#endif + SALOME_View* view = GEOM_Displayer::GetActiveView(); + QString viewType = activeViewType(); + if ( view && viewType == OCCViewer_Viewer::Type() ) { + SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + if ( prs ) { + if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC + SOCC_Prs* occPrs = (SOCC_Prs*) prs; + AIS_ListOfInteractive lst; + occPrs->GetObjects( lst ); + if ( lst.Extent() ) { + Handle(AIS_InteractiveObject) io = lst.First(); + if ( !io.IsNull() ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io); + if ( !aSh.IsNull() ) + res = (bool)aSh->isTopLevel(); + } + } + } + } + } + } + return res; +} + +bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const{ + bool res = false; + +#ifdef USE_VISUAL_PROP_MAP + bool found = false; + QVariant v = visibleProperty( entry( idx ), MATERIAL_PROP ); + if ( v.canConvert() ) { + Material_Model material; + material.fromProperties( v.toString() ); + res = material.isPhysical(); + found = true; + } + + if ( !found ) { +#endif + SALOME_View* view = GEOM_Displayer::GetActiveView(); + QString viewType = activeViewType(); + if ( view ) { + SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() ); + if ( prs ) { + if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC + SOCC_Prs* occPrs = (SOCC_Prs*) prs; + AIS_ListOfInteractive lst; + occPrs->GetObjects( lst ); + if ( lst.Extent() ) { + Handle(AIS_InteractiveObject) io = lst.First(); + if ( !io.IsNull() ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io); + if ( !aSh.IsNull() ) + res = (bool) aSh->Attributes()->ShadingAspect()-> + Material(Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC ); + } + } + } + else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK + SVTK_Prs* vtkPrs = dynamic_cast( prs ); + vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0; + if ( lst ) { + lst->InitTraversal(); + vtkActor* actor = lst->GetNextActor(); + if ( actor ) { + GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( actor ); + if ( aGeomGActor ) { + GEOM_VTKPropertyMaterial* mat = GEOM_VTKPropertyMaterial::SafeDownCast(aGeomGActor->GetProperty()); + res = mat->GetPhysical(); + } // if ( salome actor ) + } // if ( actor ) + } // if ( lst == vtkPrs->GetObjects() ) + } + } + } + } + return res; +} diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h index 35b90f225..c6e9b59da 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.h +++ b/src/GEOMGUI/GEOMGUI_Selection.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMGUI_Selection.h // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com) // @@ -28,11 +29,13 @@ #include "GEOM_GEOMGUI.hxx" #include +#include #include #include CORBA_SERVER_HEADER(GEOM_Gen) class LightApp_SelectionMgr; +class LightApp_DataOwner; class GEOMGUI_EXPORT GEOMGUI_Selection : public LightApp_Selection { @@ -40,18 +43,48 @@ public: GEOMGUI_Selection(); virtual ~GEOMGUI_Selection(); - virtual QVariant parameter( const int, const QString& ) const; + virtual void init( const QString&, LightApp_SelectionMgr* ); + virtual bool processOwner( const LightApp_DataOwner* ); + virtual QVariant parameter( const QString& ) const; + virtual QVariant parameter( const int, const QString& ) const; + + static bool hasChildren( const _PTR(SObject)& ); + static bool expandable( const _PTR(SObject)& ); + static bool isCompoundOfVertices( GEOM::GEOM_Object_ptr ); + +protected: + // virtual QVariant contextParameter( const QString& ) const; + // virtual QVariant objectParameter( const int, const QString& ) const; private: bool isVisible( const int ) const; bool isAutoColor( const int ) const; - QString typeName( const int ) const; + bool isImported( const int ) const; + QString typeName( const int ) const; + int typeId( const int ) const; QString displayMode( const int ) const; QString selectionMode() const; + bool isVectorsMode( const int ) const; + bool hasHiddenChildren( const int ) const; + bool hasShownChildren( const int ) const; + bool compoundOfVertices( const int ) const; + bool topLevel( const int ) const; + bool isPhysicalMaterial( const int ) const; bool isComponent( const int ) const; GEOM::GEOM_Object_ptr getObject( const int ) const; + + bool hasImported() const; + bool allImported() const; + + QVariant visibleProperty( const QString&, const QString& ) const; + +private: + typedef QVector GeomObjectVector; + +private: + GeomObjectVector myObjects; }; -#endif // GEOMGUI_SELECTION_H +#endif diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index b183b3f53..15f36281d 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -1,32 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOM_Displayer.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #include "GEOM_Displayer.h" #include "GeometryGUI.h" +#include #include #include #include @@ -36,11 +38,14 @@ #include #include -#include #include +#include #include #include #include +#include + +#include #include #include @@ -48,9 +53,12 @@ #include #include +#include + #include #include #include +#include #include #include @@ -71,14 +79,25 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include #include +#include +#include +#include +#include +#include + +#include + +#include // VTK Includes #include @@ -89,7 +108,11 @@ #include -using namespace std; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif //================================================================ // Function : getActiveStudy @@ -104,6 +127,14 @@ static inline SalomeApp_Study* getActiveStudy() return 0; } +static inline int getViewManagerId( SALOME_View* theViewFrame) { + SUIT_ViewModel* aModel = dynamic_cast(theViewFrame); + SUIT_ViewManager* aViewMgr = 0; + if (aModel != 0) + aViewMgr = aModel->getViewManager(); + return ((aViewMgr == 0) ? -1 :aViewMgr->getGlobalId()); +} + //================================================================ // Function : getTopAbsMode // Purpose : Get TopAbs_ShapeEnum value corresponding to the @@ -124,6 +155,35 @@ static inline int getTopAbsMode( const int implType ) } } +int GEOM_Displayer::getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin ) +{ + if ( shape.IsNull() ) + return TopAbs_SHAPE; + + int ret = shape.ShapeType(); + + if ( shape.ShapeType() == TopAbs_COMPOUND || shape.ShapeType() == TopAbs_COMPSOLID ) { + TopoDS_Iterator it(shape, Standard_True, Standard_False); + for (; it.More(); it.Next()) { + TopoDS_Shape sub_shape = it.Value(); + if ( sub_shape.IsNull() ) continue; + int stype = getMinMaxShapeType( sub_shape, ismin ); + if ( stype == TopAbs_SHAPE ) continue; + if ( ismin && stype > ret ) + ret = stype; + else if ( !ismin && ( ret < TopAbs_SOLID || stype < ret ) ) + ret = stype; + } + } + + return ret; +} + +bool GEOM_Displayer::isCompoundOfVertices( const TopoDS_Shape& theShape ) +{ + return theShape.ShapeType() == TopAbs_COMPOUND && getMinMaxShapeType( theShape, false ) == TopAbs_VERTEX; +} + //================================================================ // Function : getFilter // Purpose : Get filter corresponding to the type of object @@ -162,13 +222,13 @@ SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode ) //================================================================ // Function : getComplexFilter -// Purpose : Get compound filter corresponding to the type of +// Purpose : Get compound filter corresponding to the type of // object from GEOMImpl_Types.h //================================================================ SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList* aSubShapes) { GEOM_CompoundFilter* aFilter; - + if(aSubShapes != NULL ) { aFilter = new GEOM_CompoundFilter(getStudy()); QList aTopAbsTypes; @@ -180,7 +240,7 @@ SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList* aSubSh } aFilter->addSubTypes(aTopAbsTypes); } - + return aFilter; } @@ -188,7 +248,7 @@ SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList* aSubSh // Function : getEntry // Purpose : //================================================================ -static string getEntry( GEOM::GEOM_Object_ptr object ) +static std::string getEntry( GEOM::GEOM_Object_ptr object ) { SUIT_Session* session = SUIT_Session::session(); SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); @@ -198,9 +258,9 @@ static string getEntry( GEOM::GEOM_Object_ptr object ) if ( strcmp(IOR.in(), "") != 0 ) { SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); - _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( string(IOR) ) ); + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( std::string(IOR) ) ); if ( SO ) - return SO->GetID(); + return SO->GetID(); } } return ""; @@ -210,7 +270,7 @@ static string getEntry( GEOM::GEOM_Object_ptr object ) // Function : getName // Purpose : //================================================================ -static string getName( GEOM::GEOM_Object_ptr object ) +static std::string getName( GEOM::GEOM_Object_ptr object ) { SUIT_Session* session = SUIT_Session::session(); SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); @@ -220,7 +280,7 @@ static string getName( GEOM::GEOM_Object_ptr object ) if ( strcmp(IOR.in(), "") != 0 ) { SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); - _PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( string(IOR) ) ); + _PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( std::string(IOR) ) ); _PTR(GenericAttribute) anAttr; @@ -256,23 +316,36 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) myShadingColor = SalomeApp_Tools::color( col ); myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0); - myTypeOfMarker = (Aspect_TypeOfMarker)resMgr->integerValue("Geometry", "type_of_marker", Aspect_TOM_PLUS); - myScaleOfMarker = resMgr->doubleValue("Geometry", "marker_scale", 1.); - if(myScaleOfMarker < 1.0) - myScaleOfMarker = 1.0; - if(myScaleOfMarker > 7.) - myScaleOfMarker = 7.; + int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS); + myWidth = resMgr->integerValue("Geometry", "edge_width", -1); + myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1); + + myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType))); + myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0; + myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker)); myColor = -1; // This color is used for shape displaying. If it is equal -1 then // default color is used. + myTexture = ""; myWidth = -1; myType = -1; myToActivate = true; // This parameter is used for activisation/deactivisation of objects to be displayed + + #if OCC_VERSION_LARGE > 0x06050100 // Functionnality available only in OCCT 6.5.2 + // Activate parallel vizualisation only for testing purpose + // and if the corresponding env variable is set to 1 + char* parallel_visu = getenv("PARALLEL_VISU"); + if (parallel_visu && atoi(parallel_visu)) + { + MESSAGE("Parallel visualisation on"); + BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True); + } + #endif myViewFrame = 0; } @@ -294,8 +367,8 @@ GEOM_Displayer::~GEOM_Displayer() */ //================================================================= void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO, - const bool updateViewer, - SALOME_View* theViewFrame ) + const bool updateViewer, + SALOME_View* theViewFrame ) { SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); if ( vf ) @@ -304,13 +377,19 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO, if ( prs ) { - vf->BeforeDisplay( this ); + vf->BeforeDisplay( this, prs ); vf->Display( prs ); - vf->AfterDisplay( this ); + vf->AfterDisplay( this, prs ); if ( updateViewer ) vf->Repaint(); + int aMgrId = getViewManagerId(vf); + SalomeApp_Study* aStudy = getStudy(); + aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 1 ); + + setVisibilityState(theIO->getEntry(), Qtx::ShownState); + delete prs; // delete presentation because displayer is its owner } } @@ -328,7 +407,7 @@ void GEOM_Displayer::Display( GEOM::GEOM_Object_ptr theObj, const bool updateVie if ( theObj->_is_nil() ) return; - string entry = getEntry( theObj ); + std::string entry = getEntry( theObj ); if ( entry != "" ) { Display(new SALOME_InteractiveObject(entry.c_str(), "GEOM", getName(theObj).c_str()), updateViewer); @@ -344,7 +423,7 @@ void GEOM_Displayer::Display( GEOM::GEOM_Object_ptr theObj, const bool updateVie void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO, const bool forced, const bool updateViewer, - SALOME_View* theViewFrame ) + SALOME_View* theViewFrame ) { if ( theIO.IsNull() ) return; @@ -354,10 +433,18 @@ void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO, if ( vf ) { SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() ); if ( prs ) { + vf->BeforeErase( this, prs ); vf->Erase( prs, forced ); + vf->AfterErase( this, prs ); if ( updateViewer ) - vf->Repaint(); + vf->Repaint(); delete prs; // delete presentation because displayer is its owner + + int aMgrId = getViewManagerId(vf); + SalomeApp_Study* aStudy = getStudy(); + aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 0 ); + + setVisibilityState(theIO->getEntry(), Qtx::HiddenState); } } } @@ -372,7 +459,7 @@ void GEOM_Displayer::Erase( GEOM::GEOM_Object_ptr theObj, const bool forced, const bool updateViewer ) { - string entry = getEntry( theObj ); + std::string entry = getEntry( theObj ); if ( entry != "" ) { Erase(new SALOME_InteractiveObject(entry.c_str(), "GEOM", getName(theObj).c_str()), @@ -404,19 +491,19 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO, SUIT_ViewManager* vman = wnd->getViewManager(); if ( vman ) { - SUIT_ViewModel* vmodel = vman->getViewModel(); - if ( vmodel ) - { - SALOME_View* view = dynamic_cast(vmodel); - if ( view ) - { - if ( view->isVisible( theIO ) || view == GetActiveView() ) - { - Erase( theIO, true, false, view ); - Display( theIO, updateViewer, view ); - } - } - } + SUIT_ViewModel* vmodel = vman->getViewModel(); + if ( vmodel ) + { + SALOME_View* view = dynamic_cast(vmodel); + if ( view ) + { + if ( view->isVisible( theIO ) || view == GetActiveView() ) + { + Erase( theIO, true, false, view ); + Display( theIO, updateViewer, view ); + } + } + } } } } @@ -538,8 +625,26 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) // if presentation is empty we try to create new one if ( occPrs->IsNull() ) { - if ( !myShape.IsNull() ) - { + SalomeApp_Study* aStudy = getStudy(); + if(!aStudy) + return; + if ( !myShape.IsNull() ) { + + bool onlyVertex = (myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape )); + + QString anEntry; + int aMgrId = -1; + if(!myIO.IsNull()) { + aMgrId = getViewManagerId(myViewFrame); + anEntry = myIO->getEntry(); + } + bool useStudy = !anEntry.isEmpty() && aMgrId != -1; + bool useObjColor = false; + bool useObjMarker = false; + + PropMap aPropMap; + PropMap aDefPropMap; + //Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" ); Handle(GEOM_AISShape) AISShape; if (myType == GEOM_VECTOR) @@ -551,92 +656,214 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) AISShape = new GEOM_AISShape (myShape, ""); } // Temporary staff: vertex must be infinite for correct visualization - AISShape->SetInfiniteState( myShape.Infinite() || myShape.ShapeType() == TopAbs_VERTEX ); + AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines) + + if(useStudy){ + aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry); + aDefPropMap = getDefaultPropertyMap(SOCC_Viewer::Type()); + Quantity_Color quant_col; + if(aPropMap.contains(COLOR_PROP)) { + quant_col = SalomeApp_Tools::color( aPropMap.value(COLOR_PROP).value()); + AISShape->SetShadingColor( quant_col ); + } else + useObjColor = true; + MergePropertyMaps(aPropMap, aDefPropMap); + if(!useObjColor && aPropMap.contains(COLOR_PROP)) { + quant_col = SalomeApp_Tools::color( aPropMap.value(COLOR_PROP).value()); + AISShape->SetShadingColor( quant_col ); + } - // Setup shape properties here ..., e.g. display mode, color, transparency, etc - AISShape->SetDisplayMode( myDisplayMode ); - AISShape->SetShadingColor( myShadingColor ); + // Setup shape properties here ..., e.g. display mode, color, transparency, etc + Standard_Boolean isTopLevel = Standard_False; + if(aPropMap.contains(TOP_LEVEL_PROP)) { + isTopLevel = aPropMap.value(TOP_LEVEL_PROP).value(); + } + AISShape->SetDisplayMode( aPropMap.value(DISPLAY_MODE_PROP).toInt() ); + AISShape->setTopLevel(isTopLevel); + + AISShape->SetDisplayVectors(aPropMap.value(VECTOR_MODE_PROP).toInt()); + }else { + AISShape->SetDisplayMode( myDisplayMode ); + AISShape->SetShadingColor( myShadingColor ); + } - // Set color and number for iso lines - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QColor col = aResMgr->colorValue( "Geometry", "isos_color", + // Set color and number for iso lines + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QColor col = aResMgr->colorValue( "Geometry", "isos_color", QColor(int(0.5*255), int(0.5*255), int(0.5*255)) ); - Quantity_Color aColor = SalomeApp_Tools::color( col ); - int anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1); - int aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1); + Quantity_Color aColor = SalomeApp_Tools::color( col ); + + //get the ISOS number, set transparency if need + int anUIsoNumber, aVIsoNumber; + if(useStudy) { + QString anIsos = aPropMap.value(ISOS_PROP).toString(); + QStringList uv = anIsos.split(DIGIT_SEPARATOR); + anUIsoNumber = uv[0].toInt(); + aVIsoNumber = uv[1].toInt(); + AISShape->SetTransparency(aPropMap.value(TRANSPARENCY_PROP).toDouble()); + } else { + anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1); + aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1); + } - Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect(); - anAspect->SetNumber( anUIsoNumber ); - anAspect->SetColor( aColor ); - AISShape->Attributes()->SetUIsoAspect( anAspect ); + Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect(); + anAspect->SetNumber( anUIsoNumber ); + anAspect->SetColor( aColor ); - anAspect = AISShape->Attributes()->VIsoAspect(); - anAspect->SetNumber( aVIsoNumber ); - anAspect->SetColor( aColor ); - AISShape->Attributes()->SetVIsoAspect( anAspect ); + if(HasIsosWidth()) + anAspect->SetWidth( GetIsosWidth() ); + AISShape->Attributes()->SetUIsoAspect( anAspect ); + anAspect = AISShape->Attributes()->VIsoAspect(); + anAspect->SetNumber( aVIsoNumber ); + if(HasIsosWidth()) + anAspect->SetWidth( GetIsosWidth() ); + anAspect->SetColor( aColor ); + AISShape->Attributes()->SetVIsoAspect( anAspect ); if ( HasColor() ) { - AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); - if ( myShape.ShapeType() == TopAbs_VERTEX ) + AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); + if ( onlyVertex ) { - Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); - anAspect->SetColor( (Quantity_NameOfColor)GetColor() ); - anAspect->SetScale( myScaleOfMarker ); - anAspect->SetTypeOfMarker( myTypeOfMarker ); - AISShape->Attributes()->SetPointAspect( anAspect ); + if(aPropMap.contains(MARKER_TYPE_PROP)) { + QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR); + if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker" + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); + int aTypeOfMarker = aList[0].toInt(); + double aScaleOfMarker = aList[1].toDouble(); + anAspect->SetScale( aScaleOfMarker ); + anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1)); + anAspect->SetColor((Quantity_NameOfColor)GetColor()); + AISShape->Attributes()->SetPointAspect(anAspect); + } else { //Custom marker string contains "IdOfTexsture" + int textureId = aList[0].toInt(); + Standard_Integer aWidth, aHeight; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture = +#else + Handle(Graphic3d_HArray1OfBytes) aTexture = +#endif + GeometryGUI::getTexture(aStudy, textureId, aWidth, aHeight); + if (!aTexture.IsNull()) { + static int TextureId = 0; + Handle(Prs3d_PointAspect) aTextureAspect = + new Prs3d_PointAspect ((Quantity_NameOfColor)GetColor(), + ++TextureId, + aWidth, aHeight, + aTexture); + AISShape->Attributes()->SetPointAspect(aTextureAspect); + } else { + useObjMarker = true; + } + } + } else { + useObjMarker = true; + } } - } - else - { - if ( myShape.ShapeType() == TopAbs_VERTEX ) - { - col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ); - aColor = SalomeApp_Tools::color( col ); - - Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); - anAspect->SetColor( aColor ); - anAspect->SetScale( myScaleOfMarker ); - anAspect->SetTypeOfMarker( myTypeOfMarker ); + } + else + { + if ( onlyVertex ) + { + col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ); + aColor = SalomeApp_Tools::color( col ); + + if(aPropMap.contains(MARKER_TYPE_PROP)) { + QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR); + if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker" + int aTypeOfMarker = aList[0].toInt(); + double aScaleOfMarker = aList[1].toDouble(); + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); + anAspect->SetScale( aScaleOfMarker ); + anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1) ); + anAspect->SetColor( aColor ); AISShape->Attributes()->SetPointAspect( anAspect ); - } - else - { - // Set line aspect - col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) ); - aColor = SalomeApp_Tools::color( col ); - - Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect(); - anAspect->SetColor( aColor ); - AISShape->Attributes()->SetLineAspect( anAspect ); - - // Set unfree boundaries aspect - anAspect = AISShape->Attributes()->UnFreeBoundaryAspect(); - anAspect->SetColor( aColor ); - AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect ); - - // Set free boundaries aspect - col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) ); - aColor = SalomeApp_Tools::color( col ); - - anAspect = AISShape->Attributes()->FreeBoundaryAspect(); - anAspect->SetColor( aColor ); - AISShape->Attributes()->SetFreeBoundaryAspect( anAspect ); - - // Set wire aspect - col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) ); - aColor = SalomeApp_Tools::color( col ); - - anAspect = AISShape->Attributes()->WireAspect(); - anAspect->SetColor( aColor ); - AISShape->Attributes()->SetWireAspect( anAspect ); - - // bug [SALOME platform 0019868] - // Set deviation angle. Default one is 12 degrees (Prs3d_Drawer.cxx:18) - AISShape->SetOwnDeviationAngle( 10*PI/180 ); - } - } - + } else { //Custom marker string contains "IdOfTexsture" + int textureId = aList[0].toInt(); + Standard_Integer aWidth, aHeight; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture = +#else + Handle(Graphic3d_HArray1OfBytes) aTexture = +#endif + GeometryGUI::getTexture(aStudy, textureId, aWidth, aHeight); + if (!aTexture.IsNull()) { + static int TextureId = 0; + Handle(Prs3d_PointAspect) aTextureAspect = + new Prs3d_PointAspect (aColor, ++TextureId, aWidth, aHeight, aTexture); + AISShape->Attributes()->SetPointAspect( aTextureAspect ); + } else { + useObjMarker = true; + } + } + } else { + useObjMarker = true; + } + } + else { + // Set line aspect + col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) ); + aColor = SalomeApp_Tools::color( col ); + + Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect(); + anAspect->SetColor( aColor ); + AISShape->Attributes()->SetLineAspect( anAspect ); + + // Set unfree boundaries aspect + anAspect = AISShape->Attributes()->UnFreeBoundaryAspect(); + anAspect->SetColor( aColor ); + AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect ); + AISShape->storeBoundaryColors(); + + // Set free boundaries aspect + col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) ); + aColor = SalomeApp_Tools::color( col ); + + anAspect = AISShape->Attributes()->FreeBoundaryAspect(); + anAspect->SetColor( aColor ); + AISShape->Attributes()->SetFreeBoundaryAspect( anAspect ); + + // Set wire aspect + col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) ); + aColor = SalomeApp_Tools::color( col ); + + anAspect = AISShape->Attributes()->WireAspect(); + anAspect->SetColor( aColor ); + AISShape->Attributes()->SetWireAspect( anAspect ); + + // Set color for edges in shading + col = aResMgr->colorValue( "Geometry", "edges_in_shading_color", QColor( 255, 255, 0 ) ); + aColor = SalomeApp_Tools::color( col ); + AISShape->SetEdgesInShadingColor( aColor ); + + // bug [SALOME platform 0019868] + // Set deviation angle. Default one is 12 degrees (Prs3d_Drawer.cxx:18) + //AISShape->SetOwnDeviationAngle( 10*PI/180 ); + + // IMP 0020626 + double aDC = 0; + if(useStudy) { + aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble(); + SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt()); + SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt()); + } + else { + aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001); + } + + aDC = std::max( aDC, DEFLECTION_MIN ); // to avoid to small values of the coefficient + AISShape->SetOwnDeviationCoefficient(aDC); + } + } + + if ( HasTexture() ) + { + AISShape->SetTextureFileName(TCollection_AsciiString(myTexture.c_str())); + AISShape->SetTextureMapOn(); + AISShape->DisableTextureModulate(); + AISShape->SetDisplayMode(3); + } + if ( HasWidth() ) AISShape->SetWidth( GetWidth() ); @@ -657,86 +884,124 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) AISShape->SetOwner( anObj ); } - // Get color from GEOM_Object - SUIT_Session* session = SUIT_Session::session(); - SUIT_Application* app = session->activeApplication(); - if ( app ) - { - SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); - if ( study ) - { - Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO(); - if ( !anIO.IsNull() ) - { - _PTR(SObject) SO ( study->studyDS()->FindObjectID( anIO->getEntry() ) ); - if ( SO ) - { - // get CORBA reference to data object - CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); - if ( !CORBA::is_nil( object ) ) - { - // downcast to GEOM object - GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object ); - if ( !aGeomObject->_is_nil() ) - { - SALOMEDS::Color aSColor = aGeomObject->GetColor(); - bool hasColor = aSColor.R > 0 || aSColor.G > 0 || aSColor.B > 0; - if( !hasColor && aGeomObject->GetType() == GEOM_GROUP ) // auto color for group - { - GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen(); - GEOM::GEOM_IGroupOperations_var anOperations = aGeomGen->GetIGroupOperations( study->id() ); - GEOM::GEOM_Object_var aMainObject = anOperations->GetMainShape( aGeomObject ); - if ( !aMainObject->_is_nil() && aMainObject->GetAutoColor() ) - { - QList aReservedColors; - - SalomeApp_Application* app = dynamic_cast( app ); - CORBA::String_var IOR = app->orb()->object_to_string( aMainObject ); - if ( strcmp(IOR.in(), "") != 0 ) - { - _PTR(Study) aStudy = study->studyDS(); - _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( string(IOR) ) ); - _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); - for( ; it->More(); it->Next() ) - { - _PTR(SObject) aChildSObject( it->Value() ); - GEOM::GEOM_Object_var aChildObject = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject)); - if( CORBA::is_nil( aChildObject ) ) - continue; - - if( aChildObject->GetType() != GEOM_GROUP ) - continue; - - SALOMEDS::Color aReservedColor = aChildObject->GetColor(); - aReservedColors.append( aReservedColor ); - } - } + Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO(); + if ( !anIO.IsNull() ) { + _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) ); + if ( SO ) { + // get CORBA reference to data object + CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); + if ( !CORBA::is_nil( object ) ) { + // downcast to GEOM object + GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object ); + bool hasColor = false; + SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor); + if( hasColor && useObjColor) { + Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB ); + AISShape->SetColor( aQuanColor ); + AISShape->SetShadingColor( aQuanColor ); + if ( onlyVertex ) { + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); + anAspect->SetColor( aQuanColor ); + anAspect->SetScale( myScaleOfMarker ); + anAspect->SetTypeOfMarker( myTypeOfMarker ); + AISShape->Attributes()->SetPointAspect( anAspect ); + } + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, SalomeApp_Tools::color( aQuanColor ) ); + } else if( !hasColor ) { + //In case if color wasn't defined in the property map of the object + //and GEOM_Object color also wasn't defined get default color from Resource Mgr. + QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); + Quantity_Color aQuanColor = SalomeApp_Tools::color( col ); + AISShape->SetShadingColor( aQuanColor ); + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col ); + } + + // ... marker type + if(useObjMarker) { + GEOM::marker_type aType = aGeomObject->GetMarkerType(); + GEOM::marker_size aSize = aGeomObject->GetMarkerSize(); + if ( aType > GEOM::MT_NONE && aType < GEOM::MT_USER && aSize > GEOM::MS_NONE && aSize <= GEOM::MS_70 ) { + Aspect_TypeOfMarker aMType = (Aspect_TypeOfMarker)( (int)aType-1 ); + double aMSize = ((int)aSize+1)*0.5; + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); + anAspect->SetScale( aMSize ); + anAspect->SetTypeOfMarker( aMType ); + Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) ); + if ( hasColor ) + aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB ); + anAspect->SetColor( aQuanColor ); + AISShape->Attributes()->SetPointAspect( anAspect ); + } + else if ( aType == GEOM::MT_USER ) { + int aTextureId = aGeomObject->GetMarkerTexture(); + Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) ); + if ( hasColor ) aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB ); + Standard_Integer aWidth, aHeight; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture = +#else + Handle(Graphic3d_HArray1OfBytes) aTexture = +#endif + GeometryGUI::getTexture(getStudy(), aTextureId, aWidth, aHeight); + if (!aTexture.IsNull()) { + static int TextureId = 0; + Handle(Prs3d_PointAspect) aTextureAspect = + new Prs3d_PointAspect(aQuanColor, ++TextureId, aWidth, aHeight, aTexture ); + AISShape->Attributes()->SetPointAspect( aTextureAspect ); + } + } else { //Use marker from the preferences + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); + anAspect->SetScale( myScaleOfMarker ); + anAspect->SetTypeOfMarker( myTypeOfMarker ); + Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) ); + if ( hasColor ) + aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB ); + anAspect->SetColor( aQuanColor ); + AISShape->Attributes()->SetPointAspect( anAspect ); + } + } + } + } - aSColor = getUniqueColor( aReservedColors ); - hasColor = true; - } - } - - if( hasColor ) - { - Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB ); - AISShape->SetColor( aQuanColor ); - AISShape->SetShadingColor( aQuanColor ); - } - } - } - } - } - } - } + // get material properties, set material + Material_Model material; + if ( useStudy ) { + // Get material property from study and construct material model + material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() ); + } else { + // Get material property from study and construct material model + QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" ); + material.fromResources( mname ); + } + + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() ); + + // Set material for the selected shape + AISShape->SetMaterial( material.getMaterialOCCAspect() ); + if(HasWidth()) + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() ); + if(HasIsosWidth()) + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() ); + } // AISShape->SetName(???); ??? necessary to set name ??? occPrs->AddObject( AISShape ); - + // In accordance with ToActivate() value object will be activated/deactivated // when it will be displayed occPrs->SetToActivate( ToActivate() ); + + if( AISShape->isTopLevel() && AISShape->topLevelDisplayMode() == GEOM_AISShape::TopShowAdditionalWActor) { + //21671: EDF 1829 GEOM : Bring to front selected objects (continuation): + // Display wireframe presentation additionally + Handle(GEOM_TopWireframeShape) aWirePrs = new GEOM_TopWireframeShape(myShape); + aWirePrs->SetWidth(AISShape->Width()); + if ( !myIO.IsNull() ) { + aWirePrs->setIO( myIO ); + aWirePrs->SetOwner( myIO ); + } + occPrs->AddObject(aWirePrs); + } } } // if presentation is found -> set again shape for it @@ -778,19 +1043,29 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) //================================================================= void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) { + SalomeApp_Study* aStudy = getStudy(); + int aMgrId = -1; SVTK_Prs* vtkPrs = dynamic_cast( prs ); - if ( !vtkPrs || myShape.IsNull() ) + + if ( !vtkPrs || myShape.IsNull() || !aStudy) return; + bool useStudy = false; + bool useObjCol = false; + PropMap aPropMap; + vtkActorCollection* theActors = 0; - if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE ) - { - myToActivate = false; + QString anEntry; + if(!myIO.IsNull()) { + anEntry = myIO->getEntry(); + } + + if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE ) { + //myToActivate = false; // ouv: commented to make the trihedron pickable (see IPAL18657) GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New(); - if ( HasColor() ) - { + if ( HasColor() ) { Quantity_Color aColor( (Quantity_NameOfColor)GetColor() ); aTrh->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() ); } @@ -803,18 +1078,35 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) gp_Ax2 anAx2 = aPlane->Pln().Position().Ax2(); aTrh->SetPlacement( new Geom_Axis2Placement( anAx2 ) ); -// if ( SVTK_Viewer* vf = dynamic_cast( GetActiveView() ) ) -// aTrh->SetSize( 0.5 * vf->GetTrihedronSize() ); + // if ( SVTK_Viewer* vf = dynamic_cast( GetActiveView() ) ) + // aTrh->SetSize( 0.5 * vf->GetTrihedronSize() ); vtkPrs->AddObject( aTrh ); theActors = vtkActorCollection::New(); theActors->AddItem( aTrh ); } - else - { - bool isVector = (myType == GEOM_VECTOR); - theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True, isVector ); + else { + PropMap aDefPropMap = getDefaultPropertyMap(SVTK_Viewer::Type()); + + if(!myIO.IsNull()) { + aMgrId = getViewManagerId(myViewFrame); + } + useStudy = !anEntry.isEmpty() && aMgrId != -1; + + + theActors = vtkActorCollection::New(); + GEOM_Actor* aGeomActor = GEOM_Actor::New(); + aGeomActor->SetShape(myShape,aDefPropMap.value(DEFLECTION_COEFF_PROP).toDouble(),myType == GEOM_VECTOR); + theActors->AddItem(aGeomActor); + aGeomActor->Delete(); + + if(useStudy) { + aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry); + if(!aPropMap.contains(COLOR_PROP)) + useObjCol = true; + MergePropertyMaps(aPropMap, aDefPropMap); + } } theActors->InitTraversal(); @@ -835,11 +1127,6 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) aProp->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() ); } - if ( HasWidth() ) - { - aProp->SetLineWidth( GetWidth() ); - } - while ( anActor != NULL ) { SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor ); @@ -850,15 +1137,116 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) { GActor->SetProperty( aProp ); GActor->SetPreviewProperty( aProp ); + } - GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( anActor ); - if ( aGeomGActor != 0 ) - { + GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( anActor ); + if ( aGeomGActor != 0 ) + { + if ( aProp ) { aGeomGActor->SetShadingProperty( aProp ); aGeomGActor->SetWireframeProperty( aProp ); } + + // Set color for edges in shading + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + if(aResMgr) { + QColor c = aResMgr->colorValue( "Geometry", "edges_in_shading_color", QColor( 255, 255, 0 ) ); + aGeomGActor->SetEdgesInShadingColor( c.red()/255., c.green()/255., c.blue()/255. ); + } + + int aIsos[2]= { 1, 1 }; + if(useStudy) { + QString anIsos = aPropMap.value(ISOS_PROP).toString(); + QStringList uv = anIsos.split(DIGIT_SEPARATOR); + aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt(); + aGeomGActor->SetNbIsos(aIsos); + aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble()); + SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt()); + SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt()); + aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt()); + int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt(); + // Specially processing of 'Shading with edges' mode from preferences, + // because there is the following enum in VTK viewer: + // Points - 0, Wireframe - 1, Surface - 2, Insideframe - 3, SurfaceWithEdges - 4 + // (see VTKViewer::Representation enum) and the following enum in GEOM_Actor: + // eWireframe - 0, eShading - 1, eShadingWithEdges - 3 + if ( aDispModeId == 2 ) + // this is 'Shading with edges' mode => do the correct mapping to EDisplayMode + // enum in GEOM_Actor (and further to VTKViewer::Representation enum) + aDispModeId++; + aGeomGActor->setDisplayMode(aDispModeId); + aGeomGActor->SetDeflection(aPropMap.value(DEFLECTION_COEFF_PROP).toDouble()); + + // Create material model + Material_Model material; + material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() ); + // Set material properties for the object + aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() ); + // Set the same front and back materials for the selected shape + std::vector aProps; + aProps.push_back( material.getMaterialVTKProperty() ); + aGeomGActor->SetMaterial(aProps); + + vtkFloatingPointType aColor[3] = {1.,0.,0.}; + if ( useObjCol ) { //Get Color from geom object + Handle( SALOME_InteractiveObject ) anIO = aGeomGActor->getIO(); + if ( !anIO.IsNull() ) { + _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) ); + if ( SO ) { + // get CORBA reference to data object + CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); + if ( !CORBA::is_nil( object ) ) { + // downcast to GEOM object + GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object ); + bool hasColor = false; + SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor); + if(hasColor) { + aColor[0] = aSColor.R; aColor[1] = aSColor.G; aColor[2] = aSColor.B; + } else { + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + if(aResMgr) { + QColor c = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); + aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.; + } + } + aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, QColor( aColor[0] *255, aColor[1] * 255, aColor[2]* 255) ); + } + } + } + } else { + QColor c = aPropMap.value(COLOR_PROP).value(); + aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.; + } + + if ( !material.isPhysical() ) + aGeomGActor->SetColor(aColor[0],aColor[1],aColor[2]); + } + else { + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + if ( aResMgr ) { + // Create material model + Material_Model material; + // Get material name from resources + QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" ); + material.fromResources( mname ); + // Set material properties for the object + aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() ); + // Set material for the selected shape + std::vector aProps; + aProps.push_back( material.getMaterialVTKProperty() ); + aGeomGActor->SetMaterial(aProps); + } + } } + if ( aGeomGActor ) + { + if ( HasWidth() ) + aGeomGActor->SetWidth( GetWidth() ); + if ( HasIsosWidth() ) + aGeomGActor->SetIsosWidth( GetIsosWidth() ); + } + if ( myToActivate ) GActor->PickableOn(); else @@ -895,7 +1283,7 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) return 0; internalReset(); - setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) ); + setShape( GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), theObj ) ); myType = theObj->GetType(); // Update presentation @@ -938,7 +1326,7 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape ) */ //================================================================= SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, - SALOME_View* theViewFrame ) + SALOME_View* theViewFrame ) { SALOME_Prs* prs = 0; internalReset(); @@ -954,35 +1342,35 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, theIO->setEntry( entry.toLatin1().constData() ); if ( !theIO.IsNull() ) { - // set interactive object - setIO( theIO ); - // Find SOBject (because shape should be published previously) - SUIT_Session* session = SUIT_Session::session(); - SUIT_Application* app = session->activeApplication(); - if ( app ) - { - SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); - if ( study ) - { - _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) ); - if ( SO ) - { - // get CORBA reference to data object - CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); - if ( !CORBA::is_nil( object ) ) - { - // downcast to GEOM object - GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object ); - if ( !GeomObject->_is_nil() ) - { - // finally set shape - setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) ); - myType = GeomObject->GetType(); - } - } - } - } - } + // set interactive object + setIO( theIO ); + // Find SOBject (because shape should be published previously) + SUIT_Session* session = SUIT_Session::session(); + SUIT_Application* app = session->activeApplication(); + if ( app ) + { + SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); + if ( study ) + { + _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) ); + if ( SO ) + { + // get CORBA reference to data object + CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); + if ( !CORBA::is_nil( object ) ) + { + // downcast to GEOM object + GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object ); + if ( !GeomObject->_is_nil() ) + { + // finally set shape + setShape( GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) ); + myType = GeomObject->GetType(); + } + } + } + } + } } UpdatePrs( prs ); // Update presentation by using of the double dispatch } @@ -990,6 +1378,44 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, return prs; } +//================================================================= +/*! + * GEOM_Displayer::buildSubshapePresentation + * Builds/finds object's presentation for the current viewer + * Calls corresponding Update() method by means of double dispatch + * For not published objects (for Mantis issue 0020435) + */ +//================================================================= +SALOME_Prs* GEOM_Displayer::buildSubshapePresentation(const TopoDS_Shape& aShape, + const QString& entry, + SALOME_View* theViewFrame) +{ + SALOME_Prs* prs = 0; + internalReset(); + + myViewFrame = theViewFrame ? theViewFrame : GetActiveView(); + + if (myViewFrame) + { + prs = LightApp_Displayer::buildPresentation(entry, theViewFrame); + if (prs) + { + Handle(SALOME_InteractiveObject) theIO = new SALOME_InteractiveObject(); + theIO->setEntry(entry.toLatin1().constData()); + if (!theIO.IsNull()) + { + // set interactive object + setIO(theIO); + // finally set shape + setShape(aShape); + myType = GEOM_SUBSHAPE; + } + UpdatePrs(prs); // Update presentation by using of the double dispatch + } + } + return prs; +} + //================================================================= /*! * GEOM_Displayer::internalReset @@ -1054,7 +1480,7 @@ void GEOM_Displayer::GlobalSelection( const int theMode, const bool update ) */ //================================================================= void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, - const bool update, const QList* theSubShapes ) + const bool update, const QList* theSubShapes ) { SUIT_Session* session = SUIT_Session::session(); SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); @@ -1088,7 +1514,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, { ic = viewer->getAISContext(); if ( !ic.IsNull() ) - ic->RemoveFilters(); + ic->RemoveFilters(); } if ( theModes.Contains( GEOM_ALLOBJECTS ) ) @@ -1098,10 +1524,10 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, if ( theModes.Extent() == 1 ) { int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key(); - + if ( aMode == GEOM_COMPOUNDFILTER ) aFilter = getComplexFilter( theSubShapes ); - else + else aFilter = getFilter( aMode ); } else if ( theModes.Extent() > 1 ) @@ -1110,17 +1536,17 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, TColStd_MapIteratorOfMapOfInteger anIter( theModes ); QList aListOfFilters; for ( ; anIter.More(); anIter.Next() ) - { + { SUIT_SelectionFilter* aFilter; int aMode = anIter.Key(); if ( aMode == GEOM_COMPOUNDFILTER ) aFilter = getComplexFilter( theSubShapes ); - else + else aFilter = getFilter( aMode ); - if ( aFilter ) - aListOfFilters.append( aFilter ); - } + if ( aFilter ) + aListOfFilters.append( aFilter ); + } aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR ); } @@ -1131,10 +1557,10 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, { sm->installFilter( aFilter ); if ( !ic.IsNull() ) - { - Handle(GEOM_OCCFilter) anOCCFilter = new GEOM_OCCFilter( sm ); - ic->AddFilter( anOCCFilter ); - } + { + Handle(GEOM_OCCFilter) anOCCFilter = new GEOM_OCCFilter( sm ); + ic->AddFilter( anOCCFilter ); + } } } @@ -1159,7 +1585,7 @@ void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int t * [ Reimplemented from SALOME_Displayer ] */ //================================================================= -void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCViewType& ) +void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* ) { SOCC_Viewer* vf = dynamic_cast( v ); if ( vf ) @@ -1173,11 +1599,34 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCViewType& ) } } -void GEOM_Displayer::AfterDisplay( SALOME_View*, const SALOME_OCCViewType& ) +void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p ) { + SalomeApp_Study* aStudy = getStudy(); + if (!aStudy) return; + SOCC_Viewer* vf = dynamic_cast( v ); + if ( vf && !p->IsNull() ) { + int aMgrId = getViewManagerId( vf ); + Handle(AIS_InteractiveContext) ic = vf->getAISContext(); + const SOCC_Prs* prs = dynamic_cast( p ); + if ( !ic.IsNull() && prs ) { + AIS_ListOfInteractive objects; + prs->GetObjects( objects ); + AIS_ListIteratorOfListOfInteractive it( objects ); + for ( ; it.More(); it.Next() ) { + Handle(GEOM_AISShape) sh = Handle(GEOM_AISShape)::DownCast( it.Value() ); + if ( sh.IsNull() ) continue; + Handle(SALOME_InteractiveObject) IO = sh->getIO(); + if ( IO.IsNull() ) continue; + PropMap aPropMap = aStudy->getObjectPropMap( aMgrId, IO->getEntry() ); + if ( aPropMap.contains( TRANSPARENCY_PROP ) ) { + double transparency = aPropMap.value(TRANSPARENCY_PROP).toDouble(); + ic->SetTransparency( sh, transparency, true ); + } + } + } + } } - //================================================================= /*! * GEOM_Displayer::SetColor @@ -1209,12 +1658,37 @@ bool GEOM_Displayer::HasColor() const void GEOM_Displayer::UnsetColor() { myColor = -1; - + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); QColor col = resMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); myShadingColor = SalomeApp_Tools::color( col ); } +//================================================================= +/*! + * GEOM_Displayer::SetTexture + * Set color for shape displaying. If it is equal -1 then default color is used. + * Available values are from Quantity_NameOfColor enumeration + */ +//================================================================= +void GEOM_Displayer::SetTexture( const std::string& texureFileName ) +{ + if(texureFileName!="") + { + myTexture = texureFileName; + } +} + +bool GEOM_Displayer::HasTexture() const +{ + return myTexture != ""; +} + +std::string GEOM_Displayer::GetTexture() const +{ + return myTexture; +} + //================================================================= /*! * GEOM_Displayer::SetWidth @@ -1241,6 +1715,23 @@ void GEOM_Displayer::UnsetWidth() myWidth = -1; } + +int GEOM_Displayer::GetIsosWidth() const +{ + return myIsosWidth; +} + +void GEOM_Displayer::SetIsosWidth(const int width) +{ + myIsosWidth = width; +} + +bool GEOM_Displayer::HasIsosWidth() const +{ + return myIsosWidth != -1; +} + + //================================================================= /*! * GEOM_Displayer::SetToActivate @@ -1301,9 +1792,9 @@ void GEOM_Displayer::setShape( const TopoDS_Shape& theShape ) myShape = theShape; } -bool GEOM_Displayer::canBeDisplayed( const QString& /*entry*/, const QString& viewer_type ) const +bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const { - return viewer_type==SOCC_Viewer::Type() || viewer_type==SVTK_Viewer::Type(); + return viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type(); } int GEOM_Displayer::SetDisplayMode( const int theMode ) @@ -1346,14 +1837,14 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList& th { aTolerance /= 2; if( aTolerance < 1 ) - break; + break; } - //cout << "Iteration N" << anIterations << " (tolerance=" << aTolerance << ")"<< endl; + //std::cout << "Iteration N" << anIterations << " (tolerance=" << aTolerance << ")"<< std::endl; aHue = (int)( 360.0 * rand() / RAND_MAX ); - //cout << "Hue = " << aHue << endl; + //std::cout << "Hue = " << aHue << std::endl; - //cout << "Auto colors : "; + //std::cout << "Auto colors : "; bool ok = true; QList::const_iterator it = theReservedColors.constBegin(); QList::const_iterator itEnd = theReservedColors.constEnd(); @@ -1364,21 +1855,21 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList& th int h, s, v; aQColor.getHsv( &h, &s, &v ); - //cout << h << " "; + //std::cout << h << " "; if( abs( h - aHue ) < aTolerance ) { - ok = false; - //cout << "break (diff = " << abs( h - aHue ) << ")"; - break; + ok = false; + //std::cout << "break (diff = " << abs( h - aHue ) << ")"; + break; } } - //cout << endl; + //std::cout << std::endl; if( ok ) break; } - //cout << "Hue of the returned color = " << aHue << endl; + //std::cout << "Hue of the returned color = " << aHue << std::endl; QColor aColor; aColor.setHsv( aHue, 255, 255 ); @@ -1389,3 +1880,226 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList& th return aSColor; } + + + +PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) { + PropMap aDefaultMap; + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + //1. Visibility + aDefaultMap.insert(VISIBILITY_PROP , 1); + + //2. Nb Isos + int anUIsoNumber; + int aVIsoNumber; + if(viewer_type == SOCC_Viewer::Type()) { + anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1); + aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1); + } else if( viewer_type==SVTK_Viewer::Type()) { + anUIsoNumber = aResMgr->integerValue("VTKViewer", "iso_number_u", 1); + aVIsoNumber = aResMgr->integerValue("VTKViewer", "iso_number_u", 1); + } + QString anIsos("%1%2%3"); + anIsos = anIsos.arg(anUIsoNumber);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(aVIsoNumber); + aDefaultMap.insert(ISOS_PROP , anIsos); + + //3. Transparency + aDefaultMap.insert( TRANSPARENCY_PROP , 0.0 ); + + //4. Display Mode + aDefaultMap.insert( DISPLAY_MODE_PROP , aResMgr->integerValue("Geometry", "display_mode", 0)); + + //5. Vector Mode + aDefaultMap.insert( VECTOR_MODE_PROP , 0); + + //6. Color + QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); + aDefaultMap.insert( COLOR_PROP , col); + + //7. Deflection Coeff + double aDC; + + if(viewer_type == SOCC_Viewer::Type()) { + aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001); + } else if( viewer_type==SVTK_Viewer::Type()) { + aDC = 0.001; + } + + aDefaultMap.insert( DEFLECTION_COEFF_PROP , aDC); + + //8. Material + Material_Model material; + QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" ); + material.fromResources( mname ); + aDefaultMap.insert( MATERIAL_PROP, material.toProperties() ); + + //9. Width of the edges + aDefaultMap.insert( EDGE_WIDTH_PROP , aResMgr->integerValue("Geometry", "edge_width", 1)); + + + //10. Width of iso-lines + aDefaultMap.insert( ISOS_WIDTH_PROP , aResMgr->integerValue("Geometry", "isolines_width", 1)); + + if(viewer_type == SOCC_Viewer::Type()) { + + aDefaultMap.insert(TOP_LEVEL_PROP, Standard_False); + } + + return aDefaultMap; +} + +bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault) { + int nbInserted = 0; + if(!theOrigin.contains(VISIBILITY_PROP)) { + theOrigin.insert(VISIBILITY_PROP, 0); + nbInserted++; + } + if(!theOrigin.contains(TRANSPARENCY_PROP)) { + theOrigin.insert(TRANSPARENCY_PROP, theDefault.value(TRANSPARENCY_PROP)); + nbInserted++; + } + if(!theOrigin.contains(DISPLAY_MODE_PROP)) { + theOrigin.insert(DISPLAY_MODE_PROP, theDefault.value(DISPLAY_MODE_PROP)); + nbInserted++; + } + if(!theOrigin.contains(ISOS_PROP)) { + theOrigin.insert(ISOS_PROP, theDefault.value(ISOS_PROP)); + nbInserted++; + } + if(!theOrigin.contains(VECTOR_MODE_PROP)) { + theOrigin.insert(VECTOR_MODE_PROP, theDefault.value(VECTOR_MODE_PROP)); + nbInserted++; + } + if(!theOrigin.contains(DEFLECTION_COEFF_PROP)) { + theOrigin.insert(DEFLECTION_COEFF_PROP, theDefault.value(DEFLECTION_COEFF_PROP)); + nbInserted++; + } + if(!theOrigin.contains(MATERIAL_PROP)) { + theOrigin.insert(MATERIAL_PROP, theDefault.value(MATERIAL_PROP)); + nbInserted++; + } + + if(!theOrigin.contains(EDGE_WIDTH_PROP)) { + theOrigin.insert(EDGE_WIDTH_PROP, theDefault.value(EDGE_WIDTH_PROP)); + nbInserted++; + } + + if(!theOrigin.contains(ISOS_WIDTH_PROP)) { + theOrigin.insert(ISOS_WIDTH_PROP, theDefault.value(ISOS_WIDTH_PROP)); + nbInserted++; + } + + if(!theOrigin.contains(COLOR_PROP)) { + theOrigin.insert(COLOR_PROP, theDefault.value(COLOR_PROP)); + nbInserted++; + } + + return (nbInserted > 0); +} + + +SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bool& hasColor) { + SALOMEDS::Color aSColor; + hasColor = false; + + SUIT_Session* session = SUIT_Session::session(); + SUIT_Application* app = session->activeApplication(); + + if ( app && !theGeomObject->_is_nil()) { + SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); + + if ( study ) { + aSColor = theGeomObject->GetColor(); + hasColor = aSColor.R >= 0 && aSColor.G >= 0 && aSColor.B >= 0; + if( !hasColor && theGeomObject->GetType() == GEOM_GROUP ) { // auto color for group + GEOM::GEOM_Gen_var theGeomGen = GeometryGUI::GetGeomGen(); + GEOM::GEOM_IGroupOperations_var anOperations = theGeomGen->GetIGroupOperations( study->id() ); + GEOM::GEOM_Object_var aMainObject = anOperations->GetMainShape( theGeomObject ); + if ( !aMainObject->_is_nil() && aMainObject->GetAutoColor() ) + { + QList aReservedColors; + + SalomeApp_Application* app = dynamic_cast( app ); + CORBA::String_var IOR = app->orb()->object_to_string( aMainObject ); + if ( strcmp(IOR.in(), "") != 0 ) + { + _PTR(Study) aStudy = study->studyDS(); + _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( std::string(IOR) ) ); + _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); + for( ; it->More(); it->Next() ) + { + _PTR(SObject) aChildSObject( it->Value() ); + GEOM::GEOM_Object_var aChildObject = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject)); + if( CORBA::is_nil( aChildObject ) ) + continue; + + if( aChildObject->GetType() != GEOM_GROUP ) + continue; + + SALOMEDS::Color aReservedColor = aChildObject->GetColor(); + aReservedColors.append( aReservedColor ); + } + } + + aSColor = getUniqueColor( aReservedColors ); + hasColor = true; + } + } + } + } + return aSColor; +} + + +void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO, + const bool eraseOnlyChildren) { + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return; + + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if ( !appStudy ) + return; + + LightApp_DataObject* parent = appStudy->findObjectByEntry(theIO->getEntry()); + + if( !parent) + return; + + // Erase from all views + QList views; + SALOME_View* view; + ViewManagerList vmans = app->viewManagers(); + SUIT_ViewManager* vman; + foreach ( vman, vmans ) { + SUIT_ViewModel* vmod = vman->getViewModel(); + view = dynamic_cast ( vmod ); + if ( view ) + views.append( view ); + } + + if( views.count() == 0 ) + return; + + //Erase childrens w/o update views + DataObjectList listObj = parent->children( true ); + SUIT_DataObject* obj; + foreach( obj, listObj ) { + LightApp_DataObject* l_obj = dynamic_cast(obj); + if(l_obj) + foreach ( view, views ) { + Handle(SALOME_InteractiveObject) anIO = + new SALOME_InteractiveObject(qPrintable(l_obj->entry()), "GEOM", ""); + Erase(anIO, false, false, view); + } + } + + //Erase parent with view update or repaint views + foreach ( view, views ) { + if(!eraseOnlyChildren) + Erase(theIO, false, true, view); + else + view->Repaint(); + } +} diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 90b551fc3..07305f66b 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOM_Displayer.h // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) @@ -40,6 +41,7 @@ class SALOME_OCCViewType; #include #include #include +#include #include #include @@ -77,12 +79,12 @@ public: /* Display/Erase object methods */ void Display ( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer = true, - SALOME_View* theViewFrame = 0 ); + SALOME_View* theViewFrame = 0 ); // This overloaded Display() method can be useful for operations // not using dialog boxes. void Display ( GEOM::GEOM_Object_ptr theObj, - const bool updateViewer = true ); + const bool updateViewer = true ); void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer = true ); @@ -90,12 +92,15 @@ public: void Erase ( const Handle(SALOME_InteractiveObject)& theIO, const bool forced = false, const bool updateViewer = true, - SALOME_View* theViewFrame = 0 ); + SALOME_View* theViewFrame = 0 ); void Erase ( GEOM::GEOM_Object_ptr theObj, const bool forced = false, const bool updateViewer = true ); + void EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO, + const bool eraseOnlyChildren = false); + /* Display/Erase list of objects methods */ void Display ( const SALOME_ListIO& theIOList, @@ -118,12 +123,22 @@ public: void UnsetColor(); int GetColor () const; bool HasColor () const; + + /* Set texture for shape displaying. */ + void SetTexture ( const std::string& ); + bool HasTexture () const; + std::string GetTexture () const; /* Set width for shape displaying. If it is equal -1 then default width is used. */ void SetWidth ( const double ); void UnsetWidth(); double GetWidth () const; bool HasWidth () const; + + /* Set width for iso-lines displaying. If it is equal -1 then default width is used. */ + void SetIsosWidth ( const int ); + int GetIsosWidth () const; + bool HasIsosWidth () const; /* Set display mode shape displaying. If it is equal -1 then display mode is used. */ int SetDisplayMode( const int ); @@ -138,8 +153,8 @@ public: /* Reimplemented from SALOME_Displayer */ virtual void Update( SALOME_OCCPrs* ); virtual void Update( SALOME_VTKPrs* ); - virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ); - virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ); + virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ); + virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ); /* This methos is used for activisation/deactivisation of objects to be displayed*/ void SetToActivate( const bool ); @@ -155,9 +170,28 @@ public: static SALOMEDS::Color getUniqueColor( const QList& ); + static PropMap getDefaultPropertyMap(const QString& viewer_type); + + static bool MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault); + + /*Get color of the geom object*/ + static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject, bool& hasColor); + + /* Get minimum or maximum enclosed shape type */ + static int getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin ); + + /* Check if the object is a vertex or a compound of vertices */ + static bool isCompoundOfVertices( const TopoDS_Shape& theShape ); + + + /* Builds presentation of not published object */ + virtual SALOME_Prs* buildSubshapePresentation(const TopoDS_Shape& aShape, + const QString&, + SALOME_View* = 0); + protected: /* internal methods */ - /* Builds presentation accordint to the current viewer type */ + /* Builds presentation according to the current viewer type */ virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); /* Sets interactive object */ @@ -178,6 +212,7 @@ protected: Handle(SALOME_InteractiveObject) myIO; TopoDS_Shape myShape; std::string myName; + std::string myTexture; int myType; SALOME_View* myViewFrame; @@ -185,6 +220,7 @@ protected: Quantity_Color myShadingColor; int myColor; double myWidth; + int myIsosWidth; bool myToActivate; int myDisplayMode; Aspect_TypeOfMarker myTypeOfMarker; diff --git a/src/GEOMGUI/GEOM_GEOMGUI.hxx b/src/GEOMGUI/GEOM_GEOMGUI.hxx index 525dde08d..4017f21be 100755 --- a/src/GEOMGUI/GEOM_GEOMGUI.hxx +++ b/src/GEOMGUI/GEOM_GEOMGUI.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_GEOMGUI.hxx // Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) // @@ -26,7 +27,7 @@ #define GEOM_GEOMGUI_HXX #if defined WIN32 -# if defined GEOMGUI_EXPORTS +# if defined GEOMGUI_EXPORTS || defined GEOM_EXPORTS # define GEOMGUI_EXPORT __declspec( dllexport ) # else # define GEOMGUI_EXPORT __declspec( dllimport ) diff --git a/src/GEOMGUI/GEOM_images.po b/src/GEOMGUI/GEOM_images.po deleted file mode 100644 index 275247377..000000000 --- a/src/GEOMGUI/GEOM_images.po +++ /dev/null @@ -1,830 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. translating -# from French to English, "Foo::Bar" would be translated to "Pub", -# not "Foo::Pub". -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2001-06-14 09:11:49 PM CEST\n" -"PO-Revision-Date: 2003-09-22 16:39+0200\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -#Select -msgid "ICON_SELECT" -msgstr "select1.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_Geometry" -msgstr "geometry.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_COMPOUND" -msgstr "tree_compound.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_COMPSOLID" -msgstr "tree_compsolid.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_EDGE" -msgstr "tree_edge.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_FACE" -msgstr "tree_face.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_SHAPE" -msgstr "tree_shape.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_SHELL" -msgstr "tree_shell.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_SOLID" -msgstr "tree_solid.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_VERTEX" -msgstr "tree_vertex.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_WIRE" -msgstr "tree_wire.png" - -#: QAD_ObjectBrowser.cxx:140 -msgid "ICON_OBJBROWSER_BLOCK" -msgstr "tree_block.png" - -#BoxDlg -msgid "ICON_DLG_BOX_2P" -msgstr "box2points.png" - -#BoxDlg -msgid "ICON_DLG_BOX_DXYZ" -msgstr "boxdxyz.png" - -#CylinderDlg -msgid "ICON_DLG_CYLINDER_PV" -msgstr "cylinderpointvector.png" - -#CylinderDlg -msgid "ICON_DLG_CYLINDER_DXYZ" -msgstr "cylinderdxyz.png" - -#SphereDlg -msgid "ICON_DLG_SPHERE_P" -msgstr "spherepoint.png" - -#SphereDlg -msgid "ICON_DLG_SPHERE_DXYZ" -msgstr "spheredxyz.png" - -#torusDlg -msgid "ICON_DLG_TORUS_PV" -msgstr "toruspointvector.png" - -#ConeDlg -msgid "ICON_DLG_CONE_PV" -msgstr "conepointvector.png" - -#torusDlg -msgid "ICON_DLG_TORUS_DXYZ" -msgstr "torusdxyz.png" - -#ConeDlg -msgid "ICON_DLG_CONE_DXYZ" -msgstr "conedxyz.png" - -#LineDlg -msgid "ICON_DLG_LINE_2P" -msgstr "line2points.png" - -#LineDlg -msgid "ICON_DLG_LINE_2F" -msgstr "line2faces.png" - -#LineDlg -msgid "ICON_DLG_LINE_EDGE" -msgstr "lineedge.png" - -#LineDlg -msgid "ICON_DLG_LINE_PV" -msgstr "linepointvector.png" - -#CircleDlg -msgid "ICON_DLG_CIRCLE_PV" -msgstr "circlepointvector.png" - -#CircleDlg -msgid "ICON_DLG_CIRCLE_C2P" -msgstr "circlecenter2pnts.png" - -#VectorDlg -msgid "ICON_DLG_VECTOR_2P" -msgstr "vector2points.png" - -#vectorDlg -msgid "ICON_DLG_VECTOR_DXYZ" -msgstr "vectordxyz.png" - -#PlaneDlg -msgid "ICON_DLG_PLANE_DXYZ" -msgstr "planedxyz.png" - -#PlaneDlg -msgid "ICON_DLG_PLANE_FACE" -msgstr "planeface.png" - -#PlaneDlg -msgid "ICON_DLG_PLANE_PV" -msgstr "planepointvector.png" - -#WorkingPlaneDlg -msgid "ICON_DLG_WPLANE_FACE" -msgstr "planeworkingface.png" - -#WorkingPlaneDlg -msgid "ICON_DLG_WPLANE_VECTOR" -msgstr "planeworkingvector.png" - -#WorkingPlaneDlg -msgid "ICON_DLG_WPLANE_ORIGIN" -msgstr "planeworkingorigin.png" - -#PointDlg -msgid "ICON_DLG_POINT" -msgstr "point2.png" - -#PointDlg -msgid "ICON_DLG_POINT_REF" -msgstr "point3.png" - -#PoinDlg -msgid "ICON_DLG_POINT_EDGE" -msgstr "pointonedge.png" - -#PoinDlg -msgid "ICON_DLG_POINT_LINES" -msgstr "point_line_intersection.png" - -#ArcDlg -msgid "ICON_DLG_ARC" -msgstr "arc.png" - -#ArcDlg -msgid "ICON_DLG_ARC_CENTER" -msgstr "arccenter.png" - -#ArchimedeDlg -msgid "ICON_DLG_ARCHIMEDE" -msgstr "archimede.png" - -#PartitionDlg -msgid "ICON_DLG_PARTITION" -msgstr "partition.png" - -#PartitionDlg -msgid "ICON_DLG_PARTITION_KEEP_FACES" -msgstr "partitionkeep.png" - -#PartitionDlg -msgid "ICON_DLG_PARTITION_PLANE" -msgstr "partitionplane.png" - -#CenterMassDlg -msgid "ICON_DLG_CENTERMASS" -msgstr "centergravity.png" - -#NormaleDlg -msgid "ICON_DLG_NORMALE" -msgstr "normale.png" - -#BoundingBoxDlg -msgid "ICON_DLG_BOUNDING_BOX" -msgstr "bounding.png" - -#CommonDlg -msgid "ICON_DLG_COMMON" -msgstr "common.png" - -#CompoundDlg -msgid "ICON_DLG_BUILD_COMPOUND" -msgstr "build_compound.png" - -#CutDlg -msgid "ICON_DLG_CUT" -msgstr "cut.png" - -#EdgeDlg -msgid "ICON_DLG_BUILD_EDGE" -msgstr "build_edge.png" - -#FaceDlg -msgid "ICON_DLG_BUILD_FACE" -msgstr "build_face.png" - -#ShellDlg -msgid "ICON_DLG_BUILD_SHELL" -msgstr "build_shell.png" - -#SolidDlg -msgid "ICON_DLG_BUILD_SOLID" -msgstr "build_solid.png" - -#WireDlg -msgid "ICON_DLG_BUILD_WIRE" -msgstr "build_wire.png" - -#FillingDlg -msgid "ICON_DLG_FILLING" -msgstr "filling.png" - -#FuseDlg -msgid "ICON_DLG_FUSE" -msgstr "fuse.png" - -#InertiaDlg -msgid "ICON_DLG_INERTIA" -msgstr "axisinertia.png" - -#ToleranceDlg -msgid "ICON_DLG_TOLERANCE" -msgstr "tolerance.png" - -#BasicPropertiesDlg -msgid "ICON_DLG_BASICPROPERTIES" -msgstr "basicproperties.png" - -#WhatisDlg -msgid "ICON_DLG_WHATIS" -msgstr "whatis.png" - -#MinDistDlg -msgid "ICON_DLG_MINDIST" -msgstr "mindist.png" - -#AngleDlg -msgid "ICON_DLG_ANGLE" -msgstr "angle.png" - -#MirrorDlg (MZN: add icons for point and axe) -msgid "ICON_DLG_MIRROR_POINT" -msgstr "mirrorPoint.png" - -msgid "ICON_DLG_MIRROR_AXE" -msgstr "mirrorAxe.png" - -msgid "ICON_DLG_MIRROR_PLANE" -msgstr "mirrorPlane.png" - -#TranslationDlg -msgid "ICON_DLG_TRANSLATION_DXYZ" -msgstr "translationDxyz.png" - -#TranslationDlg -msgid "ICON_DLG_TRANSLATION_POINTS" -msgstr "translationPoints.png" - -#TranslationDlg -msgid "ICON_DLG_TRANSLATION_VECTOR" -msgstr "translationVector.png" - -#RotationDlg -msgid "ICON_DLG_ROTATION" -msgstr "rotate.png" - -#RotationDlg -msgid "ICON_DLG_ROTATION_THREE_POINTS" -msgstr "rotatepnt.png" - -#ScaleDlg -msgid "ICON_DLG_SCALE" -msgstr "scale.png" - -#OffsetDlg -msgid "ICON_DLG_OFFSET" -msgstr "offset.png" - -#OrientationDlg -msgid "ICON_DLG_DIVIDE_EDGE" -msgstr "pointonedge.png" - -#SewingDlg -msgid "ICON_DLG_SEWING" -msgstr "sewing.png" - -#ChangeOrientationDlg -msgid "ICON_DLG_CHANGE_ORIENTATION" -msgstr "change_orientation.png" - -#ChangeOrientationDlg -msgid "ICON_DLG_REMOVE_EXTRA_EDGES" -msgstr "remove_extra_edges.png" - -#PipeDlg -msgid "ICON_DLG_PIPE" -msgstr "pipe.png" - -#PrismDlg -msgid "ICON_DLG_PRISM" -msgstr "prism.png" - -msgid "ICON_DLG_PRISM_2P" -msgstr "prism2.png" - -#RevolutionDlg -msgid "ICON_DLG_REVOL" -msgstr "revol.png" - -#SectionDlg -msgid "ICON_DLG_SECTION" -msgstr "section.png" - -#SubShapeDlg -msgid "ICON_DLG_SUBSHAPE" -msgstr "subshape.png" - -#FilletDlg -msgid "ICON_DLG_FILLET" -msgstr "fillet.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER" -msgstr "chamfer.png" - -#FilletDlg -msgid "ICON_DLG_FILLET_ALL" -msgstr "filletall.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER_ALL" -msgstr "chamferall.png" - -#FilletDlg -msgid "ICON_DLG_FILLET_EDGE" -msgstr "filletedge.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER_EDGE" -msgstr "chamferedge.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER_EDGE_FROM_FACE" -msgstr "chamferedgefromface.png" - - -#FilletDlg -msgid "ICON_DLG_FILLET_FACE" -msgstr "filletface.png" - -#ChamferDlg -msgid "ICON_DLG_CHAMFER_FACE" -msgstr "chamferface.png" - -#ChamferDlg -msgid "ICON_DLG_CHECKSHAPE" -msgstr "check.png" - -msgid "ICON_DLG_CHECK_COMPOUND_OF_BLOCKS" -msgstr "check_blocks_compound.png" - -#SupressFaceDlg -msgid "ICON_DLG_SUPRESS_FACE" -msgstr "supressface.png" - -msgid "ICON_DLG_CLOSECONTOUR" -msgstr "closecontour.png" - -#SupressHoleDlg -msgid "ICON_DLG_SUPRESS_HOLE" -msgstr "supresshole.png" - -#SupressHoleDlg -msgid "ICON_DLG_SUPRESS_HOLE_FACE_SHELL" -msgstr "supressHolesOnFaceShell.png" - -#MultiTranslationDlg -msgid "ICON_DLG_MULTITRANSLATION_SIMPLE" -msgstr "multitranslationsimple.png" - -#MultiTranslationDlg -msgid "ICON_DLG_MULTITRANSLATION" -msgstr "multitranslation.png" - -#MultiTranslationDlg -msgid "ICON_DLG_MULTITRANSLATION_DOUBLE" -msgstr "multitranslationdouble.png" - -#MultiRotationDlg -msgid "ICON_DLG_MULTIROTATION_SIMPLE" -msgstr "multirotationsimple.png" - -#MultiRotationDlg -msgid "ICON_DLG_MULTIROTATION" -msgstr "multirotation.png" - -#MultiRotationDlg -msgid "ICON_DLG_MULTIROTATION_DOUBLE" -msgstr "multirotationdouble.png" - -#EllipseDlg -msgid "ICON_DLG_ELLIPSE_PV" -msgstr "ellipsepointvector.png" - -#SplineDlg -msgid "ICON_DLG_SPLINE" -msgstr "spline.png" - -#SplineDlg -msgid "ICON_DLG_BEZIER" -msgstr "bezier.png" - -#SplineDlg -msgid "ICON_DLG_INTERPOL" -msgstr "interpol.png" - -msgid "ICON_DLG_CIRCLE_PNTS" -msgstr "circle3points.png" - -msgid "ICON_DLG_PLANE_3PNTS" -msgstr "plane3points.png" - -msgid "ICON_DLG_POLYLINE" -msgstr "polyline.png" - -msgid "ICON_DLG_SUPPRESS_INT_WIRES" -msgstr "suppressintwires.png" - -msgid "ICON_DLG_ADD_POINT_ON_EDGE" -msgstr "pointonedge.png" - -msgid "ICON_DLG_SUPPRESS_HOLES" -msgstr "supressHolesOnFaceShell.png" - -msgid "ICON_MARKER" -msgstr "marker.png" - -msgid "ICON_MARKER2" -msgstr "marker2.png" - -msgid "ICON_MARKER3" -msgstr "marker3.png" - -msgid "ICON_DLG_POSITION" -msgstr "position.png" - -msgid "ICON_DLG_POSITION2" -msgstr "position2.png" - -msgid "ICON_DLG_UNDO" -msgstr "undo.png" - -msgid "ICON_DLG_REDO" -msgstr "redo.png" - -msgid "ICON_OBJBROWSER_GROUP_PNT" -msgstr "tree_group_vertex.png" - -msgid "ICON_OBJBROWSER_GROUP_EDGE" -msgstr "tree_group_edge.png" - -msgid "ICON_OBJBROWSER_GROUP_FACE" -msgstr "tree_group_face.png" - -msgid "ICON_OBJBROWSER_GROUP_SOLID" -msgstr "tree_group_solid.png" - -msgid "ICON_OBJBROWSER_LCS" -msgstr "tree_lcs.png" - -msgid "ICON_DLG_SHAPEPROCESS" -msgstr "shapeprocess.png" - -#BlocksGUI_BlockDlg -msgid "ICON_DLG_BLOCK_2F" -msgstr "block_2f.png" - -msgid "ICON_DLG_BLOCK_6F" -msgstr "block_6f.png" - -#BlocksGUI_ExplodeDlg -msgid "ICON_DLG_BLOCK_EXPLODE" -msgstr "subblock.png" - -#BlocksGUI_TrsfDlg -msgid "ICON_DLG_BLOCK_MULTITRSF_SIMPLE" -msgstr "block_multitrsf_simple.png" - -msgid "ICON_DLG_BLOCK_MULTITRSF_DOUBLE" -msgstr "block_multitrsf_double.png" - -#BlocksGUI_QuadFaceDlg -msgid "ICON_DLG_QUAD_FACE_4_VERT" -msgstr "block_face_4v.png" - -msgid "ICON_DLG_QUAD_FACE_2_EDGE" -msgstr "block_face_2e.png" - -msgid "ICON_DLG_QUAD_FACE_4_EDGE" -msgstr "block_face_4e.png" - -msgid "ICON_DLG_GLUE_FACES" -msgstr "glue.png" - -msgid "ICON_DLG_GLUE_FACES2" -msgstr "glue2.png" - -msgid "ICON_DLG_FREE_FACES" -msgstr "free_faces.png" - -msgid "ICON_DLG_PROPAGATE" -msgstr "propagate.png" - -msgid "ICO_DELETE" -msgstr "delete.png" - -msgid "ICO_POINT" -msgstr "point2.png" - -msgid "ICO_LINE" -msgstr "line.png" - -msgid "ICO_CIRCLE" -msgstr "circle.png" - -msgid "ICO_ELLIPSE" -msgstr "ellipse.png" - -msgid "ICO_ARC" -msgstr "arc.png" - -msgid "ICO_CURVE" -msgstr "spline.png" - -msgid "ICO_VECTOR" -msgstr "vector.png" - -msgid "ICO_PLANE" -msgstr "plane.png" - -msgid "ICO_WORK_PLANE" -msgstr "planeWorking.png" - -msgid "ICO_LOCAL_CS" -msgstr "marker.png" - -msgid "ICO_BOX" -msgstr "box.png" - -msgid "ICO_CYLINDER" -msgstr "cylinder.png" - -msgid "ICO_SPHERE" -msgstr "sphere.png" - -msgid "ICO_TORUS" -msgstr "torus.png" - -msgid "ICO_CONE" -msgstr "cone.png" - -msgid "ICO_EXTRUSION" -msgstr "prism.png" - -msgid "ICO_REVOLUTION" -msgstr "revol.png" - -msgid "ICO_FILLING" -msgstr "filling.png" - -msgid "ICO_PIPE" -msgstr "pipe.png" - -msgid "ICO_GROUP_CREATE" -msgstr "group_new.png" - -msgid "ICO_GROUP_EDIT" -msgstr "group_edit.png" - -msgid "ICO_Q_FACE" -msgstr "build_face.png" - -msgid "ICO_HEX_SOLID" -msgstr "box.png" - -msgid "ICO_SKETCH" -msgstr "sketch.png" - -msgid "ICO_EXPLODE" -msgstr "subshape.png" - -msgid "ICO_EDGE" -msgstr "build_edge.png" - -msgid "ICO_WIRE" -msgstr "build_wire.png" - -msgid "ICO_FACE" -msgstr "build_face.png" - -msgid "ICO_SHELL" -msgstr "build_shell.png" - -msgid "ICO_SOLID" -msgstr "build_solid.png" - -msgid "ICO_COMPOUND" -msgstr "build_compound.png" - -msgid "ICO_FUSE" -msgstr "fuse.png" - -msgid "ICO_COMMON" -msgstr "common.png" - -msgid "ICO_CUT" -msgstr "cut.png" - -msgid "ICO_SECTION" -msgstr "section.png" - -msgid "ICO_TRANSLATION" -msgstr "translationVector.png" - -msgid "ICO_ROTATION" -msgstr "rotate.png" - -msgid "ICO_MODIFY_LOCATION" -msgstr "position2.png" - -msgid "ICO_MIRROR" -msgstr "mirrorPlane.png" - -msgid "ICO_SCALE" -msgstr "scale.png" - -msgid "ICO_OFFSET" -msgstr "offset.png" - -msgid "ICO_MUL_TRANSLATION" -msgstr "multitranslation.png" - -msgid "ICO_MUL_ROTATION" -msgstr "multirotation.png" - -msgid "ICO_PARTITION" -msgstr "partition.png" - -msgid "ICO_ARCHIMEDE" -msgstr "archimede.png" - -msgid "ICO_FILLET" -msgstr "fillet.png" - -msgid "ICO_CHAMFER" -msgstr "chamfer.png" - -msgid "ICO_MUL_TRANSFORM" -msgstr "multirotation.png" - -msgid "ICO_EXPLODE_BLOCKS" -msgstr "subshape.png" - -msgid "ICO_PROPAGATE" -msgstr "propagate.png" - -msgid "ICO_SEWING" -msgstr "sewing.png" - -msgid "ICO_GLUE_FACES" -msgstr "glue.png" - -msgid "ICO_SUPPRESS_FACES" -msgstr "supressface.png" - -msgid "ICO_SUPPERSS_HOLES" -msgstr "supresshole.png" - -msgid "ICO_SHAPE_PROCESS" -msgstr "shapeprocess.png" - -msgid "ICO_CLOSE_CONTOUR" -msgstr "closecontour.png" - -msgid "ICO_SUPPRESS_INT_WIRES" -msgstr "suppressintwires.png" - -msgid "ICO_POINT_ON_EDGE" -msgstr "pointonedge.png" - -msgid "ICO_CHECK_FREE_BNDS" -msgstr "free_bound.png" - -msgid "ICO_CHECK_FREE_FACES" -msgstr "free_faces.png" - -msgid "ICO_CHANGE_ORIENTATION" -msgstr "change_orientation.png" - -msgid "ICO_REMOVE_EXTRA_EDGES" -msgstr "remove_extra_edges.png" - -msgid "ICO_POINT_COORDS" -msgstr "point_coord.png" - -msgid "ICO_BASIC_PROPS" -msgstr "basicproperties.png" - -msgid "ICO_NORMALE" -msgstr "normale.png" - -msgid "ICO_INERTIA" -msgstr "axisinertia.png" - -msgid "ICO_BND_BOX" -msgstr "bounding.png" - -msgid "ICO_MIN_DIST" -msgstr "mindist.png" - -msgid "ICO_MEASURE_ANGLE" -msgstr "angle.png" - -msgid "ICO_TOLERANCE" -msgstr "tolerance.png" - -msgid "ICO_WHAT_IS" -msgstr "whatis.png" - -msgid "ICO_CHECK" -msgstr "check.png" - -msgid "ICO_CHECK_COMPOUND" -msgstr "check_blocks_compound.png" - -msgid "ICO_SHADING" -msgstr "shading.png" - -msgid "ICO_DISPLAY_ALL" -msgstr "displayall.png" - -msgid "ICO_ERASE_ALL" -msgstr "eraseall.png" - -msgid "ICO_DISPLAY" -msgstr "display.png" - -msgid "ICO_DISPLAY_ONLY" -msgstr "displayonly.png" - -msgid "ICO_ERASE" -msgstr "erase.png" - -msgid "ICO_POP_CREATE_GROUP" -msgstr "group_new.png" - -msgid "ICO_VERTEX_SEL_ONLY" -msgstr "point2.png" - -msgid "ICO_EDGE_SEL_ONLY" -msgstr "build_edge.png" - -msgid "ICO_WIRE_SEL_ONLY" -msgstr "build_wire.png" - -msgid "ICO_FACE_SEL_ONLY" -msgstr "build_face.png" - -msgid "ICO_SHELL_SEL_ONLY" -msgstr "build_shell.png" - -msgid "ICO_SOLID_SEL_ONLY" -msgstr "build_solid.png" - -msgid "ICO_COMPOUND_SEL_ONLY" -msgstr "build_compound.png" diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index a4c96d025..d15ade1d2 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1,28 +1,6 @@ + - - + @default @@ -41,7 +19,7 @@ ICON_DLG_ARC_CENTER arccenter.png - + ICON_DLG_ARC_OF_ELLIPSE arcofellipse.png @@ -109,6 +87,14 @@ ICON_DLG_BUILD_EDGE build_edge.png + + ICON_DLG_BUILD_EDGE_WIRE + build_edge_wire.png + + + ICON_DLG_BUILD_EDGE_CURVE + build_edge_curve.png + ICON_DLG_BUILD_FACE build_face.png @@ -161,10 +147,18 @@ ICON_DLG_CHANGE_ORIENTATION change_orientation.png + + ICON_DLG_CHANGE_DIRECTION + change_direction.png + ICON_DLG_REMOVE_EXTRA_EDGES remove_extra_edges.png + + ICON_DLG_FUSE_EDGES + fuse_collinear_edges.png + ICON_DLG_CHECKSHAPE check.png @@ -173,6 +167,10 @@ ICON_DLG_CHECK_COMPOUND_OF_BLOCKS check_blocks_compound.png + + ICON_DLG_CHECK_SELF_INTERSECTIONS + check_self_intersections.png + ICON_DLG_CIRCLE_PNTS circle3points.png @@ -225,6 +223,10 @@ ICON_DLG_FILLET fillet.png + + ICON_DLG_FILLET_1D + fillet1d.png + ICON_DLG_FILLET_2D fillet2d.png @@ -237,6 +239,10 @@ ICON_DLG_FILLET_EDGE filletedge.png + + ICON_DLG_FILLET_WIRE + filletwire.png + ICON_DLG_FILLET_FACE filletface.png @@ -261,6 +267,18 @@ ICON_DLG_GLUE_FACES2 glue2.png + + ICON_DLG_GLUE_EDGES + glue.png + + + ICON_DLG_GLUE_EDGES2 + glue2.png + + + ICON_DLG_LIMIT_TOLERANCE + limit_tolerance.png + ICON_DLG_INERTIA axisinertia.png @@ -269,6 +287,10 @@ ICON_DLG_INTERPOL interpol.png + + ICON_DLG_IMPORT_PICTURE + import_picture.png + ICON_DLG_LINE_2P line2points.png @@ -321,6 +343,10 @@ ICON_DLG_OFFSET offset.png + + ICON_DLG_PROJECTION + projection.png + ICON_DLG_PARTITION partition.png @@ -421,6 +447,10 @@ ICON_DLG_QUAD_FACE_4_VERT block_face_4v.png + + ICON_DLG_RECTANGLE + rectangle.png + ICON_DLG_REDO redo.png @@ -621,6 +651,58 @@ ICON_SELECT select1.png + + ICON_VERTEX_MARKER_1 + marker_1.png + + + ICON_VERTEX_MARKER_2 + marker_2.png + + + ICON_VERTEX_MARKER_3 + marker_3.png + + + ICON_VERTEX_MARKER_4 + marker_4.png + + + ICON_VERTEX_MARKER_5 + marker_5.png + + + ICON_VERTEX_MARKER_6 + marker_6.png + + + ICON_VERTEX_MARKER_7 + marker_7.png + + + ICON_VERTEX_MARKER_8 + marker_8.png + + + ICON_VERTEX_MARKER_9 + marker_9.png + + + ICON_VERTEX_MARKER_10 + marker_10.png + + + ICON_VERTEX_MARKER_11 + marker_11.png + + + ICON_VERTEX_MARKER_12 + marker_12.png + + + ICON_VERTEX_MARKER_13 + marker_13.png + ICO_ARC arc.png @@ -657,6 +739,10 @@ ICO_CHECK_COMPOUND check_blocks_compound.png + + ICO_CHECK_SELF_INTERSECTIONS + check_self_intersections.png + ICO_CHECK_FREE_BNDS free_bound.png @@ -705,7 +791,7 @@ ICO_DELETE delete.png - + ICO_DISK disk.png @@ -721,6 +807,10 @@ ICO_DISPLAY_ONLY displayonly.png + + ICO_DRAFT + draft.png + ICO_EDGE build_edge.png @@ -748,6 +838,14 @@ ICO_EXPLODE_BLOCKS subshape.png + + + ICO_EXTRUDED_BOSS + extruded_boss.png + + + ICO_EXTRUDED_CUT + extruded_cut.png ICO_EXTRUSION @@ -757,14 +855,26 @@ ICO_FACE build_face.png + + ICO_RECTANGLE + build_face.png + ICO_FACE_SEL_ONLY build_face.png + + ICO_FEATURE_DETECTION + feature_detect.png + ICO_FILLET fillet.png + + ICO_FILLET_1D + fillet1d.png + ICO_FILLET_2D fillet2d.png @@ -781,6 +891,14 @@ ICO_GLUE_FACES glue.png + + ICO_GLUE_EDGES + glue.png + + + ICO_LIMIT_TOLERANCE + limit_tolerance.png + ICO_GROUP_CREATE group_new.png @@ -797,7 +915,11 @@ ICO_INERTIA axisinertia.png - + + ICO_PICTURE_IMPORT + import_picture.png + + ICO_LINE line.png @@ -837,6 +959,14 @@ ICO_OFFSET offset.png + + ICO_PROJECTION + projection.png + + + ICO_ORIGIN_AND_VECTORS + origin_and_vectors.png + ICO_PARTITION partition.png @@ -853,6 +983,10 @@ ICO_REMOVE_EXTRA_EDGES remove_extra_edges.png + + ICO_FUSE_EDGES + fuse_collinear_edges.png + ICO_NORMALE normale.png @@ -905,10 +1039,22 @@ ICO_SEWING sewing.png + + ICO_WIREFRAME + wireframe.png + ICO_SHADING shading.png + + ICO_SHADING_WITH_EDGES + shading_with_edges.png + + + ICO_VECTOR_MODE + vector_mode.png + ICO_SHAPE_PROCESS shapeprocess.png @@ -990,9 +1136,13 @@ planeWorking.png - ICO_GET_SHAPES_ON_SHAPES + ICO_GET_SHAPES_ON_SHAPE shapesonshape.png + + ICO_GET_SHARED_SHAPES + shared_shapes.png + ICON_DLG_POINT_FACE pointonface.png @@ -1001,9 +1151,163 @@ ICON_DLG_SHAPES_ON_SHAPE shapesonshape.png + + ICON_DLG_SHARED_SHAPES + shared_shapes.png + 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 + + + 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 + + diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po deleted file mode 100644 index 74caf6b0e..000000000 --- a/src/GEOMGUI/GEOM_msg_en.po +++ /dev/null @@ -1,3226 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. translating -# from French to English, "Foo::Bar" would be translated to "Pub", -# not "Foo::Pub". -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" -"PO-Revision-Date: 2008-03-12 12:26+0300\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -# -#============================================================================== -# - -#Button Apply -msgid "GEOM_BUT_APPLY" -msgstr "&Apply" - -#Button Close -msgid "GEOM_BUT_CLOSE" -msgstr "&Close" - -#Button Cancel -msgid "GEOM_BUT_CANCEL" -msgstr "&Cancel" - -#Button Ok -msgid "GEOM_BUT_OK" -msgstr "O&k" - -#Button Yes -msgid "GEOM_BUT_YES" -msgstr "&Yes" - -#Button No -msgid "GEOM_BUT_NO" -msgstr "&No" - -#Button Help -msgid "GEOM_BUT_HELP" -msgstr "&Help" - -#Button Explode -msgid "GEOM_BUT_EXPLODE" -msgstr "&Explode" - -#NOT_FOUND_ANY error from some operations -msgid "NOT_FOUND_ANY" -msgstr "Not a single entity has been found" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:563 -msgid "GEOM_INF_LOADED" -msgstr "File %1 loaded." - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3069 -msgid "GEOM_PRP_COMMAND" -msgstr "No command associated with this id = %1." - -#: GeometryGUI.cxx:4977 -msgid "GEOM_PRP_ABORT" -msgstr "Operation aborted" - -#: GeometryGUI.cxx:5058 -msgid "GEOM_PRP_DONE" -msgstr "Operation done" - -#: GeometryGUI.cxx:3717 -msgid "GEOM_PRP_LOADING" -msgstr "Loading %1 ..." - -#: GeometryGUI.cxx:1412 -msgid "GEOM_PRP_NULLSHAPE" -msgstr "Error, null or inappropriate shape !" - -#: GeometryGUI.cxx:5072 -msgid "GEOM_PRP_READY" -msgstr "Ready" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_SUBSHAPES" -msgstr "Select Sub Shapes" - -msgid "GEOM_PRP_EXPORT" -msgstr "Exporting geometry to %1 ..." - -msgid "GEOM_CONFIRM" -msgstr "Confirm operation" - -msgid "GEOM_CONFIRM_INFO" -msgstr "Shape contains %1 sub shapes !" - - -msgid "GEOM_PRP_NOT_FOR_VTK_VIEWER" -msgstr "Not allowed in VTK viewer" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SHAPE_IN_STUDY" -msgstr "Main shape must be in the study before" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_EDGE" -msgstr "Select edges and click on Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FACE" -msgstr "Select faces to suppress and click on Ok/Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FIRST" -msgstr "Select main shape first" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_MIN_DIST" -msgstr "Min Distance not computed" - -msgid "GEOM_STUDY_LOCKED" -msgstr "The active study is locked and therefore cannot be modified" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3698 -msgid "GEOM_MEN_ALL_FILES" -msgstr "All Files ( * )" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ANGLE" -msgstr "Angle :" - -#: GeometryGUI.cxx:3941 -msgid "GEOM_MEN_COMPONENT" -msgstr "Geometry" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ENTER_ANGLE" -msgstr "Enter An Angle In Degrees" - -#: GeometryGUI.cxx:3758 -msgid "GEOM_MEN_EXPORT" -msgstr "Export" - -#: GeometryGUI.cxx:3648 -msgid "GEOM_MEN_IMPORT" -msgstr "Import" - -#: GeometryGUI.cxx:2931 -msgid "GEOM_MEN_ISOS" -msgstr "Select Number Of Isos" - -#: GeometryGUI.cxx:4278 -msgid "GEOM_MEN_POPUP_NAME" -msgstr "%1 Objects" - -#: GeometryGUI.cxx:4414 -msgid "GEOM_MEN_SKETCHER_X" -msgstr "Enter a Length to Set X" - -#: GeometryGUI.cxx:4438 -msgid "GEOM_MEN_SKETCHER_Y" -msgstr "Enter a Length to Set Y" - -#: GeometryGUI.cxx:2898 -msgid "GEOM_MEN_TRANSPARENCY" -msgstr "Transparency" - -#: GeometryGUI.cxx:4413 -msgid "GEOM_MEN_X" -msgstr "X :" - -#: GeometryGUI.cxx:4437 -msgid "GEOM_MEN_Y" -msgstr "Y :" - -#: GeometryGUI_NbIsosDlg.cxx:36 -msgid "GEOM_MEN_ISOU" -msgstr "Isos U :" - -#: GeometryGUI_NbIsosDlg.cxx:53 -msgid "GEOM_MEN_ISOV" -msgstr "Isos V :" - -#: GeometryGUI_TransparencyDlg.cxx:31 -msgid "GEOM_MEN_TRANSPARENCY_LABEL" -msgstr "Transparency :" - -msgid "GEOM_MEN_STEP_LABEL" -msgstr "Step :" - -msgid "GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE" -msgstr "Identical names : select by mouse !" - -msgid "GEOM_NAME_INCORRECT" -msgstr "Object name not found" - -msgid "GEOM_INCORRECT_INPUT" -msgstr "Incorrect input data!" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:892 -msgid "GEOM_WRN_RADIUS_NULL" -msgstr "Radius is null" - -#: GeometryGUI.cxx:3854 -msgid "GEOM_WRN_WARNING" -msgstr "Warning" - -#: GeometryGUI.cxx:3854 -msgid "GEOM_REALLY_DELETE" -msgstr "Do you really want to delete this %1 object(s):" - -msgid "GEOM_DELETE_OBJECTS" -msgstr "Delete objects" - -# -#============================================================================== -# - -#Object -msgid "GEOM_OBJECT" -msgstr "Object" - -#Main object -msgid "GEOM_MAIN_OBJECT" -msgstr "Main Object" - -#Tool object -msgid "GEOM_TOOL_OBJECT" -msgstr "Tool Object" - -#Base Object -msgid "GEOM_BASE_OBJECT" -msgstr "Base Object" - -#Path Object -msgid "GEOM_PATH_OBJECT" -msgstr "Path Object" - -#Objects -msgid "GEOM_OBJECTS" -msgstr "Objects" - -#Object i -msgid "GEOM_OBJECT_I" -msgstr "Object %1" - -#Object and result -msgid "GEOM_OBJECT_RESULT" -msgstr "Object And Result" - -#Point -msgid "GEOM_POINT" -msgstr "Point" - -#Base point -msgid "GEOM_BASE_POINT" -msgstr "Base Point" - -#Center Point -msgid "GEOM_CENTER_POINT" -msgstr "Center Point" - -#Diagonal Points -msgid "GEOM_DIAGONAL_POINTS" -msgstr "Diagonal Points" - -#Central Point -msgid "GEOM_CENTRAL_POINT" -msgstr "Central Point" - -#Points -msgid "GEOM_POINTS" -msgstr "Points" - -#Point i -msgid "GEOM_POINT_I" -msgstr "Point %1" - -#Face i -msgid "GEOM_FACE_I" -msgstr "Face %1" - -#Arguments -msgid "GEOM_ARGUMENTS" -msgstr "Arguments" - -#Center -msgid "GEOM_CENTER" -msgstr "Center" - -#Radius -msgid "GEOM_RADIUS" -msgstr "Radius :" - -#Radius -msgid "GEOM_CONSTANT_RADIUS" -msgstr "Radius :" - -#Radius -msgid "GEOM_R1" -msgstr "R1 :" - -#Radius -msgid "GEOM_R2" -msgstr "R2 :" - -#Radius i -msgid "GEOM_RADIUS_I" -msgstr "Radius %1 :" - -#Height -msgid "GEOM_HEIGHT" -msgstr "Height :" - -#Length -msgid "GEOM_LENGTH" -msgstr "Length :" - -#Weight -msgid "GEOM_WEIGHT" -msgstr "Weight :" - -#Coordinates -msgid "GEOM_COORDINATES" -msgstr "Coordinates" - -#Coor. -msgid "GEOM_COOR" -msgstr "Coord. :" - -#Reverse -msgid "GEOM_REVERSE" -msgstr "Reverse" - -#Bothway -msgid "GEOM_BOTHWAY" -msgstr "Both Directions" - -#Reverse U -msgid "GEOM_REVERSE_U" -msgstr "Reverse U" - -#Reverse V -msgid "GEOM_REVERSE_V" -msgstr "Reverse V" - -#Angle -msgid "GEOM_ANGLE" -msgstr "Angle :" - -#Axis -msgid "GEOM_AXIS" -msgstr "Axis" - -#Matrix -msgid "GEOM_MATRIX" -msgstr "Matrix :" - -#Vector Length -msgid "GEOM_VECTOR_LENGTH" -msgstr "Vector Length :" - -#Reverse Vector -msgid "GEOM_REVERSE_VECTOR" -msgstr "Reverse Vector" - -#Point Mirror -msgid "GEOM_POINT_MIRROR" -msgstr "Point Mirror" - -#Axe Mirror -msgid "GEOM_AXE_MIRROR" -msgstr "Axe Mirror" - -#Plane Mirror -msgid "GEOM_PLANE_MIRROR" -msgstr "Plane Mirror" - -#Face Selection -msgid "GEOM_FACE_SELECTION" -msgstr "Face Selection" - -#Base -msgid "GEOM_BASE" -msgstr "Base" - -#Water Density -msgid "GEOM_WATER_DENSITY" -msgstr "Water Density :" - -#Meshing Deflection -msgid "GEOM_MESHING_DEFLECTION" -msgstr "Meshing Deflect. :" - -#Dimensions -msgid "GEOM_DIMENSIONS" -msgstr "Dimensions" - -#Precision -msgid "GEOM_PRECISION" -msgstr "Precision :" - -#Selection -msgid "GEOM_SELECTION" -msgstr "Selection" - -#Nb. Times -msgid "GEOM_NB_TIMES" -msgstr "Nb. Times :" - -#Nb. Times U -msgid "GEOM_NB_TIMES_U" -msgstr "Nb. Times U :" - -#Nb. Times V -msgid "GEOM_NB_TIMES_V" -msgstr "Nb. Times V :" - -#Step -msgid "GEOM_STEP" -msgstr "Step :" - -#Step V -msgid "GEOM_STEP_V" -msgstr "Step V :" - -#Step U -msgid "GEOM_STEP_U" -msgstr "Step U :" - -# -#============================================================================== -# - -#Partition -msgid "GEOM_PARTITION" -msgstr "Partition" - -#Half-space partition -msgid "GEOM_PARTITION_HALFSPACE" -msgstr "Half-space partition" - -#Tolerance -msgid "GEOM_TOLERANCE" -msgstr "Tolerance" - -#Orientation -msgid "GEOM_ORIENTATION" -msgstr "Orientation" - -#Pipe -msgid "GEOM_PIPE" -msgstr "Pipe" - -#Revolution -msgid "GEOM_REVOLUTION" -msgstr "Revolution" - -#Rotation -msgid "GEOM_ROTATION" -msgstr "Rotation" - -#Archimede -msgid "GEOM_ARCHIMEDE" -msgstr "Archimede" - -#Common -msgid "GEOM_COMMON" -msgstr "Common" - -#Cut -msgid "GEOM_CUT" -msgstr "Cut" - -#Distance -msgid "GEOM_DISTANCE" -msgstr "Distance" - -#Filling -msgid "GEOM_FILLING" -msgstr "Filling" - -#Fuse -msgid "GEOM_FUSE" -msgstr "Fuse" - -#Scale -msgid "GEOM_SCALE" -msgstr "Scale" - -#Position -msgid "GEOM_POSITION" -msgstr "Location" - -#Offset -msgid "GEOM_OFFSET" -msgstr "Offset" - -#Section -msgid "GEOM_SECTION" -msgstr "Section" - -#Sewing -msgid "GEOM_SEWING" -msgstr "Sewing" - -#Translation -msgid "GEOM_TRANSLATION" -msgstr "Translation" - -#Working Plane -msgid "GEOM_WPLANE" -msgstr "Working Plane" - -#Mirror -msgid "GEOM_MIRROR" -msgstr "Mirror" - -#Prism -msgid "GEOM_EXTRUSION" -msgstr "Extrusion" - -#Sub Shapes -msgid "GEOM_SUB_SHAPE" -msgstr "Sub Shapes" - -#Supress Face -msgid "GEOM_SUPRESSFACE" -msgstr "Supress Face" - -#Fillet -msgid "GEOM_FILLET" -msgstr "Fillet" - -#Chamfer -msgid "GEOM_CHAMFER" -msgstr "Chamfer" - -#Check Shape -msgid "GEOM_CHECK_SHAPE" -msgstr "Check Shape" - -#Check Blocks Compound -msgid "GEOM_CHECK_BLOCKS_COMPOUND" -msgstr "Check and Improve Blocks Compound" - -#Check Blocks Compound Errors -msgid "GEOM_CHECK_BLOCKS_COMPOUND_ERRORS" -msgstr "Errors" - -#Check Blocks Compound Errors -msgid "GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS" -msgstr "The Compound of Blocks has no errors" - -msgid "GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS" -msgstr "The Compound of Blocks has errors" - -#Check Blocks Compound SubShapes -msgid "GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES" -msgstr "Incriminated Sub-Shapes" - -#Whatis -msgid "GEOM_WHATIS" -msgstr "Whatis" - -#Bounding Box -msgid "GEOM_BNDBOX" -msgstr "Bounding Box" - -#Center Of Mass -msgid "GEOM_CMASS" -msgstr "Center Of Mass" - -#Normal -msgid "GEOM_NORMALE" -msgstr "Normal To A Face" - -msgid "GEOM_VECTOR_NORMALE" -msgstr "Vector_Normal" - -#Basic Properties -msgid "GEOM_PROPERTIES" -msgstr "Basic Properties" - -#Multi-Translation -msgid "GEOM_MULTITRANSLATION" -msgstr "Multi-Translation" - -#Multi-Rotation -msgid "GEOM_MULTIROTATION" -msgstr "Multi-Rotation" - -# -#============================================================================== -# - -#Arc -msgid "GEOM_ARC" -msgstr "Arc" - -#Box -msgid "GEOM_BOX" -msgstr "Box" - -#Circle -msgid "GEOM_CIRCLE" -msgstr "Circle" - -#Ellipse -msgid "GEOM_ELLIPSE" -msgstr "Ellipse" - -msgid "GEOM_ELLIPSE_TITLE" -msgstr "Ellipse Construction" - -#Radius major -msgid "GEOM_RADIUS_MAJOR" -msgstr "Major radius :" - -#Radius minor -msgid "GEOM_RADIUS_MINOR" -msgstr "Minor radius :" - -#Compound -msgid "GEOM_COMPOUND" -msgstr "Compound" - -#Compound of Blocks -msgid "GEOM_BLOCKS_COMPOUND" -msgstr "BlocksCompound" - -#CompSolid -msgid "GEOM_COMPOUNDSOLID" -msgstr "CompSolid" - -#Cone -msgid "GEOM_CONE" -msgstr "Cone" - -#Cylinder -msgid "GEOM_CYLINDER" -msgstr "Cylinder" - -#Edge -msgid "GEOM_EDGE" -msgstr "Edge" - -#Face -msgid "GEOM_FACE" -msgstr "Face" - -#Face -msgid "GEOM_PLANAR_FACE" -msgstr "Planar Face" - -#Faces -msgid "GEOM_FACES" -msgstr "Faces" - -#Face or LCS -msgid "GEOM_FACE_OR_LCS" -msgstr "Face or LCS" - -#Line -msgid "GEOM_LINE" -msgstr "Line" - -#Line 1 -msgid "GEOM_LINE1" -msgstr "Line 1" - -#Line 2 -msgid "GEOM_LINE2" -msgstr "Line 2" - -#Plane -msgid "GEOM_PLANE" -msgstr "Plane" - -#Shape -msgid "GEOM_SHAPE" -msgstr "Shape" - -#Shell -msgid "GEOM_SHELL" -msgstr "Shell" - -#Shells -msgid "GEOM_SHELLS" -msgstr "Shells" - -#Solid -msgid "GEOM_SOLID" -msgstr "Solid" - -#Sphere -msgid "GEOM_SPHERE" -msgstr "Sphere" - -#Conical Face -msgid "GEOM_SURFCONE" -msgstr "Conical Face" - -#Cylindrical Face -msgid "GEOM_SURFCYLINDER" -msgstr "Cylindrical Face" - -#Spherical Face -msgid "GEOM_SURFSPHERE" -msgstr "Spherical Face" - -#Toroidal Face -msgid "GEOM_SURFTORUS" -msgstr "Toroidal Face" - -#Torus -msgid "GEOM_TORUS" -msgstr "Torus" - -#Vector -msgid "GEOM_VECTOR" -msgstr "Vector" - -#Vector U -msgid "GEOM_VECTOR_U" -msgstr "Vector U" - -#Vector V -msgid "GEOM_VECTOR_V" -msgstr "Vector V" - -#Vertex -msgid "GEOM_VERTEX" -msgstr "Vertex" - -#Wire -msgid "GEOM_WIRE" -msgstr "Wire" - -#Wire(s) -msgid "GEOM_WIRES" -msgstr "Wire(s)" - -#Wires -msgid "GEOM_WIREZ" -msgstr "Wires" - -msgid "GEOM_IMPORT" -msgstr "Imported_Shape" - -#Parameter -msgid "GEOM_PARAMETER" -msgstr "Parameter :" - -# -#============================================================================== -# - -#Min -msgid "GEOM_MIN" -msgstr "Min :" - -#Max -msgid "GEOM_MAX" -msgstr "Max :" - -#X -msgid "GEOM_X" -msgstr "X :" - -#Y -msgid "GEOM_Y" -msgstr "Y :" - -#Z -msgid "GEOM_Z" -msgstr "Z :" - -#DX -msgid "GEOM_DX" -msgstr "Dx :" - -#DY -msgid "GEOM_DY" -msgstr "Dy :" - -#DZ -msgid "GEOM_DZ" -msgstr "Dz :" - -#D1 -msgid "GEOM_D1" -msgstr "D1 :" - -#D2 -msgid "GEOM_D2" -msgstr "D2 :" - -#D -msgid "GEOM_D" -msgstr "D :" - -# -#============================================================================== -# - -#: GeometryGUI.cxx -msgid "GEOM_STEP_TITLE" -msgstr "Step value for GUI constructions" - -#: GeometryGUI_ArcDlg.cxx:45 -msgid "GEOM_ARC_TITLE" -msgstr "Arc Construction" - -#: GeometryGUI_ArchimedeDlg.cxx:55 -msgid "GEOM_ARCHIMEDE_TITLE" -msgstr "Archimede Construction" - -#: GeometryGUI_BndBoxDlg.cxx:59 -msgid "GEOM_BNDBOX_TITLE" -msgstr "Bounding Box Informations" - -#: GeometryGUI_BndBoxDlg.cxx:82 -msgid "GEOM_BNDBOX_OBJDIM" -msgstr "Object And Its Dimensions" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_TITLE" -msgstr "Box Construction" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_OBJ" -msgstr "Dimensions At Origin" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_TITLE" -msgstr "Chamfer Construction" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_ALL" -msgstr "Chamfer On Whole Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_EDGES" -msgstr "Chamfer On Edges From Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_EDGE" -msgstr "Chamfer On Selected Edges" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "SELECTED_EDGE" -msgstr "Selected Edges" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_FACES" -msgstr "Chamfer On Faces From Shape" - -#: GeometryGUI_CircleDlg.cxx:48 -msgid "GEOM_CIRCLE_TITLE" -msgstr "Circle Construction" - -#: GeometryGUI_CenterMassDlg.cxx:77 -msgid "GEOM_CMASS_TITLE" -msgstr "Center Of Mass Construction" - -#: GeometryGUI_NormaleDlg.cxx:57 -msgid "GEOM_NORMALE_TITLE" -msgstr "Create Normal To A Face" - -msgid "GEOM_PLANE_SIZE" -msgstr "Size of plane :" - -#: GeometryGUI_CommonDlg.cxx:47 -msgid "GEOM_COMMON_TITLE" -msgstr "BOOLEAN : Common Of Two Objects" - -#: GeometryGUI_CompoundDlg.cxx:44 -msgid "GEOM_COMPOUND_TITLE" -msgstr "Create A Compound" - -#: GeometryGUI_ConeDlg.cxx:49 -msgid "GEOM_CONE_TITLE" -msgstr "Cone Construction" - -#: GeometryGUI_CutDlg.cxx:48 -msgid "GEOM_CUT_TITLE" -msgstr "BOOLEAN : Cut Of Two Objects" -# -#: GeometryGUI_CylinderDlg.cxx:47 -msgid "GEOM_CYLINDER_TITLE" -msgstr "Cylinder Construction" - -#: GeometryGUI_CheckShape.cxx:60 -msgid "GEOM_CHECK_TITLE" -msgstr "Check Shape Informations" - -#: GeometryGUI_CheckShape.cxx:83 -msgid "GEOM_CHECK_INFOS" -msgstr "Object And Its Topological Informations" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_TITLE" -msgstr "Minimun Distance Between Two Objects" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_OBJ" -msgstr "Objects And Results" - -#: GeometryGUI_AngleDlg.cxx:82 -msgid "GEOM_MEASURE_ANGLE_TITLE" -msgstr "Angle Between Two Straight Edges/Lines/Vectors" - -#: GeometryGUI_AngleDlg.cxx:86 -msgid "GEOM_MEASURE_ANGLE_ANGLE" -msgstr "Angle" - -#: GeometryGUI_AngleDlg.cxx:90 -msgid "GEOM_MEASURE_ANGLE_OBJ" -msgstr "Objects And Results" - -#: GeometryGUI_AngleDlg.cxx:93 -msgid "GEOM_MEASURE_ANGLE_IS" -msgstr "Angle in degrees :" - -#: GeometryGUI_EdgeDlg.cxx:47 -msgid "GEOM_EDGE_TITLE" -msgstr "Create An Edge" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_TITLE" -msgstr "Fillet Construction" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_ALL" -msgstr "Fillet On Whole Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_EDGES" -msgstr "Fillet On Edges From Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_FACES" -msgstr "Fillet On Faces From Shape" - -#: GeometryGUI_FaceDlg.cxx:49 -msgid "GEOM_FACE_TITLE" -msgstr "Create A Face" - -#: GeometryGUI_FaceDlg.cxx:78 -msgid "GEOM_FACE_FFW" -msgstr "Face creation from wires and/or edges" - -#: GeometryGUI_FaceDlg.cxx:103 -msgid "GEOM_FACE_OPT" -msgstr "Try to create a planar face" - -#: GeometryGUI_FillingDlg.cxx:53 -msgid "GEOM_FILLING_TITLE" -msgstr "Filling Surface With Edges" - -#: GeometryGUI_FillingDlg.cxx:112 -msgid "GEOM_FILLING_ARG" -msgstr "Arguments And Parameters" - -#: GeometryGUI_FillingDlg.cxx:128 -msgid "GEOM_FILLING_MIN_DEG" -msgstr "Min deg" - -#: GeometryGUI_FillingDlg.cxx:142 -msgid "GEOM_FILLING_MAX_DEG" -msgstr "Max deg" - -#: GeometryGUI_FillingDlg.cxx:150 -msgid "GEOM_FILLING_TOL_2D" -msgstr "Tol. 2D :" - -#: GeometryGUI_FillingDlg.cxx:170 -msgid "GEOM_FILLING_COMPOUND" -msgstr "Edges compound" - -#: GeometryGUI_FillingDlg.cxx:184 -msgid "GEOM_FILLING_TOL_3D" -msgstr "Tol. 3D :" - -#: GeometryGUI_FillingDlg.cxx:192 -msgid "GEOM_FILLING_NB_ITER" -msgstr "Nb. Iter :" - -#: GeometryGUI_FuseDlg.cxx:48 -msgid "GEOM_FUSE_TITLE" -msgstr "BOOLEAN : Fuse Two Objects" - -#: GeometryGUI_InertiaDlg.cxx:42 -msgid "GEOM_INERTIA_TITLE" -msgstr "Calculs Of Inertia" - -#: GeometryGUI_InertiaDlg.cxx:50 -msgid "GEOM_INERTIA_CONSTR" -msgstr "Matrix And Moments Of Inertia" - -#: GeometryGUI_InertiaDlg.cxx:100 -msgid "GEOM_INERTIA_I" -msgstr "%1:1 :" - -#: GeometryGUI_InertiaDlg.cxx:182 -msgid "GEOM_INERTIA_IXYZ" -msgstr "IX & IY & IZ :" - -#: GeometryGUI_LineDlg.cxx:50 -msgid "GEOM_LINE_TITLE" -msgstr "Line Construction" - -#: GeometryGUI_MaxToleranceDlg.cxx:53 -msgid "GEOM_TOLERANCE_TITLE" -msgstr "Maximum Tolerance" - -#: GeometryGUI_MaxToleranceDlg.cxx:84 -msgid "GEOM_TOLERANCE_CONSTR" -msgstr "Object And Its Tolerances" - -#: GeometryGUI_MaxToleranceDlg.cxx:121 -msgid "GEOM_TOLERANCE_FACE" -msgstr "Face :" - -#: GeometryGUI_MaxToleranceDlg.cxx:138 -msgid "GEOM_TOLERANCE_EDGE" -msgstr "Edge :" - -#: GeometryGUI_MaxToleranceDlg.cxx:155 -msgid "GEOM_TOLERANCE_VERTEX" -msgstr "Vertex :" - -#: GeometryGUI_MirrorDlg.cxx:52 -msgid "GEOM_MIRROR_TITLE" -msgstr "Mirror An Object" - -#: GeometryGUI_OrientationDlg.cxx:46 -msgid "GEOM_ORIENTATION_TITLE" -msgstr "Change Orientation" - -#: GeometryGUI_OrientationDlg.cxx:134 -msgid "GEOM_ORIENTATION_OPT" -msgstr "Reverse orientation with normal vectors simulation" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_TITLE" -msgstr "Partition Of Object With Tool" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_KEEP_OBJECT" -msgstr "Keep Object" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_ORIENTATION" -msgstr "Change Orientation" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "SUPPRESS_RESULT" -msgstr "Suppress Result" - -msgid "GEOM_REMOVE_WEBS" -msgstr "Remove webs" - -msgid "GEOM_SET_MATERIALS" -msgstr "Set materials" - -#: OperationGUI_MaterialDlg.cxx:45 -msgid "GEOM_MATERIAL_TITLE" -msgstr "Define materials for Dominant Fuse" - -msgid "GEOM_MATERIAL_SHAPE" -msgstr "Shapes" - -msgid "GEOM_MATERIAL_MATERIAL" -msgstr "Material" - -msgid "GEOM_MATERIAL_ID" -msgstr "Material ID:" - -msgid "GEOM_MATERIAL_SET" -msgstr "<< Set" - -#: GeometryGUI_PipeDlg.cxx:47 -msgid "GEOM_PIPE_TITLE" -msgstr "Pipe Construction" - -#: GeometryGUI_PointDlg.cxx:52 -msgid "GEOM_POINT_TITLE" -msgstr "Point Construction" - -#: GeometryGUI_PlaneDlg.cxx:60 -msgid "GEOM_PLANE_TITLE" -msgstr "Plane Construction" - -#: GeometryGUI_PlaneDlg.cxx:172 -msgid "GEOM_PLANE_PVC" -msgstr "Point + Coordinate Vector" - -#: GeometryGUI_PlaneDlg.cxx:133 -msgid "GEOM_PLANE_PV" -msgstr "Point + Vector" - -#: GeometryGUI_PrismDlg.cxx:54 -msgid "GEOM_EXTRUSION_TITLE" -msgstr "Construction by Extrusion" - -#: GeometryGUI_PrismDlg.cxx:83 -msgid "GEOM_EXTRUSION_BSV" -msgstr "Base Shape + Vector" - -msgid "GEOM_EXTRUSION_BSV_2P" -msgstr "Base Shape + 2 Points" - -#: GeometryGUI_PropertiesDlg.cxx:56 -msgid "GEOM_PROPERTIES_TITLE" -msgstr "Basic Properties Informations" - -#: GeometryGUI_PropertiesDlg.cxx:78 -msgid "GEOM_PROPERTIES_CONSTR" -msgstr "Object And Its Properties" - -#: GeometryGUI_PropertiesDlg.cxx:114 -msgid "GEOM_PROPERTIES_SURFACE" -msgstr "Surface is :" - -#: GeometryGUI_PropertiesDlg.cxx:120 -msgid "GEOM_PROPERTIES_VOLUME" -msgstr "Volume is :" - -#: GeometryGUI_RevolDlg.cxx:49 -msgid "GEOM_REVOLUTION_TITLE" -msgstr "Construction By Revolution" - -#: GeometryGUI_RotationDlg.cxx:51 -msgid "GEOM_ROTATION_TITLE" -msgstr "Rotation Of An Object" - -#: GeometryGUI_ScaleDlg.cxx:52 -msgid "GEOM_SCALE_TITLE" -msgstr "Scale An Object" - -#: GeometryGUI_PositionDlg.cxx:52 -msgid "GEOM_POSITION_TITLE" -msgstr "Modify the Location of an Object" - -#: GeometryGUI_PositionDlg.cxx:52 -msgid "GEOM_START_LCS" -msgstr "Start LCS" - -#: GeometryGUI_PositionDlg.cxx:52 -msgid "GEOM_END_LCS" -msgstr "End LCS" - -#: GeometryGUI_OffsetDlg.cxx:53 -msgid "GEOM_OFFSET_TITLE" -msgstr "Offset Surface" - -#: GeometryGUI_ScaleDlg.cxx:117 -msgid "GEOM_SCALE_FACTOR" -msgstr "Scale Factor :" - -#: GeometryGUI_SectionDlg.cxx:50 -msgid "GEOM_SECTION_TITLE" -msgstr "BOOLEAN : Section Of Two Objects" - -#: GeometryGUI_SewingDlg.cxx:48 -msgid "GEOM_SEWING_TITLE" -msgstr "Topological sewing" - -#: GeometryGUI_ShellDlg.cxx:53 -msgid "GEOM_SHELL_TITLE" -msgstr "Shell Construction" - -#: GeometryGUI_SolidDlg.cxx:74 -msgid "GEOM_SOLID_TITLE" -msgstr "Solid Construction" - -#: GeometryGUI_SphereDlg.cxx:50 -msgid "GEOM_SPHERE_TITLE" -msgstr "Sphere Construction" - -#: GeometryGUI_SphereDlg.cxx:113 -msgid "GEOM_SPHERE_CR" -msgstr "Center + Radius" - -#: GeometryGUI_SphereDlg.cxx:146 -msgid "GEOM_SPHERE_RO" -msgstr "Radius At Origin" - -#: GeometryGUI_SubShapeDlg.cxx:55 -msgid "GEOM_SUBSHAPE_TITLE" -msgstr "Sub Shapes Selection" - -#: GeometryGUI_SubShapeDlg.cxx:131 -msgid "GEOM_SUBSHAPE_TYPE" -msgstr "Sub Shapes Type :" - -#: GeometryGUI_SubShapeDlg.cxx:137 -msgid "GEOM_SUBSHAPE_SELECT" -msgstr "Select Sub Shapes" - -msgid "EntityGUI_SubShapeDlg::NO_SUBSHAPES_SELECTED" -msgstr "Please, select one or more sub-shapes" - -#: GeometryGUI_TorusDlg.cxx:51 -msgid "GEOM_TORUS_TITLE" -msgstr "Torus Construction" - -#: GeometryGUI_SuppressFacesDlg.cxx:103 -msgid "GEOM_SUPRESSFACE_TITLE" -msgstr "Suppress Faces In An Object" - -#: GeometryGUI_SuppressFacesDlg.cxx:164 -msgid "GEOM_SUPRESSFACE_SELECT" -msgstr "Select Faces To Suppress" - -#: GeometryGUI_TranslationDlg.cxx:78 -msgid "GEOM_TRANSLATION_COOR" -msgstr "Translation With Coordinates" - -msgid "GEOM_TRANSPARENCY_TITLE" -msgstr "Transparency" - -msgid "GEOM_TRANSPARENCY_OPAQUE" -msgstr "Opaque" - -msgid "GEOM_TRANSPARENCY_TRANSPARENT" -msgstr "Transparent" - -msgid "GEOM_SUPPRESSHOLE_TITLE" -msgstr "Suppress holes" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE" -msgstr "Select the face with hole" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE" -msgstr "Select wire on face" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE_END" -msgstr "Select end face (if hole traversing)" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE_END" -msgstr "Select end wire (if hole traversing)" - -msgid "GEOM_SUPPRESSHOLE_FACE_SHELL" -msgstr "Face or shell" - -msgid "GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE" -msgstr "Select hole(s) on the face" - -#: GeometryGUI_TranslationDlg.cxx:56 -msgid "GEOM_TRANSLATION_TITLE" -msgstr "Translation Of An Object" - -#: GeometryGUI_VectorDlg.cxx:54 -msgid "GEOM_VECTOR_TITLE" -msgstr "Vector Construction" - -#: GeometryGUI_WhatisDlg.cxx:63 -msgid "GEOM_WHATIS_TITLE" -msgstr "Whatis Informations" - -#: GeometryGUI_WhatisDlg.cxx:86 -msgid "GEOM_WHATIS_OBJECT" -msgstr "Object And Its Topological Informations" - -#: GeometryGUI_WireDlg.cxx:46 -msgid "GEOM_WIRE_TITLE" -msgstr "Create A Wire" - -#: GeometryGUI_WireDlg.cxx:103 -msgid "GEOM_WIRE_CONNECT" -msgstr "Wire creation from wires/edges connected" - -#: GeometryGUI_WorkingPlaneDlg.cxx:50 -msgid "GEOM_WPLANE_TITLE" -msgstr "Working Plane Selection" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_FACE" -msgstr "Plane, Planar Face or LCS" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_VECTOR" -msgstr "Select 2 vectors" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_VX" -msgstr "Vector X" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_VZ" -msgstr "Vector Z" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_ORIGIN" -msgstr "Select a plane" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_OYZ" -msgstr "OYZ" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_OZX" -msgstr "OZX" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_OXY" -msgstr "OXY" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_REVERSE_PLANE" -msgstr "Reverse the plane normal" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_TITLE" -msgstr "Multi-Translation" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_SIMPLE" -msgstr "Multi Translation Simple" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_DOUBLE" -msgstr "Multi Translation Double" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_TITLE" -msgstr "Multi-Rotation" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_SIMPLE" -msgstr "Multi Rotation Simple" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_DOUBLE" -msgstr "Multi Rotation Double" - -msgid "GEOM_PARAM_POINT" -msgstr "Parametric point" - -msgid "GEOM_REF_POINT" -msgstr "Point with reference" - -msgid "GEOM_LINE_INTERSECTION" -msgstr "Point On Lines Intersection" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_WIREFRAME" -msgstr "Wireframe" - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_SHADING" -msgstr "Shading" - -msgid "GEOM_RECONSTRUCTION_LIMIT" -msgstr "Reconstruction Limit" - -msgid "GEOM_KEEP_NONLIMIT_SHAPES" -msgstr "Keep nonlimit shapes" - -msgid "GEOM_SUPPRESS_RESULT" -msgstr "Suppress Result" - -msgid "GEOM_SUPPRESS_RESULT_INSIDE" -msgstr "Inside" - -msgid "GEOM_SUPPRESS_RESULT_OUTSIDE" -msgstr "Outside" - -msgid "GEOM_RECONSTRUCTION_LIMIT_SHAPE" -msgstr "Shape" -msgid "GEOM_RECONSTRUCTION_LIMIT_SOLID" -msgstr "Solid" -msgid "GEOM_RECONSTRUCTION_LIMIT_SHELL" -msgstr "Shell" -msgid "GEOM_RECONSTRUCTION_LIMIT_FACE" -msgstr "Face" -msgid "GEOM_RECONSTRUCTION_LIMIT_WIRE" -msgstr "Wire" -msgid "GEOM_RECONSTRUCTION_LIMIT_EDGE" -msgstr "Edge" -msgid "GEOM_RECONSTRUCTION_LIMIT_VERTEX" -msgstr "Vertex" - -msgid "GEOM_SPLINE_TITLE" -msgstr "Spline Construction" -msgid "GEOM_SPLINE" -msgstr "Spline" -msgid "GEOM_BEZIER" -msgstr "Bezier" -msgid "GEOM_INTERPOL" -msgstr "Interpolation" - -# -#============================================================================== -# - -msgid "GEOM_SKETCHER_EL" -msgstr "Element Type" - -msgid "GEOM_BUT_CLOSE_SKETCH" -msgstr "Sketch Closure" - -msgid "GEOM_BUT_END_SKETCH" -msgstr "Sketch Validation" - -msgid "GEOM_SKETCHER_TITLE" -msgstr "Sketch Construction" - -msgid "GEOM_SKETCHER_POINT" -msgstr "Point" - -msgid "GEOM_SKETCHER_SEGMENT" -msgstr "Segment" - -msgid "GEOM_SKETCHER_ARC" -msgstr "Arc" - -msgid "GEOM_SKETCHER_DIR" -msgstr "Direction" - -msgid "GEOM_SKETCHER_POINT2" -msgstr "Point :" - -msgid "GEOM_SKETCHER_DEST" -msgstr "Destination" - -msgid "GEOM_SKETCHER_ABS" -msgstr "Absolute" - -msgid "GEOM_SKETCHER_REL" -msgstr "Relative" - -msgid "GEOM_SKETCHER_SEL" -msgstr "Selection" - -msgid "GEOM_SKETCHER_ANGLE" -msgstr "Angle" - -msgid "GEOM_SKETCHER_PER" -msgstr "Perpendicular" - -msgid "GEOM_SKETCHER_TAN" -msgstr "Tangent" - -msgid "GEOM_SKETCHER_VXVY" -msgstr "VX-VY" - -msgid "GEOM_SKETCHER_LENGTH" -msgstr "Length" - -msgid "GEOM_SKETCHER_X" -msgstr "X" - -msgid "GEOM_SKETCHER_Y" -msgstr "Y" - -msgid "GEOM_SKETCHER_X2" -msgstr "X :" - -msgid "GEOM_SKETCHER_Y2" -msgstr "Y :" - -msgid "GEOM_SKETCHER_X3" -msgstr "Abs. X :" - -msgid "GEOM_SKETCHER_Y3" -msgstr "Abs. Y :" - -msgid "GEOM_SKETCHER_DX2" -msgstr "DX :" - -msgid "GEOM_SKETCHER_DY2" -msgstr "DY :" - -msgid "GEOM_SKETCHER_VX2" -msgstr "VX :" - -msgid "GEOM_SKETCHER_VY2" -msgstr "VY :" - -msgid "GEOM_SKETCHER_LENGTH2" -msgstr "Length :" - -msgid "GEOM_SKETCHER_ANGLE2" -msgstr "Angle :" - -msgid "GEOM_SKETCHER_RADIUS2" -msgstr "Radius :" - -msgid "GEOM_SKETCHER_UNDO" -msgstr "Undo" - -msgid "GEOM_SKETCHER_APPLY" -msgstr "Apply" - -msgid "GEOM_SKETCHER_VALUES" -msgstr "Values" - -msgid "GEOM_SKETCHER_TYPE" -msgstr "Type" - -msgid "EntityGUI_SketcherDlg::CANNOT_CLOSE" -msgstr "It is impossible to close sketch\nNumber of sketch points too small" - -msgid "GEOM_FILLET_ABORT" -msgstr "Fillet can't be computed with radius %1" - -msgid "GEOM_CHAMFER_ABORT" -msgstr "Chamfer can't be computed with %1 and %2" - -msgid "GEOM_3_POINTS" -msgstr "3 points" - -msgid "GEOM_CENTER_2POINTS" -msgstr "Center and two points" - -msgid "GEOM_POINT1" -msgstr "Point 1" - -msgid "GEOM_POINT2" -msgstr "Point 2" - -msgid "GEOM_POINT3" -msgstr "Point 3" - -msgid "GEOM_CREATE_COPY" -msgstr "Create a copy" - -msgid "GEOM_CREATE_SINGLE_SOLID" -msgstr "Create a single solid" - -msgid "GEOM_ERROR" -msgstr "Error" - -msgid "GEOM_ERROR_STATUS" -msgstr "Operation status" - -msgid "GEOM_ELLIPSE_ERROR_1" -msgstr "Error creating ellipse. Reason: minor radius is greater than major radius." - -msgid "GEOM_CURVE" -msgstr "Curve" - -msgid "GEOM_POLYLINE" -msgstr "Polyline" - -msgid "GEOM_NODES" -msgstr "Nodes" - -msgid "GEOM_CURVE_TITLE" -msgstr "Curve Construction" - -# ShapeProcessDlg.cxx -msgid "GEOM_SHAPEPROCESS_TITLE" -msgstr "Shape Processing" - -msgid "GEOM_SHAPES" -msgstr "Shapes" - -msgid "GEOM_SELECTED_OBJECTS" -msgstr "Selected objects" - -msgid "GEOM_OPERATIONS" -msgstr "Operations" - -msgid "GEOM_PARAMETERS" -msgstr "Parameters" - -msgid "GEOM_FixShape" -msgstr "FixShape" - -msgid "GEOM_FixFaceSize" -msgstr "FixFaceSize" - -msgid "GEOM_DropSmallEdges" -msgstr "DropSmallEdges" - -msgid "GEOM_SplitAngle" -msgstr "SplitAngle" - -msgid "GEOM_SplitClosedFaces" -msgstr "SplitClosedFaces" - -msgid "GEOM_SplitContinuity" -msgstr "SplitContinuity" - -msgid "GEOM_BSplineRestriction" -msgstr "BSplineRestriction" - -msgid "GEOM_ToBezier" -msgstr "ToBezier" - -msgid "GEOM_SameParameter" -msgstr "SameParameter" - -msgid "GEOM_3D_TOLERANCE" -msgstr "3D tolerance" - -msgid "GEOM_MAX_3D_TOLERANCE" -msgstr "Max 3D tolerance" - -msgid "GEOM_MAX_TOLERANCE" -msgstr "Max tolerance" - -msgid "GEOM_ANGLE_1" -msgstr "Angle" - -msgid "GEOM_NUM_SPLIT_POINTS" -msgstr "Number of splitting points" - -msgid "GEOM_SURFACE_CONTINUTY" -msgstr "Surface continuity" - -msgid "GEOM_CURVE_CONTINUTY" -msgstr "Curve continuity" - -msgid "GEOM_SURFACE_MODE" -msgstr "Surface mode" - -msgid "GEOM_3D_CURVE_MODE" -msgstr "3D curve mode" - -msgid "GEOM_2D_CURVE_MODE" -msgstr "2D curve mode" - -msgid "GEOM_2D_TOLERANCE" -msgstr "2D tolerance" - -msgid "GEOM_REQUIRED_DEGREE" -msgstr "Required degree" - -msgid "GEOM_REQUIRED_NUM_SEGMENTS" -msgstr "Required number of segments" - -msgid "GEOM_3D_CONTINUTY" -msgstr "3D continuity" - -msgid "GEOM_2D_CONTINUTY" -msgstr "2D continuity" - -msgid "GEOM_CLOSECONTOUR_TITLE" -msgstr "Close contour" - -msgid "GEOM_ERR_LIB_NOT_FOUND" -msgstr "GUI library corresponding to the user action can not be found or loaded" - -msgid "OperationGUI_ChamferDlg::FACE_1" -msgstr "Face 1" - -msgid "OperationGUI_ChamferDlg::FACE_2" -msgstr "Face 2" - -msgid "OperationGUI_ChamferDlg::SELECTED_FACES" -msgstr "Selected faces" - -msgid "OperationGUI_ChamferDlg::D" -msgstr "D" - -msgid "OperationGUI_FilletDlg::SELECTED_EDGES" -msgstr "Selected edges" - -msgid "OperationGUI_FilletDlg::SELECTED_FACES" -msgstr "Selected faces" - -msgid "GEOM_REMOVE_INTERNAL_WIRES_TITLE" -msgstr "Suppress internal wires" - -msgid "GEOM_INTERNAL_WIRES" -msgstr "Internal wires" - -msgid "GEOM_SELECTED_FACE" -msgstr "Selected face" - -msgid "GEOM_REMOVE_ALL_INT_WIRES" -msgstr "Remove all internal wires" - -msgid "GEOM_REMOVE_HOLES_TITLE" -msgstr "Suppress holes" - -msgid "GEOM_SELECTED_SHAPE" -msgstr "Selected shape" - -msgid "GEOM_REMOVE_ALL_HOLES" -msgstr "Remove all holes" - -msgid "GEOM_HOLES" -msgstr "Holes" - -msgid "GEOM_WIRES_TO_REMOVE" -msgstr "Wires to remove" - -msgid "GEOM_DETECT" -msgstr "Detect" - -msgid "GEOM_FREE_BOUNDARIES" -msgstr "Free boundaries" - -msgid "GEOM_FREE_FACES" -msgstr "Free faces" - -msgid "GEOM_CHANGE_ORIENTATION_TITLE" -msgstr "Change orientation" - -msgid "GEOM_CHANGE_ORIENTATION" -msgstr "Objects to change orientation" - -msgid "GEOM_REMOVE_EXTRA_EDGES_TITLE" -msgstr "Remove extra edges" - -msgid "GEOM_REMOVE_EXTRA_EDGES" -msgstr "Object to remove extra edges" - -msgid "GEOM_BY_PARAMETER" -msgstr "By parameter" - -msgid "GEOM_BY_LENGTH" -msgstr "By length" - -msgid "GEOM_DIVIDE_EDGE_TITLE" -msgstr "Addition of point" - -msgid "GEOM_ADD_POINT" -msgstr "Add point" - -msgid "GEOM_VALUE" -msgstr "Value" - -msgid "GEOM_MARKER_TITLE" -msgstr "Create marker" - -msgid "GEOM_MARKER" -msgstr "Marker" - -msgid "GEOM_TRIHEDRON" -msgstr "Trihedron" - -msgid "GEOM_FREE_BOUNDS_MSG" -msgstr "Number of free boundaries detected: %1 (%2 closed, %3 open)" - -msgid "GEOM_FREE_BOUNDS_ERROR" -msgstr "Object is not selected" - -msgid "GEOM_FREE_BOUNDS_TLT" -msgstr "Free boundary detection" - -msgid "RepairGUI_FreeBoundDlg::CAPTION" -msgstr "Check free boundaries" - -msgid "RepairGUI_FreeBoundDlg::FREE_BOUND" -msgstr "Free boundaries" - -msgid "RepairGUI_FreeBoundDlg::NUMBER_CLOSED" -msgstr "Number of closed free boundaries: " - -msgid "RepairGUI_FreeBoundDlg::NUMBER_OPEN" -msgstr "Number of open free boundaries: " - -msgid "RepairGUI_ShapeProcessDlg::ERROR_NO_OPERATORS" -msgstr "Please, select at least one Shape Process operation to proceed." - -msgid "RepairGUI_ShapeProcessDlg::ERROR_NO_OBJECTS" -msgstr "Please, select a geometrical object for Shape Processing." - -msgid "RepairGUI_ShapeProcessDlg::TIME_CONSUMING" -msgstr "Enabling this option may result in a very time-consuming operation for some input shapes.\nWould you like to continue?" - -msgid "MeasureGUI_PointDlg::POINT" -msgstr "Point" - -msgid "MeasureGUI_PointDlg::X" -msgstr "X" - -msgid "MeasureGUI_PointDlg::Y" -msgstr "Y" - -msgid "MeasureGUI_PointDlg::Z" -msgstr "Z" - -msgid "MeasureGUI_PointDlg::CAPTION" -msgstr "Point Coordinates" - -msgid "MeasureGUI_PointDlg::COORDINATES" -msgstr "Point and its coordinates" - -msgid "MeasureGUI_1Sel1TextView1Check_QTD::CHECK_SHAPE_GEOMETRY" -msgstr "Check also geometry" - -msgid "GroupGUI_GroupDlg::CREATE_GROUP_TITLE" -msgstr "Create Group" - -msgid "GroupGUI_GroupDlg::EDIT_GROUP_TITLE" -msgstr "Edit Group" - -msgid "GroupGUI_GroupDlg::SHAPE_TYPE" -msgstr "Shape Type" - -msgid "GroupGUI_GroupDlg::GROUP_NAME" -msgstr "Group Name" - -msgid "GroupGUI_GroupDlg::MAIN_SUB_SHAPES" -msgstr "Main Shape And Sub-Shapes" - -msgid "GroupGUI_GroupDlg::MAIN_SHAPE" -msgstr "Main Shape" - -msgid "GroupGUI_GroupDlg::SELECT_SUB_SHAPES" -msgstr "Select Sub-Shapes" - -msgid "GroupGUI_GroupDlg::SELECT_ALL" -msgstr "Select All" - -msgid "GroupGUI_GroupDlg::ADD" -msgstr "Add" - -msgid "GroupGUI_GroupDlg::REMOVE" -msgstr "Remove" - -msgid "GroupGUI_GroupDlg::GROUP_PREFIX" -msgstr "Group" - -msgid "GroupGUI_GroupDlg::EMPTY_NAME" -msgstr "Please, specify a non-empty group name" - -msgid "GroupGUI_GroupDlg::NO_MAIN_OBJ" -msgstr "Please, select a main shape" - -msgid "GroupGUI_GroupDlg::NO_GROUP" -msgstr "Please, select a group to edit" - -msgid "GroupGUI_GroupDlg::EMPTY_LIST" -msgstr "Please, select one or more sub-shapes to put into the group" - -msgid "GroupGUI::NO_GROUP" -msgstr "Please, select a group to edit" - -msgid "_S_" -msgstr "(s)" - -### BlocksGUI ### - -msgid "WRN_NOT_IMPLEMENTED" -msgstr "Sorry, this functionality is not yet implemented" - -### BlocksGUI_TrsfDlg ### - -msgid "BlocksGUI_TrsfDlg::FACE_1" -msgstr "Face 1" - -msgid "BlocksGUI_TrsfDlg::FACE_2" -msgstr "Face 2" - -msgid "BlocksGUI_TrsfDlg::FACE_1U" -msgstr "Face 1 U" - -msgid "BlocksGUI_TrsfDlg::FACE_2U" -msgstr "Face 2 U" - -msgid "BlocksGUI_TrsfDlg::FACE_1V" -msgstr "Face 1 V" - -msgid "BlocksGUI_TrsfDlg::FACE_2V" -msgstr "Face 2 V" - -msgid "GEOM_BLOCK_MULTITRSF_TITLE" -msgstr "Block Multi-Transformation" - -msgid "GEOM_BLOCK_MULTITRSF" -msgstr "Block Multi-Transformation" - -msgid "GEOM_BLOCK_MULTITRSF_SIMPLE" -msgstr "Multi-Transformation Simple" - -msgid "GEOM_BLOCK_MULTITRSF_DOUBLE" -msgstr "Multi-Transformation Double" - -### BlocksGUI_QuadFaceDlg ### - -msgid "BlocksGUI_QuadFaceDlg::VERTEX_1" -msgstr "Vertex 1" - -msgid "BlocksGUI_QuadFaceDlg::VERTEX_2" -msgstr "Vertex 2" - -msgid "BlocksGUI_QuadFaceDlg::VERTEX_3" -msgstr "Vertex 3" - -msgid "BlocksGUI_QuadFaceDlg::VERTEX_4" -msgstr "Vertex 4" - -msgid "BlocksGUI_QuadFaceDlg::EDGE_1" -msgstr "Edge 1" - -msgid "BlocksGUI_QuadFaceDlg::EDGE_2" -msgstr "Edge 2" - -msgid "BlocksGUI_QuadFaceDlg::EDGE_3" -msgstr "Edge 3" - -msgid "BlocksGUI_QuadFaceDlg::EDGE_4" -msgstr "Edge 4" - -msgid "GEOM_QUAD_FACE_TITLE" -msgstr "Quadrangle Face Construction" - -msgid "GEOM_QUAD_FACE" -msgstr "Quadrangle Face" - -### BlocksGUI_BlockDlg ### - -msgid "BlocksGUI_BlockDlg::FACE_1" -msgstr "Face 1" - -msgid "BlocksGUI_BlockDlg::FACE_2" -msgstr "Face 2" - -msgid "BlocksGUI_BlockDlg::FACE_3" -msgstr "Face 3" - -msgid "BlocksGUI_BlockDlg::FACE_4" -msgstr "Face 4" - -msgid "BlocksGUI_BlockDlg::FACE_5" -msgstr "Face 5" - -msgid "BlocksGUI_BlockDlg::FACE_6" -msgstr "Face 6" - -msgid "GEOM_BLOCK_TITLE" -msgstr "Hexahedral Solid Construction" - -msgid "GEOM_BLOCK" -msgstr "Hexahedral Solid" - -#============================================================================== - -msgid "BasicGUI_MarkerDlg::CAPTION" -msgstr "Local CS Construction" - -msgid "BasicGUI_MarkerDlg::LOCALCS" -msgstr "Local coordinate system" - -msgid "BasicGUI_MarkerDlg::ORIGIN" -msgstr "Coordinates of origin" - -msgid "BasicGUI_MarkerDlg::XDIR" -msgstr "X axis direction" - -msgid "BasicGUI_MarkerDlg::YDIR" -msgstr "Y axis direction" - -msgid "BasicGUI_MarkerDlg::DX" -msgstr "Dx" - -msgid "BasicGUI_MarkerDlg::DY" -msgstr "Dy" - -msgid "BasicGUI_MarkerDlg::DZ" -msgstr "Dz" - -msgid "BasicGUI_MarkerDlg::LCS_NAME" -msgstr "LocalCS" - -msgid "BasicGUI_MarkerDlg::VEC_PARALLEL" -msgstr "Coordinate system axes cannot be parallel" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -======= - -### BlocksGUI_ExplodeDlg ### - -msgid "BlocksGUI_ExplodeDlg::NB_FACES_MIN" -msgstr "Min. nb. faces" - -msgid "BlocksGUI_ExplodeDlg::NB_FACES_MAX" -msgstr "Max. nb. faces" - -msgid "GEOM_BLOCK_EXPLODE_TITLE" -msgstr "Sub Blocks Selection" - -msgid "GEOM_BLOCK_EXPLODE" -msgstr "Sub Blocks" - -msgid "GEOM_NB_BLOCKS_NO_OTHERS" -msgstr "There are %1 specified blocks and NO other solids" - -msgid "GEOM_NB_BLOCKS_SOME_OTHERS" -msgstr "There are %1 specified blocks and some other solids" - -msgid "ShHealOper_NotError_msg" -msgstr "Shape Healing algorithm has done no modification of the original shape" - -msgid "ShHealOper_InvalidParameters_msg" -msgstr "Incorrect parameters for Shape Healing algorithm" - -msgid "ShHealOper_ErrorExecution_msg" -msgstr "Shape Healing algorithm failed" - -msgid "GEOM_GLUE_TITLE" -msgstr "Glue faces" - -msgid "GEOM_GLUE" -msgstr "Glue" - -msgid "RepairGUI_GlueDlg::SELECT_FACES" -msgstr "Select Faces" - -msgid "RepairGUI_GlueDlg::FACES_FOR_GLUING_ARE_DETECTED" -msgstr "There are %1 face(s) that can be glued. They are coloured on the screen with red colour\nPlease close this message box and select faces for glueing" - -msgid "RepairGUI_GlueDlg::GLUE_FACES" -msgstr "Glue faces" - -msgid "RepairGUI_GlueDlg::THERE_ARE_NO_FACES_FOR_GLUING" -msgstr "There are no faces for gluing" - -msgid "GEOM_FREE_FACES_TITLE" -msgstr "Free faces" - -### New object names for RepairGUI ### -msgid "SEWING_NEW_OBJ_NAME" -msgstr "Sewing" - -msgid "DEVIDE_EDGE_NEW_OBJECT_NAME" -msgstr "NewObject" - -msgid "CLOSE_CONTOUR_NEW_OBJ_NAME" -msgstr "CloseContour" - -msgid "REMOVE_HOLES_NEW_OBJ_NAME" -msgstr "SupressHoles" - -msgid "GLUE_NEW_OBJ_NAME" -msgstr "Glue" - -msgid "REMOVE_INT_WIRES_NEW_OBJ_NAME" -msgstr "RemoveIntWires" - -msgid "PROCESS_SHAPE_NEW_OBJ_NAME" -msgstr "ProcessShape" - -msgid "SUPRESS_FACE_NEW_OBJ_NAME" -msgstr "SupressFaces" - -msgid "CHANGE_ORIENTATION_NEW_OBJ_NAME" -msgstr "Invert" - -msgid "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" -msgstr "NoExtraEdges" - -msgid "NON_GEOM_OBJECTS_SELECTED" -msgstr "There are objects selected which do not belong to %1 component." - -msgid "GEOM_PROPAGATE_TITLE" -msgstr "Propagate" - -msgid "GEOM_PROPAGATE" -msgstr "Propagate" - -### Menu of GEOM module ### -msgid "MEN_FILE" -msgstr "File" - -msgid "TOP_IMPORT" -msgstr "Import geometry from BREP file" - -msgid "MEN_IMPORT" -msgstr "Import..." - -msgid "STB_IMPORT" -msgstr "Import geometry from BREP file" - -msgid "TOP_EXPORT" -msgstr "Export geometry to BREP file" - -msgid "MEN_EXPORT" -msgstr "Export..." - -msgid "STB_EXPORT" -msgstr "Export geometry to BREP file" - -msgid "MEN_EDIT" -msgstr "Edit" - -msgid "TOP_DELETE" -msgstr "Delete object" - -msgid "MEN_DELETE" -msgstr "Delete" - -msgid "STB_DELETE" -msgstr "Delete object" - -msgid "MEN_NEW_ENTITY" -msgstr "New Entity" - -msgid "MEN_BASIC" -msgstr "Basic" - -msgid "TOP_POINT" -msgstr "Create a point" - -msgid "MEN_POINT" -msgstr "Point" - -msgid "STB_POINT" -msgstr "Create a point" - -msgid "TOP_LINE" -msgstr "Create a line" - -msgid "MEN_LINE" -msgstr "Line" - -msgid "STB_LINE" -msgstr "Create a line" - -msgid "TOP_CIRCLE" -msgstr "Create a circle" - -msgid "MEN_CIRCLE" -msgstr "Circle" - -msgid "STB_CIRCLE" -msgstr "Create a circle" - -msgid "TOP_ELLIPSE" -msgstr "Create an ellipse" - -msgid "MEN_ELLIPSE" -msgstr "Ellipse" - -msgid "STB_ELLIPSE" -msgstr "Create an ellipse" - -msgid "TOP_ARC" -msgstr "Create an arc" - -msgid "MEN_ARC" -msgstr "Arc" - -msgid "STB_ARC" -msgstr "Create an arc" - -msgid "TOP_CURVE" -msgstr "Create a curve" - -msgid "MEN_CURVE" -msgstr "Curve" - -msgid "STB_CURVE" -msgstr "Create a curve" - -msgid "TOP_VECTOR" -msgstr "Create a vector" - -msgid "MEN_VECTOR" -msgstr "Vector" - -msgid "STB_VECTOR" -msgstr "Create a vector" - -msgid "TOP_PLANE" -msgstr "Create a plane" - -msgid "MEN_PLANE" -msgstr "Plane" - -msgid "STB_PLANE" -msgstr "Create a plane" - -msgid "TOP_WORK_PLANE" -msgstr "Create a working plane" - -msgid "MEN_WORK_PLANE" -msgstr "Working Plane" - -msgid "STB_WORK_PLANE" -msgstr "Create a working plane" - -msgid "TOP_LOCAL_CS" -msgstr "Create a local coordinate system" - -msgid "MEN_LOCAL_CS" -msgstr "Local Coordinate System" - -msgid "STB_LOCAL_CS" -msgstr "Create a local coordinate system" - -msgid "MEN_PRIMITIVES" -msgstr "Primitives" - -msgid "TOP_BOX" -msgstr "Create a box" - -msgid "MEN_BOX" -msgstr "Box" - -msgid "STB_BOX" -msgstr "Create a box" - -msgid "TOP_CYLINDER" -msgstr "Create a cylinder" - -msgid "MEN_CYLINDER" -msgstr "Cylinder" - -msgid "STB_CYLINDER" -msgstr "Create a cylinder" - -msgid "TOP_SPHERE" -msgstr "Create a sphere" - -msgid "MEN_SPHERE" -msgstr "Sphere" - -msgid "STB_SPHERE" -msgstr "Create a sphere" - -msgid "TOP_TORUS" -msgstr "Create a torus" - -msgid "MEN_TORUS" -msgstr "Torus" - -msgid "STB_TORUS" -msgstr "Create a torus" - -msgid "TOP_CONE" -msgstr "Create a cone" - -msgid "MEN_CONE" -msgstr "Cone" - -msgid "STB_CONE" -msgstr "Create a cone" - -msgid "MEN_GENERATION" -msgstr "Generation" - -msgid "TOP_EXTRUSION" -msgstr "Create an extrusion" - -msgid "MEN_EXTRUSION" -msgstr "Extrusion" - -msgid "STB_EXTRUSION" -msgstr "Create an extrusion" - -msgid "TOP_REVOLUTION" -msgstr "Create a revolution" - -msgid "MEN_REVOLUTION" -msgstr "Revolution" - -msgid "STB_REVOLUTION" -msgstr "Create a revolution" - -msgid "TOP_FILLING" -msgstr "Create a filling" - -msgid "MEN_FILLING" -msgstr "Filling" - -msgid "STB_FILLING" -msgstr "Create a filling" - -msgid "TOP_PIPE" -msgstr "Extrusion along a path" - -msgid "MEN_PIPE" -msgstr "Extrusion Along a Path" - -msgid "STB_PIPE" -msgstr "Create a shape by Extrusion along a path" - -msgid "MEN_GROUP" -msgstr "Group" - -msgid "TOP_GROUP_CREATE" -msgstr "Create a group" - -msgid "MEN_GROUP_CREATE" -msgstr "Create" - -msgid "STB_GROUP_CREATE" -msgstr "Create a group" - -msgid "TOP_GROUP_EDIT" -msgstr "Edit a group" - -msgid "MEN_GROUP_EDIT" -msgstr "Edit" - -msgid "STB_GROUP_EDIT" -msgstr "Edit a group" - -msgid "MEN_BLOCKS" -msgstr "Blocks" - -msgid "TOP_Q_FACE" -msgstr "Quadrangle Face" - -msgid "MEN_Q_FACE" -msgstr "Quadrangle Face" - -msgid "STB_Q_FACE" -msgstr "Quadrangle Face" - -msgid "TOP_HEX_SOLID" -msgstr "Hexahedral Solid" - -msgid "MEN_HEX_SOLID" -msgstr "Hexahedral Solid" - -msgid "STB_HEX_SOLID" -msgstr "Hexahedral Solid" - -msgid "TOP_SKETCH" -msgstr "Sketch" - -msgid "MEN_SKETCH" -msgstr "Sketch" - -msgid "STB_SKETCH" -msgstr "Sketch" - -msgid "TOP_EXPLODE" -msgstr "Explode" - -msgid "MEN_EXPLODE" -msgstr "Explode" - -msgid "STB_EXPLODE" -msgstr "Explode" - -msgid "MEN_BUILD" -msgstr "Build" - -msgid "TOP_EDGE" -msgstr "Build an edge" - -msgid "MEN_EDGE" -msgstr "Edge" - -msgid "STB_EDGE" -msgstr "Build an edge" - -msgid "TOP_WIRE" -msgstr "Build a wire" - -msgid "MEN_WIRE" -msgstr "Wire" - -msgid "STB_WIRE" -msgstr "Build a wire" - -msgid "TOP_FACE" -msgstr "Build a face" - -msgid "MEN_FACE" -msgstr "Face" - -msgid "STB_FACE" -msgstr "Build a face from wires and/or edges" - -msgid "TOP_SHELL" -msgstr "Build a shell" - -msgid "MEN_SHELL" -msgstr "Shell" - -msgid "STB_SHELL" -msgstr "Build a shell" - -msgid "TOP_SOLID" -msgstr "Build a solid" - -msgid "MEN_SOLID" -msgstr "Solid" - -msgid "STB_SOLID" -msgstr "Build a solid" - -msgid "TOP_COMPOUND" -msgstr "Build a compound" - -msgid "MEN_COMPOUND" -msgstr "Compound" - -msgid "STB_COMPOUND" -msgstr "Build a compound" - -msgid "MEN_OPERATIONS" -msgstr "Operations" - -msgid "MEN_BOOLEAN" -msgstr "Boolean" - -msgid "TOP_FUSE" -msgstr "Fuse" - -msgid "MEN_FUSE" -msgstr "Fuse" - -msgid "STB_FUSE" -msgstr "Fuse" - -msgid "TOP_COMMON" -msgstr "Common" - -msgid "MEN_COMMON" -msgstr "Common" - -msgid "STB_COMMON" -msgstr "Common" - -msgid "TOP_CUT" -msgstr "Cut" - -msgid "MEN_CUT" -msgstr "Cut" - -msgid "STB_CUT" -msgstr "Cut" - -msgid "TOP_SECTION" -msgstr "Section" - -msgid "MEN_SECTION" -msgstr "Section" - -msgid "STB_SECTION" -msgstr "Section" - -msgid "MEN_TRANSFORMATION" -msgstr "Transformation" - -msgid "TOP_TRANSLATION" -msgstr "Translation" - -msgid "MEN_TRANSLATION" -msgstr "Translation" - -msgid "STB_TRANSLATION" -msgstr "Translation" - -msgid "TOP_ROTATION" -msgstr "Rotation" - -msgid "MEN_ROTATION" -msgstr "Rotation" - -msgid "STB_ROTATION" -msgstr "Rotation" - -msgid "TOP_MODIFY_LOCATION" -msgstr "Modify the Location" - -msgid "MEN_MODIFY_LOCATION" -msgstr "Modify the Location" - -msgid "STB_MODIFY_LOCATION" -msgstr "Modify the Location" - -msgid "TOP_MIRROR" -msgstr "Mirror image" - -msgid "MEN_MIRROR" -msgstr "Mirror Image" - -msgid "STB_MIRROR" -msgstr "Mirror image" - -msgid "TOP_SCALE" -msgstr "Scale transform" - -msgid "MEN_SCALE" -msgstr "Scale Transform" - -msgid "STB_SCALE" -msgstr "Scale transform" - -msgid "TOP_OFFSET" -msgstr "Offset surface" - -msgid "MEN_OFFSET" -msgstr "Offset Surface" - -msgid "STB_OFFSET" -msgstr "Offset surface" - -msgid "TOP_MUL_TRANSLATION" -msgstr "Multi-Translation" - -msgid "MEN_MUL_TRANSLATION" -msgstr "Multi-Translation" - -msgid "STB_MUL_TRANSLATION" -msgstr "Multi-Translation" - -msgid "TOP_MUL_ROTATION" -msgstr "Multi-Rotation" - -msgid "MEN_MUL_ROTATION" -msgstr "Multi-Rotation" - -msgid "STB_MUL_ROTATION" -msgstr "Multi-Rotation" - -msgid "TOP_PARTITION" -msgstr "Partition" - -msgid "MEN_PARTITION" -msgstr "Partition" - -msgid "STB_PARTITION" -msgstr "Partition" - -msgid "TOP_ARCHIMEDE" -msgstr "Archimede" - -msgid "MEN_ARCHIMEDE" -msgstr "Archimede" - -msgid "STB_ARCHIMEDE" -msgstr "Archimede" - -msgid "TOP_FILLET" -msgstr "Fillet" - -msgid "MEN_FILLET" -msgstr "Fillet" - -msgid "STB_FILLET" -msgstr "Fillet" - -msgid "TOP_CHAMFER" -msgstr "Chamfer" - -msgid "MEN_CHAMFER" -msgstr "Chamfer" - -msgid "STB_CHAMFER" -msgstr "Chamfer" - -msgid "TOP_CLIPPING" -msgstr "Clipping range" - -msgid "MEN_CLIPPING" -msgstr "Clipping Range" - -msgid "STB_CLIPPING" -msgstr "Clipping range" - -msgid "TOP_MUL_TRANSFORM" -msgstr "Multi-transformation" - -msgid "MEN_MUL_TRANSFORM" -msgstr "Multi-Transformation" - -msgid "STB_MUL_TRANSFORM" -msgstr "Multi-transformation" - -msgid "TOP_EXPLODE_BLOCKS" -msgstr "Explode on Blocks" - -msgid "MEN_EXPLODE_BLOCKS" -msgstr "Explode on Blocks" - -msgid "STB_EXPLODE_BLOCKS" -msgstr "Explode on Blocks" - -msgid "TOP_PROPAGATE" -msgstr "Propagate" - -msgid "MEN_PROPAGATE" -msgstr "Propagate" - -msgid "STB_PROPAGATE" -msgstr "Propagate" - -msgid "MEN_REPAIR" -msgstr "Repair" - -msgid "TOP_SHAPE_PROCESS" -msgstr "Perform shape processing" - -msgid "MEN_SHAPE_PROCESS" -msgstr "Shape Processing" - -msgid "STB_SHAPE_PROCESS" -msgstr "Perform shape processing " - -msgid "TOP_SUPPRESS_FACES" -msgstr "Perform suppress faces" - -msgid "MEN_SUPPRESS_FACES" -msgstr "Suppress Faces" - -msgid "STB_SUPPRESS_FACES" -msgstr "Perform suppress faces" - -msgid "TOP_CLOSE_CONTOUR" -msgstr "Perform close contour" - -msgid "MEN_CLOSE_CONTOUR" -msgstr "Close Contour" - -msgid "STB_CLOSE_CONTOUR" -msgstr "Perform close contour" - -msgid "TOP_SUPPRESS_INT_WIRES" -msgstr "Perform suppress internal wires" - -msgid "MEN_SUPPRESS_INT_WIRES" -msgstr "Suppress Internal Wires" - -msgid "STB_SUPPRESS_INT_WIRES" -msgstr "Perform suppress internal wires" - -msgid "TOP_SUPPERSS_HOLES" -msgstr "Perform suppress holes" - -msgid "MEN_SUPPERSS_HOLES" -msgstr "Suppress Holes" - -msgid "STB_SUPPERSS_HOLES" -msgstr "Perform suppress holes" - -msgid "TOP_SEWING" -msgstr "Perform sewing" - -msgid "MEN_SEWING" -msgstr "Sewing" - -msgid "STB_SEWING" -msgstr "Perform sewing" - -msgid "TOP_GLUE_FACES" -msgstr "Perform glue faces" - -msgid "MEN_GLUE_FACES" -msgstr "Glue Faces" - -msgid "STB_GLUE_FACES" -msgstr "Perform glue faces" - -msgid "TOP_POINT_ON_EDGE" -msgstr "Add point on edge" - -msgid "MEN_POINT_ON_EDGE" -msgstr "Add Point on Edge" - -msgid "STB_POINT_ON_EDGE" -msgstr "Add point on edge" - -msgid "TOP_CHECK_FREE_BNDS" -msgstr "Check free boundaries" - -msgid "MEN_CHECK_FREE_BNDS" -msgstr "Check Free Boundaries" - -msgid "STB_CHECK_FREE_BNDS" -msgstr "Check free boundaries" - -msgid "TOP_CHECK_FREE_FACES" -msgstr "Check free faces" - -msgid "MEN_CHECK_FREE_FACES" -msgstr "Check Free Faces" - -msgid "STB_CHECK_FREE_FACES" -msgstr "Check free faces" - -msgid "TOP_CHANGE_ORIENTATION" -msgstr "Change orientation" - -msgid "MEN_CHANGE_ORIENTATION" -msgstr "Change Orientation" - -msgid "STB_CHANGE_ORIENTATION" -msgstr "Change orientation" - -msgid "TOP_REMOVE_EXTRA_EDGES" -msgstr "Remove extra edges" - -msgid "MEN_REMOVE_EXTRA_EDGES" -msgstr "Remove Extra Edges" - -msgid "STB_REMOVE_EXTRA_EDGES" -msgstr "Remove extra edges" - -msgid "MEN_MEASURES" -msgstr "Measures" - -msgid "TOP_POINT_COORDS" -msgstr "Point coordinates" - -msgid "MEN_POINT_COORDS" -msgstr "Point Coordinates" - -msgid "STB_POINT_COORDS" -msgstr "Point coordinates" - -msgid "TOP_BASIC_PROPS" -msgstr "Basic properties" - -msgid "MEN_BASIC_PROPS" -msgstr "Basic Properties" - -msgid "STB_BASIC_PROPS" -msgstr "Basic properties" - -msgid "TOP_MASS_CENTER" -msgstr "Compute center of mass" - -msgid "MEN_MASS_CENTER" -msgstr "Center of Mass" - -msgid "STB_MASS_CENTER" -msgstr "Compute center of mass" - -msgid "TOP_NORMALE" -msgstr "Compute normal to a face" - -msgid "MEN_NORMALE" -msgstr "Normal to a Face" - -msgid "STB_NORMALE" -msgstr "Compute normal to a face in a point (optional)" - -msgid "TOP_INERTIA" -msgstr "Compute intertia" - -msgid "MEN_INERTIA" -msgstr "Inertia" - -msgid "STB_INERTIA" -msgstr "Compute intertia" - -msgid "MEN_DIMENSIONS" -msgstr "Dimensions" - -msgid "TOP_BND_BOX" -msgstr "Compute bounding box" - -msgid "MEN_BND_BOX" -msgstr "Bounding Box" - -msgid "STB_BND_BOX" -msgstr "Compute bounding box" - -msgid "TOP_MIN_DIST" -msgstr "Compute minimum distance" - -msgid "MEN_MIN_DIST" -msgstr "Min Distance" - -msgid "STB_MIN_DIST" -msgstr "Compute minimum distance" - -msgid "TOP_MEASURE_ANGLE" -msgstr "Compute angle" - -msgid "MEN_MEASURE_ANGLE" -msgstr "Angle" - -msgid "STB_MEASURE_ANGLE" -msgstr "Compute angle between two lines or linear edges" - -msgid "TOP_TOLERANCE" -msgstr "Compute tolerance" - -msgid "MEN_TOLERANCE" -msgstr "Compute Tolerance" - -msgid "STB_TOLERANCE" -msgstr "Compute tolerance" - -msgid "TOP_WHAT_IS" -msgstr "What is" - -msgid "MEN_WHAT_IS" -msgstr "What is" - -msgid "STB_WHAT_IS" -msgstr "What is" - -msgid "TOP_CHECK" -msgstr "Check" - -msgid "MEN_CHECK" -msgstr "Check" - -msgid "STB_CHECK" -msgstr "Check" - -msgid "TOP_CHECK_COMPOUND" -msgstr "Check compound of blocks" - -msgid "MEN_CHECK_COMPOUND" -msgstr "Check Compound of Blocks" - -msgid "STB_CHECK_COMPOUND" -msgstr "Check compound of blocks" - -msgid "MEN_TOOLS" -msgstr "Tools" - -msgid "TOP_CHECK_GEOMETRY" -msgstr "Check Geometry" - -msgid "MEN_CHECK_GEOMETRY" -msgstr "Check Geometry" - -msgid "STB_CHECK_GEOMETRY" -msgstr "Check Geometry" - -msgid "MEN_PREFERENCES" -msgstr "Preferences" - -msgid "MEN_PREFERENCES_GEOM" -msgstr "Geometry" - -msgid "TOP_SHADING_COLOR" -msgstr "Set shading color" - -msgid "MEN_SHADING_COLOR" -msgstr "Shading Color" - -msgid "STB_SHADING_COLOR" -msgstr "Set shading color" - -msgid "TOP_ISOS" -msgstr "Set number of isolines" - -msgid "MEN_ISOS" -msgstr "Isos" - -msgid "STB_ISOS" -msgstr "Set number of isolines" - -msgid "TOP_STEP_VALUE" -msgstr "Set step value" - -msgid "MEN_STEP_VALUE" -msgstr "Step Value" - -msgid "STB_STEP_VALUE" -msgstr "Set step value" - -msgid "MEN_VIEW" -msgstr "View" - -msgid "MEN_DISPLAY_MODE" -msgstr "Display Mode" - -msgid "TOP_SHADING" -msgstr "Shading" - -msgid "MEN_SHADING" -msgstr "Shading" - -msgid "MEN_WIREFRAME" -msgstr "Wireframe" - -msgid "STB_SHADING" -msgstr "Shading" - -msgid "TOP_DISPLAY_ALL" -msgstr "Show all" - -msgid "MEN_DISPLAY_ALL" -msgstr "Show All" - -msgid "STB_DISPLAY_ALL" -msgstr "Show all" - -msgid "TOP_ERASE_ALL" -msgstr "Hide all" - -msgid "MEN_ERASE_ALL" -msgstr "Hide All" - -msgid "STB_ERASE_ALL" -msgstr "Hide all" - -msgid "TOP_DISPLAY" -msgstr "Show" - -msgid "MEN_DISPLAY" -msgstr "Show" - -msgid "STB_DISPLAY" -msgstr "Show object(s)" - -msgid "TOP_DISPLAY_ONLY" -msgstr "Show only" - -msgid "MEN_DISPLAY_ONLY" -msgstr "Show Only" - -msgid "STB_DISPLAY_ONLY" -msgstr "Show only" - -msgid "TOP_ERASE" -msgstr "Hide" - -msgid "MEN_ERASE" -msgstr "Hide" - -msgid "STB_ERASE" -msgstr "Hide object(s)" - -msgid "TOP_POP_RENAME" -msgstr "Rename" - -msgid "MEN_POP_RENAME" -msgstr "Rename" - -msgid "STB_POP_RENAME" -msgstr "Rename" - -msgid "TOP_POP_WIREFRAME" -msgstr "Wireframe" - -msgid "MEN_POP_WIREFRAME" -msgstr "Wireframe" - -msgid "STB_POP_WIREFRAME" -msgstr "Wireframe" - -msgid "TOP_POP_SHADING" -msgstr "Shading" - -msgid "MEN_POP_SHADING" -msgstr "Shading" - -msgid "STB_POP_SHADING" -msgstr "Shading" - -msgid "TOP_POP_AUTO_COLOR" -msgstr "Auto color" - -msgid "MEN_POP_AUTO_COLOR" -msgstr "Auto Color" - -msgid "STB_POP_AUTO_COLOR" -msgstr "Auto color" - -msgid "TOP_POP_DISABLE_AUTO_COLOR" -msgstr "Disable auto color" - -msgid "MEN_POP_DISABLE_AUTO_COLOR" -msgstr "Disable Auto Color" - -msgid "STB_POP_DISABLE_AUTO_COLOR" -msgstr "Disable auto color" - -msgid "TOP_POP_COLOR" -msgstr "Color" - -msgid "MEN_POP_COLOR" -msgstr "Color" - -msgid "STB_POP_COLOR" -msgstr "Color" - -msgid "TOP_POP_TRANSPARENCY" -msgstr "Transparency" - -msgid "MEN_POP_TRANSPARENCY" -msgstr "Transparency" - -msgid "STB_POP_TRANSPARENCY" -msgstr "Transparency" - -msgid "TOP_POP_ISOS" -msgstr "Isolines" - -msgid "MEN_POP_ISOS" -msgstr "Isos" - -msgid "STB_POP_ISOS" -msgstr "Isolines" - -msgid "TOP_POP_CREATE_GROUP" -msgstr "Create Group" - -msgid "MEN_POP_CREATE_GROUP" -msgstr "Create Group" - -msgid "STB_POP_CREATE_GROUP" -msgstr "Create Group" - -msgid "TOOL_BASIC" -msgstr "Basic" - -msgid "TOOL_PRIMITIVES" -msgstr "Primitives" - -msgid "TOOL_BOOLEAN" -msgstr "Boolean Operations" - -msgid "TOOL_GENERATION" -msgstr "Generation" - -msgid "TOOL_TRANSFORMATION" -msgstr "Transformation" - -msgid "TLT_RENAME" -msgstr "Rename" - -msgid "NAME_LBL" -msgstr "Name: " - -msgid "GEOM_RESULT_NAME_GRP" -msgstr "Result name" - -msgid "GEOM_RESULT_NAME_LBL" -msgstr "Name" - -msgid "GEOM_ERR_GET_ENGINE" -msgstr "Failed to obtain GEOM Engine component. Reload Geometry module and try again." - -msgid "PREF_GROUP_OCCVIEWER" -msgstr "OCC Viewer 3d" - -msgid "PREF_GROUP_GENERAL" -msgstr "General" - -msgid "PREF_GROUP_VERTEX" -msgstr "Marker of Points" - -msgid "PREF_SHADING_COLOR" -msgstr "Default shading color" - -msgid "PREF_WIREFRAME_COLOR" -msgstr "Default wireframe color" - -msgid "PREF_FREE_BOUND_COLOR" -msgstr "Color of free boundaries" - -msgid "PREF_LINE_COLOR" -msgstr "Color of edges, vectors, wires" - -msgid "PREF_POINT_COLOR" -msgstr "Color of points" - -msgid "PREF_ISOS_COLOR" -msgstr "Color of isolines" - -msgid "PREF_STEP_VALUE" -msgstr "Step value for spin boxes" - -msgid "PREF_DISPLAY_MODE" -msgstr "Default display mode" - -msgid "PREF_TAB_SETTINGS" -msgstr "Settings" - -msgid "PREF_TYPE_OF_MARKER" -msgstr "Type" - -msgid "PREF_MARKER_SCALE" -msgstr "Size" - -msgid "TOM_POINT" -msgstr "." - -msgid "TOM_PLUS" -msgstr "+" - -msgid "TOM_STAR" -msgstr "*" - -msgid "TOM_O" -msgstr "O" - -msgid "TOM_X" -msgstr "X" - -msgid "TOM_O_POINT" -msgstr ". in O" - -msgid "TOM_O_PLUS" -msgstr "+ in O" - -msgid "TOM_O_STAR" -msgstr "* in O" - -msgid "TOM_O_X" -msgstr "X in O" - -msgid "ERROR_SHAPE_TYPE" -msgstr "Object of incorrect type selected!\nPlease, select face, shell or solid and try again" - -msgid "DEP_OBJECT" -msgstr "Selected object has been used to create another one\n It can't be deleted " - -msgid "MEN_SELECT_ONLY" -msgstr "Select Only" - -msgid "STB_VERTEX_SEL_ONLY" -msgstr "Select only a Points" - -msgid "STB_EDGE_SEL_ONLY" -msgstr "Select only a Edges" - -msgid "STB_WIRE_SEL_ONLY" -msgstr "Select only a Wires" - -msgid "STB_FACE_SEL_ONLY" -msgstr "Select only a Faces" - -msgid "STB_SHELL_SEL_ONLY" -msgstr "Select only a Shells" - -msgid "STB_SOLID_SEL_ONLY" -msgstr "Select only a Solids" - -msgid "STB_COMPOUND_SEL_ONLY" -msgstr "Select only a Compounds" - -msgid "STB_ALL_SEL_ONLY" -msgstr "Select all Objects" - -msgid "MEN_VERTEX_SEL_ONLY" -msgstr "Vertex" - -msgid "MEN_EDGE_SEL_ONLY" -msgstr "Edge" - -msgid "MEN_WIRE_SEL_ONLY" -msgstr "Wire" - -msgid "MEN_FACE_SEL_ONLY" -msgstr "Face" - -msgid "MEN_SHELL_SEL_ONLY" -msgstr "Shell" - -msgid "MEN_SOLID_SEL_ONLY" -msgstr "Solid" - -msgid "MEN_COMPOUND_SEL_ONLY" -msgstr "Compound" - -msgid "MEN_ALL_SEL_ONLY" -msgstr "Select All" - - - - - - - diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 15ac7e838..cf4c13db2 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -1,4141 +1,5548 @@ + - - - - @default - - CHANGE_ORIENTATION_NEW_OBJ_NAME - Invert - - - CLOSE_CONTOUR_NEW_OBJ_NAME - CloseContour - - - DEP_OBJECT - Selected object has been used to create another one. -It can't be deleted - - - DEVIDE_EDGE_NEW_OBJECT_NAME - NewObject - - - ERROR_SHAPE_TYPE - Object of incorrect type selected! + + + @default + + BRep_API: command not done + Error: can't build object + + + CHANGE_ORIENTATION_NEW_OBJ_NAME + Invert + + + EDGE_WIDTH_TLT + Select Edge Width + + + ISOS_WIDTH_TLT + Select Isos Width + + + CLOSE_CONTOUR_NEW_OBJ_NAME + CloseContour + + + DEP_OBJECT + Selected object has been used to create another one. +It can't be deleted + + + DEVIDE_EDGE_NEW_OBJECT_NAME + NewObject + + + ERROR_SHAPE_TYPE + Object of incorrect type selected! Please, select face, shell or solid and try again - - - iErr : 10 - the Classifier is NULL - - - iErr : 11 - the Shape is NULL - - - iErr : 12 - Unallowed Type of Subshape - - - iErr : 13 - Unallowed State - - - iErr : 15 - Unallowed Surface Type - - - iErr : 20 - Triangulation is not Found - - - iErr : 30 - Can not Obtain the Line From the Link - - - iErr : 40 - A Point Can Not Be Classified - - - iErr : 41 - Invalid Data for Classifier - - - GEOM_2D_CONTINUTY - 2D continuity - - - GEOM_2D_CURVE_MODE - 2D curve mode - - - GEOM_2D_TOLERANCE - 2D tolerance - - - GEOM_3D_CONTINUTY - 3D continuity - - - GEOM_3D_CURVE_MODE - 3D curve mode - - - GEOM_3D_TOLERANCE - 3D tolerance - - - GEOM_3_POINTS - 3 points - - - GEOM_ADD_POINT - Add point - - - GEOM_ANGLE - Angle : - - - GEOM_ANGLE_1 - Angle - - - GEOM_ARC - Arc - - - GEOM_ARCHIMEDE - Archimede - - - GEOM_ARCHIMEDE_TITLE - Archimede Construction - - - GEOM_ARC_TITLE - Arc Construction - - - GEOM_ARGUMENTS - Arguments - - - GEOM_AXE_MIRROR - Axe Mirror - - - GEOM_AXIS - Axis - - - GEOM_BASE - Base - - - GEOM_BASE_OBJECT - Base Object - - - GEOM_BASE_POINT - Base Point - - - GEOM_BEZIER - Bezier - - - GEOM_BINORMAL - BiNormal - - - GEOM_BLOCK - Hexahedral Solid - - - GEOM_BLOCKS_COMPOUND - BlocksCompound - - - GEOM_BLOCK_EXPLODE - Sub Blocks - - - GEOM_BLOCK_EXPLODE_TITLE - Sub Blocks Selection - - - GEOM_BLOCK_MULTITRSF - Block Multi-Transformation - - - GEOM_BLOCK_MULTITRSF_DOUBLE - Multi-Transformation Double - - - GEOM_BLOCK_MULTITRSF_SIMPLE - Multi-Transformation Simple - - - GEOM_BLOCK_MULTITRSF_TITLE - Block Multi-Transformation - - - GEOM_BLOCK_TITLE - Hexahedral Solid Construction - - - GEOM_BNDBOX - Bounding Box - - - GEOM_BNDBOX_OBJDIM - Object And Its Dimensions - - - GEOM_BNDBOX_TITLE - Bounding Box Informations - - - GEOM_BOX - Box - - - GEOM_BOX_OBJ - Dimensions At Origin - - - GEOM_BOX_TITLE - Box Construction - - - GEOM_BSplineRestriction - BSplineRestriction - - - GEOM_BUT_APPLY - &Apply - - - GEOM_BUT_CANCEL - &Cancel - - - GEOM_BUT_CLOSE - &Close - - - GEOM_BUT_CLOSE_SKETCH - Sketch Closure - - - GEOM_BUT_END_SKETCH - Sketch Validation - - - GEOM_BUT_EXPLODE - &Explode - - - GEOM_BUT_HELP - &Help - - - GEOM_BUT_NO - &No - - - GEOM_BUT_OK - O&k - - - GEOM_BUT_APPLY_AND_CLOSE - A&pply and Close - - - GEOM_BUT_YES - &Yes - - - GEOM_BY_LENGTH - By length - - - GEOM_BY_PARAMETER - By parameter - - - GEOM_CENTER - Center - - - GEOM_CENTER_POINT - Center Point - - - GEOM_CENTRAL_POINT - Central Point - - - GEOM_CHAMFER - Chamfer - - - GEOM_CHAMFER_ABORT - Chamfer can't be computed with %1 and %2 - - - GEOM_CHAMFER_ALL - Chamfer On Whole Shape - - - GEOM_CHAMFER_EDGES - Chamfer On Edges From Shape - - - GEOM_CHAMFER_FACES - Chamfer On Faces From Shape - - - GEOM_CHAMFER_TITLE - Chamfer Construction - - - GEOM_CHANGE_ORIENTATION - Objects to change orientation - - - GEOM_CHANGE_ORIENTATION_TITLE - Change orientation - - - GEOM_CHECK_BLOCKS_COMPOUND - Check and Improve Blocks Compound - - - GEOM_CHECK_BLOCKS_COMPOUND_ERRORS - Errors - - - GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS - The Compound of Blocks has errors - - - GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS - The Compound of Blocks has no errors - - - GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES - Incriminated Sub-Shapes - - - GEOM_CHECK_INFOS - Object And Its Topological Information - - - GEOM_CHECK_SHAPE - Check Shape - - - GEOM_CHECK_TITLE - Check Shape Information - - - GEOM_CIRCLE - Circle - - - GEOM_CIRCLE_TITLE - Circle Construction - - - GEOM_CLOSECONTOUR_TITLE - Close contour - - - GEOM_CMASS - Center Of Mass - - - GEOM_CMASS_TITLE - Center Of Mass Construction - - - GEOM_COMMON - Common - - - GEOM_COMMON_TITLE - Common Of Two Objects - - - GEOM_COMPOUND - Compound - - - GEOM_COMPOUNDSOLID - CompSolid - - - GEOM_COMPOUND_TITLE - Create A Compound - - - GEOM_CONE - Cone - - - GEOM_CONE_TITLE - Cone Construction - - - GEOM_CONFIRM - Confirm operation - - - GEOM_CONFIRM_INFO - Shape contains %1 sub shapes ! - - - GEOM_COOR - Coord. : - - - GEOM_COORDINATES - Coordinates - - - GEOM_CREATE_COPY - Create a copy - - - GEOM_CREATE_SINGLE_SOLID - Create a single solid - - - GEOM_CURVE - Curve - - - GEOM_CURVE_CONTINUTY - Curve continuity - - - GEOM_CURVE_TITLE - Curve Construction - - - GEOM_CUT - Cut - - - GEOM_CUT_TITLE - Cut Of Two Objects - - - GEOM_CYLINDER - Cylinder - - - GEOM_CYLINDER_TITLE - Cylinder Construction - - - GEOM_D1 - D1 : - - - GEOM_D2 - D2 : - - - GEOM_DETECT - Detect - - - GEOM_DIAGONAL_POINTS - Diagonal Points - - - GEOM_DISK - Disk - - - GEOM_DISK_TITLE - Create A Disk - - - GEOM_DIMENSIONS - Dimensions - - - GEOM_DISTANCE - Distance - - - GEOM_DIVIDE_EDGE_TITLE - Addition of point - - - GEOM_DX - Dx : - - - GEOM_DY - Dy : - - - GEOM_DZ - Dz : - - - GEOM_DropSmallEdges - DropSmallEdges - - - GEOM_EDGE - Edge - - - GEOM_EDGE_TITLE - Create An Edge - - - GEOM_ELLIPSE - Ellipse - - - GEOM_ELLIPSE_ERROR_1 - Error creating ellipse. Reason: minor radius is greater than major radius. - - - GEOM_ELLIPSE_TITLE - Ellipse Construction - - - GEOM_END_LCS - End LCS - - - GEOM_ERROR - Error - - - GEOM_ERROR_STATUS - Operation status - - - GEOM_ERR_GET_ENGINE - Failed to obtain GEOM Engine component. Reload Geometry module and try again. - - - GEOM_ERR_LIB_NOT_FOUND - GUI library corresponding to the user action can not be found or loaded - - - GEOM_EXTRUSION - Extrusion - - - GEOM_EXTRUSION_BSV - Base Shape + Vector - - - GEOM_EXTRUSION_BSV_2P - Base Shape + 2 Points - - - GEOM_EXTRUSION_DXDYDZ - Base Shape + DX DY DZ Vector - - - GEOM_EXTRUSION_TITLE - Construction by Extrusion - - - GEOM_FACE - Face - - - GEOM_LCS - Local coordinate system - - - GEOM_FACES - Faces - - - GEOM_FACE_FFW - Face creation from wires and/or edges - - - GEOM_FACE_OPT - Try to create a planar face - - - GEOM_FACE_OR_LCS - Face or LCS - - - GEOM_FACE_SELECTION - Face Selection - - - GEOM_FACE_TITLE - Create A Face - - - GEOM_FILLET - Fillet - - - GEOM_FILLET_2D - Fillet 2D - - - GEOM_FILLET_ABORT - Fillet can't be computed with radius %1 - - - GEOM_FILLET_ALL - Fillet On Whole Shape - - - GEOM_FILLET_EDGES - Fillet On Edges From Shape - - - GEOM_FILLET_FACES - Fillet On Faces From Shape - - - GEOM_FILLET_VERTEXES - Fillet On Vertexes From Face - - - GEOM_FILLET_TITLE - Fillet Construction - - - GEOM_FILLET_2D_TITLE - 2D Fillet Construction - - - GEOM_FILLING - Filling - - - GEOM_FILLING_ARG - Arguments And Parameters - - - GEOM_FILLING_COMPOUND - Edges compound - - - GEOM_FILLING_MAX_DEG - Max deg - - - GEOM_FILLING_MIN_DEG - Min deg - - - GEOM_FILLING_NB_ITER - Nb. Iter : - - - GEOM_FILLING_TITLE - Filling Surface With Edges - - - GEOM_FILLING_TOL_2D - Tol. 2D : - - - GEOM_FILLING_TOL_3D - Tol. 3D : - - - GEOM_FREE_BOUNDARIES - Free boundaries - - - GEOM_FREE_BOUNDS_ERROR - Object is not selected - - - GEOM_FREE_BOUNDS_MSG - Number of free boundaries detected: %1 (%2 closed, %3 open) - - - GEOM_FREE_BOUNDS_TLT - Free boundary detection - - - GEOM_FREE_FACES - Free faces - - - GEOM_FREE_FACES_TITLE - Free faces - - - GEOM_FUSE - Fuse - - - GEOM_FUSE_TITLE - Fuse Two Objects - - - GEOM_FixFaceSize - FixFaceSize - - - GEOM_FixShape - FixShape - - - GEOM_GLUE - Glue - - - GEOM_GLUE_TITLE - Glue faces - - - GEOM_HEIGHT - Height : - - - GEOM_HOLES - Holes - - - GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE - Identical names : select by mouse ! - - - GEOM_IMPORT - Imported_Shape - - - GEOM_INCORRECT_INPUT - Some parameters are missing - - - GEOM_INERTIA_CONSTR - Matrix And Moments Of Inertia - - - GEOM_INERTIA_I - %1:1 : - - - GEOM_INERTIA_IXYZ - IX & IY & IZ : - - - GEOM_INERTIA_TITLE - Calculs Of Inertia - - - GEOM_INF_LOADED - File %1 loaded. - - - GEOM_INTERNAL_WIRES - Internal wires - - - GEOM_INTERPOL - Interpolation - - - GEOM_KEEP_OBJECT - Keep Object - - - GEOM_LENGTH - Length : - - - GEOM_LINE - Line - - - GEOM_LINE_TITLE - Line Construction - - - GEOM_MAIN_OBJECT - Main Object - - - GEOM_MARKER - Marker - - - GEOM_MARKER_TITLE - Create marker - - - GEOM_MATERIAL_ID - Material ID: - - - GEOM_MATERIAL_MATERIAL - Material - - - GEOM_MATERIAL_SET - << Set - - - GEOM_MATERIAL_SHAPE - Shapes - - - GEOM_MATERIAL_TITLE - Define materials for Dominant Fuse - - - GEOM_MATRIX - Matrix : - - - GEOM_MAX - Max : - - - GEOM_MAX_3D_TOLERANCE - Max 3D tolerance - - - GEOM_MAX_TOLERANCE - Max tolerance - - - GEOM_MEN_ALL_FILES - All Files ( * ) - - - GEOM_MEN_ANGLE - Angle : - - - GEOM_MEN_COMPONENT - Geometry - - - GEOM_MEN_ENTER_ANGLE - Enter An Angle In Degrees - - - GEOM_MEN_EXPORT - Export - - - GEOM_MEN_IMPORT - Import - - - GEOM_MEN_ISOS - Select Number Of Isos - - - GEOM_MEN_ISOU - Isos U : - - - GEOM_MEN_ISOV - Isos V : - - - GEOM_MEN_POPUP_NAME - %1 Objects - - - GEOM_MEN_SHADING - Shading - - - GEOM_MEN_SKETCHER_X - Enter a Length to Set X - - - GEOM_MEN_SKETCHER_Y - Enter a Length to Set Y - - - GEOM_MEN_STEP_LABEL - Step : - - - GEOM_MEN_TRANSPARENCY - Transparency - - - GEOM_MEN_TRANSPARENCY_LABEL - Transparency : - - - GEOM_MEN_WIREFRAME - Wireframe - - - GEOM_MEN_X - X : - - - GEOM_MEN_Y - Y : - - - GEOM_MESHING_DEFLECTION - Meshing Deflect. : - - - GEOM_MIN - Min : - - - GEOM_MINDIST_OBJ - Objects And Results - - - GEOM_MINDIST_TITLE - Minimun Distance Between Two Objects - - - GEOM_MIRROR - Mirror - - - GEOM_MIRROR_TITLE - Mirror An Object - - - GEOM_MULTIROTATION - Multi-Rotation - - - GEOM_MULTIROTATION_DOUBLE - Multi Rotation Double - - - GEOM_MULTIROTATION_SIMPLE - Multi Rotation Simple - - - GEOM_MULTIROTATION_TITLE - Multi-Rotation - - - GEOM_MULTITRANSLATION - Multi-Translation - - - GEOM_MULTITRANSLATION_DOUBLE - Multi Translation Double - - - GEOM_MULTITRANSLATION_SIMPLE - Multi Translation Simple - - - GEOM_MULTITRANSLATION_TITLE - Multi-Translation - - - GEOM_NAME_INCORRECT - Object name not found - - - GEOM_NB_BLOCKS_NO_OTHERS - There are %1 specified blocks and NO other solids - - - GEOM_NB_BLOCKS_SOME_OTHERS - There are %1 specified blocks and some other solids - - - GEOM_NB_TIMES - Nb. Times : - - - GEOM_NB_TIMES_U - Nb. Times U : - - - GEOM_NB_TIMES_V - Nb. Times V : - - - GEOM_NODES - Nodes - - - GEOM_NUM_SPLIT_POINTS - Number of splitting points - - - GEOM_OBJECT - Object - - - GEOM_OBJECT_TYPE - Object Type - - - GEOM_OBJECTS - Objects - - - GEOM_OBJECT_I - Object %1 - - - GEOM_OBJECT_RESULT - Object And Result - - - GEOM_OFFSET - Offset - - - GEOM_OFFSET_TITLE - Offset Surface - - - GEOM_OPERATIONS - Operations - - - GEOM_ORIENTATION - Orientation - - - GEOM_ORIENTATION_OPT - Reverse orientation with normal vectors simulation - - - GEOM_ORIENTATION_TITLE - Change Orientation - - - GEOM_PARAMETER - Parameter : - - - GEOM_PARAMETERS - Parameters - - - GEOM_PARAM_POINT - Parametric point - - - GEOM_PARTITION - Partition - - - GEOM_PARTITION_HALFSPACE - Half-space partition - - - GEOM_PARTITION_ORIENTATION - Change Orientation - - - GEOM_PARTITION_TITLE - Partition Of Object With Tool - - - GEOM_PATH_OBJECT - Path Object - - - GEOM_PIPE - Pipe - - - GEOM_PIPE_TITLE - Pipe Construction - - - GEOM_SELECT_UNPUBLISHED_EDGES - Select unpublished edges - - - GEOM_PLANE - Plane - - - GEOM_PLANE_MIRROR - Plane Mirror - - - GEOM_PLANE_PV - Point + Vector - - - GEOM_PLANE_PVC - Point + Coordinate Vector - - - GEOM_PLANE_SIZE - Size of plane : - - - GEOM_PLANE_TITLE - Plane Construction - - - GEOM_POINT - Point - - - GEOM_POINT1 - Point 1 - - - GEOM_POINT2 - Point 2 - - - GEOM_POINT3 - Point 3 - - - GEOM_POINTS - Points - - - GEOM_POINT_I - Point %1 - - - GEOM_POINT_MIRROR - Point Mirror - - - GEOM_POINT_TITLE - Point Construction - - - GEOM_POLYLINE - Polyline - - - GEOM_POSITION - Location - - - GEOM_POSITION_TITLE - Modify the Location of an Object - - - GEOM_PRECISION - Precision : - - - GEOM_PROPAGATE - Propagate - - - GEOM_PROPAGATE_TITLE - Propagate - - - GEOM_PROPERTIES - Basic Properties - - - GEOM_PROPERTIES_CONSTR - Object And Its Properties - - - GEOM_PROPERTIES_SURFACE - Surface is : - - - GEOM_PROPERTIES_TITLE - Basic Properties Informations - - - GEOM_PROPERTIES_VOLUME - Volume is : - - - GEOM_PRP_ABORT - Operation aborted - - - GEOM_PRP_COMMAND - No command associated with this id = %1. - - - GEOM_PRP_DONE - Operation done - - - GEOM_PRP_EXPORT - Exporting geometry to %1 ... - - - GEOM_PRP_LOADING - Loading %1 ... - - - GEOM_PRP_MIN_DIST - Min Distance not computed - - - GEOM_PRP_NOT_FOR_VTK_VIEWER - Not allowed in VTK viewer - - - GEOM_PRP_NULLSHAPE - Error, null or inappropriate shape ! - - - GEOM_PRP_READY - Ready - - - GEOM_PRP_SELECT_EDGE - Select edges and click on Apply - - - GEOM_PRP_SELECT_FACE - Select faces to suppress and click on Ok/Apply - - - GEOM_PRP_SELECT_FIRST - Select main shape first - - - GEOM_PRP_SELECT_SUBSHAPES - Select Sub Shapes - - - GEOM_PRP_SHAPE_IN_STUDY - Main shape must be in the study before - - - GEOM_QUAD_FACE - Quadrangle Face - - - GEOM_QUAD_FACE_TITLE - Quadrangle Face Construction - - - GEOM_RADIUS - Radius : - - - GEOM_RADIUS_I - Radius %1 : - - - GEOM_RADIUS_MAJOR - Major radius : - - - GEOM_RADIUS_MINOR - Minor radius : - - - GEOM_RECONSTRUCTION_LIMIT - Resulting Type - - - GEOM_RECONSTRUCTION_LIMIT_EDGE - Edge - - - GEOM_RECONSTRUCTION_LIMIT_FACE - Face - - - GEOM_RECONSTRUCTION_LIMIT_SHAPE - Shape - - - GEOM_RECONSTRUCTION_LIMIT_SHELL - Shell - - - GEOM_RECONSTRUCTION_LIMIT_SOLID - Solid - - - GEOM_RECONSTRUCTION_LIMIT_VERTEX - Vertex - - - GEOM_RECONSTRUCTION_LIMIT_WIRE - Wire - - - GEOM_REF_POINT - Point with reference - - - GEOM_REMOVE_ALL_HOLES - Remove all holes - - - GEOM_REMOVE_ALL_INT_WIRES - Remove all internal wires - - - GEOM_REMOVE_HOLES_TITLE - Suppress holes - - - GEOM_REMOVE_INTERNAL_WIRES_TITLE - Suppress internal wires - - - GEOM_REMOVE_WEBS - Remove webs - - - GEOM_REQUIRED_DEGREE - Required degree - - - GEOM_REQUIRED_NUM_SEGMENTS - Required number of segments - - - GEOM_REVERSE - Reverse - - - GEOM_REVERSE_DIRECTION - Reverse Direction - - - GEOM_REVERSE_PLANE - Reverse the plane normal - - - GEOM_REVERSE_U - Reverse U - - - GEOM_REVERSE_V - Reverse V - - - GEOM_REVERSE_VECTOR - Reverse Vector - - - GEOM_REVOLUTION - Revolution - - - GEOM_REVOLUTION_TITLE - Construction By Revolution - - - GEOM_ROTATION - Rotation - - - GEOM_ROTATION_TITLE - Rotation Of An Object - - - GEOM_SCALE - Scale - - - GEOM_SCALE_FACTOR - Scale Factor : - - - GEOM_SCALE_TITLE - Scale An Object - - - GEOM_SECTION - Section - - - GEOM_SECTION_TITLE - Section Of Two Objects - - - GEOM_SELECTED_FACE - Selected face - - - GEOM_SELECTED_OBJECTS - Selected objects - - - GEOM_SELECTED_SHAPE - Selected shape - - - GEOM_SELECTION - Selection - - - GEOM_SET_MATERIALS - Set materials - - - GEOM_SEWING - Sewing - - - GEOM_SEWING_TITLE - Topological sewing - - - GEOM_SHAPE - Shape - - - GEOM_SHAPEPROCESS_TITLE - Shape Processing - - - GEOM_SHAPES - Shapes - - - GEOM_SHELL - Shell - - - GEOM_SHELLS - Shells - - - GEOM_SHELL_TITLE - Shell Construction - - - GEOM_SKETCHER_ABS - Absolute - - - GEOM_SKETCHER_ANGLE - Angle - - - GEOM_SKETCHER_ANGLE2 - Angle : - - - GEOM_SKETCHER_APPLY - Apply - - - GEOM_SKETCHER_ARC - Arc - - - GEOM_SKETCHER_DEST - Destination - - - GEOM_SKETCHER_DIR - Direction - - - GEOM_SKETCHER_DX2 - DX : - - - GEOM_SKETCHER_DY2 - DY : - - - GEOM_SKETCHER_DZ2 - DZ : - - - GEOM_SKETCHER_EL - Element Type - - - GEOM_SKETCHER_LENGTH - Length - - - GEOM_SKETCHER_LENGTH2 - Length : - - - GEOM_SKETCHER_PER - Perpendicular - - - GEOM_SKETCHER_POINT - Point - - - GEOM_SKETCHER_POINT2 - Point : - - - GEOM_SKETCHER_RADIUS2 - Radius : - - - GEOM_SKETCHER_REL - Relative - - - GEOM_SKETCHER_SEGMENT - Segment - - - GEOM_SKETCHER_SEL - Selection - - - GEOM_SKETCHER_TAN - Tangent - - - GEOM_SKETCHER_TITLE - Sketch Construction - - - GEOM_3DSKETCHER_TITLE - 3D Sketch Construction - - - GEOM_SKETCHER_TYPE - Type - - - GEOM_SKETCHER_UNDO - Undo - - - GEOM_SKETCHER_VALUES - Values - - - GEOM_SKETCHER_VX2 - VX : - - - GEOM_SKETCHER_VXVY - VX-VY - - - GEOM_SKETCHER_VY2 - VY : - - - GEOM_SKETCHER_X - X - - - GEOM_SKETCHER_X2 - X : - - - GEOM_SKETCHER_X3 - Abs. X : - - - GEOM_SKETCHER_Y - Y - - - GEOM_SKETCHER_Y2 - Y : - - - GEOM_SKETCHER_Y3 - Abs. Y : - - - GEOM_SKETCHER_Z2 - Z : - - - GEOM_3DSKETCHER - 3D Sketcher - - - GEOM_COORDINATES_TYPE - Coordinates Type - - - GEOM_SOLID - Solid - - - GEOM_SOLID_TITLE - Solid Construction - - - GEOM_SPHERE - Sphere - - - GEOM_SPHERE_CR - Center + Radius - - - GEOM_SPHERE_RO - Radius At Origin - - - GEOM_SPHERE_TITLE - Sphere Construction - - - GEOM_SPLINE - Spline - - - GEOM_SPLINE_TITLE - Spline Construction - - - GEOM_START_LCS - Start LCS - - - SELECT_UNPUBLISHED_EDGES - Select unpublished edges - - - GEOM_STEP - Step : - - - GEOM_STEP_TITLE - Step value for GUI constructions - - - GEOM_STEP_U - Step U : - - - GEOM_STEP_V - Step V : - - - GEOM_STUDY_LOCKED - The active study is locked and therefore cannot be modified - - - GEOM_SUBSHAPE_SELECT - Select Sub Shapes - - - GEOM_SUBSHAPE_TITLE - Sub Shapes Selection - - - GEOM_SUBSHAPE_TYPE - Sub Shapes Type : - - - GEOM_SUB_SHAPE - Sub Shapes - - - GEOM_SUPPRESSHOLE_FACE_SHELL - Face or shell - - - GEOM_SUPPRESSHOLE_SELECTFACE - Select the face with hole - - - GEOM_SUPPRESSHOLE_SELECTFACE_END - Select end face (if hole traversing) - - - GEOM_SUPPRESSHOLE_SELECTWIRE - Select wire on face - - - GEOM_SUPPRESSHOLE_SELECTWIRE_END - Select end wire (if hole traversing) - - - GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE - Select hole(s) on the face - - - GEOM_SUPPRESSHOLE_TITLE - Suppress holes - - - GEOM_SUPPRESS_RESULT - Suppress Result - - - GEOM_SUPPRESS_RESULT_INSIDE - Inside - - - GEOM_SUPPRESS_RESULT_OUTSIDE - Outside - - - GEOM_SUPRESSFACE - Supress Face - - - GEOM_SUPRESSFACE_SELECT - Select Faces To Suppress - - - GEOM_SUPRESSFACE_TITLE - Suppress Faces In An Object - - - GEOM_SURFACE_CONTINUTY - Surface continuity - - - GEOM_SURFACE_MODE - Surface mode - - - GEOM_SURFCONE - Conical Face - - - GEOM_SURFCYLINDER - Cylindrical Face - - - GEOM_SURFSPHERE - Spherical Face - - - GEOM_SURFTORUS - Toroidal Face - - - GEOM_SameParameter - SameParameter - - - GEOM_SplitAngle - SplitAngle - - - GEOM_SplitClosedFaces - SplitClosedFaces - - - GEOM_SplitContinuity - SplitContinuity - - - GEOM_TOLERANCE - Tolerance - - - GEOM_TOLERANCE_CONSTR - Object And Its Tolerances - - - GEOM_TOLERANCE_EDGE - Edge : - - - GEOM_TOLERANCE_FACE - Face : - - - GEOM_TOLERANCE_TITLE - Maximum Tolerance - - - GEOM_TOLERANCE_VERTEX - Vertex : - - - GEOM_TOOL_OBJECT - Tool Object - - - GEOM_TORUS - Torus - - - GEOM_TORUS_TITLE - Torus Construction - - - GEOM_TRANSLATION - Translation - - - GEOM_TRANSLATION_COOR - Translation With Coordinates - - - GEOM_TRANSLATION_TITLE - Translation Of An Object - - - GEOM_TRANSPARENCY_OPAQUE - Opaque - - - GEOM_TRANSPARENCY_TITLE - Transparency - - - GEOM_TRANSPARENCY_TRANSPARENT - Transparent - - - GEOM_TRIHEDRON - Trihedron - - - GEOM_ToBezier - ToBezier - - - GEOM_VALUE - Value - - - GEOM_VECTOR - Vector - - - GEOM_VECTOR_LENGTH - Vector Length : - - - GEOM_VECTOR_TITLE - Vector Construction - - - GEOM_VECTOR_U - Vector U - - - GEOM_VECTOR_V - Vector V - - - GEOM_VERTEX - Vertex - - - GEOM_VERTEXES - Vertexes - - - GEOM_WATER_DENSITY - Water Density : - - - GEOM_WEIGHT - Weight : - - - GEOM_WIDTH - Width : - - - GEOM_WHATIS - Whatis - - - GEOM_WHATIS_OBJECT - Object And Its Topological Informations - - - GEOM_WHATIS_TITLE - Whatis Informations - - - GEOM_WIRE - Wire - - - GEOM_WIRES - Wire(s) - - - GEOM_WIRES_TO_REMOVE - Wires to remove - - - GEOM_WIREZ - Wires - - - GEOM_WIRE_CONNECT - Wire creation from wires/edges connected - - - GEOM_WIRE_TITLE - Create A Wire - - - GEOM_WPLANE - Working Plane - - - GEOM_WPLANE_FACE - Plane, Planar Face or LCS - - - GEOM_WPLANE_ORIGIN - Select a plane - - - GEOM_WPLANE_OXY - OXY - - - GEOM_WPLANE_OYZ - OYZ - - - GEOM_WPLANE_OZX - OZX - - - GEOM_WPLANE_TITLE - Working Plane Selection - - - GEOM_WPLANE_VECTOR - Select 2 vectors - - - GEOM_WPLANE_VX - Vector X - - - GEOM_WPLANE_VZ - Vector Z - - - GEOM_WRN_RADIUS_NULL - Radius is null - - - GEOM_WRN_WARNING - Warning - - - WRN_SHAPE_UNCLOSED - Unable to create solid from unclosed shape %1 - - - GEOM_X - X : - - - GEOM_Y - Y : - - - GEOM_Z - Z : - - - GLUE_NEW_OBJ_NAME - Glue - - - MEN_ALL_SEL_ONLY - Select All - - - MEN_ARC - Arc - - - MEN_ARCHIMEDE - Archimede - - - MEN_BASIC - Basic - - - MEN_BASIC_PROPS - Basic Properties - - - MEN_BLOCKS - Blocks - - - MEN_BND_BOX - Bounding Box - - - MEN_BOOLEAN - Boolean - - - MEN_BOX - Box - - - MEN_BUILD - Build - - - MEN_CHAMFER - Chamfer - - - MEN_CHANGE_ORIENTATION - Change Orientation - - - MEN_CHECK - Check - - - MEN_CHECK_COMPOUND - Check Compound of Blocks - - - MEN_CHECK_FREE_BNDS - Check Free Boundaries - - - MEN_CHECK_FREE_FACES - Check Free Faces - - - MEN_CHECK_GEOMETRY - Check Geometry - - - MEN_CIRCLE - Circle - - - MEN_CLIPPING - Clipping Range - - - MEN_CLOSE_CONTOUR - Close Contour - - - MEN_COMMON - Common - - - MEN_COMPOUND - Compound - - - MEN_COMPOUND_SEL_ONLY - Compound - - - MEN_CONE - Cone - - - MEN_CURVE - Curve - - - MEN_CUT - Cut - - - MEN_CYLINDER - Cylinder - - - MEN_DELETE - Delete - - - MEN_DIMENSIONS - Dimensions - - - MEN_DISPLAY - Show - - - MEN_DISK - Disk - - - MEN_DISPLAY_ALL - Show All - - - MEN_DISPLAY_MODE - Display Mode - - - MEN_DISPLAY_ONLY - Show Only - - - MEN_EDGE - Edge - - - MEN_EDGE_SEL_ONLY - Edge - - - MEN_EDIT - Edit - - - MEN_ELLIPSE - Ellipse - - - MEN_ERASE - Hide - - - MEN_ERASE_ALL - Hide All - - - MEN_EXPLODE - Explode - - - MEN_EXPLODE_BLOCKS - Explode on Blocks - - - MEN_EXPORT - Export... - - - MEN_EXTRUSION - Extrusion - - - MEN_FACE - Face - - - MEN_FACE_SEL_ONLY - Face - - - MEN_FILE - File - - - MEN_FILLET - Fillet - - - MEN_FILLET_2D - Fillet 2D - - - MEN_FILLING - Filling - - - MEN_FUSE - Fuse - - - MEN_GENERATION - Generation - - - MEN_GLUE_FACES - Glue Faces - - - MEN_GROUP - Group - - - MEN_GROUP_CREATE - Create - - - MEN_GROUP_EDIT - Edit - - - MEN_RELOAD_IMPORTED - Reload From Disk - - - MEN_HEX_SOLID - Hexahedral Solid - - - MEN_IMPORT - Import... - - - MEN_INERTIA - Inertia - - - MEN_ISOS - Isos - - - MEN_LINE - Line - - - MEN_LOCAL_CS - Local Coordinate System - - - MEN_MASS_CENTER - Center of Mass - - - MEN_MEASURES - Measures - - - MEN_MIN_DIST - Min Distance - - - MEN_MIRROR - Mirror Image - - - MEN_MODIFY_LOCATION - Modify the Location - - - MEN_MUL_ROTATION - Multi-Rotation - - - MEN_MUL_TRANSFORM - Multi-Transformation - - - MEN_MUL_TRANSLATION - Multi-Translation - - - MEN_NEW_ENTITY - New Entity - - - MEN_OFFSET - Offset Surface - - - MEN_OPERATIONS - Operations - - - MEN_PARTITION - Partition - - - MEN_PIPE - Extrusion Along a Path - - - MEN_PLANE - Plane - - - MEN_POINT - Point - - - MEN_POINT_COORDS - Point Coordinates - - - MEN_POINT_ON_EDGE - Add Point on Edge - - - MEN_POP_COLOR - Color - - - MEN_POP_CREATE_GROUP - Create Group - - - MEN_POP_ISOS - Isos - - - MEN_POP_RENAME - Rename - - - MEN_POP_SHADING - Shading - - - MEN_POP_TRANSPARENCY - Transparency - - - MEN_POP_WIREFRAME - Wireframe - - - MEN_PREFERENCES - Preferences - - - MEN_PREFERENCES_GEOM - Geometry - - - MEN_PRIMITIVES - Primitives - - - MEN_PROPAGATE - Propagate - - - MEN_Q_FACE - Quadrangle Face - - - MEN_REPAIR - Repair - - - MEN_REVOLUTION - Revolution - - - MEN_ROTATION - Rotation - - - MEN_SCALE - Scale Transform - - - MEN_SECTION - Section - - - MEN_SELECT_ONLY - Select Only - - - MEN_SEWING - Sewing - - - MEN_SHADING - Shading - - - MEN_SHADING_COLOR - Shading Color - - - MEN_SHAPE_PROCESS - Shape Processing - - - MEN_SHELL - Shell - - - MEN_SHELL_SEL_ONLY - Shell - - - MEN_SKETCH - Sketch - - - MEN_3DSKETCH - 3D Sketch - - - MEN_SOLID - Solid - - - MEN_SOLID_SEL_ONLY - Solid - - - MEN_SPHERE - Sphere - - - MEN_STEP_VALUE - Step Value - - - MEN_SUPPERSS_HOLES - Suppress Holes - - - MEN_SUPPRESS_FACES - Suppress Faces - - - MEN_SUPPRESS_INT_WIRES - Suppress Internal Wires - - - MEN_TOLERANCE - Compute Tolerance - - - MEN_TOOLS - Tools - - - MEN_TORUS - Torus - - - MEN_TRANSFORMATION - Transformation - - - MEN_TRANSLATION - Translation - - - MEN_VECTOR - Vector - - - MEN_VERTEX_SEL_ONLY - Vertex - - - MEN_VIEW - View - - - MEN_WHAT_IS - What is - - - MEN_WIRE - Wire - - - MEN_WIREFRAME - Wireframe - - - MEN_WIRE_SEL_ONLY - Wire - - - MEN_WORK_PLANE - Working Plane - - - NAME_LBL - Name: - - - NON_GEOM_OBJECTS_SELECTED - There are objects selected which do not belong to %1 component. - - - PREF_DISPLAY_MODE - Default display mode - - - PREF_FREE_BOUND_COLOR - Color of free boundaries - - - PREF_GROUP_GENERAL - General - - - PREF_GROUP_OCCVIEWER - OCC Viewer 3d - - - PREF_GROUP_VERTEX - Marker of Points - - - PREF_ISOS_COLOR - Color of isolines - - - PREF_LINE_COLOR - Color of edges, vectors, wires - - - PREF_MARKER_SCALE - Size - - - PREF_POINT_COLOR - Color of points - - - PREF_SHADING_COLOR - Default shading color - - - PREF_STEP_VALUE - Step value for spin boxes - - - PREF_TAB_SETTINGS - Settings - - - PREF_TYPE_OF_MARKER - Type - - - PREF_WIREFRAME_COLOR - Default wireframe color - - - PROCESS_SHAPE_NEW_OBJ_NAME - ProcessShape - - - REMOVE_HOLES_NEW_OBJ_NAME - SupressHoles - - - REMOVE_INT_WIRES_NEW_OBJ_NAME - RemoveIntWires - - - SEWING_NEW_OBJ_NAME - Sewing - - - STB_ALL_SEL_ONLY - Select all Objects - - - STB_ARC - Create an arc - - - STB_ARCHIMEDE - Archimede - - - STB_BASIC_PROPS - Basic properties - - - STB_BND_BOX - Compute bounding box - - - STB_BOX - Create a box - - - STB_CHAMFER - Chamfer - - - STB_CHANGE_ORIENTATION - Change orientation - - - STB_CHECK - Check - - - STB_CHECK_COMPOUND - Check compound of blocks - - - STB_CHECK_FREE_BNDS - Check free boundaries - - - STB_CHECK_FREE_FACES - Check free faces - - - STB_CHECK_GEOMETRY - Check Geometry - - - STB_CIRCLE - Create a circle - - - STB_CLIPPING - Clipping range - - - STB_CLOSE_CONTOUR - Perform close contour - - - STB_COMMON - Common - - - STB_COMPOUND - Build a compound - - - STB_COMPOUND_SEL_ONLY - Select only a Compounds - - - STB_CONE - Create a cone - - - STB_CURVE - Create a curve - - - STB_CUT - Cut - - - STB_CYLINDER - Create a cylinder - - - STB_DELETE - Delete object - - - STB_DISK - Create a disk - - - STB_DISPLAY - Show object(s) - - - STB_DISPLAY_ALL - Show all - - - STB_DISPLAY_ONLY - Show only - - - STB_EDGE - Build an edge - - - STB_EDGE_SEL_ONLY - Select only a Edges - - - STB_ELLIPSE - Create an ellipse - - - STB_ERASE - Hide object(s) - - - STB_ERASE_ALL - Hide all - - - STB_EXPLODE - Explode - - - STB_EXPLODE_BLOCKS - Explode on Blocks - - - STB_EXPORT - Export geometry to BREP file - - - STB_EXTRUSION - Create an extrusion - - - STB_FACE - Build a face - - - STB_FACE_SEL_ONLY - Select only a Faces - - - STB_FILLET - Fillet - - - STB_FILLING - Create a filling - - - STB_FUSE - Fuse - - - STB_GLUE_FACES - Perform glue faces - - - STB_GROUP_CREATE - Create a group - - - STB_GROUP_EDIT - Edit a group - - - STB_RELOAD_IMPORTED - Reload imported shape from its original place on disk - - - STB_HEX_SOLID - Hexahedral Solid - - - STB_IMPORT - Import geometry from BREP file - - - STB_INERTIA - Compute intertia - - - STB_ISOS - Set number of isolines - - - STB_LINE - Create a line - - - STB_LOCAL_CS - Create a local coordinate system - - - STB_MASS_CENTER - Compute center of mass - - - STB_MIN_DIST - Compute minimum distance - - - STB_MIRROR - Mirror image - - - STB_MODIFY_LOCATION - Modify the Location - - - STB_MUL_ROTATION - Multi-Rotation - - - STB_MUL_TRANSFORM - Multi-transformation - - - STB_MUL_TRANSLATION - Multi-Translation - - - STB_OFFSET - Offset surface - - - STB_PARTITION - Partition - - - STB_PIPE - Create a shape by Extrusion along a path - - - STB_PLANE - Create a plane - - - STB_POINT - Create a point - - - STB_POINT_COORDS - Point coordinates - - - STB_POINT_ON_EDGE - Add point on edge - - - STB_POP_COLOR - Color - - - STB_POP_CREATE_GROUP - Create Group - - - STB_POP_ISOS - Isolines - - - STB_POP_RENAME - Rename - - - STB_POP_SHADING - Shading - - - STB_POP_TRANSPARENCY - Transparency - - - STB_POP_WIREFRAME - Wireframe - - - STB_PROPAGATE - Propagate - - - STB_Q_FACE - Quadrangle Face - - - STB_REVOLUTION - Create a revolution - - - STB_ROTATION - Rotation - - - STB_SCALE - Scale transform - - - STB_SECTION - Section - - - STB_SEWING - Perform sewing - - - STB_SHADING - Shading - - - STB_SHADING_COLOR - Set shading color - - - STB_SHAPE_PROCESS - Perform shape processing - - - STB_SHELL - Build a shell - - - STB_SHELL_SEL_ONLY - Select only a Shells - - - STB_SKETCH - Sketch - - - STB_SOLID - Build a solid - - - STB_SOLID_SEL_ONLY - Select only a Solids - - - STB_SPHERE - Create a sphere - - - STB_STEP_VALUE - Set step value - - - STB_SUPPERSS_HOLES - Perform suppress holes - - - STB_SUPPRESS_FACES - Perform suppress faces - - - STB_SUPPRESS_INT_WIRES - Perform suppress internal wires - - - STB_TOLERANCE - Compute tolerance - - - STB_TORUS - Create a torus - - - STB_TRANSLATION - Translation - - - STB_VECTOR - Create a vector - - - STB_VERTEX_SEL_ONLY - Select only a Points - - - STB_WHAT_IS - What is - - - STB_WIRE - Build a wire - - - STB_WIRE_SEL_ONLY - Select only a Wires - - - STB_WORK_PLANE - Create a working plane - - - SUPPRESS_RESULT - Suppress Result - - - SUPRESS_FACE_NEW_OBJ_NAME - SupressFaces - - - ShHealOper_ErrorExecution_msg - Shape Healing algorithm failed - - - ShHealOper_InvalidParameters_msg - Incorrect parameters for Shape Healing algorithm - - - ShHealOper_NotError_msg - Shape Healing algorithm has done no modification of the original shape - - - TLT_RENAME - Rename - - - TOM_O - O - - - TOM_O_PLUS - + in O - - - TOM_O_POINT - . in O - - - TOM_O_STAR - * in O - - - TOM_O_X - X in O - - - TOM_PLUS - + - - - TOM_POINT - . - - - TOM_STAR - * - - - TOM_X - X - - - TOOL_BASIC - Basic - - - TOOL_BOOLEAN - Boolean operations - - - TOOL_GENERATION - Generation - - - TOOL_PRIMITIVES - Primitives - - - TOOL_TRANSFORMATION - Transformation - - - TOP_ARC - Create an arc - - - TOP_ARCHIMEDE - Archimede - - - TOP_BASIC_PROPS - Basic properties - - - TOP_BND_BOX - Compute bounding box - - - TOP_BOX - Create a box - - - TOP_CHAMFER - Chamfer - - - TOP_CHANGE_ORIENTATION - Change orientation - - - TOP_CHECK - Check - - - TOP_CHECK_COMPOUND - Check compound of blocks - - - TOP_CHECK_FREE_BNDS - Check free boundaries - - - TOP_CHECK_FREE_FACES - Check free faces - - - TOP_CHECK_GEOMETRY - Check Geometry - - - TOP_CIRCLE - Create a circle - - - TOP_CLIPPING - Clipping range - - - TOP_CLOSE_CONTOUR - Perform close contour - - - TOP_COMMON - Common - - - TOP_COMPOUND - Build a compound - - - TOP_CONE - Create a cone - - - TOP_CURVE - Create a curve - - - TOP_CUT - Cut - - - TOP_CYLINDER - Create a cylinder - - - TOP_DELETE - Delete object - - - TOP_DISK - Build a Disk - - - TOP_DISPLAY - Show - - - TOP_DISPLAY_ALL - Show all - - - TOP_DISPLAY_ONLY - Show only - - - TOP_EDGE - Build an edge - - - TOP_ELLIPSE - Create an ellipse - - - TOP_ERASE - Hide - - - TOP_ERASE_ALL - Hide all - - - TOP_EXPLODE - Explode - - - TOP_EXPLODE_BLOCKS - Explode on Blocks - - - TOP_EXPORT - Export geometry to BREP file - - - TOP_EXTRUSION - Create an extrusion - - - TOP_FACE - Build a face - - - TOP_FILLET - Fillet - - - TOP_FILLING - Create a filling - - - TOP_FUSE - Fuse - - - TOP_GLUE_FACES - Perform glue faces - - - TOP_GROUP_CREATE - Create a group - - - TOP_GROUP_EDIT - Edit a group - - - TOP_HEX_SOLID - Hexahedral Solid - - - TOP_IMPORT - Import geometry from BREP file - - - TOP_INERTIA - Compute intertia - - - TOP_ISOS - Set number of isolines - - - TOP_LINE - Create a line - - - TOP_LOCAL_CS - Create a local coordinate system - - - TOP_MASS_CENTER - Compute center of mass - - - TOP_MIN_DIST - Compute minimum distance - - - TOP_MIRROR - Mirror image - - - TOP_MODIFY_LOCATION - Modify the Location - - - TOP_MUL_ROTATION - Multi-Rotation - - - TOP_MUL_TRANSFORM - Multi-transformation - - - TOP_MUL_TRANSLATION - Multi-Translation - - - TOP_OFFSET - Offset surface - - - TOP_PARTITION - Partition - - - TOP_PIPE - Extrusion along a path - - - TOP_PLANE - Create a plane - - - TOP_POINT - Create a point - - - TOP_POINT_COORDS - Point coordinates - - - TOP_POINT_ON_EDGE - Add point on edge - - - TOP_POP_COLOR - Color - - - TOP_POP_CREATE_GROUP - Create Group - - - TOP_POP_ISOS - Isolines - - - TOP_POP_RENAME - Rename - - - TOP_POP_SHADING - Shading - - - TOP_POP_TRANSPARENCY - Transparency - - - TOP_POP_WIREFRAME - Wireframe - - - TOP_PROPAGATE - Propagate - - - TOP_Q_FACE - Quadrangle Face - - - TOP_REVOLUTION - Create a revolution - - - TOP_ROTATION - Rotation - - - TOP_SCALE - Scale transform - - - TOP_SECTION - Section - - - TOP_SEWING - Perform sewing - - - TOP_SHADING - Shading - - - TOP_SHADING_COLOR - Set shading color - - - TOP_SHAPE_PROCESS - Perform shape processing - - - TOP_SHELL - Build a shell - - - TOP_SKETCH - Sketch - - - TOP_SOLID - Build a solid - - - TOP_SPHERE - Create a sphere - - - TOP_STEP_VALUE - Set step value - - - TOP_SUPPERSS_HOLES - Perform suppress holes - - - TOP_SUPPRESS_FACES - Perform suppress faces - - - TOP_SUPPRESS_INT_WIRES - Perform suppress internal wires - - - TOP_TOLERANCE - Compute tolerance - - - TOP_TORUS - Create a torus - - - TOP_TRANSLATION - Translation - - - TOP_VECTOR - Create a vector - - - TOP_WHAT_IS - What is - - - TOP_WIRE - Build a wire - - - TOP_WORK_PLANE - Create a working plane - - - WRN_NOT_IMPLEMENTED - Sorry, this functionality is not yet implemented - - - _S_ - (s) - - - NOT_FOUND_ANY - Not a single entity has been found - - - GEOM_FACE_I - Face %1 - - - GEOM_CONSTANT_RADIUS - Radius : - - - GEOM_R1 - R1 : - - - GEOM_R2 - R2 : - - - GEOM_BOTHWAY - Both Directions - - - GEOM_NORMALE - Normal To A Face - - - GEOM_VECTOR_NORMALE - Vector_Normal - - - GEOM_LINE1 - Line 1 - - - GEOM_LINE2 - Line 2 - - - GEOM_D - D : - - - GEOM_CHAMFER_EDGE - Chamfer On Selected Edges - - - SELECTED_EDGE - Selected Edges - - - GEOM_NORMALE_TITLE - Create Normal To A Face - - - GEOM_MEASURE_ANGLE_TITLE - Angle Between Two Straight Edges/Lines/Vectors - - - GEOM_MEASURE_ANGLE_ANGLE - Angle - - - GEOM_MEASURE_ANGLE_OBJ - Objects And Results - - - GEOM_MEASURE_ANGLE_IS - Angle in degrees : - - - GEOM_LINE_INTERSECTION - Point On Lines Intersection - - - GEOM_KEEP_NONLIMIT_SHAPES - Keep shapes of lower type - - - GEOM_CENTER_2POINTS - Center and two points - - - GEOM_REMOVE_EXTRA_EDGES_TITLE - Remove extra edges - - - GEOM_REMOVE_EXTRA_EDGES - Object to remove extra edges - - - REMOVE_EXTRA_EDGES_NEW_OBJ_NAME - NoExtraEdges - - - TOP_REMOVE_EXTRA_EDGES - Remove extra edges - - - MEN_REMOVE_EXTRA_EDGES - Remove Extra Edges - - - STB_REMOVE_EXTRA_EDGES - Remove extra edges - - - TOP_NORMALE - Compute normal to a face - - - MEN_NORMALE - Normal to a Face - - - STB_NORMALE - Compute normal to a face in a point (optional) - - - TOP_MEASURE_ANGLE - Compute angle - - - MEN_MEASURE_ANGLE - Angle - - - STB_MEASURE_ANGLE - Compute angle between two lines or linear edges - - - TOP_POP_AUTO_COLOR - Auto color - - - MEN_POP_AUTO_COLOR - Auto Color - - - STB_POP_AUTO_COLOR - Auto color - - - TOP_POP_DISABLE_AUTO_COLOR - Disable auto color - - - MEN_POP_DISABLE_AUTO_COLOR - Disable Auto Color - - - STB_POP_DISABLE_AUTO_COLOR - Disable auto color - - - GEOM_RESULT_NAME_GRP - Result name - - - GEOM_RESULT_NAME_LBL - Name - - - GEOM_FILLING_APPROX - Approximation - - - GEOM_WRN_NO_APPROPRIATE_SELECTION - No appropriate objects selected - - - GEOM_SHAPES_ON_SHAPE - Get shapes on shape - - - GEOM_SHAPES_ON_SHAPE_ESHAPE - Shape for exploding - - - GEOM_SHAPES_ON_SHAPE_CSHAPE - Shape for checking - - - GEOM_SHAPES_ON_SHAPE_STATE - State - - - GEOM_KIND_OF_SHAPE - Kind of Shape : - - - GEOM_CLOSED - Closed - - - GEOM_UNCLOSED - Opened - - - GEOM_CLOSEDUNCLOSED - Not defined, Closed or Opened. Possibly, error occured. - - - GEOM_DISK_CIRCLE - Disk - - - GEOM_DISK_ELLIPSE - Elliptical face - - - GEOM_PLANAR_FACE - Planar Face - - - GEOM_POLYGON - Polygon - - - GEOM_NORMAL - Normal direction - - - GEOM_DIRECTION - Direction - - - GEOM_UPARAMETER - U-parameter : - - - GEOM_VPARAMETER - V-parameter : - - - GEOM_X_I - X%1 : - - - GEOM_Y_I - Y%1 : - - - GEOM_Z_I - Z%1 : - - - GEOM_SHAPES_ON_SHAPE_TITLE - Get shapes on shape - - - GEOM_SCALE_FACTOR_X - Scale Factor X : - - - GEOM_SCALE_FACTOR_Y - Scale Factor Y : - - - GEOM_SCALE_FACTOR_Z - Scale Factor Z : - - - GEOM_STATE_IN - IN - - - GEOM_STATE_OUT - OUT - - - GEOM_STATE_ON - ON - - - GEOM_STATE_ONIN - ONIN - - - GEOM_STATE_ONOUT - ONOUT - - - GEOM_STATE_INOUT - INOUT - - - TOP_GET_SHAPES_ON_SHAPES - Get shapes on shape - - - MEN_GET_SHAPES_ON_SHAPES - Get Shapes on Shape - - - STB_GET_SHAPES_ON_SHAPES - Get shapes on shape - - - GEOM_PUBLISH_RESULT_GRP - Advanced options - - - GEOM_RESTORE_SUB_SHAPES - Set presentation parameters and subshapes from arguments - - - GEOM_ALL_IMPORT_FILES - All supported formats ( %1 ) - - - GEOM_UNSUPPORTED_TYPE - Unsupported format for the file - - - GEOM_UNKNOWN_IMPORT_ERROR - Unknown error - - - GEOM_IMPORT_ERRORS - Import operation has finished with errors: - - - - BasicGUI_MarkerDlg - - CAPTION - Local CS Construction - - - DX - Dx - - - DY - Dy - - - DZ - Dz - - - LCS_NAME - LocalCS - - - LOCALCS - Local coordinate system - - - ORIGIN - Coordinates of origin - - - VEC_PARALLEL - Coordinate system axes cannot be parallel - - - XDIR - X axis direction - - - YDIR - Y axis direction - - - - BlocksGUI_BlockDlg - - FACE_1 - Face 1 - - - FACE_2 - Face 2 - - - FACE_3 - Face 3 - - - FACE_4 - Face 4 - - - FACE_5 - Face 5 - - - FACE_6 - Face 6 - - - - BlocksGUI_ExplodeDlg - - NB_FACES_MAX - Max. nb. faces - - - NB_FACES_MIN - Min. nb. faces - - - - BlocksGUI_QuadFaceDlg - - EDGE_1 - Edge 1 - - - EDGE_2 - Edge 2 - - - EDGE_3 - Edge 3 - - - EDGE_4 - Edge 4 - - - VERTEX_1 - Vertex 1 - - - VERTEX_2 - Vertex 2 - - - VERTEX_3 - Vertex 3 - - - VERTEX_4 - Vertex 4 - - - - BlocksGUI_TrsfDlg - - FACE_1 - Face 1 - - - FACE_1U - Face 1 U - - - FACE_1V - Face 1 V - - - FACE_2 - Face 2 - - - FACE_2U - Face 2 U - - - FACE_2V - Face 2 V - - - - EntityGUI_SketcherDlg - - CANNOT_CLOSE - It is impossible to close sketch + + + iErr : 10 + the Classifier is NULL + + + iErr : 11 + the Shape is NULL + + + iErr : 12 + Unallowed Type of Sub-shape + + + iErr : 13 + Unallowed State + + + iErr : 15 + Unallowed Surface Type + + + iErr : 20 + Triangulation is not Found + + + iErr : 30 + Can not Obtain the Line From the Link + + + iErr : 40 + A Point Can Not Be Classified + + + iErr : 41 + Invalid Data for Classifier + + + GEOM_2D_CONTINUTY + 2D continuity + + + GEOM_2D_CURVE_MODE + 2D curve mode + + + GEOM_2D_TOLERANCE + 2D tolerance + + + GEOM_3D_CONTINUTY + 3D continuity + + + GEOM_3D_CURVE_MODE + 3D curve mode + + + GEOM_3D_TOLERANCE + 3D tolerance + + + GEOM_3_POINTS + 3 points + + + GEOM_ADD_POINT + Add point + + + GEOM_ANGLE + Angle : + + + GEOM_ANGLE_1 + Angle + + + GEOM_ARC_ELLIPSE + Arc of ellipse + + + GEOM_ARC + Arc + + + GEOM_ARCHIMEDE + Archimede + + + GEOM_ARCHIMEDE_TITLE + Archimede Construction + + + GEOM_ARC_TITLE + Arc Construction + + + GEOM_ARGUMENTS + Arguments + + + GEOM_AXE_MIRROR + Axe Mirror + + + GEOM_AXIS + Axis + + + GEOM_BASE + Base + + + GEOM_BASE_OBJECT + Base Object + + + GEOM_BASE_POINT + Base Point + + + GEOM_BEZIER + Bezier + + + GEOM_BINORMAL + BiNormal + + + GEOM_BLOCK + Hexahedral Solid + + + GEOM_BLOCKS_COMPOUND + BlocksCompound + + + GEOM_BLOCK_EXPLODE + Sub Blocks + + + GEOM_BLOCK_EXPLODE_TITLE + Sub Blocks Selection + + + GEOM_BLOCK_MULTITRSF + Block Multi-Transformation + + + GEOM_BLOCK_MULTITRSF_DOUBLE + Multi-Transformation Double + + + GEOM_BLOCK_MULTITRSF_SIMPLE + Multi-Transformation Simple + + + GEOM_BLOCK_MULTITRSF_TITLE + Block Multi-Transformation + + + GEOM_BLOCK_TITLE + Hexahedral Solid Construction + + + GEOM_BNDBOX + Bounding Box + + + GEOM_BNDBOX_OBJDIM + Object And Its Dimensions + + + GEOM_BNDBOX_TITLE + Bounding Box Information + + + GEOM_BOX + Box + + + GEOM_BOX_OBJ + Dimensions At Origin + + + GEOM_BOX_TITLE + Box Construction + + + GEOM_BSplineRestriction + BSplineRestriction + + + GEOM_BUT_APPLY + &Apply + + + GEOM_BUT_CANCEL + &Cancel + + + GEOM_BUT_CLOSE + &Close + + + GEOM_BUT_CLOSE_SKETCH + Sketch Closure + + + GEOM_BUT_END_SKETCH + Sketch Validation + + + GEOM_BUT_EXPLODE + &Explode + + + GEOM_BUT_HELP + &Help + + + GEOM_BUT_NO + &No + + + GEOM_BUT_OK + O&k + + + GEOM_BUT_APPLY_AND_CLOSE + A&pply and Close + + + GEOM_BUT_YES + &Yes + + + GEOM_BY_LENGTH + By length + + + GEOM_BY_PARAMETER + By parameter + + + GEOM_CENTER + Center + + + GEOM_CENTER_DEFAULT + (Origin by default) + + + GEOM_CENTER_POINT + Center Point + + + GEOM_CENTRAL_POINT + Central Point + + + GEOM_CHAMFER + Chamfer + + + GEOM_CHAMFER_ABORT + Chamfer can't be computed with %1 and %2 + + + GEOM_CHAMFER_ALL + Chamfer On Whole Shape + + + GEOM_CHAMFER_EDGES + Chamfer On Selected Edges + + + GEOM_CHAMFER_FACES + Chamfer On Selected Faces + + + GEOM_CHAMFER_TITLE + Chamfer Construction + + + GEOM_CHANGE_ORIENTATION + Objects to change orientation + + + GEOM_CHANGE_DIRECTION + Change direction + + + GEOM_CHANGE_ORIENTATION_TITLE + Change orientation + + + GEOM_CHECK_BLOCKS_COMPOUND + Check and Improve Blocks Compound + + + GEOM_CHECK_BLOCKS_COMPOUND_FAILED + Check failed + + + GEOM_CHECK_BLOCKS_COMPOUND_ERRORS + Errors + + + GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS + The Compound of Blocks has errors + + + GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS + The Compound of Blocks has no errors + + + GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES + Incriminated Sub-shapes + + + GEOM_CHECK_INFOS + Object And Its Topological Information + + + GEOM_CHECK_SHAPE + Check Shape + + + GEOM_CHECK_TITLE + Check Shape Information + + + GEOM_CHECK_SELF_INTERSECTIONS + Detect Self-intersections + + + GEOM_CHECK_SELF_INTERSECTIONS_FAILED + Detection of self-intersections failed + + + GEOM_NO_SELF_INTERSECTIONS + There are no self-intersections in the shape + + + GEOM_SELF_INTERSECTIONS_FOUND + Some self-intersections detected + + + GEOM_CIRCLE + Circle + + + GEOM_CIRCLE_TITLE + Circle Construction + + + GEOM_CLOSECONTOUR_TITLE + Close contour + + + GEOM_CMASS + Center Of Mass + + + GEOM_CMASS_TITLE + Center Of Mass Construction + + + GEOM_COMMON + Common + + + GEOM_COMMON_TITLE + Common Of Two Objects + + + GEOM_COMPOUND + Compound + + + GEOM_COMPOUNDSOLID + CompSolid + + + GEOM_COMPOUND_TITLE + Create A Compound + + + GEOM_CONE + Cone + + + GEOM_CONE_TITLE + Cone Construction + + + GEOM_CONFIRM + Confirm operation + + + GEOM_CONFIRM_INFO + Shape contains %1 sub-shapes ! + + + GEOM_COOR + Coord. : + + + GEOM_COORDINATES + Coordinates + + + GEOM_COORDINATES_RES + Result coordinates + + + GEOM_CREATE_COPY + Create a copy + + + GEOM_CREATE_SINGLE_SOLID + Create a single solid + + + GEOM_CURVE + Curve + + + GEOM_CURVE_CONTINUTY + Curve continuity + + + GEOM_CURVE_TITLE + Curve Construction + + + GEOM_CUT + Cut + + + GEOM_CUT_TITLE + Cut Of Two Objects + + + GEOM_CYLINDER + Cylinder + + + GEOM_CYLINDER_TITLE + Cylinder Construction + + + GEOM_D1 + D1 : + + + GEOM_D2 + D2 : + + + GEOM_DETECT + Detect + + + GEOM_DIAGONAL_POINTS + Diagonal Points + + + GEOM_DISK + Disk + + + GEOM_DISK_TITLE + Disk Construction + + + GEOM_DIMENSIONS + Dimensions + + + GEOM_SKETCHER_DIST + Distance + + + GEOM_DISTANCE + Distance + + + 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 : + + + GEOM_DY + Dy : + + + GEOM_DZ + Dz : + + + GEOM_DropSmallEdges + DropSmallEdges + + + GEOM_DRAFT_ANGLE + Draft angle: + + + GEOM_EDGE + Edge + + + GEOM_EDGE_TITLE + Create An Edge + + + GEOM_ELLIPSE + Ellipse + + + GEOM_ELLIPSE_ERROR_1 + Error creating ellipse. Reason: minor radius is greater than major radius. + + + GEOM_ELLIPSE_TITLE + Ellipse Construction + + + GEOM_END_LCS + End LCS + + + GEOM_ERROR + Error + + + GEOM_ERROR_STATUS + Operation status + + + GEOM_ERR_GET_ENGINE + Failed to obtain GEOM Engine component. Reload Geometry module and try again. + + + GEOM_ERR_LIB_NOT_FOUND + GUI library corresponding to the user action can not be found or loaded + + + GEOM_EXTRUDED_CUT_TITLE + Extruded cut + + + GEOM_EXTRUDED_CUT + Extruded_cut + + + GEOM_EXTRUDED_BOSS_TITLE + Extruded boss + + + GEOM_EXTRUDED_BOSS + Extruded_boss + + + GEOM_EXTRUSION + Extrusion + + + GEOM_EXTRUSION_BSV + Base Shapes + Vector + + + GEOM_EXTRUSION_BSV_2P + Base Shapes + 2 Points + + + GEOM_EXTRUSION_DXDYDZ + Base Shapes + DX DY DZ Vector + + + GEOM_EXTRUSION_TITLE + Construction by Extrusion + + + GEOM_SCALE_PRISM + Scale the face opposite to the base + + + GEOM_FACE + Face + + + GEOM_CS + Coordinate system + + + GEOM_GCS + Global coordinate system + + + GEOM_LCS + Local coordinate system + + + GEOM_FACES + Faces + + + GEOM_FACE_FFW + Face creation from wires and/or edges + + + GEOM_FACE_OPT + Try to create a planar face + + + MAKE_FACE_TOLERANCE_TOO_BIG + Cannot build a planar face: required tolerance is + too big. Non-planar face is built. + + + GEOM_FACE_OR_LCS + Face or LCS + + + GEOM_FACE_SELECTION + Face Selection + + + GEOM_FACE_TITLE + Create A Face + + + GEOM_RECTANGLE_TITLE + Rectangle Construction + + + GEOM_RECTANGLE + Rectangle + + + GEOM_FILLET + Fillet + + + GEOM_FILLET_2D + Fillet 2D + + + GEOM_FILLET_1D + Fillet 1D + + + GEOM_FILLET_1D_IGNORE_SECANT + Fuse collinear edges to allow bigger radius + + + GEOM_FILLET_ABORT + Fillet can't be computed with radius %1 + + + GEOM_FILLET_ALL + Fillet On Whole Shape + + + GEOM_FILLET_EDGES + Fillet On Selected Edges + + + GEOM_FILLET_FACES + Fillet On Selected Faces + + + GEOM_FILLET_TITLE + Fillet Construction + + + GEOM_FILLET_2D_TITLE + 2D Fillet Construction + + + GEOM_FILLET_1D_TITLE + 1D Fillet Construction + + + GEOM_FILLING + Filling + + + GEOM_FILLING_ARG + Arguments And Parameters + + + GEOM_FILLING_COMPOUND + Input compound + + + GEOM_FILLING_MAX_DEG + Max deg + + + GEOM_FILLING_MIN_DEG + Min deg + + + GEOM_FILLING_NB_ITER + Nb. Iter : + + + GEOM_FILLING_TITLE + Filling Surface With Edges + + + GEOM_FILLING_TOL_2D + Tol. 2D : + + + GEOM_FILLING_TOL_3D + Tol. 3D : + + + GEOM_FREE_BOUNDARIES + Free boundaries + + + GEOM_FREE_BOUNDS_ERROR + Object is not selected + + + GEOM_FREE_BOUNDS_MSG + Number of free boundaries detected: %1 (%2 closed, %3 open) + + + GEOM_FREE_BOUNDS_TLT + Free boundary detection + + + GEOM_FREE_FACES + Free faces + + + GEOM_FREE_FACES_TITLE + Free faces + + + GEOM_FUSE + Fuse + + + GEOM_FUSE_TITLE + Fuse Two Objects + + + GEOM_FixFaceSize + FixFaceSize + + + GEOM_FixShape + FixShape + + + GEOM_GLUE + Glue + + + GEOM_GLUE_FACES_TITLE + Glue faces + + + GEOM_GLUE_EDGES_TITLE + Glue edges + + + GLUE_ERROR_STICKED_SHAPES + The tolerance value is too big. Sticked shapes are detected. + + + GEOM_LIMIT_TOLERANCE_TITLE + Limit tolerance + + + GEOM_HEIGHT + Height : + + + GEOM_HEXAGON + Hexagon + + + GEOM_HOLES + Holes + + + GEOM_INIT_SHAPE + Initial shape + + + GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE + Identical names : select by mouse ! + + + GEOM_IMPORT + Imported_Shape + + + GEOM_INCORRECT_INPUT + Incorrect Input Data! + + + GEOM_INERTIA_CONSTR + Matrix And Moments Of Inertia + + + GEOM_INERTIA_I + %1:1 : + + + GEOM_INERTIA_IXYZ + IX & IY & IZ : + + + GEOM_INERTIA_TITLE + Calculs Of Inertia + + + GEOM_INF_LOADED + File %1 loaded. + + + GEOM_INTERNAL_WIRES + Internal wires + + + GEOM_INTERPOL + Interpolation + + + GEOM_KEEP_OBJECT + Keep Object + + + GEOM_LENGTH + Length : + + + GEOM_LINE + Line + + + GEOM_LINE_TITLE + Line Construction + + + GEOM_MAIN_OBJECT + Main Object + + + GEOM_MARKER + Marker + + + GEOM_MARKER_TITLE + Create marker + + + GEOM_MATERIAL_ID + Material ID: + + + GEOM_MATERIAL_MATERIAL + Material + + + GEOM_MATERIAL_SET + << Set + + + GEOM_MATERIAL_SHAPE + Shapes + + + GEOM_MATERIAL_TITLE + Define materials for Dominant Fuse + + + GEOM_MATRIX + Matrix : + + + GEOM_MAX + Max : + + + GEOM_MAX_3D_TOLERANCE + Max 3D tolerance + + + GEOM_MAX_TOLERANCE + Max tolerance + + + GEOM_MEN_ALL_FILES + All Files ( * ) + + + GEOM_MEN_ANGLE + Angle : + + + GEOM_MEN_COMPONENT + Geometry + + + GEOM_MEN_ENTER_ANGLE + Enter An Angle In Degrees + + + GEOM_MEN_EXPORT + Export + + + GEOM_MEN_IMPORT + Import + + + GEOM_MEN_ISOS + Select Number Of Isos + + + GEOM_MEN_ISOU + Isos U : + + + GEOM_MEN_ISOV + Isos V : + + + GEOM_MEN_POPUP_NAME + %1 Objects + + + GEOM_MEN_SHADING + Shading + + + GEOM_MEN_SHADING_WITH_EDGES + Shading With Edges + + + GEOM_MEN_SKETCHER_X + Enter a Length to Set X + + + GEOM_MEN_SKETCHER_Y + Enter a Length to Set Y + + + GEOM_MEN_STEP_LABEL + Step : + + + GEOM_MEN_TRANSPARENCY + Transparency + + + GEOM_MEN_TRANSPARENCY_LABEL + Transparency : + + + GEOM_MEN_WIREFRAME + Wireframe + + + GEOM_MEN_X + X : + + + GEOM_MEN_Y + Y : + + + GEOM_MESHING_DEFLECTION + Meshing Deflect. : + + + GEOM_MIN + Min : + + + GEOM_MINDIST_OBJ + Objects And Results + + + GEOM_MINDIST_TITLE + Minimun Distance Between Two Objects + + + GEOM_MIRROR + Mirror + + + GEOM_MIRROR_TITLE + Mirror An Object + + + GEOM_MULTIROTATION + Multi-Rotation + + + GEOM_MULTIROTATION_DOUBLE + Multi Rotation Double + + + GEOM_MULTIROTATION_SIMPLE + Multi Rotation Simple + + + GEOM_MULTIROTATION_TITLE + Multi-Rotation + + + GEOM_MULTITRANSLATION + Multi-Translation + + + GEOM_MULTITRANSLATION_DOUBLE + Multi Translation Double + + + GEOM_MULTITRANSLATION_SIMPLE + Multi Translation Simple + + + GEOM_MULTITRANSLATION_TITLE + Multi-Translation + + + GEOM_NAME_INCORRECT + Object name not found + + + GEOM_NB_BLOCKS_NO_OTHERS + There are %1 specified blocks and NO other solids + + + GEOM_NB_BLOCKS_SOME_OTHERS + There are %1 specified blocks and some other solids + + + GEOM_NB_TIMES + Nb. Times : + + + GEOM_NB_TIMES_U + Nb. Times U : + + + GEOM_NB_TIMES_V + Nb. Times V : + + + GEOM_NODES + Nodes + + + GEOM_NUM_SPLIT_POINTS + Number of splitting points + + + GEOM_OBJECT + Object + + + GEOM_OBJECT_TYPE + Object Type + + + GEOM_OBJECTS + Objects + + + GEOM_OBJECT_I + Object %1 + + + GEOM_OBJECT_RESULT + Object And Result + + + GEOM_OFFSET + Offset + + + GEOM_OFFSET_TITLE + Offset Surface + + + GEOM_PATTERN + Division pattern + + + GEOM_PROJECTION + Projection + + + GEOM_PROJECTION_TITLE + Projection on Face + + + GEOM_SOURCE_OBJECT + Source vertex, edge or wire + + + GEOM_TARGET_OBJECT + Target face + + + GEOM_OPERATIONS + Operations + + + GEOM_ORIENTATION + Orientation + + + GEOM_ORIENTATION_OPT + Reverse orientation with normal vectors simulation + + + GEOM_ORIENTATION_TITLE + Change Orientation + + + GEOM_PARAMETER + Parameter : + + + GEOM_PARAMETERS + Parameters + + + GEOM_POINT_ON_EDGE + Point on Edge + + + GEOM_POINT_ON_FACE + Point on Face + + + GEOM_PARAM_VALUE + By parameter + + + GEOM_COORD_VALUE + By coordinate + + + GEOM_LENGTH_VALUE + By length + + + GEOM_PARTITION + Partition + + + GEOM_WRN_PARTITION_RESULT_EMPTY + The partition result is empty, please verify the reconstruction limit parameter. + + + GEOM_PARTITION_HALFSPACE + Half-space partition + + + GEOM_PARTITION_ORIENTATION + Change Orientation + + + GEOM_PARTITION_TITLE + Partition Of Object With Tool + + + GEOM_PATH_OBJECT + Path Object + + + GEOM_PIPE + Pipe + + + GEOM_PIPE_TITLE + Pipe Construction + + + GEOM_PROFILE + Profile + + + GEOM_SEGMENT + Segment of straight line + + + GEOM_SELECT_UNPUBLISHED_EDGES + Select unpublished edges + + + GEOM_PLANE + Plane + + + GEOM_PLANE_MIRROR + Plane Mirror + + + GEOM_PLANE_PV + Point + Vector + + + GEOM_PLANE_PVC + Point + Coordinate Vector + + + GEOM_PLANE_SIZE + Size of plane : + + + GEOM_PLANE_TITLE + Plane Construction + + + GEOM_POINT + Point + + + GEOM_POINT1 + Point 1 + + + GEOM_POINT2 + Point 2 + + + GEOM_POINT3 + Point 3 + + + GEOM_POINTS + Points + + + GEOM_POINT_I + Point %1 + + + GEOM_POINT_MIRROR + Point Mirror + + + GEOM_POINT_TITLE + Point Construction + + + GEOM_START_POINT + Start Point + + + GEOM_POLYLINE + Polyline + + + GEOM_POSITION + Location + + + GEOM_POSITION_TITLE + Modify the Location of an Object + + + GEOM_PRECISION + Precision : + + + GEOM_PROPAGATE + Propagate + + + GEOM_PROPAGATE_TITLE + Propagate + + + GEOM_PROPERTIES + Basic Properties + + + GEOM_PROPERTIES_CONSTR + Object And Its Properties + + + GEOM_PROPERTIES_SURFACE + Surface is : + + + GEOM_PROPERTIES_TITLE + Basic Properties Information + + + GEOM_PROPERTIES_VOLUME + Volume is : + + + GEOM_PRP_ABORT + Operation aborted + + + GEOM_PRP_COMMAND + No command associated with this id = %1. + + + GEOM_PRP_DONE + Operation done + + + GEOM_PRP_EXPORT + Exporting geometry to %1 ... + + + GEOM_PRP_LOADING + Loading %1 ... + + + GEOM_PRP_MIN_DIST + Min Distance not computed + + + GEOM_PRP_NOT_FOR_VTK_VIEWER + Not allowed in VTK viewer + + + GEOM_PRP_NULLSHAPE + Error, null or inappropriate shape ! + + + GEOM_PRP_READY + Ready + + + GEOM_PRP_SELECT_EDGE + Select edges and click on Apply + + + GEOM_PRP_SELECT_FACE + Select faces to suppress and click on Ok/Apply + + + GEOM_PRP_SELECT_FIRST + Select main shape first + + + GEOM_PRP_SELECT_SUBSHAPES + Select Sub-shapes + + + GEOM_PRP_SHAPE_IN_STUDY + Main shape must be in the study before + + + GEOM_QUAD_FACE + Quadrangle Face + + + GEOM_QUAD_FACE_TITLE + Quadrangle Face Construction + + + GEOM_RADIUS + Radius : + + + GEOM_RADIUS_I + Radius %1 : + + + GEOM_RADIUS_MAJOR + Major radius : + + + GEOM_RADIUS_MINOR + Minor radius : + + + GEOM_RECONSTRUCTION_LIMIT + Resulting Type + + + GEOM_RECONSTRUCTION_LIMIT_EDGE + Edge + + + GEOM_RECONSTRUCTION_LIMIT_FACE + Face + + + GEOM_RECONSTRUCTION_LIMIT_SHAPE + Shape + + + GEOM_RECONSTRUCTION_LIMIT_SHELL + Shell + + + GEOM_RECONSTRUCTION_LIMIT_SOLID + Solid + + + GEOM_RECONSTRUCTION_LIMIT_VERTEX + Vertex + + + GEOM_RECONSTRUCTION_LIMIT_WIRE + Wire + + + GEOM_REF_POINT + Point with reference + + + GEOM_REMOVE_ALL_HOLES + Remove all holes + + + GEOM_REMOVE_ALL_INT_WIRES + Remove all internal wires + + + GEOM_REMOVE_HOLES_TITLE + Suppress holes + + + GEOM_REMOVE_INTERNAL_WIRES_TITLE + Suppress internal wires + + + GEOM_REMOVE_WEBS + Remove webs + + + GEOM_REQUIRED_DEGREE + Required degree + + + GEOM_REQUIRED_NUM_SEGMENTS + Required number of segments + + + GEOM_REVERSE + Reverse + + + GEOM_REVERSE_DIRECTION + Reverse Direction + + + GEOM_REVERSE_PLANE + Reverse the plane normal + + + GEOM_REVERSE_U + Reverse U + + + GEOM_REVERSE_V + Reverse V + + + GEOM_REVERSE_VECTOR + Reverse Vector + + + GEOM_REVOLUTION + Revolution + + + GEOM_REVOLUTION_TITLE + Construction By Revolution + + + GEOM_ROTATION + Rotation + + + GEOM_ROTATION_TITLE + Rotation Of An Object + + + GEOM_SCALE + Scale + + + GEOM_SCALE_FACTOR + Scale Factor : + + + GEOM_SCALE_TITLE + Scale An Object + + + GEOM_SECTION + Section + + + GEOM_SECTION_TITLE + Section Of Two Objects + + + GEOM_SELECTED_FACE + Selected face + + + GEOM_SELECTED_OBJECTS + Selected objects + + + GEOM_SELECTED_SHAPE + Selected shape + + + GEOM_SELECTION + Selection + + + GEOM_SET_MATERIALS + Set materials + + + GEOM_SEWING + Sewing + + + GEOM_SEWING_TITLE + Topological sewing + + + GEOM_SHAPE + Shape + + + GEOM_SHAPEPROCESS_TITLE + Shape Processing + + + GEOM_SHAPES + Shapes + + + GEOM_SHELL + Shell + + + GEOM_SHELLS + Shells + + + GEOM_SHELL_TITLE + Shell Construction + + + GEOM_SKETCH + Sketch + + + GEOM_SKETCHER_ABS + Absolute + + + GEOM_SKETCHER_ADD_PARAMS + Additionnal Parameters + + + GEOM_SKETCHER_ANGLE + Angle + + + GEOM_SKETCHER_ANGLE2 + Angle : + + + GEOM_SKETCHER_APPLY + Apply + + + GEOM_SKETCHER_ARC + Arc + + + GEOM_SKETCHER_CENTER + Center + + + GEOM_SKETCHER_CENTER2 + Center : + + + GEOM_SKETCHER_WARNING + Warning: End point not on the arc, distance = + + + GEOM_SKETCHER_CENTER_X + X Center : + + + GEOM_SKETCHER_CENTER_Y + Y Center : + + + GEOM_SKETCHER_CENTER_DX + DX Center : + + + GEOM_SKETCHER_CENTER_DY + DY Center : + + + GEOM_SKETCHER_DEST + Destination + + + GEOM_SKETCHER_DIR + Direction + + + GEOM_SKETCHER_DX2 + DX : + + + GEOM_SKETCHER_DY2 + DY : + + + GEOM_SKETCHER_DZ2 + DZ : + + + GEOM_SKETCHER_EL + Element Type + + + GEOM_SKETCHER_RESTORE + Restore + + + GEOM_SKETCHER_LENGTH + Length + + + GEOM_SKETCHER_LENGTH2 + Length : + + + GEOM_SKETCHER_NONE + None (Tangential) + + + GEOM_SKETCHER_PER + Perpendicular + + + GEOM_SKETCHER_POINT + Point + + + GEOM_SKETCHER_POINT2 + Point : + + + GEOM_SKETCHER_END_POINT2 + End Point : + + + GEOM_SKETCHER_RADIUS + Radius + + + GEOM_SKETCHER_RADIUS2 + Radius : + + + GEOM_SKETCHER_REL + Relative + + + GEOM_SKETCHER_SEGMENT + Segment + + + GEOM_SKETCHER_SEL + Selection + + + GEOM_SKETCHER_TAN + Tangent + + + GEOM_SKETCHER_TITLE + 2D Sketch Construction + + + GEOM_3DSKETCHER_TITLE + 3D Sketch Construction + + + GEOM_SKETCHER_TYPE + Type + + + GEOM_SKETCHER_UNDO + Undo + + + GEOM_SKETCHER_VALUES + Values + + + GEOM_SKETCHER_VX2 + VX : + + + GEOM_SKETCHER_VXVY + VX-VY + + + GEOM_SKETCHER_WPLANE + Select a planar face or a plane + + + GEOM_SKETCHER_VY2 + VY : + + + GEOM_SKETCHER_X + X + + + GEOM_SKETCHER_X2 + X : + + + GEOM_SKETCHER_X3 + DX : + + + GEOM_SKETCHER_Y + Y + + + GEOM_SKETCHER_Y2 + Y : + + + GEOM_SKETCHER_Y3 + DY : + + + GEOM_SKETCHER_Z2 + Z : + + + GEOM_3DSKETCHER + 3D Sketcher + + + GEOM_COORDINATES_TYPE + Coordinates Type + + + GEOM_SOLID + Solid + + + GEOM_SOLID_TITLE + Solid Construction + + + GEOM_SPHERE + Sphere + + + GEOM_SPHERE_CR + Center + Radius + + + GEOM_SPHERE_RO + Radius At Origin + + + GEOM_SPHERE_TITLE + Sphere Construction + + + GEOM_SPLINE + Spline + + + GEOM_SPLINE_TITLE + Spline Construction + + + GEOM_SQUARE + Square + + + GEOM_START_LCS + Start LCS + + + SELECT_UNPUBLISHED_EDGES + Select unpublished edges + + + GEOM_STEP + Step : + + + GEOM_STEP_TITLE + Step value for GUI constructions + + + GEOM_STEP_U + Step U : + + + GEOM_STEP_V + Step V : + + + GEOM_STUDY_LOCKED + The active study is locked and therefore cannot be modified + + + GEOM_SUBSHAPE_SELECT + Select Sub-shapes + + + GEOM_SUBSHAPE_TITLE + Sub-shapes Selection + + + GEOM_SUBSHAPE_TYPE + Sub-shapes Type + + + GEOM_SUB_SHAPE + Sub-shapes + + + GEOM_SUPPRESSHOLE_FACE_SHELL + Face or shell + + + GEOM_SUPPRESSHOLE_SELECTFACE + Select the face with hole + + + GEOM_SUPPRESSHOLE_SELECTFACE_END + Select end face (if hole traversing) + + + GEOM_SUPPRESSHOLE_SELECTWIRE + Select wire on face + + + GEOM_SUPPRESSHOLE_SELECTWIRE_END + Select end wire (if hole traversing) + + + GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE + Select hole(s) on the face + + + GEOM_SUPPRESSHOLE_TITLE + Suppress holes + + + GEOM_SUPPRESS_RESULT + Suppress Result + + + GEOM_SUPPRESS_RESULT_INSIDE + Inside + + + GEOM_SUPPRESS_RESULT_OUTSIDE + Outside + + + GEOM_SUPRESSFACE + Supress Face + + + GEOM_SUPRESSFACE_SELECT + Select Faces To Suppress + + + GEOM_SUPRESSFACE_TITLE + Suppress Faces In An Object + + + GEOM_SURFACE_CONTINUTY + Surface continuity + + + GEOM_SURFACE_MODE + Surface mode + + + GEOM_SURFCONE + Conical Face + + + GEOM_SURFCYLINDER + Cylindrical Face + + + GEOM_SURFSPHERE + Spherical Face + + + GEOM_SURFTORUS + Toroidal Face + + + GEOM_SameParameter + SameParameter + + + GEOM_SplitAngle + SplitAngle + + + GEOM_SplitClosedFaces + SplitClosedFaces + + + GEOM_SplitContinuity + SplitContinuity + + + GEOM_TOLERANCE + Tolerance + + + GEOM_LINEAR_TOLERANCE + Linear Tolerance + + + GEOM_ANGULAR_TOLERANCE + Angular Tolerance + + + GEOM_TOLERANCE_CONSTR + Object And Its Tolerances + + + GEOM_TOLERANCE_EDGE + Edge : + + + GEOM_TOLERANCE_FACE + Face : + + + GEOM_TOLERANCE_TITLE + Maximum Tolerance + + + GEOM_TOLERANCE_VERTEX + Vertex : + + + GEOM_TOOL_OBJECT + Tool Object + + + GEOM_TOOL_OBJECTS + Tool Objects + + + GEOM_TORUS + Torus + + + GEOM_TORUS_TITLE + Torus Construction + + + GEOM_TRANSLATION + Translation + + + GEOM_TRANSLATION_COOR + Translation With Coordinates + + + GEOM_TRANSLATION_TITLE + Translation Of An Object + + + GEOM_TRANSPARENCY_OPAQUE + Opaque + + + GEOM_TRANSPARENCY_TITLE + Transparency + + + GEOM_TRANSPARENCY_TRANSPARENT + Transparent + + + GEOM_TRIHEDRON + Trihedron + + + GEOM_ToBezier + ToBezier + + + GEOM_VALUE + Value + + + GEOM_VECTOR + Vector + + + GEOM_AXIS_DEFAULT + (Z axis by default) + + + GEOM_VECTOR_LENGTH + Vector Length : + + + GEOM_VECTOR_TITLE + Vector Construction + + + GEOM_VECTOR_U + Vector U + + + GEOM_VECTOR_V + Vector V + + + GEOM_VERTEX + Vertex + + + GEOM_VERTEXES + Vertexes + + + GEOM_WATER_DENSITY + Water Density : + + + GEOM_WEIGHT + Weight : + + + GEOM_WIDTH + Width : + + + GEOM_WHATIS + Whatis + + + GEOM_WHATIS_OBJECT + Object And Its Topological Information + + + GEOM_WHATIS_TITLE + Whatis Information + + + GEOM_WIRE + Wire + + + GEOM_WIRES + Wire(s) + + + GEOM_WIRES_TO_REMOVE + Wires to remove + + + GEOM_WIREZ + Wires + + + GEOM_WIRE_CONNECT + Wire creation from wires/edges connected + + + GEOM_WIRE_TITLE + Create A Wire + + + GEOM_WPLANE + Working Plane + + + GEOM_WPLANE_FACE + Plane, Planar Face or LCS + + + GEOM_WPLANE_ORIGIN + Select a plane + + + GEOM_WPLANE_OXY + OXY + + + GEOM_WPLANE_OYZ + OYZ + + + GEOM_WPLANE_OZX + OZX + + + GEOM_WPLANE_TITLE + Working Plane Selection + + + GEOM_WPLANE_VECTOR + Select 2 vectors + + + GEOM_WPLANE_VX + Vector X + + + GEOM_WPLANE_VZ + Vector Z + + + GEOM_WRN_RADIUS_NULL + Radius is null + + + GEOM_WRN_WARNING + Warning + + + WRN_SHAPE_UNCLOSED + Unable to create solid from unclosed shape %1 + + + WRN_SHAPE_NOT_SHELL + Unable to create solid from shape %1 as it is not a shell + + + WRN_NULL_OBJECT_OR_SHAPE + Shape %1 for solid creation is null + + + GEOM_X + X : + + + GEOM_Y + Y : + + + GEOM_Z + Z : + + + GLUE_NEW_OBJ_NAME + Glue + + + LIMIT_TOLERANCE_NEW_OBJ_NAME + Limit_tolerance + + + MEN_ALL_SEL_ONLY + Select All + + + MEN_ARC + Arc + + + MEN_ARCHIMEDE + Archimede + + + MEN_BASIC + Basic + + + MEN_BASIC_PROPS + Basic Properties + + + MEN_BLOCKS + Blocks + + + MEN_BND_BOX + Bounding Box + + + MEN_BOOLEAN + Boolean + + + MEN_BOX + Box + + + MEN_BUILD + Build + + + MEN_FEATURE_DETECTION + Shape recognition + + + MEN_PICTURE_IMPORT + Import picture in viewer + + + MEN_CHAMFER + Chamfer + + + MEN_CHANGE_ORIENTATION + Change Orientation + + + MEN_CHECK + Check Shape + + + MEN_CHECK_COMPOUND + Check Compound of Blocks + + + MEN_CHECK_SELF_INTERSECTIONS + Detect Self-intersections + + + MEN_CHECK_FREE_BNDS + Check Free Boundaries + + + MEN_CHECK_FREE_FACES + Check Free Faces + + + MEN_CHECK_GEOMETRY + Check Geometry + + + MEN_CIRCLE + Circle + + + MEN_CLIPPING + Clipping Range + + + MEN_CLOSE_CONTOUR + Close Contour + + + MEN_COMMON + Common + + + MEN_COMPOUND + Compound + + + MEN_COMPOUND_SEL_ONLY + Compound + + + MEN_CONE + Cone + + + MEN_CURVE + Curve + + + MEN_CUT + Cut + + + MEN_CYLINDER + Cylinder + + + MEN_RECTANGLE + Rectangle + + + MEN_DELETE + Delete + + + MEN_DIMENSIONS + Dimensions + + + MEN_DISPLAY + Show + + + 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 + + + MEN_DISPLAY_MODE + Display Mode + + + MEN_DISPLAY_ONLY + Show Only + + + MEN_BRING_TO_FRONT + Bring To Front + + + TOP_BRING_TO_FRONT + Bring To Front + + + STB_BRING_TO_FRONT + Bring To Front + + + MEN_CLS_BRING_TO_FRONT + Clear Top Level State + + + TOP_CLS_BRING_TO_FRONT + Clear Top Level State + + + STB_CLS_BRING_TO_FRONT + Clear Top Level State + + + MEN_EDGE + Edge + + + MEN_EDGE_SEL_ONLY + Edge + + + MEN_EDIT + Edit + + + MEN_ELLIPSE + Ellipse + + + MEN_ERASE + Hide + + + MEN_ERASE_ALL + Hide All + + + MEN_EXPLODE + Explode + + + MEN_EXPLODE_BLOCKS + Explode on Blocks + + + MEN_EXPORT + Export... + + + MEN_EXTRUSION + Extrusion + + + MEN_EXTRUDED_CUT + Extruded cut + + + MEN_EXTRUDED_BOSS + Extruded boss + + + MEN_FACE + Face + + + MEN_FACE_SEL_ONLY + Face + + + MEN_FILE + File + + + MEN_FILLET + Fillet 3D + + + MEN_FILLET_1D + Fillet 1D + + + MEN_FILLET_2D + Fillet 2D + + + MEN_FILLING + Filling + + + MEN_FUSE + Fuse + + + MEN_GENERATION + Generation + + + MEN_GLUE_FACES + Glue Faces + + + MEN_GLUE_EDGES + Glue Edges + + + MEN_GROUP + Group + + + MEN_GROUP_CREATE + Create + + + MEN_GROUP_EDIT + Edit + + + MEN_RELOAD_IMPORTED + Reload From Disk + + + MEN_HEX_SOLID + Hexahedral Solid + + + MEN_IMPORT + Import... + + + MEN_INERTIA + Inertia + + + MEN_ISOS + Isos + + + MEN_LIMIT_TOLERANCE + Limit tolerance + + + MEN_LINE + Line + + + MEN_LOCAL_CS + Local Coordinate System + + + MEN_MASS_CENTER + Center of Mass + + + MEN_MEASURES + Measures + + + MEN_MIN_DIST + Min Distance + + + MEN_MIRROR + Mirror Image + + + MEN_MODIFY_LOCATION + Modify Location + + + MEN_MUL_ROTATION + Multi-Rotation + + + MEN_MUL_TRANSFORM + Multi-Transformation + + + MEN_MUL_TRANSLATION + Multi-Translation + + + MEN_NEW_ENTITY + New Entity + + + MEN_OFFSET + Offset Surface + + + MEN_PROJECTION + Projection + + + MEN_OPERATIONS + Operations + + + MEN_ORIGIN_AND_VECTORS + Origin and Base Vectors + + + MEN_PARTITION + Partition + + + MEN_PIPE + Extrusion Along Path + + + MEN_PLANE + Plane + + + MEN_POINT + Point + + + MEN_POINT_COORDS + Point Coordinates + + + MEN_POINT_ON_EDGE + Add Point on Edge + + + MEN_POP_COLOR + Color + + + MEN_POP_CREATE_GROUP + Create Group + + + MEN_POP_SHOW_CHILDREN + Show Children + + + MEN_POP_HIDE_CHILDREN + Hide Children + + + MEN_POP_UNPUBLISH_OBJ + Unpublish + + + MEN_POP_PUBLISH_OBJ + Publish... + + + MEN_POP_ISOS + Isos + + + MEN_POP_DEFLECTION + Deflection Coefficient + + + MEN_POP_RENAME + Rename + + + MEN_POP_SHADING + Shading + + + MEN_POP_SHADING_WITH_EDGES + Shading With Edges + + + MEN_POP_TEXTURE + Texture + + + MEN_EDGE_WIDTH + Edge Width + + + TOP_EDGE_WIDTH + Edge Width + + + STB_EDGE_WIDTH + Edge Width + + + MEN_ISOS_WIDTH + Isos Width + + + TOP_ISOS_WIDTH + Isos Width + + + STB_ISOS_WIDTH + Isos Width + + + MEN_LINE_WIDTH + Line Width + + + MEN_POP_SETTEXTURE + Texture + + + MEN_POP_TRANSPARENCY + Transparency + + + MEN_POP_WIREFRAME + Wireframe + + + MEN_POP_VECTORS + Show Edge Direction + + + MEN_PREFERENCES + Preferences + + + MEN_PREFERENCES_GEOM + Geometry + + + MEN_PRIMITIVES + Primitives + + + MEN_ADVANCED + Advanced + + + MEN_PROPAGATE + Propagate + + + MEN_Q_FACE + Quadrangle Face + + + MEN_REPAIR + Repair + + + MEN_REVOLUTION + Revolution + + + MEN_ROTATION + Rotation + + + MEN_SCALE + Scale Transform + + + MEN_SECTION + Section + + + MEN_SELECT_ONLY + Select Only + + + MEN_SEWING + Sewing + + + MEN_SHADING + Shading + + + MEN_SHADING_WITH_EDGES + Shading With Edges + + + MEN_SHADING_COLOR + Shading Color + + + MEN_SHAPE_PROCESS + Shape Processing + + + MEN_SHELL + Shell + + + MEN_SHELL_SEL_ONLY + Shell + + + MEN_SKETCH + 2D Sketch + + + MEN_3DSKETCH + 3D Sketch + + + MEN_SOLID + Solid + + + MEN_SOLID_SEL_ONLY + Solid + + + MEN_SPHERE + Sphere + + + MEN_STEP_VALUE + Step Value + + + MEN_SUPPERSS_HOLES + Suppress Holes + + + MEN_SUPPRESS_FACES + Suppress Faces + + + MEN_SUPPRESS_INT_WIRES + Suppress Internal Wires + + + MEN_TOLERANCE + Tolerance + + + MEN_TOOLS + Tools + + + MEN_TORUS + Torus + + + MEN_TRANSFORMATION + Transformation + + + MEN_TRANSLATION + Translation + + + MEN_VECTOR + Vector + + + MEN_VERTEX_SEL_ONLY + Vertex + + + MEN_VIEW + View + + + MEN_WHAT_IS + What is + + + MEN_WIRE + Wire + + + MEN_VECTOR_MODE_ON + Show Edge Direction + + + MEN_VECTOR_MODE_OFF + Hide Edge Direction + + + MEN_WIREFRAME + Wireframe + + + MEN_WIRE_SEL_ONLY + Wire + + + MEN_WORK_PLANE + Working Plane + + + MEN_POP_POINT_MARKER + Point Marker + + + MEN_POP_MATERIAL_PROPERTIES + Material Properties + + + NAME_LBL + Name: + + + NON_GEOM_OBJECTS_SELECTED + There are objects selected which do not belong to %1 component. + + + PREF_DEFLECTION + Deflection coefficient + + + GEOM_PREF_def_precision + Default precision + + + GEOM_PREF_length_precision + Length precision + + + GEOM_PREF_angle_precision + Angular precision + + + GEOM_PREF_len_tol_precision + Length tolerance precision + + + GEOM_PREF_ang_tol_precision + Angular tolerance precision + + + GEOM_PREF_weight_precision + Weight precision + + + GEOM_PREF_density_precision + Density precision + + + GEOM_PREF_parametric_precision + Parametric precision + + + GEOM_PREF_param_tol_precision + Parametric tolerance precision + + + PREF_AUTO_CREATE + Auto create + + + PREF_DISPLAY_MODE + Default display mode + + + PREF_FREE_BOUND_COLOR + Color of free boundaries + + + PREF_GROUP_ORIGIN_AND_BASE_VECTORS + Origin and base vectors + + + PREF_GROUP_OPERATIONS + Operations + + + PREF_GROUP_GENERAL + General + + + GEOM_PREF_GROUP_PRECISION + Input fields precision + + + PREF_GROUP_VERTEX + Marker of Points + + + PREF_ISOS_COLOR + Color of isolines + + + PREF_TOPLEVEL_COLOR + Top level color + + + PREF_TOPLEVEL_DM + Top level display mode + + + MEN_KEEP_CURRENT_DM + Keep current display mode + + + MEN_SHOW_ADD_WACTOR + Show additional wireframe actor + + + PREF_LINE_COLOR + Color of edges, vectors, wires + + + PREF_MARKER_SCALE + Size + + + PREF_POINT_COLOR + Color of points + + + PREF_SHADING_COLOR + Default shading color + + + PREF_EDGES_IN_SHADING + Edges in shading + + + PREF_STEP_VALUE + Step value for spin boxes + + + PREF_TAB_SETTINGS + Settings + + + PREF_TYPE_OF_MARKER + Type + + + PREF_BASE_VECTORS_LENGTH + Length of base vectors + + + PREF_WIREFRAME_COLOR + Default wireframe color + + + PREF_MATERIAL + Default material + + + PREF_EDGE_WIDTH + Edges width + + + PREF_ISOLINES_WIDTH + Iso lines width + + + PREF_PREVIEW_EDGE_WIDTH + Preview edges width + + + PREF_MEASURES_LINE_WIDTH + Measures lines width + + + PROCESS_SHAPE_NEW_OBJ_NAME + ProcessShape + + + REMOVE_HOLES_NEW_OBJ_NAME + SupressHoles + + + REMOVE_INT_WIRES_NEW_OBJ_NAME + RemoveIntWires + + + SEWING_NEW_OBJ_NAME + Sewing + + + STB_ALL_SEL_ONLY + Select all Objects + + + STB_ARC + Create an arc + + + STB_ARCHIMEDE + Archimede operation + + + STB_BASIC_PROPS + Show basic properties of the shape + + + STB_BND_BOX + Compute bounding box of the shape + + + STB_BOX + Create a box + + + STB_FEATURE_DETECTION + Shape recognition + + + STB_PICTURE_IMPORT + Import picture in viewer + + + STB_CHAMFER + Create a chamfer + + + STB_CHANGE_ORIENTATION + Change orientation + + + STB_CHECK + Check shape validity + + + STB_CHECK_COMPOUND + Check compound of blocks + + + STB_CHECK_SELF_INTERSECTIONS + Detect Self-intersections + + + STB_CHECK_FREE_BNDS + Check free boundaries + + + STB_CHECK_FREE_FACES + Check free faces + + + STB_CHECK_GEOMETRY + Check Geometry + + + STB_CIRCLE + Create a circle + + + STB_CLIPPING + Clipping range + + + STB_CLOSE_CONTOUR + Perform close contour + + + STB_COMMON + Common + + + STB_COMPOUND + Build a compound + + + STB_COMPOUND_SEL_ONLY + Select only a Compounds + + + STB_CONE + Create a cone + + + STB_CURVE + Create a curve + + + STB_CUT + Cut + + + STB_CYLINDER + Create a cylinder + + + STB_RECTANGLE + Create rectangular face + + + STB_DELETE + Delete object + + + STB_DISK + Create a disk + + + STB_DISPLAY + Show object(s) + + + STB_DISPLAY_ALL + Show all + + + STB_DISPLAY_ONLY + Show only + + + STB_EDGE + Build an edge + + + STB_EDGE_SEL_ONLY + Select only a Edges + + + STB_ELLIPSE + Create an ellipse + + + STB_ERASE + Hide object(s) + + + STB_ERASE_ALL + Hide all + + + STB_EXPLODE + Explode + + + STB_EXPLODE_BLOCKS + Explode on Blocks + + + STB_EXPORT + Export geometry to BREP file + + + STB_EXTRUSION + Create an extrusion + + + STB_EXTRUDED_CUT + Extruded cut + + + STB_EXTRUDED_BOSS + Extruded boss + + + STB_FACE + Build a face + + + STB_FACE_SEL_ONLY + Select only a Faces + + + STB_FILLET + Create 3D fillet + + + STB_FILLET_1D + Create 1D fillet + + + STB_FILLET_2D + Create 2D fillet + + + STB_FILLING + Create a filling + + + STB_FUSE + Fuse + + + STB_GLUE_FACES + Perform glue faces + + + STB_GLUE_EDGES + Perform glue edges + + + STB_GROUP_CREATE + Create a group + + + STB_GROUP_EDIT + Edit a group + + + STB_RELOAD_IMPORTED + Reload imported shape from its original place on disk + + + STB_HEX_SOLID + Hexahedral Solid + + + STB_IMPORT + Import geometry from BREP file + + + STB_INERTIA + Compute moments of intertia of the shape + + + STB_ISOS + Set number of isolines + + + STB_LINE + Create a line + + + STB_LIMIT_TOLERANCE + Limit tolerance + + + STB_LOCAL_CS + Create a local coordinate system + + + STB_MASS_CENTER + Compute center of mass of the shape + + + STB_MIN_DIST + Compute minimum distance between two objects + + + STB_MIRROR + Mirror a shape + + + STB_MODIFY_LOCATION + Modify shape's location + + + STB_MUL_ROTATION + Perform multi-rotation + + + STB_MUL_TRANSFORM + Perform multi-transformation + + + STB_MUL_TRANSLATION + Perform multi-translation + + + STB_OFFSET + Offset surface + + + STB_PROJECTION + Project a point, an edge or a wire on a face + + + STB_ORIGIN_AND_VECTORS + Create an origin and base Vectors + + + STB_PARTITION + Make a partition + + + STB_PIPE + Create a shape by extrusion along a path + + + STB_PLANE + Create a plane + + + STB_POINT + Create a point + + + STB_POINT_COORDS + Display point coordinates + + + STB_POINT_ON_EDGE + Add point on edge + + + STB_POP_COLOR + Color + + + STB_POP_CREATE_GROUP + Create Group + + + STB_POP_SHOW_CHILDREN + Show child objects + + + STB_POP_UNPUBLISH_OBJ + Unpublish object + + + STB_POP_PUBLISH_OBJ + Publish object + + + STB_POP_HIDE_CHILDREN + Hide child objects + + + STB_POP_ISOS + Isolines + + + STB_POP_DEFLECTION + Deflection Coefficient + + + STB_POP_RENAME + Rename + + + STB_POP_SHADING + Shading + + + STB_POP_SHADING_WITH_EDGES + Shading With Edges + + + STB_POP_TEXTURE + Texture + + + STB_POP_VECTORS + Show Edge Direction + + + STB_POP_SETTEXTURE + Add a texture + + + STB_POP_TRANSPARENCY + Transparency + + + STB_POP_WIREFRAME + Wireframe + + + STB_PROPAGATE + Propagate + + + STB_Q_FACE + Quadrangle Face + + + STB_REVOLUTION + Create a revolution + + + STB_ROTATION + Rotate a shape + + + STB_SCALE + Scale a shape + + + STB_SECTION + Section + + + STB_SEWING + Perform sewing + + + STB_WIREFRAME + Wireframe + + + STB_SHADING + Shading + + + STB_SHADING_WITH_EDGES + Shading with edges + + + STB_VECTOR_MODE + Change Edge Presentation Mode + + + STB_SHADING_COLOR + Set shading color + + + STB_SHAPE_PROCESS + Perform shape processing + + + STB_SHELL + Build a shell + + + STB_SHELL_SEL_ONLY + Select only a Shells + + + STB_SKETCH + Create 2D sketch + + + STB_3DSKETCH + Create 3D sketch + + + STB_SOLID + Build a solid + + + STB_SOLID_SEL_ONLY + Select only a Solids + + + STB_SPHERE + Create a sphere + + + STB_STEP_VALUE + Set step value + + + STB_SUPPERSS_HOLES + Perform suppress holes + + + STB_SUPPRESS_FACES + Perform suppress faces + + + STB_SUPPRESS_INT_WIRES + Perform suppress internal wires + + + STB_TOLERANCE + Compute tolerance of the shape + + + STB_TORUS + Create a torus + + + STB_TRANSLATION + Translate shape + + + STB_VECTOR + Create a vector + + + STB_VERTEX_SEL_ONLY + Select only a Points + + + STB_WHAT_IS + What is + + + STB_WIRE + Build a wire + + + STB_WIRE_SEL_ONLY + Select only a Wires + + + STB_WORK_PLANE + Create a working plane + + + STB_POP_POINT_MARKER + Set Point Marker + + + STB_POP_MATERIAL_PROPERTIES + Set Material Properties + + + SUPPRESS_RESULT + Suppress Result + + + SUPRESS_FACE_NEW_OBJ_NAME + SupressFaces + + + ShHealOper_ErrorExecution_msg + Shape Healing algorithm failed + + + ShHealOper_InvalidParameters_msg + Incorrect parameters for Shape Healing algorithm + + + ShHealOper_NotError_msg + Shape Healing algorithm has done no modification of the original shape + + + TLT_RENAME + Rename + + + TOM_O + O + + + TOM_O_PLUS + + in O + + + TOM_O_POINT + . in O + + + TOM_O_STAR + * in O + + + TOM_O_X + X in O + + + TOM_PLUS + + + + + TOM_POINT + . + + + TOM_STAR + * + + + TOM_X + X + + + TOOL_BASIC + Basic + + + TOOL_BOOLEAN + Boolean operations + + + TOOL_FEATURES + Modification + + + TOOL_GENERATION + Generation + + + TOOL_PRIMITIVES + Primitives + + + TOOL_TRANSFORMATION + Transformation + + + TOOL_BUILD + Build + + + TOOL_OPERATIONS + Operations + + + TOOL_PICTURES + Pictures + + + TOOL_ADVANCED + Advanced + + + TOOL_MEASURES + Measures + + + TOP_ARC + Create an arc + + + TOP_ARCHIMEDE + Archimede + + + TOP_BASIC_PROPS + Basic properties + + + TOP_BND_BOX + Bounding box + + + TOP_BOX + Create a box + + + TOP_CHAMFER + Chamfer + + + TOP_CHANGE_ORIENTATION + Change orientation + + + TOP_CHECK + Check shape + + + TOP_CHECK_COMPOUND + Check compound of blocks + + + TOP_CHECK_SELF_INTERSECTIONS + Detect Self-intersections + + + TOP_CHECK_FREE_BNDS + Check free boundaries + + + TOP_CHECK_FREE_FACES + Check free faces + + + TOP_CHECK_GEOMETRY + Check Geometry + + + TOP_CIRCLE + Create a circle + + + TOP_CLIPPING + Clipping range + + + TOP_CLOSE_CONTOUR + Perform close contour + + + TOP_COMMON + Common + + + TOP_COMPOUND + Build compound + + + TOP_CONE + Create a cone + + + TOP_CURVE + Create a curve + + + TOP_CUT + Cut + + + TOP_CYLINDER + Create a cylinder + + + TOP_DELETE + Delete object + + + TOP_RECTANGLE + Create rectangular face + + + TOP_DISK + Create a disk + + + TOP_DISPLAY + Show + + + TOP_DISPLAY_ALL + Show all + + + TOP_DISPLAY_ONLY + Show only + + + TOP_EDGE + Build edge + + + TOP_ELLIPSE + Create an ellipse + + + TOP_ERASE + Hide + + + TOP_ERASE_ALL + Hide all + + + TOP_EXPLODE + Explode + + + TOP_EXPLODE_BLOCKS + Explode on Blocks + + + TOP_EXPORT + Export geometry to BREP file + + + TOP_EXTRUSION + Create an extrusion + + + TOP_EXTRUDED_BOSS + Extruded boss + + + TOP_EXTRUDED_CUT + Extruded cut + + + TOP_FACE + Build face + + + TOP_FILLET + Fillet 3D + + + TOP_FILLET_1D + Fillet 1D + + + TOP_FILLET_2D + Fillet 2D + + + TOP_FILLING + Create a filling + + + TOP_FUSE + Fuse + + + TOP_GLUE_FACES + Perform glue faces + + + TOP_GLUE_EDGES + Perform glue edges + + + TOP_GROUP_CREATE + Create a group + + + TOP_GROUP_EDIT + Edit a group + + + TOP_HEX_SOLID + Hexahedral Solid + + + TOP_IMPORT + Import geometry from BREP file + + + TOP_INERTIA + Moments of intertia + + + TOP_ISOS + Set number of isolines + + + TOP_LINE + Create a line + + + TOP_LIMIT_TOLERANCE + Limit tolerance + + + TOP_LOCAL_CS + Create a local coordinate system + + + TOP_MASS_CENTER + Center of mass + + + TOP_MIN_DIST + Minimum distance + + + TOP_MIRROR + Mirror image + + + TOP_MODIFY_LOCATION + Modify location + + + TOP_MUL_ROTATION + Multi-Rotation + + + TOP_MUL_TRANSFORM + Multi-transformation + + + TOP_MUL_TRANSLATION + Multi-Translation + + + TOP_PICTURE_IMPORT + Import picture in viewer + + + TOP_FEATURE_DETECTION + Shape recognition + + + TOP_OFFSET + Offset surface + + + TOP_PROJECTION + Projection + + + TOP_ORIGIN_AND_VECTORS + Create an origin and base Vectors + + + TOP_PARTITION + Partition + + + TOP_PIPE + Extrusion along path + + + TOP_PLANE + Create a plane + + + TOP_POINT + Create a point + + + TOP_POINT_COORDS + Point coordinates + + + TOP_POINT_ON_EDGE + Add point on edge + + + TOP_POP_COLOR + Color + + + TOP_POP_CREATE_GROUP + Create Group + + + TOP_POP_SHOW_CHILDREN + Show Children + + + TOP_POP_UNPUBLISH_OBJ + Unpublish object + + + TOP_POP_PUBLISH_OBJ + Publish object + + + TOP_POP_HIDE_CHILDREN + Hide Children + + + TOP_POP_ISOS + Isolines + + + TOP_POP_DEFLECTION + Deflection Coefficient + + + TOP_POP_RENAME + Rename + + + TOP_POP_SHADING + Shading + + + TOP_POP_SHADING_WITH_EDGES + Shading With Edges + + + TOP_POP_SETTEXTURE + Texture + + + TOP_POP_TRANSPARENCY + Transparency + + + TOP_POP_WIREFRAME + Wireframe + + + TOP_PROPAGATE + Propagate + + + TOP_Q_FACE + Quadrangle Face + + + TOP_REVOLUTION + Create a revolution + + + TOP_ROTATION + Rotation + + + TOP_SCALE + Scale transform + + + TOP_SECTION + Section + + + TOP_SEWING + Perform sewing + + + TOP_SHADING + Shading + + + TOP_SHADING_COLOR + Set shading color + + + TOP_SHAPE_PROCESS + Perform shape processing + + + TOP_SHELL + Build shell + + + TOP_SKETCH + 2D sketch + + + TOP_3DSKETCH + 3D sketch + + + TOP_SOLID + Build solid + + + TOP_SPHERE + Create a sphere + + + TOP_STEP_VALUE + Set step value + + + TOP_SUPPERSS_HOLES + Perform suppress holes + + + TOP_SUPPRESS_FACES + Perform suppress faces + + + TOP_SUPPRESS_INT_WIRES + Perform suppress internal wires + + + TOP_TOLERANCE + Tolerance + + + TOP_TORUS + Create a torus + + + TOP_TRANSLATION + Translation + + + TOP_VECTOR + Create a vector + + + TOP_WHAT_IS + What is + + + TOP_WIRE + Build wire + + + TOP_WORK_PLANE + Create a working plane + + + TOP_POP_POINT_MARKER + Point Marker + + + TOP_POP_MATERIAL_PROPERTIES + Material Properties + + + WRN_NOT_IMPLEMENTED + Sorry, this functionality is not yet implemented + + + _S_ + (s) + + + NOT_FOUND_ANY + Not a single entity has been found + + + GEOM_FACE_I + Face %1 + + + GEOM_CONSTANT_RADIUS + Radius : + + + GEOM_R1 + R1 : + + + GEOM_R2 + R2 : + + + GEOM_BOTHWAY + Both Directions + + + GEOM_NORMALE + Normal To A Face + + + GEOM_VECTOR_NORMALE + Vector_Normal + + + GEOM_LINE1 + Line 1 + + + GEOM_LINE2 + Line 2 + + + GEOM_D + D : + + + GEOM_CHAMFER_EDGE + Chamfer On Edge common with 2 Faces + + + SELECTED_EDGE + Selected Edges + + + GEOM_NORMALE_TITLE + Create Normal To A Face + + + GEOM_MEASURE_ANGLE_TITLE + Angle Between Two Straight Edges/Lines/Vectors + + + GEOM_MEASURE_ANGLE_ANGLE + Angle + + + GEOM_MEASURE_ANGLE_OBJ + Objects And Results + + + GEOM_MEASURE_ANGLE_IS + Angle in degrees : + + + GEOM_LINE_INTERSECTION + Point On Lines Intersection + + + GEOM_KEEP_NONLIMIT_SHAPES + Keep shapes of lower type + + + GEOM_NO_SELF_INTERSECTION + No sub-shapes intersection (Compounds only) + + + GEOM_CENTER_2POINTS + Center and two points + + + GEOM_REMOVE_EXTRA_EDGES_TITLE + Remove extra edges + + + GEOM_REMOVE_EXTRA_EDGES + Object to remove extra edges + + + GEOM_RMEE_UNION_FACES + Union faces, laying on common surface + + + REMOVE_EXTRA_EDGES_NEW_OBJ_NAME + NoExtraEdges + + + TOP_REMOVE_EXTRA_EDGES + Remove extra edges + + + MEN_REMOVE_EXTRA_EDGES + Remove Extra Edges + + + STB_REMOVE_EXTRA_EDGES + Remove extra edges + + + GEOM_FUSE_EDGES_TITLE + Fuse Collinear Edges within a Wire + + + GEOM_FUSE_EDGES + Fuse edges + + + FUSE_EDGES_NEW_OBJ_NAME + FuseEdges + + + TOP_FUSE_EDGES + Fuse collinear edges within a wire + + + MEN_FUSE_EDGES + Fuse Collinear Edges within a Wire + + + STB_FUSE_EDGES + Fuse collinear edges within a wire + + + TOP_NORMALE + Normal to a face + + + MEN_NORMALE + Normal to a Face + + + STB_NORMALE + Compute normal to the face + + + TOP_MEASURE_ANGLE + Angle + + + MEN_MEASURE_ANGLE + Angle + + + STB_MEASURE_ANGLE + Compute angle between two lines or linear edges + + + TOP_POP_AUTO_COLOR + Auto color + + + MEN_POP_AUTO_COLOR + Auto Color + + + STB_POP_AUTO_COLOR + Auto color + + + TOP_POP_DISABLE_AUTO_COLOR + Disable auto color + + + MEN_POP_DISABLE_AUTO_COLOR + Disable Auto Color + + + STB_POP_DISABLE_AUTO_COLOR + Disable auto color + + + GEOM_RESULT_NAME_GRP + Result name + + + GEOM_RESULT_NAME_LBL + Name + + + GEOM_FILLING_APPROX + Approximation + + + GEOM_FILLING_METHOD + Method + + + GEOM_FILLING_DEFAULT + Default (standard behaviour) + + + GEOM_FILLING_USEORI + Use edges orientation + + + GEOM_FILLING_AUTO + Auto-correct edges orientation + + + GEOM_WRN_NO_APPROPRIATE_SELECTION + No appropriate objects selected + + + GEOM_SHAPES_ON_SHAPE + Get shapes on shape + + + GEOM_SHAPES_ON_SHAPE_ESHAPE + Shape for exploding + + + GEOM_SHAPES_ON_SHAPE_CSHAPE + Solid for checking + + + GEOM_SHAPES_ON_SHAPE_STATE + State + + + GEOM_KIND_OF_SHAPE + Kind of Shape : + + + GEOM_CLOSED + Closed + + + GEOM_UNCLOSED + Opened + + + GEOM_CLOSEDUNCLOSED + Not defined, Closed or Opened. Possibly, error occured. + + + GEOM_DISK_CIRCLE + Disk + + + GEOM_DISK_ELLIPSE + Elliptical face + + + GEOM_PLANAR_FACE + Planar Face + + + GEOM_PLANAR_EDGE_WIRE + Wire with Planar Edges + + + GEOM_POLYGON + Polygon + + + GEOM_POLYHEDRON + Polyhedron + + + GEOM_NORMAL + Normal direction + + + GEOM_DIRECTION + Direction + + + GEOM_UPARAMETER + U-parameter : + + + GEOM_VPARAMETER + V-parameter : + + + GEOM_X_I + X%1 : + + + GEOM_Y_I + Y%1 : + + + GEOM_Z_I + Z%1 : + + + GEOM_SHAPES_ON_SHAPE_TITLE + Get shapes on shape + + + GEOM_SCALE_FACTOR_X + Scale Factor X : + + + GEOM_SCALE_FACTOR_Y + Scale Factor Y : + + + GEOM_SCALE_FACTOR_Z + Scale Factor Z : + + + GEOM_STATE_IN + IN + + + GEOM_STATE_OUT + OUT + + + GEOM_STATE_ON + ON + + + GEOM_STATE_ONIN + ONIN + + + GEOM_STATE_ONOUT + ONOUT + + + GEOM_STATE_INOUT + INOUT + + + TOP_GET_SHAPES_ON_SHAPE + Get shapes on shape + + + MEN_GET_SHAPES_ON_SHAPE + Get Shapes on Shape + + + STB_GET_SHAPES_ON_SHAPE + Get shapes on shape + + + TOP_GET_SHARED_SHAPES + Get shared shapes + + + MEN_GET_SHARED_SHAPES + Get Shared Shapes + + + STB_GET_SHARED_SHAPES + Get shared shapes + + + GEOM_PUBLISH_RESULT_GRP + Advanced options + + + GEOM_RESTORE_SUB_SHAPES + Set presentation parameters and sub-shapes from arguments + + + GEOM_RSS_ADD_FREFIX + Add prefix to names of restored sub-shapes + + + GEOM_PREVIEW + Preview + + + GEOM_ALL_IMPORT_FILES + All supported formats ( %1 ) + + + GEOM_UNSUPPORTED_TYPE + Unsupported format for the file + + + GEOM_UNKNOWN_IMPORT_ERROR + Unknown error + + + GEOM_IMPORT_ERRORS + Import operation has finished with errors: + + + EXPORT_IGES_HETEROGENEOUS_COMPOUND + This compound cannot be exported in IGES format +without loss, because it contains entities, that must be saved in +different modes. It is vertices, edges and wires on the one hand and +shells and solids on the other hand. + + + GEOM_PUBLISH_NAMED_SHAPES + Create groups for named shapes (if there are any)? + + + GEOM_SCALE_DIMENSIONS + Would you like to take into account the units? +Otherwise the dimensions will be kept without modifications. + + + 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 + + + GEOM_PLUGINS_OTHER + Other + + + SHOW_ONLY_SELECTED + Show only selected + + + HIDE_SELECTED + Hide selected + + + SHOW_ALL_SUB_SHAPES + Show all sub-shapes + + + GEOM_SELECT_IMAGE + Select image... + + + + BasicGUI_CurveDlg + + GEOM_IS_CLOSED + Build a closed edge + + + GEOM_BUILD_CLOSED_WIRE + Build a closed wire + + + GEOM_IS_REORDER + Reorder vertices taking into account distances + + + GEOM_CURVE_CRMODE + Creation Mode + + + GEOM_CURVE_SELECTION + By Selection + + + GEOM_CURVE_ANALITICAL + Analytical + + + + BasicGUI_ParamCurveWidget + + GEOM_PCURVE_TITLE + Curve parameters + + + GEOM_PCURVE_X + X(t) equation + + + GEOM_PCURVE_Y + Y(t) equation + + + GEOM_PCURVE_Z + Z(t) equation + + + GEOM_PCURVE_MIN + Min t + + + GEOM_PCURVE_MAX + Max t + + + GEOM_PCURVE_STEP + Step + + + GEOM_PCURVE_NBSTEP + Number of steps + + + + BasicGUI_EllipseDlg + + GEOM_VECTOR_MAJOR + Major Axis + + + ORIGIN_DEFAULT + Origin by default + + + X_AXIS_DEFAULT + X axis by default + + + Z_AXIS_DEFAULT + Z axis by default + + + + BasicGUI_MarkerDlg + + CAPTION + Local CS Construction + + + DX + Dx + + + DY + Dy + + + DZ + Dz + + + LCS_NAME + LocalCS + + + LOCALCS + Local coordinate system + + + ORIGIN + Coordinates of origin + + + VEC_PARALLEL + Coordinate system axes cannot be parallel + + + XDIR + X axis direction + + + YDIR + Y axis direction + + + + BlocksGUI_BlockDlg + + FACE_1 + Face 1 + + + FACE_2 + Face 2 + + + FACE_3 + Face 3 + + + FACE_4 + Face 4 + + + FACE_5 + Face 5 + + + FACE_6 + Face 6 + + + + BlocksGUI_ExplodeDlg + + NB_FACES_MAX + Max. nb. faces + + + NB_FACES_MIN + Min. nb. faces + + + + BlocksGUI_QuadFaceDlg + + EDGE_1 + Edge 1 + + + EDGE_2 + Edge 2 + + + EDGE_3 + Edge 3 + + + EDGE_4 + Edge 4 + + + VERTEX_1 + Vertex 1 + + + VERTEX_2 + Vertex 2 + + + VERTEX_3 + Vertex 3 + + + VERTEX_4 + Vertex 4 + + + + BlocksGUI_TrsfDlg + + FACE_1 + Face 1 + + + FACE_1U + Face 1 U + + + FACE_1V + Face 1 V + + + FACE_2 + Face 2 + + + FACE_2U + Face 2 U + + + FACE_2V + Face 2 V + + + + EntityGUI_SketcherDlg + + CANNOT_CLOSE + It is impossible to close sketch Number of sketch points too small - - - - EntityGUI_SubShapeDlg - - NO_SUBSHAPES_SELECTED - Please, select one or more sub-shapes - - - - GroupGUI - - NO_GROUP - Please, select a group to edit - - - - GroupGUI_GroupDlg - - ADD - Add - - - CREATE_GROUP_TITLE - Create Group - - - EDIT_GROUP_TITLE - Edit Group - - - EMPTY_LIST - Please, select one or more sub-shapes to put into the group - - - EMPTY_NAME - Please, specify a non-empty group name - - - GROUP_NAME - Group Name - - - GROUP_PREFIX - Group - - - MAIN_SHAPE - Main Shape - - - MAIN_SUB_SHAPES - Main Shape And Sub-Shapes - - - NO_GROUP - Please, select a group to edit - - - NO_MAIN_OBJ - Please, select a main shape - - - REMOVE - Remove - - - SELECT_ALL - Select All - - - SHAPE_SEL_RESTR - Main Shape Selection restriction - - - SHAPE_TYPE - Shape Type - - - NO_RESTR - No restriction - - - GEOM_PARTS_OF_SHAPE2 - Geometrical parts of the Second Shape - - - SUBSHAPES_OF_SHAPE2 - Only Sub-Shapes of the Second Shape - - - SECOND_SHAPE - Second Shape - - - - MeasureGUI_1Sel1TextView1Check_QTD - - CHECK_SHAPE_GEOMETRY - Check also geometry - - - - MeasureGUI_PointDlg - - CAPTION - Point Coordinates - - - COORDINATES - Point and its coordinates - - - POINT - Point - - - X - X - - - Y - Y - - - Z - Z - - - - OperationGUI_ChamferDlg - - D - D - - - FACE_1 - Face 1 - - - FACE_2 - Face 2 - - - SELECTED_FACES - Selected faces - - - - OperationGUI_FilletDlg - - SELECTED_EDGES - Selected edges - - - SELECTED_FACES - Selected faces - - - - RepairGUI_FreeBoundDlg - - CAPTION - Check free boundaries - - - FREE_BOUND - Free boundaries - - - NUMBER_CLOSED - Number of closed free boundaries: - - - NUMBER_OPEN - Number of open free boundaries: - - - - RepairGUI_GlueDlg - - FACES_FOR_GLUING_ARE_DETECTED - There are %1 face(s) that can be glued. They are coloured on the screen with red colour. -Please close this message box and select faces for glueing - - - GLUE_FACES - Glue faces - - - SELECT_FACES - Select Faces - - - THERE_ARE_NO_FACES_FOR_GLUING - There are no faces for gluing - - - - RepairGUI_ShapeProcessDlg - - ERROR_NO_OBJECTS - Please, select a geometrical object for Shape Processing. - - - ERROR_NO_OPERATORS - Please, select at least one Shape Process operation to proceed. - - - TIME_CONSUMING - Enabling this option may result in a very time-consuming operation for some input shapes. + + + + EntityGUI_FeatureDetectorDlg + + GEOM_DETECT_TITLE + Feature Detection + + + GEOM_SCALING + Scaling + + + GEOM_PNT1 + Top left corner + + + GEOM_PNT2 + Top right corner + + + GEOM_CORNER + Detected_corners + + + GEOM_CORNERS + Corners + + + GEOM_CONTOURS + Contours + + + GEOM_FEATURES + Features + + + GEOM_DETECT_ZONE + Select a detection zone +(default is whole picture) + + + GEOM_DETECT_OUTPUT + Output type + + + GEOM_PICTURE + Picture + + + GEOM_COLOR_FILTER + Filtering sample + + + GEOM_VIEW + View + + + GEOM_FRONT + Front (Y-Z) + + + GEOM_TOP + Top (X-Y) + + + GEOM_LEFT + Left (X-Z) + + + + EntityGUI_PictureImportDlg + + GEOM_PICTURE + Picture + + + GEOM_FILE + File name + + + GEOM_IMPORT_PICT_TITLE + Import picture in viewer + + + + EntityGUI_SubShapeDlg + + NO_SUBSHAPES_SELECTED + Please, select one or more sub-shapes + + + + GroupGUI + + NO_GROUP + Please, select a group to edit + + + + GroupGUI_GroupDlg + + ADD + Add + + + CREATE_GROUP_TITLE + Create Group + + + EDIT_GROUP_TITLE + Edit Group + + + EMPTY_LIST + Please, select one or more sub-shapes to put into the group + + + EMPTY_NAME + Please, specify a non-empty group name + + + GROUP_NAME + Group Name + + + GROUP_PREFIX + Group + + + MAIN_SHAPE + Main Shape + + + MAIN_SUB_SHAPES + Main Shape And Sub-shapes + + + NO_GROUP + Please, select a group to edit + + + NO_MAIN_OBJ + Please, select a main shape + + + REMOVE + Remove + + + SELECT_ALL + Select All + + + SHAPE_SEL_RESTR + Main Shape Selection restriction + + + SHAPE_TYPE + Shape Type + + + NO_RESTR + No restriction + + + GEOM_PARTS_OF_SHAPE2 + Geometrical parts of the Second Shape + + + SUBSHAPES_OF_SHAPE2 + Only Sub-shapes of the Second Shape + + + SECOND_SHAPE + Second Shape + + + + MeasureGUI_1Sel1TextView1Check_QTD + + CHECK_SHAPE_GEOMETRY + Check also geometry + + + + MeasureGUI_PointDlg + + CAPTION + Point Coordinates + + + COORDINATES + Point and its coordinates + + + POINT + Point + + + X + X + + + Y + Y + + + Z + Z + + + + OperationGUI_ChamferDlg + + D + D + + + FACE_1 + Face 1 + + + FACE_2 + Face 2 + + + SELECTED_FACES + Selected faces + + + + OperationGUI_FilletDlg + + SELECTED_EDGES + Selected edges + + + SELECTED_FACES + Selected faces + + + + RepairGUI_FreeBoundDlg + + CAPTION + Check free boundaries + + + FREE_BOUND + Free boundaries + + + NUMBER_CLOSED + Number of closed free boundaries: + + + NUMBER_OPEN + Number of open free boundaries: + + + + RepairGUI_GlueDlg + + FACES_FOR_GLUING_ARE_DETECTED + There are %1 face(s) that can be glued. They are coloured on the screen with red colour. +Please close this message box and select faces for gluing + + + EDGES_FOR_GLUING_ARE_DETECTED + There are %1 edge(s) that can be glued. They are coloured on the screen with red colour. +Please close this message box and select edges for gluing + + + GLUE_FACES + Glue faces + + + GLUE_EDGES + Glue edges + + + SELECT_FACES + Select Faces + + + SELECT_EDGES + Select Edges + + + GLUE_ALL_EDGES + Glue all coincident edges + + + THERE_ARE_NO_FACES_FOR_GLUING + There are no faces for gluing + + + THERE_ARE_NO_EDGES_FOR_GLUING + There are no edges for gluing + + + + RepairGUI_ShapeProcessDlg + + ERROR_NO_OBJECTS + Please, select a geometrical object for Shape Processing. + + + ERROR_NO_OPERATORS + Please, select at least one Shape Process operation to proceed. + + + TIME_CONSUMING + Enabling this option may result in a very time-consuming operation for some input shapes. Would you like to continue? - - - - GEOMToolsGUI_DeleteDlg - - GEOM_REALLY_DELETE - Do you really want to delete %1 object(s)? - - - GEOM_REALLY_DELETE_ALL - Do you really want to delete all objects? - - - GEOM_DELETE_OBJECTS - Delete objects - - + + + + GEOMToolsGUI_DeleteDlg + + GEOM_REALLY_DELETE + Do you really want to delete %1 object(s)? + + + GEOM_REALLY_DELETE_ALL + Do you really want to delete all objects? + + + GEOM_DELETE_OBJECTS + Delete objects + + + + GEOMToolsGUI_DeflectionDlg + + GEOM_DEFLECTION_TLT + Select Deflection of Shape + + + GEOM_DEFLECTION + Deflection : + + + + GEOMToolsGUI_LineWidthDlg + + GEOM_LINE_WIDTH + Line width: + + + + GEOMToolsGUI_MarkerDlg + + SET_MARKER_TLT + Set Point Marker + + + STANDARD_MARKER + Standard + + + CUSTOM_MARKER + Custom + + + TYPE + Type: + + + SCALE + Scale: + + + CUSTOM + Texture: + + + BROWSE + Browse... + + + OK_BTN + &OK + + + CANCEL_BTN + &Cancel + + + HELP_BTN + &Help + + + LOAD_TEXTURE_TLT + Load Texture + + + + GEOMToolsGUI_MaterialPropertiesDlg + + MATERIAL_PROPERTIES_TLT + Color and Material Properties + + + REFLECTION_0 + Ambient + + + REFLECTION_1 + Diffuse + + + REFLECTION_2 + Specular + + + REFLECTION_3 + Emissive + + + ENABLED + Enabled + + + SHININESS + Shininess: + + + PHYSICAL + Physical + + + ADD_MATERIAL + Add material + + + DELETE_MATERIAL + Remove material + + + RENAME_MATERIAL + Rename material + + + CURRENT_MATERIAL + [ Current ] + + + CURRENT_COLOR + Color + + + CUSTOM_MATERIAL + Custom material + + + QUE_CREATE_NEW_MATERIAL + Changing properties of pre-defined material is not allowed. +Do you want to create new material? + + + QUE_REMOVE_MATERIAL + Remove material %1? + + + OK_BTN + &OK + + + CANCEL_BTN + &Cancel + + + HELP_BTN + &Help + + + + OperationGUI_GetSharedShapesDlg + + GEOM_SHARED_SHAPES_TITLE + Get Shared Shapes + + + GEOM_GET_SHARED_SHAPES + Shared shapes + + + GEOM_SHARED_SHAPES_INPUT + Input data + + + MSG_SHARED_SHAPES_TOO_FEW_SHAPES + To few shapes selected. + + + GEOM_SHARED_SHAPE + 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 + + + + GEOMToolsGUI_PublishDlg + + GEOM_PUBLISH_OBJECTS_TLT + Publish Objects + + + OBJECT_NAME + Name + + + OBJECT_ENTRY + Entry + + + UNSELECT_ALL + U&nselect All + + + SELECT_ALL + Select &All + + + GEOM_PUBLISH_BTN + &Publish + + + GEOM_PUBLISH_CLOSE_BTN + P&ublish And Close + + diff --git a/src/GEOMGUI/GEOM_msg_fr.po b/src/GEOMGUI/GEOM_msg_fr.po deleted file mode 100644 index a0aaf1884..000000000 --- a/src/GEOMGUI/GEOM_msg_fr.po +++ /dev/null @@ -1,1413 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. translating -# from French to English, "Foo::Bar" would be translated to "Pub", -# not "Foo::Pub". -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -# -#============================================================================== -# - -#Button Apply -msgid "GEOM_BUT_APPLY" -msgstr "&Appliquer" - -#Button Close -msgid "GEOM_BUT_CLOSE" -msgstr "&Fermer" - -#Button Cancel -msgid "GEOM_BUT_CANCEL" -msgstr "&Annuler" - -#Button Ok -msgid "GEOM_BUT_OK" -msgstr "&Ok" - -#Button Yes -msgid "GEOM_BUT_YES" -msgstr "&Oui" - -#Button No -msgid "GEOM_BUT_NO" -msgstr "&Non" - -#Button Help -msgid "GEOM_BUT_HELP" -msgstr "&Aide" - - -#Button Explode -msgid "GEOM_BUT_EXPLODE" -msgstr "&Exploser" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:563 -msgid "GEOM_INF_LOADED" -msgstr "Le fichier %1 est chargé." - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3069 -msgid "GEOM_PRP_COMMAND" -msgstr "Pas de commande associée à l'id = %1." - -#: GeometryGUI.cxx:4977 -msgid "GEOM_PRP_ABORT" -msgstr "L'opération a echoué" - -#: GeometryGUI.cxx:5058 -msgid "GEOM_PRP_DONE" -msgstr "Opération effectuée" - -#: GeometryGUI.cxx:3717 -msgid "GEOM_PRP_LOADING" -msgstr "Chargement de %1 ..." - -#: GeometryGUI.cxx:1412 -msgid "GEOM_PRP_NULLSHAPE" -msgstr "Erreur, objet inconsistant ou inapproprié !" - -#: GeometryGUI.cxx:5072 -msgid "GEOM_PRP_READY" -msgstr "Prêt..." - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_SUBSHAPES" -msgstr "Selection de sous objets" - -msgid "GEOM_CONFIRM" -msgstr "Confirmer cette operation" - -msgid "GEOM_CONFIRM_INFO" -msgstr "L'objet contient %1 sous objets" - - -msgid "GEOM_PRP_NOT_FOR_VTK_VIEWER" -msgstr "Non permis dans viewer VTK" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SHAPE_IN_STUDY" -msgstr "La shape principale doit etre avant dans l'etude" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_EDGE" -msgstr "Selectionner les edges et clicker sur Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FACE" -msgstr "Select les faces a supprimer et clicker sur Ok/Apply" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_SELECT_FIRST" -msgstr "Selectionner la shape principale en premier" - -#: GeometryGUI.cxx:1690 -msgid "GEOM_PRP_MIN_DIST" -msgstr "Min Distance non calculer" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:3698 -msgid "GEOM_MEN_ALL_FILES" -msgstr "Tous fichiers ( * )" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ANGLE" -msgstr "Angle :" - -#: GeometryGUI.cxx:3941 -msgid "GEOM_MEN_COMPONENT" -msgstr "Géometrie" - -#: GeometryGUI.cxx:4389 -msgid "GEOM_MEN_ENTER_ANGLE" -msgstr "Saisir un angle en degrés" - -#: GeometryGUI.cxx:3758 -msgid "GEOM_MEN_EXPORT" -msgstr "Exporter" - -#: GeometryGUI.cxx:3648 -msgid "GEOM_MEN_IMPORT" -msgstr "Importer" - -#: GeometryGUI.cxx:3763 -msgid "GEOM_MEN_LOAD_SCRIPT" -msgstr "Fichiers PYTHON ( *.py )" - -#: GeometryGUI.cxx:2931 -msgid "GEOM_MEN_ISOS" -msgstr "Choisir un nombre d'isos" - -#: GeometryGUI.cxx:4278 -msgid "GEOM_MEN_POPUP_NAME" -msgstr "%1 Objets" - -#: GeometryGUI.cxx:4414 -msgid "GEOM_MEN_SKETCHER_X" -msgstr "Saisir une longueur pour fixer X" - -#: GeometryGUI.cxx:4438 -msgid "GEOM_MEN_SKETCHER_Y" -msgstr "Saisir une longueur pour fixer Y" - -#: GeometryGUI.cxx:2898 -msgid "GEOM_MEN_TRANSPARENCY" -msgstr "Transparence" - -#: GeometryGUI.cxx:4413 -msgid "GEOM_MEN_X" -msgstr "X :" - -#: GeometryGUI.cxx:4437 -msgid "GEOM_MEN_Y" -msgstr "Y :" - -#: GeometryGUI_NbIsosDlg.cxx:36 -msgid "GEOM_MEN_ISOU" -msgstr "Isos u :" - -#: GeometryGUI_NbIsosDlg.cxx:53 -msgid "GEOM_MEN_ISOV" -msgstr "Isos v :" - -#: GeometryGUI_TransparencyDlg.cxx:31 -msgid "GEOM_MEN_TRANSPARENCY_LABEL" -msgstr "Transparence :" - -msgid "GEOM_MEN_STEP_LABEL" -msgstr "Increment" - -msgid "GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE" -msgstr "Noms identiques : selectionner avec la souris !" - -msgid "GEOM_NAME_INCORRECT" -msgstr "Le nom saisi n'existe pas" - - - -# -#============================================================================== -# - -#: GeometryGUI.cxx:892 -msgid "GEOM_WRN_RADIUS_NULL" -msgstr "Le rayon est nul" - -#: GeometryGUI.cxx:3854 -msgid "GEOM_WRN_WARNING" -msgstr "Avertissement" - -#: GeometryGUI.cxx:3854 -msgid "GEOM_REALLY_DELETE" -msgstr "Voulez-vous supprimer l'object(s) ?" - -# -#============================================================================== -# - -#Object -msgid "GEOM_OBJECT" -msgstr "Objet" - -#Main object -msgid "GEOM_MAIN_OBJECT" -msgstr "Objet Principal" - -#Tool object -msgid "GEOM_TOOL_OBJECT" -msgstr "Objet Outil" - -#Base Object -msgid "GEOM_BASE_OBJECT" -msgstr "Objet De Base" - -#Path Object -msgid "GEOM_PATH_OBJECT" -msgstr "Objet Chemin" - -#Objects -msgid "GEOM_OBJECTS" -msgstr "Objets" - -#Object i -msgid "GEOM_OBJECT_I" -msgstr "Objet %1" - -#Object and result -msgid "GEOM_OBJECT_RESULT" -msgstr "Objet Et Résultat" - -#Point -msgid "GEOM_POINT" -msgstr "Point" - -#Base point -msgid "GEOM_BASE_POINT" -msgstr "Point De Base" - -#Center Point -msgid "GEOM_CENTER_POINT" -msgstr "Point Centre" - -#Diagonal Points -msgid "GEOM_DIAGONAL_POINTS" -msgstr "Points Diagonaux" - -#Central Point -msgid "GEOM_CENTRAL_POINT" -msgstr "Point Central" - -#Points -msgid "GEOM_POINTS" -msgstr "Points" - -#Point i -msgid "GEOM_POINT_I" -msgstr "Point %1" - -#Arguments -msgid "GEOM_ARGUMENTS" -msgstr "Arguments" - -#Center -msgid "GEOM_CENTER" -msgstr "Centre" - -#Radius -msgid "GEOM_RADIUS" -msgstr "Rayon" - -#Radius i -msgid "GEOM_RADIUS_I" -msgstr "Rayon %1" - -#Height -msgid "GEOM_HEIGHT" -msgstr "Hauteur" - -#Length -msgid "GEOM_LENGTH" -msgstr "Longueur :" - -#Weight -msgid "GEOM_WEIGHT" -msgstr "poids" - -#Coordinates -msgid "GEOM_COORDINATES" -msgstr "Coordonnées" - -#Coor. -msgid "GEOM_COOR" -msgstr "Coord. :" - -#Reverse -msgid "GEOM_REVERSE" -msgstr "Renverser" - -#Reverse U -msgid "GEOM_REVERSE_U" -msgstr "Renverser U" - -#Reverse V -msgid "GEOM_REVERSE_V" -msgstr "Reverser V" - -#Angle -msgid "GEOM_ANGLE" -msgstr "Angle :" - -#Axis -msgid "GEOM_AXIS" -msgstr "Axe" - -#Matrix -msgid "GEOM_MATRIX" -msgstr "Matrice :" - -#Vector Length -msgid "GEOM_VECTOR_LENGTH" -msgstr "Longueur Du Vecteur :" - -#Reverse Vector -msgid "GEOM_REVERSE_VECTOR" -msgstr "Renverser Le Vecteur" - -#Point Mirror -msgid "GEOM_POINT_MIRROR" -msgstr "Point Miroir" - -#Axe Mirror -msgid "GEOM_AXE_MIRROR" -msgstr "Axe Miroir" - -#Plane Mirror -msgid "GEOM_PLANE_MIRROR" -msgstr "Plan Miroir" - -#Face Selection -msgid "GEOM_FACE_SELECTION" -msgstr "Selection de Face" - -#Base -msgid "GEOM_BASE" -msgstr "Base" - -#Water Density -msgid "GEOM_WATER_DENSITY" -msgstr "Densité de l'eau :" - -#Meshing Deflection -msgid "GEOM_MESHING_DEFLECTION" -msgstr "Déflection Du Maillage :" - -#Dimensions -msgid "GEOM_DIMENSIONS" -msgstr "Dimensions" - -#Precision -msgid "GEOM_PRECISION" -msgstr "Précision :" - -#Selection -msgid "GEOM_SELECTION" -msgstr "Sélection" - -#Nb. Times -msgid "GEOM_NB_TIMES" -msgstr "Nb. Fois :" - -#Nb. Times U -msgid "GEOM_NB_TIMES_U" -msgstr "Nb. Fois U :" - -#Nb. Times V -msgid "GEOM_NB_TIMES_V" -msgstr "Nb. Fois V :" - -#Step -msgid "GEOM_STEP" -msgstr "Pas :" - -#Step V -msgid "GEOM_STEP_V" -msgstr "Pas V :" - -#Step U -msgid "GEOM_STEP_U" -msgstr "Pas U :" - -# -#============================================================================== -# - -#Partition -msgid "GEOM_PARTITION" -msgstr "Partition" - -#Half-space partition -msgid "GEOM_PARTITION_HALFSPACE" -msgstr "Half-space partition" - -#Tolerance -msgid "GEOM_TOLERANCE" -msgstr "Tolérance" - -#Orientation -msgid "GEOM_ORIENTATION" -msgstr "Orientation" - -#Pipe -msgid "GEOM_PIPE" -msgstr "Pipe" - -#Revolution -msgid "GEOM_REVOLUTION" -msgstr "Révolution" - -#Rotation -msgid "GEOM_ROTATION" -msgstr "Rotation" - -#Archimede -msgid "GEOM_ARCHIMEDE" -msgstr "Archimède" - -#Common -msgid "GEOM_COMMON" -msgstr "Joindre" - -#Cut -msgid "GEOM_CUT" -msgstr "Couper" - -#Distance -msgid "GEOM_DISTANCE" -msgstr "Distance" - -#Filling -msgid "GEOM_FILLING" -msgstr "Surface Par Edges" - -#Fuse -msgid "GEOM_FUSE" -msgstr "Fusionner" - -#Scale -msgid "GEOM_SCALE" -msgstr "Echelle" - -#Section -msgid "GEOM_SECTION" -msgstr "Section" - -#Sewing -msgid "GEOM_SEWING" -msgstr "Coudre" - -#Translation -msgid "GEOM_TRANSLATION" -msgstr "Translation" - -#Working Plane -msgid "GEOM_WPLANE" -msgstr "Plan de Travail" - -#Mirror -msgid "GEOM_MIRROR" -msgstr "Miroir" - -#Prism -msgid "GEOM_EXTRUSION" -msgstr "Extrusion" - -#Sub Shapes -msgid "GEOM_SUB_SHAPE" -msgstr "Sous Shapes" - -#Supress Face -msgid "GEOM_SUPRESSFACE" -msgstr "Supression de Face" - -#Fillet -msgid "GEOM_FILLET" -msgstr "Conge" - -#Chamfer -msgid "GEOM_CHAMFER" -msgstr "Chanfrein" - -#Check Shape -msgid "GEOM_CHECK_SHAPE" -msgstr "Check Shape" - -#Check Blocks Compound -msgid "GEOM_CHECK_BLOCKS_COMPOUND" -msgstr "Check Blocks Compound" - -#Check Blocks Compound Errors -msgid "GEOM_CHECK_BLOCKS_COMPOUND_ERRORS" -msgstr "Errors" - -#Check Blocks Compound Errors -msgid "GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS" -msgstr "The Compound of Blocks has no errors" - -msgid "GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS" -msgstr "The Compound of Blocks has errors" - -#Check Blocks Compound SubShapes -msgid "GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES" -msgstr "Incriminated Sub-Shapes" - -#Whatis -msgid "GEOM_WHATIS" -msgstr "Whatis" - -#Bounding Box -msgid "GEOM_BNDBOX" -msgstr "Boite Anglobante" - -#Center Of Mass -msgid "GEOM_CMASS" -msgstr "Centre de Masse" - -#Basic Properties -msgid "GEOM_PROPERTIES" -msgstr "Basiques Proprietes" - -#Multi-Translation -msgid "GEOM_MULTITRANSLATION" -msgstr "Multi-Translation" - -#Multi-Rotation -msgid "GEOM_MULTIROTATION" -msgstr "Multi-Rotation" - -# -#============================================================================== -# - -#Arc -msgid "GEOM_ARC" -msgstr "Arc" - -#Box -msgid "GEOM_BOX" -msgstr "Boite" - -#Circle -msgid "GEOM_CIRCLE" -msgstr "Cercle" - -#Ellipse -msgid "GEOM_ELLIPSE" -msgstr "Ellipse" - -msgid "GEOM_ELLIPSE_TITLE" -msgstr "Construction d'Ellipses" - -#Radius major -msgid "GEOM_RADIUS_MAJOR" -msgstr "Rayon max. :" - -#Radius minor -msgid "GEOM_RADIUS_MINOR" -msgstr "Rayon min. :" - -#Compound -msgid "GEOM_COMPOUND" -msgstr "Compound" - -#CompSolid -msgid "GEOM_COMPOUNDSOLID" -msgstr "CompSolid" - -#Cone -msgid "GEOM_CONE" -msgstr "Cone" - -#Cylinder -msgid "GEOM_CYLINDER" -msgstr "Cylindre" - -#Edge -msgid "GEOM_EDGE" -msgstr "Edge" - -#Face -msgid "GEOM_FACE" -msgstr "Face" - -#Faces -msgid "GEOM_FACES" -msgstr "Faces" - -#Line -msgid "GEOM_LINE" -msgstr "Ligne" - -#Plane -msgid "GEOM_PLANE" -msgstr "Plan" - -#Shape -msgid "GEOM_SHAPE" -msgstr "Shape" - -#Shell -msgid "GEOM_SHELL" -msgstr "Shell" - -#Shells -msgid "GEOM_SHELLS" -msgstr "Shells" - -#Solid -msgid "GEOM_SOLID" -msgstr "Solide" - -#Sphere -msgid "GEOM_SPHERE" -msgstr "Sphère" - -#Conical Face -msgid "GEOM_SURFCONE" -msgstr "Face Conique" - -#Cylindrical Face -msgid "GEOM_SURFCYLINDER" -msgstr "Face Cylindrique" - -#Spherical Face -msgid "GEOM_SURFSPHERE" -msgstr "Face Sphèrique" - -#Toroidal Face -msgid "GEOM_SURFTORUS" -msgstr "Face Toroique" - -#Torus -msgid "GEOM_TORUS" -msgstr "Tore" - -#Vector -msgid "GEOM_VECTOR" -msgstr "Vecteur" - -#Vector U -msgid "GEOM_VECTOR_U" -msgstr "Vecteur U" - -#Vector V -msgid "GEOM_VECTOR_V" -msgstr "Vecteur V" - -#Vertex -msgid "GEOM_VERTEX" -msgstr "Vertex" - -#Wire -msgid "GEOM_WIRE" -msgstr "Wire" - -#Wire(s) -msgid "GEOM_WIRES" -msgstr "Wire(s)" - -#Parameter -msgid "GEOM_PARAMETER" -msgstr "Paramètre :" - - -# -#============================================================================== -# - -#Min -msgid "GEOM_MIN" -msgstr "Min :" - -#Max -msgid "GEOM_MAX" -msgstr "Max :" - -#X -msgid "GEOM_X" -msgstr "X :" - -#Y -msgid "GEOM_Y" -msgstr "Y :" - -#Z -msgid "GEOM_Z" -msgstr "Z :" - -#DX -msgid "GEOM_DX" -msgstr "Dx :" - -#DY -msgid "GEOM_DY" -msgstr "Dy :" - -#DZ -msgid "GEOM_DZ" -msgstr "Dz :" - -#D1 -msgid "GEOM_D1" -msgstr "D1 :" - -#D2 -msgid "GEOM_D2" -msgstr "D2 :" - -# -#============================================================================== -# - -#: GeometryGUI.cxx -msgid "GEOM_STEP_TITLE" -msgstr "Increment par défaut lors des constructions" - -#: GeometryGUI_ArcDlg.cxx:45 -msgid "GEOM_ARC_TITLE" -msgstr "Construction d'un Arc" - -#: GeometryGUI_ArchimedeDlg.cxx:55 -msgid "GEOM_ARCHIMEDE_TITLE" -msgstr "Construction d'Archimède" - -#: GeometryGUI_BndBoxDlg.cxx:59 -msgid "GEOM_BNDBOX_TITLE" -msgstr "Boite Englobante" - -#: GeometryGUI_BndBoxDlg.cxx:82 -msgid "GEOM_BNDBOX_OBJDIM" -msgstr "Objet and ses dimensions" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_TITLE" -msgstr "Construction d'une Boite" - -#: GeometryGUI_BoxDlg.cxx:50 -msgid "GEOM_BOX_OBJ" -msgstr "Dimensions A l'Origine" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_TITLE" -msgstr "Construction d'un Chanfrein" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_ALL" -msgstr "Chanfrein sur toute la Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_EDGES" -msgstr "Chanfrein sur Edges de la Shape" - -#: GeometryGUI_ChamferDlg.cxx:58 -msgid "GEOM_CHAMFER_FACES" -msgstr "Chanfrein sur Faces de la Shape" - -#: GeometryGUI_CircleDlg.cxx:48 -msgid "GEOM_CIRCLE_TITLE" -msgstr "Construction d'un Cercle" - -#: GeometryGUI_CenterMassDlg.cxx:77 -msgid "GEOM_CMASS_TITLE" -msgstr "Centre De Gravité" - -msgid "GEOM_PLANE_SIZE" -msgstr "Taille du plan :" - -#: GeometryGUI_CommonDlg.cxx:47 -msgid "GEOM_COMMON_TITLE" -msgstr "BOOLEEN : Jonction De Deux Objets" - -#: GeometryGUI_CompoundDlg.cxx:44 -msgid "GEOM_COMPOUND_TITLE" -msgstr "Création d'un Compound" - -#: GeometryGUI_ConeDlg.cxx:49 -msgid "GEOM_CONE_TITLE" -msgstr "Construction d'un Cone" - -#: GeometryGUI_CutDlg.cxx:48 -msgid "GEOM_CUT_TITLE" -msgstr "BOOLEEN : Couper Deux Objets" -# -#: GeometryGUI_CylinderDlg.cxx:47 -msgid "GEOM_CYLINDER_TITLE" -msgstr "Construction d'un Cylindre" - -#: GeometryGUI_CheckShape.cxx:60 -msgid "GEOM_CHECK_TITLE" -msgstr "Check Shape" - -#: MeasureGUI_CheckCompoundOfBlocks.cxx:61 -msgid "GEOM_CHECK_COMPOUND_BLOCKS_TITLE" -msgstr "Check Blocks Compound" - -#: GeometryGUI_CheckShape.cxx:83 -msgid "GEOM_CHECK_INFOS" -msgstr "Objet et ses Informations Topologiques" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_TITLE" -msgstr "Distance Minimale entre Deux Objets" - -#: GeometryGUI_DistanceDlg.cxx:57 -msgid "GEOM_MINDIST_OBJ" -msgstr "Objets Et Resultats" - -#: GeometryGUI_EdgeDlg.cxx:47 -msgid "GEOM_EDGE_TITLE" -msgstr "Création d'un Edge" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_TITLE" -msgstr "Construction d'un Congé" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_ALL" -msgstr "Congé sur toute la Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_EDGES" -msgstr "Congé sur Edges de la Shape" - -#: GeometryGUI_FilletDlg.cxx:58 -msgid "GEOM_FILLET_FACES" -msgstr "Congé sur Faces de la Shape" - -#: GeometryGUI_FaceDlg.cxx:49 -msgid "GEOM_FACE_TITLE" -msgstr "Création d'une Face" - -#: GeometryGUI_FaceDlg.cxx:78 -msgid "GEOM_FACE_FFW" -msgstr "Face a partir d'un wire" - -#: GeometryGUI_FaceDlg.cxx:103 -msgid "GEOM_FACE_OPT" -msgstr "Création d'une Face plane" - -#: GeometryGUI_FillingDlg.cxx:53 -msgid "GEOM_FILLING_TITLE" -msgstr "Surface Par Edges" - -#: GeometryGUI_FillingDlg.cxx:112 -msgid "GEOM_FILLING_ARG" -msgstr "Argument Et Parametres" - -#: GeometryGUI_FillingDlg.cxx:128 -msgid "GEOM_FILLING_MIN_DEG" -msgstr "Min. Deg" - -#: GeometryGUI_FillingDlg.cxx:142 -msgid "GEOM_FILLING_MAX_DEG" -msgstr "Max. Deg" - -#: GeometryGUI_FillingDlg.cxx:150 -msgid "GEOM_FILLING_TOL_2D" -msgstr "Tol. 2D" - -#: GeometryGUI_FillingDlg.cxx:170 -msgid "GEOM_FILLING_COMPOUND" -msgstr "Compound de Edges" - -#: GeometryGUI_FillingDlg.cxx:184 -msgid "GEOM_FILLING_TOL_3D" -msgstr "Tol. 3D" - -#: GeometryGUI_FillingDlg.cxx:192 -msgid "GEOM_FILLING_NB_ITER" -msgstr "Nb. Iter" - -#: GeometryGUI_FuseDlg.cxx:48 -msgid "GEOM_FUSE_TITLE" -msgstr "BOOLEEN : Fusionner deux Objets" - -#: GeometryGUI_InertiaDlg.cxx:42 -msgid "GEOM_INERTIA_TITLE" -msgstr "Calculs d'Inertie" - -#: GeometryGUI_InertiaDlg.cxx:50 -msgid "GEOM_INERTIA_CONSTR" -msgstr "Matrice Et Moments d'Inertie" - -#: GeometryGUI_InertiaDlg.cxx:100 -msgid "GEOM_INERTIA_I" -msgstr "%1:1" - -#: GeometryGUI_InertiaDlg.cxx:182 -msgid "GEOM_INERTIA_IXYZ" -msgstr "IX & IY & IZ" - -#: GeometryGUI_LineDlg.cxx:50 -msgid "GEOM_LINE_TITLE" -msgstr "Construction d'une Ligne" - -#: GeometryGUI_MaxToleranceDlg.cxx:53 -msgid "GEOM_TOLERANCE_TITLE" -msgstr "Tolerance Maximale" - -#: GeometryGUI_MaxToleranceDlg.cxx:84 -msgid "GEOM_TOLERANCE_CONSTR" -msgstr "Object et ses Tolerances" - -#: GeometryGUI_MaxToleranceDlg.cxx:121 -msgid "GEOM_TOLERANCE_FACE" -msgstr "Face :" - -#: GeometryGUI_MaxToleranceDlg.cxx:138 -msgid "GEOM_TOLERANCE_EDGE" -msgstr "Edge :" - -#: GeometryGUI_MaxToleranceDlg.cxx:155 -msgid "GEOM_TOLERANCE_VERTEX" -msgstr "Vertex :" - -#: GeometryGUI_MirrorDlg.cxx:52 -msgid "GEOM_MIRROR_TITLE" -msgstr "Methode Miroir" - -#: GeometryGUI_OrientationDlg.cxx:46 -msgid "GEOM_ORIENTATION_TITLE" -msgstr "Changer l'Orientation" - -#: GeometryGUI_OrientationDlg.cxx:134 -msgid "GEOM_ORIENTATION_OPT" -msgstr "Renverser l'orientation avec une simulation de vecteur normal" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_TITLE" -msgstr "Partition d'Objects Avec Outils" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_KEEP_OBJECT" -msgstr "Objet garde" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "GEOM_PARTITION_ORIENTATION" -msgstr "Change l'orientation" - -#: GeometryGUI_PartitionDlg.cxx:45 -msgid "SUPPRESS_RESULT" -msgstr "Suppress Result" - -msgid "GEOM_REMOVE_WEBS" -msgstr "Remove webs" - -msgid "GEOM_SET_MATERIALS" -msgstr "Set materials" - -#: OperationGUI_MaterialDlg.cxx:45 -msgid "GEOM_MATERIAL_TITLE" -msgstr "Define materials for Dominant Fuse" - -msgid "GEOM_MATERIAL_SHAPE" -msgstr "Shapes" - -msgid "GEOM_MATERIAL_MATERIAL" -msgstr "Material" - -msgid "GEOM_MATERIAL_ID" -msgstr "Material ID:" - -msgid "GEOM_MATERIAL_SET" -msgstr "<< Set" - -#: GeometryGUI_PipeDlg.cxx:47 -msgid "GEOM_PIPE_TITLE" -msgstr "Construction d'une Pipe" - -#: GeometryGUI_PointDlg.cxx:52 -msgid "GEOM_POINT_TITLE" -msgstr "Construction d'un Point" - -#: GeometryGUI_PlaneDlg.cxx:60 -msgid "GEOM_PLANE_TITLE" -msgstr "Construction d'un Plan" - -#: GeometryGUI_PlaneDlg.cxx:172 -msgid "GEOM_PLANE_PVC" -msgstr "Point + Vecteur Coordonnes" - -#: GeometryGUI_PlaneDlg.cxx:133 -msgid "GEOM_PLANE_PV" -msgstr "Point + Vecteur" - -#: GeometryGUI_PrismDlg.cxx:54 -msgid "GEOM_EXTRUSION_TITLE" -msgstr "Extruder une Shape de base" - -#: GeometryGUI_PrismDlg.cxx:83 -msgid "GEOM_EXTRUSION_BSV" -msgstr "Shape de base + Vecteur" - -msgid "GEOM_EXTRUSION_BSV_2P" -msgstr "Shape de base + 2 Points" - -#: GeometryGUI_PropertiesDlg.cxx:56 -msgid "GEOM_PROPERTIES_TITLE" -msgstr "Proprietes Basiques" - -#: GeometryGUI_PropertiesDlg.cxx:78 -msgid "GEOM_PROPERTIES_CONSTR" -msgstr "Objet et ses Proprietes" - -#: GeometryGUI_PropertiesDlg.cxx:114 -msgid "GEOM_PROPERTIES_SURFACE" -msgstr "Surface :" - -#: GeometryGUI_PropertiesDlg.cxx:120 -msgid "GEOM_PROPERTIES_VOLUME" -msgstr "Volume :" - -#: GeometryGUI_RevolDlg.cxx:49 -msgid "GEOM_REVOLUTION_TITLE" -msgstr "Construction Par Revolution" - -#: GeometryGUI_RotationDlg.cxx:51 -msgid "GEOM_ROTATION_TITLE" -msgstr "Rotation d'un Objet" - -#: GeometryGUI_ScaleDlg.cxx:52 -msgid "GEOM_SCALE_TITLE" -msgstr "Echelle d'un Objet" - -#: GeometryGUI_ScaleDlg.cxx:117 -msgid "GEOM_SCALE_FACTOR" -msgstr "Facteur d'echelle" - -#: GeometryGUI_SectionDlg.cxx:50 -msgid "GEOM_SECTION_TITLE" -msgstr "BOOLEEN : Section De Deux Objets" - -#: GeometryGUI_SewingDlg.cxx:48 -msgid "GEOM_SEWING_TITLE" -msgstr "Coudre des Topologies" - -#: GeometryGUI_ShellDlg.cxx:53 -msgid "GEOM_SHELL_TITLE" -msgstr "Construction d'une Shell" - -#: GeometryGUI_SolidDlg.cxx:74 -msgid "GEOM_SOLID_TITLE" -msgstr "Construction d'un Solid" - -#: GeometryGUI_SphereDlg.cxx:50 -msgid "GEOM_SPHERE_TITLE" -msgstr "Construction d'une Sphere" - -#: GeometryGUI_SphereDlg.cxx:113 -msgid "GEOM_SPHERE_CR" -msgstr "Centre + rayon" - -#: GeometryGUI_SphereDlg.cxx:146 -msgid "GEOM_SPHERE_RO" -msgstr "Rayon a l'origine" - -#: GeometryGUI_SubShapeDlg.cxx:55 -msgid "GEOM_SUBSHAPE_TITLE" -msgstr "Selection de Sous Shapes" - -#: GeometryGUI_SubShapeDlg.cxx:131 -msgid "GEOM_SUBSHAPE_TYPE" -msgstr "Type de Sous Shapes" - -#: GeometryGUI_SubShapeDlg.cxx:137 -msgid "GEOM_SUBSHAPE_SELECT" -msgstr "Selectionner de Sous Shapes" - -#: GeometryGUI_TorusDlg.cxx:51 -msgid "GEOM_TORUS_TITLE" -msgstr "Constructiond'un Tore" - -#: GeometryGUI_SuppressFacesDlg.cxx:103 -msgid "GEOM_SUPRESSFACE_TITLE" -msgstr "Supprimer des Faces dans un Objet" - -#: GeometryGUI_SuppressFacesDlg.cxx:164 -msgid "GEOM_SUPRESSFACE_SELECT" -msgstr "Selectionner les Faces a Supprimer" - -#: GeometryGUI_TranslationDlg.cxx:78 -msgid "GEOM_TRANSLATION_COOR" -msgstr "Translation Avec Coordonnees" - -msgid "GEOM_TRANSPARENCY_TITLE" -msgstr "Transparence" - -msgid "GEOM_TRANSPARENCY_OPAQUE" -msgstr "Opaque" - -msgid "GEOM_TRANSPARENCY_TRANSPARENT" -msgstr "Transparent" - -msgid "GEOM_SUPPRESSHOLE_TITLE" -msgstr "Suppression de trous" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE" -msgstr "Selection de la face initiale" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE" -msgstr "Selection du contour/trou sur la face" - -msgid "GEOM_SUPPRESSHOLE_SELECTFACE_END" -msgstr "Selection de la face terminale (si trou traversant)" - -msgid "GEOM_SUPPRESSHOLE_SELECTWIRE_END" -msgstr "Selection de contour final (si trou traversant)" - -msgid "GEOM_SUPPRESSHOLE_FACE_SHELL" -msgstr "Face ou shell" - -msgid "GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE" -msgstr "Selection de trou(s) sur la face" - -#: GeometryGUI_TranslationDlg.cxx:56 -msgid "GEOM_TRANSLATION_TITLE" -msgstr "Translation d'un Objet" - -#: GeometryGUI_VectorDlg.cxx:54 -msgid "GEOM_VECTOR_TITLE" -msgstr "Construction d'un Vecteur" - -#: GeometryGUI_WhatisDlg.cxx:63 -msgid "GEOM_WHATIS_TITLE" -msgstr "Whatis" - -#: GeometryGUI_WhatisDlg.cxx:86 -msgid "GEOM_WHATIS_OBJECT" -msgstr "Objet et ses Informations Topologiques" - -#: GeometryGUI_WireDlg.cxx:46 -msgid "GEOM_WIRE_TITLE" -msgstr "Creer un Wire" - -#: GeometryGUI_WireDlg.cxx:103 -msgid "GEOM_WIRE_CONNECT" -msgstr "Creation d'un Wire a partir de wires/edges connectes" - -#: GeometryGUI_WorkingPlaneDlg.cxx:50 -msgid "GEOM_WPLANE_TITLE" -msgstr "plan de travail" - -#: GeometryGUI_WorkingPlaneDlg.cxx:107 -msgid "GEOM_WPLANE_FACE" -msgstr "Plan Ou Face plane" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_TITLE" -msgstr "Multi-Translation" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_SIMPLE" -msgstr "Multi Translation Simple" - -#: GeometryGUI_multiTranslationDlg.cxx:107 -msgid "GEOM_MULTITRANSLATION_DOUBLE" -msgstr "Multi Translation Double" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_TITLE" -msgstr "Multi-Rotation" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_SIMPLE" -msgstr "Multi Rotation Simple" - -#: GeometryGUI_multiRotationDlg.cxx:107 -msgid "GEOM_MULTIROTATION_DOUBLE" -msgstr "Multi Rotation Double" - -msgid "GEOM_PARAM_POINT" -msgstr "Point paramétrique" - -# -#============================================================================== -# - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_WIREFRAME" -msgstr "Filaire" - -#: GeometryGUI.cxx:4613 -msgid "GEOM_MEN_SHADING" -msgstr "Ombré" - -msgid "GEOM_RECONSTRUCTION_LIMIT" -msgstr "Limite de Reconstruction" - -msgid "GEOM_KEEP_NONLIMIT_SHAPES" -msgstr "Keep nonlimit shapes" - -msgid "GEOM_SUPPRESS_RESULT" -msgstr "Supprimer le Resultat" - -msgid "GEOM_SUPPRESS_RESULT_INSIDE" -msgstr "Intérieur" - -msgid "GEOM_SUPPRESS_RESULT_OUTSIDE" -msgstr "Extérieur" - -msgid "GEOM_RECONSTRUCTION_LIMIT_SHAPE" -msgstr "Shape" -msgid "GEOM_RECONSTRUCTION_LIMIT_SOLID" -msgstr "Solid" -msgid "GEOM_RECONSTRUCTION_LIMIT_SHELL" -msgstr "Shell" -msgid "GEOM_RECONSTRUCTION_LIMIT_FACE" -msgstr "Face" -msgid "GEOM_RECONSTRUCTION_LIMIT_WIRE" -msgstr "Wire" -msgid "GEOM_RECONSTRUCTION_LIMIT_EDGE" -msgstr "Edge" -msgid "GEOM_RECONSTRUCTION_LIMIT_VERTEX" -msgstr "Vertex" - -msgid "GEOM_SPLINE_TITLE" -msgstr "Construction de Splines" -msgid "GEOM_SPLINE" -msgstr "Spline" -msgid "GEOM_BEZIER" -msgstr "Bezier" -msgid "GEOM_INTERPOL" -msgstr "Interpolation" - -# -#============================================================================== -# - -msgid "GEOM_SKETCHER_EL" -msgstr "Type d'Element" - -msgid "GEOM_BUT_CLOSE_SKETCH" -msgstr "Fermer Sketch" - -msgid "GEOM_BUT_END_SKETCH" -msgstr "Terminer Sketch" - -msgid "GEOM_SKETCHER_TITLE" -msgstr "Construction de Sketch" - -msgid "GEOM_SKETCHER_POINT" -msgstr "Point" - -msgid "GEOM_SKETCHER_SEGMENT" -msgstr "Sègment" - -msgid "GEOM_SKETCHER_ARC" -msgstr "Arc" - -msgid "GEOM_SKETCHER_DIR" -msgstr "Direction" - -msgid "GEOM_SKETCHER_POINT2" -msgstr "Point :" - -msgid "GEOM_SKETCHER_DEST" -msgstr "Destination" - -msgid "GEOM_SKETCHER_ABS" -msgstr "Absolu" - -msgid "GEOM_SKETCHER_REL" -msgstr "Relative" - -msgid "GEOM_SKETCHER_SEL" -msgstr "Sélection" - -msgid "GEOM_SKETCHER_ANGLE" -msgstr "Angle" - -msgid "GEOM_SKETCHER_PER" -msgstr "Perpendiculaire" - -msgid "GEOM_SKETCHER_TAN" -msgstr "Tangent" - -msgid "GEOM_SKETCHER_VXVY" -msgstr "VX-VY" - -msgid "GEOM_SKETCHER_LENGTH" -msgstr "Longueur" - -msgid "GEOM_SKETCHER_X" -msgstr "X" - -msgid "GEOM_SKETCHER_Y" -msgstr "Y" - -msgid "GEOM_SKETCHER_X2" -msgstr "X :" - -msgid "GEOM_SKETCHER_Y2" -msgstr "Y :" - -msgid "GEOM_SKETCHER_X3" -msgstr "Abs. X :" - -msgid "GEOM_SKETCHER_Y3" -msgstr "Abs. Y :" - -msgid "GEOM_SKETCHER_DX2" -msgstr "DX :" - -msgid "GEOM_SKETCHER_DY2" -msgstr "DY :" - -msgid "GEOM_SKETCHER_VX2" -msgstr "VX :" - -msgid "GEOM_SKETCHER_VY2" -msgstr "VY :" - -msgid "GEOM_SKETCHER_LENGTH2" -msgstr "Longueur :" - -msgid "GEOM_SKETCHER_ANGLE2" -msgstr "Angle :" - -msgid "GEOM_SKETCHER_RADIUS2" -msgstr "Radius :" - -msgid "GEOM_SKETCHER_UNDO" -msgstr "Undo" - -msgid "GEOM_SKETCHER_APPLY" -msgstr "Appliquer" - -msgid "GEOM_SKETCHER_VALUES" -msgstr "Valeurs" - -msgid "GEOM_SKETCHER_TYPE" -msgstr "Type" - -msgid "GEOM_FILLET_ABORT" -msgstr "Le congé ne peut-être realisé avec un rayon de %1 " - -msgid "GEOM_CHAMFER_ABORT" -msgstr "Le chanfrein ne peut-être realisé avec %1 et %2 " - -#MZN: to be translated -msgid "GEOM_CREATE_COPY" -msgstr "Create a copy" - -#MZN: to be translated -msgid "GEOM_CREATE_SINGLE_SOLID" -msgstr "Create a single solid" - -msgid "GEOM_FREE_FACES" -msgstr "Free faces" - -msgid "GEOM_FREE_FACES_TITLE" -msgstr "Free faces" - -msgid "GEOM_PROPAGATE_TITLE" -msgstr "Propagate" - -msgid "GEOM_PROPAGATE" -msgstr "Propagate" diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 608ad2570..75db6a8ae 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -1,1445 +1,5508 @@ + - - - - @default - - GEOM_ANGLE - Angle : - - - GEOM_ARC - Arc - - - GEOM_ARCHIMEDE - Archimde - - - GEOM_ARCHIMEDE_TITLE - Construction d'Archimde - - - GEOM_ARC_TITLE - Construction d'un Arc - - - GEOM_ARGUMENTS - Arguments - - - GEOM_AXE_MIRROR - Axe Miroir - - - GEOM_AXIS - Axe - - - GEOM_BASE - Base - - - GEOM_BASE_OBJECT - Objet De Base - - - GEOM_BASE_POINT - Point De Base - - - GEOM_BEZIER - Bezier - - - GEOM_BNDBOX - Boite Anglobante - - - GEOM_BNDBOX_OBJDIM - Objet and ses dimensions - - - GEOM_BNDBOX_TITLE - Boite Englobante - - - GEOM_BOX - Boite - - - GEOM_BOX_OBJ - Dimensions A l'Origine - - - GEOM_BOX_TITLE - Construction d'une Boite - - - GEOM_BUT_APPLY - &Appliquer - - - GEOM_BUT_CANCEL - &Annuler - - - GEOM_BUT_CLOSE - &Fermer - - - GEOM_BUT_CLOSE_SKETCH - Fermer Sketch - - - GEOM_BUT_END_SKETCH - Terminer Sketch - - - GEOM_BUT_EXPLODE - &Exploser - - - GEOM_BUT_HELP - &Aide - - - GEOM_BUT_NO - &Non - - - GEOM_BUT_OK - &Ok - - - GEOM_BUT_YES - &Oui - - - GEOM_CENTER - Centre - - - GEOM_CENTER_POINT - Point Centre - - - GEOM_CENTRAL_POINT - Point Central - - - GEOM_CHAMFER - Chanfrein - - - GEOM_CHAMFER_ABORT - Le chanfrein ne peut-tre realis avec %1 et %2 - - - GEOM_CHAMFER_ALL - Chanfrein sur toute la Shape - - - GEOM_CHAMFER_EDGES - Chanfrein sur Edges de la Shape - - - GEOM_CHAMFER_FACES - Chanfrein sur Faces de la Shape - - - GEOM_CHAMFER_TITLE - Construction d'un Chanfrein - - - GEOM_CHECK_BLOCKS_COMPOUND - Check Blocks Compound - - - GEOM_CHECK_BLOCKS_COMPOUND_ERRORS - Errors - - - GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS - The Compound of Blocks has errors - - - GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS - The Compound of Blocks has no errors - - - GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES - Incriminated Sub-Shapes - - - GEOM_CHECK_COMPOUND_BLOCKS_TITLE - Check Blocks Compound - - - GEOM_CHECK_INFOS - Objet et ses Informations Topologiques - - - GEOM_CHECK_SHAPE - Check Shape - - - GEOM_CHECK_TITLE - Check Shape - - - GEOM_CIRCLE - Cercle - - - GEOM_CIRCLE_TITLE - Construction d'un Cercle - - - GEOM_CMASS - Centre de Masse - - - GEOM_CMASS_TITLE - Centre De Gravit - - - GEOM_COMMON - Joindre - - - GEOM_COMMON_TITLE - BOOLEEN : Jonction De Deux Objets - - - GEOM_COMPOUND - Compound - - - GEOM_COMPOUNDSOLID - CompSolid - - - GEOM_COMPOUND_TITLE - Cration d'un Compound - - - GEOM_CONE - Cone - - - GEOM_CONE_TITLE - Construction d'un Cone - - - GEOM_CONFIRM - Confirmer cette operation - - - GEOM_CONFIRM_INFO - L'objet contient %1 sous objets - - - GEOM_COOR - Coord. : - - - GEOM_COORDINATES - Coordonnes - - - GEOM_CREATE_COPY - Create a copy - - - GEOM_CREATE_SINGLE_SOLID - Create a single solid - - - GEOM_CUT - Couper - - - GEOM_CUT_TITLE - BOOLEEN : Couper Deux Objets - - - GEOM_CYLINDER - Cylindre - - - GEOM_CYLINDER_TITLE - Construction d'un Cylindre - - - GEOM_D1 - D1 : - - - GEOM_D2 - D2 : - - - GEOM_DIAGONAL_POINTS - Points Diagonaux - - - GEOM_DIMENSIONS - Dimensions - - - GEOM_DISTANCE - Distance - - - GEOM_DX - Dx : - - - GEOM_DY - Dy : - - - GEOM_DZ - Dz : - - - GEOM_EDGE - Edge - - - GEOM_EDGE_TITLE - Cration d'un Edge - - - GEOM_ELLIPSE - Ellipse - - - GEOM_ELLIPSE_TITLE - Construction d'Ellipses - - - GEOM_EXTRUSION - Extrusion - - - GEOM_EXTRUSION_BSV - Shape de base + Vecteur - - - GEOM_EXTRUSION_BSV_2P - Shape de base + 2 Points - - - GEOM_EXTRUSION_TITLE - Extruder une Shape de base - - - GEOM_FACE - Face - - - GEOM_FACES - Faces - - - GEOM_FACE_FFW - Face a partir d'un wire - - - GEOM_FACE_OPT - Cration d'une Face plane - - - GEOM_FACE_SELECTION - Selection de Face - - - GEOM_FACE_TITLE - Cration d'une Face - - - GEOM_FILLET - Conge - - - GEOM_FILLET_ABORT - Le cong ne peut-tre realis avec un rayon de %1 - - - GEOM_FILLET_ALL - Cong sur toute la Shape - - - GEOM_FILLET_EDGES - Cong sur Edges de la Shape - - - GEOM_FILLET_FACES - Cong sur Faces de la Shape - - - GEOM_FILLET_TITLE - Construction d'un Cong - - - GEOM_FILLING - Surface Par Edges - - - GEOM_FILLING_ARG - Argument Et Parametres - - - GEOM_FILLING_COMPOUND - Compound de Edges - - - GEOM_FILLING_MAX_DEG - Max. Deg - - - GEOM_FILLING_MIN_DEG - Min. Deg - - - GEOM_FILLING_NB_ITER - Nb. Iter - - - GEOM_FILLING_TITLE - Surface Par Edges - - - GEOM_FILLING_TOL_2D - Tol. 2D - - - GEOM_FILLING_TOL_3D - Tol. 3D - - - GEOM_FREE_FACES - Free faces - - - GEOM_FREE_FACES_TITLE - Free faces - - - GEOM_FUSE - Fusionner - - - GEOM_FUSE_TITLE - BOOLEEN : Fusionner deux Objets - - - GEOM_HEIGHT - Hauteur - - - GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE - Noms identiques : selectionner avec la souris ! - - - GEOM_INERTIA_CONSTR - Matrice Et Moments d'Inertie - - - GEOM_INERTIA_I - %1:1 - - - GEOM_INERTIA_IXYZ - IX & IY & IZ - - - GEOM_INERTIA_TITLE - Calculs d'Inertie - - - GEOM_INF_LOADED - Le fichier %1 est charg. - - - GEOM_INTERPOL - Interpolation - - - GEOM_KEEP_OBJECT - Objet garde - - - GEOM_LENGTH - Longueur : - - - GEOM_LINE - Ligne - - - GEOM_LINE_TITLE - Construction d'une Ligne - - - GEOM_MAIN_OBJECT - Objet Principal - - - GEOM_MATERIAL_ID - Material ID: - - - GEOM_MATERIAL_MATERIAL - Material - - - GEOM_MATERIAL_SET - << Set - - - GEOM_MATERIAL_SHAPE - Shapes - - - GEOM_MATERIAL_TITLE - Define materials for Dominant Fuse - - - GEOM_MATRIX - Matrice : - - - GEOM_MAX - Max : - - - GEOM_MEN_ALL_FILES - Tous fichiers ( * ) - - - GEOM_MEN_ANGLE - Angle : - - - GEOM_MEN_COMPONENT - Gometrie - - - GEOM_MEN_ENTER_ANGLE - Saisir un angle en degrs - - - GEOM_MEN_EXPORT - Exporter - - - GEOM_MEN_IMPORT - Importer - - - GEOM_MEN_ISOS - Choisir un nombre d'isos - - - GEOM_MEN_ISOU - Isos u : - - - GEOM_MEN_ISOV - Isos v : - - - GEOM_MEN_LOAD_SCRIPT - Fichiers PYTHON ( *.py ) - - - GEOM_MEN_POPUP_NAME - %1 Objets - - - GEOM_MEN_SHADING - Ombr - - - GEOM_MEN_SKETCHER_X - Saisir une longueur pour fixer X - - - GEOM_MEN_SKETCHER_Y - Saisir une longueur pour fixer Y - - - GEOM_MEN_STEP_LABEL - Increment - - - GEOM_MEN_TRANSPARENCY - Transparence - - - GEOM_MEN_TRANSPARENCY_LABEL - Transparence : - - - GEOM_MEN_WIREFRAME - Filaire - - - GEOM_MEN_X - X : - - - GEOM_MEN_Y - Y : - - - GEOM_MESHING_DEFLECTION - Dflection Du Maillage : - - - GEOM_MIN - Min : - - - GEOM_MINDIST_OBJ - Objets Et Resultats - - - GEOM_MINDIST_TITLE - Distance Minimale entre Deux Objets - - - GEOM_MIRROR - Miroir - - - GEOM_MIRROR_TITLE - Methode Miroir - - - GEOM_MULTIROTATION - Multi-Rotation - - - GEOM_MULTIROTATION_DOUBLE - Multi Rotation Double - - - GEOM_MULTIROTATION_SIMPLE - Multi Rotation Simple - - - GEOM_MULTIROTATION_TITLE - Multi-Rotation - - - GEOM_MULTITRANSLATION - Multi-Translation - - - GEOM_MULTITRANSLATION_DOUBLE - Multi Translation Double - - - GEOM_MULTITRANSLATION_SIMPLE - Multi Translation Simple - - - GEOM_MULTITRANSLATION_TITLE - Multi-Translation - - - GEOM_NAME_INCORRECT - Le nom saisi n'existe pas - - - GEOM_NB_TIMES - Nb. Fois : - - - GEOM_NB_TIMES_U - Nb. Fois U : - - - GEOM_NB_TIMES_V - Nb. Fois V : - - - GEOM_OBJECT - Objet - - - GEOM_OBJECTS - Objets - - - GEOM_OBJECT_I - Objet %1 - - - GEOM_OBJECT_RESULT - Objet Et Rsultat - - - GEOM_ORIENTATION - Orientation - - - GEOM_ORIENTATION_OPT - Renverser l'orientation avec une simulation de vecteur normal - - - GEOM_ORIENTATION_TITLE - Changer l'Orientation - - - GEOM_PARAMETER - Paramtre : - - - GEOM_PARAM_POINT - Point paramtrique - - - GEOM_PARTITION - Partition - - - GEOM_PARTITION_HALFSPACE - Half-space partition - - - GEOM_PARTITION_ORIENTATION - Change l'orientation - - - GEOM_PARTITION_TITLE - Partition d'Objects Avec Outils - - - GEOM_PATH_OBJECT - Objet Chemin - - - GEOM_PIPE - Pipe - - - GEOM_PIPE_TITLE - Construction d'une Pipe - - - GEOM_PLANE - Plan - - - GEOM_PLANE_MIRROR - Plan Miroir - - - GEOM_PLANE_PV - Point + Vecteur - - - GEOM_PLANE_PVC - Point + Vecteur Coordonnes - - - GEOM_PLANE_SIZE - Taille du plan : - - - GEOM_PLANE_TITLE - Construction d'un Plan - - - GEOM_POINT - Point - - - GEOM_POINTS - Points - - - GEOM_POINT_I - Point %1 - - - GEOM_POINT_MIRROR - Point Miroir - - - GEOM_POINT_TITLE - Construction d'un Point - - - GEOM_PRECISION - Prcision : - - - GEOM_PROPAGATE - Propagate - - - GEOM_PROPAGATE_TITLE - Propagate - - - GEOM_PROPERTIES - Basiques Proprietes - - - GEOM_PROPERTIES_CONSTR - Objet et ses Proprietes - - - GEOM_PROPERTIES_SURFACE - Surface : - - - GEOM_PROPERTIES_TITLE - Proprietes Basiques - - - GEOM_PROPERTIES_VOLUME - Volume : - - - GEOM_PRP_ABORT - L'opration a echou - - - GEOM_PRP_COMMAND - Pas de commande associe l'id = %1. - - - GEOM_PRP_DONE - Opration effectue - - - GEOM_PRP_LOADING - Chargement de %1 ... - - - GEOM_PRP_MIN_DIST - Min Distance non calculer - - - GEOM_PRP_NOT_FOR_VTK_VIEWER - Non permis dans viewer VTK - - - GEOM_PRP_NULLSHAPE - Erreur, objet inconsistant ou inappropri ! - - - GEOM_PRP_READY - Prt... - - - GEOM_PRP_SELECT_EDGE - Selectionner les edges et clicker sur Apply - - - GEOM_PRP_SELECT_FACE - Select les faces a supprimer et clicker sur Ok/Apply - - - GEOM_PRP_SELECT_FIRST - Selectionner la shape principale en premier - - - GEOM_PRP_SELECT_SUBSHAPES - Selection de sous objets - - - GEOM_PRP_SHAPE_IN_STUDY - La shape principale doit etre avant dans l'etude - - - GEOM_RADIUS - Rayon - - - GEOM_RADIUS_I - Rayon %1 - - - GEOM_RADIUS_MAJOR - Rayon max. : - - - GEOM_RADIUS_MINOR - Rayon min. : - - - GEOM_REALLY_DELETE - Voulez-vous supprimer l'object(s) ? - - - GEOM_RECONSTRUCTION_LIMIT - Limite de Reconstruction - - - GEOM_RECONSTRUCTION_LIMIT_EDGE - Edge - - - GEOM_RECONSTRUCTION_LIMIT_FACE - Face - - - GEOM_RECONSTRUCTION_LIMIT_SHAPE - Shape - - - GEOM_RECONSTRUCTION_LIMIT_SHELL - Shell - - - GEOM_RECONSTRUCTION_LIMIT_SOLID - Solid - - - GEOM_RECONSTRUCTION_LIMIT_VERTEX - Vertex - - - GEOM_RECONSTRUCTION_LIMIT_WIRE - Wire - - - GEOM_REMOVE_WEBS - Remove webs - - - GEOM_REVERSE - Renverser - - - GEOM_REVERSE_U - Renverser U - - - GEOM_REVERSE_V - Reverser V - - - GEOM_REVERSE_VECTOR - Renverser Le Vecteur - - - GEOM_REVOLUTION - Rvolution - - - GEOM_REVOLUTION_TITLE - Construction Par Revolution - - - GEOM_ROTATION - Rotation - - - GEOM_ROTATION_TITLE - Rotation d'un Objet - - - GEOM_SCALE - Echelle - - - GEOM_SCALE_FACTOR - Facteur d'echelle - - - GEOM_SCALE_TITLE - Echelle d'un Objet - - - GEOM_SECTION - Section - - - GEOM_SECTION_TITLE - BOOLEEN : Section De Deux Objets - - - GEOM_SELECTION - Slection - - - GEOM_SET_MATERIALS - Set materials - - - GEOM_SEWING - Coudre - - - GEOM_SEWING_TITLE - Coudre des Topologies - - - GEOM_SHAPE - Shape - - - GEOM_SHELL - Shell - - - GEOM_SHELLS - Shells - - - GEOM_SHELL_TITLE - Construction d'une Shell - - - GEOM_SKETCHER_ABS - Absolu - - - GEOM_SKETCHER_ANGLE - Angle - - - GEOM_SKETCHER_ANGLE2 - Angle : - - - GEOM_SKETCHER_APPLY - Appliquer - - - GEOM_SKETCHER_ARC - Arc - - - GEOM_SKETCHER_DEST - Destination - - - GEOM_SKETCHER_DIR - Direction - - - GEOM_SKETCHER_DX2 - DX : - - - GEOM_SKETCHER_DY2 - DY : - - - GEOM_SKETCHER_EL - Type d'Element - - - GEOM_SKETCHER_LENGTH - Longueur - - - GEOM_SKETCHER_LENGTH2 - Longueur : - - - GEOM_SKETCHER_PER - Perpendiculaire - - - GEOM_SKETCHER_POINT - Point - - - GEOM_SKETCHER_POINT2 - Point : - - - GEOM_SKETCHER_RADIUS2 - Radius : - - - GEOM_SKETCHER_REL - Relative - - - GEOM_SKETCHER_SEGMENT - Sgment - - - GEOM_SKETCHER_SEL - Slection - - - GEOM_SKETCHER_TAN - Tangent - - - GEOM_SKETCHER_TITLE - Construction de Sketch - - - GEOM_SKETCHER_TYPE - Type - - - GEOM_SKETCHER_UNDO - Undo - - - GEOM_SKETCHER_VALUES - Valeurs - - - GEOM_SKETCHER_VX2 - VX : - - - GEOM_SKETCHER_VXVY - VX-VY - - - GEOM_SKETCHER_VY2 - VY : - - - GEOM_SKETCHER_X - X - - - GEOM_SKETCHER_X2 - X : - - - GEOM_SKETCHER_X3 - Abs. X : - - - GEOM_SKETCHER_Y - Y - - - GEOM_SKETCHER_Y2 - Y : - - - GEOM_SKETCHER_Y3 - Abs. Y : - - - GEOM_SOLID - Solide - - - GEOM_SOLID_TITLE - Construction d'un Solid - - - GEOM_SPHERE - Sphre - - - GEOM_SPHERE_CR - Centre + rayon - - - GEOM_SPHERE_RO - Rayon a l'origine - - - GEOM_SPHERE_TITLE - Construction d'une Sphere - - - GEOM_SPLINE - Spline - - - GEOM_SPLINE_TITLE - Construction de Splines - - - GEOM_STEP - Pas : - - - GEOM_STEP_TITLE - Increment par dfaut lors des constructions - - - GEOM_STEP_U - Pas U : - - - GEOM_STEP_V - Pas V : - - - GEOM_SUBSHAPE_SELECT - Selectionner de Sous Shapes - - - GEOM_SUBSHAPE_TITLE - Selection de Sous Shapes - - - GEOM_SUBSHAPE_TYPE - Type de Sous Shapes - - - GEOM_SUB_SHAPE - Sous Shapes - - - GEOM_SUPPRESSHOLE_FACE_SHELL - Face ou shell - - - GEOM_SUPPRESSHOLE_SELECTFACE - Selection de la face initiale - - - GEOM_SUPPRESSHOLE_SELECTFACE_END - Selection de la face terminale (si trou traversant) - - - GEOM_SUPPRESSHOLE_SELECTWIRE - Selection du contour/trou sur la face - - - GEOM_SUPPRESSHOLE_SELECTWIRE_END - Selection de contour final (si trou traversant) - - - GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE - Selection de trou(s) sur la face - - - GEOM_SUPPRESSHOLE_TITLE - Suppression de trous - - - GEOM_SUPPRESS_RESULT - Supprimer le Resultat - - - GEOM_SUPPRESS_RESULT_INSIDE - Intrieur - - - GEOM_SUPPRESS_RESULT_OUTSIDE - Extrieur - - - GEOM_SUPRESSFACE - Supression de Face - - - GEOM_SUPRESSFACE_SELECT - Selectionner les Faces a Supprimer - - - GEOM_SUPRESSFACE_TITLE - Supprimer des Faces dans un Objet - - - GEOM_SURFCONE - Face Conique - - - GEOM_SURFCYLINDER - Face Cylindrique - - - GEOM_SURFSPHERE - Face Sphrique - - - GEOM_SURFTORUS - Face Toroique - - - GEOM_TOLERANCE - Tolrance - - - GEOM_TOLERANCE_CONSTR - Object et ses Tolerances - - - GEOM_TOLERANCE_EDGE - Edge : - - - GEOM_TOLERANCE_FACE - Face : - - - GEOM_TOLERANCE_TITLE - Tolerance Maximale - - - GEOM_TOLERANCE_VERTEX - Vertex : - - - GEOM_TOOL_OBJECT - Objet Outil - - - GEOM_TORUS - Tore - - - GEOM_TORUS_TITLE - Constructiond'un Tore - - - GEOM_TRANSLATION - Translation - - - GEOM_TRANSLATION_COOR - Translation Avec Coordonnees - - - GEOM_TRANSLATION_TITLE - Translation d'un Objet - - - GEOM_TRANSPARENCY_OPAQUE - Opaque - - - GEOM_TRANSPARENCY_TITLE - Transparence - - - GEOM_TRANSPARENCY_TRANSPARENT - Transparent - - - GEOM_VECTOR - Vecteur - - - GEOM_VECTOR_LENGTH - Longueur Du Vecteur : - - - GEOM_VECTOR_TITLE - Construction d'un Vecteur - - - GEOM_VECTOR_U - Vecteur U - - - GEOM_VECTOR_V - Vecteur V - - - GEOM_VERTEX - Vertex - - - GEOM_WATER_DENSITY - Densit de l'eau : - - - GEOM_WEIGHT - poids - - - GEOM_WHATIS - Whatis - - - GEOM_WHATIS_OBJECT - Objet et ses Informations Topologiques - - - GEOM_WHATIS_TITLE - Whatis - - - GEOM_WIRE - Wire - - - GEOM_WIRES - Wire(s) - - - GEOM_WIRE_CONNECT - Creation d'un Wire a partir de wires/edges connectes - - - GEOM_WIRE_TITLE - Creer un Wire - - - GEOM_WPLANE - Plan de Travail - - - GEOM_WPLANE_FACE - Plan Ou Face plane - - - GEOM_WPLANE_TITLE - plan de travail - - - GEOM_WRN_RADIUS_NULL - Le rayon est nul - - - GEOM_WRN_WARNING - Avertissement - - - GEOM_X - X : - - - GEOM_Y - Y : - - - GEOM_Z - Z : - - - SUPPRESS_RESULT - Suppress Result - - + + + @default + + BRep_API: command not done + Erreur: impossible de construire l'objet + + + CHANGE_ORIENTATION_NEW_OBJ_NAME + Inverser + + + EDGE_WIDTH_TLT + Epaisseur des arêtes + + + ISOS_WIDTH_TLT + Epaisseur des isos + + + CLOSE_CONTOUR_NEW_OBJ_NAME + Contour fermé + + + DEP_OBJECT + L'objet choisi a été utilisé pour créer un autre objet. +Il n'est pas possible de le supprimer + + + DEVIDE_EDGE_NEW_OBJECT_NAME + Nouvel objet + + + ERROR_SHAPE_TYPE + Le type de l'objet choisi n'est pas correct! +Choisissez une face, une coque ou un solide et essayez de nouveau + + + iErr : 10 + le classificateur est NULL + + + iErr : 11 + la forme est NULL + + + iErr : 12 + Type d'objet non autorisé + + + iErr : 13 + Cet état n'est pas autorisé + + + iErr : 15 + Ce type de surface n'est pas autorisé + + + iErr : 20 + Impossible de trouver la triangulation + + + iErr : 30 + Impossible d'obtenir la ligne à partir du lien + + + iErr : 40 + Impossible de classifier le point + + + iErr : 41 + Les données ne sont pas valides pour le classificateur + + + GEOM_2D_CONTINUTY + Continuité 2D + + + GEOM_2D_CURVE_MODE + Mode courbe 2D + + + GEOM_2D_TOLERANCE + Tolérance 2D + + + GEOM_3D_CONTINUTY + Continuité 3D + + + GEOM_3D_CURVE_MODE + Mode courbe 3D + + + GEOM_3D_TOLERANCE + Tolérance 3D + + + GEOM_3_POINTS + 3 points + + + GEOM_ADD_POINT + Ajouter un point + + + GEOM_ANGLE + Angle : + + + GEOM_ANGLE_1 + Angle + + + GEOM_ARC_ELLIPSE + Arc d'ellipse + + + GEOM_ARC + Arc + + + GEOM_ARCHIMEDE + Archimède + + + GEOM_ARCHIMEDE_TITLE + Construction Archimède + + + GEOM_ARC_TITLE + Construction d'un arc + + + GEOM_ARGUMENTS + Arguments + + + GEOM_AXE_MIRROR + Axe de symétrie + + + GEOM_AXIS + Axe + + + GEOM_BASE + Base + + + GEOM_BASE_OBJECT + Objet de base + + + GEOM_BASE_POINT + Point de base + + + GEOM_BEZIER + Bezier + + + GEOM_BINORMAL + BiNormal + + + GEOM_BLOCK + Solide hexaédrique + + + GEOM_BLOCKS_COMPOUND + Assemblage de blocs + + + GEOM_BLOCK_EXPLODE + Sous-blocs + + + GEOM_BLOCK_EXPLODE_TITLE + Sélection des sous-blocs + + + GEOM_BLOCK_MULTITRSF + Multi-transformation de blocs + + + GEOM_BLOCK_MULTITRSF_DOUBLE + Multi-transformation double + + + GEOM_BLOCK_MULTITRSF_SIMPLE + Multi-transformation simple + + + GEOM_BLOCK_MULTITRSF_TITLE + Multi-transformation de blocs + + + GEOM_BLOCK_TITLE + Construction d'un solide hexaédrique + + + GEOM_BNDBOX + Boîte englobante + + + GEOM_BNDBOX_OBJDIM + Objet et ses dimensions + + + GEOM_BNDBOX_TITLE + Boîte englobante + + + GEOM_BOX + Boite + + + GEOM_BOX_OBJ + Dimensions à l'origine + + + GEOM_BOX_TITLE + Construction d'une boîte + + + GEOM_BSplineRestriction + Limitation BSpline + + + GEOM_BUT_APPLY + &Appliquer + + + GEOM_BUT_CANCEL + A&nnuler + + + GEOM_BUT_CLOSE + &Fermer + + + GEOM_BUT_CLOSE_SKETCH + Fermer le contour + + + GEOM_BUT_END_SKETCH + Valider l'esquisse + + + GEOM_BUT_EXPLODE + &Eclater + + + GEOM_BUT_HELP + &Aide + + + GEOM_BUT_NO + &Non + + + GEOM_BUT_OK + &Oui + + + GEOM_BUT_APPLY_AND_CLOSE + A&ppliquer et fermer + + + GEOM_BUT_YES + &Oui + + + GEOM_BY_LENGTH + Par longueur + + + GEOM_BY_PARAMETER + Par paramètre + + + GEOM_CENTER + Centre + + + GEOM_CENTER_DEFAULT + (Origine par défaut) + + + GEOM_CENTER_POINT + Point central + + + GEOM_CENTRAL_POINT + Point central + + + GEOM_CHAMFER + Chanfrein + + + GEOM_CHAMFER_ABORT + Il n'est pas possible de calculer un chanfrein avec %1 et %2 + + + GEOM_CHAMFER_ALL + Chanfrein sur l'objet + + + GEOM_CHAMFER_EDGES + Chanfrein sur des arêtes + + + GEOM_CHAMFER_FACES + Chanfrein sur des faces + + + GEOM_CHAMFER_TITLE + Construction d'un chanfrein + + + GEOM_CHANGE_ORIENTATION + Objets à modifier + + + GEOM_CHANGE_DIRECTION + Changer la direction + + + GEOM_CHANGE_ORIENTATION_TITLE + Changer l'orientation + + + GEOM_CHECK_BLOCKS_COMPOUND + Contrôler un assemblage de blocs + + + GEOM_CHECK_BLOCKS_COMPOUND_FAILED + La vérification n'a pas abouti + + + GEOM_CHECK_BLOCKS_COMPOUND_ERRORS + Erreurs + + + GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS + L'Assemblage de blocs contient des erreurs + + + GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS + L'Assemblage de blocs n'a pas d'erreur + + + GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES + Sous-objets incriminés + + + GEOM_CHECK_INFOS + Objet et son information topologique + + + GEOM_CHECK_SHAPE + Contrôler un objet + + + GEOM_CHECK_TITLE + Contrôler la validité de l'objet + + + GEOM_CHECK_SELF_INTERSECTIONS + Détecter les auto-intersections + + + GEOM_CHECK_SELF_INTERSECTIONS_FAILED + La détection d'auto-intersections a échoué + + + GEOM_NO_SELF_INTERSECTIONS + Il n'y a pas d'auto-intersection dans la géométrie + + + GEOM_SELF_INTERSECTIONS_FOUND + Des auto-intersections ont été détectées + + + GEOM_CIRCLE + Cercle + + + GEOM_CIRCLE_TITLE + Construction d'un cercle + + + GEOM_CLOSECONTOUR_TITLE + Fermer le contour + + + GEOM_CMASS + Centre de gravité + + + GEOM_CMASS_TITLE + Construction du centre de gravité + + + GEOM_COMMON + Intersection + + + GEOM_COMMON_TITLE + Intersection de deux objets + + + GEOM_COMPOUND + Assemblage + + + GEOM_COMPOUNDSOLID + Assemblage solide + + + GEOM_COMPOUND_TITLE + Créer un assemblage + + + GEOM_CONE + Cône + + + GEOM_CONE_TITLE + Construction d'un cône + + + GEOM_CONFIRM + Confirmer l'opération + + + GEOM_CONFIRM_INFO + L'objet contient %1 sous-objets ! + + + GEOM_COOR + Coord. : + + + GEOM_COORDINATES + Coordonnées + + + GEOM_COORDINATES_RES + Coordonnées résultantes + + + GEOM_CREATE_COPY + Créer une copie + + + GEOM_CREATE_SINGLE_SOLID + Créer un solide unique + + + GEOM_CURVE + Courbe + + + GEOM_CURVE_CONTINUTY + Continuité des courbes + + + GEOM_CURVE_TITLE + Construction d'une courbe + + + GEOM_CUT + Découpe + + + GEOM_CUT_TITLE + Découpe de deux objets + + + GEOM_CYLINDER + Cylindre + + + GEOM_CYLINDER_TITLE + Construction d'un cylindre + + + GEOM_D1 + D1 : + + + GEOM_D2 + D2 : + + + GEOM_DETECT + Détecter + + + GEOM_DIAGONAL_POINTS + Points diagonaux + + + GEOM_DISK + Disque + + + GEOM_DISK_TITLE + Construction d'un disque + + + GEOM_DIMENSIONS + Dimensions + + + GEOM_SKETCHER_DIST + Distance + + + GEOM_DISTANCE + Distance + + + 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 : + + + GEOM_DY + Dy : + + + GEOM_DZ + Dz : + + + GEOM_DropSmallEdges + Arêtes mineures omises + + + GEOM_DRAFT_ANGLE + Angle de dépouille + + + GEOM_EDGE + Arête + + + GEOM_EDGE_TITLE + Créer une arête + + + GEOM_ELLIPSE + Ellipse + + + GEOM_ELLIPSE_ERROR_1 + Impossible de créer une ellipse: le demi petit axe est plus grand que le demi grand axe. + + + GEOM_ELLIPSE_TITLE + Construction d'une ellipse + + + GEOM_END_LCS + Fin SCL + + + GEOM_ERROR + Erreur + + + GEOM_ERROR_STATUS + Etat de l'opération + + + GEOM_ERR_GET_ENGINE + Il est impossible d'obtenir le composant GEOM Engine. Rouvrez le module Geometry et essayez de nouveau. + + + GEOM_ERR_LIB_NOT_FOUND + Il est impossible de trouver ou d'ouvrir la librairie IHM correspondante à l'action de l'utilisateur + + + GEOM_EXTRUDED_CUT_TITLE + Enlèvement de matière extrudé + + + GEOM_EXTRUDED_CUT + Enlèvement_extrudé + + + GEOM_EXTRUDED_BOSS_TITLE + Bossage extrudé + + + GEOM_EXTRUDED_BOSS + Bossage_extrudé + + + GEOM_EXTRUSION + Extrusion + + + GEOM_EXTRUSION_BSV + Formes de base + vecteur + + + GEOM_EXTRUSION_BSV_2P + Formes de base + 2 points + + + GEOM_EXTRUSION_DXDYDZ + Formes de base + vecteur DX DY DZ + + + GEOM_EXTRUSION_TITLE + Construction par extrusion + + + GEOM_SCALE_PRISM + Appliquer le facteur d'échelle + + + GEOM_FACE + Face + + + GEOM_CS + Système de coordonnées + + + GEOM_GCS + Système de coordonnées global + + + GEOM_LCS + Système de coordonnées local + + + GEOM_FACES + Faces + + + GEOM_FACE_FFW + Création d'une face à partir des contours et/ou arêtes + + + GEOM_FACE_OPT + Privilégier la création d'une face plane + + + MAKE_FACE_TOLERANCE_TOO_BIG + Impossible de construire une face plane: + la face créée a une tolérance trop élevée + + + GEOM_FACE_OR_LCS + Face ou SCL + + + GEOM_FACE_SELECTION + Sélection d'une face + + + GEOM_FACE_TITLE + Créer une face + + + GEOM_RECTANGLE_TITLE + Construction d'un rectangle + + + GEOM_RECTANGLE + Rectangle + + + GEOM_FILLET + Congé + + + GEOM_FILLET_2D + Congé 2D + + + GEOM_FILLET_1D + Congé 1D + + + GEOM_FILLET_ABORT + Il n'est pas possible de calculer un congé avec le rayon %1 + + + GEOM_FILLET_ALL + Congé sur l'objet + + + GEOM_FILLET_EDGES + Congé sur des arêtes + + + GEOM_FILLET_FACES + Congé sur des faces + + + GEOM_FILLET_TITLE + Construction d'un congé + + + GEOM_FILLET_2D_TITLE + Construction d'un congé 2D + + + GEOM_FILLET_1D_TITLE + Construction d'un congé 1D + + + GEOM_FILLING + Remplissage + + + GEOM_FILLING_ARG + Arguments et paramètres + + + GEOM_FILLING_COMPOUND + Assemblage d'entrée + + + GEOM_FILLING_MAX_DEG + Degré maximal + + + GEOM_FILLING_MIN_DEG + Degré minimal + + + GEOM_FILLING_NB_ITER + Nb. Itér : + + + GEOM_FILLING_TITLE + Remplir une surface avec des arêtes + + + GEOM_FILLING_TOL_2D + Tol. 2D : + + + GEOM_FILLING_TOL_3D + Tol. 3D : + + + GEOM_FREE_BOUNDARIES + Contours libres + + + GEOM_FREE_BOUNDS_ERROR + L'objet n'est pas sélectionné + + + GEOM_FREE_BOUNDS_MSG + Contours libres trouvés: %1 (%2 fermés, %3 ouverts) + + + GEOM_FREE_BOUNDS_TLT + Trouver des contours libres + + + GEOM_FREE_FACES + Faces libres + + + GEOM_FREE_FACES_TITLE + Faces libres + + + GEOM_FUSE + Union + + + GEOM_FUSE_TITLE + Réunir deux objets + + + GEOM_FixFaceSize + Répare la taille des faces + + + GEOM_FixShape + Répare l'objet + + + GEOM_GLUE + Recoller + + + GEOM_GLUE_FACES_TITLE + Recoller les faces + + + GEOM_GLUE_EDGES_TITLE + Recoller les arêtes + + + GLUE_ERROR_STICKED_SHAPES + La valeur de la tolérance est trop importante. Détection de shapes "sticked". + + + GEOM_LIMIT_TOLERANCE_TITLE + Limiter la tolérance + + + GEOM_HEIGHT + Hauteur: + + + GEOM_HEXAGON + Héxagone + + + GEOM_HOLES + Trous + + + GEOM_INIT_SHAPE + Objet d'origine + + + GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE + Noms identiques : sélectionner à la souris ! + + + GEOM_IMPORT + Objet_importé + + + GEOM_INCORRECT_INPUT + Les données d'entrée ne sont pas valides! + + + GEOM_INERTIA_CONSTR + Matrice et moment d'inertie + + + GEOM_INERTIA_I + %1:1 : + + + GEOM_INERTIA_IXYZ + IX & IY & IZ : + + + GEOM_INERTIA_TITLE + Calcul de l'inertie + + + GEOM_INF_LOADED + Le fichier %1 est ouvert. + + + GEOM_INTERNAL_WIRES + Contours internes + + + GEOM_INTERPOL + Interpolation + + + GEOM_KEEP_OBJECT + Garder l'objet + + + GEOM_LENGTH + Longueur : + + + GEOM_LINE + Ligne + + + GEOM_LINE_TITLE + Construction d'une ligne + + + GEOM_MAIN_OBJECT + Objet principal + + + GEOM_MARKER + Repère + + + GEOM_MARKER_TITLE + Créer une repère + + + GEOM_MATERIAL_ID + ID matériau: + + + GEOM_MATERIAL_MATERIAL + Matériau + + + GEOM_MATERIAL_SET + << jeu + + + GEOM_MATERIAL_SHAPE + Formes + + + GEOM_MATERIAL_TITLE + Définir les matériaux pour la fusion dominante + + + GEOM_MATRIX + Matrice : + + + GEOM_MAX + Max : + + + GEOM_MAX_3D_TOLERANCE + Tolérance 3D maximale + + + GEOM_MAX_TOLERANCE + Tolérance maximale + + + GEOM_MEN_ALL_FILES + Tous les fichiers ( * ) + + + GEOM_MEN_ANGLE + Angle : + + + GEOM_MEN_COMPONENT + Géométrie + + + GEOM_MEN_ENTER_ANGLE + Indiquez l'angle en degrés + + + GEOM_MEN_EXPORT + Exporter + + + GEOM_MEN_IMPORT + Importer + + + GEOM_MEN_ISOS + Choisir le nombre d'isolignes + + + GEOM_MEN_ISOU + Isos U : + + + GEOM_MEN_ISOV + Isos V : + + + GEOM_MEN_POPUP_NAME + %1 objets + + + GEOM_MEN_SHADING + Ombrage + + + GEOM_MEN_SHADING_WITH_EDGES + Ombrage avec arêtes + + + GEOM_MEN_SKETCHER_X + Indiquez la distance selon l'axe X + + + GEOM_MEN_SKETCHER_Y + Indiquez la distance selon l'axe Y + + + GEOM_MEN_STEP_LABEL + Pas : + + + GEOM_MEN_TRANSPARENCY + Transparence + + + GEOM_MEN_TRANSPARENCY_LABEL + Transparence : + + + GEOM_MEN_WIREFRAME + Filaire + + + GEOM_MEN_X + X : + + + GEOM_MEN_Y + Y : + + + GEOM_MESHING_DEFLECTION + Déflection de maillage. : + + + GEOM_MIN + Min : + + + GEOM_MINDIST_OBJ + Objets et résultats + + + GEOM_MINDIST_TITLE + Distance minimale entre deux objets + + + GEOM_MIRROR + Miroir + + + GEOM_MIRROR_TITLE + Refléter un objet + + + GEOM_MULTIROTATION + Multi-rotation + + + GEOM_MULTIROTATION_DOUBLE + Multi rotation double + + + GEOM_MULTIROTATION_SIMPLE + Multi rotation simple + + + GEOM_MULTIROTATION_TITLE + Multi-rotation + + + GEOM_MULTITRANSLATION + Multi-translation + + + GEOM_MULTITRANSLATION_DOUBLE + Multi translation double + + + GEOM_MULTITRANSLATION_SIMPLE + Multi translation simple + + + GEOM_MULTITRANSLATION_TITLE + Multi-translation + + + GEOM_NAME_INCORRECT + Le nom de l'objet n'a pas été trouvé + + + GEOM_NB_BLOCKS_NO_OTHERS + Il y a %1 bloc(s) spécifié(s) et PAS d'autres solides + + + GEOM_NB_BLOCKS_SOME_OTHERS + Il y a %1 bloc(s) spécifié(s) et d'autres solides + + + GEOM_NB_TIMES + Nb. fois : + + + GEOM_NB_TIMES_U + Nb. fois U : + + + GEOM_NB_TIMES_V + Nb. fois V : + + + GEOM_NODES + Noeuds + + + GEOM_NUM_SPLIT_POINTS + Nombre de points de découpe + + + GEOM_OBJECT + Objet + + + GEOM_OBJECT_TYPE + Type d'objet + + + GEOM_OBJECTS + Objets + + + GEOM_OBJECT_I + Objet %1 + + + GEOM_OBJECT_RESULT + Objet et résultat + + + GEOM_OFFSET + Décalage + + + GEOM_OFFSET_TITLE + Décaler une surface + + + GEOM_PATTERN + Schema de découpe + + + GEOM_PROJECTION + Projection + + + GEOM_PROJECTION_TITLE + Projection sur une face + + + GEOM_SOURCE_OBJECT + Point, arête ou contour de source + + + GEOM_TARGET_OBJECT + Face d'objectif + + + GEOM_OPERATIONS + Opérations + + + GEOM_ORIENTATION + Orientation + + + GEOM_ORIENTATION_OPT + Inverser l'orientation et simuler les vecteurs normaux + + + GEOM_ORIENTATION_TITLE + Changer l'orientation + + + GEOM_PARAMETER + Paramètre : + + + GEOM_PARAMETERS + Paramètres + + + GEOM_POINT_ON_EDGE + Créer un point sur une arête + + + GEOM_POINT_ON_FACE + Créer un point sur une face + + + GEOM_PARAM_VALUE + Par paramètre + + + GEOM_COORD_VALUE + Par coordonnée + + + GEOM_LENGTH_VALUE + Par longueur + + + GEOM_PARTITION + Partition + + + GEOM_WRN_PARTITION_RESULT_EMPTY + Le résultat de la partition est vide, vérifiez le paramètre "Type résultant" + + + GEOM_PARTITION_HALFSPACE + Partition de demi-espace + + + GEOM_PARTITION_ORIENTATION + Changer l'orientation + + + GEOM_PARTITION_TITLE + Partition d'un objet avec un outil + + + GEOM_PATH_OBJECT + Chemin + + + GEOM_PIPE + Tuyau + + + GEOM_PIPE_TITLE + Construction d'un tuyau + + + GEOM_PROFILE + Profile + + + GEOM_SEGMENT + Segment de droite + + + GEOM_SELECT_UNPUBLISHED_EDGES + Choisir les arêtes non-publiées + + + GEOM_PLANE + Plan + + + GEOM_PLANE_MIRROR + Plan miroir + + + GEOM_PLANE_PV + Point + vecteur + + + GEOM_PLANE_PVC + Point + vecteur de coordonnées + + + GEOM_PLANE_SIZE + Taille du plan : + + + GEOM_PLANE_TITLE + Construction d'un plan + + + GEOM_POINT + Point + + + GEOM_POINT1 + Point 1 + + + GEOM_POINT2 + Point 2 + + + GEOM_POINT3 + Point 3 + + + GEOM_POINTS + Points + + + GEOM_POINT_I + Point %1 + + + GEOM_POINT_MIRROR + Point miroir + + + GEOM_POINT_TITLE + Construction d'un point + + + GEOM_START_POINT + Point de départ + + + GEOM_POLYLINE + Ligne brisée + + + GEOM_POSITION + Position + + + GEOM_POSITION_TITLE + Modifier la position d'un objet + + + GEOM_PRECISION + Précision : + + + GEOM_PROPAGATE + Propager + + + GEOM_PROPAGATE_TITLE + Propager + + + GEOM_PROPERTIES + Propriétés de base + + + GEOM_PROPERTIES_CONSTR + Objet et ses propriétés + + + GEOM_PROPERTIES_SURFACE + Surface : + + + GEOM_PROPERTIES_TITLE + Propriétés de base + + + GEOM_PROPERTIES_VOLUME + Volume : + + + GEOM_PRP_ABORT + L'opération a été annulée + + + GEOM_PRP_COMMAND + Pas de commandes associées avec cet id = %1. + + + GEOM_PRP_DONE + L'opération a abouti + + + GEOM_PRP_EXPORT + Exporter la géométrie à %1 ... + + + GEOM_PRP_LOADING + Charger %1 ... + + + GEOM_PRP_MIN_DIST + La distance minimale n'est pas calculée + + + GEOM_PRP_NOT_FOR_VTK_VIEWER + Interdit dans le visualiseur VTK + + + GEOM_PRP_NULLSHAPE + Erreur, l'objet est inexistant ou incorrect! + + + GEOM_PRP_READY + Prêt + + + GEOM_PRP_SELECT_EDGE + Choisissez les arêtes et cliquez sur Appliquer + + + GEOM_PRP_SELECT_FACE + Choisissez les faces à supprimer et cliquez sur Oui/Appliquer + + + GEOM_PRP_SELECT_FIRST + Commencez par choisir l'objet principal + + + GEOM_PRP_SELECT_SUBSHAPES + Choisissez les sous-objets + + + GEOM_PRP_SHAPE_IN_STUDY + Commencez par indiquer l'objet principal + + + GEOM_QUAD_FACE + Face quadrangulaire + + + GEOM_QUAD_FACE_TITLE + Construction d'une face quadrangulaire + + + GEOM_RADIUS + Rayon : + + + GEOM_RADIUS_I + Rayon %1 : + + + GEOM_RADIUS_MAJOR + Demi grand axe : + + + GEOM_RADIUS_MINOR + Demi petit axe : + + + GEOM_RECONSTRUCTION_LIMIT + Type résultant + + + GEOM_RECONSTRUCTION_LIMIT_EDGE + Arête + + + GEOM_RECONSTRUCTION_LIMIT_FACE + Face + + + GEOM_RECONSTRUCTION_LIMIT_SHAPE + Objet + + + GEOM_RECONSTRUCTION_LIMIT_SHELL + Coque + + + GEOM_RECONSTRUCTION_LIMIT_SOLID + Solide + + + GEOM_RECONSTRUCTION_LIMIT_VERTEX + Point + + + GEOM_RECONSTRUCTION_LIMIT_WIRE + Contour + + + GEOM_REF_POINT + Point avec référence + + + GEOM_REMOVE_ALL_HOLES + Supprimer tous les trous + + + GEOM_REMOVE_ALL_INT_WIRES + Supprimer tous les contours internes + + + GEOM_REMOVE_HOLES_TITLE + Supprimer les trous + + + GEOM_REMOVE_INTERNAL_WIRES_TITLE + Supprimer les contours internes + + + GEOM_REMOVE_WEBS + Supprimer les toiles + + + GEOM_REQUIRED_DEGREE + Degré nécessaire + + + GEOM_REQUIRED_NUM_SEGMENTS + Nombre de segments requis + + + GEOM_REVERSE + Inverser + + + GEOM_REVERSE_DIRECTION + Inverser la direction + + + GEOM_REVERSE_PLANE + Inverser la normale du plan + + + GEOM_REVERSE_U + Inverser U + + + GEOM_REVERSE_V + inverser V + + + GEOM_REVERSE_VECTOR + Inverser un vecteur + + + GEOM_REVOLUTION + Révolution + + + GEOM_REVOLUTION_TITLE + Construction par révolution + + + GEOM_ROTATION + Rotation + + + GEOM_ROTATION_TITLE + Rotation d'un objet + + + GEOM_SCALE + Echelle + + + GEOM_SCALE_FACTOR + Facteur d'échelle : + + + GEOM_SCALE_TITLE + Redimensionner un objet + + + GEOM_SECTION + Section + + + GEOM_SECTION_TITLE + Section de deux objets + + + GEOM_SELECTED_FACE + Face sélectionnée + + + GEOM_SELECTED_OBJECTS + Objets sélectionnés + + + GEOM_SELECTED_SHAPE + Forme sélectionnée + + + GEOM_SELECTION + Sélection + + + GEOM_SET_MATERIALS + Définir les matériaux + + + GEOM_SEWING + Couture + + + GEOM_SEWING_TITLE + Couture topologique + + + GEOM_SHAPE + Forme + + + GEOM_SHAPEPROCESS_TITLE + Traitement de formes + + + GEOM_SHAPES + Formes + + + GEOM_SHELL + Coque + + + GEOM_SHELLS + Coques + + + GEOM_SHELL_TITLE + Construction d'une coque + + + GEOM_SKETCH + Esquisse + + + GEOM_SKETCHER_ABS + Absolu + + + GEOM_SKETCHER_ADD_PARAMS + Paramètre additionnel + + + GEOM_SKETCHER_ANGLE + Angle + + + GEOM_SKETCHER_ANGLE2 + Angle : + + + GEOM_SKETCHER_APPLY + Appliquer + + + GEOM_SKETCHER_ARC + Arc + + + GEOM_SKETCHER_CENTER + Centre + + + GEOM_SKETCHER_CENTER2 + Centre : + + + GEOM_SKETCHER_WARNING + Attention : point final distant de l'arc de : + + + GEOM_SKETCHER_CENTER_X + X centre : + + + GEOM_SKETCHER_CENTER_Y + Y centre : + + + GEOM_SKETCHER_CENTER_DX + DX centre : + + + GEOM_SKETCHER_CENTER_DY + DY centre : + + + GEOM_SKETCHER_DEST + Destination + + + GEOM_SKETCHER_DIR + Direction + + + GEOM_SKETCHER_DX2 + DX : + + + GEOM_SKETCHER_DY2 + DY : + + + GEOM_SKETCHER_DZ2 + DZ : + + + GEOM_SKETCHER_EL + Type d'élément + + + GEOM_SKETCHER_RESTORE + Restaurer + + + GEOM_SKETCHER_LENGTH + Longueur + + + GEOM_SKETCHER_LENGTH2 + Longueur : + + + GEOM_SKETCHER_NONE + Aucun (Tangentiel) + + + GEOM_SKETCHER_PER + Perpendiculaire + + + GEOM_SKETCHER_POINT + Point + + + GEOM_SKETCHER_POINT2 + Point : + + + GEOM_SKETCHER_END_POINT2 + Point d'arrivée : + + + GEOM_SKETCHER_RADIUS + Rayon + + + GEOM_SKETCHER_RADIUS2 + Rayon : + + + GEOM_SKETCHER_REL + Relatif + + + GEOM_SKETCHER_SEGMENT + Segment + + + GEOM_SKETCHER_SEL + Sélection + + + GEOM_SKETCHER_TAN + Tangent + + + GEOM_SKETCHER_TITLE + Construction d'une esquisse 2D + + + GEOM_3DSKETCHER_TITLE + Construction d'une esquisse 3D + + + GEOM_SKETCHER_TYPE + Type + + + GEOM_SKETCHER_UNDO + Revenir + + + GEOM_SKETCHER_VALUES + Valeurs + + + GEOM_SKETCHER_VX2 + VX : + + + GEOM_SKETCHER_VXVY + VX-VY + + + GEOM_SKETCHER_WPLANE + Sélectionnez une face plane ou un plan + + + GEOM_SKETCHER_VY2 + VY : + + + GEOM_SKETCHER_X + X + + + GEOM_SKETCHER_X2 + X : + + + GEOM_SKETCHER_X3 + DX : + + + GEOM_SKETCHER_Y + Y + + + GEOM_SKETCHER_Y2 + Y : + + + GEOM_SKETCHER_Y3 + DY : + + + GEOM_SKETCHER_Z2 + Z : + + + GEOM_3DSKETCHER + Esquisse 3D + + + GEOM_COORDINATES_TYPE + Type de coordonnées + + + GEOM_SOLID + Solide + + + GEOM_SOLID_TITLE + Construction d'un solide + + + GEOM_SPHERE + Sphère + + + GEOM_SPHERE_CR + Centre + Rayon + + + GEOM_SPHERE_RO + Rayon (centre à l'origine) + + + GEOM_SPHERE_TITLE + Construction d'une sphère + + + GEOM_SPLINE + Spline + + + GEOM_SPLINE_TITLE + Construction d'un spline + + + GEOM_SQUARE + Carré + + + GEOM_START_LCS + SCL du Début + + + SELECT_UNPUBLISHED_EDGES + Choisir les arêtes non-publiées + + + GEOM_STEP + Pas : + + + GEOM_STEP_TITLE + Valeur du pas pour les constructions d'IHM + + + GEOM_STEP_U + Pas U : + + + GEOM_STEP_V + Pas V : + + + GEOM_STUDY_LOCKED + L'étude en cours est fermée et il n'est pas possible de la modifier + + + GEOM_SUBSHAPE_SELECT + Choisir les sous-objets + + + GEOM_SUBSHAPE_TITLE + Sélection des sous-objets + + + GEOM_SUBSHAPE_TYPE + Type des sous-objets: + + + GEOM_SUB_SHAPE + Sous-objets + + + GEOM_SUPPRESSHOLE_FACE_SHELL + Face ou coque + + + GEOM_SUPPRESSHOLE_SELECTFACE + Choisir la face avec un trou + + + GEOM_SUPPRESSHOLE_SELECTFACE_END + Choisir la face finale (si l'on traverse le trou) + + + GEOM_SUPPRESSHOLE_SELECTWIRE + Choisir le contour d'une face + + + GEOM_SUPPRESSHOLE_SELECTWIRE_END + Choisir le contour final (si l'on traverse le trou) + + + GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE + Choisir les trous sur la face + + + GEOM_SUPPRESSHOLE_TITLE + Supprimer les trous + + + GEOM_SUPPRESS_RESULT + Supprimer le résultat + + + GEOM_SUPPRESS_RESULT_INSIDE + A l'intérieur + + + GEOM_SUPPRESS_RESULT_OUTSIDE + A l'extérieur + + + GEOM_SUPRESSFACE + Supprimer une Face + + + GEOM_SUPRESSFACE_SELECT + Choisissez les faces à supprimer + + + GEOM_SUPRESSFACE_TITLE + Supprimer les faces d'un objet + + + GEOM_SURFACE_CONTINUTY + Continuité des surfaces + + + GEOM_SURFACE_MODE + Mode de surface + + + GEOM_SURFCONE + Face conique + + + GEOM_SURFCYLINDER + Face cylindrique + + + GEOM_SURFSPHERE + Face sphérique + + + GEOM_SURFTORUS + Face toroïdale + + + GEOM_SameParameter + Paramètre identique + + + GEOM_SplitAngle + Séparer angle + + + GEOM_SplitClosedFaces + Séparer faces fermées + + + GEOM_SplitContinuity + Séparer continuité + + + GEOM_TOLERANCE + Tolérance + + + GEOM_LINEAR_TOLERANCE + Tolérance linéaire + + + GEOM_ANGULAR_TOLERANCE + Tolérance angulaire + + + GEOM_TOLERANCE_CONSTR + Objet et ses tolérances + + + GEOM_TOLERANCE_EDGE + Arête : + + + GEOM_TOLERANCE_FACE + Face : + + + GEOM_TOLERANCE_TITLE + Tolérance maximale + + + GEOM_TOLERANCE_VERTEX + Point: + + + GEOM_TOOL_OBJECT + Objet outil + + + GEOM_TOOL_OBJECTS + Objets outils + + + GEOM_TORUS + Tore + + + GEOM_TORUS_TITLE + Construction d'un tore + + + GEOM_TRANSLATION + Translation + + + GEOM_TRANSLATION_COOR + Translation avec coordonnées + + + GEOM_TRANSLATION_TITLE + Translation d'un objet + + + GEOM_TRANSPARENCY_OPAQUE + Opaque + + + GEOM_TRANSPARENCY_TITLE + Transparence + + + GEOM_TRANSPARENCY_TRANSPARENT + Transparent + + + GEOM_TRIHEDRON + Trièdre + + + GEOM_ToBezier + Vers bezier + + + GEOM_VALUE + Valeur + + + GEOM_VECTOR + Vecteur + + + GEOM_AXIS_DEFAULT + (Axe Z par défaut) + + + GEOM_VECTOR_LENGTH + Longueur d'un vecteur : + + + GEOM_VECTOR_TITLE + Construction d'un vecteur + + + GEOM_VECTOR_U + Vecteur U + + + GEOM_VECTOR_V + Vecteur V + + + GEOM_VERTEX + Sommet + + + GEOM_VERTEXES + Sommets + + + GEOM_WATER_DENSITY + Densité de l'eau : + + + GEOM_WEIGHT + Poids : + + + GEOM_WIDTH + Largeur : + + + GEOM_WHATIS + Qu'est-ce que c'est ? + + + GEOM_WHATIS_OBJECT + Objet et ses caractéristiques topologiques + + + GEOM_WHATIS_TITLE + Qu'est-ce que c'est ? + + + GEOM_WIRE + Contour + + + GEOM_WIRES + Contour(s) + + + GEOM_WIRES_TO_REMOVE + Contours à supprimer + + + GEOM_WIREZ + Contours + + + GEOM_WIRE_CONNECT + Création d'un contour à partir de contours/arêtes connecté(e)s + + + GEOM_WIRE_TITLE + Création d'un contour + + + GEOM_WPLANE + Plan de travail + + + GEOM_WPLANE_FACE + Plan, face plane ou SCL + + + GEOM_WPLANE_ORIGIN + Choisissez un plan + + + GEOM_WPLANE_OXY + OXY + + + GEOM_WPLANE_OYZ + OYZ + + + GEOM_WPLANE_OZX + OZX + + + GEOM_WPLANE_TITLE + Sélection du plan de travail + + + GEOM_WPLANE_VECTOR + Choisissez 2 vecteurs + + + GEOM_WPLANE_VX + Vecteur X + + + GEOM_WPLANE_VZ + Vecteur Z + + + GEOM_WRN_RADIUS_NULL + Le rayon est nul + + + GEOM_WRN_WARNING + Attention + + + WRN_SHAPE_UNCLOSED + Impossible de créer un solide à partir d'une forme non-fermée %1 + + + WRN_SHAPE_NOT_SHELL + Impossible de créer un solide à partir de la forme %1 car ce n'est pas une coque + + + WRN_NULL_OBJECT_OR_SHAPE + La forme %1 pour la création d'un solide est invalide + + + GEOM_X + X : + + + GEOM_Y + Y : + + + GEOM_Z + Z : + + + GLUE_NEW_OBJ_NAME + Recollement + + + LIMIT_TOLERANCE_NEW_OBJ_NAME + Tolérance_limite + + + MEN_ALL_SEL_ONLY + Sélectionner tout + + + MEN_ARC + Arc + + + MEN_ARCHIMEDE + Archimède + + + MEN_BASIC + Objets de base + + + MEN_BASIC_PROPS + Propriétés de base + + + MEN_BLOCKS + Blocs + + + MEN_BND_BOX + Boîte englobante + + + MEN_BOOLEAN + Opérations booléennes + + + MEN_BOX + Boîte + + + MEN_BUILD + Construire + + + MEN_FEATURE_DETECTION + Reconnaissance de formes + + + MEN_PICTURE_IMPORT + Importer une image dans la vue + + + MEN_CHAMFER + Chanfrein + + + MEN_CHANGE_ORIENTATION + Changer l'orientation + + + MEN_CHECK + Contrôler un objet + + + MEN_CHECK_COMPOUND + Contrôler un assemblage de blocs + + + MEN_CHECK_SELF_INTERSECTIONS + Détections des auto-intersections + + + MEN_CHECK_FREE_BNDS + Contrôler les contours libres + + + MEN_CHECK_FREE_FACES + Contrôler les faces libres + + + MEN_CHECK_GEOMETRY + Contrôler la géométrie + + + MEN_CIRCLE + Cercle + + + MEN_CLIPPING + Plage de découpe + + + MEN_CLOSE_CONTOUR + Fermer le contour + + + MEN_COMMON + Intersection + + + MEN_COMPOUND + Assemblage + + + MEN_COMPOUND_SEL_ONLY + Assemblage + + + MEN_CONE + Cône + + + MEN_CURVE + Courbe + + + MEN_CUT + Découpe + + + MEN_CYLINDER + Cylindre + + + MEN_RECTANGLE + Rectangle + + + MEN_DELETE + Supprimer + + + MEN_DIMENSIONS + Dimensions + + + MEN_DISPLAY + Afficher + + + 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 + + + MEN_DISPLAY_MODE + Mode de visualisation + + + MEN_DISPLAY_ONLY + Afficher uniquement + + + MEN_BRING_TO_FRONT + Afficher au premier plan + + + TOP_BRING_TO_FRONT + Afficher au premier plan + + + STB_BRING_TO_FRONT + Afficher au premier plan + + + MEN_CLS_BRING_TO_FRONT + Effacer les objets mis au premier plan + + + TOP_CLS_BRING_TO_FRONT + Effacer les objets mis au premier plan + + + STB_CLS_BRING_TO_FRONT + Effacer les objets mis au premier plan + + + MEN_EDGE + Arête + + + MEN_EDGE_SEL_ONLY + Arête + + + MEN_EDIT + Edition + + + MEN_ELLIPSE + Ellipse + + + MEN_ERASE + Cacher + + + MEN_ERASE_ALL + Cacher tout + + + MEN_EXPLODE + Eclater + + + MEN_EXPLODE_BLOCKS + Eclater en blocs + + + MEN_EXPORT + Exporter... + + + MEN_EXTRUSION + Extrusion + + + MEN_EXTRUDED_CUT + Enlèvement de matière extrudé + + + MEN_EXTRUDED_BOSS + Bossage extrudé + + + MEN_FACE + Face + + + MEN_FACE_SEL_ONLY + Face + + + MEN_FILE + Fichier + + + MEN_FILLET + Congé 3D + + + MEN_FILLET_1D + Congé 1D + + + MEN_FILLET_2D + Congé 2D + + + MEN_FILLING + Nappe + + + MEN_FUSE + Union + + + MEN_GENERATION + Génération + + + MEN_GLUE_FACES + Recoller les faces + + + MEN_GLUE_EDGES + Recoller les arêtes + + + MEN_GROUP + Groupe + + + MEN_GROUP_CREATE + Créer un groupe + + + MEN_GROUP_EDIT + Editer + + + MEN_RELOAD_IMPORTED + Recharger à partir du disque + + + MEN_HEX_SOLID + Solide hexaédrique + + + MEN_IMPORT + Importer... + + + MEN_INERTIA + Inertie + + + MEN_ISOS + Isos + + + MEN_LIMIT_TOLERANCE + Tolérance limite + + + MEN_LINE + Ligne + + + MEN_LOCAL_CS + Système de coordonnées local + + + MEN_MASS_CENTER + Centre de gravité + + + MEN_MEASURES + Mesures + + + MEN_MIN_DIST + Distance minimale + + + MEN_MIRROR + Symétrie + + + MEN_MODIFY_LOCATION + Modifier la position + + + MEN_MUL_ROTATION + Multi-rotation + + + MEN_MUL_TRANSFORM + Multi-transformation + + + MEN_MUL_TRANSLATION + Multi-translation + + + MEN_NEW_ENTITY + Nouvel objet + + + MEN_OFFSET + Décaler une surface + + + MEN_PROJECTION + Projection + + + MEN_OPERATIONS + Opérations + + + MEN_ORIGIN_AND_VECTORS + Vecteurs de base et origine + + + MEN_PARTITION + Partition + + + MEN_PIPE + Extrusion suivant un chemin + + + MEN_PLANE + Plan + + + MEN_POINT + Point + + + MEN_POINT_COORDS + Coordonnées d'un point + + + MEN_POINT_ON_EDGE + Ajouter un point sur l'arête + + + MEN_POP_COLOR + Couleur + + + MEN_POP_CREATE_GROUP + Créer un groupe + + + MEN_POP_SHOW_CHILDREN + Montrer les enfants + + + MEN_POP_HIDE_CHILDREN + Cacher les enfants + + + MEN_POP_UNPUBLISH_OBJ + Dépublier + + + MEN_POP_PUBLISH_OBJ + Publier... + + + MEN_POP_ISOS + Isos + + + MEN_POP_DEFLECTION + Coefficient de déformation + + + MEN_POP_RENAME + Renommer + + + MEN_POP_SHADING + Ombrage + + + MEN_POP_SHADING_WITH_EDGES + Ombrage avec arêtes + + + MEN_POP_TEXTURE + Texture + + + MEN_EDGE_WIDTH + Epaisseur d'arête + + + TOP_EDGE_WIDTH + Epaisseur d'arête + + + STB_EDGE_WIDTH + Epaisseur d'arête + + + MEN_ISOS_WIDTH + Epaisseur des isos + + + TOP_ISOS_WIDTH + Epaisseur des isos + + + STB_ISOS_WIDTH + Epaisseur des isos + + + MEN_LINE_WIDTH + Epaisseur des lignes + + + MEN_POP_SETTEXTURE + Texture + + + MEN_POP_TRANSPARENCY + Transparence + + + MEN_POP_WIREFRAME + Filaire + + + MEN_POP_VECTORS + Afficher l'orientation des arêtes + + + MEN_PREFERENCES + Préférences + + + MEN_PREFERENCES_GEOM + Géométrie + + + MEN_PRIMITIVES + Primitives + + + MEN_ADVANCED + Avancé + + + MEN_PROPAGATE + Propager + + + MEN_Q_FACE + Face quadrangulaire + + + MEN_REPAIR + Réparer + + + MEN_REVOLUTION + Révolution + + + MEN_ROTATION + Rotation + + + MEN_SCALE + Redimensionner + + + MEN_SECTION + Section + + + MEN_SELECT_ONLY + Sélectionner uniquement + + + MEN_SEWING + Couture + + + MEN_SHADING + Ombrage + + + MEN_SHADING_WITH_EDGES + Ombrage avec arêtes + + + MEN_SHADING_COLOR + Couleur d'ombrage + + + MEN_SHAPE_PROCESS + Traitement de forme + + + MEN_SHELL + Coque + + + MEN_SHELL_SEL_ONLY + Coque + + + MEN_SKETCH + Esquisse 2D + + + MEN_3DSKETCH + Esquisse 3D + + + MEN_SOLID + Solide + + + MEN_SOLID_SEL_ONLY + Solide + + + MEN_SPHERE + Sphère + + + MEN_STEP_VALUE + Valeur du pas + + + MEN_SUPPERSS_HOLES + Supprimer les trous + + + MEN_SUPPRESS_FACES + Supprimer des faces + + + MEN_SUPPRESS_INT_WIRES + Supprimer des contours internes + + + MEN_TOLERANCE + Tolérance + + + MEN_TOOLS + Outils + + + MEN_TORUS + Tore + + + MEN_TRANSFORMATION + Transformation + + + MEN_TRANSLATION + Translation + + + MEN_VECTOR + Vecteur + + + MEN_VERTEX_SEL_ONLY + Point + + + MEN_VIEW + Affichage + + + MEN_WHAT_IS + Qu'est-ce que c'est ? + + + MEN_WIRE + Contour + + + MEN_VECTOR_MODE_ON + Montrer l'orientation de l'arête + + + MEN_VECTOR_MODE_OFF + Cacher l'orientation de l'arête + + + MEN_WIREFRAME + Filaire + + + MEN_WIRE_SEL_ONLY + Contour + + + MEN_WORK_PLANE + Plan de travail + + + MEN_POP_POINT_MARKER + Marqueur de point + + + MEN_POP_MATERIAL_PROPERTIES + Propriétés des matériaux + + + NAME_LBL + Nom : + + + NON_GEOM_OBJECTS_SELECTED + Il y a des objets n'appartenant pas au composant %1 dans la sélection + + + PREF_DEFLECTION + Coefficient de déformation + + + GEOM_PREF_def_precision + Précision par défaut + + + GEOM_PREF_length_precision + Précision de longueur + + + GEOM_PREF_angle_precision + Précision angulaire + + + GEOM_PREF_len_tol_precision + Précision de la tolérance sur la longueur + + + GEOM_PREF_ang_tol_precision + Précision de la tolérance angulaire + + + GEOM_PREF_weight_precision + Précision de poids + + + GEOM_PREF_density_precision + Précision de densité + + + GEOM_PREF_parametric_precision + Précision paramétrique + + + GEOM_PREF_param_tol_precision + Précision de la tolérance paramétrique + + + PREF_AUTO_CREATE + Créer automatiquement + + + PREF_DISPLAY_MODE + Mode de visualisation + + + PREF_FREE_BOUND_COLOR + Couleur des contours libres + + + PREF_GROUP_ORIGIN_AND_BASE_VECTORS + Vecteurs de base et origine + + + PREF_GROUP_OPERATIONS + Opérations + + + PREF_GROUP_GENERAL + Général + + + GEOM_PREF_GROUP_PRECISION + Précision des champs d'entrée + + + PREF_GROUP_VERTEX + Marqueurs de points + + + PREF_ISOS_COLOR + Couleur des isolignes + + + PREF_TOPLEVEL_COLOR + Couleur des objets mis au premier plan + + + PREF_LINE_COLOR + Couleur des arêtes, vecteurs, contours + + + PREF_MARKER_SCALE + Taille + + + PREF_POINT_COLOR + Couleur des points + + + PREF_SHADING_COLOR + Couleur d'ombrage + + + PREF_EDGES_IN_SHADING + Bords de l'ombrage + + + PREF_STEP_VALUE + Valeur du pas pour les boîtes d'incrément + + + PREF_TAB_SETTINGS + Préférences + + + PREF_TYPE_OF_MARKER + Type + + + PREF_BASE_VECTORS_LENGTH + Longueur des vecteurs de base + + + PREF_WIREFRAME_COLOR + Couleur des contours + + + PREF_MATERIAL + Matériau + + + PREF_EDGE_WIDTH + Epaisseur des arêtes + + + PREF_ISOLINES_WIDTH + Epaisseur des isolignes + + + PREF_PREVIEW_EDGE_WIDTH + Prévisualiser l'épaisseur des arêtes + + + PREF_MEASURES_LINE_WIDTH + Epaisseur des traits de mesure + + + PROCESS_SHAPE_NEW_OBJ_NAME + FormeRetraitee + + + REMOVE_HOLES_NEW_OBJ_NAME + SupprimerTrous + + + REMOVE_INT_WIRES_NEW_OBJ_NAME + SupprimerContoursInt + + + SEWING_NEW_OBJ_NAME + Couture + + + STB_ALL_SEL_ONLY + Choisir tous les objets + + + STB_ARC + Créer un arc + + + STB_ARCHIMEDE + Opération archimède + + + STB_BASIC_PROPS + Montrer les propriétés de base de l'objet + + + STB_BND_BOX + Calculer la boîte englobante de l'objet + + + STB_BOX + Créer une boîte + + + STB_FEATURE_DETECTION + Reconnaissance de formes + + + STB_PICTURE_IMPORT + Importer une image dans la vue + + + STB_CHAMFER + Créer un chanfrein + + + STB_CHANGE_ORIENTATION + Changer l'orientation + + + STB_CHECK + Contrôler une forme + + + STB_CHECK_COMPOUND + Contrôler un assemblage de blocs + + + STB_CHECK_SELF_INTERSECTIONS + Détecte les auto-intersections + + + STB_CHECK_FREE_BNDS + Vérifier les contours libres + + + STB_CHECK_FREE_FACES + Contrôler les faces libres + + + STB_CHECK_GEOMETRY + Contrôler la géométrie + + + STB_CIRCLE + Créer un cercle + + + STB_CLIPPING + Intervalle de découpe + + + STB_CLOSE_CONTOUR + Fermer le contour + + + STB_COMMON + Intersection + + + STB_COMPOUND + Construire un assemblage + + + STB_COMPOUND_SEL_ONLY + Ne choisir que des assemblages + + + STB_CONE + Créer un cône + + + STB_CURVE + Créer une courbe + + + STB_CUT + Découpe + + + STB_CYLINDER + Créer un cylindre + + + STB_RECTANGLE + Créer une face rectangulaire + + + STB_DELETE + Supprimer un objet + + + STB_DISK + Créer un disque + + + STB_DISPLAY + Afficher les objets + + + STB_DISPLAY_ALL + Afficher tout + + + STB_DISPLAY_ONLY + Afficher uniquement + + + STB_EDGE + Créer une arête + + + STB_EDGE_SEL_ONLY + Ne choisir que des arêtes + + + STB_ELLIPSE + Créer un ellipse + + + STB_ERASE + Cacher le(s) objet(s) + + + STB_ERASE_ALL + Cacher tout + + + STB_EXPLODE + Eclater + + + STB_EXPLODE_BLOCKS + Eclater en blocs + + + STB_EXPORT + Exporter la géométrie au fichier BREP + + + STB_EXTRUSION + Créer une extrusion + + + STB_EXTRUDED_CUT + Enlèvement de matière extrudé + + + STB_EXTRUDED_BOSS + Bossage extrudé + + + STB_FACE + Construire une face + + + STB_FACE_SEL_ONLY + Ne choisir que des faces + + + STB_FILLET + Créer un congé 3D + + + STB_FILLET_1D + Créer un congé 1D + + + STB_FILLET_2D + Créer un congé 2D + + + STB_FILLING + Créer une nappe + + + STB_FUSE + Union + + + STB_GLUE_FACES + Recoller les faces + + + STB_GLUE_EDGES + Recoller les arêtes + + + STB_GROUP_CREATE + Créer un groupe + + + STB_GROUP_EDIT + Editer un groupe + + + STB_RELOAD_IMPORTED + Recharger l'objet importé depuis le disque + + + STB_HEX_SOLID + Solide hexaédrique + + + STB_IMPORT + Importer une géométrie d'un fichier BREP + + + STB_INERTIA + Calculer les moments d'inertie de l'objet + + + STB_ISOS + Définir le nombre d'isolignes + + + STB_LINE + Créer une ligne + + + STB_LIMIT_TOLERANCE + Tolérance limite + + + STB_LOCAL_CS + Créer un système local de coordonnées + + + STB_MASS_CENTER + Calculer le centre de gravité de l'objet + + + STB_MIN_DIST + Calculer la distance minimale entre deux objets + + + STB_MIRROR + Refléter un objet + + + STB_MODIFY_LOCATION + Modifier la position d'un objet + + + STB_MUL_ROTATION + Effectuer une multi-rotation + + + STB_MUL_TRANSFORM + Effectuer une multi-transformation + + + STB_MUL_TRANSLATION + Effectuer une multi-translation + + + STB_OFFSET + Décaler une surface + + + STB_PROJECTION + Projeter un point, une arête ou un contour sur une face + + + STB_ORIGIN_AND_VECTORS + Créer les vecteurs de base et l'origine + + + STB_PARTITION + Effectuer une partition + + + STB_PIPE + Créer un objet par extrusion suivant un chemin + + + STB_PLANE + Créer un plan + + + STB_POINT + Créer un point + + + STB_POINT_COORDS + Montrer les coordonnées du point + + + STB_POINT_ON_EDGE + Ajouter un point sur l'arête + + + STB_POP_COLOR + Couleur + + + STB_POP_CREATE_GROUP + Créer un groupe + + + STB_POP_SHOW_CHILDREN + Monter les objets fils + + + STB_POP_UNPUBLISH_OBJ + Dépublier l'objet + + + STB_POP_PUBLISH_OBJ + Publier l'objet + + + STB_POP_HIDE_CHILDREN + Cacher les objets fils + + + STB_POP_ISOS + Isolignes + + + STB_POP_DEFLECTION + Coefficient de déformation + + + STB_POP_RENAME + Renommer + + + STB_POP_SHADING + Ombrage + + + STB_POP_SHADING_WITH_EDGES + Ombrage avec arêtes + + + STB_POP_TEXTURE + Texture + + + STB_POP_VECTORS + Afficher l'orientation des arêtes + + + STB_POP_SETTEXTURE + Ajoute une texture + + + STB_POP_TRANSPARENCY + Transparence + + + STB_POP_WIREFRAME + Contours + + + STB_PROPAGATE + Propager + + + STB_Q_FACE + Face quadrangulaire + + + STB_REVOLUTION + Créer une révolution + + + STB_ROTATION + Tourner un objet + + + STB_SCALE + Redimensionner un objet + + + STB_SECTION + Section + + + STB_SEWING + Effectuer la couture + + + STB_WIREFRAME + Contours + + + STB_SHADING + Ombrage + + + STB_SHADING_WITH_EDGES + Ombrage avec arêtes + + + STB_VECTOR_MODE + Changer le mode de représentation des arêtes + + + STB_SHADING_COLOR + Définir la couleur d'ombrage + + + STB_SHAPE_PROCESS + Effectuer le traitement de formes + + + STB_SHELL + Construire une coque + + + STB_SHELL_SEL_ONLY + Ne choisir que des coques + + + STB_SKETCH + Créer une esquisse 2D + + + STB_3DSKETCH + Créer une esquisse 3D + + + STB_SOLID + Construire un solide + + + STB_SOLID_SEL_ONLY + Ne choisir que des solides + + + STB_SPHERE + Créer une sphère + + + STB_STEP_VALUE + Définir le valeur du pas + + + STB_SUPPERSS_HOLES + Effectuer la suppression des trous + + + STB_SUPPRESS_FACES + Effectuer la suppression des faces + + + STB_SUPPRESS_INT_WIRES + Effectuer la suppression des contours internes + + + STB_TOLERANCE + Calculer la tolérance d'un objet + + + STB_TORUS + Créer un tore + + + STB_TRANSLATION + Translater un objet + + + STB_VECTOR + Créer un vecteur + + + STB_VERTEX_SEL_ONLY + Ne choisir que des points + + + STB_WHAT_IS + Qu'est-ce que c'est ? + + + STB_WIRE + Construire un contour + + + STB_WIRE_SEL_ONLY + Ne choisir que des contours + + + STB_WORK_PLANE + Créer un plan de travail + + + STB_POP_POINT_MARKER + Définir un marqueur de point + + + STB_POP_MATERIAL_PROPERTIES + Définir les propriétés du matériau + + + SUPPRESS_RESULT + Supprimer le résultat + + + SUPRESS_FACE_NEW_OBJ_NAME + FacesSupprimees + + + ShHealOper_ErrorExecution_msg + L'algorithme de traitement de formes n'a pas abouti + + + ShHealOper_InvalidParameters_msg + Les paramètres de l'algorithme de traitement de formes sont incorrects + + + ShHealOper_NotError_msg + L'algorithme de traitement de formes n'a pas fait de modifications de la forme d'origine + + + TLT_RENAME + Renommer + + + TOM_O + O + + + TOM_O_PLUS + + en O + + + TOM_O_POINT + . en O + + + TOM_O_STAR + * en O + + + TOM_O_X + X en O + + + TOM_PLUS + + + + + TOM_POINT + . + + + TOM_STAR + * + + + TOM_X + X + + + TOOL_BASIC + Objets de base + + + TOOL_BOOLEAN + Opérations booléennes + + + TOOL_FEATURES + Modification + + + TOOL_GENERATION + Génération + + + TOOL_PRIMITIVES + Primitives + + + TOOL_TRANSFORMATION + Transformation + + + TOOL_BUILD + Construire + + + TOOL_OPERATIONS + Opérations + + + TOOL_PICTURES + Images + + + TOOL_ADVANCED + Avancé + + + TOOL_MEASURES + Informations + + + TOP_ARC + Créer un arc + + + TOP_ARCHIMEDE + Archimède + + + TOP_BASIC_PROPS + Propriétés de base + + + TOP_BND_BOX + Boîte englobante + + + TOP_BOX + Créer une boîte + + + TOP_CHAMFER + Chanfrein + + + TOP_CHANGE_ORIENTATION + Changer l'orientation + + + TOP_CHECK + Valider l'objet + + + TOP_CHECK_COMPOUND + Valider l'assemblage de blocs + + + TOP_CHECK_SELF_INTERSECTIONS + Détection des auto-intersections + + + TOP_CHECK_FREE_BNDS + Valider les contours libres + + + TOP_CHECK_FREE_FACES + Contrôler les faces libres + + + TOP_CHECK_GEOMETRY + Contrôler la géométrie + + + TOP_CIRCLE + Créer un cercle + + + TOP_CLIPPING + Intervalle de découpe + + + TOP_CLOSE_CONTOUR + Fermer le contour + + + TOP_COMMON + Intersection + + + TOP_COMPOUND + Construire un assemblage + + + TOP_CONE + Créer un cône + + + TOP_CURVE + Créer une courbe + + + TOP_CUT + Découpe + + + TOP_CYLINDER + Créer un cylindre + + + TOP_DELETE + Supprimer l'objet + + + TOP_RECTANGLE + Créer une face rectangulaire + + + TOP_DISK + Créer un disque + + + TOP_DISPLAY + Afficher + + + TOP_DISPLAY_ALL + Afficher tout + + + TOP_DISPLAY_ONLY + Afficher uniquement + + + TOP_EDGE + Construire une arête + + + TOP_ELLIPSE + Créer un ellipse + + + TOP_ERASE + Cacher + + + TOP_ERASE_ALL + Cacher tout + + + TOP_EXPLODE + Eclater + + + TOP_EXPLODE_BLOCKS + Eclater en blocs + + + TOP_EXPORT + Exporter une géométrie au format BREP + + + TOP_EXTRUSION + Créer une extrusion + + + TOP_EXTRUDED_BOSS + Bossage extrudé + + + TOP_EXTRUDED_CUT + Enlèvement de matière extrudé + + + TOP_FACE + Construire une face + + + TOP_FILLET + Congé 3D + + + TOP_FILLET_1D + Congé 1D + + + TOP_FILLET_2D + Congé 2D + + + TOP_FILLING + Créer une nappe + + + TOP_FUSE + Union + + + TOP_GLUE_FACES + Recoller les faces + + + TOP_GLUE_EDGES + Recoller les arêtes + + + TOP_GROUP_CREATE + Créer un groupe + + + TOP_GROUP_EDIT + Editer un groupe + + + TOP_HEX_SOLID + Solide hexaédrique + + + TOP_IMPORT + Importer une géométrie d'un fichier BREP + + + TOP_INERTIA + Moments d'inertie + + + TOP_ISOS + Définir le nombre d'isolignes + + + TOP_LINE + Créer une ligne + + + TOP_LIMIT_TOLERANCE + Tolérance limite + + + TOP_LOCAL_CS + Créer un système local de coordonnées + + + TOP_MASS_CENTER + Centre de gravité + + + TOP_MIN_DIST + Distance minimale + + + TOP_MIRROR + Symétrie + + + TOP_MODIFY_LOCATION + Modifier la position + + + TOP_MUL_ROTATION + Multi-rotation + + + TOP_MUL_TRANSFORM + Multi-transformation + + + TOP_MUL_TRANSLATION + Multi-translation + + + TOP_PICTURE_IMPORT + Importer une image dans la vue + + + TOP_FEATURE_DETECTION + Reconnaissance de formes + + + TOP_OFFSET + Décaler une surface + + + TOP_PROJECTION + Projection + + + TOP_ORIGIN_AND_VECTORS + Créer l'origine et les vecteurs de base + + + TOP_PARTITION + Partition + + + TOP_PIPE + Extrusion suivant un chemin + + + TOP_PLANE + Créer un plan + + + TOP_POINT + Créer un point + + + TOP_POINT_COORDS + Coordonnées d'un point + + + TOP_POINT_ON_EDGE + Ajouter un point sur l'arête + + + TOP_POP_COLOR + Couleur + + + TOP_POP_CREATE_GROUP + Créer un groupe + + + TOP_POP_SHOW_CHILDREN + Montrer les enfants + + + TOP_POP_UNPUBLISH_OBJ + Dépublier l'objet + + + TOP_POP_PUBLISH_OBJ + Publier l'objet + + + TOP_POP_HIDE_CHILDREN + Cacher les enfants + + + TOP_POP_ISOS + Isolignes + + + TOP_POP_DEFLECTION + Coefficient de déformation + + + TOP_POP_RENAME + Renommer + + + TOP_POP_SHADING + Ombrage + + + TOP_POP_SHADING_WITH_EDGES + Ombrage avec arêtes + + + TOP_POP_SETTEXTURE + Texture + + + TOP_POP_TRANSPARENCY + Transparence + + + TOP_POP_WIREFRAME + Contours + + + TOP_PROPAGATE + Propager + + + TOP_Q_FACE + Face quadrangulaire + + + TOP_REVOLUTION + Créer une révolution + + + TOP_ROTATION + Rotation + + + TOP_SCALE + Redimensionner + + + TOP_SECTION + Section + + + TOP_SEWING + Effectuer une couture + + + TOP_SHADING + Ombrage + + + TOP_SHADING_COLOR + Définir la couleur d'ombrage + + + TOP_SHAPE_PROCESS + Effectuer le traitement de forme + + + TOP_SHELL + Construire une coque + + + TOP_SKETCH + Esquisse 2D + + + TOP_3DSKETCH + Esquisse 3D + + + TOP_SOLID + Créer un solide + + + TOP_SPHERE + Créer une sphère + + + TOP_STEP_VALUE + Définir la valeur du pas + + + TOP_SUPPERSS_HOLES + Supprimer les trous + + + TOP_SUPPRESS_FACES + Supprimer les faces + + + TOP_SUPPRESS_INT_WIRES + Supprimer les contours internes + + + TOP_TOLERANCE + Tolérance + + + TOP_TORUS + Créer un tore + + + TOP_TRANSLATION + Translation + + + TOP_VECTOR + Créer un vecteur + + + TOP_WHAT_IS + Qu'est-ce que c'est ? + + + TOP_WIRE + Construire un contour + + + TOP_WORK_PLANE + Créer un plan de travail + + + TOP_POP_POINT_MARKER + Marqueur de point + + + TOP_POP_MATERIAL_PROPERTIES + Propriétés des matériaux + + + WRN_NOT_IMPLEMENTED + Désolé, cette fonctionnalité n'est pas encore implémentée + + + _S_ + (s) + + + NOT_FOUND_ANY + Aucune entité n'a été trouvée + + + GEOM_FACE_I + Face %1 + + + GEOM_CONSTANT_RADIUS + Rayon : + + + GEOM_R1 + R1 : + + + GEOM_R2 + R2 : + + + GEOM_BOTHWAY + Dans les deux directions + + + GEOM_NORMALE + Normale à une face + + + GEOM_VECTOR_NORMALE + Vecteur_Normale + + + GEOM_LINE1 + Ligne 1 + + + GEOM_LINE2 + Ligne 2 + + + GEOM_D + D : + + + GEOM_CHAMFER_EDGE + Chanfrein sur des arêtes communes à 2 faces + + + SELECTED_EDGE + Arêtes + + + GEOM_NORMALE_TITLE + Créer un vecteur normal à une face + + + GEOM_MEASURE_ANGLE_TITLE + Angle entre deux arêtes/lignes/vecteurs droits + + + GEOM_MEASURE_ANGLE_ANGLE + Angle + + + GEOM_MEASURE_ANGLE_OBJ + Objets et résultats + + + GEOM_MEASURE_ANGLE_IS + Angle en degrés : + + + GEOM_LINE_INTERSECTION + Point à l'Intersection de deux lignes + + + GEOM_KEEP_NONLIMIT_SHAPES + Préserver les formes inférieures + + + GEOM_NO_SELF_INTERSECTION + Pas d'intersection des sous-formes (assemblages seuls) + + + GEOM_CENTER_2POINTS + Centre et deux points + + + GEOM_REMOVE_EXTRA_EDGES_TITLE + Supprimer les arêtes inutiles + + + GEOM_REMOVE_EXTRA_EDGES + Objet dont on supprime les arêtes inutiles + + + GEOM_RMEE_UNION_FACES + Union des faces, qui appartiennent à la même surface + + + REMOVE_EXTRA_EDGES_NEW_OBJ_NAME + PasdAretesSupplementaires + + + TOP_REMOVE_EXTRA_EDGES + Supprimer les arêtes inutiles + + + MEN_REMOVE_EXTRA_EDGES + Supprimer les arêtes inutiles + + + STB_REMOVE_EXTRA_EDGES + Supprimer les arêtes inutiles + + + TOP_NORMALE + Vecteur normal à une face + + + MEN_NORMALE + Vecteur normal à une face + + + STB_NORMALE + Vecteur normal à une face + + + TOP_MEASURE_ANGLE + Angle + + + MEN_MEASURE_ANGLE + Angle + + + STB_MEASURE_ANGLE + Calculer l'angle entre deux lignes ou arêtes linéaires + + + TOP_POP_AUTO_COLOR + Couleur automatique + + + MEN_POP_AUTO_COLOR + Couleur automatique + + + STB_POP_AUTO_COLOR + Couleur automatique + + + TOP_POP_DISABLE_AUTO_COLOR + Désactiver la couleur automatique + + + MEN_POP_DISABLE_AUTO_COLOR + Désactiver la couleur automatique + + + STB_POP_DISABLE_AUTO_COLOR + Désactiver la couleur automatique + + + GEOM_RESULT_NAME_GRP + Nom du résultat + + + GEOM_RESULT_NAME_LBL + Nom + + + GEOM_FILLING_APPROX + Approximation + + + GEOM_FILLING_METHOD + Méthode + + + GEOM_FILLING_DEFAULT + Défaut (comportement standardisé) + + + GEOM_FILLING_USEORI + Utiliser l'orientation des arêtes + + + GEOM_FILLING_AUTO + Auto-corriger l'orientation des arêtes + + + GEOM_WRN_NO_APPROPRIATE_SELECTION + Pas d'objets appropriés choisis + + + GEOM_SHAPES_ON_SHAPE + Trouver les éléments d'un objet + + + GEOM_SHAPES_ON_SHAPE_ESHAPE + L'objet à éclater + + + GEOM_SHAPES_ON_SHAPE_CSHAPE + Le solide de contrôle + + + GEOM_SHAPES_ON_SHAPE_STATE + Etat + + + GEOM_KIND_OF_SHAPE + Type d'objet : + + + GEOM_CLOSED + Fermé + + + GEOM_UNCLOSED + Ouvert + + + GEOM_CLOSEDUNCLOSED + Il n'est pas défini, si l'objet est fermé ou ouvert. , il y a potentiellement une erreur. + + + GEOM_DISK_CIRCLE + Disque + + + GEOM_DISK_ELLIPSE + Face elliptique + + + GEOM_PLANAR_FACE + Face plane + + + GEOM_PLANAR_EDGE_WIRE + Contour avec des arêtes planes + + + GEOM_POLYGON + Polygone + + + GEOM_POLYHEDRON + Polyèdre + + + GEOM_NORMAL + Direction normale + + + GEOM_DIRECTION + Direction + + + GEOM_UPARAMETER + Paramètre-U : + + + GEOM_VPARAMETER + Paramètre-V : + + + GEOM_X_I + X%1 : + + + GEOM_Y_I + Y%1 : + + + GEOM_Z_I + Z%1 : + + + GEOM_SHAPES_ON_SHAPE_TITLE + Trouver les éléments d'un objet + + + GEOM_SCALE_FACTOR_X + Facteur de redimensionnement suivant X : + + + GEOM_SCALE_FACTOR_Y + Facteur de redimensionnement suivant Y : + + + GEOM_SCALE_FACTOR_Z + Facteur de redimensionnement suivant Z : + + + GEOM_STATE_IN + IN + + + GEOM_STATE_OUT + OUT + + + GEOM_STATE_ON + ON + + + GEOM_STATE_ONIN + ONIN + + + GEOM_STATE_ONOUT + ONOUT + + + GEOM_STATE_INOUT + INOUT + + + TOP_GET_SHAPES_ON_SHAPE + Trouver les éléments d'un objet + + + MEN_GET_SHAPES_ON_SHAPE + Trouver les éléments d'un objet + + + STB_GET_SHAPES_ON_SHAPE + Trouve les éléments d'un objet + + + TOP_GET_SHARED_SHAPES + Trouver les éléments d'un objet + + + MEN_GET_SHARED_SHAPES + Trouver les éléments partagés + + + STB_GET_SHARED_SHAPES + Trouve les éléments partagés + + + GEOM_PUBLISH_RESULT_GRP + Options avancées + + + GEOM_RESTORE_SUB_SHAPES + Récupérer les groupes et les sous-objets + + + GEOM_RSS_ADD_FREFIX + Ajouter un préfixe aux noms des sous-objets restaurés + + + GEOM_PREVIEW + Prévisualiser + + + GEOM_ALL_IMPORT_FILES + Tous les formats supportés ( %1 ) + + + GEOM_UNSUPPORTED_TYPE + Le format de ficher n'est pas supporté + + + GEOM_UNKNOWN_IMPORT_ERROR + Erreur inconnue + + + GEOM_IMPORT_ERRORS + L'import s'est fini avec des erreurs: + + + EXPORT_IGES_HETEROGENEOUS_COMPOUND + Cet assemblage ne peut pas être exporté au format IGES +sans perte car il contient des entités qui doivent être sauvegardées +dans des modes différents. Les sommets, arêtes et contours d'un côté et +les coques et solides d'un autre. + + + GEOM_PUBLISH_NAMED_SHAPES + Créer des groupes pour les objets indiqués (s'ils existent)? + + + GEOM_SCALE_DIMENSIONS + Voulez-vous prendre les unités en considération? +Sinon les dimensions seront préservées sans modifications. + + + 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 + + + GEOM_PLUGINS_OTHER + Autre + + + SHOW_ONLY_SELECTED + Afficher uniquement la sélection + + + HIDE_SELECTED + Cacher la sélection + + + SHOW_ALL_SUB_SHAPES + Afficher tous les sous-objets + + + GEOM_SELECT_IMAGE + Sélectionner une image... + + + + BasicGUI_CurveDlg + + GEOM_IS_CLOSED + Construire une arête fermée + + + GEOM_BUILD_CLOSED_WIRE + Construire un contour fermé + + + GEOM_IS_REORDER + Réarranger les points en prenant en compte les distances + + + GEOM_CURVE_CRMODE + Mode de création + + + GEOM_CURVE_SELECTION + Par sélection + + + GEOM_CURVE_ANALITICAL + Analytique + + + + BasicGUI_ParamCurveWidget + + GEOM_PCURVE_TITLE + Paramètres de la courbe + + + GEOM_PCURVE_X + Equation X(t) + + + GEOM_PCURVE_Y + Equation Y(t) + + + GEOM_PCURVE_Z + Equation Z(t) + + + GEOM_PCURVE_MIN + Min t + + + GEOM_PCURVE_MAX + Max t + + + GEOM_PCURVE_STEP + Pas + + + GEOM_PCURVE_NBSTEP + Nombre de pas + + + + BasicGUI_EllipseDlg + + GEOM_VECTOR_MAJOR + Grand axe + + + ORIGIN_DEFAULT + Origine par défaut + + + X_AXIS_DEFAULT + Axe X par défaut + + + Z_AXIS_DEFAULT + Axe Z par défaut + + + + BasicGUI_MarkerDlg + + CAPTION + Construction d'un S.C. local + + + DX + Dx + + + DY + Dy + + + DZ + Dz + + + LCS_NAME + SCLocal + + + LOCALCS + Système de coordonnées local + + + ORIGIN + Coordonnées de l'origine + + + VEC_PARALLEL + Les axes du système de coordonnées ne doivent pas être parallèles + + + XDIR + Direction de l'axe X + + + YDIR + Direction de l'axe Y + + + + BlocksGUI_BlockDlg + + FACE_1 + Face 1 + + + FACE_2 + Face 2 + + + FACE_3 + Face 3 + + + FACE_4 + Face 4 + + + FACE_5 + Face 5 + + + FACE_6 + Face 6 + + + + BlocksGUI_ExplodeDlg + + NB_FACES_MAX + Nombre de faces maximal + + + NB_FACES_MIN + Nombre de faces maximal + + + + BlocksGUI_QuadFaceDlg + + EDGE_1 + Arête 1 + + + EDGE_2 + Arête 2 + + + EDGE_3 + Arête 3 + + + EDGE_4 + Arête 4 + + + VERTEX_1 + Sommet 1 + + + VERTEX_2 + Sommet 2 + + + VERTEX_3 + Sommet 3 + + + VERTEX_4 + Sommet 4 + + + + BlocksGUI_TrsfDlg + + FACE_1 + Face 1 + + + FACE_1U + Face 1 U + + + FACE_1V + Face 1 V + + + FACE_2 + Face 2 + + + FACE_2U + Face 2 U + + + FACE_2V + Face 2 V + + + + EntityGUI_SketcherDlg + + CANNOT_CLOSE + Il est impossible de fermer le contour +Le nombre de points n'est pas suffisant + + + + EntityGUI_FeatureDetectorDlg + + GEOM_DETECT_TITLE + Détecter les angles + + + GEOM_SCALING + Mise à l'échelle + + + GEOM_PNT1 + Coin supérieur gauche + + + GEOM_PNT2 + Coin supérieur droit + + + GEOM_CORNER + Angles_détectés + + + GEOM_CORNERS + Angles + + + GEOM_CONTOURS + Contours + + + GEOM_FEATURES + Caractéristiques + + + GEOM_DETECT_ZONE + Sélectionner une zone de détection +(toute l'image par défaut) + + + GEOM_DETECT_OUTPUT + Type de sortie + + + GEOM_PICTURE + Image + + + GEOM_COLOR_FILTER + Filtre + + + GEOM_VIEW + Vue + + + GEOM_FRONT + Face (Y-Z) + + + GEOM_TOP + Dessus (X-Y) + + + GEOM_LEFT + Gauche (X-Z) + + + + EntityGUI_PictureImportDlg + + GEOM_PICTURE + Image + + + GEOM_FILE + Nom du fichier + + + GEOM_IMPORT_PICT_TITLE + Importer l'image dans le visualiseur + + + + EntityGUI_SubShapeDlg + + NO_SUBSHAPES_SELECTED + Choisissez un ou plusieurs sous-objets + + + + GroupGUI + + NO_GROUP + Choisissez un groupe à éditer + + + + GroupGUI_GroupDlg + + ADD + Ajouter + + + CREATE_GROUP_TITLE + Créer un groupe + + + EDIT_GROUP_TITLE + Editer un groupe + + + EMPTY_LIST + Choisissez un ou plusieurs sous-objets à placer dans le groupe + + + EMPTY_NAME + Le nom de groupe est vide. Indiquez un nom valide + + + GROUP_NAME + Nom du groupe + + + GROUP_PREFIX + Groupe + + + MAIN_SHAPE + Objet principal + + + MAIN_SUB_SHAPES + Objet principal et objets secondaires + + + NO_GROUP + Choisissez un groupe à éditer + + + NO_MAIN_OBJ + Choisissez un objet principal + + + REMOVE + Supprimer + + + SELECT_ALL + Tout sélectionner + + + SHAPE_SEL_RESTR + Restriction de la sélection + + + SHAPE_TYPE + Type d'objet + + + NO_RESTR + Pas de restriction + + + GEOM_PARTS_OF_SHAPE2 + Parties géométriques de l'objet secondaire + + + SUBSHAPES_OF_SHAPE2 + Sous-objets de l'objet secondaire uniquement + + + SECOND_SHAPE + Objet secondaire + + + + MeasureGUI_1Sel1TextView1Check_QTD + + CHECK_SHAPE_GEOMETRY + Vérifier la géométrie + + + + MeasureGUI_PointDlg + + CAPTION + Coordonnées d'un point + + + COORDINATES + Le point et ses coordonnées + + + POINT + Point + + + X + X + + + Y + Y + + + Z + Z + + + + OperationGUI_ChamferDlg + + D + D + + + FACE_1 + Face 1 + + + FACE_2 + Face 2 + + + SELECTED_FACES + Faces + + + + OperationGUI_FilletDlg + + SELECTED_EDGES + Arêtes + + + SELECTED_FACES + Faces + + + + RepairGUI_FreeBoundDlg + + CAPTION + Vérifier les contours libres + + + FREE_BOUND + Contours libres + + + NUMBER_CLOSED + Nombre de contours libres fermés + + + NUMBER_OPEN + Nombre de contours libres ouverts + + + + RepairGUI_GlueDlg + + FACES_FOR_GLUING_ARE_DETECTED + Il y a %1 face(s) à recoller surlignées en couleur rouge. +Fermez cette boîte d'alerte et choisissez les faces à recoller + + + EDGES_FOR_GLUING_ARE_DETECTED + Il y a %1 arête(s) à recoller surlignées en rouge. +Fermez cette boîte d'alerte et choisissez les arêtes à recoller. + + + GLUE_FACES + Recollement de faces + + + GLUE_EDGES + Recoller les arêtes + + + SELECT_FACES + Choisir les faces + + + SELECT_EDGES + Choisir les arêtes + + + GLUE_ALL_EDGES + Recoller toutes les arêtes coïncidentes + + + THERE_ARE_NO_FACES_FOR_GLUING + Il n'y a pas de face à coller + + + THERE_ARE_NO_EDGES_FOR_GLUING + Il n'y a pas d'arête à coller + + + + RepairGUI_ShapeProcessDlg + + ERROR_NO_OBJECTS + Choisissez un objet géométrique pour le traitement de forme. + + + ERROR_NO_OPERATORS + Choisissez au moins une opération de traitement de forme pour donner suite à l'opération + + + TIME_CONSUMING + L'activation de cette option peut résulter en une perte de temps sur certains objets. +Voulez-vous continuer? + + + + GEOMToolsGUI_DeleteDlg + + GEOM_REALLY_DELETE + Voulez-vous vraiment supprimer %1 objet(s)? + + + GEOM_REALLY_DELETE_ALL + Voulez-vous vraiment supprimer tous les objets? + + + GEOM_DELETE_OBJECTS + Supprimer les objets + + + + GEOMToolsGUI_DeflectionDlg + + GEOM_DEFLECTION_TLT + Choisir le degré de déformation d'un objet + + + GEOM_DEFLECTION + Déformation : + + + + GEOMToolsGUI_LineWidthDlg + + GEOM_LINE_WIDTH + Epaisseur de ligne : + + + + GEOMToolsGUI_MarkerDlg + + SET_MARKER_TLT + Définir le marqueur de point + + + STANDARD_MARKER + Standard + + + CUSTOM_MARKER + Personnalisé + + + TYPE + Type: + + + SCALE + Echelle: + + + CUSTOM + Texture: + + + BROWSE + Naviguer... + + + OK_BTN + &OK + + + CANCEL_BTN + A&nnuler + + + HELP_BTN + &Aide + + + LOAD_TEXTURE_TLT + Ouvrir une texture + + + + GEOMToolsGUI_MaterialPropertiesDlg + + MATERIAL_PROPERTIES_TLT + Couleur et propriétés des matériaux + + + REFLECTION_0 + Ambiante + + + REFLECTION_1 + Diffuse + + + REFLECTION_2 + Spéculaire + + + REFLECTION_3 + Emissive + + + ENABLED + Activée + + + SHININESS + Brillance: + + + PHYSICAL + Couleur imposée + + + ADD_MATERIAL + Ajouter un matériau + + + DELETE_MATERIAL + Supprimer un matériau + + + RENAME_MATERIAL + Renommer un matériau + + + CURRENT_MATERIAL + [ En cours ] + + + CURRENT_COLOR + Couleur + + + CUSTOM_MATERIAL + matériau personnalisé + + + QUE_CREATE_NEW_MATERIAL + Il n'est pas possible de changer les propriétés d'un matériau pré-défini. +Voulez-vous en créer un nouveau ? + + + QUE_REMOVE_MATERIAL + Supprimer le matériau %1? + + + OK_BTN + &OK + + + CANCEL_BTN + A&nnuler + + + HELP_BTN + &Aide + + + + OperationGUI_GetSharedShapesDlg + + GEOM_SHARED_SHAPES_TITLE + Trouver les éléments partagés + + + GEOM_GET_SHARED_SHAPES + Eléments partagés + + + GEOM_SHARED_SHAPES_INPUT + Paramètres d'entrée + + + MSG_SHARED_SHAPES_TOO_FEW_SHAPES + Pas assez d'éléments sélectionnés + + + GEOM_SHARED_SHAPE + 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 + + + + GEOMToolsGUI_PublishDlg + + GEOM_PUBLISH_OBJECTS_TLT + Publier les objets + + + OBJECT_NAME + Nom + + + OBJECT_ENTRY + Entrée + + + UNSELECT_ALL + Tout désélectio&nner + + + SELECT_ALL + &Sélectionner tout + + + GEOM_PUBLISH_BTN + &Publier + + + GEOM_PUBLISH_CLOSE_BTN + P&ublier et fermer + + diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 54722fe93..23694246d 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1,36 +1,44 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : GeometryGUI.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : GeometryGUI.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#include // E.A. must be included before Python.h to fix compilation on windows +#ifdef HAVE_FINITE +#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined +#endif +#include "Python.h" #include "GeometryGUI.h" +#include "GeometryGUI_Operations.h" #include "GEOMGUI_OCCSelector.h" #include "GEOMGUI_Selection.h" +#include "GEOM_Constants.h" #include "GEOM_Displayer.h" #include "GEOM_AISShape.hxx" #include "GEOM_Actor.h" +#include + #include #include #include @@ -51,7 +59,9 @@ #include #include +#include #include +#include #include #include @@ -65,8 +75,11 @@ #include #include +#include + // External includes #include +#include #include #include #include @@ -81,22 +94,33 @@ #include #include +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif + #include #include #include -#include "GEOMImpl_Types.hxx" +#include -using namespace Qt; + +#include "GEOMImpl_Types.hxx" extern "C" { Standard_EXPORT CAM_Module* createModule() { return new GeometryGUI(); } -} + Standard_EXPORT char* getModuleVersion() { + return (char*)GEOM_VERSION_STR; + } +} +GeometryGUI::StudyTextureMap GeometryGUI::myTextureMap; GEOM::GEOM_Gen_var GeometryGUI::myComponentGeom = GEOM::GEOM_Gen::_nil(); @@ -149,31 +173,33 @@ SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy) return aDSStudy._retn(); } -//======================================================================= -// function : JoinObjectParameters -// purpose : -//======================================================================= -char* GeometryGUI::JoinObjectParameters(const QStringList& theParametersList) +void GeometryGUI::Modified( bool theIsUpdateActions ) { - return theParametersList.join(":").toLatin1().data(); + if( SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ) ) { + if( SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ) ) { + appStudy->Modified(); + if( theIsUpdateActions ) + app->updateActions(); + } + } } + //======================================================================= // function : GeometryGUI::GeometryGUI() // purpose : Constructor //======================================================================= GeometryGUI::GeometryGUI() : - SalomeApp_Module( "GEOM" ) + SalomeApp_Module( "GEOM" ), + LightApp_Module( "GEOM" ) { if ( CORBA::is_nil( myComponentGeom ) ) { - SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( getApp()->namingService() ); - Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); - myComponentGeom = GEOM::GEOM_Gen::_narrow( comp ); + Engines::EngineComponent_var comp = + SalomeApp_Application::lcc()->FindOrLoad_Component( "FactoryServer", "GEOM" ); + myComponentGeom = GEOM::GEOM_Gen::_narrow( comp ); } - myState = -1; myActiveDialogBox = 0; - myFatherior = ""; gp_Pnt origin = gp_Pnt(0., 0., 0.); gp_Dir direction = gp_Dir(0., 0., 1.); @@ -194,6 +220,8 @@ GeometryGUI::~GeometryGUI() while (!myVTKSelectors.isEmpty()) delete myVTKSelectors.takeFirst(); + + qDeleteAll(myGUIMap); } //======================================================================= @@ -205,43 +233,39 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) { if ( !myGUIMap.contains( libraryName ) ) { // try to load library if it is not loaded yet - QString libs; #ifndef WNT - libs = getenv( "LD_LIBRARY_PATH" ); - if( !libs.isEmpty() ) { - QStringList dirList = libs.split( ":", QString::SkipEmptyParts ); // skip empty entries + QString dirs = getenv( "LD_LIBRARY_PATH" ); + QString sep = ":"; #else - libs = getenv( "PATH" ); - if( !libs.isEmpty() ) { - QStringList dirList = libs.split( ";", QString::SkipEmptyParts ); // skip empty entries + QString dirs = getenv( "PATH" ); + QString sep = ";"; #endif - for( int i = dirList.count()-1; i >= 0; i-- ) { - QString dir = dirList[ i ]; - QFileInfo fi( Qtx::addSlash( dirList[ i ] ) + libraryName ); - if( fi.exists() ) { - OSD_SharedLibrary aSharedLibrary( fi.fileName().toLatin1().data() ); - 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 ) { - LibraryGUI func = (GEOMGUI* (*) (GeometryGUI*))osdF; - GEOMGUI* libGUI = (*func)(this); - if ( libGUI ) { - myGUIMap[ libraryName ] = libGUI; - break; // found and loaded! - } - } - } + 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 ) { + LibraryGUI func = (GEOMGUI* (*) (GeometryGUI*))osdF; + GEOMGUI* libGUI = (*func)( this ); + if ( libGUI ) { + myGUIMap[ libraryName ] = libGUI; + break; // found and loaded! + } + } + } } } } - if ( myGUIMap.contains( libraryName ) ) - // library is successfully loaded - return myGUIMap[ libraryName ]; - return 0; + return myGUIMap.contains( libraryName ) ? myGUIMap[ libraryName ] : 0; } //======================================================================= @@ -264,8 +288,7 @@ void GeometryGUI::ActiveWorkingPlane() view3d->SetProj(DZ.X(), DZ.Y(), DZ.Z()); view3d->SetUp(DY.X(), DY.Y(), DY.Z()); - - vw->onViewFitAll(); + vw->onViewFitAll(); } } else if( ViewVTK ) { @@ -349,8 +372,16 @@ void GeometryGUI::OnGUIEvent( int id ) bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); // if current viewframe is not of OCC and not of VTK type - return immediately // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example) - bool NotViewerDependentCommand = ( id == 901 || id == 216 || id == 213 ); - if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommand ) + QList NotViewerDependentCommands; + NotViewerDependentCommands << GEOMOp::OpDelete + << GEOMOp::OpShow + << GEOMOp::OpShowOnly + << GEOMOp::OpShowChildren + << GEOMOp::OpHideChildren + << GEOMOp::OpUnpublishObject + << GEOMOp::OpPublishObject + << GEOMOp::OpPointMarker; + if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) ) return; // fix for IPAL9103, point 2 @@ -359,405 +390,322 @@ void GeometryGUI::OnGUIEvent( int id ) return; } - GEOMGUI* library = 0; - // try to get-or-load corresponding GUI library - if( id == 111 || // MENU FILE - IMPORT BREP - id == 112 || // MENU FILE - IMPORT IGES - id == 113 || // MENU FILE - IMPORT STEP - id == 121 || // MENU FILE - EXPORT BREP - id == 122 || // MENU FILE - EXPORT IGES - id == 123 || // MENU FILE - EXPORT STEP - id == 2171 || // POPUP VIEWER - SELECT ONLY - VERTEX - id == 2172 || // POPUP VIEWER - SELECT ONLY - EDGE - id == 2173 || // POPUP VIEWER - SELECT ONLY - WIRE - id == 2174 || // POPUP VIEWER - SELECT ONLY - FACE - id == 2175 || // POPUP VIEWER - SELECT ONLY - SHELL - id == 2176 || // POPUP VIEWER - SELECT ONLY - SOLID - id == 2177 || // POPUP VIEWER - SELECT ONLY - COMPOUND - id == 2178 || // POPUP VIEWER - SELECT ONLY - SELECT ALL - id == 31 || // MENU EDIT - COPY - id == 33 || // MENU EDIT - DELETE - id == 411 || // MENU SETTINGS - ADD IN STUDY - id == 412 || // MENU SETTINGS - SHADING COLOR - id == 5103 || // MENU TOOLS - CHECK GEOMETRY - id == 8032 || // POPUP VIEWER - COLOR - id == 8033 || // POPUP VIEWER - TRANSPARENCY - id == 8034 || // POPUP VIEWER - ISOS - id == 8035 || // POPUP VIEWER - AUTO COLOR - id == 8036 || // POPUP VIEWER - DISABLE AUTO COLOR - id == 804 || // POPUP VIEWER - ADD IN STUDY - id == 901 || // OBJECT BROWSER - RENAME - id == 9024 ) { // OBJECT BROWSER - OPEN - //cout << "id " << id << " received" << endl; -#ifndef WNT - library = getLibrary( "libGEOMToolsGUI.so" ); -#else - library = getLibrary( "GEOMToolsGUI.dll" ); -#endif - } - else if( id == 211 || // MENU VIEW - WIREFRAME/SHADING - id == 212 || // MENU VIEW - DISPLAY ALL - id == 213 || // MENU VIEW - DISPLAY ONLY - id == 214 || // MENU VIEW - ERASE ALL - id == 215 || // MENU VIEW - ERASE - id == 216 || // MENU VIEW - DISPLAY - id == 80311 || // POPUP VIEWER - WIREFRAME - id == 80312 ) { // POPUP VIEWER - SHADING -#ifndef WNT - library = getLibrary( "libDisplayGUI.so" ); -#else - library = getLibrary( "DisplayGUI.dll" ); -#endif - } - else if( id == 4011 || // MENU BASIC - POINT - id == 4012 || // MENU BASIC - LINE - id == 4013 || // MENU BASIC - CIRCLE - id == 4014 || // MENU BASIC - ELLIPSE - id == 4015 || // MENU BASIC - ARC - id == 4016 || // MENU BASIC - VECTOR - id == 4017 || // MENU BASIC - PLANE - id == 4018 || // MENU BASIC - WPLANE - id == 4019 || // MENU BASIC - CURVE - id == 4020 ) { // MENU BASIC - REPAIR -#ifndef WNT - library = getLibrary( "libBasicGUI.so" ); -#else - library = getLibrary( "BasicGUI.dll" ); -#endif - } - else if( id == 4021 || // MENU PRIMITIVE - BOX - id == 4022 || // MENU PRIMITIVE - CYLINDER - id == 4023 || // MENU PRIMITIVE - SPHERE - id == 4024 || // MENU PRIMITIVE - TORUS - id == 4025 || // MENU PRIMITIVE - CONE - id == 4026 || // MENU PRIMITIVE - FACE - id == 4027 ) { // MENU PRIMITIVE - DISK -#ifndef WNT - library = getLibrary( "libPrimitiveGUI.so" ); -#else - library = getLibrary( "PrimitiveGUI.dll" ); -#endif - } - else if( id == 4031 || // MENU GENERATION - PRISM - id == 4032 || // MENU GENERATION - REVOLUTION - id == 4033 || // MENU GENERATION - FILLING - id == 4034 ) { // MENU GENERATION - PIPE -#ifndef WNT - library = getLibrary( "libGenerationGUI.so" ); -#else - library = getLibrary( "GenerationGUI.dll" ); -#endif - } - else if( id == 404 || // MENU ENTITY - SKETCHER - id == 405 || // MENU ENTITY - 3D SKETCHER - id == 407 ) { // MENU ENTITY - EXPLODE -#ifndef WNT - library = getLibrary( "libEntityGUI.so" ); -#else - library = getLibrary( "EntityGUI.dll" ); -#endif - } - else if( id == 4081 || // MENU BUILD - EDGE - id == 4082 || // MENU BUILD - WIRE - id == 4083 || // MENU BUILD - FACE - id == 4084 || // MENU BUILD - SHELL - id == 4085 || // MENU BUILD - SOLID - id == 4086 ) { // MENU BUILD - COMPUND -#ifndef WNT - library = getLibrary( "libBuildGUI.so" ); -#else - library = getLibrary( "BuildGUI.dll" ); -#endif - } - else if( id == 5011 || // MENU BOOLEAN - FUSE - id == 5012 || // MENU BOOLEAN - COMMON - id == 5013 || // MENU BOOLEAN - CUT - id == 5014 ) { // MENU BOOLEAN - SECTION -#ifndef WNT - library = getLibrary( "libBooleanGUI.so" ); -#else - library = getLibrary( "BooleanGUI.dll" ); -#endif - } - else if( id == 5021 || // MENU TRANSFORMATION - TRANSLATION - id == 5022 || // MENU TRANSFORMATION - ROTATION - id == 5023 || // MENU TRANSFORMATION - LOCATION - id == 5024 || // MENU TRANSFORMATION - MIRROR - id == 5025 || // MENU TRANSFORMATION - SCALE - id == 5026 || // MENU TRANSFORMATION - OFFSET - id == 5027 || // MENU TRANSFORMATION - MULTI-TRANSLATION - id == 5028 || // MENU TRANSFORMATION - MULTI-ROTATION - id == 5029 ) { // CONTEXT(POPUP) MENU - RELOAD_IMPORTED -#ifndef WNT - library = getLibrary( "libTransformationGUI.so" ); -#else - library = getLibrary( "TransformationGUI.dll" ); -#endif - } - else if( id == 503 || // MENU OPERATION - PARTITION - id == 504 || // MENU OPERATION - ARCHIMEDE - id == 505 || // MENU OPERATION - FILLET - id == 506 || // MENU OPERATION - CHAMFER - id == 507 || // MENU OPERATION - CLIPPING RANGE - id == 508 || // MENU OPERATION - GET SHAPES ON SHAPE - id == 509 ) { // MENU OPERATION - FILLET 2D -#ifndef WNT - library = getLibrary( "libOperationGUI.so" ); -#else - library = getLibrary( "OperationGUI.dll" ); -#endif - } - else if( id == 601 || // MENU REPAIR - SEWING - id == 603 || // MENU REPAIR - SUPPRESS FACES - id == 604 || // MENU REPAIR - SUPPRESS HOLE - id == 605 || // MENU REPAIR - SHAPE PROCESSING - id == 606 || // MENU REPAIR - CLOSE CONTOUR - id == 607 || // MENU REPAIR - REMOVE INTERNAL WIRES - id == 608 || // MENU REPAIR - ADD POINT ON EDGE - id == 609 || // MENU MEASURE - FREE BOUNDARIES - id == 610 || // MENU MEASURE - FREE FACES - id == 611 || // MENU REPAIR - CHANGE ORIENTATION - id == 602 || // MENU REPAIR - GLUE FACES - id == 612 ) { // MENU REPAIR - REMOVE EXTRA EDGES -#ifndef WNT - library = getLibrary( "libRepairGUI.so" ); -#else - library = getLibrary( "RepairGUI.dll" ); -#endif - } - else if( id == 701 || // MENU MEASURE - PROPERTIES - id == 702 || // MENU MEASURE - CDG - id == 703 || // MENU MEASURE - INERTIA - id == 704 || // MENU MEASURE - NORMALE - id == 7041 || // MENU MEASURE - BOUNDING BOX - id == 7042 || // MENU MEASURE - MIN DISTANCE - id == 7043 || // MENU MEASURE - ANGLE - id == 705 || // MENU MEASURE - TOLERANCE - id == 706 || // MENU MEASURE - WHATIS - id == 707 || // MENU MEASURE - CHECK - id == 7072 || // MENU MEASURE - CHECK COMPOUND OF BLOCKS - id == 708 ) { // MENU MEASURE - POINT COORDINATES -#ifndef WNT - library = getLibrary( "libMeasureGUI.so" ); -#else - library = getLibrary( "MeasureGUI.dll" ); -#endif - } - else if( id == 800 || // MENU GROUP - CREATE - id == 8001 || // POPUP MENU - CREATE GROUP - id == 801 ) { // MENU GROUP - EDIT -#ifndef WNT - library = getLibrary( "libGroupGUI.so" ); -#else - library = getLibrary( "GroupGUI.dll" ); + QString libName; + // find corresponding GUI library + switch ( id ) { + case GEOMOp::OpOriginAndVectors: // MENU BASIC - ORIGIN AND BASE VECTORS + createOriginAndBaseVectors(); // internal operation + return; + case GEOMOp::OpImport: // MENU FILE - IMPORT + case GEOMOp::OpExport: // MENU FILE - EXPORT + case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX + case GEOMOp::OpSelectEdge: // POPUP MENU - SELECT ONLY - EDGE + case GEOMOp::OpSelectWire: // POPUP MENU - SELECT ONLY - WIRE + case GEOMOp::OpSelectFace: // POPUP MENU - SELECT ONLY - FACE + case GEOMOp::OpSelectShell: // POPUP MENU - SELECT ONLY - SHELL + case GEOMOp::OpSelectSolid: // POPUP MENU - SELECT ONLY - SOLID + case GEOMOp::OpSelectCompound: // POPUP MENU - SELECT ONLY - COMPOUND + case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL + case GEOMOp::OpDelete: // MENU EDIT - DELETE + case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY + case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT + case GEOMOp::OpColor: // POPUP MENU - COLOR + case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE + case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY + case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY + case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY + case GEOMOp::OpIsos: // POPUP MENU - ISOS + case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOS + case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOS + case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR + case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR + case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN + case GEOMOp::OpHideChildren: // POPUP MENU - HIDE CHILDREN + case GEOMOp::OpUnpublishObject: // POPUP MENU - UNPUBLISH + case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH + case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER + case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES + case GEOMOp::OpEdgeWidth: // POPUP MENU - LINE WIDTH - EDGE WIDTH + case GEOMOp::OpIsosWidth: // POPUP MENU - LINE WIDTH - ISOS WIDTH + case GEOMOp::OpBringToFront: // POPUP MENU - BRING TO FRONT + case GEOMOp::OpClsBringToFront: // + libName = "GEOMToolsGUI"; + break; + case GEOMOp::OpDMWireframe: // MENU VIEW - WIREFRAME + case GEOMOp::OpDMShading: // MENU VIEW - SHADING + case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - SHADING + case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL + case GEOMOp::OpShowOnly: // MENU VIEW - DISPLAY ONLY + case GEOMOp::OpHideAll: // MENU VIEW - ERASE ALL + case GEOMOp::OpHide: // MENU VIEW - ERASE + case GEOMOp::OpShow: // MENU VIEW - DISPLAY + case GEOMOp::OpSwitchVectors: // MENU VIEW - VECTOR MODE + case GEOMOp::OpWireframe: // POPUP MENU - WIREFRAME + case GEOMOp::OpShading: // POPUP MENU - SHADING + case GEOMOp::OpShadingWithEdges: // POPUP MENU - SHADING WITH EDGES + case GEOMOp::OpTexture: // POPUP MENU - TEXTURE + case GEOMOp::OpVectors: // POPUP MENU - VECTORS + libName = "DisplayGUI"; + break; + case GEOMOp::OpPoint: // MENU BASIC - POINT + case GEOMOp::OpLine: // MENU BASIC - LINE + case GEOMOp::OpCircle: // MENU BASIC - CIRCLE + case GEOMOp::OpEllipse: // MENU BASIC - ELLIPSE + case GEOMOp::OpArc: // MENU BASIC - ARC + case GEOMOp::OpVector: // MENU BASIC - VECTOR + case GEOMOp::OpPlane: // MENU BASIC - PLANE + case GEOMOp::OpCurve: // MENU BASIC - CURVE + case GEOMOp::OpLCS: // MENU BASIC - LOCAL COORDINATE SYSTEM + libName = "BasicGUI"; + break; + case GEOMOp::OpBox: // MENU PRIMITIVE - BOX + case GEOMOp::OpCylinder: // MENU PRIMITIVE - CYLINDER + case GEOMOp::OpSphere: // MENU PRIMITIVE - SPHERE + case GEOMOp::OpTorus: // MENU PRIMITIVE - TORUS + case GEOMOp::OpCone: // MENU PRIMITIVE - CONE + case GEOMOp::OpRectangle: // MENU PRIMITIVE - FACE + case GEOMOp::OpDisk: // MENU PRIMITIVE - DISK + libName = "PrimitiveGUI"; + break; + case GEOMOp::OpPrism: // MENU GENERATION - PRISM + case GEOMOp::OpRevolution: // MENU GENERATION - REVOLUTION + case GEOMOp::OpFilling: // MENU GENERATION - FILLING + case GEOMOp::OpPipe: // MENU GENERATION - PIPE + libName = "GenerationGUI"; + break; + case GEOMOp::Op2dSketcher: // MENU ENTITY - SKETCHER + case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER + case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE +#ifdef WITH_OPENCV + case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION #endif + case GEOMOp::OpPictureImport: // MENU ENTITY - IMPORT PICTURE IN VIEWER + libName = "EntityGUI"; + break; + case GEOMOp::OpEdge: // MENU BUILD - EDGE + case GEOMOp::OpWire: // MENU BUILD - WIRE + case GEOMOp::OpFace: // MENU BUILD - FACE + case GEOMOp::OpShell: // MENU BUILD - SHELL + case GEOMOp::OpSolid: // MENU BUILD - SOLID + case GEOMOp::OpCompound: // MENU BUILD - COMPUND + libName = "BuildGUI"; + break; + case GEOMOp::OpFuse: // MENU BOOLEAN - FUSE + case GEOMOp::OpCommon: // MENU BOOLEAN - COMMON + case GEOMOp::OpCut: // MENU BOOLEAN - CUT + case GEOMOp::OpSection: // MENU BOOLEAN - SECTION + libName = "BooleanGUI"; + break; + case GEOMOp::OpTranslate: // MENU TRANSFORMATION - TRANSLATION + case GEOMOp::OpRotate: // MENU TRANSFORMATION - ROTATION + case GEOMOp::OpChangeLoc: // MENU TRANSFORMATION - LOCATION + case GEOMOp::OpMirror: // MENU TRANSFORMATION - MIRROR + case GEOMOp::OpScale: // MENU TRANSFORMATION - SCALE + case GEOMOp::OpOffset: // MENU TRANSFORMATION - OFFSET + case GEOMOp::OpProjection: // MENU TRANSFORMATION - PROJECTION + case GEOMOp::OpMultiTranslate: // MENU TRANSFORMATION - MULTI-TRANSLATION + case GEOMOp::OpMultiRotate: // MENU TRANSFORMATION - MULTI-ROTATION + case GEOMOp::OpReimport: // CONTEXT(POPUP) MENU - RELOAD_IMPORTED + libName = "TransformationGUI"; + break; + case GEOMOp::OpPartition: // MENU OPERATION - PARTITION + case GEOMOp::OpArchimede: // MENU OPERATION - ARCHIMEDE + case GEOMOp::OpFillet3d: // MENU OPERATION - FILLET + case GEOMOp::OpChamfer: // MENU OPERATION - CHAMFER + case GEOMOp::OpClipping: // MENU OPERATION - CLIPPING RANGE + case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE + case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D + case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D + case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES + case GEOMOp::OpExtrudedBoss: // MENU OPERATION - EXTRUDED BOSS + case GEOMOp::OpExtrudedCut: // MENU OPERATION - EXTRUDED CUT + libName = "OperationGUI"; + break; + case GEOMOp::OpSewing: // MENU REPAIR - SEWING + case GEOMOp::OpSuppressFaces: // MENU REPAIR - SUPPRESS FACES + case GEOMOp::OpSuppressHoles: // MENU REPAIR - SUPPRESS HOLE + case GEOMOp::OpShapeProcess: // MENU REPAIR - SHAPE PROCESSING + case GEOMOp::OpCloseContour: // MENU REPAIR - CLOSE CONTOUR + case GEOMOp::OpRemoveIntWires: // MENU REPAIR - REMOVE INTERNAL WIRES + case GEOMOp::OpAddPointOnEdge: // MENU REPAIR - ADD POINT ON EDGE + case GEOMOp::OpFreeBoundaries: // MENU MEASURE - FREE BOUNDARIES + case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES + case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION + case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES + case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES + case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE + case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES + case GEOMOp::OpFuseEdges: // MENU REPAIR - FUSE COLLINEAR EDGES + libName = "RepairGUI"; + break; + case GEOMOp::OpProperties: // MENU MEASURE - PROPERTIES + case GEOMOp::OpCenterMass: // MENU MEASURE - CDG + case GEOMOp::OpInertia: // MENU MEASURE - INERTIA + case GEOMOp::OpNormale: // MENU MEASURE - NORMALE + case GEOMOp::OpBoundingBox: // MENU MEASURE - BOUNDING BOX + case GEOMOp::OpMinDistance: // MENU MEASURE - MIN DISTANCE + case GEOMOp::OpAngle: // MENU MEASURE - ANGLE + case GEOMOp::OpTolerance: // MENU MEASURE - TOLERANCE + case GEOMOp::OpWhatIs: // MENU MEASURE - WHATIS + case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK + case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS + case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES + case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS + libName = "MeasureGUI"; + break; + case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE + case GEOMOp::OpGroupCreatePopup: // POPUP MENU - CREATE GROUP + case GEOMOp::OpGroupEdit: // MENU GROUP - EDIT + libName = "GroupGUI"; + break; + case GEOMOp::OpHexaSolid: // MENU BLOCKS - HEXAHEDRAL SOLID + case GEOMOp::OpMultiTransform: // MENU BLOCKS - MULTI-TRANSFORMATION + case GEOMOp::OpQuadFace: // MENU BLOCKS - QUADRANGLE FACE + case GEOMOp::OpPropagate: // MENU BLOCKS - PROPAGATE + 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 + //@@ 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; + default: + break; } - else if( id == 9999 || // MENU BLOCKS - HEXAHEDRAL SOLID - id == 9998 || // MENU BLOCKS - MULTI-TRANSFORMATION - id == 9997 || // MENU BLOCKS - QUADRANGLE FACE - id == 99991 || // MENU BLOCKS - PROPAGATE - id == 9995 ) { // MENU BLOCKS - EXPLODE ON BLOCKS + + GEOMGUI* library = 0; + if ( !libName.isEmpty() ) { #ifndef WNT - library = getLibrary( "libBlocksGUI.so" ); + libName = QString( "lib" ) + libName + ".so"; #else - library = getLibrary( "BlocksGUI.dll" ); + libName = libName + ".dll"; #endif + library = getLibrary( libName ); } // call method of corresponding GUI library - if ( library ) + if ( library ) { library->OnGUIEvent( id, desk ); + + // Update a list of materials for "Preferences" dialog + if ( id == GEOMOp::OpMaterialProperties ) { + LightApp_Preferences* pref = preferences(); + if ( pref ) { + Material_ResourceMgr aMatResMgr; + setPreferenceProperty( pref->rootItem()->findItem( tr( "PREF_MATERIAL" ), true )->id(), + "strings", + aMatResMgr.materials() ); + } + } + } else SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) ); } - //================================================================================= // function : GeometryGUI::OnKeyPress() // purpose : Called when any key is pressed by user [static] //================================================================================= -void GeometryGUI::OnKeyPress( SUIT_ViewWindow* win, QKeyEvent* pe ) +void GeometryGUI::OnKeyPress( SUIT_ViewWindow* w, QKeyEvent* e ) { - GUIMap::Iterator it; - bool bOk = true; - for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) { - SUIT_Application* anApp = application(); - if (!anApp) return; - bOk = bOk && it.value()->OnKeyPress( pe, anApp->desktop(), win ); - } -// return bOk; + if ( !application() ) + return; + foreach ( GEOMGUI* lib, myGUIMap ) + lib->OnKeyPress( e, application()->desktop(), w ); } - //================================================================================= // function : GeometryGUI::OnMouseMove() // purpose : Manages mouse move events [static] //================================================================================= -void GeometryGUI::OnMouseMove( SUIT_ViewWindow* win, QMouseEvent* pe ) +void GeometryGUI::OnMouseMove( SUIT_ViewWindow* w, QMouseEvent* e ) { - GUIMap::Iterator it; - bool bOk = true; - for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) { - SUIT_Application* anApp = application(); - if (!anApp) return; - bOk = bOk && it.value()->OnMouseMove( pe, anApp->desktop(), win ); - } -// return bOk; + if ( !application() ) + return; + foreach ( GEOMGUI* lib, myGUIMap ) + lib->OnMouseMove( e, application()->desktop(), w ); } - //================================================================================= -// function : GeometryGUI::0nMousePress() -// purpose : Manage mouse press events [static] +// function : GeometryGUI::OnMouseRelease() +// purpose : Manages mouse release events [static] //================================================================================= -void GeometryGUI::OnMousePress( SUIT_ViewWindow* win, QMouseEvent* pe ) -{ - GUIMap::Iterator it; - // OnMousePress() should return false if this event should be processed further - // (see OCCViewer_Viewer3d::onMousePress() for explanation) - bool processed = false; - for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) { - SUIT_Application* anApp = application(); - if (!anApp) return; - processed = processed || it.value()->OnMousePress( pe, anApp->desktop(), win ); - } -// return processed; -} - -/* -static void UpdateVtkSelection() +void GeometryGUI::OnMouseRelease( SUIT_ViewWindow* w, QMouseEvent* e ) { - QPtrList winList = application()->desktop()->windows(); - SUIT_ViewWindow* win = 0; - for ( win = winList.first(); win; win = winList.next() ) { - if ( win->getViewManager()->getTypeView() == VIEW_VTK ) { - SVTK_ViewWindow* vw = dynamic_cast( window ); - if ( vw ) { - SVTK_RenderWindowInteractor* anInteractor = vw->getRWInteractor(); - anInteractor->SetSelectionProp(); - anInteractor->SetSelectionTolerance(); - SVTK_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME(); - if (aStyle) { - aStyle->setPreselectionProp(); - } - } - } - } + if ( !application() ) + return; + foreach ( GEOMGUI* lib, myGUIMap ) + lib->OnMouseRelease( e, application()->desktop(), w ); } //================================================================================= -// function : GeometryGUI::SetSettings() -// purpose : Called when GEOM module is activated [static] +// function : GeometryGUI::OnMousePress() +// purpose : Manage mouse press events [static] //================================================================================= -bool GeometryGUI::SetSettings() +void GeometryGUI::OnMousePress( SUIT_ViewWindow* w, QMouseEvent* e ) { - QMenuBar* Mb = parent->getMainMenuBar(); - SUIT_Study* ActiveStudy = application()->activeStudy(); - -// Wireframe or Shading - int DisplayMode = 0; - SUIT_ViewWindow* window = application()->desktop()->activeWindow(); - bool ViewOCC = ( window && window->getViewManager()->getType() == VIEW_OCC ); - bool ViewVTK = ( window && window->getViewManager()->getType() == VIEW_VTK ); - if ( ViewOCC ) { - OCCViewer_ViewManager* vm = dynamic_cast( window->getViewManager() ); - if ( vm ) { - Handle(AIS_InteractiveContext) ic = vm->getOCCViewer()->getAISContext(); - DisplayMode = ic->DisplayMode(); - } - } - else if ( ViewVTK ) { - SVTK_ViewWindow* vw = dynamic_cast( window ); - if ( vw ) { - SVTK_RenderWindowInteractor* myRenderInter = vw->getRWInteractor(); - DisplayMode = myRenderInter->GetDisplayMode(); - } - } - - if( DisplayMode == 1 ) - getApp()-> - Mb->changeItem( 211, tr( "GEOM_MEN_WIREFRAME" ) ); - else - Mb->changeItem( 211, tr( "GEOM_MEN_SHADING" ) ); - - - // Add in Study - !!!ALWAYS TRUE!!! /////// VSR : TO BE REMOVED - QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy"); - int Settings_AddInStudy; - // if(!AddInStudy.isEmpty()) - // Settings_AddInStudy = AddInStudy.toInt(); - // else - - Settings_AddInStudy = 1; - Mb->setItemChecked(411, Settings_AddInStudy); - - // step value - QString S = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - if(S.isEmpty()) - QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", "100"); - - // isos - int count = ActiveStudy->getStudyFramesCount(); - for(int i = 0; i < count; i++) { - if(ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); - QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); - if(!IsoU.isEmpty()) - ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); - if(!IsoV.isEmpty()) - ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); - } - } - - setActionsEnabled(); - - // PAL5356: update VTK selection - ::UpdateVtkSelection(); - bool bOk = true; - GUIMap::Iterator it; - for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) - bOk = bOk && it.data()->SetSettings( parent ); - - // MZN: Enable/disable "Clipping range" menu item(from GEOM_CLIPPING variable) - if (getenv( "GEOM_CLIPPING" ) == NULL) - { - QMenuItem* mi = Mb->findItem(50); - if (mi && mi->popup()) - mi->popup()->removeItem(507); - } - - return bOk; + if ( !application() ) + return; + foreach ( GEOMGUI* lib, myGUIMap ) + lib->OnMousePress( e, application()->desktop(), w ); } -*/ //======================================================================= // function : createGeomAction // purpose : //======================================================================= -void GeometryGUI::createGeomAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle ) +void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel, + const int accel, const bool toggle, const QString& shortcutAction ) { - QIcon icon; - QWidget* parent = application()->desktop(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QPixmap pix; - if ( icon_id.length() ) - pix = resMgr->loadPixmap( "GEOM", tr( icon_id.toLatin1().constData() ) ); - else - pix = resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+po_id).toLatin1().constData() ), false ); - if ( !pix.isNull() ) - icon = QIcon( pix ); - - QString tooltip = tr( (QString( "TOP_" )+po_id).toLatin1().constData() ), - menu = tr( (QString( "MEN_" )+po_id).toLatin1().constData() ), - status_bar = tr( (QString( "STB_" )+po_id).toLatin1().constData() ); - - createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) ); + QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false ) + : resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) ); + createAction( id, + tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ), + icon, + tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ), + tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ), + accel, + application()->desktop(), + toggle, + this, SLOT( OnGUIEvent() ), + shortcutAction ); } - +//======================================================================= +// function : createOriginAndBaseVectors +// purpose : +//======================================================================= +void GeometryGUI::createOriginAndBaseVectors() +{ + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + if( appStudy ) { + _PTR(Study) studyDS = appStudy->studyDS(); + if( studyDS && !CORBA::is_nil( GetGeomGen() ) ) { + GEOM::GEOM_IBasicOperations_var aBasicOperations = GetGeomGen()->GetIBasicOperations( studyDS->StudyId() ); + if( !aBasicOperations->_is_nil() ) { + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + double aLength = aResourceMgr->doubleValue( "Geometry", "base_vectors_length", 1.0 ); + GEOM::GEOM_Object_var anOrigin = aBasicOperations->MakePointXYZ( 0.0, 0.0, 0.0 ); + GEOM::GEOM_Object_var anOX = aBasicOperations->MakeVectorDXDYDZ( aLength, 0.0, 0.0 ); + GEOM::GEOM_Object_var anOY = aBasicOperations->MakeVectorDXDYDZ( 0.0, aLength, 0.0 ); + GEOM::GEOM_Object_var anOZ = aBasicOperations->MakeVectorDXDYDZ( 0.0, 0.0, aLength ); + + SALOMEDS::Study_var aDSStudy = ClientStudyToStudy( studyDS ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOrigin, "O" ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" ); + GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" ); + + getApp()->updateObjectBrowser( false ); + } + } + } +} //======================================================================= // function : GeometryGUI::initialize() @@ -769,447 +717,650 @@ void GeometryGUI::initialize( CAM_Application* app ) // ----- create actions -------------- - createGeomAction( 111, "IMPORT", "", (CTRL + Key_I) ); - createGeomAction( 121, "EXPORT", "", (CTRL + Key_E) ); - - createGeomAction( 33, "DELETE", "", Qt::Key_Delete ); - - createGeomAction( 4011, "POINT" ); - createGeomAction( 4012, "LINE" ); - createGeomAction( 4013, "CIRCLE" ); - createGeomAction( 4014, "ELLIPSE" ); - createGeomAction( 4015, "ARC" ); - createGeomAction( 4019, "CURVE" ); - createGeomAction( 4016, "VECTOR" ); - createGeomAction( 4017, "PLANE" ); - createGeomAction( 4018, "WORK_PLANE" ); - createGeomAction( 4020, "LOCAL_CS" ); - - createGeomAction( 4021, "BOX" ); - createGeomAction( 4022, "CYLINDER" ); - createGeomAction( 4023, "SPHERE" ); - createGeomAction( 4024, "TORUS" ); - createGeomAction( 4025, "CONE" ); - createGeomAction( 4026, "FACE" ); - createGeomAction( 4027, "DISK" ); - - createGeomAction( 4031, "EXTRUSION" ); - createGeomAction( 4032, "REVOLUTION" ); - createGeomAction( 4033, "FILLING" ); - createGeomAction( 4034, "PIPE" ); - - createGeomAction( 800, "GROUP_CREATE" ); - createGeomAction( 801, "GROUP_EDIT" ); - - createGeomAction( 5029, "RELOAD_IMPORTED" ); - - createGeomAction( 9997, "Q_FACE" ); - createGeomAction( 9999, "HEX_SOLID" ); - - createGeomAction( 404, "SKETCH" ); - createGeomAction( 405, "3DSKETCH" ); - createGeomAction( 407, "EXPLODE" ); - - createGeomAction( 4081, "EDGE" ); - createGeomAction( 4082, "WIRE" ); - createGeomAction( 4083, "FACE" ); - createGeomAction( 4084, "SHELL" ); - createGeomAction( 4085, "SOLID" ); - createGeomAction( 4086, "COMPOUND" ); - - createGeomAction( 5011, "FUSE" ); - createGeomAction( 5012, "COMMON" ); - createGeomAction( 5013, "CUT" ); - createGeomAction( 5014, "SECTION" ); - - createGeomAction( 5021, "TRANSLATION" ); - createGeomAction( 5022, "ROTATION" ); - createGeomAction( 5023, "MODIFY_LOCATION" ); - createGeomAction( 5024, "MIRROR" ); - createGeomAction( 5025, "SCALE" ); - createGeomAction( 5026, "OFFSET" ); - createGeomAction( 5027, "MUL_TRANSLATION" ); - createGeomAction( 5028, "MUL_ROTATION" ); - - createGeomAction( 503, "PARTITION" ); - createGeomAction( 504, "ARCHIMEDE" ); - createGeomAction( 505, "FILLET" ); - createGeomAction( 506, "CHAMFER" ); - //createGeomAction( 507, "CLIPPING" ); - createGeomAction( 508, "GET_SHAPES_ON_SHAPES" ); - createGeomAction( 509, "FILLET_2D" ); - - createGeomAction( 9998, "MUL_TRANSFORM" ); - createGeomAction( 9995, "EXPLODE_BLOCKS" ); - createGeomAction( 99991, "PROPAGATE" ); - - createGeomAction( 601, "SEWING" ); - createGeomAction( 602, "GLUE_FACES" ); - createGeomAction( 603, "SUPPRESS_FACES" ); - createGeomAction( 604, "SUPPERSS_HOLES" ); - createGeomAction( 605, "SHAPE_PROCESS" ); - createGeomAction( 606, "CLOSE_CONTOUR" ); - createGeomAction( 607, "SUPPRESS_INT_WIRES" ); - createGeomAction( 608, "POINT_ON_EDGE" ); - createGeomAction( 609, "CHECK_FREE_BNDS" ); - createGeomAction( 610, "CHECK_FREE_FACES" ); - createGeomAction( 611, "CHANGE_ORIENTATION" ); - createGeomAction( 612, "REMOVE_EXTRA_EDGES" ); - - createGeomAction( 708, "POINT_COORDS" ); - createGeomAction( 701, "BASIC_PROPS" ); - createGeomAction( 702, "MASS_CENTER" ); - createGeomAction( 703, "INERTIA" ); - createGeomAction( 704, "NORMALE" ); - createGeomAction( 7041, "BND_BOX" ); - createGeomAction( 7042, "MIN_DIST" ); - createGeomAction( 7043, "MEASURE_ANGLE" ); - - createGeomAction( 705, "TOLERANCE" ); - createGeomAction( 706, "WHAT_IS" ); - createGeomAction( 707, "CHECK" ); - createGeomAction( 7072, "CHECK_COMPOUND" ); + createGeomAction( GEOMOp::OpImport, "IMPORT", "", Qt::ControlModifier + Qt::Key_I ); + createGeomAction( GEOMOp::OpExport, "EXPORT", "", Qt::ControlModifier + Qt::Key_E ); + + createGeomAction( GEOMOp::OpDelete, "DELETE", "", Qt::Key_Delete ); + + createGeomAction( GEOMOp::OpPoint, "POINT" ); + createGeomAction( GEOMOp::OpLine, "LINE" ); + createGeomAction( GEOMOp::OpCircle, "CIRCLE" ); + createGeomAction( GEOMOp::OpEllipse, "ELLIPSE" ); + createGeomAction( GEOMOp::OpArc, "ARC" ); + createGeomAction( GEOMOp::OpCurve, "CURVE" ); + createGeomAction( GEOMOp::OpVector, "VECTOR" ); + createGeomAction( GEOMOp::OpPlane, "PLANE" ); + createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" ); + createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" ); + + createGeomAction( GEOMOp::OpBox, "BOX" ); + createGeomAction( GEOMOp::OpCylinder, "CYLINDER" ); + createGeomAction( GEOMOp::OpSphere, "SPHERE" ); + createGeomAction( GEOMOp::OpTorus, "TORUS" ); + createGeomAction( GEOMOp::OpCone, "CONE" ); + createGeomAction( GEOMOp::OpRectangle, "RECTANGLE" ); + createGeomAction( GEOMOp::OpDisk, "DISK" ); + + createGeomAction( GEOMOp::OpPrism, "EXTRUSION" ); + createGeomAction( GEOMOp::OpRevolution, "REVOLUTION" ); + createGeomAction( GEOMOp::OpFilling, "FILLING" ); + createGeomAction( GEOMOp::OpPipe, "PIPE" ); + + createGeomAction( GEOMOp::OpGroupCreate, "GROUP_CREATE" ); + createGeomAction( GEOMOp::OpGroupEdit, "GROUP_EDIT" ); + + createGeomAction( GEOMOp::OpReimport, "RELOAD_IMPORTED" ); + + createGeomAction( GEOMOp::OpQuadFace, "Q_FACE" ); + createGeomAction( GEOMOp::OpHexaSolid, "HEX_SOLID" ); + + createGeomAction( GEOMOp::Op2dSketcher, "SKETCH" ); + createGeomAction( GEOMOp::Op3dSketcher, "3DSKETCH" ); + createGeomAction( GEOMOp::OpExplode, "EXPLODE" ); +#ifdef WITH_OPENCV + createGeomAction( GEOMOp::OpFeatureDetect,"FEATURE_DETECTION" ); +#endif + createGeomAction( GEOMOp::OpPictureImport,"PICTURE_IMPORT" ); + + createGeomAction( GEOMOp::OpEdge, "EDGE" ); + createGeomAction( GEOMOp::OpWire, "WIRE" ); + createGeomAction( GEOMOp::OpFace, "FACE" ); + createGeomAction( GEOMOp::OpShell, "SHELL" ); + createGeomAction( GEOMOp::OpSolid, "SOLID" ); + createGeomAction( GEOMOp::OpCompound, "COMPOUND" ); + + createGeomAction( GEOMOp::OpFuse, "FUSE" ); + createGeomAction( GEOMOp::OpCommon, "COMMON" ); + createGeomAction( GEOMOp::OpCut, "CUT" ); + createGeomAction( GEOMOp::OpSection, "SECTION" ); + + createGeomAction( GEOMOp::OpTranslate, "TRANSLATION" ); + createGeomAction( GEOMOp::OpRotate, "ROTATION" ); + createGeomAction( GEOMOp::OpChangeLoc, "MODIFY_LOCATION" ); + createGeomAction( GEOMOp::OpMirror, "MIRROR" ); + createGeomAction( GEOMOp::OpScale, "SCALE" ); + createGeomAction( GEOMOp::OpOffset, "OFFSET" ); + createGeomAction( GEOMOp::OpProjection, "PROJECTION" ); + createGeomAction( GEOMOp::OpMultiTranslate, "MUL_TRANSLATION" ); + createGeomAction( GEOMOp::OpMultiRotate, "MUL_ROTATION" ); + + createGeomAction( GEOMOp::OpPartition, "PARTITION" ); + createGeomAction( GEOMOp::OpArchimede, "ARCHIMEDE" ); + createGeomAction( GEOMOp::OpFillet3d, "FILLET" ); + createGeomAction( GEOMOp::OpChamfer, "CHAMFER" ); + //createGeomAction( GEOMOp::OpClipping, "CLIPPING" ); + createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" ); + createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" ); + createGeomAction( GEOMOp::OpExtrudedCut, "EXTRUDED_CUT" ); + createGeomAction( GEOMOp::OpExtrudedBoss, "EXTRUDED_BOSS" ); + createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" ); + createGeomAction( GEOMOp::OpFillet2d, "FILLET_2D" ); + + createGeomAction( GEOMOp::OpMultiTransform, "MUL_TRANSFORM" ); + createGeomAction( GEOMOp::OpExplodeBlock, "EXPLODE_BLOCKS" ); + createGeomAction( GEOMOp::OpPropagate, "PROPAGATE" ); + + createGeomAction( GEOMOp::OpSewing, "SEWING" ); + createGeomAction( GEOMOp::OpGlueFaces, "GLUE_FACES" ); + createGeomAction( GEOMOp::OpGlueEdges, "GLUE_EDGES" ); + createGeomAction( GEOMOp::OpLimitTolerance, "LIMIT_TOLERANCE" ); + createGeomAction( GEOMOp::OpSuppressFaces, "SUPPRESS_FACES" ); + createGeomAction( GEOMOp::OpSuppressHoles, "SUPPERSS_HOLES" ); + createGeomAction( GEOMOp::OpShapeProcess, "SHAPE_PROCESS" ); + createGeomAction( GEOMOp::OpCloseContour, "CLOSE_CONTOUR" ); + createGeomAction( GEOMOp::OpRemoveIntWires, "SUPPRESS_INT_WIRES" ); + createGeomAction( GEOMOp::OpAddPointOnEdge, "POINT_ON_EDGE" ); + createGeomAction( GEOMOp::OpFreeBoundaries, "CHECK_FREE_BNDS" ); + createGeomAction( GEOMOp::OpFreeFaces, "CHECK_FREE_FACES" ); + createGeomAction( GEOMOp::OpOrientation, "CHANGE_ORIENTATION" ); + createGeomAction( GEOMOp::OpRemoveExtraEdges, "REMOVE_EXTRA_EDGES" ); + createGeomAction( GEOMOp::OpFuseEdges, "FUSE_EDGES" ); + + createGeomAction( GEOMOp::OpPointCoordinates, "POINT_COORDS" ); + createGeomAction( GEOMOp::OpProperties, "BASIC_PROPS" ); + createGeomAction( GEOMOp::OpCenterMass, "MASS_CENTER" ); + createGeomAction( GEOMOp::OpInertia, "INERTIA" ); + createGeomAction( GEOMOp::OpNormale, "NORMALE" ); + createGeomAction( GEOMOp::OpBoundingBox, "BND_BOX" ); + createGeomAction( GEOMOp::OpMinDistance, "MIN_DIST" ); + createGeomAction( GEOMOp::OpAngle, "MEASURE_ANGLE" ); + + createGeomAction( GEOMOp::OpTolerance, "TOLERANCE" ); + createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" ); + createGeomAction( GEOMOp::OpCheckShape, "CHECK" ); + createGeomAction( GEOMOp::OpCheckCompound, "CHECK_COMPOUND" ); + createGeomAction( GEOMOp::OpCheckSelfInters, "CHECK_SELF_INTERSECTIONS" ); #ifdef _DEBUG_ // PAL16821 - createGeomAction( 5103, "CHECK_GEOMETRY" ); + createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" ); #endif - createGeomAction( 412, "SHADING_COLOR" ); - - createGeomAction( 211, "SHADING" ); - createGeomAction( 212, "DISPLAY_ALL" ); - createGeomAction( 214, "ERASE_ALL" ); - createGeomAction( 216, "DISPLAY" ); - createGeomAction( 2171, "VERTEX_SEL_ONLY" ,"", 0, true ); - createGeomAction( 2172, "EDGE_SEL_ONLY", "", 0, true ); - createGeomAction( 2173, "WIRE_SEL_ONLY", "", 0, true ); - createGeomAction( 2174, "FACE_SEL_ONLY", "", 0, true ); - createGeomAction( 2175, "SHELL_SEL_ONLY", "", 0, true ); - createGeomAction( 2176, "SOLID_SEL_ONLY", "", 0, true ); - createGeomAction( 2177, "COMPOUND_SEL_ONLY", "", 0, true ); - createGeomAction( 2178, "ALL_SEL_ONLY", "", 0, true ); - createGeomAction( 213, "DISPLAY_ONLY" ); - createGeomAction( 215, "ERASE" ); - - createGeomAction( 901, "POP_RENAME", "", Qt::Key_F2 ); - createGeomAction( 80311, "POP_WIREFRAME", "", 0, true ); - createGeomAction( 80312, "POP_SHADING", "", 0, true ); - createGeomAction( 8032, "POP_COLOR" ); - createGeomAction( 8033, "POP_TRANSPARENCY" ); - createGeomAction( 8034, "POP_ISOS" ); - createGeomAction( 8035, "POP_AUTO_COLOR" ); - createGeomAction( 8036, "POP_DISABLE_AUTO_COLOR" ); - createGeomAction( 8001, "POP_CREATE_GROUP" ); - - // make wireframe-shading items to be exclusive (only one at a time is selected) - //QActionGroup* dispModeGr = new QActionGroup( this, "", true ); - //dispModeGr->add( action( 80311 ) ); - //dispModeGr->add( action( 80312 ) ); - // ---- create menu -------------------------- + + createGeomAction( GEOMOp::OpDMWireframe, "WIREFRAME" ); + createGeomAction( GEOMOp::OpDMShading, "SHADING" ); + createGeomAction( GEOMOp::OpDMShadingWithEdges, "SHADING_WITH_EDGES" ); + createGeomAction( GEOMOp::OpShowAll, "DISPLAY_ALL" ); + createGeomAction( GEOMOp::OpHideAll, "ERASE_ALL" ); + createGeomAction( GEOMOp::OpShow, "DISPLAY" ); + createGeomAction( GEOMOp::OpSwitchVectors, "VECTOR_MODE"); + createGeomAction( GEOMOp::OpSelectVertex, "VERTEX_SEL_ONLY" ,"", 0, true ); + createGeomAction( GEOMOp::OpSelectEdge, "EDGE_SEL_ONLY", "", 0, true ); + createGeomAction( GEOMOp::OpSelectWire, "WIRE_SEL_ONLY", "", 0, true ); + createGeomAction( GEOMOp::OpSelectFace, "FACE_SEL_ONLY", "", 0, true ); + createGeomAction( GEOMOp::OpSelectShell, "SHELL_SEL_ONLY", "", 0, true ); + createGeomAction( GEOMOp::OpSelectSolid, "SOLID_SEL_ONLY", "", 0, true ); + createGeomAction( GEOMOp::OpSelectCompound, "COMPOUND_SEL_ONLY", "", 0, true ); + createGeomAction( GEOMOp::OpSelectAll, "ALL_SEL_ONLY", "", 0, true ); + createGeomAction( GEOMOp::OpShowOnly, "DISPLAY_ONLY" ); + createGeomAction( GEOMOp::OpBringToFront, "BRING_TO_FRONT", "", 0, true ); + createGeomAction( GEOMOp::OpClsBringToFront, "CLS_BRING_TO_FRONT" ); + createGeomAction( GEOMOp::OpHide, "ERASE" ); + + createGeomAction( GEOMOp::OpWireframe, "POP_WIREFRAME", "", 0, true ); + createGeomAction( GEOMOp::OpShading, "POP_SHADING", "", 0, true ); + createGeomAction( GEOMOp::OpShadingWithEdges, "POP_SHADING_WITH_EDGES", "", 0, true ); + createGeomAction( GEOMOp::OpTexture, "POP_TEXTURE", "", 0, true ); + createGeomAction( GEOMOp::OpEdgeWidth, "EDGE_WIDTH"); + createGeomAction( GEOMOp::OpIsosWidth, "ISOS_WIDTH"); + createGeomAction( GEOMOp::OpVectors, "POP_VECTORS", "", 0, true ); + createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" ); + createGeomAction( GEOMOp::OpColor, "POP_COLOR" ); + createGeomAction( GEOMOp::OpSetTexture, "POP_SETTEXTURE" ); + createGeomAction( GEOMOp::OpTransparency, "POP_TRANSPARENCY" ); + createGeomAction( GEOMOp::OpIsos, "POP_ISOS" ); + createGeomAction( GEOMOp::OpAutoColor, "POP_AUTO_COLOR" ); + createGeomAction( GEOMOp::OpNoAutoColor, "POP_DISABLE_AUTO_COLOR" ); + createGeomAction( GEOMOp::OpGroupCreatePopup, "POP_CREATE_GROUP" ); + createGeomAction( GEOMOp::OpShowChildren, "POP_SHOW_CHILDREN" ); + createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" ); + createGeomAction( GEOMOp::OpUnpublishObject, "POP_UNPUBLISH_OBJ" ); + createGeomAction( GEOMOp::OpPublishObject, "POP_PUBLISH_OBJ" ); + createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" ); + createGeomAction( GEOMOp::OpMaterialProperties, "POP_MATERIAL_PROPERTIES" ); + + createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" ); + + // Create actions for increase/decrease transparency shortcuts + createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false, + "Geometry:Increase transparency"); + createGeomAction( GEOMOp::OpDecrTransparency, "", "", 0, false, + "Geometry:Decrease transparency"); + + // Create actions for increase/decrease number of isolines + createGeomAction( GEOMOp::OpIncrNbIsos, "", "", 0, false, + "Geometry:Increase number of isolines"); + createGeomAction( GEOMOp::OpDecrNbIsos, "", "", 0, false, + "Geometry:Decrease number of isolines"); + +// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" ); + createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" ); + createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" ); + //@@ 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 -------------------------- int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 ); - createMenu( separator(), fileId, 10 ); - createMenu( 111, fileId, 10 ); - createMenu( 121, fileId, 10 ); - createMenu( separator(), fileId, -1 ); + createMenu( separator(), fileId, 10 ); + createMenu( GEOMOp::OpImport, fileId, 10 ); + createMenu( GEOMOp::OpExport, fileId, 10 ); + createMenu( separator(), fileId, -1 ); int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 ); - createMenu( 33, editId, -1 ); + createMenu( GEOMOp::OpDelete, editId, -1 ); int newEntId = createMenu( tr( "MEN_NEW_ENTITY" ), -1, -1, 10 ); int basicId = createMenu( tr( "MEN_BASIC" ), newEntId, -1 ); - createMenu( 4011, basicId, -1 ); - createMenu( 4012, basicId, -1 ); - createMenu( 4013, basicId, -1 ); - createMenu( 4014, basicId, -1 ); - createMenu( 4015, basicId, -1 ); - createMenu( 4019, basicId, -1 ); - createMenu( separator(), basicId, -1 ); - createMenu( 4016, basicId, -1 ); - createMenu( 4017, basicId, -1 ); - createMenu( 4018, basicId, -1 ); - createMenu( 4020, basicId, -1 ); + createMenu( GEOMOp::OpPoint, basicId, -1 ); + createMenu( GEOMOp::OpLine, basicId, -1 ); + createMenu( GEOMOp::OpCircle, basicId, -1 ); + createMenu( GEOMOp::OpEllipse, basicId, -1 ); + createMenu( GEOMOp::OpArc, basicId, -1 ); + createMenu( GEOMOp::OpCurve, basicId, -1 ); + createMenu( GEOMOp::Op2dSketcher, basicId, -1 ); + createMenu( GEOMOp::Op3dSketcher, basicId, -1 ); + createMenu( separator(), basicId, -1 ); + createMenu( GEOMOp::OpVector, basicId, -1 ); + createMenu( GEOMOp::OpPlane, basicId, -1 ); + createMenu( GEOMOp::OpLCS, basicId, -1 ); + createMenu( GEOMOp::OpOriginAndVectors, basicId, -1 ); int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 ); - createMenu( 4021, primId, -1 ); - createMenu( 4022, primId, -1 ); - createMenu( 4023, primId, -1 ); - createMenu( 4024, primId, -1 ); - createMenu( 4025, primId, -1 ); - createMenu( 4026, primId, -1 ); - createMenu( 4027, primId, -1 ); + createMenu( GEOMOp::OpBox, primId, -1 ); + createMenu( GEOMOp::OpCylinder, primId, -1 ); + createMenu( GEOMOp::OpSphere, primId, -1 ); + createMenu( GEOMOp::OpTorus, primId, -1 ); + createMenu( GEOMOp::OpCone, primId, -1 ); + createMenu( GEOMOp::OpRectangle, primId, -1 ); + createMenu( GEOMOp::OpDisk, primId, -1 ); + createMenu( GEOMOp::OpPipeTShape,primId, -1 ); int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 ); - createMenu( 4031, genId, -1 ); - createMenu( 4032, genId, -1 ); - createMenu( 4033, genId, -1 ); - createMenu( 4034, genId, -1 ); + createMenu( GEOMOp::OpPrism, genId, -1 ); + createMenu( GEOMOp::OpRevolution, genId, -1 ); + createMenu( GEOMOp::OpFilling, genId, -1 ); + createMenu( GEOMOp::OpPipe, genId, -1 ); + +// int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -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 ); int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 ); - createMenu( 800, groupId, -1 ); - createMenu( 801, groupId, -1 ); + createMenu( GEOMOp::OpGroupCreate, groupId, -1 ); + createMenu( GEOMOp::OpGroupEdit, groupId, -1 ); + createMenu( separator(), newEntId, -1 ); int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 ); - createMenu( 9997, blocksId, -1 ); - createMenu( 9999, blocksId, -1 ); + createMenu( GEOMOp::OpQuadFace, blocksId, -1 ); + createMenu( GEOMOp::OpHexaSolid, blocksId, -1 ); + createMenu( GEOMOp::OpDividedDisk, blocksId, -1 ); + createMenu( GEOMOp::OpDividedCylinder, blocksId, -1 ); - createMenu( separator(), newEntId, -1 ); - createMenu( 404, newEntId, -1 ); - createMenu( 405, newEntId, -1 ); - createMenu( separator(), newEntId, -1 ); - createMenu( 407, newEntId, -1 ); + createMenu( separator(), newEntId, -1 ); + + createMenu( GEOMOp::OpExplode, newEntId, -1 ); int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 ); - createMenu( 4081, buildId, -1 ); - createMenu( 4082, buildId, -1 ); - createMenu( 4083, buildId, -1 ); - createMenu( 4084, buildId, -1 ); - createMenu( 4085, buildId, -1 ); - createMenu( 4086, buildId, -1 ); + createMenu( GEOMOp::OpEdge, buildId, -1 ); + createMenu( GEOMOp::OpWire, buildId, -1 ); + createMenu( GEOMOp::OpFace, buildId, -1 ); + createMenu( GEOMOp::OpShell, buildId, -1 ); + createMenu( GEOMOp::OpSolid, buildId, -1 ); + createMenu( GEOMOp::OpCompound, buildId, -1 ); + + createMenu( separator(), newEntId, -1 ); + + createMenu( GEOMOp::OpPictureImport, newEntId, -1 ); +#ifdef WITH_OPENCV + createMenu( GEOMOp::OpFeatureDetect, newEntId, -1 ); +#endif int operId = createMenu( tr( "MEN_OPERATIONS" ), -1, -1, 10 ); int boolId = createMenu( tr( "MEN_BOOLEAN" ), operId, -1 ); - createMenu( 5011, boolId, -1 ); - createMenu( 5012, boolId, -1 ); - createMenu( 5013, boolId, -1 ); - createMenu( 5014, boolId, -1 ); + createMenu( GEOMOp::OpFuse, boolId, -1 ); + createMenu( GEOMOp::OpCommon, boolId, -1 ); + createMenu( GEOMOp::OpCut, boolId, -1 ); + createMenu( GEOMOp::OpSection, boolId, -1 ); int transId = createMenu( tr( "MEN_TRANSFORMATION" ), operId, -1 ); - createMenu( 5021, transId, -1 ); - createMenu( 5022, transId, -1 ); - createMenu( 5023, transId, -1 ); - createMenu( 5024, transId, -1 ); - createMenu( 5025, transId, -1 ); - createMenu( 5026, transId, -1 ); - createMenu( separator(), transId, -1 ); - createMenu( 5027, transId, -1 ); - createMenu( 5028, transId, -1 ); - - createMenu( 503, operId, -1 ); - createMenu( 504, operId, -1 ); - createMenu( 508, operId, -1 ); - createMenu( separator(), operId, -1 ); - createMenu( 509, transId, -1 ); - createMenu( 505, transId, -1 ); - createMenu( 506, transId, -1 ); - //createMenu( 507, transId, -1 ); + createMenu( GEOMOp::OpTranslate, transId, -1 ); + createMenu( GEOMOp::OpRotate, transId, -1 ); + createMenu( GEOMOp::OpChangeLoc, transId, -1 ); + createMenu( GEOMOp::OpMirror, transId, -1 ); + createMenu( GEOMOp::OpScale, transId, -1 ); + createMenu( GEOMOp::OpOffset, transId, -1 ); + createMenu( GEOMOp::OpProjection, transId, -1 ); + createMenu( separator(), transId, -1 ); + createMenu( GEOMOp::OpMultiTranslate, transId, -1 ); + createMenu( GEOMOp::OpMultiRotate, transId, -1 ); int blockId = createMenu( tr( "MEN_BLOCKS" ), operId, -1 ); - createMenu( 9998, blockId, -1 ); - createMenu( 9995, blockId, -1 ); - createMenu( 99991, blockId, -1 ); + createMenu( GEOMOp::OpMultiTransform, blockId, -1 ); + createMenu( GEOMOp::OpExplodeBlock, blockId, -1 ); + createMenu( GEOMOp::OpPropagate, blockId, -1 ); + + createMenu( separator(), operId, -1 ); + + createMenu( GEOMOp::OpPartition, operId, -1 ); + createMenu( GEOMOp::OpArchimede, operId, -1 ); + createMenu( GEOMOp::OpShapesOnShape, operId, -1 ); + createMenu( GEOMOp::OpSharedShapes, operId, -1 ); + + createMenu( separator(), operId, -1 ); + + createMenu( GEOMOp::OpFillet1d, operId, -1 ); + createMenu( GEOMOp::OpFillet2d, operId, -1 ); + createMenu( GEOMOp::OpFillet3d, operId, -1 ); + createMenu( GEOMOp::OpChamfer, operId, -1 ); + createMenu( GEOMOp::OpExtrudedBoss, operId, -1 ); + createMenu( GEOMOp::OpExtrudedCut, operId, -1 ); + //createMenu( GEOMOp::OpClipping, operId, -1 ); int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 ); - createMenu( 605, repairId, -1 ); - createMenu( 603, repairId, -1 ); - createMenu( 606, repairId, -1 ); - createMenu( 607, repairId, -1 ); - createMenu( 604, repairId, -1 ); - createMenu( 601, repairId, -1 ); - createMenu( 602, repairId, -1 ); - createMenu( 608, repairId, -1 ); - //createMenu( 609, repairId, -1 ); - //createMenu( 610, repairId, -1 ); - createMenu( 611, repairId, -1 ); - createMenu( 612, repairId, -1 ); + createMenu( GEOMOp::OpShapeProcess, repairId, -1 ); + createMenu( GEOMOp::OpSuppressFaces, repairId, -1 ); + createMenu( GEOMOp::OpCloseContour, repairId, -1 ); + createMenu( GEOMOp::OpRemoveIntWires, repairId, -1 ); + createMenu( GEOMOp::OpSuppressHoles, repairId, -1 ); + createMenu( GEOMOp::OpSewing, repairId, -1 ); + createMenu( GEOMOp::OpGlueFaces, repairId, -1 ); + createMenu( GEOMOp::OpGlueEdges, repairId, -1 ); + createMenu( GEOMOp::OpLimitTolerance, repairId, -1 ); + createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 ); + //createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 ); + //createMenu( GEOMOp::OpFreeFaces, repairId, -1 ); + createMenu( GEOMOp::OpOrientation, repairId, -1 ); + createMenu( GEOMOp::OpRemoveExtraEdges, repairId, -1 ); + createMenu( GEOMOp::OpFuseEdges, repairId, -1 ); int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 ); - createMenu( 708, measurId, -1 ); - createMenu( 701, measurId, -1 ); - createMenu( separator(), measurId, -1 ); - createMenu( 702, measurId, -1 ); - createMenu( 703, measurId, -1 ); - createMenu( 704, measurId, -1 ); - // NPAL16572: move "Check free boundaries" and "Check free faces" from "Repair" to "Measure" - createMenu( separator(), measurId, -1 ); - createMenu( 609, measurId, -1 ); - createMenu( 610, measurId, -1 ); - // NPAL16572 END - createMenu( separator(), measurId, -1 ); + createMenu( GEOMOp::OpPointCoordinates, measurId, -1 ); + createMenu( GEOMOp::OpProperties, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + createMenu( GEOMOp::OpCenterMass, measurId, -1 ); + createMenu( GEOMOp::OpInertia, measurId, -1 ); + createMenu( GEOMOp::OpNormale, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + createMenu( GEOMOp::OpFreeBoundaries, measurId, -1 ); + createMenu( GEOMOp::OpFreeFaces, measurId, -1 ); + createMenu( separator(), measurId, -1 ); int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 ); - createMenu( 7041, dimId, -1 ); - createMenu( 7042, dimId, -1 ); - createMenu( 7043, dimId, -1 ); - createMenu( separator(), measurId, -1 ); - - createMenu( 705, measurId, -1 ); - createMenu( separator(), measurId, -1 ); - createMenu( 706, measurId, -1 ); - createMenu( 707, measurId, -1 ); - createMenu( 7072, measurId, -1 ); + createMenu( GEOMOp::OpBoundingBox, dimId, -1 ); + createMenu( GEOMOp::OpMinDistance, dimId, -1 ); + createMenu( GEOMOp::OpAngle, dimId, -1 ); + + createMenu( separator(), measurId, -1 ); + createMenu( GEOMOp::OpTolerance, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + createMenu( GEOMOp::OpWhatIs, measurId, -1 ); + createMenu( GEOMOp::OpCheckShape, measurId, -1 ); + createMenu( GEOMOp::OpCheckCompound, measurId, -1 ); + createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 ); #ifdef _DEBUG_ // PAL16821 int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 ); - createMenu( separator(), toolsId, -1 ); - createMenu( 5103, toolsId, -1 ); + createMenu( separator(), toolsId, -1 ); + createMenu( GEOMOp::OpCheckGeom, toolsId, -1 ); #endif - //int prefId = createMenu( tr( "MEN_PREFERENCES" ), -1, -1, 50 ); - //createMenu( separator(), prefId, -1 ); - //int geomId = createMenu( tr( "MEN_PREFERENCES_GEOM" ), prefId, -1 ); - //createMenu( 412, geomId, -1 ); - //createMenu( separator(), prefId, -1 ); int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 ); - createMenu( separator(), viewId, -1 ); + createMenu( separator(), viewId, -1 ); int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 ); - createMenu( 211, dispmodeId, -1 ); - - createMenu( separator(), viewId, -1 ); - createMenu( 212, viewId, -1 ); - createMenu( 214, viewId, -1 ); - createMenu( separator(), viewId, -1 ); + createMenu( GEOMOp::OpDMWireframe, dispmodeId, -1 ); + createMenu( GEOMOp::OpDMShading, dispmodeId, -1 ); + createMenu( GEOMOp::OpDMShadingWithEdges, dispmodeId, -1 ); + createMenu( separator(), dispmodeId, -1 ); + createMenu( GEOMOp::OpSwitchVectors, dispmodeId, -1 ); + + createMenu( separator(), viewId, -1 ); + createMenu( GEOMOp::OpShowAll, viewId, -1 ); + createMenu( GEOMOp::OpHideAll, viewId, -1 ); + createMenu( separator(), viewId, -1 ); + createMenu( GEOMOp::OpPublishObject, viewId, -1 ); + createMenu( separator(), viewId, -1 ); /* PAL9111: because of these items are accessible through object browser and viewers we have removed they from main menu - createMenu( 216, viewId, -1 ); - createMenu( 213, viewId, -1 ); - createMenu( 215, viewId, -1 ); + createMenu( GEOMOp::OpShow, viewId, -1 ); + createMenu( GEOMOp::OpShowOnly, viewId, -1 ); + createMenu( GEOMOp::OpHide, viewId, -1 ); */ // ---- create toolbars -------------------------- - + int basicTbId = createTool( tr( "TOOL_BASIC" ) ); - createTool( 4011, basicTbId ); - createTool( 4012, basicTbId ); - createTool( 4013, basicTbId ); - createTool( 4014, basicTbId ); - createTool( 4015, basicTbId ); - createTool( 4019, basicTbId ); - createTool( 4016, basicTbId ); - createTool( 4017, basicTbId ); - createTool( 4018, basicTbId ); - createTool( 4020, basicTbId ); - + createTool( GEOMOp::OpPoint, basicTbId ); + createTool( GEOMOp::OpLine, basicTbId ); + createTool( GEOMOp::OpCircle, basicTbId ); + createTool( GEOMOp::OpEllipse, basicTbId ); + createTool( GEOMOp::OpArc, basicTbId ); + createTool( GEOMOp::OpCurve, basicTbId ); + createTool( GEOMOp::OpVector, basicTbId ); + createTool( GEOMOp::Op2dSketcher, basicTbId ); //rnc + createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc + createTool( GEOMOp::OpPlane, basicTbId ); + createTool( GEOMOp::OpLCS, basicTbId ); + createTool( GEOMOp::OpOriginAndVectors, basicTbId ); + +// int sketchTbId = createTool( tr( "TOOL_SKETCH" ) ); +// createTool( GEOMOp::Op2dSketcher, sketchTbId ); +// createTool( GEOMOp::Op3dSketcher, sketchTbId ); + int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) ); - createTool( 4021, primTbId ); - createTool( 4022, primTbId ); - createTool( 4023, primTbId ); - createTool( 4024, primTbId ); - createTool( 4025, primTbId ); - createTool( 4026, primTbId ); - createTool( 4027, primTbId ); - + createTool( GEOMOp::OpBox, primTbId ); + createTool( GEOMOp::OpCylinder, primTbId ); + createTool( GEOMOp::OpSphere, primTbId ); + createTool( GEOMOp::OpTorus, primTbId ); + 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 ); + +// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); //rnc +// createTool( GEOMOp::OpPipeTShape, advancedTbId ); + int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) ); - createTool( 5011, boolTbId ); - createTool( 5012, boolTbId ); - createTool( 5013, boolTbId ); - createTool( 5014, boolTbId ); - - int genTbId = createTool( tr( "TOOL_GENERATION" ) ); - createTool( 4031, genTbId ); - createTool( 4032, genTbId ); - createTool( 4033, genTbId ); - createTool( 4034, genTbId ); - + createTool( GEOMOp::OpFuse, boolTbId ); + createTool( GEOMOp::OpCommon, boolTbId ); + createTool( GEOMOp::OpCut, boolTbId ); + createTool( GEOMOp::OpSection, boolTbId ); + + int genTbId = createTool( tr( "TOOL_GENERATION" ) ); + createTool( GEOMOp::OpPrism, genTbId ); + createTool( GEOMOp::OpRevolution, genTbId ); + createTool( GEOMOp::OpFilling, genTbId ); + createTool( GEOMOp::OpPipe, genTbId ); + int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) ); - createTool( 5021, transTbId ); - createTool( 5022, transTbId ); - createTool( 5023, transTbId ); - createTool( 5024, transTbId ); - createTool( 5025, transTbId ); - createTool( 5026, transTbId ); - createTool( separator(), transTbId ); - createTool( 5027, transTbId ); - createTool( 5028, transTbId ); + createTool( GEOMOp::OpTranslate, transTbId ); + createTool( GEOMOp::OpRotate, transTbId ); + createTool( GEOMOp::OpChangeLoc, transTbId ); + createTool( GEOMOp::OpMirror, transTbId ); + createTool( GEOMOp::OpScale, transTbId ); + createTool( GEOMOp::OpOffset, transTbId ); + createTool( GEOMOp::OpProjection, transTbId ); + createTool( separator(), transTbId ); + createTool( GEOMOp::OpMultiTranslate, transTbId ); + createTool( GEOMOp::OpMultiRotate, transTbId ); + + int operTbId = createTool( tr( "TOOL_OPERATIONS" ) ); + createTool( GEOMOp::OpExplode, operTbId ); + createTool( GEOMOp::OpPartition, operTbId ); + createTool( GEOMOp::OpArchimede, operTbId ); + createTool( GEOMOp::OpShapesOnShape, operTbId ); + createTool( GEOMOp::OpSharedShapes, operTbId ); + + int featTbId = createTool( tr( "TOOL_FEATURES" ) ); + createTool( GEOMOp::OpFillet1d, featTbId ); + createTool( GEOMOp::OpFillet2d, featTbId ); + createTool( GEOMOp::OpFillet3d, featTbId ); + createTool( GEOMOp::OpChamfer, featTbId ); + createTool( GEOMOp::OpExtrudedBoss, featTbId ); + createTool( GEOMOp::OpExtrudedCut, featTbId ); + + int buildTbId = createTool( tr( "TOOL_BUILD" ) ); + createTool( GEOMOp::OpEdge, buildTbId ); + createTool( GEOMOp::OpWire, buildTbId ); + createTool( GEOMOp::OpFace, buildTbId ); + createTool( GEOMOp::OpShell, buildTbId ); + createTool( GEOMOp::OpSolid, buildTbId ); + createTool( GEOMOp::OpCompound, buildTbId ); + + int measureTbId = createTool( tr( "TOOL_MEASURES" ) ); + createTool( GEOMOp::OpPointCoordinates, measureTbId ); + createTool( GEOMOp::OpProperties, measureTbId ); + createTool( GEOMOp::OpCenterMass, measureTbId ); + createTool( GEOMOp::OpInertia, measureTbId ); + createTool( GEOMOp::OpNormale, measureTbId ); + createTool( separator(), measureTbId ); + createTool( GEOMOp::OpBoundingBox, measureTbId ); + createTool( GEOMOp::OpMinDistance, measureTbId ); + createTool( GEOMOp::OpAngle, measureTbId ); + createTool( GEOMOp::OpTolerance , measureTbId ); + createTool( separator(), measureTbId ); + createTool( GEOMOp::OpFreeBoundaries, measureTbId ); + createTool( GEOMOp::OpFreeFaces, measureTbId ); + createTool( separator(), measureTbId ); + createTool( GEOMOp::OpWhatIs, measureTbId ); + createTool( GEOMOp::OpCheckShape, measureTbId ); + createTool( GEOMOp::OpCheckCompound, measureTbId ); + createTool( GEOMOp::OpCheckSelfInters, measureTbId ); + + int picturesTbId = createTool( tr( "TOOL_PICTURES" ) ); + createTool( GEOMOp::OpPictureImport, picturesTbId ); + #ifdef WITH_OPENCV + createTool( GEOMOp::OpFeatureDetect, picturesTbId ); + #endif + +// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); + + //@@ 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 -------------------------- QString clientOCCorVTK = "(client='OCCViewer' or client='VTKViewer')"; + QString clientOCC = "(client='OCCViewer')"; QString clientOCCorVTK_AndSomeVisible = clientOCCorVTK + " and selcount>0 and isVisible"; + QString clientOCC_AndSomeVisible = clientOCC + " and selcount>0 and isVisible"; + QString clientOCCorOB = "(client='ObjectBrowser' or client='OCCViewer')"; QString clientOCCorVTKorOB = "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer')"; QString clientOCCorVTKorOB_AndSomeVisible = clientOCCorVTKorOB + " and selcount>0 and isVisible"; + QString clientOCCorOB_AndSomeVisible = clientOCCorOB + " and selcount>0 and isVisible"; QString autoColorPrefix = "(client='ObjectBrowser' or client='OCCViewer') and type='Shape' and selcount=1 and isOCC=true"; QtxPopupMgr* mgr = popupMgr(); - mgr->insert( action( 901 ), -1, -1 ); // rename - mgr->setRule( action( 901 ), QString("$type in {'Shape' 'Group'} and selcount=1"), QtxPopupMgr::VisibleRule ); - mgr->insert( action( 33 ), -1, -1 ); // delete - mgr->setRule( action( 33 ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule ); - mgr->insert( action( 8001 ), -1, -1 ); // create group - mgr->setRule( action( 8001 ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule ); - mgr->insert( action( 801 ), -1, -1 ); // edit group - mgr->setRule( action( 801 ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule ); + + mgr->insert( action( GEOMOp::OpDelete ), -1, -1 ); // delete + mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpGroupCreatePopup ), -1, -1 ); // create group + mgr->setRule( action( GEOMOp::OpGroupCreatePopup ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpShowChildren ), -1, -1 ); // show children + mgr->setRule( action( GEOMOp::OpShowChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasHiddenChildren=true"), QtxPopupMgr::VisibleRule ); + + mgr->insert( action( GEOMOp::OpHideChildren ), -1, -1 ); // hide children + mgr->setRule( action( GEOMOp::OpHideChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasShownChildren=true"), QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpGroupEdit ), -1, -1 ); // edit group + mgr->setRule( action( GEOMOp::OpGroupEdit ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule ); + mgr->insert( separator(), -1, -1 ); // ----------- + +#if OCC_VERSION_LARGE > 0x06050200 + //QString bringRule = clientOCCorOB + " and ($component={'GEOM'}) and (selcount>0) and isOCC=true and topLevel=false"; + QString bringRule = clientOCCorOB + " and ($component={'GEOM'}) and (selcount>0) and isOCC=true"; + mgr->insert( action(GEOMOp::OpBringToFront ), -1, -1 ); // bring to front + mgr->setRule(action(GEOMOp::OpBringToFront), bringRule, QtxPopupMgr::VisibleRule ); + mgr->setRule(action(GEOMOp::OpBringToFront), "topLevel=true", QtxPopupMgr::ToggleRule ); + mgr->insert( action(GEOMOp::OpClsBringToFront ), -1, -1 ); // clear bring to front + mgr->setRule( action(GEOMOp::OpClsBringToFront ), clientOCC, QtxPopupMgr::VisibleRule ); +#endif mgr->insert( separator(), -1, -1 ); // ----------- dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu - mgr->insert( action( 80311 ), dispmodeId, -1 ); // wireframe - mgr->setRule( action( 80311 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); - mgr->setRule( action( 80311 ), clientOCCorVTK + " and displaymode='Wireframe'", QtxPopupMgr::ToggleRule ); - mgr->insert( action( 80312 ), dispmodeId, -1 ); // shading - mgr->setRule( action( 80312 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); - mgr->setRule( action( 80312 ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule ); + mgr->insert( action( GEOMOp::OpWireframe ), dispmodeId, -1 ); // wireframe + mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK + " and displaymode='Wireframe'", QtxPopupMgr::ToggleRule ); + mgr->insert( action( GEOMOp::OpShading ), dispmodeId, -1 ); // shading + mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule ); + mgr->insert( action( GEOMOp::OpShadingWithEdges ), dispmodeId, -1 ); // shading with edges + mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK + " and displaymode='ShadingWithEdges'", QtxPopupMgr::ToggleRule ); + mgr->insert( action( GEOMOp::OpTexture ), dispmodeId, -1 ); // wireframe + mgr->setRule( action( GEOMOp::OpTexture ), clientOCC_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpTexture), clientOCC + " and displaymode='Texture'", QtxPopupMgr::ToggleRule ); + mgr->insert( separator(), dispmodeId, -1 ); + mgr->insert( action( GEOMOp::OpVectors ), dispmodeId, -1 ); // vectors + mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule ); mgr->insert( separator(), -1, -1 ); // ----------- - mgr->insert( action( 8032 ), -1, -1 ); // color - mgr->setRule( action( 8032 ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); - mgr->insert( action( 8033 ), -1, -1 ); // transparency - mgr->setRule( action( 8033 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); - mgr->insert( action( 8034 ), -1, -1 ); // isos - mgr->setRule( action( 8034 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule ); + 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 + mgr->setRule( action( GEOMOp::OpTransparency ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpIsos ), -1, -1 ); // isos + mgr->setRule( action( GEOMOp::OpIsos ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpDeflection ), -1, -1 ); // deflection + mgr->setRule( action( GEOMOp::OpDeflection ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule ); + 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 ); + mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 ); // material properties + mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'}) and selcount>0 and isVisible", QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 ); // texture + mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule ); + + int lineW = mgr->insert( tr( "MEN_LINE_WIDTH" ), -1, -1 ); // line width menu + mgr->insert( action( GEOMOp::OpEdgeWidth ), lineW, -1 ); // edge width + mgr->setRule( action( GEOMOp::OpEdgeWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + + mgr->insert( action( GEOMOp::OpIsosWidth ), lineW, -1 ); // isos width + mgr->setRule( action( GEOMOp::OpIsosWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->insert( separator(), -1, -1 ); // ----------- - mgr->insert( action( 8035 ), -1, -1 ); // auto color - mgr->setRule( action( 8035 ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule ); - mgr->insert( action( 8036 ), -1, -1 ); // disable auto color - mgr->setRule( action( 8036 ), autoColorPrefix + " and isAutoColor=true", QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color + mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpNoAutoColor ), -1, -1 ); // disable auto color + mgr->setRule( action( GEOMOp::OpNoAutoColor ), autoColorPrefix + " and isAutoColor=true", QtxPopupMgr::VisibleRule ); mgr->insert( separator(), -1, -1 ); // ----------- - QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ", onlyComponent = "((type='Component') and selcount=1)", rule = canDisplay + "and ((($type in {%1}) and( %2 )) or " + onlyComponent + ")", types = "'Shape' 'Group'"; - mgr->insert( action( 216 ), -1, -1 ); // display - mgr->setRule( action( 216 ), rule.arg( types ).arg( "not isVisible" ), QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpShow ), -1, -1 ); // display + mgr->setRule( action( GEOMOp::OpShow ), rule.arg( types ).arg( "not isVisible" ), QtxPopupMgr::VisibleRule ); - mgr->insert( action( 215 ), -1, -1 ); // erase - mgr->setRule( action( 215 ), rule.arg( types ).arg( "isVisible" ), QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpHide ), -1, -1 ); // erase + mgr->setRule( action( GEOMOp::OpHide ), rule.arg( types ).arg( "isVisible" ), QtxPopupMgr::VisibleRule ); - mgr->insert( action( 214 ), -1, -1 ); // erase All - mgr->setRule( action( 214 ), clientOCCorVTK, QtxPopupMgr::VisibleRule ); + mgr->insert( action( GEOMOp::OpHideAll ), -1, -1 ); // erase All + mgr->setRule( action( GEOMOp::OpHideAll ), clientOCCorVTK, QtxPopupMgr::VisibleRule ); QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)"; - int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu - mgr->insert( action(2171), selectolnyId, -1); //Vertex - mgr->setRule(action(2171), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2171), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule); - mgr->insert( action(2172), selectolnyId, -1); //Edge - mgr->setRule(action(2172), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2172), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule); - mgr->insert( action(2173), selectolnyId, -1); //Wire - mgr->setRule(action(2173), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2173), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule); - mgr->insert( action(2174), selectolnyId, -1); //Face - mgr->setRule(action(2174), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2174), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule); - mgr->insert( action(2175), selectolnyId, -1); //Shell - mgr->setRule(action(2175), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2175), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule); - mgr->insert( action(2176), selectolnyId, -1); //Solid - mgr->setRule(action(2176), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2176), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule); - mgr->insert( action(2177), selectolnyId, -1); //Compound - mgr->setRule(action(2177), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2177), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule); - mgr->insert( separator(), selectolnyId, -1); - mgr->insert( action(2178), selectolnyId, -1); //Clear selection filter - mgr->setRule(action(2178), selectOnly, QtxPopupMgr::VisibleRule); - mgr->setRule(action(2178), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule); - mgr->insert( action( 213 ), -1, -1 ); // display only - mgr->setRule( action( 213 ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule ); - mgr->insert( separator(), -1, -1 ); + int selectonlyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu + mgr->insert( action(GEOMOp::OpSelectVertex), selectonlyId, -1); //Vertex + mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule); + mgr->insert( action(GEOMOp::OpSelectEdge), selectonlyId, -1); //Edge + mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule); + mgr->insert( action(GEOMOp::OpSelectWire), selectonlyId, -1); //Wire + mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule); + mgr->insert( action(GEOMOp::OpSelectFace), selectonlyId, -1); //Face + mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule); + mgr->insert( action(GEOMOp::OpSelectShell), selectonlyId, -1); //Shell + mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule); + mgr->insert( action(GEOMOp::OpSelectSolid), selectonlyId, -1); //Solid + mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule); + mgr->insert( action(GEOMOp::OpSelectCompound), selectonlyId, -1); //Compound + mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule); + mgr->insert( separator(), selectonlyId, -1); + mgr->insert( action(GEOMOp::OpSelectAll), selectonlyId, -1); //Clear selection filter + mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly, QtxPopupMgr::VisibleRule); + mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule); + mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only + mgr->setRule(action(GEOMOp::OpShowOnly ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule ); + + mgr->insert( separator(), -1, -1 ); // ----------- + mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object + mgr->setRule( action( GEOMOp::OpUnpublishObject ), QString("client='ObjectBrowser' and $type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule ); + + + mgr->insert( action( GEOMOp::OpPublishObject ), -1, -1 ); // Publish object + mgr->setRule( action( GEOMOp::OpPublishObject ), QString("client='ObjectBrowser' and isComponent=true"), QtxPopupMgr::VisibleRule ); + + mgr->insert( action( GEOMOp::OpReimport ), -1, -1 ); // delete + mgr->setRule( action( GEOMOp::OpReimport ), QString("$imported in {'true'} and selcount>0"), QtxPopupMgr::VisibleRule ); mgr->hide( mgr->actionId( action( myEraseAll ) ) ); + + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if(resMgr) { + GEOM_AISShape::setTopLevelDisplayMode((GEOM_AISShape::TopLevelDispMode)resMgr->integerValue("Geometry", "toplevel_dm", 0)); + QColor c = resMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) ); + GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c)); + } } //======================================================================= @@ -1225,20 +1376,31 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) if ( !res ) return false; - setMenuShown( true ); setToolShown( true ); + // import Python module that manages GEOM plugins (need to be here because SalomePyQt API uses active module) + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager"); + if(pluginsmanager==NULL) + PyErr_Print(); + else + { + PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"geom",tr("MEN_NEW_ENTITY").toStdString().c_str(),tr("GEOM_PLUGINS_OTHER").toStdString().c_str()); + if(result==NULL) + PyErr_Print(); + Py_XDECREF(result); + } + PyGILState_Release(gstate); + // end of GEOM plugins loading + connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), - this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); // Reset actions accelerator keys - //action(111)->setAccel(QKeySequence(CTRL + Key_I)); // Import - //action(121)->setAccel(QKeySequence(CTRL + Key_E)); // Export - action(111)->setEnabled( true ); // Import: CTRL + Key_I - action(121)->setEnabled( true ); // Export: CTRL + Key_E - action( 33)->setEnabled( true ); // Delete: Key_Delete - action(901)->setEnabled( true ); // Rename: Key_F2 + action(GEOMOp::OpImport)->setEnabled( true ); // Import: CTRL + Key_I + action(GEOMOp::OpExport)->setEnabled( true ); // Export: CTRL + Key_E + action(GEOMOp::OpDelete)->setEnabled( true ); // Delete: Key_Delete GUIMap::Iterator it; for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) @@ -1263,7 +1425,7 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) SALOME_ListIO selected; sm->selectedObjects( selected ); sm->clearSelected(); - + // disable OCC selectors getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); QListIterator itOCCSel( myOCCSelectors ); @@ -1280,6 +1442,24 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) sm->setSelectedObjects( selected, true ); //NPAL 19674 + QMenu* viewMenu = menuMgr()->findMenu( STD_Application::MenuViewId ); + if ( viewMenu ) + connect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) ); + + // 0020836 (Basic vectors and origin) + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + if( aResourceMgr->booleanValue( "Geometry", "auto_create_base_objects", false ) ) { + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + if( appStudy ) { + _PTR(Study) studyDS = appStudy->studyDS(); + if( studyDS ) { + _PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM"); + if( !aSComponent ) // create objects automatically only if there is no GEOM component + createOriginAndBaseVectors(); + } + } + } + return true; } @@ -1290,11 +1470,15 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) //======================================================================= bool GeometryGUI::deactivateModule( SUIT_Study* study ) { + QMenu* viewMenu = menuMgr()->findMenu( STD_Application::MenuViewId ); + if ( viewMenu ) + disconnect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) ); + setMenuShown( false ); setToolShown( false ); disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), - this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); EmitSignalCloseAllDialogs(); @@ -1303,12 +1487,9 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study ) it.value()->deactivate(); // Unset actions accelerator keys - //action(111)->setAccel(QKeySequence()); // Import - //action(121)->setAccel(QKeySequence()); // Export - action(111)->setEnabled( false ); // Import: CTRL + Key_I - action(121)->setEnabled( false ); // Export: CTRL + Key_E - action( 33)->setEnabled( false ); // Delete: Key_Delete - action(901)->setEnabled( false ); // Rename: Key_F2 + action(GEOMOp::OpImport)->setEnabled( false ); // Import: CTRL + Key_I + action(GEOMOp::OpExport)->setEnabled( false ); // Export: CTRL + Key_E + action(GEOMOp::OpDelete)->setEnabled( false ); // Delete: Key_Delete qDeleteAll(myOCCSelectors); myOCCSelectors.clear(); @@ -1321,15 +1502,6 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study ) return SalomeApp_Module::deactivateModule( study ); } -//======================================================================= -// function : GeometryGUI::BuildPresentation() -// purpose : -//======================================================================= -void GeometryGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& io, SUIT_ViewWindow* win ) -{ - //GEOM_Displayer().Display( io, false, win ); -} - //======================================================================= // function : onWindowActivated() // purpose : update menu items' status - disable non-OCC-viewer-compatible actions @@ -1343,18 +1515,18 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) //const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() ); // disable non-OCC viewframe menu commands -// action( 404 )->setEnabled( ViewOCC ); // SKETCHER - action( 603 )->setEnabled( ViewOCC ); // SuppressFace - action( 604 )->setEnabled( ViewOCC ); // SuppressHole - action( 606 )->setEnabled( ViewOCC ); // CloseContour - action( 607 )->setEnabled( ViewOCC ); // RemoveInternalWires - action( 608 )->setEnabled( ViewOCC ); // AddPointOnEdge -// action( 609 )->setEnabled( ViewOCC ); // Free boundaries - - action( 800 )->setEnabled( ViewOCC ); // Create Group - action( 801 )->setEnabled( ViewOCC ); // Edit Group - - action( 9998 )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION +// action( GEOMOp::Op2dSketcher )->setEnabled( ViewOCC ); // SKETCHER + action( GEOMOp::OpSuppressFaces )->setEnabled( ViewOCC ); // SuppressFace + action( GEOMOp::OpSuppressHoles )->setEnabled( ViewOCC ); // SuppressHole + action( GEOMOp::OpCloseContour )->setEnabled( ViewOCC ); // CloseContour + action( GEOMOp::OpRemoveIntWires )->setEnabled( ViewOCC ); // RemoveInternalWires + action( GEOMOp::OpAddPointOnEdge )->setEnabled( ViewOCC ); // AddPointOnEdge +// action( GEOMOp::OpFreeBoundaries )->setEnabled( ViewOCC ); // Free boundaries + + action( GEOMOp::OpGroupCreate )->setEnabled( ViewOCC ); // Create Group + action( GEOMOp::OpGroupEdit )->setEnabled( ViewOCC ); // Edit Group + + action( GEOMOp::OpMultiTransform )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION } void GeometryGUI::windows( QMap& mappa ) const @@ -1370,17 +1542,18 @@ void GeometryGUI::viewManagers( QStringList& lst ) const void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) { - if ( vm->getType() == OCCViewer_Viewer::Type() ) + if ( vm && vm->getType() == OCCViewer_Viewer::Type() ) { qDebug( "connect" ); connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ), - this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) ); + this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) ); connect( vm, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ), - this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) ); + this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) ); connect( vm, SIGNAL( mouseMove ( SUIT_ViewWindow*, QMouseEvent* ) ), - this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); - - + this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); + connect( vm, SIGNAL( mouseRelease ( SUIT_ViewWindow*, QMouseEvent* ) ), + this, SLOT( OnMouseRelease( SUIT_ViewWindow*, QMouseEvent* ) ) ); + LightApp_SelectionMgr* sm = getApp()->selectionMgr(); myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); @@ -1389,7 +1562,7 @@ void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) QListIterator itOCCSel( myOCCSelectors ); while ( itOCCSel.hasNext() ) if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ) - sr->setEnabled(true); + sr->setEnabled(true); } else if ( vm->getType() == SVTK_Viewer::Type() ) { @@ -1401,7 +1574,7 @@ void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) QListIterator itVTKSel( myVTKSelectors ); while ( itVTKSel.hasNext() ) if ( LightApp_VTKSelector* sr = itVTKSel.next() ) - sr->setEnabled(true); + sr->setEnabled(true); } } @@ -1413,22 +1586,22 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm ) QListIterator itOCCSel( myOCCSelectors ); while ( itOCCSel.hasNext() ) if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ) - if ( sr->viewer() == viewer ) - { - delete myOCCSelectors.takeAt( myOCCSelectors.indexOf( sr ) ); - break; - } + if ( sr->viewer() == viewer ) + { + delete myOCCSelectors.takeAt( myOCCSelectors.indexOf( sr ) ); + break; + } } if ( vm->getType() == SVTK_Viewer::Type() ) { QListIterator itVTKSel( myVTKSelectors ); while ( itVTKSel.hasNext() ) if ( LightApp_VTKSelector* sr = itVTKSel.next() ) - if ( sr->viewer() == viewer ) - { - delete myVTKSelectors.takeAt( myVTKSelectors.indexOf( sr ) ); - break; - } + if ( sr->viewer() == viewer ) + { + delete myVTKSelectors.takeAt( myVTKSelectors.indexOf( sr ) ); + break; + } } } @@ -1439,6 +1612,49 @@ QString GeometryGUI::engineIOR() const return ""; } +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +Handle(TColStd_HArray1OfByte) GeometryGUI::getTexture +#else +Handle(Graphic3d_HArray1OfBytes) GeometryGUI::getTexture +#endif + (SalomeApp_Study* theStudy, int theId, int& theWidth, int& theHeight) +{ + theWidth = theHeight = 0; + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture; +#else + Handle(Graphic3d_HArray1OfBytes) aTexture; +#endif + + if (theStudy) { + TextureMap aTextureMap = myTextureMap[ theStudy->studyDS()->StudyId() ]; + aTexture = aTextureMap[ theId ]; + if ( aTexture.IsNull() ) { + GEOM::GEOM_IInsertOperations_var aInsOp = GeometryGUI::GetGeomGen()->GetIInsertOperations( theStudy->studyDS()->StudyId() ); + if ( !aInsOp->_is_nil() ) { + CORBA::Long aWidth, aHeight; + SALOMEDS::TMPFile_var aStream = aInsOp->GetTexture( theId, aWidth, aHeight ); + if ( aWidth > 0 && aHeight > 0 && aStream->length() > 0 ) { + theWidth = aWidth; + theHeight = aHeight; + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + aTexture = new TColStd_HArray1OfByte (1, aStream->length()); +#else + aTexture = new Graphic3d_HArray1OfBytes (1, aStream->length()); +#endif + + for (int i = 0; i < aStream->length(); i++) + aTexture->SetValue( i+1, (Standard_Byte)aStream[i] ); + aTextureMap[ theId ] = aTexture; + } + } + } + } + return aTexture; +} + LightApp_Selection* GeometryGUI::createSelection() const { return new GEOMGUI_Selection(); @@ -1446,8 +1662,9 @@ LightApp_Selection* GeometryGUI::createSelection() const void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title ) { - SalomeApp_Module::contextMenuPopup(client, menu, title); + SalomeApp_Module::contextMenuPopup( client, menu, title ); + /* SALOME_ListIO lst; getApp()->selectionMgr()->selectedObjects(lst); if (lst.Extent() < 1) @@ -1472,12 +1689,15 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObj); if (CORBA::is_nil(aGeomObj) || aGeomObj->GetType() != GEOM_IMPORT) isImported = false; + } else { + isImported = false; } } if (isImported) { - menu->addAction(action(5029)); // Reload imported shape + menu->addAction(action(GEOMOp::OpReimport)); // Reload imported shape } + */ } void GeometryGUI::createPreferences() @@ -1488,29 +1708,97 @@ void GeometryGUI::createPreferences() setPreferenceProperty( genGroup, "columns", 2 ); int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup, - LightApp_Preferences::Selector, - "Geometry", "display_mode" ); + LightApp_Preferences::Selector, + "Geometry", "display_mode" ); addPreference( tr( "PREF_SHADING_COLOR" ), genGroup, - LightApp_Preferences::Color, "Geometry", "shading_color" ); + LightApp_Preferences::Color, "Geometry", "shading_color" ); + + addPreference( tr( "PREF_EDGES_IN_SHADING" ), genGroup, + LightApp_Preferences::Color, "Geometry", "edges_in_shading_color" ); addPreference( tr( "PREF_WIREFRAME_COLOR" ), genGroup, - LightApp_Preferences::Color, "Geometry", "wireframe_color" ); + LightApp_Preferences::Color, "Geometry", "wireframe_color" ); addPreference( tr( "PREF_FREE_BOUND_COLOR" ), genGroup, - LightApp_Preferences::Color, "Geometry", "free_bound_color" ); + LightApp_Preferences::Color, "Geometry", "free_bound_color" ); addPreference( tr( "PREF_LINE_COLOR"), genGroup, - LightApp_Preferences::Color, "Geometry", "line_color" ); + LightApp_Preferences::Color, "Geometry", "line_color" ); addPreference( tr( "PREF_POINT_COLOR"), genGroup, - LightApp_Preferences::Color, "Geometry", "point_color" ); + LightApp_Preferences::Color, "Geometry", "point_color" ); addPreference( tr( "PREF_ISOS_COLOR" ), genGroup, - LightApp_Preferences::Color, "Geometry", "isos_color" ); + LightApp_Preferences::Color, "Geometry", "isos_color" ); + + addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup, + LightApp_Preferences::Color, "Geometry", "toplevel_color" ); + + int top_lev_dm = addPreference( tr( "PREF_TOPLEVEL_DM" ), genGroup, + LightApp_Preferences::Selector, "Geometry", "toplevel_dm" ); int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, - LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); + LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); + + int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup, + LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" ); + + int material = addPreference( tr( "PREF_MATERIAL" ), genGroup, + LightApp_Preferences::Selector, + "Geometry", "material" ); + + const int nb = 4; + int wd[nb]; + int iter=0; + + wd[iter++] = addPreference( tr( "PREF_EDGE_WIDTH" ), genGroup, + LightApp_Preferences::IntSpin, "Geometry", "edge_width" ); + + wd[iter++] = addPreference( tr( "PREF_ISOLINES_WIDTH" ), genGroup, + LightApp_Preferences::IntSpin, "Geometry", "isolines_width" ); + + wd[iter++] = addPreference( tr( "PREF_PREVIEW_EDGE_WIDTH" ), genGroup, + LightApp_Preferences::IntSpin, "Geometry", "preview_edge_width" ); + + wd[iter++] = addPreference( tr( "PREF_MEASURES_LINE_WIDTH" ), genGroup, + LightApp_Preferences::IntSpin, "Geometry", "measures_line_width" ); + + for(int i = 0; i < nb; i++) { + setPreferenceProperty( wd[i], "min", 1 ); + setPreferenceProperty( wd[i], "max", 5 ); + } + + + // Quantities with individual precision settings + int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId ); + setPreferenceProperty( precGroup, "columns", 2 ); + + const int nbQuantities = 8; + int prec[nbQuantities], ii = 0; + prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "length_precision" ); + prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "angle_precision" ); + prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" ); + prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" ); + prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "weight_precision" ); + prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "density_precision" ); + prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" ); + prec[ii ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup, + LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" ); + + // Set property for precision value for spinboxes + for ( ii = 0; ii < nbQuantities; ii++ ){ + setPreferenceProperty( prec[ii], "min", -14 ); + setPreferenceProperty( prec[ii], "max", 14 ); + setPreferenceProperty( prec[ii], "precision", 2 ); + } int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId ); setPreferenceProperty( VertexGroup, "columns", 2 ); @@ -1519,66 +1807,100 @@ void GeometryGUI::createPreferences() LightApp_Preferences::Selector, "Geometry", "type_of_marker" ); int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), VertexGroup, - LightApp_Preferences::DblSpin, "Geometry", "marker_scale" ); + LightApp_Preferences::Selector, "Geometry", "marker_scale" ); // Set property for default display mode QStringList aModesList; aModesList.append( tr("MEN_WIREFRAME") ); aModesList.append( tr("MEN_SHADING") ); + aModesList.append( tr("MEN_SHADING_WITH_EDGES") ); QList anIndexesList; anIndexesList.append(0); anIndexesList.append(1); + anIndexesList.append(2); setPreferenceProperty( dispmode, "strings", aModesList ); setPreferenceProperty( dispmode, "indexes", anIndexesList ); + + // Set property for top level display mode + QStringList aTopModesList; + aTopModesList.append( tr("MEN_SHOW_ADD_WACTOR") ); + aTopModesList.append( tr("MEN_KEEP_CURRENT_DM") ); + aTopModesList.append( tr("MEN_WIREFRAME") ); + aTopModesList.append( tr("MEN_SHADING") ); + aTopModesList.append( tr("MEN_SHADING_WITH_EDGES") ); + + QList aTopIndexesList; + aTopIndexesList.append(0); + aTopIndexesList.append(1); + aTopIndexesList.append(2); + aTopIndexesList.append(3); + aTopIndexesList.append(4); + + setPreferenceProperty( top_lev_dm, "strings", aTopModesList ); + setPreferenceProperty( top_lev_dm, "indexes", aTopIndexesList ); + // Set property for step value for spinboxes setPreferenceProperty( step, "min", 1 ); setPreferenceProperty( step, "max", 10000 ); setPreferenceProperty( step, "precision", 3 ); - // Set property for type of vertex marker - QStringList aTypeOfMarkerList; - QList anTypeOfMarkerIndexesList; + // Set property for deflection value for spinboxes + setPreferenceProperty( defl, "min", DEFLECTION_MIN ); + setPreferenceProperty( defl, "max", 1.0 ); + setPreferenceProperty( defl, "step", 1.0e-04 ); + setPreferenceProperty( defl, "precision", 6 ); - aTypeOfMarkerList.append( tr("TOM_PLUS") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_PLUS); + // Set property for default material + Material_ResourceMgr aMatResMgr; + setPreferenceProperty( material, "strings", aMatResMgr.materials() ); - aTypeOfMarkerList.append( tr("TOM_POINT") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_POINT); + // Set property vertex marker type + QList aMarkerTypeIndicesList; + QList aMarkerTypeIconsList; - aTypeOfMarkerList.append( tr("TOM_STAR") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_STAR); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) { + QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i ); + QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) ); + aMarkerTypeIndicesList << (i-1); + aMarkerTypeIconsList << pixmap; + } - aTypeOfMarkerList.append( tr("TOM_O") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_O); + setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList ); + setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList ); - aTypeOfMarkerList.append( tr("TOM_X") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_X); + // Set property for vertex marker scale + QList aMarkerScaleIndicesList; + QStringList aMarkerScaleValuesList; - aTypeOfMarkerList.append( tr("TOM_O_POINT") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_O_POINT); + for ( int iii = GEOM::MS_10; iii <= GEOM::MS_70; iii++ ) { + aMarkerScaleIndicesList << iii; + aMarkerScaleValuesList << QString::number( (iii-(int)GEOM::MS_10)*0.5 + 1.0 ); + } - aTypeOfMarkerList.append( tr("TOM_O_PLUS") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_O_PLUS); + setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList ); + setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList ); - aTypeOfMarkerList.append( tr("TOM_O_STAR") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_O_STAR); + int originGroup = addPreference( tr( "PREF_GROUP_ORIGIN_AND_BASE_VECTORS" ), tabId ); + setPreferenceProperty( originGroup, "columns", 2 ); - aTypeOfMarkerList.append( tr("TOM_O_X") ); - anTypeOfMarkerIndexesList.append(Aspect_TOM_O_X); + int baseVectorsLength = addPreference( tr( "PREF_BASE_VECTORS_LENGTH" ), originGroup, + LightApp_Preferences::DblSpin, "Geometry", "base_vectors_length" ); + setPreferenceProperty( baseVectorsLength, "min", 0.01 ); + setPreferenceProperty( baseVectorsLength, "max", 1000 ); + addPreference( tr( "PREF_AUTO_CREATE" ), originGroup, + LightApp_Preferences::Bool, "Geometry", "auto_create_base_objects" ); - setPreferenceProperty( typeOfMarker, "strings", aTypeOfMarkerList ); - setPreferenceProperty( typeOfMarker, "indexes", anTypeOfMarkerIndexesList ); - // Set property for Vertex Marker scale - setPreferenceProperty( markerScale, "min", 1. ); - setPreferenceProperty( markerScale, "max", 7. ); - setPreferenceProperty( markerScale, "precision", 0.01 ); - setPreferenceProperty( markerScale, "step", 0.5 ); + int operationsGroup = addPreference( tr( "PREF_GROUP_OPERATIONS" ), tabId ); + setPreferenceProperty( operationsGroup, "columns", 2 ); + addPreference( tr( "GEOM_PREVIEW" ), operationsGroup, + LightApp_Preferences::Bool, "Geometry", "geom_preview" ); } void GeometryGUI::preferencesChanged( const QString& section, const QString& param ) @@ -1588,8 +1910,13 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par if (param == QString("SettingsGeomStep")) { double spin_step = aResourceMgr->doubleValue(section, param, 100.); EmitSignalDefaultStepValueChanged(spin_step); + } else if(param == QString("toplevel_color")) { + QColor c = aResourceMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) ); + GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c)); + } else if(param == QString("toplevel_dm")) { + GEOM_AISShape::setTopLevelDisplayMode((GEOM_AISShape::TopLevelDispMode)aResourceMgr->integerValue("Geometry", "toplevel_dm", 0)); } - } + } } LightApp_Displayer* GeometryGUI::displayer() @@ -1615,12 +1942,12 @@ const char gDigitsSep = ':'; // character used to separate numeric parameter val * \brief Store visual parameters * * This method is called just before the study document is saved. - * Store visual parameters in AttributeParameter attribue(s) + * Store visual parameters in AttributeParameter attribute(s) */ void GeometryGUI::storeVisualParameters (int savePoint) { SalomeApp_Study* appStudy = dynamic_cast(application()->activeStudy()); - if (!appStudy || !appStudy->studyDS()) + if ( !appStudy || !appStudy->studyDS() ) return; _PTR(Study) studyDS = appStudy->studyDS(); @@ -1635,160 +1962,117 @@ void GeometryGUI::storeVisualParameters (int savePoint) savePoint); _PTR(IParameters) ip = ClientFactory::getIParameters(ap); - // viewers counters are used for storing view_numbers in IParameters - int vtkViewers(0), occViewers(0); - QList lst; QList::Iterator it; // main cycle to store parameters of displayed objects lst.clear(); - vtkViewers = occViewers = 0; getApp()->viewManagers(lst); - for (it = lst.begin(); it != lst.end(); it++) - { + for (it = lst.begin(); it != lst.end(); it++) { SUIT_ViewManager* vman = *it; QString vType = vman->getType(); - + int aMgrId = vman->getGlobalId(); // saving VTK actors properties - if (vType == SVTK_Viewer::Type()) - { - QVector views = vman->getViews(); - for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) - { - if (SVTK_ViewWindow* vtkView = dynamic_cast(views[i])) - { - vtkActorCollection* allActors = vtkView->getRenderer()->GetActors(); - allActors->InitTraversal(); - while (vtkActor* actor = allActors->GetNextActor()) - { - if (actor->GetVisibility()) // store only visible actors - { - GEOM_Actor* aGeomActor = 0; - if (actor->IsA("GEOM_Actor")) - aGeomActor = GEOM_Actor::SafeDownCast(actor); - if (aGeomActor && aGeomActor->hasIO()) - { - Handle(SALOME_InteractiveObject) io = aGeomActor->getIO(); - if (io->hasEntry()) - { - // entry is "encoded" = it does NOT contain component adress, since it is a - // subject to change on next component loading - std::string entry = ip->encodeEntry(io->getEntry(), componentName); - - std::string param, occParam = vType.toLatin1().data(); - occParam += gSeparator; - occParam += QString::number(vtkViewers).toLatin1().data(); - occParam += gSeparator; - - param = occParam + "Visibility"; - ip->setParameter(entry, param, "On"); - - param = occParam + "DisplayMode"; - ip->setParameter(entry, param, QString::number - (aGeomActor->getDisplayMode()).toLatin1().data()); - - vtkFloatingPointType r, g, b; - aGeomActor->GetColor(r, g, b); - QString colorStr = QString::number(r); - colorStr += gDigitsSep; colorStr += QString::number(g); - colorStr += gDigitsSep; colorStr += QString::number(b); - param = occParam + "Color"; - ip->setParameter(entry, param, colorStr.toLatin1().data()); - - param = occParam + "Opacity"; - ip->setParameter(entry, param, QString::number(aGeomActor->GetOpacity()).toLatin1().data()); - - int nbUIso(0), nbVIso(0); - aGeomActor->GetNbIsos(nbUIso,nbVIso); - QString isosStr = QString::number(nbUIso); - isosStr += gDigitsSep; - isosStr += QString::number(nbVIso); - param = occParam + "Isos"; - ip->setParameter(entry, param, isosStr.toLatin1().data()); - } // if (io->hasEntry()) - } // GEOM_Actor && hasIO - } // isVisible - } // while.. actors traversal - } // if (vtkView) - } // for (views) - vtkViewers++; - } // if (SVTK view model) - else if (vType == SOCC_Viewer::Type()) // processing OCC viewers - { - QVector views = vman->getViews(); - for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) - { - SOCC_ViewWindow* occView = dynamic_cast(views[i]); - if (occView) - { - //Handle(AIS_InteractiveContext) ic = - // ((OCCViewer_Viewer*)(occView->getViewManager()->getViewModel()))->getAISContext(); - OCCViewer_Viewer* viewModel = (OCCViewer_Viewer*)(vman->getViewModel()); - //OCCViewer_Viewer* viewModel = ((OCCViewer_ViewManager*)vman)->getOCCViewer(); - Handle(AIS_InteractiveContext) ic = viewModel->getAISContext(); - - AIS_ListOfInteractive aList; - ic->DisplayedObjects(aList); - - AIS_ListIteratorOfListOfInteractive ite (aList); - for (; ite.More(); ite.Next()) - { - if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) - { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if (aSh->hasIO()) - { - Handle(SALOME_InteractiveObject) io = - Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO()); - if (io->hasEntry()) - { - // entry is "encoded": it does NOT contain component adress, - // since it is a subject to change on next component loading - std::string entry = ip->encodeEntry(io->getEntry(), componentName); - - std::string param, occParam = vType.toLatin1().data(); - occParam += gSeparator; - occParam += QString::number(occViewers).toLatin1().data(); - occParam += gSeparator; - - // Visibility - param = occParam + "Visibility"; - ip->setParameter(entry, param, "On"); - - // DisplayMode - param = occParam + "DisplayMode"; - int dm = aSh->DisplayMode(); - ip->setParameter(entry, param, QString::number(dm).toLatin1().data()); - - // Color - // is a property of GEOM_Object, it is stored by GEOM engine - - // Transparency - param = occParam + "Transparency"; - ip->setParameter(entry, param, QString::number(aSh->Transparency()).toLatin1().data()); - - // Isos - Handle(AIS_Drawer) aDrawer = aSh->Attributes(); - int nbUIso = aDrawer->UIsoAspect()->Number(); - int nbVIso = aDrawer->VIsoAspect()->Number(); - QString isosStr = QString::number(nbUIso); - isosStr += gDigitsSep; - isosStr += QString::number(nbVIso); - param = occParam + "Isos"; - ip->setParameter(entry, param, isosStr.toLatin1().data()); - } // if (io->hasEntry()) - } // if (io) - } // if (GEOM_AISShape) - } // for (AIS_ListOfInteractive) - } // if ( occView ) - } // for ( views ) - occViewers++; - } // if (SOCC view model) - else - { - // unknown viewer type - } + QVector views = vman->getViews(); + for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) { + const ObjMap anObjects = appStudy->getObjectMap(aMgrId); + ObjMap::ConstIterator o_it = anObjects.begin(); + for (; o_it != anObjects.end(); o_it++) { + const PropMap aProps = o_it.value(); + + //Check that object exists in the study + _PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) ); + if ( !obj || !(aProps.count() > 0)) + continue; + // entry is "encoded" = it does NOT contain component adress, since it is a + // subject to change on next component loading + + std::string entry = ip->encodeEntry(o_it.key().toLatin1().data(), componentName); + + _PTR(GenericAttribute) anAttr; + if( !obj->FindAttribute(anAttr, "AttributeIOR")) + continue; + + std::string param,occParam = vType.toLatin1().data(); + occParam += NAME_SEPARATOR; + occParam += QString::number(aMgrId).toLatin1().data(); + occParam += NAME_SEPARATOR; + + if(aProps.contains(VISIBILITY_PROP)) { + param = occParam + VISIBILITY_PROP; + ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off"); + } + + if(aProps.contains(DISPLAY_MODE_PROP)) { + param = occParam + DISPLAY_MODE_PROP; + ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data()); + } + + if(aProps.contains(COLOR_PROP)) { + QColor c = aProps.value(COLOR_PROP).value(); + QString colorStr = QString::number(c.red()/255.); + colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.); + colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.); + param = occParam + COLOR_PROP; + ip->setParameter(entry, param, colorStr.toLatin1().data()); + } + + if(vType == SVTK_Viewer::Type()) { + if(aProps.contains(OPACITY_PROP)) { + param = occParam + OPACITY_PROP; + ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data()); + } + } else if (vType == SOCC_Viewer::Type()) { + if(aProps.contains(TRANSPARENCY_PROP)) { + param = occParam + TRANSPARENCY_PROP; + ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data()); + } + + if(aProps.contains(TOP_LEVEL_PROP)) { + param = occParam + TOP_LEVEL_PROP; + Standard_Boolean val = aProps.value(TOP_LEVEL_PROP).value(); + if (val == Standard_True) + ip->setParameter(entry, param, "1"); + } + } + + if(aProps.contains(ISOS_PROP)) { + param = occParam + ISOS_PROP; + ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data()); + } + + if(aProps.contains(VECTOR_MODE_PROP)) { + param = occParam + VECTOR_MODE_PROP; + ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data()); + } + + if(aProps.contains(DEFLECTION_COEFF_PROP)) { + param = occParam + DEFLECTION_COEFF_PROP; + ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data()); + } + + //Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex" + if(aProps.contains(MARKER_TYPE_PROP)) { + param = occParam + MARKER_TYPE_PROP; + ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data()); + } + + if(aProps.contains(MATERIAL_PROP)) { + param = occParam + MATERIAL_PROP; + ip->setParameter(entry, param, aProps.value(MATERIAL_PROP).toString().toLatin1().data()); + } + + if(aProps.contains( EDGE_WIDTH_PROP )) { + param = occParam + EDGE_WIDTH_PROP; + ip->setParameter(entry, param, aProps.value(EDGE_WIDTH_PROP).toString().toLatin1().data()); + } + + if(aProps.contains( ISOS_WIDTH_PROP )) { + param = occParam + ISOS_WIDTH_PROP; + ip->setParameter(entry, param, aProps.value(ISOS_WIDTH_PROP).toString().toLatin1().data()); + } + } // object iterator + } // for (views) } // for (viewManagers) } @@ -1796,7 +2080,7 @@ void GeometryGUI::storeVisualParameters (int savePoint) * \brief Restore visual parameters * * This method is called after the study document is opened. - * Restore visual parameters from AttributeParameter attribue(s) + * Restore visual parameters from AttributeParameter attribute(s) */ void GeometryGUI::restoreVisualParameters (int savePoint) { @@ -1839,189 +2123,90 @@ void GeometryGUI::restoreVisualParameters (int savePoint) NCollection_DataMap vtkActors; NCollection_DataMap occActors; + QString viewerTypStr; + QString viewIndexStr; + int viewIndex; + QVector aListOfMap; + for (; namesIt != paramNames.end(); ++namesIt, ++valuesIt) { // visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName. // '_' is used as separator and should not be used in viewer type or parameter names. - QStringList lst = QString((*namesIt).c_str()).split(gSeparator, QString::SkipEmptyParts); + QStringList lst = QString((*namesIt).c_str()).split(NAME_SEPARATOR, QString::SkipEmptyParts); if (lst.size() != 3) continue; - QString viewerTypStr = lst[0]; - QString viewIndexStr = lst[1]; + viewerTypStr = lst[0]; + viewIndexStr = lst[1]; QString paramNameStr = lst[2]; bool ok; - int viewIndex = viewIndexStr.toUInt(&ok); + viewIndex = viewIndexStr.toUInt(&ok); if (!ok) // bad conversion of view index to integer - continue; + continue; + + if((viewIndex + 1) > aListOfMap.count()) { + aListOfMap.resize(viewIndex + 1); + } - // viewers - if (viewerTypStr == SVTK_Viewer::Type()) - { - GEOM_Actor* vActor = 0; - if (vtkActors.IsBound(viewIndex)) - vActor = vtkActors.Find(viewIndex); + QString val((*valuesIt).c_str()); + if(paramNameStr == VISIBILITY_PROP){ + aListOfMap[viewIndex].insert(VISIBILITY_PROP, val == "On" ? 1 : 0); - if (paramNameStr == "Visibility") - { - if (!vActor && displayer()) - { - QList lst; - getApp()->viewManagers(viewerTypStr, lst); - - // SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager - if (viewIndex >= 0 && viewIndex < lst.count()) { - SUIT_ViewManager* vman = lst.at(viewIndex); - SUIT_ViewModel* vmodel = vman->getViewModel(); - // SVTK view model can be casted to SALOME_View - displayer()->Display(entry, true, dynamic_cast(vmodel)); - - // store displayed actor in a temporary map for quicker - // access later when restoring other parameters - SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView(); - vtkRenderer* Renderer = vtkView->getRenderer(); - vtkActorCollection* theActors = Renderer->GetActors(); - theActors->InitTraversal(); - bool isFound = false; - vtkActor *ac = theActors->GetNextActor(); - for (; ac != NULL && !isFound; ac = theActors->GetNextActor()) { - if (ac->IsA("GEOM_Actor")) { - GEOM_Actor* aGeomAc = GEOM_Actor::SafeDownCast(ac); - if (aGeomAc->hasIO()) { - Handle(SALOME_InteractiveObject) io = - Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO()); - if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) { - isFound = true; - vtkActors.Bind(viewIndex, aGeomAc); - } - } - } - } - } - } - } // if (paramNameStr == "Visibility") - else - { - // the rest properties "work" with GEOM_Actor - if (vActor) - { - QString val ((*valuesIt).c_str()); + } else if(paramNameStr == OPACITY_PROP) { + aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, 1. - val.toDouble()); - if (paramNameStr == "DisplayMode") { - vActor->setDisplayMode(val.toInt()); - } - else if (paramNameStr == "Color") { - QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts); - if (colors.count() == 3) - vActor->SetColor(colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat()); - } - else if (paramNameStr == "Opacity") { - vActor->SetOpacity(val.toFloat()); - } - else if (paramNameStr == "Isos") { - QStringList isos = val.split(gDigitsSep, QString::SkipEmptyParts); - if (isos.count() == 2) { - int aIsos[2] = {isos[0].toInt(), isos[1].toInt()}; - vActor->SetNbIsos(aIsos); - } - } - } - } // other parameters than Visibility - } - else if (viewerTypStr == SOCC_Viewer::Type()) - { - //Handle(AIS_InteractiveObject) occActor; - Handle(GEOM_AISShape) occActor; - if (occActors.IsBound(viewIndex)) - occActor = occActors.Find(viewIndex); - - // ViewModel and InteractiveContext - SOCC_Viewer* occVModel = 0; - Handle(AIS_InteractiveContext) ic; - - QList lst; - getApp()->viewManagers(viewerTypStr, lst); - - // SOCC ViewManager always has 1 ViewWindow, so view index is index of view manager - if (viewIndex >= 0 && viewIndex < lst.count()) { - SUIT_ViewManager* vman = lst.at(viewIndex); - SUIT_ViewModel* vmodel = vman->getViewModel(); - occVModel = dynamic_cast(vmodel); - if (occVModel) - ic = occVModel->getAISContext(); - } + } else if(paramNameStr == TRANSPARENCY_PROP) { + aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val.toDouble() ); - if (ic.IsNull()) - continue; + } else if(paramNameStr == TOP_LEVEL_PROP) { + aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val == "1" ? Standard_True : Standard_False ); + + } else if(paramNameStr == DISPLAY_MODE_PROP) { + aListOfMap[viewIndex].insert( DISPLAY_MODE_PROP, val.toInt()); - if (paramNameStr == "Visibility") - { - if (occActor.IsNull() && displayer()) - { - displayer()->Display(entry, true, occVModel); - - // store displayed actor in a temporary map for quicker - // access later when restoring other parameters - AIS_ListOfInteractive aList; - ic->DisplayedObjects(aList); - bool isFound = false; - AIS_ListIteratorOfListOfInteractive ite (aList); - for (; ite.More() && !isFound; ite.Next()) { - if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if (aSh->hasIO()) { - Handle(SALOME_InteractiveObject) io = - Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO()); - if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) { - isFound = true; - occActors.Bind(viewIndex, aSh); - } - } - } - } - } - } // if (paramNameStr == "Visibility") - else - { - // the rest properties "work" with GEOM_AISShape - if (!occActor.IsNull()) - { - QString val ((*valuesIt).c_str()); - - if (paramNameStr == "DisplayMode") { - ic->SetDisplayMode(occActor, AIS_DisplayMode(val.toInt()), false); - //ic->Redisplay(occActor, Standard_False, Standard_True); - } - // Color is restored by the GEOM engine - else if (paramNameStr == "Transparency") { - ic->SetTransparency(occActor, val.toFloat(), false); - ic->Redisplay(occActor, Standard_False, Standard_True); - } - else if (paramNameStr == "Isos") { - QStringList isos = val.split(gDigitsSep, QString::SkipEmptyParts); - if (isos.count() == 2) { - Handle(AIS_Drawer) aDrawer = occActor->Attributes(); - int nbUIso = isos[0].toInt(); - int nbVIso = isos[1].toInt(); - Handle(Prs3d_IsoAspect) uIsoAspect = aDrawer->UIsoAspect(); - Handle(Prs3d_IsoAspect) vIsoAspect = aDrawer->VIsoAspect(); - uIsoAspect->SetNumber(nbUIso); - vIsoAspect->SetNumber(nbVIso); - aDrawer->SetUIsoAspect(uIsoAspect); - aDrawer->SetVIsoAspect(vIsoAspect); - ic->SetLocalAttributes(occActor, aDrawer); - ic->Redisplay(occActor); - } - } - } - } // other parameters than Visibility - } - else - { - // unknown viewer type + } else if(paramNameStr == ISOS_PROP) { + aListOfMap[viewIndex].insert( ISOS_PROP, val); + + } else if(paramNameStr == COLOR_PROP) { + QStringList rgb = val.split(DIGIT_SEPARATOR); + if(rgb.count() == 3) { + QColor c(int(rgb[0].toDouble()*255), int(rgb[1].toDouble()*255), int(rgb[2].toDouble()*255)); + aListOfMap[viewIndex].insert( COLOR_PROP, c); + } + } else if(paramNameStr == VECTOR_MODE_PROP) { + aListOfMap[viewIndex].insert( VECTOR_MODE_PROP, val.toInt()); + + } else if(paramNameStr == DEFLECTION_COEFF_PROP) { + aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble()); + } else if(paramNameStr == MARKER_TYPE_PROP) { + aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val); + } else if(paramNameStr == MATERIAL_PROP) { + aListOfMap[viewIndex].insert( MATERIAL_PROP, val); + } else if(paramNameStr == EDGE_WIDTH_PROP) { + aListOfMap[viewIndex].insert( EDGE_WIDTH_PROP , val); + } else if(paramNameStr == ISOS_WIDTH_PROP) { + aListOfMap[viewIndex].insert( ISOS_WIDTH_PROP , val); } + + + } // for names/parameters iterator + + QList lst = getApp()->viewManagers(); + + for (int index = 0; index < aListOfMap.count(); index++) { + + appStudy->setObjectPropMap(index, entry, aListOfMap[index]); + + //Get Visibility property of the current PropMap + if (aListOfMap[index].value(VISIBILITY_PROP) == 1) { + SUIT_ViewManager* vman = lst.at(index); + SUIT_ViewModel* vmodel = vman->getViewModel(); + displayer()->Display(entry, true, dynamic_cast(vmodel)); + } + } + } // for entries iterator // update all VTK and OCC views @@ -2044,3 +2229,90 @@ void GeometryGUI::restoreVisualParameters (int savePoint) } } } + +void GeometryGUI::onViewAboutToShow() +{ + SUIT_ViewWindow* window = application()->desktop()->activeWindow(); + QAction* a = action( GEOMOp::OpSwitchVectors ); + if ( window ) { + a->setEnabled(true); + bool vmode = window->property("VectorsMode").toBool(); + a->setText ( vmode == 1 ? tr( "MEN_VECTOR_MODE_OFF" ) : tr("MEN_VECTOR_MODE_ON") ); + } else { + a->setText ( tr("MEN_VECTOR_MODE_ON") ); + a->setEnabled(false); + } +} + +/*! + \brief Return action by id + \param id identifier of the action + \return action +*/ +QAction* GeometryGUI::getAction(const int id) { + return action(id); +} + +/*! + \brief Check if this object is can't be renamed in place + + This method can be re-implemented in the subclasses. + Return true in case if object isn't reference or component (module root). + + \param entry column id + \return \c true if the item can be renamed by the user in place (e.g. in the Object browser) +*/ +bool GeometryGUI::renameAllowed( const QString& entry) const { + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; + SalomeApp_DataObject* obj = appStudy ? dynamic_cast(appStudy->findObjectByEntry(entry)) : 0; + + return (app && appStudy && obj && !appStudy->isComponent(entry) && !obj->isReference()); +} + + +/*! + Rename object by entry. + \param entry entry of the object + \param name new name of the object + \brief Return \c true if rename operation finished successfully, \c false otherwise. +*/ +bool GeometryGUI::renameObject( const QString& entry, const QString& name) { + + bool result = false; + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication()); + SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; + + if(!appStudy) + return result; + + _PTR(Study) aStudy = appStudy->studyDS(); + + if(!aStudy) + return result; + + bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked(); + if ( aLocked ) { + SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") ); + return result; + } + + _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) ); + _PTR(GenericAttribute) anAttr; + if ( obj ) { + if ( obj->FindAttribute(anAttr, "AttributeName") ) { + _PTR(AttributeName) aName (anAttr); + + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); + if (!CORBA::is_nil(anObj)) { + aName->SetValue( name.toLatin1().data() ); // rename the SObject + anObj->SetName( name.toLatin1().data() ); // Rename the corresponding GEOM_Object + result = true; + } + } + } + return result; +} + diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 36d06fd55..bde9446a7 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -1,33 +1,36 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GeometryGUI.h // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #ifndef GEOMETRYGUI_H #define GEOMETRYGUI_H #include "GEOM_GEOMGUI.hxx" +#include + #include #include @@ -42,18 +45,24 @@ // OCCT Includes #include +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif + // IDL headers #include "SALOMEconfig.h" #include CORBA_CLIENT_HEADER(SALOMEDS) -typedef QMap GUIMap; - class QDialog; class QMenu; +class QAction; class GEOMGUI_OCCSelector; class LightApp_VTKSelector; class LightApp_Selection; class SUIT_ViewManager; +class SalomeApp_Study; //================================================================================= // class : GeometryGUI @@ -74,19 +83,22 @@ public: virtual void initialize( CAM_Application* ); virtual QString engineIOR() const; - static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + static Handle(TColStd_HArray1OfByte) getTexture (SalomeApp_Study*, int, int&, int&); +#else + static Handle(Graphic3d_HArray1OfBytes) getTexture (SalomeApp_Study*, int, int&, int&); +#endif - static GEOM::GEOM_Gen_var GetGeomGen();// { return GeometryGUI::myComponentGeom; } + static bool InitGeomGen(); + + static GEOM::GEOM_Gen_var GetGeomGen(); static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject); static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy); - static char* JoinObjectParameters(const QStringList& theParametersList); + static void Modified( bool = true ); - GEOM_Client& GetShapeReader() { return myShapeReader; } - Standard_CString& GetFatherior() { return myFatherior; } - //void SetState( const int state ) { myState = state; } - //int GetState() const { return myState; } + GEOM_Client& GetShapeReader() { static SHAPE_READER(myShapeReader);return myShapeReader; } // Get active dialog box QDialog* GetActiveDialogBox(){ return myActiveDialogBox; } @@ -98,21 +110,17 @@ public: void EmitSignalCloseAllDialogs(); void EmitSignalDefaultStepValueChanged( double newVal ); + // Process action void OnGUIEvent( int id ); -// virtual bool SetSettings(); -// virtual void SupportedViewType ( int* buffer, int bufferSize ); - virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 ); - -// virtual void DefinePopup( QString & theContext, QString & theParent, QString & theObject); -// virtual bool CustomPopup( QAD_Desktop* parent, QMenu* popup, const QString& theContext, -// const QString& theParent, const QString& theObject ); - // The Working Plane management void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; } gp_Ax3 GetWorkingPlane() { return myWorkingPlane; } void ActiveWorkingPlane(); + virtual bool renameObject( const QString&, const QString& ); + virtual bool renameAllowed( const QString& ) const; + virtual void windows( QMap& ) const; virtual void viewManagers( QStringList& ) const; @@ -125,12 +133,15 @@ public: virtual void storeVisualParameters (int savePoint); virtual void restoreVisualParameters(int savePoint); + QAction* getAction(const int id); + public slots: virtual bool deactivateModule( SUIT_Study* ); virtual bool activateModule( SUIT_Study* ); virtual void OnKeyPress ( SUIT_ViewWindow*, QKeyEvent* ); virtual void OnMousePress( SUIT_ViewWindow*, QMouseEvent* ); virtual void OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* ); + virtual void OnMouseRelease ( SUIT_ViewWindow*, QMouseEvent* ); protected slots: virtual void onViewManagerAdded( SUIT_ViewManager* ); @@ -139,6 +150,7 @@ protected slots: private slots: void OnGUIEvent(); void onWindowActivated( SUIT_ViewWindow* ); + void onViewAboutToShow(); signals : void SignalDeactivateActiveDialog(); @@ -151,23 +163,35 @@ protected: private: GEOMGUI* getLibrary( 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 ); + const QString& icon_id = QString(""), + const int key = 0, const bool toggle = false, + const QString& shortcutAction = QString() ); void createPopupItem( const int, const QString& clients, const QString& types, - const bool isSingle = false, const int isVisible = -1, - const bool isExpandAll = false, const bool isOCC = false, - const int parentId = -1 ); + const bool isSingle = false, const int isVisible = -1, + const bool isExpandAll = false, const bool isOCC = false, + const int parentId = -1 ); + + void createOriginAndBaseVectors(); public: static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!! + private: + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + typedef QMap TextureMap; +#else + typedef QMap TextureMap; +#endif + + typedef QMap StudyTextureMap; + typedef QMap GUIMap; + GUIMap myGUIMap; // GUI libraries map QDialog* myActiveDialogBox; // active dialog box - GEOM_Client myShapeReader; // geom shape reader - Standard_CString myFatherior; - int myState; // identify a method gp_Ax3 myWorkingPlane; QMap myRules; // popup rules + static StudyTextureMap myTextureMap; // texture map QList myOCCSelectors; QList myVTKSelectors; @@ -175,7 +199,7 @@ private: LightApp_Displayer* myDisplayer; int myLocalSelectionMode; //Select Only -friend class DisplayGUI; + friend class DisplayGUI; }; #endif diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h new file mode 100644 index 000000000..3d8a41d4e --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -0,0 +1,195 @@ +// Copyright (C) 2007-2012 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 +// +// File : GeometryGUI_Operations.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#ifndef GEOMETRYGUI_OPERATIONS_H +#define GEOMETRYGUI_OPERATIONS_H + +namespace GEOMOp { + enum { + // ToolsGUI ------------------//-------------------------------- + OpImport = 1000, // MENU FILE - IMPORT + OpExport = 1001, // MENU FILE - EXPORT + OpDelete = 1020, // MENU EDIT - DELETE + OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY + OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX + OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE + OpSelectWire = 1102, // POPUP MENU - SELECT ONLY - WIRE + OpSelectFace = 1103, // POPUP MENU - SELECT ONLY - FACE + OpSelectShell = 1104, // POPUP MENU - SELECT ONLY - SHELL + OpSelectSolid = 1105, // POPUP MENU - SELECT ONLY - SOLID + OpSelectCompound = 1106, // POPUP MENU - SELECT ONLY - COMPOUND + OpSelectAll = 1107, // POPUP MENU - SELECT ONLY - SELECT ALL + OpDeflection = 1200, // POPUP MENU - DEFLECTION COEFFICIENT + OpColor = 1201, // POPUP MENU - COLOR + OpTransparency = 1202, // POPUP MENU - TRANSPARENCY + OpIncrTransparency = 1203, // SHORTCUT - INCREASE TRANSPARENCY + OpDecrTransparency = 1204, // SHORTCUT - DECREASE TRANSPARENCY + OpIsos = 1205, // POPUP MENU - ISOS + OpIncrNbIsos = 1206, // SHORTCUT - INCREASE NB ISOS + OpDecrNbIsos = 1207, // SHORTCUT - DECREASE NB ISOS + OpAutoColor = 1208, // POPUP MENU - AUTO COLOR + OpNoAutoColor = 1209, // POPUP MENU - DISABLE AUTO COLOR + OpPointMarker = 1210, // POPUP MENU - POINT MARKER + OpSetTexture = 1211, // POPUP MENU - SETTEXTURE + OpMaterialProperties = 1212, // POPUP MENU - MATERIAL PROPERTIES + OpShowChildren = 1250, // POPUP MENU - SHOW CHILDREN + OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN + OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH + OpPublishObject = 1254, // GEOM ROOT OBJECT - POPUP MENU - PUBLISH + OpEdgeWidth = 1260, // POPUP MENU - LINE WIDTH - EDGE WIDTH + OpIsosWidth = 1261, // POPUP MENU - LINE WIDTH - ISOS WIDTH + + // DisplayGUI ----------------//-------------------------------- + OpSwitchVectors = 2001, // MENU VIEW - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION + OpShowAll = 2002, // MENU VIEW - SHOW ALL + OpHideAll = 2003, // MENU VIEW - HIDE ALL + OpDMWireframe = 2010, // MENU VIEW - DISPLAY MODE - WIREFRAME + OpDMShading = 2011, // MENU VIEW - DISPLAY MODE - SHADING + OpDMShadingWithEdges = 2012, // MENU VIEW - DISPLAY MODE - SHADING WITH EDGES + OpShow = 2100, // POPUP MENU - SHOW + OpShowOnly = 2101, // POPUP MENU - SHOW ONLY + OpHide = 2102, // POPUP MENU - HIDE + OpWireframe = 2200, // POPUP MENU - DISPLAY MODE - WIREFRAME + OpShading = 2201, // POPUP MENU - DISPLAY MODE - SHADING + OpShadingWithEdges = 2202, // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES + OpVectors = 2203, // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION + OpTexture = 2204, // POPUP MENU - DISPLAY MODE - TEXTURE + OpBringToFront = 2205, // POPUP MENU - BRING TO FRONT + OpClsBringToFront = 2206, + // BasicGUI ------------------//-------------------------------- + OpPoint = 3000, // MENU NEW ENTITY - BASIC - POINT + OpLine = 3001, // MENU NEW ENTITY - BASIC - LINE + OpCircle = 3002, // MENU NEW ENTITY - BASIC - CIRCLE + OpEllipse = 3003, // MENU NEW ENTITY - BASIC - ELLIPSE + OpArc = 3004, // MENU NEW ENTITY - BASIC - ARC + OpVector = 3005, // MENU NEW ENTITY - BASIC - VECTOR + OpPlane = 3006, // MENU NEW ENTITY - BASIC - PLANE + OpCurve = 3007, // MENU NEW ENTITY - BASIC - CURVE + OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM + OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS + // PrimitiveGUI --------------//-------------------------------- + OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX + OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER + OpSphere = 3102, // MENU NEW ENTITY - PRIMITIVES - SPHERE + OpTorus = 3103, // MENU NEW ENTITY - PRIMITIVES - TORUS + OpCone = 3104, // MENU NEW ENTITY - PRIMITIVES - CONE + OpRectangle = 3105, // MENU NEW ENTITY - PRIMITIVES - FACE + OpDisk = 3106, // MENU NEW ENTITY - PRIMITIVES - DISK + // GenerationGUI -------------//-------------------------------- + OpPrism = 3200, // MENU NEW ENTITY - GENERATION - EXTRUSION + OpRevolution = 3201, // MENU NEW ENTITY - GENERATION - REVOLUTION + OpFilling = 3202, // MENU NEW ENTITY - GENERATION - FILLING + OpPipe = 3203, // MENU NEW ENTITY - GENERATION - EXTRUSION ALONG PATH + // EntityGUI -----------------//-------------------------------- + Op2dSketcher = 3300, // MENU NEW ENTITY - SKETCHER + Op3dSketcher = 3301, // MENU NEW ENTITY - 3D SKETCHER + OpExplode = 3302, // MENU NEW ENTITY - EXPLODE +#ifdef WITH_OPENCV + OpFeatureDetect = 3303, // MENU NEW ENTITY - FEATURE DETECTION +#endif + OpPictureImport = 3304, // MENU NEW ENTITY - IMPORT PICTURE IN VIEWER + + // BuildGUI ------------------//-------------------------------- + OpEdge = 3400, // MENU NEW ENTITY - BUILD - EDGE + OpWire = 3401, // MENU NEW ENTITY - BUILD - WIRE + OpFace = 3402, // MENU NEW ENTITY - BUILD - FACE + OpShell = 3403, // MENU NEW ENTITY - BUILD - SHELL + OpSolid = 3404, // MENU NEW ENTITY - BUILD - SOLID + OpCompound = 3405, // MENU NEW ENTITY - BUILD - COMPOUND + // BooleanGUI ----------------//-------------------------------- + OpFuse = 3500, // MENU OPERATIONS - BOOLEAN - FUSE + OpCommon = 3501, // MENU OPERATIONS - BOOLEAN - COMMON + OpCut = 3502, // MENU OPERATIONS - BOOLEAN - CUT + OpSection = 3503, // MENU OPERATIONS - BOOLEAN - SECTION + // TransformationGUI ---------//-------------------------------- + OpTranslate = 3600, // MENU OPERATIONS - TRANSFORMATION - TRANSLATION + OpRotate = 3601, // MENU OPERATIONS - TRANSFORMATION - ROTATION + OpChangeLoc = 3602, // MENU OPERATIONS - TRANSFORMATION - LOCATION + OpMirror = 3603, // MENU OPERATIONS - TRANSFORMATION - MIRROR + OpScale = 3604, // MENU OPERATIONS - TRANSFORMATION - SCALE + OpOffset = 3605, // MENU OPERATIONS - TRANSFORMATION - OFFSET + OpMultiTranslate = 3606, // MENU OPERATIONS - TRANSFORMATION - MULTI-TRANSLATION + OpMultiRotate = 3607, // MENU OPERATIONS - TRANSFORMATION - MULTI-ROTATION + OpReimport = 3608, // POPUP MENU - RELOAD IMPORTED + OpProjection = 3609, // MENU OPERATIONS - TRANSFORMATION - PROJECTION + // OperationGUI + OpPartition = 3700, // MENU OPERATION - PARTITION + OpArchimede = 3701, // MENU OPERATION - ARCHIMEDE + OpFillet3d = 3702, // MENU OPERATION - FILLET + OpChamfer = 3703, // MENU OPERATION - CHAMFER + OpShapesOnShape = 3704, // MENU OPERATION - GET SHAPES ON SHAPE + OpFillet2d = 3705, // MENU OPERATION - FILLET 2D + OpFillet1d = 3706, // MENU OPERATION - FILLET 1D + OpClipping = 3707, // MENU OPERATION - CLIPPING RANGE + OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES + OpExtrudedBoss = 3709, // MENU OPERATION - ETRUDED BOSS + OpExtrudedCut = 3710, // MENU OPERATION - ETRUDED CUT + // RepairGUI -----------------//-------------------------------- + OpSewing = 4000, // MENU REPAIR - SEWING + OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES + OpSuppressHoles = 4002, // MENU REPAIR - SUPPRESS HOLES + OpShapeProcess = 4003, // MENU REPAIR - SHAPE PROCESSING + OpCloseContour = 4004, // MENU REPAIR - CLOSE CONTOUR + OpRemoveIntWires = 4005, // MENU REPAIR - REMOVE INTERNAL WIRES + OpAddPointOnEdge = 4006, // MENU REPAIR - ADD POINT ON EDGE + OpFreeBoundaries = 4007, // MENU MEASURES - FREE BOUNDARIES + OpFreeFaces = 4008, // MENU MEASURES - FREE FACES + OpOrientation = 4009, // MENU REPAIR - CHANGE ORIENTATION + OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES + OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES + OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE + OpGlueEdges = 4013, // MENU REPAIR - GLUE EDGES + OpFuseEdges = 4014, // MENU REPAIR - FUSE COLLINEAR EDGES + // MeasureGUI ----------------//-------------------------------- + OpProperties = 5000, // MENU MEASURES - PROPERTIES + OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS + OpInertia = 5002, // MENU MEASURES - INERTIA + OpNormale = 5003, // MENU MEASURES - NORMALE + OpBoundingBox = 5004, // MENU MEASURES - BOUNDING BOX + OpMinDistance = 5005, // MENU MEASURES - MIN DISTANCE + OpAngle = 5006, // MENU MEASURES - ANGLE + OpTolerance = 5007, // MENU MEASURES - TOLERANCE + OpWhatIs = 5008, // MENU MEASURES - WHAT IS + OpCheckShape = 5009, // MENU MEASURES - CHECK + OpCheckCompound = 5010, // MENU MEASURES - CHECK COMPOUND OF BLOCKS + OpPointCoordinates = 5011, // MENU MEASURES - POINT COORDINATES + OpCheckSelfInters = 5012, // MENU MEASURES - CHECK SELF INTERSECTIONS + // GroupGUI ------------------//-------------------------------- + OpGroupCreate = 6000, // MENU GROUP - CREATE + OpGroupEdit = 6001, // MENU GROUP - EDIT + OpGroupCreatePopup = 6002, // POPUP MENU - CREATE GROUP + // BlocksGUI -----------------//-------------------------------- + OpHexaSolid = 6100, // MENU BLOCKS - HEXAHEDRAL SOLID + OpMultiTransform = 6101, // MENU BLOCKS - MULTI-TRANSFORMATION + OpQuadFace = 6102, // MENU BLOCKS - QUADRANGLE FACE + OpPropagate = 6103, // MENU BLOCKS - PROPAGATE + 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 + //@@ insert new functions before this line @@ do not remove this line @@// + }; +} + +#endif // GEOMETRYGUI_OPERATIONS_H diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx index e1e8f1390..59410211f 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.cxx +++ b/src/GEOMGUI/GeometryGUI_Swig.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GeometryGUI_Swig.cxx // Author : Nicolas REJNERI, Paul RASCLE @@ -37,11 +38,13 @@ #include "OCCViewer_ViewWindow.h" #include "OCCViewer_ViewManager.h" #include "SOCC_ViewModel.h" +#include #include "SVTK_ViewModel.h" #include "SVTK_ViewWindow.h" #include "SVTK_View.h" #include "SVTK_Renderer.h" +#include #include "GEOM_Actor.h" #include "GEOM_Client.hxx" @@ -65,10 +68,7 @@ #include -using namespace std; - - -static GEOM_Client ShapeReader; +static SHAPE_READER(ShapeReader); inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){ SUIT_ViewWindow* window = theApp->desktop()->activeWindow(); @@ -77,7 +77,7 @@ inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){ if ( vw ) { OCCViewer_ViewManager* vm = dynamic_cast( vw->getViewManager() ); if ( vm ) - return vm->getOCCViewer(); + return vm->getOCCViewer(); } } @@ -132,7 +132,7 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated) if (CORBA::is_nil(Geom)) return; - string aFatherIOR; + std::string aFatherIOR; _PTR(SComponent) father = aStudy->FindComponent("GEOM"); if (!father) return; @@ -151,14 +151,14 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated) if (!obj->FindAttribute(anAttr, "AttributeIOR")) return; _PTR(AttributeIOR) anIOR(anAttr); - string anIORValue = anIOR->Value(); + std::string anIORValue = anIOR->Value(); GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue.c_str()); TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape); if (!Shape.IsNull()) { if (obj->FindAttribute(anAttr, "AttributeName")) { _PTR(AttributeName) aName (anAttr); - string aNameValue = aName->Value(); + std::string aNameValue = aName->Value(); // open transaction /*SUIT_Operation* op = new SalomeApp_ImportOperation (app); op->start(); @@ -173,39 +173,39 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated) "GEOM", const_cast( obj->GetID().c_str())); - GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer); - /*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) { - SVTK_View* aView = aViewWindow->getView(); - int aMode = aView->GetDisplayMode(); + GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer); + /*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) { + SVTK_View* aView = aViewWindow->getView(); + int aMode = aView->GetDisplayMode(); - vtkActorCollection* theActors = + vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(Shape,0,aMode,true); - theActors->InitTraversal(); - while (vtkActor* anActor = theActors->GetNextActor()) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); - GActor->setName(const_cast(aNameValue.c_str())); - GActor->setIO(anIO); - aView->Display(GActor); - } - aView->Repaint(); - } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) { - Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); - Handle(GEOM_AISShape) aSh = + theActors->InitTraversal(); + while (vtkActor* anActor = theActors->GetNextActor()) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + GActor->setName(const_cast(aNameValue.c_str())); + GActor->setIO(anIO); + aView->Display(GActor); + } + aView->Repaint(); + } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) { + Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); + Handle(GEOM_AISShape) aSh = new GEOM_AISShape (Shape,const_cast(aNameValue.c_str())); - aSh->setName(const_cast(aNameValue.c_str())); - aSh->setIO(anIO); - ic->Display(aSh); - ic->AddOrRemoveCurrentObject(aSh,true); - }*/ - // update object browser - SalomeApp_Application* app = NULL; //dynamic_cast(app); - if (app) { - CAM_Module* module = app->module("Geometry"); - SalomeApp_Module* appMod = dynamic_cast(module); - if (appMod) - appMod->updateObjBrowser(true); - } - } + aSh->setName(const_cast(aNameValue.c_str())); + aSh->setIO(anIO); + ic->Display(aSh); + ic->AddOrRemoveCurrentObject(aSh,true); + }*/ + // update object browser + SalomeApp_Application* app = NULL; //dynamic_cast(app); + if (app) { + CAM_Module* module = app->module("Geometry"); + SalomeApp_Module* appMod = dynamic_cast(module); + if (appMod) + appMod->updateObjBrowser(true); + } + } } } }; @@ -216,15 +216,15 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated) class TEventUpdateBrowser: public SALOME_Event { public: - TEventUpdateBrowser() {} - virtual void Execute() { + TEventUpdateBrowser() {} + virtual void Execute() { SalomeApp_Application* app = dynamic_cast(SUIT_Session::session()->activeApplication()); if (app) { - CAM_Module* module = app->module("Geometry"); - SalomeApp_Module* appMod = dynamic_cast(module); - if (appMod) appMod->updateObjBrowser(true); - } + CAM_Module* module = app->module("Geometry"); + SalomeApp_Module* appMod = dynamic_cast(module); + if (appMod) appMod->updateObjBrowser(true); + } } }; @@ -239,22 +239,22 @@ void GEOM_Swig::createAndDisplayFitAllGO (const char* Entry) public: TEventFitAll() {} virtual void Execute() { - SUIT_Application* app = SUIT_Session::session()->activeApplication(); - if (!app) return; - - if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) - { - SVTK_View* aView = aViewWindow->getView(); - aView->GetRenderer()->OnFitAll(); - } - else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) - { - Handle(V3d_Viewer) aViewer3d = occViewer->getViewer3d(); - aViewer3d->InitActiveViews(); - - if (aViewer3d->MoreActiveViews()) - aViewer3d->ActiveView()->FitAll(); - } + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if (!app) return; + + if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) + { + SVTK_View* aView = aViewWindow->getView(); + aView->GetRenderer()->OnFitAll(); + } + else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) + { + Handle(V3d_Viewer) aViewer3d = occViewer->getViewer3d(); + aViewer3d->InitActiveViews(); + + if (aViewer3d->MoreActiveViews()) + aViewer3d->ActiveView()->FitAll(); + } } }; @@ -269,12 +269,12 @@ void GEOM_Swig::UpdateViewer() public: TEventUpdateViewer() {} virtual void Execute() { - SUIT_Application* app = SUIT_Session::session()->activeApplication(); - if (!app) return; - SalomeApp_Study* ActiveStudy = dynamic_cast(app->activeStudy()); - if (!ActiveStudy) return; - - GEOM_Displayer(ActiveStudy).UpdateViewer(); + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if (!app) return; + SalomeApp_Study* ActiveStudy = dynamic_cast(app->activeStudy()); + if (!ActiveStudy) return; + + GEOM_Displayer(ActiveStudy).UpdateViewer(); } }; @@ -377,15 +377,15 @@ void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode, bool isUpdated new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", ""); if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) { - SVTK_View* aView = aViewWindow->getView(); - aView->SetDisplayMode(anIO, myMode); - if (myUpdateViewer) - aView->Repaint(); + SVTK_View* aView = aViewWindow->getView(); + aView->SetDisplayMode(anIO, myMode); + if (myUpdateViewer) + aView->Repaint(); } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) { - SOCC_Viewer* soccViewer = dynamic_cast(occViewer); - if (soccViewer) - soccViewer->switchRepresentation(anIO, myMode, myUpdateViewer); + SOCC_Viewer* soccViewer = dynamic_cast(occViewer); + if (soccViewer) + soccViewer->switchRepresentation(anIO, myMode, myUpdateViewer); } } }; @@ -393,6 +393,58 @@ void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode, bool isUpdated ProcessVoidEvent(new TEvent (theEntry, theMode, isUpdated)); } +void GEOM_Swig::setVectorsMode(const char* theEntry, bool isOn, bool isUpdated) +{ + class TEvent: public SALOME_Event { + std::string myEntry; + bool myOn; + bool myUpdateViewer; + public: + TEvent(const char* theEntryArg, bool theOn, bool theUpdated): + myEntry(theEntryArg), myOn(theOn), myUpdateViewer(theUpdated) + {} + virtual void Execute() { + SUIT_Application* anApp = SUIT_Session::session()->activeApplication(); + if (!anApp) return; + + Handle(SALOME_InteractiveObject) anIO = + new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", ""); + + if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) { + SVTK_View* aView = aViewWindow->getView(); + SVTK_Viewer* stvkViewer = dynamic_cast(aViewWindow->getViewManager()->getViewModel()); + SVTK_Prs* vtkPrs = dynamic_cast( stvkViewer->CreatePrs( myEntry.c_str() ) ); + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + while (vtkActor* anAct = anActors->GetNextActor()) { + GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct); + aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode()); + } + if (myUpdateViewer) + aView->Repaint(); + } + else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) { + Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); + SOCC_Viewer* soccViewer = dynamic_cast(occViewer); + if (soccViewer) { + SOCC_Prs* occPrs = dynamic_cast( soccViewer->CreatePrs( myEntry.c_str() ) ); + if ( occPrs && !occPrs->IsNull() ) { + AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); + AIS_ListIteratorOfListOfInteractive interIter( shapes ); + for ( ; interIter.More(); interIter.Next() ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); + aSh->SetDisplayVectors(myOn); + ic->RecomputePrsOnly(interIter.Value()); + } + } + } + } + } + }; + + ProcessVoidEvent(new TEvent (theEntry, isOn, isUpdated)); +} + void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, bool isUpdated) { class TEvent: public SALOME_Event { @@ -413,31 +465,35 @@ void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, boo new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", ""); if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)){ - SVTK_View* aView = aViewWindow->getView(); + SVTK_View* aView = aViewWindow->getView(); QColor aColor (myRed, myGreen, myBlue); aView->SetColor(anIO, aColor); - if (myUpdateViewer) - aView->Repaint(); + if (myUpdateViewer) + aView->Repaint(); } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) { - Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListIteratorOfListOfInteractive ite (List); - for (; ite.More(); ite.Next()) { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast(ite.Value()->GetOwner()); - if (!anObj.IsNull() && anObj->hasEntry() && anObj->isSame(anIO)) { - Quantity_Color CSFColor = - Quantity_Color(myRed/255., myGreen/255., myBlue/255., Quantity_TOC_RGB); - ite.Value()->SetColor(CSFColor); - if (ite.Value()->IsKind(STANDARD_TYPE(GEOM_AISShape))) - Handle(GEOM_AISShape)::DownCast(ite.Value())->SetShadingColor(CSFColor); - ic->Redisplay(ite.Value(), true, true); - if (myUpdateViewer) - occViewer->update(); - break; - } - } + Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); + SOCC_Viewer* soccViewer = dynamic_cast(occViewer); + if (soccViewer) + { + SALOME_Prs* prs= soccViewer->CreatePrs( myEntry.c_str() ); + const SOCC_Prs* anOCCPrs = dynamic_cast( prs ); + if ( !anOCCPrs || anOCCPrs->IsNull() ) + return; + + // get objects to be displayed + AIS_ListOfInteractive anAISObjects; + anOCCPrs->GetObjects( anAISObjects ); + AIS_ListIteratorOfListOfInteractive ite( anAISObjects ); + Quantity_Color CSFColor = Quantity_Color(myRed/255., myGreen/255., myBlue/255., Quantity_TOC_RGB); + for ( ; ite.More(); ite.Next() ) + { + if(!ic->IsDisplayed(ite.Value()))continue; //only displayed ais + ite.Value()->SetColor(CSFColor); + if (ite.Value()->IsKind(STANDARD_TYPE(GEOM_AISShape))) Handle(GEOM_AISShape)::DownCast(ite.Value())->SetShadingColor(CSFColor); + ite.Value()->Redisplay(Standard_True); // as in OnColor + } + if (myUpdateViewer) occViewer->update(); + } } } }; @@ -462,14 +518,14 @@ void GEOM_Swig::setTransparency(const char* theEntry, float transp, bool isUpdat new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", ""); if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) { - SVTK_View* aView = aViewWindow->getView(); - aView->SetTransparency(anIO, myParam); - if (myUpdateViewer) - aView->Repaint(); + SVTK_View* aView = aViewWindow->getView(); + aView->SetTransparency(anIO, myParam); + if (myUpdateViewer) + aView->Repaint(); } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) { - SOCC_Viewer* soccViewer = dynamic_cast(occViewer); - if (soccViewer) - soccViewer->setTransparency(anIO, myParam, myUpdateViewer); + SOCC_Viewer* soccViewer = dynamic_cast(occViewer); + if (soccViewer) + soccViewer->setTransparency(anIO, myParam, myUpdateViewer); } } }; @@ -515,44 +571,44 @@ void GEOM_Swig::eraseGO (const char* Entry, bool allWindows) GEOM_Displayer(ActiveStudy).Erase(aIO, true); /* if (myFromAllWindows) { - QPtrList aWindows = app->desktop()->windows(); - SUIT_ViewWindow* aWin = 0; - for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) { - EraseObject(aWin, aIO); - } + QPtrList aWindows = app->desktop()->windows(); + SUIT_ViewWindow* aWin = 0; + for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) { + EraseObject(aWin, aIO); + } } else { - SUIT_ViewWindow* aWin = app->desktop()->activeWindow(); - if (aWin) - EraseObject(aWin, aIO); - }*/ + SUIT_ViewWindow* aWin = app->desktop()->activeWindow(); + if (aWin) + EraseObject(aWin, aIO); + }*/ } /* private: void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO) { if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){ - OCCViewer_ViewWindow* vw = dynamic_cast( theWin ); - if ( vw ) { - OCCViewer_ViewManager* vm = dynamic_cast( vw->getViewManager() ); - if ( vm ) { - SOCC_Viewer* aViewer = dynamic_cast(vm->getOCCViewer()); - if (aViewer) { - SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str()); - if (aPrs) { - SALOME_OCCPrs* aOccPrs = dynamic_cast(aPrs); - if (aOccPrs) { - aViewer->Erase(aOccPrs); - aViewer->Repaint(); - } - } - } - } - } + OCCViewer_ViewWindow* vw = dynamic_cast( theWin ); + if ( vw ) { + OCCViewer_ViewManager* vm = dynamic_cast( vw->getViewManager() ); + if ( vm ) { + SOCC_Viewer* aViewer = dynamic_cast(vm->getOCCViewer()); + if (aViewer) { + SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str()); + if (aPrs) { + SALOME_OCCPrs* aOccPrs = dynamic_cast(aPrs); + if (aOccPrs) { + aViewer->Erase(aOccPrs); + aViewer->Repaint(); + } + } + } + } + } } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){ - SVTK_ViewWindow* aViewWindow = dynamic_cast( theWin ); - if (aViewWindow) { - aViewWindow->Erase(theIO); - } + SVTK_ViewWindow* aViewWindow = dynamic_cast( theWin ); + if (aViewWindow) { + aViewWindow->Erase(theIO); + } } }*/ @@ -579,44 +635,44 @@ void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect) new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", ""); if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) { - vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors(); - aActors->InitTraversal(); - while (vtkActor* aAct = aActors->GetNextActor()) { - if (GEOM_Actor* aGeomActor = dynamic_cast(aAct)) { - if (aGeomActor->hasIO()) { - Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO(); - if (aNextIO->isSame(anIO)) { - aGeomActor->setDeflection(myParam); - aViewWindow->Repaint(); - return; - } - } - } - } - // aView->SetTransparency(anIO, myParam); - //aView->Repaint(); + vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors(); + aActors->InitTraversal(); + while (vtkActor* aAct = aActors->GetNextActor()) { + if (GEOM_Actor* aGeomActor = dynamic_cast(aAct)) { + if (aGeomActor->hasIO()) { + Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO(); + if (aNextIO->isSame(anIO)) { + aGeomActor->setDeflection(myParam); + aViewWindow->Repaint(); + return; + } + } + } + } + // aView->SetTransparency(anIO, myParam); + //aView->Repaint(); } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) { - Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext(); - AIS_ListOfInteractive aAISList; - aContext->DisplayedObjects(aAISList); - AIS_ListIteratorOfListOfInteractive it(aAISList); - for (; it.More(); it.Next()) { - Handle(SALOME_InteractiveObject) aObj = - Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner()); - if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) { - Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value()); - if (!aShape.IsNull()) { - TopoDS_Shape aSh = aShape->Shape(); - if (!aSh.IsNull()) - BRepTools::Clean(aSh); - - aShape->SetOwnDeviationCoefficient( myParam ); - aShape->SetOwnHLRDeviationAngle( 1.57 ); - aContext->Redisplay(aShape); - return; - } - } - } + Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext(); + AIS_ListOfInteractive aAISList; + aContext->DisplayedObjects(aAISList); + AIS_ListIteratorOfListOfInteractive it(aAISList); + for (; it.More(); it.Next()) { + Handle(SALOME_InteractiveObject) aObj = + Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner()); + if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) { + Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value()); + if (!aShape.IsNull()) { + TopoDS_Shape aSh = aShape->Shape(); + if (!aSh.IsNull()) + BRepTools::Clean(aSh); + + aShape->SetOwnDeviationCoefficient( myParam ); + aShape->SetOwnHLRDeviationAngle( 1.57 ); + aContext->Redisplay(aShape); + return; + } + } + } } } }; diff --git a/src/GEOMGUI/GeometryGUI_Swig.hxx b/src/GEOMGUI/GeometryGUI_Swig.hxx index a0f079ac3..0f93ab727 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.hxx +++ b/src/GEOMGUI/GeometryGUI_Swig.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GeometryGUI_Swig.hxx // Author : Nicolas REJNERI, Paul RASCLE @@ -45,6 +46,7 @@ public: void createAndDisplayFitAllGO(const char* Entry); void UpdateViewer(); void setDisplayMode(const char* Entry, int mode, bool isUpdated = true); + void setVectorsMode(const char* Entry, bool isSet, bool isUpdated = true); void setColor(const char* Entry, int red, int green, int blue, bool isUpdated = true); void setTransparency(const char* Entry, float transp, bool isUpdated = true); void setDeflection(const char* Entry, float deflect); diff --git a/src/GEOMGUI/GeometryGUI_Swig.i b/src/GEOMGUI/GeometryGUI_Swig.i index 4fa8d7ea2..d5bdfdf1a 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.i +++ b/src/GEOMGUI/GeometryGUI_Swig.i @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GeometryGUI_Swig.i // Author : Nicolas REJNERI, Paul RASCLE @@ -61,6 +62,7 @@ class GEOM_Swig const char* getShapeTypeString(const char *Entry); void setDisplayMode(const char* Entry, int mode, bool isUpdated =true); + void setVectorsMode(const char* Entry, bool isSet, bool isUpdated =true); void setColor(const char* Entry, int red, int green, int blue, bool isUpdated =true); void setTransparency(const char* Entry, float transp, bool isUpdated =true); void setDeflection(const char* Entry, float deflect); diff --git a/src/GEOMGUI/Makefile.am b/src/GEOMGUI/Makefile.am index 9dc50a430..2ac3a347b 100644 --- a/src/GEOMGUI/Makefile.am +++ b/src/GEOMGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOMGUI : GUI for Geometry component # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -32,6 +30,7 @@ lib_LTLIBRARIES = libGEOM.la # header files salomeinclude_HEADERS = \ GeometryGUI.h \ + GeometryGUI_Operations.h\ GEOMGUI.h \ GEOM_Displayer.h \ GEOMGUI_OCCSelector.h \ @@ -72,19 +71,25 @@ libGEOM_la_CPPFLAGS = \ $(GUI_CXXFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ + $(OPENCV_INCLUDES) \ -I$(srcdir)/../OBJECT \ -I$(srcdir)/../GEOMFiltersSelection \ + -I$(srcdir)/../Material \ -I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMImpl \ -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir) libGEOM_la_LDFLAGS = \ + $(PYTHON_LIBS) \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ + ../Material/libMaterial.la \ ../GEOMClient/libGEOMClient.la \ ../OBJECT/libGEOMObject.la \ - $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA \ - $(GUI_LDFLAGS) -lOCCViewer -lVTKViewer -lCAM -lSOCC -lSVTK -lEvent + $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeNS -lSalomeDSClient \ + $(GUI_LDFLAGS) -lOCCViewer -lVTKViewer -lCAM -lSOCC -lSVTK -lEvent -lSalomePrs -lstd \ + $(OPENCV_LIBS) + # -lSalomeApp # -lToolsGUI # $(CORBA_LIBS) \ diff --git a/src/GEOMImpl/GEOMImpl.pro b/src/GEOMImpl/GEOMImpl.pro deleted file mode 100644 index 87d10eaee..000000000 --- a/src/GEOMImpl/GEOMImpl.pro +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMimpl -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} $${BOOST_CPPFLAGS} ../ShHealOper ../NMTAlgo ../NMTTools ../GEOM ../GEOMAlgo ../SKETCHER ../ARCHIMEDE ../../salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMbasic -lNMTAlgo -lGEOMAlgo -lShHealOper -lGEOMArchimede -lGEOMSketcher $${KERNEL_LDFLAGS} -lSALOMELocalTrace $${STDLIB} $${CAS_LDPATH} -lTKCAF -lTKFillet -lTKOffset - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += GEOMIMPL_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = GEOMImpl_Gen.hxx -HEADERS += GEOMImpl_IBasicOperations.hxx -HEADERS += GEOMImpl_ITransformOperations.hxx -HEADERS += GEOMImpl_IHealingOperations.hxx -HEADERS += GEOMImpl_I3DPrimOperations.hxx -HEADERS += GEOMImpl_IShapesOperations.hxx -HEADERS += GEOMImpl_IBlocksOperations.hxx -HEADERS += GEOMImpl_IBooleanOperations.hxx -HEADERS += GEOMImpl_ICurvesOperations.hxx -HEADERS += GEOMImpl_ILocalOperations.hxx -HEADERS += GEOMImpl_IInsertOperations.hxx -HEADERS += GEOMImpl_IMeasureOperations.hxx -HEADERS += GEOMImpl_IGroupOperations.hxx -HEADERS += GEOMImpl_CopyDriver.hxx -HEADERS += GEOMImpl_Types.hxx -HEADERS += GEOM_GEOMImpl.hxx - -SOURCES = GEOMImpl_IBasicOperations.cxx -SOURCES += GEOMImpl_ITransformOperations.cxx -SOURCES += GEOMImpl_IHealingOperations.cxx -SOURCES += GEOMImpl_I3DPrimOperations.cxx -SOURCES += GEOMImpl_IShapesOperations.cxx -SOURCES += GEOMImpl_IBlocksOperations.cxx -SOURCES += GEOMImpl_IBooleanOperations.cxx -SOURCES += GEOMImpl_ICurvesOperations.cxx -SOURCES += GEOMImpl_ILocalOperations.cxx -SOURCES += GEOMImpl_IInsertOperations.cxx -SOURCES += GEOMImpl_IMeasureOperations.cxx -SOURCES += GEOMImpl_IGroupOperations.cxx -SOURCES += GEOMImpl_Gen.cxx -SOURCES += GEOMImpl_PointDriver.cxx -SOURCES += GEOMImpl_VectorDriver.cxx -SOURCES += GEOMImpl_LineDriver.cxx -SOURCES += GEOMImpl_PlaneDriver.cxx -SOURCES += GEOMImpl_MarkerDriver.cxx -SOURCES += GEOMImpl_TranslateDriver.cxx -SOURCES += GEOMImpl_MirrorDriver.cxx -SOURCES += GEOMImpl_OffsetDriver.cxx -SOURCES += GEOMImpl_ScaleDriver.cxx -SOURCES += GEOMImpl_PositionDriver.cxx -SOURCES += GEOMImpl_BoxDriver.cxx -SOURCES += GEOMImpl_ConeDriver.cxx -SOURCES += GEOMImpl_CylinderDriver.cxx -SOURCES += GEOMImpl_SphereDriver.cxx -SOURCES += GEOMImpl_TorusDriver.cxx -SOURCES += GEOMImpl_PrismDriver.cxx -SOURCES += GEOMImpl_PipeDriver.cxx -SOURCES += GEOMImpl_ThruSectionsDriver.cxx -SOURCES += GEOMImpl_RevolutionDriver.cxx -SOURCES += GEOMImpl_ShapeDriver.cxx -SOURCES += GEOMImpl_BlockDriver.cxx -SOURCES += GEOMImpl_Block6Explorer.cxx -SOURCES += GEOMImpl_MeasureDriver.cxx -SOURCES += GEOMImpl_PolylineDriver.cxx -SOURCES += GEOMImpl_CircleDriver.cxx -SOURCES += GEOMImpl_EllipseDriver.cxx -SOURCES += GEOMImpl_ArcDriver.cxx -SOURCES += GEOMImpl_SplineDriver.cxx -SOURCES += GEOMImpl_SketcherDriver.cxx -SOURCES += GEOMImpl_FilletDriver.cxx -SOURCES += GEOMImpl_Fillet2dDriver.cxx -SOURCES += GEOMImpl_ChamferDriver.cxx -SOURCES += GEOMImpl_BooleanDriver.cxx -SOURCES += GEOMImpl_PartitionDriver.cxx -SOURCES += GEOMImpl_CopyDriver.cxx -SOURCES += GEOMImpl_ExportDriver.cxx -SOURCES += GEOMImpl_ImportDriver.cxx -SOURCES += GEOMImpl_RotateDriver.cxx -SOURCES += GEOMImpl_ArchimedeDriver.cxx -SOURCES += GEOMImpl_HealingDriver.cxx -SOURCES += GEOMImpl_FillingDriver.cxx -SOURCES += GEOMImpl_GlueDriver.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx index ccf53fdfb..5c00c4655 100755 --- a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx @@ -1,18 +1,17 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2007-2012 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 +// 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 +// +// 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 +// 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 @@ -70,24 +69,31 @@ Standard_Integer GEOMImpl_3DSketcherDriver::Execute(TFunction_Logbook& log) cons TopoDS_Shape aShape; Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates(); - - BRepBuilderAPI_MakePolygon aMakePoly; int anArrayLength = aCoordsArray->Length(); - double x, y, z; - gp_Pnt aPnt; - for (int i = 0; i <=(anArrayLength - 3); i+=3) { - x = aCoordsArray->Value(i+1); - y = aCoordsArray->Value(i+2); - z = aCoordsArray->Value(i+3); - aPnt = gp_Pnt(x, y, z); - aMakePoly.Add(aPnt); + + std::list points; + + for (int i = 0; i <= (anArrayLength-3); i += 3) { + gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); + if (points.empty() || aPnt.Distance(points.back()) > gp::Resolution()) + points.push_back(aPnt); } - if ( anArrayLength == 3) { // Only Start Point - BRepBuilderAPI_MakeVertex mkVertex (aPnt); + + if ( points.size() == 1) { // Only Start Point + BRepBuilderAPI_MakeVertex mkVertex (points.back()); aShape = mkVertex.Shape(); } - else { // Make Wire - if (aCoordsArray->Value(1) == x && aCoordsArray->Value(2) == y && aCoordsArray->Value(3) == z) + else if ( points.size() > 1) { // Make Wire + BRepBuilderAPI_MakePolygon aMakePoly; + std::list::iterator it; + for (it = points.begin(); it != points.end(); ++it) { + aMakePoly.Add(*it); + } + + if (points.size() > 2 && + points.back().X() == points.front().X() && + points.back().Y() == points.front().Y() && + points.back().Z() == points.front().Z()) aMakePoly.Close(); if (aMakePoly.IsDone()) @@ -119,10 +125,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_3DSketcherDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_3DSketcherDriver", - sizeof(GEOMImpl_3DSketcherDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_3DSketcherDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx index f0f2476f8..0bf85bd21 100755 --- a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx @@ -1,25 +1,25 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2007-2012 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 +// 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 +// +// 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 +// 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 // + // File : GEOMImpl_3DSketcherDriver.ixx // Module : GEOMImpl - +// #ifndef _GEOMImpl_3DSketcherDriver_HeaderFile #define _GEOMImpl_3DSketcherDriver_HeaderFile diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx index ad099022f..77ec4b0ba 100644 --- a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -129,24 +130,24 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const GC_MakeArcOfCircle arc (aGeomCirc->Circ(), aP2, aP3, Standard_True); aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); } else if ( aType == ELLIPSE_ARC_CENTER_TWO_PNT ) { // ELLIPSE_ARC_CENTER_TWO_PNT - if ( aP1.Distance(aP2) <= aP1.Distance(aP3) ) { - // Standard_ConstructionError::Raise("Arc creation aborted: the distance from Center Point to Point 1 needs to be bigger than the distance from Center Point to Point 2"); - cout << "aP1.Distance(aP2) <= aP1.Distance(aP3)" << endl; - gp_Pnt aTmpP = aP2; - aP2 = aP3; - aP3 = aTmpP; - } - - GC_MakeEllipse ellipse (aP2, aP3, aP1); - Handle(Geom_Ellipse) aGeomEllipse = ellipse.Value(); - - gp_Vec aV1 (aP1, aP2); - gp_Vec aV2 (aP1, aP3); - - double alpha = fabs(aV1.Angle(aV2)); - - GC_MakeArcOfEllipse arc (aGeomEllipse->Elips(), aP2, aP3, Standard_True); - aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); + if ( aP1.Distance(aP2) <= aP1.Distance(aP3) ) { + // Standard_ConstructionError::Raise("Arc creation aborted: the distance from Center Point to Point 1 needs to be bigger than the distance from Center Point to Point 2"); + cout << "aP1.Distance(aP2) <= aP1.Distance(aP3)" << endl; + gp_Pnt aTmpP = aP2; + aP2 = aP3; + aP3 = aTmpP; + } + + GC_MakeEllipse ellipse (aP2, aP3, aP1); + Handle(Geom_Ellipse) aGeomEllipse = ellipse.Value(); + +// gp_Vec aV1 (aP1, aP2); +// gp_Vec aV2 (aP1, aP3); +// +// double alpha = fabs(aV1.Angle(aV2)); + + GC_MakeArcOfEllipse arc (aGeomEllipse->Elips(), aP2, aP3, Standard_True); + aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); } } } @@ -179,10 +180,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ArcDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ArcDriver", - sizeof(GEOMImpl_ArcDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ArcDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.hxx b/src/GEOMImpl/GEOMImpl_ArcDriver.hxx index 4e84d5292..ccd0f06d5 100644 --- a/src/GEOMImpl/GEOMImpl_ArcDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ArcDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx index 9997cf2a7..33ac44dcc 100644 --- a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx @@ -1,30 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOMImpl_ArchimedeDriver.hxx" #include "GEOMImpl_IArchimede.hxx" #include "GEOMImpl_Types.hxx" #include "Archimede_VolumeSection.hxx" +#include + #include #include @@ -41,7 +44,6 @@ #include -using namespace std; //======================================================================= //function : GetID @@ -128,7 +130,11 @@ Standard_Integer GEOMImpl_ArchimedeDriver::Execute(TFunction_Logbook& log) const Standard_Real u1,u2,v1,v2; SurfaceTrimmee->Bounds(u1,u2,v1,v2); +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + TopoDS_Face tirant = BRepBuilderAPI_MakeFace(SurfaceTrimmee, u1, u2, v1, v2, Precision::Confusion()); +#else TopoDS_Face tirant = BRepBuilderAPI_MakeFace(SurfaceTrimmee, u1, u2, v1, v2); +#endif if (tirant.IsNull()) { StdFail_NotDone::Raise("Failed to build secant face"); @@ -159,10 +165,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ArchimedeDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ArchimedeDriver", - sizeof(GEOMImpl_ArchimedeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ArchimedeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -182,7 +188,5 @@ const Handle(GEOMImpl_ArchimedeDriver) Handle(GEOMImpl_ArchimedeDriver)::DownCas } } - return _anOtherObject ; + return _anOtherObject; } - - diff --git a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx index 1fb7839be..881ab28b3 100644 --- a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ArchimedeDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx index 68e3983d9..93af8d28b 100644 --- a/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx +++ b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -27,6 +28,8 @@ #include "utilities.h" +#include + #include #include #include @@ -61,8 +64,11 @@ #include #include +#include + #include #include +#include #include #include @@ -75,6 +81,8 @@ #define NBEDGES 12 #define NBVERTS 8 +#define PLANAR_FACE_MAX_TOLERANCE 1e-06 + static Standard_Integer mod4 (Standard_Integer nb) { if (nb <= 0) return nb + 4; @@ -983,6 +991,19 @@ void GEOMImpl_Block6Explorer::InitByTwoFaces (const TopoDS_Shape& theFace1, myEdges(edge_id(2, i)) = anEdges2(nb); } + // check the wires closure + TopoDS_Wire wire1 = TopoDS::Wire(aWire1); + TopoDS_Wire wire2 = TopoDS::Wire(aWire2); + TopoDS_Vertex aV1, aV2; + + TopExp::Vertices(wire1, aV1, aV2); + if (!aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2)) + aWire1.Closed(true); + + TopExp::Vertices(wire2, aV1, aV2); + if (!aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2)) + aWire2.Closed(true); + // 4. Generate side surface if (!aWire1.Closed() || !aWire2.Closed()) { // BRepOffsetAPI_ThruSections is not applicable on not closed wires @@ -1180,131 +1201,235 @@ Standard_Integer GEOMImpl_Block6Explorer::FindFace //function : MakeFace //purpose : //======================================================================= -void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire, - const Standard_Boolean isPlanarWanted, - TopoDS_Shape& theResult) +TCollection_AsciiString GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire, + const Standard_Boolean isPlanarWanted, + TopoDS_Shape& theResult) { - // try to build face on plane or on any surface under the edges of the wire - BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted); - if (MK.IsDone()) { - theResult = MK.Shape(); - return; - } + if (!isPlanarWanted) + return MakeAnyFace(theWire, theResult); - if (!isPlanarWanted) { - // try to construct filling surface - BRepOffsetAPI_MakeFilling MF; + // Try to build a planar face. - Standard_Integer nbEdges = 0; - BRepTools_WireExplorer aWE (theWire); - for (; aWE.More(); aWE.Next(), nbEdges++) { - MF.Add(TopoDS::Edge(aWE.Current()), GeomAbs_C0); - } + // If required tolerance increase will be + // higher than PLANAR_FACE_MAX_TOLERANCE, + // we will try to build a non-planar face. - MF.Build(); - if (MF.IsDone()) { - // Result of filling - TopoDS_Shape aFace = MF.Shape(); - - // 12.04.2006 for PAL12149 begin - Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aFace)); - BRepBuilderAPI_MakeFace MK1 (aGS, theWire); - if (MK1.IsDone()) { - TopoDS_Shape aFace1 = MK1.Shape(); - - BRepCheck_Analyzer ana (aFace1, false); - if (!ana.IsValid()) { - TopoDS_Shape aFace2; - ShHealOper_ShapeProcess aHealer; - aHealer.Perform(aFace1, aFace2); - if (aHealer.isDone()) - theResult = aFace2; - } - } - // 12.04.2006 for PAL12149 end + TCollection_AsciiString aWarning; - if (theResult.IsNull()) { // try to deal with pure result of filling - // Update tolerance - Standard_Real aTol = MF.G0Error(); + // Workaround for Mantis issue 0020956 - TColgp_Array1OfPnt aPnts (1,nbEdges); // points of the given wire - BRepTools_WireExplorer aWE1 (theWire); - Standard_Integer vi = 1; - for (; aWE1.More() && vi <= nbEdges; aWE1.Next(), vi++) { - aPnts(vi) = BRep_Tool::Pnt(TopoDS::Vertex(aWE1.CurrentVertex())); - } + // Count the number of points in the wire. + // Collect the first three points. + gp_Pnt p1, p2, p3; + bool is3Pnts (false); + bool p1set(false), p2set(false), p3set(false); + BRepTools_WireExplorer wexpl (theWire); + for (; wexpl.More(); wexpl.Next()) { + if (!p1set) { + p1set = true; + p1 = BRep_Tool::Pnt(wexpl.CurrentVertex()); + } + else if (!p2set) { + p2set = true; + p2 = BRep_Tool::Pnt(wexpl.CurrentVertex()); + } + else if (!p3set) { + p3set = true; + is3Pnts = true; + p3 = BRep_Tool::Pnt(wexpl.CurrentVertex()); + } + else { + is3Pnts = false; + break; + } + } - // Find maximum deviation in vertices - TopExp_Explorer exp (aFace, TopAbs_VERTEX); - TopTools_MapOfShape mapShape; - for (; exp.More(); exp.Next()) { - if (mapShape.Add(exp.Current())) { - TopoDS_Vertex aV = TopoDS::Vertex(exp.Current()); - Standard_Real aTolV = BRep_Tool::Tolerance(aV); - gp_Pnt aP = BRep_Tool::Pnt(aV); - Standard_Real min_dist = aP.Distance(aPnts(1)); - for (vi = 2; vi <= nbEdges; vi++) { - min_dist = Min(min_dist, aP.Distance(aPnts(vi))); - } - aTol = Max(aTol, aTolV); - aTol = Max(aTol, min_dist); - } - } + // Construct a plane for the case of three points in the wire. + gp_Pln plane; + if (is3Pnts) { + gce_MakePln mkPln (p1, p2, p3); + if (mkPln.IsDone()) { + plane = mkPln.Value(); + } + else { + is3Pnts = false; + } + } - if ((*((Handle(BRep_TFace)*)&aFace.TShape()))->Tolerance() < aTol) { - (*((Handle(BRep_TFace)*)&aFace.TShape()))->Tolerance(aTol); - } - theResult = aFace; - } + // Construct a face based on the plane (in case of three points in the wire) or + // allow MakeFace to build the plane itself (in case of the number of points is greater than 3). + if (is3Pnts) { + BRepBuilderAPI_MakeFace MK (plane, theWire, isPlanarWanted); + if (MK.IsDone()) { + theResult = MK.Shape(); + return aWarning; } - } else { - // try to update wire tolerances to build a planar face + } + else { + BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted); + if (MK.IsDone()) { + theResult = MK.Shape(); + return aWarning; + } + } + + // try to update wire tolerances to build a planar face -#if 1 //(OCC_VERSION_MAJOR < 6) || (OCC_VERSION_MAJOR == 6 && OCC_VERSION_MINOR <= 1) - // Find a deviation - Standard_Real aToleranceReached, aTol; - BRepLib_FindSurface aFS; - aFS.Init(theWire, -1., isPlanarWanted); + // Find a deviation + Standard_Real aToleranceReached, aTol; + BRepLib_FindSurface aFS; + aFS.Init(theWire, -1., isPlanarWanted); + aToleranceReached = aFS.ToleranceReached(); + aTol = aFS.Tolerance(); + + if (!aFS.Found()) { + aFS.Init(theWire, aToleranceReached, isPlanarWanted); + if (!aFS.Found()) return aWarning; aToleranceReached = aFS.ToleranceReached(); aTol = aFS.Tolerance(); + } + aTol = Max(1.2 * aToleranceReached, aTol); + + // Mantis issue 0021432: EDF GEOM: Faces with huge tolerance can be built in GEOM + if (aTol > PLANAR_FACE_MAX_TOLERANCE) { + aWarning = MakeAnyFace(theWire, theResult); + if (aWarning.IsEmpty() && !theResult.IsNull()) + aWarning = "MAKE_FACE_TOLERANCE_TOO_BIG"; + return aWarning; + } - if (!aFS.Found()) { - aFS.Init(theWire, aToleranceReached, isPlanarWanted); - if (!aFS.Found()) return; - aToleranceReached = aFS.ToleranceReached(); - aTol = aFS.Tolerance(); - } - aTol = Max(1.2 * aToleranceReached, aTol); - - // Copy the wire, bacause it can be updated with very-very big tolerance here - BRepBuilderAPI_Copy aMC (theWire); - if (!aMC.IsDone()) return; - TopoDS_Wire aWire = TopoDS::Wire(aMC.Shape()); - // Update tolerances to - BRep_Builder B; - for (TopExp_Explorer expE (aWire, TopAbs_EDGE); expE.More(); expE.Next()) { - TopoDS_Edge anE = TopoDS::Edge(expE.Current()); - B.UpdateEdge(anE, aTol); + // Copy the wire, bacause it can be updated with very-very big tolerance here + BRepBuilderAPI_Copy aMC (theWire); + if (!aMC.IsDone()) return aWarning; + TopoDS_Wire aWire = TopoDS::Wire(aMC.Shape()); + // Update tolerances to + BRep_Builder B; + for (TopExp_Explorer expE (aWire, TopAbs_EDGE); expE.More(); expE.Next()) { + TopoDS_Edge anE = TopoDS::Edge(expE.Current()); + B.UpdateEdge(anE, aTol); + } + for (TopExp_Explorer expV (aWire, TopAbs_VERTEX); expV.More(); expV.Next()) { + TopoDS_Vertex aV = TopoDS::Vertex(expV.Current()); + B.UpdateVertex(aV, aTol); + } + //BRepLib::UpdateTolerances(aWire); + // Build face + BRepBuilderAPI_MakeFace MK1 (aWire, isPlanarWanted); + if (MK1.IsDone()) { + theResult = MK1.Shape(); + // Mantis issue 0021432: EDF GEOM: Faces with huge tolerance can be built in GEOM + //if (aTol > PLANAR_FACE_MAX_TOLERANCE) + // aWarning = "MAKE_FACE_TOLERANCE_TOO_BIG"; + } + + return aWarning; +} + +//======================================================================= +//function : MakeAnyFace +//purpose : +//======================================================================= +TCollection_AsciiString GEOMImpl_Block6Explorer::MakeAnyFace (const TopoDS_Wire& theWire, + TopoDS_Shape& theResult) +{ + TCollection_AsciiString aWarning; + + // try to build a face on any surface under the edges of the wire + BRepBuilderAPI_MakeFace MK (theWire, Standard_False); + if (MK.IsDone()) { + theResult = MK.Shape(); + return aWarning; + } + + // try to construct filling surface + BRepOffsetAPI_MakeFilling MF; + + Standard_Integer nbEdges = 0; + BRepTools_WireExplorer aWE (theWire); + for (; aWE.More(); aWE.Next(), nbEdges++) { + MF.Add(TopoDS::Edge(aWE.Current()), GeomAbs_C0); + } + + MF.Build(); + if (!MF.IsDone()) { + aWarning = "BRepOffsetAPI_MakeFilling failed"; + return aWarning; + } + + // Result of filling + TopoDS_Shape aFace = MF.Shape(); + + // 12.04.2006 for PAL12149 begin + Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aFace)); + +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN +// the following block, when enabled, leads to extra vertices generation by partition algorithm +// in some cases, for example when fillet is made on a PipeTShape +//#if OCC_VERSION_LARGE > 0x06050200 +#if 0 +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END + BRep_Builder BB; + TopoDS_Iterator itw(theWire); + for (; itw.More(); itw.Next()) + { + const TopoDS_Edge& anEdge = TopoDS::Edge(itw.Value()); + TopoDS_Edge NewEdge = TopoDS::Edge(MF.Generated(anEdge).First()); + Standard_Real fpar, lpar; + Handle(Geom2d_Curve) NewPCurve = BRep_Tool::CurveOnSurface(NewEdge, TopoDS::Face(aFace), fpar, lpar); + TopLoc_Location aLoc; + Standard_Real NewTol = BRep_Tool::Tolerance(NewEdge); + BB.UpdateEdge(anEdge, NewPCurve, aGS, aLoc, NewTol); + } +#endif + + BRepBuilderAPI_MakeFace MK1 (aGS, theWire); + if (MK1.IsDone()) { + TopoDS_Shape aFace1 = MK1.Shape(); + + BRepCheck_Analyzer ana (aFace1, false); + if (!ana.IsValid()) { + TopoDS_Shape aFace2; + ShHealOper_ShapeProcess aHealer; + aHealer.Perform(aFace1, aFace2); + if (aHealer.isDone()) + theResult = aFace2; } - for (TopExp_Explorer expV (aWire, TopAbs_VERTEX); expV.More(); expV.Next()) { - TopoDS_Vertex aV = TopoDS::Vertex(expV.Current()); - B.UpdateVertex(aV, aTol); + } + // 12.04.2006 for PAL12149 end + + if (theResult.IsNull()) { // try to deal with pure result of filling + // Update tolerance + Standard_Real aTol = MF.G0Error(); + + TColgp_Array1OfPnt aPnts (1,nbEdges); // points of the given wire + BRepTools_WireExplorer aWE1 (theWire); + Standard_Integer vi = 1; + for (; aWE1.More() && vi <= nbEdges; aWE1.Next(), vi++) { + aPnts(vi) = BRep_Tool::Pnt(TopoDS::Vertex(aWE1.CurrentVertex())); } - //BRepLib::UpdateTolerances(aWire); - // Build face - BRepBuilderAPI_MakeFace MK1 (aWire, isPlanarWanted); - if (MK1.IsDone()) { - theResult = MK1.Shape(); - return; + + // Find maximum deviation in vertices + TopExp_Explorer exp (aFace, TopAbs_VERTEX); + TopTools_MapOfShape mapShape; + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Vertex aV = TopoDS::Vertex(exp.Current()); + Standard_Real aTolV = BRep_Tool::Tolerance(aV); + gp_Pnt aP = BRep_Tool::Pnt(aV); + Standard_Real min_dist = aP.Distance(aPnts(1)); + for (vi = 2; vi <= nbEdges; vi++) { + min_dist = Min(min_dist, aP.Distance(aPnts(vi))); + } + aTol = Max(aTol, aTolV); + aTol = Max(aTol, min_dist); + } } -#else // After migration on OCCT version, containing PKV's fix. See bug 8293 - BRepLib_MakeFace aBMF; - aBMF.Init(theWire, isPlanarWanted, Standard_True); - if (aBMF.Error() == BRepLib_FaceDone) { - theResult = aBMF.Shape(); - return; + if ((*((Handle(BRep_TFace)*)&aFace.TShape()))->Tolerance() < aTol) { + (*((Handle(BRep_TFace)*)&aFace.TShape()))->Tolerance(aTol); } -#endif + theResult = aFace; } + + return aWarning; } diff --git a/src/GEOMImpl/GEOMImpl_Block6Explorer.hxx b/src/GEOMImpl/GEOMImpl_Block6Explorer.hxx index 3ad008aed..9684e465d 100644 --- a/src/GEOMImpl/GEOMImpl_Block6Explorer.hxx +++ b/src/GEOMImpl/GEOMImpl_Block6Explorer.hxx @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_Block6Explorer.hxx // Module : GEOMImpl -// + #ifndef GEOMImpl_Block6Explorer_HeaderFile #define GEOMImpl_Block6Explorer_HeaderFile @@ -29,6 +30,7 @@ #include #include #include +#include #include // Class GEOMImpl_Block6Explorer gives easy and fast access to a certain sub-elements of hexahedral solid @@ -213,9 +215,27 @@ class GEOMImpl_Block6Explorer const Standard_Boolean findAll = Standard_False); // returns number of found faces - static void MakeFace (const TopoDS_Wire& theWire, - const Standard_Boolean isPlanarWanted, - TopoDS_Shape& theResult); + /*! + * Build a face, bound by the given wire. + * \param theWire The initial wire to build the face on. + * \param isPlanarWanted If true, try to build a planar face. + * \note If isPlanarWanted is true, but planar face cannot be built + * with acceptable tolerance, any face will be built. + * \param theResult The resulting shape. + * \return Error or warning description. Empty string in case of success. + */ + static TCollection_AsciiString MakeFace (const TopoDS_Wire& theWire, + const Standard_Boolean isPlanarWanted, + TopoDS_Shape& theResult); + + /*! + * Build a face, bound by the given wire. + * \param theWire The initial wire to build the face on. + * \param theResult The resulting shape. + * \return Error or warning description. Empty string in case of success. + */ + static TCollection_AsciiString MakeAnyFace (const TopoDS_Wire& theWire, + TopoDS_Shape& theResult); private: // ---------- PRIVATE FIELDS ---------- diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx index 7a98359ac..95c2dbf08 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 #include @@ -36,13 +36,14 @@ #include #include -#include +//#include #include #include "utilities.h" #include +#include #include #include #include @@ -82,6 +83,9 @@ #include +#include +#include + #include #include #include @@ -234,7 +238,14 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const ("Impossible to build a connected wire from the given edges"); } TopoDS_Wire aWire = *MW; - delete MW; + delete MW; + + // check the wire closure + TopoDS_Vertex aV1, aV2; + TopExp::Vertices(aWire, aV1, aV2); + if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) ) + aWire.Closed( true ); + if (!aWire.Closed()) { Standard_ConstructionError::Raise ("Impossible to build a closed wire from the given edges"); @@ -263,16 +274,26 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const // create two edges, linking ends of the given edges TopoDS_Vertex V11, V12, V21, V22; - TopExp::Vertices(anEdge1, V11, V12, Standard_True); - TopExp::Vertices(anEdge2, V21, V22, Standard_True); + TopExp::Vertices(anEdge1, V11, V12, Standard_False); + TopExp::Vertices(anEdge2, V21, V22, Standard_False); if (V11.IsNull() || V12.IsNull() || V21.IsNull() || V22.IsNull()) { Standard_NullObject::Raise("Bad edge for face construction: vertex is not defined"); } - gp_Pnt P11 = BRep_Tool::Pnt(V11); - gp_Pnt P12 = BRep_Tool::Pnt(V12); - gp_Pnt P21 = BRep_Tool::Pnt(V21); - gp_Pnt P22 = BRep_Tool::Pnt(V22); + + BRepAdaptor_Curve C1 (anEdge1); + BRepAdaptor_Curve C2 (anEdge2); + gp_Pnt P11, P12, P21, P22; + + // Mantis issue 0020599: Creation of a quadrangle face from 2 edges: SIGSEGV + P11 = C1.Value(C1.FirstParameter()); + P12 = C1.Value(C1.LastParameter()); + P21 = C2.Value(C2.FirstParameter()); + P22 = C2.Value(C2.LastParameter()); + //gp_Pnt P11 = BRep_Tool::Pnt(V11); + //gp_Pnt P12 = BRep_Tool::Pnt(V12); + //gp_Pnt P21 = BRep_Tool::Pnt(V21); + //gp_Pnt P22 = BRep_Tool::Pnt(V22); if (P11.Distance(P21) < prec || P12.Distance(P22) < prec || P11.Distance(P22) < prec || P12.Distance(P21) < prec) { @@ -282,24 +303,70 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const Standard_Real per11 = P11.Distance(P21) + P12.Distance(P22); Standard_Real per12 = P11.Distance(P22) + P12.Distance(P21); + BRep_Builder BB; + TopoDS_Edge anEdge3; TopoDS_Edge anEdge4; + + // Mantis issue 0020599: Creation of a quadrangle face from 2 edges: SIGSEGV if (per11 < per12) { - anEdge3 = BRepBuilderAPI_MakeEdge(V11, V21); - anEdge4 = BRepBuilderAPI_MakeEdge(V12, V22); - } else { - anEdge3 = BRepBuilderAPI_MakeEdge(V11, V22); - anEdge4 = BRepBuilderAPI_MakeEdge(V12, V21); + Handle(Geom_Line) Line1 = GC_MakeLine(P11, P21).Value(); + Handle(Geom_Line) Line2 = GC_MakeLine(P12, P22).Value(); + + BB.MakeEdge(anEdge3, Line1, Precision::Confusion()); + BB.Range(anEdge3, 0., P11.Distance(P21)); + BB.Add(anEdge3, V11.Oriented(TopAbs_FORWARD)); + BB.Add(anEdge3, V21.Oriented(TopAbs_REVERSED)); + + BB.MakeEdge(anEdge4, Line2, Precision::Confusion()); + BB.Range(anEdge4, 0., P12.Distance(P22)); + BB.Add(anEdge4, V12.Oriented(TopAbs_FORWARD)); + BB.Add(anEdge4, V22.Oriented(TopAbs_REVERSED)); + } + else { + Handle(Geom_Line) Line1 = GC_MakeLine(P11, P22).Value(); + Handle(Geom_Line) Line2 = GC_MakeLine(P12, P21).Value(); + + BB.MakeEdge(anEdge3, Line1, Precision::Confusion()); + BB.Range(anEdge3, 0., P11.Distance(P22)); + BB.Add(anEdge3, V11.Oriented(TopAbs_FORWARD)); + BB.Add(anEdge3, V22.Oriented(TopAbs_REVERSED)); + + BB.MakeEdge(anEdge4, Line2, Precision::Confusion()); + BB.Range(anEdge4, 0., P12.Distance(P21)); + BB.Add(anEdge4, V12.Oriented(TopAbs_FORWARD)); + BB.Add(anEdge4, V21.Oriented(TopAbs_REVERSED)); } + //if (per11 < per12) { + // anEdge3 = BRepBuilderAPI_MakeEdge(V11, V21); + // anEdge4 = BRepBuilderAPI_MakeEdge(V12, V22); + //} else { + // anEdge3 = BRepBuilderAPI_MakeEdge(V11, V22); + // anEdge4 = BRepBuilderAPI_MakeEdge(V12, V21); + //} // build a wire - BRepBuilderAPI_MakeWire MW (anEdge1, anEdge3, anEdge2, anEdge4); - if (!MW.IsDone()) { + BRepBuilderAPI_MakeWire* MW; + MW = new BRepBuilderAPI_MakeWire(anEdge1, anEdge3, anEdge2, anEdge4); + if (!MW->IsDone()) { Standard_ConstructionError::Raise("Wire construction failed"); } + TopoDS_Wire aWire = *MW; + delete MW; + + TopoDS_Vertex aV1, aV2; + TopExp::Vertices(aWire, aV1, aV2); + if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) ) + aWire.Closed( true ); + + if (!aWire.Closed()) { + Standard_ConstructionError::Raise + ("Impossible to build a closed wire from the given edges"); + } + // try to build face on the wire - GEOMImpl_Block6Explorer::MakeFace(MW, Standard_False, aShape); + GEOMImpl_Block6Explorer::MakeFace(aWire, Standard_False, aShape); if (aShape.IsNull()) { Standard_ConstructionError::Raise("Face construction failed"); } @@ -357,6 +424,7 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const } // try to build face on the wire + aMkPoly.Close(); GEOMImpl_Block6Explorer::MakeFace(aMkPoly, Standard_False, aShape); if (aShape.IsNull()) { Standard_ConstructionError::Raise("Face construction failed"); @@ -367,7 +435,6 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const BRepTools_Quilt Glue; if (aType == BLOCK_SIX_FACES) { - // Make block (hexahedral solid) from six faces for (Standard_Integer ind = 1; ind <= nbshapes; ind++) { if (anArgs(ind).ShapeType() != TopAbs_FACE) { @@ -376,8 +443,8 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const Glue.Add(anArgs(ind)); } - } else { - + } + else { // Make block (hexahedral solid) from two opposite faces if (anArgs(1).ShapeType() != TopAbs_FACE || anArgs(2).ShapeType() != TopAbs_FACE) { @@ -461,9 +528,8 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const } aShape = Sol; BRepLib::SameParameter(aShape, 1.E-5, Standard_True); - - } else if (aType == BLOCK_COMPOUND_GLUE) { - + } + else if (aType == BLOCK_COMPOUND_GLUE) { // Make blocks compound from a compound if (anArgs(1).ShapeType() != TopAbs_COMPOUND && anArgs(2).ShapeType() != TopAbs_COMPSOLID) { @@ -472,23 +538,15 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aCompound = anArgs(1); - // Glue coincident faces and edges (with Partition algorithm). - //NMTAlgo_Splitter1 PS; - //PS.AddShape(aCompound); - //PS.Compute(); - //PS.SetRemoveWebs(Standard_False); - // PS.Build(aCompound.ShapeType()); - //PS.Build(TopAbs_SOLID); - //aShape = PS.Shape(); - - GEOMAlgo_Gluer aGluer; - aGluer.SetShape(aCompound); - aGluer.SetCheckGeometry(Standard_True); - aGluer.Perform(); - aShape = aGluer.Result(); - - - } else { + // Glue coincident faces and edges + aShape = GEOMImpl_GlueDriver::GlueFaces(aCompound, Precision::Confusion(), Standard_True); + //GEOMAlgo_Gluer aGluer; + //aGluer.SetShape(aCompound); + //aGluer.SetCheckGeometry(Standard_True); + //aGluer.Perform(); + //aShape = aGluer.Result(); + } + else { } } else { // Multi-transformations and compound improving @@ -503,9 +561,16 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("Null Shape given"); } + // Copy shape to avoid problems (Mantis issue 0021683) + TopoDS_Shape aShapeCopy; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TNaming_CopyShape::CopyTool(aBlockOrComp, aMapTShapes, aShapeCopy); + aBlockOrComp = aShapeCopy; + // 1. Improve solids with seam and/or degenerated edges BlockFix_BlockFixAPI aTool; //aTool.Tolerance() = toler; + aTool.OptimumNbFaces() = aCI.GetOptimumNbFaces(); aTool.SetShape(aBlockOrComp); aTool.Perform(); @@ -1012,7 +1077,8 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_BlockDriver_Type_() //function : DownCast //purpose : //======================================================================= -const Handle(GEOMImpl_BlockDriver) Handle(GEOMImpl_BlockDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +const Handle(GEOMImpl_BlockDriver) Handle(GEOMImpl_BlockDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_BlockDriver) _anOtherObject; @@ -1022,5 +1088,5 @@ const Handle(GEOMImpl_BlockDriver) Handle(GEOMImpl_BlockDriver)::DownCast(const } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.hxx b/src/GEOMImpl/GEOMImpl_BlockDriver.hxx index 9037bbecf..49d78409b 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_BlockDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index bf82f5136..1582f9126 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -1,36 +1,44 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include #include #include #include +#include + +#include +#include + #include #include #include #include #include #include +#include + #include #include #include @@ -38,10 +46,10 @@ #include #include #include + +#include + #include -#include -#include -#include #include #include @@ -56,7 +64,6 @@ const Standard_GUID& GEOMImpl_BooleanDriver::GetID() return aBooleanDriver; } - //======================================================================= //function : GEOMImpl_BooleanDriver //purpose : @@ -93,7 +100,7 @@ void AddSimpleShapes(TopoDS_Shape theShape, TopTools_ListOfShape& theList) //function : Execute //purpose : //======================================================================= -Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const +Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const { if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); @@ -107,7 +114,15 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) aRefShape2 = aCI.GetShape2(); TopoDS_Shape aShape1 = aRefShape1->GetValue(); TopoDS_Shape aShape2 = aRefShape2->GetValue(); + if (!aShape1.IsNull() && !aShape2.IsNull()) { + // check arguments for Mantis issue 0021019 + BRepCheck_Analyzer ana (aShape1, Standard_True); + if (!ana.IsValid()) + StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); + ana.Init(aShape2); + if (!ana.IsValid()) + StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); // perform COMMON operation if (aType == BOOLEAN_COMMON) { @@ -363,6 +378,11 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const // we obtain BSpline curve of degree 1 (C0), which is slowly // processed by some algorithms (Partition for example). BO.Approximation(Standard_True); + //modified by NIZNHY-PKV Tue Oct 18 14:34:16 2011f + BO.ComputePCurveOn1(Standard_True); + BO.ComputePCurveOn2(Standard_True); + //modified by NIZNHY-PKV Tue Oct 18 14:34:18 2011t + BO.Build(); if (!BO.IsDone()) { StdFail_NotDone::Raise("Section operation can not be performed on the given shapes"); @@ -410,6 +430,15 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const if (aShape.IsNull()) return 0; + // as boolean operations always produce compound, lets simplify it + // for the case, if it contains only one sub-shape + TopTools_ListOfShape listShapeRes; + AddSimpleShapes(aShape, listShapeRes); + if (listShapeRes.Extent() == 1) { + aShape = listShapeRes.First(); + if (aShape.IsNull()) return 0; + } + // 08.07.2008 skl for bug 19761 from Mantis BRepCheck_Analyzer ana (aShape, Standard_True); ana.Init(aShape); @@ -428,6 +457,88 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const // Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result"); //} + // BEGIN: Mantis issue 0021060: always limit tolerance of BOP result + // 1. Get shape parameters for comparison + int nbTypes [TopAbs_SHAPE]; + { + for (int iType = 0; iType < TopAbs_SHAPE; ++iType) + nbTypes[iType] = 0; + nbTypes[aShape.ShapeType()]++; + + TopTools_MapOfShape aMapOfShape; + aMapOfShape.Add(aShape); + TopTools_ListOfShape aListOfShape; + aListOfShape.Append(aShape); + + TopTools_ListIteratorOfListOfShape itL (aListOfShape); + for (; itL.More(); itL.Next()) { + TopoDS_Iterator it (itL.Value()); + for (; it.More(); it.Next()) { + TopoDS_Shape s = it.Value(); + if (aMapOfShape.Add(s)) { + aListOfShape.Append(s); + nbTypes[s.ShapeType()]++; + } + } + } + } + + // 2. Limit tolerance + TopoDS_Shape aShapeCopy; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TNaming_CopyShape::CopyTool(aShape, aMapTShapes, aShapeCopy); + ShapeFix_ShapeTolerance aSFT; + aSFT.LimitTolerance(aShapeCopy, Precision::Confusion(), Precision::Confusion(), TopAbs_SHAPE); + Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy); + aSfs->Perform(); + aShapeCopy = aSfs->Shape(); + + // 3. Check parameters + ana.Init(aShapeCopy); + if (ana.IsValid()) { + int iType, nbTypesCopy [TopAbs_SHAPE]; + + for (iType = 0; iType < TopAbs_SHAPE; ++iType) + nbTypesCopy[iType] = 0; + nbTypesCopy[aShapeCopy.ShapeType()]++; + + TopTools_MapOfShape aMapOfShape; + aMapOfShape.Add(aShapeCopy); + TopTools_ListOfShape aListOfShape; + aListOfShape.Append(aShapeCopy); + + TopTools_ListIteratorOfListOfShape itL (aListOfShape); + for (; itL.More(); itL.Next()) { + TopoDS_Iterator it (itL.Value()); + for (; it.More(); it.Next()) { + TopoDS_Shape s = it.Value(); + if (aMapOfShape.Add(s)) { + aListOfShape.Append(s); + nbTypesCopy[s.ShapeType()]++; + } + } + } + + bool isEqual = true; + for (iType = 0; iType < TopAbs_SHAPE && isEqual; ++iType) { + if (nbTypes[iType] != nbTypesCopy[iType]) + isEqual = false; + } + if (isEqual) + aShape = aShapeCopy; + } + // END: Mantis issue 0021060 + + //Alternative case to check shape result Mantis 0020604: EDF 1172 +/* TopoDS_Iterator It (aShape, Standard_True, Standard_True); + int nbSubshapes=0; + for (; It.More(); It.Next()) + nbSubshapes++; + if (!nbSubshapes) + Standard_ConstructionError::Raise("Boolean operation aborted : result object is empty compound");*/ + //end of 0020604: EDF 1172 + //! the changes temporary commented because of customer needs (see the same mantis bug) + aFunction->SetValue(aShape); log.SetTouched(Label()); @@ -442,7 +553,6 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const //======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_BooleanDriver_Type_() { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); @@ -450,13 +560,12 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_BooleanDriver_Type_() static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BooleanDriver", - sizeof(GEOMImpl_BooleanDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_BooleanDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -470,10 +579,10 @@ const Handle(GEOMImpl_BooleanDriver) Handle(GEOMImpl_BooleanDriver)::DownCast(co Handle(GEOMImpl_BooleanDriver) _anOtherObject; if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BooleanDriver))) { - _anOtherObject = Handle(GEOMImpl_BooleanDriver)((Handle(GEOMImpl_BooleanDriver)&)AnObject); - } + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BooleanDriver))) { + _anOtherObject = Handle(GEOMImpl_BooleanDriver)((Handle(GEOMImpl_BooleanDriver)&)AnObject); + } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx index c8d0cb10a..0ed0fb6b5 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_BooleanDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_BoxDriver.cxx b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx index 48be1001d..5c0b20a6a 100644 --- a/src/GEOMImpl/GEOMImpl_BoxDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -36,6 +37,10 @@ #include +#include + +#include + //======================================================================= //function : GetID //purpose : @@ -88,9 +93,11 @@ Standard_Integer GEOMImpl_BoxDriver::Execute(TFunction_Logbook& log) const gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2)); - if (P1.X() == P2.X() || P1.Y() == P2.Y() || P1.Z() == P2.Z()) { - StdFail_NotDone::Raise("Box can not be created, the points belong to the same plane"); - return 0; + if (std::abs(P1.X() - P2.X()) < Precision::Confusion() || + std::abs(P1.Y() - P2.Y()) < Precision::Confusion() || + std::abs(P1.Z() - P2.Z()) < Precision::Confusion() ) { + StdFail_NotDone::Raise("Box can not be created, the points belong both to one of the OXY, OYZ or OZX planes"); + return 0; } BRepPrimAPI_MakeBox MB (P1,P2); @@ -132,10 +139,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_BoxDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BoxDriver", - sizeof(GEOMImpl_BoxDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_BoxDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_BoxDriver.hxx b/src/GEOMImpl/GEOMImpl_BoxDriver.hxx index ecd3377c4..e719958d1 100644 --- a/src/GEOMImpl/GEOMImpl_BoxDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_BoxDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_BoxDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx index 5a05432e1..d24bce73e 100644 --- a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx @@ -1,37 +1,43 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include #include #include #include -#include #include +#include + +#include #include #include #include +#include +#include + #include #include #include @@ -133,46 +139,47 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const M.FindFromIndex(i).Extent() == 2) fill.Add(aD, E, F); } - }else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) { + } + else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) { // chamfer on edges, common to two faces, with D1 on the first face - + TopoDS_Shape aFace1, aFace2; if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace1(), aFace1) && GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2)) - { - TopoDS_Face F = TopoDS::Face(aFace1); - - // fill map of edges of the second face - TopTools_MapOfShape aMap; - TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE); - for (; Exp2.More(); Exp2.Next()) { - aMap.Add(Exp2.Current()); - } - - // find edges of the first face, common with the second face - TopExp_Explorer Exp (aFace1, TopAbs_EDGE); - for (; Exp.More(); Exp.Next()) { - if (aMap.Contains(Exp.Current())) { - TopoDS_Edge E = TopoDS::Edge(Exp.Current()); - if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) - { - if ( aType == CHAMFER_SHAPE_EDGE ) - { - double aD1 = aCI.GetD1(); - double aD2 = aCI.GetD2(); - fill.Add(aD1, aD2, E, F); - } - else - { - double aD = aCI.GetD(); - double anAngle = aCI.GetAngle(); - if ( (anAngle > 0) && (anAngle < (Standard_PI/2)) ) - fill.AddDA(aD, anAngle, E, F); - } - } - } - } + { + TopoDS_Face F = TopoDS::Face(aFace1); + + // fill map of edges of the second face + TopTools_MapOfShape aMap; + TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE); + for (; Exp2.More(); Exp2.Next()) { + aMap.Add(Exp2.Current()); } + + // find edges of the first face, common with the second face + TopExp_Explorer Exp (aFace1, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + if (aMap.Contains(Exp.Current())) { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); + if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) + { + if ( aType == CHAMFER_SHAPE_EDGE ) + { + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + fill.Add(aD1, aD2, E, F); + } + else + { + double aD = aCI.GetD(); + double anAngle = aCI.GetAngle(); + if ( (anAngle > 0) && (anAngle < (M_PI/2.)) ) + fill.AddDA(aD, anAngle, E, F); + } + } + } + } + } } else if (aType == CHAMFER_SHAPE_FACES || aType == CHAMFER_SHAPE_FACES_AD) { // chamfer on all edges of the selected faces, with D1 on the selected face @@ -187,35 +194,37 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const { TopoDS_Shape aShapeFace; if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace(ind), aShapeFace)) - { - TopoDS_Face F = TopoDS::Face(aShapeFace); - TopExp_Explorer Exp (F, TopAbs_EDGE); - for (; Exp.More(); Exp.Next()) { - if (!aMap.Contains(Exp.Current())) - { - TopoDS_Edge E = TopoDS::Edge(Exp.Current()); - if (!BRepTools::IsReallyClosed(E, F) && - !BRep_Tool::Degenerated(E) && - M.FindFromKey(E).Extent() == 2) - if (aType == CHAMFER_SHAPE_FACES) - { - double aD1 = aCI.GetD1(); - double aD2 = aCI.GetD2(); - fill.Add(aD1, aD2, E, F); - } - else - { - double aD = aCI.GetD(); - double anAngle = aCI.GetAngle(); - if ( (anAngle > 0) && (anAngle < (Standard_PI/2)) ) - fill.AddDA(aD, anAngle, E, F); - } - } - } - } + { + TopoDS_Face F = TopoDS::Face(aShapeFace); + TopExp_Explorer Exp (F, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + if (!aMap.Contains(Exp.Current())) + { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); + if (!BRepTools::IsReallyClosed(E, F) && + !BRep_Tool::Degenerated(E) && + M.FindFromKey(E).Extent() == 2) + { + if (aType == CHAMFER_SHAPE_FACES) + { + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + fill.Add(aD1, aD2, E, F); + } + else + { + double aD = aCI.GetD(); + double anAngle = aCI.GetAngle(); + if ( (anAngle > 0) && (anAngle < (M_PI/2.)) ) + fill.AddDA(aD, anAngle, E, F); + } + } + } + } + } } - } -else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD) + } + else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD) { // chamfer on selected edges with lenght param D1 & D2. @@ -228,25 +237,25 @@ else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD) { TopoDS_Shape aShapeEdge; if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetEdge(ind), aShapeEdge)) - { - TopoDS_Edge E = TopoDS::Edge(aShapeEdge); - const TopTools_ListOfShape& aFacesList = M.FindFromKey(E); - TopoDS_Face F = TopoDS::Face( aFacesList.First() ); - if (aType == CHAMFER_SHAPE_EDGES) - { - double aD1 = aCI.GetD1(); - double aD2 = aCI.GetD2(); - fill.Add(aD1, aD2, E, F); - } - else - { - double aD = aCI.GetD(); - double anAngle = aCI.GetAngle(); - if ( (anAngle > 0) && (anAngle < (Standard_PI/2)) ) - fill.AddDA(aD, anAngle, E, F); - } - } - } + { + TopoDS_Edge E = TopoDS::Edge(aShapeEdge); + const TopTools_ListOfShape& aFacesList = M.FindFromKey(E); + TopoDS_Face F = TopoDS::Face( aFacesList.First() ); + if (aType == CHAMFER_SHAPE_EDGES) + { + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + fill.Add(aD1, aD2, E, F); + } + else + { + double aD = aCI.GetD(); + double anAngle = aCI.GetAngle(); + if ( (anAngle > 0) && (anAngle < (M_PI/2.)) ) + fill.AddDA(aD, anAngle, E, F); + } + } + } } else { } @@ -259,6 +268,17 @@ else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD) if (aShape.IsNull()) return 0; + // reduce tolerances + ShapeFix_ShapeTolerance aSFT; + aSFT.LimitTolerance(aShape, Precision::Confusion(), + Precision::Confusion(), TopAbs_SHAPE); + Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape); + aSfs->Perform(); + aShape = aSfs->Shape(); + + // fix SameParameter flag + BRepLib::SameParameter(aShape, 1.E-5, Standard_True); + aFunction->SetValue(aShape); log.SetTouched(Label()); @@ -273,7 +293,6 @@ else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD) //======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_ChamferDriver_Type_() { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); @@ -281,13 +300,12 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ChamferDriver_Type_() static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ChamferDriver", - sizeof(GEOMImpl_ChamferDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ChamferDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -306,5 +324,5 @@ const Handle(GEOMImpl_ChamferDriver) Handle(GEOMImpl_ChamferDriver)::DownCast(co } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx index 4107f9dfe..9c1f9ac04 100644 --- a/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ChamferDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx index 2edcc5c1b..b26507e88 100644 --- a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -111,8 +112,13 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const } // Axes gp_Ax2 anAxes (aP, aV); + // Radius + double anR = aCI.GetRadius(); + char aMsg[] = "Circle creation aborted: radius value less than 1e-07 is not acceptable"; + if (anR < Precision::Confusion()) + Standard_ConstructionError::Raise(aMsg); // Circle - gp_Circ aCirc (anAxes, aCI.GetRadius()); + gp_Circ aCirc (anAxes, anR); aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); } else if (aType == CIRCLE_CENTER_TWO_PNT) { @@ -213,10 +219,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_CircleDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CircleDriver", - sizeof(GEOMImpl_CircleDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_CircleDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.hxx b/src/GEOMImpl/GEOMImpl_CircleDriver.hxx index 4aa2ab5dc..e16f9941f 100644 --- a/src/GEOMImpl/GEOMImpl_CircleDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_CircleDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_ConeDriver.cxx b/src/GEOMImpl/GEOMImpl_ConeDriver.cxx index a84948554..551bb904f 100644 --- a/src/GEOMImpl/GEOMImpl_ConeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ConeDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -160,10 +161,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ConeDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ConeDriver", - sizeof(GEOMImpl_ConeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ConeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_ConeDriver.hxx b/src/GEOMImpl/GEOMImpl_ConeDriver.hxx index 81aaf2779..35a772838 100644 --- a/src/GEOMImpl/GEOMImpl_ConeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ConeDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ConeDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.cxx b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx index 008d28289..5d9f31591 100644 --- a/src/GEOMImpl/GEOMImpl_CopyDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -109,10 +110,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_CopyDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CopyDriver", - sizeof(GEOMImpl_CopyDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_CopyDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.hxx b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx index 4b2271be2..8fd0f4d69 100644 --- a/src/GEOMImpl/GEOMImpl_CopyDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_CopyDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx b/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx index 3cf373e4e..e381da9c9 100644 --- a/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -143,10 +144,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_CylinderDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CylinderDriver", - sizeof(GEOMImpl_CylinderDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_CylinderDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx b/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx index ab063d334..055679c2e 100644 --- a/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_CylinderDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_DiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DiskDriver.cxx index 5804a77ac..8876bc45f 100755 --- a/src/GEOMImpl/GEOMImpl_DiskDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_DiskDriver.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -95,11 +93,11 @@ Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); gp_Ax2 anAxes (aP, -aV); gp_Circ aCirc (anAxes, aCI.GetRadius()); - TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge(); - BRepBuilderAPI_MakeWire MW; - MW.Add(TopoDS::Edge(aCircle)); - BRepBuilderAPI_MakeFace MF (MW, Standard_False); - aShape = MF.Shape(); + TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge(); + BRepBuilderAPI_MakeWire MW; + MW.Add(TopoDS::Edge(aCircle)); + BRepBuilderAPI_MakeFace MF (MW, Standard_False); + aShape = MF.Shape(); } } } @@ -179,10 +177,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_DiskDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_DiskDriver", - sizeof(GEOMImpl_DiskDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_DiskDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_DiskDriver.hxx b/src/GEOMImpl/GEOMImpl_DiskDriver.hxx index ffee9eddf..d595e219d 100755 --- a/src/GEOMImpl/GEOMImpl_DiskDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_DiskDriver.hxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_DiskDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx new file mode 100644 index 000000000..105fa28b5 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx @@ -0,0 +1,524 @@ +// Copyright (C) 2007-2008 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 + +#include +#include +#include +#include + +// OCCT includes +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include + +#include + +#include +//@@ include required header files here @@// + +enum +{ + SQUARE, + HEXAGON +}; +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_DividedDiskDriver::GetID() +{ + static Standard_GUID aGUID("0b01da9a-c5da-11e1-8d80-78e7d1879630"); + return aGUID; +} + +//======================================================================= +//function : GEOMImpl_DividedDiskDriver +//purpose : +//======================================================================= +GEOMImpl_DividedDiskDriver::GEOMImpl_DividedDiskDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IDividedDisk aData (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + // Getting data + double R = aData.GetR(); + double Ratio = aData.GetRatio(); + int Pattern = aData.GetType(); + + // Build reference disk (in the global coordinate system) + TopoDS_Shape aDisk; + + if (Pattern == SQUARE) + aDisk = MakeDiskSquare( R, Ratio ); + else if (Pattern == HEXAGON) + aDisk = MakeDiskHexagon( R, Ratio ); + + if (aType == DIVIDEDDISK_R_RATIO) + { + int theOrientation = aData.GetOrientation(); + aShape = TransformShape(aDisk, theOrientation); + } + else if (aType == DIVIDEDDISK_R_VECTOR_PNT) + { + Handle(GEOM_Function) aRefPoint = aData.GetCenter(); + Handle(GEOM_Function) aRefVector = aData.GetVector(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + + if (aShapePnt.ShapeType() == TopAbs_VERTEX && + aShapeVec.ShapeType() == TopAbs_EDGE) + { + gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) + { + gp_Vec aVec (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + gp_Dir aDir(aVec); + aShape = TransformShape(aDisk, aPnt, aDir); + } + } + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : MakeDiskHexagon +//purpose : +//======================================================================= +TopoDS_Shell GEOMImpl_DividedDiskDriver::MakeDiskHexagon(double R, double Ratio) const +{ + // Geometry + gp_Dir ZDir(0,0,1); + gp_Dir XDir(1,0,0); + gp_Pnt Orig(0,0,0); + + // Circle + gp_Ax1 Ax1(Orig,ZDir); + gp_Ax2 Ax(Orig,ZDir,XDir); + gp_Circ aCircle(Ax, R); + + // Points +// gp_Pnt P4(0.01*Ratio*R,0,0); +// gp_Pnt P3(R,0,0); +// gp_Pnt P2 = P3.Rotated(Ax1,-M_PI/6.0); +// gp_Pnt P1(P4.X(), +// P4.X()/sqrt(3.0),0); + gp_Pnt P1(0.01*Ratio*R*sqrt(3.0)/2,0,0); + gp_Pnt P2(R,0,0); + gp_Pnt P3 = P2.Rotated(Ax1,M_PI/6.0); + gp_Pnt P4(P1.X(), + P1.X()/sqrt(3.0),0); + + + //surfaces + gp_Ax2 anAx (gp::XOY()); + Handle(Geom_Plane) aPlane = new Geom_Plane (anAx); + + // Topology + + // Vertices + TopoDS_Vertex O = BRepBuilderAPI_MakeVertex(Orig); + TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1); + TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2); + TopoDS_Vertex V3 = BRepBuilderAPI_MakeVertex(P3); + TopoDS_Vertex V4 = BRepBuilderAPI_MakeVertex(P4); + + TopoDS_Vertex V1 = V1_init; + TopoDS_Vertex V2 = V2_init; + + //Rotation + gp_Trsf myTrsf; + myTrsf.SetRotation(Ax1, M_PI/3.0); + + BRepBuilderAPI_Transform xform(myTrsf); + xform.Perform(V1,Standard_True); + TopoDS_Vertex V1_60 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V2,Standard_True); + TopoDS_Vertex V2_60 = TopoDS::Vertex(xform.Shape()); + + // Declaration of shapes (used in the loop) + TopoDS_Edge E1, E2, E3, E4, E5, E6, E7, E8, E9; + TopoDS_Wire W1, W2, W3; + TopoDS_Face F1, F2, F3; + TopoDS_Shell S; + + BRep_Builder aBuilder; + aBuilder.MakeShell(S); + + // Initialisation of edges + TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed())); + E1 = E1_init; + TopoDS_Edge E8_init = BRepBuilderAPI_MakeEdge(O,TopoDS::Vertex(V1.Reversed())); + E8 = E8_init; + + for (int i=1;i<=6;i++) + { + // Edges + + // for Face1 + E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V3.Reversed())); + E3 = BRepBuilderAPI_MakeEdge(V3,TopoDS::Vertex(V4.Reversed())); + E4 = BRepBuilderAPI_MakeEdge(V4,TopoDS::Vertex(V1.Reversed())); + + // for Face2 + if (i==6) + { + E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_init.Reversed())); + E7 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V4.Reversed())); + } + else + { + E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_60.Reversed())); + E7 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(V4.Reversed())); + } + E6 = BRepBuilderAPI_MakeEdge(V2_60,TopoDS::Vertex(V1_60.Reversed())); + + // for Face3 + E9 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(O.Reversed())); + + + // Wires + + //Wire1 + aBuilder.MakeWire(W1); + if (i==1) + aBuilder.Add(W1,E1); + else + aBuilder.Add(W1,TopoDS::Edge(E1.Reversed())); + aBuilder.Add(W1,E2); + aBuilder.Add(W1,E3); + aBuilder.Add(W1,E4); + + // Wire 2 + aBuilder.MakeWire(W2); + aBuilder.Add(W2,TopoDS::Edge(E3.Reversed())); + aBuilder.Add(W2,E5); + if (i==6) + aBuilder.Add(W2,TopoDS::Edge(E1_init.Reversed())); + else + aBuilder.Add(W2,E6); + aBuilder.Add(W2,E7); + + // Wire3 + aBuilder.MakeWire(W3); + if (i==1) + aBuilder.Add(W3,E8); + else + aBuilder.Add(W3,TopoDS::Edge(E8.Reversed())); + aBuilder.Add(W3,TopoDS::Edge(E4.Reversed())); + aBuilder.Add(W3,TopoDS::Edge(E7.Reversed())); + if (i==6) + aBuilder.Add(W3,TopoDS::Edge(E8_init.Reversed())); + else + aBuilder.Add(W3,E9); + + // Faces creation + F1 = BRepBuilderAPI_MakeFace(aPlane,W1); + F2 = BRepBuilderAPI_MakeFace(aPlane,W2); + F3 = BRepBuilderAPI_MakeFace(aPlane,W3); + + //Shell + aBuilder.Add(S, F1); + aBuilder.Add(S, F2); + aBuilder.Add(S, F3); + + // rotation + V1=V1_60; + V2=V2_60; + + xform.Perform(V1_60,Standard_True); + V1_60 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V2_60,Standard_True); + V2_60 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V3,Standard_True); + V3 = TopoDS::Vertex(xform.Shape()); + xform.Perform(V4,Standard_True); + V4 = TopoDS::Vertex(xform.Shape()); + + // "Increment" of edges + E1=E6; + E8=E9; + } + + return S; +} + +//======================================================================= +//function : MakeDiskSquare +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_DividedDiskDriver::MakeDiskSquare(double R, double Ratio) const +{ + // Geometry + gp_Dir ZDir(0,0,1); + gp_Dir XDir(1,0,0); + gp_Pnt Orig(0,0,0); + + // Circle + gp_Ax1 Ax1(Orig,ZDir); + gp_Ax2 Ax(Orig,ZDir,XDir); + gp_Circ aCircle(Ax, R); + + // Points + gp_Pnt P1(0.01*Ratio*R,0,0); + gp_Pnt P2(R,0,0); + + //surfaces + gp_Ax2 anAx (gp::XOY()); + Handle(Geom_Plane) aPlane = new Geom_Plane (anAx); + + // Topology + + // Vertices + TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1); + TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2); + + TopoDS_Vertex V1 = V1_init; + TopoDS_Vertex V2 = V2_init; + + //Rotation + gp_Trsf myTrsf; + myTrsf.SetRotation(Ax1, M_PI/2); + + BRepBuilderAPI_Transform xform(myTrsf); + xform.Perform(V1,Standard_True); + TopoDS_Vertex V1_rotated = TopoDS::Vertex(xform.Shape()); + xform.Perform(V2,Standard_True); + TopoDS_Vertex V2_rotated = TopoDS::Vertex(xform.Shape()); + + // Declaration of shapes (used in the loop) + TopoDS_Edge E1, E2, E3, E4; + TopoDS_Wire W1, W2; + TopoDS_Face F1, F2; + TopoDS_Shell S; + + BRep_Builder aBuilder; + aBuilder.MakeWire(W2); // Central Wire + aBuilder.MakeShell(S); // Shell + + // Initialisation of edges + TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed())); + E1 = E1_init; + + for (int i=1;i<=4;i++) + { + // Edges + // for Face1 + + E3 = BRepBuilderAPI_MakeEdge(V2_rotated,TopoDS::Vertex(V1_rotated.Reversed())); + if (i == 4) + { + E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_init.Reversed())); + E4 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V1.Reversed())); + } + else + { + E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_rotated.Reversed())); + E4 = BRepBuilderAPI_MakeEdge(V1_rotated,TopoDS::Vertex(V1.Reversed())); + } + + // Wires + //Wire1 + aBuilder.MakeWire(W1); + if (i==1) + aBuilder.Add(W1,E1); + else + aBuilder.Add(W1,TopoDS::Edge(E1.Reversed())); + aBuilder.Add(W1,E2); + if (i==4) + aBuilder.Add(W1,TopoDS::Edge(E1_init.Reversed())); + else + aBuilder.Add(W1,E3); + aBuilder.Add(W1,E4); + + // Wire central + aBuilder.Add(W2,TopoDS::Edge(E4.Reversed())); + + // Faces creation + F1 = BRepBuilderAPI_MakeFace(aPlane,W1); + + //Shell + aBuilder.Add(S, F1); + + // rotation + V1=V1_rotated; + V2=V2_rotated; + + xform.Perform(V1_rotated,Standard_True); + V1_rotated = TopoDS::Vertex(xform.Shape()); + xform.Perform(V2_rotated,Standard_True); + V2_rotated = TopoDS::Vertex(xform.Shape()); + + // "Increment" of edges + E1=E3; + } + // Central square Face + F2 = BRepBuilderAPI_MakeFace(aPlane,W2); + aBuilder.Add(S, F2); + + return S; +} + + +//======================================================================= +//function : TrasformShape(TopoDS_Shape aShape,int theOrientation) +//purpose : Perform shape transformation accordingly with specified +// orientation +//======================================================================= +TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape theShape, int theOrientation) const +{ + gp_Dir N, Vx; + gp_Pnt theOrigin = gp::Origin(); + + switch(theOrientation) + { + case 1: + { + N = gp::DZ(); + Vx = gp::DX(); + break; + } + case 2: + { + N = gp::DX(); + Vx = gp::DY(); + break; + } + case 3: + { + N = gp::DY(); + Vx = gp::DZ(); + break; + } + } + + gp_Ax3 aWPlane = gp_Ax3(theOrigin, N, Vx); + + return WPlaneTransform(theShape, aWPlane); +} + +//======================================================================= +//function : TrasformShape(TopoDS_Shape aShape, gp_Dir V, gp_Pnt P) +//purpose : Perform shape transformation accordingly with specified +// pnt and direction +//======================================================================= +TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape theShape, gp_Pnt P, gp_Dir V) const +{ + gp_Ax3 aWPlane( P, V ); + return WPlaneTransform(theShape, aWPlane); +} + +//======================================================================= +//function : WPlaneTransform +//purpose : Perform shape transformation accordingly with the given +// Working Plane +//======================================================================= +TopoDS_Shape GEOMImpl_DividedDiskDriver::WPlaneTransform(TopoDS_Shape theShape, gp_Ax3 theWPlane) const +{ + gp_Trsf aTrans; + aTrans.SetTransformation(theWPlane); + aTrans.Invert(); + BRepBuilderAPI_Transform aTransformation (theShape, aTrans, Standard_False); + return aTransformation.Shape(); +} + +//======================================================================= +//function : GEOMImpl_DividedDiskDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_DividedDiskDriver_Type_() +{ + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_DividedDiskDriver", + sizeof(GEOMImpl_DividedDiskDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_DividedDiskDriver) Handle(GEOMImpl_DividedDiskDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_DividedDiskDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_DividedDiskDriver))) { + _anOtherObject = Handle(GEOMImpl_DividedDiskDriver)((Handle(GEOMImpl_DividedDiskDriver)&)AnObject); + } + } + + return _anOtherObject; +} diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx new file mode 100644 index 000000000..ef6f08f7c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx @@ -0,0 +1,133 @@ +// Copyright (C) 2007-2008 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 _GEOMImpl_DividedDiskDriver_HXX +#define _GEOMImpl_DividedDiskDriver_HXX + +#include + +class Handle_Standard_Type; +class GEOMImpl_DividedDiskDriver; +class TopoDS_Shape; +class TopoDS_Shell; +class gp_Pnt; +class gp_Dir; +class gp_Ax3; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DividedDiskDriver); + +class Handle(GEOMImpl_DividedDiskDriver) : public Handle(TFunction_Driver) { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_DividedDiskDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_DividedDiskDriver)(const Handle(GEOMImpl_DividedDiskDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + {} + + Handle(GEOMImpl_DividedDiskDriver)(const GEOMImpl_DividedDiskDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + {} + + Handle(GEOMImpl_DividedDiskDriver)& operator=(const Handle(GEOMImpl_DividedDiskDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_DividedDiskDriver)& operator=(const GEOMImpl_DividedDiskDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_DividedDiskDriver* operator->() + { + return (GEOMImpl_DividedDiskDriver *)ControlAccess(); + } + + GEOMImpl_DividedDiskDriver* operator->() const + { + return (GEOMImpl_DividedDiskDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_DividedDiskDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_DividedDiskDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +class GEOMImpl_DividedDiskDriver : public TFunction_Driver { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_DividedDiskDriver(); + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const + { + return Standard_True; + } + Standard_EXPORT static const Standard_GUID& GetID(); + Standard_EXPORT ~GEOMImpl_DividedDiskDriver() {}; + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_DividedDiskDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { + return STANDARD_TYPE(GEOMImpl_DividedDiskDriver); + } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { + return (STANDARD_TYPE(GEOMImpl_DividedDiskDriver) == AType || TFunction_Driver::IsKind(AType)); + } + +private: + TopoDS_Shape TransformShape (TopoDS_Shape aShape, int theOrientation) const; + TopoDS_Shape TransformShape (TopoDS_Shape aShape, gp_Pnt P, gp_Dir V) const; + TopoDS_Shape WPlaneTransform (TopoDS_Shape aShape, gp_Ax3 theWPlane) const; + TopoDS_Shell MakeDiskHexagon (double R, double Ratio) const; + TopoDS_Shape MakeDiskSquare (double R, double Ratio) const; +}; + +#endif // _GEOMImpl_DividedDiskDriver_HXX diff --git a/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx index 24ac23eb6..90aa414da 100644 --- a/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -79,7 +80,7 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShapePnt = aRefPoint->GetValue(); if (aShapePnt.ShapeType() != TopAbs_VERTEX) { Standard_ConstructionError::Raise - ("Circle creation aborted: invalid center argument, must be a point"); + ("Ellipse creation aborted: invalid center argument, must be a point"); } aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); } @@ -90,7 +91,7 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShapeVec = aRefVector->GetValue(); if (aShapeVec.ShapeType() != TopAbs_EDGE) { Standard_ConstructionError::Raise - ("Circle creation aborted: invalid vector argument, must be a vector or an edge"); + ("Ellipse creation aborted: invalid normal vector argument, must be a vector or an edge"); } TopoDS_Edge anE = TopoDS::Edge(aShapeVec); TopoDS_Vertex V1, V2; @@ -99,14 +100,51 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); if (aV.Magnitude() < gp::Resolution()) { Standard_ConstructionError::Raise - ("Circle creation aborted: vector of zero length is given"); + ("Ellipse creation aborted: normal vector of zero length is given"); } } } + // Axes gp_Ax2 anAxes (aP, aV); + + // Main Axis vector + Handle(GEOM_Function) aRefVectorMaj = aCI.GetVectorMajor(); + if (!aRefVectorMaj.IsNull()) { + TopoDS_Shape aShapeVec = aRefVectorMaj->GetValue(); + if (aShapeVec.ShapeType() != TopAbs_EDGE) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: invalid major axis vector argument, must be a vector or an edge"); + } + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aVM (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (aVM.Magnitude() < gp::Resolution()) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: major axis vector of zero length is given"); + } + if (aV.IsParallel(aVM, Precision::Angular())) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: normal and major axis vectors are parallel"); + } + // Axes defined with main axis vector + anAxes = gp_Ax2 (aP, aV, aVM); + } + } + // Radiuses + double radiusMaj = aCI.GetRMajor(); + double radiusMin = aCI.GetRMinor(); + if ( radiusMaj < radiusMin ) + Standard_ConstructionError::Raise + ("Ellipse creation aborted: a major radius is less that a minor one"); + if ( radiusMin < 0.0 ) + Standard_ConstructionError::Raise + ("Ellipse creation aborted: raduis must be positive"); + // Ellipse - gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor()); + gp_Elips anEll (anAxes, radiusMaj, radiusMin); aShape = BRepBuilderAPI_MakeEdge(anEll).Edge(); } else { @@ -139,10 +177,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_EllipseDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_EllipseDriver", - sizeof(GEOMImpl_EllipseDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_EllipseDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx b/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx index 98bdec9a5..fda0a9273 100644 --- a/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_EllipseDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_ExportDriver.cxx b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx index 44efd6e1e..27c5f8bb4 100644 --- a/src/GEOMImpl/GEOMImpl_ExportDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -143,10 +144,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ExportDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ExportDriver", - sizeof(GEOMImpl_ExportDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ExportDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_ExportDriver.hxx b/src/GEOMImpl/GEOMImpl_ExportDriver.hxx index 040d7c912..806437da9 100644 --- a/src/GEOMImpl/GEOMImpl_ExportDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ExportDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ExportDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_FaceDriver.cxx b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx index 197b52ee0..4aafb7114 100755 --- a/src/GEOMImpl/GEOMImpl_FaceDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -143,10 +141,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_FaceDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FaceDriver", - sizeof(GEOMImpl_FaceDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_FaceDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_FaceDriver.hxx b/src/GEOMImpl/GEOMImpl_FaceDriver.hxx index 4e927d510..0a1aee235 100755 --- a/src/GEOMImpl/GEOMImpl_FaceDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_FaceDriver.hxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_FaceDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_Fillet1d.cxx b/src/GEOMImpl/GEOMImpl_Fillet1d.cxx new file mode 100644 index 000000000..0a648ad2c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Fillet1d.cxx @@ -0,0 +1,773 @@ +// Copyright (C) 2007-2012 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 + +// File : GEOMImpl_Fillet1d.cxx +// Module : GEOMImpl + +#include "GEOMImpl_Fillet1d.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * class GEOMImpl_Fillet1d + */ + +//======================================================================= +//function : Constructor +//purpose : +//======================================================================= +GEOMImpl_Fillet1d::GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1, + const TopoDS_Edge& theEdge2, + const gp_Pln& thePlane) +: myEdgesExchnged( Standard_False ) +{ + myPlane = new Geom_Plane(thePlane); + + BRepAdaptor_Curve aBAC1(theEdge1); + BRepAdaptor_Curve aBAC2(theEdge2); + if (aBAC1.GetType() < aBAC2.GetType()) + { // first curve must be more complicated + myEdge1 = theEdge2; + myEdge2 = theEdge1; + myEdgesExchnged = Standard_True; + } + else + { + myEdge1 = theEdge1; + myEdge2 = theEdge2; + } + + Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(myEdge1, myStart1, myEnd1); + Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(myEdge2, myStart2, myEnd2); + + myCurve1 = GeomProjLib::Curve2d(aCurve1, myStart1, myEnd1, myPlane); + myCurve2 = GeomProjLib::Curve2d(aCurve2, myStart2, myEnd2, myPlane); + + while (myCurve1->IsPeriodic() && myStart1 >= myEnd1) + myEnd1 += myCurve1->Period(); + while (myCurve2->IsPeriodic() && myStart2 >= myEnd2) + myEnd2 += myCurve2->Period(); + + if (aBAC1.GetType() == aBAC2.GetType()) + { + if (myEnd2 - myStart2 < myEnd1 - myStart1) + { // first curve must be parametrically shorter + TopoDS_Edge anEdge = myEdge1; + myEdge1 = myEdge2; + myEdge2 = anEdge; + Handle(Geom2d_Curve) aCurve = myCurve1; + myCurve1 = myCurve2; + myCurve2 = aCurve; + Standard_Real a = myStart1; + myStart1 = myStart2; + myStart2 = a; + a = myEnd1; + myEnd1 = myEnd2; + myEnd2 = a; + myEdgesExchnged = Standard_True; + } + } +} + +//======================================================================= +//function : isRadiusIntersected +//purpose : local function +//======================================================================= +static Standard_Boolean isRadiusIntersected(const Handle(Geom2d_Curve)& theCurve, + const gp_Pnt2d theStart, + const gp_Pnt2d theEnd, + const Standard_Boolean theStartConnected) +{ + const Standard_Real aTol = Precision::Confusion(); + const Standard_Real anAngTol = Precision::Angular(); + Geom2dAPI_InterCurveCurve anInter(theCurve, new Geom2d_Line(theStart, + gp_Dir2d(gp_Vec2d(theStart, theEnd))), aTol); + Standard_Integer a; + gp_Pnt2d aPoint; + for(a = anInter.NbPoints(); a > 0; a--) + { + aPoint = anInter.Point(a); + if ( aPoint.Distance(theStart) < aTol && !theStartConnected ) + return Standard_True; + if (aPoint.Distance(theEnd) < aTol * 200) + return Standard_True; + if (gp_Vec2d(aPoint, theStart).IsOpposite(gp_Vec2d(aPoint, theEnd), anAngTol)) + return Standard_True; + } + Handle(Geom2d_Curve) aCurve; + for(a = anInter.NbSegments(); a > 0; a--) + { + anInter.Segment(a, aCurve); + aPoint = aCurve->Value(aCurve->FirstParameter()); + if (aPoint.Distance(theStart) < aTol) + if (!theStartConnected) + return Standard_True; + if (aPoint.Distance(theEnd) < aTol) + return Standard_True; + if (gp_Vec2d(aPoint, theStart).IsOpposite(gp_Vec2d(aPoint, theEnd), anAngTol)) + return Standard_True; + aPoint = aCurve->Value(aCurve->LastParameter()); + if (aPoint.Distance(theStart) < aTol) + if (!theStartConnected) + return Standard_True; + if (aPoint.Distance(theEnd) < aTol) + return Standard_True; + if (gp_Vec2d(aPoint, theStart).IsOpposite(gp_Vec2d(aPoint, theEnd), anAngTol)) + return Standard_True; + } + return Standard_False; +} + + +//======================================================================= +//function : fillPoint +//purpose : +//======================================================================= +void GEOMImpl_Fillet1d::fillPoint(GEOMImpl_Fillet1dPoint* thePoint) +{ + gp_Pnt2d aPoint; + gp_Vec2d aVec; + const Standard_Real aTol = Precision::Confusion(); + myCurve1->D1(thePoint->GetParam(), aPoint, aVec); + if (aVec.SquareMagnitude() < aTol) + return; + + gp_Vec2d aPerp(((myStartSide)?-1:1) * aVec.Y(), ((myStartSide)?1:-1) * aVec.X()); + aPerp.Normalize(); + aPerp.Multiply(myRadius); + gp_Pnt2d aCenter = aPoint.Translated(aPerp); + thePoint->SetCenter(aCenter); + + // on the intersection point + Standard_Boolean aValid = Standard_True; + Geom2dAPI_ProjectPointOnCurve aProjInt(aPoint, myCurve2); + if (aProjInt.NbPoints() && aPoint.Distance(aProjInt.NearestPoint()) < aTol) + aValid = Standard_False; + else + aValid = !isRadiusIntersected(myCurve2, aPoint, aCenter, Standard_True); + + Geom2dAPI_ProjectPointOnCurve aProj(aCenter, myCurve2); + Standard_Integer a, aNB = aProj.NbPoints(); + for(a = aNB; a > 0; a--) + { + if (aPoint.Distance(aProj.Point(a)) < aTol) + continue; + + Standard_Boolean aValid2 = aValid; + if (aValid2) + aValid2 = !isRadiusIntersected(myCurve1, aCenter, aProj.Point(a), Standard_False); + + // checking the right parameter + Standard_Real aParam = aProj.Parameter(a); + while(myCurve2->IsPeriodic() && aParam < myStart2) + aParam += myCurve2->Period(); + + thePoint->AddValue(aProj.Distance(a) * aProj.Distance(a) - myRadius * myRadius, + (aParam >= myStart2 && aParam <= myEnd2 && aValid2)); + if (fabs(fabs(aProj.Distance(a)) - myRadius) < aTol) + thePoint->SetParam2(aParam); + } +} + +//======================================================================= +//function : fillDiff +//purpose : +//======================================================================= +void GEOMImpl_Fillet1d::fillDiff(GEOMImpl_Fillet1dPoint* thePoint, Standard_Real theDiffStep, Standard_Boolean theFront) +{ + GEOMImpl_Fillet1dPoint* aDiff = + new GEOMImpl_Fillet1dPoint(thePoint->GetParam() + (theFront?(theDiffStep):(-theDiffStep))); + fillPoint(aDiff); + if (!thePoint->ComputeDifference(aDiff)) + { + aDiff->SetParam(thePoint->GetParam() + (theFront?(-theDiffStep):(theDiffStep))); + fillPoint(aDiff); + thePoint->ComputeDifference(aDiff); + } + delete aDiff; +} + +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_Fillet1d::Perform(const Standard_Real theRadius) +{ + myDegreeOfRecursion = 0; + myResultParams.Clear(); + myResultOrientation.Clear(); + + Standard_Real aNBSteps = 100; + Geom2dAdaptor_Curve aGAC(myCurve1); + switch (aGAC.GetType()) + { + case GeomAbs_Line: + aNBSteps = 2; + break; + case GeomAbs_Circle: + aNBSteps = 4; + break; + case GeomAbs_Ellipse: + aNBSteps = 5; + break; + case GeomAbs_BezierCurve: + case GeomAbs_BSplineCurve: + aNBSteps = 2 + aGAC.Degree() * aGAC.NbPoles(); + break; + default: // unknown: maximum + aNBSteps = 100; + } + + myRadius = theRadius; + Standard_Real aParam, aStep, aDStep; + aStep = (myEnd1 - myStart1) / aNBSteps; + aDStep = aStep/1000.; + + Standard_Integer aCycle; + for(aCycle = 2, myStartSide = Standard_False; aCycle; myStartSide = !myStartSide, aCycle--) + { + GEOMImpl_Fillet1dPoint *aLeft = NULL, *aRight = NULL; + + for(aParam = myStart1 + aStep; aParam < myEnd1 || fabs(myEnd1 - aParam) < Precision::Confusion(); aParam += aStep) + { + if (!aLeft) + { + aLeft = new GEOMImpl_Fillet1dPoint(aParam - aStep); + fillPoint(aLeft); + fillDiff(aLeft, aDStep, Standard_True); + } + + aRight = new GEOMImpl_Fillet1dPoint(aParam); + fillPoint(aRight); + fillDiff(aRight, aDStep, Standard_False); + + aLeft->FilterPoints(aRight); + performNewton(aLeft, aRight); + + delete aLeft; + aLeft = aRight; + } + delete aLeft; + } + + if (myResultParams.Extent()) + return Standard_True; + + return Standard_False; +} + +//======================================================================= +//function : processPoint +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_Fillet1d::processPoint(GEOMImpl_Fillet1dPoint* theLeft, + GEOMImpl_Fillet1dPoint* theRight, + Standard_Real theParameter) +{ + if (theParameter >= theLeft->GetParam() && theParameter < theRight->GetParam()) + { + Standard_Real aDX = theRight->GetParam() - theLeft->GetParam(); + if (theParameter - theLeft->GetParam() < aDX / 100.) + { + theParameter = theLeft->GetParam() + aDX / 100.; + } + if (theRight->GetParam() - theParameter < aDX / 100.) + { + theParameter = theRight->GetParam() - aDX / 100.; + } + + // Protection on infinite loop. + myDegreeOfRecursion++; + Standard_Real diffx = 0.001 * aDX; + if (myDegreeOfRecursion > 1000) + { + diffx *= 10.0; + if (myDegreeOfRecursion > 10000) + { + diffx *= 10.0; + if (myDegreeOfRecursion > 100000) + { + return Standard_True; + } + } + } + + GEOMImpl_Fillet1dPoint* aPoint1 = theLeft->Copy(); + GEOMImpl_Fillet1dPoint* aPoint2 = new GEOMImpl_Fillet1dPoint(theParameter); + fillPoint(aPoint2); + fillDiff(aPoint2, diffx, Standard_True); + + aPoint1->FilterPoints(aPoint2); + performNewton(aPoint1, aPoint2); + aPoint2->FilterPoints(theRight); + performNewton(aPoint2, theRight); + + delete aPoint1; + delete aPoint2; + return Standard_True; + } + + return Standard_False; +} + +//======================================================================= +//function : performNewton +//purpose : +//======================================================================= +void GEOMImpl_Fillet1d::performNewton(GEOMImpl_Fillet1dPoint* theLeft, + GEOMImpl_Fillet1dPoint* theRight) +{ + Standard_Integer a; + // check the left: if this is solution store it and remove it from the list of researching points of theLeft + a = theLeft->HasSolution(myRadius); + if (a) + { + if (theLeft->IsValid(a)) + { + myResultParams.Append(theLeft->GetParam()); + myResultOrientation.Append(myStartSide); + } + return; + } + + Standard_Real aDX = theRight->GetParam() - theLeft->GetParam(); + if ( aDX < Precision::Confusion() / 1000000.) + { + a = theRight->HasSolution(myRadius); + if (a) + if (theRight->IsValid(a)) + { + myResultParams.Append(theRight->GetParam()); + myResultOrientation.Append(myStartSide); + } + return; + } + + for(a = 1; a <= theLeft->GetNBValues(); a++) + { + Standard_Integer aNear = theLeft->GetNear(a); + + Standard_Real aA = (theRight->GetDiff(aNear) - theLeft->GetDiff(a)) / aDX; + Standard_Real aB = theLeft->GetDiff(a) - aA * theLeft->GetParam(); + Standard_Real aC = theLeft->GetValue(a) - theLeft->GetDiff(a) * theLeft->GetParam() + + aA * theLeft->GetParam() * theLeft->GetParam() / 2.0; + Standard_Real aDet = aB * aB - 2.0 * aA * aC; + + if ( fabs(aDet) < gp::Resolution() ) + continue; + + if (fabs(aA) < Precision::Confusion()) + { // linear case + if (fabs(aB) > 10e-20) + { + Standard_Real aX0 = - aC / aB; // use extremum + if (aX0 > theLeft->GetParam() && aX0 < theRight->GetParam()) + processPoint(theLeft, theRight, aX0); + } + else + { + processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise + } + } + else + { + if (fabs(aB) > fabs(aDet * 1000000.)) + { // possible floating point operations accuracy errors + processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise + } + else + { + if (aDet > 0) + { // two solutions + aDet = sqrt(aDet); + Standard_Boolean aRes = processPoint(theLeft, theRight, (- aB + aDet) / aA); + if (!aRes) + aRes = processPoint(theLeft, theRight, (- aB - aDet) / aA); + if (!aRes) + processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise + } + else + { + Standard_Real aX0 = - aB / aA; // use extremum + if (aX0 > theLeft->GetParam() && aX0 < theRight->GetParam()) + processPoint(theLeft, theRight, aX0); + else + processPoint(theLeft, theRight, theLeft->GetParam() + aDX / 2.0); // linear division otherwise + } + } + } + } +} + +//======================================================================= +//function : Result +//purpose : +//======================================================================= +TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, + TopoDS_Edge& theEdge1, + TopoDS_Edge& theEdge2) +{ + TopoDS_Edge aResult; + gp_Pnt2d aTargetPoint2d; + Standard_Real aX, aY; + ElSLib::PlaneParameters(myPlane->Pln().Position(), thePoint, aX, aY); + aTargetPoint2d.SetCoord(aX, aY); + + // choose the nearest circle + Standard_Real aDistance, aP; + GEOMImpl_Fillet1dPoint *aNearest; + Standard_Integer a; + TColStd_ListIteratorOfListOfReal anIter(myResultParams); + for(aNearest = NULL, a = 1; anIter.More(); anIter.Next(), a++) + { + myStartSide = (myResultOrientation.Value(a)) ? Standard_True : Standard_False; + GEOMImpl_Fillet1dPoint *aPoint = new GEOMImpl_Fillet1dPoint(anIter.Value()); + fillPoint(aPoint); + if (!aPoint->HasSolution(myRadius)) + continue; + aP = fabs(aPoint->GetCenter().Distance(aTargetPoint2d) - myRadius); + if (!aNearest || aP < aDistance) + { + aNearest = aPoint; + aDistance = aP; + } + else + { + delete aPoint; + } + } + + if (!aNearest) + return aResult; + + // create circle edge + gp_Pnt aCenter = ElSLib::PlaneValue(aNearest->GetCenter().X(), + aNearest->GetCenter().Y(), + myPlane->Pln().Position()); + Handle(Geom_Circle) aCircle = + new Geom_Circle(gp_Ax2(aCenter, myPlane->Pln().Axis().Direction()), myRadius); + gp_Pnt2d aPoint2d1, aPoint2d2; + myCurve1->D0(aNearest->GetParam(), aPoint2d1); + myCurve2->D0(aNearest->GetParam2(), aPoint2d2); + gp_Pnt aPoint1 = ElSLib::PlaneValue(aPoint2d1.X(), aPoint2d1.Y(), myPlane->Pln().Position()); + gp_Pnt aPoint2 = ElSLib::PlaneValue(aPoint2d2.X(), aPoint2d2.Y(), myPlane->Pln().Position()); + + GeomAPI_ProjectPointOnCurve aProj(thePoint, aCircle); + Standard_Real aTarGetParam = aProj.LowerDistanceParameter(); + gp_Pnt aPointOnCircle = aProj.NearestPoint(); + + // Check extrema point manually, because there is a bug in Open CASCADE + // in calculation of nearest point to a circle near the parameter 0.0 + gp_Pnt p0 = ElCLib::Value(0.0, aCircle->Circ()); + if (p0.Distance(thePoint) < aPointOnCircle.Distance(thePoint)) + { + aTarGetParam = 0.0; + aPointOnCircle = p0; + } + + aProj.Perform(aPoint1); + Standard_Real aParam1 = aProj.LowerDistanceParameter(); + aProj.Perform(aPoint2); + Standard_Real aParam2 = aProj.LowerDistanceParameter(); + Standard_Boolean aIsOut = ((aParam1 < aTarGetParam && aParam2 < aTarGetParam) || + (aParam1 > aTarGetParam && aParam2 > aTarGetParam)); + if (aParam1 > aParam2) + aIsOut = !aIsOut; + BRepBuilderAPI_MakeEdge aBuilder(aCircle->Circ(), + aIsOut ? aParam2 : aParam1, + aIsOut? aParam1 : aParam2); + aResult = aBuilder.Edge(); + + // divide edges + Standard_Real aStart, anEnd; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(myEdge1, aStart, anEnd); + gp_Vec aDir; + aCurve->D1(aNearest->GetParam(), aPoint1, aDir); + + gp_Vec aCircleDir; + aCircle->D1(aParam1, aPoint1, aCircleDir); + if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ^ aIsOut) + aStart = aNearest->GetParam(); + else + anEnd = aNearest->GetParam(); + + if (fabs(aStart - anEnd) > Precision::Confusion()) + { + //Divide edge + BRepBuilderAPI_MakeEdge aDivider1(aCurve, aStart, anEnd); + if (myEdgesExchnged) + theEdge2 = aDivider1.Edge(); + else + theEdge1 = aDivider1.Edge(); + } + + aCurve = BRep_Tool::Curve(myEdge2, aStart, anEnd); + aCurve->D1(aNearest->GetParam2(), aPoint2, aDir); + + aCircle->D1(aParam2, aPoint2, aCircleDir); + if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ^ (!aIsOut)) + aStart = aNearest->GetParam2(); + else + anEnd = aNearest->GetParam2(); + + if (fabs(aStart - anEnd) > Precision::Confusion()) + { + BRepBuilderAPI_MakeEdge aDivider2(aCurve, aStart, anEnd); + if (myEdgesExchnged) + theEdge1 = aDivider2.Edge(); + else + theEdge2 = aDivider2.Edge(); + } + + delete aNearest; + return aResult; +} + +//======================================================================= +//function : AddValue +//purpose : +//======================================================================= +void GEOMImpl_Fillet1dPoint::AddValue(Standard_Real theValue, Standard_Boolean theValid) +{ + Standard_Integer a; + for(a = 1; a <= myV.Length(); a++) + { + if (theValue < myV.Value(a)) + { + myV.InsertBefore(a, theValue); + myValid.InsertBefore(a, (Standard_Integer)theValid); + return; + } + } + myV.Append(theValue); + myValid.Append((Standard_Integer)theValid); +} + +//======================================================================= +//function : ComputeDifference +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_Fillet1dPoint::ComputeDifference(GEOMImpl_Fillet1dPoint* thePoint) +{ + Standard_Integer a; + Standard_Boolean aDiffsSet = (myD.Length() != 0); + Standard_Real aDX = thePoint->GetParam() - myParam, aDY; + if (thePoint->myV.Length() == myV.Length()) + { // absolutely the same points + for(a = 1; a <= myV.Length(); a++) + { + aDY = thePoint->myV.Value(a) - myV.Value(a); + if ( aDiffsSet ) + myD.SetValue(a, fabs(aDX) > gp::Resolution() ? (aDY/aDX) : 0); + else + myD.Append( fabs(aDX) > gp::Resolution() ? (aDY/aDX) : 0); + } + return Standard_True; + } + // between the diffeerent points searching for nearest analogs + Standard_Integer b; + for(a = 1; a <= myV.Length(); a++) + { + for(b = 1; b <= thePoint->myV.Length(); b++) + { + if (b == 1 || fabs(thePoint->myV.Value(b) - myV.Value(a)) < fabs(aDY)) + aDY = thePoint->myV.Value(b) - myV.Value(a); + } + if (aDiffsSet) + { + if ( fabs(aDX) > gp::Resolution() && fabs(aDY / aDX) < fabs(myD.Value(a))) + myD.SetValue(a, aDY / aDX); + else + myD.SetValue(a, 0); + } + else + { + myD.Append( fabs(aDX) > gp::Resolution() ? aDY/aDX : 0); + } + } + + return Standard_False; +} + +//======================================================================= +//function : FilterPoints +//purpose : +//======================================================================= +void GEOMImpl_Fillet1dPoint::FilterPoints(GEOMImpl_Fillet1dPoint* thePoint) +{ + Standard_Integer a, b; + TColStd_SequenceOfReal aDiffs; + Standard_Real aY, aY2, aDX = thePoint->GetParam() - myParam; + for(a = 1; a <= myV.Length(); a++) + { + // searching for near point from thePoint + Standard_Integer aNear = 0; + Standard_Real aDiff = aDX * 10000.; + aY = myV.Value(a) + myD.Value(a) * aDX; + for(b = 1; b <= thePoint->myV.Length(); b++) + { + // calculate hypothesis value of the Y2 with the constant first and second derivative + aY2 = aY + aDX * (thePoint->myD.Value(b) - myD.Value(a)) / 2.0; + if (aNear == 0 || fabs(aY2 - thePoint->myV.Value(b)) < fabs(aDiff)) + { + aNear = b; + aDiff = aY2 - thePoint->myV.Value(b); + } + }//for b... + + if (aNear) + { + if (myV.Value(a) * thePoint->myV.Value(aNear) > 0) + {// the same sign at the same sides of the interval + if (myV.Value(a) * myD.Value(a) > 0) + { + if (fabs(myD.Value(a)) > Precision::Confusion()) + aNear = 0; + } + else + { + if (fabs(myV.Value(a)) > fabs(thePoint->myV.Value(aNear))) + if (thePoint->myV.Value(aNear) * thePoint->myD.Value(aNear) < 0 && + fabs(thePoint->myD.Value(aNear)) > Precision::Confusion()) + { + aNear = 0; + } + } + } + } + + if (aNear) + { + if (myV.Value(a) * thePoint->myV.Value(aNear) > 0) + { + if ((myV.Value(a) + myD.Value(a) * aDX) * myV.Value(a) > Precision::Confusion() && + (thePoint->myV.Value(aNear) + thePoint->myD.Value(aNear) * aDX) * thePoint->myV.Value(aNear) > Precision::Confusion()) + { + aNear = 0; + } + } + } + + if (aNear) + { + if ( fabs(aDX) < gp::Resolution() || fabs(aDiff / aDX) > 1.e+7) + { + aNear = 0; + } + } + + if (aNear == 0) + { // there is no near: remove it from the list + myV.Remove(a); + myD.Remove(a); + myValid.Remove(a); + a--; + } + else + { + Standard_Boolean aFound = Standard_False; + for(b = 1; b <= myNear.Length(); b++) + { + if (myNear.Value(b) == aNear) + { + if (fabs(aDiffs.Value(b)) < fabs(aDiff)) + { // return this 'near' + aFound = Standard_True; + myV.Remove(a); + myD.Remove(a); + myValid.Remove(a); + a--; + break; + } + else + { // remove the old 'near' + myV.Remove(b); + myD.Remove(b); + myValid.Remove(b); + myNear.Remove(b); + aDiffs.Remove(b); + a--; + break; + } + } + }//for b... + if (!aFound) + { + myNear.Append(aNear); + aDiffs.Append(aDiff); + } + } + }//for a... +} + +//======================================================================= +//function : Copy +//purpose : +//======================================================================= +GEOMImpl_Fillet1dPoint* GEOMImpl_Fillet1dPoint::Copy() +{ + GEOMImpl_Fillet1dPoint* aCopy = new GEOMImpl_Fillet1dPoint(myParam); + Standard_Integer a; + for(a = 1; a <= myV.Length(); a++) + { + aCopy->myV.Append(myV.Value(a)); + aCopy->myD.Append(myD.Value(a)); + aCopy->myValid.Append(myValid.Value(a)); + } + return aCopy; +} + +//======================================================================= +//function : HasSolution +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Fillet1dPoint::HasSolution(const Standard_Real theRadius) +{ + Standard_Integer a; + for(a = 1; a <= myV.Length(); a++) + { + if (fabs(sqrt(fabs(fabs(myV.Value(a)) + theRadius * theRadius)) - theRadius) < Precision::Confusion() / 10.) + return a; + } + return 0; +} + +//======================================================================= +//function : RemoveSolution +//purpose : +//======================================================================= +void GEOMImpl_Fillet1dPoint::RemoveSolution(Standard_Integer theIndex) +{ + myV.Remove(theIndex); + myD.Remove(theIndex); + myValid.Remove(theIndex); + myNear.Remove(theIndex); +} diff --git a/src/GEOMImpl/GEOMImpl_Fillet1d.hxx b/src/GEOMImpl/GEOMImpl_Fillet1d.hxx new file mode 100644 index 000000000..679e3fc70 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Fillet1d.hxx @@ -0,0 +1,143 @@ +// Copyright (C) 2007-2012 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 + +// File : GEOMImpl_Fillet1d.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_Fillet1d_HeaderFile +#define _GEOMImpl_Fillet1d_HeaderFile + +#include + +#include +#include + +#include + +#include +#include +#include + +class GEOMImpl_Fillet1dPoint; + +/** +* GEOMImpl_Fillet1d is 1D fillet algorithm on two planar edges with given radius +*/ + +class GEOMImpl_Fillet1d +{ +public: + //! Constructor + //! The fillet 1D algorithm is initialised by two edges and plane + Standard_EXPORT GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1, + const TopoDS_Edge& theEdge2, + const gp_Pln& thePlane); + //! Makes fillet with given radius + //! @returns Standard_True, if at least one result computed + Standard_EXPORT Standard_Boolean Perform(const Standard_Real theRadius); + + //! Returns result fillet edge and modified edges as out parameters + Standard_EXPORT TopoDS_Edge Result(const gp_Pnt& thePoint, TopoDS_Edge& theEdge1, TopoDS_Edge& theEdge2); + +private: + //! private methods + void fillPoint(GEOMImpl_Fillet1dPoint*); + void fillDiff(GEOMImpl_Fillet1dPoint*, Standard_Real, Standard_Boolean); + void performNewton(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*); + Standard_Boolean processPoint(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*, Standard_Real); + +private: + //! private fields + TopoDS_Edge myEdge1, myEdge2; + Handle(Geom_Plane) myPlane; + Handle(Geom2d_Curve) myCurve1, myCurve2; + Standard_Real myStart1, myEnd1, myStart2, myEnd2, myRadius; + TColStd_ListOfReal myResultParams; + TColStd_SequenceOfInteger myResultOrientation; + Standard_Boolean myStartSide, myEdgesExchnged; + Standard_Integer myDegreeOfRecursion; +}; + + +/** +* GEOMImpl_Fillet1dPoint is an internal class for 1D fillet algorithm +* to store and compare computed solutions on edges +*/ + +class GEOMImpl_Fillet1dPoint +{ +public: + //! Puiblic methods + + //! Constructor + Standard_EXPORT GEOMImpl_Fillet1dPoint(Standard_Real theParam) + {myParam = theParam;} + + //! Make copy of point + //!WARNING: Copies only field values: myParam, myV, myD, myValid + Standard_EXPORT GEOMImpl_Fillet1dPoint* Copy(); // warning: this is not the full copy! + + //! Set/Get parameter + Standard_EXPORT inline void SetParam(Standard_Real theParam) + {myParam = theParam;} + Standard_EXPORT inline Standard_Real GetParam() const + {return myParam;} + Standard_EXPORT inline void SetParam2(const Standard_Real theParam2) + {myParam2 = theParam2;} + Standard_EXPORT inline Standard_Real GetParam2() + { return myParam2 ; } + + //! Returns validity + Standard_EXPORT inline Standard_Boolean IsValid(int theIndex) + {return (Standard_Boolean)myValid.Value(theIndex);} + + //! Get values + Standard_EXPORT inline Standard_Integer GetNBValues() {return myV.Length();} + Standard_EXPORT inline Standard_Real GetValue(Standard_Integer theIndex) + {return myV.Value(theIndex);} + Standard_EXPORT inline Standard_Real GetDiff(Standard_Integer theIndex) + {return myD.Value(theIndex);} + Standard_EXPORT inline Standard_Integer GetNear(Standard_Integer theIndex) + {return myNear.Value(theIndex);} + + //! Set/Get center point + Standard_EXPORT inline void SetCenter(const gp_Pnt2d thePoint) + {myCenter = thePoint;} + Standard_EXPORT inline const gp_Pnt2d GetCenter() + {return myCenter;} + + Standard_EXPORT void AddValue(Standard_Real theValue, Standard_Boolean theIsValid); + + //! compute difference between this and given point + Standard_EXPORT Standard_Boolean ComputeDifference(GEOMImpl_Fillet1dPoint*); + Standard_EXPORT void FilterPoints(GEOMImpl_Fillet1dPoint*); + + //! Checks if point contains solution and returns the index of it if any + Standard_EXPORT Standard_Integer HasSolution(Standard_Real theRadius); + //! Remove solution by index + void RemoveSolution(Standard_Integer theIndex); + +private: + //! Private fields + gp_Pnt2d myCenter; + Standard_Real myParam, myParam2; + TColStd_SequenceOfReal myV, myD; + TColStd_SequenceOfInteger myValid, myNear; +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx new file mode 100644 index 000000000..f781f228e --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx @@ -0,0 +1,407 @@ +// Copyright (C) 2007-2012 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 + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_Fillet1dDriver::GetID() +{ + static Standard_GUID aFillet1dDriver("FF60908B-AB2E-4b71-B098-5C256C37D961"); + return aFillet1dDriver; +} + +//======================================================================= +//function : GEOMImpl_Fillet1dDriver +//purpose : +//======================================================================= +GEOMImpl_Fillet1dDriver::GEOMImpl_Fillet1dDriver() +{ +} + +//======================================================================= +//function : anotherVertex +//purpose : local function to get vertex from edge +//======================================================================= +static TopoDS_Vertex anotherVertex( const TopoDS_Edge& theE, + const TopoDS_Vertex& theV ) +{ + // here is an assumption that edge has different vertices + TopoDS_Vertex aV; + TopExp_Explorer anExp( theE, TopAbs_VERTEX ); + for ( ; anExp.More(); anExp.Next() ) + { + if ( BRepTools::Compare(theV,TopoDS::Vertex(anExp.Current())) /*theV.IsSame(anExp.Current())*/ ) + continue; + aV = TopoDS::Vertex( anExp.Current() ); + break; + } + return aV; +} + +//======================================================================= +//function : takePlane +//purpose : local function returns plane of given edges +//======================================================================= +static Standard_Boolean takePlane( const TopoDS_Edge& theE1, + const TopoDS_Edge& theE2, + const TopoDS_Vertex& theV, + gp_Pln& thePlane ) +{ + TopoDS_Vertex aV12 = anotherVertex( theE1, theV ); + TopoDS_Vertex aV22 = anotherVertex( theE2, theV ); + // check can closed wire be created by two initial edges + if ( aV12.IsNull() || aV22.IsNull() || aV12.IsSame( aV22 ) ) + return false; + + // create plane by 3 points + gp_XYZ aXYZ = BRep_Tool::Pnt( theV ).XYZ(); + gp_XYZ aXYZ1 = BRep_Tool::Pnt( aV12 ).XYZ(); + gp_XYZ aXYZ2 = BRep_Tool::Pnt( aV22 ).XYZ(); + try { + gp_Dir aDir1( aXYZ - aXYZ1 ); + gp_Dir aDir2( aXYZ2 - aXYZ ); + Standard_Real anAngle = aDir1.Angle(aDir2); + if ( fabs(anAngle) <= gp::Resolution() || + fabs(anAngle - M_PI) <= gp::Resolution() ) + return false; + thePlane = gp_Pln( gp_Pnt(aXYZ), aDir1^ aDir2); + } + catch (Standard_Failure) { + return false; + } + return true; +} + +//======================================================================= +//function : addEdgeRelation +//purpose : local function to remember relation between initial and modified edge +//======================================================================= +static void addEdgeRelation(TopTools_DataMapOfShapeShape& theMap, + const TopoDS_Edge& theInitE, + const TopoDS_Edge& theResE) +{ + if ( theMap.IsBound( theInitE ) ) + theMap.ChangeFind( theInitE ) = theResE; + else + theMap.Bind( theInitE, theResE ); +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Fillet1dDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IFillet1d aCI (aFunction); + + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) + return 0; + if (aShape.ShapeType() != TopAbs_WIRE) + Standard_ConstructionError::Raise("Wrong arguments: polyline as wire must be given"); + + TopoDS_Wire aWire = TopoDS::Wire(aShape); + + bool doIgnoreSecantPoints = aCI.GetFlag(); + + double rad = aCI.GetR(); + if (rad < Precision::Confusion()) + return 0; + + // collect vertices for make fillet + TopTools_ListOfShape aVertexList; + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aWire, anIndices); + int aLen = aCI.GetLength(); + if (aLen > 0) { + for (int ii = 1; ii <= aLen; ii++) { + int ind = aCI.GetVertex(ii); + if (1 <= ind && ind <= anIndices.Extent()) { + TopoDS_Shape aShapeVertex = anIndices.FindKey(ind); + if (aShapeVertex.ShapeType() == TopAbs_VERTEX) + aVertexList.Append(aShapeVertex); + } + } + } + else { // get all vertices from wire + TopTools_MapOfShape mapShape; + TopExp_Explorer anExp (aWire, TopAbs_VERTEX); + for (; anExp.More(); anExp.Next()) { + if (mapShape.Add(anExp.Current())) + aVertexList.Append(anExp.Current()); + } + } + if (aVertexList.IsEmpty()) + Standard_ConstructionError::Raise("Invalid input: no vertices to make fillet"); + + // at first we try to make fillet on the initial wire (without edges fusing) + bool isFinalPass = !doIgnoreSecantPoints; + TopoDS_Wire aResult; + bool isAllStepsOk = MakeFillet(aWire, aVertexList, rad, isFinalPass, aResult); + + // try to fuse collinear edges to allow bigger radius + if (!isFinalPass && !isAllStepsOk) { + // 1. Fuse + TopoDS_Shape aShapeNew; + Handle(TColStd_HSequenceOfTransient) aVerts; + GEOMImpl_HealingDriver::FuseCollinearEdges(aWire, aVerts, aShapeNew); + TopoDS_Wire aWireNew = TopoDS::Wire(aShapeNew); + + // 2. Rebuild the list of vertices (by coincidence) + Standard_Real tol, tolMax = Precision::Confusion(); + for (TopExp_Explorer ExV (aWireNew, TopAbs_VERTEX); ExV.More(); ExV.Next()) { + TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current()); + tol = BRep_Tool::Tolerance(Vertex); + if (tol > tolMax) + tolMax = tol; + } + + TopTools_ListOfShape aVertexListNew; + TopTools_IndexedMapOfShape anIndicesNew; + TopExp::MapShapes(aWireNew, anIndicesNew); + TopTools_ListIteratorOfListOfShape anIt (aVertexList); + for (; anIt.More(); anIt.Next()) { + TopoDS_Vertex aV = TopoDS::Vertex(anIt.Value()); + if (anIndicesNew.Contains(aV)) + aVertexListNew.Append(aV); + else { + // try to find by coords in the new wire + gp_Pnt aP = BRep_Tool::Pnt(aV); + + bool isFound = false; + TopTools_MapOfShape mapShape; + TopExp_Explorer exp (aWireNew, TopAbs_VERTEX); + for (; exp.More() && !isFound; exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Vertex aVi = TopoDS::Vertex(exp.Current()); + gp_Pnt aPi = BRep_Tool::Pnt(aVi); + if (aPi.Distance(aP) < tolMax) { + aVertexListNew.Append(aVi); + isFound = true; + } + } + } + } + } + + // 3. Repeat the fillet algorithm + isFinalPass = true; + MakeFillet(aWireNew, aVertexListNew, rad, isFinalPass, aResult); + } + + aFunction->SetValue(aResult); + log.SetTouched(Label()); + + return 1; +} + +//======================================================================= +//function : MakeFillet +//purpose : +//======================================================================= +bool GEOMImpl_Fillet1dDriver::MakeFillet(const TopoDS_Wire& aWire, + const TopTools_ListOfShape& aVertexList, + const Standard_Real rad, + bool isFinalPass, + TopoDS_Wire& aResult) const +{ + // this variable is needed to break execution + // in case of fillet failure and try to fuse edges + bool isAllStepsOk = true; + + //INFO: this algorithm implemented in assumption that user can select both + // vertices of some edges to make fillet. In this case we should remember + // already modified initial edges to take care in next fillet step + TopTools_DataMapOfShapeShape anEdgeToEdgeMap; + + //iterates on vertices, and make fillet on each couple of edges + //collect result fillet edges in list + TopTools_ListOfShape aListOfNewEdge; + // remember relation between initial and modified map + TopTools_IndexedDataMapOfShapeListOfShape aMapVToEdges; + TopExp::MapShapesAndAncestors( aWire, TopAbs_VERTEX, TopAbs_EDGE, aMapVToEdges ); + TopTools_ListIteratorOfListOfShape anIt( aVertexList ); + for ( ; anIt.More(); anIt.Next() ) { + TopoDS_Vertex aV = TopoDS::Vertex( anIt.Value() ); + if ( aV.IsNull() || !aMapVToEdges.Contains( aV ) ) + continue; + const TopTools_ListOfShape& aVertexEdges = aMapVToEdges.FindFromKey( aV ); + if ( aVertexEdges.Extent() != 2 ) + continue; // no input data to make fillet + TopoDS_Edge anEdge1 = TopoDS::Edge( aVertexEdges.First() ); + TopoDS_Edge anEdge2 = TopoDS::Edge( aVertexEdges.Last() ); + // check if initial edges already modified in previous fillet operation + if ( anEdgeToEdgeMap.IsBound( anEdge1 ) ) anEdge1 = TopoDS::Edge(anEdgeToEdgeMap.Find( anEdge1 )); + if ( anEdgeToEdgeMap.IsBound( anEdge2 ) ) anEdge2 = TopoDS::Edge(anEdgeToEdgeMap.Find( anEdge2 )); + if ( anEdge1.IsNull() || anEdge2.IsNull() || anEdge1.IsSame( anEdge2 ) ) + continue; //no input data to make fillet + + // create plane on 2 edges + gp_Pln aPlane; + if ( !takePlane(anEdge1, anEdge2, aV, aPlane) ) + continue; // seems edges does not belong to same plane or parallel (fillet can not be build) + + GEOMImpl_Fillet1d aFilletAlgo (anEdge1, anEdge2, aPlane); + if (!aFilletAlgo.Perform(rad)) { + if (isFinalPass) + continue; // can not create fillet with given radius + else { + isAllStepsOk = false; + break; // can not create fillet with given radius + } + } + + // take fillet result in given vertex + TopoDS_Edge aModifE1, aModifE2; + TopoDS_Edge aNewE = aFilletAlgo.Result(BRep_Tool::Pnt(aV), aModifE1, aModifE2); + if (aNewE.IsNull()) { + if (isFinalPass) + continue; // no result found + else { + isAllStepsOk = false; + break; // no result found + } + } + + // add new created edges and take modified edges + aListOfNewEdge.Append(aNewE); + + // check if wire edges modified, + // if yes, then map to original edges (from vertex-edges list), because edges can be modified before + if (aModifE1.IsNull() || !anEdge1.IsSame( aModifE1 )) + addEdgeRelation( anEdgeToEdgeMap, TopoDS::Edge(aVertexEdges.First()), aModifE1 ); + if (aModifE2.IsNull() || !anEdge2.IsSame( aModifE2 )) + addEdgeRelation( anEdgeToEdgeMap, TopoDS::Edge(aVertexEdges.Last()), aModifE2 ); + } + + if (anEdgeToEdgeMap.IsEmpty() && aListOfNewEdge.IsEmpty()) { + if (isFinalPass) + StdFail_NotDone::Raise("1D Fillet can't be computed on the given shape with the given radius"); + else + isAllStepsOk = false; + } + + if (!isAllStepsOk) + return false; + + // create new wire instead of original + for (TopExp_Explorer anExp (aWire, TopAbs_EDGE); anExp.More(); anExp.Next()) { + TopoDS_Shape anEdge = anExp.Current(); + if (!anEdgeToEdgeMap.IsBound(anEdge)) + aListOfNewEdge.Append(anEdge); + else if (!anEdgeToEdgeMap.Find(anEdge).IsNull()) + aListOfNewEdge.Append(anEdgeToEdgeMap.Find(anEdge)); + } + + GEOMImpl_IShapesOperations::SortShapes(aListOfNewEdge); + + BRepBuilderAPI_MakeWire aWireTool; + aWireTool.Add(aListOfNewEdge); + aWireTool.Build(); + if (!aWireTool.IsDone()) + return 0; + + aResult = aWireTool.Wire(); + + return isAllStepsOk; +} + + +//======================================================================= +//function : GEOMImpl_Fillet1dDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet1dDriver_Type_() +{ + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_Fillet1dDriver", + sizeof(GEOMImpl_Fillet1dDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_Fillet1dDriver) Handle(GEOMImpl_Fillet1dDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_Fillet1dDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_Fillet1dDriver))) { + _anOtherObject = Handle(GEOMImpl_Fillet1dDriver)((Handle(GEOMImpl_Fillet1dDriver)&)AnObject); + } + } + + return _anOtherObject; +} diff --git a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx new file mode 100644 index 000000000..dc8b9da89 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx @@ -0,0 +1,167 @@ +// Copyright (C) 2007-2012 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 + +// File : GEOMImpl_Fillet1dDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_Fillet1dDriver_HeaderFile +#define _GEOMImpl_Fillet1dDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +#include +#include + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_Fillet1dDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_Fillet1dDriver); + +class Handle(GEOMImpl_Fillet1dDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_Fillet1dDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_Fillet1dDriver)(const Handle(GEOMImpl_Fillet1dDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_Fillet1dDriver)(const GEOMImpl_Fillet1dDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_Fillet1dDriver)& operator=(const Handle(GEOMImpl_Fillet1dDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_Fillet1dDriver)& operator=(const GEOMImpl_Fillet1dDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_Fillet1dDriver* operator->() + { + return (GEOMImpl_Fillet1dDriver *)ControlAccess(); + } + + GEOMImpl_Fillet1dDriver* operator->() const + { + return (GEOMImpl_Fillet1dDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_Fillet1dDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_Fillet1dDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_Fillet1dDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_Fillet1dDriver(); + Standard_EXPORT ~GEOMImpl_Fillet1dDriver() {}; + + Standard_EXPORT static const Standard_GUID& GetID(); + + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_Fillet1dDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { return STANDARD_TYPE(GEOMImpl_Fillet1dDriver) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { return (STANDARD_TYPE(GEOMImpl_Fillet1dDriver) == AType || TFunction_Driver::IsKind(AType)); } + +private: + + Standard_EXPORT bool MakeFillet(const TopoDS_Wire&, const TopTools_ListOfShape&, + const Standard_Real, bool, TopoDS_Wire&) const; + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx index f7f2050ae..76049a6f4 100755 --- a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx @@ -1,18 +1,17 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2007-2012 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 +// 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 +// +// 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 +// 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 @@ -24,17 +23,22 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include +#include #include #include +#include +#include #include #include @@ -76,29 +80,96 @@ Standard_Integer GEOMImpl_Fillet2dDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; Handle(GEOM_Function) aRefShape = aCI.GetShape(); - TopoDS_Face aFaceShape = TopoDS::Face(aRefShape->GetValue()); - - if (aFaceShape.ShapeType() != TopAbs_FACE) - Standard_ConstructionError::Raise("Wrong arguments: two faces must be given"); - - BRepFilletAPI_MakeFillet2d fillet2d (aFaceShape); + TopoDS_Shape aFaceShape = aRefShape->GetValue(); int aLen = aCI.GetLength(); - int ind = 1; double rad = aCI.GetR(); - for (; ind <= aLen; ind++) { - TopoDS_Shape aShapeVertex; - if (GEOMImpl_ILocalOperations::GetSubShape - (aFaceShape, aCI.GetVertex(ind), aShapeVertex)) { - fillet2d.AddFillet(TopoDS::Vertex(aShapeVertex), rad); + + if (aFaceShape.ShapeType() == TopAbs_FACE) { + BRepFilletAPI_MakeFillet2d fillet2d (TopoDS::Face(aFaceShape)); + + int ind = 1; + for (; ind <= aLen; ind++) { + TopoDS_Shape aShapeVertex; + if (GEOMImpl_ILocalOperations::GetSubShape + (aFaceShape, aCI.GetVertex(ind), aShapeVertex)) { + fillet2d.AddFillet(TopoDS::Vertex(aShapeVertex), rad); + } + } + + fillet2d.Build(); + if (!fillet2d.IsDone()) { + StdFail_NotDone::Raise("2D Fillet can't be computed on the given shape with the given radius"); } + aShape = fillet2d.Shape(); } + else if (aFaceShape.ShapeType() == TopAbs_SHELL) { + // 1. Map vertices to faces to build fillets only on corner vertices + TopTools_IndexedDataMapOfShapeListOfShape mapVertexFaces; + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (aFaceShape, TopAbs_VERTEX, TopAbs_FACE, mapVertexFaces); + + // 2. Map faces to vertices + TopTools_IndexedDataMapOfShapeListOfShape mapFaceVertices; + TopTools_ListOfShape empty; + int ind = 1; + for (; ind <= aLen; ind++) { + TopoDS_Shape aVi; + if (GEOMImpl_ILocalOperations::GetSubShape(aFaceShape, aCI.GetVertex(ind), aVi)) { + Standard_Integer aVi_index = mapVertexFaces.FindIndex(aVi); + if (aVi_index > 0) { + const TopTools_ListOfShape& aFacesOfVi = mapVertexFaces(aVi_index); + if (aFacesOfVi.Extent() == 1) { // we use only corner vertices of shell + TopoDS_Shape aFi = aFacesOfVi.First(); + Standard_Integer aFi_index = mapFaceVertices.FindIndex(aFi); + if (aFi_index == 0) aFi_index = mapFaceVertices.Add(aFi, empty); + mapFaceVertices(aFi_index).Append(aVi); + } + } + } + } + + // 3. Build fillet on each given vertex + TopoDS_Shell aResult; + BRep_Builder B; + B.MakeShell(aResult); + + TopoDS_Iterator It (aFaceShape, Standard_True, Standard_True); + TopTools_MapOfShape mapShape; + for (; It.More(); It.Next()) { + if (mapShape.Add(It.Value())) { + Standard_Integer aFi_index = mapFaceVertices.FindIndex(It.Value()); + if (aFi_index == 0) { + // No fillets requested on this face, add it as is + B.Add(aResult, It.Value()); + } + else { + // Build a fillet and add the changed face + BRepFilletAPI_MakeFillet2d fillet2d (TopoDS::Face(It.Value())); + const TopTools_ListOfShape& aVertsOfFi = mapFaceVertices(aFi_index); + TopTools_ListIteratorOfListOfShape itV (aVertsOfFi); + for (; itV.More(); itV.Next()) { + fillet2d.AddFillet(TopoDS::Vertex(itV.Value()), rad); + } + + fillet2d.Build(); + if (!fillet2d.IsDone()) { + StdFail_NotDone::Raise("2D Fillet can't be computed on the given shape with the given radius"); + } + TopoDS_Shape aFillet = fillet2d.Shape(); + + B.Add(aResult, aFillet); + } + } + } - fillet2d.Build(); - if (!fillet2d.IsDone()) { - StdFail_NotDone::Raise("2D Fillet can't be computed on the given shape with the given radius"); + // 4. Build a shell + // ?TODO? + aShape = aResult; + } + else { + Standard_ConstructionError::Raise("Wrong arguments: a face or a shell must be given"); } - aShape = fillet2d.Shape(); if (aShape.IsNull()) return 0; @@ -115,7 +186,6 @@ Standard_Integer GEOMImpl_Fillet2dDriver::Execute(TFunction_Logbook& log) const //======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_() { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); @@ -123,13 +193,12 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_() static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_Fillet2dDriver", - sizeof(GEOMImpl_Fillet2dDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_Fillet2dDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -138,7 +207,8 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_() //function : DownCast //purpose : //======================================================================= -const Handle(GEOMImpl_Fillet2dDriver) Handle(GEOMImpl_Fillet2dDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +const Handle(GEOMImpl_Fillet2dDriver) Handle(GEOMImpl_Fillet2dDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_Fillet2dDriver) _anOtherObject; @@ -148,5 +218,5 @@ const Handle(GEOMImpl_Fillet2dDriver) Handle(GEOMImpl_Fillet2dDriver)::DownCast( } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx index a5448db66..c3ba4df28 100755 --- a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx @@ -1,25 +1,25 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2007-2012 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 +// 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 +// +// 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 +// 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 // + // File : GEOMImpl_Fillet2dDriver.ixx // Module : GEOMImpl - +// #ifndef _GEOMImpl_Fillet2dDriver_HeaderFile #define _GEOMImpl_Fillet2dDriver_HeaderFile diff --git a/src/GEOMImpl/GEOMImpl_FilletDriver.cxx b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx index af8f67064..01d1dcd2b 100644 --- a/src/GEOMImpl/GEOMImpl_FilletDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -87,17 +88,19 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const TopoDS_Edge E = TopoDS::Edge(Exp.Current()); fill.Add(E); } - } else if (aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_EDGES_2R) { + } + else if (aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_EDGES_2R) { int aLen = aCI.GetLength(); int ind = 1; for (; ind <= aLen; ind++) { TopoDS_Shape aShapeEdge; if (GEOMImpl_ILocalOperations::GetSubShape (aShapeBase, aCI.GetEdge(ind), aShapeEdge)) { - fill.Add(TopoDS::Edge(aShapeEdge)); + fill.Add(TopoDS::Edge(aShapeEdge)); } } - } else if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_FACES_2R) { + } + else if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_FACES_2R) { int aLen = aCI.GetLength(); int ind = 1; for (; ind <= aLen; ind++) { @@ -110,16 +113,19 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const } } } - } else { } - if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_ALL) + else { + } + + if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_ALL) { for (int i = 1; i <= fill.NbContours(); i++) fill.SetRadius(aCI.GetR(), i, 1); - else if (aType == FILLET_SHAPE_FACES_2R || aType == FILLET_SHAPE_EDGES_2R) - for (int i = 1; i <= fill.NbContours(); i++) - { - fill.SetRadius(aCI.GetR1(), aCI.GetR2(), i, 1); - } + } + else if (aType == FILLET_SHAPE_FACES_2R || aType == FILLET_SHAPE_EDGES_2R) { + for (int i = 1; i <= fill.NbContours(); i++) { + fill.SetRadius(aCI.GetR1(), aCI.GetR2(), i, 1); + } + } fill.Build(); if (!fill.IsDone()) { @@ -169,10 +175,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_FilletDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FilletDriver", - sizeof(GEOMImpl_FilletDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_FilletDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_FilletDriver.hxx b/src/GEOMImpl/GEOMImpl_FilletDriver.hxx index d5ac84451..b1ba69bb2 100644 --- a/src/GEOMImpl/GEOMImpl_FilletDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_FilletDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_FilletDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx index 5be038b34..0b47281ec 100644 --- a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx @@ -1,55 +1,73 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 #include -#include #include #include +#include + +#include + +#include + #include #include +#include #include +#include #include +#include #include +#include +#include #include -#include +#include #include #include #include +#include +#include +#include +#include +#include #include #include #include #include +#include +#include + +#include + +#include +#include #include -#include -#include -#include -#include -#include +#include //======================================================================= //function : GetID @@ -61,7 +79,6 @@ const Standard_GUID& GEOMImpl_FillingDriver::GetID() return aFillingDriver; } - //======================================================================= //function : GEOMImpl_FillingDriver //purpose : @@ -80,20 +97,22 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); if (aFunction.IsNull()) return 0; - if (aFunction->GetType() != BASIC_FILLING) return 0; GEOMImpl_IFilling IF (aFunction); Handle(GEOM_Function) aShapeFunction = IF.GetShape(); if (aShapeFunction.IsNull()) return 0; - TopoDS_Shape aShape = aShapeFunction->GetValue(); + + TopoDS_Shape aShape; + BRepBuilderAPI_Copy Copy (aShapeFunction->GetValue()); + if (Copy.IsDone()) + aShape = Copy.Shape(); + if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return 0; Standard_Integer mindeg = IF.GetMinDeg(); Standard_Integer maxdeg = IF.GetMaxDeg(); - Standard_Real tol3d = IF.GetTol2D(); - Standard_Real tol2d = IF.GetTol3D(); - Standard_Integer nbiter = IF.GetNbIter(); + Standard_Real tol3d = IF.GetTol3D(); Standard_Boolean isApprox = IF.GetApprox(); if (mindeg > maxdeg) { @@ -106,23 +125,155 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const Standard_Real First, Last; Handle(Geom_Curve) C; + TopoDS_Compound aComp; + BRep_Builder B; + B.MakeCompound(aComp); + + // 1. Convert argument wires, if any, into BSpline edges TopoDS_Iterator It (aShape); for (; It.More(); It.Next()) { Scurrent = It.Value(); - if (Scurrent.ShapeType() != TopAbs_EDGE) - Standard_ConstructionError::Raise("The argument compound must contain only edges"); + if (Scurrent.ShapeType() != TopAbs_EDGE) { + Handle(Geom_BSplineCurve) newC; + if (Scurrent.ShapeType() == TopAbs_WIRE) { + TColgp_SequenceOfPnt PntSeq; + // collect points + for (Ex.Init(Scurrent, TopAbs_EDGE); Ex.More(); Ex.Next()) { + TopoDS_Edge E = TopoDS::Edge(Ex.Current()); + if (BRep_Tool::Degenerated(E)) continue; + C = BRep_Tool::Curve(E, First, Last); + if( E.Orientation() == TopAbs_REVERSED ) { + C->Reverse(); + } + Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C); + while( !tc.IsNull() ) { + C = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C); + } + int nbp = 10; + if( C->IsKind(STANDARD_TYPE(Geom_Line)) ) { + nbp = 4; + } + else if( C->IsKind(STANDARD_TYPE(Geom_Circle)) || + C->IsKind(STANDARD_TYPE(Geom_Ellipse)) ) { + nbp = (int)25*fabs(Last-First)/(2.*M_PI); + } + else if( C->IsKind(STANDARD_TYPE(Geom_BezierCurve)) ) { + Handle(Geom_BezierCurve) C3d = Handle(Geom_BezierCurve)::DownCast(C); + nbp = C3d->NbPoles(); + } + else if( C->IsKind(STANDARD_TYPE(Geom_BSplineCurve)) ) { + Handle(Geom_BSplineCurve) C3d = Handle(Geom_BSplineCurve)::DownCast(C); + nbp = C3d->NbPoles(); + } + else { + } + if( nbp<4 ) nbp = 4; + double dp = (Last-First)/(nbp-1); + for(int i=1; iD0(First+dp*(i-1),P); + PntSeq.Append(P); + } + } + // add last point + gp_Pnt P; + C->D0(Last,P); + PntSeq.Append(P); + // create BSpline + if(PntSeq.Length()>1) { + TColgp_Array1OfPnt Pnts(1,PntSeq.Length()); + // check orientation of wire + if( Scurrent.Orientation() == TopAbs_REVERSED ) { + for(int i=1; i<=PntSeq.Length(); i++) { + Pnts.SetValue(PntSeq.Length()-i+1,PntSeq.Value(i)); + } + } + else { + for(int i=1; i<=PntSeq.Length(); i++) { + Pnts.SetValue(i,PntSeq.Value(i)); + } + } + GeomAPI_PointsToBSpline PTB (Pnts); + newC = Handle(Geom_BSplineCurve)::DownCast(PTB.Curve()); + // set periodic flag if curve is closed + //if( newC->IsClosed() ) { + // newC->SetPeriodic(); + //} + // create edge + double fp = newC->FirstParameter(); + double lp = newC->FirstParameter(); + gp_Pnt PF,PL; + newC->D0(fp,PF); + newC->D0(lp,PL); + TopoDS_Vertex VF,VL; + B.MakeVertex(VF,PF,1.e-7); + B.MakeVertex(VL,PL,1.e-7); + TopoDS_Edge newE; + B.MakeEdge(newE,newC,1.e-7); + B.Add(newE,VF); + B.Add(newE,VL.Reversed()); + Scurrent = newE; + } + } + if (newC.IsNull()) { + Standard_ConstructionError::Raise("The argument compound must contain only edges"); + } + } + B.Add(aComp,Scurrent); } + aShape = aComp; + // 2. The surface construction if (!isApprox) { // make filling as in old version of SALOME (before 4.1.1) + + Standard_Real tol2d = IF.GetTol2D(); + Standard_Integer nbiter = IF.GetNbIter(); + Standard_Integer aMethod = IF.GetMethod(); + GeomFill_SectionGenerator Section; Standard_Integer i = 0; + Handle(Geom_Curve) aLastC; + gp_Pnt PL1,PL2; for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) { Scurrent = Ex.Current(); if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0; if (BRep_Tool::Degenerated(TopoDS::Edge(Scurrent))) continue; C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); + //if (Scurrent.Orientation() == TopAbs_REVERSED) + // // Mantis isuue 0020659: consider the orientation of the edges + // C = new Geom_TrimmedCurve(C, Last, First); + //else + // C = new Geom_TrimmedCurve(C, First, Last); C = new Geom_TrimmedCurve(C, First, Last); + gp_Pnt P1,P2; + C->D0(First,P1); + C->D0(Last,P2); + + if (aMethod == 1 && Scurrent.Orientation() == TopAbs_REVERSED) { + C->Reverse(); + } + else if (aMethod == 2) { + if (i == 0) { + PL1 = P1; + PL2 = P2; + } + else { + double d1 = PL1.Distance(P1) + PL2.Distance(P2); + double d2 = PL1.Distance(P2) + PL2.Distance(P1); + if (d2 < d1) { + C->Reverse(); + PL1 = P2; + PL2 = P1; + } + else { + PL1 = P1; + PL2 = P2; + } + } + } + Section.AddCurve(C); i++; } @@ -130,26 +281,32 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const /* a 'tolerance' is used to compare 2 knots : see GeomFill_Generator.cdl */ Section.Perform(Precision::Confusion()); Handle(GeomFill_Line) Line = new GeomFill_Line(i); - + GeomFill_AppSurf App (mindeg, maxdeg, tol3d, tol2d, nbiter); /* user parameters */ App.Perform(Line, Section); - + if (!App.IsDone()) return 0; Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots; App.SurfShape(UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots); Handle(Geom_BSplineSurface) GBS = new Geom_BSplineSurface (App.SurfPoles(), App.SurfWeights(), App.SurfUKnots(), App.SurfVKnots(), App.SurfUMults(), App.SurfVMults(), App.UDegree(), App.VDegree()); - + if (GBS.IsNull()) return 0; +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + aShape = BRepBuilderAPI_MakeFace(GBS, Precision::Confusion()); +#else aShape = BRepBuilderAPI_MakeFace(GBS); - } +#endif + } else { // implemented by skl 20.03.2008 for bug 16568 // make approximation - try to create bspline surface // using GeomAPI_PointsToBSplineSurface + TColGeom_SequenceOfCurve aSeq; int MaxNbPoles = 0; + // add curves from edges to sequence and find maximal // number of poles if some of them are bsplines for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) { @@ -158,21 +315,21 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const if (BRep_Tool::Degenerated(TopoDS::Edge(Scurrent))) continue; C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); Handle(Geom_TrimmedCurve) TC = Handle(Geom_TrimmedCurve)::DownCast(C); - if(TC.IsNull()) { + if (TC.IsNull()) { Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(C); - if(!BC.IsNull()) { + if (!BC.IsNull()) { MaxNbPoles = Max(MaxNbPoles,BC->NbPoles()); } } else { Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(TC->BasisCurve()); - if(BC.IsNull()) { + if (BC.IsNull()) { Handle(Geom_TrimmedCurve) TC1 = Handle(Geom_TrimmedCurve)::DownCast(TC->BasisCurve()); - if(!TC1.IsNull()) { + if (!TC1.IsNull()) { BC = Handle(Geom_BSplineCurve)::DownCast(TC1->BasisCurve()); } } - if(!BC.IsNull()) { + if (!BC.IsNull()) { MaxNbPoles = Max(MaxNbPoles,BC->NbPoles()); } } @@ -183,27 +340,34 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const // by V parameter - determ using MaxNbPoles but it's // value must be between 21(min) and 101(max) int nbc = aSeq.Length(); - int nbp = Max(21,2*MaxNbPoles-1); - if(nbp>101) nbp = 101; - TColgp_Array2OfPnt Points(1,nbc,1,nbp); + int nbp = Max(21, 2*MaxNbPoles-1); + + // commented for Mantis issue 0021541 + //if (nbp > 101) nbp = 101; + + TColgp_Array2OfPnt Points (1, nbc, 1, nbp); int ic = 1; - for(; ic<=nbc; ic++) { + for (; ic <= nbc; ic++) { Handle(Geom_Curve) C = aSeq.Value(ic); double fp = C->FirstParameter(); double lp = C->LastParameter(); double dp = (lp-fp)/(nbp-1); int j = 0; gp_Pnt P; - for(; jD0(fp+dp*j,P); - Points.SetValue(ic,j+1,P); - } + for (; j < nbp; j++) { + C->D0(fp+dp*j, P); + Points.SetValue(ic, j+1, P); + } } - GeomAPI_PointsToBSplineSurface PTB(Points,mindeg,maxdeg,GeomAbs_C2,tol3d); + GeomAPI_PointsToBSplineSurface PTB (Points, mindeg, maxdeg, GeomAbs_C2, tol3d); Handle(Geom_BSplineSurface) BS = PTB.Surface(); - BRepBuilderAPI_MakeFace BB(BS); +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + BRepBuilderAPI_MakeFace BB (BS, Precision::Confusion()); +#else + BRepBuilderAPI_MakeFace BB (BS); +#endif TopoDS_Face NewF = BB.Face(); - Handle(ShapeFix_Face) sff = new ShapeFix_Face(NewF); + Handle(ShapeFix_Face) sff = new ShapeFix_Face (NewF); sff->Perform(); sff->FixOrientation(); aShape = sff->Face(); @@ -211,7 +375,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const /* We test the validity of resulting shape */ if (!BRepAlgo::IsValid((aShape))) { - Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); + Standard_ConstructionError::Raise("Algorithm has produced an invalid shape result"); return 0; } @@ -228,7 +392,6 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const //======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_FillingDriver_Type_() { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); @@ -236,13 +399,12 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_FillingDriver_Type_() static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FillingDriver", - sizeof(GEOMImpl_FillingDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_FillingDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -251,8 +413,8 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_FillingDriver_Type_() //function : DownCast //purpose : //======================================================================= - -const Handle(GEOMImpl_FillingDriver) Handle(GEOMImpl_FillingDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +const Handle(GEOMImpl_FillingDriver) Handle(GEOMImpl_FillingDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_FillingDriver) _anOtherObject; @@ -262,7 +424,5 @@ const Handle(GEOMImpl_FillingDriver) Handle(GEOMImpl_FillingDriver)::DownCast(co } } - return _anOtherObject ; + return _anOtherObject; } - - diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.hxx b/src/GEOMImpl/GEOMImpl_FillingDriver.hxx index 753439de2..0fb90d0aa 100644 --- a/src/GEOMImpl/GEOMImpl_FillingDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_FillingDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx index b01b3f88a..884da5cb1 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.cxx +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifdef WNT #pragma warning( disable:4786 ) #endif @@ -62,10 +63,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -78,6 +81,11 @@ #include #include #include +// Advanced operations +#include +#include +// #include +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ //============================================================================= /*! @@ -134,6 +142,7 @@ GEOMImpl_Gen::GEOMImpl_Gen() // Local Operations TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet1dDriver::GetID(), new GEOMImpl_Fillet1dDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet2dDriver::GetID(), new GEOMImpl_Fillet2dDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver()); @@ -141,6 +150,7 @@ GEOMImpl_Gen::GEOMImpl_Gen() TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TranslateDriver::GetID(), new GEOMImpl_TranslateDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RotateDriver::GetID(), new GEOMImpl_RotateDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MirrorDriver::GetID(), new GEOMImpl_MirrorDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ProjectionDriver::GetID(), new GEOMImpl_ProjectionDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_OffsetDriver::GetID(), new GEOMImpl_OffsetDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ScaleDriver::GetID(), new GEOMImpl_ScaleDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PositionDriver::GetID(), new GEOMImpl_PositionDriver()); @@ -156,6 +166,12 @@ 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()); + /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ + SetEngine(this); } @@ -385,3 +401,18 @@ 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 c777a3a6b..8378dbe55 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.hxx +++ b/src/GEOMImpl/GEOMImpl_Gen.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_GEN_HXX_ #define _GEOMImpl_GEN_HXX_ @@ -38,6 +39,7 @@ #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 @@ -70,6 +72,8 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine GEOMImpl_IGroupOperations* GetIGroupOperations(int theDocID); + GEOMImpl_IAdvancedOperations* GetIAdvancedOperations(int theDocID); + private: std::map _mapOfBasicOperations; @@ -83,7 +87,8 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine std::map _mapOfLocalOperations; std::map _mapOfInsertOperations; std::map _mapOfMeasureOperations; - std::map _mapOfGroupOperations; + std::map _mapOfGroupOperations; + std::map _mapOfAdvancedOperations; }; #endif diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx index cd6235466..8de926b7c 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -28,22 +29,26 @@ #include #include -#include -#include "GEOMAlgo_Gluer1.hxx" +#include "GEOMAlgo_Gluer2.hxx" #include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" #include "GEOMAlgo_CoupleOfShapes.hxx" #include "GEOMAlgo_ListOfCoupleOfShapes.hxx" +#include + #include "utilities.h" #include #include #include -#include +#include #include +#include #include +#include + #include #include @@ -72,6 +77,7 @@ const Standard_GUID& GEOMImpl_GlueDriver::GetID() //function : GlueFacesWithWarnings //purpose : //======================================================================= +/* TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape, const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids, @@ -146,6 +152,12 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the aRes = aGluer.Result(); + // SKL 18.01.2010 - patch for 20662 + Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aRes); + aSfs->SetPrecision(Precision::Confusion()); + aSfs->Perform(); + aRes = aSfs->Shape(); + // Fill history to be used by GetInPlace functionality TopTools_IndexedMapOfShape aResIndices; TopExp::MapShapes(aRes, aResIndices); @@ -194,7 +206,6 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the return aRes; } - //======================================================================= //function : GlueFaces //purpose : @@ -203,7 +214,6 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids) { - Standard_Integer iErr, iWrn; TopoDS_Shape aRes; GEOMAlgo_Gluer aGluer; @@ -214,7 +224,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, aGluer.Perform(); - iErr = aGluer.ErrorStatus(); + Standard_Integer iErr = aGluer.ErrorStatus(); if (iErr) { switch (iErr) { case 2: @@ -241,7 +251,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, return aRes; } - iWrn = aGluer.WarningStatus(); + Standard_Integer iWrn = aGluer.WarningStatus(); if (iWrn) { switch (iWrn) { case 1: @@ -259,15 +269,14 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, return aRes; } - //======================================================================= //function : GlueFacesByList //purpose : //======================================================================= TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, - const Standard_Real theTolerance, + const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids, - const TopTools_MapOfShape& aFaces) + const TopTools_MapOfShape& aFaces) { TopoDS_Shape aRes; @@ -291,14 +300,14 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value(); const TopoDS_Shape& aF1 = aCSG.Shape1(); const TopoDS_Shape& aF2 = aCSG.Shape2(); - if( aFaces.Contains(aF1) || aFaces.Contains(aF2) ) + if (aFaces.Contains(aF1) || aFaces.Contains(aF2)) continue; aCS.SetShapes(aF1,aF2); aLCS.Append(aCS); } //cout<<"aLCS.Extent() = "<0) { + if (aLCS.Extent()>0) { aGluer.SetFacesToUnglue(aLCS); aGluer.UnglueFaces(); iErr = aGluer.ErrorStatus(); @@ -309,7 +318,397 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, return aRes; } +*/ + +//======================================================================= +//function : GlueFaces +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids) +{ + TopoDS_Shape aRes; + + GEOMAlgo_Gluer2 aGA; + + // 1. Initialization + aGA.SetArgument(theShape); + aGA.SetTolerance(theTolerance); + aGA.SetKeepNonSolids(doKeepNonSolids); + + // 2. Detect interferred shapes + aGA.Detect(); + + //Standard_Integer iWrnDetect = aGA.WarningStatus(); + //if (iWrnDetect == 2) { + // Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES"); + //} + + Standard_Integer iErr = aGA.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 11: + Standard_Failure::Raise("GEOMAlgo_GlueDetector failed"); + break; + case 13: + case 14: + Standard_Failure::Raise("PerformImagesToWork failed"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer2.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + // 3. Set shapes to glue. If the operator is absent, the whole gluing will be done + //aGA.SetShapesToGlue(aMSG); + + // 4. Gluing + aGA.Perform(); + iErr = aGA.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 11: + Standard_Failure::Raise("GEOMAlgo_GlueDetector failed"); + break; + case 13: + case 14: + Standard_Failure::Raise("PerformImagesToWork failed"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer2.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + Standard_Integer iWrn = aGA.WarningStatus(); + if (iWrn) { + switch (iWrn) { + case 1: + MESSAGE("No shapes to glue"); + break; + default: + // description of all warnings see in GEOMAlgo_Gluer2.cxx + MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn); + break; + } + } + // 5. Result + aRes = aGA.Shape(); + + return aRes; +} + +//======================================================================= +//function : GlueWithWarnings +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const TopAbs_ShapeEnum theShapeType, + const Standard_Boolean doKeepNonSolids, + TCollection_AsciiString& theWarning) const +{ + TopoDS_Shape aRes; + + GEOMAlgo_Gluer2 aGA; + + // 1. Initialization + aGA.SetArgument(theShape); + aGA.SetTolerance(theTolerance); + aGA.SetKeepNonSolids(doKeepNonSolids); + + // 2. Detect interferred shapes + aGA.Detect(); + + //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f +#if OCC_VERSION_LARGE > 0x06050200 + Standard_Integer iWrnDetect = aGA.WarningStatus(); + if (iWrnDetect == 2) { + /* + TopTools_ListIteratorOfListOfShape aItLS; + + // Sticked shapes are detected + const TopTools_IndexedDataMapOfShapeListOfShape& aIDMSS = pGluer2->StickedShapes(); + + Standard_Integer i, aNb = aIDMSS.Extent(); + for (i = 1; i <= aNb; ++i) { + // ancestor aSa (edge, wire face,..) + const TopoDS_Shape& aSa = aIDMSS.FindKey(i); + + // successors aSs (vertex, edge, ...) + // of the ancestor that are sticked + // for given value of the tolerance + const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i); + aItLS.Initialize(aLSS); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aSs = aItLS.Value(); + } + } + */ + Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES"); + //Standard_Failure::Raise("Sticked shapes are detected. The tolerance value is too big."); + //theWarning = "Sticked shapes are detected. The tolerance value is too big."; + } +#endif + //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t + + Standard_Integer iErr = aGA.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 11: + Standard_Failure::Raise("GEOMAlgo_GlueDetector failed"); + break; + case 13: + case 14: + Standard_Failure::Raise("PerformImagesToWork failed"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer2.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + if (theShapeType != TopAbs_FACE) { + // 3. Fill shapes to glue aMSG + TopTools_DataMapOfShapeListOfShape aMSG; + const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected(); + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD; + aItMSD.Initialize(aMSD); + for (; aItMSD.More(); aItMSD.Next()) { + const TopoDS_Shape& aSx = aItMSD.Key(); + const TopTools_ListOfShape& aLSD = aItMSD.Value(); + if (aSx.ShapeType() == theShapeType) { + aMSG.Bind(aSx, aLSD); + } + } + + // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done + aGA.SetShapesToGlue(aMSG); + } + + // 5. Gluing + aGA.Perform(); + iErr = aGA.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 11: + Standard_Failure::Raise("GEOMAlgo_GlueDetector failed"); + break; + case 13: + case 14: + Standard_Failure::Raise("PerformImagesToWork failed"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer2.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + Standard_Integer iWrn = aGA.WarningStatus(); + if (iWrn) { + switch (iWrn) { + case 1: + theWarning = "No shapes to glue"; + break; + default: + // description of all warnings see in GEOMAlgo_Gluer2.cxx + theWarning = "Warning in GEOMAlgo_Gluer2 with code "; + theWarning += TCollection_AsciiString(iWrn); + break; + } + } + + // 6. Result + aRes = aGA.Shape(); + + // 7. Fill history to be used by GetInPlace functionality + TopTools_IndexedMapOfShape aResIndices; + TopExp::MapShapes(aRes, aResIndices); + + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + // history for all argument shapes + TDF_LabelSequence aLabelSeq; + aFunction->GetDependency(aLabelSeq); + Standard_Integer nbArg = aLabelSeq.Length(); + + for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) { + + TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg); + + Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel); + TopoDS_Shape anArgumentShape = anArgumentObject->GetValue(); + + TopTools_IndexedMapOfShape anArgumentIndices; + TopExp::MapShapes(anArgumentShape, anArgumentIndices); + Standard_Integer nbArgumentEntities = anArgumentIndices.Extent(); + + // Find corresponding label in history + TDF_Label anArgumentHistoryLabel = + aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True); + + for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) { + TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie); + const TopTools_ListOfShape& aModified = aGA.Modified(anEntity); + Standard_Integer nbModified = aModified.Extent(); + + if (nbModified > 0) { + TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True); + Handle(TDataStd_IntegerArray) anAttr = + TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified); + + TopTools_ListIteratorOfListOfShape itM (aModified); + for (int im = 1; itM.More(); itM.Next(), ++im) { + int id = aResIndices.FindIndex(itM.Value()); + anAttr->SetValue(im, id); + } + } + } + } + + return aRes; +} + +//======================================================================= +//function : GlueByList +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids, + const TopTools_MapOfShape& theShapesList, + const Standard_Boolean doGlueAllEdges) +{ + TopoDS_Shape aRes; + + GEOMAlgo_Gluer2 aGA; + + // 1. Initialization + aGA.SetArgument(theShape); + aGA.SetTolerance(theTolerance); + aGA.SetKeepNonSolids(doKeepNonSolids); + + // 2. Detect interferred shapes + aGA.Detect(); + Standard_Integer iErr = aGA.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 11: + Standard_Failure::Raise("GEOMAlgo_GlueDetector failed"); + break; + case 13: + case 14: + Standard_Failure::Raise("PerformImagesToWork failed"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer2.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + // 3. Fill shapes to glue aMSG + TopTools_DataMapOfShapeListOfShape aMSG; + const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected(); + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD; + aItMSD.Initialize(aMSD); + for (; aItMSD.More(); aItMSD.Next()) { + const TopoDS_Shape& aSx = aItMSD.Key(); + const TopTools_ListOfShape& aLSD = aItMSD.Value(); + TopTools_ListIteratorOfListOfShape anItLSD (aLSD); + bool isToGlue = false; + if (doGlueAllEdges && aSx.ShapeType() == TopAbs_EDGE) { + isToGlue = true; + } + else { + for (; anItLSD.More() && !isToGlue; anItLSD.Next()) { + if (theShapesList.Contains(anItLSD.Value())) { + isToGlue = true; + } + } + } + if (isToGlue) { + aMSG.Bind(aSx, aLSD); + } + } + + // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done + aGA.SetShapesToGlue(aMSG); + + // 5. Gluing + aGA.Perform(); + iErr = aGA.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 11: + Standard_Failure::Raise("GEOMAlgo_GlueDetector failed"); + break; + case 13: + case 14: + Standard_Failure::Raise("PerformImagesToWork failed"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer2.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + Standard_Integer iWrn = aGA.WarningStatus(); + if (iWrn) { + switch (iWrn) { + case 1: + MESSAGE("No shapes to glue"); + break; + default: + // description of all warnings see in GEOMAlgo_Gluer2.cxx + MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn); + break; + } + } + + // 6. Result + aRes = aGA.Shape(); + + return aRes; +} //======================================================================= //function : Execute @@ -337,26 +736,36 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids(); if (aType == GLUE_FACES) { - aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn); + //aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn); + aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_FACE, aKeepNonSolids, aWrn); } - else { // aType == GLUE_FACES_BY_LIST + else if (aType == GLUE_EDGES) { + aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_EDGE, aKeepNonSolids, aWrn); + } + else if (aType == GLUE_FACES_BY_LIST || aType == GLUE_EDGES_BY_LIST) { Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces(); TopTools_MapOfShape aFaces; - int i=1; - for( ; i <= SF->Length(); i++) { + int i = 1; + for (; i <= SF->Length(); i++) { Handle(Standard_Transient) anItem = SF->Value(i); - if(anItem.IsNull()) - continue; + if (anItem.IsNull()) + continue; Handle(GEOM_Function) aRefSh = Handle(GEOM_Function)::DownCast(anItem); - if(aRefSh.IsNull()) - continue; + if (aRefSh.IsNull()) + continue; TopoDS_Shape aFace = aRefSh->GetValue(); - if(aFace.IsNull()) - continue; - if(!aFaces.Contains(aFace)) - aFaces.Add(aFace); + if (aFace.IsNull()) + continue; + if (!aFaces.Contains(aFace)) + aFaces.Add(aFace); } - aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces); + + Standard_Boolean aGlueAllEdges = Standard_False; + if (aType == GLUE_FACES_BY_LIST) + aGlueAllEdges = aCI.GetGlueAllEdges(); + + //aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces); + aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces, aGlueAllEdges); } if (aShape.IsNull()) return 0; @@ -380,19 +789,19 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_GlueDriver_Type_() { static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_GlueDriver", - sizeof(GEOMImpl_GlueDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_GlueDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -411,5 +820,5 @@ const Handle(GEOMImpl_GlueDriver) Handle(GEOMImpl_GlueDriver)::DownCast(const Ha } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx index 1121c2f6d..9337f2782 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_GlueDriver.ixx // Module : GEOMImpl -// + #ifndef _GEOMImpl_GlueDriver_HeaderFile #define _GEOMImpl_GlueDriver_HeaderFile @@ -154,16 +155,28 @@ Standard_EXPORT ~GEOMImpl_GlueDriver() {}; Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape, const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids = Standard_True); - + /* Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape, const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids, TCollection_AsciiString& theWarning) const; Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShape, - const Standard_Real theTolerance, + const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids, - const TopTools_MapOfShape& aFaces); + const TopTools_MapOfShape& aFaces); + */ +Standard_EXPORT TopoDS_Shape GlueWithWarnings (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const TopAbs_ShapeEnum theShapeType, + const Standard_Boolean doKeepNonSolids, + TCollection_AsciiString& theWarning) const; + +Standard_EXPORT static TopoDS_Shape GlueByList (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const Standard_Boolean doKeepNonSolids, + const TopTools_MapOfShape& theShapesList, + const Standard_Boolean doGlueAllEdges); // Type management diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx index 9516c6137..7771033fb 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 #include @@ -26,6 +26,9 @@ #include #include +#include +#include + #include #include #include @@ -35,11 +38,30 @@ #include #include -#include +#include + +#include +#include + +#include +#include +#include +#include + #include +#include +#include +#include #include +#include +#include + +#include + +#include #include +#include //======================================================================= //function : raiseNotDoneExeption @@ -66,12 +88,10 @@ const Standard_GUID& GEOMImpl_HealingDriver::GetID() return aHealingDriver; } - //======================================================================= //function : GEOMImpl_HealingDriver //purpose : //======================================================================= - GEOMImpl_HealingDriver::GEOMImpl_HealingDriver() { } @@ -120,6 +140,15 @@ Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const case CHANGE_ORIENTATION: ChangeOrientation(&HI, anOriginalShape, aShape); break; + case LIMIT_TOLERANCE: + LimitTolerance(&HI, anOriginalShape, aShape); + break; + case FUSE_COLLINEAR_EDGES: + { + Handle(TColStd_HSequenceOfTransient) aVerts = HI.GetShapes(); + FuseCollinearEdges(anOriginalShape, aVerts, aShape); + } + break; default: return 0; } @@ -183,19 +212,75 @@ Standard_Boolean GEOMImpl_HealingDriver::ShapeProcess (GEOMImpl_IHealing* theHI, //function : SupressFaces //purpose : //======================================================================= +void SuppressFacesRec (const TopTools_SequenceOfShape& theShapesFaces, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) +{ + if ((theOriginalShape.ShapeType() != TopAbs_COMPOUND && + theOriginalShape.ShapeType() != TopAbs_COMPSOLID)) + { + ShHealOper_RemoveFace aHealer (theOriginalShape); + Standard_Boolean aResult = aHealer.Perform(theShapesFaces); + + if (aResult) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption(aHealer.GetErrorStatus()); + } + else + { + BRep_Builder BB; + TopoDS_Compound CC; + BB.MakeCompound(CC); + + TopTools_MapOfShape mapShape; + TopoDS_Iterator It (theOriginalShape, Standard_True, Standard_True); + + for (; It.More(); It.Next()) { + TopoDS_Shape aShape_i = It.Value(); + if (mapShape.Add(aShape_i)) { + // check, if current shape contains at least one of faces to be removed + bool isFound = false; + TopTools_IndexedMapOfShape aShapes_i; + TopExp::MapShapes(aShape_i, aShapes_i); + for (int i = 1; i <= theShapesFaces.Length() && !isFound; i++) { + const TopoDS_Shape& aFace_i = theShapesFaces.Value(i); + if (aShapes_i.Contains(aFace_i)) isFound = true; + } + if (isFound) { + TopoDS_Shape anOutSh_i; + SuppressFacesRec(theShapesFaces, aShape_i, anOutSh_i); + if ( !anOutSh_i.IsNull() ) + BB.Add(CC, anOutSh_i); + } + else { + // nothing to do + BB.Add(CC, aShape_i); + } + } + } + theOutShape = CC; + } +} + Standard_Boolean GEOMImpl_HealingDriver::SuppressFaces (GEOMImpl_IHealing* theHI, const TopoDS_Shape& theOriginalShape, TopoDS_Shape& theOutShape) const { Handle(TColStd_HArray1OfInteger) aFaces = theHI->GetFaces(); - ShHealOper_RemoveFace aHealer (theOriginalShape); - Standard_Boolean aResult = Standard_False; - if (aFaces.IsNull()) // remove all faces - { + + if (aFaces.IsNull()) { + ShHealOper_RemoveFace aHealer (theOriginalShape); aResult = aHealer.Perform(); - } else { + + if (aResult) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption(aHealer.GetErrorStatus()); + } + else { TopTools_SequenceOfShape aShapesFaces; TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes(theOriginalShape, aShapes); @@ -204,16 +289,15 @@ Standard_Boolean GEOMImpl_HealingDriver::SuppressFaces (GEOMImpl_IHealing* theHI TopoDS_Shape aFace = aShapes.FindKey(indexOfFace); aShapesFaces.Append(aFace); } - - aResult = aHealer.Perform(aShapesFaces); + SuppressFacesRec(aShapesFaces, theOriginalShape, theOutShape); + if ((theOriginalShape.ShapeType() == TopAbs_COMPOUND || + theOriginalShape.ShapeType() == TopAbs_COMPSOLID)) { + TopoDS_Shape aSh = theOutShape; + theOutShape = GEOMImpl_GlueDriver::GlueFaces(aSh, Precision::Confusion(), Standard_True); + } } - if ( aResult ) - theOutShape = aHealer.GetResultShape(); - else - raiseNotDoneExeption( aHealer.GetErrorStatus() ); - - return aResult; + return Standard_True; } //======================================================================= @@ -404,6 +488,288 @@ Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation (GEOMImpl_IHealing* t return aResult; } +//======================================================================= +//function : LimitTolerance +//purpose : +//======================================================================= +void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Standard_Real aTol = theHI->GetTolerance(); + if (aTol < Precision::Confusion()) + aTol = Precision::Confusion(); + + // 1. Make a copy to prevent the original shape changes. + TopoDS_Shape aShapeCopy; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy); + + // 2. Limit tolerance. + ShapeFix_ShapeTolerance aSFT; + aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE); + + // 3. Fix obtained shape. + Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy); + aSfs->Perform(); + theOutShape = aSfs->Shape(); + + BRepCheck_Analyzer ana (theOutShape, Standard_True); + if (!ana.IsValid()) + StdFail_NotDone::Raise("Non valid shape result"); +} + +//======================================================================= +//function : FuseCollinearEdges +//purpose : +//======================================================================= +void GEOMImpl_HealingDriver::FuseCollinearEdges (const TopoDS_Shape& theOriginalShape, + const Handle(TColStd_HSequenceOfTransient)& aVerts, + TopoDS_Shape& theOutShape) +{ + if (theOriginalShape.ShapeType() != TopAbs_WIRE) + Standard_TypeMismatch::Raise("Not a wire is given"); + + // Tolerances + Standard_Real AngTol = Precision::Angular(); + Standard_Real LinTol = Precision::Confusion(); + Standard_Real tol; + for (TopExp_Explorer ExV (theOriginalShape, TopAbs_VERTEX); ExV.More(); ExV.Next()) { + TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current()); + tol = BRep_Tool::Tolerance(Vertex); + if (tol > LinTol) + LinTol = tol; + } + + // 1. Make a copy to prevent the original shape changes. + TopoDS_Shape aWire; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aWire); + TopoDS_Wire theWire = TopoDS::Wire(aWire); + + // 2. Sub-shapes of the wire + TopTools_MapOfShape aMapToRemove; + + TopTools_IndexedMapOfShape anOldIndices; + TopExp::MapShapes(theOriginalShape, anOldIndices); + + TopTools_IndexedMapOfShape aNewIndices; + TopExp::MapShapes(theWire, aNewIndices); + + // 3. Collect vertices of the wire, same or equal to the given vertices + bool removeAll = false; + if (aVerts.IsNull() || aVerts->Length() < 1) + removeAll = true; + + if (!removeAll) { + for (unsigned int ind = 1; ind <= aVerts->Length(); ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aVerts->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) + Standard_NullObject::Raise("Null vertex given"); + if (aShape_i.ShapeType() != TopAbs_VERTEX) + Standard_TypeMismatch::Raise("Shape to suppress is not a vertex"); + + // find vertices shared with the initial wire + if (anOldIndices.Contains(aShape_i)) { + aMapToRemove.Add(aNewIndices.FindKey(anOldIndices.FindIndex(aShape_i))); + } else { + // try to find by coords in the new wire + TopoDS_Vertex aVert = TopoDS::Vertex(aShape_i); + gp_Pnt aP = BRep_Tool::Pnt(aVert); + + bool isFound = false; + TopTools_MapOfShape mapShape; + TopExp_Explorer exp (theWire, TopAbs_VERTEX); + for (; exp.More() && !isFound; exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Vertex aVi = TopoDS::Vertex(exp.Current()); + gp_Pnt aPi = BRep_Tool::Pnt(aVi); + if (aPi.Distance(aP) < LinTol) { + aMapToRemove.Add(aVi); + isFound = true; + } + } + } + } + } + } + + /* + BRepLib::BuildCurves3d(theWire); + Handle(ShapeFix_Shape) Fixer = new ShapeFix_Shape(theWire); + Fixer->SetPrecision(LinTol); + Fixer->SetMaxTolerance(LinTol); + Fixer->Perform(); + theWire = TopoDS::Wire(Fixer->Shape()); + */ + + TopoDS_Edge prevEdge; + TopTools_ListOfShape finalList, currChain; + + BRepTools_WireExplorer wexp (theWire); + if (wexp.More()) { + prevEdge = wexp.Current(); + currChain.Append(prevEdge); + wexp.Next(); + } + else { + Standard_NullObject::Raise("Empty wire given"); + } + + for (; wexp.More(); wexp.Next()) { + TopoDS_Edge anEdge = wexp.Current(); + TopoDS_Vertex CurVertex = wexp.CurrentVertex(); + + bool continueChain = false; + if (aMapToRemove.Contains(CurVertex) || removeAll) { + // if C1 -> continue chain + if (AreEdgesC1(prevEdge, anEdge)) { + continueChain = true; + } + } + + if (!continueChain) { + if (currChain.Extent() == 1) { + // add one edge to the final list + finalList.Append(currChain.First()); + } + else { + // make wire from the list of edges + BRep_Builder B; + TopoDS_Wire aCurrWire; + B.MakeWire(aCurrWire); + TopTools_ListIteratorOfListOfShape itEdges (currChain); + for (; itEdges.More(); itEdges.Next()) { + TopoDS_Shape aValue = itEdges.Value(); + B.Add(aCurrWire, TopoDS::Edge(aValue)); + } + + // make edge from the wire + TopoDS_Edge anEdge = GEOMImpl_ShapeDriver::MakeEdgeFromWire(aCurrWire, LinTol, AngTol); + + // add this new edge to the final list + finalList.Append(anEdge); + } + currChain.Clear(); + } + + // add one edge to the chain + currChain.Append(anEdge); + prevEdge = anEdge; + } + + if (currChain.Extent() == 1) { + // add one edge to the final list + finalList.Append(currChain.First()); + } + else { + // make wire from the list of edges + BRep_Builder B; + TopoDS_Wire aCurrWire; + B.MakeWire(aCurrWire); + TopTools_ListIteratorOfListOfShape itEdges (currChain); + for (; itEdges.More(); itEdges.Next()) { + TopoDS_Shape aValue = itEdges.Value(); + B.Add(aCurrWire, TopoDS::Edge(aValue)); + } + + // make edge from the wire + TopoDS_Edge anEdge = GEOMImpl_ShapeDriver::MakeEdgeFromWire(aCurrWire, LinTol, AngTol); + + // add this new edge to the final list + finalList.Append(anEdge); + } + + BRep_Builder B; + TopoDS_Wire aFinalWire; + B.MakeWire(aFinalWire); + TopTools_ListIteratorOfListOfShape itEdges (finalList); + for (; itEdges.More(); itEdges.Next()) { + TopoDS_Shape aValue = itEdges.Value(); + B.Add(aFinalWire, TopoDS::Edge(aValue)); + } + theOutShape = aFinalWire; + + BRepCheck_Analyzer ana (theOutShape, Standard_True); + if (!ana.IsValid()) + StdFail_NotDone::Raise("Non valid shape result"); +} + +//======================================================================= +//function : AreEdgesC1 +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::AreEdgesC1 (const TopoDS_Edge& E1, const TopoDS_Edge& E2) +{ + BRepAdaptor_Curve aCurve1 (E1); + BRepAdaptor_Curve aCurve2 (E2); + + if (aCurve1.Continuity() == GeomAbs_C0 || aCurve2.Continuity() == GeomAbs_C0) + return Standard_False; + + Standard_Real tol, tolMax = Precision::Confusion(); + for (TopExp_Explorer ExV1 (E1, TopAbs_VERTEX); ExV1.More(); ExV1.Next()) { + TopoDS_Vertex Vertex = TopoDS::Vertex(ExV1.Current()); + tol = BRep_Tool::Tolerance(Vertex); + if (tol > tolMax) + tolMax = tol; + } + for (TopExp_Explorer ExV2 (E2, TopAbs_VERTEX); ExV2.More(); ExV2.Next()) { + TopoDS_Vertex Vertex = TopoDS::Vertex(ExV2.Current()); + tol = BRep_Tool::Tolerance(Vertex); + if (tol > tolMax) + tolMax = tol; + } + + Standard_Real f1, l1, f2, l2; + f1 = aCurve1.FirstParameter(); + l1 = aCurve1.LastParameter(); + f2 = aCurve2.FirstParameter(); + l2 = aCurve2.LastParameter(); + + if (f1 > l1) { + Standard_Real tmp = f1; + f1 = l1; + l1 = tmp; + } + + if (f2 > l2) { + Standard_Real tmp = f2; + f2 = l2; + l2 = tmp; + } + + gp_Pnt pf1, pl1, pf2, pl2; + gp_Vec vf1, vl1, vf2, vl2; + aCurve1.D1(f1, pf1, vf1); + aCurve1.D1(l1, pl1, vl1); + aCurve2.D1(f2, pf2, vf2); + aCurve2.D1(l2, pl2, vl2); + + // pf1--->---pl1.pf2--->---pl2 + if (pl1.SquareDistance(pf2) < tolMax*tolMax) { + if (vl1.Angle(vf2) < Precision::Angular()) + return Standard_True; + } + // pl1---<---pf1.pf2--->---pl2 + else if (pf1.SquareDistance(pf2) < tolMax*tolMax) { + if (vf1.Angle(-vf2) < Precision::Angular()) + return Standard_True; + } + // pf1--->---pl1.pl2---<---pf2 + else if (pl1.SquareDistance(pl2) < tolMax*tolMax) { + if (vl1.Angle(-vl2) < Precision::Angular()) + return Standard_True; + } + // pl1---<---pf1.pl2---<---pf2 + else { + if (vf1.Angle(vl2) < Precision::Angular()) + return Standard_True; + } + + return Standard_False; +} //======================================================================= //function : GEOMImpl_HealingDriver_Type_ @@ -422,10 +788,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_HealingDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_HealingDriver", - sizeof(GEOMImpl_HealingDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_HealingDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -445,7 +811,5 @@ const Handle(GEOMImpl_HealingDriver) Handle(GEOMImpl_HealingDriver)::DownCast(co } } - return _anOtherObject ; + return _anOtherObject; } - - diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.hxx b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx index d89f3e408..f1d740d6f 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx @@ -1,27 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : GEOMImpl_HealingDriver.hxx // Module : GEOMImpl -// + #ifndef _GEOMImpl_HealingDriver_HeaderFile #define _GEOMImpl_HealingDriver_HeaderFile @@ -57,6 +57,8 @@ class GEOMImpl_HealingDriver; class GEOMImpl_IHealing; #include +#include +#include Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_HealingDriver); @@ -128,45 +130,51 @@ class GEOMImpl_HealingDriver : public TFunction_Driver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC - // -Standard_EXPORT GEOMImpl_HealingDriver(); -Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; -Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} -Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } -Standard_EXPORT static const Standard_GUID& GetID(); -Standard_EXPORT ~GEOMImpl_HealingDriver() {}; - - - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_HealingDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_HealingDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_HealingDriver) == AType || TFunction_Driver::IsKind(AType)); } + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_HealingDriver(); + Standard_EXPORT ~GEOMImpl_HealingDriver() {}; + + Standard_EXPORT static const Standard_GUID& GetID(); + + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } + + Standard_EXPORT static Standard_Boolean AreEdgesC1 (const TopoDS_Edge& E1, const TopoDS_Edge& E2); + Standard_EXPORT static void FuseCollinearEdges (const TopoDS_Shape&, + const Handle(TColStd_HSequenceOfTransient)&, + TopoDS_Shape&); + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_HealingDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_HealingDriver) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_HealingDriver) == AType || TFunction_Driver::IsKind(AType)); } private: -Standard_Boolean ShapeProcess ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; -Standard_Boolean SuppressFaces ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; -Standard_Boolean CloseContour ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; -Standard_Boolean RemoveIntWires( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; -Standard_Boolean RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; -Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; -Standard_Boolean AddPointOnEdge( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; -Standard_Boolean ChangeOrientation( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; - + Standard_Boolean ShapeProcess ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + Standard_Boolean SuppressFaces ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + Standard_Boolean CloseContour ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + Standard_Boolean RemoveIntWires( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + Standard_Boolean RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + Standard_Boolean AddPointOnEdge( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + Standard_Boolean ChangeOrientation( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + void LimitTolerance( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; }; diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index ffa7b4d3f..12d2e4df2 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -1,26 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include +#include + #include #include "utilities.h" @@ -61,13 +64,14 @@ #include #include #include -#include #include #include #include #include #include +#include + #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -120,7 +124,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, dou //Compute the box value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -177,7 +181,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Objec //Compute the Box value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -228,7 +232,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double //Compute the Face try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -256,7 +260,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Object) theObj, - double theH, double theW) + double theH, double theW) { SetErrorCode(KO); @@ -285,7 +289,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Objec //Compute the Face try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -343,7 +347,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR //Compute the Disk value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -371,8 +375,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2, - Handle(GEOM_Object) thePnt3) + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3) { SetErrorCode(KO); @@ -403,7 +407,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Ob //Compute the Disk value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -453,7 +457,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskR (double theR, int theO //Compute the Disk try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -501,7 +505,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou //Compute the Cylinder value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -562,7 +566,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO //Compute the Cylinder value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -614,7 +618,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, dou //Compute the Cone value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -677,7 +681,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM //Compute the Cone value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -725,7 +729,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR) //Compute the Sphere value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -780,7 +784,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Obje //Compute the Sphere value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -831,7 +835,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR //Compute the Torus value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -891,7 +895,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR //Compute the Torus value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -921,7 +925,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theVec, - double theH) + double theH, double theScaleFactor) { SetErrorCode(KO); @@ -948,10 +952,11 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec aCI.SetBase(aRefBase); aCI.SetVector(aRefVec); aCI.SetH(theH); + aCI.SetScale(theScaleFactor); //Compute the Prism value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -967,8 +972,12 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec } //Make a Python command - GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH(" - << theBase << ", " << theVec << ", " << theH << ")"; + GEOM::TPythonDump pd (aFunction); + pd << aPrism << " = geompy.MakePrismVecH(" << theBase << ", " << theVec << ", " << theH; + if (theScaleFactor > Precision::Confusion()) + pd << ", " << theScaleFactor << ")"; + else + pd << ")"; SetErrorCode(OK); return aPrism; @@ -980,8 +989,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) theVec, - double theH) + Handle(GEOM_Object) theVec, + double theH) { SetErrorCode(KO); @@ -1011,7 +1020,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_ //Compute the Prism value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1041,7 +1050,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2) + Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2, + double theScaleFactor) { SetErrorCode(KO); @@ -1069,10 +1079,11 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt aCI.SetBase(aRefBase); aCI.SetFirstPoint(aRefPnt1); aCI.SetLastPoint(aRefPnt2); + aCI.SetScale(theScaleFactor); //Compute the Prism value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1088,8 +1099,12 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt } //Make a Python command - GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism(" - << theBase << ", " << thePoint1 << ", " << thePoint2 << ")"; + GEOM::TPythonDump pd (aFunction); + pd << aPrism << " = geompy.MakePrism(" << theBase << ", " << thePoint1 << ", " << thePoint2; + if (theScaleFactor > Precision::Confusion()) + pd << ", " << theScaleFactor << ")"; + else + pd << ")"; SetErrorCode(OK); return aPrism; @@ -1133,7 +1148,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways //Compute the Prism value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1162,7 +1177,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ - (Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ) + (Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ, + double theScaleFactor) { SetErrorCode(KO); @@ -1189,10 +1205,11 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ aCI.SetDX(theDX); aCI.SetDY(theDY); aCI.SetDZ(theDZ); + aCI.SetScale(theScaleFactor); //Compute the Prism value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1207,8 +1224,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ } //Make a Python command - GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismDXDYDZ(" - << theBase << ", " << theDX << ", " << theDY << ", " << theDZ << ")"; + GEOM::TPythonDump pd (aFunction); + pd << aPrism << " = geompy.MakePrismDXDYDZ(" + << theBase << ", " << theDX << ", " << theDY << ", " << theDZ; + if (theScaleFactor > Precision::Confusion()) + pd << ", " << theScaleFactor << ")"; + else + pd << ")"; SetErrorCode(OK); return aPrism; @@ -1250,7 +1272,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ2Ways //Compute the Prism value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1272,6 +1294,88 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ2Ways return aPrism; } +//============================================================================= +/*! + * MakeDraftPrism + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism + (Handle(GEOM_Object) theInitShape ,Handle(GEOM_Object) theBase, double theHeight, double theAngle, bool theFuse) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || theInitShape.IsNull()) return NULL; + + Handle(GEOM_Object) aPrism = NULL; + + if ( theFuse ) + { + //Add a new Extruded Boss object + aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_BOSS); + } + else + { + //Add a new Extruded Cut object + aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_CUT); + } + + //Add a new Prism function for the creation of a Draft Prism feature + Handle(GEOM_Function) aFunction = + aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), DRAFT_PRISM_FEATURE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL; + + GEOMImpl_IPrism aCI (aFunction); + + Handle(GEOM_Function) aRefInit = theInitShape->GetLastFunction(); + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + + if (aRefBase.IsNull() || aRefInit.IsNull()) return NULL; + + // Set parameters + aCI.SetBase(aRefBase); + aCI.SetInitShape(aRefInit); + aCI.SetH(theHeight); + aCI.SetDraftAngle(theAngle); + if ( theFuse ) + aCI.SetFuseFlag(1); + else + aCI.SetFuseFlag(0); + + //Compute the Draft Prism Feature value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Extrusion can not be created, check input data"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + if(theFuse) + { + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedBoss(" + << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")"; + } + else + { + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedCut(" + << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")"; + } + + SetErrorCode(OK); + return aPrism; +} + //============================================================================= /*! * MakePipe @@ -1307,7 +1411,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipe (Handle(GEOM_Object) th //Compute the Pipe value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1367,7 +1471,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle( //Compute the Revolution value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1383,7 +1487,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle( //Make a Python command GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution(" - << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + << theBase << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)"; SetErrorCode(OK); return aRevolution; @@ -1425,7 +1529,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways //Compute the Revolution value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1441,65 +1545,12 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways //Make a Python command GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution2Ways(" - << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + << theBase << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)"; SetErrorCode(OK); return aRevolution; } -//============================================================================= -/*! - * MakeSolidShell - */ -//============================================================================= -Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Object) theShell) -{ - SetErrorCode(KO); - - if (theShell.IsNull()) return NULL; - - //Add a new Solid object - Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID); - - //Add a new Solid function for creation a solid from a shell - Handle(GEOM_Function) aFunction = - aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL); - if (aFunction.IsNull()) return NULL; - - //Check if the function is set correctly - if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; - - GEOMImpl_IShapes aCI (aFunction); - - Handle(GEOM_Function) aRefShell = theShell->GetLastFunction(); - - if (aRefShell.IsNull()) return NULL; - - aCI.SetBase(aRefShell); - - //Compute the Solid value - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if (!GetSolver()->ComputeFunction(aFunction)) { - SetErrorCode("Solid driver failed"); - return NULL; - } - } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); - return NULL; - } - - //Make a Python command - GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")"; - - SetErrorCode(OK); - return aSolid; -} - //============================================================================= /*! * MakeFilling @@ -1507,7 +1558,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Obje //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, - double theTol2D, double theTol3D, int theNbIter, bool isApprox) + double theTol2D, double theTol3D, int theNbIter, + int theMethod, bool isApprox) { SetErrorCode(KO); @@ -1536,10 +1588,11 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling aFI.SetTol3D(theTol3D); aFI.SetNbIter(theNbIter); aFI.SetApprox(isApprox); + aFI.SetMethod(theMethod); //Compute the Solid value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1559,10 +1612,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling //Make a Python command GEOM::TPythonDump pd (aFunction); pd << aFilling << " = geompy.MakeFilling(" - << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", " - << theTol2D << ", " << theTol3D << ", " << theNbIter; + << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", " + << theTol2D << ", " << theTol3D << ", " << theNbIter << ", "; + if( theMethod==1 ) pd << "GEOM.FOM_UseOri"; + else if( theMethod==2 ) pd << "GEOM.FOM_AutoCorrect"; + else pd << "GEOM.FOM_Default"; if(isApprox) - pd << ", " << isApprox; + pd << ", " << isApprox ; pd << ")"; SetErrorCode(OK); @@ -1575,10 +1631,10 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( - const Handle(TColStd_HSequenceOfTransient)& theSeqSections, - bool theModeSolid, - double thePreci, - bool theRuled) + const Handle(TColStd_HSequenceOfTransient)& theSeqSections, + bool theModeSolid, + double thePreci, + bool theRuled) { Handle(GEOM_Object) anObj; SetErrorCode(KO); @@ -1586,13 +1642,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( return anObj; Standard_Integer nbObj = theSeqSections->Length(); - if (!nbObj) + if (!nbObj) return anObj; //Add a new ThruSections object Handle(GEOM_Object) aThruSect = GetEngine()->AddObject(GetDocID(), GEOM_THRUSECTIONS); - + //Add a new ThruSections function int aTypeFunc = (theRuled ? THRUSECTIONS_RULED : THRUSECTIONS_SMOOTHED); @@ -1613,7 +1669,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( Handle(Standard_Transient) anItem = theSeqSections->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem); if(!aSectObj.IsNull()) { @@ -1632,7 +1688,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( //Compute the ThruSections value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1655,21 +1711,19 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( Handle(Standard_Transient) anItem = theSeqSections->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem); if(!aSectObj.IsNull()) { pyDump<< aSectObj; if(i < nbObj) - pyDump<<", "; + pyDump<<", "; } } - + pyDump<< "],"<Length(); - + if (!nbBases) return anObj; - + Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length()); //Add a new Pipe object Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); - + //Add a new Pipe function Handle(GEOM_Function) aFunction = @@ -1723,7 +1777,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem); if(aBase.IsNull()) continue; @@ -1734,14 +1788,14 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( { Handle(Standard_Transient) anItemLoc = theLocations->Value(i); if(anItemLoc.IsNull()) - continue; - + continue; + Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc); if(aLoc.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction(); if(aRefLoc.IsNull()) - continue; + continue; aSeqLocs->Append(aRefLoc); } aSeqBases->Append(aRefBase); @@ -1755,10 +1809,10 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( aCI.SetPath(aRefPath); aCI.SetWithContactMode(theWithContact); aCI.SetWithCorrectionMode(theWithCorrections); - + //Compute the Pipe value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1781,38 +1835,35 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbLocs; i++) { Handle(Standard_Transient) anItem = theLocations->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbLocs) - pyDump<<", "; + pyDump<<", "; } - } + } pyDump<< "], "<Length(); - + if (!nbBases) return anObj; - + Standard_Integer nbSubBases = (theSubBases.IsNull() ? 0 :theSubBases->Length()); Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length()); //Add a new Pipe object Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); - + //Add a new Pipe function Handle(GEOM_Function) aFunction = @@ -1882,26 +1933,26 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections( if( nbSubBases >= nbBases ) { Handle(Standard_Transient) aSubItem = theSubBases->Value(i); if(aSubItem.IsNull()) - continue; + continue; Handle(GEOM_Object) aSubBase = Handle(GEOM_Object)::DownCast(aSubItem); if(aSubBase.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefSubBase = aSubBase->GetLastFunction(); if(aRefSubBase.IsNull()) - continue; + continue; aSeqSubBases->Append(aRefSubBase); } if(nbLocs) { Handle(Standard_Transient) anItemLoc = theLocations->Value(i); if(anItemLoc.IsNull()) - continue; + continue; Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc); if(aLoc.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction(); if(aRefLoc.IsNull()) - continue; + continue; aSeqLocs->Append(aRefLoc); } @@ -1917,10 +1968,10 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections( aCI.SetPath(aRefPath); aCI.SetWithContactMode(theWithContact); aCI.SetWithCorrectionMode(theWithCorrections); - + //Compute the Pipe value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1943,48 +1994,46 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbSubBases; i++) { Handle(Standard_Transient) anItem = theSubBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbLocs; i++) { Handle(Standard_Transient) anItem = theLocations->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbLocs) - pyDump<<", "; + pyDump<<", "; } - } + } pyDump<< "], "<Length(); - + if (!nbBases) return anObj; - + Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length()); //Add a new Pipe object Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); - + //Add a new Pipe function Handle(GEOM_Function) aFunction = @@ -2048,13 +2097,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( if(nbLocs) { Handle(Standard_Transient) anItemLoc = theLocations->Value(i); if(anItemLoc.IsNull()) - continue; + continue; Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc); if(aLoc.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction(); if(aRefLoc.IsNull()) - continue; + continue; aSeqLocs->Append(aRefLoc); } @@ -2066,10 +2115,10 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( aCI.SetBases(aSeqBases); aCI.SetLocations(aSeqLocs); - + //Compute the Pipe value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -2092,31 +2141,30 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbLocs; i++) { Handle(Standard_Transient) anItem = theLocations->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbLocs) - pyDump<<", "; + pyDump<<", "; } - } + } pyDump<< "])"; @@ -2132,8 +2180,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePath, - Handle(GEOM_Object) theVec) + Handle(GEOM_Object) thePath, + Handle(GEOM_Object) theVec) { SetErrorCode(KO); @@ -2164,7 +2212,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Han //Compute the Pipe value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -2185,4 +2233,3 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Han SetErrorCode(OK); return aPipe; } - diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx index 6f1295b41..c567d0333 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_I3DPrimOperations_HXX_ #define _GEOMImpl_I3DPrimOperations_HXX_ @@ -36,16 +37,16 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeBoxDXDYDZ (double theDX, double theDY, double theDZ); Standard_EXPORT Handle(GEOM_Object) MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2); + Handle(GEOM_Object) thePnt2); Standard_EXPORT Handle(GEOM_Object) MakeFaceHW (double theH, double theW, int theOrientation); Standard_EXPORT Handle(GEOM_Object) MakeFaceObjHW (Handle(GEOM_Object) theObj, - double theH, double theW); + double theH, double theW); Standard_EXPORT Handle(GEOM_Object) MakeDiskThreePnt (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2, - Handle(GEOM_Object) thePnt3); + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); Standard_EXPORT Handle(GEOM_Object) MakeDiskPntVecR (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) theVec, - double theR); + Handle(GEOM_Object) theVec, + double theR); Standard_EXPORT Handle(GEOM_Object) MakeDiskR (double theR, int theOrientation); Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH); Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt, @@ -67,67 +68,76 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { double theRMajor, double theRMinor); Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) theVec, double theH); + Handle(GEOM_Object) theVec, + double theH, double theScaleFactor = -1.0); Standard_EXPORT Handle(GEOM_Object) MakePrismVecH2Ways (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) theVec, double theH); + Handle(GEOM_Object) theVec, double theH); Standard_EXPORT Handle(GEOM_Object) MakePrismTwoPnt (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2); + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2, + double theScaleFactor = -1.0); Standard_EXPORT Handle(GEOM_Object) MakePrismTwoPnt2Ways (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2); + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); Standard_EXPORT Handle(GEOM_Object) MakePrismDXDYDZ (Handle(GEOM_Object) theBase, - double theDX, double theDY, double theDZ); + double theDX, double theDY, double theDZ, + double theScaleFactor = -1.0); Standard_EXPORT Handle(GEOM_Object) MakePrismDXDYDZ2Ways (Handle(GEOM_Object) theBase, - double theDX, double theDY, double theDZ); - + double theDX, double theDY, double theDZ); + + Standard_EXPORT Handle(GEOM_Object) MakeDraftPrism (Handle(GEOM_Object) theInitShape, Handle(GEOM_Object) theBase, + double theHeight, double theAngle, bool theFuse); + Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePath); + Handle(GEOM_Object) thePath); Standard_EXPORT Handle(GEOM_Object) MakeRevolutionAxisAngle (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) theAxis, - double theAngle); + Handle(GEOM_Object) theAxis, + double theAngle); Standard_EXPORT Handle(GEOM_Object) MakeRevolutionAxisAngle2Ways (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) theAxis, - double theAngle); - - Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell); + Handle(GEOM_Object) theAxis, + double theAngle); - Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter, bool isApprox); + Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, + int theMinDeg, int theMaxDeg, + double theTol2D, double theTol3D, + int theNbIter, int theMethod, + bool isApprox); - Standard_EXPORT Handle(GEOM_Object) MakeThruSections(const Handle(TColStd_HSequenceOfTransient)& theSeqSections, - bool theModeSolid, - double thePreci, - bool theRuled); + Standard_EXPORT Handle(GEOM_Object) MakeThruSections + (const Handle(TColStd_HSequenceOfTransient)& theSeqSections, + bool theModeSolid, + double thePreci, + bool theRuled); Standard_EXPORT Handle(GEOM_Object) MakePipeWithDifferentSections( - const Handle(TColStd_HSequenceOfTransient)& theBases, - const Handle(TColStd_HSequenceOfTransient)& theLocations, - const Handle(GEOM_Object)& thePath, - bool theWithContact, - bool theWithCorrections); + const Handle(TColStd_HSequenceOfTransient)& theBases, + const Handle(TColStd_HSequenceOfTransient)& theLocations, + const Handle(GEOM_Object)& thePath, + bool theWithContact, + bool theWithCorrections); Standard_EXPORT Handle(GEOM_Object) MakePipeWithShellSections( - const Handle(TColStd_HSequenceOfTransient)& theBases, - const Handle(TColStd_HSequenceOfTransient)& theSubBases, - const Handle(TColStd_HSequenceOfTransient)& theLocations, - const Handle(GEOM_Object)& thePath, - bool theWithContact, - bool theWithCorrections); + const Handle(TColStd_HSequenceOfTransient)& theBases, + const Handle(TColStd_HSequenceOfTransient)& theSubBases, + const Handle(TColStd_HSequenceOfTransient)& theLocations, + const Handle(GEOM_Object)& thePath, + bool theWithContact, + bool theWithCorrections); Standard_EXPORT Handle(GEOM_Object) MakePipeShellsWithoutPath( - const Handle(TColStd_HSequenceOfTransient)& theBases, - const Handle(TColStd_HSequenceOfTransient)& theLocations); + const Handle(TColStd_HSequenceOfTransient)& theBases, + const Handle(TColStd_HSequenceOfTransient)& theLocations); Standard_EXPORT Handle(GEOM_Object) MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePath, - Handle(GEOM_Object) theVec); + Handle(GEOM_Object) thePath, + Handle(GEOM_Object) theVec); }; diff --git a/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx b/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx index dc4ea30f6..fa6e04639 100755 --- a/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx +++ b/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx @@ -1,25 +1,24 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2007-2012 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 +// 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 +// +// 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 +// 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 // -//NOTE: This is an interface to a function for the Sketcher creation. - +//NOTE: This is an interface to a function for the Sketcher creation. +// #include "GEOM_Function.hxx" #include diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx new file mode 100644 index 000000000..7fc3b43bc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -0,0 +1,2432 @@ +// Copyright (C) 2007-2012 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 +// +// File : GEOMImpl_IAdvancedOperations.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#include + +#include "GEOMImpl_Types.hxx" +#include "GEOMImpl_IAdvancedOperations.hxx" +#include "GEOMImpl_IBasicOperations.hxx" +#include "GEOMImpl_IBooleanOperations.hxx" +#include "GEOMImpl_IShapesOperations.hxx" +#include "GEOMImpl_ITransformOperations.hxx" +#include "GEOMImpl_IBlocksOperations.hxx" +#include "GEOMImpl_I3DPrimOperations.hxx" +#include "GEOMImpl_ILocalOperations.hxx" +#include "GEOMImpl_IHealingOperations.hxx" + +#include "GEOMImpl_Gen.hxx" + +#include + +#include +#include +#include + +#include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" + +#include "GEOMImpl_PipeTShapeDriver.hxx" +#include "GEOMImpl_IPipeTShape.hxx" +#include +#include +// #include +// #include +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +#define HALF_LENGTH_MAIN_PIPE "Main pipe half length" //"Tuyau principal - demi longueur" +#define HALF_LENGTH_INCIDENT_PIPE "Incident pipe half length" //"Tuyau incident - demi longueur" +#define CIRCULAR_QUARTER_PIPE "Circular quarter of pipe" //"Circulaire - quart de tuyau" +#define THICKNESS "Thickness" //"Epaisseur" +#define FLANGE "Flange" // "Collerette" +#define CHAMFER_OR_FILLET "Chamfer or fillet" //"Chanfrein ou Raccord" +#define JUNCTION_FACE_1 "Junction 1" //"Face de jonction 1" +#define JUNCTION_FACE_2 "Junction 2" //"Face de jonction 2" +#define JUNCTION_FACE_3 "Junction 3" //"Face de jonction 3" + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID) : + GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations"); + myBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID()); + myBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID()); + myShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID()); + myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID()); + myBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID()); + my3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID()); + myLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID()); + myHealingOperations = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID()); +} + +//============================================================================= +/*! + * Destructor + */ +//============================================================================= +GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations() +{ + MESSAGE("GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations"); + delete myBasicOperations; + delete myBooleanOperations; + delete myShapesOperations; + delete myTransformOperations; + delete myBlocksOperations; + delete my3DPrimOperations; + delete myLocalOperations; + delete myHealingOperations; +} + +//============================================================================= +/*! + * SetPosition + */ +//============================================================================= +gp_Trsf GEOMImpl_IAdvancedOperations::GetPositionTrsf(double theL1, double theL2, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3) +{ + // Old Local Coordinates System oldLCS + gp_Pnt P0(0, 0, 0); + gp_Pnt P1(-theL1, 0, 0); + gp_Pnt P2(theL1, 0, 0); + gp_Pnt P3(0, 0, theL2); + + gp_Dir oldX(gp_Vec(P1, P2)); + gp_Dir oldZ(gp_Vec(P0, P3)); + gp_Ax3 oldLCS(P0, oldZ, oldX); + + // New Local Coordinates System newLCS + double LocX, LocY, LocZ; + gp_Pnt newP1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue())); + gp_Pnt newP2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue())); + gp_Pnt newP3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue())); + LocX = (newP1.X() + newP2.X()) / 2.; + LocY = (newP1.Y() + newP2.Y()) / 2.; + LocZ = (newP1.Z() + newP2.Z()) / 2.; + gp_Pnt newO(LocX, LocY, LocZ); + + gp_Dir newX(gp_Vec(newP1, newP2)); // P1P2 Vector + gp_Dir newZ(gp_Vec(newO, newP3)); // OP3 Vector + gp_Ax3 newLCS = gp_Ax3(newO, newZ, newX); + + gp_Trsf aTrsf; + aTrsf.SetDisplacement(oldLCS, newLCS); + + return aTrsf; +} + +//============================================================================= +/*! + * CheckCompatiblePosition + * + */ +//============================================================================= +bool GEOMImpl_IAdvancedOperations::CheckCompatiblePosition(double& theL1, double& theL2, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3, + double theTolerance) +{ + SetErrorCode(KO); + gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue())); + gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue())); + gp_Pnt P3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue())); + + double d12 = P1.Distance(P2); + double d13 = P1.Distance(P3); + double d23 = P2.Distance(P3); + // double d2 = newO.Distance(P3); + + if (Abs(d12) <= Precision::Confusion()) { + SetErrorCode("Junctions points P1 and P2 are identical"); + return false; + } + if (Abs(d13) <= Precision::Confusion()) { + SetErrorCode("Junctions points P1 and P3 are identical"); + return false; + } + if (Abs(d23) <= Precision::Confusion()) { + SetErrorCode("Junctions points P2 and P3 are identical"); + return false; + } + + + double newL1 = 0.5 * d12; + double newL2 = sqrt(pow(d13,2)-pow(newL1,2)); + // + // theL1*(1-theTolerance) <= newL1 <= theL1*(1+theTolerance) + // + if (fabs(newL1 - theL1) > Precision::Approximation()) { + if ( (newL1 * (1 - theTolerance) -theL1 <= Precision::Approximation()) && + (newL1 * (1 + theTolerance) -theL1 >= Precision::Approximation()) ) { + // std::cerr << "theL1 = newL1" << std::endl; + theL1 = newL1; + } else { + theL1 = -1; + SetErrorCode("Dimension for main pipe (L1) is incompatible with new position"); + return false; + } + } + + // + // theL2*(1-theTolerance) <= newL2 <= theL2*(1+theTolerance) + // + if (fabs(newL2 - theL2) > Precision::Approximation()) { + if ( (newL2 * (1 - theTolerance) -theL2 <= Precision::Approximation()) && + (newL2 * (1 + theTolerance) -theL2 >= Precision::Approximation()) ) { + theL2 = newL2; + } else { + theL2 = -1; + SetErrorCode("Dimension for incident pipe (L2) is incompatible with new position"); + return false; + } + } + + SetErrorCode(OK); + return true; + +} + +//============================================================================= +/*! + * Generate the propagation groups of a Pipe T-Shape used for hexa mesh + */ +//============================================================================= +bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int shapeType, + double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + Handle(TColStd_HSequenceOfTransient) theSeq, + gp_Trsf aTrsf) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return false; + + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) { + SetErrorCode("Shape is not defined"); + return false; + } + + gp_Trsf aTrsfInv = aTrsf.Inverted(); + +// int expectedGroups = 0; +// if (shapeType == TSHAPE_BASIC) +// if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation()) +// expectedGroups = 10; +// else +// expectedGroups = 11; +// else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) +// expectedGroups = 12; + + double aR1Ext = theR1 + theW1; + double aR2Ext = theR2 + theW2; + + ///////////////////////// + //// Groups of Faces //// + ///////////////////////// + + // + // Comment the following lines when GetInPlace bug is solved + // == BEGIN + // Workaround of GetInPlace bug + // Create a bounding box that fits the shape + Handle(GEOM_Object) aBox = my3DPrimOperations->MakeBoxDXDYDZ(2*theL1, 2*aR1Ext, aR1Ext+theL2); + aBox->GetLastFunction()->SetDescription(""); + myTransformOperations->TranslateDXDYDZ(aBox, -theL1, -aR1Ext, -aR1Ext); + aBox->GetLastFunction()->SetDescription(""); + // Apply transformation to box + BRepBuilderAPI_Transform aTransformationBox(aBox->GetValue(), aTrsf, Standard_False); + TopoDS_Shape aBoxShapeTrsf = aTransformationBox.Shape(); + aBox->GetLastFunction()->SetValue(aBoxShapeTrsf); + + // Get the shell of the box + Handle(GEOM_Object) aShell = Handle(GEOM_Object)::DownCast + (myShapesOperations->MakeExplode(aBox, TopAbs_SHELL, true)->Value(1)); + aBox->GetLastFunction()->SetDescription(""); + aShell->GetLastFunction()->SetDescription(""); + // Get the common shapes between shell and shape + Handle(GEOM_Object) aCommonCompound = myBooleanOperations->MakeBoolean (theShape, aShell, 1); // MakeCommon + if (aCommonCompound.IsNull()) { + SetErrorCode(myBooleanOperations->GetErrorCode()); + return false; + } + aCommonCompound->GetLastFunction()->SetDescription(""); + // Explode the faces of common shapes => 3 faces + Handle(TColStd_HSequenceOfTransient) aCommonFaces = + myShapesOperations->MakeExplode(aCommonCompound, TopAbs_FACE, true); + aCommonCompound->GetLastFunction()->SetDescription(""); + std::list aCompoundOfFacesList; + + for (int i=0 ; i<= aCommonFaces->Length()-4 ; i+=4) { + std::list aFacesList; + for (int j = 1 ; j <= 4 ; j++) { + Handle(GEOM_Object) aFace = Handle(GEOM_Object)::DownCast(aCommonFaces->Value(i+j)); // Junction faces + if (!aFace.IsNull()) { + aFace->GetLastFunction()->SetDescription(""); + aFacesList.push_back(aFace); + } + } + Handle(GEOM_Object) aCompoundOfFaces = myShapesOperations->MakeCompound(aFacesList); + if (!aCompoundOfFaces.IsNull()) { + aCompoundOfFaces->GetLastFunction()->SetDescription(""); + aCompoundOfFacesList.push_back(aCompoundOfFaces); + } + } + + if (aCompoundOfFacesList.size() == 3) { + Handle(GEOM_Object) aPln1 = aCompoundOfFacesList.front(); + aCompoundOfFacesList.pop_front(); + Handle(GEOM_Object) aPln2 = aCompoundOfFacesList.front(); + aCompoundOfFacesList.pop_front(); + Handle(GEOM_Object) aPln3 = aCompoundOfFacesList.front(); + aCompoundOfFacesList.pop_front(); + // == END + // + + + // Uncomment the following lines when GetInPlace bug is solved + // == BEGIN +// Handle(GEOM_Object) aP1 = myBasicOperations->MakePointXYZ(-theL1, 0, 0); +// Handle(GEOM_Object) aP2 = myBasicOperations->MakePointXYZ(-0, 0, theL2); +// Handle(GEOM_Object) aP3 = myBasicOperations->MakePointXYZ(theL1, 0, 0); +// aP1->GetLastFunction()->SetDescription(""); +// aP2->GetLastFunction()->SetDescription(""); +// aP3->GetLastFunction()->SetDescription(""); +// Handle(GEOM_Object) aV1 = myBasicOperations->MakeVectorDXDYDZ(-1, 0, 0); +// Handle(GEOM_Object) aV2 = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1); +// Handle(GEOM_Object) aV3 = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0); +// aV1->GetLastFunction()->SetDescription(""); +// aV2->GetLastFunction()->SetDescription(""); +// aV3->GetLastFunction()->SetDescription(""); +// Handle(GEOM_Object) aPln1 = myBasicOperations->MakePlanePntVec(aP1, aV1, 2*(aR1Ext+theL2)); +// Handle(GEOM_Object) aPln2 = myBasicOperations->MakePlanePntVec(aP2, aV2, 2*(aR2Ext)); +// Handle(GEOM_Object) aPln3 = myBasicOperations->MakePlanePntVec(aP3, aV3, 2*(aR1Ext+theL2)); +// aPln1->GetLastFunction()->SetDescription(""); +// aPln2->GetLastFunction()->SetDescription(""); +// aPln3->GetLastFunction()->SetDescription(""); +// +// BRepBuilderAPI_Transform aTransformation1(aPln1->GetValue(), aTrsf, Standard_False); +// TopoDS_Shape aTrsf_Shape1 = aTransformation1.Shape(); +// aPln1->GetLastFunction()->SetValue(aTrsf_Shape1); +// BRepBuilderAPI_Transform aTransformation2(aPln2->GetValue(), aTrsf, Standard_False); +// TopoDS_Shape aTrsf_Shape2 = aTransformation2.Shape(); +// aPln2->GetLastFunction()->SetValue(aTrsf_Shape2); +// BRepBuilderAPI_Transform aTransformation3(aPln3->GetValue(), aTrsf, Standard_False); +// TopoDS_Shape aTrsf_Shape3 = aTransformation3.Shape(); +// aPln3->GetLastFunction()->SetValue(aTrsf_Shape3); + // == END + // + + Handle(GEOM_Object) junctionFaces1 = myShapesOperations->GetInPlace(theShape, aPln1); + if (junctionFaces1.IsNull()) + junctionFaces1 = myShapesOperations->GetShapesOnShapeAsCompound + (aPln1, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN); + if (!junctionFaces1.IsNull()) { + junctionFaces1->GetLastFunction()->SetDescription(""); + junctionFaces1->SetName("JUNCTION_FACE_1"); + theSeq->Append(junctionFaces1); + } + else { + SetErrorCode("Junction face 1 not found"); + // theSeq->Append(aPln1); + // return false; + } + Handle(GEOM_Object) junctionFaces2 = myShapesOperations->GetInPlace(theShape, aPln2); + if (junctionFaces2.IsNull()) + junctionFaces2 = myShapesOperations->GetShapesOnShapeAsCompound + (aPln2, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN); + if (!junctionFaces2.IsNull()) { + junctionFaces2->GetLastFunction()->SetDescription(""); + junctionFaces2->SetName("JUNCTION_FACE_2"); + theSeq->Append(junctionFaces2); + } + else { + SetErrorCode("Junction face 2 not found"); + // theSeq->Append(aPln2); + // return false; + } + Handle(GEOM_Object) junctionFaces3 = myShapesOperations->GetInPlace(theShape, aPln3); + if (junctionFaces3.IsNull()) + junctionFaces3 = myShapesOperations->GetShapesOnShapeAsCompound + (aPln3, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN); + if (!junctionFaces3.IsNull()) { + junctionFaces3->GetLastFunction()->SetDescription(""); + junctionFaces3->SetName("JUNCTION_FACE_3"); + theSeq->Append(junctionFaces3); + } + else { + SetErrorCode("Junction face 3 not found"); + // theSeq->Append(aPln3); + // return false; + } + // Comment the following lines when GetInPlace bug is solved + // == BEGIN + } + // == END + ///////////////////////// + //// Groups of Edges //// + ///////////////////////// + // Result of propagate + + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + + TCollection_AsciiString theDesc = aFunction->GetDescription(); + Handle(TColStd_HSequenceOfTransient) aSeqPropagate = myBlocksOperations->Propagate(theShape); + if (aSeqPropagate.IsNull() || aSeqPropagate->Length() == 0) { + SetErrorCode("Propagation groups not found"); + return false; + } + Standard_Integer nbEdges, aNbGroups = aSeqPropagate->Length(); + // Recover previous description to get rid of Propagate dump + aFunction->SetDescription(theDesc); + + bool addGroup; + bool circularFoundAndAdded = false; + bool circularFound10 = false; + bool incidentPipeFound = false; + bool mainPipeFound = false; + bool mainPipeFoundAndAdded = false; + bool radialFound =false; + bool flangeFound = false; + bool flangeFoundAndAdded = false; + bool chamferOrFilletFound = false; + + for (int i=1 ; i<= aNbGroups; i++) { + addGroup = false; + + Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(i)); + if(aGroup.IsNull()) + continue; + + TopoDS_Shape aGroupShape = aGroup->GetValue(); + BRepBuilderAPI_Transform aTransformationShapeInv(aGroupShape, aTrsfInv, Standard_False); + TopoDS_Shape aGroupShapeTrsfInv = aTransformationShapeInv.Shape(); + + TopTools_IndexedMapOfShape anEdgesMap; + TopExp::MapShapes(aGroupShapeTrsfInv,TopAbs_EDGE, anEdgesMap); + nbEdges = anEdgesMap.Extent(); + + if (shapeType == TSHAPE_BASIC) { + if ((nbEdges == 21) || /*R1Ext = R2Ext*/(nbEdges == 17)){ + addGroup = true; + aGroup->SetName("THICKNESS"); + } + else if (nbEdges == 6) { + if (!circularFoundAndAdded) { + circularFoundAndAdded = true; + addGroup = true; + aGroup->SetName("CIRCULAR_QUARTER_PIPE"); + } + } + else if (nbEdges == 8) { + incidentPipeFound = true; + mainPipeFound = false; + radialFound =false; + flangeFound = false; + + TopExp_Explorer Ex(aGroupShapeTrsfInv,TopAbs_VERTEX); + while (Ex.More()) { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); + double x=aP.X(), y=aP.Y(), z=aP.Z(); + + + if ((Abs(x) > aR2Ext + Precision::Confusion()) || + (Abs(y) > aR2Ext + Precision::Confusion())) { + incidentPipeFound = false; + } + + if ( z < -Precision::Confusion()) { + // length of main pipe + mainPipeFound = true; + if (!mainPipeFoundAndAdded) { + mainPipeFoundAndAdded = true; + addGroup = true; + aGroup->SetName("HALF_LENGTH_MAIN_PIPE"); + } + } + + else if (Abs(x) > (theL1-Precision::Confusion())) { + // discretisation circulaire + radialFound = true; + if (!circularFoundAndAdded) { + circularFoundAndAdded = true; + addGroup = true; + aGroup->SetName("CIRCULAR_QUARTER_PIPE"); + } + } + Ex.Next(); + } + if (incidentPipeFound) { + addGroup = true; + aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE"); + } + if (!addGroup && (!incidentPipeFound && + !radialFound && + !mainPipeFound && + !flangeFound)) { + // Flange (collerette) + flangeFound = true; + addGroup = true; + aGroup->SetName("FLANGE"); + } + } + else + continue; + } + else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) { + if (nbEdges == 25) { + addGroup = true; + aGroup->SetName("THICKNESS"); + } + else if ((nbEdges == 10) || (nbEdges == 6)) { + if (!circularFoundAndAdded) { + addGroup = true; + circularFoundAndAdded = true; + aGroup->SetName("CIRCULAR_QUARTER_PIPE"); + if (nbEdges == 10) { + circularFound10 = true; + } + } + else if (!circularFound10 && nbEdges == 10) { + circularFound10 = true; + addGroup = true; + aGroup->SetName("CIRCULAR_QUARTER_PIPE"); + } + } + else if (nbEdges == 8) { + incidentPipeFound = true; + mainPipeFound = true; + flangeFound = false; + + bool isNearZ0 = false; + bool isBelowZ0 = false; + + TopExp_Explorer Ex (aGroupShapeTrsfInv,TopAbs_VERTEX); + while (Ex.More()) { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); + double x=aP.X(), y=aP.Y(), z=aP.Z(); + + // tuy_princ_long_avant & tuy_princ_long_apres + //bool isMain = (((z < Precision::Confusion()) || (x < Precision::Confusion())) && + // ((y <= aR1Ext + Precision::Confusion()) || + // (y <= -(aR1Ext + Precision::Confusion())) || + // (y <= theR1 + Precision::Confusion()) || + // (y == -(theR1 + Precision::Confusion())))); + bool isMain = ((z < Precision::Confusion() || x < Precision::Confusion()) && + (fabs(y) > theR1 - Precision::Confusion() || + fabs(y) < Precision::Confusion())); + + if (!isMain) { + mainPipeFound = false; + } + + // collerette + //if (z < Precision::Confusion() && !isMain) { + // flangeFound = true; + // if (!flangeFoundAndAdded) { + // flangeFoundAndAdded = true; + // addGroup = true; + // aGroup->SetName("FLANGE"); + // } + //} + if (fabs(z) < Precision::Confusion()) isNearZ0 = true; + if (z < - Precision::Confusion()) isBelowZ0 = true; + + // tuyau incident + if ((Abs(x) > aR2Ext + Precision::Confusion()) || + (Abs(y) > aR2Ext + Precision::Confusion())) { + incidentPipeFound = false; + } + Ex.Next(); + } + if (mainPipeFound) { + addGroup = true; + aGroup->SetName("HALF_LENGTH_MAIN_PIPE"); + } + if (incidentPipeFound) { + addGroup = true; + aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE"); + } + if (isNearZ0 && !isBelowZ0) { + flangeFound = true; + if (!flangeFoundAndAdded) { + flangeFoundAndAdded = true; + addGroup = true; + aGroup->SetName("FLANGE"); + } + } + if (!addGroup && (!incidentPipeFound && + !mainPipeFound && + !flangeFound && + !chamferOrFilletFound)) { + addGroup = true; + chamferOrFilletFound = true; + if (shapeType == TSHAPE_CHAMFER) + aGroup->SetName("CHAMFER"); + else + aGroup->SetName("FILLET"); + } + } + else + continue; + } + // Add group to the list + if (addGroup) + theSeq->Append(aGroup); + } + + SetErrorCode(OK); + return true; +} + +bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) theShape, + double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theH, double theW, + double theRF, bool isNormal) +{ + SetErrorCode(KO); + + // Build tools for partition operation: + // 1 face and 2 planes + // Face + Handle(GEOM_Object) arete_intersect_int; + Handle(GEOM_Object) wire_t, wire_t2, face_t, face_t2; + Handle(GEOM_Object) chan_racc; + Handle(GEOM_Object) vi1, vi2; + Handle(GEOM_Object) Te3; + + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + Handle(GEOM_Object) Vector_Z = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1); + Vector_Z->GetLastFunction()->SetDescription(""); + + // Useful values + double aSize = 2*(theL1 + theL2); + double aR1Ext = theR1 + theW1; + double aR2Ext = theR2 + theW2; + double theVertCylinderRadius = aR2Ext + theW + theRF; + double theHoriCylinderRadius = aR1Ext + theH + theRF; + + // Common edges on internal cylinder + Handle(GEOM_Object) box_i = my3DPrimOperations->MakeBoxDXDYDZ(theR2, theR2, theR1); + box_i->GetLastFunction()->SetDescription(""); + box_i = myTransformOperations->TranslateDXDYDZ(box_i, -theR2, -theR2, 0); + box_i->GetLastFunction()->SetDescription(""); + + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString theDesc = aFunction->GetDescription(); + Handle(TColStd_HSequenceOfTransient) edges_i = + myShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN); + // Recover previous description to get rid of Propagate dump + aFunction->SetDescription(theDesc); + if (edges_i.IsNull() || edges_i->Length() == 0) { + SetErrorCode("Internal edges not found"); + return false; + } + for (int i=1; i<=edges_i->Length();i++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_i->Value(i)); + anObj->GetLastFunction()->SetDescription(""); + } + arete_intersect_int = Handle(GEOM_Object)::DownCast(edges_i->Value(1)); + + // search for vertices located on both internal pipes + aFunction = theShape->GetLastFunction(); + theDesc = aFunction->GetDescription(); + Handle(TColStd_HSequenceOfTransient) vertices_i = + myShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN); + // Recover previous description to get rid of Propagate dump + aFunction->SetDescription(theDesc); + if (vertices_i.IsNull() || vertices_i->Length() == 0) { + SetErrorCode("Internal vertices not found"); + return false; + } + + for (int i = 1; i <= vertices_i->Length(); i++) { + Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_i->Value(i)); + v->GetLastFunction()->SetDescription(""); + TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue()); + gp_Pnt aP = BRep_Tool::Pnt(aVertex); +// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl; + if (Abs(aP.X()) <= Precision::Confusion()) { + if (Abs(aP.Y()) - theR1 <= Precision::Confusion()) { + vi1 = v; + } + } else if (Abs(aP.Y()) <= Precision::Confusion()) { + if (Abs(aP.X()) - theR1 <= Precision::Confusion()) { + vi2 = v; + } + } + } + + std::list theShapes; + + if (isNormal) { + Handle(GEOM_Object) ve1, ve2; + + Handle(GEOM_Object) box_e = my3DPrimOperations->MakeBoxDXDYDZ(aR2Ext, aR2Ext, aR1Ext); + box_e->GetLastFunction()->SetDescription(""); + box_e = myTransformOperations->TranslateDXDYDZ(box_e, -aR2Ext, -aR2Ext, 0); + box_e->GetLastFunction()->SetDescription(""); + // Common edges on external cylinder + aFunction = theShape->GetLastFunction(); + theDesc = aFunction->GetDescription(); + Handle(TColStd_HSequenceOfTransient) edges_e = + myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN); + // Recover previous description to get rid of Propagate dump + aFunction->SetDescription(theDesc); + if (edges_e.IsNull() || edges_e->Length() == 0) { + SetErrorCode("External edges not found"); + return false; + } + for (int i=1; i<=edges_e->Length();i++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i)); + anObj->GetLastFunction()->SetDescription(""); + } + + // search for vertices located on both external pipes + aFunction = theShape->GetLastFunction(); + theDesc = aFunction->GetDescription(); + Handle(TColStd_HSequenceOfTransient) vertices_e = + myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN); + // Recover previous description to get rid of Propagate dump + aFunction->SetDescription(theDesc); + if (vertices_e.IsNull() || vertices_e->Length() == 0) { + SetErrorCode("External vertices not found"); + return false; + } + + for (int i = 1; i <= vertices_e->Length(); i++) { + Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_e->Value(i)); + v->GetLastFunction()->SetDescription(""); + TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue()); + gp_Pnt aP = BRep_Tool::Pnt(aVertex); +// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl; + if (Abs(aP.X()) <= Precision::Confusion()) { + if (Abs(aP.Y()) - theR2 > Precision::Confusion()) { + ve1 = v; + } + } else if (Abs(aP.Y()) <= Precision::Confusion()) { + if (Abs(aP.X()) - theR2 > Precision::Confusion()) { + ve2 = v; + } + } + if ( !ve1.IsNull() && !ve2.IsNull()) + break; + } + Handle(GEOM_Object) edge_e1, edge_e2; + + edge_e1 = myBasicOperations->MakeLineTwoPnt(ve1, vi1); + if (edge_e1.IsNull()) { + SetErrorCode("Edge 1 could not be built"); + return false; + } + + edge_e2 = myBasicOperations->MakeLineTwoPnt(ve2, vi2); + if (edge_e2.IsNull()) { + SetErrorCode("Edge 2 could not be built"); + return false; + } + + edge_e1->GetLastFunction()->SetDescription(""); + edge_e2->GetLastFunction()->SetDescription(""); + + std::list edge_e_elist; + edge_e_elist.push_back(arete_intersect_int); + edge_e_elist.push_back(edge_e1); + edge_e_elist.push_back(Handle(GEOM_Object)::DownCast(edges_e->Value(1))); + edge_e_elist.push_back(edge_e2); + wire_t = myShapesOperations->MakeWire(edge_e_elist, 1e-7); + if (wire_t.IsNull()) { + SetErrorCode("Impossible to build wire"); + return false; + } + wire_t->GetLastFunction()->SetDescription(""); + face_t = myShapesOperations->MakeFace(wire_t, false); + if (face_t.IsNull()) { + SetErrorCode("Impossible to build face"); + return false; + } + face_t->GetLastFunction()->SetDescription(""); + + theShapes.push_back(theShape); + theShapes.push_back(vi1); + theShapes.push_back(vi2); + theShapes.push_back(ve1); + theShapes.push_back(ve2); + theShapes.push_back(edge_e1); + theShapes.push_back(edge_e2); + theShapes.push_back(wire_t); + theShapes.push_back(face_t); + } + else { + Handle(GEOM_Object) P1, P2, P3, P4, P5, P6; + int idP1, idP2, idP3, idP4; + int PZX, PZY; + double ZX=0, ZY=0; + std::vector LX; + std::vector LY; + Handle(GEOM_Object) box_e = my3DPrimOperations->MakeBoxDXDYDZ + (theVertCylinderRadius, theVertCylinderRadius, theHoriCylinderRadius); + box_e->GetLastFunction()->SetDescription(""); + box_e = myTransformOperations->TranslateDXDYDZ + (box_e, -theVertCylinderRadius, -theVertCylinderRadius, 0); + box_e->GetLastFunction()->SetDescription(""); + + aFunction = theShape->GetLastFunction(); + theDesc = aFunction->GetDescription(); + Handle(TColStd_HSequenceOfTransient) extremVertices = + myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN); + // Recover previous description to get rid of Propagate dump + aFunction->SetDescription(theDesc); + + if (extremVertices.IsNull() || extremVertices->Length() == 0) { + if (theRF == 0) + SetErrorCode("Vertices on chamfer not found"); + else + SetErrorCode("Vertices on fillet not found"); + return false; + } + + theShapes.push_back(theShape); + theShapes.push_back(box_e); + if (extremVertices->Length() != 6) { + // for (int i=1; i<=extremVertices->Length(); i++){ + // theShapes.push_back(Handle(GEOM_Object)::DownCast(extremVertices->Value(i))); + // } + // Handle(GEOM_Object) aCompound = myShapesOperations->MakeCompound(theShapes); + // TopoDS_Shape aCompoundShape = aCompound->GetValue(); + // theShape->GetLastFunction()->SetValue(aCompoundShape); + SetErrorCode("Bad number of vertices on chamfer found"); + return false; + } + + for (int i=1; i<=extremVertices->Length(); i++){ + Handle(GEOM_Object) aV = Handle(GEOM_Object)::DownCast(extremVertices->Value(i)); + aV->GetLastFunction()->SetDescription(""); + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aV->GetValue())); + + if (Abs(aP.X()) <= Precision::Confusion()) { + if (Abs(aP.Y()) - theR2 > Precision::Confusion()) { + LX.push_back(i); + if (aP.Z()-ZX > Precision::Confusion()) { + ZX = aP.Z(); + PZX = i; + } + } + } + else { + if (Abs(aP.X()) - theR2 > Precision::Confusion()) { + LY.push_back(i); + if (aP.Z() - ZY > Precision::Confusion()) { + ZY = aP.Z(); + PZY = i; + } + } + } + } + + idP2 = PZX; + idP4 = PZY; + idP1 = LX.at(0); + if (LX.at(0) == PZX) + idP1 = LX.at(1); + idP3 = LY.at(0); + if (LY.at(0) == PZY) + idP3 = LY.at(1); + + P1 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP1)); + P2 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP2)); + P3 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP3)); + P4 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP4)); + + Handle(GEOM_Object) Cote_1 = myBasicOperations->MakeLineTwoPnt(P1, vi1); + if (Cote_1.IsNull()) { + SetErrorCode("Impossible to build edge in thickness"); + return false; + } + Cote_1->GetLastFunction()->SetDescription(""); + + Handle(GEOM_Object) Cote_2 = myBasicOperations->MakeLineTwoPnt(vi2, P3); + if (Cote_2.IsNull()) { + SetErrorCode("Impossible to build edge in thickness"); + return false; + } + Cote_2->GetLastFunction()->SetDescription(""); + + // edge_chan_princ = arete du chanfrein (ou raccord) sur le tuyau principal + // edge_chan_inc = arete du chanfrein (ou raccord) sur le tuyau incident + // std::cerr << "Getting chamfer edge on main pipe" << std::endl; + Handle(GEOM_Object) edge_chan_princ = myBlocksOperations->GetEdge(theShape, P1, P3); + if (edge_chan_princ.IsNull()) { + SetErrorCode("Impossible to find edge on main pipe"); + return false; + } + edge_chan_princ->GetLastFunction()->SetDescription(""); + + Handle(GEOM_Object) edge_chan_inc = myBlocksOperations->GetEdge(theShape, P2, P4); + if (edge_chan_inc.IsNull()) { + SetErrorCode("Impossible to find edge on incident pipe"); + return false; + } + edge_chan_inc->GetLastFunction()->SetDescription(""); + + std::list edgeList1; + edgeList1.push_back(edge_chan_princ); + edgeList1.push_back(Cote_1); + edgeList1.push_back(arete_intersect_int); + edgeList1.push_back(Cote_2); + + // std::cerr << "Creating wire 1" << std::endl; + wire_t = myShapesOperations->MakeWire(edgeList1, 1e-7); + if (wire_t.IsNull()) { + SetErrorCode("Impossible to build wire"); + return false; + } + wire_t->GetLastFunction()->SetDescription(""); + + // std::cerr << "Creating face 1" << std::endl; + face_t = myShapesOperations->MakeFace(wire_t, false); + if (face_t.IsNull()) { + SetErrorCode("Impossible to build face"); + return false; + } + face_t->GetLastFunction()->SetDescription(""); + theShapes.push_back(face_t); + + gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(P2->GetValue())); + gp_Pnt aP5 = BRep_Tool::Pnt(TopoDS::Vertex(vi1->GetValue())); + double deltaZ = aP2.Z() - aP5.Z(); + // std::cerr << "Creating new point from vi1 with deltaZ = " << deltaZ << std::endl; + Handle(GEOM_Object) P5bis = myTransformOperations->TranslateDXDYDZCopy(vi1, 0, 0, deltaZ); + if (P5bis.IsNull()) { + SetErrorCode("Impossible to translate vertex"); + return false; + } + P5bis->GetLastFunction()->SetDescription(""); + + gp_Pnt aP4 = BRep_Tool::Pnt(TopoDS::Vertex(P4->GetValue())); + gp_Pnt aP6 = BRep_Tool::Pnt(TopoDS::Vertex(vi2->GetValue())); + deltaZ = aP4.Z() - aP6.Z(); + // std::cerr << "Creating new point from vi2 with deltaZ = " << deltaZ << std::endl; + Handle(GEOM_Object) P6bis = myTransformOperations->TranslateDXDYDZCopy(vi2, 0, 0, deltaZ); + if (P6bis.IsNull()) { + SetErrorCode("Impossible to translate vertex"); + return false; + } + P6bis->GetLastFunction()->SetDescription(""); + + // std::cerr << "Creating new line 1 from 2 previous points" << std::endl; + Handle(GEOM_Object) Cote_3 = myBasicOperations->MakeLineTwoPnt(P5bis, P2); + if (Cote_3.IsNull()) { + SetErrorCode("Impossible to build edge in thickness"); + return false; + } + Cote_3->GetLastFunction()->SetDescription(""); + + // std::cerr << "Creating new line 2 from 2 previous points" << std::endl; + Handle(GEOM_Object) Cote_4 = myBasicOperations->MakeLineTwoPnt(P6bis, P4); + if (Cote_4.IsNull()) { + SetErrorCode("Impossible to build edge in thickness"); + return false; + } + Cote_4->GetLastFunction()->SetDescription(""); + + // std::cerr << "Creating new line 3 from 2 previous points" << std::endl; + Handle(GEOM_Object) Cote_5 = myBasicOperations->MakeLineTwoPnt(P5bis, P6bis); + if (Cote_4.IsNull()) { + SetErrorCode("Impossible to build edge in thickness"); + return false; + } + Cote_5->GetLastFunction()->SetDescription(""); + + //std::list edgeList2; + //edgeList2.push_back(edge_chan_inc); + //edgeList2.push_back(Cote_3); + //edgeList2.push_back(Cote_5); + //edgeList2.push_back(Cote_4); + // std::cerr << "Creating wire 2" << std::endl; + //wire_t2 = myShapesOperations->MakeWire(edgeList2, 1e-7); + //if (wire_t2.IsNull()) { + // SetErrorCode("Impossible to build wire"); + // return false; + //} + //wire_t2->GetLastFunction()->SetDescription(""); + // std::cerr << "Creating face 2" << std::endl; + //face_t2 = myShapesOperations->MakeFace(wire_t2, false); + + // Mantis issue 0021682 + face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - (theR2 + theW2)); + //face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - 2.0*theR2); + if (face_t2.IsNull()) { + SetErrorCode("Impossible to build face"); + return false; + } + face_t2->GetLastFunction()->SetDescription(""); + theShapes.push_back(face_t2); + } + + // Planes + Handle(GEOM_Object) aP0 = myBasicOperations->MakePointXYZ(0, 0, 0); + Handle(GEOM_Object) aVZ = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1); + Handle(GEOM_Object) aVXZ = myBasicOperations->MakeVectorDXDYDZ(aR1Ext, 0, 0.5*(theL1+theVertCylinderRadius)); + Handle(GEOM_Object) aPlnOZ = myBasicOperations->MakePlanePntVec(aP0, aVZ, aSize); + Handle(GEOM_Object) aPlnOXZ = myBasicOperations->MakePlanePntVec(aP0, aVXZ, aSize); + aP0->GetLastFunction()->SetDescription(""); + aVZ->GetLastFunction()->SetDescription(""); + aVXZ->GetLastFunction()->SetDescription(""); + aPlnOZ->GetLastFunction()->SetDescription(""); + aPlnOXZ->GetLastFunction()->SetDescription(""); + theShapes.push_back(aPlnOZ); + theShapes.push_back(aPlnOXZ); + + // Partition + Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient; + Handle(TColStd_HArray1OfInteger) theMaterials; + + partitionShapes->Append(theShape); + theTools->Append(aPlnOZ); + if (Abs(aR1Ext - aR2Ext) > Precision::Confusion()) + theTools->Append(aPlnOXZ); + theTools->Append(face_t); + if (!isNormal) + theTools->Append(face_t2); + + Te3 = myBooleanOperations->MakePartition + (partitionShapes, theTools, theKeepInside, theRemoveInside, + TopAbs_SOLID, false, theMaterials, 0, false); + if (Te3.IsNull()) { + SetErrorCode("Impossible to build partition of TShape"); + return false; + } + Te3->GetLastFunction()->SetDescription(""); + + // Last verification: result should be a block + std::list errList; + if (!myBlocksOperations->CheckCompoundOfBlocks(Te3,errList)) { + SetErrorCode("TShape is not a compound of block"); + return false; + } + +// // BEGIN Compound of created shapes - Only for debug purpose +// theShapes.clear(); +// theShapes.push_back(theShape); +// theShapes.push_back(aPlnOZ); +// if (Abs(aR1Ext - aR2Ext) > Precision::Confusion() ) +// theShapes.push_back(aPlnOXZ); +// theShapes.push_back(face_t); +// if (!isNormal) +// theShapes.push_back(face_t2); +// +// Handle(GEOM_Object) aCompound = myShapesOperations->MakeCompound(theShapes); +// TopoDS_Shape aCompoundShape = aCompound->GetValue(); +// theShape->GetLastFunction()->SetValue(aCompoundShape); +// // END Compound of created shapes - Only for debug purpose + + TopoDS_Shape aShape = Te3->GetValue(); + theShape->GetLastFunction()->SetValue(aShape); + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return false; + } + + SetErrorCode(OK); + return true; +} + +// Mirror and glue faces +bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape, + double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2) +{ + SetErrorCode(KO); + + // Useful values + double aSize = 2*(theL1 + theL2); + double aR1Ext = theR1 + theW1; + + // Planes + Handle(GEOM_Object) aP0 = myBasicOperations->MakePointXYZ(0, 0, 0); + aP0->GetLastFunction()->SetDescription(""); + Handle(GEOM_Object) aVX = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0); + Handle(GEOM_Object) aVY = myBasicOperations->MakeVectorDXDYDZ(0, 1, 0); + aVX->GetLastFunction()->SetDescription(""); + aVY->GetLastFunction()->SetDescription(""); + Handle(GEOM_Object) aPlane_OX = myBasicOperations->MakePlanePntVec(aP0, aVX, 2*(aR1Ext + theL2)); + Handle(GEOM_Object) aPlane_OY = myBasicOperations->MakePlanePntVec(aP0, aVY, aSize); + aPlane_OX->GetLastFunction()->SetDescription(""); + aPlane_OY->GetLastFunction()->SetDescription(""); + + Handle(GEOM_Object) Te4 = myTransformOperations->MirrorPlaneCopy(theShape, aPlane_OX); + if (Te4.IsNull()) { + SetErrorCode("Impossible to build mirror of quarter TShape"); + return false; + } + + Handle(GEOM_Object) Te5 = myTransformOperations->MirrorPlaneCopy(theShape, aPlane_OY); + if (Te5.IsNull()) { + SetErrorCode("Impossible to build mirror of half TShape"); + return false; + } + + Handle(GEOM_Object) Te6 = myTransformOperations->MirrorPlaneCopy(Te4, aPlane_OY); + if (Te6.IsNull()) { + SetErrorCode("Impossible to build mirror of half TShape"); + return false; + } + + std::list aShapesList; + aShapesList.push_back(theShape); + aShapesList.push_back(Te4); + aShapesList.push_back(Te5); + aShapesList.push_back(Te6); + Handle(GEOM_Object) Te7 = myShapesOperations->MakeCompound(aShapesList); + if (Te7.IsNull()) { + SetErrorCode("Impossible to build compound"); + return false; + } + + Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7, 1e-7, true); + if (Te8.IsNull()) { + SetErrorCode("Impossible to glue faces of TShape"); + return false; + } + + TopoDS_Shape aShape = Te8->GetValue(); + + theShape->GetLastFunction()->SetValue(aShape); + + Te4->GetLastFunction()->SetDescription(""); + Te5->GetLastFunction()->SetDescription(""); + Te6->GetLastFunction()->SetDescription(""); + Te7->GetLastFunction()->SetDescription(""); + Te8->GetLastFunction()->SetDescription(""); + + SetErrorCode(OK); + return true; +} + +//============================================================================= +/*! + * MakePipeTShape + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) + GEOMImpl_IAdvancedOperations::MakePipeTShape(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + bool theHexMesh) +{ + MESSAGE("GEOMImpl_IAdvancedOperations::MakePipeTShape"); + SetErrorCode(KO); + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE); + + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_BASIC); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL; + + GEOMImpl_IPipeTShape aData(aFunction); + + aData.SetR1(theR1); + aData.SetW1(theW1); + aData.SetL1(theL1); + aData.SetR2(theR2); + aData.SetW2(theW2); + aData.SetL2(theL2); + aData.SetHexMesh(theHexMesh); + + //Compute the resulting value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("TShape driver failed"); + return NULL; + } + if (theHexMesh) { + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + aSeq->Append(aShape); + + if (theHexMesh) { + /* + * Get the groups: BEGIN + */ + try { + if (!MakeGroups(aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) + return NULL; + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + TCollection_AsciiString aListRes, anEntry; + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 2; + for (; i <= aNbGroups; i++) { + Handle(Standard_Transient) anItem = aSeq->Value(i); + if (anItem.IsNull()) continue; + Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem); + if (aGroup.IsNull()) continue; + //Make a Python command + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + + aListRes.Trunc(aListRes.Length() - 2); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << ", " << aListRes.ToCString() << "] = geompy.MakePipeTShape(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theHexMesh << ")"; + } + /* + * Get the groups: END + */ + else { + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << "] = geompy.MakePipeTShape(" << theR1 << ", " << theW1 << ", " + << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theHexMesh << ")"; + } + + SetErrorCode(OK); + + return aSeq; +} + +//============================================================================= +/*! + * MakePipeTShapeWithPosition + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Objects, containing the created shape and propagation groups.. + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) +GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + bool theHexMesh, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3) +{ + SetErrorCode(KO); + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE); + ///////////////// + // TSHAPE CODE + ///////////////// + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_BASIC); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL; + + // Check new position + if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) { + return NULL; + } + + GEOMImpl_IPipeTShape aData(aFunction); + + aData.SetR1(theR1); + aData.SetW1(theW1); + aData.SetL1(theL1); + aData.SetR2(theR2); + aData.SetW2(theW2); + aData.SetL2(theL2); + aData.SetHexMesh(theHexMesh); + + //Compute the resulting value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("TShape driver failed"); + return NULL; + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + if (theHexMesh) { + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + } + + TopoDS_Shape Te = aShape->GetValue(); + + // Set Position + gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3); + BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False); + TopoDS_Shape aTrsf_Shape = aTransformation.Shape(); + aFunction->SetValue(aTrsf_Shape); + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + aSeq->Append(aShape); + + if (theHexMesh) { + // + // Get the groups: BEGIN + // + try { + if (!MakeGroups(aShape,TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) { + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + TCollection_AsciiString aListRes, anEntry; + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 2; + for (; i <= aNbGroups; i++) { + Handle(Standard_Transient) anItem = aSeq->Value(i); + if (anItem.IsNull()) continue; + Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem); + if (aGroup.IsNull()) continue; + //Make a Python command + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + + aListRes.Trunc(aListRes.Length() - 2); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << ", " << aListRes.ToCString() << "] = geompy.MakePipeTShape(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")"; + } + // + // Get the groups: END + // + + else { + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << "] = geompy.MakePipeTShape(" << theR1 << ", " << theW1 << ", " + << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theHexMesh << ", " << theP1 + << ", " << theP2 << ", " << theP3 << ")"; + } + + SetErrorCode(OK); + + return aSeq; +} + +//============================================================================= +/*! + * MakePipeTShapeChamfer + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A chamfer is created + * on the junction of the pipes. + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theH Height of chamfer. + * \param theW Width of chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) +GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theH, double theW, + bool theHexMesh) +{ + SetErrorCode(KO); + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE); + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_CHAMFER); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL; + + GEOMImpl_IPipeTShape aData(aFunction); + + aData.SetR1(theR1); + aData.SetW1(theW1); + aData.SetL1(theL1); + aData.SetR2(theR2); + aData.SetW2(theW2); + aData.SetL2(theL2); + aData.SetH(theH); + aData.SetW(theW); + aData.SetHexMesh(theHexMesh); + + //Compute the resulting value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("TShape driver failed"); + return NULL; + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + // BEGIN of chamfer + TopoDS_Shape aShapeShape = aShape->GetValue(); + TopTools_IndexedMapOfShape anEdgesIndices; + TopExp::MapShapes(aShapeShape, anEdgesIndices); + // Common edges on external cylinders + Handle(GEOM_Object) box_e; + if (theHexMesh) { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1); + } + else { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); + } + box_e->GetLastFunction()->SetDescription(""); + box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); + box_e->GetLastFunction()->SetDescription(""); + + Handle(TColStd_HSequenceOfInteger) edges_e = + myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); + box_e->GetLastFunction()->SetDescription(""); + + if (edges_e.IsNull() || edges_e->Length() == 0) { + SetErrorCode("External edges not found"); + return NULL; + } + int nbEdgesInChamfer = 0; + std::list theEdges; + for (int i=1; i<=edges_e->Length();i++) { + int edgeID = edges_e->Value(i); + TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID); + TopExp_Explorer Ex(theEdge,TopAbs_VERTEX); + int iv=0; + while (Ex.More()) { + iv ++; + gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); + if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) { + nbEdgesInChamfer ++; + theEdges.push_back(edgeID); + } + Ex.Next(); + } + if (theHexMesh && nbEdgesInChamfer == 1) + break; + } + Handle(GEOM_Object) aChamfer; + try { + aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + if (aChamfer.IsNull()) { + SetErrorCode("Chamfer can not be computed on the given shape with the given parameters"); + return NULL; + } + aChamfer->GetLastFunction()->SetDescription(""); + + TopoDS_Shape aChamferShape = aChamfer->GetValue(); + aFunction->SetValue(aChamferShape); + // END of chamfer + + // bool doMesh = false; + if (theHexMesh) { + // doMesh = true; + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false)) { + MESSAGE("PipeTShape partition failed"); + // doMesh = false; + return NULL; + } + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) { + MESSAGE("PipeTShape mirrors and glue failed"); + // doMesh = false; + return NULL; + } + } + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + aSeq->Append(aShape); + + // if (doMesh) { + if (theHexMesh) { + // + // Get the groups: BEGIN + // + //if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) { + // //Make a Python command + // GEOM::TPythonDump(aFunction) + // << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 + // << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW + // << ", " << theHexMesh << ")"; + //} + //else { + try { + if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) + return NULL; + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + TCollection_AsciiString aListRes, anEntry; + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 2; + for (; i <= aNbGroups; i++) { + Handle(Standard_Transient) anItem = aSeq->Value(i); + if (anItem.IsNull()) continue; + Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem); + if (aGroup.IsNull()) continue; + //Make a Python command + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + + aListRes.Trunc(aListRes.Length() - 2); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << ", " << aListRes.ToCString() + << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 + << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW << ", " << theHexMesh << ")"; + //} + } + // + // Get the groups: END + // + else { + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 + << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW + << ", " << theHexMesh << ")"; + } + + SetErrorCode(OK); + + return aSeq; +} + +//============================================================================= +/*! + * MakePipeTShapeChamferWithPosition + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A chamfer is created + * on the junction of the pipes. + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theH Height of chamfer. + * \param theW Width of chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) +GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theH, double theW, + bool theHexMesh, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3) +{ + SetErrorCode(KO); + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE); + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_CHAMFER); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL; + + // Check new position + if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) { + return NULL; + } + + GEOMImpl_IPipeTShape aData(aFunction); + + aData.SetR1(theR1); + aData.SetW1(theW1); + aData.SetL1(theL1); + aData.SetR2(theR2); + aData.SetW2(theW2); + aData.SetL2(theL2); + aData.SetH(theH); + aData.SetW(theW); + aData.SetHexMesh(theHexMesh); + + //Compute the resulting value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("TShape driver failed"); + return NULL; + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + // BEGIN of chamfer + TopoDS_Shape aShapeShape = aShape->GetValue(); + TopTools_IndexedMapOfShape anEdgesIndices; + TopExp::MapShapes(aShapeShape, anEdgesIndices); + // Common edges on external cylinders + Handle(GEOM_Object) box_e; + if (theHexMesh) { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1); + } + else { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); + } + box_e->GetLastFunction()->SetDescription(""); + box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); + box_e->GetLastFunction()->SetDescription(""); + + Handle(TColStd_HSequenceOfInteger) edges_e = + myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); + box_e->GetLastFunction()->SetDescription(""); + + if (edges_e.IsNull() || edges_e->Length() == 0) { + SetErrorCode("External edges not found"); + return NULL; + } + int nbEdgesInChamfer = 0; + std::list theEdges; + for (int i=1; i<=edges_e->Length();i++) { + int edgeID = edges_e->Value(i); + TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID); + TopExp_Explorer Ex(theEdge,TopAbs_VERTEX); + while (Ex.More()) { + gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); + if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) { + nbEdgesInChamfer ++; + theEdges.push_back(edgeID); + } + Ex.Next(); + } + if (theHexMesh && nbEdgesInChamfer == 1) + break; + } + Handle(GEOM_Object) aChamfer; + try { + aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + if (aChamfer.IsNull()) { + SetErrorCode("Chamfer can not be computed on the given shape with the given parameters"); + return NULL; + } + aChamfer->GetLastFunction()->SetDescription(""); + + TopoDS_Shape aChamferShape = aChamfer->GetValue(); + aFunction->SetValue(aChamferShape); + // END of chamfer + + if (theHexMesh) { + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false)) + return NULL; + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + } + + TopoDS_Shape Te = aShape->GetValue(); + + // Set Position + gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3); + BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False); + TopoDS_Shape aTrsf_Shape = aTransformation.Shape(); + aFunction->SetValue(aTrsf_Shape); + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + aSeq->Append(aShape); + if (theHexMesh) { + /* + * Get the groups: BEGIN + */ + try { + if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) + return NULL; + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + TCollection_AsciiString aListRes, anEntry; + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 2; + for (; i <= aNbGroups; i++) { + Handle(Standard_Transient) anItem = aSeq->Value(i); + if (anItem.IsNull()) continue; + Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem); + if (aGroup.IsNull()) continue; + //Make a Python command + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + + aListRes.Trunc(aListRes.Length() - 2); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << ", " << aListRes.ToCString() + << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 + << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW << ", " << theHexMesh << ", " + << theP1 << ", " << theP2 << ", " << theP3 << ")"; + } + /* + * Get the groups: END + */ + else { + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 + << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW + << ", " << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")"; + } + + SetErrorCode(OK); + + return aSeq; +} + +//============================================================================= +/*! + * MakePipeTShapeFillet + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A fillet is created + * on the junction of the pipes. + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theRF Radius of curvature of fillet. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) +GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRF, bool theHexMesh) +{ + SetErrorCode(KO); + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE); + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_FILLET); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL; + + GEOMImpl_IPipeTShape aData(aFunction); + + aData.SetR1(theR1); + aData.SetW1(theW1); + aData.SetL1(theL1); + aData.SetR2(theR2); + aData.SetW2(theW2); + aData.SetL2(theL2); + aData.SetRF(theRF); + aData.SetHexMesh(theHexMesh); + + //Compute the resulting value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("TShape driver failed"); + return NULL; + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + // BEGIN of fillet + TopoDS_Shape aShapeShape = aShape->GetValue(); + TopTools_IndexedMapOfShape anEdgesIndices; + TopExp::MapShapes(aShapeShape, anEdgesIndices); + // Common edges on external cylinders + Handle(GEOM_Object) box_e; + if (theHexMesh) { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1); + } + else { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); + } + box_e->GetLastFunction()->SetDescription(""); + box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); + box_e->GetLastFunction()->SetDescription(""); + + Handle(TColStd_HSequenceOfInteger) edges_e = + myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); + box_e->GetLastFunction()->SetDescription(""); + + if (edges_e.IsNull() || edges_e->Length() == 0) { + SetErrorCode("External edges not found"); + return NULL; + } + int nbEdgesInFillet = 0; + std::list theEdges; + for (int i=1; i<=edges_e->Length();i++) { + int edgeID = edges_e->Value(i); + TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID); + TopExp_Explorer Ex(theEdge,TopAbs_VERTEX); + while (Ex.More()) { + gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); + if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) { + nbEdgesInFillet ++; + theEdges.push_back(edgeID); + } + Ex.Next(); + } + if (theHexMesh && nbEdgesInFillet == 1) + break; + } + + Handle(GEOM_Object) aFillet; + try { + aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + if (aFillet.IsNull()) { + //SetErrorCode("Fillet can not be computed on the given shape with the given parameters"); + SetErrorCode(myLocalOperations->GetErrorCode()); + return NULL; + } + aFillet->GetLastFunction()->SetDescription(""); + + TopoDS_Shape aFilletShape = aFillet->GetValue(); + aFunction->SetValue(aFilletShape); + // END of fillet + +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (1) +// the following block, when enabled, leads to partitioning problems +#if 0 +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (1) + // BEGIN: Limit tolerances (debug) + Handle(GEOM_Object) aCorr1 = myHealingOperations->LimitTolerance(aShape, 1e-07); + TopoDS_Shape aCorr1Shape = aCorr1->GetValue(); + aShape->GetLastFunction()->SetValue(aCorr1Shape); + aCorr1->GetLastFunction()->SetDescription(""); + // END: Limit tolerances (debug) +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (2) +#endif +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (2) + + if (theHexMesh) { + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false)) + return NULL; + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + } + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + aSeq->Append(aShape); + if (theHexMesh) { + /* + * Get the groups: BEGIN + */ + try { + if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) + return NULL; + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + TCollection_AsciiString aListRes, anEntry; + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 2; + for (; i <= aNbGroups; i++) { + Handle(Standard_Transient) anItem = aSeq->Value(i); + if (anItem.IsNull()) continue; + Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem); + if (aGroup.IsNull()) continue; + //Make a Python command + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + + aListRes.Trunc(aListRes.Length() - 2); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << ", " << aListRes.ToCString() + << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 + << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " << theHexMesh << ")"; + } + /* + * Get the groups: END + */ + else { + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 + << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " + << theHexMesh << ")"; + } + + SetErrorCode(OK); + + return aSeq; +} + +//============================================================================= +/*! + * MakePipeTShapeFilletWithPosition + * \brief Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A fillet is created + * on the junction of the pipes. + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theRF Radius of curvature of fillet + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) +GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRF, bool theHexMesh, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3) +{ + SetErrorCode(KO); + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE); + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_FILLET); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL; + + // Check new position + if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) { + return NULL; + } + + GEOMImpl_IPipeTShape aData(aFunction); + + aData.SetR1(theR1); + aData.SetW1(theW1); + aData.SetL1(theL1); + aData.SetR2(theR2); + aData.SetW2(theW2); + aData.SetL2(theL2); + aData.SetRF(theRF); + aData.SetHexMesh(theHexMesh); + + //Compute the resulting value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("TShape driver failed"); + return NULL; + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + // BEGIN of fillet + TopoDS_Shape aShapeShape = aShape->GetValue(); + TopTools_IndexedMapOfShape anEdgesIndices; + TopExp::MapShapes(aShapeShape, anEdgesIndices); + // Common edges on external cylinders + Handle(GEOM_Object) box_e; + if (theHexMesh) { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1); + } + else { + box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); + } + box_e->GetLastFunction()->SetDescription(""); + box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); + box_e->GetLastFunction()->SetDescription(""); + + Handle(TColStd_HSequenceOfInteger) edges_e = + myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); + box_e->GetLastFunction()->SetDescription(""); + + if (edges_e.IsNull() || edges_e->Length() == 0) { + SetErrorCode("External edges not found"); + return NULL; + } + int nbEdgesInFillet = 0; + std::list theEdges; + for (int i=1; i<=edges_e->Length();i++) { + int edgeID = edges_e->Value(i); + TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID); + TopExp_Explorer Ex(theEdge,TopAbs_VERTEX); + while (Ex.More()) { + gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); + if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) { + nbEdgesInFillet ++; + theEdges.push_back(edgeID); + } + Ex.Next(); + } + if (theHexMesh && nbEdgesInFillet == 1) + break; + } + + Handle(GEOM_Object) aFillet; + try { + aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + if (aFillet.IsNull()) { + SetErrorCode("Fillet can not be computed on the given shape with the given parameters"); + return NULL; + } + aFillet->GetLastFunction()->SetDescription(""); + + TopoDS_Shape aFilletShape = aFillet->GetValue(); + aFunction->SetValue(aFilletShape); + // END of fillet + +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (3) +// the following block, when enabled, leads to partitioning problems +#if 0 +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (3) + // BEGIN: Limit tolerances (debug) + Handle(GEOM_Object) aCorr1 = myHealingOperations->LimitTolerance(aShape, 1e-07); + TopoDS_Shape aCorr1Shape = aCorr1->GetValue(); + aShape->GetLastFunction()->SetValue(aCorr1Shape); + aCorr1->GetLastFunction()->SetDescription(""); + // END: Limit tolerances (debug) +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (4) +#endif +// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (4) + + if (theHexMesh) { + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false)) + return NULL; + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + } + + TopoDS_Shape Te = aShape->GetValue(); + + // Set Position + gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3); + BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False); + TopoDS_Shape aTrsf_Shape = aTransformation.Shape(); + aFunction->SetValue(aTrsf_Shape); + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + aSeq->Append(aShape); + if (theHexMesh) { + /* + * Get the groups: BEGIN + */ + try { + if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) + return NULL; + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + TCollection_AsciiString aListRes, anEntry; + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 2; + for (; i <= aNbGroups; i++) { + Handle(Standard_Transient) anItem = aSeq->Value(i); + if (anItem.IsNull()) continue; + Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem); + if (aGroup.IsNull()) continue; + //Make a Python command + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + + aListRes.Trunc(aListRes.Length() - 2); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << ", " << aListRes.ToCString() + << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 + << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " << theHexMesh << ", " << theP1 << ", " + << theP2 << ", " << theP3 << ")"; + } + /* + * Get the groups: END + */ + else { + //Make a Python command + GEOM::TPythonDump(aFunction) + << "[" << aShape << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 + << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " + << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")"; + } + + SetErrorCode(OK); + + return aSeq; +} + +//============================================================================= +/*! + * This function allows to create a disk already divided into blocks. It can be + * used to create divided pipes for later meshing in hexaedra. + * \param theR Radius of the disk + * \param theRatio Relative size of the central square diagonal against the disk diameter + * \param theOrientation Plane on which the disk will be built + * \param thePattern The division pattern of the disk (hexagon or square in the center) + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio, + int theOrientation, int thePattern) +{ + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK); + + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_DividedDiskDriver::GetID(), DIVIDEDDISK_R_RATIO); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL; + + GEOMImpl_IDividedDisk aData (aFunction); + + aData.SetR(theR); + aData.SetRatio(theRatio); + aData.SetOrientation(theOrientation); + aData.SetType(thePattern); + + //Compute the resulting value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("DividedDisk driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + std::string aPatternStr; + + switch(thePattern) + { + case 0: + aPatternStr = "GEOM.SQUARE"; + break; + case 1: + aPatternStr = "GEOM.HEXAGON"; + break; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theOrientation << ", " << aPatternStr.c_str() << ")"; + + SetErrorCode(OK); + + return aShape; +} + +//============================================================================= +/*! + * This function allows to create a disk already divided into blocks. It can be + * used to create divided pipes for later meshing in hexaedra. + * \param theR Radius of the disk + * \param theRatio Relative size of the central square diagonal against the disk diameter + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theR, + double theRatio, + int thePattern) +{ + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK); + + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_DividedDiskDriver::GetID(), DIVIDEDDISK_R_VECTOR_PNT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL; + + GEOMImpl_IDividedDisk aData (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aData.SetCenter(aRefPnt); + aData.SetVector(aRefVec); + + aData.SetR(theR); + aData.SetRatio(theRatio); + aData.SetType(thePattern); + + //Compute the resulting value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("DividedDisk driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + std::string aPatternStr; + + switch(thePattern) + { + case 0: + aPatternStr = "GEOM.SQUARE"; + break; + case 1: + aPatternStr = "GEOM.HEXAGON"; + break; + } + + + //Make a Python command + GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDiskPntVecR(" << thePnt << ", " << theVec << ", " << theR << ", " << aPatternStr.c_str() << ")"; + + SetErrorCode(OK); + + return aShape; +} + +//============================================================================= +/*! + * Builds a cylinder prepared for hexa meshes + * \param theR Radius of the cylinder + * \param theH Height of the cylinder + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedCylinder (double theR, + double theH, + int thePattern) +{ + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDCYLINDER); + + Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 67.0, 1, thePattern); + aBaseShape->GetLastFunction()->SetDescription(""); // Erase dump of MakeDividedDisk + + aShape = my3DPrimOperations->MakePrismDXDYDZ(aBaseShape,0.0,0.0,theH, -1.0); + + Handle(GEOM_Function) aFunction = aShape->GetLastFunction(); + aFunction->SetDescription(""); // Erase dump of MakePrismDXDYDZ + aShape->SetType(GEOM_DIVIDEDCYLINDER); + + std::string aPatternStr; + + switch(thePattern) + { + case 0: + aPatternStr = "GEOM.SQUARE"; + break; + case 1: + aPatternStr = "GEOM.HEXAGON"; + break; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedCylinder(" << theR << ", " << theH << ", " << aPatternStr.c_str() << ")"; + + SetErrorCode(OK); + + return aShape; +} +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx new file mode 100644 index 000000000..a7c11d6ff --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx @@ -0,0 +1,127 @@ +// Copyright (C) 2007-2012 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 +// +// File : GEOMImpl_IAdvancedOperations.hxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#ifndef _GEOMImpl_IAdvancedOperations_HXX_ +#define _GEOMImpl_IAdvancedOperations_HXX_ + +#include +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +class GEOMImpl_IBasicOperations; +class GEOMImpl_IBooleanOperations; +class GEOMImpl_IShapesOperations; +class GEOMImpl_ITransformOperations; +class GEOMImpl_IBlocksOperations; +class GEOMImpl_I3DPrimOperations; +class GEOMImpl_ILocalOperations; +class GEOMImpl_IHealingOperations; + +class GEOMImpl_IAdvancedOperations: public GEOM_IOperations { +private: + bool MakePipeTShapePartition(Handle(GEOM_Object) theShape, + double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theH = 0, double theW = 0, + double theRF = 0, bool isNormal = true); + bool MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape, + double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2); + bool MakeGroups(Handle(GEOM_Object) theShape, int shapType, + double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + Handle(TColStd_HSequenceOfTransient) theSeq, + gp_Trsf aTrsf); + gp_Trsf GetPositionTrsf(double theL1, double theL2, + Handle(GEOM_Object) P1 = 0, + Handle(GEOM_Object) P2 = 0, + Handle(GEOM_Object) P3 = 0); + bool CheckCompatiblePosition(double& theL1, double& theL2, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3, + double theTolerance); +private: + GEOMImpl_IBasicOperations* myBasicOperations; + GEOMImpl_IBooleanOperations* myBooleanOperations; + GEOMImpl_IShapesOperations* myShapesOperations; + GEOMImpl_ITransformOperations* myTransformOperations; + GEOMImpl_IBlocksOperations* myBlocksOperations; + GEOMImpl_I3DPrimOperations* my3DPrimOperations; + GEOMImpl_ILocalOperations* myLocalOperations; + GEOMImpl_IHealingOperations* myHealingOperations; + +public: + Standard_EXPORT GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IAdvancedOperations(); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + MakePipeTShape(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + bool theHexMesh = true); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + MakePipeTShapeWithPosition(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + bool theHexMesh = true, + Handle(GEOM_Object) P1 = 0, + Handle(GEOM_Object) P2 = 0, + Handle(GEOM_Object) P3 = 0); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + MakePipeTShapeChamfer(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theH, double theW, + bool theHexMesh = true); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theH, double theW, + bool theHexMesh = true, + Handle(GEOM_Object) P1 = 0, + Handle(GEOM_Object) P2 = 0, + Handle(GEOM_Object) P3 = 0); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + MakePipeTShapeFillet(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRF, bool theHexMesh = true); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRF, bool theHexMesh = true, + Handle(GEOM_Object) P1 = 0, + Handle(GEOM_Object) P2 = 0, + Handle(GEOM_Object) P3 = 0); + + Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio, + int theOrientation, int thePattern); + Standard_EXPORT Handle(GEOM_Object) MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theR, + double theRatio, + int thePattern); + + Standard_EXPORT Handle(GEOM_Object) MakeDividedCylinder (double theR, + double theH, + int thePattern); + + /*@@ insert new functions before this line @@ do not remove this line @@*/ +}; +#endif diff --git a/src/GEOMImpl/GEOMImpl_IArc.hxx b/src/GEOMImpl/GEOMImpl_IArc.hxx index 8aecd206c..7927ef77b 100644 --- a/src/GEOMImpl/GEOMImpl_IArc.hxx +++ b/src/GEOMImpl/GEOMImpl_IArc.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Arc creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IArchimede.hxx b/src/GEOMImpl/GEOMImpl_IArchimede.hxx index 4b93c91f0..68721becf 100644 --- a/src/GEOMImpl/GEOMImpl_IArchimede.hxx +++ b/src/GEOMImpl/GEOMImpl_IArchimede.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Archimede operation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx index 1594f5827..e29905bd3 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx @@ -1,28 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include +#include + #include "utilities.h" #include #include @@ -103,7 +106,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ //Compute the point value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -158,7 +161,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference //Compute the point value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -182,36 +185,81 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference //============================================================================= /*! - * MakePointOnCurve + * makePointOnGeom */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve - (Handle(GEOM_Object) theCurve, double theParameter) +Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom + (Handle(GEOM_Object) theGeomObj, + double theParam1, + double theParam2, + double theParam3, + const PointLocation theLocation, + Handle(GEOM_Object) theRefPoint) { SetErrorCode(KO); - if (theCurve.IsNull()) return NULL; + if (theGeomObj.IsNull()) return NULL; //Add a new Point object Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); //Add a new Point function for creation a point relativley another point - Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_CURVE_PAR); + int fType = POINT_CURVE_PAR; + switch( theLocation ) + { + case PointOn_CurveByParam: fType = POINT_CURVE_PAR; break; + case PointOn_CurveByLength: fType = POINT_CURVE_LENGTH; break; + case PointOn_CurveByCoord: fType = POINT_CURVE_COORD; break; + case PointOn_SurfaceByParam: fType = POINT_SURFACE_PAR; break; + case PointOn_SurfaceByCoord: fType = POINT_SURFACE_COORD; break; + default: break; + } + Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType); //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL; GEOMImpl_IPoint aPI (aFunction); - Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction(); + Handle(GEOM_Function) aRefFunction = theGeomObj->GetLastFunction(); if (aRefFunction.IsNull()) return NULL; - aPI.SetCurve(aRefFunction); - aPI.SetParameter(theParameter); - + switch( theLocation ) + { + case PointOn_CurveByParam: + aPI.SetCurve(aRefFunction); + aPI.SetParameter(theParam1); + break; + case PointOn_CurveByLength: + aPI.SetCurve(aRefFunction); + aPI.SetLength(theParam1); + if (!theRefPoint.IsNull()) { + Handle(GEOM_Function) aRefPoint = theRefPoint->GetLastFunction(); + aPI.SetRef(aRefPoint); + } + break; + case PointOn_CurveByCoord: + aPI.SetCurve(aRefFunction); + aPI.SetX(theParam1); + aPI.SetY(theParam2); + aPI.SetZ(theParam3); + break; + case PointOn_SurfaceByParam: + aPI.SetSurface(aRefFunction); + aPI.SetParameter(theParam1); + aPI.SetParameter2(theParam2); + break; + case PointOn_SurfaceByCoord: + aPI.SetSurface(aRefFunction); + aPI.SetX(theParam1); + aPI.SetY(theParam2); + aPI.SetZ(theParam3); + default: break; + } + //Compute the point value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -226,68 +274,100 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve } //Make a Python command - GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve(" - << theCurve << ", " << theParameter << ")"; + switch( theLocation ) + { + case PointOn_CurveByParam: + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve(" + << theGeomObj << ", " << theParam1 << ")"; + break; + case PointOn_CurveByLength: + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength(" + << theGeomObj << ", " << theParam1 << ", " << theRefPoint << ")"; + break; + case PointOn_CurveByCoord: + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord(" + << theGeomObj << ", " << theParam1 + << ", " << theParam2 << ", " << theParam3 << ")"; + break; + case PointOn_SurfaceByParam: + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface(" + << theGeomObj << ", " << theParam1 + << ", " << theParam2 << ")"; + break; + case PointOn_SurfaceByCoord: + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord(" + << theGeomObj << ", " << theParam1 + << ", " << theParam2 << ", " << theParam3 << ")"; + default: break; + } SetErrorCode(OK); return aPoint; } - //============================================================================= /*! - * MakePointOnSurface + * MakePointOnCurve */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface - (Handle(GEOM_Object) theSurface, double theUParameter, double theVParameter) +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve + (Handle(GEOM_Object) theCurve, double theParameter) { - SetErrorCode(KO); - - if (theSurface.IsNull()) return NULL; - - //Add a new Point object - Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); - - //Add a new Point function for creation a point relativley another point - Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), - POINT_SURFACE_PAR); - - //Check if the function is set correctly - if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL; - - GEOMImpl_IPoint aPI (aFunction); - - Handle(GEOM_Function) aRefFunction = theSurface->GetLastFunction(); - if (aRefFunction.IsNull()) return NULL; + return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam); +} - aPI.SetSurface(aRefFunction); - aPI.SetParameter(theUParameter); - aPI.SetParameter2(theVParameter); +//============================================================================= +/*! + * MakePointOnCurveByCoord + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByCoord + (Handle(GEOM_Object) theCurve, + double theXParam, + double theYParam, + double theZParam) +{ + return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, PointOn_CurveByCoord); +} - //Compute the point value - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if (!GetSolver()->ComputeFunction(aFunction)) { - SetErrorCode("Point driver failed"); - return NULL; - } - } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); - return NULL; - } +//============================================================================= +/*! + * MakePointOnCurveByLength + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength + (Handle(GEOM_Object) theCurve, + double theLength, + Handle(GEOM_Object) theStartPoint) +{ + return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theStartPoint); +} - //Make a Python command - GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface(" - << theSurface << ", " << theUParameter - << ", " << theVParameter << ")"; +//============================================================================= +/*! + * MakePointOnSurface + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface + (Handle(GEOM_Object) theSurface, + double theUParameter, + double theVParameter) +{ + return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., PointOn_SurfaceByParam); +} - SetErrorCode(OK); - return aPoint; +//============================================================================= +/*! + * MakePointOnSurfaceByCoord + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord + (Handle(GEOM_Object) theSurface, + double theXParam, + double theYParam, + double theZParam) +{ + return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord); } @@ -323,7 +403,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection //Compute the point value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -376,7 +456,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve //Compute the vector value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -427,7 +507,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ //Compute the Vector value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -482,7 +562,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt //Compute the Vector value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -538,7 +618,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine //Compute the Line value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -593,7 +673,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt //Compute the Line value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -648,7 +728,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces //Compute the Line value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -707,7 +787,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt //Compute the Plane value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -764,7 +844,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec //Compute the Plane value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -818,7 +898,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace //Compute the Plane value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -840,6 +920,117 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace return aPlane; } +//============================================================================= +/*! + * MakePlane2Vec + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec + (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2, + double theSize) +{ + SetErrorCode(KO); + + if (theVec1.IsNull() || theVec2.IsNull()) return NULL; + + //Add a new Plane object + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + + //Add a new Plane function + Handle(GEOM_Function) aFunction = + aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_2_VEC); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL; + + GEOMImpl_IPlane aPI (aFunction); + + Handle(GEOM_Function) aRefVec1 = theVec1->GetLastFunction(); + Handle(GEOM_Function) aRefVec2 = theVec2->GetLastFunction(); + if (aRefVec1.IsNull() || aRefVec2.IsNull()) return NULL; + + aPI.SetVector1(aRefVec1); + aPI.SetVector2(aRefVec2); + aPI.SetSize(theSize); + + //Compute the Plane value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Plane driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlane2Vec(" + << theVec1 << ", " << theVec2 << ", " << theSize << ")"; + + SetErrorCode(OK); + return aPlane; +} + +//============================================================================= +/*! + * MakePlaneLCS + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS + (Handle(GEOM_Object) theLCS, double theSize, int theOrientation) +{ + SetErrorCode(KO); + + //Add a new Plane object + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + + //Add a new Plane function + Handle(GEOM_Function) aFunction = + aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_LCS); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL; + + GEOMImpl_IPlane aPI (aFunction); + + if ( !theLCS.IsNull() ) { + Handle(GEOM_Function) aRef = theLCS->GetLastFunction(); + aPI.SetLCS(aRef); + } + + aPI.SetSize(theSize); + aPI.SetOrientation(theOrientation); + + //Compute the Plane value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Plane driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneLCS(" + << theLCS << ", " << theSize << ", " << theOrientation << ")"; + + SetErrorCode(OK); + return aPlane; +} + //============================================================================= /*! @@ -872,7 +1063,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker //Compute the marker value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -896,6 +1087,115 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker return aMarker; } +//============================================================================= +/*! + * MakeMarkerFromShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerFromShape + (const Handle(GEOM_Object)& theShape) +{ + SetErrorCode(KO); + + //Add a new Marker object + Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER); + + //Add a new Marker function + Handle(GEOM_Function) aFunction = + aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_SHAPE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL; + + GEOMImpl_IMarker aPI(aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aPI.SetShape(aRefShape); + + //Compute the marker value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Marker driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarkerFromShape(" << theShape << ")"; + + SetErrorCode(OK); + return aMarker; +} + +//============================================================================= +/*! + * MakeMarkerPntTwoVec + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerPntTwoVec + (const Handle(GEOM_Object)& theOrigin, + const Handle(GEOM_Object)& theXVec, + const Handle(GEOM_Object)& theYVec) +{ + SetErrorCode(KO); + + //Add a new Marker object + Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER); + + //Add a new Marker function + Handle(GEOM_Function) aFunction = + aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_PNT2VEC); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL; + + GEOMImpl_IMarker aPI(aFunction); + + Handle(GEOM_Function) aRefOrigin = theOrigin->GetLastFunction(); + Handle(GEOM_Function) aRefXVec = theXVec->GetLastFunction(); + Handle(GEOM_Function) aRefYVec = theYVec->GetLastFunction(); + if (aRefOrigin.IsNull() || aRefXVec.IsNull() || aRefYVec.IsNull()) return NULL; + + aPI.SetOrigin(aRefOrigin); + aPI.SetXVec(aRefXVec); + aPI.SetYVec(aRefYVec); + + //Compute the marker value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Marker driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarkerPntTwoVec(" + << theOrigin << ", " << theXVec << ", " << theYVec << ")"; + + SetErrorCode(OK); + return aMarker; +} + //============================================================================= /*! * MakeTangentPlaneOnFace @@ -903,9 +1203,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker //============================================================================= Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace, - double theParamU, - double theParamV, - double theSize) + double theParamU, + double theParamV, + double theSize) { SetErrorCode(KO); @@ -933,7 +1233,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Hand //Compute the Plane value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -954,5 +1254,3 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Hand SetErrorCode(OK); return aPlane; } - - diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx index 16c4af6ea..1e743415f 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_IBasicOperations_HXX_ #define _GEOMImpl_IBasicOperations_HXX_ @@ -40,7 +41,16 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations { double theX, double theY, double theZ); Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve, - double theParameter); + double theParameter); + + Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve, + double theLength, + Handle(GEOM_Object) theStartPoint); + + Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByCoord (Handle(GEOM_Object) theCurve, + double theXParam, + double theYParam, + double theZParam); Standard_EXPORT Handle(GEOM_Object) MakePointOnLinesIntersection (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2); @@ -49,6 +59,11 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations { double theUParameter, double theVParameter); + Standard_EXPORT Handle(GEOM_Object) MakePointOnSurfaceByCoord (Handle(GEOM_Object) theSurface, + double theXParam, + double theYParam, + double theZParam); + // Vector Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ); @@ -56,7 +71,7 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations { Handle(GEOM_Object) thePnt2); Standard_EXPORT Handle(GEOM_Object) MakeTangentOnCurve(const Handle(GEOM_Object)& theCurve, - double theParameter); + double theParameter); // Line Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1, @@ -79,17 +94,49 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations { double theSize); Standard_EXPORT Handle(GEOM_Object) MakePlaneFace (Handle(GEOM_Object) theFace, double theSize); + + Standard_EXPORT Handle(GEOM_Object) MakePlane2Vec (Handle(GEOM_Object) theVec1, + Handle(GEOM_Object) theVec2, + double theSize); + + Standard_EXPORT Handle(GEOM_Object) MakePlaneLCS (Handle(GEOM_Object) theFace, double theSize, int theOrientation); // Marker Standard_EXPORT Handle(GEOM_Object) MakeMarker (double theOX, double theOY, double theOZ, double theXDX, double theXDY, double theXDZ, double theYDX, double theYDY, double theYDZ); + + Standard_EXPORT Handle(GEOM_Object) MakeMarkerFromShape (const Handle(GEOM_Object)& theShape); + + Standard_EXPORT Handle(GEOM_Object) MakeMarkerPntTwoVec (const Handle(GEOM_Object)& theOrigin, + const Handle(GEOM_Object)& theXVec, + const Handle(GEOM_Object)& theYVec); Standard_EXPORT Handle(GEOM_Object) MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace, - double theParamU, - double theParamV, - double theSize); - + double theParamU, + double theParamV, + double theSize); + + private: + // Private methods + + //! Enumeration describes point position on geometric object (curve or surface) + //! Point location can be determined by parameter (or U, V parameters) or 3D coordinates + enum PointLocation + { + PointOn_CurveByParam, + PointOn_CurveByCoord, + PointOn_CurveByLength, + PointOn_SurfaceByParam, + PointOn_SurfaceByCoord + }; + + Handle(GEOM_Object) makePointOnGeom (Handle(GEOM_Object) theGeomObj, + double theParam1, + double theParam2, + double theParam3, + const PointLocation theLocation, + Handle(GEOM_Object) theRefPoint = 0); }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx b/src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx index b6827133d..5505f3c20 100644 --- a/src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx +++ b/src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx @@ -1,25 +1,26 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -//NOTE: This is an interface to a function for the Blocks Multi-Transformations. + +//NOTE: This is an interface to a functions for the Blocks Multi-Transformations and repairing // #include "GEOM_Function.hxx" @@ -32,6 +33,8 @@ #define TRSF_FACE_2_V 6 #define TRSF_NBITER_V 7 +#define TRSF_NB_FACES 8 + class GEOMImpl_IBlockTrsf { public: @@ -49,6 +52,8 @@ class GEOMImpl_IBlockTrsf void SetNbIterU (int theNbIter) { _func->SetInteger(TRSF_NBITER_U, theNbIter); } void SetNbIterV (int theNbIter) { _func->SetInteger(TRSF_NBITER_V, theNbIter); } + void SetOptimumNbFaces (int theNbFaces) { _func->SetInteger(TRSF_NB_FACES, theNbFaces); } + int GetFace1U () { return _func->GetInteger(TRSF_FACE_1_U); } int GetFace2U () { return _func->GetInteger(TRSF_FACE_2_U); } int GetFace1V () { return _func->GetInteger(TRSF_FACE_1_V); } @@ -56,6 +61,8 @@ class GEOMImpl_IBlockTrsf int GetNbIterU() { return _func->GetInteger(TRSF_NBITER_U); } int GetNbIterV() { return _func->GetInteger(TRSF_NBITER_V); } + int GetOptimumNbFaces() { return _func->GetInteger(TRSF_NB_FACES); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IBlocks.hxx b/src/GEOMImpl/GEOMImpl_IBlocks.hxx index dac943bd2..c237641d5 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocks.hxx +++ b/src/GEOMImpl/GEOMImpl_IBlocks.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // NOTE: This is an interface to a function for the Blocks // creation and transformation. // diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx index 590881408..42aaa4260 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifdef WNT #pragma warning( disable:4786 ) #endif @@ -34,6 +35,7 @@ #include #include #include +#include #include #include @@ -44,6 +46,8 @@ #include #include +#include + #include "utilities.h" #include #include @@ -164,7 +168,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -222,7 +226,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad2Edges //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -287,7 +291,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad4Vertices //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -359,7 +363,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa //Compute the Block value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -418,7 +422,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa2Faces //Compute the Block value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -474,7 +478,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeBlockCompound //Compute the Blocks Compound value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -568,6 +572,81 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint return aResult; } +//============================================================================= +/*! + * GetVertexNearPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetVertexNearPoint + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + + // New Point object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || thePoint.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + TopoDS_Shape aPoint = thePoint->GetValue(); + if (aBlockOrComp.IsNull() || aPoint.IsNull()) { + SetErrorCode("Given shape is null"); + return NULL; + } + + if (aPoint.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for vertex identification is not a vertex"); + return NULL; + } + + TopoDS_Vertex aVert = TopoDS::Vertex(aPoint); + gp_Pnt aP = BRep_Tool::Pnt(aVert); + + // Compute the Vertex value + TopoDS_Shape V; + bool isFound = false; + Standard_Real aDist = RealLast(); + TopTools_MapOfShape mapShape; + + TopExp_Explorer exp (aBlockOrComp, TopAbs_VERTEX); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Vertex aVi = TopoDS::Vertex(exp.Current()); + gp_Pnt aPi = BRep_Tool::Pnt(aVi); + Standard_Real aDisti = aPi.Distance(aP); + if (aDisti < aDist) { + V = aVi; + aDist = aDisti; + isFound = true; + } + } + } + + if (!isFound) { + SetErrorCode("Vertex has not been found"); + return NULL; + } + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(V)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + + // The GetPoint() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + + // Make a Python command + GEOM::TPythonDump(aFunction, /*append=*/true) + << aResult << " = geompy.GetVertexNearPoint(" + << theShape << ", " << thePoint << ")"; + + SetErrorCode(OK); + return aResult; +} + //============================================================================= /*! * GetEdge @@ -606,7 +685,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdge //Compute the Edge value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopTools_IndexedDataMapOfShapeListOfShape MVE; @@ -712,7 +791,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdgeNearPoint //Compute the Edge value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape aShape; @@ -844,7 +923,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByPoints //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape aShape; @@ -979,7 +1058,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByEdges //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape aShape; @@ -1104,7 +1183,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetOppositeFace //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape aShape; @@ -1170,7 +1249,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape aShape; @@ -1362,7 +1441,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByNormale //Compute the Face value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape aShape; @@ -1457,6 +1536,137 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByNormale return aResult; } +//============================================================================= +/*! + * GetShapesNearPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetShapesNearPoint + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint, + const Standard_Integer theShapeType, + const Standard_Real theConstTolerance) +{ + SetErrorCode(KO); + + // New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || thePoint.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Block or compound is null"); + return NULL; + } + + TopoDS_Shape anArg = thePoint->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for face identification is not a vertex"); + return NULL; + } + + if (theShapeType < TopAbs_SOLID || TopAbs_VERTEX < theShapeType) { + SetErrorCode("Invalid type of result is requested"); + return NULL; + } + + Standard_Real theTolerance = theConstTolerance; + if (theTolerance < Precision::Confusion()) { + theTolerance = Precision::Confusion(); + } + + // Compute the result + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + TopoDS_Vertex aVert = TopoDS::Vertex(anArg); + + TopTools_MapOfShape mapShape; + Standard_Integer nbEdges = 0; + TopExp_Explorer exp (aBlockOrComp, TopAbs_ShapeEnum(theShapeType)); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + nbEdges++; + } + } + + if (nbEdges == 0) { + SetErrorCode("Given shape contains no sub-shapes of requested type"); + return NULL; + } + + // Calculate distances and find min + mapShape.Clear(); + Standard_Integer ind = 1; + Standard_Real aMinDist = RealLast(); + TopTools_Array1OfShape anEdges (1, nbEdges); + TColStd_Array1OfReal aDistances (1, nbEdges); + for (exp.Init(aBlockOrComp, TopAbs_ShapeEnum(theShapeType)); exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape anEdge = exp.Current(); + anEdges(ind) = anEdge; + + BRepExtrema_DistShapeShape aDistTool (aVert, anEdges(ind)); + if (!aDistTool.IsDone()) { + SetErrorCode("Can not find a distance from the given point to one of sub-shapes"); + return NULL; + } + aDistances(ind) = aDistTool.Value(); + if (aDistances(ind) < aMinDist) { + aMinDist = aDistances(ind); + } + ind++; + } + } + + if (aMinDist < RealLast()) { + // Collect sub-shapes with distance < (aMinDist + theTolerance) + int nbSubShapes = 0; + TopTools_Array1OfShape aNearShapes (1, nbEdges); + for (ind = 1; ind <= nbEdges; ind++) { + if (aDistances(ind) < aMinDist + theTolerance) { + nbSubShapes++; + aNearShapes(nbSubShapes) = anEdges(ind); + } + } + + // Add sub-shape + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, nbSubShapes); + for (ind = 1; ind <= nbSubShapes; ind++) { + anArray->SetValue(ind, anIndices.FindIndex(aNearShapes(ind))); + } + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + if (aResult.IsNull()) + return NULL; + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << aResult << " = geompy.GetShapesNearPoint(" << theShape << ", " << thePoint + << ", " << TopAbs_ShapeEnum(theShapeType) << ", " << theTolerance << ")"; + + SetErrorCode(OK); + return aResult; +} + //============================================================================= /*! * IsCompoundOfBlocks @@ -1478,7 +1688,7 @@ Standard_Boolean GEOMImpl_IBlocksOperations::IsCompoundOfBlocks //Check isCompOfBlocks = Standard_True; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopTools_MapOfShape mapShape; @@ -2126,7 +2336,7 @@ TCollection_AsciiString GEOMImpl_IBlocksOperations::PrintBCErrors //============================================================================= Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound, - std::list& theErrors) + std::list& theErrors) { SetErrorCode(KO); @@ -2222,7 +2432,7 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks } // 3. Find not glued blocks - GEOMAlgo_GlueAnalyser aGD; + GEOMAlgo_GlueAnalyser aGD; aGD.SetShape(aComp); aGD.SetTolerance(Precision::Confusion()); @@ -2309,7 +2519,8 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks */ //============================================================================= Handle(GEOM_Object) GEOMImpl_IBlocksOperations::RemoveExtraEdges - (Handle(GEOM_Object) theObject) + (Handle(GEOM_Object) theObject, + const Standard_Integer theOptimumNbFaces) { SetErrorCode(KO); @@ -2330,10 +2541,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::RemoveExtraEdges GEOMImpl_IBlockTrsf aTI (aFunction); aTI.SetOriginal(aLastFunction); + aTI.SetOptimumNbFaces(theOptimumNbFaces); //Compute the fixed shape try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -2348,8 +2560,9 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::RemoveExtraEdges } //Make a Python command - GEOM::TPythonDump(aFunction) << aCopy - << " = geompy.RemoveExtraEdges(" << theObject << ")"; + std::string doUnionFaces = (theOptimumNbFaces < 0) ? "False" : "True"; + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.RemoveExtraEdges(" + << theObject << ", " << doUnionFaces.data() << ")"; SetErrorCode(OK); return aCopy; @@ -2383,9 +2596,13 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::CheckAndImprove GEOMImpl_IBlockTrsf aTI (aFunction); aTI.SetOriginal(aLastFunction); + // -1 means do not unite faces on common surface (?except case of seam edge between them?) + //aTI.SetOptimumNbFaces(-1); + aTI.SetOptimumNbFaces(6); + //Compute the fixed shape try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -2437,7 +2654,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompound // Explode try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopExp_Explorer exp (aBlockOrComp, TopAbs_SOLID); @@ -2532,7 +2749,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockNearPoint //Compute the Block value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape aShape; @@ -2711,7 +2928,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockByParts //Compute the Block value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif // 1. Explode compound on solids @@ -2830,7 +3047,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::GetBlocksByPart //Get the Blocks try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopTools_MapOfShape mapShape; @@ -2953,7 +3170,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation1D //Compute the transformation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -3017,7 +3234,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation2D //Compute the transformation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -3069,6 +3286,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate TopTools_MapOfShape mapAcceptedEdges; TCollection_AsciiString aListRes, anEntry; + // Sort shapes in current chain (Mantis issue 21053) + TopTools_DataMapOfShapeListOfShape aMapChains; + TopTools_ListOfShape aFirstInChains; + for (ie = 1; ie <= nbEdges; ie++) { TopoDS_Shape curE = MEW.FindKey(ie); @@ -3129,6 +3350,21 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate listPrevEdges = listCurEdges; } // while (listPrevEdges.Extent() > 0) + // Sort shapes in current chain (Mantis issue 21053) + GEOMImpl_IShapesOperations::SortShapes(currentChain, Standard_False); + aFirstInChains.Append(currentChain.First()); + aMapChains.Bind(currentChain.First(), currentChain); + } + + // Sort chains (Mantis issue 21053) + GEOMImpl_IShapesOperations::SortShapes(aFirstInChains, Standard_False); + + // Store sorted chains in the document + TopTools_ListIteratorOfListOfShape aChainsIt (aFirstInChains); + for (; aChainsIt.More(); aChainsIt.Next()) { + TopoDS_Shape aFirstInChain = aChainsIt.Value(); + const TopTools_ListOfShape& currentChain = aMapChains.Find(aFirstInChain); + // Store the chain in the document Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, currentChain.Extent()); @@ -3146,7 +3382,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate // Set a GROUP type aChain->SetType(GEOM_GROUP); - // Set a sub shape type + // Set a sub-shape type TDF_Label aFreeLabel = aChain->GetFreeLabel(); TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)TopAbs_EDGE); diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx index 449c36f51..f702da402 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_IBlocksOperations_HXX_ #define _GEOMImpl_IBlocksOperations_HXX_ @@ -40,68 +41,76 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { // Creation of blocks and block faces Standard_EXPORT Handle(GEOM_Object) MakeQuad (Handle(GEOM_Object) theEdge1, - Handle(GEOM_Object) theEdge2, - Handle(GEOM_Object) theEdge3, - Handle(GEOM_Object) theEdge4); + Handle(GEOM_Object) theEdge2, + Handle(GEOM_Object) theEdge3, + Handle(GEOM_Object) theEdge4); Standard_EXPORT Handle(GEOM_Object) MakeQuad2Edges (Handle(GEOM_Object) theEdge1, - Handle(GEOM_Object) theEdge2); + Handle(GEOM_Object) theEdge2); Standard_EXPORT Handle(GEOM_Object) MakeQuad4Vertices (Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2, - Handle(GEOM_Object) thePoint3, - Handle(GEOM_Object) thePoint4); + Handle(GEOM_Object) thePoint2, + Handle(GEOM_Object) thePoint3, + Handle(GEOM_Object) thePoint4); Standard_EXPORT Handle(GEOM_Object) MakeHexa (Handle(GEOM_Object) theFace1, - Handle(GEOM_Object) theFace2, - Handle(GEOM_Object) theFace3, - Handle(GEOM_Object) theFace4, - Handle(GEOM_Object) theFace5, - Handle(GEOM_Object) theFace6); + Handle(GEOM_Object) theFace2, + Handle(GEOM_Object) theFace3, + Handle(GEOM_Object) theFace4, + Handle(GEOM_Object) theFace5, + Handle(GEOM_Object) theFace6); Standard_EXPORT Handle(GEOM_Object) MakeHexa2Faces (Handle(GEOM_Object) theFace1, - Handle(GEOM_Object) theFace2); + Handle(GEOM_Object) theFace2); Standard_EXPORT Handle(GEOM_Object) MakeBlockCompound (Handle(GEOM_Object) theCompound); // Extract elements of blocks and blocks compounds Standard_EXPORT Handle(GEOM_Object) GetPoint (Handle(GEOM_Object) theShape, - const Standard_Real theX, - const Standard_Real theY, - const Standard_Real theZ, - const Standard_Real theEpsilon); + const Standard_Real theX, + const Standard_Real theY, + const Standard_Real theZ, + const Standard_Real theEpsilon); + + Standard_EXPORT Handle(GEOM_Object) GetVertexNearPoint (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetEdge (Handle(GEOM_Object) theShape, - Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2); + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); Standard_EXPORT Handle(GEOM_Object) GetEdgeNearPoint (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) thePoint); + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetFaceByPoints (Handle(GEOM_Object) theShape, - Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2, - Handle(GEOM_Object) thePoint3, - Handle(GEOM_Object) thePoint4); + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2, + Handle(GEOM_Object) thePoint3, + Handle(GEOM_Object) thePoint4); Standard_EXPORT Handle(GEOM_Object) GetFaceByEdges (Handle(GEOM_Object) theShape, - Handle(GEOM_Object) theEdge1, - Handle(GEOM_Object) theEdge2); + Handle(GEOM_Object) theEdge1, + Handle(GEOM_Object) theEdge2); Standard_EXPORT Handle(GEOM_Object) GetOppositeFace (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) theFace); + Handle(GEOM_Object) theFace); Standard_EXPORT Handle(GEOM_Object) GetFaceNearPoint (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) thePoint); + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetFaceByNormale (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) theVector); + Handle(GEOM_Object) theVector); + + Standard_EXPORT Handle(GEOM_Object) GetShapesNearPoint (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint, + const Standard_Integer theShapeType, + const Standard_Real theTolerance); // Check blocks compounds Standard_EXPORT Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object) theCompound, - const Standard_Integer theMinNbFaces, - const Standard_Integer theMaxNbFaces, - Standard_Integer& theNbBlocks); + const Standard_Integer theMinNbFaces, + const Standard_Integer theMaxNbFaces, + Standard_Integer& theNbBlocks); enum BCErrorType { NOT_BLOCK, @@ -117,22 +126,23 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { }; Standard_EXPORT Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound, - std::list& theErrors); + std::list& theErrors); Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound, - std::list& theErrors); + std::list& theErrors); Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound, - const std::list& theErrors); + const std::list& theErrors); - Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape); + Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape, + const Standard_Integer theOptimumNbFaces = 6); Standard_EXPORT Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound); Standard_EXPORT static void AddBlocksFrom (const TopoDS_Shape& theShape, - TopTools_ListOfShape& BLO, - TopTools_ListOfShape& NOT, - TopTools_ListOfShape& EXT); + TopTools_ListOfShape& BLO, + TopTools_ListOfShape& NOT, + TopTools_ListOfShape& EXT); // Extract blocks from blocks compounds Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks @@ -141,7 +151,7 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { const Standard_Integer theMaxNbFaces); Standard_EXPORT Handle(GEOM_Object) GetBlockNearPoint (Handle(GEOM_Object) theCompound, - Handle(GEOM_Object) thePoint); + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetBlockByParts (Handle(GEOM_Object) theCompound, @@ -153,17 +163,17 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { // Operations on blocks with gluing of result Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation1D (Handle(GEOM_Object) theBlock, - const Standard_Integer theDirFace1, - const Standard_Integer theDirFace2, - const Standard_Integer theNbTimes); + const Standard_Integer theDirFace1, + const Standard_Integer theDirFace2, + const Standard_Integer theNbTimes); Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation2D (Handle(GEOM_Object) theBlock, - const Standard_Integer theDirFace1U, - const Standard_Integer theDirFace2U, - const Standard_Integer theNbTimesU, - const Standard_Integer theDirFace1V, - const Standard_Integer theDirFace2V, - const Standard_Integer theNbTimesV); + const Standard_Integer theDirFace1U, + const Standard_Integer theDirFace2U, + const Standard_Integer theNbTimesU, + const Standard_Integer theDirFace1V, + const Standard_Integer theDirFace2V, + const Standard_Integer theNbTimesV); // Build groups for Propagation of 1D hypotheses Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Propagate (Handle(GEOM_Object) theShape); diff --git a/src/GEOMImpl/GEOMImpl_IBoolean.hxx b/src/GEOMImpl/GEOMImpl_IBoolean.hxx index 871b58caa..39696d85c 100644 --- a/src/GEOMImpl/GEOMImpl_IBoolean.hxx +++ b/src/GEOMImpl/GEOMImpl_IBoolean.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Common, Cut and Fuse creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx index bae1dd0c6..3be15dbeb 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -34,6 +35,8 @@ #include #include +#include + #include #include "utilities.h" @@ -108,7 +111,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object //Compute the Boolean value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -149,7 +152,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition const Standard_Integer theLimit, const Standard_Boolean theRemoveWebs, const Handle(TColStd_HArray1OfInteger)& theMaterials, - const Standard_Integer theKeepNonlimitShapes, + const Standard_Integer theKeepNonlimitShapes, const Standard_Boolean thePerformSelfIntersections) { SetErrorCode(KO); @@ -269,7 +272,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition //Compute the Partition try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -346,7 +349,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition //Compute the Partition value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx index 7e99fa82f..75a094544 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_IBooleanOperations_HXX_ #define _GEOMImpl_IBooleanOperations_HXX_ @@ -47,8 +48,8 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations { const Standard_Integer theLimit, const Standard_Boolean theRemoveWebs, const Handle(TColStd_HArray1OfInteger)& theMaterials, - const Standard_Integer theKeepNonlimitShapes, - const Standard_Boolean thePerformSelfIntersections); + const Standard_Integer theKeepNonlimitShapes, + const Standard_Boolean thePerformSelfIntersections); Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape, Handle(GEOM_Object) thePlane); diff --git a/src/GEOMImpl/GEOMImpl_IBox.hxx b/src/GEOMImpl/GEOMImpl_IBox.hxx index 81445ab6e..006900598 100644 --- a/src/GEOMImpl/GEOMImpl_IBox.hxx +++ b/src/GEOMImpl/GEOMImpl_IBox.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Box creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IChamfer.hxx b/src/GEOMImpl/GEOMImpl_IChamfer.hxx index 32f43fa17..a06d14f48 100644 --- a/src/GEOMImpl/GEOMImpl_IChamfer.hxx +++ b/src/GEOMImpl/GEOMImpl_IChamfer.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an interface to a function for the Chamfer and creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ICircle.hxx b/src/GEOMImpl/GEOMImpl_ICircle.hxx index e5d466a8a..12f1b5c2b 100644 --- a/src/GEOMImpl/GEOMImpl_ICircle.hxx +++ b/src/GEOMImpl/GEOMImpl_ICircle.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Circle creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ICone.hxx b/src/GEOMImpl/GEOMImpl_ICone.hxx index f927a59c7..351e18f45 100644 --- a/src/GEOMImpl/GEOMImpl_ICone.hxx +++ b/src/GEOMImpl/GEOMImpl_ICone.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Cone creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ICopy.hxx b/src/GEOMImpl/GEOMImpl_ICopy.hxx index a9c4ad251..8d7b218cb 100644 --- a/src/GEOMImpl/GEOMImpl_ICopy.hxx +++ b/src/GEOMImpl/GEOMImpl_ICopy.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Copy operation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index 6a6b8f9ef..ca1ac5db0 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -1,35 +1,47 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +#ifdef WNT +// E.A. : On windows with python 2.6, there is a conflict +// E.A. : between pymath.h and Standard_math.h which define +// E.A. : some same symbols : acosh, asinh, ... +#include +#include +#endif + +#include +#include + +#ifdef HAVE_FINITE +#undef HAVE_FINITE +#endif #include #include - -#include +#include #include #include -#include - #include #include #include @@ -46,13 +58,121 @@ #include #include +#include + #include "utilities.h" #include +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +/* ================================== + * =========== PYTHON ============== + * ==================================*/ + +typedef struct { + PyObject_HEAD + int softspace; + std::string *out; + } PyStdOut; + +static void +PyStdOut_dealloc(PyStdOut *self) +{ + PyObject_Del(self); +} + +static PyObject * +PyStdOut_write(PyStdOut *self, PyObject *args) +{ + char *c; + int l; + if (!PyArg_ParseTuple(args, "t#:write",&c, &l)) + return NULL; + + //std::cerr << c ; + *(self->out)=*(self->out)+c; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef PyStdOut_methods[] = { + {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, + PyDoc_STR("write(string) -> None")}, + {NULL, NULL} /* sentinel */ +}; + +static PyMemberDef PyStdOut_memberlist[] = { + {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0, + (char*)"flag indicating that a space needs to be printed; used by print"}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject PyStdOut_Type = { + /* The ob_type field must be initialized in the module init function + * to be portable to Windows without using C++. */ + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "PyOut", /*tp_name*/ + sizeof(PyStdOut), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)PyStdOut_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + /* softspace is writable: we must supply tp_setattro */ + PyObject_GenericSetAttr, /* tp_setattro */ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + PyStdOut_methods, /*tp_methods*/ + PyStdOut_memberlist, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +PyObject * newPyStdOut( std::string& out ) +{ + PyStdOut *self; + self = PyObject_New(PyStdOut, &PyStdOut_Type); + if (self == NULL) + return NULL; + self->softspace = 0; + self->out=&out; + return (PyObject*)self; +} + + +////////////////////////END PYTHON/////////////////////////// //============================================================================= /*! * constructor: @@ -75,73 +195,6 @@ GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations() } -//============================================================================= -/*! - * MakePolyline - */ -//============================================================================= -Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (list thePoints) -{ - SetErrorCode(KO); - - //Add a new Polyline object - Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE); - - //Add a new Polyline function for creation a polyline relatively to points set - Handle(GEOM_Function) aFunction = - aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS); - if (aFunction.IsNull()) return NULL; - - //Check if the function is set correctly - if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL; - - GEOMImpl_IPolyline aCI (aFunction); - - int aLen = thePoints.size(); - aCI.SetLength(aLen); - - int ind = 1; - list::iterator it = thePoints.begin(); - for (; it != thePoints.end(); it++, ind++) { - Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); - if (aRefPnt.IsNull()) { - SetErrorCode("NULL point for Polyline"); - return NULL; - } - aCI.SetPoint(ind, aRefPnt); - } - - //Compute the Polyline value - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if (!GetSolver()->ComputeFunction(aFunction)) { - SetErrorCode("Polyline driver failed"); - return NULL; - } - } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); - return NULL; - } - - //Make a Python command - GEOM::TPythonDump pd (aFunction); - pd << aPolyline << " = geompy.MakePolyline(["; - - it = thePoints.begin(); - pd << (*it++); - while (it != thePoints.end()) { - pd << ", " << (*it++); - } - pd << "])"; - - SetErrorCode(OK); - return aPolyline; -} - //============================================================================= /*! * MakeCircleThreePnt @@ -180,7 +233,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_ //Compute the Circle value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -240,7 +293,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEO //Compute the Circle value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -305,7 +358,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR //Compute the Circle value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -334,12 +387,14 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR //============================================================================= Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, - double theRMajor, double theRMinor) + double theRMajor, double theRMinor, + Handle(GEOM_Object) theVecMaj) { SetErrorCode(KO); // Not set thePnt means origin of global CS, // Not set theVec means Z axis of global CS + // Not set theVecMaj means X axis of global CS //if (thePnt.IsNull() || theVec.IsNull()) return NULL; //Add a new Ellipse object @@ -370,9 +425,15 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse aCI.SetRMajor(theRMajor); aCI.SetRMinor(theRMinor); + if (!theVecMaj.IsNull()) { + Handle(GEOM_Function) aRefVecMaj = theVecMaj->GetLastFunction(); + if (aRefVecMaj.IsNull()) return NULL; + aCI.SetVectorMajor(aRefVecMaj); + } + //Compute the Ellipse value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -387,8 +448,15 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse } //Make a Python command - GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" - << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; + if (!theVecMaj.IsNull()) { + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" + << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor + << ", " << theVecMaj << ")"; + } + else { + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" + << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; + } SetErrorCode(OK); return anEll; @@ -412,10 +480,10 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) the //Add a new Circle Arc function Handle(GEOM_Function) aFunction = - anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT); + anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT); if (aFunction.IsNull()) return NULL; - + //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL; GEOMImpl_IArc aCI (aFunction); @@ -423,17 +491,16 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) the Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction(); Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction(); Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction(); - if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL; aCI.SetPoint1(aRefPnt1); aCI.SetPoint2(aRefPnt2); aCI.SetPoint3(aRefPnt3); - + //Compute the Arc value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -494,7 +561,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Objec //Compute the Arc value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -521,8 +588,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Objec */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2, - Handle(GEOM_Object) thePnt3) + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3) { SetErrorCode(KO); @@ -536,7 +603,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Ob anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), ELLIPSE_ARC_CENTER_TWO_PNT); if (aFunction.IsNull()) return NULL; - + //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL; GEOMImpl_IArc aCI (aFunction); @@ -544,17 +611,16 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Ob Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction(); Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction(); Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction(); - if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL; aCI.SetPoint1(aRefPnt1); aCI.SetPoint2(aRefPnt2); aCI.SetPoint3(aRefPnt3); - + //Compute the Arc value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -576,13 +642,85 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Ob return anArc; } +//============================================================================= +/*! + * MakePolyline + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (std::list thePoints, + bool theIsClosed) +{ + SetErrorCode(KO); + + //Add a new Polyline object + Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE); + + //Add a new Polyline function for creation a polyline relatively to points set + Handle(GEOM_Function) aFunction = + aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL; + + GEOMImpl_IPolyline aCI (aFunction); + + int aLen = thePoints.size(); + aCI.SetLength(aLen); + aCI.SetConstructorType(POINT_CONSTRUCTOR); + + int ind = 1; + std::list::iterator it = thePoints.begin(); + for (; it != thePoints.end(); it++, ind++) { + Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); + if (aRefPnt.IsNull()) { + SetErrorCode("NULL point for Polyline"); + return NULL; + } + aCI.SetPoint(ind, aRefPnt); + } + + aCI.SetIsClosed(theIsClosed); + + //Compute the Polyline value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Polyline driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aPolyline << " = geompy.MakePolyline(["; + + it = thePoints.begin(); + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); + } + pd << "], " << theIsClosed << ")"; + + SetErrorCode(OK); + return aPolyline; +} + //============================================================================= /*! * MakeSplineBezier */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier - (list thePoints) + (std::list thePoints, + bool theIsClosed) { SetErrorCode(KO); @@ -601,9 +739,10 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier int aLen = thePoints.size(); aCI.SetLength(aLen); + aCI.SetConstructorType(POINT_CONSTRUCTOR); int ind = 1; - list::iterator it = thePoints.begin(); + std::list::iterator it = thePoints.begin(); for (; it != thePoints.end(); it++, ind++) { Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); @@ -612,9 +751,11 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier aCI.SetPoint(ind, aRefPnt); } + aCI.SetIsClosed(theIsClosed); + //Compute the Spline value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -637,7 +778,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier while (it != thePoints.end()) { pd << ", " << (*it++); } - pd << "])"; + pd << "], " << theIsClosed << ")"; SetErrorCode(OK); return aSpline; @@ -649,7 +790,9 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation - (list thePoints) + (std::list thePoints, + bool theIsClosed, + bool theDoReordering) { SetErrorCode(KO); @@ -667,10 +810,11 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation GEOMImpl_ISpline aCI (aFunction); int aLen = thePoints.size(); + aCI.SetConstructorType(POINT_CONSTRUCTOR); aCI.SetLength(aLen); int ind = 1; - list::iterator it = thePoints.begin(); + std::list::iterator it = thePoints.begin(); for (; it != thePoints.end(); it++, ind++) { Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); @@ -679,9 +823,12 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation aCI.SetPoint(ind, aRefPnt); } + aCI.SetIsClosed(theIsClosed); + aCI.SetDoReordering(theDoReordering); + //Compute the Spline value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -704,19 +851,264 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation while (it != thePoints.end()) { pd << ", " << (*it++); } - pd << "])"; + pd << "], " << theIsClosed << ", " << theDoReordering << ")"; SetErrorCode(OK); return aSpline; } +//============================================================================= +/*! + * MakeCurveParametric + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric + (const char* thexExpr, const char* theyExpr, const char* thezExpr, + double theParamMin, double theParamMax, double theParamStep, + CurveType theCurveType, + int theParamNbStep, bool theNewMethod) +{ + TCollection_AsciiString aPyScript; + aPyScript +="from math import * \n"; + aPyScript +="def X(t): \n"; + aPyScript +=" return "; + aPyScript += thexExpr; + aPyScript += "\n"; + aPyScript +="def Y(t): \n"; + aPyScript +=" return "; + aPyScript += theyExpr; + aPyScript += "\n"; + + aPyScript +="def Z(t): \n"; + aPyScript +=" return "; + aPyScript += thezExpr; + aPyScript += "\n"; + + if (theNewMethod) + { + aPyScript +="def coordCalculator(tmin, tmax, nstep): \n"; + aPyScript +=" coords = [] \n"; + aPyScript +=" tstep = (tmax - tmin) / nstep \n"; + aPyScript +=" n = 0 \n"; + aPyScript +=" while n <= nstep : \n"; + aPyScript +=" t = tmin + n*tstep \n"; + aPyScript +=" coords.append([X(t), Y(t), Z(t)]) \n"; + aPyScript +=" n = n+1 \n"; + aPyScript +=" return coords \n"; + } + else + { + aPyScript +="def coordCalculator(tmin, tmax, tstep): \n"; + aPyScript +=" coords = [] \n"; + aPyScript +=" while tmin <= tmax : \n"; + aPyScript +=" coords.append([X(tmin), Y(tmin), Z(tmin)]) \n"; + aPyScript +=" tmin = tmin + tstep \n"; + aPyScript +=" return coords \n"; + } + + SetErrorCode(KO); + + if(theParamMin >= theParamMax) { + SetErrorCode("The minimum value of the parameter must be less than maximum value !!!"); + return NULL; + } + + if(!theNewMethod && theParamStep <= 0.0) { + SetErrorCode("Value of the step must be positive !!!"); + return NULL; + } + else if(theNewMethod && theParamNbStep < 0) { + SetErrorCode("The number of steps must be positive !!!"); + return NULL; + } + + /* Initialize the Python interpreter */ + if (! Py_IsInitialized()) { + SetErrorCode("Python interpreter is not initialized !!! "); + return NULL; + } + + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + + PyObject* main_mod = PyImport_AddModule("__main__"); + PyObject* main_dict = PyModule_GetDict(main_mod); + + PyObject* obj = PyRun_String(aPyScript.ToCString(), Py_file_input, main_dict, NULL); + + if (obj == NULL) { + SetErrorCode("Error during executing of python script !!!"); + PyErr_Print(); + PyGILState_Release(gstate); + return NULL; + } else { + Py_DECREF(obj); + } + + PyObject * func = NULL; + func = PyObject_GetAttrString(main_mod, "coordCalculator"); + + if (func == NULL){ + SetErrorCode("Can't get function from python module !!!"); + PyGILState_Release(gstate); + return NULL; + } + + PyObject* coords; + if (theNewMethod) + coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theParamMin, theParamMax, theParamNbStep ); + else + coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep ); + + PyObject* new_stderr = NULL; + + if (coords == NULL){ + fflush(stderr); + std::string err_description=""; + new_stderr = newPyStdOut(err_description); + PySys_SetObject((char*)"stderr", new_stderr); + PyErr_Print(); + PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__")); + Py_DECREF(new_stderr); + MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description); + SetErrorCode("Can't evaluate the expressions, please check them !!!"); + PyGILState_Release(gstate); + return NULL; + } + + Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, PyList_Size( coords ) * 3); + + if(PyList_Size( coords ) <= 0) { + SetErrorCode("Empty list of the points, please check input parameters !!!"); + return NULL; + } + + int k=1; + for ( Py_ssize_t i = 0; i< PyList_Size( coords ); ++i ) { + PyObject* coord = PyList_GetItem( coords, i ); + if (coord != NULL) { + for ( Py_ssize_t j = 0; j < PyList_Size(coord); ++j) { + PyObject* item = PyList_GetItem(coord, j); + aCoordsArray->SetValue(k, PyFloat_AsDouble(item)); + k++; + } + } + } + + Py_DECREF(coords); + + PyGILState_Release(gstate); + + Handle(GEOM_Object) aCurve; + Handle(GEOM_Function) aFunction; + TCollection_AsciiString aCurveType; + + switch(theCurveType) { + case Polyline: { + //Add a new Polyline object + aCurve = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE); + + //Add a new Polyline function for creation a polyline relatively to points set + aFunction = aCurve->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL; + + GEOMImpl_IPolyline aCI (aFunction); + + aCI.SetLength(PyList_Size( coords )); + aCI.SetConstructorType(COORD_CONSTRUCTOR); + aCI.SetIsClosed(false); + aCI.SetCoordinates(aCoordsArray); + aCurveType = "geompy.GEOM.Polyline"; + break; + } + case Bezier: { + //Add a new Spline object + aCurve = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE); + //Add a new Spline function for creation a bezier curve relatively to points set + aFunction = + aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL; + + GEOMImpl_ISpline aCI (aFunction); + + aCI.SetLength(PyList_Size( coords )); + aCI.SetConstructorType(COORD_CONSTRUCTOR); + aCI.SetIsClosed(false); + aCI.SetCoordinates(aCoordsArray); + aCurveType = "geompy.GEOM.Bezier"; + break; + } + case Interpolation: { + //Add a new Spline object + aCurve = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE); + + //Add a new Spline function for creation a bezier curve relatively to points set + aFunction = aCurve->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL; + + GEOMImpl_ISpline aCI (aFunction); + aCI.SetConstructorType(COORD_CONSTRUCTOR); + aCI.SetLength(PyList_Size( coords )); + aCI.SetIsClosed(false); + aCI.SetDoReordering(false); + aCI.SetCoordinates(aCoordsArray); + aCurveType = "geompy.GEOM.Interpolation"; + break; + } + } + + //Compute the Curve value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Curve driver failed !!!"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aCurve << " = geompy.MakeCurveParametric("; + pd << "\"" << thexExpr << "\", "; + pd << "\"" << theyExpr << "\", "; + pd << "\"" << thezExpr << "\", "; + + pd << theParamMin <<", "; + pd << theParamMax <<", "; + if (theNewMethod) + pd << theParamNbStep <<", "; + else + pd << theParamStep <<", "; + pd << aCurveType.ToCString() <<", "; + pd << theNewMethod <<")"; + + SetErrorCode(OK); + return aCurve; +} + //============================================================================= /*! * MakeSketcher */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand, - list theWorkingPlane) + std::list theWorkingPlane) { SetErrorCode(KO); @@ -739,13 +1131,13 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom aCI.SetCommand(aCommand); int ind = 1; - list::iterator it = theWorkingPlane.begin(); + std::list::iterator it = theWorkingPlane.begin(); for (; it != theWorkingPlane.end(); it++, ind++) aCI.SetWorkingPlane(ind, *it); //Compute the Sketcher value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -779,7 +1171,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom * Make3DSketcher */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (list theCoordinates) +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list theCoordinates) { SetErrorCode(KO); @@ -797,7 +1189,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (list the GEOMImpl_I3DSketcher aCI (aFunction); int nbOfCoords = 0; - list::iterator it = theCoordinates.begin(); + std::list::iterator it = theCoordinates.begin(); for (; it != theCoordinates.end(); it++) nbOfCoords++; @@ -809,10 +1201,10 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (list the aCoordsArray->SetValue(ind, *it); aCI.SetCoordinates(aCoordsArray); - + //Compute the Sketcher value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -876,7 +1268,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane //Compute the Sketcher value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx index 7380a0977..2e71bbd38 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -1,25 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -using namespace std; #ifndef _GEOMImpl_ICurvesOperations_HXX_ #define _GEOMImpl_ICurvesOperations_HXX_ @@ -34,12 +33,14 @@ class GEOM_Engine; class Handle(GEOM_Object); class GEOMImpl_ICurvesOperations : public GEOM_IOperations { + public: + + enum CurveType { Polyline, Bezier, Interpolation }; + Standard_EXPORT GEOMImpl_ICurvesOperations(GEOM_Engine* theEngine, int theDocID); Standard_EXPORT ~GEOMImpl_ICurvesOperations(); - Standard_EXPORT Handle(GEOM_Object) MakePolyline (list thePoints); - Standard_EXPORT Handle(GEOM_Object) MakeCircleThreePnt (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, Handle(GEOM_Object) thePnt3); @@ -51,7 +52,8 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeEllipse (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, - double theRMajor, double theRMinor); + double theRMajor, double theRMinor, + Handle(GEOM_Object) theVecMaj); Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, @@ -63,15 +65,27 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { bool theSense); Standard_EXPORT Handle(GEOM_Object) MakeArcOfEllipse (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2, - Handle(GEOM_Object) thePnt3); + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); + + Standard_EXPORT Handle(GEOM_Object) MakePolyline (std::list thePoints, + bool theIsClosed = false); + + Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (std::list thePoints, + bool theIsClosed = false); + + Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (std::list thePoints, + bool theIsClosed = false, + bool theDoReordering = false); - Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list thePoints); - Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list thePoints); + Standard_EXPORT Handle(GEOM_Object) MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr, + double theParamMin, double theParamMax, double theParamStep, + CurveType theCurveType, + int theParamNbStep=0, bool theNewMethod=false); Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand, - list theWorkingPlane); - Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (list theCoordinates); + std::list theWorkingPlane); + Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list theCoordinates); Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand, Handle(GEOM_Object) theWorkingPlane); }; diff --git a/src/GEOMImpl/GEOMImpl_ICylinder.hxx b/src/GEOMImpl/GEOMImpl_ICylinder.hxx index 735668007..236eabdc9 100644 --- a/src/GEOMImpl/GEOMImpl_ICylinder.hxx +++ b/src/GEOMImpl/GEOMImpl_ICylinder.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Cylinder creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IDisk.hxx b/src/GEOMImpl/GEOMImpl_IDisk.hxx index 3102ea484..94d4ad96c 100755 --- a/src/GEOMImpl/GEOMImpl_IDisk.hxx +++ b/src/GEOMImpl/GEOMImpl_IDisk.hxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Disk creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx new file mode 100644 index 000000000..8a934bff5 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx @@ -0,0 +1,63 @@ +// Copyright (C) 2007-2008 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 _GEOMImpl_IDividedDisk_HXX_ +#define _GEOMImpl_IDividedDisk_HXX_ + +#include "GEOM_Function.hxx" + +#define DIVIDEDDISK_ARG_R 1 +#define DIVIDEDDISK_ARG_RATIO 2 +#define DIVIDEDDISK_ARG_ORIENT 3 + +#define DIVIDEDDISK_ARG_CENTER 4 +#define DIVIDEDDISK_ARG_VECTOR 5 + +#define DIVIDEDDISK_ARG_TYPE 6 + +class GEOMImpl_IDividedDisk +{ +public: + GEOMImpl_IDividedDisk(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetR(double theR) { _func->SetReal(DIVIDEDDISK_ARG_R, theR); } + double GetR() { return _func->GetReal(DIVIDEDDISK_ARG_R); } + + void SetRatio(double theRatio) { _func->SetReal(DIVIDEDDISK_ARG_RATIO, theRatio); } + double GetRatio() { return _func->GetReal(DIVIDEDDISK_ARG_RATIO); } + + void SetOrientation(int theOrientation) { _func->SetInteger(DIVIDEDDISK_ARG_ORIENT, theOrientation); } + int GetOrientation() { return _func->GetInteger(DIVIDEDDISK_ARG_ORIENT); } + + void SetType(int theType) { _func->SetInteger(DIVIDEDDISK_ARG_TYPE, theType); } + int GetType() { return _func->GetInteger(DIVIDEDDISK_ARG_TYPE); } + + void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(DIVIDEDDISK_ARG_CENTER, theP); } + void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(DIVIDEDDISK_ARG_VECTOR, theV); } + + Handle(GEOM_Function) GetCenter() { return _func->GetReference(DIVIDEDDISK_ARG_CENTER); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(DIVIDEDDISK_ARG_VECTOR); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // _GEOMImpl_IDividedDisk_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IEllipse.hxx b/src/GEOMImpl/GEOMImpl_IEllipse.hxx index 8a199e760..a77b7b8e4 100644 --- a/src/GEOMImpl/GEOMImpl_IEllipse.hxx +++ b/src/GEOMImpl/GEOMImpl_IEllipse.hxx @@ -1,32 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Ellipse creation. // #include "GEOM_Function.hxx" -#define ELLIPS_ARG_CC 1 -#define ELLIPS_ARG_VV 2 -#define ELLIPS_ARG_RMAJ 3 -#define ELLIPS_ARG_RMIN 4 +#define ELLIPS_ARG_CC 1 +#define ELLIPS_ARG_VV 2 +#define ELLIPS_ARG_RMAJ 3 +#define ELLIPS_ARG_RMIN 4 +#define ELLIPS_ARG_VVMAJ 5 class GEOMImpl_IEllipse { @@ -40,12 +42,16 @@ class GEOMImpl_IEllipse void SetRMajor(double theR) { _func->SetReal(ELLIPS_ARG_RMAJ, theR); } void SetRMinor(double theR) { _func->SetReal(ELLIPS_ARG_RMIN, theR); } + void SetVectorMajor(Handle(GEOM_Function) theV) { _func->SetReference(ELLIPS_ARG_VVMAJ, theV); } + Handle(GEOM_Function) GetCenter() { return _func->GetReference(ELLIPS_ARG_CC); } Handle(GEOM_Function) GetVector() { return _func->GetReference(ELLIPS_ARG_VV); } double GetRMajor() { return _func->GetReal(ELLIPS_ARG_RMAJ); } double GetRMinor() { return _func->GetReal(ELLIPS_ARG_RMIN); } + Handle(GEOM_Function) GetVectorMajor() { return _func->GetReference(ELLIPS_ARG_VVMAJ); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IFace.hxx b/src/GEOMImpl/GEOMImpl_IFace.hxx index 6782c0891..11e9e5d7f 100755 --- a/src/GEOMImpl/GEOMImpl_IFace.hxx +++ b/src/GEOMImpl/GEOMImpl_IFace.hxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Face creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IFillet.hxx b/src/GEOMImpl/GEOMImpl_IFillet.hxx index 975670a8c..8bcea7c67 100644 --- a/src/GEOMImpl/GEOMImpl_IFillet.hxx +++ b/src/GEOMImpl/GEOMImpl_IFillet.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an interface to a function for the Fillet and creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IFillet1d.hxx b/src/GEOMImpl/GEOMImpl_IFillet1d.hxx new file mode 100644 index 000000000..eb3ef0ee6 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IFillet1d.hxx @@ -0,0 +1,52 @@ +// Copyright (C) 2007-2012 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 + +//NOTE: This is an interface to a function for the Fillet1d and creation. + +#include "GEOM_Function.hxx" + +#define FILLET1D_ARG_SH 1 +#define FILLET1D_ARG_R 2 +#define FILLET1D_ARG_BOOL 3 +#define FILLET1D_ARG_LENG 4 +#define FILLET1D_ARG_LAST 5 + +class GEOMImpl_IFillet1d +{ + public: + + GEOMImpl_IFillet1d(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShape(Handle(GEOM_Function) theRef) { _func->SetReference(FILLET1D_ARG_SH, theRef); } + Handle(GEOM_Function) GetShape() { return _func->GetReference(FILLET1D_ARG_SH); } + + void SetR(double theR) { _func->SetReal(FILLET1D_ARG_R, theR); } + void SetFlag(const Standard_Boolean theFlag) { _func->SetInteger(FILLET1D_ARG_BOOL, theFlag ? 1 : 0); } + void SetLength(int theLen) { _func->SetInteger(FILLET1D_ARG_LENG, theLen); } + void SetVertex(int theInd, int theVertex) + { _func->SetInteger(FILLET1D_ARG_LAST + theInd, theVertex); } + + double GetR() { return _func->GetReal(FILLET1D_ARG_R); } + Standard_Boolean GetFlag() { return (_func->GetInteger(FILLET1D_ARG_BOOL) == 1); } + int GetLength() { return _func->GetInteger(FILLET1D_ARG_LENG); } + int GetVertex(int theInd) { return _func->GetInteger(FILLET1D_ARG_LAST + theInd); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IFillet2d.hxx b/src/GEOMImpl/GEOMImpl_IFillet2d.hxx index ba67a6a18..5f68d9425 100755 --- a/src/GEOMImpl/GEOMImpl_IFillet2d.hxx +++ b/src/GEOMImpl/GEOMImpl_IFillet2d.hxx @@ -1,25 +1,24 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2007-2012 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 +// 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 +// +// 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 +// 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 // -//NOTE: This is an interface to a function for the Fillet2d and creation. - +//NOTE: This is an interface to a function for the Fillet2d and creation. +// #include "GEOM_Function.hxx" #define FILLET2D_ARG_SH 1 diff --git a/src/GEOMImpl/GEOMImpl_IFilling.hxx b/src/GEOMImpl/GEOMImpl_IFilling.hxx index 491555e48..b08de436e 100644 --- a/src/GEOMImpl/GEOMImpl_IFilling.hxx +++ b/src/GEOMImpl/GEOMImpl_IFilling.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Filling operation. // #include "GEOM_Function.hxx" @@ -30,6 +31,7 @@ #define FILL_ARG_SHAPE 5 #define FILL_ARG_NBITER 6 #define FILL_ARG_APPROX 7 +#define FILL_ARG_METHOD 8 class GEOMImpl_IFilling { @@ -52,6 +54,9 @@ class GEOMImpl_IFilling void SetApprox(bool theApprox) { _func->SetInteger(FILL_ARG_APPROX, theApprox); } bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); } + void SetMethod(int theMethod) { _func->SetInteger(FILL_ARG_METHOD, theMethod); } + int GetMethod() { return _func->GetInteger(FILL_ARG_METHOD); } + void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); } Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); } diff --git a/src/GEOMImpl/GEOMImpl_IGlue.hxx b/src/GEOMImpl/GEOMImpl_IGlue.hxx index 1ee1515d0..ef53547e0 100644 --- a/src/GEOMImpl/GEOMImpl_IGlue.hxx +++ b/src/GEOMImpl/GEOMImpl_IGlue.hxx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // NOTE: This is an interface to a function for the Glueing of faces -// + #include "GEOM_Function.hxx" #include @@ -29,6 +30,7 @@ #define GLUE_ARG_TOLER 2 #define GLUE_ARG_FACES 3 #define GLUE_ARG_KEEPALL 4 +#define GLUE_ARG_GLUEEDG 5 class GEOMImpl_IGlue { @@ -55,6 +57,9 @@ class GEOMImpl_IGlue void SetKeepNonSolids (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_KEEPALL, theFlag ? 1 : 0); } Standard_Boolean GetKeepNonSolids() { return (_func->GetInteger(GLUE_ARG_KEEPALL) != 0); } + void SetGlueAllEdges (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_GLUEEDG, theFlag ? 1 : 0); } + Standard_Boolean GetGlueAllEdges() { return (_func->GetInteger(GLUE_ARG_GLUEEDG) != 0); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx index 1c0a5c1e6..db55c72b6 100644 --- a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -89,7 +90,7 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup //Set a GROUP type aGroup->SetType(GEOM_GROUP); - //Set a sub shape type + //Set a sub-shape type TDF_Label aFreeLabel = aGroup->GetFreeLabel(); TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)theShapeType); @@ -113,7 +114,7 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS SetErrorCode(KO); if(theGroup.IsNull()) return; - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if(aFunction.IsNull()) return; GEOM_ISubShape aSSI (aFunction); @@ -146,12 +147,20 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS for(Standard_Integer i = 1; i<=aLength; i++) { aNewSeq->SetValue(i, aSeq->Value(i)); if(aSeq->Value(i) == theSubShapeID) { - SetErrorCode(ALREADY_PRESENT); - return; // + SetErrorCode(ALREADY_PRESENT); + return; // } } aNewSeq->SetValue(aLength+1, theSubShapeID); - aSSI.SetIndices(aNewSeq); + if ( aFunction->IsLastFuntion() ) { + aSSI.SetIndices(aNewSeq); + } + else { + aFunction = theGroup->AddFunction( GEOM_Object::GetSubShapeID(), 0, true ); + GEOM_ISubShape aSSI2 (aFunction); + aSSI2.SetIndices(aNewSeq); + aSSI2.SetMainShape( aSSI.GetMainShape() ); + } } // As we do not recompute here our group, lets mark it as Modified @@ -176,7 +185,7 @@ void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int SetErrorCode(KO); if(theGroup.IsNull()) return; - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if(aFunction.IsNull()) return; GEOM_ISubShape aSSI(aFunction); @@ -218,7 +227,15 @@ void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int } } - aSSI.SetIndices(aNewSeq); + if ( aFunction->IsLastFuntion() ) { + aSSI.SetIndices(aNewSeq); + } + else { + aFunction = theGroup->AddFunction( GEOM_Object::GetSubShapeID(), 0, true ); + GEOM_ISubShape aSSI2 (aFunction); + aSSI2.SetIndices(aNewSeq); + aSSI2.SetMainShape( aSSI.GetMainShape() ); + } // As we do not recompute here our group, lets mark it as Modified TDF_Label aLabel = aSSI.GetMainShape()->GetOwnerEntry(); @@ -249,11 +266,12 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup, Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { - SetErrorCode("The list is empty"); + //SetErrorCode("The list is empty"); + SetErrorCode(OK); return; } - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if (aFunction.IsNull()) return; GEOM_ISubShape aSSI (aFunction); @@ -296,6 +314,7 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup, Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i)); TopoDS_Shape aShape_i = anObj_i->GetValue(); + if ( aShape_i.IsNull() ) continue; TopAbs_ShapeEnum aType_i = aShape_i.ShapeType(); // 1. If aShape_i is sub-shape of aMainShape - add it @@ -358,20 +377,22 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup, for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) { aNewSeq->SetValue(k, aNewIDsIter.Value()); } - - aSSI.SetIndices(aNewSeq); - + if ( aFunction->IsLastFuntion() ) { + aSSI.SetIndices(aNewSeq); + } + else { + aFunction = theGroup->AddFunction( GEOM_Object::GetSubShapeID(), 0, true ); + GEOM_ISubShape aSSI2 (aFunction); + aSSI2.SetIndices(aNewSeq); + aSSI2.SetMainShape(aMainShapeFunc); + } // As we do not recompute here our group, lets mark it as Modified Standard_Integer aTic = aMainObj->GetTic(); // tic of main shape theGroup->SetTic(aTic - 1); } //Make a Python command - Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes); - aLatest = GEOM::GetCreatedLast(aLatest, theGroup); - Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction(); - - GEOM::TPythonDump pd (aLastFunc, /*append=*/true); + GEOM::TPythonDump pd (aFunction, /*append=*/true); pd << "geompy.UnionList(" << theGroup << ", ["; for (i = 1; i <= aLen; i++) { @@ -395,11 +416,12 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { - SetErrorCode("The list is empty"); + //SetErrorCode("The list is empty"); + SetErrorCode(OK); return; } - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if (aFunction.IsNull()) return; GEOM_ISubShape aSSI (aFunction); @@ -412,8 +434,9 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, if (aSeq.IsNull()) return; Standard_Integer aLength = aSeq->Length(); - if (aLength == 1 && aSeq->Value(1) == -1) // empty group - return; + // VSR 28/04/2011 commented to allow operation even for empty group + // if (aLength == 1 && aSeq->Value(1) == -1) // empty group + // return; TColStd_MapOfInteger mapIDsCurrent; Standard_Integer j = 1; @@ -447,7 +470,7 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, // 1. If aShape_i is sub-shape of aMainShape - remove it if (mapIndices.Contains(aShape_i)) { rem_id = mapIndices.FindIndex(aShape_i); - if (mapIDsCurrent.Contains(rem_id)) { + if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) { mapIDsToRemove.Add(rem_id); } } @@ -461,7 +484,7 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, TopoDS_Shape aSubShape_i = mapIndices_i.FindKey(ii); if (mapIndices.Contains(aSubShape_i)) { rem_id = mapIndices.FindIndex(aSubShape_i); - if (mapIDsCurrent.Contains(rem_id)) { + if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) { mapIDsToRemove.Add(rem_id); } } @@ -474,7 +497,7 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, TopoDS_Shape aSubShape_i = aSubShapes_i.Current(); if (mapIndices.Contains(aSubShape_i)) { rem_id = mapIndices.FindIndex(aSubShape_i); - if (mapIDsCurrent.Contains(rem_id)) { + if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) { mapIDsToRemove.Add(rem_id); } } @@ -484,28 +507,37 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, if (mapIDsToRemove.Extent() > 0) { Standard_Integer k = 1, aRemLength = mapIDsToRemove.Extent(); - Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength); - - for (j = 1; j <= aLength; j++) { - if (!mapIDsToRemove.Contains(aSeq->Value(j))) { - aNewSeq->SetValue(k, aSeq->Value(j)); - k++; + Handle(TColStd_HArray1OfInteger) aNewSeq; + if ( aLength - aRemLength > 0 ) { + aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength); + for (j = 1; j <= aLength; j++) { + if (!mapIDsToRemove.Contains(aSeq->Value(j))) { + aNewSeq->SetValue(k, aSeq->Value(j)); + k++; + } } } + else { + aNewSeq = new TColStd_HArray1OfInteger(1,1); + aNewSeq->SetValue(1, -1); + } - aSSI.SetIndices(aNewSeq); - + if ( aFunction->IsLastFuntion() ) { + aSSI.SetIndices(aNewSeq); + } + else { + aFunction = theGroup->AddFunction( GEOM_Object::GetSubShapeID(), 0, true ); + GEOM_ISubShape aSSI2 (aFunction); + aSSI2.SetIndices(aNewSeq); + aSSI2.SetMainShape(aMainShapeFunc); + } // As we do not recompute here our group, lets mark it as Modified Standard_Integer aTic = aMainObj->GetTic(); // tic of main shape theGroup->SetTic(aTic - 1); } //Make a Python command - Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes); - aLatest = GEOM::GetCreatedLast(aLatest, theGroup); - Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction(); - - GEOM::TPythonDump pd (aLastFunc, /*append=*/true); + GEOM::TPythonDump pd (aFunction, /*append=*/true); pd << "geompy.DifferenceList(" << theGroup << ", ["; for (i = 1; i <= aLen; i++) { @@ -529,11 +561,12 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup, Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { - SetErrorCode("The list is empty"); + //SetErrorCode("The list is empty"); + SetErrorCode(OK); return; } - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if (aFunction.IsNull()) return; GEOM_ISubShape aSSI (aFunction); @@ -567,13 +600,17 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup, TopTools_IndexedMapOfShape mapIndices; TopExp::MapShapes(aMainShape, mapIndices); + // Get group type + TopAbs_ShapeEnum aType = GetType(theGroup); + // Get IDs of sub-shapes to add Standard_Integer i, new_id; for (i = 1; i <= aLen; i++) { new_id = theSubShapes->Value(i); if (0 < new_id && new_id <= mapIndices.Extent()) { - if (mapIDs.Add(new_id)) { + //if (mapIDs.Add(new_id)) { IPAL21297. Why we ignore invalid ids silently? + if (mapIDs.Add(new_id) && mapIndices(new_id).ShapeType()==aType ) { aNewIDs.Append(new_id); } } @@ -586,9 +623,15 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup, for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) { aNewSeq->SetValue(k, aNewIDsIter.Value()); } - - aSSI.SetIndices(aNewSeq); - + if ( aFunction->IsLastFuntion() ) { + aSSI.SetIndices(aNewSeq); + } + else { + aFunction = theGroup->AddFunction( GEOM_Object::GetSubShapeID(), 0, true ); + GEOM_ISubShape aSSI2 (aFunction); + aSSI2.SetIndices(aNewSeq); + aSSI2.SetMainShape(aMainShapeFunc); + } // As we do not recompute here our group, lets mark it as Modified Standard_Integer aTic = aMainObj->GetTic(); // tic of main shape theGroup->SetTic(aTic - 1); @@ -617,11 +660,12 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup, Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { - SetErrorCode("The list is empty"); + //SetErrorCode("The list is empty"); + SetErrorCode(OK); return; } - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if (aFunction.IsNull()) return; GEOM_ISubShape aSSI (aFunction); @@ -634,8 +678,9 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup, if (aSeq.IsNull()) return; Standard_Integer aLength = aSeq->Length(); - if (aLength == 1 && aSeq->Value(1) == -1) // empty group - return; + // VSR 28/04/2011 commented to allow operation even for empty group + // if (aLength == 1 && aSeq->Value(1) == -1) // empty group + // return; TColStd_MapOfInteger mapIDsCurrent; Standard_Integer j = 1; @@ -660,24 +705,36 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup, Standard_Integer i, rem_id; for (i = 1; i <= aLen; i++) { rem_id = theSubShapes->Value(i); - if (mapIDsCurrent.Contains(rem_id)) { + if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) { mapIDsToRemove.Add(rem_id); } } if (mapIDsToRemove.Extent() > 0) { Standard_Integer k = 1, aRemLength = mapIDsToRemove.Extent(); - Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength); - - for (j = 1; j <= aLength; j++) { - if (!mapIDsToRemove.Contains(aSeq->Value(j))) { - aNewSeq->SetValue(k, aSeq->Value(j)); - k++; + Handle(TColStd_HArray1OfInteger) aNewSeq; + if ( aLength - aRemLength > 0 ) { + aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength); + for (j = 1; j <= aLength; j++) { + if (!mapIDsToRemove.Contains(aSeq->Value(j))) { + aNewSeq->SetValue(k, aSeq->Value(j)); + k++; + } } } - - aSSI.SetIndices(aNewSeq); - + else { + aNewSeq = new TColStd_HArray1OfInteger(1,1); + aNewSeq->SetValue(1, -1); + } + if ( aFunction->IsLastFuntion() ) { + aSSI.SetIndices(aNewSeq); + } + else { + aFunction = theGroup->AddFunction( GEOM_Object::GetSubShapeID(), 0, true ); + GEOM_ISubShape aSSI2 (aFunction); + aSSI2.SetIndices(aNewSeq); + aSSI2.SetMainShape(aMainShapeFunc); + } // As we do not recompute here our group, lets mark it as Modified Standard_Integer aTic = aMainObj->GetTic(); // tic of main shape theGroup->SetTic(aTic - 1); @@ -733,8 +790,8 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object) if (aMainShape.IsNull()) return NULL; //Make a Python command - GEOM::TPythonDump(aGroupFunction, /*append=*/true) - << aMainShape << " = geompy.GetMainShape(" << theGroup << ")"; + //GEOM::TPythonDump(aGroupFunction, /*append=*/true) + // << aMainShape << " = geompy.GetMainShape(" << theGroup << ")"; SetErrorCode(OK); return aMainShape; @@ -751,7 +808,7 @@ Handle(TColStd_HArray1OfInteger) GEOMImpl_IGroupOperations::GetObjects(Handle(GE if(theGroup.IsNull()) return NULL; - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if(aFunction.IsNull()) return NULL; GEOM_ISubShape aSSI(aFunction); diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx index 272d2c532..0b6a89110 100644 --- a/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_IGroupOperations_HXX_ #define _GEOMImpl_IGroupOperations_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IHealing.hxx b/src/GEOMImpl/GEOMImpl_IHealing.hxx index 62e53e804..2ee387908 100755 --- a/src/GEOMImpl/GEOMImpl_IHealing.hxx +++ b/src/GEOMImpl/GEOMImpl_IHealing.hxx @@ -1,46 +1,48 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 -// -//NOTE: This is an intreface to a function for the Healing creation. +// 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_Function.hxx" #include #include - -#define ARG_SHAPE_PROCESS_OPERATORS 1 -#define ARG_SHAPE_PROCESS_PARAMS 2 -#define ARG_SHAPE_PROCESS_VALUES 3 -#define ARG_ORIGINAL 4 -#define ARG_LIST_ARGUMENTS 5 -#define ARG_IS_COMMON_VERTEX 6 -#define ARG_TOLERANCE 7 -#define ARG_DEV_EDGE_VALUE 8 -#define ARG_IS_BY_PARAMETER 9 -#define ARG_SUBSHAPE_INDEX 10 - +#include "TColStd_HSequenceOfTransient.hxx" class GEOMImpl_IHealing { public: + + enum { + ARG_SHAPE_PROCESS_OPERATORS = 1, + ARG_SHAPE_PROCESS_PARAMS = 2, + ARG_SHAPE_PROCESS_VALUES = 3, + ARG_ORIGINAL = 4, + ARG_LIST_ARGUMENTS = 5, + ARG_IS_COMMON_VERTEX = 6, + ARG_TOLERANCE = 7, + ARG_DEV_EDGE_VALUE = 8, + ARG_IS_BY_PARAMETER = 9, + ARG_SUBSHAPE_INDEX = 10, + ARG_LIST_SHAPES = 11 + }; + GEOMImpl_IHealing(Handle(GEOM_Function) theFunction): _func(theFunction) {} void SetOperators( const Handle(TColStd_HArray1OfExtendedString)& arr ) { if ( !arr.IsNull() ) _func->SetStringArray(ARG_SHAPE_PROCESS_OPERATORS, arr); } @@ -75,7 +77,12 @@ public: void SetIndex( Standard_Integer val ) { _func->SetInteger(ARG_SUBSHAPE_INDEX, val); } Standard_Integer GetIndex() { return _func->GetInteger(ARG_SUBSHAPE_INDEX); } - + + void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(ARG_LIST_SHAPES, theShapes); } + Handle(TColStd_HSequenceOfTransient) GetShapes() + { return _func->GetReferenceList(ARG_LIST_SHAPES); } + private: - Handle(GEOM_Function) _func; + Handle(GEOM_Function) _func; }; diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx index 6057b7a37..3db0e6a93 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx @@ -1,28 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifdef WNT #pragma warning( disable:4786 ) #endif +#include #include #include @@ -32,14 +34,18 @@ #include #include #include +#include +#include #include -#include +#include #include "utilities.h" #include #include +#include + #include #include @@ -54,13 +60,11 @@ #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC - //============================================================================= /*! * constructor: */ //============================================================================= - GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations (GEOM_Engine* theEngine, int theDocID) : GEOM_IOperations(theEngine, theDocID) { @@ -72,7 +76,6 @@ GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations (GEOM_Engine* theEngine * destructor */ //============================================================================= - GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations() { MESSAGE("GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations"); @@ -138,7 +141,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ShapeProcess (Handle(GEOM_Objec //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) @@ -202,7 +205,7 @@ void GEOMImpl_IHealingOperations::GetShapeProcessParameters (std::list& theParams, - std::list& theValues ) +bool GEOMImpl_IHealingOperations::GetOperatorParameters( const std::string theOperation, + std::list& theParams, + std::list& theValues ) { ShHealOper_ShapeProcess aHealer; int nbParamValueErrors( 0 ); @@ -236,11 +239,11 @@ bool GEOMImpl_IHealingOperations::GetOperatorParameters( const std::string theOp TCollection_AsciiString aParam( (Standard_CString)(*it).c_str() ); TCollection_AsciiString aValue; if ( aHealer.GetParameter( aParam, aValue ) ) { - theParams.push_back( aParam.ToCString() ); - theValues.push_back( aValue.ToCString() ); + theParams.push_back( aParam.ToCString() ); + theValues.push_back( aValue.ToCString() ); } else - nbParamValueErrors++; + nbParamValueErrors++; } } else @@ -323,31 +326,31 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces // set error code, check parameters SetErrorCode(KO); - if ( theObject.IsNull() ) // if theFaces.IsNull() - it's OK, it means that ALL faces must be removed.. + if (theObject.IsNull()) // if theFaces.IsNull() - it's OK, it means that ALL faces must be removed.. return NULL; Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); - if(aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed // Add a new object - Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add the function aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SUPPRESS_FACES); - if(aFunction.IsNull()) return NULL; + if (aFunction.IsNull()) return NULL; //Check if the function is set correctly - if(aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; // prepare "data container" class IHealing - GEOMImpl_IHealing HI(aFunction); - HI.SetFaces( theFaces ); - HI.SetOriginal( aLastFunction ); + GEOMImpl_IHealing HI (aFunction); + HI.SetFaces(theFaces); + HI.SetOriginal(aLastFunction); //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) @@ -358,7 +361,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces } catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; } @@ -376,7 +379,6 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces return aNewObject; } - //============================================================================= /*! * CloseContour @@ -418,7 +420,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) @@ -429,7 +431,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour } catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; } @@ -487,7 +489,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) @@ -555,7 +557,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::FillHoles (Handle(GEOM_Object) //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) @@ -566,7 +568,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::FillHoles (Handle(GEOM_Object) } catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; } @@ -623,7 +625,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) @@ -634,7 +636,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj } catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; } @@ -686,18 +688,16 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::DivideEdge (Handle(GEOM_Object) //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif - if (!GetSolver()->ComputeFunction(aFunction)) - { + if (!GetSolver()->ComputeFunction(aFunction)) { SetErrorCode("Healing driver failed"); return NULL; } } - catch (Standard_Failure) - { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; } @@ -710,14 +710,89 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::DivideEdge (Handle(GEOM_Object) return aNewObject; } +//============================================================================= +/*! + * FuseCollinearEdgesWithinWire + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::FuseCollinearEdgesWithinWire + (Handle(GEOM_Object) theWire, + std::list theVertices) +{ + SetErrorCode(KO); + + if (theWire.IsNull()) return NULL; + + // Add a new object + Handle(GEOM_Object) aRes = GetEngine()->AddObject(GetDocID(), theWire->GetType()); + + // Add a new function + Handle(GEOM_Function) aFunction; + aFunction = aRes->AddFunction(GEOMImpl_HealingDriver::GetID(), FUSE_COLLINEAR_EDGES); + if (aFunction.IsNull()) return NULL; + + // Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + GEOMImpl_IHealing aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theWire->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + aCI.SetOriginal(aRefShape); + + Handle(TColStd_HSequenceOfTransient) aVertices = new TColStd_HSequenceOfTransient; + std::list::iterator it = theVertices.begin(); + for (; it != theVertices.end(); it++) { + Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL argument shape for the shape construction"); + return NULL; + } + aVertices->Append(aRefSh); + } + aCI.SetShapes(aVertices); + + // Compute the new wire + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + // Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aRes << " = geompy.FuseCollinearEdgesWithinWire(" << theWire << ", ["; + // Vertices + it = theVertices.begin(); + if (it != theVertices.end()) { + pd << (*it++); + while (it != theVertices.end()) { + pd << ", " << (*it++); + } + } + pd << "])"; + + SetErrorCode(OK); + return aRes; +} + //============================================================================= /*! * GetFreeBoundary */ //============================================================================= bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(GEOM_Object) theObject, - Handle(TColStd_HSequenceOfTransient)& theClosed, - Handle(TColStd_HSequenceOfTransient)& theOpen ) + Handle(TColStd_HSequenceOfTransient)& theClosed, + Handle(TColStd_HSequenceOfTransient)& theOpen ) { // set error code, check parameters SetErrorCode(KO); @@ -730,7 +805,13 @@ bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(GEOM_Object) theObject return false; // get free boundary shapes - ShapeAnalysis_FreeBounds anAnalizer( aShape ); + +#if OCC_VERSION_LARGE > 0x06030008 + ShapeAnalysis_FreeBounds anAnalizer(aShape, Standard_False, + Standard_True, Standard_True); +#else + ShapeAnalysis_FreeBounds anAnalizer(aShape); +#endif TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); TopoDS_Compound anOpen = anAnalizer.GetOpenWires(); @@ -806,30 +887,42 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientation (Handle(GEOM_ return NULL; if (!theObject->IsMainShape()) { - SetErrorCode("Sub shape cannot be transformed - need to create a copy"); + SetErrorCode("Sub-shape cannot be transformed - need to create a copy"); return NULL; } Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); - if (aLastFunction.IsNull()) + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed - //Add the function - aFunction = theObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION); + if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066 + //Add the function + aFunction = theObject->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_REVERSE); - if (aFunction.IsNull()) - return NULL; + //Check if the function is set correctly + if (aFunction.IsNull()) return NULL; + if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL; - //Check if the function is set correctly - if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + // prepare "data container" class IVector + GEOMImpl_IVector aVI (aFunction); + aVI.SetCurve(aLastFunction); + } + else { + //Add the function + aFunction = theObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION); - // prepare "data container" class IHealing - GEOMImpl_IHealing HI(aFunction); - HI.SetOriginal( aLastFunction ); + //Check if the function is set correctly + if (aFunction.IsNull()) return NULL; + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI (aFunction); + HI.SetOriginal(aLastFunction); + } //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -851,7 +944,6 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientation (Handle(GEOM_ return theObject; } - //============================================================================= /*! * ChangeOrientationCopy @@ -870,24 +962,36 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(G return NULL; //There is no function which creates an object to be processed // Add a new object - Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType()); - //Add the function - aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION); + if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066 + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_REVERSE); - if (aFunction.IsNull()) - return NULL; + //Check if the function is set correctly + if (aFunction.IsNull()) return NULL; + if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL; - //Check if the function is set correctly - if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + // prepare "data container" class IVector + GEOMImpl_IVector aVI (aFunction); + aVI.SetCurve(aLastFunction); + } + else { + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION); - // prepare "data container" class IHealing - GEOMImpl_IHealing HI(aFunction); - HI.SetOriginal( aLastFunction ); + //Check if the function is set correctly + if (aFunction.IsNull()) return NULL; + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; - //Compute the translation + // prepare "data container" class IHealing + GEOMImpl_IHealing aHI (aFunction); + aHI.SetOriginal(aLastFunction); + } + + // Compute the result try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -909,3 +1013,61 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(G return aNewObject; } +//============================================================================= +/*! + * LimitTolerance + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Object) theObject, + double theTolerance) +{ + // Set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) + return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) + return NULL; // There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + // Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), LIMIT_TOLERANCE); + + if (aFunction.IsNull()) + return NULL; + + // Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // Prepare "data container" class IHealing + GEOMImpl_IHealing HI (aFunction); + HI.SetOriginal(aLastFunction); + HI.SetTolerance(theTolerance); + + // Compute + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + // Make a Python command + GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.LimitTolerance(" + << theObject << ", " << theTolerance << ")"; + + SetErrorCode(OK); + return aNewObject; +} diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx index 9be4f44f5..7434d937c 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 _GEOMImpl_IHealingOperations_HXX_ #define _GEOMImpl_IHealingOperations_HXX_ @@ -38,9 +38,9 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations { // Apply Shape Processing to the selected Object Standard_EXPORT Handle(GEOM_Object) ShapeProcess( Handle(GEOM_Object) theObject, - const Handle(TColStd_HArray1OfExtendedString)& theOperations, - const Handle(TColStd_HArray1OfExtendedString)& theParams, - const Handle(TColStd_HArray1OfExtendedString)& theValues ); + const Handle(TColStd_HArray1OfExtendedString)& theOperations, + const Handle(TColStd_HArray1OfExtendedString)& theParams, + const Handle(TColStd_HArray1OfExtendedString)& theValues ); // Retrieve default Shape Process parameters (from resource file) Standard_EXPORT void GetShapeProcessParameters( std::list& theOperations, @@ -48,12 +48,13 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations { std::list& theValues ); // Retrieve default Shape Process parameters for given operator - Standard_EXPORT bool GetOperatorParameters( const std::string theOperation, + Standard_EXPORT bool GetOperatorParameters( const std::string theOperation, std::list& theParams, std::list& theValues ); // returns all parameters that are valid for the given operation (Shape Process operator) - Standard_EXPORT static bool GetParameters( const std::string theOperation, std::list& theParams ); + Standard_EXPORT static bool GetParameters( const std::string theOperation, + std::list& theParams ); Standard_EXPORT Handle(GEOM_Object) SuppressFaces( Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theFaces); @@ -67,25 +68,32 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) FillHoles( Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theWires); - + Standard_EXPORT Handle(GEOM_Object) Sew( Handle(GEOM_Object) theObject, double theTolerance ); Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject, - int theIndex, - double theValue, - bool isByParameter ); + int theIndex, + double theValue, + bool isByParameter ); + + Standard_EXPORT Handle(GEOM_Object) FuseCollinearEdgesWithinWire + (Handle(GEOM_Object) theWire, + std::list theVertices); // this function does not use Function-Driver mechanism, it just computes the free // boundary edges and returns them in the sequence. It is called just for information reasons // and it's not intended for history/undo/redo/etc.. - Standard_EXPORT bool GetFreeBoundary ( Handle(GEOM_Object) theObject, - Handle(TColStd_HSequenceOfTransient)& theOutClosedWires, + Standard_EXPORT bool GetFreeBoundary ( Handle(GEOM_Object) theObject, + Handle(TColStd_HSequenceOfTransient)& theOutClosedWires, Handle(TColStd_HSequenceOfTransient)& theOutOpenWires ); Standard_EXPORT Handle(GEOM_Object) ChangeOrientation( Handle(GEOM_Object) theObject); Standard_EXPORT Handle(GEOM_Object) ChangeOrientationCopy( Handle(GEOM_Object) theObject); + Standard_EXPORT Handle(GEOM_Object) LimitTolerance( Handle(GEOM_Object) theObject, + double theTolerance ); + }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IImportExport.hxx b/src/GEOMImpl/GEOMImpl_IImportExport.hxx index 731e637ec..282bab97d 100644 --- a/src/GEOMImpl/GEOMImpl_IImportExport.hxx +++ b/src/GEOMImpl/GEOMImpl_IImportExport.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Import Export operation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx index 5fb461ff7..3bb7cec61 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -1,28 +1,41 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + #include "utilities.h" #include #include @@ -32,17 +45,16 @@ #include #include -#include -#include - -#include -#include -#include - -#include -#include +#include +#include +#include +#include -#include +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -101,7 +113,7 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) the //Compute the Copy value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -129,8 +141,8 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) the //============================================================================= void GEOMImpl_IInsertOperations::Export (const Handle(GEOM_Object) theOriginal, - const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& theFormatName) + const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName) { SetErrorCode(KO); @@ -139,8 +151,11 @@ void GEOMImpl_IInsertOperations::Export Handle(GEOM_Function) aRefFunction = theOriginal->GetLastFunction(); if (aRefFunction.IsNull()) return; //There is no function which creates an object to be exported + //Add a new result object + Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT); + //Add an Export function - Handle(GEOM_Function) aFunction = theOriginal->AddFunction(GEOMImpl_ExportDriver::GetID(), EXPORT_SHAPE); + Handle(GEOM_Function) aFunction = result->AddFunction(GEOMImpl_ExportDriver::GetID(), EXPORT_SHAPE); if (aFunction.IsNull()) return; //Check if the function is set correctly @@ -161,7 +176,7 @@ void GEOMImpl_IInsertOperations::Export //Perform the Export try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -189,7 +204,7 @@ void GEOMImpl_IInsertOperations::Export //============================================================================= Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import (const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& theFormatName) + const TCollection_AsciiString& theFormatName) { SetErrorCode(KO); @@ -206,7 +221,7 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import if (aFunction->GetDriverGUID() != GEOMImpl_ImportDriver::GetID()) return result; Handle(TCollection_HAsciiString) aHLibName; - if (!IsSupported(Standard_True, theFormatName, aHLibName)) { + if (!IsSupported(Standard_True, theFormatName.SubString(1,4), aHLibName)) { return result; } TCollection_AsciiString aLibName = aHLibName->String(); @@ -216,10 +231,11 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import aCI.SetFileName(theFileName); aCI.SetFormatName(theFormatName); aCI.SetPluginName(aLibName); + //cout<<"IIO: theFormatName = "< 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -234,10 +250,27 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import } //Make a Python command - GEOM::TPythonDump(aFunction) << result << " = geompy.Import(\"" - << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; + if( theFormatName != "IGES_UNIT" ) { + GEOM::TPythonDump(aFunction) << result << " = geompy.ImportFile(\"" + << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; + } SetErrorCode(OK); + + if( theFormatName == "IGES_UNIT" ) { + TopoDS_Shape S = aFunction->GetValue(); + TopoDS_Vertex V = TopoDS::Vertex(S); + gp_Pnt P = BRep_Tool::Pnt(V); + double scale = P.X(); + TCollection_AsciiString aUnitName = "UNIT_M"; + if( fabs(scale-0.01) < 1.e-6 ) + aUnitName = "UNIT_CM"; + else if( fabs(scale-0.001) < 1.e-6 ) + aUnitName = "UNIT_MM"; + //cout<<"IIO: aUnitName = "<Length(); bool isFound = false; for(int aInd=1;aInd<=aLenFormats;aInd++){ - if( theFormats->Value(aInd) == aToken){ - isFound = true; - break; - } + if( theFormats->Value(aInd) == aToken){ + isFound = true; + break; + } } if(!isFound) - theFormats->Append(aToken); + theFormats->Append(aToken); } } @@ -305,7 +338,7 @@ Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators if (myResMgr->Find(aKey.ToCString())) aPattern = myResMgr->Value(aKey.ToCString()); else if(myResMgrUser->Find(aKey.ToCString())) - aPattern = myResMgrUser->Value(aKey.ToCString()); + aPattern = myResMgrUser->Value(aKey.ToCString()); else { aPattern = theFormats->Value(j); aPattern += " Files ( *.* )"; @@ -324,7 +357,7 @@ Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators //============================================================================= Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators (Handle(TColStd_HSequenceOfAsciiString)& theFormats, - Handle(TColStd_HSequenceOfAsciiString)& thePatterns) + Handle(TColStd_HSequenceOfAsciiString)& thePatterns) { if (theFormats.IsNull()) theFormats = new TColStd_HSequenceOfAsciiString; @@ -357,13 +390,13 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators int aLenFormats = theFormats->Length(); bool isFound = false; for(int aInd=1;aInd<=aLenFormats;aInd++){ - if( theFormats->Value(aInd) == aToken){ - isFound = true; - break; - } + if( theFormats->Value(aInd) == aToken){ + isFound = true; + break; + } } if(!isFound) - theFormats->Append(aToken); + theFormats->Append(aToken); } } @@ -381,7 +414,7 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators if (myResMgr->Find(aKey.ToCString())) aPattern = myResMgr->Value(aKey.ToCString()); else if (myResMgrUser->Find(aKey.ToCString())) - aPattern = myResMgrUser->Value(aKey.ToCString()); + aPattern = myResMgrUser->Value(aKey.ToCString()); else { aPattern = theFormats->Value(j); aPattern += " Files ( *.* )"; @@ -411,7 +444,6 @@ Standard_Boolean GEOMImpl_IInsertOperations::IsSupported if (isImport) aMode = "Import"; else aMode = "Export"; - // Read supported formats for the certain mode from install directory if (myResMgr->Find(aMode.ToCString())) { TCollection_AsciiString aFormats (myResMgr->Value(aMode.ToCString())); @@ -519,5 +551,122 @@ Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr() } return ( myResMgr->Find("Import") || myResMgr->Find("Export") || - myResMgrUser->Find("Import") || myResMgrUser->Find("Export")); + myResMgrUser->Find("Import") || myResMgrUser->Find("Export")); +} + +int GEOMImpl_IInsertOperations::LoadTexture(const TCollection_AsciiString& theTextureFile) +{ + SetErrorCode(KO); + + if (theTextureFile.IsEmpty()) return 0; + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture; +#else + Handle(TDataStd_HArray1OfByte) aTexture; +#endif + + FILE* fp = fopen(theTextureFile.ToCString(), "r"); + if (!fp) return 0; + + std::list lines; + char buffer[4096]; + int maxlen = 0; + while (!feof(fp)) { + if ((fgets(buffer, 4096, fp)) == NULL) break; + int aLen = strlen(buffer); + if (buffer[aLen-1] == '\n') buffer[aLen-1] = '\0'; + lines.push_back(buffer); + maxlen = std::max(maxlen, (int)strlen(buffer)); + } + + fclose(fp); + + int lenbytes = maxlen/8; + if (maxlen%8) lenbytes++; + + if (lenbytes == 0 || lines.empty()) + return 0; + + std::list bytedata; + std::list::const_iterator it; + for (it = lines.begin(); it != lines.end(); ++it) { + std::string line = *it; + int lenline = (line.size()/8 + (line.size()%8 ? 1 : 0)) * 8; + for (int i = 0; i < lenline/8; i++) { + unsigned char byte = 0; + for (int j = 0; j < 8; j++) + byte = (byte << 1) + ( i*8+j < line.size() && line[i*8+j] != '0' ? 1 : 0 ); + bytedata.push_back(byte); + } + for (int i = lenline/8; i < lenbytes; i++) + bytedata.push_back((unsigned char)0); + } + + if (bytedata.empty() || bytedata.size() != lines.size()*lenbytes) + return 0; + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + aTexture = new TColStd_HArray1OfByte (1, lines.size()*lenbytes); +#else + aTexture = new TDataStd_HArray1OfByte (1, lines.size()*lenbytes); +#endif + + std::list::iterator bdit; + int i; + for (i = 1, bdit = bytedata.begin(); bdit != bytedata.end(); ++bdit, ++i) + aTexture->SetValue(i, (Standard_Byte)(*bdit)); + + int aTextureId = GetEngine()->addTexture(GetDocID(), lenbytes*8, lines.size(), aTexture, theTextureFile); + if (aTextureId > 0) SetErrorCode(OK); + return aTextureId; +} + +int GEOMImpl_IInsertOperations::AddTexture(int theWidth, int theHeight, +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + const Handle(TColStd_HArray1OfByte)& theTexture) +#else + const Handle(TDataStd_HArray1OfByte)& theTexture) +#endif +{ + SetErrorCode(KO); + int aTextureId = GetEngine()->addTexture(GetDocID(), theWidth, theHeight, theTexture); + if (aTextureId > 0) SetErrorCode(OK); + return aTextureId; +} + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +Handle(TColStd_HArray1OfByte) GEOMImpl_IInsertOperations::GetTexture(int theTextureId, +#else +Handle(TDataStd_HArray1OfByte) GEOMImpl_IInsertOperations::GetTexture(int theTextureId, +#endif + int& theWidth, int& theHeight) +{ + SetErrorCode(KO); + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture; +#else + Handle(TDataStd_HArray1OfByte) aTexture; +#endif + + theWidth = theHeight = 0; + TCollection_AsciiString aFileName; + + if (theTextureId <= 0) + return aTexture; + + aTexture = GetEngine()->getTexture(GetDocID(), theTextureId, theWidth, theHeight, aFileName); + + if (theWidth > 0 && theHeight > 0 && aTexture->Length() > 0) SetErrorCode(OK); + + return aTexture; +} + +std::list GEOMImpl_IInsertOperations::GetAllTextures() +{ + SetErrorCode(KO); + std::list id_list = GetEngine()->getAllTextures(GetDocID()); + SetErrorCode(OK); + return id_list; } diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx index aba0c227f..e60c22b32 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx @@ -1,36 +1,49 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_IInsertOperations_HXX_ #define _GEOMImpl_IInsertOperations_HXX_ -#include "Utils_SALOME_Exception.hxx" #include "GEOM_IOperations.hxx" #include "GEOM_Engine.hxx" #include "GEOM_Object.hxx" + +#include + +#include "Utils_SALOME_Exception.hxx" + #include #include #include #include +#include + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +class Handle_TColStd_HArray1OfByte; +#else +class Handle_TDataStd_HArray1OfByte; +#endif + class GEOMImpl_IInsertOperations : public GEOM_IOperations { public: Standard_EXPORT GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, int theDocID); @@ -56,6 +69,24 @@ class GEOMImpl_IInsertOperations : public GEOM_IOperations { const TCollection_AsciiString& theFormat, Handle(TCollection_HAsciiString)& theLibName); + Standard_EXPORT int LoadTexture(const TCollection_AsciiString& theTextureFile); + + Standard_EXPORT int AddTexture(int theWidth, int theHeight, +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + const Handle(TColStd_HArray1OfByte)& theTexture); +#else + const Handle(TDataStd_HArray1OfByte)& theTexture); +#endif + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Standard_EXPORT Handle(TColStd_HArray1OfByte) GetTexture(int theTextureId, +#else + Standard_EXPORT Handle(TDataStd_HArray1OfByte) GetTexture(int theTextureId, +#endif + int& theWidth, int& theHeight); + + Standard_EXPORT std::list GetAllTextures(); + private: Standard_Boolean InitResMgr (); diff --git a/src/GEOMImpl/GEOMImpl_ILine.hxx b/src/GEOMImpl/GEOMImpl_ILine.hxx index faa1d462c..2bb7fdf91 100644 --- a/src/GEOMImpl/GEOMImpl_ILine.hxx +++ b/src/GEOMImpl/GEOMImpl_ILine.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the vector creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx index 9e552229a..76b8f0563 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx @@ -1,38 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 #include -#include -#include - #include #include +#include #include #include #include +#include #include #include @@ -42,6 +41,11 @@ #include #include +#include +#include + +#include + #include "utilities.h" #include #include @@ -111,7 +115,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletAll //Compute the Fillet value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -172,7 +176,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdges //Compute the Fillet value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -242,7 +246,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdgesR1R2 //Compute the Fillet value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -312,7 +316,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFaces //Compute the Fillet value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -382,7 +386,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFacesR1R2 //Compute the Fillet value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -451,7 +455,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFillet2D //Compute the Fillet value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -481,6 +485,78 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFillet2D return aFillet2D; } +//============================================================================= +/*! + * MakeFillet1D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFillet1D + (Handle(GEOM_Object) theShape, double theR, + std::list theVertexes, bool doIgnoreSecantVertices) +{ + SetErrorCode(KO); + + //Add a new Fillet object + Handle(GEOM_Object) aFillet1D = GetEngine()->AddObject(GetDocID(), GEOM_FILLET_1D); + + //Add a new Fillet function + Handle(GEOM_Function) aFunction = + aFillet1D->AddFunction(GEOMImpl_Fillet1dDriver::GetID(), FILLET_1D_SHAPE_VERTEXES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_Fillet1dDriver::GetID()) return NULL; + + GEOMImpl_IFillet1d aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetR(theR); + aCI.SetFlag(doIgnoreSecantVertices); + int aLen = theVertexes.size(); + aCI.SetLength(aLen); + + int ind = 1; + std::list::iterator it = theVertexes.begin(); + for (; it != theVertexes.end(); it++, ind++) { + aCI.SetVertex(ind, (*it)); + } + + //Compute the Fillet value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("1D Fillet driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aFillet1D << " = geompy.MakeFillet1D(" << theShape + << ", " << theR << ", ["; + + it = theVertexes.begin(); + if (it != theVertexes.end()) { + pd << (*it++); + while (it != theVertexes.end()) + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aFillet1D; +} + //============================================================================= /*! * MakeChamferAll @@ -511,7 +587,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferAll (Handle(GEOM_Objec //Compute the Chamfer value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -568,7 +644,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdge //Compute the Chamfer value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -626,7 +702,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgeAD //Compute the Chamfer value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -689,7 +765,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFaces //Compute the Chamfer value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -760,7 +836,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFacesAD //Compute the Chamfer value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -811,7 +887,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdges //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) - { MESSAGE ( "Chamfer Driver is NULL!!!" ); return NULL; } + { MESSAGE ( "Chamfer Driver is NULL!!!" ); return NULL; } GEOMImpl_IChamfer aCI (aFunction); @@ -832,7 +908,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdges //Compute the Chamfer value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -883,7 +959,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgesAD //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) - { MESSAGE("Chamfer Driver is NULL!!!"); return NULL;} + { MESSAGE("Chamfer Driver is NULL!!!"); return NULL;} GEOMImpl_IChamfer aCI (aFunction); @@ -904,7 +980,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgesAD //Compute the Chamfer value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -968,7 +1044,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeArchimede (Handle(GEOM_Object //Compute the Archimede value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx index 15acc6eaf..e3877b63b 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 _GEOMImpl_ILocalOperations_HXX_ #define _GEOMImpl_ILocalOperations_HXX_ @@ -48,6 +48,8 @@ class GEOMImpl_ILocalOperations : public GEOM_IOperations { std::list theFaces); Standard_EXPORT Handle(GEOM_Object) MakeFillet2D (Handle(GEOM_Object) theShape, double theR, std::list theVertexes); + Standard_EXPORT Handle(GEOM_Object) MakeFillet1D (Handle(GEOM_Object) theShape, double theR, + std::list theVertexes, bool doIgnoreSecantVertices); Standard_EXPORT Handle(GEOM_Object) MakeChamferAll (Handle(GEOM_Object) theShape, double theD); Standard_EXPORT Handle(GEOM_Object) MakeChamferEdge (Handle(GEOM_Object) theShape, diff --git a/src/GEOMImpl/GEOMImpl_IMarker.hxx b/src/GEOMImpl/GEOMImpl_IMarker.hxx index 54265314f..a756a94ca 100644 --- a/src/GEOMImpl/GEOMImpl_IMarker.hxx +++ b/src/GEOMImpl/GEOMImpl_IMarker.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an interface to a function for the local coordinate system creation. // #include "GEOM_Function.hxx" @@ -35,6 +36,11 @@ #define CS_ARG_Y_DY 8 #define CS_ARG_Y_DZ 9 +#define CS_ARG_SHAPE 10 +#define CS_ARG_ORIGIN 11 +#define CS_ARG_XVEC 12 +#define CS_ARG_YVEC 13 + class GEOMImpl_IMarker { public: @@ -61,6 +67,26 @@ class GEOMImpl_IMarker _func->SetReal(CS_ARG_Y_DY, theDY); _func->SetReal(CS_ARG_Y_DZ, theDZ); } + + void SetShape (Handle(GEOM_Function) theShape) + { + _func->SetReference(CS_ARG_SHAPE, theShape); + } + + void SetOrigin (Handle(GEOM_Function) theOrigin) + { + _func->SetReference(CS_ARG_ORIGIN, theOrigin); + } + + void SetXVec (Handle(GEOM_Function) theXVec) + { + _func->SetReference(CS_ARG_XVEC, theXVec); + } + + void SetYVec (Handle(GEOM_Function) theYVec) + { + _func->SetReference(CS_ARG_YVEC, theYVec); + } void GetOrigin (double& theX, double& theY, double& theZ) { @@ -82,6 +108,26 @@ class GEOMImpl_IMarker theDY = _func->GetReal(CS_ARG_Y_DY); theDZ = _func->GetReal(CS_ARG_Y_DZ); } + + Handle(GEOM_Function) GetShape() + { + return _func->GetReference(CS_ARG_SHAPE); + } + + Handle(GEOM_Function) GetOrigin() + { + return _func->GetReference(CS_ARG_ORIGIN); + } + + Handle(GEOM_Function) GetXVec() + { + return _func->GetReference(CS_ARG_XVEC); + } + + Handle(GEOM_Function) GetYVec() + { + return _func->GetReference(CS_ARG_YVEC); + } private: diff --git a/src/GEOMImpl/GEOMImpl_IMeasure.hxx b/src/GEOMImpl/GEOMImpl_IMeasure.hxx index c6c8ab74e..a58ffcbb5 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasure.hxx +++ b/src/GEOMImpl/GEOMImpl_IMeasure.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // NOTE: This is an interface to a functions for the Measurement // #include "GEOM_Function.hxx" @@ -30,7 +31,8 @@ class GEOMImpl_IMeasure { enum { MEASURE_ARG_BASE = 1, - MEASURE_ARG_POINT = 2 + MEASURE_ARG_POINT = 2, + MEASURE_INDEX = 3 }; public: @@ -45,6 +47,10 @@ class GEOMImpl_IMeasure { _func->SetReference(MEASURE_ARG_POINT, thePnt); } Handle(GEOM_Function) GetPoint() { return _func->GetReference(MEASURE_ARG_POINT); } + + void SetIndex(int theIndex) { _func->SetInteger(MEASURE_INDEX, theIndex); } + + int GetIndex() { return _func->GetInteger(MEASURE_INDEX); } private: diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index d77245838..98abba29c 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -26,6 +27,7 @@ #include #include #include +#include #include #include @@ -33,6 +35,19 @@ #include #include +#include + +#include +#include +#include +//#include +#include +#include +//#include +#include + +#include + #include #include #include @@ -47,8 +62,9 @@ #include #include #include -#include #include +#include +#include #include #include #include @@ -59,6 +75,7 @@ #include #include +#include #include #include #include @@ -89,21 +106,22 @@ #include #include -#include -#include #include #include +#include +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +#include +#include #include +#include #include #include -#include -#include -#include #include +#include //============================================================================= @@ -154,6 +172,14 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape TopoDS_Shape aShape = aRefShape->GetValue(); if (aShape.IsNull()) return aKind; + int geom_type = theShape->GetType(); + + // check if it's advanced shape + if ( geom_type > ADVANCED_BASE ) { + SetErrorCode(OK); + return SK_ADVANCED; + } + // Call algorithm GEOMAlgo_ShapeInfoFiller aSF; aSF.SetShape(aShape); @@ -763,19 +789,35 @@ gp_Ax3 GEOMImpl_IMeasureOperations::GetPosition (const TopoDS_Shape& theShape) Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS); gp_Pln aPln = aGPlane->Pln(); aResult = aPln.Position(); + // In case of reverse orinetation of the face invert the plane normal + // (the face's normal does not mathc the plane's normal in this case) + if(theShape.Orientation() == TopAbs_REVERSED) + { + gp_Dir Vx = aResult.XDirection(); + gp_Dir N = aResult.Direction().Mirrored(Vx); + gp_Pnt P = aResult.Location(); + aResult = gp_Ax3(P, N, Vx); + } } } // Origin gp_Pnt aPnt; - if (theShape.ShapeType() == TopAbs_VERTEX) { + + TopAbs_ShapeEnum aShType = theShape.ShapeType(); + + if (aShType == TopAbs_VERTEX) { aPnt = BRep_Tool::Pnt(TopoDS::Vertex(theShape)); } else { + if (aShType == TopAbs_COMPOUND) { + aShType = GEOMImpl_IShapesOperations::GetTypeOfSimplePart(theShape); + } + GProp_GProps aSystem; - if (theShape.ShapeType() == TopAbs_EDGE || theShape.ShapeType() == TopAbs_WIRE) + if (aShType == TopAbs_EDGE || aShType == TopAbs_WIRE) BRepGProp::LinearProperties(theShape, aSystem); - else if (theShape.ShapeType() == TopAbs_FACE || theShape.ShapeType() == TopAbs_SHELL) + else if (aShType == TopAbs_FACE || aShType == TopAbs_SHELL) BRepGProp::SurfaceProperties(theShape, aSystem); else BRepGProp::VolumeProperties(theShape, aSystem); @@ -817,7 +859,7 @@ void GEOMImpl_IMeasureOperations::GetPosition } try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif @@ -873,7 +915,7 @@ Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetCentreOfMass //Compute the CentreOfMass value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -894,6 +936,60 @@ Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetCentreOfMass return aCDG; } +//============================================================================= +/*! + * GetVertexByIndex + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetVertexByIndex + (Handle(GEOM_Object) theShape, + Standard_Integer theIndex) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + //Add a new Vertex object + Handle(GEOM_Object) aVertex = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + + //Add a function + Handle(GEOM_Function) aFunction = + aVertex->AddFunction(GEOMImpl_MeasureDriver::GetID(), VERTEX_BY_INDEX); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MeasureDriver::GetID()) return NULL; + + GEOMImpl_IMeasure aCI (aFunction); + aCI.SetBase(aRefShape); + aCI.SetIndex(theIndex); + + //Compute + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Vertex by index driver failed."); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aVertex << " = geompy.GetVertexByIndex(" << theShape << ", " << theIndex << ")"; + + SetErrorCode(OK); + return aVertex; +} + //============================================================================= /*! * GetNormal @@ -932,7 +1028,7 @@ Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetNormal //Compute the Normale value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -984,7 +1080,7 @@ void GEOMImpl_IMeasureOperations::GetBasicProperties (Handle(GEOM_Object) theSha //Compute the parameters GProp_GProps LProps, SProps; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif BRepGProp::LinearProperties(aShape, LProps); @@ -996,9 +1092,9 @@ void GEOMImpl_IMeasureOperations::GetBasicProperties (Handle(GEOM_Object) theSha theVolume = 0.0; if (aShape.ShapeType() < TopAbs_SHELL) { for (TopExp_Explorer Exp (aShape, TopAbs_SOLID); Exp.More(); Exp.Next()) { - GProp_GProps VProps; - BRepGProp::VolumeProperties(Exp.Current(), VProps); - theVolume += VProps.Mass(); + GProp_GProps VProps; + BRepGProp::VolumeProperties(Exp.Current(), VProps); + theVolume += VProps.Mass(); } } } @@ -1040,7 +1136,7 @@ void GEOMImpl_IMeasureOperations::GetInertia GProp_GProps System; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (aShape.ShapeType() == TopAbs_VERTEX || @@ -1107,7 +1203,7 @@ void GEOMImpl_IMeasureOperations::GetBoundingBox Bnd_Box B; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif BRepBndLib::Add(aShape, B); @@ -1152,32 +1248,32 @@ void GEOMImpl_IMeasureOperations::GetTolerance FaceMax = EdgeMax = VertMax = -RealLast(); try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif for (TopExp_Explorer ExF (aShape, TopAbs_FACE); ExF.More(); ExF.Next()) { TopoDS_Face Face = TopoDS::Face(ExF.Current()); T = BRep_Tool::Tolerance(Face); if (T > FaceMax) - FaceMax = T; + FaceMax = T; if (T < FaceMin) - FaceMin = T; + FaceMin = T; } for (TopExp_Explorer ExE (aShape, TopAbs_EDGE); ExE.More(); ExE.Next()) { TopoDS_Edge Edge = TopoDS::Edge(ExE.Current()); T = BRep_Tool::Tolerance(Edge); if (T > EdgeMax) - EdgeMax = T; + EdgeMax = T; if (T < EdgeMin) - EdgeMin = T; + EdgeMin = T; } for (TopExp_Explorer ExV (aShape, TopAbs_VERTEX); ExV.More(); ExV.Next()) { TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current()); T = BRep_Tool::Tolerance(Vertex); if (T > VertMax) - VertMax = T; + VertMax = T; if (T < VertMin) - VertMin = T; + VertMin = T; } } catch (Standard_Failure) { @@ -1214,7 +1310,7 @@ bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape, //Compute the parameters bool isValid = false; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif BRepCheck_Analyzer ana (aShape, theIsCheckGeom); @@ -1235,6 +1331,139 @@ bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape, return isValid; } +//============================================================================= +/*! + * CheckSelfIntersections + */ +//============================================================================= +bool GEOMImpl_IMeasureOperations::CheckSelfIntersections + (Handle(GEOM_Object) theShape, + Handle(TColStd_HSequenceOfInteger)& theIntersections) +{ + SetErrorCode(KO); + bool isGood = false; + + if (theIntersections.IsNull()) + theIntersections = new TColStd_HSequenceOfInteger; + else + theIntersections->Clear(); + + if (theShape.IsNull()) + return isGood; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return isGood; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) return isGood; + + // 0. Prepare data + BRep_Builder aBB; + TopoDS_Compound aCS; + TopoDS_Shape aScopy; + NMTDS_Tools::CopyShape(aShape, aScopy); + + // Map sub-shapes and their indices + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aScopy, anIndices); + + aBB.MakeCompound(aCS); + aBB.Add(aCS, aScopy); + + NMTTools_CheckerSI aCSI; // checker of self-interferences + aCSI.SetCompositeShape(aCS); + + // 1. Launch the checker + aCSI.Perform(); + Standard_Integer iErr = aCSI.StopStatus(); + if (iErr) { + return false; // Error + } + + isGood = true; + + // 2. Take the shapes from DS + const NMTDS_ShapesDataStructure& aDS = *(aCSI.DS()); + Standard_Integer aNbS = aDS.NumberOfShapesOfTheObject(); + + // 3. Get the pairs of interfered shapes + NMTDS_PInterfPool pIP = aCSI.IP(); + //const NMTDS_ListOfPassKeyBoolean& aLPKB = pIP->Get(); + const NMTDS_ListOfPairBoolean& aLPKB = pIP->Get(); + + Standard_Integer n1, n2; + //NMTDS_ListIteratorOfListOfPassKeyBoolean aIt; + NMTDS_ListIteratorOfListOfPairBoolean aIt; + + aIt.Initialize(aLPKB); + for (; aIt.More(); aIt.Next()) { + //const NMTDS_PassKeyBoolean& aPKB = aIt.Value(); + const NMTDS_PairBoolean& aPKB = aIt.Value(); + aPKB.Ids(n1, n2); + + if (n1 > aNbS || n2 > aNbS) + return false; // Error + + const TopoDS_Shape& aS1 = aDS.Shape(n1); + const TopoDS_Shape& aS2 = aDS.Shape(n2); + + theIntersections->Append(anIndices.FindIndex(aS1)); + theIntersections->Append(anIndices.FindIndex(aS2)); + isGood = false; + } + + SetErrorCode(OK); + return isGood; +} + +//============================================================================= +/*! + * IsGoodForSolid + */ +//============================================================================= +TCollection_AsciiString GEOMImpl_IMeasureOperations::IsGoodForSolid (Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + TCollection_AsciiString aRes = ""; + + if (theShape.IsNull()) { + aRes = "WRN_NULL_OBJECT_OR_SHAPE"; + } + else { + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) { + aRes = "WRN_NULL_OBJECT_OR_SHAPE"; + } + else { + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) { + aRes = "WRN_NULL_OBJECT_OR_SHAPE"; + } + else { + if (aShape.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator It (aShape, Standard_True, Standard_True); + if (It.More()) aShape = It.Value(); + } + if (aShape.ShapeType() == TopAbs_SHELL) { + BRepCheck_Shell chkShell (TopoDS::Shell(aShape)); + if (chkShell.Closed() == BRepCheck_NotClosed) { + aRes = "WRN_SHAPE_UNCLOSED"; + } + } + else { + aRes = "WRN_SHAPE_NOT_SHELL"; + } + } + } + } + + if (aRes.IsEmpty()) + SetErrorCode(OK); + + return aRes; +} + //============================================================================= /*! * WhatIs @@ -1267,7 +1496,7 @@ TCollection_AsciiString GEOMImpl_IMeasureOperations::WhatIs (Handle(GEOM_Object) Astr = Astr + " Number of sub-shapes : \n"; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif int iType, nbTypes [TopAbs_SHAPE]; @@ -1343,10 +1572,13 @@ static double CheckSingularCase(const TopoDS_Shape& aSh1, if( sh.ShapeType()==TopAbs_SHELL || sh.ShapeType()==TopAbs_FACE ) { // non solid case double U1,U2,V1,V2; - S->Bounds(U1,U2,V1,V2); - Handle(Geom_RectangularTrimmedSurface) TrS1 = + // changes for 0020677: EDF 1219 GEOM: MinDistance gives 0 instead of 20.88 + //S->Bounds(U1,U2,V1,V2); changed by + ShapeAnalysis::GetFaceUVBounds(TopoDS::Face(tmpSh1),U1,U2,V1,V2); + // end of changes for 020677 (dmv) + Handle(Geom_RectangularTrimmedSurface) TrS1 = new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2); - Handle(Geom_RectangularTrimmedSurface) TrS2 = + Handle(Geom_RectangularTrimmedSurface) TrS2 = new Geom_RectangularTrimmedSurface(S,(U1+U2)/2.,U2,V1,V2); BRep_Builder B; TopoDS_Face F1,F2; @@ -1412,10 +1644,11 @@ static double CheckSingularCase(const TopoDS_Shape& aSh1, if( sh.ShapeType()==TopAbs_SHELL || sh.ShapeType()==TopAbs_FACE ) { // non solid case double U1,U2,V1,V2; - S->Bounds(U1,U2,V1,V2); - Handle(Geom_RectangularTrimmedSurface) TrS1 = + //S->Bounds(U1,U2,V1,V2); + ShapeAnalysis::GetFaceUVBounds(TopoDS::Face(tmpSh2),U1,U2,V1,V2); + Handle(Geom_RectangularTrimmedSurface) TrS1 = new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2); - Handle(Geom_RectangularTrimmedSurface) TrS2 = + Handle(Geom_RectangularTrimmedSurface) TrS2 = new Geom_RectangularTrimmedSurface(S,(U1+U2)/2.,U2,V1,V2); BRep_Builder B; TopoDS_Face F1,F2; @@ -1612,6 +1845,37 @@ static bool CheckSingularCase(const TopoDS_Shape& aSh1, */ +//============================================================================= +/*! + * AreCoordsInside + */ +//============================================================================= +std::vector GEOMImpl_IMeasureOperations::AreCoordsInside(Handle(GEOM_Object) theShape, + const std::vector& coords, + double tolerance) +{ + std::vector res; + if (!theShape.IsNull()) { + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (!aRefShape.IsNull()) { + TopoDS_Shape aShape = aRefShape->GetValue(); + if (!aShape.IsNull()) { + BRepClass3d_SolidClassifier SC(aShape); + unsigned int nb_points = coords.size()/3; + for (int i = 0; i < nb_points; i++) { + double x = coords[3*i]; + double y = coords[3*i+1]; + double z = coords[3*i+2]; + gp_Pnt aPnt(x, y, z); + SC.Perform(aPnt, tolerance); + res.push_back( ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ) ); + } + } + } + } + return res; +} + //============================================================================= /*! * GetMinDistance @@ -1640,10 +1904,38 @@ Standard_Real GEOMImpl_IMeasureOperations::GetMinDistance //Compute the parameters try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif + // Issue 0020231: A min distance bug with torus and vertex. + // Make GetMinDistance() return zero if a sole VERTEX is inside any of SOLIDs + + // which of shapes consists of only one vertex? + TopExp_Explorer exp1(aShape1,TopAbs_VERTEX), exp2(aShape2,TopAbs_VERTEX); + TopoDS_Shape V1 = exp1.More() ? exp1.Current() : TopoDS_Shape(); + TopoDS_Shape V2 = exp2.More() ? exp2.Current() : TopoDS_Shape(); + exp1.Next(); exp2.Next(); + if ( exp1.More() ) V1.Nullify(); + if ( exp2.More() ) V2.Nullify(); + // vertex and container of solids + TopoDS_Shape V = V1.IsNull() ? V2 : V1; + TopoDS_Shape S = V1.IsNull() ? aShape1 : aShape2; + if ( !V.IsNull() ) { + // classify vertex against solids + gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( V ) ); + for ( exp1.Init( S, TopAbs_SOLID ); exp1.More(); exp1.Next() ) { + BRepClass3d_SolidClassifier classifier( exp1.Current(), p, 1e-6); + if ( classifier.State() == TopAbs_IN ) { + p.Coord(X1, Y1, Z1); + p.Coord(X2, Y2, Z2); + SetErrorCode(OK); + return 0.0; + } + } + } + // End Issue 0020231 + // skl 30.06.2008 // additional workaround for bugs 19899, 19908 and 19910 from Mantis gp_Pnt Ptmp1, Ptmp2; @@ -1660,12 +1952,12 @@ Standard_Real GEOMImpl_IMeasureOperations::GetMinDistance gp_Pnt PMin1, PMin2, P1, P2; for (int i = 1; i <= dst.NbSolution(); i++) { - P1 = dst.PointOnShape1(i); - P2 = dst.PointOnShape2(i); + P1 = dst.PointOnShape1(i); + P2 = dst.PointOnShape2(i); - Standard_Real Dist = P1.Distance(P2); - if (MinDist > Dist) { - MinDist = Dist; + Standard_Real Dist = P1.Distance(P2); + if (MinDist > Dist) { + MinDist = Dist; PMin1 = P1; PMin2 = P2; } @@ -1710,7 +2002,7 @@ void GEOMImpl_IMeasureOperations::PointCoordinates (Handle(GEOM_Object) theShape } try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); @@ -1735,6 +2027,10 @@ void GEOMImpl_IMeasureOperations::PointCoordinates (Handle(GEOM_Object) theShape Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2) { + if (theLine1->GetType() == GEOM_VECTOR && + theLine2->GetType() == GEOM_VECTOR) + return GetAngleBtwVectors(theLine1, theLine2); + SetErrorCode(KO); Standard_Real anAngle = -1.0; @@ -1758,7 +2054,7 @@ Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine } try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Edge E1 = TopoDS::Edge(aLine1); @@ -1769,7 +2065,7 @@ Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine Handle(Geom_Curve) C2 = BRep_Tool::Curve(E2,fp,lp); if ( C1.IsNull() || C2.IsNull() || - !C1->IsKind(STANDARD_TYPE(Geom_Line)) || + !C1->IsKind(STANDARD_TYPE(Geom_Line)) || !C2->IsKind(STANDARD_TYPE(Geom_Line))) { SetErrorCode("The edges must be linear"); @@ -1783,7 +2079,78 @@ Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine gp_Lin aLin2 = L2->Lin(); anAngle = aLin1.Angle(aLin2); - anAngle /= PI180; // convert radians into degrees + anAngle *= 180. / M_PI; // convert radians into degrees + + if (anAngle > 90.0) { + anAngle = 180.0 - anAngle; + } + + SetErrorCode(OK); + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + } + + return anAngle; +} + +//======================================================================= +/*! + * Compute angle (in degrees) between two vectors + */ +//======================================================================= +Standard_Real GEOMImpl_IMeasureOperations::GetAngleBtwVectors (Handle(GEOM_Object) theVec1, + Handle(GEOM_Object) theVec2) +{ + SetErrorCode(KO); + + Standard_Real anAngle = -1.0; + + if (theVec1.IsNull() || theVec2.IsNull()) + return anAngle; + + if (theVec1->GetType() != GEOM_VECTOR || theVec2->GetType() != GEOM_VECTOR) { + SetErrorCode("Two vectors must be given"); + return anAngle; + } + + Handle(GEOM_Function) aRefVec1 = theVec1->GetLastFunction(); + Handle(GEOM_Function) aRefVec2 = theVec2->GetLastFunction(); + if (aRefVec1.IsNull() || aRefVec2.IsNull()) + return anAngle; + + TopoDS_Shape aVec1 = aRefVec1->GetValue(); + TopoDS_Shape aVec2 = aRefVec2->GetValue(); + if (aVec1.IsNull() || aVec2.IsNull() || + aVec1.ShapeType() != TopAbs_EDGE || + aVec2.ShapeType() != TopAbs_EDGE) + { + SetErrorCode("Two edges must be given"); + return anAngle; + } + + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + TopoDS_Edge aE1 = TopoDS::Edge(aVec1); + TopoDS_Edge aE2 = TopoDS::Edge(aVec2); + + TopoDS_Vertex aP11, aP12, aP21, aP22; + TopExp::Vertices(aE1, aP11, aP12, Standard_True); + TopExp::Vertices(aE2, aP21, aP22, Standard_True); + if (aP11.IsNull() || aP12.IsNull() || aP21.IsNull() || aP22.IsNull()) { + SetErrorCode("Bad edge given"); + return anAngle; + } + + gp_Vec aV1 (BRep_Tool::Pnt(aP11), BRep_Tool::Pnt(aP12)); + gp_Vec aV2 (BRep_Tool::Pnt(aP21), BRep_Tool::Pnt(aP22)) ; + + anAngle = aV1.Angle(aV2); + anAngle *= 180. / M_PI; // convert radians into degrees SetErrorCode(OK); } @@ -1827,10 +2194,10 @@ Standard_Real GEOMImpl_IMeasureOperations::CurveCurvatureByParam //Compute curvature try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif - GeomLProp_CLProps Prop = GeomLProp_CLProps + GeomLProp_CLProps Prop = GeomLProp_CLProps (aCurve, aP, 2, Precision::Confusion()); aRes = fabs(Prop.Curvature()); SetErrorCode(OK); @@ -1845,7 +2212,7 @@ Standard_Real GEOMImpl_IMeasureOperations::CurveCurvatureByParam aRes = 1/aRes; else aRes = RealLast(); - + return aRes; } @@ -1881,13 +2248,13 @@ Standard_Real GEOMImpl_IMeasureOperations::CurveCurvatureByPoint //Compute curvature try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif - GeomAPI_ProjectPointOnCurve PPC(aPoint, aCurve, aFP, aLP); - if(PPC.NbPoints()>0) { - GeomLProp_CLProps Prop = GeomLProp_CLProps - (aCurve, PPC.LowerDistanceParameter(), 2, Precision::Confusion()); + GeomAPI_ProjectPointOnCurve PPCurve(aPoint, aCurve, aFP, aLP); + if(PPCurve.NbPoints()>0) { + GeomLProp_CLProps Prop = GeomLProp_CLProps + (aCurve, PPCurve.LowerDistanceParameter(), 2, Precision::Confusion()); aRes = fabs(Prop.Curvature()); SetErrorCode(OK); } @@ -1902,7 +2269,7 @@ Standard_Real GEOMImpl_IMeasureOperations::CurveCurvatureByPoint aRes = 1/aRes; else aRes = RealLast(); - + return aRes; } @@ -1924,10 +2291,10 @@ Standard_Real GEOMImpl_IMeasureOperations::getSurfaceCurvatures if (aSurf.IsNull()) return aRes; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif - GeomLProp_SLProps Prop = GeomLProp_SLProps + GeomLProp_SLProps Prop = GeomLProp_SLProps (aSurf, theUParam, theVParam, 2, Precision::Confusion()); if(Prop.IsCurvatureDefined()) { if(Prop.IsUmbilic()) { @@ -1956,7 +2323,7 @@ Standard_Real GEOMImpl_IMeasureOperations::getSurfaceCurvatures aRes = 1/aRes; else aRes = RealLast(); - + return aRes; } @@ -1993,7 +2360,7 @@ Standard_Real GEOMImpl_IMeasureOperations::MaxSurfaceCurvatureByParam ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2); Standard_Real U = U1 + (U2-U1)*theUParam; Standard_Real V = V1 + (V2-V1)*theVParam; - + return getSurfaceCurvatures(aSurf, U, V, true); } @@ -2066,7 +2433,7 @@ Standard_Real GEOMImpl_IMeasureOperations::MinSurfaceCurvatureByParam ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2); Standard_Real U = U1 + (U2-U1)*theUParam; Standard_Real V = V1 + (V2-V1)*theVParam; - + return getSurfaceCurvatures(aSurf, U, V, false); } @@ -2277,7 +2644,7 @@ void GEOMImpl_IMeasureOperations::StructuralDump (const BRepCheck_Analyzer& theA } count = NbProblems->Value((Standard_Integer)BRepCheck_SubshapeNotInShape); if (count > 0) { - theDump += " Subshape not in Shape .................... "; + theDump += " Sub-shape not in Shape .................... "; theDump += TCollection_AsciiString(count) + "\n"; } count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientation); @@ -2287,7 +2654,7 @@ void GEOMImpl_IMeasureOperations::StructuralDump (const BRepCheck_Analyzer& theA } count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientationOfSubshape); if (count > 0) { - theDump += " Bad Orientation of Subshape .............. "; + theDump += " Bad Orientation of Sub-shape .............. "; theDump += TCollection_AsciiString(count) + "\n"; } count = NbProblems->Value((Standard_Integer)BRepCheck_CheckFail); @@ -2433,14 +2800,14 @@ void GEOMImpl_IMeasureOperations::GetProblemSub (const BRepCheck_Analyzer& const Handle(BRepCheck_Result)& res = theAna.Result(sub); for (res->InitContextIterator(); - res->MoreShapeInContext(); - res->NextShapeInContext()) { + res->MoreShapeInContext(); + res->NextShapeInContext()) { if (res->ContextualShape().IsSame(theShape) && !Contains(theMap(sub), theShape)) { - theMap(sub).Append(theShape); - itl.Initialize(res->StatusOnShape()); + theMap(sub).Append(theShape); + itl.Initialize(res->StatusOnShape()); - if (itl.Value() != BRepCheck_NoError) { - Standard_Integer ii = 0; + if (itl.Value() != BRepCheck_NoError) { + Standard_Integer ii = 0; for (ii = 1; ii <= sl->Length(); ii++) if (sl->Value(ii).IsSame(sub)) break; @@ -2459,8 +2826,8 @@ void GEOMImpl_IMeasureOperations::GetProblemSub (const BRepCheck_Analyzer& NbProblems->SetValue((Standard_Integer)stat, NbProblems->Value((Standard_Integer)stat) + 1); } - } - break; + } + break; } } } diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx index 8d484b716..d84b8743c 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_IMeasureOperations_HXX_ #define _GEOMImpl_IMeasureOperations_HXX_ @@ -33,6 +34,7 @@ #include #include #include +#include class GEOM_Engine; class Handle(GEOM_Object); @@ -78,7 +80,9 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { SK_SEGMENT, // segment SK_EDGE, // other edge // VERTEX - SK_VERTEX + SK_VERTEX, + // ADVANCED shapes + SK_ADVANCED, // all advanced shapes (temporary implementation) }; Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape, @@ -92,6 +96,9 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape); + Standard_EXPORT Handle(GEOM_Object) GetVertexByIndex (Handle(GEOM_Object) theShape, + Standard_Integer theIndex); + Standard_EXPORT Handle(GEOM_Object) GetNormal (Handle(GEOM_Object) theFace, Handle(GEOM_Object) theOptionalPoint); @@ -120,8 +127,17 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { const Standard_Boolean theIsCheckGeom, TCollection_AsciiString& theDump); + Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape, + Handle(TColStd_HSequenceOfInteger)& theIntersections); + + Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape); + Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape); + Standard_EXPORT std::vector AreCoordsInside (Handle(GEOM_Object) theShape, + const std::vector& coords, + double tolerance = Precision::Confusion()); + Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2, Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, @@ -132,6 +148,8 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { Standard_EXPORT Standard_Real GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2); + Standard_EXPORT Standard_Real GetAngleBtwVectors (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2); + // Methods for recieving radiuses of curvature of curves and surfaces // in the given point diff --git a/src/GEOMImpl/GEOMImpl_IMirror.hxx b/src/GEOMImpl/GEOMImpl_IMirror.hxx index 513d81a30..569f95f96 100644 --- a/src/GEOMImpl/GEOMImpl_IMirror.hxx +++ b/src/GEOMImpl/GEOMImpl_IMirror.hxx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -//NOTE: This is an intreface to a function for the Mirror creation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +//NOTE: This is an interface to a function for the Mirror creation. + #include "GEOM_Function.hxx" #define MIRROR_ARG_ORIGINAL 1 diff --git a/src/GEOMImpl/GEOMImpl_IOffset.hxx b/src/GEOMImpl/GEOMImpl_IOffset.hxx index eb8821589..f70a2a1d2 100644 --- a/src/GEOMImpl/GEOMImpl_IOffset.hxx +++ b/src/GEOMImpl/GEOMImpl_IOffset.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Offset creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IPartition.hxx b/src/GEOMImpl/GEOMImpl_IPartition.hxx index ae5d9e2a7..ae2dd72be 100644 --- a/src/GEOMImpl/GEOMImpl_IPartition.hxx +++ b/src/GEOMImpl/GEOMImpl_IPartition.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Partition creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IPipe.hxx b/src/GEOMImpl/GEOMImpl_IPipe.hxx index 5b56e2454..fe349157a 100644 --- a/src/GEOMImpl/GEOMImpl_IPipe.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipe.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Pipe creation. // #ifndef _GEOMImpl_IPIPE_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx b/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx index 04ccfd371..14a86dba0 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an interface to a function for the Pipe creation. // #ifndef _GEOMImpl_IPIPEBINORMAL_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx index 3b51e624c..dbdb52601 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Pipe creation. // #ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx b/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx index 0afb7506f..0b3f35fd4 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeShellSect.hxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Pipe creation. // #ifndef _GEOMImpl_IPIPESHELLSECT_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx b/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx new file mode 100644 index 000000000..8048d0313 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx @@ -0,0 +1,95 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef _GEOMImpl_IPipeTShape_HXX_ +#define _GEOMImpl_IPipeTShape_HXX_ + +#include "GEOM_Function.hxx" + +#define TSHAPE_ARG_R1 1 +#define TSHAPE_ARG_W1 2 +#define TSHAPE_ARG_L1 3 +#define TSHAPE_ARG_R2 4 +#define TSHAPE_ARG_W2 5 +#define TSHAPE_ARG_L2 6 + +// chamfer +#define TSHAPE_ARG_H 7 +#define TSHAPE_ARG_W 8 + +// fillet +#define TSHAPE_ARG_RF 9 + +// partition +#define TSHAPE_ARG_HEXMESH 10 + +// junction points +#define TSHAPE_ARG_P1 11 +#define TSHAPE_ARG_P2 12 +#define TSHAPE_ARG_P3 13 + +class GEOMImpl_IPipeTShape +{ +public: + GEOMImpl_IPipeTShape(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetR1(double theR1) { _func->SetReal(TSHAPE_ARG_R1, theR1); } + double GetR1() { return _func->GetReal(TSHAPE_ARG_R1); } + + void SetW1(double theW1) { _func->SetReal(TSHAPE_ARG_W1, theW1); } + double GetW1() { return _func->GetReal(TSHAPE_ARG_W1); } + + void SetL1(double theL1) { _func->SetReal(TSHAPE_ARG_L1, theL1); } + double GetL1() { return _func->GetReal(TSHAPE_ARG_L1); } + + void SetR2(double theR2) { _func->SetReal(TSHAPE_ARG_R2, theR2); } + double GetR2() { return _func->GetReal(TSHAPE_ARG_R2); } + + void SetW2(double theW2) { _func->SetReal(TSHAPE_ARG_W2, theW2); } + double GetW2() { return _func->GetReal(TSHAPE_ARG_W2); } + + void SetL2(double theL2) { _func->SetReal(TSHAPE_ARG_L2, theL2); } + double GetL2() { return _func->GetReal(TSHAPE_ARG_L2); } + + void SetH(double theH) { _func->SetReal(TSHAPE_ARG_H, theH); } + double GetH() { return _func->GetReal(TSHAPE_ARG_H); } + + void SetW(double theW) { _func->SetReal(TSHAPE_ARG_W, theW); } + double GetW() { return _func->GetReal(TSHAPE_ARG_W); } + + void SetRF(double theRF) { _func->SetReal(TSHAPE_ARG_RF, theRF); } + double GetRF() { return _func->GetReal(TSHAPE_ARG_RF); } + + void SetHexMesh(int theHexMesh) { _func->SetInteger(TSHAPE_ARG_HEXMESH, theHexMesh); } + int GetHexMesh() { return _func->GetInteger(TSHAPE_ARG_HEXMESH); } + + void SetP1(const Handle(GEOM_Function)& theP1){_func->SetReference(TSHAPE_ARG_P1, theP1); } + Handle(GEOM_Function) GetP1() { return _func->GetReference(TSHAPE_ARG_P1); } + + void SetP2(const Handle(GEOM_Function)& theP2){_func->SetReference(TSHAPE_ARG_P2, theP2); } + Handle(GEOM_Function) GetP2() { return _func->GetReference(TSHAPE_ARG_P2); } + + void SetP3(const Handle(GEOM_Function)& theP3){_func->SetReference(TSHAPE_ARG_P3, theP3); } + Handle(GEOM_Function) GetP3() { return _func->GetReference(TSHAPE_ARG_P3); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // _GEOMImpl_IPipeTShape_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IPlane.hxx b/src/GEOMImpl/GEOMImpl_IPlane.hxx index fbd97d705..ebdca4a7b 100644 --- a/src/GEOMImpl/GEOMImpl_IPlane.hxx +++ b/src/GEOMImpl/GEOMImpl_IPlane.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the vector creation. // #include "GEOM_Function.hxx" @@ -37,6 +38,13 @@ #define PLN_ARG_PARAM_V 8 +#define PLN_ARG_VEC1 9 +#define PLN_ARG_VEC2 10 + +#define PLN_ARG_ORIENT 11 + +#define PLN_ARG_LCS 12 + class GEOMImpl_IPlane { public: @@ -46,11 +54,18 @@ class GEOMImpl_IPlane void SetSize(double theSize) { _func->SetReal(PLN_ARG_SIZE, theSize); } double GetSize() { return _func->GetReal(PLN_ARG_SIZE); } + + void SetOrientation(double theOrientation) { _func->SetReal(PLN_ARG_ORIENT, theOrientation); } + + double GetOrientation() { return _func->GetReal(PLN_ARG_ORIENT); } void SetPoint (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT1, theRef); } void SetVector(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_VEC , theRef); } + void SetVector1(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_VEC1 , theRef); } + void SetVector2(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_VEC2 , theRef); } void SetFace (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_REF , theRef); } + void SetLCS (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_LCS , theRef); } void SetPoint1(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT1, theRef); } void SetPoint2(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT2, theRef); } @@ -58,8 +73,11 @@ class GEOMImpl_IPlane Handle(GEOM_Function) GetPoint () { return _func->GetReference(PLN_ARG_PNT1); } Handle(GEOM_Function) GetVector() { return _func->GetReference(PLN_ARG_VEC ); } + Handle(GEOM_Function) GetVector1() { return _func->GetReference(PLN_ARG_VEC1 ); } + Handle(GEOM_Function) GetVector2() { return _func->GetReference(PLN_ARG_VEC2 ); } Handle(GEOM_Function) GetFace () { return _func->GetReference(PLN_ARG_REF ); } + Handle(GEOM_Function) GetLCS () { return _func->GetReference(PLN_ARG_LCS ); } Handle(GEOM_Function) GetPoint1() { return _func->GetReference(PLN_ARG_PNT1); } Handle(GEOM_Function) GetPoint2() { return _func->GetReference(PLN_ARG_PNT2); } diff --git a/src/GEOMImpl/GEOMImpl_IPoint.hxx b/src/GEOMImpl/GEOMImpl_IPoint.hxx index 61b2ae8bc..85267e0ec 100755 --- a/src/GEOMImpl/GEOMImpl_IPoint.hxx +++ b/src/GEOMImpl/GEOMImpl_IPoint.hxx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -//NOTE: This is an intreface to a function for the point creation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +//NOTE: This is an interface to a function for the point creation. + #include "GEOM_Function.hxx" #define ARG_X 1 @@ -37,6 +38,10 @@ #define ARG_SURFACE 9 #define ARG_PARAM2 10 +#define ARG_LENGTH 11 + +//#define ARG_FLAG 12 + class GEOMImpl_IPoint { public: @@ -67,9 +72,13 @@ class GEOMImpl_IPoint void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); } void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); } + void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); } + //void SetReversed(bool theReversed) { _func->SetInteger(ARG_FLAG, theReversed); } double GetParameter() { return _func->GetReal(ARG_PARAM); } double GetParameter2() { return _func->GetReal(ARG_PARAM2); } + double GetLength() { return _func->GetReal(ARG_LENGTH); } + //bool GetReversed() { return _func->GetInteger(ARG_FLAG); } private: diff --git a/src/GEOMImpl/GEOMImpl_IPolyline.hxx b/src/GEOMImpl/GEOMImpl_IPolyline.hxx index 5c0c80ad3..3375e8721 100644 --- a/src/GEOMImpl/GEOMImpl_IPolyline.hxx +++ b/src/GEOMImpl/GEOMImpl_IPolyline.hxx @@ -1,30 +1,36 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -//NOTE: This is an intreface to a function for the Polyline creation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +//NOTE: This is an interface to a function for the Polyline creation. + #include "GEOM_Function.hxx" +#include #define POLY_ARG_LENG 1 #define POLY_ARG_LAST 1 +#define POLY_ARG_CLOS 2 + +#define POLY_CONSTRUCTOR 3 +#define POLY_ARG_ARRAY 4 class GEOMImpl_IPolyline { @@ -36,10 +42,26 @@ class GEOMImpl_IPolyline void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(POLY_ARG_LAST + theId, theP); } + void SetIsClosed(bool theIsClosed) { _func->SetInteger(POLY_ARG_CLOS, (int)theIsClosed); } + int GetLength() { return _func->GetInteger(POLY_ARG_LENG); } Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(POLY_ARG_LAST + theId); } + bool GetIsClosed() { return (bool)_func->GetInteger(POLY_ARG_CLOS); } + + void SetConstructorType(int theConstructor) {_func->SetInteger(POLY_CONSTRUCTOR,theConstructor); } + + int GetConstructorType() { return _func->GetInteger(POLY_CONSTRUCTOR); } + + void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue) + { _func->SetRealArray(POLY_ARG_ARRAY, theValue); } + + + Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(POLY_ARG_ARRAY); } + + + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IPosition.hxx b/src/GEOMImpl/GEOMImpl_IPosition.hxx index 5d42d5d92..ccfc0505b 100644 --- a/src/GEOMImpl/GEOMImpl_IPosition.hxx +++ b/src/GEOMImpl/GEOMImpl_IPosition.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Setting In Position. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IPrism.hxx b/src/GEOMImpl/GEOMImpl_IPrism.hxx index f3496f0d9..0e28b29ac 100644 --- a/src/GEOMImpl/GEOMImpl_IPrism.hxx +++ b/src/GEOMImpl/GEOMImpl_IPrism.hxx @@ -1,36 +1,43 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Prism creation. -// + #include "GEOM_Function.hxx" +// #include TEST -#define PRISM_ARG_H 1 -#define PRISM_ARG_VEC 2 -#define PRISM_ARG_BASE 3 -#define PRISM_ARG_PNT_F 4 -#define PRISM_ARG_PNT_L 5 -#define PRISM_ARG_DX 6 -#define PRISM_ARG_DY 7 -#define PRISM_ARG_DZ 8 +#define PRISM_ARG_H 1 +#define PRISM_ARG_VEC 2 +#define PRISM_ARG_BASE 3 +#define PRISM_ARG_PNT_F 4 +#define PRISM_ARG_PNT_L 5 +#define PRISM_ARG_DX 6 +#define PRISM_ARG_DY 7 +#define PRISM_ARG_DZ 8 +#define PRISM_ARG_SCALE 9 +#define PRISM_ARG_DRAFT 10 +#define PRISM_ARG_FUSE 11 +#define PRISM_ARG_INIT 12 +#define PRISM_ARG_MODE 13 class GEOMImpl_IPrism { @@ -38,10 +45,17 @@ class GEOMImpl_IPrism GEOMImpl_IPrism(Handle(GEOM_Function) theFunction): _func(theFunction) {} - void SetBase (Handle(GEOM_Function) theRefBase ) { _func->SetReference(PRISM_ARG_BASE, theRefBase); } - void SetVector(Handle(GEOM_Function) theRefVector) { _func->SetReference(PRISM_ARG_VEC , theRefVector); } - void SetFirstPoint(Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_F, thePoint); } - void SetLastPoint (Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_L, thePoint); } + void SetBase (Handle(GEOM_Function) theRefBase ) { _func->SetReference(PRISM_ARG_BASE, theRefBase); } + void SetVector(Handle(GEOM_Function) theRefVector ) { _func->SetReference(PRISM_ARG_VEC , theRefVector); } + void SetFirstPoint(Handle(GEOM_Function) thePoint ) { _func->SetReference(PRISM_ARG_PNT_F, thePoint); } + void SetLastPoint (Handle(GEOM_Function) thePoint ) { _func->SetReference(PRISM_ARG_PNT_L, thePoint); } + void SetInitShape (Handle(GEOM_Function) theInitShape) { _func->SetReference(PRISM_ARG_INIT, theInitShape); } + + Handle(GEOM_Function) GetBase () { return _func->GetReference(PRISM_ARG_BASE); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(PRISM_ARG_VEC ); } + Handle(GEOM_Function) GetFirstPoint() { return _func->GetReference(PRISM_ARG_PNT_F ); } + Handle(GEOM_Function) GetLastPoint () { return _func->GetReference(PRISM_ARG_PNT_L ); } + Handle(GEOM_Function) GetInitShape () { return _func->GetReference(PRISM_ARG_INIT ); } void SetDX(double theDX) { _func->SetReal(PRISM_ARG_DX, theDX); } void SetDY(double theDY) { _func->SetReal(PRISM_ARG_DY, theDY); } @@ -51,14 +65,19 @@ class GEOMImpl_IPrism double GetDY() { return _func->GetReal(PRISM_ARG_DY); } double GetDZ() { return _func->GetReal(PRISM_ARG_DZ); } - Handle(GEOM_Function) GetBase () { return _func->GetReference(PRISM_ARG_BASE); } - Handle(GEOM_Function) GetVector() { return _func->GetReference(PRISM_ARG_VEC ); } - Handle(GEOM_Function) GetFirstPoint() { return _func->GetReference(PRISM_ARG_PNT_F ); } - Handle(GEOM_Function) GetLastPoint () { return _func->GetReference(PRISM_ARG_PNT_L ); } + void SetH (double theH ) { _func->SetReal(PRISM_ARG_H, theH); } + void SetScale (double theH ) { _func->SetReal(PRISM_ARG_SCALE, theH); } + void SetDraftAngle(double theAngle) { _func->SetReal(PRISM_ARG_DRAFT, theAngle); } - void SetH(double theH) { _func->SetReal(PRISM_ARG_H, theH); } + double GetH() { return _func->GetReal(PRISM_ARG_H); } + double GetScale() { return _func->GetReal(PRISM_ARG_SCALE); } + double GetDraftAngle() { return _func->GetReal(PRISM_ARG_DRAFT); } + + void SetFuseFlag(int theFlag) { _func->SetInteger(PRISM_ARG_FUSE, theFlag); } +// void SetMode(GEOMImpl_Mode theMode) { _func->SetInteger(PRISM_ARG_MODE, theMode); } //TEST - double GetH() { return _func->GetReal(PRISM_ARG_H); } + int GetFuseFlag() { return _func->GetInteger(PRISM_ARG_FUSE); } +// GEOMImpl_Mode GetMode() { return _func->GetInteger(PRISM_ARG_MODE); } //TEST private: diff --git a/src/GEOMImpl/GEOMImpl_IRevolution.hxx b/src/GEOMImpl/GEOMImpl_IRevolution.hxx index a02b7ad73..ffca037bb 100644 --- a/src/GEOMImpl/GEOMImpl_IRevolution.hxx +++ b/src/GEOMImpl/GEOMImpl_IRevolution.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Revolution creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IRotate.hxx b/src/GEOMImpl/GEOMImpl_IRotate.hxx index e4a603070..cbe19f34a 100644 --- a/src/GEOMImpl/GEOMImpl_IRotate.hxx +++ b/src/GEOMImpl/GEOMImpl_IRotate.hxx @@ -1,37 +1,43 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -//NOTE: This is an intreface to a function for the Rotate operation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// NOTE: This is an interface to a function for the Rotate operation. + #include "GEOM_Function.hxx" +#include + #define ROTATE_ANGLE 1 #define ROTATE_AXIS 2 #define ROTATE_ORGN 3 #define ROTATE_STEP1 4 -#define ROTATE_NBITER1 5 -#define ROTATE_NBITER2 6 +#define ROTATE_NBITER1 5 +#define ROTATE_NBITER2 6 #define ROTATE_CENTRAL_POINT 7 #define ROTATE_POINT1 8 #define ROTATE_POINT2 9 +#define ROTATE_DIR2_X 10 +#define ROTATE_DIR2_Y 11 +#define ROTATE_DIR2_Z 12 class GEOMImpl_IRotate { @@ -63,7 +69,7 @@ class GEOMImpl_IRotate Handle(GEOM_Function) GetOriginal() { return _func->GetReference(ROTATE_ORGN); } - void SetStep(double theStep) { return _func->SetReal(ROTATE_STEP1, theStep); } + void SetStep(double theStep) { _func->SetReal(ROTATE_STEP1, theStep); } double GetStep() { return _func->GetReal(ROTATE_STEP1); } @@ -75,6 +81,21 @@ class GEOMImpl_IRotate int GetNbIter2() { return _func->GetInteger(ROTATE_NBITER2); } + void SetDir2 (gp_XYZ theDir2) + { + _func->SetReal(ROTATE_DIR2_X, theDir2.X()); + _func->SetReal(ROTATE_DIR2_Y, theDir2.Y()); + _func->SetReal(ROTATE_DIR2_Z, theDir2.Z()); + } + + gp_XYZ GetDir2() + { + gp_XYZ aRes (0., 0., 0.); + aRes.SetX(_func->GetReal(ROTATE_DIR2_X)); + aRes.SetY(_func->GetReal(ROTATE_DIR2_Y)); + aRes.SetZ(_func->GetReal(ROTATE_DIR2_Z)); + return aRes; + } private: diff --git a/src/GEOMImpl/GEOMImpl_IScale.hxx b/src/GEOMImpl/GEOMImpl_IScale.hxx index bcbd0493e..54731b8bf 100644 --- a/src/GEOMImpl/GEOMImpl_IScale.hxx +++ b/src/GEOMImpl/GEOMImpl_IScale.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Scale creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IShapes.hxx b/src/GEOMImpl/GEOMImpl_IShapes.hxx index a4efd5161..e3238cb79 100644 --- a/src/GEOMImpl/GEOMImpl_IShapes.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapes.hxx @@ -1,45 +1,47 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// NOTE: This is an intreface to a function for the Shapes -// (Wire, Face, Shell, Solid and Compound) creation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// NOTE: This is an interface to a function for the Shapes +// (Edge, Wire, Face, Shell, Solid and Compound) creation. + #include "GEOM_Function.hxx" #include "TColStd_HSequenceOfTransient.hxx" #include "TColStd_HArray1OfInteger.hxx" -#define SHAPE_ARG_SHAPES 1 // for Wire, Shell, Solid and Compound - -#define SHAPE_ARG_BASE 2 // for Face, Solid and Sub-shape - -#define SHAPE_ARG_PLANAR 3 // for Face - -#define SHAPE_ARG_SUBTYPE 4 // for Sub-shape -#define SHAPE_ARG_INDICES 5 // for Sub-shape - class GEOMImpl_IShapes { public: + enum { + SHAPE_ARG_SHAPES = 1, // for Wire, Shell, Solid and Compound + SHAPE_ARG_BASE = 2, // for Face, Solid and Sub-shape + SHAPE_ARG_PLANAR = 3, // for Face + SHAPE_ARG_SUBTYPE = 4, // for Sub-shape + SHAPE_ARG_INDICES = 5, // for Sub-shape + SHAPE_ARG_TOLERANCE = 6, // linear tolerance (for Wire, Edge) + SHAPE_ARG_ANGLE_TOL = 7, // angular tolerance (for Edge) + }; + GEOMImpl_IShapes(Handle(GEOM_Function) theFunction): _func(theFunction) {} void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes) @@ -69,6 +71,16 @@ class GEOMImpl_IShapes Handle(TColStd_HArray1OfInteger) GetIndices() { return _func->GetIntegerArray(SHAPE_ARG_INDICES); } + void SetTolerance(const Standard_Real theValue) + { _func->SetReal(SHAPE_ARG_TOLERANCE, theValue); } + + Standard_Real GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); } + + void SetAngularTolerance(const Standard_Real theValue) + { _func->SetReal(SHAPE_ARG_ANGLE_TOL, theValue); } + + Standard_Real GetAngularTolerance() { return _func->GetReal(SHAPE_ARG_ANGLE_TOL); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 09a2477a7..682311302 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -1,30 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 -// -// File : GEOMImpl_IShapesOperations.cxx -// Created : -// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 -// Project : SALOME -// $Header$ +// 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 + +// File : GEOMImpl_IShapesOperations.cxx +// Created : +// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 +// Project : SALOME + #include #include "GEOMImpl_IShapesOperations.hxx" @@ -41,21 +40,27 @@ #include "GEOMImpl_IGlue.hxx" #include "GEOMImpl_Block6Explorer.hxx" +#include "GEOMImpl_IHealingOperations.hxx" + +#include #include "GEOM_Function.hxx" #include "GEOM_ISubShape.hxx" #include "GEOM_PythonDump.hxx" +#include "GEOMAlgo_ClsfBox.hxx" +#include "GEOMAlgo_ClsfSolid.hxx" +#include "GEOMAlgo_CoupleOfShapes.hxx" #include "GEOMAlgo_FinderShapeOn1.hxx" #include "GEOMAlgo_FinderShapeOnQuad.hxx" #include "GEOMAlgo_FinderShapeOn2.hxx" -#include "GEOMAlgo_ClsfBox.hxx" -#include "GEOMAlgo_ClsfSolid.hxx" -#include "GEOMAlgo_Gluer1.hxx" +#include "GEOMAlgo_GetInPlace.hxx" +#include "GEOMAlgo_GlueDetector.hxx" #include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" -#include "GEOMAlgo_CoupleOfShapes.hxx" #include "GEOMAlgo_ListOfCoupleOfShapes.hxx" +#include + #include "utilities.h" #include "OpUtil.hxx" #include "Utils_ExceptHandlers.hxx" @@ -65,6 +70,7 @@ #include #include #include +#include #include #include @@ -77,11 +83,12 @@ #include #include #include -#include #include #include #include +#include +#include #include #include #include @@ -90,13 +97,12 @@ #include #include #include -#include -#include -#include -#include #include -#include +#include #include +#include +#include +#include #include #include @@ -109,14 +115,17 @@ #include #include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include #include +#include +#include #include #include @@ -132,6 +141,8 @@ #include #include +#define STD_SORT_ALGO 1 + //============================================================================= /*! * constructor: @@ -186,7 +197,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdge //Compute the Edge value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -208,15 +219,209 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdge return anEdge; } +//============================================================================= +/*! + * MakeEdgeOnCurveByLength + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdgeOnCurveByLength + (Handle(GEOM_Object) theRefCurve, + const Standard_Real theLength, + Handle(GEOM_Object) theStartPoint) +{ + SetErrorCode(KO); + + if (theRefCurve.IsNull()) return NULL; + + //Add a new Edge object + Handle(GEOM_Object) anEdge = GetEngine()->AddObject(GetDocID(), GEOM_EDGE); + + //Add a new Vector function + Handle(GEOM_Function) aFunction = + anEdge->AddFunction(GEOMImpl_ShapeDriver::GetID(), EDGE_CURVE_LENGTH); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IVector aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theRefCurve->GetLastFunction(); + if (aRef1.IsNull()) return NULL; + aPI.SetPoint1(aRef1); + + if (!theStartPoint.IsNull()) { + Handle(GEOM_Function) aRef2 = theStartPoint->GetLastFunction(); + aPI.SetPoint2(aRef2); + } + + aPI.SetParameter(theLength); + + //Compute the Edge value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Vector driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << anEdge << " = geompy.MakeEdgeOnCurveByLength(" + << theRefCurve << ", " << theLength << ", " << theStartPoint << ")"; + + SetErrorCode(OK); + return anEdge; +} + +//============================================================================= +/*! + * MakeEdgeWire + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdgeWire + (Handle(GEOM_Object) theWire, + const Standard_Real theLinearTolerance, + const Standard_Real theAngularTolerance) +{ + SetErrorCode(KO); + + if (theWire.IsNull()) return NULL; + + //Add a new Edge object + Handle(GEOM_Object) anEdge = GetEngine()->AddObject(GetDocID(), GEOM_EDGE); + + //Add a new Vector function + Handle(GEOM_Function) aFunction = + anEdge->AddFunction(GEOMImpl_ShapeDriver::GetID(), EDGE_WIRE); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aCI (aFunction); + + Handle(GEOM_Function) aWire = theWire->GetLastFunction(); + + if (aWire.IsNull()) return NULL; + + aCI.SetBase(aWire); + aCI.SetTolerance(theLinearTolerance); + aCI.SetAngularTolerance(theAngularTolerance); + + //Compute the Edge value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + const double DEF_LIN_TOL = Precision::Confusion(); + const double DEF_ANG_TOL = Precision::Angular(); + //Make a Python command + if ( theAngularTolerance == DEF_ANG_TOL ) { + if ( theLinearTolerance == DEF_LIN_TOL ) + GEOM::TPythonDump(aFunction) << anEdge << " = geompy.MakeEdgeWire(" + << theWire << ")"; + else + GEOM::TPythonDump(aFunction) << anEdge << " = geompy.MakeEdgeWire(" + << theWire << ", " << theLinearTolerance << ")"; + } + else { + GEOM::TPythonDump(aFunction) << anEdge << " = geompy.MakeEdgeWire(" + << theWire << ", " << theLinearTolerance << ", " + << theAngularTolerance << ")"; + } + + SetErrorCode(OK); + return anEdge; +} + //============================================================================= /*! * MakeWire */ //============================================================================= Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeWire - (std::list theShapes) + (std::list theShapes, + const Standard_Real theTolerance) { - return MakeShape(theShapes, GEOM_WIRE, WIRE_EDGES, "MakeWire"); + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aWire = GetEngine()->AddObject(GetDocID(), GEOM_WIRE); + + //Add a new function + Handle(GEOM_Function) aFunction = + aWire->AddFunction(GEOMImpl_ShapeDriver::GetID(), WIRE_EDGES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aCI (aFunction); + aCI.SetTolerance(theTolerance); + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + + // Shapes + std::list::iterator it = theShapes.begin(); + for (; it != theShapes.end(); it++) { + Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL argument shape for the shape construction"); + return NULL; + } + aShapesSeq->Append(aRefSh); + } + aCI.SetShapes(aShapesSeq); + + //Compute the shape + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aWire << " = geompy.MakeWire(["; + + // Shapes + it = theShapes.begin(); + if (it != theShapes.end()) { + pd << (*it++); + while (it != theShapes.end()) { + pd << ", " << (*it++); + } + } + pd << "], " << theTolerance << ")"; + + SetErrorCode(OK); + return aWire; } //============================================================================= @@ -252,8 +457,9 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFace (Handle(GEOM_Object) th aCI.SetIsPlanar(isPlanarWanted); //Compute the Face value + Standard_Boolean isWarning = Standard_False; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -264,14 +470,20 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFace (Handle(GEOM_Object) th catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); - return NULL; + // to provide warning + if (!aFunction->GetValue().IsNull()) { + isWarning = Standard_True; + } else { + return NULL; + } } //Make a Python command GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFace(" << theWire << ", " << (int)isPlanarWanted << ")"; - SetErrorCode(OK); + // to provide warning + if (!isWarning) SetErrorCode(OK); return aFace; } @@ -316,8 +528,9 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires aCI.SetIsPlanar(isPlanarWanted); //Compute the shape + Standard_Boolean isWarning = Standard_False; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -328,7 +541,12 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); - return NULL; + // to provide warning + if (!aFunction->GetValue().IsNull()) { + isWarning = Standard_True; + } else { + return NULL; + } } //Make a Python command @@ -345,7 +563,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires } pd << "], " << (int)isPlanarWanted << ")"; - SetErrorCode(OK); + // to provide warning + if (!isWarning) SetErrorCode(OK); return aShape; } @@ -371,60 +590,6 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShells return MakeShape(theShapes, GEOM_SOLID, SOLID_SHELLS, "MakeSolid"); } -//============================================================================= -/*! - * MakeSolidShell - */ -//============================================================================= -Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShell (Handle(GEOM_Object) theShell) -{ - SetErrorCode(KO); - - if (theShell.IsNull()) return NULL; - - //Add a new Solid object - Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID); - - //Add a new Solid function for creation of a solid from a shell - Handle(GEOM_Function) aFunction = - aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL); - if (aFunction.IsNull()) return NULL; - - //Check if the function is set correctly - if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; - - GEOMImpl_IShapes aCI (aFunction); - - Handle(GEOM_Function) aRefShell = theShell->GetLastFunction(); - - if (aRefShell.IsNull()) return NULL; - - aCI.SetBase(aRefShell); - - //Compute the Solid value - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if (!GetSolver()->ComputeFunction(aFunction)) { - SetErrorCode("Solid driver failed"); - return NULL; - } - } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); - return NULL; - } - - //Make a Python command - GEOM::TPythonDump(aFunction) << aSolid - << " = geompy.MakeSolid(" << theShell << ")"; - - SetErrorCode(OK); - return aSolid; -} - //============================================================================= /*! * MakeCompound @@ -442,7 +607,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeCompound */ //============================================================================= Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape - (std::list theShapes, + (std::list theShapes, const Standard_Integer theObjectType, const Standard_Integer theFunctionType, const TCollection_AsciiString& theMethodName) @@ -478,7 +643,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape //Compute the shape try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -547,7 +712,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces //Compute the sub-shape value Standard_Boolean isWarning = Standard_False; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -580,6 +745,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces * GetGlueFaces */ //============================================================================= +/* Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces (Handle(GEOM_Object) theShape, const Standard_Real theTolerance) @@ -637,17 +803,19 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces } //Make a Python command - if(anAsciiList.Length()>0) + if( anAsciiList.Length() > 0 ) { anAsciiList.Trunc(anAsciiList.Length() - 1); - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); - GEOM::TPythonDump pd (aFunction, /*append=*/true); - pd << "[" << anAsciiList.ToCString(); - pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")"; + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + GEOM::TPythonDump pd (aFunction, true); + pd << "[" << anAsciiList.ToCString(); + pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")"; + } SetErrorCode(OK); return aSeq; } +*/ //============================================================================= /*! @@ -657,8 +825,9 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList (Handle(GEOM_Object) theShape, const Standard_Real theTolerance, - std::list theFaces, - const Standard_Boolean doKeepNonSolids) + std::list theFaces, + const Standard_Boolean doKeepNonSolids, + const Standard_Boolean doGlueAllEdges) { SetErrorCode(KO); @@ -683,6 +852,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList aCI.SetBase(aRefShape); aCI.SetTolerance(theTolerance); aCI.SetKeepNonSolids(doKeepNonSolids); + aCI.SetGlueAllEdges(doGlueAllEdges); Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient; std::list::iterator it = theFaces.begin(); @@ -699,7 +869,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList //Compute the sub-shape value Standard_Boolean isWarning = Standard_False; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -731,6 +901,244 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList pd << ", " << (*it++); } } + pd << "], " << (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")"; + + // to provide warning + if (!isWarning) SetErrorCode(OK); + return aGlued; +} + +//============================================================================= +/*! + * MakeGlueEdges + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + //Add a new Glued object + Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED); + + //Add a new Glue function + Handle(GEOM_Function) aFunction; + aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_EDGES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL; + + GEOMImpl_IGlue aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetBase(aRefShape); + aCI.SetTolerance(theTolerance); + aCI.SetKeepNonSolids(true); + + //Compute the sub-shape value + Standard_Boolean isWarning = Standard_False; + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed to glue edges"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + // to provide warning + if (!aFunction->GetValue().IsNull()) { + isWarning = Standard_True; + } else { + return NULL; + } + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueEdges(" + << theShape << ", " << theTolerance << ")"; + + // to provide warning + if (!isWarning) SetErrorCode(OK); + return aGlued; +} + +//============================================================================= +/*! + * GetGlueShapes + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance, + const TopAbs_ShapeEnum theType) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + + GEOMAlgo_GlueDetector aGluer; + aGluer.SetArgument(aShape); + aGluer.SetTolerance(theTolerance); + aGluer.Perform(); + Standard_Integer iErr = aGluer.ErrorStatus(); + if (iErr) return NULL; + + TCollection_AsciiString anAsciiList, anEntry; + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + Handle(GEOM_Object) anObj; + + TopTools_ListOfShape listOnePerSet; + + const TopTools_DataMapOfShapeListOfShape& aImages = aGluer.Images(); + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS (aImages); + for (int index = 1; aItDMSLS.More(); aItDMSLS.Next(), ++index) { + // some key shape + //const TopoDS_Shape& aSkey = aItDMSLS.Key(); + + // list of shapes of the argument that can be glued + const TopTools_ListOfShape& aLSD = aItDMSLS.Value(); + + //listShape.Append(aLSD.First()); + TopoDS_Shape aValue = aLSD.First(); + + if (aValue.ShapeType() == theType) { + listOnePerSet.Append(aValue); + } + } + + // for stable order of returned entities + GEOMImpl_IShapesOperations::SortShapes(listOnePerSet, Standard_False); + + TopTools_ListIteratorOfListOfShape aListIt (listOnePerSet); + for (; aListIt.More(); aListIt.Next()) { + TopoDS_Shape aValue = aListIt.Value(); + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aValue)); + anObj = GetEngine()->AddSubShape(theShape, anArray); + if (!anObj.IsNull()) { + aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; + } + } + + // Make a Python command + if (anAsciiList.Length() > 0) { + anAsciiList.Trunc(anAsciiList.Length() - 1); + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + GEOM::TPythonDump pd (aFunction, /*append=*/true); + pd << "[" << anAsciiList.ToCString(); + if (theType == TopAbs_FACE) + pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")"; + else if (theType == TopAbs_EDGE) + pd << "] = geompy.GetGlueEdges(" << theShape << ", " << theTolerance << ")"; + } + + SetErrorCode(OK); + + return aSeq; +} + +//============================================================================= +/*! + * MakeGlueEdgesByList + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance, + std::list theEdges) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + //Add a new Glued object + Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED); + + //Add a new Glue function + Handle(GEOM_Function) aFunction; + aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_EDGES_BY_LIST); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL; + + GEOMImpl_IGlue aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetBase(aRefShape); + aCI.SetTolerance(theTolerance); + aCI.SetKeepNonSolids(true); + + Handle(TColStd_HSequenceOfTransient) anEdges = new TColStd_HSequenceOfTransient; + std::list::iterator it = theEdges.begin(); + for (; it != theEdges.end(); it++) { + Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL argument shape for the shape construction"); + return NULL; + } + anEdges->Append(aRefSh); + } + aCI.SetFaces(anEdges); + + //Compute the sub-shape value + Standard_Boolean isWarning = Standard_False; + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed to glue edges"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + // to provide warning + if (!aFunction->GetValue().IsNull()) { + isWarning = Standard_True; + } else { + return NULL; + } + } + + //Make a Python command + + GEOM::TPythonDump pd (aFunction); + pd << aGlued << " = geompy.MakeGlueEdgesByList(" + << theShape << ", " << theTolerance << ", ["; + // Edges + it = theEdges.begin(); + if (it != theEdges.end()) { + pd << (*it++); + while (it != theEdges.end()) { + pd << ", " << (*it++); + } + } pd << "])"; // to provide warning @@ -738,6 +1146,70 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList return aGlued; } +//============================================================================= +/*! + * GetExistingSubObjects + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetExistingSubObjects + (Handle(GEOM_Object) theShape, + const Standard_Boolean theGroupsOnly) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + Handle(GEOM_Function) aMainShape = theShape->GetLastFunction(); + if (aMainShape.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + SetErrorCode(NOT_FOUND_ANY); + + if (!aMainShape->HasSubShapeReferences()) return aSeq; + const TDataStd_ListOfExtendedString& aListEntries = aMainShape->GetSubShapeReferences(); + if (aListEntries.IsEmpty()) return aSeq; + + SetErrorCode(KO); + + TCollection_AsciiString anAsciiList; + + TDataStd_ListIteratorOfListOfExtendedString anIt (aListEntries); + for (; anIt.More(); anIt.Next()) { + TCollection_ExtendedString anEntry = anIt.Value(); + Standard_Integer aStrLen = anEntry.LengthOfCString(); + char* anEntryStr = new char[aStrLen]; + anEntry.ToUTF8CString(anEntryStr); + Handle(GEOM_Object) anObj = GetEngine()->GetObject(GetDocID(), anEntryStr, false); + if (!anObj.IsNull()) { + if (!theGroupsOnly || anObj->GetType() == GEOM_GROUP) { + aSeq->Append(anObj); + + // for python command + anAsciiList += anEntryStr; + anAsciiList += ","; + } + } + delete [] anEntryStr; + } + + if (aSeq->Length() == 0) { + SetErrorCode(NOT_FOUND_ANY); + return aSeq; + } + + //Make a Python command + anAsciiList.Trunc(anAsciiList.Length() - 1); + + GEOM::TPythonDump pd (aMainShape, /*append=*/true); + pd << "[" << anAsciiList.ToCString(); + pd << "] = geompy.GetExistingSubObjects("; + pd << theShape << ", " << (bool)theGroupsOnly << ")"; + + SetErrorCode(OK); + + return aSeq; +} + //============================================================================= /*! * MakeExplode @@ -746,7 +1218,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode (Handle(GEOM_Object) theShape, const Standard_Integer theShapeType, - const Standard_Boolean isSorted) + const Standard_Boolean isSorted, + const ExplodeType theExplodeType) { SetErrorCode(KO); @@ -764,7 +1237,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode if (aShape.ShapeType() == TopAbs_COMPOUND && (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID || - TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) { + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) + { TopoDS_Iterator It (aShape, Standard_True, Standard_True); for (; It.More(); It.Next()) { if (mapShape.Add(It.Value())) { @@ -774,11 +1248,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode } } } - } else { + } + else if (theExplodeType != EXPLODE_NEW_EXCLUDE_MAIN || aShape.ShapeType() != theShapeType) // issue 0021079 + { TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType)); for (; exp.More(); exp.Next()) if (mapShape.Add(exp.Current())) - listShape.Append(exp.Current()); + listShape.Append(exp.Current()); } if (listShape.IsEmpty()) { @@ -787,8 +1263,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode return aSeq; } - if (isSorted) - SortShapes(listShape); + if (isSorted) { + bool isOldSorting = false; + if (theExplodeType == EXPLODE_OLD_INCLUDE_MAIN) + isOldSorting = true; + SortShapes(listShape, isOldSorting); + } TopTools_IndexedMapOfShape anIndices; TopExp::MapShapes(aShape, anIndices); @@ -817,6 +1297,9 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode // because GEOM_SubShapeDriver will build TopTools_IndexedMapOfShape // on the main shape for each being calculated sub-shape separately. aFunction->SetValue(aValue); + + // Put this subshape in the list of sub-shapes of theMainShape + aMainShape->AddSubShapeReference(aFunction); } if (!anObj.IsNull()) { @@ -833,10 +1316,22 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode anAsciiList.Trunc(anAsciiList.Length() - 1); GEOM::TPythonDump pd (aMainShape, /*append=*/true); - pd << "[" << anAsciiList.ToCString(); - pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "("); - pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; - + pd << "[" << anAsciiList.ToCString() << "] = geompy."; + switch (theExplodeType) { + case EXPLODE_NEW_EXCLUDE_MAIN: + pd << "ExtractShapes(" << theShape << ", " + << TopAbs_ShapeEnum(theShapeType) << ", " << (isSorted ? "True" : "False") << ")"; + break; + case EXPLODE_NEW_INCLUDE_MAIN: + pd << "SubShapeAll" << (isSorted ? "SortedCentres(" : "(") + << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; + break; + case EXPLODE_OLD_INCLUDE_MAIN: + pd << "SubShapeAll" << (isSorted ? "Sorted(" : "(") + << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; + break; + default: ; + } SetErrorCode(OK); return aSeq; @@ -850,7 +1345,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs (Handle(GEOM_Object) theShape, const Standard_Integer theShapeType, - const Standard_Boolean isSorted) + const Standard_Boolean isSorted, + const ExplodeType theExplodeType) { SetErrorCode(KO); @@ -865,7 +1361,8 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs if (aShape.ShapeType() == TopAbs_COMPOUND && (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID || - TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) { + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) + { TopoDS_Iterator It (aShape, Standard_True, Standard_True); for (; It.More(); It.Next()) { if (mapShape.Add(It.Value())) { @@ -875,11 +1372,13 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs } } } - } else { + } + else if (theExplodeType != EXPLODE_NEW_EXCLUDE_MAIN || aShape.ShapeType() != theShapeType) // issue 0021079 + { TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType)); for (; exp.More(); exp.Next()) if (mapShape.Add(exp.Current())) - listShape.Append(exp.Current()); + listShape.Append(exp.Current()); } if (listShape.IsEmpty()) { @@ -888,8 +1387,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs return aSeq; } - if (isSorted) - SortShapes(listShape); + if (isSorted) { + bool isOldSorting = false; + if (theExplodeType == EXPLODE_OLD_INCLUDE_MAIN) + isOldSorting = true; + SortShapes(listShape, isOldSorting); + } TopTools_IndexedMapOfShape anIndices; TopExp::MapShapes(aShape, anIndices); @@ -906,8 +1409,19 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs //Make a Python command GEOM::TPythonDump pd (aFunction, /*append=*/true); pd << "listSubShapeIDs = geompy.SubShapeAll"; - pd << (isSorted ? "SortedIDs(" : "IDs("); - pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; + switch (theExplodeType) { + case EXPLODE_NEW_EXCLUDE_MAIN: + break; + case EXPLODE_NEW_INCLUDE_MAIN: + pd << (isSorted ? "SortedCentresIDs(" : "IDs(") + << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; + break; + case EXPLODE_OLD_INCLUDE_MAIN: + pd << (isSorted ? "SortedIDs(" : "IDs(") + << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; + break; + default: ; + } SetErrorCode(OK); return aSeq; @@ -944,6 +1458,89 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetSubShape return anObj; } +//============================================================================= +/*! + * MakeSubShapes + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeSubShapes + (Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices) +{ + SetErrorCode(KO); + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + + if (!theIndices->Length()) { + SetErrorCode(NOT_FOUND_ANY); + return aSeq; + } + + if (theMainShape.IsNull()) return NULL; + TopoDS_Shape aShape = theMainShape->GetValue(); + if (aShape.IsNull()) return NULL; + + Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction(); + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + + Handle(TColStd_HArray1OfInteger) anArray; + Handle(GEOM_Object) anObj; + + TCollection_AsciiString anAsciiList, anEntry; + Standard_Integer i, low = theIndices->Lower(), up = theIndices->Upper(); + for (i = low; i <= up; i++) { + int id = theIndices->Value(i); + if (1 <= id && id <= anIndices.Extent()) { + TopoDS_Shape aValue = anIndices.FindKey(id); + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, id); + + anObj = GetEngine()->AddObject(GetDocID(), GEOM_SUBSHAPE); + if (!anObj.IsNull()) { + Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOM_Object::GetSubShapeID(), 1); + if (aFunction.IsNull()) return aSeq; + + GEOM_ISubShape aSSI (aFunction); + aSSI.SetMainShape(aMainShape); + aSSI.SetIndices(anArray); + + // Set function value directly, as we know it. + // Usage of Solver here would lead to significant loss of time, + // because GEOM_SubShapeDriver will build TopTools_IndexedMapOfShape + // on the main shape for each being calculated sub-shape separately. + aFunction->SetValue(aValue); + + // Put this sub-shape in the list of sub-shapes of theMainShape + aMainShape->AddSubShapeReference(aFunction); + + aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; + } + } + } + + //Make a Python command + anAsciiList.Trunc(anAsciiList.Length() - 1); + + GEOM::TPythonDump pd (aMainShape, /*append=*/true); + pd << "[" << anAsciiList.ToCString() << "] = geompy.SubShapes(" + << theMainShape << ", [" ; + for (i = low; i <= up - 1; i++) { + pd << theIndices->Value(i) << ", "; + } + pd << theIndices->Value(up) << "])"; + + SetErrorCode(OK); + + return aSeq; +} + //============================================================================= /*! * GetSubShapeIndex @@ -995,13 +1592,13 @@ Standard_Integer GEOMImpl_IShapesOperations::GetTopologyIndex (Handle(GEOM_Objec TopTools_ListIteratorOfListOfShape itC; for (itC.Initialize(CL); itC.More(); itC.Next()) { for (it.Initialize(itC.Value()); it.More(); it.Next()) { - if (it.Value().ShapeType() == TopAbs_COMPOUND) { - if (it.Value().IsSame(aSubShape)) - return index; - else - index++; - CL.Append(it.Value()); - } + if (it.Value().ShapeType() == TopAbs_COMPOUND) { + if (it.Value().IsSame(aSubShape)) + return index; + else + index++; + CL.Append(it.Value()); + } } } } else { @@ -1009,9 +1606,9 @@ Standard_Integer GEOMImpl_IShapesOperations::GetTopologyIndex (Handle(GEOM_Objec TopTools_MapOfShape M; for (; anExp.More(); anExp.Next()) { if (M.Add(anExp.Current())) { - if (anExp.Current().IsSame(aSubShape)) - return index; - index++; + if (anExp.Current().IsSame(aSubShape)) + return index; + index++; } } } @@ -1053,17 +1650,17 @@ TCollection_AsciiString GEOMImpl_IShapesOperations::GetShapeTypeString (Handle(G { BRepAdaptor_Surface surf (TopoDS::Face(aShape)); if (surf.GetType() == GeomAbs_Plane) - aTypeName = "Plane"; + aTypeName = "Plane"; else if (surf.GetType() == GeomAbs_Cylinder) - aTypeName = "Cylindrical Face"; + aTypeName = "Cylindrical Face"; else if (surf.GetType() == GeomAbs_Sphere) - aTypeName = "Spherical Face"; + aTypeName = "Spherical Face"; else if (surf.GetType() == GeomAbs_Torus) - aTypeName = "Toroidal Face"; + aTypeName = "Toroidal Face"; else if (surf.GetType() == GeomAbs_Cone) - aTypeName = "Conical Face"; + aTypeName = "Conical Face"; else - aTypeName = "GEOM::FACE"; + aTypeName = "GEOM::FACE"; } break; case TopAbs_WIRE: @@ -1073,15 +1670,15 @@ TCollection_AsciiString GEOMImpl_IShapesOperations::GetShapeTypeString (Handle(G { BRepAdaptor_Curve curv (TopoDS::Edge(aShape)); if (curv.GetType() == GeomAbs_Line) { - if ((Abs(curv.FirstParameter()) >= 1E6) || + if ((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) aTypeName = "Line"; - else - aTypeName = "Edge"; + else + aTypeName = "Edge"; } else if (curv.GetType() == GeomAbs_Circle) { - if (curv.IsClosed()) + if (curv.IsClosed()) aTypeName = "Circle"; - else + else aTypeName = "Arc"; } else { aTypeName = "Edge"; @@ -1103,54 +1700,83 @@ TCollection_AsciiString GEOMImpl_IShapesOperations::GetShapeTypeString (Handle(G //============================================================================= /*! - * NumberOfFaces + * NumberOfSubShapes */ //============================================================================= -Standard_Integer GEOMImpl_IShapesOperations::NumberOfFaces (Handle(GEOM_Object) theShape) +Standard_Integer GEOMImpl_IShapesOperations::NumberOfSubShapes + (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType) { SetErrorCode(KO); - - Standard_Integer nb = 0; + Standard_Integer nbShapes = 0; if (theShape.IsNull()) return -1; TopoDS_Shape aShape = theShape->GetValue(); if (aShape.IsNull()) return -1; + /* TopTools_MapOfShape mapShape; - TopExp_Explorer exp (aShape, TopAbs_FACE); - for (; exp.More(); exp.Next()) - if (mapShape.Add(exp.Current())) - nb++; - - SetErrorCode(OK); - return nb; -} - -//============================================================================= -/*! - * NumberOfEdges - */ -//============================================================================= -Standard_Integer GEOMImpl_IShapesOperations::NumberOfEdges (Handle(GEOM_Object) theShape) -{ - SetErrorCode(KO); - - Standard_Integer nb = 0; - - if (theShape.IsNull()) return -1; - TopoDS_Shape aShape = theShape->GetValue(); - if (aShape.IsNull()) return -1; + if (aShape.ShapeType() == TopAbs_COMPOUND && + (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID || + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) { + TopoDS_Iterator It (aShape, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + if (mapShape.Add(It.Value())) { + if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) { + nbShapes++; + } + } + } + } else { + TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType)); + for (; exp.More(); exp.Next()) + if (mapShape.Add(exp.Current())) + nbShapes++; + } + */ - TopTools_MapOfShape mapShape; + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + int iType, nbTypes [TopAbs_SHAPE]; + for (iType = 0; iType < TopAbs_SHAPE; ++iType) + nbTypes[iType] = 0; + nbTypes[aShape.ShapeType()]++; + + TopTools_MapOfShape aMapOfShape; + aMapOfShape.Add(aShape); + TopTools_ListOfShape aListOfShape; + aListOfShape.Append(aShape); + + TopTools_ListIteratorOfListOfShape itL (aListOfShape); + for (; itL.More(); itL.Next()) { + TopoDS_Iterator it (itL.Value()); + for (; it.More(); it.Next()) { + TopoDS_Shape s = it.Value(); + if (aMapOfShape.Add(s)) { + aListOfShape.Append(s); + nbTypes[s.ShapeType()]++; + } + } + } - TopExp_Explorer exp (aShape, TopAbs_EDGE); - for (; exp.More(); exp.Next()) - if (mapShape.Add(exp.Current())) - nb++; + if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE) + nbShapes = aMapOfShape.Extent(); + else + nbShapes = nbTypes[theShapeType]; + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return -1; + } SetErrorCode(OK); - return nb; + return nbShapes; } //============================================================================= @@ -1164,6 +1790,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object) if (theShape.IsNull()) return NULL; + /* //Add a new reversed object Handle(GEOM_Object) aReversed = GetEngine()->AddObject(GetDocID(), theShape->GetType()); @@ -1184,7 +1811,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object) //Compute the sub-shape value try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1203,6 +1830,21 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object) << " = geompy.ChangeOrientation(" << theShape << ")"; SetErrorCode(OK); + */ + + Handle(GEOM_Object) aReversed; + + GEOM_Engine* anEngine = GetEngine(); + //GEOMImpl_Gen* aGen = dynamic_cast(anEngine); + GEOMImpl_Gen* aGen = (GEOMImpl_Gen*)anEngine; + + if (aGen) { + GEOMImpl_IHealingOperations* anIHealingOperations = + aGen->GetIHealingOperations(GetDocID()); + aReversed = anIHealingOperations->ChangeOrientationCopy(theShape); + SetErrorCode(anIHealingOperations->GetErrorCode()); + } + return aReversed; } @@ -1319,6 +1961,126 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes return aSeq; } +//======================================================================= +//function : GetSharedShapes +//purpose : +//======================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes + (std::list theShapes, + const Standard_Integer theShapeType) +{ + SetErrorCode(KO); + + int aLen = theShapes.size(); + if (aLen < 1) return NULL; + + int ind = 1; + std::list::iterator it = theShapes.begin(); + + Handle(GEOM_Object) aMainObj = (*it++); + Handle(GEOM_Function) aMainShape = aMainObj->GetLastFunction(); + if (aMainShape.IsNull()) { + SetErrorCode("NULL shape for GetSharedShapes"); + return NULL; + } + + TopoDS_Shape aShape1 = aMainShape->GetValue(); + if (aShape1.IsNull()) return NULL; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape1, anIndices); + + TopTools_IndexedMapOfShape mapSelected; + TopExp::MapShapes(aShape1, TopAbs_ShapeEnum(theShapeType), mapSelected); + + // Find shared shapes + BRep_Builder B; + TopoDS_Compound aCurrSelection; + + for (; it != theShapes.end(); it++, ind++) { + Handle(GEOM_Function) aRefShape = (*it)->GetLastFunction(); + if (aRefShape.IsNull()) { + SetErrorCode("NULL shape for GetSharedShapes"); + return NULL; + } + + TopoDS_Compound aCompound; + B.MakeCompound(aCompound); + + TopoDS_Shape aShape2 = aRefShape->GetValue(); + if (aShape2.IsNull()) return NULL; + + TopTools_MapOfShape mapShape2; + TopExp_Explorer exp (aShape2, TopAbs_ShapeEnum(theShapeType)); + for (; exp.More(); exp.Next()) { + TopoDS_Shape aSS = exp.Current(); + if (mapShape2.Add(aSS) && mapSelected.Contains(aSS)) { + B.Add(aCompound, aSS); + } + } + + mapSelected.Clear(); + TopExp::MapShapes(aCompound, TopAbs_ShapeEnum(theShapeType), mapSelected); + aCurrSelection = aCompound; + } + + // Create GEOM_Object for each found shared shape (collected in aCurrSelection) + Handle(GEOM_Object) anObj; + Handle(TColStd_HArray1OfInteger) anArray; + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + TCollection_AsciiString anAsciiList, anEntry; + + TopoDS_Iterator itSel (aCurrSelection, Standard_True, Standard_True); + for (; itSel.More(); itSel.Next()) { + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(itSel.Value())); + anObj = GetEngine()->AddSubShape(aMainObj, anArray); + aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; + } + + if (aSeq->IsEmpty()) { + SetErrorCode("The given shapes have no shared sub-shapes of the requested type"); + return aSeq; + } + + // Make a Python command + anAsciiList.Trunc(anAsciiList.Length() - 1); + + // IPAL22904: TC6.5.0: order of python commands is wrong after dump study + Handle(TColStd_HSequenceOfTransient) anObjects = new TColStd_HSequenceOfTransient; + for( it = theShapes.begin(); it != theShapes.end(); it++ ) + { + Handle(GEOM_Object) anObj = *it; + if( !anObj.IsNull() ) + anObjects->Append( anObj ); + } + + // Get the function of the latest published object + Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast( anObjects )->GetLastFunction(); + if( aFunction.IsNull() ) // just in case + aFunction = aMainShape; + + GEOM::TPythonDump pd (aFunction, /*append=*/true); + pd << "[" << anAsciiList.ToCString() + << "] = geompy.GetSharedShapesMulti(["; + + it = theShapes.begin(); + pd << (*it++); + while (it != theShapes.end()) { + pd << ", " << (*it++); + } + + pd << "], " << TopAbs_ShapeEnum(theShapeType) << ")"; + + SetErrorCode(OK); + return aSeq; +} + //============================================================================= /*! * @@ -1435,19 +2197,19 @@ Handle(Geom_Surface) GEOMImpl_IShapesOperations::makeCylinder(const TopoDS_Shape //======================================================================= //function : getShapesOnBoxIDs /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theBox - the box to check state of subshapes against + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, - const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - GEOMAlgo_State theState) + const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState) { Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; @@ -1516,21 +2278,21 @@ Handle(TColStd_HSequenceOfInteger) //======================================================================= //function : GetShapesOnBoxIDs /*! - * \brief Find subshapes complying with given status about surface - * \param theBox - the box to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, - const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - GEOMAlgo_State theState) + const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState) { - // Find subshapes ids + // Find sub-shapes ids Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = getShapesOnBoxIDs (theBox, theShape, theShapeType, theState); if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 ) @@ -1554,21 +2316,21 @@ Handle(TColStd_HSequenceOfInteger) //======================================================================= //function : GetShapesOnBox /*! - * \brief Find subshapes complying with given status about surface - * \param theBox - the box to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfTransient) - found subshapes + * \retval Handle(TColStd_HSequenceOfTransient) - found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnBox(const Handle(GEOM_Object)& theBox, - const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - GEOMAlgo_State theState) + const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState) { - // Find subshapes ids + // Find sub-shapes ids Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = getShapesOnBoxIDs (theBox, theShape, theShapeType, theState); if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 ) @@ -1600,12 +2362,12 @@ Handle(TColStd_HSequenceOfTransient) //======================================================================= //function : getShapesOnShapeIDs /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theCheckShape - the shape to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfInteger) @@ -1645,10 +2407,15 @@ Handle(TColStd_HSequenceOfInteger) Standard_Integer iErr = aFinder.ErrorStatus(); // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx if (iErr) { - MESSAGE(" iErr : " << iErr); - TCollection_AsciiString aMsg (" iErr : "); - aMsg += TCollection_AsciiString(iErr); - SetErrorCode(aMsg); + if (iErr == 41) { + SetErrorCode("theCheckShape must be a solid"); + } + else { + MESSAGE(" iErr : " << iErr); + TCollection_AsciiString aMsg (" iErr : "); + aMsg += TCollection_AsciiString(iErr); + SetErrorCode(aMsg); + } return aSeqOfIDs; } Standard_Integer iWrn = aFinder.WarningStatus(); @@ -1682,12 +2449,12 @@ Handle(TColStd_HSequenceOfInteger) //======================================================================= //function : GetShapesOnShapeIDs /*! - * \brief Find subshapes complying with given status about surface - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theCheckShape - the shape to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfInteger) @@ -1722,12 +2489,12 @@ Handle(TColStd_HSequenceOfInteger) //======================================================================= //function : GetShapesOnShape /*! - * \brief Find subshapes complying with given status about surface - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theCheckShape - the shape to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfTransient) - found subshapes + * \retval Handle(TColStd_HSequenceOfTransient) - found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfTransient) @@ -1820,12 +2587,12 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnShapeAsCompound //======================================================================= //function : getShapesOnSurfaceIDs /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theSurface - the surface to check state of subshapes against + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theSurface - the surface to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfInteger) @@ -1842,9 +2609,31 @@ Handle(TColStd_HSequenceOfInteger) return aSeqOfIDs; } + // BEGIN: Mantis issue 0020961: Error on a pipe T-Shape + // Compute tolerance + Standard_Real T, VertMax = -RealLast(); + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + for (TopExp_Explorer ExV (theShape, TopAbs_VERTEX); ExV.More(); ExV.Next()) { + TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current()); + T = BRep_Tool::Tolerance(Vertex); + if (T > VertMax) + VertMax = T; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return aSeqOfIDs; + } + // END: Mantis issue 0020961 + // Call algo GEOMAlgo_FinderShapeOn1 aFinder; - Standard_Real aTol = 0.0001; // default value + //Standard_Real aTol = 0.0001; // default value + Standard_Real aTol = VertMax; // Mantis issue 0020961 aFinder.SetShape(theShape); aFinder.SetTolerance(aTol); @@ -1941,13 +2730,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations:: //======================================================================= //function : getShapesOnSurface /*! - * \brief Find subshapes complying with given status about surface - * \param theSurface - the surface to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theSurface - the surface to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \param theShapeEntries - outgoing entries like "entry1, entry2, ..." - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfTransient) @@ -1957,7 +2746,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMAlgo_State theState, TCollection_AsciiString & theShapeEntries) { - // Find subshapes ids + // Find sub-shapes ids Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = getShapesOnSurfaceIDs (theSurface, theShape->GetValue(), theShapeType, theState); if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 ) @@ -2024,7 +2813,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan (const Handle(GEOM_Object)& theShape, const Standard_Integer theShapeType, const Handle(GEOM_Object)& theAx1, - const Handle(GEOM_Object)& thePnt, + const Handle(GEOM_Object)& thePnt, const GEOMAlgo_State theState) { SetErrorCode(KO); @@ -2061,18 +2850,68 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan gp_Vec aVec(BRep_Tool::Pnt(V1),BRep_Tool::Pnt(V2)); if (aVec.Magnitude() < Precision::Confusion()) { - SetErrorCode("Vector with null magnitude given"); + SetErrorCode("Vector with null magnitude given"); + return NULL; + } + Handle(Geom_Surface) aPlane = new Geom_Plane(aLoc, aVec); + + if ( aPlane.IsNull() ) + return NULL; + + // Find objects + TCollection_AsciiString anAsciiList; + Handle(TColStd_HSequenceOfTransient) aSeq; + aSeq = getShapesOnSurface( aPlane, theShape, aShapeType, theState, anAsciiList ); + if ( aSeq.IsNull() || aSeq->Length() == 0 ) + return NULL; + + // Make a Python command + + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 )); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnPlaneWithLocation(" << theShape << ", " + << aShapeType << ", " << theAx1 << ", "<< thePnt <<", " << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//============================================================================= +/*! + * GetShapesOnCylinder + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCylinder + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Standard_Real theRadius, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || theAxis.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape anAxis = theAxis->GetValue(); + + if (aShape.IsNull() || anAxis.IsNull()) return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) return NULL; - } - Handle(Geom_Surface) aPlane = new Geom_Plane(aLoc, aVec); - if ( aPlane.IsNull() ) + // Create a cylinder surface + Handle(Geom_Surface) aCylinder = makeCylinder( anAxis, theRadius ); + if ( aCylinder.IsNull() ) return NULL; // Find objects TCollection_AsciiString anAsciiList; Handle(TColStd_HSequenceOfTransient) aSeq; - aSeq = getShapesOnSurface( aPlane, theShape, aShapeType, theState, anAsciiList ); + aSeq = getShapesOnSurface( aCylinder, theShape, aShapeType, theState, anAsciiList ); if ( aSeq.IsNull() || aSeq->Length() == 0 ) return NULL; @@ -2082,8 +2921,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() - << "] = geompy.GetShapesOnPlaneWithLocation(" << theShape << ", " - << aShapeType << ", " << theAx1 << ", "<< thePnt <<", " << theState << ")"; + << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << aShapeType + << ", " << theAxis << ", " << theRadius << ", " << theState << ")"; SetErrorCode(OK); return aSeq; @@ -2091,24 +2930,32 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan //============================================================================= /*! - * GetShapesOnCylinder + * GetShapesOnCylinderWithLocation */ //============================================================================= -Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCylinder +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCylinderWithLocation (const Handle(GEOM_Object)& theShape, const Standard_Integer theShapeType, const Handle(GEOM_Object)& theAxis, + const Handle(GEOM_Object)& thePnt, const Standard_Real theRadius, const GEOMAlgo_State theState) { SetErrorCode(KO); - if (theShape.IsNull() || theAxis.IsNull()) return NULL; + if (theShape.IsNull() || theAxis.IsNull() || thePnt.IsNull()) return NULL; TopoDS_Shape aShape = theShape->GetValue(); TopoDS_Shape anAxis = theAxis->GetValue(); + TopoDS_Shape aPnt = thePnt->GetValue(); - if (aShape.IsNull() || anAxis.IsNull()) return NULL; + if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return NULL; + + if (aPnt.ShapeType() != TopAbs_VERTEX ) + { + SetErrorCode("Bottom location point must be vertex"); + return NULL; + } TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); if ( !checkTypeShapesOn( aShapeType )) @@ -2119,6 +2966,18 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCyli if ( aCylinder.IsNull() ) return NULL; + // translate the surface + Handle(Geom_CylindricalSurface) aCylSurface = + Handle(Geom_CylindricalSurface)::DownCast( aCylinder ); + if ( aCylSurface.IsNull() ) + { + SetErrorCode("Unexpected surface type instead of Geom_CylindricalSurface"); + return NULL; + } + gp_Pnt fromLoc = aCylSurface->Cylinder().Location(); + gp_Pnt toLoc = BRep_Tool::Pnt( TopoDS::Vertex( aPnt )); + aCylinder->Translate( fromLoc, toLoc ); + // Find objects TCollection_AsciiString anAsciiList; Handle(TColStd_HSequenceOfTransient) aSeq; @@ -2131,9 +2990,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCyli Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 )); Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); - GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() - << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << aShapeType - << ", " << theAxis << ", " << theRadius << ", " << theState << ")"; + GEOM::TPythonDump(aFunction) + << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnCylinderWithLocation(" << theShape << ", " << aShapeType << ", " + << theAxis << ", " << thePnt << ", " << theRadius << ", " << theState << ")"; SetErrorCode(OK); return aSeq; @@ -2246,7 +3106,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnPlaneW (const Handle(GEOM_Object)& theShape, const Standard_Integer theShapeType, const Handle(GEOM_Object)& theAx1, - const Handle(GEOM_Object)& thePnt, + const Handle(GEOM_Object)& thePnt, const GEOMAlgo_State theState) { SetErrorCode(KO); @@ -2351,6 +3211,74 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnCylind return aSeq; } +//============================================================================= +/*! + * GetShapesOnCylinderWithLocationIDs + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnCylinderWithLocationIDs + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Handle(GEOM_Object)& thePnt, + const Standard_Real theRadius, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || theAxis.IsNull() || thePnt.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape anAxis = theAxis->GetValue(); + TopoDS_Shape aPnt = thePnt->GetValue(); + + if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return NULL; + + if (aPnt.ShapeType() != TopAbs_VERTEX ) + { + SetErrorCode("Bottom location point must be vertex"); + return NULL; + } + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) + return NULL; + + // Create a cylinder surface + Handle(Geom_Surface) aCylinder = makeCylinder( anAxis, theRadius ); + if ( aCylinder.IsNull() ) + return NULL; + + // translate the surface + Handle(Geom_CylindricalSurface) aCylSurface = + Handle(Geom_CylindricalSurface)::DownCast( aCylinder ); + if ( aCylSurface.IsNull() ) + { + SetErrorCode("Unexpected surface type instead of Geom_CylindricalSurface"); + return NULL; + } + gp_Pnt fromLoc = aCylSurface->Cylinder().Location(); + gp_Pnt toLoc = BRep_Tool::Pnt( TopoDS::Vertex( aPnt )); + aCylinder->Translate( fromLoc, toLoc ); + + // Find object IDs + Handle(TColStd_HSequenceOfInteger) aSeq; + aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState ); + + // The GetShapesOnCylinder() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = + GEOM::GetCreatedLast(theShape, GEOM::GetCreatedLast(thePnt,theAxis))->GetLastFunction(); + + // Make a Python command + GEOM::TPythonDump(aFunction, /*append=*/true) + << "listShapesOnCylinder = geompy.GetShapesOnCylinderWithLocationIDs" + << "(" << theShape << ", " << aShapeType << ", " << theAxis << ", " + << thePnt << ", " << theRadius << ", " << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + //============================================================================= /*! * GetShapesOnSphereIDs @@ -2404,15 +3332,15 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnSphere //======================================================================= //function : getShapesOnQuadrangleIDs /*! - * \brief Find IDs of subshapes complying with given status about quadrangle + * \brief Find IDs of sub-shapes complying with given status about quadrangle * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theTopLeftPoint - top left quadrangle corner * \param theTopRigthPoint - top right quadrangle corner * \param theBottomLeftPoint - bottom left quadrangle corner * \param theBottomRigthPoint - bottom right quadrangle corner * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfInteger) @@ -2530,15 +3458,15 @@ Handle(TColStd_HSequenceOfInteger) //======================================================================= //function : GetShapesOnQuadrangle /*! - * \brief Find subshapes complying with given status about quadrangle + * \brief Find sub-shapes complying with given status about quadrangle * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theTopLeftPoint - top left quadrangle corner * \param theTopRigthPoint - top right quadrangle corner * \param theBottomLeftPoint - bottom left quadrangle corner * \param theBottomRigthPoint - bottom right quadrangle corner * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfTransient) @@ -2591,15 +3519,15 @@ Handle(TColStd_HSequenceOfTransient) //======================================================================= //function : GetShapesOnQuadrangleIDs /*! - * \brief Find IDs of subshapes complying with given status about quadrangle + * \brief Find IDs of sub-shapes complying with given status about quadrangle * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theTopLeftPoint - top left quadrangle corner * \param theTopRigthPoint - top right quadrangle corner * \param theBottomLeftPoint - bottom left quadrangle corner * \param theBottomRigthPoint - bottom right quadrangle corner * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ //======================================================================= Handle(TColStd_HSequenceOfInteger) @@ -2728,84 +3656,327 @@ static bool GetInPlaceOfShape (const Handle(GEOM_Function)& theWhereFunction, bool isFoundAny = false; TopTools_MapOfShape mapShape; - if (theWhat.ShapeType() == TopAbs_COMPOUND || - theWhat.ShapeType() == TopAbs_COMPSOLID) { - // recursive processing of compound/compsolid - TopoDS_Iterator anIt (theWhat, Standard_True, Standard_True); - for (; anIt.More(); anIt.Next()) { - if (mapShape.Add(anIt.Value())) { - TopoDS_Shape curWhat = anIt.Value(); - isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); - if (isFoundAny) isFound = Standard_True; - } - } - } - else if (theWhat.ShapeType() == TopAbs_SHELL) { - // try to replace a shell by its faces images - TopExp_Explorer anExp (theWhat, TopAbs_FACE); - for (; anExp.More(); anExp.Next()) { - if (mapShape.Add(anExp.Current())) { - TopoDS_Shape curWhat = anExp.Current(); - isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); - if (isFoundAny) isFound = Standard_True; - } - } - } - else if (theWhat.ShapeType() == TopAbs_WIRE) { - // try to replace a wire by its edges images - TopExp_Explorer anExp (theWhat, TopAbs_EDGE); - for (; anExp.More(); anExp.Next()) { - if (mapShape.Add(anExp.Current())) { - TopoDS_Shape curWhat = anExp.Current(); - isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); - if (isFoundAny) isFound = Standard_True; - } - } + if (theWhat.ShapeType() == TopAbs_COMPOUND || + theWhat.ShapeType() == TopAbs_COMPSOLID) { + // recursive processing of compound/compsolid + TopoDS_Iterator anIt (theWhat, Standard_True, Standard_True); + for (; anIt.More(); anIt.Next()) { + if (mapShape.Add(anIt.Value())) { + TopoDS_Shape curWhat = anIt.Value(); + isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); + if (isFoundAny) isFound = Standard_True; + } + } + } + else if (theWhat.ShapeType() == TopAbs_SHELL) { + // try to replace a shell by its faces images + TopExp_Explorer anExp (theWhat, TopAbs_FACE); + for (; anExp.More(); anExp.Next()) { + if (mapShape.Add(anExp.Current())) { + TopoDS_Shape curWhat = anExp.Current(); + isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); + if (isFoundAny) isFound = Standard_True; + } + } + } + else if (theWhat.ShapeType() == TopAbs_WIRE) { + // try to replace a wire by its edges images + TopExp_Explorer anExp (theWhat, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + if (mapShape.Add(anExp.Current())) { + TopoDS_Shape curWhat = anExp.Current(); + isFoundAny = GetInPlaceOfShape(theWhereFunction, theWhereIndices, curWhat, theModifiedList); + if (isFoundAny) isFound = Standard_True; + } + } + } + else { + // Removed entity + } + } + + return isFound; +} + +//============================================================================= +/*! + * GetShapeProperties + */ +//============================================================================= +void GEOMImpl_IShapesOperations::GetShapeProperties( const TopoDS_Shape aShape, Standard_Real tab[], + gp_Pnt & aVertex ) +{ + GProp_GProps theProps; + gp_Pnt aCenterMass; + //TopoDS_Shape aPntShape; + Standard_Real aShapeSize; + + if (aShape.ShapeType() == TopAbs_VERTEX) aCenterMass = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + else if (aShape.ShapeType() == TopAbs_EDGE) BRepGProp::LinearProperties(aShape, theProps); + else if (aShape.ShapeType() == TopAbs_FACE) BRepGProp::SurfaceProperties(aShape, theProps); + else BRepGProp::VolumeProperties(aShape, theProps); + + if (aShape.ShapeType() == TopAbs_VERTEX) + aShapeSize = 1; + else { + aCenterMass = theProps.CentreOfMass(); + aShapeSize = theProps.Mass(); + } + +// aPntShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); +// aVertex = BRep_Tool::Pnt( TopoDS::Vertex( aPntShape ) ); + aVertex = aCenterMass; + tab[0] = aVertex.X(); + tab[1] = aVertex.Y(); + tab[2] = aVertex.Z(); + tab[3] = aShapeSize; + return; +} + +namespace { + + //================================================================================ + /*! + * \brief Return normal to face at extrema point + */ + //================================================================================ + + gp_Vec GetNormal (const TopoDS_Face& face, const BRepExtrema_DistShapeShape& extrema) + { + gp_Vec defaultNorm(1,0,0); // to have same normals on different faces + try { + // get UV at extrema point + Standard_Real u,v, f,l; + switch ( extrema.SupportTypeShape2(1) ) { + case BRepExtrema_IsInFace: { + extrema.ParOnFaceS2(1, u, v ); + break; + } + case BRepExtrema_IsOnEdge: { + TopoDS_Edge edge = TopoDS::Edge( extrema.SupportOnShape2(1)); + Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( edge, face, f,l ); + extrema.ParOnEdgeS2( 1, u ); + gp_Pnt2d uv = pcurve->Value( u ); + u = uv.Coord(1); + v = uv.Coord(2); + break; + } + case BRepExtrema_IsVertex: return defaultNorm; + } + // get derivatives + BRepAdaptor_Surface surface( face, false ); + gp_Vec du, dv; gp_Pnt p; + surface.D1( u, v, p, du, dv ); + + return du ^ dv; + + } catch (Standard_Failure ) { + } + return defaultNorm; + } +} + +//================================================================================ +/*! + * \brief Return type of shape for explode. In case of compound it will be a type of sub-shape. + */ +//================================================================================ +TopAbs_ShapeEnum GEOMImpl_IShapesOperations::GetTypeOfSimplePart (const TopoDS_Shape& theShape) +{ + TopAbs_ShapeEnum aType = theShape.ShapeType(); + if (aType == TopAbs_VERTEX) return TopAbs_VERTEX; + else if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) return TopAbs_EDGE; + else if (aType == TopAbs_FACE || aType == TopAbs_SHELL) return TopAbs_FACE; + else if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID) return TopAbs_SOLID; + else if (aType == TopAbs_COMPOUND) { + // Only the iType of the first shape in the compound is taken into account + TopoDS_Iterator It (theShape, Standard_False, Standard_False); + if (It.More()) { + return GetTypeOfSimplePart(It.Value()); + } + } + return TopAbs_SHAPE; +} + +//============================================================================= +/*! + * case GetInPlace: + * default: + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat) +{ + SetErrorCode(KO); + + if (theShapeWhere.IsNull() || theShapeWhat.IsNull()) return NULL; + + TopoDS_Shape aWhere = theShapeWhere->GetValue(); + TopoDS_Shape aWhat = theShapeWhat->GetValue(); + TopoDS_Shape aPntShape; + TopoDS_Vertex aVertex; + + if (aWhere.IsNull() || aWhat.IsNull()) { + SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null."); + return NULL; + } + + Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction(); + if (aWhereFunction.IsNull()) { + SetErrorCode("Error: aWhereFunction is Null."); + return NULL; + } + + TopTools_IndexedMapOfShape aWhereIndices; + TopExp::MapShapes(aWhere, aWhereIndices); + + TopAbs_ShapeEnum iType = TopAbs_SOLID; + Standard_Real dl_l = 1e-3; + Standard_Real min_l, Tol_0D, Tol_1D, Tol_2D, Tol_3D, Tol_Mass; + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + Bnd_Box BoundingBox; + gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2]; + GProp_GProps aProps; + + // Find the iType of the aWhat shape + iType = GetTypeOfSimplePart(aWhat); + if (iType == TopAbs_SHAPE) { + SetErrorCode("Error: An attempt to extract a shape of not supported type."); + return NULL; + } + + TopExp_Explorer Exp_aWhat ( aWhat, iType ); + TopExp_Explorer Exp_aWhere ( aWhere, iType ); + TopExp_Explorer Exp_Edge ( aWhere, TopAbs_EDGE ); + + // Find the shortest edge in theShapeWhere shape + BRepBndLib::Add(aWhere, BoundingBox); + BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + min_l = fabs(aXmax - aXmin); + if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin); + if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin); + min_l /= dl_l; + // Mantis issue 0020908 BEGIN + if (!Exp_Edge.More()) { + min_l = Precision::Confusion(); + } + // Mantis issue 0020908 END + for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) { + TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX); + for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) { + aPnt = BRep_Tool::Pnt( TopoDS::Vertex( Exp_Vertex.Current() ) ); + tab_Pnt[nbVertex] = aPnt; + } + if ( ! tab_Pnt[0].IsEqual(tab_Pnt[1], dl_l) ) { + BRepGProp::LinearProperties(Exp_Edge.Current(), aProps); + if ( aProps.Mass() < min_l ) min_l = aProps.Mass(); + } + } + + // Compute tolerances + Tol_0D = dl_l; + Tol_1D = dl_l * min_l; + Tol_2D = dl_l * ( min_l * min_l) * ( 2. + dl_l); + Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) ); + + if (Tol_0D < Precision::Confusion()) Tol_0D = Precision::Confusion(); + if (Tol_1D < Precision::Confusion()) Tol_1D = Precision::Confusion(); + if (Tol_2D < Precision::Confusion()) Tol_2D = Precision::Confusion(); + if (Tol_3D < Precision::Confusion()) Tol_3D = Precision::Confusion(); + + Tol_Mass = Tol_3D; + if ( iType == TopAbs_VERTEX ) Tol_Mass = Tol_0D; + else if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D; + else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D; + + // Searching for the sub-shapes inside the ShapeWhere shape + GEOMAlgo_GetInPlace aGIP; + aGIP.SetTolerance(Tol_1D); + aGIP.SetTolMass(Tol_Mass); + aGIP.SetTolCG(Tol_1D); + + aGIP.SetArgument(aWhat); + aGIP.SetShapeWhere(aWhere); + + aGIP.Perform(); + int iErr = aGIP.ErrorStatus(); + if (iErr) { + SetErrorCode("Error in GEOMAlgo_GetInPlace"); + return NULL; + } + + // aGIP.IsFound() returns true only when the whole theShapeWhat + // is found (as one shape or several parts). But we are also interested + // in the partial result, that is why this check is commented. + //if (!aGIP.IsFound()) { + // SetErrorCode(NOT_FOUND_ANY); + // return NULL; + //} + + const TopTools_DataMapOfShapeListOfShape& aDMSLS = aGIP.Images(); + if (!aDMSLS.IsBound(aWhat)) { + SetErrorCode(NOT_FOUND_ANY); + return NULL; + } + + // the list of shapes aLSA contains the shapes + // of the Shape For Search that corresponds + // to the Argument aWhat + const TopTools_ListOfShape& aLSA = aDMSLS.Find(aWhat); + if (aLSA.Extent() == 0) { + SetErrorCode(NOT_FOUND_ANY); // Not found any Results + return NULL; + } + + Handle(TColStd_HArray1OfInteger) aModifiedArray = new TColStd_HArray1OfInteger (1, aLSA.Extent()); + TopTools_ListIteratorOfListOfShape anIterModif (aLSA); + for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) { + if (aWhereIndices.Contains(anIterModif.Value())) { + aModifiedArray->SetValue(imod, aWhereIndices.FindIndex(anIterModif.Value())); } else { - // Removed entity + SetErrorCode("Error: wrong sub-shape returned"); + return NULL; } } - return isFound; -} + //Add a new object + Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray); + if (aResult.IsNull()) { + SetErrorCode("Error in algorithm: result found, but cannot be returned."); + return NULL; + } -//============================================================================= -/*! - * GetShapeProperties - */ -//============================================================================= -void GEOMImpl_IShapesOperations::GetShapeProperties( const TopoDS_Shape aShape, Standard_Real tab[], - gp_Pnt & aVertex ) -{ - GProp_GProps theProps; - gp_Pnt aCenterMass; - TopoDS_Shape aPntShape; - Standard_Real aShapeSize; + if (aModifiedArray->Length() > 1 || theShapeWhat->GetType() == GEOM_GROUP) { + //Set a GROUP type + aResult->SetType(GEOM_GROUP); - if (aShape.ShapeType() == TopAbs_EDGE) BRepGProp::LinearProperties(aShape, theProps); - else if (aShape.ShapeType() == TopAbs_FACE) BRepGProp::SurfaceProperties(aShape, theProps); - else BRepGProp::VolumeProperties(aShape, theProps); + //Set a sub-shape type + TopoDS_Shape aFirstFound = aLSA.First(); + TopAbs_ShapeEnum aShapeType = aFirstFound.ShapeType(); + + TDF_Label aFreeLabel = aResult->GetFreeLabel(); + TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aShapeType); + } - aCenterMass = theProps.CentreOfMass(); - aShapeSize = theProps.Mass(); + //Make a Python command + Handle(GEOM_Function) aFunction = aResult->GetFunction(1); - aPntShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); - aVertex = BRep_Tool::Pnt( TopoDS::Vertex( aPntShape ) ); - tab[0] = aVertex.X(); - tab[1] = aVertex.Y(); - tab[2] = aVertex.Z(); - tab[3] = aShapeSize; - return; + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetInPlace(" + << theShapeWhere << ", " << theShapeWhat << ", True)"; + + SetErrorCode(OK); + return aResult; } //============================================================================= /*! - * GetInPlace + * case GetInPlaceOld: + * default: */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) theShapeWhere, - Handle(GEOM_Object) theShapeWhat) +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld (Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat) { SetErrorCode(KO); @@ -2836,26 +4007,32 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) Handle(GEOM_Object) aResult; bool isFound = false; - Standard_Integer iType = TopAbs_SOLID; - Standard_Integer compType = TopAbs_SOLID; - Standard_Real aWhat_Mass = 0., aWhere_Mass = 0.; + TopAbs_ShapeEnum iType = TopAbs_SOLID; + //Standard_Real aWhat_Mass = 0., aWhere_Mass = 0.; Standard_Real tab_aWhat[4], tab_aWhere[4]; Standard_Real dl_l = 1e-3; - Standard_Real min_l, Tol_1D, Tol_2D, Tol_3D, Tol_Mass; + Standard_Real min_l, Tol_0D, Tol_1D, Tol_2D, Tol_3D, Tol_Mass; Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; Bnd_Box BoundingBox; gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2]; GProp_GProps aProps; // Find the iType of the aWhat shape - if ( aWhat.ShapeType() == TopAbs_EDGE || aWhat.ShapeType() == TopAbs_WIRE ) iType = TopAbs_EDGE; + /* + if ( aWhat.ShapeType() == TopAbs_VERTEX ) iType = TopAbs_VERTEX; + else if ( aWhat.ShapeType() == TopAbs_EDGE || aWhat.ShapeType() == TopAbs_WIRE ) iType = TopAbs_EDGE; else if ( aWhat.ShapeType() == TopAbs_FACE || aWhat.ShapeType() == TopAbs_SHELL ) iType = TopAbs_FACE; else if ( aWhat.ShapeType() == TopAbs_SOLID || aWhat.ShapeType() == TopAbs_COMPSOLID ) iType = TopAbs_SOLID; else if ( aWhat.ShapeType() == TopAbs_COMPOUND ) { // Only the iType of the first shape in the compound is taken into account - TopoDS_Iterator It (aWhat, Standard_True, Standard_True); - compType = It.Value().ShapeType(); - if ( compType == TopAbs_EDGE || compType == TopAbs_WIRE ) iType = TopAbs_EDGE; + TopoDS_Iterator It (aWhat, Standard_False, Standard_False); + if ( !It.More() ) { + SetErrorCode("Error: theShapeWhat is an empty COMPOUND."); + return NULL; + } + TopAbs_ShapeEnum compType = It.Value().ShapeType(); + if ( compType == TopAbs_VERTEX ) iType = TopAbs_VERTEX; + else if ( compType == TopAbs_EDGE || compType == TopAbs_WIRE ) iType = TopAbs_EDGE; else if ( compType == TopAbs_FACE || compType == TopAbs_SHELL) iType = TopAbs_FACE; else if ( compType == TopAbs_SOLID || compType == TopAbs_COMPSOLID) iType = TopAbs_SOLID; } @@ -2863,10 +4040,16 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) SetErrorCode("Error: An attempt to extract a shape of not supported type."); return NULL; } + */ + iType = GetTypeOfSimplePart(aWhat); + if (iType == TopAbs_SHAPE) { + SetErrorCode("Error: An attempt to extract a shape of not supported type."); + return NULL; + } - TopExp_Explorer Exp_aWhat( aWhat, TopAbs_ShapeEnum( iType ) ); - TopExp_Explorer Exp_aWhere( aWhere, TopAbs_ShapeEnum( iType ) ); - TopExp_Explorer Exp_Edge( aWhere, TopAbs_EDGE ); + TopExp_Explorer Exp_aWhat ( aWhat, iType ); + TopExp_Explorer Exp_aWhere ( aWhere, iType ); + TopExp_Explorer Exp_Edge ( aWhere, TopAbs_EDGE ); // Find the shortest edge in theShapeWhere shape BRepBndLib::Add(aWhere, BoundingBox); @@ -2875,6 +4058,11 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin); if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin); min_l /= dl_l; + // Mantis issue 0020908 BEGIN + if (!Exp_Edge.More()) { + min_l = Precision::Confusion(); + } + // Mantis issue 0020908 END for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) { TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX); for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) { @@ -2888,25 +4076,38 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) } // Compute tolerances + Tol_0D = dl_l; Tol_1D = dl_l * min_l; Tol_2D = dl_l * ( min_l * min_l) * ( 2. + dl_l); Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) ); + if (Tol_0D < Precision::Confusion()) Tol_0D = Precision::Confusion(); if (Tol_1D < Precision::Confusion()) Tol_1D = Precision::Confusion(); if (Tol_2D < Precision::Confusion()) Tol_2D = Precision::Confusion(); if (Tol_3D < Precision::Confusion()) Tol_3D = Precision::Confusion(); + //if (Tol_1D > 1.0) Tol_1D = 1.0; + //if (Tol_2D > 1.0) Tol_2D = 1.0; + //if (Tol_3D > 1.0) Tol_3D = 1.0; + Tol_Mass = Tol_3D; - if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D; + if ( iType == TopAbs_VERTEX ) Tol_Mass = Tol_0D; + else if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D; else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D; // Compute the ShapeWhat Mass + /* for ( ; Exp_aWhat.More(); Exp_aWhat.Next() ) { - if ( iType == TopAbs_EDGE ) BRepGProp::LinearProperties(Exp_aWhat.Current(), aProps); + if ( iType == TopAbs_VERTEX ) { + aWhat_Mass += 1; + continue; + } + else if ( iType == TopAbs_EDGE ) BRepGProp::LinearProperties(Exp_aWhat.Current(), aProps); else if ( iType == TopAbs_FACE ) BRepGProp::SurfaceProperties(Exp_aWhat.Current(), aProps); else BRepGProp::VolumeProperties(Exp_aWhat.Current(), aProps); aWhat_Mass += aProps.Mass(); } + */ // Searching for the sub-shapes inside the ShapeWhere shape TopTools_MapOfShape map_aWhere; @@ -2924,19 +4125,37 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) aVertex = TopoDS::Vertex( aPntShape ); BRepExtrema_DistShapeShape aWhereDistance ( aVertex, Exp_aWhere.Current() ); BRepExtrema_DistShapeShape aWhatDistance ( aVertex, Exp_aWhat.Current() ); - if ( fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= Tol_1D ) - isFound = true; + if ( aWhereDistance.IsDone() && aWhatDistance.IsDone() && + fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= Tol_1D ) + { + // 0020162: "EDF 961 GEOM : Getinplace is getting additionnal orthogonal faces" + // aVertex must be projected to the same point on Where and on What + gp_Pnt pOnWhat = aWhatDistance.PointOnShape2(1); + gp_Pnt pOnWhere = aWhereDistance.PointOnShape2(1); + isFound = ( pOnWhat.Distance(pOnWhere) <= Tol_1D ); + if ( isFound && iType == TopAbs_FACE ) + { + // check normals at pOnWhat and pOnWhere + const double angleTol = M_PI/180.; + gp_Vec normToWhat = GetNormal( TopoDS::Face(Exp_aWhat.Current()), aWhatDistance); + gp_Vec normToWhere = GetNormal( TopoDS::Face(Exp_aWhere.Current()), aWhereDistance); + if ( normToWhat * normToWhere < 0 ) + normToWhat.Reverse(); + isFound = ( normToWhat.Angle( normToWhere ) < angleTol ); + } + } } } if ( isFound ) { aWhereIndex = aWhereIndices.FindIndex(Exp_aWhere.Current()); aModifiedList.Append(aWhereIndex); - aWhere_Mass += tab_aWhere[3]; + //aWhere_Mass += tab_aWhere[3]; isFound = false; break; } } - if ( fabs( aWhat_Mass - aWhere_Mass ) <= Tol_Mass ) break; + //if ( fabs( aWhat_Mass - aWhere_Mass ) <= Tol_Mass ) + //break; } if (aModifiedList.Extent() == 0) { // Not found any Results @@ -2956,11 +4175,11 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) return NULL; } - if (aModifiedArray->Length() > 1) { + if (aModifiedArray->Length() > 1 || theShapeWhat->GetType() == GEOM_GROUP) { //Set a GROUP type aResult->SetType(GEOM_GROUP); - //Set a sub shape type + //Set a sub-shape type TopoDS_Shape aFirstFound = aWhereIndices.FindKey(aModifiedArray->Value(1)); TopAbs_ShapeEnum aShapeType = aFirstFound.ShapeType(); @@ -2972,7 +4191,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) Handle(GEOM_Function) aFunction = aResult->GetFunction(1); GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetInPlace(" - << theShapeWhere << ", " << theShapeWhat << ")"; + << theShapeWhere << ", " << theShapeWhat << ", False)"; SetErrorCode(OK); return aResult; @@ -3029,7 +4248,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory //Set a GROUP type aResult->SetType(GEOM_GROUP); - //Set a sub shape type + //Set a sub-shape type TopoDS_Shape aFirstFound = aWhereIndices.FindKey(aModifiedArray->Value(1)); TopAbs_ShapeEnum aShapeType = aFirstFound.ShapeType(); @@ -3047,12 +4266,133 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory return aResult; } +//======================================================================= +//function : ShapeToDouble +//purpose : used by CompareShapes::operator() +//======================================================================= +std::pair ShapeToDouble (const TopoDS_Shape& S, bool isOldSorting) +{ + // Computing of CentreOfMass + gp_Pnt GPoint; + double Len; + + if (S.ShapeType() == TopAbs_VERTEX) { + GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S)); + Len = (double)S.Orientation(); + } + else { + GProp_GProps GPr; + // BEGIN: fix for Mantis issue 0020842 + if (isOldSorting) { + BRepGProp::LinearProperties(S, GPr); + } + else { + if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties(S, GPr); + } + else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(S, GPr); + } + else { + BRepGProp::VolumeProperties(S, GPr); + } + } + // END: fix for Mantis issue 0020842 + GPoint = GPr.CentreOfMass(); + Len = GPr.Mass(); + } + + double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9; + return std::make_pair(dMidXYZ, Len); +} + +//======================================================================= +//function : CompareShapes::operator() +//purpose : used by std::sort(), called from SortShapes() +//======================================================================= +bool GEOMImpl_IShapesOperations::CompareShapes::operator()(const TopoDS_Shape& theShape1, + const TopoDS_Shape& theShape2) +{ + if (!myMap.IsBound(theShape1)) { + myMap.Bind(theShape1, ShapeToDouble(theShape1, myIsOldSorting)); + } + + if (!myMap.IsBound(theShape2)) { + myMap.Bind(theShape2, ShapeToDouble(theShape2, myIsOldSorting)); + } + + std::pair val1 = myMap.Find(theShape1); + std::pair val2 = myMap.Find(theShape2); + + double tol = Precision::Confusion(); + bool exchange = Standard_False; + + double dMidXYZ = val1.first - val2.first; + if (dMidXYZ >= tol) { + exchange = Standard_True; + } + else if (Abs(dMidXYZ) < tol) { + double dLength = val1.second - val2.second; + if (dLength >= tol) { + exchange = Standard_True; + } + else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) { + // PAL17233 + // equal values possible on shapes such as two halves of a sphere and + // a membrane inside the sphere + Bnd_Box box1,box2; + BRepBndLib::Add(theShape1, box1); + if (!box1.IsVoid()) { + BRepBndLib::Add(theShape2, box2); + Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent(); + if (dSquareExtent >= tol) { + exchange = Standard_True; + } + else if (Abs(dSquareExtent) < tol) { + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2; + box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + val1 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9; + box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + val2 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9; + if ((val1 - val2) >= tol) { + exchange = Standard_True; + } + } + } + } + } + + //return val1 < val2; + return !exchange; +} + //======================================================================= //function : SortShapes //purpose : //======================================================================= -void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL) +void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL, + const Standard_Boolean isOldSorting) { +#ifdef STD_SORT_ALGO + std::vector aShapesVec; + aShapesVec.reserve(SL.Extent()); + + TopTools_ListIteratorOfListOfShape it (SL); + for (; it.More(); it.Next()) { + aShapesVec.push_back(it.Value()); + } + SL.Clear(); + + CompareShapes shComp (isOldSorting); + std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp); + //std::sort(aShapesVec.begin(), aShapesVec.end(), shComp); + + std::vector::const_iterator anIter = aShapesVec.begin(); + for (; anIter != aShapesVec.end(); ++anIter) { + SL.Append(*anIter); + } +#else + // old implementation Standard_Integer MaxShapes = SL.Extent(); TopTools_Array1OfShape aShapes (1,MaxShapes); TColStd_Array1OfInteger OrderInd(1,MaxShapes); @@ -3070,19 +4410,31 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL) SL.Remove( it ); // == it.Next() aShapes(Index) = S; OrderInd.SetValue (Index, Index); - if (S.ShapeType() == TopAbs_VERTEX) - { + if (S.ShapeType() == TopAbs_VERTEX) { GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S )); Length.SetValue( Index, (Standard_Real) S.Orientation()); } - else - { - BRepGProp::LinearProperties (S, GPr); + else { + // BEGIN: fix for Mantis issue 0020842 + if (isOldSorting) { + BRepGProp::LinearProperties (S, GPr); + } + else { + if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties (S, GPr); + } + else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(S, GPr); + } + else { + BRepGProp::VolumeProperties(S, GPr); + } + } + // END: fix for Mantis issue 0020842 GPoint = GPr.CentreOfMass(); - Length.SetValue( Index, GPr.Mass() ); + Length.SetValue(Index, GPr.Mass()); } - MidXYZ.SetValue(Index, - GPoint.X()*999 + GPoint.Y()*99 + GPoint.Z()*0.9); + MidXYZ.SetValue(Index, GPoint.X()*999.0 + GPoint.Y()*99.0 + GPoint.Z()*0.9); //cout << Index << " L: " << Length(Index) << "CG: " << MidXYZ(Index) << endl; } @@ -3101,12 +4453,12 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL) if ( dMidXYZ >= tol ) { // cout << "MidXYZ: " << MidXYZ(OrderInd(Index))<< " > " <= tol ) { // cout << "Length: " << Length(OrderInd(Index))<< " > " <GetValue(); + TopoDS_Shape aWhat = theShapeWhat->GetValue(); + + if (aWhere.IsNull() || aWhat.IsNull()) return NULL; + + TopTools_ListOfShape listShape; + TopTools_MapOfShape aMap; + + if (aWhat.ShapeType() == TopAbs_COMPOUND || aWhat.ShapeType() == TopAbs_COMPSOLID) { + TopoDS_Iterator It (aWhat, Standard_True, Standard_True); + if (It.More()) aWhat = It.Value(); + It.Next(); + if (It.More()) { + SetErrorCode("Compounds of two or more shapes are not allowed for aWhat argument"); + return NULL; + } + } + + switch (aWhat.ShapeType()) { + case TopAbs_VERTEX: { + gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aWhat)); + TopExp_Explorer E(aWhere, TopAbs_VERTEX); + for(; E.More(); E.Next()) { + if(!aMap.Add(E.Current())) continue; + gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(E.Current())); + if(P.Distance(P2) <= MAX_TOLERANCE) { + listShape.Append(E.Current()); + } + } + break; + } + case TopAbs_EDGE: { + TopoDS_Edge anEdge = TopoDS::Edge(aWhat); + TopExp_Explorer E(aWhere, TopAbs_EDGE); + for(; E.More(); E.Next()) { + if(!aMap.Add(E.Current())) continue; + if(isSameEdge(anEdge, TopoDS::Edge(E.Current()))) { + listShape.Append(E.Current()); + } + } + break; + } + case TopAbs_FACE: { + TopoDS_Face aFace = TopoDS::Face(aWhat); + TopExp_Explorer E(aWhere, TopAbs_FACE); + for(; E.More(); E.Next()) { + if(!aMap.Add(E.Current())) continue; + if(isSameFace(aFace, TopoDS::Face(E.Current()))) { + listShape.Append(E.Current()); + } + } + break; + } + case TopAbs_SOLID: { + TopoDS_Solid aSolid = TopoDS::Solid(aWhat); + TopExp_Explorer E(aWhere, TopAbs_SOLID); + for(; E.More(); E.Next()) { + if(!aMap.Add(E.Current())) continue; + if(isSameSolid(aSolid, TopoDS::Solid(E.Current()))) { + listShape.Append(E.Current()); + } + } + break; + } + default: + return NULL; + } + + if ( !listShape.IsEmpty() ) { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aWhere, anIndices); + TopTools_ListIteratorOfListOfShape itSub (listShape); + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + for (; itSub.More(); itSub.Next()) { + if (anIndices.Contains(itSub.Value())) + aSeq->Append(anIndices.FindIndex(itSub.Value())); + } + SetErrorCode(OK); + // The GetSameIDs() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShapeWhere,theShapeWhat)->GetLastFunction(); + + // Make a Python command + GEOM::TPythonDump(aFunction) + << "listSameIDs = geompy.GetSameIDs(" + << theShapeWhere << ", " + << theShapeWhat << ")"; + return aSeq; + } else { + SetErrorCode(NOT_FOUND_ANY); + return NULL; + } +} diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 3deb09d0a..21885888a 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -1,32 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //============================================================================= // File : GEOMImpl_IShapesOperations.hxx -// Created : +// Created : // Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 // Project : SALOME -// $Header$ //============================================================================= -// + #ifndef _GEOMImpl_IShapesOperations_HXX_ #define _GEOMImpl_IShapesOperations_HXX_ @@ -34,19 +34,28 @@ #include "GEOMAlgo_State.hxx" +#include #include +#include #include #include -#include #include #include +#include +#include + class GEOM_Engine; class Handle(GEOM_Object); class Handle(TColStd_HArray1OfInteger); +inline Standard_Boolean IsEqual (const TopoDS_Shape& S1, const TopoDS_Shape& S2) +{ + return S1.IsSame(S2); +} + class GEOMImpl_IShapesOperations : public GEOM_IOperations { public: @@ -54,46 +63,83 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Standard_EXPORT ~GEOMImpl_IShapesOperations(); Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2); + Handle(GEOM_Object) thePoint2); + + Standard_EXPORT Handle(GEOM_Object) MakeEdgeOnCurveByLength (Handle(GEOM_Object) theCurve, + const Standard_Real theLength, + Handle(GEOM_Object) theStartPoint); + + Standard_EXPORT Handle(GEOM_Object) MakeEdgeWire (Handle(GEOM_Object) theWire, + const Standard_Real theLinearTolerance, + const Standard_Real theAngularTolerance); - Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list theEdgesAndWires); + Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list theEdgesAndWires, + const Standard_Real theTolerance); Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted); Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (std::list theWires, - const bool isPlanarWanted); + const bool isPlanarWanted); Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list theShapes); - Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell); - Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (std::list theShells); Standard_EXPORT Handle(GEOM_Object) MakeCompound (std::list theShapes); Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape, - const Standard_Real theTolerance, + const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids); - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape, - const Standard_Real theTolerance); + //Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape, + // const Standard_Real theTolerance); Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape, - const Standard_Real theTolerance, - std::list theFaces, - const Standard_Boolean doKeepNonSolids); - - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, - const Standard_Integer theShapeType, - const Standard_Boolean isSorted); - - Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape, - const Standard_Integer theShapeType, - const Standard_Boolean isSorted); + const Standard_Real theTolerance, + std::list theFaces, + const Standard_Boolean doKeepNonSolids, + const Standard_Boolean doGlueAllEdges); + + Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance, + const TopAbs_ShapeEnum theType); + + Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance, + std::list theEdges); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects + (Handle(GEOM_Object) theShape, + const Standard_Boolean theGroupsOnly); + + enum ExplodeType { + EXPLODE_OLD_INCLUDE_MAIN, + EXPLODE_NEW_INCLUDE_MAIN, + EXPLODE_NEW_EXCLUDE_MAIN + }; + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode + (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + const Standard_Boolean isSorted, + const ExplodeType theExplodeType = EXPLODE_NEW_INCLUDE_MAIN); + + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs + (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + const Standard_Boolean isSorted, + const ExplodeType theExplodeType = EXPLODE_NEW_INCLUDE_MAIN); Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape, const Standard_Integer theID); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeSubShapes + (Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices); + Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theMainShape, Handle(GEOM_Object) theSubShape); @@ -102,21 +148,27 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape); - Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape); - Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape); + Standard_EXPORT Standard_Integer NumberOfSubShapes (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType); Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes); Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape); - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharedShapes (Handle(GEOM_Object) theShape1, - Handle(GEOM_Object) theShape2, - const Standard_Integer theShapeType); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetSharedShapes (Handle(GEOM_Object) theShape1, + Handle(GEOM_Object) theShape2, + const Standard_Integer theShapeType); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetSharedShapes (std::list theShapes, + const Standard_Integer theShapeType); - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape, - const Standard_Integer theShapeType, - const Handle(GEOM_Object)& theAx1, - const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetShapesOnPlane (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const GEOMAlgo_State theState); Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape, @@ -133,6 +185,14 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const Standard_Real theRadius, const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetShapesOnCylinderWithLocation (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Handle(GEOM_Object)& thePnt, + const Standard_Real theRadius, + const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape, const Standard_Integer theShapeType, @@ -160,6 +220,14 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const Standard_Real theRadius, const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) + GetShapesOnCylinderWithLocationIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Handle(GEOM_Object)& thePnt, + const Standard_Real theRadius, + const GEOMAlgo_State theState); + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape, const Standard_Integer theShapeType, @@ -168,15 +236,15 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const GEOMAlgo_State theState); /*! - * \brief Find subshapes complying with given status about quadrangle + * \brief Find sub-shapes complying with given status about quadrangle * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theTopLeftPoint - top left quadrangle corner * \param theTopRigthPoint - top right quadrangle corner * \param theBottomLeftPoint - bottom left quadrangle corner * \param theBottomRigthPoint - bottom right quadrangle corner * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape, @@ -188,15 +256,15 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const GEOMAlgo_State theState); /*! - * \brief Find IDs of subshapes complying with given status about quadrangle + * \brief Find IDs of sub-shapes complying with given status about quadrangle * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theTopLeftPoint - top left quadrangle corner * \param theTopRigthPoint - top right quadrangle corner * \param theBottomLeftPoint - bottom left quadrangle corner * \param theBottomRigthPoint - bottom right quadrangle corner * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape, @@ -208,20 +276,23 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const GEOMAlgo_State theState); Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object) theShape, - const Standard_Integer theShapeType, - Handle(GEOM_Object) theAxis, - const Standard_Real theRadius); + const Standard_Integer theShapeType, + Handle(GEOM_Object) theAxis, + const Standard_Real theRadius); Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object) theShape, - const Standard_Integer theShapeType, - Handle(GEOM_Object) theCenter, - const Standard_Real theRadius); + const Standard_Integer theShapeType, + Handle(GEOM_Object) theCenter, + const Standard_Real theRadius); void GetShapeProperties(const TopoDS_Shape aShape, Standard_Real propertiesArray[], gp_Pnt & aPnt); Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere, Handle(GEOM_Object) theShapeWhat); + Standard_EXPORT Handle(GEOM_Object) GetInPlaceOld (Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat); + Standard_EXPORT Handle(GEOM_Object) GetInPlaceByHistory (Handle(GEOM_Object) theShapeWhere, Handle(GEOM_Object) theShapeWhat); @@ -235,12 +306,21 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const Handle(GEOM_Object)& theShapeWhat); /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theBox - the box to check state of subshapes against + * \brief Searches a shape equal to theWhat in the context of theWhere + * \param theShapeWhere - a context shap + * \param theShapeWhat - a sample shape + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes + */ + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetSameIDs(const Handle(GEOM_Object)& theShapeWhere, + const Handle(GEOM_Object)& theShapeWhat); + + /*! + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, @@ -249,10 +329,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations GEOMAlgo_State theState); /*! - * \brief Find subshapes complying with given status about surface - * \param theBox - the box to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects */ @@ -263,12 +343,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations GEOMAlgo_State theState); /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theCheckShape - the shape to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape, @@ -277,10 +357,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations GEOMAlgo_State theState); /*! - * \brief Find subshapes complying with given status about surface - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theCheckShape - the shape to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects */ @@ -300,7 +380,20 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations * \brief Sort shapes in the list by their coordinates. * \param SL The list of shapes to sort. */ - Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL); + struct CompareShapes : public std::binary_function + { + CompareShapes (bool isOldSorting) + : myIsOldSorting(isOldSorting) {} + + bool operator()(const TopoDS_Shape& lhs, const TopoDS_Shape& rhs); + + typedef NCollection_DataMap > NCollection_DataMapOfShapeDouble; + NCollection_DataMapOfShapeDouble myMap; + bool myIsOldSorting; + }; + + Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL, + const Standard_Boolean isOldSorting = Standard_True); /*! * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND. @@ -319,6 +412,13 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations */ Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape); + /*! + * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape. + * \param theShape The shape to get type of. + * \retval TopAbs_ShapeEnum Return type of shape for explode. + */ + Standard_EXPORT static TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape); + private: Handle(GEOM_Object) MakeShape (std::list theShapes, const Standard_Integer theObjectType, @@ -353,12 +453,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const Standard_Real theRadius); /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theSurface - the surface to check state of subshapes against + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theSurface - the surface to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Handle(TColStd_HSequenceOfInteger) getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface, @@ -367,10 +467,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations GEOMAlgo_State theState); /*! - * \brief Find subshapes complying with given status about surface - * \param theSurface - the surface to check state of subshapes against + * \brief Find sub-shapes complying with given status about surface + * \param theSurface - the surface to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state * \param theShapeEntries - outgoing entries like "entry1, entry2, ..." * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects @@ -383,15 +483,15 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations TCollection_AsciiString & theShapeEntries); /*! - * \brief Find IDs of subshapes complying with given status about quadrangle + * \brief Find IDs of sub-shapes complying with given status about quadrangle * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theTopLeftPoint - top left quadrangle corner * \param theTopRigthPoint - top right quadrangle corner * \param theBottomLeftPoint - bottom left quadrangle corner * \param theBottomRigthPoint - bottom right quadrangle corner * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Handle(TColStd_HSequenceOfInteger) getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape, @@ -403,12 +503,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const GEOMAlgo_State theState); /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theBox - the box to check state of subshapes against + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Handle(TColStd_HSequenceOfInteger) getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox, const Handle(GEOM_Object)& theShape, @@ -416,12 +516,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations GEOMAlgo_State theState); /*! - * \brief Find IDs of subshapes complying with given status about surface - * \param theCheckShape - the shape to check state of subshapes against + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theCheckShape - the shape to check state of sub-shapes against * \param theShape - the shape to explore - * \param theShapeType - type of subshape of theShape + * \param theShapeType - type of sub-shape of theShape * \param theState - required state - * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ Handle(TColStd_HSequenceOfInteger) getShapesOnShapeIDs (const Handle(GEOM_Object)& theCheckShape, diff --git a/src/GEOMImpl/GEOMImpl_ISketcher.hxx b/src/GEOMImpl/GEOMImpl_ISketcher.hxx index 2cec2cb61..0918083a5 100644 --- a/src/GEOMImpl/GEOMImpl_ISketcher.hxx +++ b/src/GEOMImpl/GEOMImpl_ISketcher.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an interface to a function for the Sketcher creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ISphere.hxx b/src/GEOMImpl/GEOMImpl_ISphere.hxx index 785af6fd7..d5bcf07ee 100644 --- a/src/GEOMImpl/GEOMImpl_ISphere.hxx +++ b/src/GEOMImpl/GEOMImpl_ISphere.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Sphere creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ISpline.hxx b/src/GEOMImpl/GEOMImpl_ISpline.hxx index 3694a556d..b20a7e6dc 100644 --- a/src/GEOMImpl/GEOMImpl_ISpline.hxx +++ b/src/GEOMImpl/GEOMImpl_ISpline.hxx @@ -1,30 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -//NOTE: This is an intreface to a function for the Spline creation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// NOTE: This is an interface to a function for the Spline creation. + #include "GEOM_Function.hxx" +#include #define SPL_ARG_LENG 1 -#define SPL_ARG_LAST 1 +#define SPL_ARG_CLOS 2 +#define SPL_ARG_REOR 3 +#define SPL_ARG_LAST 2 + +#define SPL_CONSTRUCTOR 4 +#define SPL_ARG_ARRAY 5 class GEOMImpl_ISpline { @@ -34,12 +41,31 @@ class GEOMImpl_ISpline void SetLength(int theLen) { _func->SetInteger(SPL_ARG_LENG, theLen); } + void SetIsClosed(bool theIsClosed) { _func->SetInteger(SPL_ARG_CLOS, (int)theIsClosed); } + + void SetDoReordering(bool theDoReordering) { _func->SetInteger(SPL_ARG_REOR, (int)theDoReordering); } + void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SPL_ARG_LAST + theId, theP); } int GetLength() { return _func->GetInteger(SPL_ARG_LENG); } + bool GetIsClosed() { return (bool)_func->GetInteger(SPL_ARG_CLOS); } + + bool GetDoReordering() { return (bool)_func->GetInteger(SPL_ARG_REOR); } + Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SPL_ARG_LAST + theId); } + + void SetConstructorType(int theConstructor) {_func->SetInteger(SPL_CONSTRUCTOR,theConstructor); } + + int GetConstructorType() { return _func->GetInteger(SPL_CONSTRUCTOR); } + + void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue) + { _func->SetRealArray(SPL_ARG_ARRAY, theValue); } + + + Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(SPL_ARG_ARRAY); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IThruSections.hxx b/src/GEOMImpl/GEOMImpl_IThruSections.hxx index f2e2a55e2..b78157131 100644 --- a/src/GEOMImpl/GEOMImpl_IThruSections.hxx +++ b/src/GEOMImpl/GEOMImpl_IThruSections.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Pipe creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ITorus.hxx b/src/GEOMImpl/GEOMImpl_ITorus.hxx index 9edc7e359..3c0c7b212 100644 --- a/src/GEOMImpl/GEOMImpl_ITorus.hxx +++ b/src/GEOMImpl/GEOMImpl_ITorus.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Torus creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx index 5150f0a1c..07098c561 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -1,42 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include -#include "utilities.h" -#include -#include - -#include -#include -#include -#include - -#include -#include - #include #include +#include #include #include #include @@ -51,6 +41,32 @@ #include +#include +#include + +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -112,7 +128,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -165,7 +181,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -221,7 +237,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -276,7 +292,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -331,7 +347,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -384,7 +400,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -445,7 +461,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -462,13 +478,13 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance //Make a Python command if (theCopy) { GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVectorDistance(" - << theObject << ", " << theVector << ", " << theDistance << ")"; + << theObject << ", " << theVector << ", " << theDistance << ")"; SetErrorCode(OK); return aCopy; } GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance(" - << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")"; + << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")"; SetErrorCode(OK); return theObject; } @@ -507,7 +523,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -535,12 +551,12 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject, - Handle(GEOM_Object) theVector, - double theStep1, - Standard_Integer theNbTimes1, - Handle(GEOM_Object) theVector2, - double theStep2, - Standard_Integer theNbTimes2) + Handle(GEOM_Object) theVector, + double theStep1, + Standard_Integer theNbTimes1, + Handle(GEOM_Object) theVector2, + double theStep2, + Standard_Integer theNbTimes2) { SetErrorCode(KO); @@ -559,7 +575,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; - GEOMImpl_ITranslate aTI(aFunction); + GEOMImpl_ITranslate aTI (aFunction); aTI.SetVector(theVector->GetLastFunction()); aTI.SetVector2(theVector2->GetLastFunction()); aTI.SetOriginal(aLastFunction); @@ -570,7 +586,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -593,6 +609,148 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje return aCopy; } +//============================================================================= +/*! + * TranslateShape1D + */ +//============================================================================= +/* +TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape1D (const TopoDS_Shape& theShape, + GEOMImpl_ITranslate* theTI) +{ + TopoDS_Shape aRes; + + // Vector + Handle(GEOM_Function) aVector = theTI->GetVector(); + if (aVector.IsNull()) { + StdFail_NotDone::Raise("Invalid object is given for vector argument"); + } + TopoDS_Shape aV = aVector->GetValue(); + if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) { + StdFail_NotDone::Raise("Invalid object is given for vector argument"); + } + TopoDS_Edge anEdge = TopoDS::Edge(aV); + + gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); + if (aP1.Distance(aP2) < gp::Resolution()) { + StdFail_NotDone::Raise("Invalid object is given for vector argument"); + } + + // Step and Nb.times + Standard_Real step = theTI->GetStep1(); + Standard_Integer nbtimes = theTI->GetNbIter1(); + + // Make multi-translation + gp_Trsf aTrsf; + gp_Vec aVec; + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound(aCompound); + + gp_Vec Vec (aP1, aP2); + Vec.Normalize(); + + TopLoc_Location aLocOrig = theShape.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + + for (int i = 0; i < nbtimes; i++) { + aVec = Vec * (i * step); + aTrsf.SetTranslation(aVec); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aTransformation(theShape, aTrsf, Standard_False); + //B.Add(aCompound, aTransformation.Shape()); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + B.Add(aCompound, theShape.Located(aLocRes)); + } + aRes = aCompound; + + return aRes; +} +*/ + +//============================================================================= +/*! + * TranslateShape2D + */ +//============================================================================= +/* +TopoDS_Shape GEOMImpl_ITransformOperations::TranslateShape2D (const TopoDS_Shape& theShape, + GEOMImpl_ITranslate* theTI) +{ + TopoDS_Shape aRes; + + // Vectors + Handle(GEOM_Function) aVector1 = theTI->GetVector(); + Handle(GEOM_Function) aVector2 = theTI->GetVector2(); + + if (aVector1.IsNull() || aVector2.IsNull()) { + StdFail_NotDone::Raise("Invalid object is given for vector argument"); + } + + TopoDS_Shape aV1 = aVector1->GetValue(); + TopoDS_Shape aV2 = aVector2->GetValue(); + + if (aV1.IsNull() || aV1.ShapeType() != TopAbs_EDGE || + aV2.IsNull() || aV2.ShapeType() != TopAbs_EDGE) { + StdFail_NotDone::Raise("Invalid object is given for vector argument"); + } + + TopoDS_Edge anEdge1 = TopoDS::Edge(aV1); + TopoDS_Edge anEdge2 = TopoDS::Edge(aV2); + + gp_Pnt aP11 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge1)); + gp_Pnt aP12 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge1)); + gp_Pnt aP21 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge2)); + gp_Pnt aP22 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge2)); + + if (aP11.Distance(aP12) < gp::Resolution() || + aP21.Distance(aP22) < gp::Resolution()) { + StdFail_NotDone::Raise("Invalid object is given for vector argument"); + } + + gp_Vec Vec1 (aP11, aP12); + gp_Vec Vec2 (aP21, aP22); + + Vec1.Normalize(); + Vec2.Normalize(); + + // Step and Nb.times + Standard_Real step1 = theTI->GetStep1(), step2 = theTI->GetStep2(); + Standard_Integer nbtimes1 = theTI->GetNbIter1(), nbtimes2 = theTI->GetNbIter2(); + + // Make multi-translation + gp_Trsf aTrsf; + gp_Vec aVec; + Standard_Real DX, DY, DZ; + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound(aCompound); + + TopLoc_Location aLocOrig = theShape.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + + for (int i = 0; i < nbtimes1; i++) { + for (int j = 0; j < nbtimes2; j++) { + DX = i * step1 * Vec1.X() + j * step2 * Vec2.X(); + DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y(); + DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z(); + aVec.SetCoord(DX, DY, DZ); + aTrsf.SetTranslation(aVec); + //NPAL18620: performance problem: multiple locations are accumulated + // in shape and need a great time to process + //BRepBuilderAPI_Transform aBRepTransformation(theShape, aTrsf, Standard_False); + //B.Add(aCompound, aBRepTransformation.Shape()); + TopLoc_Location aLocRes (aTrsf * aTrsfOrig); + B.Add(aCompound, theShape.Located(aLocRes)); + } + } + aRes = aCompound; + + return aRes; +} +*/ //============================================================================= /*! @@ -626,7 +784,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane //Compute the mirror try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -679,7 +837,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy //Compute the mirror try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -733,7 +891,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint //Compute the mirror try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -786,7 +944,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy //Compute the mirror try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -840,7 +998,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis //Compute the mirror try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -893,7 +1051,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy //Compute the mirror try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -945,7 +1103,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape //Compute the offset try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -999,7 +1157,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy //Compute the offset try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1022,6 +1180,60 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy } +//============================================================================= +/*! + * ProjectShapeCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::ProjectShapeCopy + (Handle(GEOM_Object) theSource, Handle(GEOM_Object) theTarget) +{ + SetErrorCode(KO); + + if (theSource.IsNull() || theTarget.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theSource->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be projected + + //Add a new Projection object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION); + + //Add a Projection function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_ProjectionDriver::GetID(), PROJECTION_COPY); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) return NULL; + + GEOMImpl_IMirror aTI (aFunction); + aTI.SetPlane(theTarget->GetLastFunction()); + aTI.SetOriginal(aLastFunction); + + //Compute the Projection + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Projection driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeProjection(" + << theSource << ", " << theTarget << ")"; + + SetErrorCode(OK); + return aCopy; +} + + //============================================================================= /*! * ScaleShape @@ -1058,7 +1270,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape //Compute the scale try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1119,7 +1331,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy //Compute the scale try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1190,7 +1402,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(G //Compute the scale try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1251,11 +1463,11 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape aTI.SetShape(anOriginal); aTI.SetEndLCS(theEndLCS->GetLastFunction()); if (!theStartLCS.IsNull()) - aTI.SetStartLCS(theStartLCS->GetLastFunction()); + aTI.SetStartLCS(theObject == theStartLCS ? anOriginal : theStartLCS->GetLastFunction()); //Compute the Position try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1314,7 +1526,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy //Compute the position try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1342,8 +1554,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath - (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath, - double theDistance, bool theCopy, bool theReverse) + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath, + double theDistance, bool theCopy, bool theReverse) { SetErrorCode(KO); @@ -1376,7 +1588,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath //Compute the position try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1393,7 +1605,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath //Make a Python command if (theCopy) { GEOM::TPythonDump(aFunction) << aCopy << " = geompy.PositionAlongPath(" - << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")"; + << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")"; SetErrorCode(OK); return aCopy; } @@ -1439,7 +1651,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1455,7 +1667,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t //Make a Python command GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject - << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)"; SetErrorCode(OK); return theObject; @@ -1492,7 +1704,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1508,7 +1720,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec //Make a Python command GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject - << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)"; SetErrorCode(OK); return aCopy; @@ -1537,7 +1749,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D); if (aFunction.IsNull()) return NULL; - //Check if the function is set correctly + //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL; GEOMImpl_IRotate aRI(aFunction); @@ -1547,7 +1759,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1575,11 +1787,11 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject, - Handle(GEOM_Object) theAxis, - double theAngle, - Standard_Integer theNbTimes1, - double theStep, - Standard_Integer theNbTimes2) + Handle(GEOM_Object) theAxis, + double theAngle, + Standard_Integer theNbTimes1, + double theStep, + Standard_Integer theNbTimes2) { SetErrorCode(KO); @@ -1608,7 +1820,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1637,9 +1849,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject, - Handle(GEOM_Object) theCentPoint, - Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2) + Handle(GEOM_Object) theCentPoint, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2) { SetErrorCode(KO); @@ -1670,7 +1882,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEO //Compute the translation try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1686,7 +1898,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEO //Make a Python command GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.RotateThreePoints(" << theObject - << ", " << theCentPoint << ", "< 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif if (!GetSolver()->ComputeFunction(aFunction)) { @@ -1743,9 +1955,154 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle //Make a Python command GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject - << ", " << theCentPoint << ", "<GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; // There is no function which creates an object to be transformed + + Handle(GEOM_Function) aSampleFunc = theSample->GetLastFunction(); + if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object + + // Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + // Add a transform function (depends on theSample function) + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(aSampleFunc->GetDriverGUID(), aSampleFunc->GetType()); + if (aFunction.IsNull()) return NULL; + + // Check if the function is set correctly + if (aFunction->GetDriverGUID() != aSampleFunc->GetDriverGUID()) return NULL; + + if (aSampleFunc->GetDriverGUID() == GEOMImpl_TranslateDriver::GetID()) { + switch (aSampleFunc->GetType()) { + case TRANSLATE_1D: + { + GEOMImpl_ITranslate aRI_sample (aSampleFunc); + GEOMImpl_ITranslate aRI_target (aFunction); + + aRI_target.SetVector(aRI_sample.GetVector()); + aRI_target.SetStep1(aRI_sample.GetStep1()); + aRI_target.SetNbIter1(aRI_sample.GetNbIter1()); + + aRI_target.SetOriginal(aLastFunction); + } + break; + case TRANSLATE_2D: + { + GEOMImpl_ITranslate aRI_sample (aSampleFunc); + GEOMImpl_ITranslate aRI_target (aFunction); + + aRI_target.SetVector(aRI_sample.GetVector()); + aRI_target.SetStep1(aRI_sample.GetStep1()); + aRI_target.SetNbIter1(aRI_sample.GetNbIter1()); + + aRI_target.SetVector2(aRI_sample.GetVector2()); + aRI_target.SetStep2(aRI_sample.GetStep2()); + aRI_target.SetNbIter2(aRI_sample.GetNbIter2()); + + aRI_target.SetOriginal(aLastFunction); + } + break; + default: + { + SetErrorCode("Not implemented case of TransformLikeOtherCopy"); + return NULL; + } + } + } + else if (aSampleFunc->GetDriverGUID() == GEOMImpl_RotateDriver::GetID()) { + switch (aSampleFunc->GetType()) { + case ROTATE_1D: + { + GEOMImpl_IRotate aRI_sample (aSampleFunc); + GEOMImpl_IRotate aRI_target (aFunction); + + aRI_target.SetAxis(aRI_sample.GetAxis()); + aRI_target.SetNbIter1(aRI_sample.GetNbIter1()); + + aRI_target.SetOriginal(aLastFunction); + } + break; + case ROTATE_2D: + { + GEOMImpl_IRotate aRI_sample (aSampleFunc); + GEOMImpl_IRotate aRI_target (aFunction); + + aRI_target.SetAxis(aRI_sample.GetAxis()); + + aRI_target.SetNbIter1(aRI_sample.GetNbIter1()); + aRI_target.SetNbIter2(aRI_sample.GetNbIter2()); + + aRI_target.SetAngle(aRI_sample.GetAngle()); + aRI_target.SetStep(aRI_sample.GetStep()); + + aRI_target.SetDir2(aRI_sample.GetDir2()); + + aRI_target.SetOriginal(aLastFunction); + } + break; + case ROTATE_THREE_POINTS_COPY: + { + GEOMImpl_IRotate aRI_sample (aSampleFunc); + GEOMImpl_IRotate aRI_target (aFunction); + + aRI_target.SetCentPoint(aRI_sample.GetCentPoint()); + aRI_target.SetPoint1(aRI_sample.GetPoint1()); + aRI_target.SetPoint2(aRI_sample.GetPoint2()); + + aRI_target.SetOriginal(aLastFunction); + } + break; + default: + { + SetErrorCode("Not implemented case of TransformLikeOtherCopy"); + return NULL; + } + } + } + else { + SetErrorCode("Not implemented case of TransformLikeOtherCopy"); + return NULL; + } + + // Compute the transformation + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + //GEOM::TPythonDump(aFunction) << aCopy << " = geompy.TransformLikeOtherCopy(" + // << theObject << ", " << theSample << ")"; + + SetErrorCode(OK); + return aCopy; +} diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx index 99c52595e..270854229 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOMImpl_ITransformOperations_HXX_ #define _GEOMImpl_ITransformOperations_HXX_ @@ -26,7 +27,12 @@ #include "GEOM_IOperations.hxx" #include "GEOM_Engine.hxx" #include "GEOM_Object.hxx" + #include +#include + +class GEOMImpl_ITranslate; +class GEOMImpl_IRotate; class GEOMImpl_ITransformOperations : public GEOM_IOperations { @@ -72,6 +78,14 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations double theStep2, Standard_Integer theNbTimes2); + /* + Standard_EXPORT static TopoDS_Shape TranslateShape1D (const TopoDS_Shape& theShape, + GEOMImpl_ITranslate* theTI); + + Standard_EXPORT static TopoDS_Shape TranslateShape2D (const TopoDS_Shape& theShape, + GEOMImpl_ITranslate* theTI); + */ + Standard_EXPORT Handle(GEOM_Object) MirrorPlane (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane); @@ -96,6 +110,9 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations Standard_EXPORT Handle(GEOM_Object) OffsetShapeCopy (Handle(GEOM_Object) theObject, double theOffset); + Standard_EXPORT Handle(GEOM_Object) ProjectShapeCopy (Handle(GEOM_Object) theSource, + Handle(GEOM_Object) theTarget); + Standard_EXPORT Handle(GEOM_Object) ScaleShape (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor); @@ -122,8 +139,8 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations Standard_EXPORT Handle(GEOM_Object) PositionAlongPath (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath, double theDistance, - bool theCopy, - bool theReverse); + bool theCopy, + bool theReverse); Standard_EXPORT Handle(GEOM_Object) Rotate (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, @@ -154,6 +171,9 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2); + Standard_EXPORT Handle(GEOM_Object) TransformLikeOtherCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theSample); + }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ITranslate.hxx b/src/GEOMImpl/GEOMImpl_ITranslate.hxx index 4c6692440..4abbdcc86 100755 --- a/src/GEOMImpl/GEOMImpl_ITranslate.hxx +++ b/src/GEOMImpl/GEOMImpl_ITranslate.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //NOTE: This is an intreface to a function for the Translate creation. // #include "GEOM_Function.hxx" diff --git a/src/GEOMImpl/GEOMImpl_IVector.hxx b/src/GEOMImpl/GEOMImpl_IVector.hxx index fc63787ac..02a8dc8a9 100644 --- a/src/GEOMImpl/GEOMImpl_IVector.hxx +++ b/src/GEOMImpl/GEOMImpl_IVector.hxx @@ -1,26 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -//NOTE: This is an intreface to a function for the vector creation. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +//NOTE: This is an interface to a function for the vector creation. + #include "GEOM_Function.hxx" #define VEC_ARG_DX 1 diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx index 4a309a0b6..ee1495f0e 100644 --- a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -53,7 +54,8 @@ typedef TopoDS_Shape (*funcPoint)(const TCollection_AsciiString&, const TCollection_AsciiString&, - TCollection_AsciiString&); + TCollection_AsciiString&, + const TDF_Label&); //======================================================================= //function : GetID @@ -100,14 +102,14 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const fp = (funcPoint)GetProc( anImportLib, "Import" ); if ( !fp ) { - TCollection_AsciiString aMsg = aFormatName; + TCollection_AsciiString aMsg = aFormatName.SubString(1,4); aMsg += " plugin was not installed"; Standard_Failure::Raise(aMsg.ToCString()); } // perform the import TCollection_AsciiString anError; - TopoDS_Shape aShape = fp( aFileName, aFormatName, anError ); + TopoDS_Shape aShape = fp(aFileName, aFormatName, anError, aFunction->GetNamingEntry()); // unload plugin library // commented by enk: @@ -145,10 +147,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ImportDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ImportDriver", - sizeof(GEOMImpl_ImportDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ImportDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -157,7 +159,8 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ImportDriver_Type_() //function : DownCast //purpose : //======================================================================= -const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_ImportDriver) _anOtherObject; @@ -167,5 +170,5 @@ const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast(cons } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.hxx b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx index c165d1aab..0c625e05c 100644 --- a/src/GEOMImpl/GEOMImpl_ImportDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ImportDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.cxx b/src/GEOMImpl/GEOMImpl_LineDriver.cxx index 9e9a18e05..0ec1efec4 100644 --- a/src/GEOMImpl/GEOMImpl_LineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_LineDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -28,6 +29,7 @@ #include #include +#include #include #include #include @@ -88,12 +90,14 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const if (aShape1.IsSame(aShape2)) { Standard_ConstructionError::Raise("The end points must be different"); } - gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); - gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2)); + TopoDS_Vertex V1 = TopoDS::Vertex(aShape1); + TopoDS_Vertex V2 = TopoDS::Vertex(aShape2); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + gp_Pnt P2 = BRep_Tool::Pnt(V2); if (P1.Distance(P2) < Precision::Confusion()) { Standard_ConstructionError::Raise("The end points are too close"); } - aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + aShape = BRepBuilderAPI_MakeEdge(V1, V2).Shape(); } else if (aType == LINE_TWO_FACES) { Handle(GEOM_Function) aRefFace1 = aPI.GetFace1(); @@ -115,18 +119,18 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const } else { - TopExp_Explorer Exp (E, TopAbs_EDGE); - if ( Exp.More() ){ - aShape = Exp.Current(); - Exp.Next(); - } - else - { - Standard_ConstructionError::Raise("Faces not have intersection line"); - aShape = E.Shape(); - } - if ( Exp.More() ) - aShape = E.Shape(); + TopExp_Explorer Exp (E, TopAbs_EDGE); + if ( Exp.More() ){ + aShape = Exp.Current(); + Exp.Next(); + } + else + { + Standard_ConstructionError::Raise("Faces not have intersection line"); + aShape = E.Shape(); + } + if ( Exp.More() ) + aShape = E.Shape(); } } else if (aType == LINE_PNT_DIR) { @@ -143,7 +147,8 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const if (aShape1.IsSame(aShape2)) { Standard_ConstructionError::Raise("The end points must be different"); } - gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); + TopoDS_Vertex Vstart = TopoDS::Vertex(aShape1); + gp_Pnt P1 = BRep_Tool::Pnt(Vstart); TopoDS_Edge anE = TopoDS::Edge(aShape2); TopoDS_Vertex V1, V2; @@ -156,14 +161,19 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const if (PV1.Distance(PV2) < Precision::Confusion()) { Standard_ConstructionError::Raise("Vector with null magnitude"); } - - gp_Pnt P2 (P1.XYZ() + PV2.XYZ() - PV1.XYZ()); - aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + TopoDS_Vertex Vend; + if ( V1.IsSame( Vstart ) ) + Vend = V2; + else if ( V2.IsSame( Vstart ) ) + Vend = V1; + else + Vend = BRepBuilderAPI_MakeVertex( gp_Pnt(P1.XYZ() + PV2.XYZ() - PV1.XYZ()) ); + aShape = BRepBuilderAPI_MakeEdge(Vstart, Vend).Shape(); } else { } if (aShape.IsNull()) return 0; - aShape.Infinite(true); + //aShape.Infinite(true); // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines) aFunction->SetValue(aShape); @@ -190,10 +200,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_LineDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_LineDriver", - sizeof(GEOMImpl_LineDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_LineDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.hxx b/src/GEOMImpl/GEOMImpl_LineDriver.hxx index 4f5d8e2c5..01d24c309 100644 --- a/src/GEOMImpl/GEOMImpl_LineDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_LineDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_LineDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx index bbe8a5f38..25f22d214 100644 --- a/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx @@ -1,30 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include #include #include #include +#include #include #include @@ -102,6 +104,48 @@ Standard_Integer GEOMImpl_MarkerDriver::Execute(TFunction_Logbook& log) const gp_Ax3 anA (aPO, aN, aVX); gp_Pln aPln (anA); + double aTrimSize = 100.0; + aShape = BRepBuilderAPI_MakeFace(aPln, -aTrimSize, +aTrimSize, -aTrimSize, +aTrimSize).Shape(); + } else if (aType == MARKER_SHAPE) { + Handle(GEOM_Function) aRefShape = aPI.GetShape(); + TopoDS_Shape aSh = aRefShape->GetValue(); + gp_Ax3 anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aSh); + gp_Pln aPln (anAx3); + + double aTrimSize = 100.0; + aShape = BRepBuilderAPI_MakeFace(aPln, -aTrimSize, +aTrimSize, -aTrimSize, +aTrimSize).Shape(); + } else if (aType == MARKER_PNT2VEC) { + Handle(GEOM_Function) aRefOrigin = aPI.GetOrigin(); + Handle(GEOM_Function) aRefXVec = aPI.GetXVec(); + Handle(GEOM_Function) aRefYVec = aPI.GetYVec(); + TopoDS_Shape aShapeOrigin = aRefOrigin->GetValue(); + TopoDS_Shape aShapeXVec = aRefXVec->GetValue(); + TopoDS_Shape aShapeYVec = aRefYVec->GetValue(); + if (aShapeOrigin.ShapeType() != TopAbs_VERTEX || aShapeOrigin.IsNull()) return 0; + if (aShapeXVec.ShapeType() != TopAbs_EDGE || aShapeXVec.IsNull()) return 0; + if (aShapeYVec.ShapeType() != TopAbs_EDGE || aShapeYVec.IsNull()) return 0; + + gp_Pnt aPO = BRep_Tool::Pnt( TopoDS::Vertex( aShapeOrigin ) ); + + gp_Pnt aPX1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShapeXVec ) ) ); + gp_Pnt aPX2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShapeXVec ) ) ); + gp_Vec aVX( aPX1, aPX2 ); + + gp_Pnt aPY1 = BRep_Tool::Pnt( TopExp::FirstVertex( TopoDS::Edge( aShapeYVec ) ) ); + gp_Pnt aPY2 = BRep_Tool::Pnt( TopExp::LastVertex( TopoDS::Edge( aShapeYVec ) ) ); + gp_Vec aVY( aPY1, aPY2 ); + + if (aVX.Magnitude() < gp::Resolution() || aVY.Magnitude() < gp::Resolution()) + Standard_ConstructionError::Raise + ("Local CS creation aborted: vector of zero length is given"); + + if ( aVX.IsParallel(aVY, Precision::Angular())) + Standard_ConstructionError::Raise("Parallel Vectors given"); + + gp_Vec aN = aVX ^ aVY; + gp_Ax3 anA (aPO, aN, aVX); + gp_Pln aPln (anA); + double aTrimSize = 100.0; aShape = BRepBuilderAPI_MakeFace(aPln, -aTrimSize, +aTrimSize, -aTrimSize, +aTrimSize).Shape(); } else { @@ -134,10 +178,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_MarkerDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MarkerDriver", - sizeof(GEOMImpl_MarkerDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_MarkerDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx b/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx index 90222bdd9..eafcc60ef 100644 --- a/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_MarkerDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx index b9dff3e14..5e014b4eb 100644 --- a/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -35,6 +36,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -90,23 +96,72 @@ Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("Shape for centre of mass calculation is null"); } - GProp_GProps aSystem; - gp_Pnt aCenterMass; + gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(aShapeBase); + gp_Pnt aCenterMass = aPos.Location(); + aShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); + } + else if (aType == VERTEX_BY_INDEX) + { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + if (aShapeBase.IsNull()) { + Standard_NullObject::Raise("Shape for centre of mass calculation is null"); + } + + int index = aCI.GetIndex(); + gp_Pnt aVertex; if (aShapeBase.ShapeType() == TopAbs_VERTEX) { - aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase)); - } else if (aShapeBase.ShapeType() == TopAbs_EDGE || aShapeBase.ShapeType() == TopAbs_WIRE) { - BRepGProp::LinearProperties(aShapeBase, aSystem); - aCenterMass = aSystem.CentreOfMass(); - } else if (aShapeBase.ShapeType() == TopAbs_FACE || aShapeBase.ShapeType() == TopAbs_SHELL) { - BRepGProp::SurfaceProperties(aShapeBase, aSystem); - aCenterMass = aSystem.CentreOfMass(); + if ( index != 1 ) + Standard_NullObject::Raise("Vertex index is out of range"); + else + aVertex = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase)); + } else if (aShapeBase.ShapeType() == TopAbs_EDGE) { + TopoDS_Vertex aV1, aV2; + TopoDS_Edge anEdgeE = TopoDS::Edge(aShapeBase); + + TopExp::Vertices(anEdgeE, aV1, aV2); + gp_Pnt aP1 = BRep_Tool::Pnt(aV1); + gp_Pnt aP2 = BRep_Tool::Pnt(aV2); + + if (index < 0 || index > 1) + Standard_NullObject::Raise("Vertex index is out of range"); + + if ( ( anEdgeE.Orientation() == TopAbs_FORWARD && index == 0 ) || + ( anEdgeE.Orientation() == TopAbs_REVERSED && index == 1 ) ) + aVertex = aP1; + else + aVertex = aP2; + } else if (aShapeBase.ShapeType() == TopAbs_WIRE) { + TopTools_IndexedMapOfShape anEdgeShapes; + TopTools_IndexedMapOfShape aVertexShapes; + TopoDS_Vertex aV1, aV2; + TopoDS_Wire aWire = TopoDS::Wire(aShapeBase); + TopExp_Explorer exp (aWire, TopAbs_EDGE); + for (; exp.More(); exp.Next()) { + anEdgeShapes.Add(exp.Current()); + TopoDS_Edge E = TopoDS::Edge(exp.Current()); + TopExp::Vertices(E, aV1, aV2); + if ( aVertexShapes.Extent() == 0) + aVertexShapes.Add(aV1); + if ( !aV1.IsSame( aVertexShapes(aVertexShapes.Extent()) ) ) + aVertexShapes.Add(aV1); + if ( !aV2.IsSame( aVertexShapes(aVertexShapes.Extent()) ) ) + aVertexShapes.Add(aV2); + } + + if (index < 0 || index > aVertexShapes.Extent()) + Standard_NullObject::Raise("Vertex index is out of range"); + + if (aWire.Orientation() == TopAbs_FORWARD) + aVertex = BRep_Tool::Pnt(TopoDS::Vertex(aVertexShapes(index+1))); + else + aVertex = BRep_Tool::Pnt(TopoDS::Vertex(aVertexShapes(aVertexShapes.Extent() - index))); } else { - BRepGProp::VolumeProperties(aShapeBase, aSystem); - aCenterMass = aSystem.CentreOfMass(); + Standard_NullObject::Raise("Shape for vertex calculation is not an edge or wire"); } - aShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); + aShape = BRepBuilderAPI_MakeVertex(aVertex).Shape(); } else if (aType == VECTOR_FACE_NORMALE) { @@ -147,6 +202,17 @@ Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const gp_Vec Vec1,Vec2; BRepAdaptor_Surface SF (aFace); SF.D1(pUV.X(), pUV.Y(), p1, Vec1, Vec2); + if (Vec1.Magnitude() < Precision::Confusion()) { + gp_Vec tmpV; + gp_Pnt tmpP; + SF.D1(pUV.X(), pUV.Y()-0.1, tmpP, Vec1, tmpV); + } + else if (Vec2.Magnitude() < Precision::Confusion()) { + gp_Vec tmpV; + gp_Pnt tmpP; + SF.D1(pUV.X()-0.1, pUV.Y(), tmpP, tmpV, Vec2); + } + gp_Vec V = Vec1.Crossed(Vec2); Standard_Real mod = V.Magnitude(); if (mod < Precision::Confusion()) @@ -159,7 +225,7 @@ Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const Standard_Real radius1 = Abs(aProperties.MinCurvature()); Standard_Real radius2 = Abs(aProperties.MaxCurvature()); if (Abs(radius1) > Precision::Confusion()) { - radius = 1.0 / radius1; + radius = 1.0 / radius1; if (Abs(radius2) > Precision::Confusion()) { radius = (radius + 1.0 / radius2) / 2.0; } @@ -229,10 +295,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_MeasureDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MeasureDriver", - sizeof(GEOMImpl_MeasureDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_MeasureDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx b/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx index 9463fed63..aa49703b1 100644 --- a/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_MeasureDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx b/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx index 69a8c599d..3c08295b9 100644 --- a/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -29,6 +30,9 @@ #include #include +#include +#include +#include #include #include @@ -117,8 +121,8 @@ Standard_Integer GEOMImpl_MirrorDriver::Execute(TFunction_Logbook& log) const const gp_Dir dir = pos.Direction(); /* Main direction of the plane (Z axis) */ gp_Ax2 aPln (loc, dir); aTrsf.SetMirror(aPln); - - } else if (aType == MIRROR_AXIS || aType == MIRROR_AXIS_COPY) { + } + else if (aType == MIRROR_AXIS || aType == MIRROR_AXIS_COPY) { Handle(GEOM_Function) anAxis = TI.GetAxis(); if (anAxis.IsNull()) return 0; TopoDS_Shape anAxisShape = anAxis->GetValue(); @@ -130,8 +134,8 @@ Standard_Integer GEOMImpl_MirrorDriver::Execute(TFunction_Logbook& log) const gp_Vec aV (aP1, aP2); gp_Ax1 anAx1 (aP1, aV); aTrsf.SetMirror(anAx1); - - } else if (aType == MIRROR_POINT || aType == MIRROR_POINT_COPY) { + } + else if (aType == MIRROR_POINT || aType == MIRROR_POINT_COPY) { Handle(GEOM_Function) aPoint = TI.GetPoint(); if (aPoint.IsNull()) return 0; TopoDS_Shape aVertexShape = aPoint->GetValue(); @@ -140,7 +144,8 @@ Standard_Integer GEOMImpl_MirrorDriver::Execute(TFunction_Logbook& log) const gp_Pnt aP = BRep_Tool::Pnt(aVertex); aTrsf.SetMirror(aP); - } else { + } + else { return 0; } @@ -174,10 +179,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_MirrorDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MirrorDriver", - sizeof(GEOMImpl_MirrorDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_MirrorDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -197,7 +202,5 @@ const Handle(GEOMImpl_MirrorDriver) Handle(GEOMImpl_MirrorDriver)::DownCast(cons } } - return _anOtherObject ; + return _anOtherObject; } - - diff --git a/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx b/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx index 3fafbd3aa..c9d7cf497 100644 --- a/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_MirrorDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx index ff68f7e8d..7bcf8af96 100644 --- a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -37,6 +38,11 @@ #include #include +#include +#include +#include + +#include #include //======================================================================= @@ -90,7 +96,22 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const aTol); if (MO.IsDone()) { aShape = MO.Shape(); - } else { + // 23.04.2010 skl for bug 21699 from Mantis + BRepCheck_Analyzer ana (aShape, Standard_True); + ana.Init(aShape); + if (!ana.IsValid()) { + ShapeFix_ShapeTolerance aSFT; + aSFT.LimitTolerance(aShape, Precision::Confusion(), + Precision::Confusion(), TopAbs_SHAPE); + Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape); + aSfs->Perform(); + aShape = aSfs->Shape(); + ana.Init(aShape); + if (!ana.IsValid()) + Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result"); + } + } + else { StdFail_NotDone::Raise("Offset construction failed"); } } else { @@ -123,10 +144,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_OffsetDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_OffsetDriver", - sizeof(GEOMImpl_OffsetDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_OffsetDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx index b171523fe..3d9c2974e 100644 --- a/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_OffsetDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx index 40d68aa88..703735b22 100644 --- a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -28,14 +29,15 @@ #include #include -//#include #include -#include #include +#include +//#include #include #include +#include #include #include @@ -45,11 +47,14 @@ #include #include #include +#include #include +#include #include #include +#include #include #include #include @@ -116,6 +121,9 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const //sklNMTAlgo_Splitter1 PS; GEOMAlgo_Splitter PS; + TopTools_DataMapOfShapeShape aCopyMap; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + if (aType == PARTITION_PARTITION || aType == PARTITION_NO_SELF_INTERSECTIONS) { Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); @@ -140,8 +148,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("In Partition a shape is null"); } // + //BRepBuilderAPI_Copy aCopyTool (aShape_i); + TopoDS_Shape aShape_i_copy; + TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy); + //if (aCopyTool.IsDone()) + // aShape_i_copy = aCopyTool.Shape(); + //else + // Standard_NullObject::Raise("Bad shape detected"); + // + // fill aCopyMap for history + TopTools_IndexedMapOfShape aShape_i_inds; + TopTools_IndexedMapOfShape aShape_i_copy_inds; + TopExp::MapShapes(aShape_i, aShape_i_inds); + TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds); + Standard_Integer nbInds = aShape_i_inds.Extent(); + for (Standard_Integer ie = 1; ie <= nbInds; ie++) { + aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie)); + } + // TopTools_ListOfShape aSimpleShapes; - PrepareShapes(aShape_i, aType, aSimpleShapes); + //PrepareShapes(aShape_i, aType, aSimpleShapes); + PrepareShapes(aShape_i_copy, aType, aSimpleShapes); TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes); for (; aSimpleIter.More(); aSimpleIter.Next()) { const TopoDS_Shape& aSimpleSh = aSimpleIter.Value(); @@ -163,8 +190,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("In Partition a tool shape is null"); } // + //BRepBuilderAPI_Copy aCopyTool (aShape_i); + TopoDS_Shape aShape_i_copy; + TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy); + //if (aCopyTool.IsDone()) + // aShape_i_copy = aCopyTool.Shape(); + //else + // Standard_NullObject::Raise("Bad shape detected"); + // + // fill aCopyMap for history + TopTools_IndexedMapOfShape aShape_i_inds; + TopTools_IndexedMapOfShape aShape_i_copy_inds; + TopExp::MapShapes(aShape_i, aShape_i_inds); + TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds); + Standard_Integer nbInds = aShape_i_inds.Extent(); + for (Standard_Integer ie = 1; ie <= nbInds; ie++) { + aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie)); + } + // TopTools_ListOfShape aSimpleShapes; - PrepareShapes(aShape_i, aType, aSimpleShapes); + //PrepareShapes(aShape_i, aType, aSimpleShapes); + PrepareShapes(aShape_i_copy, aType, aSimpleShapes); TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes); for (; aSimpleIter.More(); aSimpleIter.Next()) { const TopoDS_Shape& aSimpleSh = aSimpleIter.Value(); @@ -182,8 +228,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("In Partition a Keep Inside shape is null"); } // + //BRepBuilderAPI_Copy aCopyTool (aShape_i); + TopoDS_Shape aShape_i_copy; + TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy); + //if (aCopyTool.IsDone()) + // aShape_i_copy = aCopyTool.Shape(); + //else + // Standard_NullObject::Raise("Bad shape detected"); + // + // fill aCopyMap for history + TopTools_IndexedMapOfShape aShape_i_inds; + TopTools_IndexedMapOfShape aShape_i_copy_inds; + TopExp::MapShapes(aShape_i, aShape_i_inds); + TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds); + Standard_Integer nbInds = aShape_i_inds.Extent(); + for (Standard_Integer ie = 1; ie <= nbInds; ie++) { + aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie)); + } + // TopTools_ListOfShape aSimpleShapes; - PrepareShapes(aShape_i, aType, aSimpleShapes); + //PrepareShapes(aShape_i, aType, aSimpleShapes); + PrepareShapes(aShape_i_copy, aType, aSimpleShapes); TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes); for (; aSimpleIter.More(); aSimpleIter.Next()) { const TopoDS_Shape& aSimpleSh = aSimpleIter.Value(); @@ -200,8 +265,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("In Partition a Remove Inside shape is null"); } // + //BRepBuilderAPI_Copy aCopyTool (aShape_i); + TopoDS_Shape aShape_i_copy; + TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy); + //if (aCopyTool.IsDone()) + // aShape_i_copy = aCopyTool.Shape(); + //else + // Standard_NullObject::Raise("Bad shape detected"); + // + // fill aCopyMap for history + TopTools_IndexedMapOfShape aShape_i_inds; + TopTools_IndexedMapOfShape aShape_i_copy_inds; + TopExp::MapShapes(aShape_i, aShape_i_inds); + TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds); + Standard_Integer nbInds = aShape_i_inds.Extent(); + for (Standard_Integer ie = 1; ie <= nbInds; ie++) { + aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie)); + } + // TopTools_ListOfShape aSimpleShapes; - PrepareShapes(aShape_i, aType, aSimpleShapes); + //PrepareShapes(aShape_i, aType, aSimpleShapes); + PrepareShapes(aShape_i_copy, aType, aSimpleShapes); TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes); for (; aSimpleIter.More(); aSimpleIter.Next()) { const TopoDS_Shape& aSimpleSh = aSimpleIter.Value(); @@ -211,7 +295,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const } PS.SetLimitMode(aCI.GetKeepNonlimitShapes()); - PS.SetLimit( (TopAbs_ShapeEnum)aCI.GetLimit() ); + PS.SetLimit((TopAbs_ShapeEnum)aCI.GetLimit()); PS.Perform(); //skl PS.Compute(); @@ -244,11 +328,52 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise("In Half Partition a shape or a plane is null"); } + TopoDS_Shape aShapeArg_copy; + TopoDS_Shape aPlaneArg_copy; + { + TNaming_CopyShape::CopyTool(aShapeArg, aMapTShapes, aShapeArg_copy); + //BRepBuilderAPI_Copy aCopyTool (aShapeArg); + //if (aCopyTool.IsDone()) + // aShapeArg_copy = aCopyTool.Shape(); + //else + // Standard_NullObject::Raise("Bad shape detected"); + // + // fill aCopyMap for history + TopTools_IndexedMapOfShape aShapeArg_inds; + TopTools_IndexedMapOfShape aShapeArg_copy_inds; + TopExp::MapShapes(aShapeArg, aShapeArg_inds); + TopExp::MapShapes(aShapeArg_copy, aShapeArg_copy_inds); + Standard_Integer nbInds = aShapeArg_inds.Extent(); + for (Standard_Integer ie = 1; ie <= nbInds; ie++) { + aCopyMap.Bind(aShapeArg_inds.FindKey(ie), aShapeArg_copy_inds.FindKey(ie)); + } + } + { + TNaming_CopyShape::CopyTool(aPlaneArg, aMapTShapes, aPlaneArg_copy); + //BRepBuilderAPI_Copy aCopyTool (aPlaneArg); + //if (aCopyTool.IsDone()) + // aPlaneArg_copy = aCopyTool.Shape(); + //else + // Standard_NullObject::Raise("Bad shape detected"); + // + // fill aCopyMap for history + TopTools_IndexedMapOfShape aPlaneArg_inds; + TopTools_IndexedMapOfShape aPlaneArg_copy_inds; + TopExp::MapShapes(aPlaneArg, aPlaneArg_inds); + TopExp::MapShapes(aPlaneArg_copy, aPlaneArg_copy_inds); + Standard_Integer nbInds = aPlaneArg_inds.Extent(); + for (Standard_Integer ie = 1; ie <= nbInds; ie++) { + aCopyMap.Bind(aPlaneArg_inds.FindKey(ie), aPlaneArg_copy_inds.FindKey(ie)); + } + } + // add object shapes that are in ListShapes; - PS.AddShape(aShapeArg); + PS.AddShape(aShapeArg_copy); + //PS.AddShape(aShapeArg); // add tool shapes that are in ListTools and not in ListShapes; - PS.AddTool(aPlaneArg); + PS.AddTool(aPlaneArg_copy); + //PS.AddTool(aPlaneArg); //skl PS.Compute(); PS.Perform(); @@ -261,6 +386,15 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const aShape = PS.Shape(); if (aShape.IsNull()) return 0; + //Alternative case to check not valid partition IPAL21418 + TopoDS_Iterator It (aShape, Standard_True, Standard_True); + int nbSubshapes=0; + for (; It.More(); It.Next()) + nbSubshapes++; + if (!nbSubshapes) + Standard_ConstructionError::Raise("Partition aborted : non valid shape result"); + //end of IPAL21418 + if (!BRepAlgo::IsValid(aShape)) { // 08.07.2008 added by skl during fixing bug 19761 from Mantis ShapeFix_ShapeTolerance aSFT; @@ -283,6 +417,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult(); // history for all argument shapes + // be sure to use aCopyMap TDF_LabelSequence aLabelSeq; aFunction->GetDependency(aLabelSeq); Standard_Integer nbArg = aLabelSeq.Length(); @@ -304,11 +439,24 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) { TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie); + // be sure to use aCopyMap here + if (aCopyMap.IsBound(anEntity)) + anEntity = aCopyMap.Find(anEntity); + // if (!aMR.Contains(anEntity)) continue; const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity); Standard_Integer nbModified = aModified.Extent(); + if (nbModified > 0) { // Mantis issue 0021182 + int ih = 1; + TopTools_ListIteratorOfListOfShape itM (aModified); + for (; itM.More() && nbModified > 0; itM.Next(), ++ih) { + if (!aResIndices.Contains(itM.Value())) { + nbModified = 0; + } + } + } if (nbModified > 0) { TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True); Handle(TDataStd_IntegerArray) anAttr = @@ -336,21 +484,17 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const //======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_() { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PartitionDriver", - sizeof(GEOMImpl_PartitionDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + static Handle_Standard_Transient _Ancestors[] = {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = + new Standard_Type ("GEOMImpl_PartitionDriver", sizeof(GEOMImpl_PartitionDriver), + 1, (Standard_Address)_Ancestors, (Standard_Address)NULL); return _aType; } @@ -369,5 +513,5 @@ const Handle(GEOMImpl_PartitionDriver) Handle(GEOMImpl_PartitionDriver)::DownCas } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx index 4c0e0d684..10b250455 100644 --- a/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_PartitionDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 430cb0ef9..e3c734a10 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 #include @@ -28,11 +28,10 @@ #include #include #include +#include #include #include -#include - #include #include #include @@ -50,6 +49,7 @@ #include #include #include +#include #include #include @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -93,7 +94,6 @@ #include "utilities.h" - //======================================================================= //function : GetID //purpose : @@ -104,7 +104,6 @@ const Standard_GUID& GEOMImpl_PipeDriver::GetID() return aPipeDriver; } - //======================================================================= //function : GEOMImpl_PipeDriver //purpose : @@ -113,15 +112,14 @@ GEOMImpl_PipeDriver::GEOMImpl_PipeDriver() { } - //======================================================================= //function : FillForOtherEdges //purpose : auxilary for CreatePipeForShellSections() //======================================================================= static bool FillForOtherEdges(const TopoDS_Shape& F1, - const TopoDS_Shape& E1, - const TopoDS_Shape& V1, - TopTools_IndexedDataMapOfShapeShape& FF) + const TopoDS_Shape& E1, + const TopoDS_Shape& V1, + TopTools_IndexedDataMapOfShapeShape& FF) { //cout<<"FillForOtherEdges"<Length(); + Standard_Integer nbLocs = (theHSeqLocs.IsNull() ? 0 : theHSeqLocs->Length()); + + if (nbLocs && nbLocs != nbBases) { + Standard_ConstructionError::Raise("Number of sections is not equal to number of locations "); + } + + TopTools_SequenceOfShape aSeqBases; + TopTools_SequenceOfShape aSeqLocs; + TopTools_SequenceOfShape aSeqFaces; + + Standard_Integer i = 1; + for (i = 1; i <= nbBases; i++) { + if (theHSeqBases->Value(i).IsNull()) + continue; + + // Make copy to prevent modifying of base object 0020766 : EDF 1320 + TopoDS_Shape aShapeBase; + BRepBuilderAPI_Copy Copy (theHSeqBases->Value(i)); + if (Copy.IsDone()) + aShapeBase = Copy.Shape(); + + TopAbs_ShapeEnum aTypeBase = aShapeBase.ShapeType(); + + //if for section was specified face with a few wires then a few + // pipes were build and make solid + Standard_Boolean NeedCreateSolid = Standard_False; + if (aTypeBase == TopAbs_SHELL) { + // create wire as boundary contour if shell is no closed + // get free boundary shapes + ShapeAnalysis_FreeBounds anAnalizer(aShapeBase); + TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); + TopExp_Explorer anExp; + TopoDS_Shape aWire; + Standard_Integer NbWires = 0; + for (anExp.Init(aClosed, TopAbs_WIRE); anExp.More(); anExp.Next()) { + NbWires++; + aWire = anExp.Current(); + } + if (NbWires != 1) { + // bad case + Standard_ConstructionError::Raise("Bad shell is used as section "); + } + NeedCreateSolid = Standard_True; + aSeqFaces.Append(aShapeBase); + aSeqBases.Append(aWire); + } + else if (aTypeBase == TopAbs_FACE) { + NeedCreateSolid = Standard_True; + //for case one path should be used other type function + aSeqFaces.Append(aShapeBase); + TopExp_Explorer aExpW(aShapeBase,TopAbs_WIRE); + for (; aExpW.More(); aExpW.Next()) { + TopoDS_Shape aWireProf = aExpW.Current(); + aSeqBases.Append(aWireProf); + } + } + else if (aTypeBase == TopAbs_WIRE || aTypeBase == TopAbs_VERTEX) { + aSeqBases.Append(aShapeBase); + } + else if (aTypeBase == TopAbs_EDGE) { + TopoDS_Edge anEdge = TopoDS::Edge(aShapeBase); + TopoDS_Shape aWireProf = BRepBuilderAPI_MakeWire(anEdge); + aSeqBases.Append(aWireProf); + } + if (nbLocs) { + TopoDS_Shape aShapeLoc = theHSeqLocs->Value(i); + if (aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX) + continue; + aSeqLocs.Append(aShapeLoc); + } + } + + nbLocs = aSeqLocs.Length(); + + // skl 02.05.2007 + TopTools_SequenceOfShape Edges; + if (nbLocs > 0) { + // we have to check that each location shape is a vertex from + // path and update aSeqLocs if it is needed (and possible) + TColgp_SequenceOfPnt PLocs; + for (i=1; i<=nbLocs; i++) { + TopoDS_Vertex V = TopoDS::Vertex(aSeqLocs.Value(i)); + PLocs.Append(BRep_Tool::Pnt(V)); + } + //TopTools_SequenceOfShape Edges; + TopExp_Explorer anExp; + for (anExp.Init(aWirePath, TopAbs_EDGE); anExp.More(); anExp.Next()) { + Edges.Append(anExp.Current()); + } + int nbEdges = Edges.Length(); + ShapeAnalysis_Edge sae; + TopoDS_Edge edge = TopoDS::Edge(Edges.First()); + double tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VF = sae.FirstVertex(edge); + gp_Pnt PF = BRep_Tool::Pnt(VF); + //cout<<"PF("< tol) { + Standard_ConstructionError::Raise + ("First location shapes is not coincided with first vertex of aWirePath"); + } + aSeqLocs.ChangeValue(1) = VF; + edge = TopoDS::Edge(Edges.Last()); + tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VL = sae.LastVertex(edge); + gp_Pnt PL = BRep_Tool::Pnt(VL); + if (PL.Distance(PLocs.Last()) > tol) { + Standard_ConstructionError::Raise + ("Last location shapes is not coincided with last vertex of aWirePath"); + } + aSeqLocs.ChangeValue(nbLocs) = VL; + int jcurr = 2; + for (i=1; i<=Edges.Length() && jcurr0 && + PLocs.Value(jcurr).Distance(PPCurve.Point(1)) < tol) { + double param = PPCurve.Parameter(1); + gp_Pnt PC1; + C->D0(param,PC1); + // split current edge + Handle(Geom_TrimmedCurve) tc1 = new Geom_TrimmedCurve(C,fp,param); + Handle(Geom_TrimmedCurve) tc2 = new Geom_TrimmedCurve(C,param,lp); + TopoDS_Edge E1,E2; + BRep_Builder B; + gp_Pnt Pfp; + C->D0(fp,Pfp); + if (Pfp.Distance(P1) we have to update WirePath + BRep_Builder B; + TopoDS_Wire W; + B.MakeWire(W); + for (i=1; i<=Edges.Length(); i++) { + B.Add(W,TopoDS::Edge(Edges.Value(i))); + } + aWirePath = W; + } + } + + // check curvature of wire for condition that + // max summary angle between directions along + // wire path must be < 4*PI. If not - split wire + // and seguences of shapes, perform pipe for each + // and make sewing after that + double fp,lp; + Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp); + gp_Pnt P1,P2; + gp_Vec Vec1,Vec2; + C->D1(fp,P1,Vec1); + C->D1(lp,P2,Vec2); + double SumAng = fabs(Vec1.Angle(Vec2)); + Vec1 = Vec2; + P1 = P2; + TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums; + int LastLoc = 1; + //cout<<"Edges.Length()="<D1(lp,P2,Vec2); + double ang = fabs(Vec1.Angle(Vec2)); + SumAng += ang; + if (SumAng>4*M_PI) { + SumAng = ang; + SplitEdgeNums.Append(i-1); + int j; + for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) { + TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j)); + gp_Pnt P = BRep_Tool::Pnt(aVert); + if (P1.Distance(P) < tol) { + SplitLocNums.Append(j); + LastLoc = j; + break; + } + } + } + Vec1 = Vec2; + P1 = P2; + } + + if (SplitLocNums.Length()==SplitEdgeNums.Length() && SplitEdgeNums.Length()>0) { + TopTools_SequenceOfShape aSeqRes; + int nn, num1 = 1, num2 = 1; + for (nn=1; nn<=SplitEdgeNums.Length(); nn++) { + // create wirepath and sequences of shapes + BRep_Builder B; + TopoDS_Wire tmpW; + B.MakeWire(tmpW); + for (i=num1; i<=SplitEdgeNums.Value(nn); i++) { + B.Add(tmpW,TopoDS::Edge(Edges.Value(i))); + } + num1 = SplitEdgeNums.Value(nn) + 1; + TopTools_SequenceOfShape aTmpSeqBases; + TopTools_SequenceOfShape aTmpSeqLocs; + for (i=num2; i<=SplitLocNums.Value(nn); i++) { + aTmpSeqBases.Append(aSeqBases.Value(i)); + aTmpSeqLocs.Append(aSeqLocs.Value(i)); + } + num2 = SplitLocNums.Value(nn); + // make pipe + BRepOffsetAPI_MakePipeShell aBuilder(tmpW); + Standard_Integer nbShapes = aTmpSeqBases.Length(); + for (i=1; i<=nbShapes; i++) { + TopoDS_Shape aShapeLoc = aTmpSeqLocs.Value(i); + TopoDS_Vertex aVert = TopoDS::Vertex(aShapeLoc); + aBuilder.Add(aTmpSeqBases.Value(i), aVert, theWithContact, theWithCorrect); + } + if (!aBuilder.IsReady()) { + Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); + } + aBuilder.Build(); + TopoDS_Shape resShape = aBuilder.Shape(); + aSeqRes.Append(resShape); + } + // create wirepath and sequences of shapes for last part + BRep_Builder B; + TopoDS_Wire tmpW; + B.MakeWire(tmpW); + for (i=num1; i<=Edges.Length(); i++) { + B.Add(tmpW,TopoDS::Edge(Edges.Value(i))); + } + TopTools_SequenceOfShape aTmpSeqBases; + TopTools_SequenceOfShape aTmpSeqLocs; + for (i=num2; i<=aSeqLocs.Length(); i++) { + aTmpSeqBases.Append(aSeqBases.Value(i)); + aTmpSeqLocs.Append(aSeqLocs.Value(i)); + } + // make pipe for last part + BRepOffsetAPI_MakePipeShell aBuilder(tmpW); + Standard_Integer nbShapes = aTmpSeqBases.Length(); + for (i=1; i<=nbShapes; i++) { + TopoDS_Shape aShapeLoc = aTmpSeqLocs.Value(i); + TopoDS_Vertex aVert = TopoDS::Vertex(aShapeLoc); + aBuilder.Add(aTmpSeqBases.Value(i), aVert, theWithContact, theWithCorrect); + } + if (!aBuilder.IsReady()) { + Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); + } + aBuilder.Build(); + TopoDS_Shape resShape = aBuilder.Shape(); + aSeqRes.Append(resShape); + // make sewing for result + Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing; + aSewing->SetTolerance(Precision::Confusion()); + aSewing->SetFaceMode(Standard_True); + aSewing->SetFloatingEdgesMode(Standard_False); + aSewing->SetNonManifoldMode(Standard_False); + for (i=1; i<=aSeqRes.Length(); i++) { + aSewing->Add(aSeqRes.Value(i)); + } + aSewing->Perform(); + aShape = aSewing->SewedShape(); + } + else { + // old implementation without splitting + BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + + Standard_Integer nbShapes = aSeqBases.Length(); + Standard_Integer step = nbShapes/nbBases; + + if (nbShapes < nbBases || fmod((double)nbShapes, (double)nbBases)) { + Standard_ConstructionError::Raise("Invalid sections were specified for building pipe"); + } + Standard_Integer ind =0; + for (i = 1; i <= nbShapes && ind < nbShapes; i++) { //i+nbBases <= nbShapes + TopTools_SequenceOfShape usedBases; + Standard_Integer j = 1; + for (; j <= nbBases; j++) { + ind = i + (j-1)*step; + TopoDS_Shape aWireProf = aSeqBases.Value(ind); + usedBases.Append(aWireProf); + if (nbLocs) { + TopoDS_Shape aShapeLoc = aSeqLocs.Value(j); + TopoDS_Vertex aVert = TopoDS::Vertex(aShapeLoc); + aBuilder.Add(aWireProf, aVert, theWithContact, theWithCorrect); + } + else + aBuilder.Add(aWireProf, theWithContact, theWithCorrect); + } + if (!aBuilder.IsReady()) { + Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); + } + aBuilder.Build(); + aShape = aBuilder.Shape(); + aSeqFaces.Append(aShape); + for (j = 1; j <=usedBases.Length(); j++) + aBuilder.Delete(usedBases.Value(j)); + } + + //for case if section is face + if (aSeqFaces.Length() >1) { + BRep_Builder aB; + TopoDS_Compound aComp; + aB.MakeCompound(aComp); + for (i = 1; i <= aSeqFaces.Length(); i++) + aB.Add(aComp,aSeqFaces.Value(i)); + aShape = aComp; + } + } + + return aShape; +} //======================================================================= //function : CreatePipeForShellSections //purpose : auxilary for Execute() //======================================================================= static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, - GEOMImpl_IPipe* aCI) + GEOMImpl_IPipe* aCI) { //cout<<"CreatePipeForShellSections"<Length()), nbLocs = (aLocObjs.IsNull() ? 0 :aLocObjs->Length()); - if( nbLocs != nbBases) { - if(aCI) delete aCI; + if (nbLocs != nbBases) { + if (aCI) delete aCI; Standard_ConstructionError::Raise("Number of sections is not equal to number of locations "); } - if( nbSubBases && nbSubBases != nbBases) { - if(aCI) delete aCI; + if (nbSubBases && nbSubBases != nbBases) { + if (aCI) delete aCI; Standard_ConstructionError::Raise("Number of sections is not equal to number of subsections "); } //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); TopTools_SequenceOfShape VLocs; - for(i=1; i<=nbBases; i++) { + for (i=1; i<=nbBases; i++) { Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i); - if(anItemLoc.IsNull()) + if (anItemLoc.IsNull()) continue; Handle(GEOM_Function) aRefLoc = Handle(GEOM_Function)::DownCast(anItemLoc); TopoDS_Shape aShapeLoc = aRefLoc->GetValue(); - if(aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX) + if (aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX) continue; VLocs.Append(aShapeLoc); } nbLocs = VLocs.Length(); - if( nbLocs != nbBases) { - if(aCI) delete aCI; + if (nbLocs != nbBases) { + if (aCI) delete aCI; Standard_ConstructionError::Raise("One of location shapes is not a vertex"); } // split wire path by location points TColgp_SequenceOfPnt PLocs; - for(i=1; i<=nbLocs; i++) { + for (i=1; i<=nbLocs; i++) { TopoDS_Vertex V = TopoDS::Vertex(VLocs.Value(i)); PLocs.Append(BRep_Tool::Pnt(V)); } @@ -680,32 +1034,32 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, TopTools_SequenceOfShape Wires; ShapeAnalysis_Edge sae; - if(nbLocs==2) { + if (nbLocs==2) { TopExp_Explorer anExp; - for ( anExp.Init( aWirePath, TopAbs_EDGE ); anExp.More(); anExp.Next() ) { + for (anExp.Init(aWirePath, TopAbs_EDGE); anExp.More(); anExp.Next()) { Edges.Append(anExp.Current()); } Standard_Integer Num1 = 0; Standard_Integer Num2 = 0; - for(i=1; i<=Edges.Length(); i++) { + for (i=1; i<=Edges.Length(); i++) { TopoDS_Edge E = TopoDS::Edge(Edges.Value(i)); double tol = BRep_Tool::Tolerance(E); TopoDS_Vertex V1 = sae.FirstVertex(E); TopoDS_Vertex V2 = sae.LastVertex(E); gp_Pnt P1 = BRep_Tool::Pnt(V1); gp_Pnt P2 = BRep_Tool::Pnt(V2); - if( P1.Distance(PLocs.First()) < tol ) { - Num1 = i; + if (P1.Distance(PLocs.First()) < tol) { + Num1 = i; } - if( P2.Distance(PLocs.Last()) < tol ) { - Num2 = i; + if (P2.Distance(PLocs.Last()) < tol) { + Num2 = i; } } - if( Num1>0 && Num2>0 ) { + if (Num1>0 && Num2>0) { TopoDS_Wire W; B.MakeWire(W); - for(i=Num1; i<=Num2; i++) { - B.Add(W,Edges.Value(i)); + for (i=Num1; i<=Num2; i++) { + B.Add(W,Edges.Value(i)); } Wires.Append(W); } @@ -715,7 +1069,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, } else { TopExp_Explorer anExp; - for ( anExp.Init( aWirePath, TopAbs_EDGE ); anExp.More(); anExp.Next() ) { + for (anExp.Init(aWirePath, TopAbs_EDGE); anExp.More(); anExp.Next()) { Edges.Append(anExp.Current()); } TopoDS_Edge edge = TopoDS::Edge(Edges.First()); @@ -723,112 +1077,112 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, TopoDS_Vertex VF = sae.FirstVertex(edge); gp_Pnt PF = BRep_Tool::Pnt(VF); //cout<<"PF("< tol ) { - if(aCI) delete aCI; + if (PF.Distance(PLocs.First()) > tol) { + if (aCI) delete aCI; Standard_ConstructionError::Raise - ("First location shapes is not coincided with first vertex of aWirePath"); + ("First location shapes is not coincided with first vertex of aWirePath"); } VLocs.ChangeValue(1) = VF; edge = TopoDS::Edge(Edges.Last()); tol = BRep_Tool::Tolerance(edge); TopoDS_Vertex VL = sae.LastVertex(edge); gp_Pnt PL = BRep_Tool::Pnt(VL); - if( PL.Distance(PLocs.Last()) > tol ) { - if(aCI) delete aCI; + if (PL.Distance(PLocs.Last()) > tol) { + if (aCI) delete aCI; Standard_ConstructionError::Raise - ("Last location shapes is not coincided with last vertex of aWirePath"); + ("Last location shapes is not coincided with last vertex of aWirePath"); } VLocs.ChangeValue(nbLocs) = VL; int jcurr = 2; TopTools_SequenceOfShape tmpEdges; - for(i=1; i<=Edges.Length() && jcurr0 && - PLocs.Value(jcurr).Distance(PPC.Point(1)) < tol ) { - double param = PPC.Parameter(1); - gp_Pnt PC1; - C->D0(param,PC1); - // split current edge - Handle(Geom_TrimmedCurve) tc1 = new Geom_TrimmedCurve(C,fp,param); - Handle(Geom_TrimmedCurve) tc2 = new Geom_TrimmedCurve(C,param,lp); - TopoDS_Edge E1,E2; - gp_Pnt Pfp; - C->D0(fp,Pfp); - if(Pfp.Distance(P1)0 && + PLocs.Value(jcurr).Distance(PPCurve.Point(1)) < tol) { + double param = PPCurve.Parameter(1); + gp_Pnt PC1; + C->D0(param,PC1); + // split current edge + Handle(Geom_TrimmedCurve) tc1 = new Geom_TrimmedCurve(C,fp,param); + Handle(Geom_TrimmedCurve) tc2 = new Geom_TrimmedCurve(C,param,lp); + TopoDS_Edge E1,E2; + gp_Pnt Pfp; + C->D0(fp,Pfp); + if (Pfp.Distance(P1)Value(i); - if(anItem1.IsNull()) + if (anItem1.IsNull()) continue; Handle(GEOM_Function) aRefBase1 = Handle(GEOM_Function)::DownCast(anItem1); - if(aRefBase1.IsNull()) + if (aRefBase1.IsNull()) continue; TopoDS_Shape aShBase1 = aRefBase1->GetValue(); - if(aShBase1.IsNull()) + if (aShBase1.IsNull()) continue; TopAbs_ShapeEnum aType1 = aShBase1.ShapeType(); // 2 section Handle(Standard_Transient) anItem2 = aBasesObjs->Value(i+1); - if(anItem2.IsNull()) + if (anItem2.IsNull()) continue; Handle(GEOM_Function) aRefBase2 = Handle(GEOM_Function)::DownCast(anItem2); - if(aRefBase2.IsNull()) + if (aRefBase2.IsNull()) continue; TopoDS_Shape aShBase2 = aRefBase2->GetValue(); - if(aShBase2.IsNull()) + if (aShBase2.IsNull()) continue; TopAbs_ShapeEnum aType2 = aShBase2.ShapeType(); //BRepTools::Write(aShBase1,"/dn02/users_Linux/skl/work/Bugs/14857/base1.brep"); - bool OkSec = ( aType1==TopAbs_SHELL || aType1==TopAbs_FACE ) && - ( aType2==TopAbs_SHELL || aType2==TopAbs_FACE ); - if( !OkSec ) { - if(aCI) delete aCI; + bool OkSec = (aType1==TopAbs_SHELL || aType1==TopAbs_FACE) && + (aType2==TopAbs_SHELL || aType2==TopAbs_FACE); + if (!OkSec) { + if (aCI) delete aCI; Standard_ConstructionError::Raise("One of section shapes has invalid type"); } @@ -876,14 +1230,14 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, // compare sections TopExp_Explorer anExp; Standard_Integer nbf1 = 0; - for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + for (anExp.Init(aShBase1, TopAbs_FACE); anExp.More(); anExp.Next()) { nbf1++; } Standard_Integer nbf2 = 0; - for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) { + for (anExp.Init(aShBase2, TopAbs_FACE); anExp.More(); anExp.Next()) { nbf2++; } - if(nbf1==nbf2) { + if (nbf1==nbf2) { CreateFewSolids = true; } @@ -892,261 +1246,261 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, bool NeedReverse = false; { // first section - anExp.Init( aShBase1, TopAbs_FACE ); + anExp.Init(aShBase1, TopAbs_FACE); TopoDS_Shape aFace = anExp.Current(); TColgp_SequenceOfPnt aPnts; double xc=0, yc=0, zc=0; - for ( anExp.Init( aFace, TopAbs_VERTEX ); anExp.More(); anExp.Next() ) { - TopoDS_Vertex V = TopoDS::Vertex(anExp.Current()); - aPnts.Append(BRep_Tool::Pnt(V)); - xc += aPnts.Last().X(); - yc += aPnts.Last().Y(); - zc += aPnts.Last().Z(); - } - gp_Pnt PC( xc/aPnts.Length(), yc/aPnts.Length(), zc/aPnts.Length() ); + for (anExp.Init(aFace, TopAbs_VERTEX); anExp.More(); anExp.Next()) { + TopoDS_Vertex V = TopoDS::Vertex(anExp.Current()); + aPnts.Append(BRep_Tool::Pnt(V)); + xc += aPnts.Last().X(); + yc += aPnts.Last().Y(); + zc += aPnts.Last().Z(); + } + gp_Pnt PC(xc/aPnts.Length(), yc/aPnts.Length(), zc/aPnts.Length()); gp_Vec V1(PC,aPnts.Value(1)); gp_Vec V2(PC,aPnts.Value(2)); gp_Vec VN = V1.Crossed(V2); - for(int ip=2; ipD0(fp,P1); - if( P1.Distance(PLoc) < tol ) { - C->D0(fp+(lp-fp)/100,P2); - } - else { - C->D0(lp,P1); - C->D0(lp+(fp-lp)/100,P2); - } - PathNorm = gp_Vec(P1,P2); - break; - } - else { - TopoDS_Vertex VL = sae.LastVertex(edge); - gp_Pnt PL = BRep_Tool::Pnt(VL); - if( PL.Distance(PLoc) < tol ) { - double fp,lp; - Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp); - gp_Pnt P1,P2; - C->D0(fp,P1); - if( P1.Distance(PLoc) < tol ) { - C->D0(fp+(lp-fp)/100,P2); - } - else { - C->D0(lp,P1); - C->D0(lp+(fp-lp)/100,P2); - } - PathNorm = gp_Vec(P2,P1); - break; - } - } + for (WE.Init(WPath, TopAbs_EDGE); WE.More(); WE.Next()) { + TopoDS_Edge edge = TopoDS::Edge(WE.Current()); + double tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VF = sae.FirstVertex(edge); + gp_Pnt PF = BRep_Tool::Pnt(VF); + if (PF.Distance(PLoc) < tol) { + double fp,lp; + Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp); + gp_Pnt P1,P2; + C->D0(fp,P1); + if (P1.Distance(PLoc) < tol) { + C->D0(fp+(lp-fp)/100,P2); + } + else { + C->D0(lp,P1); + C->D0(lp+(fp-lp)/100,P2); + } + PathNorm = gp_Vec(P1,P2); + break; + } + else { + TopoDS_Vertex VL = sae.LastVertex(edge); + gp_Pnt PL = BRep_Tool::Pnt(VL); + if (PL.Distance(PLoc) < tol) { + double fp,lp; + Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp); + gp_Pnt P1,P2; + C->D0(fp,P1); + if (P1.Distance(PLoc) < tol) { + C->D0(fp+(lp-fp)/100,P2); + } + else { + C->D0(lp,P1); + C->D0(lp+(fp-lp)/100,P2); + } + PathNorm = gp_Vec(P2,P1); + break; + } + } } cout<<"VN("<PI/2.) { - NeedReverse = true; - aShBase1.Reverse(); + if (fabs(VN.Angle(PathNorm))>PI/2.) { + NeedReverse = true; + aShBase1.Reverse(); } } { // second section - anExp.Init( aShBase2, TopAbs_FACE ); + anExp.Init(aShBase2, TopAbs_FACE); TopoDS_Shape aFace = anExp.Current(); TColgp_SequenceOfPnt aPnts; double xc=0, yc=0, zc=0; - for ( anExp.Init( aFace, TopAbs_VERTEX ); anExp.More(); anExp.Next() ) { - TopoDS_Vertex V = TopoDS::Vertex(anExp.Current()); - aPnts.Append(BRep_Tool::Pnt(V)); - xc += aPnts.Last().X(); - yc += aPnts.Last().Y(); - zc += aPnts.Last().Z(); - } - gp_Pnt PC( xc/aPnts.Length(), yc/aPnts.Length(), zc/aPnts.Length() ); + for (anExp.Init(aFace, TopAbs_VERTEX); anExp.More(); anExp.Next()) { + TopoDS_Vertex V = TopoDS::Vertex(anExp.Current()); + aPnts.Append(BRep_Tool::Pnt(V)); + xc += aPnts.Last().X(); + yc += aPnts.Last().Y(); + zc += aPnts.Last().Z(); + } + gp_Pnt PC(xc/aPnts.Length(), yc/aPnts.Length(), zc/aPnts.Length()); gp_Vec V1(PC,aPnts.Value(1)); gp_Vec V2(PC,aPnts.Value(2)); gp_Vec VN = V1.Crossed(V2); - for(int ip=2; ipD0(fp,P1); - if( P1.Distance(PLoc) < tol ) { - C->D0(fp+(lp-fp)/100,P2); - } - else { - C->D0(lp,P1); - C->D0(lp+(fp-lp)/100,P2); - } - PathNorm = gp_Vec(P2,P1); - break; - } - else { - TopoDS_Vertex VL = sae.LastVertex(edge); - gp_Pnt PL = BRep_Tool::Pnt(VL); - if( PL.Distance(PLoc) < tol ) { - double fp,lp; - Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp); - gp_Pnt P1,P2; - C->D0(fp,P1); - if( P1.Distance(PLoc) < tol ) { - C->D0(fp+(lp-fp)/100,P2); - } - else { - C->D0(lp,P1); - C->D0(lp+(fp-lp)/100,P2); - } - PathNorm = gp_Vec(P2,P1); - break; - } - } + for (WE.Init(WPath, TopAbs_EDGE); WE.More(); WE.Next()) { + TopoDS_Edge edge = TopoDS::Edge(WE.Current()); + double tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VF = sae.FirstVertex(edge); + gp_Pnt PF = BRep_Tool::Pnt(VF); + if (PF.Distance(PLoc) < tol) { + double fp,lp; + Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp); + gp_Pnt P1,P2; + C->D0(fp,P1); + if (P1.Distance(PLoc) < tol) { + C->D0(fp+(lp-fp)/100,P2); + } + else { + C->D0(lp,P1); + C->D0(lp+(fp-lp)/100,P2); + } + PathNorm = gp_Vec(P2,P1); + break; + } + else { + TopoDS_Vertex VL = sae.LastVertex(edge); + gp_Pnt PL = BRep_Tool::Pnt(VL); + if (PL.Distance(PLoc) < tol) { + double fp,lp; + Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp); + gp_Pnt P1,P2; + C->D0(fp,P1); + if (P1.Distance(PLoc) < tol) { + C->D0(fp+(lp-fp)/100,P2); + } + else { + C->D0(lp,P1); + C->D0(lp+(fp-lp)/100,P2); + } + PathNorm = gp_Vec(P2,P1); + break; + } + } } //cout<<"VN("<PI/2.) - aShBase2.Reverse(); + if (fabs(VN.Angle(PathNorm))>PI/2.) + aShBase2.Reverse(); } */ - if(!CreateFewSolids) { + if (!CreateFewSolids) { // we can create only one solid TopoDS_Shape aWire1, aWire2; // prepare aWire1 - if(aType1==TopAbs_SHELL) { - // create wire as boundary contour if shell is no closed - // get free boundary shapes - ShapeAnalysis_FreeBounds anAnalizer( aShBase1 ); - TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); - //TopExp_Explorer anExp; - Standard_Integer NbWires = 0; - for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() ) { - NbWires++; - aWire1 = anExp.Current(); - } - if(NbWires!=1) { - // bad case - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Bad shell is used as section "); - } + if (aType1==TopAbs_SHELL) { + // create wire as boundary contour if shell is no closed + // get free boundary shapes + ShapeAnalysis_FreeBounds anAnalizer(aShBase1); + TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); + //TopExp_Explorer anExp; + Standard_Integer NbWires = 0; + for (anExp.Init(aClosed, TopAbs_WIRE); anExp.More(); anExp.Next()) { + NbWires++; + aWire1 = anExp.Current(); + } + if (NbWires!=1) { + // bad case + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Bad shell is used as section "); + } } else { // aType1==TopAbs_FACE - TopExp_Explorer aExpW(aShBase1,TopAbs_WIRE); - aWire1 = aExpW.Current(); + TopExp_Explorer aExpW(aShBase1,TopAbs_WIRE); + aWire1 = aExpW.Current(); } // prepare aWire2 - if(aType2==TopAbs_SHELL) { - // create wire as boundary contour if shell is no closed - // get free boundary shapes - ShapeAnalysis_FreeBounds anAnalizer( aShBase2 ); - TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); - //TopExp_Explorer anExp; - Standard_Integer NbWires = 0; - for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() ) { - NbWires++; - aWire2 = anExp.Current(); - } - if(NbWires!=1) { - // bad case - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Bad shell is used as section "); - } + if (aType2==TopAbs_SHELL) { + // create wire as boundary contour if shell is no closed + // get free boundary shapes + ShapeAnalysis_FreeBounds anAnalizer(aShBase2); + TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); + //TopExp_Explorer anExp; + Standard_Integer NbWires = 0; + for (anExp.Init(aClosed, TopAbs_WIRE); anExp.More(); anExp.Next()) { + NbWires++; + aWire2 = anExp.Current(); + } + if (NbWires!=1) { + // bad case + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Bad shell is used as section "); + } } else { // aType2==TopAbs_FACE - TopExp_Explorer aExpW(aShBase2,TopAbs_WIRE); - aWire2 = aExpW.Current(); + TopExp_Explorer aExpW(aShBase2,TopAbs_WIRE); + aWire2 = aExpW.Current(); } // make pipe using aWire1 and aWire2 - if( !aWire1.IsNull() && !aWire2.IsNull() ) { - //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); - BRepOffsetAPI_MakePipeShell aBuilder(WPath); - aBuilder.Add(aWire1, TopoDS::Vertex(VLocs(i)), - aWithContact, aWithCorrect); - aBuilder.Add(aWire2, TopoDS::Vertex(VLocs(i+1)), - aWithContact, aWithCorrect); - if(!aBuilder.IsReady()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); - } - aBuilder.Build(); - TopoDS_Shape aShape = aBuilder.Shape(); - TopoDS_Shell aShell; - B.MakeShell(aShell); - for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - B.Add(aShell,anExp.Current()); - } - for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - B.Add(aShell,anExp.Current()); - } - for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - B.Add(aShell,anExp.Current()); - } - // make sewing for this shell - Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing; - aSewing->SetTolerance(Precision::Confusion()); - aSewing->SetFaceMode(Standard_True); - aSewing->SetFloatingEdgesMode(Standard_False); - aSewing->SetNonManifoldMode(Standard_False); - for ( anExp.Init( aShell, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - aSewing->Add(anExp.Current()); - } - aSewing->Perform(); - const TopoDS_Shape aSewShape = aSewing->SewedShape(); - if( aSewShape.ShapeType() == TopAbs_SHELL ) { - aShell = TopoDS::Shell(aSewShape); - GProp_GProps aSystem; - BRepGProp::VolumeProperties(aShell, aSystem); - if(aSystem.Mass()<0) { - aShell.Reverse(); - } - if(BRep_Tool::IsClosed(aShell)) { - TopoDS_Solid aSolid; - B.MakeSolid(aSolid); - B.Add(aSolid,aShell); - B.Add(aComp,aSolid); - } - else { - B.Add(aComp,aShell); - } - } - else { - B.Add(aComp,aShell); - } + if (!aWire1.IsNull() && !aWire2.IsNull()) { + //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + BRepOffsetAPI_MakePipeShell aBuilder(WPath); + aBuilder.Add(aWire1, TopoDS::Vertex(VLocs(i)), + aWithContact, aWithCorrect); + aBuilder.Add(aWire2, TopoDS::Vertex(VLocs(i+1)), + aWithContact, aWithCorrect); + if (!aBuilder.IsReady()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); + } + aBuilder.Build(); + TopoDS_Shape aShape = aBuilder.Shape(); + TopoDS_Shell aShell; + B.MakeShell(aShell); + for (anExp.Init(aShape, TopAbs_FACE); anExp.More(); anExp.Next()) { + B.Add(aShell,anExp.Current()); + } + for (anExp.Init(aShBase1, TopAbs_FACE); anExp.More(); anExp.Next()) { + B.Add(aShell,anExp.Current()); + } + for (anExp.Init(aShBase2, TopAbs_FACE); anExp.More(); anExp.Next()) { + B.Add(aShell,anExp.Current()); + } + // make sewing for this shell + Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing; + aSewing->SetTolerance(Precision::Confusion()); + aSewing->SetFaceMode(Standard_True); + aSewing->SetFloatingEdgesMode(Standard_False); + aSewing->SetNonManifoldMode(Standard_False); + for (anExp.Init(aShell, TopAbs_FACE); anExp.More(); anExp.Next()) { + aSewing->Add(anExp.Current()); + } + aSewing->Perform(); + const TopoDS_Shape aSewShape = aSewing->SewedShape(); + if (aSewShape.ShapeType() == TopAbs_SHELL) { + aShell = TopoDS::Shell(aSewShape); + GProp_GProps aSystem; + BRepGProp::VolumeProperties(aShell, aSystem); + if (aSystem.Mass()<0) { + aShell.Reverse(); + } + if (BRep_Tool::IsClosed(aShell)) { + TopoDS_Solid aSolid; + B.MakeSolid(aSolid); + B.Add(aSolid,aShell); + B.Add(aComp,aSolid); + } + else { + B.Add(aComp,aShell); + } + } + else { + B.Add(aComp,aShell); + } } } else { // main block - creation few solids (for each pair of faces) TopTools_MapOfShape aFaces1,aFaces2; - for ( anExp.Init( aShBase1, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - aFaces1.Add(anExp.Current()); + for (anExp.Init(aShBase1, TopAbs_FACE); anExp.More(); anExp.Next()) { + aFaces1.Add(anExp.Current()); } - for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - aFaces2.Add(anExp.Current()); + for (anExp.Init(aShBase2, TopAbs_FACE); anExp.More(); anExp.Next()) { + aFaces2.Add(anExp.Current()); } // creating map of edge faces TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces1; @@ -1157,221 +1511,220 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, // constuct map face->face TopTools_IndexedDataMapOfShapeShape FF; TopoDS_Shape FS1,FS2; - if(nbSubBases==0) { - // find edge the most distant from location point - // (this edge is not shared by two faces) - double maxdist = 0.; - TopoDS_Shape E1; - TopoDS_Vertex V11,V21; - for(j=1; j<=aMapEdgeFaces1.Extent(); j++) { - TopoDS_Shape tmp = aMapEdgeFaces1.FindKey(j); - const TopTools_ListOfShape& aList = aMapEdgeFaces1.FindFromKey(tmp); - if(aList.Extent()>1) - continue; - TopExp_Explorer expv; - expv.Init( tmp, TopAbs_VERTEX ); - TopoDS_Vertex V1 = TopoDS::Vertex(expv.Current()); - expv.Next(); - TopoDS_Vertex V2 = TopoDS::Vertex(expv.Current()); - gp_Pnt P1 = BRep_Tool::Pnt(V1); - gp_Pnt P2 = BRep_Tool::Pnt(V2); - double dist = PLocs.Value(i).Distance(P1) + PLocs.Value(i).Distance(P2); - if(dist>maxdist) { - E1 = tmp; - V11 = V1; - V21 = V2; - TopTools_ListIteratorOfListOfShape anIter(aList); - FS1 = anIter.Value(); - maxdist = dist; - } - } - // main direction for comparing - gp_Vec VM(PLocs.Value(i),PLocs.Value(i+1)); - // find corresponding edge from next section - double minang = PI; - gp_Pnt P11 = BRep_Tool::Pnt(V11); - gp_Pnt P21 = BRep_Tool::Pnt(V21); - TopoDS_Shape E2; - TopoDS_Vertex V12,V22; - for(j=1; j<=aMapEdgeFaces2.Extent(); j++) { - TopoDS_Shape tmp = aMapEdgeFaces2.FindKey(j); - const TopTools_ListOfShape& aList = aMapEdgeFaces2.FindFromKey(tmp); - if(aList.Extent()>1) - continue; - TopExp_Explorer expv; - expv.Init( tmp, TopAbs_VERTEX ); - TopoDS_Vertex V1tmp = TopoDS::Vertex(expv.Current()); - expv.Next(); - TopoDS_Vertex V2tmp = TopoDS::Vertex(expv.Current()); - gp_Pnt P1tmp = BRep_Tool::Pnt(V1tmp); - gp_Pnt P2tmp = BRep_Tool::Pnt(V2tmp); - double d1 = P1tmp.Distance(P11) + P2tmp.Distance(P21); - double d2 = P1tmp.Distance(P21) + P2tmp.Distance(P11); - TopoDS_Vertex V1,V2; - gp_Pnt P1,P2; - if(d1>d2) { - V1 = V2tmp; P1 = P2tmp; - V2 = V1tmp; P2 = P1tmp; - } - else { - V1 = V1tmp; P1 = P1tmp; - V2 = V2tmp; P2 = P2tmp; - } - gp_Vec Vec1(P11,P1); - gp_Vec Vec2(P21,P2); - double ang = fabs(Vec1.Angle(VM)) + fabs(Vec2.Angle(VM)); - if(ang1) + continue; + TopExp_Explorer expv; + expv.Init(tmp, TopAbs_VERTEX); + TopoDS_Vertex V1 = TopoDS::Vertex(expv.Current()); + expv.Next(); + TopoDS_Vertex V2 = TopoDS::Vertex(expv.Current()); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + gp_Pnt P2 = BRep_Tool::Pnt(V2); + double dist = PLocs.Value(i).Distance(P1) + PLocs.Value(i).Distance(P2); + if (dist>maxdist) { + E1 = tmp; + V11 = V1; + V21 = V2; + TopTools_ListIteratorOfListOfShape anIter(aList); + FS1 = anIter.Value(); + maxdist = dist; + } + } + // main direction for comparing + gp_Vec VM(PLocs.Value(i),PLocs.Value(i+1)); + // find corresponding edge from next section + double minang = M_PI; + gp_Pnt P11 = BRep_Tool::Pnt(V11); + gp_Pnt P21 = BRep_Tool::Pnt(V21); + TopoDS_Shape E2; + TopoDS_Vertex V12,V22; + for (j=1; j<=aMapEdgeFaces2.Extent(); j++) { + TopoDS_Shape tmp = aMapEdgeFaces2.FindKey(j); + const TopTools_ListOfShape& aList = aMapEdgeFaces2.FindFromKey(tmp); + if (aList.Extent()>1) + continue; + TopExp_Explorer expv; + expv.Init(tmp, TopAbs_VERTEX); + TopoDS_Vertex V1tmp = TopoDS::Vertex(expv.Current()); + expv.Next(); + TopoDS_Vertex V2tmp = TopoDS::Vertex(expv.Current()); + gp_Pnt P1tmp = BRep_Tool::Pnt(V1tmp); + gp_Pnt P2tmp = BRep_Tool::Pnt(V2tmp); + double d1 = P1tmp.Distance(P11) + P2tmp.Distance(P21); + double d2 = P1tmp.Distance(P21) + P2tmp.Distance(P11); + TopoDS_Vertex V1,V2; + gp_Pnt P1,P2; + if (d1>d2) { + V1 = V2tmp; P1 = P2tmp; + V2 = V1tmp; P2 = P1tmp; + } + else { + V1 = V1tmp; P1 = P1tmp; + V2 = V2tmp; P2 = P2tmp; + } + gp_Vec Vec1(P11,P1); + gp_Vec Vec2(P21,P2); + double ang = fabs(Vec1.Angle(VM)) + fabs(Vec2.Angle(VM)); + if (angValue(i); - if(anItem.IsNull()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem); - if(aRefBase.IsNull()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - TopoDS_Shape aSh = aRefBase->GetValue(); - if(aSh.IsNull()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - if(aSh.ShapeType()!=TopAbs_FACE) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - FS1 = aSh; - } - { // 2 section - Handle(Standard_Transient) anItem = aSubBasesObjs->Value(i+1); - if(anItem.IsNull()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem); - if(aRefBase.IsNull()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - TopoDS_Shape aSh = aRefBase->GetValue(); - if(aSh.IsNull()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - if(aSh.ShapeType()!=TopAbs_FACE) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - FS2 = aSh; - } - - if( !aFaces1.Contains(FS1) || !aFaces2.Contains(FS2) ) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid subbase shape"); - } - - FF.Add(FS1,FS2); - - // add pairs of edges to FF - bool stat = FillCorrespondingEdges(FS1, FS2, TopoDS::Vertex(VLocs(i)), - TopoDS::Vertex(VLocs(i+1)), WPath, FF); - if( !stat ) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Can not create correct pipe"); - } + { // 1 section + Handle(Standard_Transient) anItem = aSubBasesObjs->Value(i); + if (anItem.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem); + if (aRefBase.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + TopoDS_Shape aSh = aRefBase->GetValue(); + if (aSh.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + if (aSh.ShapeType()!=TopAbs_FACE) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + FS1 = aSh; + } + { // 2 section + Handle(Standard_Transient) anItem = aSubBasesObjs->Value(i+1); + if (anItem.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem); + if (aRefBase.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + TopoDS_Shape aSh = aRefBase->GetValue(); + if (aSh.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + if (aSh.ShapeType()!=TopAbs_FACE) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + FS2 = aSh; + } + + if (!aFaces1.Contains(FS1) || !aFaces2.Contains(FS2)) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Invalid subbase shape"); + } + + FF.Add(FS1,FS2); + + // add pairs of edges to FF + bool stat = FillCorrespondingEdges(FS1, FS2, TopoDS::Vertex(VLocs(i)), + TopoDS::Vertex(VLocs(i+1)), WPath, FF); + if (!stat) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Can not create correct pipe"); + } } FindNextPairOfFaces(FS1, aMapEdgeFaces1, aMapEdgeFaces2, FF, aCI); - // make pipe for each pair of faces - for(j=1; j<=FF.Extent(); j++) { - TopoDS_Shape F1 = FF.FindKey(j); - if( F1.ShapeType() != TopAbs_FACE ) - continue; - TopoDS_Shape F2 = FF.FindFromIndex(j); - TopExp_Explorer aExpW1(F1,TopAbs_WIRE); - TopoDS_Wire aWire1 = TopoDS::Wire(aExpW1.Current()); - TopExp_Explorer aExpW2(F2,TopAbs_WIRE); - TopoDS_Wire aWire2 = TopoDS::Wire(aExpW2.Current()); - // make pipe using aWire1 and aWire2 - if( !aWire1.IsNull() && !aWire2.IsNull() ) { - BRepOffsetAPI_MakePipeShell aBuilder(WPath); - aBuilder.Add(aWire1, TopoDS::Vertex(VLocs(i)), - aWithContact, aWithCorrect); - aBuilder.Add(aWire2, TopoDS::Vertex(VLocs(i+1)), - aWithContact, aWithCorrect); - if(!aBuilder.IsReady()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); - } - aBuilder.Build(); - TopoDS_Shape aShape = aBuilder.Shape(); - TopoDS_Shell aShell; - B.MakeShell(aShell); - for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - B.Add(aShell,anExp.Current()); - } - - B.Add(aShell,F1); - B.Add(aShell,F2); - // make sewing for this shell - Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing; - aSewing->SetTolerance(Precision::Confusion()); - aSewing->SetFaceMode(Standard_True); - aSewing->SetFloatingEdgesMode(Standard_False); - aSewing->SetNonManifoldMode(Standard_False); - for ( anExp.Init( aShell, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - aSewing->Add(anExp.Current()); - } - aSewing->Perform(); - const TopoDS_Shape aSewShape = aSewing->SewedShape(); - if( aSewShape.ShapeType() == TopAbs_SHELL ) { - aShell = TopoDS::Shell(aSewShape); - GProp_GProps aSystem; - BRepGProp::VolumeProperties(aShell, aSystem); - if(aSystem.Mass()<0) { - //cout<<"aSewShape is reversed"<SetTolerance(Precision::Confusion()); + aSewing->SetFaceMode(Standard_True); + aSewing->SetFloatingEdgesMode(Standard_False); + aSewing->SetNonManifoldMode(Standard_False); + for (anExp.Init(aShell, TopAbs_FACE); anExp.More(); anExp.Next()) { + aSewing->Add(anExp.Current()); + } + aSewing->Perform(); + const TopoDS_Shape aSewShape = aSewing->SewedShape(); + if (aSewShape.ShapeType() == TopAbs_SHELL) { + aShell = TopoDS::Shell(aSewShape); + GProp_GProps aSystem; + BRepGProp::VolumeProperties(aShell, aSystem); + if (aSystem.Mass()<0) { + //cout<<"aSewShape is reversed"<Length(), nbv = (VObjs.IsNull() ? 0 :VObjs->Length()); - if( nbv != nbBases ) { - if(aCI) delete aCI; + if (nbv != nbBases) { + if (aCI) delete aCI; Standard_ConstructionError::Raise("Number of shapes for recognition is invalid"); } - TopTools_SequenceOfShape SecVs,Bases; - for(i=1; i<=nbBases; i++) { + for (i=1; i<=nbBases; i++) { // vertex Handle(Standard_Transient) anItem = VObjs->Value(i); - if(anItem.IsNull()) + if (anItem.IsNull()) continue; Handle(GEOM_Function) aRef = Handle(GEOM_Function)::DownCast(anItem); TopoDS_Shape V = aRef->GetValue(); - if(V.IsNull() || V.ShapeType() != TopAbs_VERTEX) + if (V.IsNull() || V.ShapeType() != TopAbs_VERTEX) continue; SecVs.Append(V); // section anItem = aBasesObjs->Value(i); - if(anItem.IsNull()) + if (anItem.IsNull()) continue; aRef = Handle(GEOM_Function)::DownCast(anItem); TopoDS_Shape aSh = aRef->GetValue(); - if(aSh.IsNull()) + if (aSh.IsNull()) continue; Bases.Append(aSh); } nbv = SecVs.Length(); nbBases = Bases.Length(); - if( nbv != nbBases ) { - if(aCI) delete aCI; + if (nbv != nbBases) { + if (aCI) delete aCI; Standard_ConstructionError::Raise("One of shapes for recognition is not a vertex"); } TopoDS_Compound aComp; B.MakeCompound(aComp); - for(i=1 ; iface (and subshapes) + // constuct map face->face (and sub-shapes) TopTools_IndexedDataMapOfShapeShape FF; //TopoDS_Shape FS1 = SecFs.Value(i), FS2 = SecFs.Value(i+1); TopoDS_Shape FS1, FS2; @@ -1484,11 +1835,11 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) // add pairs of edges and vertexes to FF bool stat = FillCorrespondingEdges(FS1, FS2, V1, V2, FF); - if( !stat ) { - if(aCI) delete aCI; + if (!stat) { + if (aCI) delete aCI; Standard_ConstructionError::Raise("Can not create correct pipe"); } - MESSAGE (" correspondences for subshapes of first pair of faces is found"); + MESSAGE (" correspondences for sub-shapes of first pair of faces is found"); FindNextPairOfFaces(FS1, aMapEdgeFaces1, aMapEdgeFaces2, FF, aCI); MESSAGE (" other correspondences is found, make pipe for all pairs of faces"); @@ -1499,289 +1850,289 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) ShapeAnalysis_Edge sae; //cout<<"FF.Extent()="<IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - Handle(Geom_RectangularTrimmedSurface) RTS = - Handle(Geom_RectangularTrimmedSurface)::DownCast(S1); - S1 = RTS->BasisSurface(); + if (S1->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { + Handle(Geom_RectangularTrimmedSurface) RTS = + Handle(Geom_RectangularTrimmedSurface)::DownCast(S1); + S1 = RTS->BasisSurface(); } Handle(Geom_Plane) Pln1 = Handle(Geom_Plane)::DownCast(S1); - if( Pln1.IsNull() ) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Surface from face is not plane"); + if (Pln1.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Surface from face is not plane"); } gp_Vec aDir1(Pln1->Axis().Direction()); Handle(Geom_Surface) S2 = BRep_Tool::Surface(TopoDS::Face(F2)); - if(S2->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - Handle(Geom_RectangularTrimmedSurface) RTS = - Handle(Geom_RectangularTrimmedSurface)::DownCast(S2); - S2 = RTS->BasisSurface(); + if (S2->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { + Handle(Geom_RectangularTrimmedSurface) RTS = + Handle(Geom_RectangularTrimmedSurface)::DownCast(S2); + S2 = RTS->BasisSurface(); } Handle(Geom_Plane) Pln2 = - Handle(Geom_Plane)::DownCast(S2); - if( Pln2.IsNull() ) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Surface from face is not plane"); + Handle(Geom_Plane)::DownCast(S2); + if (Pln2.IsNull()) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Surface from face is not plane"); } gp_Vec aDir2(Pln2->Axis().Direction()); gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(SecVs(i))); gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(SecVs(i+1))); gp_Vec aDir(P1,P2); - if(fabs(aDir.Angle(aDir1))>PI/2.) - aDir1.Reverse(); - if(fabs(aDir.Angle(aDir2))>PI/2.) - aDir2.Reverse(); + if (fabs(aDir.Angle(aDir1)) > M_PI/2.) + aDir1.Reverse(); + if (fabs(aDir.Angle(aDir2)) > M_PI/2.) + aDir2.Reverse(); TopExp_Explorer anExpE(F1,TopAbs_EDGE); TopTools_SequenceOfShape aNewFs; //int nbee=0; - for(; anExpE.More(); anExpE.Next()) { - TopoDS_Edge E1 = TopoDS::Edge(anExpE.Current()); - //nbee++; - if(!FF.Contains(E1)) - MESSAGE ("map FF not contains key E1"); - - if(VPE.Contains(E1)) { - aNewFs.Append(VPE.FindFromKey(E1)); + for (; anExpE.More(); anExpE.Next()) { + TopoDS_Edge E1 = TopoDS::Edge(anExpE.Current()); + //nbee++; + if (!FF.Contains(E1)) + MESSAGE ("map FF not contains key E1"); + + if (VPE.Contains(E1)) { + aNewFs.Append(VPE.FindFromKey(E1)); #ifdef _DEBUG_ - MESSAGE (" using existed face"); + MESSAGE (" using existed face"); #endif - continue; - } - - TopoDS_Edge E3 = TopoDS::Edge(FF.FindFromKey(E1)); - TopoDS_Vertex V1 = sae.FirstVertex(E1); - TopoDS_Vertex V2 = sae.LastVertex(E1); - if(!FF.Contains(V1)) - MESSAGE ("map FF not contains key V1"); - if(!FF.Contains(V2)) - MESSAGE ("map FF not contains key V2"); - TopoDS_Vertex V3 = TopoDS::Vertex(FF.FindFromKey(V2)); - TopoDS_Vertex V4 = TopoDS::Vertex(FF.FindFromKey(V1)); - TopoDS_Vertex Vtmp = sae.FirstVertex(E3); - if(Vtmp.IsSame(V4)) - E3.Reverse(); - gp_Pnt P1 = BRep_Tool::Pnt(V1); - gp_Pnt P2 = BRep_Tool::Pnt(V2); - gp_Pnt P3 = BRep_Tool::Pnt(V3); - gp_Pnt P4 = BRep_Tool::Pnt(V4); - // make E2 - TopoDS_Edge E2; - Handle(Geom_BSplineCurve) C2; - if(VPE.Contains(V2)) { - E2 = TopoDS::Edge(VPE.FindFromKey(V2)); - double fp,lp; - C2 = Handle(Geom_BSplineCurve)::DownCast(BRep_Tool::Curve(E2,fp,lp)); - } - else { - Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,2); - HAP->SetValue(1,P2); - HAP->SetValue(2,P3); - GeomAPI_Interpolate anInt(HAP,Standard_False,1.e-7); - anInt.Load(aDir1,aDir2); - anInt.Perform(); - C2 = anInt.Curve(); - B.MakeEdge(E2,C2,1.e-7); - B.Add(E2,TopoDS::Vertex(V2.Oriented(TopAbs_FORWARD))); - B.Add(E2,TopoDS::Vertex(V3.Oriented(TopAbs_REVERSED))); - VPE.Add(V2,E2); - } - // make E4 - TopoDS_Edge E4; - Handle(Geom_BSplineCurve) C4; - if(VPE.Contains(V1)) { - E4 = TopoDS::Edge(VPE.FindFromKey(V1)); - double fp,lp; - C4 = Handle(Geom_BSplineCurve)::DownCast(BRep_Tool::Curve(E4,fp,lp)); - } - else { - Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,2); - HAP->SetValue(1,P1); - HAP->SetValue(2,P4); - GeomAPI_Interpolate anInt(HAP,Standard_False,1.e-7); - anInt.Load(aDir1,aDir2); - anInt.Perform(); - C4 = anInt.Curve(); - B.MakeEdge(E4,anInt.Curve(),1.e-7); - B.Add(E4,TopoDS::Vertex(V1.Oriented(TopAbs_FORWARD))); - B.Add(E4,TopoDS::Vertex(V4.Oriented(TopAbs_REVERSED))); - VPE.Add(V1,E4); - } - - TopoDS_Wire W; - B.MakeWire(W); - B.Add(W,E1); - B.Add(W,E2); - B.Add(W,E3); - B.Add(W,E4.Reversed()); - //cout<<" wire for edge "<IsKind(STANDARD_TYPE(Geom_Conic)) ) { - // IsConicC1 = true; - // cout<<"C1 - Geom_Conic"<IsKind(STANDARD_TYPE(Geom_Line)) || C1->IsKind(STANDARD_TYPE(Geom_Conic)) ) { - C1 = new Geom_TrimmedCurve(C1,fp,lp); - } - //if(IsConicC1) { - // double tol = BRep_Tool::Tolerance(E1); - // GeomConvert_ApproxCurve ApxC1(C1,tol,GeomAbs_C1,10,5); - // C1 = ApxC1.Curve(); - //} - Handle(Geom_Curve) C3 = BRep_Tool::Curve(E3,fp,lp); - if( C3->IsKind(STANDARD_TYPE(Geom_Line)) || C3->IsKind(STANDARD_TYPE(Geom_Conic)) ) { - C3 = new Geom_TrimmedCurve(C3,fp,lp); - } - //filebuf fic; - //ostream os(&fic); - //os.precision(15); - Handle(Geom_BSplineCurve) CE1 = - GeomConvert::CurveToBSplineCurve(C1,Convert_RationalC1); - if(CE1->Degree()<3) - CE1->IncreaseDegree(3); - Handle(Geom_BSplineCurve) CE2 = - GeomConvert::CurveToBSplineCurve(C2,Convert_RationalC1); - if(CE2->Degree()<3) - CE2->IncreaseDegree(3); - Handle(Geom_BSplineCurve) CE3 = - GeomConvert::CurveToBSplineCurve(C3,Convert_RationalC1); - if(CE3->Degree()<3) - CE3->IncreaseDegree(3); - Handle(Geom_BSplineCurve) CE4 = - GeomConvert::CurveToBSplineCurve(C4,Convert_RationalC1); - if(CE4->Degree()<3) - CE4->IncreaseDegree(3); - //cout<<"CE1->Degree()="<Degree()<<" CE2->Degree()="<Degree() - // <<" CE3->Degree()="<Degree()<<" CE4->Degree()="<Degree()<D0(fp1,P1C1); - C1->D0(lp1,P2C1); - gp_Pnt P1C3,P2C3; - C3->D0(fp2,P1C3); - C3->D0(lp2,P2C3); - int n1,n2; - double fp,lp; - // get points from C1 - if(P1.Distance(P1C1)<1.e-6) { - fp = fp1; - lp = lp1; - } - else { - fp = lp1; - lp = fp1; - } - double step = (lp-fp)/(NbP-1); - Points.SetValue(1,1,P1); - double par = fp; - for(n1=2; n1D0(par,P); - Points.SetValue(1,n1,P); - } - Points.SetValue(1,NbP,P2); - // get points from C3 - if(P4.Distance(P1C3)<1.e-6) { - fp = fp2; - lp = lp2; - } - else { - fp = lp2; - lp = fp2; - } - step = (lp-fp)/(NbP-1); - Points.SetValue(NbP,1,P4); - par = fp; - for(n1=2; n1D0(par,P); - Points.SetValue(NbP,n1,P); - } - Points.SetValue(NbP,NbP,P3); - // create isolines and get points from them - for(n1=1; n1<=NbP; n1++) { - gp_Pnt PI1 = Points.Value(1,n1); - gp_Pnt PI2 = Points.Value(NbP,n1); - Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,2); - HAP->SetValue(1,PI1); - HAP->SetValue(2,PI2); - GeomAPI_Interpolate anInt(HAP,Standard_False,1.e-7); - anInt.Load(aDir1,aDir2); - anInt.Perform(); - Handle(Geom_Curve) iso = anInt.Curve(); - fp = iso->FirstParameter(); - lp = iso->LastParameter(); - step = (lp-fp)/(NbP-1); - par = fp; - TopoDS_Compound VComp; - B.MakeCompound(VComp); - for(n2=2; n2D0(par,P); - Points.SetValue(n2,n1,P); - } - } - // create surface and face - //Handle(Geom_BezierSurface) BS = new Geom_BezierSurface(Points); - BS = new Geom_BezierSurface(Points); - } - - BRepBuilderAPI_MakeFace BB(BS,W); - TopoDS_Face NewF = BB.Face(); - Handle(ShapeFix_Face) sff = new ShapeFix_Face(NewF); - sff->Perform(); - sff->FixOrientation(); - TopoDS_Face FixedFace = sff->Face(); - aNewFs.Append(FixedFace); - VPE.Add(E1,FixedFace); - //cout<<" face for edge "<SetValue(1,P2); + HAP->SetValue(2,P3); + GeomAPI_Interpolate anInt(HAP,Standard_False,1.e-7); + anInt.Load(aDir1,aDir2); + anInt.Perform(); + C2 = anInt.Curve(); + B.MakeEdge(E2,C2,1.e-7); + B.Add(E2,TopoDS::Vertex(V2.Oriented(TopAbs_FORWARD))); + B.Add(E2,TopoDS::Vertex(V3.Oriented(TopAbs_REVERSED))); + VPE.Add(V2,E2); + } + // make E4 + TopoDS_Edge E4; + Handle(Geom_BSplineCurve) C4; + if (VPE.Contains(V1)) { + E4 = TopoDS::Edge(VPE.FindFromKey(V1)); + double fp,lp; + C4 = Handle(Geom_BSplineCurve)::DownCast(BRep_Tool::Curve(E4,fp,lp)); + } + else { + Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,2); + HAP->SetValue(1,P1); + HAP->SetValue(2,P4); + GeomAPI_Interpolate anInt(HAP,Standard_False,1.e-7); + anInt.Load(aDir1,aDir2); + anInt.Perform(); + C4 = anInt.Curve(); + B.MakeEdge(E4,anInt.Curve(),1.e-7); + B.Add(E4,TopoDS::Vertex(V1.Oriented(TopAbs_FORWARD))); + B.Add(E4,TopoDS::Vertex(V4.Oriented(TopAbs_REVERSED))); + VPE.Add(V1,E4); + } + + TopoDS_Wire W; + B.MakeWire(W); + B.Add(W,E1); + B.Add(W,E2); + B.Add(W,E3); + B.Add(W,E4.Reversed()); + //cout<<" wire for edge "<IsKind(STANDARD_TYPE(Geom_Conic))) { + // IsConicC1 = true; + // cout<<"C1 - Geom_Conic"<IsKind(STANDARD_TYPE(Geom_Line)) || C1->IsKind(STANDARD_TYPE(Geom_Conic))) { + C1 = new Geom_TrimmedCurve(C1,fp,lp); + } + //if (IsConicC1) { + // double tol = BRep_Tool::Tolerance(E1); + // GeomConvert_ApproxCurve ApxC1(C1,tol,GeomAbs_C1,10,5); + // C1 = ApxC1.Curve(); + //} + Handle(Geom_Curve) C3 = BRep_Tool::Curve(E3,fp,lp); + if (C3->IsKind(STANDARD_TYPE(Geom_Line)) || C3->IsKind(STANDARD_TYPE(Geom_Conic))) { + C3 = new Geom_TrimmedCurve(C3,fp,lp); + } + //filebuf fic; + //ostream os(&fic); + //os.precision(15); + Handle(Geom_BSplineCurve) CE1 = + GeomConvert::CurveToBSplineCurve(C1,Convert_RationalC1); + if (CE1->Degree()<3) + CE1->IncreaseDegree(3); + Handle(Geom_BSplineCurve) CE2 = + GeomConvert::CurveToBSplineCurve(C2,Convert_RationalC1); + if (CE2->Degree()<3) + CE2->IncreaseDegree(3); + Handle(Geom_BSplineCurve) CE3 = + GeomConvert::CurveToBSplineCurve(C3,Convert_RationalC1); + if (CE3->Degree()<3) + CE3->IncreaseDegree(3); + Handle(Geom_BSplineCurve) CE4 = + GeomConvert::CurveToBSplineCurve(C4,Convert_RationalC1); + if (CE4->Degree()<3) + CE4->IncreaseDegree(3); + //cout<<"CE1->Degree()="<Degree()<<" CE2->Degree()="<Degree() + // <<" CE3->Degree()="<Degree()<<" CE4->Degree()="<Degree()<D0(fp1,P1C1); + C1->D0(lp1,P2C1); + gp_Pnt P1C3,P2C3; + C3->D0(fp2,P1C3); + C3->D0(lp2,P2C3); + int n1,n2; + double fp,lp; + // get points from C1 + if (P1.Distance(P1C1)<1.e-6) { + fp = fp1; + lp = lp1; + } + else { + fp = lp1; + lp = fp1; + } + double step = (lp-fp)/(NbP-1); + Points.SetValue(1,1,P1); + double par = fp; + for (n1=2; n1D0(par,P); + Points.SetValue(1,n1,P); + } + Points.SetValue(1,NbP,P2); + // get points from C3 + if (P4.Distance(P1C3)<1.e-6) { + fp = fp2; + lp = lp2; + } + else { + fp = lp2; + lp = fp2; + } + step = (lp-fp)/(NbP-1); + Points.SetValue(NbP,1,P4); + par = fp; + for (n1=2; n1D0(par,P); + Points.SetValue(NbP,n1,P); + } + Points.SetValue(NbP,NbP,P3); + // create isolines and get points from them + for (n1=1; n1<=NbP; n1++) { + gp_Pnt PI1 = Points.Value(1,n1); + gp_Pnt PI2 = Points.Value(NbP,n1); + Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,2); + HAP->SetValue(1,PI1); + HAP->SetValue(2,PI2); + GeomAPI_Interpolate anInt(HAP,Standard_False,1.e-7); + anInt.Load(aDir1,aDir2); + anInt.Perform(); + Handle(Geom_Curve) iso = anInt.Curve(); + fp = iso->FirstParameter(); + lp = iso->LastParameter(); + step = (lp-fp)/(NbP-1); + par = fp; + TopoDS_Compound VComp; + B.MakeCompound(VComp); + for (n2=2; n2D0(par,P); + Points.SetValue(n2,n1,P); + } + } + // create surface and face + //Handle(Geom_BezierSurface) BS = new Geom_BezierSurface(Points); + BS = new Geom_BezierSurface(Points); + } + + BRepBuilderAPI_MakeFace BB(BS,W); + TopoDS_Face NewF = BB.Face(); + Handle(ShapeFix_Face) sff = new ShapeFix_Face(NewF); + sff->Perform(); + sff->FixOrientation(); + TopoDS_Face FixedFace = sff->Face(); + aNewFs.Append(FixedFace); + VPE.Add(E1,FixedFace); + //cout<<" face for edge "<SetFaceMode(Standard_True); aSewing->SetFloatingEdgesMode(Standard_False); aSewing->SetNonManifoldMode(Standard_False); - for ( anExp.Init( aShell, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - aSewing->Add(anExp.Current()); + for (anExp.Init(aShell, TopAbs_FACE); anExp.More(); anExp.Next()) { + aSewing->Add(anExp.Current()); } aSewing->Perform(); MESSAGE (" shell for face "<SewedShape(); //BRepTools::Write(aSewShape,"/dn02/users_Linux/skl/work/Bugs/14857/sew.brep"); - if( aSewShape.ShapeType() == TopAbs_SHELL ) { - aShell = TopoDS::Shell(aSewShape); - GProp_GProps aSystem; - BRepGProp::VolumeProperties(aShell, aSystem); - if(aSystem.Mass()<0) { - //cout<<"aSewShape is reversed"<GetValue(); if (aShapeBase.IsNull()) { - if(aCIBN) delete aCIBN; + if (aCIBN) delete aCIBN; Standard_NullObject::Raise("MakePipe aborted : null base argument"); } TopoDS_Shape aProf; - if( aShapeBase.ShapeType() == TopAbs_VERTEX ) { + if (aShapeBase.ShapeType() == TopAbs_VERTEX) { aProf = aShapeBase; } - else if( aShapeBase.ShapeType() == TopAbs_EDGE) { + else if (aShapeBase.ShapeType() == TopAbs_EDGE) { aProf = BRepBuilderAPI_MakeWire(TopoDS::Edge(aShapeBase)).Shape(); } - else if( aShapeBase.ShapeType() == TopAbs_WIRE) { + else if (aShapeBase.ShapeType() == TopAbs_WIRE) { aProf = aShapeBase; } - else if( aShapeBase.ShapeType() == TopAbs_FACE) { + else if (aShapeBase.ShapeType() == TopAbs_FACE) { TopExp_Explorer wexp(aShapeBase,TopAbs_WIRE); aProf = wexp.Current(); } @@ -1894,7 +2244,7 @@ static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath, PipeBuilder.Add(aProf); if (aShapeVec.IsNull()) { - if(aCIBN) delete aCIBN; + if (aCIBN) delete aCIBN; Standard_NullObject::Raise ("MakePipe aborted : null vector argument"); } @@ -1911,14 +2261,13 @@ static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath, gp_Dir BiNormal(aVec); PipeBuilder.SetMode(BiNormal); PipeBuilder.Build(); - if( aShapeBase.ShapeType() == TopAbs_FACE) { + if (aShapeBase.ShapeType() == TopAbs_FACE) { PipeBuilder.MakeSolid(); } return PipeBuilder.Shape(); } - //======================================================================= //function : Execute //purpose : @@ -1930,427 +2279,157 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); GEOMImpl_IPipe* aCI= 0; Standard_Integer aType = aFunction->GetType(); - if(aType == PIPE_BASE_PATH) + if (aType == PIPE_BASE_PATH) aCI = new GEOMImpl_IPipe(aFunction); - else if(aType == PIPE_DIFFERENT_SECTIONS) + else if (aType == PIPE_DIFFERENT_SECTIONS) aCI = new GEOMImpl_IPipeDiffSect(aFunction); - else if(aType == PIPE_SHELL_SECTIONS) + else if (aType == PIPE_SHELL_SECTIONS) aCI = new GEOMImpl_IPipeShellSect(aFunction); - else if(aType == PIPE_SHELLS_WITHOUT_PATH) + else if (aType == PIPE_SHELLS_WITHOUT_PATH) aCI = new GEOMImpl_IPipeShellSect(aFunction); - else if(aType == PIPE_BI_NORMAL_ALONG_VECTOR) + else if (aType == PIPE_BI_NORMAL_ALONG_VECTOR) aCI = new GEOMImpl_IPipeBiNormal(aFunction); else return 0; TopoDS_Wire aWirePath; - if(aType != PIPE_SHELLS_WITHOUT_PATH) { + if (aType != PIPE_SHELLS_WITHOUT_PATH) { // working with path Handle(GEOM_Function) aRefPath = aCI->GetPath(); TopoDS_Shape aShapePath = aRefPath->GetValue(); if (aShapePath.IsNull()) { MESSAGE ("Driver : path is null"); - if(aCI) delete aCI; + if (aCI) delete aCI; Standard_NullObject::Raise("MakePipe aborted : null path argument"); } // Get path contour - if (aShapePath.ShapeType() == TopAbs_WIRE) { + bool isOk = false; + if (aShapePath.ShapeType() == TopAbs_COMPOUND) { + TopTools_SequenceOfShape anEdges; + TopExp_Explorer anExp; + BRep_Builder B; + TopoDS_Wire W; + B.MakeWire(W); + for (anExp.Init(aShapePath, TopAbs_EDGE); anExp.More(); anExp.Next()) { + B.Add(W, anExp.Current()); + isOk = true; + } + if (isOk) + aWirePath = W; + } + else if (aShapePath.ShapeType() == TopAbs_WIRE) { aWirePath = TopoDS::Wire(aShapePath); + isOk = true; } else { if (aShapePath.ShapeType() == TopAbs_EDGE) { - TopoDS_Edge anEdge = TopoDS::Edge(aShapePath); - aWirePath = BRepBuilderAPI_MakeWire(anEdge); - } - else { - if(aCI) delete aCI; - Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge"); + TopoDS_Edge anEdge = TopoDS::Edge(aShapePath); + aWirePath = BRepBuilderAPI_MakeWire(anEdge); + isOk = true; } } + if (!isOk) { + if (aCI) delete aCI; + Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge"); + } } TopoDS_Shape aShape; - if (aType == PIPE_BASE_PATH) - { + if (aType == PIPE_BASE_PATH) { Handle(GEOM_Function) aRefBase = aCI->GetBase(); - TopoDS_Shape aShapeBase = aRefBase->GetValue(); + TopoDS_Shape aShapeBase; + + // Make copy to prevent modifying of base object 0020766 : EDF 1320 + BRepBuilderAPI_Copy Copy(aRefBase->GetValue()); + if (Copy.IsDone()) + aShapeBase = Copy.Shape(); if (aShapeBase.IsNull()) { - if(aCI) delete aCI; + if (aCI) delete aCI; Standard_NullObject::Raise("MakePipe aborted : null base argument"); } // Make pipe - aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase); + if (aShapeBase.ShapeType() == TopAbs_EDGE || + aShapeBase.ShapeType() == TopAbs_WIRE) + { + TopoDS_Wire Profile; + if (aShapeBase.ShapeType() == TopAbs_WIRE) + Profile = TopoDS::Wire(aShapeBase); + else + { + BRep_Builder BB; + BB.MakeWire(Profile); + BB.Add(Profile, aShapeBase); + } + + BRepOffsetAPI_MakePipeShell Sweep (aWirePath); + BRepBuilderAPI_MakeFace FaceBuilder (aWirePath, Standard_True); //to find the plane of spine + if (FaceBuilder.IsDone()) + Sweep.SetMode(FaceBuilder.Face()); + Sweep.Add(Profile); + Sweep.Build(); + + if (!Sweep.IsDone()) + { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("MakePipeShell failed"); + } + else + aShape = Sweep.Shape(); //result is good + + } + else + aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase); } //building pipe with different sections else if (aType == PIPE_DIFFERENT_SECTIONS) { GEOMImpl_IPipeDiffSect* aCIDS = (GEOMImpl_IPipeDiffSect*)aCI; - //GEOMImpl_IPipeDiffSect* aCIDS = static_cast(aCI); - //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases (); Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations (); Standard_Boolean aWithContact = (aCIDS->GetWithContactMode()); Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode()); + if (aCI) { + delete aCI; + aCI = 0; + } - Standard_Integer i =1, nbBases = aBasesObjs->Length(), - nbLocs = (aLocObjs.IsNull() ? 0 :aLocObjs->Length()); + Standard_Integer nbBases = aBasesObjs->Length(); + Standard_Integer nbLocs = (aLocObjs.IsNull() ? 0 : aLocObjs->Length()); - if(nbLocs && nbLocs != nbBases) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Number of sections is not equal to number of locations "); - } - TopTools_SequenceOfShape aSeqBases; - TopTools_SequenceOfShape aSeqLocs; - TopTools_SequenceOfShape aSeqFaces; - for( ; i <= nbBases; i++) { + Handle(TopTools_HSequenceOfShape) aHSeqBases = new TopTools_HSequenceOfShape; + Handle(TopTools_HSequenceOfShape) aHSeqLocs = new TopTools_HSequenceOfShape; + Standard_Integer i; + + for (i = 1; i <= nbBases; i++) { Handle(Standard_Transient) anItem = aBasesObjs->Value(i); - if(anItem.IsNull()) - continue; + if (anItem.IsNull()) + continue; Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem); - if(aRefBase.IsNull()) - continue; - TopoDS_Shape aShapeBase = aRefBase->GetValue(); - if(aShapeBase.IsNull()) - continue; - TopAbs_ShapeEnum aTypeBase = aShapeBase.ShapeType(); - - //if for section was specified face with a few wires then a few - // pipes were build and make solid - Standard_Boolean NeedCreateSolid = Standard_False; - if(aTypeBase == TopAbs_SHELL) { - // create wire as boundary contour if shell is no closed - // get free boundary shapes - ShapeAnalysis_FreeBounds anAnalizer( aShapeBase ); - TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); - TopExp_Explorer anExp; - TopoDS_Shape aWire; - Standard_Integer NbWires = 0; - for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() ) { - NbWires++; - aWire = anExp.Current(); - } - if(NbWires!=1) { - // bad case - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Bad shell is used as section "); - } - NeedCreateSolid = Standard_True; - aSeqFaces.Append(aShapeBase); - aSeqBases.Append(aWire); - } - else if(aTypeBase == TopAbs_FACE) { - NeedCreateSolid = Standard_True; - //for case one path should be used other type function - aSeqFaces.Append(aShapeBase); - TopExp_Explorer aExpW(aShapeBase,TopAbs_WIRE); - for( ; aExpW.More(); aExpW.Next()) - { - TopoDS_Shape aWireProf = aExpW.Current(); - aSeqBases.Append(aWireProf); - } - } - else if(aTypeBase == TopAbs_WIRE || aTypeBase == TopAbs_VERTEX) { - aSeqBases.Append(aShapeBase); - } - else if(aTypeBase == TopAbs_EDGE) { - TopoDS_Edge anEdge = TopoDS::Edge(aShapeBase); - TopoDS_Shape aWireProf = BRepBuilderAPI_MakeWire(anEdge); - aSeqBases.Append(aWireProf); - } - if(nbLocs) { - Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i); - if(anItemLoc.IsNull()) - continue; - Handle(GEOM_Function) aRefLoc = Handle(GEOM_Function)::DownCast(anItemLoc); - TopoDS_Shape aShapeLoc = aRefLoc->GetValue(); - if(aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX) - continue; - aSeqLocs.Append(aShapeLoc); - } - } - - nbLocs = aSeqLocs.Length(); - - // skl 02.05.2007 - TopTools_SequenceOfShape Edges; - if(nbLocs>0) { - // we have to check that each location shape is a vertex from - // path and update aSeqLocs if it is needed (and possible) - TColgp_SequenceOfPnt PLocs; - for(i=1; i<=nbLocs; i++) { - TopoDS_Vertex V = TopoDS::Vertex(aSeqLocs.Value(i)); - PLocs.Append(BRep_Tool::Pnt(V)); - } - //TopTools_SequenceOfShape Edges; - TopExp_Explorer anExp; - for ( anExp.Init( aWirePath, TopAbs_EDGE ); anExp.More(); anExp.Next() ) { - Edges.Append(anExp.Current()); - } - int nbEdges = Edges.Length(); - ShapeAnalysis_Edge sae; - TopoDS_Edge edge = TopoDS::Edge(Edges.First()); - double tol = BRep_Tool::Tolerance(edge); - TopoDS_Vertex VF = sae.FirstVertex(edge); - gp_Pnt PF = BRep_Tool::Pnt(VF); - //cout<<"PF("< tol ) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise - ("First location shapes is not coincided with first vertex of aWirePath"); - } - aSeqLocs.ChangeValue(1) = VF; - edge = TopoDS::Edge(Edges.Last()); - tol = BRep_Tool::Tolerance(edge); - TopoDS_Vertex VL = sae.LastVertex(edge); - gp_Pnt PL = BRep_Tool::Pnt(VL); - if( PL.Distance(PLocs.Last()) > tol ) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise - ("Last location shapes is not coincided with last vertex of aWirePath"); - } - aSeqLocs.ChangeValue(nbLocs) = VL; - int jcurr = 2; - for(i=1; i<=Edges.Length() && jcurr0 && - PLocs.Value(jcurr).Distance(PPC.Point(1)) < tol ) { - double param = PPC.Parameter(1); - gp_Pnt PC1; - C->D0(param,PC1); - // split current edge - Handle(Geom_TrimmedCurve) tc1 = new Geom_TrimmedCurve(C,fp,param); - Handle(Geom_TrimmedCurve) tc2 = new Geom_TrimmedCurve(C,param,lp); - TopoDS_Edge E1,E2; - BRep_Builder B; - gp_Pnt Pfp; - C->D0(fp,Pfp); - if(Pfp.Distance(P1) we have to update WirePath - BRep_Builder B; - TopoDS_Wire W; - B.MakeWire(W); - for(i=1; i<=Edges.Length(); i++) { - B.Add(W,TopoDS::Edge(Edges.Value(i))); - } - aWirePath = W; - } - } + if (aRefBase.IsNull()) + continue; + if (aRefBase->GetValue().IsNull()) + continue; - // check curvature of wire for condition that - // max summary angle between directions along - // wire path must be < 4*PI. If not - split wire - // and seguences of shapes, perform pipe for each - // and make sewing after that - double fp,lp; - Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp); - gp_Pnt P1,P2; - gp_Vec Vec1,Vec2; - C->D1(fp,P1,Vec1); - C->D1(lp,P2,Vec2); - double SumAng = fabs(Vec1.Angle(Vec2)); - Vec1 = Vec2; - P1 = P2; - TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums; - int LastLoc = 1; - //cout<<"Edges.Length()="<D1(lp,P2,Vec2); - double ang = fabs(Vec1.Angle(Vec2)); - SumAng += ang; - if(SumAng>4*PI) { - SumAng = ang; - SplitEdgeNums.Append(i-1); - int j; - for(j=LastLoc+1; j<=aSeqLocs.Length(); j++) { - TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j)); - gp_Pnt P = BRep_Tool::Pnt(aVert); - if( P1.Distance(P) < tol ) { - SplitLocNums.Append(j); - LastLoc = j; - break; - } - } - } - Vec1 = Vec2; - P1 = P2; + aHSeqBases->Append(aRefBase->GetValue()); } - - //cout<<"SplitEdgeNums.Length()="<SetTolerance(Precision::Confusion()); - aSewing->SetFaceMode(Standard_True); - aSewing->SetFloatingEdgesMode(Standard_False); - aSewing->SetNonManifoldMode(Standard_False); - for(i=1; i<=aSeqRes.Length(); i++) { - aSewing->Add(aSeqRes.Value(i)); - } - aSewing->Perform(); - aShape = aSewing->SewedShape(); + for (i = 1; i <= nbLocs; i++) { + Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i); + if (anItemLoc.IsNull()) + continue; + Handle(GEOM_Function) aRefLoc = Handle(GEOM_Function)::DownCast(anItemLoc); + TopoDS_Shape aShapeLoc = aRefLoc->GetValue(); + if (aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX) + continue; + + aHSeqLocs->Append(aShapeLoc); } - else { - // old implementation without splitting - BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); - - Standard_Integer nbShapes = aSeqBases.Length(); - Standard_Integer step = nbShapes/nbBases; - - if(nbShapes < nbBases || fmod((double)nbShapes, (double)nbBases)) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid sections were specified for building pipe"); - } - Standard_Integer ind =0; - for( i=1; i <= nbShapes && ind < nbShapes; i++) { //i+nbBases <= nbShapes - TopTools_SequenceOfShape usedBases; - Standard_Integer j = 1; - for( ; j <= nbBases ; j++) { - ind = i + (j-1)*step; - TopoDS_Shape aWireProf = aSeqBases.Value(ind); - usedBases.Append(aWireProf); - if(nbLocs) { - TopoDS_Shape aShapeLoc = aSeqLocs.Value(j); - TopoDS_Vertex aVert = TopoDS::Vertex(aShapeLoc); - aBuilder.Add(aWireProf,aVert,aWithContact,aWithCorrect); - } - else - aBuilder.Add(aWireProf,aWithContact,aWithCorrect); - } - if(!aBuilder.IsReady()) { - if(aCI) delete aCI; - Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); - } - aBuilder.Build(); - aShape = aBuilder.Shape(); - aSeqFaces.Append(aShape); - for( j = 1; j <=usedBases.Length(); j++) - aBuilder.Delete(usedBases.Value(j)); - } - //for case if section is face - if(aSeqFaces.Length() >1) { - BRep_Builder aB; - TopoDS_Compound aComp; - aB.MakeCompound(aComp); - for( i = 1; i <= aSeqFaces.Length(); i++) - aB.Add(aComp,aSeqFaces.Value(i)); - aShape = aComp; - } - } + aShape = CreatePipeWithDifferentSections(aWirePath, aHSeqBases, aHSeqLocs, aWithContact, aWithCorrect); } //building pipe with shell sections @@ -2389,6 +2468,21 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); } + // Glue (for bug 0020207) + TopExp_Explorer anExpV (aShape, TopAbs_VERTEX); + if (anExpV.More()) { + Standard_Real aVertMaxTol = -RealLast(); + for (; anExpV.More(); anExpV.Next()) { + TopoDS_Vertex aVertex = TopoDS::Vertex(anExpV.Current()); + Standard_Real aTol = BRep_Tool::Tolerance(aVertex); + if (aTol > aVertMaxTol) + aVertMaxTol = aTol; + } + aVertMaxTol += Precision::Confusion(); + aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True); + //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True); + } + TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); aFunction->SetValue(aRes); @@ -2396,28 +2490,25 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const return 1; } - //======================================================================= //function : GEOMImpl_PipeDriver_Type_ //purpose : //======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeDriver_Type_() { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipeDriver", - sizeof(GEOMImpl_PipeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_PipeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -2436,6 +2527,5 @@ const Handle(GEOMImpl_PipeDriver) Handle(GEOMImpl_PipeDriver)::DownCast(const Ha } } - return _anOtherObject ; + return _anOtherObject; } - diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx index 041027786..829072875 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_PipeDriver.ixx // Module : GEOMImpl -// + #ifndef _GEOMImpl_PipeDriver_HeaderFile #define _GEOMImpl_PipeDriver_HeaderFile @@ -119,6 +120,10 @@ class Handle(GEOMImpl_PipeDriver) : public Handle(TFunction_Driver) { #include #endif +#include +#include +#include + class TColStd_SequenceOfExtendedString; @@ -149,6 +154,13 @@ public: Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PipeDriver() {}; + Standard_EXPORT static TopoDS_Shape CreatePipeWithDifferentSections + (const TopoDS_Wire& theWirePath, + const Handle(TopTools_HSequenceOfShape) theBases, + const Handle(TopTools_HSequenceOfShape) theLocs, + const Standard_Boolean theWithContact, + const Standard_Boolean theWithCorrect); + // Type management // @@ -157,7 +169,7 @@ public: { return STANDARD_TYPE(GEOMImpl_PipeDriver) ; } Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PipeDriver) == AType || - TFunction_Driver::IsKind(AType)); } + TFunction_Driver::IsKind(AType)); } }; diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx new file mode 100644 index 000000000..025042282 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx @@ -0,0 +1,656 @@ +// Copyright (C) 2007-2012 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 + +#include +#include +#include + +#include +#include + +#include +#include "GEOMAlgo_FinderShapeOn1.hxx" +#include "GEOMAlgo_FinderShapeOn2.hxx" +#include + +#include +#include + +// Partition includes +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +//@@ include required header files here @@// + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PipeTShapeDriver::GetID() +{ + static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C"); + return aGUID; +} + +//======================================================================= +//function : GEOMImpl_PipeTShapeDriver +//purpose : +//======================================================================= +GEOMImpl_PipeTShapeDriver::GEOMImpl_PipeTShapeDriver() +{ +} + +//======================================================================= +//function : getShapesOnBoxIDs + /*! + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against + * \param theShape - the shape to explore + * \param theShapeType - type of sub-shape of theShape + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes + */ +//======================================================================= +Handle(TColStd_HSequenceOfInteger) +GEOMImpl_PipeTShapeDriver::GetShapesOnBoxIDs(const TopoDS_Shape& aBox, + const TopoDS_Shape& aShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState) const +{ + Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; + + // Check presence of triangulation, build if need + if (!GEOMImpl_IShapesOperations::CheckTriangulation(aShape)) { + StdFail_NotDone::Raise("Cannot build triangulation on the shape"); + return aSeqOfIDs; + } + + // Call algo + GEOMAlgo_FinderShapeOn2 aFinder; + Standard_Real aTol = 0.0001; // default value + + Handle(GEOMAlgo_ClsfBox) aClsfBox = new GEOMAlgo_ClsfBox; + aClsfBox->SetBox(aBox); + + aFinder.SetShape(aShape); + aFinder.SetTolerance(aTol); + aFinder.SetClsf(aClsfBox); + aFinder.SetShapeType( (TopAbs_ShapeEnum)theShapeType ); + aFinder.SetState(theState); + aFinder.Perform(); + + // Interprete results + Standard_Integer iErr = aFinder.ErrorStatus(); + // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx + if (iErr) { + TCollection_AsciiString aMsg (" iErr : "); + aMsg += TCollection_AsciiString(iErr); + StdFail_NotDone::Raise(aMsg.ToCString()); + return aSeqOfIDs; + } + + + const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result + + if (listSS.Extent() < 1) { + StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017 + return aSeqOfIDs; + } + + // Fill sequence of object IDs + aSeqOfIDs = new TColStd_HSequenceOfInteger; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + + TopTools_ListIteratorOfListOfShape itSub (listSS); + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + int id = anIndices.FindIndex(itSub.Value()); +// std::cerr << "Shape with ID " << id << " found" << std::endl; + aSeqOfIDs->Append(id); + } + + return aSeqOfIDs; +} + +//======================================================================= +//function : GetShapesOnSurfaceIDs + /*! + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theSurface - the surface to check state of sub-shapes against + * \param theShape - the shape to explore + * \param theShapeType - type of sub-shape of theShape + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes + */ +//======================================================================= +Handle(TColStd_HSequenceOfInteger) + GEOMImpl_PipeTShapeDriver::GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface, + const TopoDS_Shape& theShape, + TopAbs_ShapeEnum theShapeType, + GEOMAlgo_State theState) const +{ + Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; + + // Check presence of triangulation, build if need + if (!GEOMImpl_IShapesOperations::CheckTriangulation(theShape)) { + StdFail_NotDone::Raise("Cannot build triangulation on the shape"); + return aSeqOfIDs; + } + + // Call algo + GEOMAlgo_FinderShapeOn1 aFinder; + Standard_Real aTol = 1e-6; + + aFinder.SetShape(theShape); + aFinder.SetTolerance(aTol); + aFinder.SetSurface(theSurface); + aFinder.SetShapeType(theShapeType); + aFinder.SetState(theState); + + // Sets the minimal number of inner points for the faces that do not have own + // inner points at all (for e.g. rectangular planar faces have just 2 triangles). + // Default value=3 + aFinder.SetNbPntsMin(3); + // Sets the maximal number of inner points for edges or faces. + // It is usefull for the cases when this number is very big (e.g =2000) to improve + // the performance. If this value =0, all inner points will be taken into account. + // Default value=0 + aFinder.SetNbPntsMax(0); + + aFinder.Perform(); + + // Interprete results + Standard_Integer iErr = aFinder.ErrorStatus(); + // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx + if (iErr) { +// MESSAGE(" iErr : " << iErr); + TCollection_AsciiString aMsg (" iErr : "); + aMsg += TCollection_AsciiString(iErr); + StdFail_NotDone::Raise(aMsg.ToCString()); + return aSeqOfIDs; + } +// Standard_Integer iWrn = aFinder.WarningStatus(); + // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx +// if (iWrn) { +// MESSAGE(" *** iWrn : " << iWrn); +// } + + const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result + + if (listSS.Extent() < 1) { + //StdFail_NotDone::Raise("Not a single sub-shape of the requested type found on the given surface"); + StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017 + return aSeqOfIDs; + } + + // Fill sequence of object IDs + aSeqOfIDs = new TColStd_HSequenceOfInteger; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(theShape, anIndices); + + TopTools_ListIteratorOfListOfShape itSub (listSS); + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + int id = anIndices.FindIndex(itSub.Value()); + aSeqOfIDs->Append(id); + } + + return aSeqOfIDs; +} + +//======================================================================= +//function : GetCommonShapesOnCylinders +//purpose : return the common shapes between 2 cylindrical surfaces +// along OX and OZ +//======================================================================= +void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& theShape, + TopAbs_ShapeEnum theShapeType, + double r1, + double r2, + Handle(TopTools_HSequenceOfShape)& commonShapes) const +{ + gp_Pnt aP0 (0, 0, 0); + gp_Vec aVX = gp::DX(), aVZ = gp::DZ(); + gp_Ax3 anAxis1 (aP0, aVX), anAxis2 (aP0, aVZ); + + TopTools_IndexedMapOfShape aMapOfShapes; + aMapOfShapes.Clear(); + TopExp::MapShapes(theShape, aMapOfShapes); + + commonShapes->Clear(); + + int myID; + bool found = false; + + // Create a cylinder surface + Handle(Geom_Surface) aC1Ext = new Geom_CylindricalSurface(anAxis1, r1); + if ( aC1Ext.IsNull() ) + StdFail_NotDone::Raise("Couldn't build main cylindrical surface"); + // Find object IDs + Handle(TColStd_HSequenceOfInteger) aSeqExt1 = GetShapesOnSurfaceIDs( aC1Ext, theShape, theShapeType, GEOMAlgo_ST_ON ); + // Create a cylinder surface + Handle(Geom_Surface) aC2Ext = new Geom_CylindricalSurface(anAxis2, r2); + if ( aC2Ext.IsNull() ) + StdFail_NotDone::Raise("Couldn't build incident cylindrical surface"); + // Find object IDs + Handle(TColStd_HSequenceOfInteger) aSeqExt2 = GetShapesOnSurfaceIDs( aC2Ext, theShape, theShapeType, GEOMAlgo_ST_ON ); + // # Recherche (dans le quart de Te) de l'arete d'intersection des 2 cylindres + // # Search in theShape for common shape of type theShapeType on the intersection of 2 pipes + found = false; + for (int i=1; i<=aSeqExt2->Length();i++) { +// std::cerr << "aSeqExt2->Value(i): " << aSeqExt2->Value(i) << std::endl; + for (int j=1; j<=aSeqExt1->Length();j++) { +// std::cerr << "aSeqExt1->Value(j): " << aSeqExt1->Value(j) << std::endl; + if (aSeqExt1->Value(j) == aSeqExt2->Value(i)) { + myID = aSeqExt1->Value(j); + commonShapes->Append(aMapOfShapes.FindKey(myID)); + found = true; + } + } + } + if (!found) + StdFail_NotDone::Raise("Common shapes couldn't be found"); +} + +//======================================================================= +//function : MakePipeTShape +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape(const double r1, const double w1, const double l1, + const double r2, const double w2, const double l2) const +{ + double r1Ext = r1 + w1; + double r2Ext = r2 + w2; + + gp_Pnt aP0 (0, 0, 0); + gp_Pnt aP1 (-l1, 0, 0); + gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ(); + gp_Ax2 anAxes1 (aP1, aVX); + gp_Ax2 anAxes2 (aP0, aVZ); + + // Build the initial pipes + BRepPrimAPI_MakeCylinder C1Int (anAxes1, r1, Abs(2 * l1)); + BRepPrimAPI_MakeCylinder C1Ext (anAxes1, r1Ext, Abs(2 * l1)); + BRepPrimAPI_MakeCylinder C2Int (anAxes2, r2, Abs(l2)); + BRepPrimAPI_MakeCylinder C2Ext (anAxes2, r2Ext, Abs(l2)); + C1Int.Build(); + C1Ext.Build(); + C2Int.Build(); + C2Ext.Build(); + if (!C1Int.IsDone() || !C1Ext.IsDone() || !C2Int.IsDone() || !C2Ext.IsDone()) { + StdFail_NotDone::Raise("Couldn't build cylinders"); + } + + // Fuse the 2 pipes + BRepAlgoAPI_Fuse fuse1 (C1Ext.Shape(), C2Ext.Shape()); + if (!fuse1.IsDone()) { + StdFail_NotDone::Raise("Couldn't fuse cylinders"); + } + + // Remove small radius main pipe + BRepAlgoAPI_Cut cut1 (fuse1.Shape(), C1Int.Shape()); + if (!cut1.IsDone()) { + StdFail_NotDone::Raise("Coudn't cut cylinders"); + } + + // Remove small radius incident pipe => Te + BRepAlgoAPI_Cut Te (cut1.Shape(), C2Int.Shape()); + if (!Te.IsDone()) { + StdFail_NotDone::Raise("Coudn't cut cylinders"); + } + + return Te.Shape(); +} + +//======================================================================= +//function : MakeQuarterPipeTShape +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakeQuarterPipeTShape(const double r1, const double w1, const double l1, + const double r2, const double w2, const double l2) const +{ + double r1Ext = r1 + w1; + TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2); + if (Te.IsNull()) + StdFail_NotDone::Raise("Couldn't build Pipe TShape"); + + // Get a quarter of shape => Te2 + BRepPrimAPI_MakeBox box1 (gp_Pnt(0,-2*r1Ext,-2*r1Ext),gp_Pnt(Abs(2 * l1), 2*r1Ext, Abs(2*l2))); + BRepPrimAPI_MakeBox box2 (gp_Pnt(0,2*r1Ext,-2*r1Ext),gp_Pnt(-Abs(2 * l1), 0, Abs(2*l2))); + box1.Build(); + box2.Build(); + if (!box1.IsDone() || !box2.IsDone()) { + StdFail_NotDone::Raise("Couldn't build boxes"); + } + BRepAlgoAPI_Cut cut3 (Te, box1.Shape()); + if (!cut3.IsDone()) { + StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box"); + } + BRepAlgoAPI_Cut Te4 (cut3.Shape(), box2.Shape()); + if (!Te4.IsDone()) { + StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box"); + } + + return Te4.Shape(); +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPipeTShape aData (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape, Te4, Te4Part; +// TopoDS_Edge arete_intersect_int; +// Handle(TopTools_HSequenceOfShape) edges_e = new TopTools_HSequenceOfShape; + Handle(TColStd_HSequenceOfInteger) edges_e; +// Handle(TopTools_HSequenceOfShape) edges_i = new TopTools_HSequenceOfShape; +// gp_Pnt aP0 (0, 0, 0); +// gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ(); + bool hexMesh = (bool) aData.GetHexMesh(); + + // Useful values +// double aSize = 2*(aData.GetL1() + aData.GetL2()); + double epsilon = Precision::Approximation(); + double aR1Ext = aData.GetR1() + aData.GetW1(); + double aR2Ext = aData.GetR2() + aData.GetW2(); + + if (aData.GetR2() > aData.GetR1() + epsilon) { + StdFail_NotDone::Raise("TShape cannot be computed if R2 > R1"); + } + + if (aR2Ext > aR1Ext + epsilon) { + StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 > R1+W1"); + } + + // external radius are equal + if (fabs(aR2Ext - aR1Ext) < epsilon) { + if (aType == TSHAPE_CHAMFER) + StdFail_NotDone::Raise("TShape with chamfer cannot be computed if R2+W2 = R1+W1"); + if (aType == TSHAPE_FILLET) + StdFail_NotDone::Raise("TShape with fillet cannot be computed if R2+W2 = R1+W1"); + // internal radius are different => not possible + if (fabs(aData.GetR2() - aData.GetR1()) > epsilon) { + StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 = R1+W1 and R2 != R1"); + } + } + + + if (aR1Ext >= aData.GetL2() + epsilon) { + StdFail_NotDone::Raise("TShape cannot be computed if R1+W1 >= L2"); + } + if (aR2Ext >= aData.GetL1() + epsilon) { + StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 >= L1"); + } + + if (aType == TSHAPE_CHAMFER) { + if (aData.GetH() >= (aData.GetL2() - aR1Ext + epsilon)) { + StdFail_NotDone::Raise("TShape cannot be computed: height of chamfer is too high"); + } + + if (aData.GetW() >= (aData.GetL1() - aR2Ext + epsilon)) + StdFail_NotDone::Raise("TShape cannot be computed: width of chamfer is too high"); + } + + if (aType == TSHAPE_FILLET) { + if (aData.GetRF() >= (aData.GetL2() - aR1Ext + epsilon) || + aData.GetRF() >= (aData.GetL1() - aR2Ext + epsilon)) + StdFail_NotDone::Raise("TShape cannot be computed: radius of fillet is too high"); + } + + if (hexMesh) { + // Create a quarter of a basic T-Shape pipe +// std::cerr << "Create a quarter of a basic T-Shape pipe" << std::endl; + Te4 = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(), + aData.GetR2(), aData.GetW2(), aData.GetL2()); + } + else { + // No need to cut pipe t-shape +// std::cerr << "Create a basic T-Shape pipe" << std::endl; + Te4 = MakePipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(), + aData.GetR2(), aData.GetW2(), aData.GetL2()); + } + aShape = Te4; +/* + if (aType == TSHAPE_BASIC) { + aShape = Te4; +// aShape = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(), +// aData.GetR2(), aData.GetW2(), aData.GetL2()); + } + else if (aType == TSHAPE_CHAMFER) { + // TShape with chamfer +// BRep_Builder BB; +// TopoDS_Compound CC; +// BB.MakeCompound(CC); + // Create chamfer on the edges edges_e + BRepFilletAPI_MakeChamfer chamfer (Te4); + TopTools_IndexedMapOfShape anEdgesIndices; + TopExp::MapShapes(Te4, anEdgesIndices); + + TopoDS_Shape theBox; + if (hexMesh) { + BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext)); + aBox.Build(); + if (!aBox.IsDone()) { + StdFail_NotDone::Raise("Couldn't build box"); + } + theBox = aBox.Shape(); + } + else { + BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext)); + aBox.Build(); + if (!aBox.IsDone()) { + StdFail_NotDone::Raise("Couldn't build box"); + } + theBox = aBox.Shape(); + } + Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger; + edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN); + if (edges_e.IsNull() || edges_e->Length() == 0) { + StdFail_NotDone::Raise("Common edges not found"); + } + + + TopTools_IndexedDataMapOfShapeListOfShape M; + GEOMImpl_Block6Explorer::MapShapesAndAncestors(Te4, TopAbs_EDGE, TopAbs_FACE, M); +// std::cerr << "Number of IDs: " << edges_e->Length() << std::endl; + int nbEdgesInChamfer = 0; + for (int i=1;i<=edges_e->Length();i++) { +// std::cerr << "Get Edge with ID #" << i << std::endl; + int theId = edges_e->Value(i); +// std::cerr << "ID #" << i << "= " << theId << std::endl; +// std::cerr << "Search for edge in shape" << std::endl; + TopoDS_Edge theEdge = TopoDS::Edge(anEdgesIndices.FindKey(theId)); +// std::cerr << "Found" << std::endl; +// std::cerr << "Keep only edges with a vertex on (x, x, re1)" << std::endl; + TopExp_Explorer ExVertices; + for (ExVertices.Init(theEdge,TopAbs_VERTEX); ExVertices.More(); ExVertices.Next()) { + gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(ExVertices.Current())); + if (aPt.Z() - aR1Ext <= epsilon) { +// std::cerr << "aPt.Z() = aR1Ext => keep this edge" << std::endl; + nbEdgesInChamfer ++; + const TopTools_ListOfShape& aFL = M.FindFromKey(theEdge); + TopoDS_Face F = TopoDS::Face( aFL.First() ); + if (hexMesh) + chamfer.Add(aData.GetH(), aData.GetW(), theEdge, F); + else + chamfer.Add(aData.GetW(), aData.GetH(), theEdge, F); + break; + } + } +// std::cerr << "Test if hexMesh: "; + if (hexMesh && nbEdgesInChamfer == 1) { +// std::cerr << "Yes => stop after 1 edge" << std::endl; + break; + } +// std::cerr << "No => continue for other edges" << std::endl; + // BB.Add(CC, edges_e->Value(i)); + // const TopTools_ListOfShape& aFL = M.FindFromKey(TopoDS::Edge(edges_e->Value(i))); + // chamfer.Add(aData.GetW(), aData.GetH(), TopoDS::Edge(edges_e->Value(i)), F); + } +// std::cerr << "Build chamfer with " << nbEdgesInChamfer << " edges" << std::endl; +// } + chamfer.Build(); + if (!chamfer.IsDone()) { + StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters"); + } + +// BB.Add(CC, chamfer.Shape()); + + +// aShape = CC; + aShape = chamfer.Shape(); + } + else if (aType == TSHAPE_FILLET) { + // TShape with fillet + // Create fillet on the edge arete_intersect_ext + BRepFilletAPI_MakeFillet fill (Te4); + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(Te4, anIndices); + + TopoDS_Shape theBox; + if (hexMesh) { + BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext)); + aBox.Build(); + if (!aBox.IsDone()) { + StdFail_NotDone::Raise("Couldn't build box"); + } + theBox = aBox.Shape(); + } + else { + BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext)); + aBox.Build(); + if (!aBox.IsDone()) { + StdFail_NotDone::Raise("Couldn't build box"); + } + theBox = aBox.Shape(); + } + Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger; + edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN); + if (edges_e.IsNull() || edges_e->Length() == 0) { + StdFail_NotDone::Raise("Common edges not found"); + } + +// fill.Add(TopoDS::Edge(edges_e->Value(1))); +// if (!hexMesh) { + for (int i=1;i<=edges_e->Length();i++) { + if (hexMesh && (i > 1)) + break; + TopoDS_Edge theEdge = TopoDS::Edge(anIndices.FindKey(edges_e->Value(i))); + fill.Add(theEdge); +// fill.Add(TopoDS::Edge(edges_e->Value(i))); + } +// } + fill.SetRadius(aData.GetRF(), 1, 1); + fill.Build(); + if (!fill.IsDone()) { + StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius"); + } + + aShape = fill.Shape(); + } + else { + // other construction modes here + } +*/ + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + +//======================================================================= +//function : GEOMImpl_PipeTShapeDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_() +{ + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipeTShapeDriver", + sizeof(GEOMImpl_PipeTShapeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_PipeTShapeDriver) Handle(GEOMImpl_PipeTShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PipeTShapeDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipeTShapeDriver))) { + _anOtherObject = Handle(GEOMImpl_PipeTShapeDriver)((Handle(GEOMImpl_PipeTShapeDriver)&)AnObject); + } + } + + return _anOtherObject; +} diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx new file mode 100644 index 000000000..90d8f35ec --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx @@ -0,0 +1,196 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef _GEOMImpl_PipeTShapeDriver_HXX +#define _GEOMImpl_PipeTShapeDriver_HXX + +#include + +#include "GEOMAlgo_State.hxx" + +#include +#include +#include +#include +#include + +#include + +class Handle_Standard_Type; +class GEOMImpl_PipeTShapeDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeTShapeDriver); + +class Handle(GEOMImpl_PipeTShapeDriver) : public Handle(TFunction_Driver) { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PipeTShapeDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PipeTShapeDriver)(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + {} + + Handle(GEOMImpl_PipeTShapeDriver)(const GEOMImpl_PipeTShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + {} + + Handle(GEOMImpl_PipeTShapeDriver)& operator=(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PipeTShapeDriver)& operator=(const GEOMImpl_PipeTShapeDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PipeTShapeDriver* operator->() + { + return (GEOMImpl_PipeTShapeDriver *)ControlAccess(); + } + + GEOMImpl_PipeTShapeDriver* operator->() const + { + return (GEOMImpl_PipeTShapeDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PipeTShapeDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PipeTShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +class GEOMImpl_PipeTShapeDriver : public TFunction_Driver { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_PipeTShapeDriver(); + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const + { + return Standard_True; + } + Standard_EXPORT static const Standard_GUID& GetID(); + Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {}; + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { + return STANDARD_TYPE(GEOMImpl_PipeTShapeDriver); + } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { + return (STANDARD_TYPE(GEOMImpl_PipeTShapeDriver) == AType || TFunction_Driver::IsKind(AType)); + } +private: + /*! + * \brief Create a T-Shape based on pipes + * \param r1 - the internal radius of main pipe + * \param w1 - the thickness main pipe + * \param l1 - the half-length of main pipe + * \param r2 - the internal radius of incident pipe + * \param w2 - the thickness incident pipe + * \param l2 - the half-length of main pipe + * \retval TopoDS_Shape - Resulting shape + */ + TopoDS_Shape MakePipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const; + + /*! + * \brief Create a quarter of a T-Shape based on pipes + * \param r1 - the internal radius of main pipe + * \param w1 - the thickness main pipe + * \param l1 - the half-length of main pipe + * \param r2 - the internal radius of incident pipe + * \param w2 - the thickness incident pipe + * \param l2 - the half-length of main pipe + * \retval TopoDS_Shape - Resulting shape + */ + TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const; + +//======================================================================= +//function : GetShapesOnSurfaceIDs + /*! + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theSurface - the surface to check state of sub-shapes against + * \param theShape - the shape to explore + * \param theShapeType - type of sub-shape of theShape + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes + */ + Handle(TColStd_HSequenceOfInteger) + GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface, + const TopoDS_Shape& theShape, + TopAbs_ShapeEnum theShapeType, + GEOMAlgo_State theState) const; +//======================================================================= +//function : getShapesOnBoxIDs + /*! + * \brief Find IDs of sub-shapes complying with given status about surface + * \param theBox - the box to check state of sub-shapes against + * \param theShape - the shape to explore + * \param theShapeType - type of sub-shape of theShape + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes + */ +//======================================================================= + Handle(TColStd_HSequenceOfInteger) + GetShapesOnBoxIDs(const TopoDS_Shape& aBox, + const TopoDS_Shape& aShape, + const Standard_Integer theShapeType, + GEOMAlgo_State theState) const; + + //======================================================================= + //function : getCommonShapesOnCylinders + //purpose : return the common edge between 2 cylindrical surfaces + // along OX and OZ + //======================================================================= + void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape, + TopAbs_ShapeEnum theShapeType, + double r, double r2, + Handle(TopTools_HSequenceOfShape)& commonShapes) const; + +}; + +#endif // _GEOMImpl_PipeTShapeDriver_HXX diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx index 534fc8565..e1968567b 100644 --- a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -28,6 +29,8 @@ #include +#include + // OCCT Includes #include #include @@ -124,7 +127,12 @@ Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) Standard_ConstructionError::Raise("Plane creation aborted: points lay on one line"); GC_MakePlane aMakePlane (aP1, aP2, aP3); +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + aShape = BRepBuilderAPI_MakeFace(aMakePlane, -aSize, +aSize, -aSize, +aSize, + Precision::Confusion()).Shape(); +#else aShape = BRepBuilderAPI_MakeFace(aMakePlane, -aSize, +aSize, -aSize, +aSize).Shape(); +#endif } else if (aType == PLANE_FACE) { Handle(GEOM_Function) aRef = aPI.GetFace(); TopoDS_Shape aRefShape = aRef->GetValue(); @@ -174,6 +182,58 @@ Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const if(aTool.IsDone()) aShape = aTool.Shape(); } + else if (aType == PLANE_2_VEC) { + Handle(GEOM_Function) aRefVec1 = aPI.GetVector1(); + Handle(GEOM_Function) aRefVec2 = aPI.GetVector2(); + TopoDS_Shape aShape1 = aRefVec1->GetValue(); + TopoDS_Shape aShape2 = aRefVec2->GetValue(); + if (aShape1.ShapeType() != TopAbs_EDGE || + aShape2.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge aVectX = TopoDS::Edge(aShape1); + TopoDS_Edge aVectZ = TopoDS::Edge(aShape2); + + TopoDS_Vertex VX1, VX2, VZ1, VZ2; + TopExp::Vertices( aVectX, VX1, VX2, Standard_True ); + TopExp::Vertices( aVectZ, VZ1, VZ2, Standard_True ); + + gp_Vec aVX = gp_Vec( BRep_Tool::Pnt( VX1 ), BRep_Tool::Pnt( VX2 ) ); + gp_Vec aVZ = gp_Vec( BRep_Tool::Pnt( VZ1 ), BRep_Tool::Pnt( VZ2 ) ); + + if ( aVX.Magnitude() < Precision::Confusion() || aVZ.Magnitude() < Precision::Confusion()) + Standard_TypeMismatch::Raise("Invalid vector selected"); + + gp_Dir aDirX = gp_Dir( aVX.X(), aVX.Y(), aVX.Z() ); + gp_Dir aDirZ = gp_Dir( aVZ.X(), aVZ.Y(), aVZ.Z() ); + + if ( aDirX.IsParallel( aDirZ, Precision::Angular() ) ) + Standard_TypeMismatch::Raise("Parallel vectors selected"); + + gp_Ax3 aPlane = gp_Ax3( BRep_Tool::Pnt( VX1 ), aDirZ, aDirX ); + BRepBuilderAPI_MakeFace aTool(aPlane, -aSize, +aSize, -aSize, +aSize); + if(aTool.IsDone()) + aShape = aTool.Shape(); + } else if (aType == PLANE_LCS) { + Handle(GEOM_Function) aRef = aPI.GetLCS(); + double anOrientation = aPI.GetOrientation(); + gp_Ax3 anAx3; + if (aRef.IsNull()) { + gp_Ax2 anAx2 = gp::XOY(); + anAx3 = gp_Ax3( anAx2 ); + } else { + TopoDS_Shape aRefShape = aRef->GetValue(); + if (aRefShape.ShapeType() != TopAbs_FACE) + return 0; + anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aRefShape); + } + + if ( anOrientation == 2) + anAx3 = gp_Ax3(anAx3.Location(), anAx3.XDirection(), anAx3.YDirection() ); + else if ( anOrientation == 3 ) + anAx3 = gp_Ax3(anAx3.Location(), anAx3.YDirection(), anAx3.XDirection() ); + + gp_Pln aPln(anAx3); + aShape = BRepBuilderAPI_MakeFace(aPln, -aSize, +aSize, -aSize, +aSize).Shape(); + } else { } @@ -204,10 +264,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_PlaneDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PlaneDriver", - sizeof(GEOMImpl_PlaneDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_PlaneDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx index 8eb27642a..c5cc4678e 100644 --- a/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_PlaneDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index accc93779..b25807bd0 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -26,22 +27,34 @@ #include #include +#include + +#include #include +#include #include #include -#include + #include +#include #include #include +#include #include #include +#include + +#include +#include #include #include + #include -#include -#include +#include + +#include //======================================================================= //function : GetID @@ -62,6 +75,34 @@ GEOMImpl_PointDriver::GEOMImpl_PointDriver() { } +//======================================================================= +//function : getExtremaSolution +//purpose : local function +//======================================================================= +static Standard_Boolean getExtremaSolution +(const gp_Pnt& theInitPnt, + const TopoDS_Shape& theRefShape, + gp_Pnt& thePnt) +{ + BRepBuilderAPI_MakeVertex mkVertex (theInitPnt); + TopoDS_Vertex anInitV = TopoDS::Vertex(mkVertex.Shape()); + + BRepExtrema_DistShapeShape anExt (anInitV, theRefShape); + if ( !anExt.IsDone() || anExt.NbSolution() < 1 ) + return Standard_False; + thePnt = anExt.PointOnShape2(1); + Standard_Real aMinDist2 = theInitPnt.SquareDistance( thePnt ); + for ( Standard_Integer j = 2, jn = anExt.NbSolution(); j <= jn; j++ ) + { + gp_Pnt aPnt = anExt.PointOnShape2(j); + Standard_Real aDist2 = theInitPnt.SquareDistance( aPnt ); + if ( aDist2 > aMinDist2) + continue; + aMinDist2 = aDist2; + thePnt = aPnt; + } + return Standard_True; +} //======================================================================= //function : Execute @@ -76,13 +117,13 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); gp_Pnt aPnt; + TopoDS_Compound aCompound; + bool retCompound = false; if (aType == POINT_XYZ) { aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ()); - } else if (aType == POINT_XYZ_REF) { - Handle(GEOM_Function) aRefPoint = aPI.GetRef(); TopoDS_Shape aRefShape = aRefPoint->GetValue(); if (aRefShape.ShapeType() != TopAbs_VERTEX) { @@ -91,7 +132,6 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const } gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aRefShape)); aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ()); - } else if (aType == POINT_CURVE_PAR) { Handle(GEOM_Function) aRefCurve = aPI.GetCurve(); @@ -105,6 +145,82 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const aP = aFP + (aLP - aFP) * aPI.GetParameter(); aPnt = aCurve->Value(aP); } + else if (aType == POINT_CURVE_COORD) { + Handle(GEOM_Function) aRefCurve = aPI.GetCurve(); + TopoDS_Shape aRefShape = aRefCurve->GetValue(); + if (aRefShape.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise + ("Point On Curve creation aborted : curve shape is not an edge"); + } + gp_Pnt anInitPnt (aPI.GetX(), aPI.GetY(), aPI.GetZ()); + if (!getExtremaSolution(anInitPnt, aRefShape, aPnt)) { + Standard_ConstructionError::Raise + ("Point On Curve creation aborted : cannot project point"); + } + } + else if (aType == POINT_CURVE_LENGTH) { + // RefCurve + Handle(GEOM_Function) aRefCurve = aPI.GetCurve(); + if (aRefCurve.IsNull()) { + Standard_NullObject::Raise + ("Point On Curve creation aborted : curve object is null"); + } + TopoDS_Shape aRefShape1 = aRefCurve->GetValue(); + if (aRefShape1.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise + ("Point On Curve creation aborted : curve shape is not an edge"); + } + TopoDS_Edge aRefEdge = TopoDS::Edge(aRefShape1); + TopoDS_Vertex V1, V2; + TopExp::Vertices(aRefEdge, V1, V2, Standard_True); + + // RefPoint + TopoDS_Vertex aRefVertex; + Handle(GEOM_Function) aRefPoint = aPI.GetRef(); + if (aRefPoint.IsNull()) { + aRefVertex = V1; + } + else { + TopoDS_Shape aRefShape2 = aRefPoint->GetValue(); + if (aRefShape2.ShapeType() != TopAbs_VERTEX) { + Standard_TypeMismatch::Raise + ("Point On Curve creation aborted : start point shape is not a vertex"); + } + aRefVertex = TopoDS::Vertex(aRefShape2); + } + gp_Pnt aRefPnt = BRep_Tool::Pnt(aRefVertex); + + // Length + Standard_Real aLength = aPI.GetLength(); + //Standard_Real theCurveLength = IntTools::Length(aRefEdge); + //if (aLength > theCurveLength) { + // Standard_ConstructionError::Raise + // ("Point On Curve creation aborted : given length is greater than edges length"); + //} + + // Check orientation + Standard_Real UFirst, ULast; + Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(aRefEdge, UFirst, ULast); + Handle(Geom_Curve) ReOrientedCurve = EdgeCurve; + + Standard_Real dU = ULast - UFirst; + Standard_Real par1 = UFirst + 0.1 * dU; + Standard_Real par2 = ULast - 0.1 * dU; + + gp_Pnt P1 = EdgeCurve->Value(par1); + gp_Pnt P2 = EdgeCurve->Value(par2); + + if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) { + ReOrientedCurve = EdgeCurve->Reversed(); + UFirst = EdgeCurve->ReversedParameter(ULast); + } + + // Get the point by length + GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve); + GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst); + Standard_Real aParam = anAbsPnt.Parameter(); + aPnt = AdapCurve.Value(aParam); + } else if (aType == POINT_SURFACE_PAR) { Handle(GEOM_Function) aRefCurve = aPI.GetSurface(); TopoDS_Shape aRefShape = aRefCurve->GetValue(); @@ -121,6 +237,19 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const Standard_Real V = V1 + (V2-V1) * aPI.GetParameter2(); aPnt = aSurf->Value(U,V); } + else if (aType == POINT_SURFACE_COORD) { + Handle(GEOM_Function) aRefCurve = aPI.GetSurface(); + TopoDS_Shape aRefShape = aRefCurve->GetValue(); + if (aRefShape.ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise + ("Point On Surface creation aborted : surface shape is not a face"); + } + gp_Pnt anInitPnt (aPI.GetX(), aPI.GetY(), aPI.GetZ()); + if (!getExtremaSolution(anInitPnt, aRefShape, aPnt)) { + Standard_ConstructionError::Raise + ("Point On Surface creation aborted : cannot project point"); + } + } else if (aType == POINT_LINES_INTERSECTION) { Handle(GEOM_Function) aRef1 = aPI.GetLine1(); Handle(GEOM_Function) aRef2 = aPI.GetLine2(); @@ -128,33 +257,50 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aRefShape1 = aRef1->GetValue(); TopoDS_Shape aRefShape2 = aRef2->GetValue(); - if (aRefShape1.ShapeType() != TopAbs_EDGE || aRefShape2.ShapeType() != TopAbs_EDGE ) { + if ( (aRefShape1.ShapeType() != TopAbs_EDGE && aRefShape1.ShapeType() != TopAbs_WIRE) + || (aRefShape2.ShapeType() != TopAbs_EDGE && aRefShape2.ShapeType() != TopAbs_WIRE) ) { Standard_TypeMismatch::Raise - ("Creation Point On Lines Intersection Aborted : Line shape is not an edge"); + ("Creation Point On Lines Intersection Aborted : Line shape is not an edge or wire"); } + + if (aRefShape1.IsSame(aRefShape2)) + Standard_ConstructionError::Raise("The lines to make intersection must be different"); + //Calculate Lines Intersection Point BRepExtrema_DistShapeShape dst (aRefShape1, aRefShape2); - if (dst.IsDone()) - { - gp_Pnt P1, P2; - for (int i = 1; i <= dst.NbSolution(); i++) { - P1 = dst.PointOnShape1(i); - P2 = dst.PointOnShape2(i); - Standard_Real Dist = P1.Distance(P2); - if ( Dist <= Precision::Confusion() ) - aPnt = P1; - else - Standard_TypeMismatch::Raise ("Lines not have an Intersection Point"); - } + if (dst.IsDone()) { + gp_Pnt P1, P2; + BRep_Builder B; + B.MakeCompound( aCompound ); + for (int i = 1; i <= dst.NbSolution(); i++) { + P1 = dst.PointOnShape1(i); + P2 = dst.PointOnShape2(i); + Standard_Real Dist = P1.Distance(P2); + if ( Dist <= Precision::Confusion() && dst.NbSolution() > 1) { + BRepBuilderAPI_MakeVertex mkVertex (P1); + B.Add(aCompound, mkVertex.Shape()); + retCompound = true; + } else if ( Dist <= Precision::Confusion() ) { + aPnt = P1; + } else { + Standard_TypeMismatch::Raise ("Shapes have not an Intersection Point"); + } } + } } else { return 0; } - BRepBuilderAPI_MakeVertex mkVertex (aPnt); - TopoDS_Shape aShape = mkVertex.Shape(); - aShape.Infinite(Standard_True); + TopoDS_Shape aShape; + if ( retCompound ) { + aShape = aCompound; + } else { + BRepBuilderAPI_MakeVertex mkVertex (aPnt); + aShape = mkVertex.Shape(); + } + + //aShape.Infinite(Standard_True); // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines) aFunction->SetValue(aShape); log.SetTouched(Label()); @@ -180,10 +326,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_PointDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PointDriver", - sizeof(GEOMImpl_PointDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_PointDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -205,5 +351,3 @@ const Handle(GEOMImpl_PointDriver) Handle(GEOMImpl_PointDriver)::DownCast(const return _anOtherObject ; } - - diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.hxx b/src/GEOMImpl/GEOMImpl_PointDriver.hxx index acffa0196..44841b5e2 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_PointDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx index 5a295e43b..abeac9b21 100644 --- a/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -26,6 +27,8 @@ #include #include +#include +#include #include #include #include @@ -68,23 +71,69 @@ Standard_Integer GEOMImpl_PolylineDriver::Execute(TFunction_Logbook& log) const GEOMImpl_IPolyline aCI (aFunction); Standard_Integer aType = aFunction->GetType(); - + TopoDS_Shape aShape; if (aType == POLYLINE_POINTS) { + + bool useCoords = aCI.GetConstructorType() == COORD_CONSTRUCTOR; + TColgp_Array1OfPnt points(1, (useCoords ? aCI.GetLength() : 1) ); + if(useCoords) { + Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates(); + int anArrayLength = aCoordsArray->Length(); + for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) { + gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); + points.SetValue(j,aPnt); + j++; + } + } + int aLen = aCI.GetLength(); int ind = 1; BRepBuilderAPI_MakePolygon aMakePoly; for (; ind <= aLen; ind++) { - Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); - TopoDS_Shape aShapePnt = aRefPoint->GetValue(); - if (aShapePnt.ShapeType() == TopAbs_VERTEX) { - aMakePoly.Add(TopoDS::Vertex(aShapePnt)); -// if (!aMakePoly.Added()) return 0; + if(useCoords) { + aMakePoly.Add(BRepBuilderAPI_MakeVertex(points.Value(ind))); + } else { + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() != TopAbs_VERTEX) { + Standard_TypeMismatch::Raise + ("Polyline creation aborted : arguments are not a vertexes"); + return 0; + } + if (aShapePnt.ShapeType() == TopAbs_VERTEX) { + aMakePoly.Add(TopoDS::Vertex(aShapePnt)); + //if (!aMakePoly.Added()) return 0; + } } } - if (false) aMakePoly.Close(); + // Compare first and last point coordinates and close polyline if it's the same. + if ( aLen > 2 ) { + TopoDS_Vertex aV1; + if( useCoords ) { + aV1 = BRepBuilderAPI_MakeVertex(points.Value(1)); + } else { + Handle(GEOM_Function) aFPoint = aCI.GetPoint(1); + TopoDS_Shape aFirstPnt = aFPoint->GetValue(); + aV1 = TopoDS::Vertex(aFirstPnt); + } + + TopoDS_Vertex aV2; + if( useCoords ) { + aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen)); + } else { + Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen); + TopoDS_Shape aLastPnt = aLPoint->GetValue(); + aV2 = TopoDS::Vertex(aLastPnt); + } + + if ( (!aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2)) || + aCI.GetIsClosed()) + aMakePoly.Close(); + } + if (aMakePoly.IsDone()) { aShape = aMakePoly.Wire(); } @@ -93,11 +142,11 @@ Standard_Integer GEOMImpl_PolylineDriver::Execute(TFunction_Logbook& log) const } if (aShape.IsNull()) return 0; - + aFunction->SetValue(aShape); - + log.SetTouched(Label()); - + return 1; } @@ -119,10 +168,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_PolylineDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PolylineDriver", - sizeof(GEOMImpl_PolylineDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_PolylineDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx b/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx index 197087d66..690c9489d 100644 --- a/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_PolylineDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx index 2bdec65f3..be11e7dbb 100644 --- a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + //#include // #include @@ -30,11 +31,15 @@ // OCCT Includes #include -#include #include #include #include +#include +#include +#include #include +#include +#include #include #include #include @@ -53,6 +58,10 @@ #include #include +#include +#include +#include + #include #include #include @@ -101,7 +110,7 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShapeEndLCS = aRefEndLCS->GetValue(); if (aShapeBase.IsNull() || aShapeStartLCS.IsNull() || - aShapeEndLCS.IsNull() || aShapeEndLCS.ShapeType() != TopAbs_FACE) + aShapeEndLCS.IsNull() || aShapeEndLCS.ShapeType() != TopAbs_FACE) return 0; gp_Trsf aTrsf; @@ -148,179 +157,55 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const else if (aType == POSITION_ALONG_PATH) { Handle(GEOM_Function) aRefShape = aCI.GetShape(); Handle(GEOM_Function) aPathShape = aCI.GetPath(); - double aValue = aCI.GetDistance(); + Standard_Real aParameter = aCI.GetDistance(); bool aReversed = aCI.GetReverse(); + if (aReversed) + aParameter = 1 - aParameter; TopoDS_Shape aShapeBase = aRefShape->GetValue(); TopoDS_Shape aPath = aPathShape->GetValue(); + TopoDS_Wire aWire; if (aShapeBase.IsNull() || aPath.IsNull()) return 0; - //Get a Center Of Mass Of Base Object - GProp_GProps aSystem; - gp_Pnt aCenterMass; - if (aShapeBase.ShapeType() == TopAbs_VERTEX) { - aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase)); - } else if (aShapeBase.ShapeType() == TopAbs_EDGE || aShapeBase.ShapeType() == TopAbs_WIRE) { - BRepGProp::LinearProperties(aShapeBase, aSystem); - aCenterMass = aSystem.CentreOfMass(); - } else if (aShapeBase.ShapeType() == TopAbs_FACE || aShapeBase.ShapeType() == TopAbs_SHELL) { - BRepGProp::SurfaceProperties(aShapeBase, aSystem); - aCenterMass = aSystem.CentreOfMass(); - } else { - BRepGProp::VolumeProperties(aShapeBase, aSystem); - aCenterMass = aSystem.CentreOfMass(); + if ( aPath.ShapeType() == TopAbs_EDGE ) { + TopoDS_Edge anEdge = TopoDS::Edge(aPath); + aWire = BRepBuilderAPI_MakeWire(anEdge); } + else if ( aPath.ShapeType() == TopAbs_WIRE) + aWire = TopoDS::Wire(aPath); + else + return 0; - TopoDS_Shape aTrimmedPath; - gp_Trsf aTrsf; - Handle(Geom_Curve) aCurve; - Standard_Real aFirst =0.,aLast=0.; - Standard_Real aParam = 0.; - Standard_Real aLength = 0.; - - gp_Pnt aPFirst, aPLast; - - if ( aPath.ShapeType() == TopAbs_EDGE ) { // The Path is Edge - TopoDS_Edge anEdge = TopoDS::Edge(aPath); + Handle(GeomFill_TrihedronLaw) TLaw = new GeomFill_CorrectedFrenet(); + Handle(GeomFill_CurveAndTrihedron) aLocationLaw = new GeomFill_CurveAndTrihedron( TLaw ); + Handle(BRepFill_LocationLaw) aLocation = new BRepFill_Edge3DLaw(aWire, aLocationLaw); - BRep_Tool::Range(anEdge,aFirst,aLast); - aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast); - if (aReversed) - aCurve = aCurve->Reversed(); - - aCurve->D0(aFirst, aPFirst); - aCurve->D0(aLast, aPLast); - - // Translate a CenterMass of Base Shape to the start of the path - if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) { - gp_Trsf aCurTrsf; - aCurTrsf.SetTranslation(aCenterMass, aPFirst); - aTrsf.PreMultiply(aCurTrsf); - } - aParam = aFirst + aValue*(aLast - aFirst); // Calculate parameter - } else if ( aPath.ShapeType() == TopAbs_WIRE ) { // The path Shape is Wire - TopoDS_Wire aWire = TopoDS::Wire(aPath); - - // fix edges order - Handle(ShapeFix_Wire) aFixWire = new ShapeFix_Wire; - aFixWire->Load(aWire); - aFixWire->FixReorder(); - aWire = aFixWire->Wire(); - - TopExp_Explorer ex; - TopTools_SequenceOfShape Edges; - Standard_Real nbEdges = 0.; - BRepTools_WireExplorer aWE (aWire); - for (; aWE.More(); aWE.Next(), nbEdges++) // Explore a Wire on Edges - Edges.Append(aWE.Current()); - - Standard_Real aSummOfLen =0.; - Standard_Real aCurLen =0.; - GeomAdaptor_Curve aAdC; - - for(int i=1; i<=Edges.Length(); i++) { // Calculate summary Lenght of edges - TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i)); - BRep_Tool::Range(anEdge,aFirst,aLast); - aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast); - aAdC.Load(aCurve,aFirst,aLast); - aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast); - aSummOfLen += aCurLen; - } - - // Move BaseShape to the Start Of the Curve - TopoDS_Edge anEdge; - if (!aReversed) - anEdge = TopoDS::Edge(Edges.Value(1)); - else - anEdge = TopoDS::Edge(Edges.Value(Edges.Length())); - - BRep_Tool::Range(anEdge,aFirst,aLast); - aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast); - aCurve->D0(aFirst, aPFirst); - aCurve->D0(aLast, aPLast); - if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) { - gp_Trsf aCurTrsf; - if (aReversed && anEdge.Orientation() == TopAbs_FORWARD) - aPFirst = aPLast; - - aCurTrsf.SetTranslation(aCenterMass, aPFirst); - aTrsf.PreMultiply(aCurTrsf); - } - - Standard_Real aWireLen = aSummOfLen*aValue; - aSummOfLen = 0; - for(int i=1; i<=Edges.Length(); i++) { - TopoDS_Edge anEdge; - if (!aReversed) - anEdge = TopoDS::Edge(Edges.Value(i)); - else - anEdge = TopoDS::Edge(Edges.Value(Edges.Length() - i + 1)); - - aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast); - BRep_Tool::Range(anEdge,aFirst,aLast); - - if (!aReversed && anEdge.Orientation() == TopAbs_REVERSED) - aCurve = aCurve->Reversed(); - - if (aReversed && anEdge.Orientation() == TopAbs_FORWARD) - aCurve = aCurve->Reversed(); - - aAdC.Load(aCurve,aFirst,aLast); - aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast); - - if ( aWireLen > (aSummOfLen + aCurLen) ) { // Transform a Base object along this Edge - aSummOfLen += aCurLen; - gp_Pnt aP1, aP2; - gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2; - aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 ); - aCurve->D2(aLast, aP2, aDestVec1, aDestVec2 ); - gp_Trsf aCurTrsf; - if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) { - gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2); - gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2); - aCurTrsf.SetDisplacement(aStartAx3, aDestAx3); - } else - aCurTrsf.SetTranslation(aP1, aP2); - - aTrsf.PreMultiply(aCurTrsf); - } - else { - aLength = aWireLen - aSummOfLen; - GCPnts_AbscissaPoint anAbsc(aAdC,aLength,aFirst); - if(anAbsc.IsDone()) - aParam = anAbsc.Parameter(); - break; - } - } - } else - return 0; // Unknown Type - - gp_Trsf aCurTrsf; - gp_Pnt aP1, aP2; - gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2; - aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 ); - aCurve->D2(aParam, aP2, aDestVec1, aDestVec2 ); - - if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) { - gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2); - gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2); - aCurTrsf.SetDisplacement(aStartAx3, aDestAx3); - } else - aCurTrsf.SetTranslation(aP1, aP2); - - aTrsf.PreMultiply(aCurTrsf); - - if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) { - gp_Trsf aCurTrsf; - aCurTrsf.SetTranslation(aPFirst, aCenterMass); - aTrsf.PreMultiply(aCurTrsf); - } + aLocation->TransformInCompatibleLaw( 0.01 ); - // Perform transformation - BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False); - aShape = aBRepTrsf.Shape(); + //Calculate a Parameter + Standard_Real aFirstParam1 = 0, aLastParam1 = 0; // Parameters of the First edge + Standard_Real aFirstParam2 = 0, aLastParam2 = 0; // Parameters of the Last edge + aLocation->CurvilinearBounds(aLocation->NbLaw(), aFirstParam2, aLastParam2); + + if ( aLocation->NbLaw() > 1) + aLocation->CurvilinearBounds(1, aFirstParam1, aLastParam1); + else if ( aLocation->NbLaw() == 1 ) + aFirstParam1 = aFirstParam2; + else + return 0; + + Standard_Real aParam = (aFirstParam1 + (aLastParam2 - aFirstParam1)*aParameter ); + + TopoDS_Shape CopyShape = aShapeBase; + BRepFill_SectionPlacement Place( aLocation, aShapeBase ); + TopLoc_Location Loc2(Place.Transformation()), Loc1; + Loc1 = CopyShape.Location(); + CopyShape.Location(Loc2.Multiplied(Loc1)); + + aLocation->D0( aParam, CopyShape ); + aShape = CopyShape; } else return 0; @@ -352,10 +237,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_PositionDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PositionDriver", - sizeof(GEOMImpl_PositionDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_PositionDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.hxx b/src/GEOMImpl/GEOMImpl_PositionDriver.hxx index 96d147fa7..debb73126 100644 --- a/src/GEOMImpl/GEOMImpl_PositionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PositionDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_PositionDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx index 0cd63b150..87b18275d 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -1,75 +1,101 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include #include -#include #include +#include +#include +#include +#include #include #include #include +#include + +#include +#include +#include +#include +#include +#include #include +#include +#include #include +#include + +#include +#include +#include #include -#include +#include #include +#include +#include +#include #include -#include -#include +#include +#include #include +#include #include -#include #include +#include + +#include + #include +#include "utilities.h" + //======================================================================= //function : GetID //purpose : -//======================================================================= +//======================================================================= const Standard_GUID& GEOMImpl_PrismDriver::GetID() { static Standard_GUID aPrismDriver("FF1BBB17-5D14-4df2-980B-3A668264EA16"); - return aPrismDriver; + return aPrismDriver; } //======================================================================= //function : GEOMImpl_PrismDriver -//purpose : +//purpose : //======================================================================= -GEOMImpl_PrismDriver::GEOMImpl_PrismDriver() +GEOMImpl_PrismDriver::GEOMImpl_PrismDriver() { } //======================================================================= //function : Execute //purpose : -//======================================================================= +//======================================================================= Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const { - if (Label().IsNull()) return 0; + if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); GEOMImpl_IPrism aCI (aFunction); @@ -93,14 +119,19 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const } if (aV.Magnitude() > Precision::Confusion()) { aV.Normalize(); - if (aType == PRISM_BASE_VEC_H_2WAYS) { - gp_Trsf aTrsf; - aTrsf.SetTranslation( (-aV) * aCI.GetH() ); - BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); - aShapeBase = aTransformation.Shape(); - aCI.SetH( aCI.GetH()*2 ); - } - aShape = BRepPrimAPI_MakePrism(aShapeBase, aV * aCI.GetH(), Standard_False).Shape(); + if (aType != PRISM_BASE_DXDYDZ_2WAYS && aCI.GetScale() > Precision::Confusion()) { + aShape = MakeScaledPrism(aShapeBase, aV * aCI.GetH(), aCI.GetScale()); + } + else { + if (aType == PRISM_BASE_VEC_H_2WAYS) { + gp_Trsf aTrsf; + aTrsf.SetTranslation((-aV) * aCI.GetH()); + BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); + aShapeBase = aTransformation.Shape(); + aCI.SetH(aCI.GetH()*2); + } + aShape = BRepPrimAPI_MakePrism(aShapeBase, aV * aCI.GetH(), Standard_False).Shape(); + } } } } @@ -118,15 +149,19 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const if (!V1.IsNull() && !V2.IsNull()) { gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); if (aV.Magnitude() > gp::Resolution()) { - if (aType == PRISM_BASE_TWO_PNT_2WAYS) - { - gp_Trsf aTrsf; - aTrsf.SetTranslation(-aV); - BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); - aShapeBase = aTransformation.Shape(); - aV = aV * 2; - } - aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape(); + if (aType != PRISM_BASE_DXDYDZ_2WAYS && aCI.GetScale() > Precision::Confusion()) { + aShape = MakeScaledPrism(aShapeBase, aV, aCI.GetScale()); + } + else { + if (aType == PRISM_BASE_TWO_PNT_2WAYS) { + gp_Trsf aTrsf; + aTrsf.SetTranslation(-aV); + BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); + aShapeBase = aTransformation.Shape(); + aV = aV * 2; + } + aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape(); + } } } } @@ -135,50 +170,350 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShapeBase = aRefBase->GetValue(); gp_Vec aV (aCI.GetDX(), aCI.GetDY(), aCI.GetDZ()); if (aV.Magnitude() > gp::Resolution()) { - if (aType == PRISM_BASE_DXDYDZ_2WAYS) - { - gp_Trsf aTrsf; - aTrsf.SetTranslation(-aV); - BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); - aShapeBase = aTransformation.Shape(); - aV = aV * 2; - } - aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape(); + if (aType != PRISM_BASE_DXDYDZ_2WAYS && aCI.GetScale() > Precision::Confusion()) { + aShape = MakeScaledPrism(aShapeBase, aV, aCI.GetScale()); + } + else { + if (aType == PRISM_BASE_DXDYDZ_2WAYS) { + gp_Trsf aTrsf; + aTrsf.SetTranslation(-aV); + BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); + aShapeBase = aTransformation.Shape(); + aV = aV * 2; + } + aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape(); + } + } + } + + else if (aType == DRAFT_PRISM_FEATURE) { + Handle(GEOM_Function) aRefInit = aCI.GetInitShape(); + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape anInitShape = aRefInit->GetValue(); // Initial shape + TopoDS_Shape aSketch = aRefBase->GetValue(); + Standard_Real aHeight = aCI.GetH(); // Height of the extrusion + Standard_Real anAngle = aCI.GetDraftAngle(); // Draft angle + Standard_Boolean isProtrusion = (aCI.GetFuseFlag()==1); + // Flag to know wether the feature is a protrusion (fuse) or a depression (cut) + + // history of the Base wire (RefBase) + Handle(GEOM_Object) aSuppObj; + TDF_LabelSequence aLabelSeq; + aRefBase->GetDependency(aLabelSeq); + + // If the base wire has only one dependency we use it + // to determine the right normal of the face which + // must be oriented towards outside of the solid (like the support face) + if (aLabelSeq.Length()==1) + { + TDF_Label anArgumentRefLabel = aLabelSeq.Value(1); + aSuppObj = GEOM_Object::GetReferencedObject(anArgumentRefLabel); } + + TopoDS_Shape aSupport; + + if(!aSuppObj.IsNull()) // If the wire has a support + aSupport = aSuppObj->GetValue(); + + aShape = MakeDraftPrism(anInitShape, aSketch, aHeight, anAngle, isProtrusion, aSupport); } if (aShape.IsNull()) return 0; + + + if (aType == DRAFT_PRISM_FEATURE) + { + TopoDS_Shape aRes = aShape; + + // If the result is a compound with only one solid, + // return the solid + if (aShape.ShapeType() == TopAbs_COMPOUND) + { + TopExp_Explorer anExp(aShape, TopAbs_SOLID); + + int solidNb = 0; + TopoDS_Solid aSolid; + + for(;anExp.More();anExp.Next()) + { + aSolid = TopoDS::Solid(anExp.Current()); + solidNb++; + if (solidNb > 1) + break; + } + if (solidNb == 1) + aRes = aSolid; + } + + aFunction->SetValue(aRes); + } + else + { + TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + aFunction->SetValue(aRes); + } + + + log.SetTouched(Label()); + + return 1; +} + +//======================================================================= +//function : MakeScaledPrism +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_PrismDriver::MakeScaledPrism (const TopoDS_Shape& theShapeBase, + const gp_Vec& theVector, + const Standard_Real theScaleFactor, + const gp_Pnt& theCDG, + bool isCDG) +{ + TopoDS_Shape aShape; + BRep_Builder B; + + // 1. aCDG = geompy.MakeCDG(theBase) + gp_Pnt aCDG = theCDG; + if (!isCDG) { + gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(theShapeBase); + aCDG = aPos.Location(); + } + TopoDS_Shape aShapeCDG_1 = BRepBuilderAPI_MakeVertex(aCDG).Shape(); - TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); - aFunction->SetValue(aRes); + // Process case of several given shapes + if (theShapeBase.ShapeType() == TopAbs_COMPOUND || + theShapeBase.ShapeType() == TopAbs_SHELL) { + int nbSub = 0; + TopoDS_Shape aShapeI; + TopoDS_Compound aCompound; + B.MakeCompound(aCompound); + TopoDS_Iterator It (theShapeBase, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + nbSub++; + aShapeI = MakeScaledPrism(It.Value(), theVector, theScaleFactor, aCDG, true); + B.Add(aCompound, aShapeI); + } + if (nbSub == 1) + aShape = aShapeI; + else if (nbSub > 1) + aShape = GEOMImpl_GlueDriver::GlueFaces(aCompound, Precision::Confusion(), Standard_True); + return aShape; + } + + // 2. Scale = geompy.MakeScaleTransform(theBase, aCDG, theScaleFactor) + + // Bug 6839: Check for standalone (not included in faces) degenerated edges + TopTools_IndexedDataMapOfShapeListOfShape aEFMap; + TopExp::MapShapesAndAncestors(theShapeBase, TopAbs_EDGE, TopAbs_FACE, aEFMap); + Standard_Integer i, nbE = aEFMap.Extent(); + for (i = 1; i <= nbE; i++) { + TopoDS_Shape anEdgeSh = aEFMap.FindKey(i); + if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeSh))) { + const TopTools_ListOfShape& aFaces = aEFMap.FindFromIndex(i); + if (aFaces.IsEmpty()) + Standard_ConstructionError::Raise + ("Scaling aborted : cannot scale standalone degenerated edge"); + } + } + + // Perform Scaling + gp_Trsf aTrsf; + aTrsf.SetScale(aCDG, theScaleFactor); + BRepBuilderAPI_Transform aBRepTrsf (theShapeBase, aTrsf, Standard_False); + TopoDS_Shape aScale = aBRepTrsf.Shape(); + + // 3. aBase2 = geompy.MakeTranslationVectorDistance(Scale, theVec, theH) + gp_Trsf aTrsf3; + aTrsf3.SetTranslation(theVector); + TopLoc_Location aLocOrig = aScale.Location(); + gp_Trsf aTrsfOrig = aLocOrig.Transformation(); + TopLoc_Location aLocRes (aTrsf3 * aTrsfOrig); + TopoDS_Shape aBase2 = aScale.Located(aLocRes); + + // 4. aCDG_2 = geompy.MakeTranslationVectorDistance(aCDG, theVec, theH) + gp_Pnt aCDG_2 = aCDG.Translated(theVector); + TopoDS_Shape aShapeCDG_2 = BRepBuilderAPI_MakeVertex(aCDG_2).Shape(); + + // 5. Vector = geompy.MakeVector(aCDG, aCDG_2) + TopoDS_Shape aShapeVec = BRepBuilderAPI_MakeEdge(aCDG, aCDG_2).Shape(); + TopoDS_Edge anEdge = TopoDS::Edge(aShapeVec); + TopoDS_Wire aWirePath = BRepBuilderAPI_MakeWire(anEdge); - log.SetTouched(Label()); + // 6. aPrism = geompy.MakePipeWithDifferentSections([theBase, aBase2], [aCDG, aCDG_2], Vector, False, False) + Handle(TopTools_HSequenceOfShape) aBases = new TopTools_HSequenceOfShape; + aBases->Append(theShapeBase); + aBases->Append(aBase2); - return 1; + Handle(TopTools_HSequenceOfShape) aLocs = new TopTools_HSequenceOfShape; + aLocs->Append(aShapeCDG_1); + aLocs->Append(aShapeCDG_2); + + aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections(aWirePath, aBases, aLocs, false, false); + + // 7. Make a solid, if possible + if (theShapeBase.ShapeType() == TopAbs_FACE) { + BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0); + TopExp_Explorer expF (aShape, TopAbs_FACE); + Standard_Integer ifa = 0; + for (; expF.More(); expF.Next()) { + aSewing.Add(expF.Current()); + ifa++; + } + if (ifa > 0) { + aSewing.Perform(); + TopoDS_Shape aShell; + + TopoDS_Shape sh = aSewing.SewedShape(); + if (sh.ShapeType() == TopAbs_FACE && ifa == 1) { + // case for creation of shell from one face + TopoDS_Shell ss; + B.MakeShell(ss); + B.Add(ss,sh); + aShell = ss; + } + else { + TopExp_Explorer exp (sh, TopAbs_SHELL); + Standard_Integer ish = 0; + for (; exp.More(); exp.Next()) { + aShell = exp.Current(); + ish++; + } + if (ish != 1) + aShell = sh; + } + BRepCheck_Shell chkShell (TopoDS::Shell(aShell)); + if (chkShell.Closed() == BRepCheck_NoError) { + TopoDS_Solid Sol; + B.MakeSolid(Sol); + B.Add(Sol, aShell); + BRepClass3d_SolidClassifier SC (Sol); + SC.PerformInfinitePoint(Precision::Confusion()); + if (SC.State() == TopAbs_IN) { + B.MakeSolid(Sol); + B.Add(Sol, aShell.Reversed()); + } + aShape = Sol; + } + } + } + + return aShape; } +//======================================================================= +//function : MakeDraftPrism +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_PrismDriver::MakeDraftPrism ( const TopoDS_Shape& theInitShape, + const TopoDS_Shape& theBaseShape, + const Standard_Real theHeight, + const Standard_Real theAngle, + bool isProtrusion, + const TopoDS_Shape& theSupport) +{ + TopoDS_Shape aShape; + + if (theInitShape.ShapeType() == TopAbs_COMPOUND) + { + TopExp_Explorer anExp(theInitShape, TopAbs_SOLID); + int solidCount = 0; + for(;anExp.More();anExp.Next()) + { + solidCount++; + if (solidCount > 1) + Standard_ConstructionError::Raise("The input shape is a compound with more than one solid"); + } + if (solidCount == 0) + Standard_ConstructionError::Raise("The input shape is a compound without any solid"); + } + + TopoDS_Wire aWire = TopoDS_Wire(); + + if (theBaseShape.ShapeType() == TopAbs_EDGE) + { + aWire = BRepBuilderAPI_MakeWire(TopoDS::Edge(theBaseShape)); + } + else if (theBaseShape.ShapeType() == TopAbs_WIRE) + { + aWire = TopoDS::Wire(theBaseShape); + } + else + { + Standard_ConstructionError::Raise("The input profile is neither a wire, nor edge"); + } + + TopoDS_Vertex aV1, aV2; + TopExp::Vertices(aWire, aV1, aV2); + if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) ) + aWire.Closed( true ); + + if (!aWire.Closed()) + Standard_ConstructionError::Raise("The input profile is not closed"); + + // Construction of the face if the wire hasn't any support face; + // the face must be planar for BRepFeat_MakeDPrism + TopoDS_Face aFaceBase = BRepBuilderAPI_MakeFace(aWire, /*OnlyPlane=*/true); + + if(!theSupport.IsNull() && theSupport.ShapeType() == TopAbs_FACE) // If the wire has a support + { + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(theSupport)); + TopoDS_Face aTempFace = BRepBuilderAPI_MakeFace(aSurf, aWire); + + if(aTempFace.Orientation() != TopoDS::Face(theSupport).Orientation()) + { + aFaceBase=TopoDS::Face(aTempFace.Reversed()); + } + else + aFaceBase=aTempFace; + } + + // Invert height and angle if the operation is an extruded cut + bool invert = !isProtrusion; + + // If the face has a reversed orientation invert for extruded boss operations + if(aFaceBase.Orientation() == TopAbs_REVERSED) + invert = isProtrusion; + + Standard_Real anAngle = theAngle; + Standard_Real aHeight = theHeight; + if(invert) + { + anAngle = -theAngle; // Invert angle and height + aHeight = -theHeight; + } + + BRepFeat_MakeDPrism aPrism(theInitShape, aFaceBase, aFaceBase, + anAngle*M_PI/180., isProtrusion, Standard_True); + + aPrism.Perform(aHeight); + aPrism.Check(); // Raises NotDone if done is false + + aShape = aPrism.Shape(); + + return aShape; +} + //======================================================================= -//function : GEOMImpl_PrismDriver_Type_ +//function : GEOMImpl_PrismDriver_Type_ //purpose : -//======================================================================= +//======================================================================= Standard_EXPORT Handle_Standard_Type& GEOMImpl_PrismDriver_Type_() { static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PrismDriver", - sizeof(GEOMImpl_PrismDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_PrismDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -186,7 +521,7 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_PrismDriver_Type_() //======================================================================= //function : DownCast //purpose : -//======================================================================= +//======================================================================= const Handle(GEOMImpl_PrismDriver) Handle(GEOMImpl_PrismDriver)::DownCast(const Handle(Standard_Transient)& AnObject) { Handle(GEOMImpl_PrismDriver) _anOtherObject; @@ -197,5 +532,5 @@ const Handle(GEOMImpl_PrismDriver) Handle(GEOMImpl_PrismDriver)::DownCast(const } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.hxx b/src/GEOMImpl/GEOMImpl_PrismDriver.hxx index a1f890d9f..b7adffaf3 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.hxx @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_PrismDriver.ixx // Module : GEOMImpl -// + #ifndef _GEOMImpl_PrismDriver_HeaderFile #define _GEOMImpl_PrismDriver_HeaderFile @@ -103,9 +104,9 @@ class Handle(GEOMImpl_PrismDriver) : public Handle(TFunction_Driver) { return (GEOMImpl_PrismDriver *)ControlAccess(); } - Standard_EXPORT ~Handle(GEOMImpl_PrismDriver)() {}; + Standard_EXPORT ~Handle(GEOMImpl_PrismDriver)() {}; - Standard_EXPORT static const Handle(GEOMImpl_PrismDriver) DownCast(const Handle(Standard_Transient)& AnObject); + Standard_EXPORT static const Handle(GEOMImpl_PrismDriver) DownCast(const Handle(Standard_Transient)& AnObject); }; #ifndef _TFunction_Driver_HeaderFile @@ -118,6 +119,10 @@ class Handle(GEOMImpl_PrismDriver) : public Handle(TFunction_Driver) { #include #endif +#include +#include +#include + class TColStd_SequenceOfExtendedString; @@ -125,35 +130,48 @@ class GEOMImpl_PrismDriver : public TFunction_Driver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC - // -Standard_EXPORT GEOMImpl_PrismDriver(); -Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; -Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} -Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } -Standard_EXPORT static const Standard_GUID& GetID(); -Standard_EXPORT ~GEOMImpl_PrismDriver() {}; - - - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PrismDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PrismDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PrismDriver) == AType || TFunction_Driver::IsKind(AType)); } - + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + + Standard_EXPORT GEOMImpl_PrismDriver(); + Standard_EXPORT ~GEOMImpl_PrismDriver() {}; + + Standard_EXPORT virtual Standard_Integer Execute (TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate (TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute (const TFunction_Logbook&) const { return Standard_True; } + Standard_EXPORT static const Standard_GUID& GetID(); + + Standard_EXPORT static TopoDS_Shape MakeScaledPrism (const TopoDS_Shape& theShapeBase, + const gp_Vec& theVector, + const Standard_Real theScaleFactor, + const gp_Pnt& theCDG = gp::Origin(), + bool isCDG = false); + + Standard_EXPORT static TopoDS_Shape MakeDraftPrism (const TopoDS_Shape& theInitShape, + const TopoDS_Shape& theBaseShape, + const Standard_Real theHeight, + const Standard_Real theAngle, + bool isProtrusion, + const TopoDS_Shape& theSupport); + + + // Type management + + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PrismDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PrismDriver) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PrismDriver) == AType || TFunction_Driver::IsKind(AType)); } }; diff --git a/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx b/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx new file mode 100644 index 000000000..9cb803d7a --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx @@ -0,0 +1,265 @@ +// Copyright (C) 2007-2012 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 + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ProjectionDriver::GetID() +{ + static Standard_GUID aProjectionDriver ("FF1BBB70-5D14-4df2-980B-3A668264EA16"); + return aProjectionDriver; +} + + +//======================================================================= +//function : GEOMImpl_ProjectionDriver +//purpose : +//======================================================================= + +GEOMImpl_ProjectionDriver::GEOMImpl_ProjectionDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ProjectionDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + if (aFunction.IsNull()) return 0; + + TopoDS_Shape aShape; + gp_Trsf aTrsf; + + GEOMImpl_IMirror TI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + Handle(GEOM_Function) anOriginalFunction = TI.GetOriginal(); + if (anOriginalFunction.IsNull()) return 0; + + TopoDS_Shape anOriginal = anOriginalFunction->GetValue(); + if (anOriginal.IsNull()) return 0; + + // Projection + if (aType == PROJECTION_COPY) { + // Source shape (point, edge or wire) + if (anOriginal.ShapeType() != TopAbs_VERTEX && + anOriginal.ShapeType() != TopAbs_EDGE && + anOriginal.ShapeType() != TopAbs_WIRE) { + Standard_ConstructionError::Raise + ("Projection aborted : the source shape is neither a vertex, nor an edge or a wire"); + } + + // Target face + Handle(GEOM_Function) aTargetFunction = TI.GetPlane(); + if (aTargetFunction.IsNull()) return 0; + TopoDS_Shape aFaceShape = aTargetFunction->GetValue(); + //if (aFaceShape.IsNull() || aFaceShape.ShapeType() != TopAbs_FACE) { + // Standard_ConstructionError::Raise + // ("Projection aborted : the target shape is not a face"); + //} + + Standard_Real tol = 1.e-4; + + if (anOriginal.ShapeType() == TopAbs_VERTEX) { + if (aFaceShape.IsNull() || aFaceShape.ShapeType() != TopAbs_FACE) { + Standard_ConstructionError::Raise + ("Projection aborted : the target shape is not a face"); + } + TopoDS_Face aFace = TopoDS::Face(aFaceShape); + Handle(Geom_Surface) surface = BRep_Tool::Surface(aFace); + double U1, U2, V1, V2; + //surface->Bounds(U1, U2, V1, V2); + BRepTools::UVBounds(aFace, U1, U2, V1, V2); + + // projector + GeomAPI_ProjectPointOnSurf proj; + proj.Init(surface, U1, U2, V1, V2, tol); + + gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(anOriginal)); + proj.Perform(aPnt); + if (!proj.IsDone()) { + Standard_ConstructionError::Raise + ("Projection aborted : the algorithm failed"); + } + int nbPoints = proj.NbPoints(); + if (nbPoints < 1) { + Standard_ConstructionError::Raise("No solution found"); + } + + Quantity_Parameter U, V; + proj.LowerDistanceParameters(U, V); + gp_Pnt2d aProjPnt (U, V); + + // classifier + BRepClass_FaceClassifier aClsf (aFace, aProjPnt, tol); + if (aClsf.State() != TopAbs_IN && aClsf.State() != TopAbs_ON) { + bool isSol = false; + double minDist = RealLast(); + for (int i = 1; i <= nbPoints; i++) { + Quantity_Parameter Ui, Vi; + proj.Parameters(i, Ui, Vi); + aProjPnt = gp_Pnt2d(Ui, Vi); + aClsf.Perform(aFace, aProjPnt, tol); + if (aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON) { + isSol = true; + double dist = proj.Distance(i); + if (dist < minDist) { + minDist = dist; + U = Ui; + V = Vi; + } + } + } + if (!isSol) { + Standard_ConstructionError::Raise("No solution found"); + } + } + + gp_Pnt surfPnt = surface->Value(U, V); + + aShape = BRepBuilderAPI_MakeVertex(surfPnt).Shape(); + } + else { + //see BRepTest_BasicCommands.cxx for example of BRepOffsetAPI_NormalProjection + BRepOffsetAPI_NormalProjection OrtProj (aFaceShape); + OrtProj.Add(anOriginal); + + //Standard_Real tol = 1.e-4; + //Standard_Real tol2d = Pow(tol, 2./3); + //GeomAbs_Shape Continuity = GeomAbs_C2; + //Standard_Integer MaxDeg = 14; + //Standard_Integer MaxSeg = 16; + //OrtProj.SetParams(tol, tol2d, Continuity, MaxDeg, MaxSeg); + try { + OrtProj.Build(); + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + TCollection_AsciiString aMsg (aFail->GetMessageString()); + if (!aMsg.Length()) + aMsg = "Projection aborted : possibly the source shape intersects the cylinder's axis"; + Standard_ConstructionError::Raise(aMsg.ToCString()); + } + if (!OrtProj.IsDone()) { + Standard_ConstructionError::Raise + ("Projection aborted : BRepOffsetAPI_NormalProjection failed"); + } + + aShape = OrtProj.Shape(); + + // check that the result shape is an empty compound + // (IPAL22905: TC650: Projection on face dialog problems) + if( !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND ) + { + TopoDS_Iterator anIter( aShape ); + if( !anIter.More() ) + Standard_ConstructionError::Raise("Projection aborted : empty compound produced"); + } + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + log.SetTouched(Label()); + } + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ProjectionDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ProjectionDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ProjectionDriver", + sizeof(GEOMImpl_ProjectionDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_ProjectionDriver) Handle(GEOMImpl_ProjectionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ProjectionDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ProjectionDriver))) { + _anOtherObject = Handle(GEOMImpl_ProjectionDriver)((Handle(GEOMImpl_ProjectionDriver)&)AnObject); + } + } + + return _anOtherObject; +} diff --git a/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx b/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx new file mode 100644 index 000000000..5243d47ad --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx @@ -0,0 +1,161 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOMImpl_ProjectionDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ProjectionDriver_HeaderFile +#define _GEOMImpl_ProjectionDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ProjectionDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ProjectionDriver); + +class Handle(GEOMImpl_ProjectionDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ProjectionDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ProjectionDriver)(const Handle(GEOMImpl_ProjectionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ProjectionDriver)(const GEOMImpl_ProjectionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ProjectionDriver)& operator=(const Handle(GEOMImpl_ProjectionDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ProjectionDriver)& operator=(const GEOMImpl_ProjectionDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ProjectionDriver* operator->() + { + return (GEOMImpl_ProjectionDriver *)ControlAccess(); + } + + GEOMImpl_ProjectionDriver* operator->() const + { + return (GEOMImpl_ProjectionDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ProjectionDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ProjectionDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ProjectionDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ProjectionDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ProjectionDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ProjectionDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ProjectionDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ProjectionDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx index f4e8026b1..ea72dd7c3 100644 --- a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -105,18 +106,18 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons gp_Lin aL(BRep_Tool::Pnt(V1), gp_Dir(aV)); Standard_Real d = aL.Distance(BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase))); if (d < Precision::Confusion()) { - Standard_ConstructionError::Raise("Vertex to be rotated is too close to Revolution Axis"); + Standard_ConstructionError::Raise("Vertex to be rotated is too close to Revolution Axis"); } } double anAngle = aCI.GetAngle(); gp_Ax1 anAxis (BRep_Tool::Pnt(V1), aV); if (aType == REVOLUTION_BASE_AXIS_ANGLE_2WAYS) { - gp_Trsf aTrsf; - aTrsf.SetRotation(anAxis, ( -anAngle )); - BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); - aShapeBase = aTransformation.Shape(); - anAngle = anAngle * 2; + gp_Trsf aTrsf; + aTrsf.SetRotation(anAxis, ( -anAngle )); + BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); + aShapeBase = aTransformation.Shape(); + anAngle = anAngle * 2; } BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, anAngle, Standard_False); if (!MR.IsDone()) MR.Build(); @@ -153,10 +154,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_RevolutionDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_RevolutionDriver", - sizeof(GEOMImpl_RevolutionDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_RevolutionDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx index b1e7b15ad..35d392778 100644 --- a/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_RevolutionDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx index cff3a9b51..9f1e3035b 100644 --- a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -99,7 +100,7 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const gp_Dir aDir(gp_Vec(aP1, aP2)); gp_Ax1 anAx1(aP1, aDir); Standard_Real anAngle = RI.GetAngle(); - if (fabs(anAngle) < Precision::Angular()) anAngle += 2*PI; // NPAL19665,19769 + if (fabs(anAngle) < Precision::Angular()) anAngle += 2.*M_PI; // NPAL19665,19769 aTrsf.SetRotation(anAx1, anAngle); //NPAL18620: performance problem: multiple locations are accumulated @@ -134,7 +135,7 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const gp_Dir aDir (aVec1 ^ aVec2); gp_Ax1 anAx1 (aCP, aDir); Standard_Real anAngle = aVec1.Angle(aVec2); - if (fabs(anAngle) < Precision::Angular()) anAngle += 2*PI; // NPAL19665 + if (fabs(anAngle) < Precision::Angular()) anAngle += 2.*M_PI; // NPAL19665 aTrsf.SetRotation(anAx1, anAngle); //NPAL18620: performance problem: multiple locations are accumulated // in shape and need a great time to process @@ -176,7 +177,7 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const B.Add(aCompound, anOriginal); } else { - aTrsf.SetRotation(AX1, i*angle*PI180); + aTrsf.SetRotation(AX1, i*angle*M_PI/180.); //TopLoc_Location aLocRes (aTrsf * aTrsfOrig); // gp_Trsf::Multiply() has a bug gp_Trsf aTrsfNew (aTrsfOrig); aTrsfNew.PreMultiply(aTrsf); @@ -204,35 +205,45 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const gp_Ax1 AX1(aP1, D); - gp_Trsf aTrsf1; gp_Trsf aTrsf2; - gp_Pnt P1; - GProp_GProps System; - if (anOriginal.ShapeType() == TopAbs_VERTEX) { - P1 = BRep_Tool::Pnt(TopoDS::Vertex( anOriginal )); - } - else if ( anOriginal.ShapeType() == TopAbs_EDGE || anOriginal.ShapeType() == TopAbs_WIRE ) { - BRepGProp::LinearProperties(anOriginal, System); - P1 = System.CentreOfMass(); - } - else if ( anOriginal.ShapeType() == TopAbs_FACE || anOriginal.ShapeType() == TopAbs_SHELL ) { - BRepGProp::SurfaceProperties(anOriginal, System); - P1 = System.CentreOfMass(); - } - else { - BRepGProp::VolumeProperties(anOriginal, System); - P1 = System.CentreOfMass(); - } + gp_XYZ aDir2 = RI.GetDir2(); // can be set by previous execution + if (aDir2.Modulus() < gp::Resolution()) { + // Calculate direction as vector from the axis to the shape's center + gp_Pnt P1; + GProp_GProps System; - Handle(Geom_Line) Line = new Geom_Line(AX1); - GeomAPI_ProjectPointOnCurve aPrjTool( P1, Line ); - gp_Pnt P2 = aPrjTool.NearestPoint(); + if (anOriginal.ShapeType() == TopAbs_VERTEX) { + P1 = BRep_Tool::Pnt(TopoDS::Vertex( anOriginal )); + } + else if ( anOriginal.ShapeType() == TopAbs_EDGE || anOriginal.ShapeType() == TopAbs_WIRE ) { + BRepGProp::LinearProperties(anOriginal, System); + P1 = System.CentreOfMass(); + } + else if ( anOriginal.ShapeType() == TopAbs_FACE || anOriginal.ShapeType() == TopAbs_SHELL ) { + BRepGProp::SurfaceProperties(anOriginal, System); + P1 = System.CentreOfMass(); + } + else { + BRepGProp::VolumeProperties(anOriginal, System); + P1 = System.CentreOfMass(); + } + + Handle(Geom_Line) Line = new Geom_Line(AX1); + GeomAPI_ProjectPointOnCurve aPrjTool( P1, Line ); + gp_Pnt P2 = aPrjTool.NearestPoint(); - if ( P1.IsEqual(P2, Precision::Confusion() ) ) return 0; + if ( P1.IsEqual(P2, Precision::Confusion() ) ) return 0; + + aDir2 = gp_XYZ(P1.X()-P2.X(), P1.Y()-P2.Y(), P1.Z()-P2.Z()); + + // Attention: this abnormal action is done for good working of + // TransformLikeOther(), used by RestoreSubShapes functionality + RI.SetDir2(aDir2); + } - gp_Vec Vec (P1.X()-P2.X(), P1.Y()-P2.Y(), P1.Z()-P2.Z()); + gp_Vec Vec (aDir2); Vec.Normalize(); Standard_Integer nbtimes2 = RI.GetNbIter2(); @@ -263,7 +274,7 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const B.Add(aCompound, anOriginal.Located(aLocRes)); } else { - aTrsf2.SetRotation(AX1, j*ang*PI180); + aTrsf2.SetRotation(AX1, j*ang*M_PI/180.); //TopLoc_Location aLocRes (aTrsf2 * aTrsf1 * aTrsfOrig); // gp_Trsf::Multiply() has a bug gp_Trsf aTrsfNew (aTrsfOrig); aTrsfNew.PreMultiply(aTrsf1); @@ -309,10 +320,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_RotateDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_RotateDriver", - sizeof(GEOMImpl_RotateDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_RotateDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.hxx b/src/GEOMImpl/GEOMImpl_RotateDriver.hxx index 5b94668ba..c770afd6c 100644 --- a/src/GEOMImpl/GEOMImpl_RotateDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_RotateDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx index 0c4dea8f4..b5fe870a1 100644 --- a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -213,10 +214,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ScaleDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ScaleDriver", - sizeof(GEOMImpl_ScaleDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ScaleDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -235,5 +236,5 @@ const Handle(GEOMImpl_ScaleDriver) Handle(GEOMImpl_ScaleDriver)::DownCast(const } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx index 9aca82323..b71827c74 100644 --- a/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ScaleDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 43af2ed5c..e1ef28022 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -1,27 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include +#include #include #include @@ -29,22 +31,30 @@ // OCCT Includes #include +#include +#include -#include #include +#include +#include #include -#include #include +#include +#include +#include #include #include #include #include -#include -#include +#include +#include +#include #include #include +#include +#include #include #include #include @@ -53,18 +63,39 @@ #include #include #include -#include #include #include +#include + +#include + +#include +#include +#include +#include +#include + +#include #include +#include +#include +#include +#include #include + #include #include #include +//modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f +//static +// void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges, +// const Handle(TopTools_HSequenceOfShape)& aWires); +//modified by NIZNHY-PKV Wed Dec 28 13:48:23 2011t + //======================================================================= //function : GetID //purpose : @@ -97,74 +128,72 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); TopoDS_Shape aShape; + TCollection_AsciiString aWarning; + BRep_Builder B; if (aType == WIRE_EDGES) { Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); - unsigned int ind, nbshapes = aShapes->Length(); - TopoDS_Wire aWire; B.MakeWire(aWire); - BRepBuilderAPI_MakeWire MW; - bool isMWDone = true; // add edges - for (ind = 1; ind <= nbshapes; ind++) { + for (unsigned int ind = 1; ind <= aShapes->Length(); ind++) { Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); TopoDS_Shape aShape_i = aRefShape->GetValue(); if (aShape_i.IsNull()) { Standard_NullObject::Raise("Shape for wire construction is null"); } - if (aShape_i.ShapeType() == TopAbs_EDGE) { - B.Add(aWire, TopoDS::Edge(aShape_i)); - MW.Add(TopoDS::Edge(aShape_i)); - if (!MW.IsDone()) { - // check status after each edge/wire addition, because the final status - // can be OK even in case, when some edges/wires was not accepted. - isMWDone = false; - } - } else if (aShape_i.ShapeType() == TopAbs_WIRE) { + if (aShape_i.ShapeType() == TopAbs_EDGE || aShape_i.ShapeType() == TopAbs_WIRE) { TopExp_Explorer exp (aShape_i, TopAbs_EDGE); - for (; exp.More(); exp.Next()) { + for (; exp.More(); exp.Next()) B.Add(aWire, TopoDS::Edge(exp.Current())); - MW.Add(TopoDS::Edge(exp.Current())); - if (!MW.IsDone()) { - // check status after each edge/wire addition, because the final status - // can be OK even in case, when some edges/wires was not accepted. - isMWDone = false; - } - } } else { Standard_TypeMismatch::Raise ("Shape for wire construction is neither an edge nor a wire"); } } - if (isMWDone) { - aShape = MW; + // fix edges order + Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire; + aFW->Load(aWire); + aFW->FixReorder(); + + if (aFW->StatusReorder(ShapeExtend_FAIL1)) { + Standard_ConstructionError::Raise("Wire construction failed: several loops detected"); + } else if (aFW->StatusReorder(ShapeExtend_FAIL)) { + Standard_ConstructionError::Raise("Wire construction failed"); } else { - // fix edges order - Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire; - aFW->Load(aWire); - aFW->FixReorder(); - - if (aFW->StatusReorder(ShapeExtend_FAIL1)) { - Standard_ConstructionError::Raise("Wire construction failed: several loops detected"); - } else if (aFW->StatusReorder(ShapeExtend_FAIL)) { - Standard_ConstructionError::Raise("Wire construction failed"); - } else if (aFW->StatusReorder(ShapeExtend_DONE2)) { - Standard_ConstructionError::Raise("Wire construction failed: some gaps detected"); - } else { - } + } - aFW->ClosedWireMode() = Standard_False; - aFW->FixConnected(); - if (aFW->StatusConnected(ShapeExtend_FAIL)) { - Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire"); - } + // IMP 0019766: Building a Wire from unconnected edges by introducing a tolerance + Standard_Real aTolerance = aCI.GetTolerance(); + if (aTolerance < Precision::Confusion()) + aTolerance = Precision::Confusion(); - aShape = aFW->WireAPIMake(); + aFW->ClosedWireMode() = Standard_False; + aFW->FixConnected(aTolerance); + if (aFW->StatusConnected(ShapeExtend_FAIL)) { + Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire"); + } + // IMP 0019766 + if (aFW->StatusConnected(ShapeExtend_DONE3)) { + // Confused with but not Analyzer.Precision(), set the same + aFW->FixGapsByRangesMode() = Standard_True; + if (aFW->FixGaps3d()) { + Handle(ShapeExtend_WireData) sbwd = aFW->WireData(); + Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge; + for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) { + TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge)); + aFe->FixVertexTolerance(aEdge); + aFe->FixSameParameter(aEdge); + } + } + else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) { + Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps"); + } } + aShape = aFW->WireAPIMake(); } else if (aType == FACE_WIRE) { Handle(GEOM_Function) aRefBase = aCI.GetBase(); @@ -173,6 +202,14 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const TopoDS_Wire W; if (aShapeBase.ShapeType() == TopAbs_WIRE) { W = TopoDS::Wire(aShapeBase); + // check the wire is closed + TopoDS_Vertex aV1, aV2; + TopExp::Vertices(W, aV1, aV2); + if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) ) + aShapeBase.Closed(true); + else + Standard_NullObject::Raise + ("Shape for face construction is not closed"); } else if (aShapeBase.ShapeType() == TopAbs_EDGE && aShapeBase.Closed()) { BRepBuilderAPI_MakeWire MW; @@ -180,13 +217,13 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const if (!MW.IsDone()) { Standard_ConstructionError::Raise("Wire construction failed"); } - W = MW; + W = MW; } else { Standard_NullObject::Raise ("Shape for face construction is neither a wire nor a closed edge"); } - GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape); + aWarning = GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape); if (aShape.IsNull()) { Standard_ConstructionError::Raise("Face construction failed"); } @@ -205,7 +242,6 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const TopTools_MapOfShape aMapEdges; Handle(TopTools_HSequenceOfShape) aSeqEdgesIn = new TopTools_HSequenceOfShape; - BRep_Builder B; for (ind = 1; ind <= nbshapes; ind++) { Handle(GEOM_Function) aRefSh_i = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); TopoDS_Shape aSh_i = aRefSh_i->GetValue(); @@ -222,6 +258,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const Handle(TopTools_HSequenceOfShape) aSeqWiresOut; ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(), /*shared*/Standard_False, aSeqWiresOut); + //modified by NIZNHY-PKV Wed Dec 28 13:46:55 2011f + //KeepEdgesOrder(aSeqEdgesIn, aSeqWiresOut); + //modified by NIZNHY-PKV Wed Dec 28 13:46:59 2011t // 3. Separate closed wires Handle(TopTools_HSequenceOfShape) aSeqClosedWires = new TopTools_HSequenceOfShape; @@ -243,7 +282,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const // 4.a. Basic face TopoDS_Shape aFFace; TopoDS_Wire aW1 = TopoDS::Wire(aSeqClosedWires->Value(1)); - GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace); + aWarning = GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace); if (aFFace.IsNull()) { Standard_ConstructionError::Raise("Face construction failed"); } @@ -347,12 +386,16 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const else if (aType == SOLID_SHELL) { Handle(GEOM_Function) aRefShell = aCI.GetBase(); TopoDS_Shape aShapeShell = aRefShell->GetValue(); + if (!aShapeShell.IsNull() && aShapeShell.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True); + if (It.More()) aShapeShell = It.Value(); + } if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) { Standard_NullObject::Raise("Shape for solid construction is null or not a shell"); } BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell)); - if(chkShell.Closed() == BRepCheck_NotClosed) return 0; + if (chkShell.Closed() == BRepCheck_NotClosed) return 0; TopoDS_Solid Sol; B.MakeSolid(Sol); @@ -381,23 +424,22 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const if (aShapeShell.IsNull()) { Standard_NullObject::Raise("Shell for solid construction is null"); } + if (aShapeShell.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True); + if (It.More()) aShapeShell = It.Value(); + } if (aShapeShell.ShapeType() == TopAbs_SHELL) { B.Add(Sol, aShapeShell); ish++; } } - if ( ish == 0 ) return 0; + if (ish == 0) return 0; BRepClass3d_SolidClassifier SC (Sol); SC.PerformInfinitePoint(Precision::Confusion()); - switch (SC.State()) { - case TopAbs_IN: - aShape = Sol.Reversed(); break; - case TopAbs_OUT: - aShape = Sol; break; - default: // not closed shell? - return 0; - } - + if (SC.State() == TopAbs_IN) + aShape = Sol.Reversed(); + else + aShape = Sol; } else if (aType == COMPOUND_SHAPES) { Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); @@ -418,6 +460,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = C; } + /* else if (aType == REVERSE_ORIENTATION) { Handle(GEOM_Function) aRefShape = aCI.GetBase(); TopoDS_Shape aShape_i = aRefShape->GetValue(); @@ -440,22 +483,461 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = tds; } } + */ + else if (aType == EDGE_WIRE) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape aWire = aRefBase->GetValue(); + Standard_Real LinTol = aCI.GetTolerance(); + Standard_Real AngTol = aCI.GetAngularTolerance(); + if (aWire.IsNull()) Standard_NullObject::Raise("Argument Wire is null"); + + aShape = MakeEdgeFromWire(aWire, LinTol, AngTol); + } + else if (aType == EDGE_CURVE_LENGTH) { + GEOMImpl_IVector aVI (aFunction); + + // RefCurve + Handle(GEOM_Function) aRefCurve = aVI.GetPoint1(); + if (aRefCurve.IsNull()) Standard_NullObject::Raise("Argument Curve is null"); + TopoDS_Shape aRefShape1 = aRefCurve->GetValue(); + if (aRefShape1.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise + ("Edge On Curve creation aborted : curve shape is not an edge"); + } + TopoDS_Edge aRefEdge = TopoDS::Edge(aRefShape1); + TopoDS_Vertex V1, V2; + TopExp::Vertices(aRefEdge, V1, V2, Standard_True); + + // RefPoint + TopoDS_Vertex aRefVertex; + Handle(GEOM_Function) aRefPoint = aVI.GetPoint2(); + if (aRefPoint.IsNull()) { + aRefVertex = V1; + } + else { + TopoDS_Shape aRefShape2 = aRefPoint->GetValue(); + if (aRefShape2.ShapeType() != TopAbs_VERTEX) { + Standard_TypeMismatch::Raise + ("Edge On Curve creation aborted : start point shape is not a vertex"); + } + aRefVertex = TopoDS::Vertex(aRefShape2); + } + gp_Pnt aRefPnt = BRep_Tool::Pnt(aRefVertex); + + // Length + Standard_Real aLength = aVI.GetParameter(); + //Standard_Real aCurveLength = IntTools::Length(aRefEdge); + //if (aLength > aCurveLength) { + // Standard_ConstructionError::Raise + // ("Edge On Curve creation aborted : given length is greater than edges length"); + //} + if (fabs(aLength) < Precision::Confusion()) { + Standard_ConstructionError::Raise + ("Edge On Curve creation aborted : given length is smaller than Precision::Confusion()"); + } + + // Check orientation + Standard_Real UFirst, ULast; + Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(aRefEdge, UFirst, ULast); + Handle(Geom_Curve) ReOrientedCurve = EdgeCurve; + + Standard_Real dU = ULast - UFirst; + Standard_Real par1 = UFirst + 0.1 * dU; + Standard_Real par2 = ULast - 0.1 * dU; + + gp_Pnt P1 = EdgeCurve->Value(par1); + gp_Pnt P2 = EdgeCurve->Value(par2); + + if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) { + ReOrientedCurve = EdgeCurve->Reversed(); + UFirst = EdgeCurve->ReversedParameter(ULast); + } + + // Get the point by length + GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve); + GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst); + Standard_Real aParam = anAbsPnt.Parameter(); + + if (AdapCurve.IsClosed() && aLength < 0.0) { + Standard_Real aTmp = aParam; + aParam = UFirst; + UFirst = aTmp; + } + + BRepBuilderAPI_MakeEdge aME (ReOrientedCurve, UFirst, aParam); + if (aME.IsDone()) + aShape = aME.Shape(); + } + else { + } if (aShape.IsNull()) return 0; // Check shape validity BRepCheck_Analyzer ana (aShape, false); if (!ana.IsValid()) { - Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); + //Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); } aFunction->SetValue(aShape); log.SetTouched(Label()); + if (!aWarning.IsEmpty()) + Standard_Failure::Raise(aWarning.ToCString()); + return 1; } +TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire, + const Standard_Real LinTol, + const Standard_Real AngTol) +{ + TopoDS_Edge ResEdge; + + BRepLib::BuildCurves3d(aWire); + Handle(ShapeFix_Shape) Fixer = new ShapeFix_Shape(aWire); + Fixer->SetPrecision(LinTol); + Fixer->SetMaxTolerance(LinTol); + Fixer->Perform(); + TopoDS_Wire theWire = TopoDS::Wire(Fixer->Shape()); + + TColGeom_SequenceOfCurve CurveSeq; + TopTools_SequenceOfShape LocSeq; + TColStd_SequenceOfReal FparSeq; + TColStd_SequenceOfReal LparSeq; + TColStd_SequenceOfReal TolSeq; + GeomAbs_CurveType CurType; + TopoDS_Vertex FirstVertex, LastVertex; + Standard_Boolean FinalReverse = Standard_False; + + BRepTools_WireExplorer wexp(theWire) ; + for (; wexp.More(); wexp.Next()) + { + TopoDS_Edge anEdge = wexp.Current(); + Standard_Real fpar, lpar; + TopLoc_Location aLoc; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, fpar, lpar); + if (aCurve.IsNull()) + continue; + + BRepAdaptor_Curve BAcurve(anEdge); + GeomAbs_CurveType aType = BAcurve.GetType(); + + Handle(Geom_Curve) aBasisCurve = BAcurve.Curve().Curve(); + + if (aBasisCurve->IsPeriodic()) + ElCLib::AdjustPeriodic(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(), + Precision::PConfusion(), fpar, lpar); + + if (CurveSeq.IsEmpty()) + { + CurveSeq.Append(aCurve); + TopoDS_Shape aLocShape; + aLocShape.Location(aLoc); + aLocShape.Orientation(wexp.Orientation()); + LocSeq.Append(aLocShape); + FparSeq.Append(fpar); + LparSeq.Append(lpar); + CurType = aType; + FirstVertex = wexp.CurrentVertex(); + if (anEdge.Orientation() == TopAbs_REVERSED) + FinalReverse = Standard_True; + } + else + { + Standard_Boolean Done = Standard_False; + Standard_Real NewFpar, NewLpar; + GeomAdaptor_Curve GAprevcurve(CurveSeq.Last()); + TopoDS_Vertex CurVertex = wexp.CurrentVertex(); + TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge); + TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED; + if (aCurve == CurveSeq.Last()) + { + NewFpar = fpar; + NewLpar = lpar; + if (aBasisCurve->IsPeriodic()) + { + if (NewLpar < NewFpar) + NewLpar += aBasisCurve->Period(); + if (ConnectByOrigin == TopAbs_FORWARD) + ElCLib::AdjustPeriodic(FparSeq.Last(), + FparSeq.Last() + aBasisCurve->Period(), + Precision::PConfusion(), NewFpar, NewLpar); + else + ElCLib::AdjustPeriodic(FparSeq.Last() - aBasisCurve->Period(), + FparSeq.Last(), + Precision::PConfusion(), NewFpar, NewLpar); + } + Done = Standard_True; + } + else if (aType == CurType && + aType != GeomAbs_BezierCurve && + aType != GeomAbs_BSplineCurve && + aType != GeomAbs_OtherCurve) + { + switch (aType) + { + case GeomAbs_Line: + { + gp_Lin aLine = BAcurve.Line(); + gp_Lin PrevLine = GAprevcurve.Line(); + if (aLine.Contains(PrevLine.Location(), LinTol) && + aLine.Direction().IsParallel(PrevLine.Direction(), AngTol)) + { + gp_Pnt P1 = ElCLib::Value(fpar, aLine); + gp_Pnt P2 = ElCLib::Value(lpar, aLine); + NewFpar = ElCLib::Parameter(PrevLine, P1); + NewLpar = ElCLib::Parameter(PrevLine, P2); + if (NewLpar < NewFpar) + { + Standard_Real MemNewFpar = NewFpar; + NewFpar = NewLpar; + NewLpar = MemNewFpar; + ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin); + } + Done = Standard_True; + } + break; + } + case GeomAbs_Circle: + { + gp_Circ aCircle = BAcurve.Circle(); + gp_Circ PrevCircle = GAprevcurve.Circle(); + if (aCircle.Location().Distance(PrevCircle.Location()) <= LinTol && + Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol && + aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol)) + { + if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.) + { + Standard_Real memfpar = fpar; + fpar = lpar; + lpar = memfpar; + ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin); + } + gp_Pnt P1 = ElCLib::Value(fpar, aCircle); + gp_Pnt P2 = ElCLib::Value(lpar, aCircle); + NewFpar = ElCLib::Parameter(PrevCircle, P1); + NewLpar = ElCLib::Parameter(PrevCircle, P2); + if (NewLpar < NewFpar) + NewLpar += 2.*M_PI; + //Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar; + if (ConnectByOrigin == TopAbs_FORWARD) + ElCLib::AdjustPeriodic(FparSeq.Last(), + FparSeq.Last() + 2.*M_PI, + Precision::PConfusion(), NewFpar, NewLpar); + else + ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI, + FparSeq.Last(), + Precision::PConfusion(), NewFpar, NewLpar); + Done = Standard_True; + } + break; + } + case GeomAbs_Ellipse: + { + gp_Elips anEllipse = BAcurve.Ellipse(); + gp_Elips PrevEllipse = GAprevcurve.Ellipse(); + if (anEllipse.Focus1().Distance(PrevEllipse.Focus1()) <= LinTol && + anEllipse.Focus2().Distance(PrevEllipse.Focus2()) <= LinTol && + Abs(anEllipse.MajorRadius() - PrevEllipse.MajorRadius()) <= LinTol && + Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol && + anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol)) + { + if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.) + { + Standard_Real memfpar = fpar; + fpar = lpar; + lpar = memfpar; + ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin); + } + gp_Pnt P1 = ElCLib::Value(fpar, anEllipse); + gp_Pnt P2 = ElCLib::Value(lpar, anEllipse); + NewFpar = ElCLib::Parameter(PrevEllipse, P1); + NewLpar = ElCLib::Parameter(PrevEllipse, P2); + if (NewLpar < NewFpar) + NewLpar += 2.*M_PI; + if (ConnectByOrigin == TopAbs_FORWARD) + ElCLib::AdjustPeriodic(FparSeq.Last(), + FparSeq.Last() + 2.*M_PI, + Precision::PConfusion(), NewFpar, NewLpar); + else + ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI, + FparSeq.Last(), + Precision::PConfusion(), NewFpar, NewLpar); + Done = Standard_True; + } + break; + } + case GeomAbs_Hyperbola: + { + gp_Hypr aHypr = BAcurve.Hyperbola(); + gp_Hypr PrevHypr = GAprevcurve.Hyperbola(); + if (aHypr.Focus1().Distance(PrevHypr.Focus1()) <= LinTol && + aHypr.Focus2().Distance(PrevHypr.Focus2()) <= LinTol && + Abs(aHypr.MajorRadius() - PrevHypr.MajorRadius()) <= LinTol && + Abs(aHypr.MinorRadius() - PrevHypr.MinorRadius()) <= LinTol && + aHypr.Axis().IsParallel(PrevHypr.Axis(), AngTol)) + { + gp_Pnt P1 = ElCLib::Value(fpar, aHypr); + gp_Pnt P2 = ElCLib::Value(lpar, aHypr); + NewFpar = ElCLib::Parameter(PrevHypr, P1); + NewLpar = ElCLib::Parameter(PrevHypr, P2); + if (NewLpar < NewFpar) + { + Standard_Real MemNewFpar = NewFpar; + NewFpar = NewLpar; + NewLpar = MemNewFpar; + ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin); + } + Done = Standard_True; + } + break; + } + case GeomAbs_Parabola: + { + gp_Parab aParab = BAcurve.Parabola(); + gp_Parab PrevParab = GAprevcurve.Parabola(); + if (aParab.Location().Distance(PrevParab.Location()) <= LinTol && + aParab.Focus().Distance(PrevParab.Focus()) <= LinTol && + Abs(aParab.Focal() - PrevParab.Focal()) <= LinTol && + aParab.Axis().IsParallel(PrevParab.Axis(), AngTol)) + { + gp_Pnt P1 = ElCLib::Value(fpar, aParab); + gp_Pnt P2 = ElCLib::Value(lpar, aParab); + NewFpar = ElCLib::Parameter(PrevParab, P1); + NewLpar = ElCLib::Parameter(PrevParab, P2); + if (NewLpar < NewFpar) + { + Standard_Real MemNewFpar = NewFpar; + NewFpar = NewLpar; + NewLpar = MemNewFpar; + ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin); + } + Done = Standard_True; + } + break; + } + } //end of switch (aType) + } // end of else if (aType == CurType && ... + if (Done) + { + if (NewFpar < FparSeq.Last()) + FparSeq(FparSeq.Length()) = NewFpar; + else + LparSeq(LparSeq.Length()) = NewLpar; + } + else + { + CurveSeq.Append(aCurve); + TopoDS_Shape aLocShape; + aLocShape.Location(aLoc); + aLocShape.Orientation(wexp.Orientation()); + LocSeq.Append(aLocShape); + FparSeq.Append(fpar); + LparSeq.Append(lpar); + TolSeq.Append(BRep_Tool::Tolerance(CurVertex)); + CurType = aType; + } + } // end of else (CurveSeq.IsEmpty()) -> not first time + } // end for (; wexp.More(); wexp.Next()) + + LastVertex = wexp.CurrentVertex(); + TolSeq.Append(BRep_Tool::Tolerance(LastVertex)); + + TopoDS_Vertex FirstVtx_final = (FinalReverse)? LastVertex : FirstVertex; + FirstVtx_final.Orientation(TopAbs_FORWARD); + TopoDS_Vertex LastVtx_final = (FinalReverse)? FirstVertex : LastVertex; + LastVtx_final.Orientation(TopAbs_REVERSED); + + if (!CurveSeq.IsEmpty()) + { + Standard_Integer nb_curve = CurveSeq.Length(); //number of curves + TColGeom_Array1OfBSplineCurve tab(0,nb_curve-1); //array of the curves + TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2); //array of the tolerances + + Standard_Integer i; + + if (nb_curve > 1) + { + for (i = 1; i <= nb_curve; i++) + { + if (CurveSeq(i)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) + CurveSeq(i) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve(); + + Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i)); + tab(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve); + tab(i-1)->Transform(LocSeq(i).Location().Transformation()); + GeomConvert::C0BSplineToC1BSplineCurve(tab(i-1), Precision::Confusion()); + if (LocSeq(i).Orientation() == TopAbs_REVERSED) + tab(i-1)->Reverse(); + + //Temporary + //char* name = new char[100]; + //sprintf(name, "c%d", i); + //DrawTrSurf::Set(name, tab(i-1)); + + if (i > 1) + tabtolvertex(i-2) = TolSeq(i-1); + } // end for (i = 1; i <= nb_curve; i++) + tabtolvertex(nb_curve-1) = TolSeq(TolSeq.Length()); + + Standard_Boolean closed_flag = Standard_False; + Standard_Real closed_tolerance = 0.; + if (FirstVertex.IsSame(LastVertex) && + GeomLProp::Continuity(tab(0), tab(nb_curve-1), + tab(0)->FirstParameter(), + tab(nb_curve-1)->LastParameter(), + Standard_False, Standard_False, LinTol, AngTol) >= GeomAbs_G1) + { + closed_flag = Standard_True ; + closed_tolerance = BRep_Tool::Tolerance(FirstVertex); + } + + Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves + Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex + GeomConvert::ConcatC1(tab, + tabtolvertex, + ArrayOfIndices, + concatcurve, + closed_flag, + closed_tolerance); //C1 concatenation + + if (concatcurve->Length() > 1) + { + GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower())); + + for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++) + Concat.Add( concatcurve->Value(i), LinTol, Standard_True ); + + concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve()); + } + // rnc : prevents the driver from building an edge without C1 continuity + if (concatcurve->Value(concatcurve->Lower())->Continuity()==GeomAbs_C0){ + Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built"); + } + ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()), + FirstVtx_final, LastVtx_final, + concatcurve->Value(concatcurve->Lower())->FirstParameter(), + concatcurve->Value(concatcurve->Lower())->LastParameter()); + } + else + { + if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) + CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve(); + + CurveSeq(1)->Transform(LocSeq(1).Location().Transformation()); + ResEdge = BRepLib_MakeEdge(CurveSeq(1), + FirstVtx_final, LastVtx_final, + FparSeq(1), LparSeq(1)); + } + } + + if (FinalReverse) + ResEdge.Reverse(); + + return ResEdge; +} //======================================================================= //function : GEOMImpl_ShapeDriver_Type_ @@ -474,10 +956,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ShapeDriver", - sizeof(GEOMImpl_ShapeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ShapeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -498,3 +980,72 @@ const Handle(GEOMImpl_ShapeDriver) Handle(GEOMImpl_ShapeDriver)::DownCast(const return _anOtherObject; } + +//modified by NIZNHY-PKV Wed Dec 28 13:48:31 2011f +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : KeepEdgesOrder +//purpose : +//======================================================================= +/* +void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges, + const Handle(TopTools_HSequenceOfShape)& aWires) +{ + Standard_Integer aNbWires, aNbEdges; + // + if (aEdges.IsNull()) { + return; + } + // + if (aWires.IsNull()) { + return; + } + // + aNbEdges=aEdges->Length(); + aNbWires=aWires->Length(); + if (!aNbEdges || !aNbWires) { + return; + } + //----- + Standard_Boolean bClosed; + Standard_Integer i, j; + TopoDS_Wire aWy; + TopoDS_Iterator aIt; + BRep_Builder aBB; + TopTools_MapOfOrientedShape aMEx; + // + for (i=1; i<=aNbWires; ++i) { + const TopoDS_Shape& aWx=aWires->Value(i); + // + aMEx.Clear(); + aIt.Initialize (aWx); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aEx=aIt.Value(); + aMEx.Add(aEx); + } + // aWy + aBB.MakeWire (aWy); + for (j=1; j<=aNbEdges; ++j) { + const TopoDS_Shape& aE=aEdges->Value(j); + if (aMEx.Contains(aE)) { + aBB.Add(aWy, aE); + } + } + // + bClosed=aWx.Closed(); + aWy.Closed(bClosed); + // + aWires->Append(aWy); + }// for (i=1; i<=aNbWires; ++i) { + // + aWires->Remove(1, aNbWires); +} +*/ +//modified by NIZNHY-PKV Wed Dec 28 13:48:34 2011t diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx index 45bc5e65b..653ad7e13 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx @@ -1,27 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 + // File : GEOMImpl_ShapeDriver.ixx // Module : GEOMImpl -// + #ifndef _GEOMImpl_ShapeDriver_HeaderFile #define _GEOMImpl_ShapeDriver_HeaderFile @@ -118,6 +118,9 @@ class Handle(GEOMImpl_ShapeDriver) : public Handle(TFunction_Driver) { #include #endif +#include +#include + class TColStd_SequenceOfExtendedString; @@ -125,35 +128,38 @@ class GEOMImpl_ShapeDriver : public TFunction_Driver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC - // -Standard_EXPORT GEOMImpl_ShapeDriver(); -Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; -Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} -Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } -Standard_EXPORT static const Standard_GUID& GetID(); -Standard_EXPORT ~GEOMImpl_ShapeDriver() {}; - - - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ShapeDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ShapeDriver) == AType || TFunction_Driver::IsKind(AType)); } - + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_ShapeDriver(); + Standard_EXPORT ~GEOMImpl_ShapeDriver() {}; + + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } + Standard_EXPORT static const Standard_GUID& GetID(); + + Standard_EXPORT static TopoDS_Edge MakeEdgeFromWire(const TopoDS_Shape& aWire, + const Standard_Real LinTol, + const Standard_Real AngTol); + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ShapeDriver) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ShapeDriver) == AType || TFunction_Driver::IsKind(AType)); } }; diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx index 6642592d1..70e627719 100644 --- a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -28,6 +29,8 @@ #include +#include + // OCCT Includes #include #include @@ -78,6 +81,9 @@ Standard_Integer GEOMImpl_SketcherDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; + // Set "C" numeric locale to save numbers correctly + Kernel_Utils::Localizer loc; + // create sketcher Sketcher_Profile aProfile (aCommand.ToCString()); @@ -148,10 +154,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_SketcherDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SketcherDriver", - sizeof(GEOMImpl_SketcherDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_SketcherDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx index 5d5362b25..13acfcbeb 100644 --- a/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_SketcherDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_SphereDriver.cxx b/src/GEOMImpl/GEOMImpl_SphereDriver.cxx index 9bc4f0e8d..daacff0ac 100644 --- a/src/GEOMImpl/GEOMImpl_SphereDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SphereDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -67,16 +68,27 @@ Standard_Integer GEOMImpl_SphereDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; + char aMsg[] = "Sphere creation aborted: radius value less than 1e-07 is not acceptable"; + if (aType == SPHERE_R) { - aShape = BRepPrimAPI_MakeSphere(aCI.GetR()).Shape(); + double anR = aCI.GetR(); + if (anR < Precision::Confusion()) + Standard_ConstructionError::Raise(aMsg); + + aShape = BRepPrimAPI_MakeSphere(anR).Shape(); } else if (aType == SPHERE_PNT_R) { + double anR = aCI.GetR(); + if (anR < Precision::Confusion()) + Standard_ConstructionError::Raise(aMsg); + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(); TopoDS_Shape aShapePnt = aRefPoint->GetValue(); - if (aShapePnt.ShapeType() == TopAbs_VERTEX) { - gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); - aShape = BRepPrimAPI_MakeSphere(aP, aCI.GetR()).Shape(); - } + if (aShapePnt.ShapeType() != TopAbs_VERTEX) + Standard_ConstructionError::Raise("Invalid shape given for sphere center: it must be a point"); + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + + aShape = BRepPrimAPI_MakeSphere(aP, anR).Shape(); } else { } @@ -108,10 +120,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_SphereDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SphereDriver", - sizeof(GEOMImpl_SphereDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_SphereDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_SphereDriver.hxx b/src/GEOMImpl/GEOMImpl_SphereDriver.hxx index e80729ca0..8e7f66c40 100644 --- a/src/GEOMImpl/GEOMImpl_SphereDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_SphereDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_SphereDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx index 11aaea41f..c87cdbc09 100644 --- a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -27,6 +28,7 @@ #include #include +#include #include #include @@ -81,39 +83,129 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; if (aType == SPLINE_BEZIER || aType == SPLINE_INTERPOLATION) { + + bool useCoords = aCI.GetConstructorType() == COORD_CONSTRUCTOR; + TColgp_Array1OfPnt points(1, (useCoords ? aCI.GetLength() : 1) ); + if(useCoords) { + Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates(); + int anArrayLength = aCoordsArray->Length(); + for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) { + gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); + points.SetValue(j,aPnt); + j++; + } + } + + int ind, aLen = aCI.GetLength(); if (aLen < 2) return 0; Standard_Boolean isSeveral = Standard_False; gp_Pnt aPrevP; - TColgp_Array1OfPnt CurvePoints (1, aLen); + int aRealLen = aLen; + if (aType == SPLINE_BEZIER && aCI.GetIsClosed()) { + TopoDS_Vertex aV1; + if(useCoords) { + aV1 = BRepBuilderAPI_MakeVertex(points.Value(1)); + } else { + Handle(GEOM_Function) aFPoint = aCI.GetPoint(1); + TopoDS_Shape aFirstPnt = aFPoint->GetValue(); + aV1 = TopoDS::Vertex(aFirstPnt); + } + + TopoDS_Vertex aV2; + if(useCoords) { + aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen)); + } else { + Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen); + TopoDS_Shape aLastPnt = aLPoint->GetValue(); + aV2 = TopoDS::Vertex(aLastPnt); + } + + if (!aV1.IsNull() && !aV2.IsNull() && !aV1.IsSame(aV2)) { + aRealLen++; + } + } + + TColgp_Array1OfPnt CurvePoints (1, aRealLen); for (ind = 1; ind <= aLen; ind++) { - Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); - TopoDS_Shape aShapePnt = aRefPoint->GetValue(); - if (aShapePnt.ShapeType() == TopAbs_VERTEX) { - gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + gp_Pnt aP; + if( useCoords ) { + aP = points.Value(ind); if (!isSeveral && ind > 1) { if (aP.Distance(aPrevP) > Precision::Confusion()) { isSeveral = Standard_True; } } - CurvePoints.SetValue(ind, aP); + CurvePoints.SetValue(ind, aP); aPrevP = aP; + } else { + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX) { + aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + if (!isSeveral && ind > 1) { + if (aP.Distance(aPrevP) > Precision::Confusion()) { + isSeveral = Standard_True; + } + } + CurvePoints.SetValue(ind, aP); + aPrevP = aP; + } } } if (aType == SPLINE_BEZIER) { if (!isSeveral) { Standard_ConstructionError::Raise("Points for Bezier Curve are too close"); } + if (aRealLen > aLen) { // set last point equal to first for the closed curve + CurvePoints.SetValue(aRealLen, CurvePoints.Value(1)); + } Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints); aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); } else { -// GeomAPI_PointsToBSpline GBC (CurvePoints); -// aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); + //GeomAPI_PointsToBSpline GBC (CurvePoints); + //aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); + Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt(1, aLen); - for (ind = 1; ind <= aLen; ind++) { - aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); + + if (aCI.GetDoReordering()) { + for (int curInd = 1; curInd < aLen - 1; curInd++) { + gp_Pnt curPnt = CurvePoints.Value(curInd); + int nearInd = 0; + double nearDist = RealLast(); + for (ind = curInd + 1; ind <= aLen; ind++) { + double dist = curPnt.SquareDistance(CurvePoints.Value(ind)); + if (dist < nearDist && (nearDist - dist) > Precision::Confusion()) { + nearInd = ind; + nearDist = dist; + } + } + if (nearInd > 0 && nearInd != curInd + 1) { + // Keep given order of points to use it in case of equidistant candidates + // .-<---<-. + // / \ + // o o o c o->o->o->o->n o o + // | | | + // curInd curInd+1 nearInd + gp_Pnt nearPnt = CurvePoints.Value(nearInd); + for (ind = nearInd; ind > curInd + 1; ind--) { + CurvePoints.SetValue(ind, CurvePoints.Value(ind - 1)); + } + CurvePoints.SetValue(curInd + 1, nearPnt); + } + } + for (ind = 1; ind <= aLen; ind++) { + aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); + } + } + else { + for (ind = 1; ind <= aLen; ind++) { + aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); + } } - GeomAPI_Interpolate GBC (aHCurvePoints, Standard_False, gp::Resolution()); + + bool isClosed = aCI.GetIsClosed(); + GeomAPI_Interpolate GBC (aHCurvePoints, isClosed, gp::Resolution()); GBC.Perform(); if (GBC.IsDone()) aShape = BRepBuilderAPI_MakeEdge(GBC.Curve()).Edge(); @@ -123,13 +215,13 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const } else { } - + if (aShape.IsNull()) return 0; - + aFunction->SetValue(aShape); - + log.SetTouched(Label()); - + return 1; } @@ -151,10 +243,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_SplineDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SplineDriver", - sizeof(GEOMImpl_SplineDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_SplineDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.hxx b/src/GEOMImpl/GEOMImpl_SplineDriver.hxx index c615207c1..28202814a 100644 --- a/src/GEOMImpl/GEOMImpl_SplineDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_SplineDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx index 2f99b2580..2ea0ccd27 100644 --- a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -171,10 +172,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ThruSectionsDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ThruSectionsDriver", - sizeof(GEOMImpl_ThruSectionsDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_ThruSectionsDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx index 2aacffe9a..d750b63ff 100644 --- a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_ThruSectionsDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_TorusDriver.cxx b/src/GEOMImpl/GEOMImpl_TorusDriver.cxx index 7ccffe4bd..434135a84 100644 --- a/src/GEOMImpl/GEOMImpl_TorusDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_TorusDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -137,10 +138,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_TorusDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_TorusDriver", - sizeof(GEOMImpl_TorusDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_TorusDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_TorusDriver.hxx b/src/GEOMImpl/GEOMImpl_TorusDriver.hxx index 56db37230..a3947304d 100644 --- a/src/GEOMImpl/GEOMImpl_TorusDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_TorusDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_TorusDriver.ixx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx index 57689ec57..575cbaea9 100644 --- a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx @@ -1,28 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include #include +#include #include #include @@ -78,7 +80,7 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const if (aFunction.IsNull()) return 0; - GEOMImpl_ITranslate TI(aFunction); + GEOMImpl_ITranslate TI (aFunction); gp_Trsf aTrsf; gp_Pnt aP1, aP2; Standard_Integer aType = aFunction->GetType(); @@ -196,6 +198,7 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const B.Add(aCompound, anOriginal.Located(aLocRes)); } aShape = aCompound; + //aShape = GEOMImpl_ITransformOperations::TranslateShape1D(anOriginal, &TI); } else if (aType == TRANSLATE_2D) { Standard_Integer nbtimes1 = TI.GetNbIter1(), nbtimes2 = TI.GetNbIter2(); @@ -241,7 +244,8 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const B.Add(aCompound, anOriginal.Located(aLocRes)); } } - aShape = aCompound; + aShape = aCompound; + //aShape = GEOMImpl_ITransformOperations::TranslateShape2D(anOriginal, &TI); } else return 0; @@ -285,10 +289,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_TranslateDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_TranslateDriver", - sizeof(GEOMImpl_TranslateDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_TranslateDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx index d8875696b..687f21925 100644 --- a/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_TranslateDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 49cf5542f..2e5f871b8 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -1,26 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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_Object types +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + + +// GEOM_Object types + #define GEOM_COPY 0 #define GEOM_IMPORT 1 @@ -49,6 +51,7 @@ #define GEOM_FILLET 20 #define GEOM_FILLET_2D 45 +#define GEOM_FILLET_1D 46 #define GEOM_CHAMFER 21 #define GEOM_EDGE 22 @@ -92,6 +95,12 @@ #define GEOM_3DSKETCHER 44 +#define GEOM_PROJECTION 45 + +#define GEOM_EXTRUDED_CUT 46 + +#define GEOM_EXTRUDED_BOSS 47 + //GEOM_Function types #define COPY_WITH_REF 1 @@ -105,17 +114,22 @@ #define POINT_CURVE_PAR 3 #define POINT_LINES_INTERSECTION 4 #define POINT_SURFACE_PAR 5 -//#define POINT_FACE_PAR 5 +#define POINT_CURVE_COORD 6 +#define POINT_SURFACE_COORD 7 +#define POINT_CURVE_LENGTH 8 +// Vector #define VECTOR_TWO_PNT 1 #define VECTOR_DX_DY_DZ 2 #define VECTOR_TANGENT_CURVE_PAR 3 -#define VECTOR_FACE_NORMALE 4 +#define VECTOR_REVERSE 4 -#define PLANE_PNT_VEC 1 -#define PLANE_FACE 2 -#define PLANE_THREE_PNT 3 +#define PLANE_PNT_VEC 1 +#define PLANE_FACE 2 +#define PLANE_THREE_PNT 3 #define PLANE_TANGENT_FACE 4 +#define PLANE_2_VEC 5 +#define PLANE_LCS 6 #define LINE_TWO_PNT 1 #define LINE_PNT_DIR 2 @@ -148,6 +162,8 @@ #define OFFSET_SHAPE 1 #define OFFSET_SHAPE_COPY 2 +#define PROJECTION_COPY 1 + #define SCALE_SHAPE 1 #define SCALE_SHAPE_COPY 2 #define SCALE_SHAPE_AXES 3 @@ -187,6 +203,7 @@ #define PRISM_BASE_TWO_PNT_2WAYS 4 #define PRISM_BASE_DXDYDZ 5 #define PRISM_BASE_DXDYDZ_2WAYS 6 +#define DRAFT_PRISM_FEATURE 7 #define REVOLUTION_BASE_AXIS_ANGLE 1 #define REVOLUTION_BASE_AXIS_ANGLE_2WAYS 2 @@ -211,15 +228,16 @@ #define POLYLINE_POINTS 1 +#define SPLINE_BEZIER 1 +#define SPLINE_INTERPOLATION 2 + #define CIRCLE_THREE_PNT 1 #define CIRCLE_PNT_VEC_R 2 #define CIRCLE_CENTER_TWO_PNT 3 -#define SPLINE_BEZIER 1 -#define SPLINE_INTERPOLATION 2 - #define ELLIPSE_PNT_VEC_RR 1 +// Arc #define CIRC_ARC_THREE_PNT 1 #define CIRC_ARC_CENTER 2 #define ELLIPSE_ARC_CENTER_TWO_PNT 3 @@ -231,6 +249,7 @@ #define FILLET_SHAPE_FACES_2R 5 #define FILLET_2D_SHAPE_VERTEXES 1 +#define FILLET_1D_SHAPE_VERTEXES 1 #define CHAMFER_SHAPE_ALL 1 #define CHAMFER_SHAPE_EDGE 2 @@ -240,6 +259,7 @@ #define CHAMFER_SHAPE_FACES_AD 6 #define CHAMFER_SHAPE_EDGES_AD 7 +// Shape creation #define WIRE_EDGES 1 #define FACE_WIRE 2 #define SHELL_FACES 3 @@ -249,7 +269,9 @@ #define SUBSHAPE_SORTED 7 #define SUBSHAPE_NOT_SORTED 8 #define FACE_WIRES 9 -#define REVERSE_ORIENTATION 10 +//#define REVERSE_ORIENTATION 10 +#define EDGE_WIRE 11 +#define EDGE_CURVE_LENGTH 12 #define ARCHIMEDE_TYPE 1 @@ -262,21 +284,32 @@ #define SEWING 6 #define DIVIDE_EDGE 7 #define CHANGE_ORIENTATION 8 +#define LIMIT_TOLERANCE 9 +#define FUSE_COLLINEAR_EDGES 10 #define BASIC_FILLING 1 -#define GLUE_FACES 1 +#define GLUE_FACES 1 #define GLUE_FACES_BY_LIST 2 +#define GLUE_EDGES 3 +#define GLUE_EDGES_BY_LIST 4 #define SKETCHER_NINE_DOUBLS 1 #define SKETCHER_PLANE 2 +// Measures #define CDG_MEASURE 1 +#define VECTOR_FACE_NORMALE 4 +#define VERTEX_BY_INDEX 5 #define GROUP_FUNCTION 1 #define SHAPES_ON_SHAPE 1 +// Curve constructor type +#define POINT_CONSTRUCTOR 0 +#define COORD_CONSTRUCTOR 1 + // Blocks #define BLOCK_FACE_FOUR_PNT 1 #define BLOCK_FACE_FOUR_EDGES 2 @@ -290,4 +323,21 @@ #define BLOCK_COMPOUND_IMPROVE 10 // Marker -#define MARKER_CS 1 +#define MARKER_CS 1 +#define MARKER_SHAPE 2 +#define MARKER_PNT2VEC 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 +/*@@ 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 +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/GEOMImpl_VectorDriver.cxx b/src/GEOMImpl/GEOMImpl_VectorDriver.cxx index e925d0e8b..8e8cd9705 100644 --- a/src/GEOMImpl/GEOMImpl_VectorDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_VectorDriver.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -30,7 +31,9 @@ #include #include +#include #include +#include #include #include @@ -71,7 +74,8 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const GEOMImpl_IVector aPI (aFunction); Standard_Integer aType = aFunction->GetType(); - if (aType != VECTOR_DX_DY_DZ && aType != VECTOR_TWO_PNT && aType != VECTOR_TANGENT_CURVE_PAR) return 0; + if (aType != VECTOR_DX_DY_DZ && aType != VECTOR_TWO_PNT && + aType != VECTOR_TANGENT_CURVE_PAR && aType != VECTOR_REVERSE) return 0; TopoDS_Shape aShape; @@ -84,7 +88,8 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise(aMsg.ToCString()); } aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); - } else if (aType == VECTOR_TWO_PNT) { + } + else if (aType == VECTOR_TWO_PNT) { Handle(GEOM_Function) aRefPnt1 = aPI.GetPoint1(); Handle(GEOM_Function) aRefPnt2 = aPI.GetPoint2(); TopoDS_Shape aShape1 = aRefPnt1->GetValue(); @@ -103,7 +108,7 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const } aShape = BRepBuilderAPI_MakeEdge(V1, V2).Shape(); } - else if(aType == VECTOR_TANGENT_CURVE_PAR) { + else if (aType == VECTOR_TANGENT_CURVE_PAR) { Handle(GEOM_Function) aRefCurve = aPI.GetCurve(); TopoDS_Shape aRefShape = aRefCurve->GetValue(); if (aRefShape.ShapeType() != TopAbs_EDGE) { @@ -129,6 +134,18 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const if(aBuilder.IsDone()) aShape = aBuilder.Shape(); } + else if (aType == VECTOR_REVERSE) { + Handle(GEOM_Function) aRefVec = aPI.GetCurve(); + TopoDS_Shape aRefShape = aRefVec->GetValue(); + if (aRefShape.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise + ("Reversed vector creation aborted : vector shape is not an edge"); + } + TopoDS_Edge anE = TopoDS::Edge(aRefShape); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + aShape = BRepBuilderAPI_MakeEdge(V2, V1).Shape(); + } if (aShape.IsNull()) return 0; @@ -157,10 +174,10 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_VectorDriver_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_VectorDriver", - sizeof(GEOMImpl_VectorDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOMImpl_VectorDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } @@ -180,5 +197,5 @@ const Handle(GEOMImpl_VectorDriver) Handle(GEOMImpl_VectorDriver)::DownCast } } - return _anOtherObject ; + return _anOtherObject; } diff --git a/src/GEOMImpl/GEOMImpl_VectorDriver.hxx b/src/GEOMImpl/GEOMImpl_VectorDriver.hxx index 7bf4a469f..8210bf0d7 100644 --- a/src/GEOMImpl/GEOMImpl_VectorDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_VectorDriver.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOMImpl_VectorDriver.hxx // Module : GEOMImpl // diff --git a/src/GEOMImpl/GEOM_GEOMImpl.hxx b/src/GEOMImpl/GEOM_GEOMImpl.hxx index b101bae15..413561cbe 100755 --- a/src/GEOMImpl/GEOM_GEOMImpl.hxx +++ b/src/GEOMImpl/GEOM_GEOMImpl.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_GEOMImpl.hxx // Author : Alexander A. BORODIN // Module : GEOM @@ -27,7 +28,7 @@ #define _GEOM_GEOMImpl_HXX_ #ifdef WNT - #if defined GEOMIMPL_EXPORTS + #if defined GEOMIMPL_EXPORTS || defined GEOMimpl_EXPORTS #if defined WIN32 #define GEOMIMPL_EXPORT __declspec( dllexport ) #else diff --git a/src/GEOMImpl/GUID.txt b/src/GEOMImpl/GUID.txt index 0c03153c7..be669b2b6 100755 --- a/src/GEOMImpl/GUID.txt +++ b/src/GEOMImpl/GUID.txt @@ -39,7 +39,7 @@ FF1BBB53-5D14-4df2-980B-3A668264EA16 // Copy FF1BBB54-5D14-4df2-980B-3A668264EA16 // Shape (Wire, Face, Shell, Solid, Compound) -FF1BBB55-5D14-4df2-980B-3A668264EA16 // Subshape +FF1BBB55-5D14-4df2-980B-3A668264EA16 // Sub-shape FF1BBB56-5D14-4df2-980B-3A668264EA16 // Rotate @@ -65,6 +65,10 @@ FF1BBB66-5D14-4df2-980B-3A668264EA16 // Group FF1BBB67-5D14-4df2-980B-3A668264EA16 // Blocks -FF1BBB68-5D14-4df2-980B-3A668264EA16 // Sub shape GUID +FF1BBB68-5D14-4df2-980B-3A668264EA16 // Sub-shape GUID FF1BBB69-5D14-4df2-980B-3A668264EA16 // Modify the Location + +FF1BBB70-5D14-4df2-980B-3A668264EA16 // Projection + +1C3A0F3F-729D-4E83-8232-78E74FC5637C // Pipe T-Shape diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index eb02b2929..69cda82da 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -1,38 +1,33 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 +# 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 GEOM : implementaion of GEOM_Gen.idl # File : Makefile.in # Author : Damien COQUERET (OCC) # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM -# $Header: -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # Libraries targets - lib_LTLIBRARIES = libGEOMimpl.la -# header files +# header files salomeinclude_HEADERS = \ GEOMImpl_Gen.hxx \ GEOMImpl_IBasicOperations.hxx \ @@ -47,8 +42,8 @@ salomeinclude_HEADERS = \ GEOMImpl_IInsertOperations.hxx \ GEOMImpl_IMeasureOperations.hxx \ GEOMImpl_IGroupOperations.hxx \ + GEOMImpl_IAdvancedOperations.hxx \ GEOMImpl_IGlue.hxx \ - GEOMImpl_Gen.hxx \ GEOMImpl_PointDriver.hxx \ GEOMImpl_IPoint.hxx \ GEOMImpl_IPolyline.hxx \ @@ -56,6 +51,7 @@ salomeinclude_HEADERS = \ GEOMImpl_ISpline.hxx \ GEOMImpl_IEllipse.hxx \ GEOMImpl_IFillet.hxx \ + GEOMImpl_IFillet1d.hxx \ GEOMImpl_IFillet2d.hxx \ GEOMImpl_IChamfer.hxx \ GEOMImpl_ICopy.hxx \ @@ -104,6 +100,7 @@ salomeinclude_HEADERS = \ GEOMImpl_MarkerDriver.hxx \ GEOMImpl_TranslateDriver.hxx \ GEOMImpl_MirrorDriver.hxx \ + GEOMImpl_ProjectionDriver.hxx \ GEOMImpl_OffsetDriver.hxx \ GEOMImpl_ScaleDriver.hxx \ GEOMImpl_PositionDriver.hxx \ @@ -128,6 +125,8 @@ salomeinclude_HEADERS = \ GEOMImpl_SketcherDriver.hxx \ GEOMImpl_3DSketcherDriver.hxx \ GEOMImpl_FilletDriver.hxx \ + GEOMImpl_Fillet1d.hxx \ + GEOMImpl_Fillet1dDriver.hxx \ GEOMImpl_Fillet2dDriver.hxx \ GEOMImpl_ChamferDriver.hxx \ GEOMImpl_BooleanDriver.hxx \ @@ -140,10 +139,17 @@ salomeinclude_HEADERS = \ GEOMImpl_HealingDriver.hxx \ GEOMImpl_FillingDriver.hxx \ GEOMImpl_GlueDriver.hxx \ - GEOMImpl_CopyDriver.hxx \ 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 +##@@ 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 \ @@ -157,6 +163,7 @@ 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 \ @@ -165,6 +172,7 @@ dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_MarkerDriver.cxx \ GEOMImpl_TranslateDriver.cxx \ GEOMImpl_MirrorDriver.cxx \ + GEOMImpl_ProjectionDriver.cxx \ GEOMImpl_OffsetDriver.cxx \ GEOMImpl_ScaleDriver.cxx \ GEOMImpl_PositionDriver.cxx \ @@ -191,6 +199,8 @@ dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_SketcherDriver.cxx \ GEOMImpl_3DSketcherDriver.cxx \ GEOMImpl_FilletDriver.cxx \ + GEOMImpl_Fillet1d.cxx \ + GEOMImpl_Fillet1dDriver.cxx \ GEOMImpl_Fillet2dDriver.cxx \ GEOMImpl_ChamferDriver.cxx \ GEOMImpl_BooleanDriver.cxx \ @@ -204,6 +214,14 @@ 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 +##@@ 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 = \ @@ -212,14 +230,15 @@ libGEOMimpl_la_CPPFLAGS = \ $(CAS_CPPFLAGS) \ $(KERNEL_CXXFLAGS) \ $(BOOST_CPPFLAGS) \ + $(PYTHON_INCLUDES) \ -I$(srcdir)/../ShHealOper \ + -I$(srcdir)/../NMTDS \ -I$(srcdir)/../NMTTools \ -I$(srcdir)/../GEOM \ -I$(srcdir)/../GEOMAlgo \ -I$(srcdir)/../SKETCHER \ -I$(srcdir)/../ARCHIMEDE \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOMimpl_la_LDFLAGS = \ ../GEOM/libGEOMbasic.la \ @@ -227,9 +246,10 @@ libGEOMimpl_la_LDFLAGS = \ ../ShHealOper/libShHealOper.la \ ../ARCHIMEDE/libGEOMArchimede.la \ ../SKETCHER/libGEOMSketcher.la \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \ $(STDLIB) \ - $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset + $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lTKFeat \ + $(PYTHON_LIBS) # extra dist files EXTRA_DIST += GUID.txt diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 4945b72e8..f0acaa34f 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -1,32 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMBase_Tools.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. -// + #include "GEOMToolsGUI.h" #include "GEOMToolsGUI_DeleteDlg.h" #include +#include "GeometryGUI_Operations.h" #include #include #include @@ -57,8 +59,6 @@ // OCCT Includes #include -using namespace std; - typedef QMap FilterMap; static QString lastUsedFilter; @@ -68,19 +68,19 @@ static QString lastUsedFilter; // the selected file type code through argument. //======================================================================= static QString getFileName( QWidget* parent, - const QString& initial, - const FilterMap& filterMap, + const QString& initial, + const FilterMap& filterMap, const QStringList& filters, - const QString& caption, - bool open, - QString& format, - bool showCurrentDirInitially = false ) + const QString& caption, + bool open, + QString& format, + bool showCurrentDirInitially = false ) { //QStringList filters; QString aBrepFilter; - for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) { + for (FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it) { //filters.push_back( it.key() ); - if ( it.key().contains( "BREP", Qt::CaseInsensitive ) ) + if (it.key().contains( "BREP", Qt::CaseInsensitive )) aBrepFilter = it.key(); } @@ -90,12 +90,12 @@ static QString getFileName( QWidget* parent, if ( !initial.isEmpty() ) fd->selectFile( initial ); - + if ( showCurrentDirInitially && SUIT_FileDlg::getLastVisitedPath().isEmpty() ) fd->setDirectory( QDir::currentPath() ); fd->setFilters( filters ); - + if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) ) { fd->selectFilter( lastUsedFilter ); } @@ -121,11 +121,11 @@ static QString getFileName( QWidget* parent, // the selected file type code through argument. //======================================================================= static QStringList getFileNames( QWidget* parent, - const QString& initial, - const FilterMap& filterMap, - const QString& caption, - QString& format, - bool showCurrentDirInitially = false) + const QString& initial, + const FilterMap& filterMap, + const QString& caption, + QString& format, + bool showCurrentDirInitially = false) { QString aBrepFilter; QStringList allFilters; @@ -144,19 +144,19 @@ static QStringList getFileNames( QWidget* parent, } } filters.append( QObject::tr( "GEOM_ALL_IMPORT_FILES" ).arg( allFilters.join( " " ) ) ); - + SUIT_FileDlg fd( parent, true, true, true ); - fd.setFileMode( SUIT_FileDlg::ExistingFiles ); + fd.setFileMode( SUIT_FileDlg::ExistingFiles ); if ( !caption.isEmpty() ) fd.setWindowTitle( caption ); if ( !initial.isEmpty() ) fd.selectFile( initial ); - + if ( showCurrentDirInitially && SUIT_FileDlg::getLastVisitedPath().isEmpty() ) fd.setDirectory( QDir::currentPath() ); - + fd.setFilters( filters ); - + if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) ) fd.selectFilter( lastUsedFilter ); else if ( !aBrepFilter.isEmpty() ) @@ -200,7 +200,7 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap gobjects; QMap::ConstIterator oit; - list<_PTR(SObject)> aSelectedSO; + std::list<_PTR(SObject)> aSelectedSO; for ( oit = objects.begin(); oit != objects.end(); ++oit ) { _PTR(SObject) so = study->FindObjectID( oit.key().toLatin1().data() ); if ( !so ) @@ -208,23 +208,23 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap::iterator itSO = aSelectedSO.begin(); + std::list< _PTR(SObject) >::iterator itSO = aSelectedSO.begin(); for ( ; itSO != aSelectedSO.end(); ++itSO ) { - std::vector<_PTR(SObject)> aReferences = study->FindDependances( *itSO ); + std::vector<_PTR(SObject)> aReferences = study->FindDependances( *itSO ); int aRefLength = aReferences.size(); if (aRefLength) { for (int i = 0; i < aRefLength; i++) { - _PTR(SObject) firstSO( aReferences[i] ); - _PTR(SComponent) aComponent = firstSO->GetFatherComponent(); - QString type = aComponent->ComponentDataType().c_str(); - if ( type == "SMESH" ) - return true; + _PTR(SObject) firstSO( aReferences[i] ); + _PTR(SComponent) aComponent = firstSO->GetFatherComponent(); + QString type = aComponent->ComponentDataType().c_str(); + if ( type == "SMESH" ) + return true; } } } @@ -235,11 +235,11 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMapValue() ); CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child ); GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); - if( CORBA::is_nil( geomObj ) ) + if( CORBA::is_nil( geomObj ) ) continue; GEOM::ListOfGO_var list = geomObj->GetDependency(); - if( list->length() == 0 ) + if( list->length() == 0 ) continue; for( int i = 0; i < list->length(); i++ ) { @@ -247,17 +247,16 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap::Iterator git; for ( git = gobjects.begin(); git != gobjects.end() && ( !depends || !deleted ); ++git ) { - depends = depends || list[i]->_is_equivalent( *git ); - deleted = deleted || git.key() == child->GetID().c_str() ;//geomObj->_is_equivalent( *git ); + depends = depends || list[i]->_is_equivalent( *git ); + deleted = deleted || git.key() == child->GetID().c_str() ;//geomObj->_is_equivalent( *git ); } if ( depends && !deleted ) - return true; + return true; } } return false; } - //======================================================================= // function : GEOMToolsGUI() // purpose : Constructor @@ -267,7 +266,6 @@ GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent ) { } - //======================================================================= // function : ~GEOMToolsGUI() // purpose : Destructor @@ -276,7 +274,6 @@ GEOMToolsGUI::~GEOMToolsGUI() { } - //======================================================================= // function : OnGUIEvent() // purpose : @@ -285,137 +282,111 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { getGeometryGUI()->EmitSignalDeactivateDialog(); - switch (theCommandID) - { - case 31: // COPY - { - OnEditCopy(); - break; - } - case 33: // DELETE - { - OnEditDelete(); - break; - } - case 111: // IMPORT BREP - case 112: // IMPORT IGES - case 113: // IMPORT STEP - { - Import(); - break; - } - case 121: // EXPORT BREP - case 122: // EXPORT IGES - case 123: // EXPORT STEP - { - Export(); - break; - } - case 2171: // POPUP VIEWER - SELECT ONLY - VERTEX - { - OnSelectOnly( GEOM_POINT ); - break; - } - case 2172: // POPUP VIEWER - SELECT ONLY - EDGE - { - OnSelectOnly( GEOM_EDGE ); - break; - } - case 2173: // POPUP VIEWER - SELECT ONLY - WIRE - { - OnSelectOnly( GEOM_WIRE ); - break; - } - case 2174: // POPUP VIEWER - SELECT ONLY - FACE - { - OnSelectOnly( GEOM_FACE ); - break; - } - case 2175: // POPUP VIEWER - SELECT ONLY - SHELL - { - OnSelectOnly( GEOM_SHELL ); - break; - } - case 2176: // POPUP VIEWER - SELECT ONLY - SOLID - { - OnSelectOnly( GEOM_SOLID ); - break; - } - case 2177: // POPUP VIEWER - SELECT ONLY - COMPOUND - { - OnSelectOnly( GEOM_COMPOUND ); - break; - } - case 2178: // POPUP VIEWER - SELECT ONLY - SELECT ALL - { - OnSelectOnly( GEOM_ALLOBJECTS ); - break; - } - case 411: // SETTINGS - ADD IN STUDY - { - // SAN -- TO BE REMOVED !!! - break; - } - case 412: // SETTINGS - SHADING COLOR - { - OnSettingsColor(); - break; - } - case 804: // ADD IN STUDY - POPUP VIEWER - { - // SAN -- TO BE REMOVED !!!! - break; - } - case 901: // RENAME - { - OnRename(); - break; - } - case 5103: // CHECK GEOMETRY - { - OnCheckGeometry(); - break; - } - case 8032: // COLOR - POPUP VIEWER - { - OnColor(); - break; - } - case 8033: // TRANSPARENCY - POPUP VIEWER - { - OnTransparency(); - break; - } - case 8034: // ISOS - POPUP VIEWER - { - OnNbIsos(); - break; - } - case 8035: // AUTO COLOR - POPUP VIEWER - { - OnAutoColor(); - break; - } - case 8036: // DISABLE AUTO COLOR - POPUP VIEWER - { - OnDisableAutoColor(); - break; - } - case 9024 : // OPEN - OBJBROSER POPUP - { - OnOpen(); - break; - } - default: - { - SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); - break; - } - } + switch ( theCommandID ) { + case GEOMOp::OpDelete: // EDIT - DELETE + OnEditDelete(); + break; + case GEOMOp::OpImport: // FILE - IMPORT + Import(); + break; + case GEOMOp::OpExport: // FILE - EXPORT + Export(); + break; + case GEOMOp::OpCheckGeom: // TOOLS - CHECK GEOMETRY + OnCheckGeometry(); + break; + case GEOMOp::OpSelectVertex: // POPUP - SELECT ONLY - VERTEX + OnSelectOnly( GEOM_POINT ); + break; + case GEOMOp::OpSelectEdge: // POPUP - SELECT ONLY - EDGE + OnSelectOnly( GEOM_EDGE ); + break; + case GEOMOp::OpSelectWire: // POPUP - SELECT ONLY - WIRE + OnSelectOnly( GEOM_WIRE ); + break; + case GEOMOp::OpSelectFace: // POPUP - SELECT ONLY - FACE + OnSelectOnly( GEOM_FACE ); + break; + case GEOMOp::OpSelectShell: // POPUP - SELECT ONLY - SHELL + OnSelectOnly( GEOM_SHELL ); + break; + case GEOMOp::OpSelectSolid: // POPUP - SELECT ONLY - SOLID + OnSelectOnly( GEOM_SOLID ); + break; + case GEOMOp::OpSelectCompound: // POPUP - SELECT ONLY - COMPOUND + OnSelectOnly( GEOM_COMPOUND ); + break; + case GEOMOp::OpSelectAll: // POPUP - SELECT ONLY - SELECT ALL + OnSelectOnly( GEOM_ALLOBJECTS ); + break; + case GEOMOp::OpDeflection: // POPUP - DEFLECTION ANGLE + OnDeflection(); + break; + case GEOMOp::OpColor: // POPUP - COLOR + OnColor(); + break; + case GEOMOp::OpSetTexture: // POPUP - TEXTURE + OnTexture(); + break; + case GEOMOp::OpTransparency: // POPUP - TRANSPARENCY + OnTransparency(); + break; + case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY + OnChangeTransparency( true ); + break; + case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY + OnChangeTransparency( false ); + break; + case GEOMOp::OpIsos: // POPUP - ISOS + OnNbIsos(); + break; + case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOLINES + OnNbIsos( INCR ); + break; + case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOLINES + OnNbIsos( DECR ); + break; + case GEOMOp::OpMaterialProperties: // POPUP - MATERIAL PROPERTIES + OnMaterialProperties(); + break; + case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR + OnAutoColor(); + break; + case GEOMOp::OpNoAutoColor: // POPUP - DISABLE AUTO COLOR + OnDisableAutoColor(); + break; + case GEOMOp::OpShowChildren: // POPUP - SHOW CHILDREN + case GEOMOp::OpHideChildren: // POPUP - HIDE CHILDREN + OnShowHideChildren( theCommandID == GEOMOp::OpShowChildren ); + break; + case GEOMOp::OpPointMarker: // POPUP - POINT MARKER + OnPointMarker(); + break; + case GEOMOp::OpUnpublishObject:// POPUP - UNPUBLISH + OnUnpublishObject(); + break; + case GEOMOp::OpPublishObject:// GEOM ROOT OBJECT - POPUP - PUBLISH + OnPublishObject(); + break; + case GEOMOp::OpEdgeWidth: + OnEdgeWidth(); + break; + case GEOMOp::OpIsosWidth: + OnIsosWidth(); + break; + case GEOMOp::OpBringToFront: + OnBringToFront(); + break; + case GEOMOp::OpClsBringToFront: + OnClsBringToFront(); + break; + default: + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } return true; } - //=============================================================================== // function : OnEditDelete() // purpose : @@ -439,15 +410,15 @@ void GEOMToolsGUI::OnEditDelete() return; _PTR(Study) aStudy = appStudy->studyDS(); - + // check if study is locked if ( _PTR(AttributeStudyProperties)( aStudy->GetProperties() )->IsLocked() ) { SUIT_MessageBox::warning( app->desktop(), - tr("WRN_WARNING"), - tr("WRN_STUDY_LOCKED") ); + tr("WRN_WARNING"), + tr("WRN_STUDY_LOCKED") ); return; // study is locked } - + // get GEOM component CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() ); QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR.in() ) ); @@ -456,6 +427,7 @@ void GEOMToolsGUI::OnEditDelete() QMap toBeDeleted; QMap allDeleted; bool isComponentSelected = false; + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { Handle(SALOME_InteractiveObject) anIObject = It.Value(); if ( !anIObject->hasEntry() ) @@ -467,20 +439,23 @@ void GEOMToolsGUI::OnEditDelete() QString parentComp = getParentComponent( obj ); if ( parentComp != geomComp ) { SUIT_MessageBox::warning( app->desktop(), - QObject::tr("ERR_ERROR"), - QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ) ); + QObject::tr("ERR_ERROR"), + QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ) ); return; // not GEOM object selected } /////////////////////////////////////////////////////// // if GEOM component is selected, so skip other checks - if ( isComponentSelected ) continue; + if ( isComponentSelected ) continue; /////////////////////////////////////////////////////// - + // check if object is reference _PTR(SObject) refobj; - if ( obj && obj->ReferencedObject( refobj ) ) - continue; // skip references + if ( obj && obj->ReferencedObject( refobj ) ) { + // get the main object by reference IPAL 21354 + obj = refobj; + entry = obj->GetID().c_str(); + } // ... QString aName = obj->GetName().c_str(); if ( entry == geomComp ) { @@ -495,13 +470,13 @@ void GEOMToolsGUI::OnEditDelete() for ( it->InitEx( true ); it->More(); it->Next() ) { _PTR(SObject) child( it->Value() ); if ( child && child->ReferencedObject( refobj ) ) - continue; // skip references + continue; // skip references aName = child->GetName().c_str(); if ( !aName.isEmpty() ) - allDeleted.insert( child->GetID().c_str(), aName ); + allDeleted.insert( child->GetID().c_str(), aName ); } } - + // is there is anything to delete? if ( !isComponentSelected && allDeleted.count() <= 0 ) return; // nothing to delete @@ -510,7 +485,7 @@ void GEOMToolsGUI::OnEditDelete() GEOMToolsGUI_DeleteDlg dlg( app->desktop(), allDeleted, isComponentSelected ); if ( !dlg.exec() ) return; // operation is cancelled by user - + // get currently opened views QList views; SALOME_View* view; @@ -522,10 +497,10 @@ void GEOMToolsGUI::OnEditDelete() if ( view ) views.append( view ); } - + _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder()); GEOM_Displayer* disp = new GEOM_Displayer( appStudy ); - + if ( isComponentSelected ) { // GEOM component is selected: delete all objects recursively _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toLatin1().data() ); @@ -545,8 +520,8 @@ void GEOMToolsGUI::OnEditDelete() // GEOM component is not selected: check if selected objects are in use if ( inUse( aStudy, geomComp, allDeleted ) ) { SUIT_MessageBox::warning( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("DEP_OBJECT") ); + QObject::tr("WRN_WARNING"), + QObject::tr("DEP_OBJECT") ); return; // object(s) in use } // ... and then delete all objects @@ -559,57 +534,21 @@ void GEOMToolsGUI::OnEditDelete() aStudyBuilder->RemoveObjectWithChildren( obj ); } } - + selected.Clear(); aSelMgr->setSelectedObjects( selected ); getGeometryGUI()->updateObjBrowser(); app->updateActions(); //SRN: To update a Save button in the toolbar } - -//============================================================================== -// function : OnEditCopy() -// purpose : -//============================================================================== -void GEOMToolsGUI::OnEditCopy() -{ -/* - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); - GEOM::string_array_var listIOR = new GEOM::string_array; - - const SALOME_ListIO& List = Sel->StoredIObjects(); - - myGeomBase->ConvertListOfIOInListOfIOR(List, listIOR); - - Sel->ClearIObjects(); - - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - int aStudyID = aStudy->StudyId(); - - for (unsigned int ind = 0; ind < listIOR->length();ind++) { - GEOM::GEOM_Object_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]); - try { - GEOM::GEOM_IInsertOperations_var IOp = myGeom->GetIInsertOperations(aStudyID); - GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit); - myGeomBase->Display(result); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - } - - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); -*/ -} - //===================================================================================== // function : Import -// purpose : BRep, Iges, Step +// purpose : BRep, Iges, Step, ... //===================================================================================== bool GEOMToolsGUI::Import() { SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( getGeometryGUI()->getApp() ); - if (! app) return false; + if ( !app ) return false; SalomeApp_Study* stud = dynamic_cast ( app->activeStudy() ); if ( !stud ) { @@ -622,8 +561,8 @@ bool GEOMToolsGUI::Import() bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { SUIT_MessageBox::warning( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED") ); + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED") ); return false; } @@ -631,8 +570,8 @@ bool GEOMToolsGUI::Import() GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); if ( CORBA::is_nil( eng ) ) { SUIT_MessageBox::critical( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr( "GEOM Engine is not started" ) ); + QObject::tr("WRN_WARNING"), + QObject::tr( "GEOM Engine is not started" ) ); return false; } @@ -651,7 +590,7 @@ bool GEOMToolsGUI::Import() // select files to be imported QString fileType; QStringList fileNames = getFileNames( app->desktop(), "", aMap, - tr( "GEOM_MEN_IMPORT" ), fileType, true ); + tr( "GEOM_MEN_IMPORT" ), fileType, true ); // set Wait cursor SUIT_OverrideCursor wc; @@ -662,10 +601,16 @@ bool GEOMToolsGUI::Import() QStringList errors; QList< GEOM::GEOM_Object_var > objsForDisplay; - + + QStringList anEntryList; + // iterate through all selected files - for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) { - QString fileName = *it; + + SUIT_MessageBox::StandardButton igesAnswer = SUIT_MessageBox::NoButton; + SUIT_MessageBox::StandardButton acisAnswer = SUIT_MessageBox::NoButton; + + for ( int i = 0; i < fileNames.count(); i++ ) { + QString fileName = fileNames[i]; if ( fileName.isEmpty() ) continue; @@ -675,14 +620,14 @@ bool GEOMToolsGUI::Import() // file type is not defined, try to detect QString ext = QFileInfo( fileName ).suffix().toUpper(); QRegExp re( "\\*\\.(\\w+)" ); - for ( FilterMap::const_iterator it = aMap.begin(); - it != aMap.end() && aCurrentType.isEmpty(); ++it ) { - int pos = 0; - while ( re.indexIn( it.key(), pos ) >= 0 ) { - QString f = re.cap(1).trimmed().toUpper(); - if ( ext == f ) { aCurrentType = it.value(); break; } - pos = re.pos() + re.cap(1).length() + 2; - } + for ( FilterMap::const_iterator it = aMap.begin(); + it != aMap.end() && aCurrentType.isEmpty(); ++it ) { + int pos = 0; + while ( re.indexIn( it.key(), pos ) >= 0 ) { + QString f = re.cap(1).trimmed().toUpper(); + if ( ext == f ) { aCurrentType = it.value(); break; } + pos = re.pos() + re.cap(1).length() + 2; + } } } else { @@ -701,25 +646,84 @@ bool GEOMToolsGUI::Import() CORBA::String_var fileN = fileName.toLatin1().constData(); CORBA::String_var fileT = aCurrentType.toLatin1().constData(); - GEOM::GEOM_Object_var anObj = aInsOp->Import( fileN, fileT ); + + // skl 29.05.2009 + if ( aCurrentType == "IGES" ) { + GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, "IGES_UNIT" ); + bool needConvert = false; + TCollection_AsciiString aUnitName = aInsOp->GetErrorCode(); + if ( aUnitName.SubString( 1, 4 ) == "UNIT" ) + needConvert = aUnitName.SubString( 6, aUnitName.Length() ) != "M"; + + if ( needConvert ) { + if ( igesAnswer == SUIT_MessageBox::NoToAll ) { + // converting for all files is already approved + fileT = "IGES_SCALE"; + } + else if ( igesAnswer != SUIT_MessageBox::YesToAll ) { + SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No; + if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll; + igesAnswer = SUIT_MessageBox::question( app->desktop(), + "Question",//tr("WRN_WARNING"), + tr("GEOM_SCALE_DIMENSIONS"), + btns | SUIT_MessageBox::Cancel, + SUIT_MessageBox::No ); + switch ( igesAnswer ) { + case SUIT_MessageBox::Cancel: + return false; // cancel (break) import operation + case SUIT_MessageBox::Yes: + case SUIT_MessageBox::YesToAll: + break; // scaling is confirmed + case SUIT_MessageBox::No: + case SUIT_MessageBox::NoAll: + fileT = "IGES_SCALE"; + default: + break; // scaling is rejected + } // switch ( igesAnswer ) + } // if ( igeAnswer != NoToAll ) + } // if ( needConvert ) + } // if ( aCurrentType == "IGES" ) + else if ( aCurrentType == "ACIS" ) { + if ( acisAnswer != SUIT_MessageBox::YesToAll && acisAnswer != SUIT_MessageBox::NoToAll ) { + SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No; + if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll; + acisAnswer = SUIT_MessageBox::question( app->desktop(), + "Question",//tr("WRN_WARNING"), + tr("GEOM_PUBLISH_NAMED_SHAPES"), + btns | SUIT_MessageBox::Cancel, + SUIT_MessageBox::No ); + if ( acisAnswer == SUIT_MessageBox::Cancel ) + return false; // cancel (break) import operation + } // if ( acisAnswer != YesToAll && acisAnswer != NoToAll ) + } // else if ( aCurrentType == "ACIS" ) + + GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, fileT ); if ( !anObj->_is_nil() && aInsOp->IsDone() ) { - QString aPublishObjName = - GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, /*withExten=*/true ) ); - - SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy ); - GeometryGUI::GetGeomGen()->PublishInStudy( aDSStudy, - SALOMEDS::SObject::_nil(), - anObj, - aPublishObjName.toLatin1().constData() ); - - objsForDisplay.append( anObj ); - - anOp->commit(); + QString aPublishObjName = + GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, /*withExten=*/true ) ); + + SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy ); + SALOMEDS::SObject_var aSO = + GeometryGUI::GetGeomGen()->PublishInStudy( aDSStudy, + SALOMEDS::SObject::_nil(), + anObj, + aPublishObjName.toLatin1().constData() ); + if ( ( !aSO->_is_nil() ) ) + anEntryList.append( aSO->GetID() ); + + objsForDisplay.append( anObj ); + + if ( aCurrentType == "ACIS" ) { + if ( acisAnswer == SUIT_MessageBox::Yes || acisAnswer == SUIT_MessageBox::YesToAll ) + GeometryGUI::GetGeomGen()->PublishNamedShapesInStudy( aDSStudy, anObj ); + } + + anOp->commit(); } else { - anOp->abort(); - errors.append( QString( "%1 : %2" ).arg( fileName ).arg( aInsOp->GetErrorCode() ) ); + anOp->abort(); + errors.append( QString( "%1 : %2" ).arg( fileName ).arg( aInsOp->GetErrorCode() ) ); } } catch( const SALOME::SALOME_Exception& S_ex ) { @@ -731,14 +735,17 @@ bool GEOMToolsGUI::Import() // update object browser getGeometryGUI()->updateObjBrowser( true ); + // browse published objects + app->browseObjects( anEntryList ); + // display imported model (if only one file is selected) if ( objsForDisplay.count() == 1 ) GEOM_Displayer( stud ).Display( objsForDisplay[0].in() ); if ( errors.count() > 0 ) { SUIT_MessageBox::critical( app->desktop(), - QObject::tr( "GEOM_ERROR" ), - QObject::tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) ); + QObject::tr( "GEOM_ERROR" ), + QObject::tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) ); } app->updateActions(); //SRN: To update a Save button in the toolbar @@ -746,7 +753,6 @@ bool GEOMToolsGUI::Import() return objsForDisplay.count() > 0; } - //===================================================================================== // function : Export // purpose : BRep, Iges, Step @@ -766,8 +772,8 @@ bool GEOMToolsGUI::Export() GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); if ( CORBA::is_nil( eng ) ) { SUIT_MessageBox::critical( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr( "GEOM Engine is not started" ) ); + QObject::tr("WRN_WARNING"), + QObject::tr( "GEOM Engine is not started" ) ); return false; } @@ -795,17 +801,16 @@ bool GEOMToolsGUI::Export() bool appropriateObj = false; SALOME_ListIteratorOfListIO It( selectedObjects ); - for(;It.More();It.Next()) { + for (; It.More(); It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(IObject, found); + GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( IObject ); - if ( !found || anObj->_is_nil() ) + if ( anObj->_is_nil() ) continue; QString fileType; QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap, filters, - tr("GEOM_MEN_EXPORT"), false, fileType, true); + tr("GEOM_MEN_EXPORT"), false, fileType, true); // User has pressed "Cancel" --> stop the operation if ( file.isEmpty() || fileType.isEmpty() ) @@ -819,20 +824,18 @@ bool GEOMToolsGUI::Export() anOp->start(); - aInsOp->Export( anObj, file.toStdString().c_str(), fileType.toLatin1().constData() ); - if ( aInsOp->IsDone() ) - anOp->commit(); - else - { - anOp->abort(); - wc.suspend(); - SUIT_MessageBox::critical( app->desktop(), - QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ) ); - return false; - } + if (aInsOp->IsDone()) + anOp->commit(); + else { + anOp->abort(); + wc.suspend(); + SUIT_MessageBox::critical(app->desktop(), + QObject::tr("GEOM_ERROR"), + QObject::tr("GEOM_PRP_ABORT") + "\n" + QObject::tr(aInsOp->GetErrorCode())); + return false; + } } catch (const SALOME::SALOME_Exception& S_ex) { //QtCatchCorbaException(S_ex); @@ -844,14 +847,14 @@ bool GEOMToolsGUI::Export() if ( !appropriateObj ) SUIT_MessageBox::warning( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") ); + QObject::tr("WRN_WARNING"), + QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") ); return true; } //===================================================================================== // function : RemoveObjectWithChildren -// purpose : to be used by OnEditDelete() method +// purpose : used by OnEditDelete() method //===================================================================================== void GEOMToolsGUI::removeObjectWithChildren(_PTR(SObject) obj, _PTR(Study) aStudy, @@ -869,6 +872,8 @@ void GEOMToolsGUI::removeObjectWithChildren(_PTR(SObject) obj, if (obj->FindAttribute(anAttr, "AttributeIOR")) { _PTR(AttributeIOR) anIOR (anAttr); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + // Delete shape in Client const TCollection_AsciiString ASCIor ((char*)anIOR->Value().c_str()); getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer(ASCIor); @@ -876,14 +881,21 @@ void GEOMToolsGUI::removeObjectWithChildren(_PTR(SObject) obj, CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj); GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); if (!CORBA::is_nil(geomObj)) { + + //Remove visual properties of the object + appStudy->removeObjectFromAll(obj->GetID().c_str()); + // Erase graphical object QListIterator it( views ); while ( it.hasNext() ) - if ( SALOME_View* view = it.next() ) - disp->Erase(geomObj, true, view); - + if ( SALOME_View* view = it.next() ) + disp->Erase(geomObj, true, view); + // Remove object from Engine - GeometryGUI::GetGeomGen()->RemoveObject( geomObj ); + // We can't directly remove object from engine. All we can do is to unpublish the object + // from the study. Another client could be using the object. + // Unpublishing is done just after in aStudyBuilder->RemoveObjectWithChildren( child ); + //GeometryGUI::GetGeomGen()->RemoveObject( geomObj ); } } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 3ae7e7808..4241124f6 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -1,27 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// GEOM GEOMGUI : GUI for Geometry component -// File : GEOMToolsGUI.h -// Author : Damien COQUERET, Open CASCADE S.A.S. + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI.h +// Author : Damien COQUERET, Open CASCADE S.A.S. // #ifndef GEOMTOOLSGUI_H #define GEOMTOOLSGUI_H @@ -51,32 +52,43 @@ public: bool OnGUIEvent( int, SUIT_Desktop* ); virtual void deactivate(); + enum ActionType { SHOWDLG, INCR, DECR }; + private: // Import and export topology methods bool Import(); bool Export(); - void OnEditCopy(); void OnEditDelete(); - - void OnSettingsColor(); - void OnRename(); void OnCheckGeometry(); // Popup commands void OnAutoColor(); void OnDisableAutoColor(); void OnColor(); + void OnTexture(); void OnTransparency(); - void OnNbIsos(); - void OnOpen(); + void OnNbIsos( ActionType actionType = SHOWDLG ); + void OnDeflection(); void OnSelectOnly(int mode); - + void OnShowHideChildren( bool ); + void OnUnpublishObject(); + void OnPublishObject() ; + void OnPointMarker(); + void OnMaterialProperties(); + void OnEdgeWidth(); + void OnIsosWidth(); + void OnBringToFront(); + void OnClsBringToFront(); + + // Shortcut commands + void OnChangeTransparency( bool ); + // Recursive deletion of object with children void removeObjectWithChildren( _PTR(SObject), - _PTR(Study), - QList, - GEOM_Displayer* ); + _PTR(Study), + QList, + GEOM_Displayer* ); }; #endif // GEOMTOOLSGUI_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.pro b/src/GEOMToolsGUI/GEOMToolsGUI.pro deleted file mode 100644 index 3ab591e7b..000000000 --- a/src/GEOMToolsGUI/GEOMToolsGUI.pro +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMToolsGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../OBJECT ../GEOMBase ../GEOMClient ../GEOMImpl ../GEOMGUI $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMBase -lGEOM $${GUI_LDFLAGS} -lVTKViewer -lOCCViewer -lsuit -lSalomeApp - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += GEOMTOOLSGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -SOURCES = GEOMToolsGUI.cxx -SOURCES += GEOMToolsGUI_1.cxx -SOURCES += GEOMToolsGUI_TransparencyDlg.cxx -SOURCES += GEOMToolsGUI_NbIsosDlg.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index a996e25ef..64983d176 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -1,40 +1,51 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : GEOMToolsGUI_1.cxx -// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI_1.cxx +// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) + #include #include "GEOMToolsGUI.h" #include "GEOMToolsGUI_TransparencyDlg.h" #include "GEOMToolsGUI_NbIsosDlg.h" +#include "GEOMToolsGUI_DeflectionDlg.h" +#include "GEOMToolsGUI_MarkerDlg.h" +#include "GEOMToolsGUI_PublishDlg.h" +#include "GEOMToolsGUI_MaterialPropertiesDlg.h" +#include "GEOMToolsGUI_LineWidthDlg.h" +#include "Material_Model.h" #include +#include +#include #include #include #include +#include + #include #include @@ -53,6 +64,7 @@ #include #include #include +#include #include #include @@ -70,124 +82,66 @@ #include #include #include +#include +#include +#include + + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif // QT Includes +#include #include +#include +#include #include +#include +#include +#include +#include +#include + // VTK includes #include -void GEOMToolsGUI::OnSettingsColor() -{ - SUIT_Session* sess = SUIT_Session::session(); - SUIT_ResourceMgr* resMgr = sess->resourceMgr(); - SUIT_Desktop* desk = sess->activeApplication()->desktop(); - - QColor anInitColor = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "yellow" ) ); - - QColor aDialogColor = QColorDialog::getColor(anInitColor, desk ); - if( aDialogColor.isValid() ) - { - QString type = desk->activeWindow()->getViewManager()->getType(); - if( type != OCCViewer_Viewer::Type() && type != SVTK_Viewer::Type() ) - MESSAGE("Settings Color is not supported for current Viewer"); - - resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor ); - } -} - -void GEOMToolsGUI::OnRename() -{ - SALOME_ListIO selected; - SalomeApp_Application* app = - dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - if ( app ) { - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); - if ( aSelMgr && appStudy ) { - aSelMgr->selectedObjects( selected ); - if ( !selected.IsEmpty() ) { - _PTR(Study) aStudy = appStudy->studyDS(); - - bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); - if ( aLocked ) { - SUIT_MessageBox::warning ( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED") ); - return; - } - - bool isAny = false; // is there any appropriate object selected - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - - _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); - _PTR(GenericAttribute) anAttr; - if ( obj ) { - if ( obj->FindAttribute(anAttr, "AttributeName") ) { - _PTR(AttributeName) aName (anAttr); - - GEOM::GEOM_Object_var anObj = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); - if (!CORBA::is_nil(anObj)) { - isAny = true; - QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() ); - if (!newName.isEmpty()) { - aName->SetValue( newName.toLatin1().data() ); // rename the SObject - IObject->setName( newName.toLatin1().data() );// rename the InteractiveObject - anObj->SetName( newName.toLatin1().data() ); // Rename the corresponding GEOM_Object - (dynamic_cast(app->activeModule()))->updateObjBrowser( false ); - } - } // if ( anObj ) - } // if ( name attribute ) - } // if ( obj ) - } // iterator - - if (!isAny) { - SUIT_MessageBox::warning( app->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") ); - return; - } - } - } - } - - app->updateActions(); //SRN: To update a Save button in the toolbar -} - void GEOMToolsGUI::OnCheckGeometry() { - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication()); PyConsole_Console* pyConsole = app->pythonConsole(); - if(pyConsole) + if (pyConsole) pyConsole->exec("from GEOM_usinggeom import *"); } void GEOMToolsGUI::OnAutoColor() { SALOME_ListIO selected; - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - if( !app ) + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication()); + if (!app) return; LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); - if( !aSelMgr || !appStudy ) + SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); + if (!aSelMgr || !appStudy) return; - aSelMgr->selectedObjects( selected ); - if( selected.IsEmpty() ) + aSelMgr->selectedObjects(selected); + if (selected.IsEmpty()) return; Handle(SALOME_InteractiveObject) anIObject = selected.First(); _PTR(Study) aStudy = appStudy->studyDS(); - _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) ); + _PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry())); GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject)); - if( CORBA::is_nil( aMainObject ) ) + if (CORBA::is_nil(aMainObject)) return; aMainObject->SetAutoColor( true ); @@ -224,11 +178,11 @@ void GEOMToolsGUI::OnAutoColor() { SVTK_ViewWindow* vtkVW = dynamic_cast( window ); if ( !vtkVW ) - return; + return; SVTK_View* aView = vtkVW->getView(); SUIT_OverrideCursor(); for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) - aView->SetColor( It.Value(), c ); + aView->SetColor( It.Value(), c ); } else if ( isOCC ) { @@ -237,16 +191,16 @@ void GEOMToolsGUI::OnAutoColor() SOCC_Prs* anOCCPrs = dynamic_cast( aPrs ); if( !anOCCPrs ) - continue; + continue; AIS_ListOfInteractive aList; anOCCPrs->GetObjects( aList ); if( !aList.Extent() ) - continue; + continue; Handle(AIS_InteractiveObject) io = aList.First(); if( io.IsNull() ) - continue; + continue; Quantity_Color aQuanColor( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); @@ -257,12 +211,29 @@ void GEOMToolsGUI::OnAutoColor() Standard_Real aCurScale; Aspect_TypeOfMarker aCurTypeOfMarker; aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale ); - aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aQuanColor, aCurScale) ); + if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) { + aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aQuanColor, aCurScale) ); + } + else { + Standard_Integer aWidth, aHeight; + aCurPointAspect->GetTextureSize( aWidth, aHeight ); + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture(); +#else + Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture(); +#endif + + aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aQuanColor, 1, aWidth, aHeight, aTexture ) ); + } ic->SetLocalAttributes( io, aCurDrawer ); io->SetColor( aQuanColor ); - if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) - Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aQuanColor ); + if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) { + Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io ); + aGAISShape->SetShadingColor( aQuanColor ); + aGAISShape->storeBoundaryColors(); + } io->Redisplay( Standard_True ); } @@ -309,75 +280,176 @@ void GEOMToolsGUI::OnColor() if ( aSelMgr ) { aSelMgr->selectedObjects( selected ); if ( !selected.IsEmpty() ) { - SUIT_ViewWindow* window = app->desktop()->activeWindow(); - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); - if ( isVTK ) { - SVTK_ViewWindow* vtkVW = dynamic_cast( window ); - if ( !vtkVW ) - return; - SVTK_View* aView = vtkVW->getView(); - QColor initcolor = aView->GetColor( selected.First() ); - QColor c = QColorDialog::getColor( initcolor, app->desktop() ); - if ( c.isValid() ) { - SUIT_OverrideCursor(); - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - aView->SetColor( It.Value(), c ); - } - } - } // if ( isVTK ) - else if ( isOCC ) { - Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() ); - if ( !io.IsNull() ) { - Quantity_Color aColor; - io->Color( aColor ); - QColor initcolor( (int)( aColor.Red() * 255.0 ), (int)( aColor.Green() * 255.0 ), (int)( aColor.Blue() * 255.0 ) ); - QColor c = QColorDialog::getColor( initcolor, app->desktop() ); - if ( c.isValid() ) { - SUIT_OverrideCursor(); - aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - io = GEOMBase::GetAIS( It.Value(), true ); - if ( !io.IsNull() ) { - // Set color for a point - OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - Handle(AIS_Drawer) aCurDrawer = io->Attributes(); - Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect(); - Quantity_Color aCurColor; - Standard_Real aCurScale; - Aspect_TypeOfMarker aCurTypeOfMarker; - aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale ); - aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale) ); - ic->SetLocalAttributes(io, aCurDrawer); + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + int mgrId = window->getViewManager()->getGlobalId(); + if ( isVTK ) { + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); + if ( !vtkVW ) + return; + SVTK_View* aView = vtkVW->getView(); + QColor initcolor = aView->GetColor( selected.First() ); + QColor c = QColorDialog::getColor( initcolor, app->desktop() ); + if ( c.isValid() ) { + SUIT_OverrideCursor(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + QString matProp; + matProp = appStudy->getObjectProperty(mgrId,It.Value()->getEntry(), MATERIAL_PROP, matProp).toString(); + Material_Model material; + material.fromProperties( matProp ); + if ( !material.isPhysical() ) { + aView->SetColor( It.Value(), c ); + appStudy->setObjectProperty(mgrId,It.Value()->getEntry(),COLOR_PROP, c); + } + // store color to GEOM_Object + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) ); + GEOM::GEOM_Object_var anObject = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject)); + SALOMEDS::Color aSColor; + aSColor.R = (double)c.red() / 255.0; + aSColor.G = (double)c.green() / 255.0; + aSColor.B = (double)c.blue() / 255.0; + anObject->SetColor( aSColor ); + anObject->SetAutoColor( false ); + } + GeometryGUI::Modified(); + } + } // if ( isVTK ) + else if ( isOCC ) { + Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() ); + if ( !io.IsNull() ) { + Quantity_Color aColor; + io->Color( aColor ); + QColor ic = QColor((int )( aColor.Red() * 255.0 ), + (int)( aColor.Green() * 255.0 ), + (int)( aColor.Blue() * 255.0 )); + + QVariant v = appStudy->getObjectProperty(mgrId,selected.First()->getEntry(), COLOR_PROP, ic); + + QColor initcolor = v.value(); + QColor c = QColorDialog::getColor( initcolor, app->desktop() ); + if ( c.isValid() ) { + SUIT_OverrideCursor(); + aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); + OCCViewer_Viewer* vm = dynamic_cast ( window->getViewManager()->getViewModel() ); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + QString matProp; + matProp = appStudy->getObjectProperty(mgrId,It.Value()->getEntry(), MATERIAL_PROP, matProp).toString(); + Material_Model material; + material.fromProperties( matProp ); + io = GEOMBase::GetAIS( It.Value(), true ); + if ( !io.IsNull() && !material.isPhysical() ) { // change color only for shapes with not physical type of material + + if ( io->IsKind( STANDARD_TYPE(AIS_Shape) ) ) { + TopoDS_Shape theShape = Handle(AIS_Shape)::DownCast( io )->Shape(); + bool onlyVertex = (theShape.ShapeType() == TopAbs_VERTEX || GEOM_Displayer::isCompoundOfVertices( theShape )); + if (onlyVertex) { + // Set color for a point + + Handle(AIS_Drawer) aCurDrawer = io->Attributes(); + Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect(); + Quantity_Color aCurColor; + Standard_Real aCurScale; + Aspect_TypeOfMarker aCurTypeOfMarker; + aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale ); + if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) { + aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aCurTypeOfMarker, aColor, aCurScale)); + } + else { + Standard_Integer aWidth, aHeight; + aCurPointAspect->GetTextureSize( aWidth, aHeight ); + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture(); +#else + Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture(); +#endif + + aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aColor, 1, aWidth, aHeight, aTexture)); + } + ic->SetLocalAttributes(io, aCurDrawer, Standard_False); + } + } + + io->SetColor( aColor ); + if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) { + Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io ); + aGAISShape->SetShadingColor( aColor ); + aGAISShape->storeBoundaryColors(); + } + + appStudy->setObjectProperty(mgrId,It.Value()->getEntry(), COLOR_PROP, c); - io->SetColor( aColor ); - if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) - Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aColor ); - - io->Redisplay( Standard_True ); - - // store color to GEOM_Object - _PTR(Study) aStudy = appStudy->studyDS(); - _PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) ); - GEOM::GEOM_Object_var anObject = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject)); - - SALOMEDS::Color aSColor; - aSColor.R = (double)c.red() / 255.0; - aSColor.G = (double)c.green() / 255.0; - aSColor.B = (double)c.blue() / 255.0; - anObject->SetColor( aSColor ); - anObject->SetAutoColor( false ); - } - } - } // if c.isValid() - } // first IO is not null - } // if ( isOCC ) + io->Redisplay( Standard_True ); + + // store color to GEOM_Object + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) ); + GEOM::GEOM_Object_var anObject = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject)); + + + SALOMEDS::Color aSColor; + aSColor.R = (double)c.red() / 255.0; + aSColor.G = (double)c.green() / 255.0; + aSColor.B = (double)c.blue() / 255.0; + anObject->SetColor( aSColor ); + anObject->SetAutoColor( false ); + } + } // for + ic->UpdateCurrentViewer(); + GeometryGUI::Modified(); + } // if c.isValid() + } // first IO is not null + } // if ( isOCC ) } // if ( selection not empty ) } } - + + app->updateActions(); //SRN: To update a Save button in the toolbar +} + +void GEOMToolsGUI::OnTexture() +{ + SALOME_ListIO selected; + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if ( app && appStudy ) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( aSelMgr ) { + aSelMgr->selectedObjects( selected ); + if ( !selected.IsEmpty() ) { + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + if ( isOCC ) { + QString aTexture = QFileDialog::getOpenFileName(window,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES")); + if( !aTexture.isEmpty() ) + { + SUIT_OverrideCursor(); + OCCViewer_Viewer* vm = dynamic_cast ( window->getViewManager()->getViewModel() ); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + Handle(AIS_InteractiveObject) io ; + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + io = GEOMBase::GetAIS( It.Value(), true ); + if ( !io.IsNull() ) { + if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) + Handle(GEOM_AISShape)::DownCast( io )->SetTextureFileName(TCollection_AsciiString(aTexture.toStdString().c_str())); + io->Redisplay( Standard_True ); + } // if ( !io.IsNull() ) + } // for + ic->UpdateCurrentViewer(); + GeometryGUI::Modified(); + GeometryGUI* myGeomGUI = getGeometryGUI(); + myGeomGUI->OnGUIEvent(GEOMOp::OpTexture); + } // if ( !selFile.isEmpty() ) + } // if ( isOCC ) + } // if ( selection not empty ) + } + } + app->updateActions(); //SRN: To update a Save button in the toolbar } @@ -387,10 +459,93 @@ void GEOMToolsGUI::OnTransparency() dlg.exec(); } -void GEOMToolsGUI::OnNbIsos() +void GEOMToolsGUI::OnChangeTransparency( bool increase ) { - SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return; + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) + return; + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) + return; + + Handle(SALOME_InteractiveObject) FirstIOS = selected.First(); + if ( FirstIOS.IsNull() ) + return; + + // Delta + float delta = 0.1; // VSR: 23/11/2010 (transparency value <= 0.05 is ignored) + if ( !increase ) + delta *= -1; + + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + + if ( isVTK ) { + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); + if ( !vtkVW ) + return; + SVTK_View* aView = vtkVW->getView(); + + float transp = aView->GetTransparency(FirstIOS); + + // Compute new transparency value + transp = transp + delta; + if ( transp < 0 ) + transp = 0; + else if ( transp > 1 ) + transp = 1; + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + aView->SetTransparency( It.Value(), transp ); + } + aView->Repaint(); + GeometryGUI::Modified(); + } // if ( isVTK ) + + else if ( isOCC ) { + GEOMBase* gb = new GEOMBase(); + Handle(GEOM_AISShape) aisShape; + + aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, true ); + if( aisShape.IsNull() ) + return; + float transp = aisShape->Transparency(); + + // Compute new transparency value + transp = transp + delta; + if ( transp < 0 ) + transp = 0; + else if ( transp > 1 ) + transp = 1; + + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + if ( !vm ) + return; + Handle(AIS_InteractiveContext) ic = vm->getAISContext(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true ); + if ( !aisShape.IsNull() ) { + ic->SetTransparency( aisShape, transp, false ); + ic->Redisplay( aisShape, Standard_False, Standard_True ); + } + } // for... + ic->UpdateCurrentViewer(); + GeometryGUI::Modified(); + } // if ( isOCC ) +} + +void GEOMToolsGUI::OnNbIsos( ActionType actionType ) +{ + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* aStudy = dynamic_cast( app->activeStudy() ); + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); @@ -402,40 +557,72 @@ void GEOMToolsGUI::OnNbIsos() ic->InitCurrent(); if ( ic->MoreCurrent() ) { Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + CurObject->restoreIsoNumbers(); Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - + int UIso = CurDrawer->UIsoAspect()->Number(); int VIso = CurDrawer->VIsoAspect()->Number(); - - GEOMToolsGUI_NbIsosDlg * NbIsosDlg = - new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); - - NbIsosDlg->setU( UIso ); - NbIsosDlg->setV( VIso ); - - if ( NbIsosDlg->exec() ) { - SUIT_OverrideCursor(); - for(; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - - int nbUIso = NbIsosDlg->getU(); - int nbVIso = NbIsosDlg->getV(); - - CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) ); - CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) ); - - ic->SetLocalAttributes(CurObject, CurDrawer); - ic->Redisplay(CurObject); - } + + int newNbUIso = -1; + int newNbVIso = -1; + + if ( actionType == SHOWDLG ) { + GEOMToolsGUI_NbIsosDlg * NbIsosDlg = + new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); + + NbIsosDlg->setU( UIso ); + NbIsosDlg->setV( VIso ); + + if ( NbIsosDlg->exec() ) { + SUIT_OverrideCursor(); + + newNbUIso = NbIsosDlg->getU(); + newNbVIso = NbIsosDlg->getV(); + } else //Cancel case + return; + } + else if ( actionType == INCR || actionType == DECR ) { + int delta = 1; + if (actionType == DECR) + delta = -1; + + newNbUIso = UIso + delta; + newNbVIso = VIso + delta; + + if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) + return; + } + + for(; ic->MoreCurrent(); ic->NextCurrent()) { + int aMgrId = window->getViewManager()->getGlobalId(); + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + + Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); + + QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() ); + + int width = v.isValid() ? v.toInt() : 1; + + CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbUIso) ); + CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbVIso) ); + + CurObject->storeIsoNumbers(); + + ic->SetLocalAttributes(CurObject, CurDrawer); + ic->Redisplay(CurObject); + + QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso); + aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos); } } + GeometryGUI::Modified(); } else if(isVTK){ // if is VTKViewer // // Warning. It's works incorrect. must be recheked. // - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > + ( SUIT_Session::session()->activeApplication() ); if ( !app ) return; LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); @@ -445,7 +632,7 @@ void GEOMToolsGUI::OnNbIsos() aSelMgr->selectedObjects( selected ); if ( selected.IsEmpty() ) return; - + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); if ( !vtkVW ) return; @@ -453,147 +640,197 @@ void GEOMToolsGUI::OnNbIsos() SALOME_View* view = GEOM_Displayer::GetActiveView(); vtkActorCollection* aCollection = vtkActorCollection::New(); - + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { Handle(SALOME_InteractiveObject) anIObject = It.Value(); - SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() ); + SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() ); SVTK_Prs* vtkPrs = dynamic_cast( aPrs ); if ( vtkPrs ) { - vtkActorCollection* anActors = vtkPrs->GetObjects(); - anActors->InitTraversal(); - vtkActor* anAct = anActors->GetNextActor(); - aCollection->AddItem(anAct); + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + vtkActor* anAct = anActors->GetNextActor(); + aCollection->AddItem(anAct); } } - + if(aCollection) aCollection->InitTraversal(); else return; - + int UIso = 0; int VIso = 0; - + vtkActor* anAct = aCollection->GetNextActor(); - if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + anActor->RestoreIsoNumbers(); anActor->GetNbIsos(UIso,VIso); + } else return; - GEOMToolsGUI_NbIsosDlg* NbIsosDlg = - new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); + int newNbUIso = -1; + int newNbVIso = -1; - NbIsosDlg->setU( UIso ); - NbIsosDlg->setV( VIso ); + if ( actionType == SHOWDLG ) { + GEOMToolsGUI_NbIsosDlg* NbIsosDlg = + new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); - if ( NbIsosDlg->exec() ) { - SUIT_OverrideCursor(); + NbIsosDlg->setU( UIso ); + NbIsosDlg->setV( VIso ); + + if ( NbIsosDlg->exec() ) { + SUIT_OverrideCursor(); + + newNbUIso = NbIsosDlg->getU(); + newNbVIso = NbIsosDlg->getV(); + } else + return; //Cancel case + } + else if ( actionType == INCR || actionType == DECR ) { + int delta = 1; + if (actionType == DECR) + delta = -1; + + newNbUIso = UIso + delta; + newNbVIso = VIso + delta; - while( anAct!=NULL ) { - if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){ - // There are no casting to needed actor. - UIso = NbIsosDlg->getU(); - VIso = NbIsosDlg->getV(); - int aIsos[2]={UIso,VIso}; - anActor->SetNbIsos(aIsos); - } - anAct = aCollection->GetNextActor(); + if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) + return; + } + + while( anAct!=NULL ) { + if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){ + // There are no casting to needed actor. + int aIsos[2]={newNbUIso,newNbVIso}; + anActor->SetNbIsos(aIsos); + anActor->StoreIsoNumbers(); + + QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso); + int aMgrId = window->getViewManager()->getGlobalId(); + aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_PROP, anIsos); } + anAct = aCollection->GetNextActor(); } + view->Repaint(); + GeometryGUI::Modified(); } // end vtkviewer } -void GEOMToolsGUI::OnOpen() +void GEOMToolsGUI::OnDeflection() { -/* - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - - SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); - Handle(SALOME_InteractiveObject) anIObject; - for(;It.More();It.Next()) { - anIObject = It.Value(); - _PTR(SObject) obj ( aStudy->FindObjectID(anIObject->getEntry()) ); - _PTR(AttributePersistentRef) aPersist; - _PTR(AttributeIOR) anIOR; - if(obj) { - // this SObject may be GEOM module root SObject - _PTR(ChildIterator) anIter ( aStudy->NewChildIterator() ); - _PTR(GenericAttribute) anAttr; - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - _PTR(SObject) subobj ( anIter->Value() ); - if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) { - useSubItems = true; - obj = subobj; - } - else - anIter->Next(); - } - obj->FindAttribute(anAttr, "AttributePersistentRef"); - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - if(!obj->FindAttribute(anAttr, "AttributeIOR") && - obj->FindAttribute(anAttr, "AttributePersistentRef")) { - _PTR(SComponent) FComp ( obj->GetFatherComponent() ); - if (FComp) { - if (FComp->FindAttribute(anAttr, "AttributeName")) { - _PTR(AttributeName) aName ( anAttr ); - QString compName = QAD_Application::getDesktop()->getComponentName(aName->Value().c_str()); - // parent->loadComponentData(parent->getComponentName(aName->Value())); - Engines::Component_var comp ; - if ( compName.compare("SUPERV") == 0 ) { - comp = QAD_Application::getDesktop()->getEngine( "SuperVisionContainer", compName) ; - } - else { - comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", compName); - if ( comp->_is_nil() ) - comp = QAD_Application::getDesktop()->getEngine( "FactoryServerPy", compName); - } - - if (!CORBA::is_nil(comp)) { - SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); - if (!CORBA::is_nil(driver)) { - SALOMEDS::StudyBuilder_var B = dynamic_cast(aStudy.get())->GetStudy()->NewBuilder(); - if (!CORBA::is_nil(B)) { - B->LoadWith(FComp,driver); - } else { - return; - } - } - else { - MESSAGE("loadComponentData(): Driver is null"); - return; - } - } - else { - MESSAGE("loadComponentData(): Engine is null"); - return; - } - // // load - // Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer","GEOM"); - // if (!CORBA::is_nil(comp)) { - // SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); - // SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - // SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM"); - // if (!CORBA::is_nil(SC)) - // aStudyBuilder->LoadWith(SC,driver); - } - } - else { - MESSAGE("Component is null"); - } - } - if(useSubItems) { - anIter->Next(); - obj.reset( anIter->Value() ); - } - else - anAttr = NULL; + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + + + bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); + bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type()); + int mgrId = window->getViewManager()->getGlobalId(); + + if (isOCC) { // if is OCCViewer + OCCViewer_Viewer* vm = dynamic_cast(window->getViewManager()->getViewModel()); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + + ic->InitCurrent(); + if (ic->MoreCurrent()) { + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + + Standard_Real aDC, aPrevDC; + Standard_Boolean isOwnDC = CurObject->OwnDeviationCoefficient(aDC, aPrevDC); + if (!isOwnDC) + aDC = ic->DeviationCoefficient(); + + GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg + (SUIT_Session::session()->activeApplication()->desktop()); + DeflectionDlg->setTheDC(aDC); + double aNewDC = 0.0; + bool ok = false; + while (!ok) { + if (DeflectionDlg->exec()) { + SUIT_OverrideCursor(); + aNewDC = DeflectionDlg->getTheDC(); + ok = (1e-07 <= aNewDC && aNewDC <= 1.0); // spinbox can return zero + if (ok) { + for (; ic->MoreCurrent(); ic->NextCurrent()) { + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True); + ic->Redisplay(CurObject); + appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aNewDC); + } + } + } + else { + ok = true; + } } } + GeometryGUI::Modified(); } -*/ + else if (isVTK) { // if is VTKViewer + SalomeApp_Application* app = dynamic_cast + (SUIT_Session::session()->activeApplication()); + if (!app) + return; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if (!aSelMgr) + return; + + SALOME_ListIO selected; + aSelMgr->selectedObjects(selected); + if (selected.IsEmpty()) + return; + + SVTK_ViewWindow* vtkVW = dynamic_cast(window); + if (!vtkVW) + return; + + SALOME_View* view = GEOM_Displayer::GetActiveView(); + + vtkActorCollection* aCollection = vtkActorCollection::New(); + + for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) anIObject = It.Value(); + SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry()); + SVTK_Prs* vtkPrs = dynamic_cast(aPrs); + if (vtkPrs) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + vtkActor* anAct = anActors->GetNextActor(); + aCollection->AddItem(anAct); + } + } + + if (aCollection) + aCollection->InitTraversal(); + else + return; + + double aDC = 0.; + + vtkActor* anAct = aCollection->GetNextActor(); + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) + aDC = anActor->GetDeflection(); + else + return; + + GEOMToolsGUI_DeflectionDlg* DeflectionDlg = new GEOMToolsGUI_DeflectionDlg + (SUIT_Session::session()->activeApplication()->desktop()); + DeflectionDlg->setTheDC(aDC); + if (DeflectionDlg->exec()) { + SUIT_OverrideCursor(); + aDC = DeflectionDlg->getTheDC(); + while (anAct != NULL) { + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + // There are no casting to needed actor. + anActor->SetDeflection(aDC); + appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aDC); + } + anAct = aCollection->GetNextActor(); + } + } + GeometryGUI::Modified(); + } // end vtkviewer } void GEOMToolsGUI::OnSelectOnly(int mode) @@ -606,3 +843,496 @@ void GEOMToolsGUI::OnSelectOnly(int mode) getGeometryGUI()->setLocalSelectionMode(mode); } } + +void GEOMToolsGUI::OnShowHideChildren( bool show ) +{ + SALOME_ListIO selected; + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + + SalomeApp_Module* mod = app ? dynamic_cast(app->activeModule()) : 0; + + GEOM_Displayer* disp = mod ? dynamic_cast(mod->displayer()) : 0; + + if ( app && disp ) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if ( aSelMgr && appStudy ) { + aSelMgr->selectedObjects( selected ); + if ( !selected.IsEmpty() ) { + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(StudyBuilder) B = aStudy->NewBuilder(); + + bool aLocked = ( _PTR(AttributeStudyProperties)( aStudy->GetProperties() ) )->IsLocked(); + if ( aLocked ) { + SUIT_MessageBox::warning( app->desktop(), + QObject::tr( "WRN_WARNING" ), + QObject::tr( "WRN_STUDY_LOCKED" ) ); + return; + } + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + + _PTR(SObject) obj ( aStudy->FindObjectID( IObject->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj ) { + _PTR(AttributeExpandable) aExp = B->FindOrCreateAttribute( obj, "AttributeExpandable" ); + aExp->SetExpandable( show ); + if(!show) + disp->EraseWithChildren(IObject,true); + } // if ( obj ) + } // iterator + } + } + app->updateObjectBrowser( false ); + app->updateActions(); + } +} + +void GEOMToolsGUI::OnPointMarker() +{ + GEOMToolsGUI_MarkerDlg dlg( SUIT_Session::session()->activeApplication()->desktop() ); + dlg.exec(); +} + +void GEOMToolsGUI::OnMaterialProperties() +{ + GEOMToolsGUI_MaterialPropertiesDlg dlg( SUIT_Session::session()->activeApplication()->desktop() ); + dlg.exec(); +} + +void GEOMToolsGUI::OnUnpublishObject() { + SALOME_ListIO selected; + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + + SalomeApp_Module* mod = app ? dynamic_cast(app->activeModule()) : 0; + + GEOM_Displayer* disp = mod ? dynamic_cast(mod->displayer()) : 0; + + if ( app && disp ) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if ( aSelMgr && appStudy ) { + aSelMgr->selectedObjects( selected ); + if ( !selected.IsEmpty() ) { + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(StudyBuilder) B = aStudy->NewBuilder(); + + bool aLocked = ( _PTR(AttributeStudyProperties)( aStudy->GetProperties() ) )->IsLocked(); + if ( aLocked ) { + SUIT_MessageBox::warning( app->desktop(), + QObject::tr( "WRN_WARNING" ), + QObject::tr( "WRN_STUDY_LOCKED" ) ); + return; + } + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + + _PTR(SObject) obj ( aStudy->FindObjectID( IObject->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj ) { + _PTR(AttributeDrawable) aDrw = B->FindOrCreateAttribute( obj, "AttributeDrawable" ); + aDrw->SetDrawable( false ); + disp->EraseWithChildren(IObject); + } // if ( obj ) + } // iterator + aSelMgr->clearSelected(); + } + } + app->updateObjectBrowser( false ); + app->updateActions(); + } + +} + +void GEOMToolsGUI::OnPublishObject() { + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if(!app) + return; + + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if(!appStudy) + return; + + _PTR(Study) aStudy = appStudy->studyDS(); + + if(!aStudy) + return; + + //Check lock of the study + bool aLocked = ( _PTR(AttributeStudyProperties)( aStudy->GetProperties() ) )->IsLocked(); + if ( aLocked ) { + SUIT_MessageBox::warning( app->desktop(), + QObject::tr( "WRN_WARNING" ), + QObject::tr( "WRN_STUDY_LOCKED" ) ); + return; + } + + GEOMToolsGUI_PublishDlg * publishDlg = + new GEOMToolsGUI_PublishDlg( SUIT_Session::session()->activeApplication()->desktop() ); + publishDlg->exec(); +} + + +void GEOMToolsGUI::OnEdgeWidth() +{ + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + + + bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); + bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type()); + int mgrId = window->getViewManager()->getGlobalId(); + + if (isOCC) { // if is OCCViewer + OCCViewer_Viewer* vm = dynamic_cast(window->getViewManager()->getViewModel()); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + SALOME_View* view = GEOM_Displayer::GetActiveView(); + ic->InitCurrent(); + if (ic->MoreCurrent()) { + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + + int aWidth = (int)CurObject->Width(); + + GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg + (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT"); + Dlg->setTheLW(aWidth); + int aNewWidth = 0; + if (Dlg->exec()) { + aNewWidth = Dlg->getTheLW(); + bool ok = (aNewWidth != aWidth && aNewWidth != 0 ); + if (ok) { + for(; ic->MoreCurrent(); ic->NextCurrent()) { + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + SOCC_Prs* aPrs = dynamic_cast(view->CreatePrs(CurObject->getIO()->getEntry())); + AIS_ListOfInteractive anAISObjects; + aPrs->GetObjects( anAISObjects ); + AIS_ListIteratorOfListOfInteractive aIter( anAISObjects ); + for ( ; aIter.More(); aIter.Next() ) { + Handle(SALOME_AISShape) cur = Handle(SALOME_AISShape)::DownCast(aIter.Value()); + if ( !cur.IsNull() ) { + cur->SetWidth(aNewWidth); + ic->Redisplay(cur); + } + } + appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth); + } + } + } + } + else { + return; + } + GeometryGUI::Modified(); + } + else if (isVTK) { // if is VTKViewer + SalomeApp_Application* app = dynamic_cast + (SUIT_Session::session()->activeApplication()); + if (!app) + return; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if (!aSelMgr) + return; + + SALOME_ListIO selected; + aSelMgr->selectedObjects(selected); + if (selected.IsEmpty()) + return; + + SVTK_ViewWindow* vtkVW = dynamic_cast(window); + if (!vtkVW) + return; + + SALOME_View* view = GEOM_Displayer::GetActiveView(); + + vtkActorCollection* aCollection = vtkActorCollection::New(); + + for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) anIObject = It.Value(); + SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry()); + SVTK_Prs* vtkPrs = dynamic_cast(aPrs); + if (vtkPrs) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + vtkActor* anAct = anActors->GetNextActor(); + aCollection->AddItem(anAct); + } + } + + if (aCollection) + aCollection->InitTraversal(); + else + return; + + int aWidth = 1; + + vtkActor* anAct = aCollection->GetNextActor(); + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) + aWidth = anActor->GetWidth(); + else + return; + + GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg + (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT"); + + Dlg->setTheLW(aWidth); + if (Dlg->exec()) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + while (anAct != NULL) { + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + // There are no casting to needed actor. + anActor->SetWidth(aWidth); + appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), EDGE_WIDTH_PROP, aWidth); + } + anAct = aCollection->GetNextActor(); + } + } + GeometryGUI::Modified(); + } // end vtkviewer +} + + +void GEOMToolsGUI::OnIsosWidth() { + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* aStudy = dynamic_cast( app->activeStudy() ); + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + + if(isOCC){ // if is OCCViewer + + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + + ic->InitCurrent(); + if ( ic->MoreCurrent() ) { + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + CurObject->restoreIsoNumbers(); + Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); + + Handle(Graphic3d_AspectLine3d) asp = CurDrawer->UIsoAspect()->Aspect(); + + Quantity_Color C; + Aspect_TypeOfLine T; + Standard_Real W; + asp->Values(C,T,W); + + int aWidth = (int)W; + + GEOMToolsGUI_LineWidthDlg * Dlg = + new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(),"ISOS_WIDTH_TLT" ); + + Dlg->setTheLW( aWidth ); + + if ( Dlg->exec() ) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + } else //Cancel case + return; + + for(; ic->MoreCurrent(); ic->NextCurrent()) { + int aMgrId = window->getViewManager()->getGlobalId(); + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + + Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); + + CurObject->Attributes()->UIsoAspect()->SetWidth(aWidth); + CurObject->Attributes()->VIsoAspect()->SetWidth(aWidth); + + ic->Redisplay(CurObject); + + aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth); + } + GeometryGUI::Modified(); + } + } + else if(isVTK){ // if is VTKViewer + // + // Warning. It's works incorrect. must be recheked. + // + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > + ( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return; + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) + return; + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) + return; + + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); + if ( !vtkVW ) + return; + + SALOME_View* view = GEOM_Displayer::GetActiveView(); + + vtkActorCollection* aCollection = vtkActorCollection::New(); + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) anIObject = It.Value(); + SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() ); + SVTK_Prs* vtkPrs = dynamic_cast( aPrs ); + if ( vtkPrs ) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + vtkActor* anAct = anActors->GetNextActor(); + aCollection->AddItem(anAct); + } + } + + if(aCollection) + aCollection->InitTraversal(); + else + return; + + int aWidth = 1; + + vtkActor* anAct = aCollection->GetNextActor(); + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + aWidth = anActor->GetIsosWidth(); + } + else + return; + + GEOMToolsGUI_LineWidthDlg* Dlg = + new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "ISOS_WIDTH_TLT" ); + + Dlg->setTheLW( aWidth ); + if (Dlg->exec() ) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + } else + return; //Cancel case + + while( anAct!= NULL ) { + if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { + // There are no casting to needed actor. + anActor->SetIsosWidth(aWidth); + int aMgrId = window->getViewManager()->getGlobalId(); + aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth); + } + anAct = aCollection->GetNextActor(); + } + + view->Repaint(); + GeometryGUI::Modified(); + } // end vtkviewer +} + +void GEOMToolsGUI::OnBringToFront() { + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return; + + SalomeApp_Module* mod = dynamic_cast(app->activeModule()); + if(!mod) + return; + + GEOM_Displayer* disp = dynamic_cast(mod->displayer()); + + if(!disp) + return; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) + return; + + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) + return; + + SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); + if(!appStudy) + return; + + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + if ( !vm ) + return; + + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + + QAction* a = getGeometryGUI()->getAction( GEOMOp::OpBringToFront ); + bool checked = a->isChecked(); + + if ( isOCC ) { + GEOMBase* gb = new GEOMBase(); + Handle(GEOM_AISShape) aisShape; + + Handle(AIS_InteractiveContext) ic = vm->getAISContext(); + SALOME_ListIO anIOlst; + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true ); + if ( !aisShape.IsNull() ) { + aisShape->setTopLevel(checked); + int aMgrId = window->getViewManager()->getGlobalId(); + appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), TOP_LEVEL_PROP, checked ); + anIOlst.Append(aisShape->getIO()); + } + } // for... + disp->Redisplay(anIOlst); + GeometryGUI::Modified(); + } // if ( isOCC ) +} + +void GEOMToolsGUI::OnClsBringToFront() { + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if(!app) + return; + + SalomeApp_Module* mod = dynamic_cast(app->activeModule()); + if(!mod) + return; + + GEOM_Displayer* disp = dynamic_cast(mod->displayer()); + + if(!disp) + return; + + + SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); + if(!appStudy) + return; + + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + + if(isOCC){ // if is OCCViewer + + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + + SALOME_ListIO anIOlst; + AIS_ListOfInteractive aList; + ic->DisplayedObjects( aList ); + for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() ) { + + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(it.Value()); + + if(CurObject.IsNull()) + continue; + + CurObject->setTopLevel(Standard_False); + + int aMgrId = window->getViewManager()->getGlobalId(); + appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), TOP_LEVEL_PROP, Standard_False ); + anIOlst.Append(CurObject->getIO()); + } + disp->Redisplay(anIOlst); + GeometryGUI::Modified(); + } +} + diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx new file mode 100644 index 000000000..428c91c47 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx @@ -0,0 +1,196 @@ +// Copyright (C) 2007-2012 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 +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI_DeflectionDlg.cxx +// Author : OCC Team +// +#include "GEOMToolsGUI_DeflectionDlg.h" +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//================================================================================= +// class : GEOMToolsGUI_DeflectionDlg() +// purpose : Constructs a GEOMToolsGUI_DeflectionDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GEOMToolsGUI_DeflectionDlg::GEOMToolsGUI_DeflectionDlg (QWidget* parent) + : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +{ + setObjectName("GEOMToolsGUI_DeflectionDlg"); + setModal(true); + + setWindowTitle(tr("GEOM_DEFLECTION_TLT")); + setSizeGripEnabled(TRUE); + QGridLayout* MyDialogLayout = new QGridLayout(this); + MyDialogLayout->setSpacing(6); + MyDialogLayout->setMargin(11); + + /***************************************************************/ + QGroupBox* GroupC1 = new QGroupBox (this); + GroupC1->setObjectName("GroupC1"); + QGridLayout* GroupC1Layout = new QGridLayout (GroupC1); + GroupC1Layout->setAlignment(Qt::AlignTop); + GroupC1Layout->setSpacing(6); + GroupC1Layout->setMargin(11); + + QLabel* TextLabel1 = new QLabel (GroupC1); + TextLabel1->setObjectName("TextLabel1"); + TextLabel1->setText(tr("GEOM_DEFLECTION")); + GroupC1Layout->addWidget(TextLabel1, 0, 0); + + SpinBox = new SalomeApp_DoubleSpinBox (GroupC1); + // Obtain precision from preferences + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + const char* quantity = "parametric_precision"; + int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 ); + SpinBox->setAcceptNames( false ); + SpinBox->setPrecision( aPrecision ); + SpinBox->setDecimals( aPrecision ); + SpinBox->setRange( DEFLECTION_MIN, 1.0 ); + SpinBox->setSingleStep( 1.0e-04 ); + // Add a hint for the user saying how to tune precision + QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() ); + SpinBox->setProperty( "validity_tune_hint", + QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) ); + + SpinBox->setObjectName("SpinBoxU"); + SpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + SpinBox->setValue(1.0e-04); + GroupC1Layout->addWidget(SpinBox, 0, 1); + + /***************************************************************/ + QGroupBox* GroupButtons = new QGroupBox (this); + GroupButtons->setObjectName("GroupButtons"); + QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons); + GroupButtonsLayout->setAlignment(Qt::AlignTop); + GroupButtonsLayout->setSpacing(6); + GroupButtonsLayout->setMargin(11); + + QPushButton* buttonOk = new QPushButton (GroupButtons); + buttonOk->setObjectName("buttonOk"); + buttonOk->setText(tr("GEOM_BUT_OK")); + buttonOk->setAutoDefault(TRUE); + buttonOk->setDefault(TRUE); + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + + GroupButtonsLayout->addItem(new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + + QPushButton* buttonCancel = new QPushButton (GroupButtons); + buttonCancel->setObjectName("buttonCancel"); + buttonCancel->setText(tr("GEOM_BUT_CANCEL")); + buttonCancel->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonCancel, 0, 1); + + QPushButton* buttonHelp = new QPushButton (GroupButtons); + buttonHelp->setObjectName("buttonHelp"); + buttonHelp->setText(tr("GEOM_BUT_HELP")); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 2); + /***************************************************************/ + + MyDialogLayout->addWidget(GroupC1, 0, 0); + MyDialogLayout->addWidget(GroupButtons, 1, 0); + + myHelpFileName = "deflection_page.html"; + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + + // Move widget on the botton right corner of main widget + SUIT_Tools::centerWidget(this, parent); +} + +//================================================================================= +// function : ~GEOMToolsGUI_DeflectionDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GEOMToolsGUI_DeflectionDlg::~GEOMToolsGUI_DeflectionDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +double GEOMToolsGUI_DeflectionDlg::getTheDC() const +{ + return SpinBox->text().toDouble(); +} + +void GEOMToolsGUI_DeflectionDlg::setTheDC (const double v) +{ + SpinBox->setValue(v); +} + +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void GEOMToolsGUI_DeflectionDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + GeometryGUI* aGeomGUI = dynamic_cast(app->module("Geometry")); + app->onHelpContextModule(aGeomGUI ? app->moduleName(aGeomGUI->moduleName()) : QString(""), myHelpFileName); + } + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning + (0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void GEOMToolsGUI_DeflectionDlg::keyPressEvent (QKeyEvent* e) +{ + QDialog::keyPressEvent(e); + if (e->isAccepted()) + return; + + if (e->key() == Qt::Key_F1) { + e->accept(); + ClickOnHelp(); + } +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.h new file mode 100644 index 000000000..99778e9a5 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.h @@ -0,0 +1,59 @@ +// Copyright (C) 2007-2012 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 +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI_DeflectionDlg.h +// Author : OCC Team +// +#ifndef GEOMTOOLSGUI_DEFLECTIONDLG_H +#define GEOMTOOLSGUI_DEFLECTIONDLG_H + +#include "GEOM_ToolsGUI.hxx" + +#include + +class SalomeApp_DoubleSpinBox; + +//================================================================================= +// class : GEOMToolsGUI_DeflectionDlg +// purpose : +//================================================================================= +class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_DeflectionDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMToolsGUI_DeflectionDlg( QWidget* ); + ~GEOMToolsGUI_DeflectionDlg(); + + double getTheDC() const; + void setTheDC( const double ); + +private slots: + void ClickOnHelp(); + +private: + void keyPressEvent( QKeyEvent* ); + +private: + SalomeApp_DoubleSpinBox* SpinBox; + QString myHelpFileName; +}; + +#endif // GEOMTOOLSGUI_DEFLECTIONDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.cxx index 9a350496f..f6e065984 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMToolsGUI_DeleteDlg.cxx // Author : Dmitry Matveitchev, Open CASCADE S.A.S. @@ -26,7 +24,7 @@ #include "GEOMToolsGUI_DeleteDlg.h" #include -#include +#include #include #include #include @@ -73,10 +71,12 @@ static QStringList objectsToNames( const QMap& objects ) /*! \brief Constructor. \param parent parent widget + \param objects map of objects names/objects + \param deleteAll if True, delete all objects */ GEOMToolsGUI_DeleteDlg::GEOMToolsGUI_DeleteDlg( QWidget* parent, - const QMap& objects, - bool deleteAll ) + const QMap& objects, + bool deleteAll ) : QDialog( parent ) { setModal( true ); @@ -110,21 +110,13 @@ GEOMToolsGUI_DeleteDlg::GEOMToolsGUI_DeleteDlg( QWidget* parent, lab->setText( tr( "GEOM_REALLY_DELETE_ALL" ) ); } - QPushButton* buttonYes = new QPushButton( tr( "GEOM_BUT_YES" ), this ); - QPushButton* buttonNo = new QPushButton( tr( "GEOM_BUT_NO" ), this ); - QHBoxLayout* btnLayout = new QHBoxLayout; - btnLayout->setMargin( 0 ); - btnLayout->setSpacing( 6 ); - btnLayout->addWidget( buttonYes ); - btnLayout->addSpacing( 10 ); - btnLayout->addStretch(); - btnLayout->addWidget( buttonNo ); + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Yes + | QDialogButtonBox::No); int rc = topLayout->rowCount(); - topLayout->addLayout( btnLayout, rc, 0, 1, 2 ); + topLayout->addWidget( buttonBox, rc, 1, 1, 1 ); - /* signals and slots connections */ - connect( buttonYes, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( buttonNo, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); } GEOMToolsGUI_DeleteDlg::~GEOMToolsGUI_DeleteDlg() diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.h index 2e5e906e1..8db7d4c27 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_DeleteDlg.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMToolsGUI_DeleteDlg.h // Author : Dmitry Matveitchev, Open CASCADE S.A.S. diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx new file mode 100644 index 000000000..478cc5710 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx @@ -0,0 +1,192 @@ +// Copyright (C) 2007-2012 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 +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI_LineWidthDlg.cxx +// Author : OCC Team +// +#include "GEOMToolsGUI_LineWidthDlg.h" +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : GEOMToolsGUI_LineWidthDlg() +// purpose : Constructs a GEOMToolsGUI_LineWidthDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= + +GEOMToolsGUI_LineWidthDlg::GEOMToolsGUI_LineWidthDlg (QWidget* parent, const QString& title) + : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +{ + setObjectName("GEOMToolsGUI_LineWidthDlg"); + setModal(true); + + setWindowTitle(tr(title.toLatin1().constData())); + setSizeGripEnabled(TRUE); + QGridLayout* MyDialogLayout = new QGridLayout(this); + MyDialogLayout->setSpacing(6); + MyDialogLayout->setMargin(11); + + + /***************************************************************/ + QGroupBox* GroupC1 = new QGroupBox (this); + GroupC1->setObjectName("GroupC1"); + QGridLayout* GroupC1Layout = new QGridLayout (GroupC1); + GroupC1Layout->setAlignment(Qt::AlignTop); + GroupC1Layout->setSpacing(6); + GroupC1Layout->setMargin(11); + + QLabel* TextLabel1 = new QLabel (GroupC1); + TextLabel1->setObjectName("TextLabel1"); + TextLabel1->setText(tr("GEOM_LINE_WIDTH")); + GroupC1Layout->addWidget(TextLabel1, 0, 0); + + + mySpinBox = new SalomeApp_IntSpinBox (GroupC1); + mySpinBox->setRange( 1, 5 ); + mySpinBox->setSingleStep( 1 ); + + mySpinBox->setObjectName("SpinBoxU"); + mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + mySpinBox->setValue(1); + GroupC1Layout->addWidget(mySpinBox, 0, 1); + + + /***************************************************************/ + QGroupBox* GroupButtons = new QGroupBox (this); + GroupButtons->setObjectName("GroupButtons"); + QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons); + GroupButtonsLayout->setAlignment(Qt::AlignTop); + GroupButtonsLayout->setSpacing(6); + GroupButtonsLayout->setMargin(11); + + QPushButton* buttonOk = new QPushButton (GroupButtons); + buttonOk->setObjectName("buttonOk"); + buttonOk->setText(tr("GEOM_BUT_OK")); + buttonOk->setAutoDefault(TRUE); + buttonOk->setDefault(TRUE); + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + + GroupButtonsLayout->addItem(new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + + QPushButton* buttonCancel = new QPushButton (GroupButtons); + buttonCancel->setObjectName("buttonCancel"); + buttonCancel->setText(tr("GEOM_BUT_CANCEL")); + buttonCancel->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonCancel, 0, 1); + + QPushButton* buttonHelp = new QPushButton (GroupButtons); + buttonHelp->setObjectName("buttonHelp"); + buttonHelp->setText(tr("GEOM_BUT_HELP")); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 2); + /***************************************************************/ + + MyDialogLayout->addWidget(GroupC1, 0, 0); + MyDialogLayout->addWidget(GroupButtons, 1, 0); + + myHelpFileName = "line_width_page.html"; + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + + // Move widget on the botton right corner of main widget + SUIT_Tools::centerWidget(this, parent); +} + + +//================================================================================= +// function : ~GEOMToolsGUI_LineWidthDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GEOMToolsGUI_LineWidthDlg::~GEOMToolsGUI_LineWidthDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +int GEOMToolsGUI_LineWidthDlg::getTheLW() const +{ + return mySpinBox->text().toInt(); +} + +void GEOMToolsGUI_LineWidthDlg::setTheLW (const int v) +{ + mySpinBox->setValue(v); +} + + +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void GEOMToolsGUI_LineWidthDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + GeometryGUI* aGeomGUI = dynamic_cast(app->module("Geometry")); + app->onHelpContextModule(aGeomGUI ? app->moduleName(aGeomGUI->moduleName()) : QString(""), myHelpFileName); + } + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning + (0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void GEOMToolsGUI_LineWidthDlg::keyPressEvent (QKeyEvent* e) +{ + QDialog::keyPressEvent(e); + if (e->isAccepted()) + return; + + if (e->key() == Qt::Key_F1) { + e->accept(); + ClickOnHelp(); + } +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h new file mode 100644 index 000000000..5efa2e25a --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h @@ -0,0 +1,59 @@ +// Copyright (C) 2007-2012 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 +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : GEOMToolsGUI_DeflectionDlg.h +// Author : OCC Team +// +#ifndef GEOMTOOLSGUI_LINEWIDTHDLG_H +#define GEOMTOOLSGUI_LINEWIDTHDLG_H + +#include "GEOM_ToolsGUI.hxx" + +#include + +class SalomeApp_IntSpinBox; + +//================================================================================= +// class : GEOMToolsGUI_LineWidthDlg +// purpose : +//================================================================================= +class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_LineWidthDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMToolsGUI_LineWidthDlg( QWidget*, const QString& ); + ~GEOMToolsGUI_LineWidthDlg(); + + int getTheLW() const; + void setTheLW( const int ); + +private slots: + void ClickOnHelp(); + +private: + void keyPressEvent( QKeyEvent* ); + +private: + SalomeApp_IntSpinBox* mySpinBox; + QString myHelpFileName; +}; + +#endif // GEOMTOOLSGUI_LINEWIDTHDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx new file mode 100644 index 000000000..4ba147b78 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx @@ -0,0 +1,393 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOMToolsGUI_MarkerDlg.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#include "GEOMToolsGUI_MarkerDlg.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MARGIN 9 +#define SPACING 6 + +GEOMToolsGUI_MarkerDlg::GEOMToolsGUI_MarkerDlg( QWidget* parent ) + : QDialog ( parent ) +{ + setWindowTitle( tr( "SET_MARKER_TLT" ) ); + setSizeGripEnabled( true ); + setModal( true ); + + // --- + + QRadioButton* aStandardTypeRB = new QRadioButton( tr( "STANDARD_MARKER" ), this ); + QRadioButton* aCustomTypeRB = new QRadioButton( tr( "CUSTOM_MARKER" ), this ); + myTypeGroup = new QButtonGroup( this ); + myTypeGroup->addButton( aStandardTypeRB, 0 ); + myTypeGroup->addButton( aCustomTypeRB, 1 ); + + QHBoxLayout* aRadioLayout = new QHBoxLayout; + aRadioLayout->setMargin( 0 ); + aRadioLayout->setSpacing( SPACING ); + aRadioLayout->addWidget( aStandardTypeRB ); + aRadioLayout->addWidget( aCustomTypeRB ); + + // --- + + myWGStack = new QStackedWidget( this ); + myWGStack->setFrameStyle( QFrame::Box | QFrame::Sunken ); + + // --- + + QWidget* aStdWidget = new QWidget( myWGStack ); + + QLabel* aTypeLab = new QLabel( tr( "TYPE" ), aStdWidget ); + QLabel* aScaleLab = new QLabel( tr( "SCALE" ), aStdWidget ); + + myStdTypeCombo = new QtxComboBox( aStdWidget ); + myStdScaleCombo = new QtxComboBox( aStdWidget ); + + QGridLayout* aStdLayout = new QGridLayout; + aStdLayout->setMargin( MARGIN ); + aStdLayout->setSpacing( SPACING ); + aStdLayout->addWidget( aTypeLab, 0, 0 ); + aStdLayout->addWidget( myStdTypeCombo, 0, 1 ); + aStdLayout->addWidget( aScaleLab, 1, 0 ); + aStdLayout->addWidget( myStdScaleCombo, 1, 1 ); + aStdWidget->setLayout( aStdLayout ); + + // --- + + QWidget* aCustomWidget = new QWidget( myWGStack ); + + QLabel* aCustomLab = new QLabel( tr( "CUSTOM" ), aCustomWidget ); + myCustomTypeCombo = new QtxComboBox( aCustomWidget ); + QPushButton* aBrowseBtn = new QPushButton( tr( "BROWSE" ), aCustomWidget ); + + QGridLayout* aCustomLayout = new QGridLayout; + aCustomLayout->setMargin( MARGIN ); + aCustomLayout->setSpacing( SPACING ); + aCustomLayout->addWidget( aCustomLab, 0, 0 ); + aCustomLayout->addWidget( myCustomTypeCombo, 0, 1 ); + aCustomLayout->addWidget( aBrowseBtn, 0, 2 ); + aCustomLayout->setRowStretch( 1, 5 ); + aCustomWidget->setLayout( aCustomLayout ); + + // --- + + myWGStack->insertWidget( 0, aStdWidget ); + myWGStack->insertWidget( 1, aCustomWidget ); + + // --- + + QPushButton* aOkBtn = new QPushButton( tr( "OK_BTN" ), this ); + aOkBtn->setAutoDefault( true ); aOkBtn->setDefault( true ); + QPushButton* aCancelBtn = new QPushButton( tr( "CANCEL_BTN" ), this ); + aCancelBtn->setAutoDefault( true ); + QPushButton* aHelpBtn = new QPushButton( tr( "HELP_BTN" ), this ); + aHelpBtn->setAutoDefault( true ); + + QHBoxLayout* aBtnLayout = new QHBoxLayout; + aBtnLayout->setMargin( 0 ); + aBtnLayout->setSpacing( SPACING ); + aBtnLayout->addWidget( aOkBtn ); + aBtnLayout->addSpacing( 10 ); + aBtnLayout->addStretch(); + aBtnLayout->addWidget( aCancelBtn ); + aBtnLayout->addWidget( aHelpBtn ); + + // --- + + QVBoxLayout* aTopLayout = new QVBoxLayout; + aTopLayout->setMargin( MARGIN ); + aTopLayout->setSpacing( SPACING ); + aTopLayout->addLayout( aRadioLayout ); + aTopLayout->addWidget( myWGStack ); + aTopLayout->addLayout( aBtnLayout ); + setLayout( aTopLayout ); + + // --- + + connect( myTypeGroup, SIGNAL( buttonClicked( int ) ), myWGStack, SLOT( setCurrentIndex( int ) ) ); + connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( browse() ) ); + connect( aOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( aHelpBtn, SIGNAL( clicked() ), this, SLOT( help() ) ); + + // --- + + aStandardTypeRB->setChecked( true ); + init(); +} + +GEOMToolsGUI_MarkerDlg::~GEOMToolsGUI_MarkerDlg() +{ + myOperation->UnRegister(); +} + +void GEOMToolsGUI_MarkerDlg::setStandardMarker( GEOM::marker_type type, GEOM::marker_size size ) +{ + if ( type > GEOM::MT_NONE && type < GEOM::MT_USER ) { + myTypeGroup->button( 0 )->setChecked( true ); + myWGStack->setCurrentIndex( 0 ); + myStdTypeCombo->setCurrentIndex( (int)type - 1 ); +#ifdef WNT + int asize = max( (int)GEOM::MS_10, min( (int)GEOM::MS_70, (int)size ) ); +#else + int asize = std::max( (int)GEOM::MS_10, std::min( (int)GEOM::MS_70, (int)size ) ); +#endif + myStdScaleCombo->setCurrentIndex( asize-1 ); + } +} + +void GEOMToolsGUI_MarkerDlg::setCustomMarker( int id ) +{ + if ( id > 0 ) { + myTypeGroup->button( 1 )->setChecked( true ); + myWGStack->setCurrentIndex( 1 ); + addTexture( id ); + myCustomTypeCombo->setCurrentId( id ); + } +} + +GEOM::marker_type GEOMToolsGUI_MarkerDlg::getMarkerType() const +{ + return myWGStack->currentIndex() == 0 ? (GEOM::marker_type)myStdTypeCombo->currentId() : GEOM::MT_USER; +} + +GEOM::marker_size GEOMToolsGUI_MarkerDlg::getStandardMarkerScale() const +{ + return myWGStack->currentIndex() == 0 ? (GEOM::marker_size)myStdScaleCombo->currentId() : GEOM::MS_NONE; +} + +int GEOMToolsGUI_MarkerDlg::getCustomMarkerID() const +{ + return myWGStack->currentIndex() == 1 ? myCustomTypeCombo->currentId() : 0; +} + +void GEOMToolsGUI_MarkerDlg::accept() +{ + if ( getStudy() ) { + LightApp_SelectionMgr* selMgr = qobject_cast( getStudy()->application() )->selectionMgr(); + + SUIT_ViewWindow* window = getStudy()->application()->desktop()->activeWindow(); + if (window && window->getViewManager()) { + int mgrId = window->getViewManager()->getGlobalId(); + if ( selMgr ) { + SALOME_ListIO selected; + selMgr->selectedObjects( selected ); + if ( !selected.IsEmpty() ) { + _PTR(Study) study = getStudy()->studyDS(); + for ( SALOME_ListIteratorOfListIO it( selected ); it.More(); it.Next() ) { + _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) ); + GEOM::GEOM_Object_var anObject = + GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) ); + if ( !anObject->_is_nil() ) { + if ( myWGStack->currentIndex() == 0 ) { + anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() ); + QString aMarker = "%1%2%3"; + aMarker = aMarker.arg(getMarkerType()); + aMarker = aMarker.arg(DIGIT_SEPARATOR); + aMarker = aMarker.arg(getStandardMarkerScale()); + getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, aMarker); + } + else if ( getCustomMarkerID() > 0 ) { + anObject->SetMarkerTexture( getCustomMarkerID() ); + getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, QString::number(getCustomMarkerID())); + } + } + } + GEOM_Displayer displayer( getStudy() ); + displayer.Redisplay( selected, true ); + selMgr->setSelectedObjects( selected ); + } + } + } + } + QDialog::accept(); +} + +void GEOMToolsGUI_MarkerDlg::keyPressEvent( QKeyEvent* e ) +{ + if ( e->key() == Qt::Key_F1 ) + help(); + QDialog::keyPressEvent( e ); +} + +void GEOMToolsGUI_MarkerDlg::init() +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + + // --- + + for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) { + QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i ); + QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) ); + myStdTypeCombo->addItem( pixmap, QString() ); + myStdTypeCombo->setId( myStdTypeCombo->count()-1, i ); + } + + // --- + + for ( int i = GEOM::MS_10; i <= GEOM::MS_70; i++ ) { + myStdScaleCombo->addItem( QString::number( (i-1)*0.5 + 1.0 ) ); + myStdScaleCombo->setId( myStdScaleCombo->count()-1, i ); + } + + // --- + + GEOM::GEOM_Gen_var engine = GeometryGUI::GetGeomGen(); + myOperation = engine->GetIInsertOperations( getStudy()->id() ); + GEOM::ListOfLong_var ids = myOperation->GetAllTextures(); + for ( int i = 0; i < ids->length(); i++ ) + addTexture( ids[i] ); + + // --- + + GEOM::marker_type aType = (GEOM::marker_type)-1; + GEOM::marker_size aSize = (GEOM::marker_size)-1; + int aTexture = 0; + if ( getStudy() ) { + LightApp_SelectionMgr* selMgr = qobject_cast( getStudy()->application() )->selectionMgr(); + if ( selMgr ) { + SALOME_ListIO selected; + selMgr->selectedObjects( selected ); + if ( !selected.IsEmpty() ) { + _PTR(Study) study = getStudy()->studyDS(); + for ( SALOME_ListIteratorOfListIO it( selected ); it.More(); it.Next() ) { + _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) ); + GEOM::GEOM_Object_var anObject = + GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) ); + if ( !anObject->_is_nil() ) { + GEOM::marker_type mtype = anObject->GetMarkerType(); + if ( aType == -1 ) + aType = mtype; + else if ( aType != mtype ) { + aType = (GEOM::marker_type)-1; + break; + } + if ( mtype > GEOM::MT_NONE && mtype < GEOM::MT_USER ) { + GEOM::marker_size msize = anObject->GetMarkerSize(); + if ( aSize == -1 ) + aSize = msize; + else if ( aSize != msize ) + break; + } + else if ( mtype == GEOM::MT_USER ) { + int mtexture = anObject->GetMarkerTexture(); + if ( aTexture == 0 ) + aTexture = mtexture; + else if ( aTexture != mtexture ) + break; + } + } + } + } + } + } + if ( aType > GEOM::MT_NONE && aType < GEOM::MT_USER ) + setStandardMarker( aType, aSize ); + else if ( aType == GEOM::MT_USER ) + setCustomMarker( aTexture ); + else + setStandardMarker((GEOM::marker_type)(resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS) + 1), + (GEOM::marker_size)(resMgr->integerValue("Geometry", "marker_scale", 1))); +} + +void GEOMToolsGUI_MarkerDlg::addTexture( int id, bool select ) const +{ + if ( id > 0 && myCustomTypeCombo->index( id ) == -1 ) { + int tWidth, tHeight; + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) texture = GeometryGUI::getTexture(getStudy(), id, tWidth, tHeight); +#else + Handle(Graphic3d_HArray1OfBytes) texture = GeometryGUI::getTexture(getStudy(), id, tWidth, tHeight); +#endif + + if ( !texture.IsNull() && texture->Length() == tWidth*tHeight/8 ) { + QImage image( tWidth, tHeight, QImage::Format_Mono ); + image.setColor( 0, qRgba( 0, 0, 0, 0 ) ); + image.setColor( 1, qRgba( 0, 0, 0, 255 ) ); + int bytesperline = tWidth/8; + for ( int j = texture->Lower(); j <= texture->Upper(); j++ ) { + uchar val = (uchar)texture->Value( j ); + for ( int k = 0; k < 8; k++ ) { + int row = ( j - texture->Lower() ) / bytesperline; + int col = ( ( j - texture->Lower() ) % bytesperline ) * 8 + k; + image.setPixel( row, col, ( val & (1<<(8-k-1)) ) ? 1 : 0 ); + } + } + QPixmap pixmap = QPixmap::fromImage( image ); + if ( !pixmap.isNull() ) { + myCustomTypeCombo->addItem( pixmap, QString::number( id ) ); + myCustomTypeCombo->setId( myCustomTypeCombo->count()-1, id ); + if ( select ) myCustomTypeCombo->setCurrentId( id ); + } + } + } +} + +SalomeApp_Study* GEOMToolsGUI_MarkerDlg::getStudy() const +{ + return qobject_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); +} + +void GEOMToolsGUI_MarkerDlg::browse() +{ + QStringList filters; + filters << tr( "Texture files (*.dat)" ) << tr( "All files (*)" ); + QString aFileName = SUIT_Session::session()->activeApplication()->getFileName( true, QString(), filters.join( ";;" ), tr( "LOAD_TEXTURE_TLT" ), this ); + if ( !aFileName.isEmpty() ) { + addTexture( myOperation->LoadTexture( aFileName.toLatin1().constData() ), true ); + } +} + +void GEOMToolsGUI_MarkerDlg::help() +{ + if ( getStudy() ) { + SalomeApp_Application* app = qobject_cast( getStudy()->application() ); + app->onHelpContextModule( "GEOM", "point_marker_page.html" ); + } +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.h new file mode 100644 index 000000000..b550ee235 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.h @@ -0,0 +1,75 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOMToolsGUI_MarkerDlg.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#ifndef GEOMTOOLSGUI_MARKERDLG_H +#define GEOMTOOLSGUI_MARKERDLG_H + +#include "GEOM_ToolsGUI.hxx" + +#include + +#include +#include CORBA_CLIENT_HEADER(GEOM_Gen) + +class QButtonGroup; +class QStackedWidget; +class QtxComboBox; +class SalomeApp_Study; + +class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_MarkerDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMToolsGUI_MarkerDlg( QWidget* = 0 ); + ~GEOMToolsGUI_MarkerDlg(); + + void setStandardMarker( GEOM::marker_type, GEOM::marker_size ); + void setCustomMarker( int ); + GEOM::marker_type getMarkerType() const; + GEOM::marker_size getStandardMarkerScale() const; + int getCustomMarkerID() const; + + void accept(); + +protected: + void keyPressEvent( QKeyEvent* ); + +private: + void init(); + void addTexture( int, bool = false ) const; + SalomeApp_Study* getStudy() const; + +private slots: + void browse(); + void help(); + +private: + GEOM::GEOM_IInsertOperations_var myOperation; + QButtonGroup* myTypeGroup; + QStackedWidget* myWGStack; + QtxComboBox* myStdTypeCombo; + QtxComboBox* myStdScaleCombo; + QtxComboBox* myCustomTypeCombo; +}; + +#endif // GEOMTOOLSGUI_MARKERDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx new file mode 100644 index 000000000..ca92d6f08 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx @@ -0,0 +1,672 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOMToolsGUI_MaterialPropertiesDlg.cxx +// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com) + +#include "GEOMToolsGUI_MaterialPropertiesDlg.h" + +#include "GeometryGUI.h" +#include "GEOM_Constants.h" +#include "GEOM_VTKPropertyMaterial.hxx" +#include "GEOMBase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MARGIN 9 // layout spacing +#define SPACING 6 // layout margin + +/*! + \class GEOMToolsGUI_MaterialList + \brief Internal class, used to handle context menu event from materials list + \internal +*/ + +/*! + \brief Contructor + */ +GEOMToolsGUI_MaterialList::GEOMToolsGUI_MaterialList( QWidget* parent ) + : QListWidget( parent ) +{} + +/*! + \brief Context menu event, emits context menu signal passing event as parameter +*/ +void GEOMToolsGUI_MaterialList::contextMenuEvent( QContextMenuEvent* e ) +{ + emit contextMenu( e ); +} + +/*! + \class GEOMToolsGUI_MaterialPropertiesDlg + \brief GEOM material properties dialog box class + + The dialog box is used to set material properties for the presentation objects. +*/ + +/*! + \brief Constructor + \param parent parent widget +*/ +GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget* parent ) + : QtxDialog( parent, true, true, OK | Close | Apply | Help ) +{ + // Set title + setWindowTitle( tr( "MATERIAL_PROPERTIES_TLT" ) ); + + // main layout + QVBoxLayout* main = new QVBoxLayout( mainFrame() ); + main->setMargin( 0 ); + main->setSpacing( SPACING ); + + // add top-level frame box to enclose all main widgets (excluding buttons) + QFrame* fr = new QFrame( mainFrame() ); + fr->setFrameStyle( QFrame::Box | QFrame::Sunken ); + main->addWidget( fr ); + + // materials list widget + myMaterials = new GEOMToolsGUI_MaterialList( fr ); + // properties widget + QWidget* propWidget = new QWidget( fr ); + + // layout main widgets + QHBoxLayout* frLayout = new QHBoxLayout( fr ); + frLayout->setMargin( MARGIN ); + frLayout->setSpacing( SPACING ); + frLayout->addWidget( myMaterials ); + frLayout->addWidget( propWidget ); + + // layout for material properties widgets + QGridLayout* propLayout = new QGridLayout( propWidget ); + propLayout->setMargin( 0 ); + propLayout->setSpacing( SPACING ); + + // current color widgets + myColorLab = new QLabel( tr( "CURRENT_COLOR" ), propWidget ); + myColor = new QtxColorButton( propWidget ); + + // "physical" material type widgets + myPhysical = new QCheckBox( tr( "PHYSICAL" ), propWidget ); + + // reflection components widgets + for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) + { + Reflection refl; + + refl.label = new QLabel( tr( QString( "REFLECTION_%1" ).arg( i ).toLatin1().data() ), propWidget ); + + refl.color = new QtxColorButton( propWidget ); + //refl.color->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + refl.coef = new QtxDoubleSpinBox( propWidget ); + refl.coef->setPrecision( 4 ); + refl.coef->setDecimals( 4 ); + refl.coef->setRange( 0., 1. ); + refl.coef->setSingleStep( 0.05 ); + refl.coef->setMinimumWidth( 80 ); + + refl.enabled = new QCheckBox( tr( "ENABLED" ), propWidget ); + + myReflection << refl; + } + + // shininess widgets + QLabel* shininessLab = new QLabel( tr( "SHININESS" ), propWidget ); + myShininess = new QtxDoubleSpinBox( propWidget ); + myShininess->setPrecision( 4 ); + myShininess->setDecimals( 4 ); + myShininess->setRange( 0., 1. ); + myShininess->setSingleStep( 0.05 ); + + // separator widgets + QFrame* line1 = new QFrame( propWidget ); + line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + QFrame* line2 = new QFrame( propWidget ); + line2->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + // add / remove material buttons + myAddButton = new QPushButton( tr( "ADD_MATERIAL" ), propWidget ); + myDelButton = new QPushButton( tr( "DELETE_MATERIAL" ), propWidget ); + + // buttons layout + QHBoxLayout* btnLayout = new QHBoxLayout; + btnLayout->setMargin( 0 ); + btnLayout->setSpacing( SPACING ); + btnLayout->addWidget( myAddButton ); + btnLayout->addWidget( myDelButton ); + + // layout all properties widgets together + propLayout->addWidget( myColorLab, 0, 0 ); + propLayout->addWidget( myColor, 0, 1 ); + propLayout->addWidget( line1, 1, 0, 1, 4 ); + propLayout->addWidget( myPhysical, 2, 0, 1, 2 ); + for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) { + propLayout->addWidget( myReflection[i].label, i+3, 0 ); + propLayout->addWidget( myReflection[i].color, i+3, 1 ); + propLayout->addWidget( myReflection[i].coef, i+3, 2 ); + propLayout->addWidget( myReflection[i].enabled, i+3, 3 ); + } + propLayout->addWidget( shininessLab, 7, 0 ); + propLayout->addWidget( myShininess, 7, 2 ); + propLayout->addWidget( line2, 8, 0, 1, 4 ); + propLayout->setRowStretch( 9, 5 ); + propLayout->addLayout( btnLayout, 10, 0, 1, 4 ); + + // initialize dialog box + setButtonPosition( Right, Close ); + + // fill in the list of materials + QStringList globalMaterials = myResourceMgr.materials( Material_ResourceMgr::Global ); + QStringList userMaterials = myResourceMgr.materials( Material_ResourceMgr::User ); + + QListWidgetItem* item; + + // - current material + item = new QListWidgetItem( tr( "CURRENT_MATERIAL" ) ); + item->setForeground( QColor( Qt::red ) ); + item->setData( TypeRole, QVariant( Current ) ); + myMaterials->addItem( item ); + // - global materials + foreach( QString material, globalMaterials ) { + item = new QListWidgetItem( material ); + item->setForeground( QColor( Qt::blue ) ); + item->setData( TypeRole, QVariant( Global ) ); + item->setData( NameRole, QVariant( material ) ); + myMaterials->addItem( item ); + } + // - user materials + foreach ( QString material, userMaterials ) { + item = new QListWidgetItem( material ); + item->setData( TypeRole, QVariant( User ) ); + item->setData( NameRole, QVariant( material ) ); + item->setFlags( item->flags() | Qt::ItemIsEditable ); + myMaterials->addItem( item ); + } + // install event filter to the materials list to process key press events + myMaterials->installEventFilter( this ); + + // connect signals + // note: all widgets, that change material properties, are connected to the common signal + // changed(), instead of connecting directly to the slot - this allows easy temporary blocking + // of the change signal + connect( myPhysical, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) ); + for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) { + connect( myReflection[i].color, SIGNAL( changed( QColor ) ), this, SIGNAL( changed() ) ); + connect( myReflection[i].coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) ); + connect( myReflection[i].enabled, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) ); + } + connect( myShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) ); + connect( myMaterials, SIGNAL( itemSelectionChanged() ), + this, SLOT( onMaterialChanged() ) ); + connect( myMaterials, SIGNAL( itemChanged( QListWidgetItem* ) ), + this, SLOT( onItemChanged( QListWidgetItem* ) ) ); + connect( myMaterials, SIGNAL( contextMenu( QContextMenuEvent* ) ), + this, SLOT( onContextMenu( QContextMenuEvent* ) ) ); + connect( myAddButton, SIGNAL( clicked() ), this, SLOT( onAddMaterial() ) ); + connect( myDelButton, SIGNAL( clicked() ), this, SLOT( onDeleteMaterial() ) ); + connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) ); + connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); + connect( this, SIGNAL( changed() ), this, SLOT( onChanged() ) ); + + // initialize current material model according to the selection + myColor->setColor( SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ) ); + myCurrentModel.fromResources( SUIT_Session::session()->resourceMgr()->stringValue( "Geometry", "material", "Plastic" ) ); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); + LightApp_SelectionMgr* selMgr = app->selectionMgr(); + if ( study ) { + SALOME_ListIO selected; + selMgr->selectedObjects( selected ); + if ( selected.Extent() > 0 ) { + Handle(SALOME_InteractiveObject) io = selected.First(); + if ( !io.IsNull() ) { + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + if ( window ) { + int mgrId = window->getViewManager()->getGlobalId(); + PropMap propMap = study->getObjectPropMap( mgrId, io->getEntry() ); + QString matProp = propMap.value(MATERIAL_PROP).toString(); + if ( !matProp.isEmpty() ) + myCurrentModel.fromProperties( matProp ); + QColor c = propMap.value(COLOR_PROP).value(); + if ( c.isValid() ) + myColor->setColor( c ); + } + } + } + } + + // finally activate current material properties + myMaterials->setCurrentRow( 0 ); +} + +/*! + \brief Destructor +*/ +GEOMToolsGUI_MaterialPropertiesDlg::~GEOMToolsGUI_MaterialPropertiesDlg() +{ +} + +/*! + \brief Called when "OK" button is clicked +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::accept() +{ + onApply(); + QtxDialog::accept(); +} + +/*! + \brief Event filter + \param o sender + \param e event +*/ +bool GEOMToolsGUI_MaterialPropertiesDlg::eventFilter( QObject* o, QEvent* e ) +{ + // process key press event from materials list + if ( o == myMaterials && e->type() == QEvent::KeyPress ) { + QKeyEvent* ke = (QKeyEvent*)e; + if ( ke->key() == Qt::Key_Delete ) { + onDeleteMaterial(); + } + } + return QtxDialog::eventFilter( o, e ); +} + +/*! + \brief Initialize dialog box widgets from material model + \param model material model +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::fromModel( const Material_Model& model ) +{ + // reflection components + for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) + { + myReflection[i].color->setColor( model.color( (Material_Model::ReflectionType)i ) ); + myReflection[i].coef->setValue( model.reflection( (Material_Model::ReflectionType)i ) ); + myReflection[i].enabled->setChecked( model.hasReflection( (Material_Model::ReflectionType)i ) ); + } + + // shininess + myShininess->setValue( model.shininess() ); + + // type (physical or no) + myPhysical->setChecked( model.isPhysical() ); +} + +/*! + \brief Save values from dialog box widgets to material model + \param model material model to be filled in +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::toModel( Material_Model& model ) const +{ + // type (physical or no) + model.setPhysical( myPhysical->isChecked() ); + + // shininess + model.setShininess( myShininess->value() ); + + // reflection components + for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) + { + model.setColor ( (Material_Model::ReflectionType)i, myReflection[i].color->color() ); + model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].coef->value() ); + model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].enabled->isChecked() ); + } +} + +/*! + \brief Find unique name for the material name + \param name material name template + \param item the item to be ignored when browsing through the materials list + \param addSuffix if \c true, the integrer suffix is always added to the material name (otherwise + suffix is added only if item name is not unique) + \return new unique material name +*/ +QString GEOMToolsGUI_MaterialPropertiesDlg::findUniqueName( const QString& name, QListWidgetItem* item, bool addSuffix ) +{ + bool found = false; + int idx = 0; + for( int i = 1; i < myMaterials->count(); i++ ) { + if ( item == myMaterials->item( i ) ) continue; + QString iname = myMaterials->item( i )->text(); + if ( iname == name ) { + found = true; + } + else if ( iname.startsWith( name ) ) { + iname = iname.mid( name.length() ).trimmed(); + bool ok = false; + int nx = iname.toInt( &ok ); + if ( ok ) idx = qMax( idx, nx ); + } + } + return found || addSuffix ? QString( "%1 %2" ).arg( name ).arg( idx+1 ) : name; +} + +/*! + \brief Called when "Apply" button is pressed +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onApply() +{ + // save user materials + myResourceMgr.save(); + + // store selected material properties in the current model + toModel( myCurrentModel ); + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + LightApp_SelectionMgr* selMgr = app->selectionMgr(); + SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); + + if ( !study ) return; + + // get selection + SALOME_ListIO selected; + selMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; + + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + int mgrId = window->getViewManager()->getGlobalId(); + + // convert current material properties to the string representation + QString prop = myCurrentModel.toProperties(); + + if ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ) { + // for VTK viewer + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); + if ( !vtkVW ) + return; + + SVTK_View* aView = vtkVW->getView(); + + // get VTK material properties from the current model + GEOM_VTKPropertyMaterial* vtkProp = myCurrentModel.getMaterialVTKProperty(); + + SUIT_OverrideCursor wc(); + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + // set material property to the presentation + aView->SetMaterial( It.Value(), vtkProp ); + // store chosen material in the property map + study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop ); + // set correct color for the non-physical material + if ( !myCurrentModel.isPhysical() ) { + aView->SetColor( It.Value(), myColor->color() ); + study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() ); + } + } + aView->Repaint(); + GeometryGUI::Modified(); + } + else if ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + // for OCC viewer + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + if ( !vm ) + return; + + Handle(AIS_InteractiveContext) ic = vm->getAISContext(); + + // get OCC material aspect from the current model + Graphic3d_MaterialAspect occAspect = myCurrentModel.getMaterialOCCAspect(); + + SUIT_OverrideCursor wc(); + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle(GEOM_AISShape) aisShape = GEOMBase::ConvertIOinGEOMAISShape( It.Value(), true ); + if ( !aisShape.IsNull() ) { + // set material property to the presentation + aisShape->SetMaterial( occAspect ); + // store chosen material in the property map + study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop ); + // set correct color for the non-physical material + if ( !myCurrentModel.isPhysical() ) { + aisShape->SetShadingColor( SalomeApp_Tools::color( myColor->color() ) ); + study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() ); + ic->RecomputePrsOnly( aisShape, Standard_False ); + } + //if ( aisShape->DisplayMode() != AIS_Shaded/*aisShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges*/) + ic->Redisplay( aisShape, Standard_False ); + } + } + ic->UpdateCurrentViewer(); + GeometryGUI::Modified(); + } +} + +/*! + \brief Called when "Help" button is pressed +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + app->onHelpContextModule( "GEOM", "material_page.html" ); +} + +/*! + \brief Called when user selects any material item in the materials list +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onMaterialChanged() +{ + // get currently selected item + QListWidgetItem* item = myMaterials->currentItem(); + if ( !item ) return; + + bool blocked = blockSignals( true ); + + int type = item->data( TypeRole ).toInt(); + if ( type == Current ) { + // initialize widgets from current material model + fromModel( myCurrentModel ); + } + else { + // initialize widgets from chosen material model (using resources manager) + Material_Model model; + model.fromResources( item->data( NameRole ).toString(), &myResourceMgr ); + fromModel( model ); + } + + blockSignals( blocked ); + + // update buttons state + updateState(); +} + +/*! + \brief Called when any material parameter is changed by the user +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onChanged() +{ + // get currently selected item + QListWidgetItem* item = myMaterials->currentItem(); + int type = item->data( TypeRole ).toInt(); + if ( !item ) return; + + if ( type == Current ) { + // for the current model do not perform any actions except store changed values + toModel( myCurrentModel ); + } + else if ( type == User ) { + // for the user model, simply store the changes in the resource manager + Material_Model model; + toModel( model ); + // check if the user model is renamed + QString oldName = item->data( NameRole ).toString(), newName = item->text(); + if ( oldName == newName ) { + // model is not renamed: store data using current name + model.toResources( oldName, &myResourceMgr ); + } + else { + // model is renamed: remove model with old name and store model using new name + myResourceMgr.remove( oldName ); + model.toResources( newName, &myResourceMgr ); + item->setData( NameRole, newName ); + } + } + else { + // it is no allowed to change global material + // user is asked about creating of a new user material model based on the currently selected one + if ( SUIT_MessageBox::question( this, + tr( "GEOM_WRN_WARNING" ), + tr( "QUE_CREATE_NEW_MATERIAL" ), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::Yes ) == QMessageBox::Yes ) { + // user has chosen creation of new user model + onAddMaterial(); + } + else { + // user has rejected creation of new user model: revert changes + bool blocked = blockSignals( true ); + Material_Model model; + model.fromResources( item->data( NameRole ).toString(), &myResourceMgr ); + fromModel( model ); + blockSignals( blocked ); + } + } + + // update buttons state + updateState(); +} + +/*! + \brief Called when user material is renamed by the user +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onItemChanged( QListWidgetItem* item ) +{ + // check new name to be unique (add suffix if necessary) + QString newName = item->text(); + QString uniqueName = findUniqueName( newName, item ); + if ( uniqueName != newName ) { + bool blocked = myMaterials->blockSignals( true ); + item->setText( uniqueName ); + myMaterials->blockSignals( blocked ); + } + onChanged(); +} + +/*! + \brief Process context menu event from materials list +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onContextMenu( QContextMenuEvent* e ) +{ + QListWidgetItem* item = myMaterials->itemAt( e->pos() ); + QMap actionMap; + QMenu m; + // rename + if ( item && item->data( TypeRole ).toInt() == User ) { + actionMap[ m.addAction( tr( "RENAME_MATERIAL" ) ) ] = 0; + m.addSeparator(); + } + // add user material + actionMap[ m.addAction( tr( "ADD_MATERIAL" ) ) ] = 1; + // delete user material + if ( item && item->data( TypeRole ).toInt() == User ) { + actionMap[ m.addAction( tr( "DELETE_MATERIAL" ) ) ] = 2; + } + QAction* a = m.exec( e->globalPos() ); + switch( actionMap[ a ] ) { + case 0: + // rename + myMaterials->editItem( item ); + break; + case 1: + // add user material + onAddMaterial(); + break; + case 2: + // delete user material + onDeleteMaterial(); + break; + default: + break; + } +} + +/*! + \brief Delete currently selected user model +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onDeleteMaterial() +{ + QListWidgetItem* item = myMaterials->currentItem(); + if ( item && item->data( TypeRole ).toInt() == User ) { + if ( SUIT_MessageBox::question( this, + tr( "GEOM_WRN_WARNING" ), + tr( "QUE_REMOVE_MATERIAL" ).arg( item->text() ), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::Yes ) == QMessageBox::Yes ) { + myResourceMgr.remove( item->data( NameRole ).toString() ); + delete item; + } + } +} + +/*! + \brief Add new user material model +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::onAddMaterial() +{ + QString newName = findUniqueName( tr( "CUSTOM_MATERIAL" ), 0, true ); + QListWidgetItem* item = new QListWidgetItem( newName ); + item->setData( TypeRole, QVariant( User ) ); + item->setData( NameRole, QVariant( newName ) ); + item->setFlags( item->flags() | Qt::ItemIsEditable ); + myMaterials->addItem( item ); + + Material_Model model; + toModel( model ); + model.toResources( newName, &myResourceMgr ); + myMaterials->setCurrentItem( item ); + myMaterials->editItem( item ); +} + +/*! + \brief Update buttons state +*/ +void GEOMToolsGUI_MaterialPropertiesDlg::updateState() +{ + QListWidgetItem* item = myMaterials->currentItem(); + myDelButton->setEnabled( item && item->data( TypeRole ).toInt() == User ); + myColorLab->setEnabled( !myPhysical->isChecked() ); + myColor->setEnabled( !myPhysical->isChecked() ); + myReflection[0].color->setEnabled( myPhysical->isChecked() ); +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.h new file mode 100644 index 000000000..1e2a7c6f7 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.h @@ -0,0 +1,108 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOMToolsGUI_MaterialPropertiesDlg.h +// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com) +// +#ifndef GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H +#define GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H + +#include "GEOM_ToolsGUI.hxx" + +#include +#include +#include "Material_Model.h" +#include "Material_ResourceMgr.h" + +class QCheckBox; +class QLabel; +class QPushButton; +class QtxDoubleSpinBox; +class QtxColorButton; +class GEOMToolsGUI_MaterialList; + +class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_MaterialPropertiesDlg : public QtxDialog +{ + Q_OBJECT + + enum { Current, Global, User }; + enum { TypeRole = Qt::UserRole + 123, NameRole }; + +public: + GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 ); + ~GEOMToolsGUI_MaterialPropertiesDlg(); + + void accept(); + + bool eventFilter( QObject*, QEvent* ); + +private: + void updateState(); + void toModel( Material_Model& ) const; + void fromModel( const Material_Model& ); + QString findUniqueName( const QString&, + QListWidgetItem* = 0, + bool = false ); + +signals: + void changed(); + +private slots: + void onChanged(); + void onMaterialChanged(); + void onItemChanged( QListWidgetItem* ); + void onContextMenu( QContextMenuEvent* ); + void onDeleteMaterial(); + void onAddMaterial(); + void onApply(); + void onHelp(); + +private: + typedef struct + { + QLabel* label; + QtxColorButton* color; + QtxDoubleSpinBox* coef; + QCheckBox* enabled; + } Reflection; + + GEOMToolsGUI_MaterialList* myMaterials; + QCheckBox* myPhysical; + QList myReflection; + QtxDoubleSpinBox* myShininess; + QLabel* myColorLab; + QtxColorButton* myColor; + QPushButton* myAddButton; + QPushButton* myDelButton; + Material_ResourceMgr myResourceMgr; + Material_Model myCurrentModel; +}; + +class GEOMToolsGUI_MaterialList : public QListWidget +{ +Q_OBJECT +public: + GEOMToolsGUI_MaterialList( QWidget* parent ); +protected: + void contextMenuEvent( QContextMenuEvent* e ); +signals: + void contextMenu( QContextMenuEvent* ); +}; + +#endif // GEOMTOOLSGUI_MATERIALPROPERTIESDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx index b8bc790ba..3e8b8ec1d 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMToolsGUI_NbIsosDlg.cxx // Author : OCC Team @@ -174,16 +175,16 @@ void GEOMToolsGUI_NbIsosDlg::ClickOnHelp() app->onHelpContextModule(aGeomGUI ? app->moduleName(aGeomGUI->moduleName()) : QString(""), myHelpFileName); } else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h index 23beae1ea..5ee0c90fa 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMToolsGUI_NbIsosDlg.h // Author : OCC Team diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx new file mode 100644 index 000000000..5d16cbe7b --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx @@ -0,0 +1,389 @@ +// Copyright (C) 2007-2012 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 : GEOMToolsGUI_PublishDlg.cxx +// Author : Roman NIKOLAEV, Open CASCADE S.A.S. +// + +#include "GEOMToolsGUI_PublishDlg.h" + +//SALOME GUI includes +#include +#include + +#include + +#include + +#include +#include +#include + + +//QT includes +#include +#include +#include + +#define DEFAULT_MARGIN 11 +#define DEFAULT_SPACING 6 + +GEOMToolsGUI_PublishDlg::GEOMToolsGUI_PublishDlg(QWidget* parent): + QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) +{ + setObjectName( "GEOMToolsGUI_PublishDlg" ); + setModal( true ); + setWindowTitle( tr( "GEOM_PUBLISH_OBJECTS_TLT" ) ); + + setAttribute(Qt::WA_DeleteOnClose); + + //List of the objects + myTreeWidget = new QTreeWidget(this); + //myTreeWidget->setRootIsDecorated(false); + //myTreeWidget->setUniformRowHeights(true); + myTreeWidget->setAllColumnsShowFocus(true); + myTreeWidget->setColumnCount(2); + + QStringList columnNames; + columnNames.append(tr("OBJECT_NAME")); + columnNames.append(tr("OBJECT_ENTRY")); + QTreeWidgetItem * headerItem = new QTreeWidgetItem(columnNames); + myTreeWidget->setHeaderItem ( headerItem ); + + //Select All button + QPushButton* selectAllButton = new QPushButton( tr("SELECT_ALL"),this ); + + //Unselect Select All button + QPushButton* unselectAllButton = new QPushButton( tr("UNSELECT_ALL"),this ); + + //Publish button + QPushButton* publishButton = new QPushButton( tr("GEOM_PUBLISH_BTN"),this ); + + //Publish and Close button + QPushButton* publishCloseButton = new QPushButton( tr("GEOM_PUBLISH_CLOSE_BTN"), this ); + + //Close button + QPushButton* closeButton = new QPushButton( tr("GEOM_BUT_CLOSE"), this ); + + QGridLayout* gridLayout = new QGridLayout(this); + gridLayout->setMargin(DEFAULT_MARGIN); + gridLayout->setSpacing(DEFAULT_SPACING); + + gridLayout->addWidget(myTreeWidget, 0, 0, 3, 3); + gridLayout->addWidget(selectAllButton, 0, 3, 1, 1); + gridLayout->addWidget(unselectAllButton, 1, 3, 1, 1); + gridLayout->addItem( new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 2, 3, 1, 1); + gridLayout->addWidget(publishCloseButton, 3, 0, 1, 1); + gridLayout->addWidget(publishButton, 3, 1, 1, 1); + gridLayout->addItem( new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 3, 2, 1, 1); + gridLayout->addWidget(closeButton, 3, 3, 1, 1); + + //Connect signals and slots + connect( selectAllButton, SIGNAL(clicked()), this, SLOT(clickOnSelectAll()) ); + connect( unselectAllButton, SIGNAL(clicked()), this, SLOT(clickOnUnSelectAll()) ); + + connect(publishCloseButton, SIGNAL(clicked()), this, SLOT(clickOnOk())); + connect(publishButton, SIGNAL(clicked()), this, SLOT(clickOnApply())); + connect(closeButton, SIGNAL(clicked()), this, SLOT(reject())); + + initData(); +} + +//================================================================================= +// function : ~GEOMToolsGUI_PublishDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GEOMToolsGUI_PublishDlg::~GEOMToolsGUI_PublishDlg() +{ +} + +//================================================================================= +// function : initData() +// purpose : Fill dialog after opening +//================================================================================= +void GEOMToolsGUI_PublishDlg::initData() { + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if(!app) + return; + + SalomeApp_Module* module = dynamic_cast(app->activeModule()); + + if(!module) + return; + + CAM_DataModel* dataModel = module->dataModel(); + if(!dataModel) + return; + + myGeomRoot = dynamic_cast(dataModel->root()); + + if(!myGeomRoot) + return; + + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if(!appStudy ) + return; + + _PTR(Study) aStudy = appStudy->studyDS(); + if(!aStudy) + return; + + buildTree(aStudy, myGeomRoot); + + + myTreeWidget->resizeColumnToContents(0); + myTreeWidget->resizeColumnToContents(1); +} + +//================================================================================= +// function : buildTree() +// purpose : +//================================================================================= +QTreeWidgetItem* GEOMToolsGUI_PublishDlg::createItem(QTreeWidgetItem* theParent, Pair theAttributes, bool isCheckable) { + QStringList aList; + aList<setCheckState(0, Qt::Unchecked); + else { + anItem->setFlags(anItem->flags() & ~Qt::ItemIsUserCheckable); + } + + if(theParent) + theParent->addChild(anItem); + else + myTreeWidget->addTopLevelItem(anItem); + + myEntryToItem.insert(theAttributes.first, anItem); + + anItem->setExpanded(true); + return anItem; +} + +//================================================================================= +// function : buildTree() +// purpose : +//================================================================================= +QTreeWidgetItem* GEOMToolsGUI_PublishDlg::findParentItem(_PTR(Study) theStudy, SalomeApp_DataObject* theObject, BufferedList& theList ) { + + QTreeWidgetItem* aResult = NULL; + SalomeApp_DataObject* aParrent = dynamic_cast(theObject->parent()); + if(aParrent) { + QString targetEntry = aParrent->entry(); + if( !(aResult = myEntryToItem.value(targetEntry)) ) { + if( aParrent != myGeomRoot ) { + QString aName; + _PTR(SObject) aSO ( theStudy->FindObjectID(qPrintable(aParrent->entry()))); + _PTR(GenericAttribute) anAttr; + if ( aSO->FindAttribute(anAttr, "AttributeName") ) { + _PTR(AttributeName) anAttrName (anAttr); + aName = anAttrName->Value().c_str(); + } + theList.push_front(qMakePair(targetEntry, aName)); + aResult = findParentItem(theStudy,aParrent,theList); + } else { + //Publish List + for(int i = 0; i < theList.size(); i++ ) { + aResult = createItem(aResult, theList[i], false); + } + theList.clear(); + } + } else { + //Publish List + for(int i = 0; i < theList.size(); i++ ) { + aResult = createItem(aResult, theList[i], false); + } + theList.clear(); + } + } + return aResult; +} + +//================================================================================= +// function : buildTree() +// purpose : +//================================================================================= +void GEOMToolsGUI_PublishDlg::buildTree(_PTR(Study) theStudy, SalomeApp_DataObject* theItem) { + if(!theItem || theItem->isReference()) + return; + + if(theItem != myGeomRoot) { + + //If object hasn't "AttributeDrawable" => it visible + bool isDrawable = true; + _PTR(SObject) SO ( theStudy->FindObjectID(qPrintable(theItem->entry()))); + _PTR(GenericAttribute) anAttr; + if ( SO && SO->FindAttribute(anAttr, "AttributeDrawable") ) { + _PTR(AttributeDrawable) aDrw (anAttr); + isDrawable = aDrw->IsDrawable(); + } + + if(!isDrawable) { + QString aName; + if ( SO->FindAttribute(anAttr, "AttributeName") ) { + _PTR(AttributeName) aAttrName (anAttr); + aName = aAttrName->Value().c_str(); + } + BufferedList aList; + QTreeWidgetItem* parentItem = findParentItem(theStudy, theItem, aList); + createItem(parentItem,qMakePair(theItem->entry(),aName),true); + } + } + + DataObjectList listObj = theItem->children( false ); + DataObjectList::iterator itr = listObj.begin(); + while( itr != listObj.end()) { + buildTree(theStudy, dynamic_cast(*itr)); + itr++; + } +} + +//================================================================================= +// function : clickOnApply() +// purpose : Called then "Publish" button clicked +//================================================================================= +void GEOMToolsGUI_PublishDlg::clickOnApply() { + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if(!app) + return; + + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if(!appStudy ) + return; + + _PTR(Study) aStudy = appStudy->studyDS(); + if(!aStudy) + return; + + + QList toProcess; + getDrawableList(myTreeWidget->invisibleRootItem(), toProcess); + + _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); + for( int i = 0; i < toProcess.count(); i++) { + QTreeWidgetItem* item = toProcess[i]; + if(item) { + QString entry = myEntryToItem.key(item); + _PTR(SObject) SO ( aStudy->FindObjectID(qPrintable(entry)) ); + if(!SO) continue; + _PTR(AttributeDrawable) aDrw = aBuilder->FindOrCreateAttribute( SO, "AttributeDrawable" ); + aDrw->SetDrawable( true ); + //Remove or change item + if( item != myTreeWidget->invisibleRootItem() ){ + if( item->data(0,Qt::UserRole).toBool() ) { + delete item; + } else { + item->setFlags(item->flags() & ~Qt::ItemIsUserCheckable); + item->setData(0,Qt::CheckStateRole,QVariant()); + } + } + } + } + toProcess.clear(); + getTails(myTreeWidget->invisibleRootItem(), toProcess); + for( int i = 0; i < toProcess.count(); i++) { + if( toProcess[i] != myTreeWidget->invisibleRootItem() ) + delete toProcess[i]; + } + + app->updateObjectBrowser( false ); + app->updateActions(); +} + +//================================================================================= +// function : clickOnOk() +// purpose : Called then "Publish And Close" button clicked +//================================================================================= +void GEOMToolsGUI_PublishDlg::clickOnOk() { + clickOnApply(); + accept(); +} + +//================================================================================= +// function : clickOnSelectAll() +// purpose : Called then "Select All" button clicked +//================================================================================= +void GEOMToolsGUI_PublishDlg::clickOnSelectAll() { + processAll(myTreeWidget->invisibleRootItem(),Qt::Checked); +} + +//================================================================================= +// function : clickOnUnSelectAll() +// purpose : Called then "Unselect All" button clicked +//================================================================================= +void GEOMToolsGUI_PublishDlg::clickOnUnSelectAll() { + processAll(myTreeWidget->invisibleRootItem(),Qt::Unchecked); +} + +//================================================================================= +// function : processAll() +// purpose : +//================================================================================= +void GEOMToolsGUI_PublishDlg::processAll(QTreeWidgetItem* theItem, Qt::CheckState state) { + + + if((theItem->flags() & Qt::ItemIsUserCheckable)) + theItem->setCheckState(0,state); + + int i = 0; + while(i < theItem->childCount()) { + processAll(theItem->child(i), state); + i++; + } +} + +//================================================================================= +// function : processAll() +// purpose : +//================================================================================= +void GEOMToolsGUI_PublishDlg::getDrawableList(QTreeWidgetItem* theItem, QList& theList) { + + theItem->setData(0, Qt::UserRole, true); + + if((theItem->flags() & Qt::ItemIsUserCheckable) ) { + theItem->setData(0, Qt::UserRole,theItem->checkState(0) == Qt::Checked); + } + + int i = 0; + while(i < theItem->childCount()) { + getDrawableList(theItem->child(i), theList); + theItem->setData( 0, Qt::UserRole, (theItem->data(0,Qt::UserRole).toBool() && theItem->child(i)->data(0,Qt::UserRole).toBool()) ); + i++; + } + + if( (theItem->flags() & Qt::ItemIsUserCheckable) && (theItem->checkState(0) == Qt::Checked)) + theList.push_back(theItem); +} + + +void GEOMToolsGUI_PublishDlg::getTails(QTreeWidgetItem* theItem, QList& theList) { + int i = 0; + while(i < theItem->childCount()) { + getTails(theItem->child(i),theList); + i++; + } + + if(theItem->data(0,Qt::UserRole).toBool()) + theList.push_back(theItem); +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h new file mode 100644 index 000000000..65d460d69 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h @@ -0,0 +1,83 @@ +// Copyright (C) 2007-2012 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 : GEOMToolsGUI_PublishDlg.h +// Author : Roman NIKOLAEV, Open CASCADE S.A.S. +// + +#ifndef GEOMTOOLSGUI_PUBLISHDLG_H +#define GEOMTOOLSGUI_PUBLISHDLG_H + +#include "GEOM_ToolsGUI.hxx" + +#include +#include +#include +#include + + + + +#include + +class QTreeWidget; +class QTreeWidgetItem; + +class SalomeApp_DataObject; + +typedef QPair Pair; +typedef QList BufferedList; +typedef QMap Entry2ItemMap; + +class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_PublishDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMToolsGUI_PublishDlg( QWidget* ); + ~GEOMToolsGUI_PublishDlg(); + +protected: + void initData(); + void buildTree(_PTR(Study) theStudy, SalomeApp_DataObject* theItem); + QTreeWidgetItem* findParentItem(_PTR(Study) theStudy, SalomeApp_DataObject* theItem, BufferedList& theList); + QTreeWidgetItem* createItem(QTreeWidgetItem* theItem, Pair theAttributes, bool isCheckable); + void getDrawableList(QTreeWidgetItem* theItem, QList& theList); + void getTails(QTreeWidgetItem* theItem, QList& theList); + +protected slots: + void clickOnOk(); + void clickOnApply(); + void clickOnSelectAll(); + void clickOnUnSelectAll(); + +private: + QTreeWidget* myTreeWidget; + SalomeApp_DataObject* myGeomRoot; + Entry2ItemMap myEntryToItem; + void processAll(QTreeWidgetItem* theItem, Qt::CheckState state); +}; + + + +#endif //GEOMTOOLSGUI_PUBLISHDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx index c3f06d704..3bcbc16ea 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMToolsGUI_TransparencyDlg.cxx // Author : Lucien PIGNOLONI @@ -27,6 +28,7 @@ #include #include #include +#include #include #include @@ -47,6 +49,7 @@ #include #include #include +#include #include #include @@ -59,7 +62,6 @@ #include -using namespace std; //================================================================================= // class : GEOMBase_TransparencyDlg() @@ -96,8 +98,8 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) GroupC1Layout->setMargin( 11 ); QLabel* TextLabelTransparent = new QLabel( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ), GroupC1 ); - TextLabelTransparent->setAlignment( Qt::AlignRight ); - GroupC1Layout->addWidget( TextLabelTransparent, 0, 0 ); + TextLabelTransparent->setAlignment( Qt::AlignLeft ); + GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); myValueLab = new QLabel( GroupC1 ); myValueLab->setAlignment( Qt::AlignCenter ); @@ -106,8 +108,8 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) GroupC1Layout->addWidget( myValueLab, 0, 1 ); QLabel* TextLabelOpaque = new QLabel( tr( "GEOM_TRANSPARENCY_OPAQUE" ), GroupC1 ); - TextLabelOpaque->setAlignment( Qt::AlignLeft ); - GroupC1Layout->addWidget( TextLabelOpaque, 0, 2 ); + TextLabelOpaque->setAlignment( Qt::AlignRight ); + GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); //GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); mySlider = new QSlider( Qt::Horizontal, GroupC1 ); @@ -120,8 +122,9 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) mySlider->setSingleStep( 1 ); mySlider->setPageStep( 10 ); //mySlider->setValue( 5 ); + mySlider->setTracking(false); - mySlider->setTickPosition( QSlider::TicksLeft ); + mySlider->setTickPosition( QSlider::TicksAbove ); GroupC1Layout->addWidget( mySlider, 1, 0, 1, 3 ); /*************************************************************************/ @@ -155,7 +158,7 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(mySlider, SIGNAL(valueChanged(int)), this, SLOT(SetTransparency())); - connect(mySlider, SIGNAL(sliderMoved(int)), this, SLOT(ValueHasChanged())); + connect(mySlider, SIGNAL(sliderMoved(int)), this, SLOT(SliderHasMoved(int))); } @@ -202,16 +205,16 @@ void GEOMToolsGUI_TransparencyDlg::ClickOnHelp() app->onHelpContextModule(aGeomGUI ? app->moduleName(aGeomGUI->moduleName()) : QString(""), myHelpFileName); } else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), + QObject::tr("BUT_OK")); } } @@ -224,6 +227,15 @@ void GEOMToolsGUI_TransparencyDlg::ValueHasChanged() myValueLab->setText( QString("%1%").arg( mySlider->value() ) ); } +//================================================================================= +// function : SliderHasMoved() +// purpose : Called when value of slider change +//================================================================================= +void GEOMToolsGUI_TransparencyDlg::SliderHasMoved(int value) +{ + myValueLab->setText( QString("%1%").arg( value ) ); +} + //================================================================================= // function : SetTransparency() // purpose : Called when value of slider change @@ -231,7 +243,7 @@ void GEOMToolsGUI_TransparencyDlg::ValueHasChanged() //================================================================================= void GEOMToolsGUI_TransparencyDlg::SetTransparency() { - float newValue = ( 100 - mySlider->value() ) / 100.; + float newValue = mySlider->value() / 100.; SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); if ( !app ) @@ -239,6 +251,12 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency() LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); if ( !aSelMgr ) return; + + SalomeApp_Study* aStudy = dynamic_cast(app->activeStudy()); + + if(!aStudy) + return; + SALOME_ListIO selected; aSelMgr->selectedObjects( selected ); if ( selected.IsEmpty() ) @@ -247,19 +265,19 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency() Handle(SALOME_InteractiveObject) FirstIOS = selected.First(); if ( FirstIOS.IsNull() ) return; - + SUIT_ViewWindow* window = app->desktop()->activeWindow(); bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); - + int aMgrId = window->getViewManager()->getGlobalId(); if ( isVTK ) { SVTK_ViewWindow* vtkVW = dynamic_cast( window ); if ( !vtkVW ) return; SVTK_View* aView = vtkVW->getView(); - if ( myFirstInit ) { + if ( myFirstInit ) { myFirstInit = false; - int transp = int (100 - ((aView->GetTransparency(FirstIOS))*100.0) + 0.5); + int transp = int ((aView->GetTransparency(FirstIOS))*100.0 + 0.5); mySlider->setValue(transp); ValueHasChanged(); return; @@ -268,20 +286,22 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency() SUIT_OverrideCursor(); for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { aView->SetTransparency( It.Value(), newValue ); + aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), TRANSPARENCY_PROP , newValue ); } + GeometryGUI::Modified(); aView->Repaint(); } // if ( isVTK ) - + else if ( isOCC ) { GEOMBase* gb = new GEOMBase(); - Standard_Boolean found; Handle(GEOM_AISShape) aisShape; if ( myFirstInit ) { + mySlider->setValue(mySlider->maximum()); myFirstInit = false; - aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, found ); - if( !found ) - return; - int transp = int( 100 - ( aisShape->Transparency() * 100.0 ) + 0.5); + aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, true ); + if( aisShape.IsNull() ) + return; + int transp = int( aisShape->Transparency() * 100.0 + 0.5); mySlider->setValue(transp); ValueHasChanged(); return; @@ -293,13 +313,15 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency() return; Handle(AIS_InteractiveContext) ic = vm->getAISContext(); for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), found ); - if ( found ) { - ic->SetTransparency( aisShape, newValue, false ); - ic->Redisplay( aisShape, Standard_False, Standard_True ); + aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true ); + if ( !aisShape.IsNull() ) { + ic->SetTransparency( aisShape, newValue, false ); + ic->Redisplay( aisShape, Standard_False, Standard_True ); + aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), TRANSPARENCY_PROP , newValue ); } } // for... ic->UpdateCurrentViewer(); + GeometryGUI::Modified(); } // if ( isOCC ) ValueHasChanged(); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h index 96eda5d71..8a3debd2c 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GEOMToolsGUI_TransparencyDlg.h // Author : Lucien PIGNOLONI @@ -60,6 +61,7 @@ private slots: void ClickOnClose(); void ClickOnHelp(); void ValueHasChanged(); + void SliderHasMoved(int); void SetTransparency(); }; diff --git a/src/GEOMToolsGUI/GEOM_ToolsGUI.hxx b/src/GEOMToolsGUI/GEOM_ToolsGUI.hxx index 97cc42ba3..b35820b28 100755 --- a/src/GEOMToolsGUI/GEOM_ToolsGUI.hxx +++ b/src/GEOMToolsGUI/GEOM_ToolsGUI.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_ToolsGUI.hxx // Author : Alexander A. BORODIN // Module : GEOM @@ -27,7 +28,7 @@ #define _GEOM_ToolsGUI_HXX_ #ifdef WNT - #if defined GEOMTOOLSGUI_EXPORTS + #if defined GEOMTOOLSGUI_EXPORTS || defined GEOMToolsGUI_EXPORTS #if defined WIN32 #define GEOMTOOLSGUI_EXPORT __declspec( dllexport ) #else diff --git a/src/GEOMToolsGUI/Makefile.am b/src/GEOMToolsGUI/Makefile.am index 4f879990b..e77822def 100644 --- a/src/GEOMToolsGUI/Makefile.am +++ b/src/GEOMToolsGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : GEOMToolsGUI @@ -33,21 +31,35 @@ salomeinclude_HEADERS = \ GEOMToolsGUI.h \ GEOM_ToolsGUI.hxx \ GEOMToolsGUI_NbIsosDlg.h \ + GEOMToolsGUI_DeflectionDlg.h \ GEOMToolsGUI_TransparencyDlg.h \ GEOMToolsGUI_DeleteDlg.h \ - GEOMToolsGUI_NbIsosDlg.h + GEOMToolsGUI_MarkerDlg.h \ + GEOMToolsGUI_PublishDlg.h \ + GEOMToolsGUI_MaterialPropertiesDlg.h \ + GEOMToolsGUI_LineWidthDlg.h dist_libGEOMToolsGUI_la_SOURCES = \ GEOMToolsGUI.cxx \ GEOMToolsGUI_1.cxx \ GEOMToolsGUI_TransparencyDlg.cxx \ GEOMToolsGUI_NbIsosDlg.cxx \ - GEOMToolsGUI_DeleteDlg.cxx + GEOMToolsGUI_DeflectionDlg.cxx \ + GEOMToolsGUI_DeleteDlg.cxx \ + GEOMToolsGUI_MarkerDlg.cxx \ + GEOMToolsGUI_PublishDlg.cxx \ + GEOMToolsGUI_MaterialPropertiesDlg.cxx \ + GEOMToolsGUI_LineWidthDlg.cxx MOC_FILES = \ GEOMToolsGUI_TransparencyDlg_moc.cxx \ GEOMToolsGUI_NbIsosDlg_moc.cxx \ - GEOMToolsGUI_DeleteDlg_moc.cxx + GEOMToolsGUI_DeflectionDlg_moc.cxx \ + GEOMToolsGUI_DeleteDlg_moc.cxx \ + GEOMToolsGUI_MarkerDlg_moc.cxx \ + GEOMToolsGUI_PublishDlg_moc.cxx \ + GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx \ + GEOMToolsGUI_LineWidthDlg_moc.cxx nodist_libGEOMToolsGUI_la_SOURCES = \ $(MOC_FILES) @@ -66,13 +78,14 @@ libGEOMToolsGUI_la_CPPFLAGS = \ $(CORBA_INCLUDES) \ -I$(srcdir)/../OBJECT \ -I$(srcdir)/../GEOMBase \ + -I$(srcdir)/../Material \ -I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMImpl \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOMToolsGUI_la_LDFLAGS = \ ../GEOMBase/libGEOMBase.la \ + ../Material/libMaterial.la \ ../GEOMGUI/libGEOM.la \ - $(GUI_LDFLAGS) -lVTKViewer -lOCCViewer -lsuit -lSalomeApp + $(GUI_LDFLAGS) -lVTKViewer -lOCCViewer -lsuit -lSalomeApp -lPyConsole diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc index 82f5f5d44..4661de78e 100644 --- a/src/GEOM_I/GEOM_DumpPython.cc +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifdef WNT #pragma warning( disable:4786 ) #endif @@ -35,6 +36,25 @@ #include #include +//======================================================================= +//function : RemoveTabulation +//purpose : +//======================================================================= +void RemoveTabulation( TCollection_AsciiString& theScript ) +{ + std::string aString( theScript.ToCString() ); + std::string::size_type aPos = 0; + while( aPos < aString.length() ) + { + aPos = aString.find( "\n\t", aPos ); + if( aPos == std::string::npos ) + break; + aString.replace( aPos, 2, "\n" ); + aPos++; + } + theScript = aString.c_str(); +} + //======================================================================= //function : DumpPython //purpose : @@ -42,7 +62,8 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished, - CORBA::Boolean& isValidScript) + CORBA::Boolean isMultiFile, + CORBA::Boolean& isValidScript) { SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy); if(CORBA::is_nil(aStudy)) @@ -52,7 +73,8 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, if(CORBA::is_nil(aSO)) return new Engines::TMPFile(0); - Resource_DataMapOfAsciiStringAsciiString aMap; + TObjectData objData; + std::vector objectDataVec; TVariablesList aVariableMap; @@ -64,9 +86,23 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::Object_var obj = _orb->string_to_object(IOR); GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_narrow(obj); if(!CORBA::is_nil(GO)) { - CORBA::String_var aName = aValue->GetName(); - CORBA::String_var anEntry = GO->GetEntry(); - aMap.Bind( (char*)anEntry.in(), (char*)aName.in() ); + CORBA::String_var aName = aValue->GetName(); + CORBA::String_var anEntry = GO->GetEntry(); + CORBA::String_var aStudyEntry = aValue->GetID(); + objData._name = aName.in(); + objData._entry = anEntry.in(); + objData._studyEntry = aStudyEntry.in(); + + //Find Drawable Attribute + SALOMEDS::GenericAttribute_var aGenAttr; + if(aValue->FindAttribute(aGenAttr, "AttributeDrawable") ) { + SALOMEDS::AttributeDrawable_var aDrw = SALOMEDS::AttributeDrawable::_narrow(aGenAttr); + objData._unpublished = !aDrw->IsDrawable(); + } else { + objData._unpublished = false; + } + + objectDataVec.push_back( objData ); //Find attribute with list of used notebook variables SALOMEDS::GenericAttribute_var anAttr; @@ -85,19 +121,46 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, } aStates->AddState(aState); } - aVariableMap.insert(pair(TCollection_AsciiString(anEntry),aStates)); + aVariableMap.insert(std::make_pair(TCollection_AsciiString(anEntry),aStates)); } } } } - TCollection_AsciiString aScript = - "### This file is generated by SALOME automatically by dump python functionality\n" - "### of GEOM component\n\n"; - aScript += _impl->DumpPython(aStudy->StudyId(), aMap, aVariableMap, isPublished, isValidScript); + TCollection_AsciiString aScript; + aScript += _impl->DumpPython(aStudy->StudyId(), objectDataVec, aVariableMap, isPublished, isMultiFile, isValidScript); if (isPublished) { + + SALOMEDS::AttributeParameter_var ap = aStudy->GetModuleParameters("Interface Applicative", + ComponentDataType(), + -1); + if(!CORBA::is_nil(ap)) { + //Add the id parameter of the object + std::vector::iterator it = objectDataVec.begin(); + for( ;it != objectDataVec.end(); it++ ) { + + //1. Encode entry + if ( (*it)._studyEntry.Length() < 7 ) continue; + std::string tail( (*it)._studyEntry.ToCString(), 6, (*it)._studyEntry.Length()-1 ); + std::string newEntry(ComponentDataType()); + newEntry+=("_"+tail); + + CORBA::String_var anEntry = CORBA::string_dup(newEntry.c_str()); + + if( ap->IsSet(anEntry, 6) ) { //6 Means string array, see SALOMEDS_Attributes.idl AttributeParameter interface + std::string idCommand = std::string("geompy.getObjectID(") + GetDumpName((*it)._studyEntry.ToCString()) + std::string(")"); + SALOMEDS::StringSeq_var aSeq= ap->GetStrArray(anEntry); + int oldLenght = aSeq->length(); + aSeq->length(oldLenght+2); + aSeq[oldLenght] = CORBA::string_dup("_PT_OBJECT_ID_"); + aSeq[oldLenght + 1] = CORBA::string_dup(idCommand.c_str()); + ap->SetStrArray( anEntry, aSeq ); + } + } + } + //Output the script that sets up the visual parameters. char* script = aStudy->GetDefaultScript(ComponentDataType(), "\t"); if (script && strlen(script) > 0) { @@ -107,7 +170,12 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, } } - aScript += "\n\tpass\n"; + if( isMultiFile ) + aScript += "\n\tpass"; + aScript += "\n"; + + if( !isMultiFile ) // remove unnecessary tabulation + RemoveTabulation( aScript ); int aLen = aScript.Length(); unsigned char* aBuffer = new unsigned char[aLen+1]; diff --git a/src/GEOM_I/GEOM_GEOM_I.hxx b/src/GEOM_I/GEOM_GEOM_I.hxx index b9ef2ed75..d57cf9de3 100755 --- a/src/GEOM_I/GEOM_GEOM_I.hxx +++ b/src/GEOM_I/GEOM_GEOM_I.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_GEOM_I.hxx // Author : Alexander A. BORODIN // Module : GEOM @@ -27,7 +28,7 @@ #define _GEOM_GEOM_I_HXX_ #ifdef WNT - #if defined GEOM_I_EXPORTS + #if defined GEOM_I_EXPORTS || defined GEOMEngine_EXPORTS #if defined WIN32 #define GEOM_I_EXPORT __declspec( dllexport ) #else diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 6e8e4e430..fe877f791 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifdef WNT #pragma warning( disable:4786 ) #endif @@ -28,7 +29,8 @@ #include "GEOM_Gen_i.hh" #include "GEOM_Object_i.hh" -#include +#include +#include #include "Utils_CorbaException.hxx" #include "OpUtil.hxx" @@ -38,6 +40,8 @@ #include "GEOM_Object_i.hh" #include "GEOM_Object.hxx" #include "GEOM_Function.hxx" +#include "GEOM_ISubShape.hxx" +#include #include "GEOMImpl_Types.hxx" #include "GEOMImpl_CopyDriver.hxx" @@ -46,9 +50,14 @@ #include #include #include +#include +#include +#include #include #include #include +//#include +#include #include #include "SALOMEDS_Tool.hxx" @@ -57,11 +66,11 @@ // function : GEOM_Gen_i() // purpose : constructor to be called for servant creation. //============================================================================ -GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) : +GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName) { _thisObj = this; @@ -104,9 +113,9 @@ GEOM_Gen_i::~GEOM_Gen_i() { // purpose : //============================================================================ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(IORString)); if (!CORBA::is_nil(anObject)) { @@ -123,9 +132,9 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, // : The IOR (IORName) of object created is returned //============================================================================ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { SALOMEDS::Study_var aStudy = theSObject->GetStudy(); @@ -154,9 +163,9 @@ bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) // purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) throw (SALOME::SALOME_Exception) + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); SALOMEDS::SObject_var aResultSO; @@ -173,9 +182,12 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); aName->SetValue("Geometry"); + aName->UnRegister(); anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap"); - SALOMEDS::AttributePixMap::_narrow(anAttr)->SetPixMap("ICON_OBJBROWSER_Geometry"); - aStudyBuilder->DefineComponentInstance(aFather, GEOM_Gen::_this()); + SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry"); + aPixMap->UnRegister(); + aStudyBuilder->DefineComponentInstance(aFather, (GEOM::GEOM_Gen_var)GEOM_Gen::_this()); } if (aFather->_is_nil()) return aResultSO; @@ -186,126 +198,289 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, aResultSO = SALOMEDS::SObject::_duplicate(theSObject); //SRN: Added Aug 24,2004 : for the method AddInStudy with theFather argumenet != NULL //THROW_SALOME_CORBA_EXCEPTION("Publish in study supervision graph error",SALOME::BAD_PARAM); } - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR"); - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - //char *aGeomObjIOR = _orb->object_to_string(theObject); - CORBA::String_var aGeomObjIOR = _orb->object_to_string(theObject); - //anIOR->SetValue(CORBA::string_dup(aGeomObjIOR)); - anIOR->SetValue(aGeomObjIOR); + CORBA::String_var aGeomObjIOR = _orb->object_to_string(theObject); + aResultSO->SetAttrString("AttributeIOR",aGeomObjIOR); - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap"); - SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); TCollection_AsciiString aShapeName("Shape_"); - if ( aShape->GetType() == GEOM_GROUP ) { + CORBA::Long mytype=aShape->GetType(); + if ( mytype == GEOM_GROUP ) { GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() ); switch ( (TopAbs_ShapeEnum)anOp->GetType( aShape ) ) { case TopAbs_VERTEX: - aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_PNT" ); + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_PNT" ); aShapeName = "Group_Of_Vertices_"; break; case TopAbs_EDGE: - aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_EDGE" ); + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_EDGE"); aShapeName = "Group_Of_Edges_"; break; case TopAbs_FACE: - aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_FACE" ); + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_FACE"); aShapeName = "Group_Of_Faces_"; break; case TopAbs_SOLID: - aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_SOLID" ); + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_SOLID"); aShapeName = "Group_Of_Solids_"; break; } - } else if ( aShape->GetType() == GEOM_MARKER ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_LCS" ); + } else if ( mytype == GEOM_MARKER ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_LCS"); aShapeName = "LocalCS_"; - } else if ( aShape->GetShapeType() == GEOM::COMPOUND ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); + } else if ( mytype > ADVANCED_BASE ) { + char buf[20]; + sprintf( buf, "%d", aShape->GetType() ); + std::string advId = "ICON_OBJBROWSER_ADVANCED_"; advId += buf; + aResultSO->SetAttrString("AttributePixMap",advId.c_str()); + aShapeName = "Advanced_"; + } else { + GEOM::shape_type myshapetype=aShape->GetShapeType(); + if ( myshapetype == GEOM::COMPOUND ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPOUND" ); aShapeName = "Compound_"; - } else if ( aShape->GetShapeType() == GEOM::COMPSOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); + } else if ( myshapetype == GEOM::COMPSOLID ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPSOLID"); aShapeName = "Compsolid_"; - } else if ( aShape->GetShapeType() == GEOM::SOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); + } else if ( myshapetype == GEOM::SOLID ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SOLID"); aShapeName = "Solid_"; - } else if ( aShape->GetShapeType() == GEOM::SHELL ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); + } else if ( myshapetype == GEOM::SHELL ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SHELL"); aShapeName = "Shell_"; - } else if ( aShape->GetShapeType() == GEOM::FACE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); + } else if ( myshapetype == GEOM::FACE ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_FACE"); aShapeName = "Face_"; - } else if ( aShape->GetShapeType() == GEOM::WIRE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); + } else if ( myshapetype == GEOM::WIRE ) { + aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_WIRE"); aShapeName = "Wire_"; - } else if ( aShape->GetShapeType() == GEOM::EDGE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); + } else if ( myshapetype == GEOM::EDGE ) { + aResultSO->SetAttrString("AttributePixMap", "ICON_OBJBROWSER_EDGE"); aShapeName = "Edge_"; - } else if ( aShape->GetShapeType() == GEOM::VERTEX ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); + } 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)); - // asv : 11.11.04 Introducing a more sofisticated method of name creation, just as - // it is done in GUI in GEOMBase::GetDefaultName() - not just add a Tag() == number - // of objects in the study, but compute a number of objects with the same prefix - // and build a new name as Prefix_N+1 - if ( strlen( theName ) == 0 ) { // MOST PROBABLY CALLED FROM BATCHMODE OR SUPERVISOR - int i = 0; // (WITH EMPTY NEW NAME) - SALOMEDS::SObject_var obj; - TCollection_AsciiString aNewShapeName; - do { - aNewShapeName = aShapeName + TCollection_AsciiString(++i); - obj = theStudy->FindObject( aNewShapeName.ToCString() ); + // BEGIN: try to find existed name for current shape + bool HasName = false; + // recieve current TopoDS shape + CORBA::String_var entry = aShape->GetEntry(); + Handle(GEOM_Object) aGShape = _impl->GetObject(aShape->GetStudyID(), entry); + TopoDS_Shape TopoSh = aGShape->GetValue(); + // find label of main shape + GEOM::GEOM_Object_var aMainSh = aShape; + while( !aMainSh->IsMainShape() ) { + aMainSh = aMainSh->GetMainShape(); + } + entry = aMainSh->GetEntry(); + Handle(GEOM_Object) anObj = _impl->GetObject(aMainSh->GetStudyID(), entry); + TDF_Label aMainLbl = anObj->GetFunction(1)->GetNamingEntry(); + + // check all named shapes using iterator + TDF_ChildIDIterator anIt (aMainLbl, TNaming_NamedShape::GetID(), Standard_True); + + for (; anIt.More() && !HasName; anIt.Next()) { + Handle(TNaming_NamedShape) anAttr = + Handle(TNaming_NamedShape)::DownCast(anIt.Value()); + if (anAttr.IsNull()) continue; + TopoDS_Shape S = anAttr->Get(); + if (S.IsEqual(TopoSh)) { + TDF_Label L = anAttr->Label(); + Handle(TDataStd_Name) aName; + if (L.FindAttribute(TDataStd_Name::GetID(), aName)) { + aShapeName = aName->Get(); + HasName = true; + } } - while ( !obj->_is_nil() ); - aShapeName = aNewShapeName; } - else // MOST PROBABLY CALLED FROM GEOM GUI (ALREADY WITH VALID NAME) - aShapeName = TCollection_AsciiString((char*)theName); + // END: try to find existed name for current shape + + if (!HasName) { + // asv : 11.11.04 Introducing a more sofisticated method of name creation, just as + // it is done in GUI in GEOMBase::GetDefaultName() - not just add a Tag() == number + // of objects in the study, but compute a number of objects with the same prefix + // and build a new name as Prefix_N+1 + if ( strlen( theName ) == 0 ) { // MOST PROBABLY CALLED FROM BATCHMODE OR SUPERVISOR + int i = 0; // (WITH EMPTY NEW NAME) + SALOMEDS::SObject_var obj; + TCollection_AsciiString aNewShapeName; + do { + aNewShapeName = aShapeName + TCollection_AsciiString(++i); + obj = theStudy->FindObject( aNewShapeName.ToCString() ); + } + while ( !obj->_is_nil() ); + aShapeName = aNewShapeName; + } + else // MOST PROBABLY CALLED FROM GEOM GUI (ALREADY WITH VALID NAME) + aShapeName = TCollection_AsciiString((char*)theName); + } //Set the study entry as a name of the published GEOM_Object - aShape->SetStudyEntry(aResultSO->GetID()); + CORBA::String_var anID =aResultSO->GetID(); + aShape->SetStudyEntry(anID.in()); //Set a name of the added shape - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName"); - SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr); - aNameAttrib->SetValue(aShapeName.ToCString()); + aResultSO->SetAttrString("AttributeName",aShapeName.ToCString()); //Set NoteBook variables used in the object creation TCollection_AsciiString aVars; - SALOMEDS::ListOfListOfStrings_var aSections = theStudy->ParseVariables(aShape->GetParameters()); + CORBA::String_var aString=aShape->GetParameters(); + SALOMEDS::ListOfListOfStrings_var aSections = theStudy->ParseVariables(aString); for(int i = 0, n = aSections->length(); i < n; i++) { SALOMEDS::ListOfStrings aListOfVars = aSections[i]; for(int j = 0, m = aListOfVars.length(); j < m; j++) { if(theStudy->IsVariable(aListOfVars[j].in())) - aVars += TCollection_AsciiString(aListOfVars[j].in()); + aVars += TCollection_AsciiString(aListOfVars[j].in()); if(j != m-1) - aVars += ":"; + aVars += ":"; } if(i != n-1) aVars += "|"; } - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString"); - SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr); - aStringAttrib->SetValue(aVars.ToCString()); + aResultSO->SetAttrString("AttributeString",aVars.ToCString()); + + aFather->UnRegister(); //Set a name of the GEOM object - aShape->SetName(theName); + aShape->SetName(aShapeName.ToCString()); return aResultSO._retn(); } +//============================================================================ +// function : CreateAndPublishGroup +// purpose : auxilary for PublishNamedShapesInStudy +//============================================================================ +void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_var theMainShape, + const TopTools_IndexedMapOfShape& anIndices, + const TopTools_SequenceOfShape& SeqS, + const TColStd_SequenceOfAsciiString& SeqN, + const Standard_CString& GrName, + GEOM::ListOfGO_var aResList) +{ + CORBA::String_var entry = theMainShape->GetEntry(); + Handle(GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry); + Handle(TColStd_HArray1OfInteger) anArray; + if(SeqS.Length()>0) { + // create a group + GEOM::GEOM_IGroupOperations_var GOp = GetIGroupOperations(theStudy->StudyId()); + GEOM::GEOM_Object_ptr GrObj = + GOp->CreateGroup( theMainShape, SeqS.Value(1).ShapeType() ); + AddInStudy(theStudy, GrObj, GrName, theMainShape._retn()); + CORBA::String_var GrEntry = GrObj->GetEntry(); + Handle(GEOM_Object) HGrObj = _impl->GetObject(GrObj->GetStudyID(), GrEntry); + // add named objects + //Handle(GEOM_Object) anObj; + for(int i=1; i<=SeqS.Length(); i++) { + TopoDS_Shape aValue = SeqS.Value(i); + //anArray = new TColStd_HArray1OfInteger(1,1); + Standard_Integer anIndex = anIndices.FindIndex(aValue); + //anArray->SetValue(1, anIndex); + GOp->AddObject(GrObj,anIndex); + //anObj = GEOM_Engine::GetEngine()->AddObject(aMainShape->GetDocID(), GEOM_SUBSHAPE); + //if (anObj.IsNull()) continue; + //Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOM_Object::GetSubShapeID(), 1); + //if (aFunction.IsNull()) continue; + //GEOM_ISubShape aSSI(aFunction); + //aSSI.SetMainShape(aMainShape->GetLastFunction()); + //aSSI.SetIndices(anArray); + //aFunction->SetValue(aValue); + //GOp->UnionIDs(GrObj, anIndex); + //SALOMEDS::SObject_var aResultSO; + //TCollection_AsciiString anEntry; + //TDF_Tool::Entry(anObj->GetEntry(),anEntry); + //GEOM::GEOM_Object_var aGObj = GetObject(anObj->GetDocID(), anEntry.ToCString()); + //AddInStudy(theStudy, aGObj._retn(), SeqN.Value(i).ToCString(), GrObj); + } + } +} + + +//============================================================================ +// function : PublishNamedShapesInStudy +// purpose : +//============================================================================ +GEOM::ListOfGO* GEOM_Gen_i:: + PublishNamedShapesInStudy(SALOMEDS::Study_ptr theStudy, + //SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject) +{ + //Unexpect aCatch(SALOME_SalomeException); + GEOM::ListOfGO_var aResList = new GEOM::ListOfGO; + + //CORBA::Object_var theObject = theSObject->GetObject(); + GEOM::GEOM_Object_var theMainShape = GEOM::GEOM_Object::_narrow(theObject); + if(theMainShape->_is_nil()) return aResList._retn(); + + CORBA::String_var entry = theMainShape->GetEntry(); + Handle(GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry); + if (aMainShape.IsNull()) return aResList._retn(); + TopoDS_Shape MainSh = aMainShape->GetValue(); + + TDF_Label aMainLbl = aMainShape->GetEntry(); + TopTools_SequenceOfShape SolidSeqS, FaceSeqS, EdgeSeqS, VertSeqS; + TColStd_SequenceOfAsciiString SolidSeqN, FaceSeqN, EdgeSeqN, VertSeqN; + TDF_ChildIDIterator anIt(aMainLbl, TNaming_NamedShape::GetID(), Standard_True); + for(; anIt.More(); anIt.Next()) { + Handle(TNaming_NamedShape) anAttr = + Handle(TNaming_NamedShape)::DownCast(anIt.Value()); + if(anAttr.IsNull()) continue; + TopoDS_Shape S = anAttr->Get(); + TDF_Label L = anAttr->Label(); + //if(S.IsEqual(MainSh)) continue; + Handle(TDataStd_Name) aName; + if(L.FindAttribute(TDataStd_Name::GetID(),aName)) { + TCollection_ExtendedString EName = aName->Get(); + if(S.ShapeType()==TopAbs_SOLID) { + SolidSeqS.Append(S); + SolidSeqN.Append(aName->Get()); + } + else if(S.ShapeType()==TopAbs_FACE) { + FaceSeqS.Append(S); + FaceSeqN.Append(aName->Get()); + } + else if(S.ShapeType()==TopAbs_EDGE) { + EdgeSeqS.Append(S); + EdgeSeqN.Append(aName->Get()); + } + else if(S.ShapeType()==TopAbs_VERTEX) { + VertSeqS.Append(S); + VertSeqN.Append(aName->Get()); + } + } + } + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(MainSh, anIndices); + + CreateAndPublishGroup(theStudy, theMainShape, anIndices, SolidSeqS, SolidSeqN, + "Group_Of_Named_Solids", aResList); + + CreateAndPublishGroup(theStudy, theMainShape, anIndices, FaceSeqS, FaceSeqN, + "Group_Of_Named_Faces", aResList); + + CreateAndPublishGroup(theStudy, theMainShape, anIndices, EdgeSeqS, EdgeSeqN, + "Group_Of_Named_Edges", aResList); + + CreateAndPublishGroup(theStudy, theMainShape, anIndices, VertSeqS, VertSeqN, + "Group_Of_Named_Vertices", aResList); + + return aResList._retn(); +} + + //============================================================================ // function : Save() // purpose : save OCAF/Geom document //============================================================================ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) { + const char* theURL, + bool isMultiFile) { SALOMEDS::TMPFile_var aStreamFile; // Get a temporary directory to store a file std::string aTmpDir = (isMultiFile)?theURL:SALOMEDS_Tool::GetTmpDir(); @@ -326,7 +501,8 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, // Prepare a file name to open TCollection_AsciiString aNameWithExt(""); if (isMultiFile) - aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str()); + aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath + (theComponent->GetStudy()->URL())).c_str()); aNameWithExt += TCollection_AsciiString("_GEOM.sgd"); aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString()); // Build a full file name of temporary file @@ -348,8 +524,8 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, // purpose : //============================================================================ SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) { + const char* theURL, + bool isMultiFile) { SALOMEDS::TMPFile_var aStreamFile = Save(theComponent, theURL, isMultiFile); return aStreamFile._retn(); } @@ -360,9 +536,9 @@ SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, // purpose : //============================================================================ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile) { + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) { if (theStream.length() <= 9) { MESSAGE("The TMPFile is too short : " << theStream.length() << " bytes "); @@ -389,7 +565,8 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, // Prepare a file name to open TCollection_AsciiString aNameWithExt(""); if (isMultiFile) - aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str()); + aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath + (theComponent->GetStudy()->URL())).c_str()); aNameWithExt += TCollection_AsciiString("_GEOM.sgd"); TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt); @@ -411,9 +588,9 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, // purpose : //============================================================================ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile) { + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) { return Load(theComponent, theStream, theURL, isMultiFile); } @@ -424,7 +601,8 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, //============================================================================ void GEOM_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) { - _impl->Close(theComponent->GetStudy()->StudyId()); + SALOMEDS::Study_var aStudy= theComponent->GetStudy(); + _impl->Close(aStudy->StudyId()); } //============================================================================ @@ -438,7 +616,10 @@ CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) { SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(anIOR->Value())); + CORBA::String_var aString=anIOR->Value(); + anIOR->UnRegister(); + CORBA::Object_var anObj = _orb->string_to_object(aString); + GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(anObj); // If the object is null one it can't be copied: return false if (anObject->_is_nil()) return false; return true; @@ -448,14 +629,16 @@ CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) { // function : CopyFrom() // purpose : //============================================================================ -SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) { +SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) +{ // Declare a sequence of the byte to store the copied object SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile; // Try to get GEOM_Object object by given SObject SALOMEDS::GenericAttribute_var anAttr; if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return aStreamFile._retn(); - GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())); + GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow + (_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())); if (anObject->_is_nil()) return aStreamFile._retn(); aStreamFile = anObject->GetShapeStream(); @@ -483,15 +666,15 @@ CORBA::Boolean GEOM_Gen_i::CanPaste(const char* theComponentName, CORBA::Long th // purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject) { + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject) { // Find the current Study and StudyBuilder SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); // Retrieve a TopoDS_Shape from byte stream TopoDS_Shape aTopology; - istrstream aStreamedBrep((char*) &theStream[0], theStream.length()); + std::istringstream aStreamedBrep((char*) &theStream[0]); BRep_Builder aBuilder; try { BRepTools::Read(aTopology, aStreamedBrep, aBuilder); @@ -523,6 +706,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var objStr = _orb->object_to_string(obj); anIOR->SetValue(objStr.in()); + anIOR->UnRegister(); // Return the created in the Study SObject return aNewSO._retn(); @@ -542,9 +726,9 @@ char* GEOM_Gen_i::ComponentDataType() // purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - const char* theName, - GEOM::GEOM_Object_ptr theFather) + GEOM::GEOM_Object_ptr theObject, + const char* theName, + GEOM::GEOM_Object_ptr theFather) { SALOMEDS::SObject_var aResultSO; if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO; @@ -557,6 +741,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR.in()); if(aFatherSO->_is_nil()) return aResultSO._retn(); aResultSO = aStudyBuilder->NewObject(aFatherSO); + aFatherSO->UnRegister(); //aStudyBuilder->Addreference(aResultSO, aResultSO); } @@ -568,14 +753,20 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, if(aLength < 1) return aResultSO._retn(); //Publish the arguments + TCollection_AsciiString aPrevID; // to avoid multiple references to same object for(Standard_Integer i = 0; i< aLength; i++) { GEOM::GEOM_Object_var anObject = aList[i]; if(anObject->_is_nil()) continue; IOR = _orb->object_to_string(anObject); SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(IOR.in()); if(aSO->_is_nil()) continue; + CORBA::String_var anID = aSO->GetID(); + if ( aPrevID == anID.in() ) continue; + aPrevID = anID.in(); SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO); aStudyBuilder->Addreference(aSubSO, aSO); + aSO->UnRegister(); + aSubSO->UnRegister(); } return aResultSO._retn(); @@ -586,22 +777,59 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, // purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments. // To be used from python scripts out of geompy.addToStudy (non-default usage) //============================================================================ -CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - const GEOM::ListOfGO& theArgs, - GEOM::find_shape_method theFindMethod, - CORBA::Boolean theInheritFirstArg) +GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix) { + GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject)) - return false; + return aParts._retn(); - // find SObject in the study + // find SObject in the study if it is already published CORBA::String_var anIORo = _orb->object_to_string(theObject); SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(anIORo.in()); - if (CORBA::is_nil(aSO)) - return false; + //PTv, IMP 0020001, The salome object + // is not obligatory in case of invokation from script + // if (CORBA::is_nil(aSO)) + // return aParts._retn(); + + aParts = RestoreSubShapes(theStudy, theObject, aSO, theArgs, + theFindMethod, theInheritFirstArg, theAddPrefix); + if (!CORBA::is_nil(aSO)) aSO->UnRegister(); + return aParts._retn(); +} + +//============================================================================ +// function : RestoreGivenSubShapesO +// purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments. +// To be used from python scripts, generated by Dump Python. +//============================================================================ +GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesO (SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix) +{ + GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; + if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject)) + return aParts._retn(); - return RestoreSubShapes(theStudy, theObject, aSO, theArgs, theFindMethod, theInheritFirstArg); + // find SObject in the study if it is already published + CORBA::String_var anIORo = _orb->object_to_string(theObject); + SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(anIORo.in()); + //PTv, IMP 0020001, The salome object + // is not obligatory in case of invokation from script + // if (CORBA::is_nil(aSO)) + // return aParts._retn(); + + aParts = RestoreGivenSubShapes(theStudy, theObject, aSO, theArgs, + theFindMethod, theInheritFirstArg, theAddPrefix); + if (!CORBA::is_nil(aSO)) aSO->UnRegister(); + return aParts._retn(); } //============================================================================ @@ -609,18 +837,20 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy, // purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments. // To be used from GUI and from geompy.addToStudy //============================================================================ -CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - const GEOM::ListOfGO& theArgs, - GEOM::find_shape_method theFindMethod, - CORBA::Boolean theInheritFirstArg) +GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix) { + GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject)) - return false; + return aParts._retn(); SALOMEDS::GenericAttribute_var anAttr; if (!theSObject->FindAttribute(anAttr, "AttributeIOR")) - return false; + return aParts._retn(); SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var anIORso = anAttrIOR->Value(); @@ -628,9 +858,37 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy, // get Object from SObject GEOM::GEOM_Object_var anO = GEOM::GEOM_Object::_narrow(_orb->string_to_object(anIORso)); if (CORBA::is_nil(anO)) - return false; + return aParts._retn(); - return RestoreSubShapes(theStudy, anO, theSObject, theArgs, theFindMethod, theInheritFirstArg); + aParts = RestoreSubShapes(theStudy, anO, theSObject, theArgs, + theFindMethod, theInheritFirstArg, theAddPrefix); + return aParts._retn(); +} + +//============================================================================ +// function : addToListOfGO +// purpose : static local function +//============================================================================ +static void addToListOfGO( GEOM::GEOM_Object_ptr theObject, + GEOM::ListOfGO& theList ) +{ + const int oldLen = theList.length(); + theList.length(oldLen + 1); + theList[ oldLen ] = GEOM::GEOM_Object::_duplicate( theObject ); +} + +//============================================================================ +// function : addToListOfGO +// purpose : static local function +//============================================================================ +static void addToListOfGO( const GEOM::ListOfGO& theSrcList, + GEOM::ListOfGO& theTrgList ) +{ + const int oldLen = theTrgList.length(); + const int srcLen = theSrcList.length(); + theTrgList.length(oldLen + srcLen); + for( int i = 0; i < srcLen; i++ ) + theTrgList[ oldLen + i ] = GEOM::GEOM_Object::_duplicate( theSrcList[ i ] ); } //============================================================================ @@ -638,15 +896,22 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy, // purpose : Private method. Works only if both theObject and theSObject // are defined, and does not check, if they correspond to each other. //============================================================================ -CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - SALOMEDS::SObject_ptr theSObject, - const GEOM::ListOfGO& theArgs, - GEOM::find_shape_method theFindMethod, - CORBA::Boolean theInheritFirstArg) +GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + SALOMEDS::SObject_ptr theSObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix) { - if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) || CORBA::is_nil(theSObject)) - return false; + GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; + //PTv, IMP 0020001, The salome object + // is not obligatory in case of invokation from script + if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/) + return aParts._retn(); + + // For Dump Python (mantis issue 0020768) + GEOM::ListOfGO_var anOutArgs = new GEOM::ListOfGO; // Arguments to be published GEOM::ListOfGO_var aList; @@ -659,7 +924,7 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy, aList = new GEOM::ListOfGO; aList->length(aLength); for (int i = 0; i < aLength; i++) { - aList[i] = theArgs[i]; + aList[i] = GEOM::GEOM_Object::_duplicate( theArgs[i] ); } } else { @@ -670,172 +935,891 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy, } if (aLength < 1) - return false; + return aParts._retn(); if (theInheritFirstArg || (nbArgsActual == 1)) { // Do not publish argument's reflection, // but only reconstruct its published sub-shapes - GEOM::GEOM_Object_var anArgO = aList[0]; - CORBA::String_var anIOR = _orb->object_to_string(anArgO); + CORBA::String_var anIOR = _orb->object_to_string(aList[0]); SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in()); - GEOM::ListOfGO_var aParts = - RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod); + // remember restored objects for Python Dump + addToListOfGO(aList[0], anOutArgs); + + aParts = RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, + anOutArgs, theFindMethod, theAddPrefix); // set the color of the transformed shape to the color of initial shape theObject->SetColor(aList[0]->GetColor()); + // set the texture + if (theObject->GetShapeType() == GEOM::VERTEX) { + theObject->SetMarkerStd(aList[0]->GetMarkerType(), aList[0]->GetMarkerSize()); + if (aList[0]->GetMarkerType() == GEOM::MT_USER) + theObject->SetMarkerTexture(aList[0]->GetMarkerTexture()); + } - return (aParts->length() > 0); + anArgSO->UnRegister(); + } + else { + // Get interface, containing method, which we will use to reconstruct sub-shapes + GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId()); + GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId()); + GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId()); + + // Reconstruct arguments and tree of sub-shapes of the arguments + CORBA::String_var anIOR; + SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); + for (Standard_Integer i = 0; i < aLength; i++) + { + GEOM::GEOM_Object_var anArgO = aList[i]; + if (!CORBA::is_nil(anArgO)) { + anIOR = _orb->object_to_string(anArgO); + SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in()); + TCollection_AsciiString anArgName; + if (CORBA::is_nil(anArgSO)) { + anArgName = "arg_"; + anArgName += TCollection_AsciiString(i); + } + else { + anArgName = anArgSO->GetName(); + } + + // Find a sub-shape of theObject in place of the argument + GEOM::GEOM_Object_var aSubO; + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + { + // Use GetInPlace + aSubO = aShapesOp->GetInPlace(theObject, anArgO); + } + break; + case GEOM::FSM_MultiTransformed: + { + // Only for Multi-transformations + GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anArgO, theObject); + if (!CORBA::is_nil(anArgOTrsf)) { + CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry(); + Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry); + Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction(); + anArgOTrsfFun->SetDescription(""); + aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf); + } + /* + Handle(GEOM_Function) anOFun = theObject->GetLastFunction(); + if (!anOFun.IsNull()) { + CORBA::String_var entryArg = anArgO->GetEntry(); + Handle(GEOM_Object) anArgOImpl = _impl->GetObject(anArgO->GetStudyID(), entryArg); + if (!anArgOImpl.IsNull()) { + TopoDS_Shape anArgOShape = anArgOImpl->GetValue(); + TopoDS_Shape aMultiArgShape; + //GEOM::GEOM_Object_var anArgOMulti; // ??? + switch (anOFun->GetType()) { + case TRANSLATE_1D: + { + GEOMImpl_ITranslate aTI (anOFun); + aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape1D(anArgOShape, &aTI); + //anArgOMulti = aTrsfOp->Translate1D(anArgO, , , ); + } + break; + case TRANSLATE_2D: + { + GEOMImpl_ITranslate aTI (anOFun); + aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape2D(anArgOShape, &aTI); + } + break; + case ROTATE_1D: + { + GEOMImpl_IRotate aTI (anOFun); + //aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape2D(anArgOShape, &aTI); + } + break; + case ROTATE_2D: + { + GEOMImpl_IRotate aTI (anOFun); + //aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape2D(anArgOShape, &aTI); + } + break; + default: + {} + } + GEOM::GEOM_Object_var anArgOMulti = (aMultiArgShape); // TODO + Handle(GEOM_Function) anArgOMultiFun = anArgOMulti->GetLastFunction(); + anArgOMultiFun->SetDescription(""); + aSubO = aShapesOp->GetInPlace(theObject, anArgOMulti); + } + } + */ + } + break; + case GEOM::FSM_Transformed: + { + // transformation, cannot use GetInPlace, operate with indices + GEOM::ListOfLong_var anIDs = anArgO->GetSubShapeIndices(); + if (anIDs->length() > 1) { + // group + aSubO = aGroupOp->CreateGroup(theObject, aGroupOp->GetType(anArgO)); + if (!CORBA::is_nil(aSubO)) + aGroupOp->UnionIDs(aSubO, anIDs); + } + else if (anIDs->length() > 0) { + // single sub-shape + aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]); + } + } + break; + case GEOM::FSM_GetSame: + { + // Use GetSame + aSubO = aShapesOp->GetSame(theObject, anArgO); + } + break; + case GEOM::FSM_GetShapesOnShape: + { + // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids + aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject, + (short)GEOM::SOLID, GEOM::ST_ONIN); + } + break; + case GEOM::FSM_GetInPlaceByHistory: + { + // Use GetInPlaceByHistory + aSubO = aShapesOp->GetInPlaceByHistory(theObject, anArgO); + } + break; + default: + {} + } + + if (!CORBA::is_nil(aSubO)) { + // remember restored objects for Python Dump + addToListOfGO(anArgO, anOutArgs); + + // add to parts list + addToListOfGO( aSubO, aParts ); + + // Publish the sub-shape + SALOMEDS::SObject_var aSubSO; + if (!CORBA::is_nil(theSObject)) { + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_"; + } + aSubName += anArgName; + aSubSO = aStudyBuilder->NewObject(theSObject); + aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); + // Restore color + aSubO->SetColor(anArgO->GetColor()); + // set the texture + if (aSubO->GetShapeType() == GEOM::VERTEX) { + aSubO->SetMarkerStd(anArgO->GetMarkerType(), anArgO->GetMarkerSize()); + if (anArgO->GetMarkerType() == GEOM::MT_USER) + aSubO->SetMarkerTexture(anArgO->GetMarkerTexture()); + } + } + + if (!CORBA::is_nil(anArgSO)) { + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts; + if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) + // pass theObject, because only it has the history + aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, + theObject, anOutArgs, theFindMethod, theAddPrefix); + else + aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, + aSubO, anOutArgs, theFindMethod, theAddPrefix); + // add to parts list + addToListOfGO( aSubParts, aParts ); + } + } + else { // GetInPlace failed, try to build from published parts + if (!CORBA::is_nil(anArgSO)) { + SALOMEDS::SObject_var aSubSO; + if (!CORBA::is_nil(theSObject)) + aSubSO = aStudyBuilder->NewObject(theSObject); + + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts = + RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, + theObject, anOutArgs, theFindMethod, theAddPrefix); + + // add to parts list + addToListOfGO( aSubParts, aParts ); + + if (aSubParts->length() > 0) { + // remember restored objects for Python Dump + addToListOfGO(anArgO, anOutArgs); + + // try to build an argument from a set of its sub-shapes, + // that published and will be reconstructed + if (aSubParts->length() > 1) { + aSubO = aShapesOp->MakeCompound(aSubParts); + // add to parts list + addToListOfGO( aSubO, aParts ); + } + else { + aSubO = aSubParts[0]; + } + if (!CORBA::is_nil(aSubO) && !CORBA::is_nil(aSubSO)) { + // Publish the sub-shape + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_parts_of_"; + } + aSubName += anArgName; + aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); + // Restore color + aSubO->SetColor(anArgO->GetColor()); + // set the texture + if (aSubO->GetShapeType() == GEOM::VERTEX) { + aSubO->SetMarkerStd(anArgO->GetMarkerType(), anArgO->GetMarkerSize()); + if (anArgO->GetMarkerType() == GEOM::MT_USER) + aSubO->SetMarkerTexture(anArgO->GetMarkerTexture()); + } + } + } + else if (!CORBA::is_nil(aSubSO)) { + // remove created aSubSO, because no parts have been found + aStudyBuilder->RemoveObject(aSubSO); + } + } + } // try to build from published parts + anArgSO->UnRegister(); + } + } // process arguments + } + std::set anObjEntryMap; + GEOM::ListOfGO_var aResParts = new GEOM::ListOfGO; + int nbRes = 0; + int nb = aParts->length(); + aResParts->length(nb); + if (nb > 0) + { + Handle(GEOM_Object) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Function) aFunction = aMainObj->GetLastFunction(); + GEOM::TPythonDump pd (aFunction, true); + pd <<"["; + int i = 0, j = 0; + for ( ; i < nb; i++ ) + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aParts[ i ] ); + if (CORBA::is_nil(anObj)) + continue; + char* anEntry = anObj->GetEntry(); + if (anObjEntryMap.count(anEntry)) + continue; // already treated + anObjEntryMap.insert(anEntry); + aResParts[nbRes++] = anObj; + // clear python dump of object + Handle(GEOM_Object) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry); + Handle(GEOM_Function) anObjFun = aGeomObj->GetLastFunction(); + if ( !anObjFun.IsNull() ) + anObjFun->SetDescription( "" ); + if ( j > 0 ) + pd << ", "; + pd << aGeomObj; + j++; + } + pd <<"]" << " = geompy.RestoreGivenSubShapes(" << aMainObj << ", " << "["; + //i = 0; nb = theArgs.length(); j = 0; + i = 0; nb = anOutArgs->length(); j = 0; + for ( ; i < nb; i++ ) + { + //GEOM::GEOM_Object_var anObj = theArgs[ i ]; + GEOM::GEOM_Object_var anObj = anOutArgs[ i ]; + if (CORBA::is_nil(anObj)) + continue; + Handle(GEOM_Object) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry()); + if ( j > 0 ) + pd << ", "; + pd << aGeomObj; + j++; + } + pd <<"]" << ", " <<"geompy.GEOM."; + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + pd << "FSM_GetInPlace"; break; + case GEOM::FSM_MultiTransformed: + pd << "FSM_MultiTransformed"; break; + case GEOM::FSM_Transformed: + pd << "FSM_Transformed"; break; + case GEOM::FSM_GetSame: + pd << "FSM_GetSame"; break; + case GEOM::FSM_GetShapesOnShape: + pd << "FSM_GetShapesOnShape"; break; + case GEOM::FSM_GetInPlaceByHistory: + default: + pd << "FSM_GetInPlaceByHistory"; break; + } + pd << ", " << theInheritFirstArg << ", " << theAddPrefix << ")"; } + aResParts->length(nbRes); + return aResParts._retn(); +} - // Get interface, containing method, which we will use to reconstruct sub-shapes - GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId()); - GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId()); +//============================================================================ +// function : RestoreSubShapesOneLevel +// purpose : Private method +//============================================================================ +GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theOldSO, + SALOMEDS::SObject_ptr theNewSO, + GEOM::GEOM_Object_ptr theNewO, + GEOM::ListOfGO& theOutArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theAddPrefix) +{ + int i = 0; + GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; + GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO; + if (CORBA::is_nil(theStudy) || CORBA::is_nil(theOldSO) || + CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/) + return aParts._retn(); - // Reconstruct arguments and tree of sub-shapes of the arguments - CORBA::String_var anIOR; SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); - for (Standard_Integer i = 0; i < aLength; i++) - { - GEOM::GEOM_Object_var anArgO = aList[i]; - if (!CORBA::is_nil(anArgO)) { - anIOR = _orb->object_to_string(anArgO); - SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in()); - TCollection_AsciiString anArgName; - if (CORBA::is_nil(anArgSO)) { - anArgName = "arg_"; - anArgName += TCollection_AsciiString(i); - } - else { - anArgName = anArgSO->GetName(); - } - // Find a sub-shape of theObject in place of the argument - GEOM::GEOM_Object_var aSubO; - switch (theFindMethod) { - case GEOM::FSM_GetInPlace: - { - // Use GetInPlace - aSubO = aShapesOp->GetInPlace(theObject, anArgO); - } - break; - case GEOM::FSM_Transformed: - { - // transformation, cannot use GetInPlace, operate with indices - GEOM::ListOfLong_var anIDs = anArgO->GetSubShapeIndices(); - if (anIDs->length() > 1) { - // group - aSubO = aGroupOp->CreateGroup(theObject, aGroupOp->GetType(anArgO)); - if (!CORBA::is_nil(aSubO)) - aGroupOp->UnionIDs(aSubO, anIDs); - } - else { - // single sub-shape - aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]); - } - } - break; - case GEOM::FSM_GetSame: - { - // Use GetSame - aSubO = aShapesOp->GetSame(theObject, anArgO); - } - break; - case GEOM::FSM_GetShapesOnShape: - { - // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids - aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject, - (short)GEOM::SOLID, GEOM::ST_ONIN); - } - break; - case GEOM::FSM_GetInPlaceByHistory: - { - // Use GetInPlaceByHistory - aSubO = aShapesOp->GetInPlaceByHistory(theObject, anArgO); - } - break; - default: - {} - } + // Get interface, containing method, which we will use to reconstruct sub-shapes + GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId()); + GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId()); + GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId()); + + // Reconstruct published sub-shapes + SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator(theOldSO); - if (!CORBA::is_nil(aSubO)) { - // Publish the sub-shape - TCollection_AsciiString aSubName ("from_"); - aSubName += anArgName; - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(theSObject); - aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); - // Restore color - aSubO->SetColor(anArgO->GetColor()); - - if (!CORBA::is_nil(anArgSO)) { - // Restore published sub-shapes of the argument - if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) - // pass theObject, because only it has the history - RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod); - else - RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, aSubO, theFindMethod); - } + int aLen = 0; + for (it->Init(); it->More(); it->Next()) { + aLen++; + } + aParts->length(aLen); + + for (it->Init(); it->More(); it->Next()) { + SALOMEDS::SObject_var anOldSubSO = it->Value(); + + TCollection_AsciiString anArgName = anOldSubSO->GetName(); + + SALOMEDS::GenericAttribute_var anAttr; + if (anOldSubSO->FindAttribute(anAttr, "AttributeIOR")) { + SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Object_var anOldSubO = + GEOM::GEOM_Object::_narrow(_orb->string_to_object(anAttrIOR->Value())); + if (!CORBA::is_nil(anOldSubO)) { + // Find a sub-shape of theNewO in place of anOldSubO + GEOM::GEOM_Object_var aNewSubO; + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + { + // Use GetInPlace + aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO); + } + break; + case GEOM::FSM_MultiTransformed: + { + // Only for Multi-transformations + GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anOldSubO, theNewO); + if (!CORBA::is_nil(anArgOTrsf)) { + CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry(); + Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry); + Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction(); + anArgOTrsfFun->SetDescription(""); + aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf); + } + } + break; + case GEOM::FSM_Transformed: + { + // transformation, cannot use GetInPlace, operate with indices + GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices(); + if (anIDs->length() > 1) { + // group + aNewSubO = aGroupOp->CreateGroup(theNewO, aGroupOp->GetType(anOldSubO)); + if (!CORBA::is_nil(aNewSubO)) + aGroupOp->UnionIDs(aNewSubO, anIDs); + } + else { + // single sub-shape + aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]); + } + } + break; + case GEOM::FSM_GetSame: + { + // Use GetSame + aNewSubO = aShapesOp->GetSame(theNewO, anOldSubO); + } + break; + case GEOM::FSM_GetShapesOnShape: + { + // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids + aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO, + (short)GEOM::SOLID, GEOM::ST_ONIN); + } + break; + case GEOM::FSM_GetInPlaceByHistory: + { + // Use GetInPlaceByHistory + aNewSubO = aShapesOp->GetInPlaceByHistory(theNewO, anOldSubO); + } + break; + default: + {} + } + + if (!CORBA::is_nil(aNewSubO)) { + // remember restored objects for Python Dump + addToListOfGO(anOldSubO, theOutArgs); + + // add the part to the list + aParts[i] = aNewSubO; + i++; + // add to parts list + addToListOfGO( aNewSubO, aNewParts ); + + SALOMEDS::SObject_var aNewSubSO; + if (!CORBA::is_nil(theNewSO)) { + // Publish the sub-shape + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_"; + } + aSubName += anArgName; + aNewSubSO = aStudyBuilder->NewObject(theNewSO); + aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); + // Restore color + aNewSubO->SetColor(anOldSubO->GetColor()); + // set the texture + if (aNewSubO->GetShapeType() == GEOM::VERTEX) { + aNewSubO->SetMarkerStd(anOldSubO->GetMarkerType(), anOldSubO->GetMarkerSize()); + if (anOldSubO->GetMarkerType() == GEOM::MT_USER) + aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture()); + } + } + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts; + if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) + // pass the main shape as Object, because only it has the history + aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + theNewO, theOutArgs, theFindMethod, theAddPrefix); + else + aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + aNewSubO, theOutArgs, theFindMethod, theAddPrefix); + // add to parts list + addToListOfGO( aSubParts, aNewParts ); + } + else { // GetInPlace failed, try to build from published parts + SALOMEDS::SObject_var aNewSubSO; + if (!CORBA::is_nil(theNewSO)) + aNewSubSO = aStudyBuilder->NewObject(theNewSO); + + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts = + RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + theNewO, theOutArgs, theFindMethod, theAddPrefix); + // add to parts list + addToListOfGO( aSubParts, aNewParts ); + + if (aSubParts->length() > 0) { + // remember restored objects for Python Dump + addToListOfGO(anOldSubO, theOutArgs); + + // try to build an object from a set of its sub-shapes, + // that published and will be reconstructed + if (aSubParts->length() > 1) { + aNewSubO = aShapesOp->MakeCompound(aSubParts); + // add to parts list + addToListOfGO( aNewSubO, aNewParts ); + } + else { + aNewSubO = aSubParts[0]; + } + + if (!CORBA::is_nil(aNewSubO)) { + // add the part to the list + aSubParts[i] = aNewSubO; + i++; + + // Publish the sub-shape + if (!CORBA::is_nil(aNewSubSO)) { + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_parts_of_"; + } + aSubName += anArgName; + aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); + // Restore color + aNewSubO->SetColor(anOldSubO->GetColor()); + // set the texture + if (aNewSubO->GetShapeType() == GEOM::VERTEX) { + aNewSubO->SetMarkerStd(anOldSubO->GetMarkerType(), anOldSubO->GetMarkerSize()); + if (anOldSubO->GetMarkerType() == GEOM::MT_USER) + aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture()); + } + } + } + } + else if (!CORBA::is_nil(aNewSubSO)) { + // remove created aSubSO, because no parts have been found + aStudyBuilder->RemoveObject(aNewSubSO); + } + } // try to build from published parts } - else { // GetInPlace failed, try to build from published parts - if (!CORBA::is_nil(anArgSO)) { - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(theSObject); - - // Restore published sub-shapes of the argument - GEOM::ListOfGO_var aParts = - RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod); - - if (aParts->length() > 0) { - // try to build an argument from a set of its sub-shapes, - // that published and will be reconstructed - if (aParts->length() > 1) { - aSubO = aShapesOp->MakeCompound(aParts); - } - else { - aSubO = aParts[0]; - } - if (!CORBA::is_nil(aSubO)) { - // Publish the sub-shape - TCollection_AsciiString aSubName ("from_parts_of_"); - aSubName += anArgName; - aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); - // Restore color - aSubO->SetColor(anArgO->GetColor()); - } - } - else { - // remove created aSubSO, because no parts have been found - aStudyBuilder->RemoveObject(aSubSO); - } - } - } // try to build from published parts } - } // process arguments + } // iterate on published sub-shapes - return true; + aParts->length(i); + // add to parts list + addToListOfGO( aNewParts, aParts ); + return aParts._retn(); } //============================================================================ -// function : RestoreSubShapesOneLevel +// function : RestoreGivenSubShapes +// purpose : Private method. Works only if both theObject and theSObject +// are defined, and does not check, if they correspond to each other. +// List theArgs in this case contains not only operation arguments, +// but also all subshapes, which must be published. +//============================================================================ +GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + SALOMEDS::SObject_ptr theSObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix) +{ + GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; + //PTv, IMP 0020001, The salome object + // is not obligatory in case of invokation from script + if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/) + return aParts._retn(); + + // If theArgs list is empty, nothing to do + Standard_Integer aLength = theArgs.length(); + if (aLength == 0) + return aParts._retn(); + + // Get all arguments + GEOM::ListOfGO_var anOpArgsList = theObject->GetDependency(); + Standard_Integer nbArgsActual = anOpArgsList->length(); + + // If anOpArgsList list is empty, nothing to do + if (nbArgsActual == 0) + return aParts._retn(); + + // Entries of arguments and subshapes + std::set anArgs; + for (int i = 0; i < aLength; i++) { + CORBA::String_var anEntry = theArgs[i]->GetEntry(); + anArgs.insert(anEntry.in()); + } + + // Arguments to be published + // We try to publish all arguments, that are in theArgs list + GEOM::ListOfGO_var aList = new GEOM::ListOfGO; + aList->length(nbArgsActual); + + int k = 0; + for (int j = 0; j < nbArgsActual; j++) { + CORBA::String_var anEntry = anOpArgsList[j]->GetEntry(); + if (anArgs.count(anEntry.in())) { + aList[k] = GEOM::GEOM_Object::_duplicate(anOpArgsList[j]); + k++; + } + } + nbArgsActual = k; + //aList->length(nbArgsActual); + + if (nbArgsActual < 1) + return aParts._retn(); + + if (theInheritFirstArg || (nbArgsActual == 1)) { + // Do not publish argument's reflection, + // but only reconstruct its published sub-shapes + + CORBA::String_var anIOR = _orb->object_to_string(aList[0]); + SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in()); + + aParts = RestoreGivenSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, + anArgs, theFindMethod, theAddPrefix); + + // set the color of the transformed shape to the color of initial shape + theObject->SetColor(aList[0]->GetColor()); + // set the texture + if (theObject->GetShapeType() == GEOM::VERTEX) { + theObject->SetMarkerStd(aList[0]->GetMarkerType(), aList[0]->GetMarkerSize()); + if (aList[0]->GetMarkerType() == GEOM::MT_USER) + theObject->SetMarkerTexture(aList[0]->GetMarkerTexture()); + } + + anArgSO->UnRegister(); + } + else { + // Get interface, containing method, which we will use to reconstruct sub-shapes + GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId()); + GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId()); + GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId()); + + // Reconstruct arguments and tree of sub-shapes of the arguments + CORBA::String_var anIOR; + SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); + for (Standard_Integer i = 0; i < nbArgsActual; i++) + { + GEOM::GEOM_Object_var anArgO = aList[i]; + if (!CORBA::is_nil(anArgO)) { + anIOR = _orb->object_to_string(anArgO); + SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in()); + TCollection_AsciiString anArgName; + if (CORBA::is_nil(anArgSO)) { + anArgName = "arg_"; + anArgName += TCollection_AsciiString(i); + } + else { + anArgName = anArgSO->GetName(); + } + + // Find a sub-shape of theObject in place of the argument + GEOM::GEOM_Object_var aSubO; + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + { + // Use GetInPlace + aSubO = aShapesOp->GetInPlace(theObject, anArgO); + } + break; + case GEOM::FSM_MultiTransformed: + { + // Only for Multi-transformations + GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anArgO, theObject); + if (!CORBA::is_nil(anArgOTrsf)) { + CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry(); + Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry); + Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction(); + anArgOTrsfFun->SetDescription(""); + aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf); + } + } + break; + case GEOM::FSM_Transformed: + { + // transformation, cannot use GetInPlace, operate with indices + GEOM::ListOfLong_var anIDs = anArgO->GetSubShapeIndices(); + if (anIDs->length() > 1) { + // group + aSubO = aGroupOp->CreateGroup(theObject, aGroupOp->GetType(anArgO)); + if (!CORBA::is_nil(aSubO)) + aGroupOp->UnionIDs(aSubO, anIDs); + } + else if (anIDs->length() > 0) { + // single sub-shape + aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]); + } + } + break; + case GEOM::FSM_GetSame: + { + // Use GetSame + aSubO = aShapesOp->GetSame(theObject, anArgO); + } + break; + case GEOM::FSM_GetShapesOnShape: + { + // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids + aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject, + (short)GEOM::SOLID, GEOM::ST_ONIN); + } + break; + case GEOM::FSM_GetInPlaceByHistory: + { + // Use GetInPlaceByHistory + aSubO = aShapesOp->GetInPlaceByHistory(theObject, anArgO); + } + break; + default: + {} + } + + if (!CORBA::is_nil(aSubO)) { + // add to parts list + addToListOfGO( aSubO, aParts ); + + // Publish the sub-shape + SALOMEDS::SObject_var aSubSO; + if (!CORBA::is_nil(theSObject)) { + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_"; + } + aSubName += anArgName; + aSubSO = aStudyBuilder->NewObject(theSObject); + aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); + // Restore color + aSubO->SetColor(anArgO->GetColor()); + // set the texture + if (aSubO->GetShapeType() == GEOM::VERTEX) { + aSubO->SetMarkerStd(anArgO->GetMarkerType(), anArgO->GetMarkerSize()); + if (anArgO->GetMarkerType() == GEOM::MT_USER) + aSubO->SetMarkerTexture(anArgO->GetMarkerTexture()); + } + } + + if (!CORBA::is_nil(anArgSO)) { + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts; + if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) + // pass theObject, because only it has the history + aSubParts = RestoreGivenSubShapesOneLevel(theStudy, anArgSO, aSubSO, + theObject, anArgs, theFindMethod, theAddPrefix); + else + aSubParts = RestoreGivenSubShapesOneLevel(theStudy, anArgSO, aSubSO, + aSubO, anArgs, theFindMethod, theAddPrefix); + // add to parts list + addToListOfGO( aSubParts, aParts ); + } + } + else { // GetInPlace failed, try to build from published parts + if (!CORBA::is_nil(anArgSO)) { + SALOMEDS::SObject_var aSubSO; + if (!CORBA::is_nil(theSObject)) + aSubSO = aStudyBuilder->NewObject(theSObject); + + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts = + RestoreGivenSubShapesOneLevel(theStudy, anArgSO, aSubSO, + theObject, anArgs, theFindMethod, theAddPrefix); + + // add to parts list + addToListOfGO( aSubParts, aParts ); + + if (aSubParts->length() > 0) { + // try to build an argument from a set of its sub-shapes, + // that published and will be reconstructed + if (aSubParts->length() > 1) { + aSubO = aShapesOp->MakeCompound(aSubParts); + // add to parts list + addToListOfGO( aSubO, aParts ); + } + else { + aSubO = aSubParts[0]; + } + if (!CORBA::is_nil(aSubO) && !CORBA::is_nil(aSubSO)) { + // Publish the sub-shape + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_parts_of_"; + } + aSubName += anArgName; + aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); + // Restore color + aSubO->SetColor(anArgO->GetColor()); + // set the texture + if (aSubO->GetShapeType() == GEOM::VERTEX) { + aSubO->SetMarkerStd(anArgO->GetMarkerType(), anArgO->GetMarkerSize()); + if (anArgO->GetMarkerType() == GEOM::MT_USER) + aSubO->SetMarkerTexture(anArgO->GetMarkerTexture()); + } + } + } + else if (!CORBA::is_nil(aSubSO)) { + // remove created aSubSO, because no parts have been found + aStudyBuilder->RemoveObject(aSubSO); + } + } + } // try to build from published parts + anArgSO->UnRegister(); + } + } // process arguments + } + std::set anObjEntryMap; + GEOM::ListOfGO_var aResParts = new GEOM::ListOfGO; + int nbRes = 0; + int nb = aParts->length(); + aResParts->length(nb); + if (nb > 0) + { + Handle(GEOM_Object) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Function) aFunction = aMainObj->GetLastFunction(); + GEOM::TPythonDump pd (aFunction, true); + pd <<"["; + int i = 0, j = 0; + for ( ; i < nb; i++ ) + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aParts[ i ] ); + if (CORBA::is_nil(anObj)) + continue; + char* anEntry = anObj->GetEntry(); + if (anObjEntryMap.count(anEntry)) + continue; // already treated + anObjEntryMap.insert(anEntry); + aResParts[nbRes++] = anObj; + // clear python dump of object + Handle(GEOM_Object) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry); + Handle(GEOM_Function) anObjFun = aGeomObj->GetLastFunction(); + if ( !anObjFun.IsNull() ) + anObjFun->SetDescription( "" ); + if ( j > 0 ) + pd << ", "; + pd << aGeomObj; + j++; + } + pd <<"]" << " = geompy.RestoreGivenSubShapes(" << aMainObj << ", " << "["; + i = 0; nb = theArgs.length(); j = 0; + for ( ; i < nb; i++ ) + { + GEOM::GEOM_Object_var anObj = theArgs[ i ]; + if (CORBA::is_nil(anObj)) + continue; + Handle(GEOM_Object) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry()); + if ( j > 0 ) + pd << ", "; + pd << aGeomObj; + j++; + } + pd <<"]" << ", " <<"geompy.GEOM."; + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + pd << "FSM_GetInPlace"; break; + case GEOM::FSM_MultiTransformed: + pd << "FSM_MultiTransformed"; break; + case GEOM::FSM_Transformed: + pd << "FSM_Transformed"; break; + case GEOM::FSM_GetSame: + pd << "FSM_GetSame"; break; + case GEOM::FSM_GetShapesOnShape: + pd << "FSM_GetShapesOnShape"; break; + case GEOM::FSM_GetInPlaceByHistory: + default: + pd << "FSM_GetInPlaceByHistory"; break; + } + pd << ", " << theInheritFirstArg << ", " << theAddPrefix << ")"; + } + aResParts->length(nbRes); + return aResParts._retn(); +} + +//============================================================================ +// function : RestoreGivenSubShapesOneLevel // purpose : Private method //============================================================================ -GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theOldSO, - SALOMEDS::SObject_ptr theNewSO, - GEOM::GEOM_Object_ptr theNewO, - GEOM::find_shape_method theFindMethod) +GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theOldSO, + SALOMEDS::SObject_ptr theNewSO, + GEOM::GEOM_Object_ptr theNewO, + std::set theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theAddPrefix) { int i = 0; GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; + GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO; if (CORBA::is_nil(theStudy) || CORBA::is_nil(theOldSO) || - CORBA::is_nil(theNewO) || CORBA::is_nil(theNewSO)) + CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/) return aParts._retn(); SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); // Get interface, containing method, which we will use to reconstruct sub-shapes - GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId()); - GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId()); + GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId()); + GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId()); + GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId()); // Reconstruct published sub-shapes SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator(theOldSO); @@ -855,116 +1839,175 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th if (anOldSubSO->FindAttribute(anAttr, "AttributeIOR")) { SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); GEOM::GEOM_Object_var anOldSubO = - GEOM::GEOM_Object::_narrow(_orb->string_to_object(anAttrIOR->Value())); + GEOM::GEOM_Object::_narrow(_orb->string_to_object(anAttrIOR->Value())); + + bool okToContinue = false; + if (!CORBA::is_nil(anOldSubO)) { - // Find a sub-shape of theNewO in place of anOldSubO - GEOM::GEOM_Object_var aNewSubO; - switch (theFindMethod) { - case GEOM::FSM_GetInPlace: - { - // Use GetInPlace - aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO); - } - break; - case GEOM::FSM_Transformed: - { - // transformation, cannot use GetInPlace, operate with indices - GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices(); - if (anIDs->length() > 1) { - // group - aNewSubO = aGroupOp->CreateGroup(theNewO, aGroupOp->GetType(anOldSubO)); - if (!CORBA::is_nil(aNewSubO)) - aGroupOp->UnionIDs(aNewSubO, anIDs); - } - else { - // single sub-shape - aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]); - } - } - break; - case GEOM::FSM_GetSame: - { - // Use GetSame - aNewSubO = aShapesOp->GetSame(theNewO, anOldSubO); - } - break; - case GEOM::FSM_GetShapesOnShape: - { - // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids - aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO, - (short)GEOM::SOLID, GEOM::ST_ONIN); - } - break; - case GEOM::FSM_GetInPlaceByHistory: - { - // Use GetInPlaceByHistory - aNewSubO = aShapesOp->GetInPlaceByHistory(theNewO, anOldSubO); - } - break; - default: - {} - } - - if (!CORBA::is_nil(aNewSubO)) { - // add the part to the list - aParts[i] = aNewSubO; - i++; - - // Publish the sub-shape - TCollection_AsciiString aSubName ("from_"); - aSubName += anArgName; - SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO); - aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); - // Restore color - aNewSubO->SetColor(anOldSubO->GetColor()); - - // Restore published sub-shapes of the argument - if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) - // pass the main shape as Object, because only it has the history - RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod); - else - RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, theFindMethod); - } - else { // GetInPlace failed, try to build from published parts - SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO); - - // Restore published sub-shapes of the argument - GEOM::ListOfGO_var aParts = - RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod); - - if (aParts->length() > 0) { - // try to build an object from a set of its sub-shapes, - // that published and will be reconstructed - if (aParts->length() > 1) { - aNewSubO = aShapesOp->MakeCompound(aParts); - } - else { - aNewSubO = aParts[0]; - } - - if (!CORBA::is_nil(aNewSubO)) { - // add the part to the list - aParts[i] = aNewSubO; - i++; - - // Publish the sub-shape - TCollection_AsciiString aSubName = "from_parts_of_"; - aSubName += anArgName; - aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); - // Restore color - aNewSubO->SetColor(anOldSubO->GetColor()); - } - } - else { - // remove created aSubSO, because no parts have been found - aStudyBuilder->RemoveObject(aNewSubSO); - } - } // try to build from published parts + CORBA::String_var anEntry = anOldSubO->GetEntry(); + okToContinue = theArgs.count(anEntry.in()); + } + + if (okToContinue) { + // Find a sub-shape of theNewO in place of anOldSubO + GEOM::GEOM_Object_var aNewSubO; + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + { + // Use GetInPlace + aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO); + } + break; + case GEOM::FSM_MultiTransformed: + { + // Only for Multi-transformations + GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anOldSubO, theNewO); + if (!CORBA::is_nil(anArgOTrsf)) { + CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry(); + Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry); + Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction(); + anArgOTrsfFun->SetDescription(""); + aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf); + } + } + break; + case GEOM::FSM_Transformed: + { + // transformation, cannot use GetInPlace, operate with indices + GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices(); + if (anIDs->length() > 1) { + // group + aNewSubO = aGroupOp->CreateGroup(theNewO, aGroupOp->GetType(anOldSubO)); + if (!CORBA::is_nil(aNewSubO)) + aGroupOp->UnionIDs(aNewSubO, anIDs); + } + else { + // single sub-shape + aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]); + } + } + break; + case GEOM::FSM_GetSame: + { + // Use GetSame + aNewSubO = aShapesOp->GetSame(theNewO, anOldSubO); + } + break; + case GEOM::FSM_GetShapesOnShape: + { + // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids + aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO, + (short)GEOM::SOLID, GEOM::ST_ONIN); + } + break; + case GEOM::FSM_GetInPlaceByHistory: + { + // Use GetInPlaceByHistory + aNewSubO = aShapesOp->GetInPlaceByHistory(theNewO, anOldSubO); + } + break; + default: + {} + } + + if (!CORBA::is_nil(aNewSubO)) { + // add the part to the list + aParts[i] = aNewSubO; + i++; + // add to parts list + addToListOfGO( aNewSubO, aNewParts ); + + SALOMEDS::SObject_var aNewSubSO; + if (!CORBA::is_nil(theNewSO)) { + // Publish the sub-shape + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_"; + } + aSubName += anArgName; + aNewSubSO = aStudyBuilder->NewObject(theNewSO); + aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); + // Restore color + aNewSubO->SetColor(anOldSubO->GetColor()); + // set the texture + if (aNewSubO->GetShapeType() == GEOM::VERTEX) { + aNewSubO->SetMarkerStd(anOldSubO->GetMarkerType(), anOldSubO->GetMarkerSize()); + if (anOldSubO->GetMarkerType() == GEOM::MT_USER) + aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture()); + } + } + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts; + if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) + // pass the main shape as Object, because only it has the history + aSubParts = RestoreGivenSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + theNewO, theArgs, theFindMethod, theAddPrefix); + else + aSubParts = RestoreGivenSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + aNewSubO, theArgs, theFindMethod, theAddPrefix); + // add to parts list + addToListOfGO( aSubParts, aNewParts ); + } + else { // GetInPlace failed, try to build from published parts + SALOMEDS::SObject_var aNewSubSO; + if (!CORBA::is_nil(theNewSO)) + aNewSubSO = aStudyBuilder->NewObject(theNewSO); + + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts = + RestoreGivenSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + theNewO, theArgs, theFindMethod, theAddPrefix); + // add to parts list + addToListOfGO( aSubParts, aNewParts ); + + if (aSubParts->length() > 0) { + // try to build an object from a set of its sub-shapes, + // that published and will be reconstructed + if (aSubParts->length() > 1) { + aNewSubO = aShapesOp->MakeCompound(aSubParts); + // add to parts list + addToListOfGO( aNewSubO, aNewParts ); + } + else { + aNewSubO = aSubParts[0]; + } + + if (!CORBA::is_nil(aNewSubO)) { + // add the part to the list + aSubParts[i] = aNewSubO; + i++; + + // Publish the sub-shape + if (!CORBA::is_nil(aNewSubSO)) { + TCollection_AsciiString aSubName; + if (theAddPrefix) { + aSubName = "from_parts_of_"; + } + aSubName += anArgName; + aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); + // Restore color + aNewSubO->SetColor(anOldSubO->GetColor()); + // set the texture + if (aNewSubO->GetShapeType() == GEOM::VERTEX) { + aNewSubO->SetMarkerStd(anOldSubO->GetMarkerType(), anOldSubO->GetMarkerSize()); + if (anOldSubO->GetMarkerType() == GEOM::MT_USER) + aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture()); + } + } + } + } + else if (!CORBA::is_nil(aNewSubSO)) { + // remove created aSubSO, because no parts have been found + aStudyBuilder->RemoveObject(aNewSubSO); + } + } // try to build from published parts } } } // iterate on published sub-shapes aParts->length(i); + // add to parts list + addToListOfGO( aNewParts, aParts ); return aParts._retn(); } @@ -1012,6 +2055,7 @@ GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theS GEOM_IBasicOperations_i* aServant = new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID)); + PortableServer::ObjectId_var id = _poa->activate_object(aServant); // activate the CORBA servant GEOM::GEOM_IBasicOperations_var operations = aServant->_this(); return operations._retn(); @@ -1051,6 +2095,7 @@ GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long th GEOM_I3DPrimOperations_i* aServant = new GEOM_I3DPrimOperations_i(_poa, engine, _impl->GetI3DPrimOperations(theStudyID)); + PortableServer::ObjectId_var id = _poa->activate_object(aServant); // activate the CORBA servant GEOM::GEOM_I3DPrimOperations_var operations = aServant->_this(); @@ -1237,22 +2282,44 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theS return operations._retn(); } +//============================================================================ +// function : GetIAdvancedOperations +// purpose : +//============================================================================ +GEOM::GEOM_IAdvancedOperations_ptr GEOM_Gen_i::GetIAdvancedOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIAdvancedOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IAdvancedOperations_i* aServant = + new GEOM_IAdvancedOperations_i(_poa, engine, _impl->GetIAdvancedOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IAdvancedOperations_var operations = aServant->_this(); + return operations._retn(); +} + //============================================================================= /*! * AddSubShape */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShape, - const GEOM::ListOfLong& theIndices) + const GEOM::ListOfLong& theIndices) { - if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil(); - Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry()); - if (aMainsShape.IsNull()) return GEOM::GEOM_Object::_nil(); + if (CORBA::is_nil(theMainShape) || theIndices.length() < 1) + return GEOM::GEOM_Object::_nil(); + CORBA::String_var entry = theMainShape->GetEntry(); + Handle(GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry); + if (aMainShape.IsNull()) return GEOM::GEOM_Object::_nil(); Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length()); for(Standard_Integer i = 0; iSetValue(i+1, theIndices[i]); - Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray, true); + Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainShape, anArray, true); if(anObject.IsNull()) return GEOM::GEOM_Object::_nil(); TCollection_AsciiString anEntry; @@ -1268,7 +2335,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShap void GEOM_Gen_i::RemoveObject(GEOM::GEOM_Object_ptr theObject) { CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = _impl->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = _impl->GetObject(theObject->GetStudyID(), anEntry, false); if (anObject.IsNull()) return; _impl->RemoveObject(anObject); return; @@ -1306,7 +2373,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* { GEOM::GEOM_Object_var obj; Handle(GEOM_Object) handle_object = _impl->GetObject(theStudyID, (char*)theEntry); - if (handle_object.IsNull()) return NULL; + if (handle_object.IsNull()) return obj._retn(); TCollection_AsciiString stringIOR = handle_object->GetIOR(); if (stringIOR.Length() > 1) { @@ -1316,7 +2383,9 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* } GEOM::GEOM_Gen_ptr engine = _this(); + //transfer the reference to GEOM_Object_i GEOM_Object_i* servant = new GEOM_Object_i (_poa, engine, handle_object); + PortableServer::ObjectId_var id = _poa->activate_object(servant); obj = servant->_this(); CORBA::String_var objStr = _orb->object_to_string(obj); @@ -1341,7 +2410,7 @@ bool GEOM_Gen_i::hasObjectInfo() char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) { GEOM::GEOM_Object_var aGeomObject; - + CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" ); SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject ); SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId ); @@ -1354,11 +2423,14 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) { SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var aVal = anIOR->Value(); + anIOR->UnRegister(); CORBA::Object_var anObject = aStudy->ConvertIORToObject(aVal); aGeomObject = GEOM::GEOM_Object::_narrow(anObject); } - - char* aTypeInfo = "Object"; + if (!aSObj->_is_nil() ) + aSObj->UnRegister(); + + const char* aTypeInfo = "Object"; if ( !aGeomObject->_is_nil() ) { GEOM::GEOM_IKindOfShape::shape_kind aKind; GEOM::ListOfLong_var anInts; @@ -1370,111 +2442,113 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) if ( anOp->IsDone() ) { switch ( aKind ) { case GEOM::GEOM_IKindOfShape::COMPOUND: - aTypeInfo = "Compound"; - break; + aTypeInfo = "Compound"; + break; case GEOM::GEOM_IKindOfShape::COMPSOLID: - aTypeInfo = "CompSolid"; - break; + aTypeInfo = "CompSolid"; + break; case GEOM::GEOM_IKindOfShape::SHELL: - aTypeInfo = "Shell"; - break; + aTypeInfo = "Shell"; + break; case GEOM::GEOM_IKindOfShape::WIRE: - if ( anInts[0] == 1 ) - aTypeInfo = "Closed Wire"; - else if ( anInts[0] == 2 ) - aTypeInfo = "Opened Wire"; - else - aTypeInfo = "Wire"; - break; - // SOLIDs + if ( anInts[0] == 1 ) + aTypeInfo = "Closed Wire"; + else if ( anInts[0] == 2 ) + aTypeInfo = "Opened Wire"; + else + aTypeInfo = "Wire"; + break; + // SOLIDs case GEOM::GEOM_IKindOfShape::SPHERE: - aTypeInfo = "Sphere"; - break; + aTypeInfo = "Sphere"; + break; case GEOM::GEOM_IKindOfShape::CYLINDER: - aTypeInfo = "Cylinder"; - break; + aTypeInfo = "Cylinder"; + break; case GEOM::GEOM_IKindOfShape::BOX: case GEOM::GEOM_IKindOfShape::ROTATED_BOX: - aTypeInfo = "Box"; - break; + aTypeInfo = "Box"; + break; case GEOM::GEOM_IKindOfShape::TORUS: - aTypeInfo = "Torus"; - break; + aTypeInfo = "Torus"; + break; case GEOM::GEOM_IKindOfShape::CONE: - aTypeInfo = "Cone"; - break; + aTypeInfo = "Cone"; + break; case GEOM::GEOM_IKindOfShape::POLYHEDRON: - aTypeInfo = "Polyhedron"; - break; + aTypeInfo = "Polyhedron"; + break; case GEOM::GEOM_IKindOfShape::SOLID: - aTypeInfo = "Solid"; - break; - // FACEs + aTypeInfo = "Solid"; + break; + // FACEs case GEOM::GEOM_IKindOfShape::SPHERE2D: - aTypeInfo = "Spherical Face"; - break; + aTypeInfo = "Spherical Face"; + break; case GEOM::GEOM_IKindOfShape::CYLINDER2D: - aTypeInfo = "Cylindrical Face"; - break; + aTypeInfo = "Cylindrical Face"; + break; case GEOM::GEOM_IKindOfShape::TORUS2D: - aTypeInfo = "Toroidal Face"; - break; + aTypeInfo = "Toroidal Face"; + break; case GEOM::GEOM_IKindOfShape::CONE2D: - aTypeInfo = "Conical Face"; - break; + aTypeInfo = "Conical Face"; + break; case GEOM::GEOM_IKindOfShape::DISK_CIRCLE: - aTypeInfo = "Disk"; - break; + aTypeInfo = "Disk"; + break; case GEOM::GEOM_IKindOfShape::DISK_ELLIPSE: - aTypeInfo = "Elliptical Face"; - break; + aTypeInfo = "Elliptical Face"; + break; case GEOM::GEOM_IKindOfShape::POLYGON: - aTypeInfo = "Polygon"; - break; + aTypeInfo = "Polygon"; + break; case GEOM::GEOM_IKindOfShape::PLANE: - aTypeInfo = "Plane"; - break; + aTypeInfo = "Plane"; + break; case GEOM::GEOM_IKindOfShape::PLANAR: - aTypeInfo = "Planar Face"; - break; + aTypeInfo = "Planar Face"; + break; case GEOM::GEOM_IKindOfShape::FACE: - aTypeInfo = "Face"; - break; - // EDGEs + aTypeInfo = "Face"; + break; + // EDGEs case GEOM::GEOM_IKindOfShape::CIRCLE: - aTypeInfo = "Circle"; - break; + aTypeInfo = "Circle"; + break; case GEOM::GEOM_IKindOfShape::ARC_CIRCLE: - aTypeInfo = "Ark"; - break; + aTypeInfo = "Arc Circle"; + break; case GEOM::GEOM_IKindOfShape::ELLIPSE: - aTypeInfo = "Ellipse"; - break; + aTypeInfo = "Ellipse"; + break; case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE: - aTypeInfo = "Arc Ellipse"; - break; + aTypeInfo = "Arc Ellipse"; + break; case GEOM::GEOM_IKindOfShape::LINE: - aTypeInfo = "Line"; - break; + aTypeInfo = "Line"; + break; case GEOM::GEOM_IKindOfShape::SEGMENT: - aTypeInfo = "Segment"; - break; + aTypeInfo = "Segment"; + break; case GEOM::GEOM_IKindOfShape::EDGE: - aTypeInfo = "Edge"; - break; + aTypeInfo = "Edge"; + break; case GEOM::GEOM_IKindOfShape::VERTEX: - aTypeInfo = "Vertex"; - break; + aTypeInfo = "Vertex"; + break; default: - break; + break; } } } - - char anInfo [strlen("Module ") + strlen(ComponentDataType()) + strlen(", ") + strlen(aTypeInfo)]; + + char* anInfo = new char[strlen("Module ") + strlen(ComponentDataType()) + strlen(", ") + strlen(aTypeInfo) + 3]; sprintf(anInfo, "Module %s, %s", ComponentDataType(), aTypeInfo); - - return CORBA::string_dup(anInfo); + + char* ret = CORBA::string_dup(anInfo); + delete [] anInfo; + return ret; } //===================================================================================== @@ -1482,16 +2556,19 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) //===================================================================================== extern "C" { -GEOM_I_EXPORT - PortableServer::ObjectId * GEOMEngine_factory(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char * interfaceName) + /* + GEOM_I_EXPORT + PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB*, PortableServer::POA*, PortableServer::ObjectId*, const char*, const char*); + */ + + GEOM_I_EXPORT + PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName) { - GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName); - // Don't understand the reason of this register ???? -// myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example - return myGEOM_Gen_i->getId(); + GEOM_Gen_i* myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName); + return myGEOM_Gen_i->getId(); } } diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index aba3b6aa6..9e65dea0c 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef __GEOM_GEN_I_H__ #define __GEOM_GEN_I_H__ @@ -49,6 +50,12 @@ #include "GEOM_IInsertOperations_i.hh" #include "GEOM_IMeasureOperations_i.hh" #include "GEOM_IGroupOperations_i.hh" +#include "GEOM_IAdvancedOperations_i.hh" + +#include + +#include +#include //#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -67,10 +74,10 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi // constructor to be called for servant creation. GEOM_Gen_i(); GEOM_Gen_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName); + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); // destructor, doing nothing (for now) virtual ~GEOM_Gen_i(); @@ -84,74 +91,89 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi //-----------------------------------------------------------------------// SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile); + const char* theURL, + bool isMultiFile); SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile); + const char* theURL, + bool isMultiFile); CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile); + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile); CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile); + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile); void Close(SALOMEDS::SComponent_ptr theComponent); char* ComponentDataType(); char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII); + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII); + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); bool CanPublishInStudy(CORBA::Object_ptr theIOR); SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) throw (SALOME::SALOME_Exception) ; + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) ; + + GEOM::ListOfGO* PublishNamedShapesInStudy(SALOMEDS::Study_ptr theStudy, + CORBA::Object_ptr theObject); CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID); CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject); + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject); /*! \brief Adds theObject in the study with a name = theName, if * theFather is not null the object is placed under theFather */ SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - const char* theName, - GEOM::GEOM_Object_ptr theFather); + GEOM::GEOM_Object_ptr theObject, + const char* theName, + GEOM::GEOM_Object_ptr theFather); /*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments. * To be used from python scripts out of geompy.addToStudy (non-default usage) */ - CORBA::Boolean RestoreSubShapesO (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - const GEOM::ListOfGO& theArgs, - GEOM::find_shape_method theFindMethod, - CORBA::Boolean theInheritFirstArg); + GEOM::ListOfGO* RestoreSubShapesO (SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix); + + /*! \brief Publish sub-shapes, standing for given in \a theArgs arguments and sub-shapes. + * To be used from python scripts, generated by Dump Python. + */ + GEOM::ListOfGO* RestoreGivenSubShapesO (SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix); /*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments. * To be used from GUI and from geompy.addToStudy */ - CORBA::Boolean RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - const GEOM::ListOfGO& theArgs, - GEOM::find_shape_method theFindMethod, - CORBA::Boolean theInheritFirstArg); + GEOM::ListOfGO* RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix); //-----------------------------------------------------------------------// // Transaction methods // @@ -215,9 +237,13 @@ 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); - //Adds a new sub shape + //Returns a pointer to AdvancedOperations interface + virtual GEOM::GEOM_IAdvancedOperations_ptr GetIAdvancedOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Adds a new sub-shape virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape, - const GEOM::ListOfLong& theIndices); + const GEOM::ListOfLong& theIndices); virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject); @@ -226,17 +252,18 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR); virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, - CORBA::Boolean isPublished, - CORBA::Boolean& isValidScript); + CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, + CORBA::Boolean& isValidScript); char* GetDumpName (const char* theStudyEntry); GEOM::string_array* GetAllDumpNames(); - + // Object information virtual bool hasObjectInfo(); virtual char* getObjectInfo(CORBA::Long studyId, const char* entry); - + //-----------------------------------------------------------------------// // Internal methods // //-----------------------------------------------------------------------// @@ -244,18 +271,46 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry); private: + GEOM::ListOfGO* RestoreSubShapes (SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + SALOMEDS::SObject_ptr theSObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix); + GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theOldSO, - SALOMEDS::SObject_ptr theNewSO, - GEOM::GEOM_Object_ptr theNewO, - GEOM::find_shape_method theFindMethod); - - CORBA::Boolean RestoreSubShapes (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - SALOMEDS::SObject_ptr theSObject, - const GEOM::ListOfGO& theArgs, - GEOM::find_shape_method theFindMethod, - CORBA::Boolean theInheritFirstArg); + SALOMEDS::SObject_ptr theOldSO, + SALOMEDS::SObject_ptr theNewSO, + GEOM::GEOM_Object_ptr theNewO, + GEOM::ListOfGO& theOutArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theAddPrefix); + + GEOM::ListOfGO* RestoreGivenSubShapes (SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + SALOMEDS::SObject_ptr theSObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, + CORBA::Boolean theAddPrefix); + + GEOM::ListOfGO* RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theOldSO, + SALOMEDS::SObject_ptr theNewSO, + GEOM::GEOM_Object_ptr theNewO, + std::set theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theAddPrefix); + + // auxilary for PublishNamedShapesInStudy + void CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_var theMainShape, + const TopTools_IndexedMapOfShape& anIndices, + const TopTools_SequenceOfShape& SeqS, + const TColStd_SequenceOfAsciiString& SeqN, + const Standard_CString& GrName, + GEOM::ListOfGO_var aResList); private: diff --git a/src/GEOM_I/GEOM_I.pro b/src/GEOM_I/GEOM_I.pro deleted file mode 100644 index 7b2cccd07..000000000 --- a/src/GEOM_I/GEOM_I.pro +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMEngine -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -CAS_DATAEXCHANGE = -L$${CASROOT}/Linux/lib -lTKIGES -lTKSTEP - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$${CASROOT}/Linux/lib - -CORBA_LIBS = -L$$(OMNIORBDIR)/lib -lomniORB4 -lomniDynamic4 -lCOS4 -lCOSDynamic4 -lomnithread - -INCLUDEPATH += $${CORBA_INCLUDES} $${CAS_CPPFLAGS} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} ../SKETCHER ../ARCHIMEDE ../GEOMImpl ../GEOMAlgo ../GEOM $$(GEOM_ROOT_DIR)/idl ../../salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/idl -lSalomeIDLGEOM -L$$(GEOM_ROOT_DIR)/lib -lGEOMArchimede -lGEOMimpl -lGEOMSketcher -lGEOMbasic $${KERNEL_LDFLAGS} -lSalomeNS -lSalomeContainer -lSalomeGenericObj -lTOOLSDS $${CAS_DATAEXCHANGE} $${CAS_LDPATH} -lTKFillet -lTKOffset $${STDLIB} $${CORBA_LIBS} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += GEOM_I_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = GEOM_Object_i.hh -HEADERS += GEOM_IOperations_i.hh -HEADERS += GEOM_IBasicOperations_i.hh -HEADERS += GEOM_IHealingOperations_i.hh -HEADERS += GEOM_I3DPrimOperations_i.hh -HEADERS += GEOM_IShapesOperations_i.hh -HEADERS += GEOM_IBlocksOperations_i.hh -HEADERS += GEOM_IBooleanOperations_i.hh -HEADERS += GEOM_ICurvesOperations_i.hh -HEADERS += GEOM_ILocalOperations_i.hh -HEADERS += GEOM_IInsertOperations_i.hh -HEADERS += GEOM_ITransformOperations_i.hh -HEADERS += GEOM_IMeasureOperations_i.hh -HEADERS += GEOM_IGroupOperations_i.hh -HEADERS += GEOM_Gen_i.hh -HEADERS += GEOM_GEOM_I.hxx - -SOURCES = GEOM_Object_i.cc -SOURCES += GEOM_IOperations_i.cc -SOURCES += GEOM_IBasicOperations_i.cc -SOURCES += GEOM_IHealingOperations_i.cc -SOURCES += GEOM_I3DPrimOperations_i.cc -SOURCES += GEOM_IShapesOperations_i.cc -SOURCES += GEOM_IBlocksOperations_i.cc -SOURCES += GEOM_IBooleanOperations_i.cc -SOURCES += GEOM_ICurvesOperations_i.cc -SOURCES += GEOM_ILocalOperations_i.cc -SOURCES += GEOM_IInsertOperations_i.cc -SOURCES += GEOM_ITransformOperations_i.cc -SOURCES += GEOM_IMeasureOperations_i.cc -SOURCES += GEOM_IGroupOperations_i.cc -SOURCES += GEOM_Gen_i.cc -SOURCES += GEOM_DumpPython.cc - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 104bb85ab..76febf836 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_I3DPrimOperations_i.hh" @@ -58,19 +59,19 @@ GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i() */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ) + CORBA::Double theDY, + CORBA::Double theDZ) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - + //Create the Box Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); - + return GetObject(anObject); } @@ -87,13 +88,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); - - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn(); @@ -111,8 +107,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH, - CORBA::Double theW, - CORBA::Short theOrientation) + CORBA::Double theW, + CORBA::Short theOrientation) { GEOM::GEOM_Object_var aGEOMObject; @@ -137,20 +133,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH, //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj, - CORBA::Double theH, - CORBA::Double theW) + CORBA::Double theH, + CORBA::Double theW) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObj == NULL || theH == 0 || theW == 0) - return aGEOMObject._retn(); - - //Get the reference points - Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject - (theObj->GetStudyID(), theObj->GetEntry()); + //Get the reference object + Handle(GEOM_Object) anObj = GetObjectImpl(theObj); if (anObj.IsNull()) return aGEOMObject._retn(); @@ -170,20 +162,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theR) + CORBA::Double theR) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); - Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); @@ -203,22 +191,17 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt3) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3); if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); @@ -237,7 +220,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR, - CORBA::Short theOrientation) + CORBA::Short theOrientation) { GEOM::GEOM_Object_var aGEOMObject; @@ -261,7 +244,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR, */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR, - CORBA::Double theH) + CORBA::Double theH) { GEOM::GEOM_Object_var aGEOMObject; @@ -283,20 +266,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theR, CORBA::Double theH) + CORBA::Double theR, CORBA::Double theH) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); - Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); @@ -314,8 +293,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1, - CORBA::Double theR2, - CORBA::Double theH) + CORBA::Double theR2, + CORBA::Double theH) { GEOM::GEOM_Object_var aGEOMObject; @@ -337,20 +316,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double the //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH) + CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); - Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); @@ -396,18 +371,14 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt == NULL) return aGEOMObject._retn(); - //Get the reference point - CORBA::String_var entry=thePnt->GetEntry(); - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), entry); + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); if (aPnt.IsNull()) return aGEOMObject._retn(); //Create the Sphere Handle(GEOM_Object) anObject = - GetOperations()->MakeSpherePntR(aPnt, theR); + GetOperations()->MakeSpherePntR(aPnt, theR); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -443,20 +414,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theRMajor, CORBA::Double theRMinor) + CORBA::Double theRMajor, CORBA::Double theRMinor) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); - Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); @@ -476,26 +443,22 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theH) + CORBA::Double theH) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); //Create the Prism Handle(GEOM_Object) anObject = - GetOperations()->MakePrismVecH(aBase, aVec, theH); + GetOperations()->MakePrismVecH(aBase, aVec, theH); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -509,20 +472,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theH) + CORBA::Double theH) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); @@ -535,6 +494,35 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways return GetObject(anObject); } +//============================================================================= +/*! + * MakePrismVecH + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecHWithScaling + (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH, CORBA::Double theScaleFactor) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); + + if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = + GetOperations()->MakePrismVecH(aBase, aVec, theH, theScaleFactor); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakePrismTwoPnt @@ -542,24 +530,18 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL) - return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject - (thePoint1->GetStudyID(), thePoint1->GetEntry()); - Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject - (thePoint2->GetStudyID(), thePoint2->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull()) return aGEOMObject._retn(); @@ -580,31 +562,58 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL) + //Get the reference objects + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); + + if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull()) + return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = + GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePrismTwoPnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPntWithScaling + (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + CORBA::Double theScaleFactor) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject - (thePoint1->GetStudyID(), thePoint1->GetEntry()); - Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject - (thePoint2->GetStudyID(), thePoint2->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull()) return aGEOMObject._retn(); //Create the Prism Handle(GEOM_Object) anObject = - GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2); + GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2, theScaleFactor); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -618,18 +627,15 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX, - CORBA::Double theDY, CORBA::Double theDZ) + CORBA::Double theDY, CORBA::Double theDZ) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); if (aBase.IsNull()) return aGEOMObject._retn(); @@ -649,18 +655,15 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX, - CORBA::Double theDY, CORBA::Double theDZ) + CORBA::Double theDY, CORBA::Double theDZ) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); if (aBase.IsNull()) return aGEOMObject._retn(); @@ -673,6 +676,66 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways return GetObject(anObject); } +//============================================================================= +/*! + * MakePrismDXDYDZ + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZWithScaling + (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX, + CORBA::Double theDY, CORBA::Double theDZ, + CORBA::Double theScaleFactor) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + + if (aBase.IsNull()) return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = + GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ, theScaleFactor); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeDraftPrism + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism + (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase, + CORBA::Double theHeight, + CORBA::Double theAngle, + CORBA::Boolean theFuse) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aInit = GetObjectImpl(theInitShape); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + + if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse); + + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakePipe @@ -686,13 +749,9 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || thePath == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject - (thePath->GetStudyID(), thePath->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aPath = GetObjectImpl(thePath); if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn(); @@ -712,20 +771,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + CORBA::Double theAngle) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject - (theAxis->GetStudyID(), theAxis->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn(); @@ -745,20 +800,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + CORBA::Double theAngle) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject - (theAxis->GetStudyID(), theAxis->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn(); @@ -776,29 +827,54 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways * MakeFilling */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape, - CORBA::Long theMinDeg, - CORBA::Long theMaxDeg, - CORBA::Double theTol2D, - CORBA::Double theTol3D, - CORBA::Long theNbIter, - CORBA::Boolean theApprox) +GEOM::GEOM_Object_ptr +GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape, + CORBA::Long theMinDeg, + CORBA::Long theMaxDeg, + CORBA::Double theTol2D, + CORBA::Double theTol3D, + CORBA::Long theNbIter, + GEOM::filling_oper_method theMethod, + CORBA::Boolean theApprox) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aGEOMObject._retn(); + int aMethod = 0; + switch (theMethod) { + case GEOM::FOM_Default: + { + // Default (standard behaviour) + aMethod = 0; + } + break; + case GEOM::FOM_UseOri: + { + // Use edges orientation + aMethod = 1; + } + break; + case GEOM::FOM_AutoCorrect: + { + // Auto-correct edges orientation + aMethod = 2; + } + break; + default: + {} + } + //Create the Solid - Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox); + Handle(GEOM_Object) anObject = GetOperations()->MakeFilling + (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, + aMethod, theApprox); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -811,9 +887,9 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_pt */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections, - CORBA::Boolean theModeSolid, - CORBA::Double thePreci, - CORBA::Boolean theRuled) + CORBA::Boolean theModeSolid, + CORBA::Double thePreci, + CORBA::Boolean theRuled) { GEOM::GEOM_Object_var aGEOMObject; @@ -825,13 +901,11 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::Lis //Get the shapes aLen = theSeqSections.length(); for (ind = 0; ind < aLen; ind++) { - if (theSeqSections[ind] == NULL) continue; - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]); if (!aSh.IsNull()) aSeqSections->Append(aSh); } - if(!aSeqSections->Length()) + if (!aSeqSections->Length()) return aGEOMObject._retn(); // Make shell or solid @@ -848,55 +922,52 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::Lis * MakePipeWithDifferentSections */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theLocations, - GEOM::GEOM_Object_ptr thePath, - CORBA::Boolean theWithContact, - CORBA::Boolean theWithCorrections) +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections + (const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) { - GEOM::GEOM_Object_var aGEOMObject; + GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient; int ind=0, aNbBases =0,aNbLocs=0; - + //Get the shapes aNbBases = theBases.length(); aNbLocs = theLocations.length(); - if( aNbLocs && aNbBases != aNbLocs) + if (aNbLocs && aNbBases != aNbLocs) + return aGEOMObject._retn(); + + Handle(GEOM_Object) aPath = GetObjectImpl(thePath); + if (aPath.IsNull()) return aGEOMObject._retn(); - - Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject - (thePath->GetStudyID(), thePath->GetEntry()); - if(aPath.IsNull()) - return aGEOMObject._retn(); for (ind = 0; ind < aNbBases; ind++) { - if (theBases[ind] == NULL) continue; - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(), - theBases[ind]->GetEntry()); - if(aBase.IsNull()) + Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]); + if (aBase.IsNull()) continue; - if(aNbLocs) + if (aNbLocs) { - Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject - (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry()); - if(aLoc.IsNull()) - continue; + Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]); + if (aLoc.IsNull()) + continue; aSeqLocations->Append(aLoc); } aSeqBases->Append(aBase); } - if(!aSeqBases->Length()) + if (!aSeqBases->Length()) return aGEOMObject._retn(); // Make pipe Handle(GEOM_Object) anObject = GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath, - theWithContact,theWithCorrections); + theWithContact,theWithCorrections); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -911,11 +982,11 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(co //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections (const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theSubBases, - const GEOM::ListOfGO& theLocations, - GEOM::GEOM_Object_ptr thePath, - CORBA::Boolean theWithContact, - CORBA::Boolean theWithCorrections) + const GEOM::ListOfGO& theSubBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) { GEOM::GEOM_Object_var aGEOMObject; @@ -925,55 +996,49 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient; int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0; - + //Get the shapes aNbBases = theBases.length(); aNbSubBases = theSubBases.length(); aNbLocs = theLocations.length(); - if( aNbLocs && aNbBases != aNbLocs) + if (aNbLocs && aNbBases != aNbLocs) + return aGEOMObject._retn(); + + Handle(GEOM_Object) aPath = GetObjectImpl(thePath); + if (aPath.IsNull()) return aGEOMObject._retn(); - - Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject - (thePath->GetStudyID(), thePath->GetEntry()); - if(aPath.IsNull()) - return aGEOMObject._retn(); for (ind = 0; ind < aNbBases; ind++) { - if (theBases[ind] == NULL) continue; - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()-> - GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry()); - if(aBase.IsNull()) + Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]); + if (aBase.IsNull()) continue; - if(aNbLocs) { - Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject - (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry()); - if(aLoc.IsNull()) - continue; + if (aNbLocs) { + Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]); + if (aLoc.IsNull()) + continue; aSeqLocations->Append(aLoc); } aSeqBases->Append(aBase); - if(aNbSubBases>=aNbBases) { - Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()-> - GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry()); - if(aSubBase.IsNull()) { - aSeqSubBases->Clear(); - aNbSubBases = 0; - continue; + if (aNbSubBases >= aNbBases) { + Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]); + if (aSubBase.IsNull()) { + aSeqSubBases->Clear(); + aNbSubBases = 0; + continue; } aSeqSubBases->Append(aSubBase); } - } - if(!aSeqBases->Length()) + if (!aSeqBases->Length()) return aGEOMObject._retn(); // Make pipe Handle(GEOM_Object) anObject = GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases, - aSeqLocations, aPath, - theWithContact, theWithCorrections); + aSeqLocations, aPath, + theWithContact, theWithCorrections); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -988,7 +1053,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath (const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theLocations) + const GEOM::ListOfGO& theLocations) { GEOM::GEOM_Object_var aGEOMObject; @@ -997,31 +1062,28 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient; int ind=0, aNbBases=0, aNbLocs=0; - + //Get the shapes aNbBases = theBases.length(); aNbLocs = theLocations.length(); - if( aNbLocs && aNbBases != aNbLocs) + if (aNbLocs && aNbBases != aNbLocs) return aGEOMObject._retn(); - + for (ind = 0; ind < aNbBases; ind++) { - if (theBases[ind] == NULL) continue; - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()-> - GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry()); - if(aBase.IsNull()) + Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]); + if (aBase.IsNull()) continue; - if(aNbLocs) { - Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject - (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry()); - if(aLoc.IsNull()) - continue; + if (aNbLocs) { + Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]); + if (aLoc.IsNull()) + continue; aSeqLocations->Append(aLoc); } aSeqBases->Append(aBase); } - if(!aSeqBases->Length()) + if (!aSeqBases->Length()) return aGEOMObject._retn(); // Make pipe @@ -1041,24 +1103,19 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector - (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePath, - GEOM::GEOM_Object_ptr theVec) + (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath, + GEOM::GEOM_Object_ptr theVec) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBase == NULL || thePath == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject - (theBase->GetStudyID(), theBase->GetEntry()); - Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject - (thePath->GetStudyID(), thePath->GetEntry()); - Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aBase = GetObjectImpl(theBase); + Handle(GEOM_Object) aPath = GetObjectImpl(thePath); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index e6574b876..05a748932 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_I3DPrimOperations_i_HeaderFile #define _GEOM_I3DPrimOperations_i_HeaderFile @@ -106,6 +107,11 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr theVec, CORBA::Double theH); + GEOM::GEOM_Object_ptr MakePrismVecHWithScaling (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH, + CORBA::Double theScaleFactor); + GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); @@ -114,6 +120,11 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr MakePrismTwoPntWithScaling (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + CORBA::Double theScaleFactor); + GEOM::GEOM_Object_ptr MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX, CORBA::Double theDY, @@ -122,7 +133,18 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); - + GEOM::GEOM_Object_ptr MakePrismDXDYDZWithScaling (GEOM::GEOM_Object_ptr theBase, + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ, + CORBA::Double theScaleFactor); + + GEOM::GEOM_Object_ptr MakeDraftPrism (GEOM::GEOM_Object_ptr theInitShape, + GEOM::GEOM_Object_ptr theBase, + CORBA::Double theHeight, + CORBA::Double theAngle, + CORBA::Boolean theFuse); + GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath); @@ -134,7 +156,12 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr theAxis, CORBA::Double theAngle); - GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter, CORBA::Boolean theApprox); + GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, + CORBA::Long theMinDeg, CORBA::Long theMaxDeg, + CORBA::Double theTol2D, CORBA::Double theTol3D, + CORBA::Long theNbIter, + GEOM::filling_oper_method theMethod, + CORBA::Boolean theApprox); GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections, CORBA::Boolean theModeSolid, diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc new file mode 100644 index 000000000..77310827f --- /dev/null +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc @@ -0,0 +1,407 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOM_IAdvancedOperations.cc +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#include + +#include "GEOM_IAdvancedOperations_i.hh" + +#include +#include +#include + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IAdvancedOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i() +{ + MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i"); +} + +//============================================================================= +/*! + * MakePipeTShape + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the TShape + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakePipeTShapeWithPosition + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference vertices + Handle(GEOM_Object) aP1 = GetObjectImpl(theP1); + Handle(GEOM_Object) aP2 = GetObjectImpl(theP2); + Handle(GEOM_Object) aP3 = GetObjectImpl(theP3); + if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn(); + + //Create the TShape + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakePipeTShapeChamfer + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A chamfer is created + * on the junction of the pipes. + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theH Height of chamfer. + * \param theW Width of chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the TShape + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakePipeTShapeChamferWithPosition + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A chamfer is created + * on the junction of the pipes. + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theH Height of the chamfer. + * \param theW Width of the chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference vertices + Handle(GEOM_Object) aP1 = GetObjectImpl(theP1); + Handle(GEOM_Object) aP2 = GetObjectImpl(theP2); + Handle(GEOM_Object) aP3 = GetObjectImpl(theP3); + + //Create the TShape + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, + theHexMesh, aP1, aP2, aP3); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakePipeTShapeFillet + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A fillet is created + * on the junction of the pipes. + * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theRF Radius of curvature of fillet. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the TShape + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakePipeTShapeFilletWithPosition + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A fillet is created + * on the junction of the pipes. + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. + * \param theR1 Internal radius of main pipe + * \param theW1 Width of main pipe + * \param theL1 Half-length of main pipe + * \param theR2 Internal radius of incident pipe (R2 < R1) + * \param theW2 Width of incident pipe (R2+W2 < R1+W1) + * \param theL2 Half-length of incident pipe + * \param theRF Radius of curvature of fillet + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh + * \param theP1 1st junction point of main pipe + * \param theP2 2nd junction point of main pipe + * \param theP3 Junction point of incident pipe + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference vertices + Handle(GEOM_Object) aP1 = GetObjectImpl(theP1); + Handle(GEOM_Object) aP2 = GetObjectImpl(theP2); + Handle(GEOM_Object) aP3 = GetObjectImpl(theP3); + + //Create the TShape + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, + theHexMesh, aP1, aP2, aP3); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * This function allows to create a disk already divided into blocks. It can be + * use to create divided pipes for later meshing in hexaedra. + * \param theR Radius of the disk + * \param theRatio Relative size of the central square diagonal against the disk diameter + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, + CORBA::Double theRatio, + CORBA::Short theOrientation, + GEOM::pattern thePattern) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the DividedDisk + Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation, thePattern); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeDividedDiskPntVecR + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theR, + CORBA::Double theRatio, + GEOM::pattern thePattern) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference points + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); + Handle(GEOM_Object) aVec = GetObjectImpl(theVec); + + if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + // Make DividedDisk + Handle(GEOM_Object) anObject = + GetOperations()->MakeDividedDiskPntVecR(aPnt, aVec, theR, theRatio, thePattern); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * Builds a cylinder prepared for hexa meshes + * \param theR Radius of the cylinder + * \param theH Height of the cylinder + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the DividedCylinder + Handle(GEOM_Object) anObject = GetOperations()->MakeDividedCylinder(theR, theH, thePattern); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +/*@@ insert new functions before this line @@ do not remove this line @@*/ diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh new file mode 100644 index 000000000..fde5fcfa5 --- /dev/null +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh @@ -0,0 +1,87 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOM_IAdvancedOperations.hh +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#ifndef _GEOM_IAdvancedOperations_i_HeaderFile +#define _GEOM_IAdvancedOperations_i_HeaderFile + +#include "GEOMImpl_Gen.hxx" + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IAdvancedOperations.hxx" + +class GEOM_I_EXPORT GEOM_IAdvancedOperations_i : + public virtual POA_GEOM::GEOM_IAdvancedOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IAdvancedOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IAdvancedOperations* theImpl); + ~GEOM_IAdvancedOperations_i(); + + GEOM::ListOfGO* MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Boolean theHexMesh); + GEOM::ListOfGO* MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::ListOfGO* MakePipeTShapeChamfer (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh); + GEOM::ListOfGO* MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::ListOfGO* MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh); + GEOM::ListOfGO* MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + + GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, + CORBA::Double theRatio, + CORBA::Short theOrientation, + GEOM::pattern thePattern); + + GEOM::GEOM_Object_ptr MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR, + CORBA::Double theRatio, + GEOM::pattern thePattern); + + GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern); + /*@@ insert new functions before this line @@ do not remove this line @@*/ + + ::GEOMImpl_IAdvancedOperations* GetOperations() + { return (::GEOMImpl_IAdvancedOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc index f475de827..47979c7b0 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.cc +++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_IBasicOperations_i.hh" @@ -36,8 +37,8 @@ */ //============================================================================= GEOM_IBasicOperations_i::GEOM_IBasicOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IBasicOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBasicOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IBasicOperations_i::GEOM_IBasicOperations_i"); @@ -67,8 +68,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointXYZ //Set a not done flag GetOperations()->SetNotDone(); - //Create the point - + //Create the point Handle(GEOM_Object) anObject = GetOperations()->MakePointXYZ(theX, theY, theZ); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -89,18 +89,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointWithReference //Set a not done flag GetOperations()->SetNotDone(); - if(theReference == NULL) return aGEOMObject._retn(); - //Get the reference point - - Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject - (theReference->GetStudyID(), theReference->GetEntry()); - if (aRefernce.IsNull()) return aGEOMObject._retn(); + Handle(GEOM_Object) aReference = GetObjectImpl(theReference); + if (aReference.IsNull()) return aGEOMObject._retn(); //Create the point - Handle(GEOM_Object) anObject = - GetOperations()->MakePointWithReference(aRefernce, theX, theY, theZ); + GetOperations()->MakePointWithReference(aReference, theX, theY, theZ); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -120,18 +115,12 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection //Set a not done flag GetOperations()->SetNotDone(); - if (theLine1 == NULL || theLine2 == NULL) return aGEOMObject._retn(); - //Get the reference Lines - - Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject - (theLine1->GetStudyID(), theLine1->GetEntry()); - Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject - (theLine2->GetStudyID(), theLine2->GetEntry()); + Handle(GEOM_Object) aRef1 = GetObjectImpl(theLine1); + Handle(GEOM_Object) aRef2 = GetObjectImpl(theLine2); if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); //Create the point - Handle(GEOM_Object) anObject = GetOperations()->MakePointOnLinesIntersection(aRef1, aRef2); if (!GetOperations()->IsDone() || anObject.IsNull()) @@ -140,7 +129,6 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection return GetObject(anObject); } - //============================================================================= /*! * MakePointOnCurve @@ -154,24 +142,82 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve //Set a not done flag GetOperations()->SetNotDone(); - if (theCurve == NULL) return aGEOMObject._retn(); + //Get the reference curve + Handle(GEOM_Object) aReference = GetObjectImpl(theCurve); + if (aReference.IsNull()) return aGEOMObject._retn(); + + //Create the point + Handle(GEOM_Object) anObject = + GetOperations()->MakePointOnCurve(aReference, theParameter); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePointOnCurveByLength + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByLength + (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); //Get the reference curve + Handle(GEOM_Object) aReference = GetObjectImpl(theCurve); + if (aReference.IsNull()) return aGEOMObject._retn(); - Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject - (theCurve->GetStudyID(), theCurve->GetEntry()); - if (aRefernce.IsNull()) return aGEOMObject._retn(); + //Get the reference point (can be NULL) + Handle(GEOM_Object) aRefPoint; + if (!CORBA::is_nil(theStartPoint)) { + aRefPoint = GetObjectImpl(theStartPoint); + } //Create the point - Handle(GEOM_Object) anObject = - GetOperations()->MakePointOnCurve(aRefernce, theParameter); + GetOperations()->MakePointOnCurveByLength(aReference, theLength, aRefPoint); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); return GetObject(anObject); } +//============================================================================= +/*! + * MakePointOnCurveByCoord + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByCoord + (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference curve + Handle(GEOM_Object) aReference = GetObjectImpl(theCurve); + if (aReference.IsNull()) return aGEOMObject._retn(); + + //Create the point + Handle(GEOM_Object) anObject = + GetOperations()->MakePointOnCurveByCoord(aReference, theXParameter, + theYParameter, theZParameter); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! @@ -180,24 +226,51 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurface (GEOM::GEOM_Object_ptr theSurface, - CORBA::Double theUParameter, - CORBA::Double theVParameter) + CORBA::Double theUParameter, + CORBA::Double theVParameter) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theSurface == NULL) return aGEOMObject._retn(); + //Get the reference surface + Handle(GEOM_Object) aReference = GetObjectImpl(theSurface); + if (aReference.IsNull()) return aGEOMObject._retn(); + + //Create the point + Handle(GEOM_Object) anObject = + GetOperations()->MakePointOnSurface(aReference, theUParameter, theVParameter); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePointOnSurfaceByCoord + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurfaceByCoord + (GEOM::GEOM_Object_ptr theSurface, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); //Get the reference surface - Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject - (theSurface->GetStudyID(), theSurface->GetEntry()); - if (aRefernce.IsNull()) return aGEOMObject._retn(); + Handle(GEOM_Object) aReference = GetObjectImpl(theSurface); + if (aReference.IsNull()) return aGEOMObject._retn(); //Create the point Handle(GEOM_Object) anObject = - GetOperations()->MakePointOnSurface(aRefernce, theUParameter, theVParameter); + GetOperations()->MakePointOnSurfaceByCoord(aReference, theXParameter, + theYParameter, theZParameter); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -218,25 +291,19 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentOnCurve //Set a not done flag GetOperations()->SetNotDone(); - if (theCurve == NULL) return aGEOMObject._retn(); - //Get the reference curve + Handle(GEOM_Object) aReference = GetObjectImpl(theCurve); + if (aReference.IsNull()) return aGEOMObject._retn(); - Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject - (theCurve->GetStudyID(), theCurve->GetEntry()); - if (aRefernce.IsNull()) return aGEOMObject._retn(); - - //Create the point - + //Create the vector Handle(GEOM_Object) anObject = - GetOperations()->MakeTangentOnCurve(aRefernce, theParameter); + GetOperations()->MakeTangentOnCurve(aReference, theParameter); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); return GetObject(anObject); } - //============================================================================= /*! * MakeVectorDXDYDZ @@ -272,20 +339,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeVectorTwoPnt //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); - //Get the reference points - - Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aRef2 = GetObjectImpl(thePnt2); if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); //Create the vector - - Handle(GEOM_Object) anObject = - GetOperations()->MakeVectorTwoPnt(aRef1, aRef2); + Handle(GEOM_Object) anObject = GetOperations()->MakeVectorTwoPnt(aRef1, aRef2); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -306,20 +366,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLine //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt == NULL || theDir == NULL) return aGEOMObject._retn(); - //Get the reference objects - - Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); - Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject - (theDir->GetStudyID(), theDir->GetEntry()); + Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt); + Handle(GEOM_Object) aRef2 = GetObjectImpl(theDir); if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); //Create the Line - - Handle(GEOM_Object) anObject = - GetOperations()->MakeLine(aRef1, aRef2); + Handle(GEOM_Object) anObject = GetOperations()->MakeLine(aRef1, aRef2); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -339,20 +392,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoPnt //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); - //Get the reference points - - Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aRef2 = GetObjectImpl(thePnt2); if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); //Create the Line - - Handle(GEOM_Object) anObject = - GetOperations()->MakeLineTwoPnt(aRef1, aRef2); + Handle(GEOM_Object) anObject = GetOperations()->MakeLineTwoPnt(aRef1, aRef2); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -372,18 +418,12 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces //Set a not done flag GetOperations()->SetNotDone(); - if (theFace1 == NULL || theFace2 == NULL) return aGEOMObject._retn(); - //Get the reference points - - Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject - (theFace1->GetStudyID(), theFace1->GetEntry()); - Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject - (theFace2->GetStudyID(), theFace2->GetEntry()); + Handle(GEOM_Object) aRef1 = GetObjectImpl(theFace1); + Handle(GEOM_Object) aRef2 = GetObjectImpl(theFace2); if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); //Create the Line - Handle(GEOM_Object) anObject = GetOperations()->MakeLineTwoFaces(aRef1, aRef2); if (!GetOperations()->IsDone() || anObject.IsNull()) @@ -392,6 +432,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces return GetObject(anObject); } + //============================================================================= /*! * MakePlanePntVec @@ -399,25 +440,19 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlanePntVec (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theTrimSize) + CORBA::Double theTrimSize) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the references - - Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); - Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt); + Handle(GEOM_Object) aRef2 = GetObjectImpl(theVec); if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); //Create the plane - Handle(GEOM_Object) anObject = GetOperations()->MakePlanePntVec(aRef1, aRef2, theTrimSize); if (!GetOperations()->IsDone() || anObject.IsNull()) @@ -433,29 +468,21 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlanePntVec //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3, CORBA::Double theTrimSize) + GEOM::GEOM_Object_ptr thePnt3, CORBA::Double theTrimSize) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) - return aGEOMObject._retn(); - //Get the reference points - - Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aRef3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aRef2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aRef3 = GetObjectImpl(thePnt3); if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull()) return aGEOMObject._retn(); //Create the plane - Handle(GEOM_Object) anObject = GetOperations()->MakePlaneThreePnt(aRef1, aRef2, aRef3, theTrimSize); if (!GetOperations()->IsDone() || anObject.IsNull()) @@ -477,16 +504,11 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneFace //Set a not done flag GetOperations()->SetNotDone(); - if (theFace == NULL) return aGEOMObject._retn(); - //Get the reference face - - Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject - (theFace->GetStudyID(), theFace->GetEntry()); + Handle(GEOM_Object) aRef = GetObjectImpl(theFace); if (aRef.IsNull()) return aGEOMObject._retn(); //Create the plane - Handle(GEOM_Object) anObject = GetOperations()->MakePlaneFace(aRef, theTrimSize); if (!GetOperations()->IsDone() || anObject.IsNull()) @@ -495,6 +517,59 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneFace return GetObject(anObject); } +//============================================================================= +/*! + * MakePlane2Vec + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlane2Vec + (GEOM::GEOM_Object_ptr theVec1, GEOM::GEOM_Object_ptr theVec2, + CORBA::Double theTrimSize) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the references + Handle(GEOM_Object) aRef1 = GetObjectImpl(theVec1); + Handle(GEOM_Object) aRef2 = GetObjectImpl(theVec2); + if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); + + //Create the plane + Handle(GEOM_Object) anObject = + GetOperations()->MakePlane2Vec(aRef1, aRef2, theTrimSize); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePlaneLCS + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneLCS + (GEOM::GEOM_Object_ptr theLCS, CORBA::Double theTrimSize, + CORBA::Double theOrientation) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the references + Handle(GEOM_Object) aRef1 = GetObjectImpl(theLCS); + + //Create the plane + Handle(GEOM_Object) anObject = + GetOperations()->MakePlaneLCS(aRef1, theTrimSize, theOrientation); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! @@ -513,8 +588,64 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker //Create the point Handle(GEOM_Object) anObject = GetOperations()->MakeMarker(theOX , theOY , theOZ, - theXDX, theXDY, theXDZ, - theYDX, theYDY, theYDZ); + theXDX, theXDY, theXDZ, + theYDX, theYDY, theYDZ); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeMarkerFromShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarkerFromShape + (GEOM::GEOM_Object_ptr theShape) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the referenced object + Handle(GEOM_Object) aRef = GetObjectImpl(theShape); + if (aRef.IsNull()) return aGEOMObject._retn(); + + //Create the point + Handle(GEOM_Object) anObject = GetOperations()->MakeMarkerFromShape(aRef); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeMarkerPntTwoVec + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarkerPntTwoVec + (GEOM::GEOM_Object_ptr theOrigin, + GEOM::GEOM_Object_ptr theXVec, + GEOM::GEOM_Object_ptr theYVec) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the referenced objects + Handle(GEOM_Object) aRef1 = GetObjectImpl(theOrigin); + Handle(GEOM_Object) aRef2 = GetObjectImpl(theXVec); + Handle(GEOM_Object) aRef3 = GetObjectImpl(theYVec); + if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull()) return aGEOMObject._retn(); + + //Create the point + Handle(GEOM_Object) anObject = GetOperations()->MakeMarkerPntTwoVec(aRef1, + aRef2, + aRef3); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -528,26 +659,21 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentPlaneOnFace - (GEOM::GEOM_Object_ptr theFace, - CORBA::Double theParameterU, - CORBA::Double theParameterV, - CORBA::Double theTrimSize) + (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theParameterU, + CORBA::Double theParameterV, + CORBA::Double theTrimSize) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theFace == NULL) return aGEOMObject._retn(); - //Get the reference face - - Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject - (theFace->GetStudyID(), theFace->GetEntry()); + Handle(GEOM_Object) aRef = GetObjectImpl(theFace); if (aRef.IsNull()) return aGEOMObject._retn(); //Create the plane - Handle(GEOM_Object) anObject = GetOperations()->MakeTangentPlaneOnFace(aRef, theParameterU,theParameterV,theTrimSize); if (!GetOperations()->IsDone() || anObject.IsNull()) @@ -555,4 +681,3 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentPlaneOnFace return GetObject(anObject); } - diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.hh b/src/GEOM_I/GEOM_IBasicOperations_i.hh index cc44faafc..841a08221 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.hh +++ b/src/GEOM_I/GEOM_IBasicOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IBasicOperations_i_HeaderFile #define _GEOM_IBasicOperations_i_HeaderFile @@ -54,10 +55,24 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i : GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint); + + GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter); + GEOM::GEOM_Object_ptr MakePointOnSurface (GEOM::GEOM_Object_ptr theSurface, CORBA::Double theUParameter, CORBA::Double theVParameter); + GEOM::GEOM_Object_ptr MakePointOnSurfaceByCoord (GEOM::GEOM_Object_ptr theSurface, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter); + GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theLine1, GEOM::GEOM_Object_ptr theLine2); @@ -91,11 +106,23 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i : GEOM::GEOM_Object_ptr MakePlaneFace (GEOM::GEOM_Object_ptr theFace, CORBA::Double theTrimSize); + + GEOM::GEOM_Object_ptr MakePlane2Vec (GEOM::GEOM_Object_ptr theVec1, + GEOM::GEOM_Object_ptr theVec2, + CORBA::Double theTrimSize); + + GEOM::GEOM_Object_ptr MakePlaneLCS (GEOM::GEOM_Object_ptr theLCS, + CORBA::Double theTrimSize, + CORBA::Double theOrientation ); GEOM::GEOM_Object_ptr MakeMarker (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ, CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ); + GEOM::GEOM_Object_ptr MakeMarkerFromShape (GEOM::GEOM_Object_ptr theShape); + + GEOM::GEOM_Object_ptr MakeMarkerPntTwoVec (GEOM::GEOM_Object_ptr theOrigin, GEOM::GEOM_Object_ptr theXVec, GEOM::GEOM_Object_ptr theYVec); + GEOM::GEOM_Object_ptr MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, CORBA::Double theParameterU, CORBA::Double theParameterV, diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.cc b/src/GEOM_I/GEOM_IBlocksOperations_i.cc index 093df705a..0c1917d46 100644 --- a/src/GEOM_I/GEOM_IBlocksOperations_i.cc +++ b/src/GEOM_I/GEOM_IBlocksOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_IBlocksOperations_i.hh" @@ -39,8 +40,8 @@ */ //============================================================================= GEOM_IBlocksOperations_i::GEOM_IBlocksOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IBlocksOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBlocksOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IBlocksOperations_i::GEOM_IBlocksOperations_i"); @@ -64,25 +65,18 @@ GEOM_IBlocksOperations_i::~GEOM_IBlocksOperations_i() //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad (GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2, - GEOM::GEOM_Object_ptr theEdge3, GEOM::GEOM_Object_ptr theEdge4) + GEOM::GEOM_Object_ptr theEdge3, GEOM::GEOM_Object_ptr theEdge4) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theEdge1 == NULL || theEdge2 == NULL || - theEdge3 == NULL || theEdge4 == NULL) return aGEOMObject._retn(); - //Get the reference edges - Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject - (theEdge1->GetStudyID(), theEdge1->GetEntry()); - Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject - (theEdge2->GetStudyID(), theEdge2->GetEntry()); - Handle(GEOM_Object) anEdge3 = GetOperations()->GetEngine()->GetObject - (theEdge3->GetStudyID(), theEdge3->GetEntry()); - Handle(GEOM_Object) anEdge4 = GetOperations()->GetEngine()->GetObject - (theEdge4->GetStudyID(), theEdge4->GetEntry()); + Handle(GEOM_Object) anEdge1 = GetObjectImpl(theEdge1); + Handle(GEOM_Object) anEdge2 = GetObjectImpl(theEdge2); + Handle(GEOM_Object) anEdge3 = GetObjectImpl(theEdge3); + Handle(GEOM_Object) anEdge4 = GetObjectImpl(theEdge4); if (anEdge1.IsNull() || anEdge2.IsNull() || anEdge3.IsNull() || anEdge4.IsNull()) return aGEOMObject._retn(); @@ -109,13 +103,9 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad2Edges //Set a not done flag GetOperations()->SetNotDone(); - if (theEdge1 == NULL || theEdge2 == NULL) return aGEOMObject._retn(); - //Get the reference edges - Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject - (theEdge1->GetStudyID(), theEdge1->GetEntry()); - Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject - (theEdge2->GetStudyID(), theEdge2->GetEntry()); + Handle(GEOM_Object) anEdge1 = GetObjectImpl(theEdge1); + Handle(GEOM_Object) anEdge2 = GetObjectImpl(theEdge2); if (anEdge1.IsNull() || anEdge2.IsNull()) return aGEOMObject._retn(); @@ -135,25 +125,18 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad2Edges //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad4Vertices (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3, GEOM::GEOM_Object_ptr thePnt4) + GEOM::GEOM_Object_ptr thePnt3, GEOM::GEOM_Object_ptr thePnt4) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || - thePnt3 == NULL || thePnt4 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); - Handle(GEOM_Object) aPnt4 = GetOperations()->GetEngine()->GetObject - (thePnt4->GetStudyID(), thePnt4->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3); + Handle(GEOM_Object) aPnt4 = GetObjectImpl(thePnt4); if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull() || aPnt4.IsNull()) return aGEOMObject._retn(); @@ -174,31 +157,21 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad4Vertices //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeHexa (GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2, - GEOM::GEOM_Object_ptr theFace3, GEOM::GEOM_Object_ptr theFace4, - GEOM::GEOM_Object_ptr theFace5, GEOM::GEOM_Object_ptr theFace6) + GEOM::GEOM_Object_ptr theFace3, GEOM::GEOM_Object_ptr theFace4, + GEOM::GEOM_Object_ptr theFace5, GEOM::GEOM_Object_ptr theFace6) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theFace1 == NULL || theFace2 == NULL || - theFace3 == NULL || theFace4 == NULL || - theFace5 == NULL || theFace6 == NULL) return aGEOMObject._retn(); - //Get the reference Faces - Handle(GEOM_Object) anFace1 = GetOperations()->GetEngine()->GetObject - (theFace1->GetStudyID(), theFace1->GetEntry()); - Handle(GEOM_Object) anFace2 = GetOperations()->GetEngine()->GetObject - (theFace2->GetStudyID(), theFace2->GetEntry()); - Handle(GEOM_Object) anFace3 = GetOperations()->GetEngine()->GetObject - (theFace3->GetStudyID(), theFace3->GetEntry()); - Handle(GEOM_Object) anFace4 = GetOperations()->GetEngine()->GetObject - (theFace4->GetStudyID(), theFace4->GetEntry()); - Handle(GEOM_Object) anFace5 = GetOperations()->GetEngine()->GetObject - (theFace5->GetStudyID(), theFace5->GetEntry()); - Handle(GEOM_Object) anFace6 = GetOperations()->GetEngine()->GetObject - (theFace6->GetStudyID(), theFace6->GetEntry()); + Handle(GEOM_Object) anFace1 = GetObjectImpl(theFace1); + Handle(GEOM_Object) anFace2 = GetObjectImpl(theFace2); + Handle(GEOM_Object) anFace3 = GetObjectImpl(theFace3); + Handle(GEOM_Object) anFace4 = GetObjectImpl(theFace4); + Handle(GEOM_Object) anFace5 = GetObjectImpl(theFace5); + Handle(GEOM_Object) anFace6 = GetObjectImpl(theFace6); if (anFace1.IsNull() || anFace2.IsNull() || anFace3.IsNull() || anFace4.IsNull() || @@ -226,13 +199,9 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeHexa2Faces //Set a not done flag GetOperations()->SetNotDone(); - if (theFace1 == NULL || theFace2 == NULL) return aGEOMObject._retn(); - //Get the reference Faces - Handle(GEOM_Object) anFace1 = GetOperations()->GetEngine()->GetObject - (theFace1->GetStudyID(), theFace1->GetEntry()); - Handle(GEOM_Object) anFace2 = GetOperations()->GetEngine()->GetObject - (theFace2->GetStudyID(), theFace2->GetEntry()); + Handle(GEOM_Object) anFace1 = GetObjectImpl(theFace1); + Handle(GEOM_Object) anFace2 = GetObjectImpl(theFace2); if (anFace1.IsNull() || anFace2.IsNull()) return aGEOMObject._retn(); @@ -258,12 +227,8 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeBlockCompound //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL) return aGEOMObject._retn(); - //Get the reference Compound - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return aGEOMObject._retn(); //Create the Blocks Compound @@ -281,22 +246,18 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeBlockCompound */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr theShape, - const CORBA::Double theX, - const CORBA::Double theY, - const CORBA::Double theZ, - const CORBA::Double theEpsilon) + const CORBA::Double theX, + const CORBA::Double theY, + const CORBA::Double theZ, + const CORBA::Double theEpsilon) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aGEOMObject._retn(); //Create the Point @@ -308,30 +269,52 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr return GetObject(anObject); } +//============================================================================= +/*! + * GetVertexNearPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetVertexNearPoint + (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Get the reference Objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); + if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); + + // Create the Point + Handle(GEOM_Object) anObject = + GetOperations()->GetVertexNearPoint(aShape, aPoint); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * GetEdge */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdge (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - thePoint1 == NULL || thePoint2 == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject - (thePoint1->GetStudyID(), thePoint1->GetEntry()); - Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject - (thePoint2->GetStudyID(), thePoint2->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); if (aShape.IsNull() || aPoint1.IsNull() || aPoint2.IsNull()) return aGEOMObject._retn(); @@ -351,20 +334,16 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdge (GEOM::GEOM_Object_ptr t */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || thePoint == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject - (thePoint->GetStudyID(), thePoint->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); @@ -384,31 +363,22 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdgeNearPoint (GEOM::GEOM_Obj //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByPoints (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2, - GEOM::GEOM_Object_ptr thePoint3, - GEOM::GEOM_Object_ptr thePoint4) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + GEOM::GEOM_Object_ptr thePoint3, + GEOM::GEOM_Object_ptr thePoint4) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - thePoint1 == NULL || thePoint2 == NULL || - thePoint3 == NULL || thePoint4 == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject - (thePoint1->GetStudyID(), thePoint1->GetEntry()); - Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject - (thePoint2->GetStudyID(), thePoint2->GetEntry()); - Handle(GEOM_Object) aPoint3 = GetOperations()->GetEngine()->GetObject - (thePoint3->GetStudyID(), thePoint3->GetEntry()); - Handle(GEOM_Object) aPoint4 = GetOperations()->GetEngine()->GetObject - (thePoint4->GetStudyID(), thePoint4->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); + Handle(GEOM_Object) aPoint3 = GetObjectImpl(thePoint3); + Handle(GEOM_Object) aPoint4 = GetObjectImpl(thePoint4); if (aShape.IsNull() || aPoint1.IsNull() || aPoint2.IsNull() || @@ -430,24 +400,18 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByPoints //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByEdges (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr theEdge1, - GEOM::GEOM_Object_ptr theEdge2) + GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - theEdge1 == NULL || theEdge2 == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject - (theEdge1->GetStudyID(), theEdge1->GetEntry()); - Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject - (theEdge2->GetStudyID(), theEdge2->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anEdge1 = GetObjectImpl(theEdge1); + Handle(GEOM_Object) anEdge2 = GetObjectImpl(theEdge2); if (aShape.IsNull() || anEdge1.IsNull() || anEdge2.IsNull()) return aGEOMObject._retn(); @@ -467,20 +431,16 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByEdges */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetOppositeFace (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr theFace) + GEOM::GEOM_Object_ptr theFace) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theFace == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject - (theFace->GetStudyID(), theFace->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aFace = GetObjectImpl(theFace); if (aShape.IsNull() || aFace.IsNull()) return aGEOMObject._retn(); @@ -499,20 +459,16 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetOppositeFace (GEOM::GEOM_Obje */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || thePoint == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject - (thePoint->GetStudyID(), thePoint->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); @@ -531,20 +487,16 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceNearPoint (GEOM::GEOM_Obj */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr theVector) + GEOM::GEOM_Object_ptr theVector) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theVector == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject - (theVector->GetStudyID(), theVector->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aVector = GetObjectImpl(theVector); if (aShape.IsNull() || aVector.IsNull()) return aGEOMObject._retn(); @@ -557,6 +509,37 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Obj return GetObject(anObject); } +//============================================================================= +/*! + * GetShapesNearPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetShapesNearPoint + (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Long theShapeType, + CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Get the reference Objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); + + if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); + + // Create the Shape + Handle(GEOM_Object) anObject = + GetOperations()->GetShapesNearPoint(aShape, aPoint, theShapeType, theTolerance); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * ExplodeCompoundOfBlocks @@ -564,20 +547,16 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Obj //============================================================================= GEOM::ListOfGO* GEOM_IBlocksOperations_i::ExplodeCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - const CORBA::Long theMinNbFaces, - const CORBA::Long theMaxNbFaces) + const CORBA::Long theMinNbFaces, + const CORBA::Long theMaxNbFaces) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL) return aSeq._retn(); - //Get the reference Compound - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return aSeq._retn(); //Explode @@ -601,9 +580,9 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::ExplodeCompoundOfBlocks //============================================================================= CORBA::Boolean GEOM_IBlocksOperations_i::IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - const CORBA::Long theMinNbFaces, - const CORBA::Long theMaxNbFaces, - CORBA::Long& theNbBlocks) + const CORBA::Long theMinNbFaces, + const CORBA::Long theMaxNbFaces, + CORBA::Long& theNbBlocks) { theNbBlocks = 0; CORBA::Boolean isComp = false; @@ -611,20 +590,16 @@ CORBA::Boolean GEOM_IBlocksOperations_i::IsCompoundOfBlocks //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL) return isComp; - //Get the reference Compound - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return isComp; //Check Standard_Integer nbBlocks = 0; isComp = GetOperations()->IsCompoundOfBlocks(aCompound, - theMinNbFaces, - theMaxNbFaces, - nbBlocks); + theMinNbFaces, + theMaxNbFaces, + nbBlocks); if (!GetOperations()->IsDone()) return isComp; @@ -639,23 +614,19 @@ CORBA::Boolean GEOM_IBlocksOperations_i::IsCompoundOfBlocks //============================================================================= CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors) + GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors) { CORBA::Boolean isComp = false; //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL) return isComp; - //Get the reference Compound - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return isComp; //Check - list errList; + std::list errList; isComp = GetOperations()->CheckCompoundOfBlocks(aCompound, errList); if (!GetOperations()->IsDone()) return isComp; @@ -666,7 +637,7 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks anErrArray->length(nbErr); // fill the local CORBA array with values from lists - list::iterator errIt = errList.begin(); + std::list::iterator errIt = errList.begin(); int i = 0; for (; errIt != errList.end(); i++, errIt++) { GEOM::GEOM_IBlocksOperations::BCError_var anError = @@ -694,11 +665,11 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks break; } - list sshList = errStruct.incriminated; + std::list sshList = errStruct.incriminated; GEOM::ListOfLong_var anIncrims = new GEOM::ListOfLong(); anIncrims->length(sshList.size()); - list::iterator sshIt = sshList.begin(); + std::list::iterator sshIt = sshList.begin(); int jj = 0; for (; sshIt != sshList.end(); jj++, sshIt++) { anIncrims[jj] = *sshIt; @@ -722,16 +693,14 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks //============================================================================= char* GEOM_IBlocksOperations_i::PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, - const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) + const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) { //Get the reference Compound - if (theCompound == NULL) return NULL; - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return NULL; // Convert the errors sequence - list anErrors; + std::list anErrors; int nbErr = theErrors.length(); int ie = 0; for (; ie < nbErr; ie++) { @@ -770,7 +739,7 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors } TCollection_AsciiString aDescr = GetOperations()->PrintBCErrors(aCompound, anErrors); - return CORBA::string_dup(aDescr.ToCString()); + return CORBA::string_dup(aDescr.ToCString()); } //============================================================================= @@ -778,24 +747,21 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors * RemoveExtraEdges */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape) +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges + (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theOptimumNbFaces) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aGEOMObject._retn(); //Get the result - Handle(GEOM_Object) anObject = - GetOperations()->RemoveExtraEdges(aShape); + Handle(GEOM_Object) anObject = GetOperations()->RemoveExtraEdges(aShape, theOptimumNbFaces); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -814,12 +780,8 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::CheckAndImprove (GEOM::GEOM_Obje //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return aGEOMObject._retn(); //Get the result @@ -837,20 +799,16 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::CheckAndImprove (GEOM::GEOM_Obje */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL || thePoint == NULL) return aGEOMObject._retn(); - //Get the reference Objects - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject - (thePoint->GetStudyID(), thePoint->GetEntry()); + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); if (aCompound.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); @@ -869,19 +827,15 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockNearPoint (GEOM::GEOM_Ob */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockByParts (GEOM::GEOM_Object_ptr theCompound, - const GEOM::ListOfGO& theParts) + const GEOM::ListOfGO& theParts) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL) return aGEOMObject._retn(); - //Get the reference Compound - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return aGEOMObject._retn(); //Get the parts @@ -890,9 +844,7 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockByParts (GEOM::GEOM_Obje aLen = theParts.length(); for (ind = 0; ind < aLen; ind++) { - if (theParts[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theParts[ind]->GetStudyID(), theParts[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theParts[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aParts->Append(aSh); } @@ -912,19 +864,15 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockByParts (GEOM::GEOM_Obje */ //============================================================================= GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound, - const GEOM::ListOfGO& theParts) + const GEOM::ListOfGO& theParts) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theCompound == NULL) return aSeq._retn(); - //Get the reference Compound - Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject - (theCompound->GetStudyID(), theCompound->GetEntry()); - + Handle(GEOM_Object) aCompound = GetObjectImpl(theCompound); if (aCompound.IsNull()) return aSeq._retn(); //Get the parts @@ -933,9 +881,7 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_pt aLen = theParts.length(); for (ind = 0; ind < aLen; ind++) { - if (theParts[ind] == NULL) return aSeq._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theParts[ind]->GetStudyID(), theParts[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theParts[ind]); if (aSh.IsNull()) return aSeq._retn(); aParts->Append(aSh); } @@ -961,29 +907,25 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_pt //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation1D (GEOM::GEOM_Object_ptr theBlock, - const CORBA::Long theDirFace1, - const CORBA::Long theDirFace2, - const CORBA::Long theNbTimes) + const CORBA::Long theDirFace1, + const CORBA::Long theDirFace2, + const CORBA::Long theNbTimes) { GEOM::GEOM_Object_var aGEOMObject; - //Set a not done flag + //Set a not done flag GetOperations()->SetNotDone(); - if (theBlock == NULL) return aGEOMObject._retn(); - - //Get the object itself and the vector of translation - Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject - (theBlock->GetStudyID(), theBlock->GetEntry()); - - if (aBasicObject.IsNull()) return aGEOMObject._retn(); + //Get the object itself and the vector of translation + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theBlock); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); - //Perform the transformation - Handle(GEOM_Object) anObject = GetOperations()->MakeMultiTransformation1D - (aBasicObject, theDirFace1, theDirFace2, theNbTimes); - if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + //Perform the transformation + Handle(GEOM_Object) anObject = GetOperations()->MakeMultiTransformation1D + (aBasicObject, theDirFace1, theDirFace2, theNbTimes); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); - return GetObject(anObject); + return GetObject(anObject); } //============================================================================= @@ -993,24 +935,20 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation1D //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation2D (GEOM::GEOM_Object_ptr theBlock, - const CORBA::Long theDirFace1U, - const CORBA::Long theDirFace2U, - const CORBA::Long theNbTimesU, - const CORBA::Long theDirFace1V, - const CORBA::Long theDirFace2V, - const CORBA::Long theNbTimesV) + const CORBA::Long theDirFace1U, + const CORBA::Long theDirFace2U, + const CORBA::Long theNbTimesU, + const CORBA::Long theDirFace1V, + const CORBA::Long theDirFace2V, + const CORBA::Long theNbTimesV) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theBlock == NULL) return aGEOMObject._retn(); - //Get the object itself - Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject - (theBlock->GetStudyID(), theBlock->GetEntry()); - + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theBlock); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Perform the transformation @@ -1035,12 +973,8 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::Propagate (GEOM::GEOM_Object_ptr theSh //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aSeq._retn(); - //Get the reference Shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aSeq._retn(); //Get the Propagation chains diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.hh b/src/GEOM_I/GEOM_IBlocksOperations_i.hh index ff6480f8b..a801a1e7e 100644 --- a/src/GEOM_I/GEOM_IBlocksOperations_i.hh +++ b/src/GEOM_I/GEOM_IBlocksOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IBlocksOperations_i_HeaderFile #define _GEOM_IBlocksOperations_i_HeaderFile @@ -74,6 +75,9 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i : CORBA::Double theZ, CORBA::Double theEpsilon); + GEOM::GEOM_Object_ptr GetVertexNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr GetEdge (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); @@ -100,10 +104,15 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i : GEOM::GEOM_Object_ptr GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock, GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr GetShapesNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Long theShapeType, + CORBA::Double theTolerance); + // Check blocks compound CORBA::Boolean IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - CORBA::Long theMinNbFaces, - CORBA::Long theMaxNbFaces, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces, CORBA::Long& theNbBlocks); CORBA::Boolean CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, @@ -112,7 +121,8 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i : char* PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors); - GEOM::GEOM_Object_ptr RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape); + GEOM::GEOM_Object_ptr RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theOptimumNbFaces); GEOM::GEOM_Object_ptr CheckAndImprove (GEOM::GEOM_Object_ptr theCompound); diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.cc b/src/GEOM_I/GEOM_IBooleanOperations_i.cc index cceef3727..d6ae76235 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.cc +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_IBooleanOperations_i.hh" @@ -37,8 +38,8 @@ */ //============================================================================= GEOM_IBooleanOperations_i::GEOM_IBooleanOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IBooleanOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBooleanOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IBooleanOperations_i::GEOM_IBooleanOperations_i"); @@ -62,23 +63,17 @@ GEOM_IBooleanOperations_i::~GEOM_IBooleanOperations_i() //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2, - CORBA::Long theOp) + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOp) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape1 == NULL || theShape2 == NULL) return aGEOMObject._retn(); - //Get the reference shapes - CORBA::String_var entry=theShape1->GetEntry(); - Handle(GEOM_Object) aSh1 = GetOperations()->GetEngine()->GetObject - (theShape1->GetStudyID(), entry); - entry=theShape2->GetEntry(); - Handle(GEOM_Object) aSh2 = GetOperations()->GetEngine()->GetObject - (theShape2->GetStudyID(), entry); + Handle(GEOM_Object) aSh1 = GetObjectImpl(theShape1); + Handle(GEOM_Object) aSh2 = GetObjectImpl(theShape2); if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn(); @@ -97,13 +92,13 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition (const GEOM::ListOfGO& theShapes, - const GEOM::ListOfGO& theTools, - const GEOM::ListOfGO& theKeepIns, - const GEOM::ListOfGO& theRemoveIns, - CORBA::Short theLimit, - CORBA::Boolean theRemoveWebs, - const GEOM::ListOfLong& theMaterials, - CORBA::Short theKeepNonlimitShapes) + const GEOM::ListOfGO& theTools, + const GEOM::ListOfGO& theKeepIns, + const GEOM::ListOfGO& theRemoveIns, + CORBA::Short theLimit, + CORBA::Boolean theRemoveWebs, + const GEOM::ListOfLong& theMaterials, + CORBA::Short theKeepNonlimitShapes) { GEOM::GEOM_Object_var aGEOMObject; @@ -120,9 +115,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition //Get the shapes aLen = theShapes.length(); for (ind = 0; ind < aLen; ind++) { - if (theShapes[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aShapes->Append(aSh); } @@ -130,9 +123,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition //Get the tools aLen = theTools.length(); for (ind = 0; ind < aLen; ind++) { - if (theTools[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theTools[ind]->GetStudyID(), theTools[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theTools[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aTools->Append(aSh); } @@ -140,9 +131,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition //Get the keep inside shapes aLen = theKeepIns.length(); for (ind = 0; ind < aLen; ind++) { - if (theKeepIns[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theKeepIns[ind]->GetStudyID(), theKeepIns[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theKeepIns[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aKeepIns->Append(aSh); } @@ -150,9 +139,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition //Get the remove inside shapes aLen = theRemoveIns.length(); for (ind = 0; ind < aLen; ind++) { - if (theRemoveIns[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theRemoveIns[ind]->GetStudyID(), theRemoveIns[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theRemoveIns[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aRemIns->Append(aSh); } @@ -169,9 +156,9 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition // Make Partition Handle(GEOM_Object) anObject = GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, - theLimit, theRemoveWebs, aMaterials, - theKeepNonlimitShapes, - /*PerformSelfIntersections*/Standard_True); + theLimit, theRemoveWebs, aMaterials, + theKeepNonlimitShapes, + /*PerformSelfIntersections*/Standard_True); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -185,13 +172,13 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersectedShape (const GEOM::ListOfGO& theShapes, - const GEOM::ListOfGO& theTools, - const GEOM::ListOfGO& theKeepIns, - const GEOM::ListOfGO& theRemoveIns, - CORBA::Short theLimit, - CORBA::Boolean theRemoveWebs, - const GEOM::ListOfLong& theMaterials, - CORBA::Short theKeepNonlimitShapes) + const GEOM::ListOfGO& theTools, + const GEOM::ListOfGO& theKeepIns, + const GEOM::ListOfGO& theRemoveIns, + CORBA::Short theLimit, + CORBA::Boolean theRemoveWebs, + const GEOM::ListOfLong& theMaterials, + CORBA::Short theKeepNonlimitShapes) { GEOM::GEOM_Object_var aGEOMObject; @@ -208,9 +195,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected //Get the shapes aLen = theShapes.length(); for (ind = 0; ind < aLen; ind++) { - if (theShapes[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aShapes->Append(aSh); } @@ -218,9 +203,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected //Get the tools aLen = theTools.length(); for (ind = 0; ind < aLen; ind++) { - if (theTools[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theTools[ind]->GetStudyID(), theTools[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theTools[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aTools->Append(aSh); } @@ -228,9 +211,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected //Get the keep inside shapes aLen = theKeepIns.length(); for (ind = 0; ind < aLen; ind++) { - if (theKeepIns[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theKeepIns[ind]->GetStudyID(), theKeepIns[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theKeepIns[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aKeepIns->Append(aSh); } @@ -238,9 +219,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected //Get the remove inside shapes aLen = theRemoveIns.length(); for (ind = 0; ind < aLen; ind++) { - if (theRemoveIns[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theRemoveIns[ind]->GetStudyID(), theRemoveIns[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theRemoveIns[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aRemIns->Append(aSh); } @@ -257,9 +236,9 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected // Make Partition Handle(GEOM_Object) anObject = GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, - theLimit, theRemoveWebs, aMaterials, - theKeepNonlimitShapes, - /*PerformSelfIntersections*/Standard_False); + theLimit, theRemoveWebs, aMaterials, + theKeepNonlimitShapes, + /*PerformSelfIntersections*/Standard_False); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -273,20 +252,16 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePlane) + GEOM::GEOM_Object_ptr thePlane) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || thePlane == NULL) return aGEOMObject._retn(); - //Get the reference shapes - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aPl = GetOperations()->GetEngine()->GetObject - (thePlane->GetStudyID(), thePlane->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theShape); + Handle(GEOM_Object) aPl = GetObjectImpl(thePlane); if (aSh.IsNull() || aPl.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.hh b/src/GEOM_I/GEOM_IBooleanOperations_i.hh index 5be05a05e..3a31252b7 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.hh +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IBooleanOperations_i_HeaderFile #define _GEOM_IBooleanOperations_i_HeaderFile diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index 2b15af49f..b5109c9bb 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_ICurvesOperations_i.hh" @@ -35,8 +36,8 @@ */ //============================================================================= GEOM_ICurvesOperations_i::GEOM_ICurvesOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_ICurvesOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ICurvesOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_ICurvesOperations_i::GEOM_ICurvesOperations_i"); @@ -60,7 +61,7 @@ GEOM_ICurvesOperations_i::~GEOM_ICurvesOperations_i() //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theR) + CORBA::Double theR) { GEOM::GEOM_Object_var aGEOMObject; @@ -74,13 +75,11 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR //Get the arguments Handle(GEOM_Object) aPnt, aVec; if (!CORBA::is_nil(thePnt)) { - aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); + aPnt = GetObjectImpl(thePnt); if (aPnt.IsNull()) return aGEOMObject._retn(); } if (!CORBA::is_nil(theVec)) { - aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + aVec = GetObjectImpl(theVec); if (aVec.IsNull()) return aGEOMObject._retn(); } @@ -100,22 +99,17 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt3) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3); if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); @@ -135,22 +129,17 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt3) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3); if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); @@ -169,7 +158,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleCenter2Pnt //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, - CORBA::Double theRMajor, double theRMinor) + CORBA::Double theRMajor, double theRMinor) { GEOM::GEOM_Object_var aGEOMObject; @@ -181,21 +170,63 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse //if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); //Get the arguments - Handle(GEOM_Object) aPnt, aVec; + Handle(GEOM_Object) aPnt, aVec, aVecMaj; + if (!CORBA::is_nil(thePnt)) { + aPnt = GetObjectImpl(thePnt); + if (aPnt.IsNull()) return aGEOMObject._retn(); + } + if (!CORBA::is_nil(theVec)) { + aVec = GetObjectImpl(theVec); + if (aVec.IsNull()) return aGEOMObject._retn(); + } + + // Make Ellipse + Handle(GEOM_Object) anObject = + GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor, aVecMaj); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeEllipseVec + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipseVec + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, double theRMinor, + GEOM::GEOM_Object_ptr theVecMaj) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + // Not set thePnt means origin of global CS, + // Not set theVec means Z axis of global CS + // Not set theVecMaj means X axis of global CS + //if (thePnt == NULL || theVec == NULL || theVecMaj == NULL) return aGEOMObject._retn(); + + //Get the arguments + Handle(GEOM_Object) aPnt, aVec, aVecMaj; if (!CORBA::is_nil(thePnt)) { - aPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); + aPnt = GetObjectImpl(thePnt); if (aPnt.IsNull()) return aGEOMObject._retn(); } if (!CORBA::is_nil(theVec)) { - aVec = GetOperations()->GetEngine()->GetObject - (theVec->GetStudyID(), theVec->GetEntry()); + aVec = GetObjectImpl(theVec); if (aVec.IsNull()) return aGEOMObject._retn(); } + if (!CORBA::is_nil(theVecMaj)) { + aVecMaj = GetObjectImpl(theVecMaj); + if (aVecMaj.IsNull()) return aGEOMObject._retn(); + } // Make Ellipse Handle(GEOM_Object) anObject = - GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor); + GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor, aVecMaj); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -209,23 +240,18 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3); if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); @@ -255,15 +281,10 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcCenter //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3); if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); @@ -283,23 +304,18 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcCenter //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); - Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject - (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); + Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3); if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); @@ -318,7 +334,8 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcOfEllipse */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline - (const GEOM::ListOfGO& thePoints) + (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed) { GEOM::GEOM_Object_var aGEOMObject; @@ -328,20 +345,16 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline //Get the reference point int ind = 0; int aLen = thePoints.length(); - list aPoints; + std::list aPoints; for (; ind < aLen; ind++) { - if (thePoints[ind] == NULL) return aGEOMObject._retn(); - - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePoints[ind]->GetStudyID(), thePoints[ind]->GetEntry()); - + Handle(GEOM_Object) aPnt = GetObjectImpl(thePoints[ind]); if (aPnt.IsNull()) return aGEOMObject._retn(); aPoints.push_back(aPnt); } // Make Polyline Handle(GEOM_Object) anObject = - GetOperations()->MakePolyline(aPoints); + GetOperations()->MakePolyline(aPoints, theIsClosed); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -354,7 +367,8 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier - (const GEOM::ListOfGO& thePoints) + (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed) { GEOM::GEOM_Object_var aGEOMObject; @@ -364,20 +378,16 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier //Get the reference point int ind = 0; int aLen = thePoints.length(); - list aPoints; + std::list aPoints; for (; ind < aLen; ind++) { - if (thePoints[ind] == NULL) return aGEOMObject._retn(); - - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePoints[ind]->GetStudyID(), thePoints[ind]->GetEntry()); - + Handle(GEOM_Object) aPnt = GetObjectImpl(thePoints[ind]); if (aPnt.IsNull()) return aGEOMObject._retn(); aPoints.push_back(aPnt); } // Make Bezier curve Handle(GEOM_Object) anObject = - GetOperations()->MakeSplineBezier(aPoints); + GetOperations()->MakeSplineBezier(aPoints, theIsClosed); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -390,7 +400,9 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation - (const GEOM::ListOfGO& thePoints) + (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed, + CORBA::Boolean theDoReordering) { GEOM::GEOM_Object_var aGEOMObject; @@ -400,26 +412,102 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation //Get the reference point int ind = 0; int aLen = thePoints.length(); - list aPoints; + std::list aPoints; for (; ind < aLen; ind++) { - if (thePoints[ind] == NULL) return aGEOMObject._retn(); - - Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject - (thePoints[ind]->GetStudyID(), thePoints[ind]->GetEntry()); - + Handle(GEOM_Object) aPnt = GetObjectImpl(thePoints[ind]); if (aPnt.IsNull()) return aGEOMObject._retn(); aPoints.push_back(aPnt); } // Make Polyline Handle(GEOM_Object) anObject = - GetOperations()->MakeSplineInterpolation(aPoints); + GetOperations()->MakeSplineInterpolation(aPoints, theIsClosed, theDoReordering); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); return GetObject(anObject); } +//============================================================================= +/*! + * MakeCurveParametric + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr, + double theParamMin, double theParamMax, double theParamStep, + GEOM::curve_type theCurveType) { + GEOM::GEOM_Object_var aGEOMObject; + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOMImpl_ICurvesOperations::CurveType aType; + switch(theCurveType) { + case GEOM::Polyline: + aType = GEOMImpl_ICurvesOperations::Polyline; + break; + case GEOM::Bezier: + aType = GEOMImpl_ICurvesOperations::Bezier; + break; + case GEOM::Interpolation: + aType = GEOMImpl_ICurvesOperations::Interpolation; + break; + default: + break; + } + + + // Make Polyline + Handle(GEOM_Object) anObject = + GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr, + theParamMin, theParamMax, + theParamStep, aType); + + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeCurveParametricNew + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const char* thexExpr, const char* theyExpr, const char* thezExpr, + double theParamMin, double theParamMax, CORBA::Long theParamNbStep, + GEOM::curve_type theCurveType) { + GEOM::GEOM_Object_var aGEOMObject; + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOMImpl_ICurvesOperations::CurveType aType; + switch(theCurveType) { + case GEOM::Polyline: + aType = GEOMImpl_ICurvesOperations::Polyline; + break; + case GEOM::Bezier: + aType = GEOMImpl_ICurvesOperations::Bezier; + break; + case GEOM::Interpolation: + aType = GEOMImpl_ICurvesOperations::Interpolation; + break; + default: + break; + } + + + // Make Polyline + Handle(GEOM_Object) anObject = + GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr, + theParamMin, theParamMax, + 0.0, aType, theParamNbStep, true); + + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeSketcher @@ -433,7 +521,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher int ind = 0; int aLen = theWorkingPlane.length(); - list aWorkingPlane; + std::list aWorkingPlane; for (; ind < aLen; ind++) aWorkingPlane.push_back(theWorkingPlane[ind]); @@ -459,7 +547,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher int ind = 0; int aLen = theCoordinates.length(); - list aCoords; + std::list aCoords; for (; ind < aLen; ind++) aCoords.push_back(theCoordinates[ind]); @@ -483,8 +571,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane //Set a not done flag GetOperations()->SetNotDone(); - Handle(GEOM_Object) aWorkingPlane = GetOperations()->GetEngine()->GetObject - (theWorkingPlane->GetStudyID(), theWorkingPlane->GetEntry()); + Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane); // Make Sketcher Handle(GEOM_Object) anObject = diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh index 24179fc1f..5fc09cc55 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_ICurvesOperations_i_HeaderFile #define _GEOM_ICurvesOperations_i_HeaderFile @@ -57,6 +58,11 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i : GEOM::GEOM_Object_ptr theVector, double theRMajor, double theRMinor); + GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + double theRMajor, double theRMinor, + GEOM::GEOM_Object_ptr theVectorMajor); + GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); @@ -70,11 +76,23 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i : GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); - GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints); + GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed); - GEOM::GEOM_Object_ptr MakeSplineBezier (const GEOM::ListOfGO& thePoints); + GEOM::GEOM_Object_ptr MakeSplineBezier (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed); - GEOM::GEOM_Object_ptr MakeSplineInterpolation (const GEOM::ListOfGO& thePoints); + GEOM::GEOM_Object_ptr MakeSplineInterpolation (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed, + CORBA::Boolean theDoReordering); + + GEOM::GEOM_Object_ptr MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr, + double theParamMin, double theParamMax, double theParamStep, + GEOM::curve_type theCurveType); + + GEOM::GEOM_Object_ptr MakeCurveParametricNew(const char* thexExpr, const char* theyExpr, const char* thezExpr, + double theParamMin, double theParamMax, CORBA::Long theParamNbStep, + GEOM::curve_type theCurveType); GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane); diff --git a/src/GEOM_I/GEOM_IGroupOperations_i.cc b/src/GEOM_I/GEOM_IGroupOperations_i.cc index 7f87d4ac4..3a8cef597 100644 --- a/src/GEOM_I/GEOM_IGroupOperations_i.cc +++ b/src/GEOM_I/GEOM_IGroupOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_IGroupOperations_i.hh" @@ -39,8 +40,8 @@ */ //============================================================================= GEOM_IGroupOperations_i::GEOM_IGroupOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IGroupOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IGroupOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IGroupOperations_i::GEOM_IGroupOperations_i"); @@ -61,19 +62,19 @@ GEOM_IGroupOperations_i::~GEOM_IGroupOperations_i() /*! * CreateGroup */ -//============================================================================= -GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CreateGroup(GEOM::GEOM_Object_ptr theMainShape, CORBA::Long theShapeType) +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CreateGroup(GEOM::GEOM_Object_ptr theMainShape, + CORBA::Long theShapeType) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theMainShape == NULL || theShapeType < 0) return aGEOMObject._retn(); + if (theShapeType < 0) return aGEOMObject._retn(); //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry()); - + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theMainShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Create the Fillet @@ -89,40 +90,33 @@ GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CreateGroup(GEOM::GEOM_Object_ptr * AddObject */ //============================================================================= -void GEOM_IGroupOperations_i::AddObject(GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId) +void GEOM_IGroupOperations_i::AddObject(GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId) { //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return; - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return; GetOperations()->AddObject(aGroupRef, theSubShapeId); - return; } //============================================================================= /*! * RemoveObject */ -//============================================================================= -void GEOM_IGroupOperations_i::RemoveObject(GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId) +//============================================================================= +void GEOM_IGroupOperations_i::RemoveObject(GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId) { //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return; - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return; GetOperations()->RemoveObject(aGroupRef, theSubShapeId); - - return; } //============================================================================= @@ -131,16 +125,13 @@ void GEOM_IGroupOperations_i::RemoveObject(GEOM::GEOM_Object_ptr theGroup, CORBA */ //============================================================================= void GEOM_IGroupOperations_i::UnionList (GEOM::GEOM_Object_ptr theGroup, - const GEOM::ListOfGO& theSubShapes) + const GEOM::ListOfGO& theSubShapes) { //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return; - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject - (theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return; //Get sub-shape to add @@ -148,16 +139,13 @@ void GEOM_IGroupOperations_i::UnionList (GEOM::GEOM_Object_ptr theGroup, int ind, aLen = theSubShapes.length(); for (ind = 0; ind < aLen; ind++) { - if (theSubShapes[ind] == NULL) return; - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theSubShapes[ind]->GetStudyID(), theSubShapes[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]); if (aSh.IsNull()) return; aSubShapes->Append(aSh); } //Perform the operation GetOperations()->UnionList(aGroupRef, aSubShapes); - return; } //============================================================================= @@ -166,16 +154,13 @@ void GEOM_IGroupOperations_i::UnionList (GEOM::GEOM_Object_ptr theGroup, */ //============================================================================= void GEOM_IGroupOperations_i::DifferenceList (GEOM::GEOM_Object_ptr theGroup, - const GEOM::ListOfGO& theSubShapes) + const GEOM::ListOfGO& theSubShapes) { //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return; - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject - (theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return; //Get sub-shape to remove @@ -183,16 +168,13 @@ void GEOM_IGroupOperations_i::DifferenceList (GEOM::GEOM_Object_ptr theGroup, int ind, aLen = theSubShapes.length(); for (ind = 0; ind < aLen; ind++) { - if (theSubShapes[ind] == NULL) return; - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theSubShapes[ind]->GetStudyID(), theSubShapes[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]); if (aSh.IsNull()) return; aSubShapes->Append(aSh); } //Perform the operation GetOperations()->DifferenceList(aGroupRef, aSubShapes); - return; } //============================================================================= @@ -201,16 +183,13 @@ void GEOM_IGroupOperations_i::DifferenceList (GEOM::GEOM_Object_ptr theGroup, */ //============================================================================= void GEOM_IGroupOperations_i::UnionIDs (GEOM::GEOM_Object_ptr theGroup, - const GEOM::ListOfLong& theSubShapes) + const GEOM::ListOfLong& theSubShapes) { //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return; - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject - (theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return; //Get sub-shape to add @@ -232,16 +211,13 @@ void GEOM_IGroupOperations_i::UnionIDs (GEOM::GEOM_Object_ptr theGroup, */ //============================================================================= void GEOM_IGroupOperations_i::DifferenceIDs (GEOM::GEOM_Object_ptr theGroup, - const GEOM::ListOfLong& theSubShapes) + const GEOM::ListOfLong& theSubShapes) { //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return; - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject - (theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return; //Get sub-shape to remove @@ -261,17 +237,14 @@ void GEOM_IGroupOperations_i::DifferenceIDs (GEOM::GEOM_Object_ptr theGroup, /*! * GetType */ -//============================================================================= +//============================================================================= CORBA::Long GEOM_IGroupOperations_i::GetType(GEOM::GEOM_Object_ptr theGroup) { //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return -1; - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); - + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return -1; return GetOperations()->GetType(aGroupRef); @@ -281,7 +254,7 @@ CORBA::Long GEOM_IGroupOperations_i::GetType(GEOM::GEOM_Object_ptr theGroup) /*! * GetMainShape */ -//============================================================================= +//============================================================================= GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::GetMainShape(GEOM::GEOM_Object_ptr theGroup) { GEOM::GEOM_Object_var aGEOMObject; @@ -289,10 +262,8 @@ GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::GetMainShape(GEOM::GEOM_Object_pt //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return aGEOMObject._retn(); - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return aGEOMObject._retn(); Handle(GEOM_Object) anObject = GetOperations()->GetMainShape(aGroupRef); @@ -305,7 +276,7 @@ GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::GetMainShape(GEOM::GEOM_Object_pt /*! * GetObjects */ -//============================================================================= +//============================================================================= GEOM::ListOfLong* GEOM_IGroupOperations_i::GetObjects(GEOM::GEOM_Object_ptr theGroup) { GEOM::ListOfLong_var aList; @@ -313,20 +284,17 @@ GEOM::ListOfLong* GEOM_IGroupOperations_i::GetObjects(GEOM::GEOM_Object_ptr theG //Set a not done flag GetOperations()->SetNotDone(); - if (theGroup == NULL) return aList._retn(); - //Get the reference group - Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + Handle(GEOM_Object) aGroupRef = GetObjectImpl(theGroup); if (aGroupRef.IsNull()) return aList._retn(); - aList = new GEOM::ListOfLong; + aList = new GEOM::ListOfLong; Handle(TColStd_HArray1OfInteger) aSeq = GetOperations()->GetObjects(aGroupRef); if (!GetOperations()->IsDone() || aSeq.IsNull()) return aList._retn(); - + aList->length(aSeq->Length()); for(int i = 1; i<=aSeq->Length(); i++) aList[i-1] = aSeq->Value(i); return aList._retn(); } - diff --git a/src/GEOM_I/GEOM_IGroupOperations_i.hh b/src/GEOM_I/GEOM_IGroupOperations_i.hh index c4cf01e93..b3871e0fe 100644 --- a/src/GEOM_I/GEOM_IGroupOperations_i.hh +++ b/src/GEOM_I/GEOM_IGroupOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IGroupOperations_i_HeaderFile #define _GEOM_IGroupOperations_i_HeaderFile diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.cc b/src/GEOM_I/GEOM_IHealingOperations_i.cc index a529c1cfe..9a064b3d0 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.cc +++ b/src/GEOM_I/GEOM_IHealingOperations_i.cc @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 #include @@ -30,6 +30,7 @@ #include "utilities.h" #include "OpUtil.hxx" #include "Utils_ExceptHandlers.hxx" +#include #include @@ -40,8 +41,8 @@ //============================================================================= GEOM_IHealingOperations_i::GEOM_IHealingOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IHealingOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IHealingOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IHealingOperations_i::GEOM_IHealingOperations_i"); @@ -104,27 +105,24 @@ Handle(TColStd_HArray1OfExtendedString) GEOM_IHealingOperations_i::Convert */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ProcessShape (GEOM::GEOM_Object_ptr theObject, - const GEOM::string_array& theOperations, - const GEOM::string_array& theParams, - const GEOM::string_array& theValues) + const GEOM::string_array& theOperations, + const GEOM::string_array& theParams, + const GEOM::string_array& theValues) { + Kernel_Utils::Localizer loc; + GEOM::GEOM_Object_var aGEOMObject; // Set a not done flag GetOperations()->SetNotDone(); - // Check parameters - if ( CORBA::is_nil(theObject) ) - return aGEOMObject._retn(); - // Check if theOperations has more than 0 elements and theParams and theValues have the same length -// if ( theOperations.length() <= 0 || theParams.length() != theValues.length() ) -// return aGEOMObject._retn(); + //if (theOperations.length() <= 0 || theParams.length() != theValues.length()) + // return aGEOMObject._retn(); // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); - if ( anObject.IsNull() ) + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); + if (anObject.IsNull()) return aGEOMObject._retn(); // Perform @@ -150,7 +148,7 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out GEOM::string_array_var aValArray = new GEOM::string_array(); // retrieve the values as stl-lists - list operationsList, paramsList, valuesList; + std::list operationsList, paramsList, valuesList; GetOperations()->GetShapeProcessParameters( operationsList, paramsList, valuesList ); const int opSize = operationsList.size(), parSize = paramsList.size(), @@ -163,13 +161,13 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out aValArray->length(valSize); // fill the local CORBA arrays with values from lists - list::iterator opIt, parIt, valIt; + std::list::iterator opIt, parIt, valIt; int i = 0; for ( opIt = operationsList.begin(); opIt != operationsList.end(); i++,++opIt ) anOpArray[i] = CORBA::string_dup( (*opIt).c_str() ); for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin(); - parIt != paramsList.end(); i++, ++parIt,++valIt ) { + parIt != paramsList.end(); i++, ++parIt,++valIt ) { aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); } @@ -186,15 +184,15 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out * GetOperatorParameters */ //============================================================================= -void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator, - GEOM::string_array_out theParams, - GEOM::string_array_out theValues) +void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues) { GEOM::string_array_var aParArray = new GEOM::string_array(); GEOM::string_array_var aValArray = new GEOM::string_array(); // retrieve the values as stl-lists - list paramsList, valuesList; + std::list paramsList, valuesList; if ( GetOperations()->GetOperatorParameters( theOperator, paramsList, valuesList ) ) { const int parSize = paramsList.size(), valSize = valuesList.size(); @@ -203,12 +201,12 @@ void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator, aValArray->length(valSize); // fill the local CORBA arrays with values from lists - list::iterator parIt, valIt; + std::list::iterator parIt, valIt; int i; for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin(); parIt != paramsList.end(); i++, ++parIt,++valIt ) { - aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); - aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); + aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); + aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); } } } @@ -224,23 +222,20 @@ void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator, */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SuppressFaces (GEOM::GEOM_Object_ptr theObject, - const GEOM::short_array& theFaces) + const GEOM::short_array& theFaces) { GEOM::GEOM_Object_var aGEOMObject; // Set a not done flag GetOperations()->SetNotDone(); - // Check parameters - if ( CORBA::is_nil(theObject) ) // if theFaces is empty - it's OK, it means that ALL faces must be removed - return aGEOMObject._retn(); - // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); + // if theFaces is empty - it's OK, it means that ALL faces must be removed + // Perform Handle(GEOM_Object) aNewObject = GetOperations()->SuppressFaces( anObject, Convert( theFaces ) ); @@ -256,21 +251,16 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SuppressFaces (GEOM::GEOM_Objec */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::CloseContour (GEOM::GEOM_Object_ptr theObject, - const GEOM::short_array& theWires, - CORBA::Boolean isCommonVertex) + const GEOM::short_array& theWires, + CORBA::Boolean isCommonVertex) { GEOM::GEOM_Object_var aGEOMObject; // Set a not done flag GetOperations()->SetNotDone(); - // Check parameters - if ( CORBA::is_nil(theObject) ) - return aGEOMObject._retn(); - // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); @@ -289,23 +279,20 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::CloseContour (GEOM::GEOM_Object */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveIntWires (GEOM::GEOM_Object_ptr theObject, - const GEOM::short_array& theWires) + const GEOM::short_array& theWires) { GEOM::GEOM_Object_var aGEOMObject; // Set a not done flag GetOperations()->SetNotDone(); - // Check parameters - if ( CORBA::is_nil(theObject) ) // if theWires is empty - it's OK, it means that ALL wires should be removed - return aGEOMObject._retn(); - // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); + // if theWires is empty - it's OK, it means that ALL wires should be removed + // Perform Handle(GEOM_Object) aNewObject = GetOperations()->RemoveIntWires( anObject, Convert( theWires ) ); @@ -321,23 +308,20 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveIntWires (GEOM::GEOM_Obje */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FillHoles (GEOM::GEOM_Object_ptr theObject, - const GEOM::short_array& theWires) + const GEOM::short_array& theWires) { GEOM::GEOM_Object_var aGEOMObject; // Set a not done flag GetOperations()->SetNotDone(); - // Check parameters - if ( CORBA::is_nil(theObject) ) // if theWires is empty - it's OK, it means that ALL wires should be removed - return aGEOMObject._retn(); - // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); + // if theWires is empty - it's OK, it means that ALL wires should be removed + // Perform Handle(GEOM_Object) aNewObject = GetOperations()->FillHoles( anObject, Convert( theWires ) ); @@ -353,7 +337,7 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FillHoles (GEOM::GEOM_Object_pt */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theTolerance) + CORBA::Double theTolerance) { GEOM::GEOM_Object_var aGEOMObject; @@ -361,12 +345,11 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theO GetOperations()->SetNotDone(); // Check parameters - if ( CORBA::is_nil(theObject) || theTolerance < 0 ) + if (theTolerance < 0) return aGEOMObject._retn(); // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); @@ -386,8 +369,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theO //============================================================================= GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::DivideEdge (GEOM::GEOM_Object_ptr theObject, CORBA::Short theIndex, - CORBA::Double theValue, - CORBA::Boolean isByParameter) + CORBA::Double theValue, + CORBA::Boolean isByParameter) { GEOM::GEOM_Object_var aGEOMObject; @@ -395,12 +378,11 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::DivideEdge (GEOM::GEOM_Object_p GetOperations()->SetNotDone(); // Check parameters - if ( CORBA::is_nil(theObject) || theValue < 0 || theValue > 1 ) + if (theValue < 0 || theValue > 1) return aGEOMObject._retn(); // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); @@ -413,14 +395,51 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::DivideEdge (GEOM::GEOM_Object_p return GetObject(aNewObject); } +//============================================================================= +/*! + * FuseCollinearEdgesWithinWire + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FuseCollinearEdgesWithinWire + (GEOM::GEOM_Object_ptr theWire, + const GEOM::ListOfGO& theVertices) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aWire = GetObjectImpl(theWire); + if (aWire.IsNull()) return aGEOMObject._retn(); + + int ind, aLen; + std::list aVerts; + //Get the shapes + aLen = theVertices.length(); + for (ind = 0; ind < aLen; ind++) { + Handle(GEOM_Object) aSh = GetObjectImpl(theVertices[ind]); + if (aSh.IsNull()) return aGEOMObject._retn(); + aVerts.push_back(aSh); + } + + //Perform operation + Handle(GEOM_Object) anObject = + GetOperations()->FuseCollinearEdgesWithinWire(aWire, aVerts); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * GetFreeBoundary */ //============================================================================= CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_ptr theObject, - GEOM::ListOfGO_out theClosedWires, - GEOM::ListOfGO_out theOpenWires ) + GEOM::ListOfGO_out theClosedWires, + GEOM::ListOfGO_out theOpenWires ) { theClosedWires = new GEOM::ListOfGO; theOpenWires = new GEOM::ListOfGO; @@ -428,12 +447,8 @@ CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_pt // Set a not done flag GetOperations()->SetNotDone(); - if ( CORBA::is_nil(theObject) ) - return false; - // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return false; @@ -442,7 +457,7 @@ CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_pt bool res = GetOperations()->GetFreeBoundary( anObject, aClosed, anOpen ); if ( !GetOperations()->IsDone() || !res ) - return false; + return false; int i, n = aClosed->Length(); theClosedWires->length( n ); @@ -477,8 +492,7 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientation (GEOM::GEOM_O aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); @@ -489,7 +503,7 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientation (GEOM::GEOM_O // return aGEOMObject._retn(); //return GetObject(aNewObject); - return aGEOMObject._retn(); + return aGEOMObject._retn(); } @@ -505,13 +519,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GE // Set a not done flag GetOperations()->SetNotDone(); - // Check parameters - if ( CORBA::is_nil(theObject) ) - return aGEOMObject._retn(); - // Get the object itself - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); @@ -524,3 +533,29 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GE return GetObject(aNewObject); } +//============================================================================= +/*! + * LimitTolerance + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::LimitTolerance (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Get the object itself + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->LimitTolerance(anObject, theTolerance); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aNewObject); +} diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.hh b/src/GEOM_I/GEOM_IHealingOperations_i.hh index a76e39ac1..bdbaf8689 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.hh +++ b/src/GEOM_I/GEOM_IHealingOperations_i.hh @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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_IHealingOperations_i_HeaderFile #define _GEOM_IHealingOperations_i_HeaderFile @@ -35,42 +35,68 @@ #include #include -class GEOM_I_EXPORT GEOM_IHealingOperations_i : +class GEOM_I_EXPORT GEOM_IHealingOperations_i : public virtual POA_GEOM::GEOM_IHealingOperations, public virtual GEOM_IOperations_i { public: - GEOM_IHealingOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IHealingOperations* theImpl); + GEOM_IHealingOperations_i(PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IHealingOperations* theImpl); ~GEOM_IHealingOperations_i(); - - GEOM::GEOM_Object_ptr ProcessShape(GEOM::GEOM_Object_ptr theObject, const GEOM::string_array& theOperations, const GEOM::string_array& theParams, const GEOM::string_array& theValues); - void GetShapeProcessParameters(GEOM::string_array_out theOperations, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + GEOM::GEOM_Object_ptr ProcessShape(GEOM::GEOM_Object_ptr theObject, + const GEOM::string_array& theOperations, + const GEOM::string_array& theParams, + const GEOM::string_array& theValues); + + void GetShapeProcessParameters(GEOM::string_array_out theOperations, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues); + + void GetOperatorParameters (const char* theOperator, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues); - void GetOperatorParameters (const char* theOperator, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theFaces); - GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theFaces); + GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires, + CORBA::Boolean isCommonVertex); - GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires, CORBA::Boolean isCommonVertex); + GEOM::GEOM_Object_ptr RemoveIntWires (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires); - GEOM::GEOM_Object_ptr RemoveIntWires (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires); - - GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires); + GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires); - GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject, CORBA::Double theTolerance); + GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theTolerance); - GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject, CORBA::Short theIndex, CORBA::Double theValue, CORBA::Boolean isByParameter); + GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject, + CORBA::Short theIndex, + CORBA::Double theValue, + CORBA::Boolean isByParameter); + + GEOM::GEOM_Object_ptr FuseCollinearEdgesWithinWire (GEOM::GEOM_Object_ptr theWire, + const GEOM::ListOfGO& theVertices); + + CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, + GEOM::ListOfGO_out theClosedWires, + GEOM::ListOfGO_out theOpenWires ); - CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theOpenWires ); - GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theObject); GEOM::GEOM_Object_ptr ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject); + GEOM::GEOM_Object_ptr LimitTolerance (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theTolerance); + ::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); } private: - Handle(TColStd_HArray1OfExtendedString) Convert( const GEOM::string_array& ); - Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& ); + Handle(TColStd_HArray1OfExtendedString) Convert( const GEOM::string_array& ); + Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& ); }; diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.cc b/src/GEOM_I/GEOM_IInsertOperations_i.cc index a0145517c..e27a6876b 100644 --- a/src/GEOM_I/GEOM_IInsertOperations_i.cc +++ b/src/GEOM_I/GEOM_IInsertOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifdef WNT #pragma warning( disable:4786 ) #endif @@ -34,16 +35,24 @@ #include "GEOM_Engine.hxx" #include "GEOM_Object.hxx" +#include + #include +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 +#include +#else +#include +#endif + //============================================================================= /*! * constructor: */ //============================================================================= GEOM_IInsertOperations_i::GEOM_IInsertOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IInsertOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IInsertOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IInsertOperations_i::GEOM_IInsertOperations_i"); @@ -72,13 +81,8 @@ GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::MakeCopy(GEOM::GEOM_Object_ptr t //Set a not done flag GetOperations()->SetNotDone(); - if (theOriginal == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) anOriginal = - GetOperations()->GetEngine()->GetObject(theOriginal->GetStudyID(), - theOriginal->GetEntry()); - + Handle(GEOM_Object) anOriginal = GetObjectImpl(theOriginal); if (anOriginal.IsNull()) return aGEOMObject._retn(); //Create the copy @@ -96,21 +100,16 @@ GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::MakeCopy(GEOM::GEOM_Object_ptr t //============================================================================= void GEOM_IInsertOperations_i::Export (GEOM::GEOM_Object_ptr theOriginal, - const char* theFileName, - const char* theFormatName) + const char* theFileName, + const char* theFormatName) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theOriginal); //Set a not done flag GetOperations()->SetNotDone(); - if (theOriginal == NULL) return; - //Get the reference shape - Handle(GEOM_Object) anOriginal = - GetOperations()->GetEngine()->GetObject(theOriginal->GetStudyID(), - theOriginal->GetEntry()); - + Handle(GEOM_Object) anOriginal = GetObjectImpl(theOriginal); if (anOriginal.IsNull()) return; //Export the shape to the file @@ -119,18 +118,16 @@ void GEOM_IInsertOperations_i::Export GetOperations()->Export(anOriginal, aFileName, aFormatName); free(aFileName); free(aFormatName); - - return; } //============================================================================= /*! - * Import + * ImportFile */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::Import +GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::ImportFile (const char* theFileName, - const char* theFormatName) + const char* theFormatName) { GEOM::GEOM_Object_var aGEOMObject; @@ -141,11 +138,19 @@ GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::Import char* aFileName = strdup(theFileName); char* aFormatName = strdup(theFormatName); Handle(GEOM_Object) anObject = GetOperations()->Import(aFileName, aFormatName); + + if( strcmp(aFormatName,"IGES_UNIT")==0 && !anObject.IsNull() ) { + free(aFileName); + free(aFormatName); + return GetObject(anObject); + } + free(aFileName); free(aFormatName); - if (!GetOperations()->IsDone() || anObject.IsNull()) + if (!GetOperations()->IsDone() || anObject.IsNull()) { return aGEOMObject._retn(); + } return GetObject(anObject); } @@ -174,8 +179,8 @@ void GEOM_IInsertOperations_i::ImportTranslators // fill the local CORBA arrays with values from sequences CORBA::Long i = 1; for (; i <= formSize; i++) { - aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString()); - aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString()); + aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString()); + aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString()); } } } @@ -209,8 +214,8 @@ void GEOM_IInsertOperations_i::ExportTranslators // fill the local CORBA arrays with values from sequences CORBA::Long i = 1; for (; i <= formSize; i++) { - aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString()); - aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString()); + aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString()); + aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString()); } } } @@ -219,3 +224,68 @@ void GEOM_IInsertOperations_i::ExportTranslators theFormats = aFormatsArray._retn(); thePatterns = aPatternsArray._retn(); } + +CORBA::Long GEOM_IInsertOperations_i::LoadTexture(const char* theTextureFile) +{ + GetOperations()->SetNotDone(); + return GetOperations()->LoadTexture( theTextureFile ); +} + +CORBA::Long GEOM_IInsertOperations_i::AddTexture(CORBA::Long theWidth, CORBA::Long theHeight, + const SALOMEDS::TMPFile& theTexture) +{ + GetOperations()->SetNotDone(); + +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTexture; +#else + Handle(TDataStd_HArray1OfByte) aTexture; +#endif + + if ( theTexture.length() > 0 ) { +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + aTexture = new TColStd_HArray1OfByte (1, theTexture.length()); +#else + aTexture = new TDataStd_HArray1OfByte (1, theTexture.length()); +#endif + + for ( int i = 0; i < theTexture.length(); i++ ) + aTexture->SetValue( i+1, (Standard_Byte)theTexture[i] ); + } + return GetOperations()->AddTexture( theWidth, theHeight, aTexture ); +} + +SALOMEDS::TMPFile* GEOM_IInsertOperations_i::GetTexture(CORBA::Long theID, + CORBA::Long& theWidth, + CORBA::Long& theHeight) +{ + int aWidth, aHeight; +#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 + Handle(TColStd_HArray1OfByte) aTextureImpl = +#else + Handle(TDataStd_HArray1OfByte) aTextureImpl = +#endif + GetOperations()->GetTexture(theID, aWidth, aHeight); + theWidth = aWidth; + theHeight = aHeight; + SALOMEDS::TMPFile_var aTexture; + if ( !aTextureImpl.IsNull() ) { + aTexture = new SALOMEDS::TMPFile; + aTexture->length( aTextureImpl->Length() ); + for ( int i = aTextureImpl->Lower(); i <= aTextureImpl->Upper(); i++ ) + aTexture[i-aTextureImpl->Lower()] = aTextureImpl->Value( i ); + } + return aTexture._retn(); +} + +GEOM::ListOfLong* GEOM_IInsertOperations_i::GetAllTextures() +{ + std::list localIDs = GetOperations()->GetAllTextures(); + GEOM::ListOfLong_var anIDs = new GEOM::ListOfLong(localIDs.size()); + anIDs->length(localIDs.size()); + std::list::const_iterator anIt; + int i = 0; + for( anIt = localIDs.begin(); anIt != localIDs.end(); ++anIt, i++) + anIDs[i] = *anIt; + return anIDs._retn(); +} diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.hh b/src/GEOM_I/GEOM_IInsertOperations_i.hh index da29eabf0..a7f8cf1dd 100644 --- a/src/GEOM_I/GEOM_IInsertOperations_i.hh +++ b/src/GEOM_I/GEOM_IInsertOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IInsertOperations_i_HeaderFile #define _GEOM_IInsertOperations_i_HeaderFile @@ -27,34 +28,44 @@ #include #include CORBA_SERVER_HEADER(GEOM_Gen) +#include CORBA_CLIENT_HEADER(SALOMEDS) #include "GEOM_IOperations_i.hh" #include "GEOM_Object_i.hh" #include "GEOMImpl_IInsertOperations.hxx" -class GEOM_I_EXPORT GEOM_IInsertOperations_i : +class GEOM_I_EXPORT GEOM_IInsertOperations_i : public virtual POA_GEOM::GEOM_IInsertOperations, public virtual GEOM_IOperations_i { public: GEOM_IInsertOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IInsertOperations* theImpl); + ::GEOMImpl_IInsertOperations* theImpl); ~GEOM_IInsertOperations_i(); GEOM::GEOM_Object_ptr MakeCopy (GEOM::GEOM_Object_ptr theOriginal); void Export (GEOM::GEOM_Object_ptr theOriginal, - const char* theFileName, - const char* theFormatName); + const char* theFileName, + const char* theFormatName); - GEOM::GEOM_Object_ptr Import (const char* theFileName, - const char* theFormatName); + GEOM::GEOM_Object_ptr ImportFile (const char* theFileName, + const char* theFormatName); void ImportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns); + GEOM::string_array_out thePatterns); void ExportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns); + GEOM::string_array_out thePatterns); + + CORBA::Long LoadTexture(const char* theTextureFile); + CORBA::Long AddTexture(CORBA::Long theWidth, CORBA::Long theHeight, + const SALOMEDS::TMPFile& theTexture); + SALOMEDS::TMPFile* GetTexture(CORBA::Long theID, + CORBA::Long& theWidth, + CORBA::Long& theHeight); + + GEOM::ListOfLong* GetAllTextures(); ::GEOMImpl_IInsertOperations* GetOperations() { return (::GEOMImpl_IInsertOperations*)GetImpl(); } diff --git a/src/GEOM_I/GEOM_ILocalOperations_i.cc b/src/GEOM_I/GEOM_ILocalOperations_i.cc index c71a24780..954778614 100644 --- a/src/GEOM_I/GEOM_ILocalOperations_i.cc +++ b/src/GEOM_I/GEOM_ILocalOperations_i.cc @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 #include "GEOM_ILocalOperations_i.hh" @@ -36,8 +36,8 @@ */ //============================================================================= GEOM_ILocalOperations_i::GEOM_ILocalOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_ILocalOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ILocalOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_ILocalOperations_i::GEOM_ILocalOperations_i"); @@ -64,12 +64,8 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Create the Fillet @@ -88,21 +84,18 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, - const GEOM::ListOfLong& theEdges) + const GEOM::ListOfLong& theEdges) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference edges int ind = 0; int aLen = theEdges.length(); - list anEdges; + std::list anEdges; for (; ind < aLen; ind++) { anEdges.push_back(theEdges[ind]); } @@ -127,17 +120,14 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2 { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference edges int ind = 0; int aLen = theEdges.length(); - list anEdges; + std::list anEdges; for (; ind < aLen; ind++) { anEdges.push_back(theEdges[ind]); } @@ -158,21 +148,18 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2 //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, - const GEOM::ListOfLong& theFaces) + const GEOM::ListOfLong& theFaces) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference faces int ind = 0; int aLen = theFaces.length(); - list aFaces; + std::list aFaces; for (; ind < aLen; ind++) { aFaces.push_back(theFaces[ind]); } @@ -197,17 +184,14 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2 { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference faces int ind = 0; int aLen = theFaces.length(); - list aFaces; + std::list aFaces; for (; ind < aLen; ind++) { aFaces.push_back(theFaces[ind]); } @@ -228,21 +212,18 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2 //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, - const GEOM::ListOfLong& theVertexes) + const GEOM::ListOfLong& theVertexes) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference vertex int ind = 0; int aLen = theVertexes.length(); - list aVertexes; + std::list aVertexes; for (; ind < aLen; ind++) { aVertexes.push_back(theVertexes[ind]); } @@ -256,6 +237,39 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D return GetObject(anObject); } +//============================================================================= +/*! + * MakeFillet1D + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet1D + (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + const GEOM::ListOfLong& theVertexes, + CORBA::Boolean doIgnoreSecantVertices) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Get the reference shape (wire) + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference vertex + int ind = 0; + int aLen = theVertexes.length(); + std::list aVertexes; + for (; ind < aLen; ind++) { + aVertexes.push_back(theVertexes[ind]); + } + + //Create the Fillet + Handle(GEOM_Object) anObject = + GetOperations()->MakeFillet1D(aShapeRef, theR, aVertexes, doIgnoreSecantVertices); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeChamferAll @@ -266,12 +280,8 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Create the Chamfer @@ -290,16 +300,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - CORBA::Long theFace1, CORBA::Long theFace2) + CORBA::Double theD1, CORBA::Double theD2, + CORBA::Long theFace1, CORBA::Long theFace2) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Create the Chamfer @@ -317,16 +324,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - CORBA::Long theFace1, CORBA::Long theFace2) + CORBA::Double theD, CORBA::Double theAngle, + CORBA::Long theFace1, CORBA::Long theFace2) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Create the Chamfer @@ -345,22 +349,19 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - const GEOM::ListOfLong& theFaces) + CORBA::Double theD1, CORBA::Double theD2, + const GEOM::ListOfLong& theFaces) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference faces int ind = 0; int aLen = theFaces.length(); - list aFaces; + std::list aFaces; for (; ind < aLen; ind++) { aFaces.push_back(theFaces[ind]); } @@ -380,22 +381,19 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - const GEOM::ListOfLong& theFaces) + CORBA::Double theD, CORBA::Double theAngle, + const GEOM::ListOfLong& theFaces) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference faces int ind = 0; int aLen = theFaces.length(); - list aFaces; + std::list aFaces; for (; ind < aLen; ind++) { aFaces.push_back(theFaces[ind]); } @@ -416,22 +414,19 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - const GEOM::ListOfLong& theEdges) + CORBA::Double theD1, CORBA::Double theD2, + const GEOM::ListOfLong& theEdges) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference edges int ind = 0; int aLen = theEdges.length(); - list aEdges; + std::list aEdges; for (; ind < aLen; ind++) { aEdges.push_back(theEdges[ind]); } @@ -452,22 +447,19 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - const GEOM::ListOfLong& theEdges) + CORBA::Double theD, CORBA::Double theAngle, + const GEOM::ListOfLong& theEdges) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Get the reference edges int ind = 0; int aLen = theEdges.length(); - list aEdges; + std::list aEdges; for (; ind < aLen; ind++) { aEdges.push_back(theEdges[ind]); } @@ -487,17 +479,14 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theWeight, - CORBA::Double theWaterDensity, - CORBA::Double theMeshingDeflection) + CORBA::Double theWeight, + CORBA::Double theWaterDensity, + CORBA::Double theMeshingDeflection) { GEOM::GEOM_Object_var aGEOMObject; - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); if (aShapeRef.IsNull()) return aGEOMObject._retn(); //Create the Archimede @@ -517,13 +506,9 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_ CORBA::Long GEOM_ILocalOperations_i::GetSubShapeIndex (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theSubShape) { - if (theShape == NULL || theSubShape == NULL) return -1; - //Get the reference shapes - Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject - (theSubShape->GetStudyID(), theSubShape->GetEntry()); + Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape); + Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape); if (aShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1; //Get the unique ID of inside diff --git a/src/GEOM_I/GEOM_ILocalOperations_i.hh b/src/GEOM_I/GEOM_ILocalOperations_i.hh index e13d37f49..764f8e5cb 100644 --- a/src/GEOM_I/GEOM_ILocalOperations_i.hh +++ b/src/GEOM_I/GEOM_ILocalOperations_i.hh @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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_ILocalOperations_i_HeaderFile #define _GEOM_ILocalOperations_i_HeaderFile @@ -63,6 +63,10 @@ class GEOM_I_EXPORT GEOM_ILocalOperations_i : GEOM::GEOM_Object_ptr MakeFillet2D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, const GEOM::ListOfLong& theVertexes); + GEOM::GEOM_Object_ptr MakeFillet1D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + const GEOM::ListOfLong& theVertexes, + CORBA::Boolean doIgnoreSecantVertices); + GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc index 84248c73b..ffbdcd5d4 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.cc +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_IMeasureOperations_i.hh" @@ -35,8 +36,8 @@ */ //============================================================================= GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IMeasureOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IMeasureOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i"); @@ -59,8 +60,8 @@ GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i() //============================================================================= GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape (GEOM::GEOM_Object_ptr theShape, - GEOM::ListOfLong_out theIntegers, - GEOM::ListOfDouble_out theDoubles) + GEOM::ListOfLong_out theIntegers, + GEOM::ListOfDouble_out theDoubles) { GEOMImpl_IMeasureOperations::ShapeKind aKind = GEOMImpl_IMeasureOperations::SK_NO_SHAPE; @@ -69,8 +70,7 @@ GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble(); //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (!aShape.IsNull()) { Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger; @@ -106,9 +106,9 @@ GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape //============================================================================= void GEOM_IMeasureOperations_i::GetPosition (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz, - CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz, - CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz) + CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz, + CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz, + CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz) { //Set a not done flag GetOperations()->SetNotDone(); @@ -117,12 +117,8 @@ void GEOM_IMeasureOperations_i::GetPosition Ox = Oy = Oz = Zx = Zy = Xy = Xz = 0.; Zz = Xx = 1.; - if (theShape == NULL) return; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return; // Get shape parameters @@ -142,12 +138,8 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass //Set a not done flag GetOperations()->SetNotDone(); - if (CORBA::is_nil(theShape)) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aGEOMObject._retn(); // Make Point - centre of mass of theShape @@ -158,6 +150,31 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass return GetObject(anObject); } +//============================================================================= +/*! + * GetVertexByIndex + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetVertexByIndex + (GEOM::GEOM_Object_ptr theShape, CORBA::Long theIndex) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference shape + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if ( aShape.IsNull() ) return aGEOMObject._retn(); + + // Get vertex by index + Handle(GEOM_Object) anObject = GetOperations()->GetVertexByIndex(aShape, theIndex); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * GetNormal @@ -165,27 +182,21 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass //============================================================================= GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetNormal (GEOM::GEOM_Object_ptr theFace, - GEOM::GEOM_Object_ptr theOptionalPoint) + GEOM::GEOM_Object_ptr theOptionalPoint) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (CORBA::is_nil(theFace)) return aGEOMObject._retn(); - //Get the reference shape - Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject - (theFace->GetStudyID(), theFace->GetEntry()); - + Handle(GEOM_Object) aFace = GetObjectImpl(theFace); if (aFace.IsNull()) return aGEOMObject._retn(); + // Get the OptionalPoint (can be not defined) + Handle(GEOM_Object) anOptionalPoint = GetObjectImpl(theOptionalPoint); + // Make Vector - normal to theFace (in point theOptionalPoint if the face is not planar) - Handle(GEOM_Object) anOptionalPoint; - if (!CORBA::is_nil(theOptionalPoint)) { - anOptionalPoint = GetOperations()->GetEngine()->GetObject - (theOptionalPoint->GetStudyID(), theOptionalPoint->GetEntry()); - } Handle(GEOM_Object) anObject = GetOperations()->GetNormal(aFace, anOptionalPoint); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -199,19 +210,15 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetNormal */ //============================================================================= void GEOM_IMeasureOperations_i::GetBasicProperties (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& theLength, - CORBA::Double& theSurfArea, - CORBA::Double& theVolume) + CORBA::Double& theLength, + CORBA::Double& theSurfArea, + CORBA::Double& theVolume) { //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return; // Get shape parameters @@ -233,20 +240,16 @@ void GEOM_IMeasureOperations_i::GetInertia //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return; // Get shape parameters GetOperations()->GetInertia(aShape, - I11, I12, I13, - I21, I22, I23, - I31, I32, I33, - Ix , Iy , Iz); + I11, I12, I13, + I21, I22, I23, + I31, I32, I33, + Ix , Iy , Iz); } //============================================================================= @@ -255,19 +258,15 @@ void GEOM_IMeasureOperations_i::GetInertia */ //============================================================================= void GEOM_IMeasureOperations_i::GetBoundingBox (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& Xmin, CORBA::Double& Xmax, - CORBA::Double& Ymin, CORBA::Double& Ymax, - CORBA::Double& Zmin, CORBA::Double& Zmax) + CORBA::Double& Xmin, CORBA::Double& Xmax, + CORBA::Double& Ymin, CORBA::Double& Ymax, + CORBA::Double& Zmin, CORBA::Double& Zmax) { //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return; // Get shape parameters @@ -281,26 +280,22 @@ void GEOM_IMeasureOperations_i::GetBoundingBox (GEOM::GEOM_Object_ptr theShape, //============================================================================= void GEOM_IMeasureOperations_i::GetTolerance (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& FaceMin, CORBA::Double& FaceMax, - CORBA::Double& EdgeMin, CORBA::Double& EdgeMax, - CORBA::Double& VertMin, CORBA::Double& VertMax) + CORBA::Double& FaceMin, CORBA::Double& FaceMax, + CORBA::Double& EdgeMin, CORBA::Double& EdgeMax, + CORBA::Double& VertMin, CORBA::Double& VertMax) { //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return; // Get shape parameters GetOperations()->GetTolerance(aShape, - FaceMin, FaceMax, - EdgeMin, EdgeMax, - VertMin, VertMax); + FaceMin, FaceMax, + EdgeMin, EdgeMax, + VertMin, VertMax); } //============================================================================= @@ -309,20 +304,19 @@ void GEOM_IMeasureOperations_i::GetTolerance */ //============================================================================= CORBA::Boolean GEOM_IMeasureOperations_i::CheckShape (GEOM::GEOM_Object_ptr theShape, - CORBA::String_out theDescription) + CORBA::String_out theDescription) { //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) + if (CORBA::is_nil(theShape)) { theDescription = CORBA::string_dup("null"); return 0; } //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) { @@ -342,20 +336,19 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckShape (GEOM::GEOM_Object_ptr theS } CORBA::Boolean GEOM_IMeasureOperations_i::CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape, - CORBA::String_out theDescription) + CORBA::String_out theDescription) { //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) + if (CORBA::is_nil(theShape)) { theDescription = CORBA::string_dup("null"); return 0; } //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) { @@ -374,6 +367,64 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckShapeWithGeometry (GEOM::GEOM_Obj return 0; } +//============================================================================= +/*! + * CheckSelfIntersections + */ +//============================================================================= +CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape, + GEOM::ListOfLong_out theIntersections) +{ + // Set a not done flag + GetOperations()->SetNotDone(); + + bool isGood = false; + + // Allocate the CORBA arrays + GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong(); + + // Get the reference shape + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + + if (!aShape.IsNull()) { + Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger; + + // Detect self-intersections + isGood = GetOperations()->CheckSelfIntersections(aShape, anIntegers); + + int nbInts = anIntegers->Length(); + + anIntegersArray->length(nbInts); + + for (int ii = 0; ii < nbInts; ii++) { + anIntegersArray[ii] = anIntegers->Value(ii + 1); + } + } + + // Initialize out-parameters with local arrays + theIntersections = anIntegersArray._retn(); + return isGood; +} + +//============================================================================= +/*! + * IsGoodForSolid + */ +//============================================================================= +char* GEOM_IMeasureOperations_i::IsGoodForSolid (GEOM::GEOM_Object_ptr theShape) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference shape + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return CORBA::string_dup("WRN_NULL_OBJECT_OR_SHAPE"); + + // Get shape parameters + TCollection_AsciiString aDescription = GetOperations()->IsGoodForSolid(aShape); + return CORBA::string_dup(aDescription.ToCString()); +} + //============================================================================= /*! * WhatIs @@ -384,12 +435,8 @@ char* GEOM_IMeasureOperations_i::WhatIs (GEOM::GEOM_Object_ptr theShape) //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return NULL; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return NULL; // Get shape parameters @@ -397,6 +444,34 @@ char* GEOM_IMeasureOperations_i::WhatIs (GEOM::GEOM_Object_ptr theShape) return CORBA::string_dup(aDescription.ToCString()); } +//============================================================================= +/*! + * AreCoordsInside + */ +//============================================================================= +GEOM::ListOfBool* GEOM_IMeasureOperations_i::AreCoordsInside (GEOM::GEOM_Object_ptr theShape, + const GEOM::ListOfDouble& theCoords, + CORBA::Double tolerance) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + unsigned int nb_points = theCoords.length()/3; + + GEOM::ListOfBool_var aResults = new GEOM::ListOfBool; + aResults->length(nb_points); + + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + + std::vector tmp(3*nb_points); + for (int i = 0; i < 3*nb_points; i++) + tmp[i] = theCoords[i]; + std::vector res = GetOperations()->AreCoordsInside(aShape, tmp, tolerance); + for (int i = 0; i < nb_points; i++) + aResults[i] = i < res.size() ? res[i] : false; + return aResults._retn(); +} + //============================================================================= /*! * GetMinDistance @@ -410,14 +485,9 @@ CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance //Set a not done flag GetOperations()->SetNotDone(); - if (theShape1 == NULL || theShape2 == NULL) return -1.0; - //Get the reference shape - Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject - (theShape1->GetStudyID(), theShape1->GetEntry()); - Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject - (theShape2->GetStudyID(), theShape2->GetEntry()); - + Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1); + Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2); if (aShape1.IsNull() || aShape2.IsNull()) return -1.0; // Get shape parameters @@ -430,20 +500,15 @@ CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance */ //============================================================================= void GEOM_IMeasureOperations_i::PointCoordinates (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z) + CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z) { //Set a not done flag GetOperations()->SetNotDone(); - if ( theShape->_is_nil() ) - return; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject( - theShape->GetStudyID(), theShape->GetEntry() ); - - if ( aShape.IsNull() ) + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return; // Get shape parameters @@ -456,25 +521,40 @@ void GEOM_IMeasureOperations_i::PointCoordinates (GEOM::GEOM_Object_ptr theShape */ //============================================================================= CORBA::Double GEOM_IMeasureOperations_i::GetAngle (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2) + GEOM::GEOM_Object_ptr theShape2) { //Set a not done flag GetOperations()->SetNotDone(); - if (theShape1 == NULL || theShape2 == NULL) return -1.0; - //Get the reference shapes - Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject - (theShape1->GetStudyID(), theShape1->GetEntry()); - Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject - (theShape2->GetStudyID(), theShape2->GetEntry()); - + Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1); + Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2); if (aShape1.IsNull() || aShape2.IsNull()) return -1.0; // Get the angle return GetOperations()->GetAngle(aShape1, aShape2); } +//============================================================================= +/*! + * GetAngle + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::GetAngleBtwVectors (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference shapes + Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1); + Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2); + if (aShape1.IsNull() || aShape2.IsNull()) return -1.0; + + // Get the angle + return GetOperations()->GetAngleBtwVectors(aShape1, aShape2); +} + //============================================================================= /*! @@ -487,18 +567,13 @@ CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByParam //Set a not done flag GetOperations()->SetNotDone(); - if(theCurve==NULL) return -1.0; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theCurve->GetStudyID(), theCurve->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theCurve); if(aShape.IsNull()) return -1.0; return GetOperations()->CurveCurvatureByParam(aShape,theParam); } - //============================================================================= /*! * CurveCurvatureByPoint @@ -510,14 +585,9 @@ CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByPoint //Set a not done flag GetOperations()->SetNotDone(); - if( theCurve==NULL || thePoint==NULL ) return -1.0; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theCurve->GetStudyID(), theCurve->GetEntry()); - Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject - (thePoint->GetStudyID(), thePoint->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theCurve); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); if( aShape.IsNull() || aPoint.IsNull() ) return -1.0; return GetOperations()->CurveCurvatureByPoint(aShape,aPoint); @@ -531,24 +601,19 @@ CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByPoint //============================================================================= CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf, - CORBA::Double theUParam, - CORBA::Double theVParam) + CORBA::Double theUParam, + CORBA::Double theVParam) { //Set a not done flag GetOperations()->SetNotDone(); - if(theSurf==NULL) return -1.0; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theSurf->GetStudyID(), theSurf->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theSurf); if(aShape.IsNull()) return -1.0; return GetOperations()->MaxSurfaceCurvatureByParam(aShape,theUParam,theVParam); } - //============================================================================= /*! * MaxSurfaceCurvatureByPoint @@ -560,20 +625,14 @@ CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByPoint //Set a not done flag GetOperations()->SetNotDone(); - if( theSurf==NULL || thePoint==NULL ) return -1.0; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theSurf->GetStudyID(), theSurf->GetEntry()); - Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject - (thePoint->GetStudyID(), thePoint->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theSurf); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); if( aShape.IsNull() || aPoint.IsNull() ) return -1.0; return GetOperations()->MaxSurfaceCurvatureByPoint(aShape,aPoint); } - //============================================================================= /*! * MinSurfaceCurvatureByParam @@ -581,24 +640,19 @@ CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByPoint //============================================================================= CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf, - CORBA::Double theUParam, - CORBA::Double theVParam) + CORBA::Double theUParam, + CORBA::Double theVParam) { //Set a not done flag GetOperations()->SetNotDone(); - if(theSurf==NULL) return -1.0; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theSurf->GetStudyID(), theSurf->GetEntry()); - - if(aShape.IsNull()) return -1.0; + Handle(GEOM_Object) aShape = GetObjectImpl(theSurf); + if (aShape.IsNull()) return -1.0; return GetOperations()->MinSurfaceCurvatureByParam(aShape,theUParam,theVParam); } - //============================================================================= /*! * MinSurfaceCurvatureByPoint @@ -610,15 +664,10 @@ CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByPoint //Set a not done flag GetOperations()->SetNotDone(); - if( theSurf==NULL || thePoint==NULL ) return -1.0; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theSurf->GetStudyID(), theSurf->GetEntry()); - Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject - (thePoint->GetStudyID(), thePoint->GetEntry()); - - if( aShape.IsNull() || aPoint.IsNull() ) return -1.0; + Handle(GEOM_Object) aShape = GetObjectImpl(theSurf); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); + if (aShape.IsNull() || aPoint.IsNull()) return -1.0; return GetOperations()->MinSurfaceCurvatureByPoint(aShape,aPoint); } diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.hh b/src/GEOM_I/GEOM_IMeasureOperations_i.hh index 1aace732a..4534dc45e 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.hh +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IMeasureOperations_i_HeaderFile #define _GEOM_IMeasureOperations_i_HeaderFile @@ -38,84 +39,99 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i : { public: GEOM_IMeasureOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IMeasureOperations* theImpl); + ::GEOMImpl_IMeasureOperations* theImpl); ~GEOM_IMeasureOperations_i(); GEOM::GEOM_IKindOfShape::shape_kind KindOfShape (GEOM::GEOM_Object_ptr theShape, - GEOM::ListOfLong_out theIntegers, - GEOM::ListOfDouble_out theDoubles); + GEOM::ListOfLong_out theIntegers, + GEOM::ListOfDouble_out theDoubles); void GetPosition (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz, - CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz, - CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz); + CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz, + CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz, + CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz); void GetBasicProperties (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& theLength, - CORBA::Double& theSurfArea, - CORBA::Double& theVolume); + CORBA::Double& theLength, + CORBA::Double& theSurfArea, + CORBA::Double& theVolume); GEOM::GEOM_Object_ptr GetCentreOfMass (GEOM::GEOM_Object_ptr theShape); GEOM::GEOM_Object_ptr GetNormal (GEOM::GEOM_Object_ptr theFace, - GEOM::GEOM_Object_ptr theOptionalPoint); + GEOM::GEOM_Object_ptr theOptionalPoint); + + GEOM::GEOM_Object_ptr GetVertexByIndex (GEOM::GEOM_Object_ptr theObject, + CORBA::Long theIndex); void GetInertia (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13, - CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23, - CORBA::Double& I31, CORBA::Double& I32, CORBA::Double& I33, - CORBA::Double& Ix , CORBA::Double& Iy , CORBA::Double& Iz); + CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13, + CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23, + CORBA::Double& I31, CORBA::Double& I32, CORBA::Double& I33, + CORBA::Double& Ix , CORBA::Double& Iy , CORBA::Double& Iz); void GetBoundingBox (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& Xmin, CORBA::Double& Xmax, - CORBA::Double& Ymin, CORBA::Double& Ymax, - CORBA::Double& Zmin, CORBA::Double& Zmax); + CORBA::Double& Xmin, CORBA::Double& Xmax, + CORBA::Double& Ymin, CORBA::Double& Ymax, + CORBA::Double& Zmin, CORBA::Double& Zmax); void GetTolerance (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& FaceMin, CORBA::Double& FaceMax, - CORBA::Double& EdgeMin, CORBA::Double& EdgeMax, - CORBA::Double& VertMin, CORBA::Double& VertMax); + CORBA::Double& FaceMin, CORBA::Double& FaceMax, + CORBA::Double& EdgeMin, CORBA::Double& EdgeMax, + CORBA::Double& VertMin, CORBA::Double& VertMax); CORBA::Boolean CheckShape (GEOM::GEOM_Object_ptr theShape, - CORBA::String_out theDescription); + CORBA::String_out theDescription); CORBA::Boolean CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape, - CORBA::String_out theDescription); + CORBA::String_out theDescription); + + CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape, + GEOM::ListOfLong_out theIntersections); + + char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape); char* WhatIs (GEOM::GEOM_Object_ptr theShape); + GEOM::ListOfBool* AreCoordsInside (GEOM::GEOM_Object_ptr theShape, + const GEOM::ListOfDouble& theCoords, + CORBA::Double theTolerance); + CORBA::Double GetMinDistance (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2, + GEOM::GEOM_Object_ptr theShape2, CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1, CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2); void PointCoordinates (GEOM::GEOM_Object_ptr theShape, - CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z); + CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z); CORBA::Double GetAngle (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2); + GEOM::GEOM_Object_ptr theShape2); + + CORBA::Double GetAngleBtwVectors (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2); // Methods for recieving radiuses of curvature of curves and surfaces // in the given point CORBA::Double CurveCurvatureByParam (GEOM::GEOM_Object_ptr theCurve, - CORBA::Double theParam); + CORBA::Double theParam); CORBA::Double CurveCurvatureByPoint (GEOM::GEOM_Object_ptr theCurve, - GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr thePoint); CORBA::Double MaxSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf, - CORBA::Double theUParam, - CORBA::Double theVParam); + CORBA::Double theUParam, + CORBA::Double theVParam); CORBA::Double MaxSurfaceCurvatureByPoint (GEOM::GEOM_Object_ptr theSurf, - GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr thePoint); CORBA::Double MinSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf, - CORBA::Double theUParam, - CORBA::Double theVParam); + CORBA::Double theUParam, + CORBA::Double theVParam); CORBA::Double MinSurfaceCurvatureByPoint (GEOM::GEOM_Object_ptr theSurf, - GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr thePoint); ::GEOMImpl_IMeasureOperations* GetOperations() { return (::GEOMImpl_IMeasureOperations*)GetImpl(); } diff --git a/src/GEOM_I/GEOM_IOperations_i.cc b/src/GEOM_I/GEOM_IOperations_i.cc index 3a6516150..b56c32942 100644 --- a/src/GEOM_I/GEOM_IOperations_i.cc +++ b/src/GEOM_I/GEOM_IOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_IOperations_i.hh" #include "GEOM_Engine.hxx" @@ -131,9 +132,26 @@ void GEOM_IOperations_i::AbortOperation() //============================================================================= GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObject) { - if(theObject.IsNull()) return NULL; + GEOM::GEOM_Object_var GO; + if (theObject.IsNull()) return GO._retn(); TCollection_AsciiString anEntry; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - GEOM::GEOM_Object_var GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString()); + GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString()); return GO._retn(); } + +//============================================================================= +/*! + * GetObjectImpl + */ +//============================================================================= +Handle(GEOM_Object) GEOM_IOperations_i::GetObjectImpl(GEOM::GEOM_Object_ptr theObject) +{ + Handle(GEOM_Object) anImpl; + if (!CORBA::is_nil(theObject)) { + CORBA::String_var anEntry = theObject->GetEntry(); + anImpl = GetImpl()->GetEngine()->GetObject + (theObject->GetStudyID(), anEntry); + } + return anImpl; +} diff --git a/src/GEOM_I/GEOM_IOperations_i.hh b/src/GEOM_I/GEOM_IOperations_i.hh index c816e0beb..dc45fffa3 100644 --- a/src/GEOM_I/GEOM_IOperations_i.hh +++ b/src/GEOM_I/GEOM_IOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IOperations_i_HeaderFile #define _GEOM_IOperations_i_HeaderFile @@ -47,6 +48,7 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio virtual CORBA::Long GetStudyID(); virtual GEOM::GEOM_Object_ptr GetObject(Handle(GEOM_Object) theObject); + virtual Handle(GEOM_Object) GetObjectImpl(GEOM::GEOM_Object_ptr theObject); virtual void StartOperation(); diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index 16eb76575..cee18553c 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_IShapesOperations_i.hh" @@ -30,6 +31,7 @@ #include "GEOM_Engine.hxx" #include "GEOM_Object.hxx" +#include #include #include @@ -39,8 +41,8 @@ */ //============================================================================= GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IShapesOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IShapesOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i"); @@ -70,13 +72,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge //Set a not done flag GetOperations()->SetNotDone(); - if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); - //Get the reference points - Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject - (thePnt1->GetStudyID(), thePnt1->GetEntry()); - Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject - (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1); + Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2); if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn(); @@ -88,13 +86,76 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge return GetObject(anObject); } +//============================================================================= +/*! + * MakeEdgeOnCurveByLength + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeOnCurveByLength + (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference curve + Handle(GEOM_Object) aRefCurve = GetObjectImpl(theCurve); + if (aRefCurve.IsNull()) return aGEOMObject._retn(); + + //Get the reference point (can be NULL) + Handle(GEOM_Object) aRefPoint; + if (!CORBA::is_nil(theStartPoint)) { + aRefPoint = GetObjectImpl(theStartPoint); + } + + //Create the point + Handle(GEOM_Object) anObject = + GetOperations()->MakeEdgeOnCurveByLength(aRefCurve, theLength, aRefPoint); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeEdgeWire + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeWire + (GEOM::GEOM_Object_ptr theWire, + const CORBA::Double theLinearTolerance, + const CORBA::Double theAngularTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the source wire + Handle(GEOM_Object) aWire = GetObjectImpl(theWire); + + if (aWire.IsNull()) return aGEOMObject._retn(); + + //Create the Edge + Handle(GEOM_Object) anObject = GetOperations()->MakeEdgeWire(aWire, theLinearTolerance, theAngularTolerance); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeWire */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire - (const GEOM::ListOfGO& theEdgesAndWires) + (const GEOM::ListOfGO& theEdgesAndWires, + const CORBA::Double theTolerance) { GEOM::GEOM_Object_var aGEOMObject; @@ -102,21 +163,19 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire GetOperations()->SetNotDone(); int ind, aLen; - list aShapes; + std::list aShapes; //Get the shapes aLen = theEdgesAndWires.length(); for (ind = 0; ind < aLen; ind++) { - if (theEdgesAndWires[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theEdgesAndWires[ind]->GetStudyID(), theEdgesAndWires[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theEdgesAndWires[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aShapes.push_back(aSh); } // Make Solid Handle(GEOM_Object) anObject = - GetOperations()->MakeWire(aShapes); + GetOperations()->MakeWire(aShapes, theTolerance); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -130,24 +189,22 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace (GEOM::GEOM_Object_ptr theWire, - const CORBA::Boolean isPlanarWanted) + const CORBA::Boolean isPlanarWanted) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theWire == NULL) return aGEOMObject._retn(); - //Get the reference wire - Handle(GEOM_Object) aWire = GetOperations()->GetEngine()->GetObject - (theWire->GetStudyID(), theWire->GetEntry()); - + Handle(GEOM_Object) aWire = GetObjectImpl(theWire); if (aWire.IsNull()) return aGEOMObject._retn(); //Create the Face Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted); - if (!GetOperations()->IsDone() || anObject.IsNull()) + //if (!GetOperations()->IsDone() || anObject.IsNull()) + // enable warning status + if (anObject.IsNull()) return aGEOMObject._retn(); return GetObject(anObject); @@ -160,7 +217,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires (const GEOM::ListOfGO& theWires, - const CORBA::Boolean isPlanarWanted) + const CORBA::Boolean isPlanarWanted) { GEOM::GEOM_Object_var aGEOMObject; @@ -168,14 +225,12 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires GetOperations()->SetNotDone(); int ind, aLen; - list aShapes; + std::list aShapes; //Get the shapes aLen = theWires.length(); for (ind = 0; ind < aLen; ind++) { - if (theWires[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theWires[ind]->GetStudyID(), theWires[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theWires[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aShapes.push_back(aSh); } @@ -183,7 +238,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires // Make Face Handle(GEOM_Object) anObject = GetOperations()->MakeFaceWires(aShapes, isPlanarWanted); - if (!GetOperations()->IsDone() || anObject.IsNull()) + //if (!GetOperations()->IsDone() || anObject.IsNull()) + // enable warning status + if (anObject.IsNull()) return aGEOMObject._retn(); return GetObject(anObject); @@ -203,14 +260,12 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell GetOperations()->SetNotDone(); int ind, aLen; - list aShapes; + std::list aShapes; //Get the shapes aLen = theFacesAndShells.length(); for (ind = 0; ind < aLen; ind++) { - if (theFacesAndShells[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theFacesAndShells[ind]->GetStudyID(), theFacesAndShells[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theFacesAndShells[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aShapes.push_back(aSh); } @@ -237,16 +292,15 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell //Set a not done flag GetOperations()->SetNotDone(); - if (theShell == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShell = GetOperations()->GetEngine()->GetObject - (theShell->GetStudyID(), theShell->GetEntry()); - + Handle(GEOM_Object) aShell = GetObjectImpl(theShell); if (aShell.IsNull()) return aGEOMObject._retn(); + std::list aShapes; + aShapes.push_back(aShell); + //Create the Solid - Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShell(aShell); + Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShells(aShapes); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); @@ -267,14 +321,12 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells GetOperations()->SetNotDone(); int ind, aLen; - list aShapes; + std::list aShapes; //Get the shapes aLen = theShells.length(); for (ind = 0; ind < aLen; ind++) { - if (theShells[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theShells[ind]->GetStudyID(), theShells[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theShells[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aShapes.push_back(aSh); } @@ -302,14 +354,12 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound GetOperations()->SetNotDone(); int ind, aLen; - list aShapes; + std::list aShapes; //Get the shapes aLen = theShapes.length(); for (ind = 0; ind < aLen; ind++) { - if (theShapes[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aShapes.push_back(aSh); } @@ -330,20 +380,16 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - CORBA::Boolean doKeepNonSolids) + CORBA::Double theTolerance, + CORBA::Boolean doKeepNonSolids) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aGEOMObject._retn(); //Perform the gluing @@ -357,7 +403,6 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces return GetObject(anObject); } - //============================================================================= /*! * GetGlueFaces @@ -365,22 +410,20 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape, - const CORBA::Double theTolerance) + const CORBA::Double theTolerance) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aSeq._retn(); Handle(TColStd_HSequenceOfTransient) aHSeq = - GetOperations()->GetGlueFaces(aShape, theTolerance); + //GetOperations()->GetGlueFaces(aShape, theTolerance); + GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_FACE); //if (!GetOperations()->IsDone() || aHSeq.IsNull()) // to allow warning @@ -395,7 +438,6 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces return aSeq._retn(); } - //============================================================================= /*! * MakeGlueFacesByList @@ -403,38 +445,33 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces, - CORBA::Boolean doKeepNonSolids) + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces, + CORBA::Boolean doKeepNonSolids, + CORBA::Boolean doGlueAllEdges) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aGEOMObject._retn(); int ind, aLen; - list aFaces; + std::list aFaces; //Get the shapes aLen = theFaces.length(); for (ind = 0; ind < aLen; ind++) { - if (theFaces[ind] == NULL) return aGEOMObject._retn(); - Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject - (theFaces[ind]->GetStudyID(), theFaces[ind]->GetEntry()); + Handle(GEOM_Object) aSh = GetObjectImpl(theFaces[ind]); if (aSh.IsNull()) return aGEOMObject._retn(); aFaces.push_back(aSh); } //Perform the gluing Handle(GEOM_Object) anObject = - GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids); + GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids, doGlueAllEdges); //if (!GetOperations()->IsDone() || anObject.IsNull()) // to allow warning if (anObject.IsNull()) @@ -443,24 +480,209 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList return GetObject(anObject); } +//============================================================================= +/*! + * MakeGlueEdges + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aGEOMObject._retn(); + + //Perform the gluing + Handle(GEOM_Object) anObject = + GetOperations()->MakeGlueEdges(aShape, theTolerance); + //if (!GetOperations()->IsDone() || anObject.IsNull()) + // to allow warning + if (anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! - * MakeExplode + * GetGlueEdges + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Double theTolerance) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_EDGE); + + //if (!GetOperations()->IsDone() || aHSeq.IsNull()) + // to allow warning + if (aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakeGlueEdgesByList + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theEdges) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aGEOMObject._retn(); + + int ind, aLen; + std::list anEdges; + //Get the shapes + aLen = theEdges.length(); + for (ind = 0; ind < aLen; ind++) { + Handle(GEOM_Object) aSh = GetObjectImpl(theEdges[ind]); + if (aSh.IsNull()) return aGEOMObject._retn(); + anEdges.push_back(aSh); + } + + //Perform the gluing + Handle(GEOM_Object) anObject = + GetOperations()->MakeGlueEdgesByList(aShape, theTolerance, anEdges); + //if (!GetOperations()->IsDone() || anObject.IsNull()) + // to allow warning + if (anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetExistingSubObjects + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape, + CORBA::Boolean theGroupsOnly) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakeExplode (including theShape itself, bad sorting) */ //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - const CORBA::Boolean isSorted) + const CORBA::Long theShapeType, + const CORBA::Boolean isSorted) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; - if (theShape == NULL) return aSeq._retn(); - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); Handle(TColStd_HSequenceOfTransient) aHSeq = - GetOperations()->MakeExplode(aShape, theShapeType, isSorted); + GetOperations()->MakeExplode(aShape, theShapeType, isSorted, + GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakeAllSubShapes (including theShape itself, good sorting) + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + const CORBA::Boolean isSorted) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakeExplode(aShape, theShapeType, isSorted, + GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * ExtractSubShapes (excluding theShape itself, good sorting) + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::ExtractSubShapes (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + const CORBA::Boolean isSorted) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + // TODO: enum instead of bool for the last argument + GetOperations()->MakeExplode(aShape, theShapeType, isSorted, + GEOMImpl_IShapesOperations::EXPLODE_NEW_EXCLUDE_MAIN); if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); @@ -478,17 +700,44 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr the */ //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - const CORBA::Boolean isSorted) + const CORBA::Long theShapeType, + const CORBA::Boolean isSorted) { GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; - if (theShape == NULL) return aSeq._retn(); - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); Handle(TColStd_HSequenceOfInteger) aHSeq = - GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted); + GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, + GEOMImpl_IShapesOperations::EXPLODE_OLD_INCLUDE_MAIN); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetAllSubShapesIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + const CORBA::Boolean isSorted) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfInteger) aHSeq = + GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, + GEOMImpl_IShapesOperations::EXPLODE_NEW_INCLUDE_MAIN); if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); Standard_Integer aLength = aHSeq->Length(); @@ -506,19 +755,15 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_pt //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape (GEOM::GEOM_Object_ptr theMainShape, - const CORBA::Long theID) + const CORBA::Long theID) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theMainShape == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theMainShape->GetStudyID(), theMainShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape); if (aShape.IsNull()) return aGEOMObject._retn(); Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID); @@ -528,6 +773,42 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape return GetObject(anObject); } +//============================================================================= +/*! + * MakeSubShapes + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr theMainShape, + const GEOM::ListOfLong& theIndices) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + Standard_Integer i; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theIndices.length() < 1) + return aSeq._retn(); + + Handle(GEOM_Object) aShape = GetObjectImpl(theMainShape); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length()); + for (i = 0; i < theIndices.length(); i++) + anArray->SetValue(i+1, theIndices[i]); + + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (i = 0; i < aLength; i++) + aSeq[i] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i+1))); + + return aSeq._retn(); +} + //============================================================================= /*! * GetSubShapeIndex @@ -536,13 +817,10 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape) { - if (theMainShape == NULL || theSubShape == NULL) return -1; - //Get the reference shapes - Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject - (theMainShape->GetStudyID(), theMainShape->GetEntry()); - Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject - (theSubShape->GetStudyID(), theSubShape->GetEntry()); + Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape); + Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape); + if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1; //Get the unique ID of inside @@ -561,13 +839,10 @@ CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape) { - if (theMainShape == NULL || theSubShape == NULL) return -1; - //Get the reference shapes - Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject - (theMainShape->GetStudyID(), theMainShape->GetEntry()); - Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject - (theSubShape->GetStudyID(), theSubShape->GetEntry()); + Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape); + Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape); + if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1; //Get an ID of , unique among all sub-shapes of of the same type @@ -585,12 +860,8 @@ CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex //============================================================================= char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape) { - if (theShape == NULL) return NULL; - //Get the reference shape - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return NULL; // Get shape parameters @@ -605,15 +876,7 @@ char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theSha //============================================================================= CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape) { - if (theShape == NULL) return -1; - - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - - CORBA::Long aNb = GetOperations()->NumberOfFaces(aShape); - if (!GetOperations()->IsDone()) return -1; - - return aNb; + return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE)); } //============================================================================= @@ -623,12 +886,21 @@ CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theSh //============================================================================= CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape) { - if (theShape == NULL) return -1; + return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE)); +} - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); +//============================================================================= +/*! + * NumberOfSubShapes + */ +//============================================================================= +CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType) +{ + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return -1; - CORBA::Long aNb = GetOperations()->NumberOfEdges(aShape); + CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType); if (!GetOperations()->IsDone()) return -1; return aNb; @@ -647,12 +919,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); if (aShape.IsNull()) return aGEOMObject._retn(); //Create the Solid @@ -674,10 +942,9 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_p GetOperations()->SetNotDone(); GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; - if (theShape == NULL) return aSeq._retn(); - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + if (aShape.IsNull()) return aSeq._retn(); Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetFreeFacesIDs(aShape); @@ -698,23 +965,18 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_p //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2, - const CORBA::Long theShapeType) + GEOM::GEOM_Object_ptr theShape2, + const CORBA::Long theShapeType) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; - if (theShape1 == NULL || - theShape2 == NULL) return aSeq._retn(); - Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject - (theShape1->GetStudyID(), theShape1->GetEntry()); - Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject - (theShape2->GetStudyID(), theShape2->GetEntry()); + Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1); + Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2); - if (aShape1.IsNull() || - aShape2.IsNull()) return aSeq._retn(); + if (aShape1.IsNull() || aShape2.IsNull()) return aSeq._retn(); Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType); @@ -729,6 +991,42 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes return aSeq._retn(); } +//============================================================================= +/*! + * GetSharedShapesMulti + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti + (const GEOM::ListOfGO& theShapes, + const CORBA::Long theShapeType) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Get the shapes + std::list aShapes; + int aLen = theShapes.length(); + for (int ind = 0; ind < aLen; ind++) { + Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]); + if (aSh.IsNull()) return aSeq._retn(); + aShapes.push_back(aSh); + } + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetSharedShapes(aShapes, theShapeType); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + static GEOMAlgo_State ShapeState (const GEOM::shape_state theState) { GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN; @@ -763,22 +1061,18 @@ static GEOMAlgo_State ShapeState (const GEOM::shape_state theState) //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + const GEOM::shape_state theState) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theAx1 == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject - (theAx1->GetStudyID(), theAx1->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1); if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn(); @@ -803,25 +1097,20 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - GEOM::GEOM_Object_ptr thePnt, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::GEOM_Object_ptr thePnt, + const GEOM::shape_state theState) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theAx1 == NULL || thePnt == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject - (theAx1->GetStudyID(), theAx1->GetEntry()); - Handle(GEOM_Object) anPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1); + Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt); if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn(); @@ -846,23 +1135,19 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocation //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAxis, - const CORBA::Double theRadius, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + const CORBA::Double theRadius, + const GEOM::shape_state theState) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theAxis == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject - (theAxis->GetStudyID(), theAxis->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn(); @@ -880,6 +1165,45 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder return aSeq._retn(); } +//============================================================================= +/*! + * GetShapesOnCylinderWithLocation + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocation + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + GEOM::GEOM_Object_ptr thePnt, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); + + if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn(); + + //Get Shapes On Cylinder + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinderWithLocation + (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + //============================================================================= /*! * GetShapesOnSphere @@ -887,23 +1211,19 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theCenter, - const CORBA::Double theRadius, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + const CORBA::Double theRadius, + const GEOM::shape_state theState) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theCenter == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject - (theCenter->GetStudyID(), theCenter->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter); if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn(); @@ -940,30 +1260,18 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - theTopLeftPoint == NULL || - theTopRigthPoint == NULL || - theBottomLeftPoint == NULL || - theBottomRigthPoint == NULL ) - return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theTopLeftPoint->GetEntry()); - Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theTopRigthPoint->GetEntry()); - Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theBottomLeftPoint->GetEntry()); - Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theBottomRigthPoint->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint); + Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint); + Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint); + Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint); if (aShape.IsNull() || aTopLeftPoint.IsNull() || aTopRigthPoint.IsNull() || aBottomLeftPoint.IsNull() || - aBottomRigthPoint.IsNull() ) + aBottomRigthPoint.IsNull()) return aSeq._retn(); //Get Shapes On Quadrangle @@ -989,22 +1297,18 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + const GEOM::shape_state theState) { GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theAx1 == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject - (theAx1->GetStudyID(), theAx1->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1); if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn(); @@ -1029,31 +1333,27 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - GEOM::GEOM_Object_ptr thePnt, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::GEOM_Object_ptr thePnt, + const GEOM::shape_state theState) { GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theAx1 == NULL || thePnt == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject - (theAx1->GetStudyID(), theAx1->GetEntry()); - Handle(GEOM_Object) anPnt = GetOperations()->GetEngine()->GetObject - (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAx1 = GetObjectImpl(theAx1); + Handle(GEOM_Object) anPnt = GetObjectImpl(thePnt); if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return aSeq._retn(); //Get Shapes On Plane Handle(TColStd_HSequenceOfInteger) aHSeq = - GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType, anAx1, anPnt, ShapeState(theState)); + GetOperations()->GetShapesOnPlaneWithLocationIDs(aShape, theShapeType, + anAx1, anPnt, ShapeState(theState)); if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); @@ -1072,23 +1372,19 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneWithLocationIDs //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAxis, - const CORBA::Double theRadius, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + const CORBA::Double theRadius, + const GEOM::shape_state theState) { GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theAxis == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject - (theAxis->GetStudyID(), theAxis->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn(); @@ -1106,6 +1402,45 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs return aSeq._retn(); } +//============================================================================= +/*! + * GetShapesOnCylinderWithLocationIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderWithLocationIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + GEOM::GEOM_Object_ptr thePnt, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); + Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt); + + if (aShape.IsNull() || anAxis.IsNull() || aPnt.IsNull()) return aSeq._retn(); + + //Get Shapes On Cylinder + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderWithLocationIDs + (aShape, theShapeType, anAxis, aPnt, theRadius, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + //============================================================================= /*! * GetShapesOnSphereIDs @@ -1113,23 +1448,19 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr theShape, - const CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theCenter, - const CORBA::Double theRadius, - const GEOM::shape_state theState) + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + const CORBA::Double theRadius, + const GEOM::shape_state theState) { GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || theCenter == NULL) return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject - (theCenter->GetStudyID(), theCenter->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aCenter = GetObjectImpl(theCenter); if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn(); @@ -1166,24 +1497,12 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs //Set a not done flag GetOperations()->SetNotDone(); - if (theShape == NULL || - theTopLeftPoint == NULL || - theTopRigthPoint == NULL || - theBottomLeftPoint == NULL || - theBottomRigthPoint == NULL ) - return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theTopLeftPoint->GetEntry()); - Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theTopRigthPoint->GetEntry()); - Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theBottomLeftPoint->GetEntry()); - Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theBottomRigthPoint->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint); + Handle(GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint); + Handle(GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint); + Handle(GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint); if (aShape.IsNull() || aTopLeftPoint.IsNull() || @@ -1224,14 +1543,9 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox //Set a not done flag GetOperations()->SetNotDone(); - if ( theShape == NULL || theBox == NULL ) - return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aBox = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theBox->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aBox = GetObjectImpl(theBox); if (aShape.IsNull() || aBox.IsNull() ) return aSeq._retn(); @@ -1257,7 +1571,7 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnBox //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs (GEOM::GEOM_Object_ptr theBox, - GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, GEOM::shape_state theState) { @@ -1266,14 +1580,9 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs //Set a not done flag GetOperations()->SetNotDone(); - if ( theShape == NULL || theBox == NULL ) - return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aBox = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theBox->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aBox = GetObjectImpl(theBox); if (aShape.IsNull() || aBox.IsNull() ) return aSeq._retn(); @@ -1300,23 +1609,18 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnBoxIDs //============================================================================= GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState) + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; //Set a not done flag GetOperations()->SetNotDone(); - if ( theShape == NULL || theCheckShape == NULL ) - return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theCheckShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape); if (aShape.IsNull() || aCheckShape.IsNull() ) return aSeq._retn(); @@ -1344,23 +1648,18 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState) + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if ( theShape == NULL || theCheckShape == NULL ) - return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theCheckShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape); if (aShape.IsNull() || aCheckShape.IsNull() ) return aGEOMObject._retn(); @@ -1383,23 +1682,18 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound //============================================================================= GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState) + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState) { GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; //Set a not done flag GetOperations()->SetNotDone(); - if ( theShape == NULL || theCheckShape == NULL ) - return aSeq._retn(); - //Get the reference objects - Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theShape->GetEntry()); - Handle(GEOM_Object) aCheckShape = GetOperations()->GetEngine()->GetObject - (theShape->GetStudyID(), theCheckShape->GetEntry()); + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aCheckShape = GetObjectImpl(theCheckShape); if (aShape.IsNull() || aCheckShape.IsNull() ) return aSeq._retn(); @@ -1426,21 +1720,16 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere, - GEOM::GEOM_Object_ptr theShapeWhat) + GEOM::GEOM_Object_ptr theShapeWhat) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShapeWhere == NULL || - theShapeWhat == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject - (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry()); - Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject - (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry()); + Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere); + Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat); if (aShapeWhere.IsNull() || aShapeWhat.IsNull()) return aGEOMObject._retn(); @@ -1454,6 +1743,36 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace return GetObject(anObject); } +//============================================================================= +/*! + * GetInPlaceOld + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceOld + (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere); + Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat); + + if (aShapeWhere.IsNull() || + aShapeWhat.IsNull()) return aGEOMObject._retn(); + + //Get Shapes in place of aShapeWhat + Handle(GEOM_Object) anObject = + GetOperations()->GetInPlaceOld(aShapeWhere, aShapeWhat); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * GetInPlaceByHistory @@ -1461,21 +1780,16 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory (GEOM::GEOM_Object_ptr theShapeWhere, - GEOM::GEOM_Object_ptr theShapeWhat) + GEOM::GEOM_Object_ptr theShapeWhat) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShapeWhere == NULL || - theShapeWhat == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject - (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry()); - Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject - (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry()); + Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere); + Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat); if (aShapeWhere.IsNull() || aShapeWhat.IsNull()) return aGEOMObject._retn(); @@ -1496,21 +1810,16 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory //============================================================================= GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame (GEOM::GEOM_Object_ptr theShapeWhere, - GEOM::GEOM_Object_ptr theShapeWhat) + GEOM::GEOM_Object_ptr theShapeWhat) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theShapeWhere == NULL || - theShapeWhat == NULL) return aGEOMObject._retn(); - //Get the reference objects - Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject - (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry()); - Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject - (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry()); + Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere); + Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat); if (aShapeWhere.IsNull() || aShapeWhat.IsNull()) return aGEOMObject._retn(); @@ -1524,3 +1833,33 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSame return GetObject(anObject); } +//============================================================================= +/*! + * GetSameIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSameIDs + (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat) { + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Get the reference objects + Handle(GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere); + Handle(GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat); + + if (aShapeWhere.IsNull() || + aShapeWhat.IsNull()) return aSeq._retn(); + + + Handle(TColStd_HSequenceOfInteger) aHSeq = + GetOperations()->GetSameIDs(aShapeWhere, aShapeWhat); + + if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index 2b1523918..c01b6317e 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_IShapesOperations_i_HeaderFile #define _GEOM_IShapesOperations_i_HeaderFile @@ -38,20 +39,29 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : { public: GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IShapesOperations* theImpl); + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IShapesOperations* theImpl); ~GEOM_IShapesOperations_i(); GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr thePnt2); + + GEOM::GEOM_Object_ptr MakeEdgeOnCurveByLength (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint); - GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires); + GEOM::GEOM_Object_ptr MakeEdgeWire (GEOM::GEOM_Object_ptr theWire, + const CORBA::Double theLinearTolerance, + const CORBA::Double theAngularTolerance); + + GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires, + const CORBA::Double theTolerance); GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire, - CORBA::Boolean isPlanarWanted); + CORBA::Boolean isPlanarWanted); GEOM::GEOM_Object_ptr MakeFaceWires (const GEOM::ListOfGO& theWires, - CORBA::Boolean isPlanarWanted); + CORBA::Boolean isPlanarWanted); GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells); @@ -62,70 +72,113 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes); GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - CORBA::Boolean doKeepNonSolids); + CORBA::Double theTolerance, + CORBA::Boolean doKeepNonSolids); GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance); + CORBA::Double theTolerance); GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces, - CORBA::Boolean doKeepNonSolids); + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces, + CORBA::Boolean doKeepNonSolids, + CORBA::Boolean doGlueAllEdges); + + GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + GEOM::ListOfGO* GetGlueEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + GEOM::GEOM_Object_ptr MakeGlueEdgesByList (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theEdges); + + GEOM::ListOfGO* GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape, + CORBA::Boolean theGroupsOnly); + + // For old SubShapeAll() + // Deprecated, use MakeAllSubShapes() instead GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - CORBA::Boolean isSorted); + CORBA::Long theShapeType, + CORBA::Boolean isSorted); + + GEOM::ListOfGO* MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + CORBA::Boolean isSorted); + + GEOM::ListOfGO* ExtractSubShapes (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + CORBA::Boolean isSorted); + // Deprecated, use GetAllSubShapesIDs() instead GEOM::ListOfLong* SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - CORBA::Boolean isSorted); + CORBA::Long theShapeType, + CORBA::Boolean isSorted); + + GEOM::ListOfLong* GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + CORBA::Boolean isSorted); GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape, - CORBA::Long theID); + CORBA::Long theID); + + GEOM::ListOfGO* MakeSubShapes (GEOM::GEOM_Object_ptr theMainShape, + const GEOM::ListOfLong& theIndices); CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theMainShape, - GEOM::GEOM_Object_ptr theSubShape); + GEOM::GEOM_Object_ptr theSubShape); CORBA::Long GetTopologyIndex (GEOM::GEOM_Object_ptr theMainShape, - GEOM::GEOM_Object_ptr theSubShape); + GEOM::GEOM_Object_ptr theSubShape); char* GetShapeTypeString (GEOM::GEOM_Object_ptr theShape); CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape); CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape); + CORBA::Long NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType); GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theShape); GEOM::ListOfLong* GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape); GEOM::ListOfGO* GetSharedShapes (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2, - CORBA::Long theShapeType); + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theShapeType); + + GEOM::ListOfGO* GetSharedShapesMulti (const GEOM::ListOfGO& theShapes, + CORBA::Long theShapeType); GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::shape_state theState); GEOM::ListOfGO* GetShapesOnPlaneWithLocation(GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - GEOM::GEOM_Object_ptr thePnt, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::GEOM_Object_ptr thePnt, + GEOM::shape_state theState); GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theRadius, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + GEOM::shape_state theState); + + GEOM::ListOfGO* GetShapesOnCylinderWithLocation (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + GEOM::GEOM_Object_ptr thePnt, + CORBA::Double theRadius, + GEOM::shape_state theState); GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theCenter, - CORBA::Double theRadius, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + CORBA::Double theRadius, + GEOM::shape_state theState); GEOM::ListOfGO* GetShapesOnQuadrangle (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, @@ -136,27 +189,34 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : GEOM::shape_state theState); GEOM::ListOfLong* GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::shape_state theState); GEOM::ListOfLong* GetShapesOnPlaneWithLocationIDs (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAx1, - GEOM::GEOM_Object_ptr thePnt, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::GEOM_Object_ptr thePnt, + GEOM::shape_state theState); GEOM::ListOfLong* GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theRadius, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + GEOM::shape_state theState); + + GEOM::ListOfLong* GetShapesOnCylinderWithLocationIDs (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + GEOM::GEOM_Object_ptr thePnt, + CORBA::Double theRadius, + GEOM::shape_state theState); GEOM::ListOfLong* GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::GEOM_Object_ptr theCenter, - CORBA::Double theRadius, - GEOM::shape_state theState); + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + CORBA::Double theRadius, + GEOM::shape_state theState); GEOM::ListOfLong* GetShapesOnQuadrangleIDs (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, @@ -167,39 +227,45 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : GEOM::shape_state theState); GEOM::ListOfGO* GetShapesOnBox (GEOM::GEOM_Object_ptr theBox, - GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::shape_state theState); + GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::shape_state theState); GEOM::ListOfLong* GetShapesOnBoxIDs (GEOM::GEOM_Object_ptr theBox, - GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - GEOM::shape_state theState); + GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::shape_state theState); GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState); + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState); GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound (GEOM::GEOM_Object_ptr theSheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState); + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState); GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState); + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState); GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere, - GEOM::GEOM_Object_ptr theShapeWhat); + GEOM::GEOM_Object_ptr theShapeWhat); + + GEOM::GEOM_Object_ptr GetInPlaceOld (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat); GEOM::GEOM_Object_ptr GetInPlaceByHistory (GEOM::GEOM_Object_ptr theShapeWhere, - GEOM::GEOM_Object_ptr theShapeWhat); + GEOM::GEOM_Object_ptr theShapeWhat); GEOM::GEOM_Object_ptr GetSame (GEOM::GEOM_Object_ptr theShapeWhere, - GEOM::GEOM_Object_ptr theShapeWhat); + GEOM::GEOM_Object_ptr theShapeWhat); + + GEOM::ListOfLong* GetSameIDs (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat); ::GEOMImpl_IShapesOperations* GetOperations() { return (::GEOMImpl_IShapesOperations*)GetImpl(); } diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.cc b/src/GEOM_I/GEOM_ITransformOperations_i.cc index ac359856d..59bc4a293 100644 --- a/src/GEOM_I/GEOM_ITransformOperations_i.cc +++ b/src/GEOM_I/GEOM_ITransformOperations_i.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include "GEOM_ITransformOperations_i.hh" @@ -42,8 +43,8 @@ //============================================================================= GEOM_ITransformOperations_i::GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA, - GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_ITransformOperations* theImpl) + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ITransformOperations* theImpl) :GEOM_IOperations_i(thePOA, theEngine, theImpl) { MESSAGE("GEOM_ITransformOperations_i::GEOM_ITransformOperations_i"); @@ -68,17 +69,17 @@ GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i() //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape - if(!theObject->IsMainShape()) { + //check if the object is a sub-shape + if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } @@ -86,21 +87,15 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the first point of translation - CORBA::String_var aP1Entry = thePoint1->GetEntry(); - Handle(GEOM_Object) aPoint1 = - GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); if (aPoint1.IsNull()) return aGEOMObject._retn(); //Get the second point of translation - CORBA::String_var aP2Entry = thePoint2->GetEntry(); - Handle(GEOM_Object) aPoint2 = - GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); if (aPoint2.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -116,32 +111,24 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the first point of translation - CORBA::String_var aP1Entry = thePoint1->GetEntry(); - Handle(GEOM_Object) aPoint1 = - GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); if (aPoint1.IsNull()) return aGEOMObject._retn(); //Get the second point of translation - CORBA::String_var aP2Entry = thePoint2->GetEntry(); - Handle(GEOM_Object) aPoint2 = - GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); if (aPoint2.IsNull()) return aGEOMObject._retn(); //Create the translated shape @@ -159,17 +146,17 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ - (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) + (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) { //Set a not done flag GetOperations()->SetNotDone(); - GEOM::GEOM_Object_var aGEOMObject ; + GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape - if(!theObject->IsMainShape()) { + //check if the object is a sub-shape + if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } @@ -177,9 +164,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -188,7 +173,6 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ return aGEOMObject._retn(); } - //============================================================================= /*! * TranslateDXDYDZCopy @@ -196,19 +180,15 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) + CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Create the translated shape @@ -220,7 +200,6 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy return GetObject(anObject); } - //============================================================================= /*! * TranslateVector @@ -228,16 +207,16 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector) + GEOM::GEOM_Object_ptr theVector) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape - if(!theObject->IsMainShape()) { + //check if the object is a sub-shape + if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } @@ -245,15 +224,11 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the vector of translation - CORBA::String_var aVEntry = theVector->GetEntry(); - Handle(GEOM_Object) aVector = - GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVEntry); + Handle(GEOM_Object) aVector = GetObjectImpl(theVector); if (aVector.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -269,25 +244,19 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector) + GEOM::GEOM_Object_ptr theVector) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the vector of translation - CORBA::String_var aVEntry = theVector->GetEntry(); - Handle(GEOM_Object) aVector = - GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVEntry); + Handle(GEOM_Object) aVector = GetObjectImpl(theVector); if (aVector.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -305,16 +274,16 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theDistance, - CORBA::Boolean theCopy) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theDistance, + CORBA::Boolean theCopy) { GEOM::GEOM_Object_var aGEOMObject; GetOperations()->SetNotDone(); //Set a not done flag - if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theCopy && !theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); @@ -324,15 +293,11 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the vector of translation - CORBA::String_var aVecEntry = theVector->GetEntry(); - Handle(GEOM_Object) aVector = - GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry); + Handle(GEOM_Object) aVector = GetObjectImpl(theVector); if (aVector.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -355,17 +320,17 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape - if(!theObject->IsMainShape()) { + //check if the object is a sub-shape + if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } @@ -373,15 +338,11 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the axis of revolution - CORBA::String_var anAEntry = theAxis->GetEntry(); - Handle(GEOM_Object) anAxis = - GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); if (anAxis.IsNull()) return aGEOMObject._retn(); //Perform the rotation @@ -396,26 +357,20 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the axis of rotation - CORBA::String_var anAEntry = theAxis->GetEntry(); - Handle(GEOM_Object) anAxis = - GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry); + Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis); if (anAxis.IsNull()) return aGEOMObject._retn(); //Perform the rotation @@ -426,7 +381,6 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object return GetObject(anObject); } - //============================================================================= /*! * MirrorPlane @@ -434,31 +388,27 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePlane) + GEOM::GEOM_Object_ptr thePlane) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the plane - CORBA::String_var aPlnEntry = thePlane->GetEntry(); - Handle(GEOM_Object) aPlane = - GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), aPlnEntry); + Handle(GEOM_Object) aPlane = GetObjectImpl(thePlane); if (aPlane.IsNull()) return aGEOMObject._retn(); //Perform the mirror @@ -474,25 +424,19 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePlane) + GEOM::GEOM_Object_ptr thePlane) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the vector of translation - CORBA::String_var aPlnEntry = thePlane->GetEntry(); - Handle(GEOM_Object) aPlane = - GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), aPlnEntry); + Handle(GEOM_Object) aPlane = GetObjectImpl(thePlane); if (aPlane.IsNull()) return aGEOMObject._retn(); //Perform the mirror @@ -510,31 +454,27 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis) + GEOM::GEOM_Object_ptr theAxis) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape - if(!theObject->IsMainShape()) { + //check if the object is a sub-shape + if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the axis - CORBA::String_var anAEntry = theAxis->GetEntry(); - Handle(GEOM_Object) aAxis = - GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry); + Handle(GEOM_Object) aAxis = GetObjectImpl(theAxis); if (aAxis.IsNull()) return aGEOMObject._retn(); //Perform the mirror @@ -550,25 +490,19 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis) + GEOM::GEOM_Object_ptr theAxis) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the vector of translation - CORBA::String_var anAEntry = theAxis->GetEntry(); - Handle(GEOM_Object) aAxis = - GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry); + Handle(GEOM_Object) aAxis = GetObjectImpl(theAxis); if (aAxis.IsNull()) return aGEOMObject._retn(); //Perform the mirror @@ -586,31 +520,27 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the point - CORBA::String_var aPntEntry = thePoint->GetEntry(); - Handle(GEOM_Object) aPoint = - GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); if (aPoint.IsNull()) return aGEOMObject._retn(); //Perform the mirror @@ -626,25 +556,19 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the vector of translation - CORBA::String_var aPntEntry = thePoint->GetEntry(); - Handle(GEOM_Object) aPoint = - GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); if (aPoint.IsNull()) return aGEOMObject._retn(); //Perform the mirror @@ -655,7 +579,6 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy return GetObject(anObject); } - //============================================================================= /*! * OffsetShape @@ -663,25 +586,23 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theOffset) + CORBA::Double theOffset) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL) return aGEOMObject._retn(); + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } //Get the basic object - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Create the offset shape @@ -697,19 +618,15 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theOffset) + CORBA::Double theOffset) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL) return aGEOMObject._retn(); - //Get the basic object - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Create the offset shape @@ -720,6 +637,32 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy return GetObject(anObject); } +//============================================================================= +/*! + * ProjectShapeCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ProjectShapeCopy + (GEOM::GEOM_Object_ptr theSource, + GEOM::GEOM_Object_ptr theTarget) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the input objects + Handle(GEOM_Object) aSource = GetObjectImpl(theSource); + Handle(GEOM_Object) aTarget = GetObjectImpl(theTarget); + if (aSource.IsNull() || aTarget.IsNull()) return aGEOMObject._retn(); + + //Create the projection + Handle(GEOM_Object) anObject = GetOperations()->ProjectShapeCopy(aSource, aTarget); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! @@ -728,8 +671,8 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactor) + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); @@ -738,23 +681,20 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape if (theObject->_is_nil()) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the point Handle(GEOM_Object) aPoint; if (!thePoint->_is_nil()) { - CORBA::String_var aPntEntry = thePoint->GetEntry(); - aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry); + aPoint = GetObjectImpl(thePoint); if (aPoint.IsNull()) return aGEOMObject._retn(); } @@ -771,27 +711,22 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactor) + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject->_is_nil()) return aGEOMObject._retn(); - //Get the basic object - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the point Handle(GEOM_Object) aPoint; if (!thePoint->_is_nil()) { - CORBA::String_var aPntEntry = thePoint->GetEntry(); - aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry); + aPoint = GetObjectImpl(thePoint); if (aPoint.IsNull()) return aGEOMObject._retn(); } @@ -811,10 +746,10 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactorX, - CORBA::Double theFactorY, - CORBA::Double theFactorZ) + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactorX, + CORBA::Double theFactorY, + CORBA::Double theFactorZ) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); @@ -823,23 +758,20 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes if (theObject->_is_nil()) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the point Handle(GEOM_Object) aPoint; if (!thePoint->_is_nil()) { - CORBA::String_var aPntEntry = thePoint->GetEntry(); - aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry); + aPoint = GetObjectImpl(thePoint); if (aPoint.IsNull()) return aGEOMObject._retn(); } @@ -857,29 +789,24 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactorX, - CORBA::Double theFactorY, - CORBA::Double theFactorZ) + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactorX, + CORBA::Double theFactorY, + CORBA::Double theFactorZ) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject->_is_nil()) return aGEOMObject._retn(); - //Get the basic object - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the point Handle(GEOM_Object) aPoint; if (!thePoint->_is_nil()) { - CORBA::String_var aPntEntry = thePoint->GetEntry(); - aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry); + aPoint = GetObjectImpl(thePoint); if (aPoint.IsNull()) return aGEOMObject._retn(); } @@ -899,41 +826,36 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxesCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theStartLCS, - GEOM::GEOM_Object_ptr theEndLCS) + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) { GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || theEndLCS == NULL) + if (CORBA::is_nil(theObject) || CORBA::is_nil(theEndLCS)) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); } //Get the basic object - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the Start LCS (may be NULL for positioning from global LCS) - Handle(GEOM_Object) aStartLCS = NULL; - if (theStartLCS != NULL && !CORBA::is_nil(theStartLCS)) { - CORBA::String_var aStartLCSEntry = theStartLCS->GetEntry(); - aStartLCS = GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), aStartLCSEntry); + Handle(GEOM_Object) aStartLCS; + if (!CORBA::is_nil(theStartLCS)) { + aStartLCS = GetObjectImpl(theStartLCS); if (aStartLCS.IsNull()) return aGEOMObject._retn(); } //Get the End LCS - CORBA::String_var anEndLCSEntry = theEndLCS->GetEntry(); - Handle(GEOM_Object) aEndLCS = - GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), anEndLCSEntry); + Handle(GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS); if (aEndLCS.IsNull()) return aGEOMObject._retn(); //Perform the Position @@ -949,35 +871,27 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theStartLCS, - GEOM::GEOM_Object_ptr theEndLCS) + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || theEndLCS == NULL) - return aGEOMObject._retn(); - //Get the basic object - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the Start LCS (may be NULL for positioning from global LCS) - Handle(GEOM_Object) aStartLCS = NULL; - if (theStartLCS != NULL && !CORBA::is_nil(theStartLCS)) { - CORBA::String_var aStartLCSEntry = theStartLCS->GetEntry(); - aStartLCS = GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), aStartLCSEntry); + Handle(GEOM_Object) aStartLCS; + if (!CORBA::is_nil(theStartLCS)) { + aStartLCS = GetObjectImpl(theStartLCS); if (aStartLCS.IsNull()) return aGEOMObject._retn(); } //Get the End LCS - CORBA::String_var anEndLCSEntry = theEndLCS->GetEntry(); - Handle(GEOM_Object) aEndLCS = - GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), anEndLCSEntry); + Handle(GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS); if (aEndLCS.IsNull()) return aGEOMObject._retn(); //Perform the position @@ -996,29 +910,22 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePath, - CORBA::Double theDistance, - CORBA::Boolean theCopy, - CORBA::Boolean theReverse) + GEOM::GEOM_Object_ptr thePath, + CORBA::Double theDistance, + CORBA::Boolean theCopy, + CORBA::Boolean theReverse) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theObject == NULL || thePath == NULL) - return aGEOMObject._retn(); - //Get the basic object - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the path object - CORBA::String_var aPathEntry = thePath->GetEntry(); - Handle(GEOM_Object) aPathObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), aPathEntry); + Handle(GEOM_Object) aPathObject = GetObjectImpl(thePath); if (aPathObject.IsNull()) return aGEOMObject._retn(); //Perform the position @@ -1037,26 +944,20 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theStep, CORBA::Long theNbTimes) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theStep, CORBA::Long theNbTimes) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the vector of translation - CORBA::String_var aVecEntry = theVector->GetEntry(); - Handle(GEOM_Object) aVector = - GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry); + Handle(GEOM_Object) aVector = GetObjectImpl(theVector); if (aVector.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -1073,36 +974,28 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector1, - CORBA::Double theStep1, - CORBA::Long theNbTimes1, - GEOM::GEOM_Object_ptr theVector2, - CORBA::Double theStep2, - CORBA::Long theNbTimes2) + GEOM::GEOM_Object_ptr theVector1, + CORBA::Double theStep1, + CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, + CORBA::Double theStep2, + CORBA::Long theNbTimes2) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL || theVector1 == NULL || theVector2 == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the vector1 of translation - CORBA::String_var aVec1Entry = theVector1->GetEntry(); - Handle(GEOM_Object) aVector1 = - GetOperations()->GetEngine()->GetObject(theVector1->GetStudyID(), aVec1Entry); + Handle(GEOM_Object) aVector1 = GetObjectImpl(theVector1); if (aVector1.IsNull()) return aGEOMObject._retn(); //Get the vector2 of translation - CORBA::String_var aVec2Entry = theVector2->GetEntry(); - Handle(GEOM_Object) aVector2 = - GetOperations()->GetEngine()->GetObject(theVector2->GetStudyID(), aVec2Entry); + Handle(GEOM_Object) aVector2 = GetObjectImpl(theVector2); if (aVector2.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -1119,26 +1012,20 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_ */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Long theNbTimes) + GEOM::GEOM_Object_ptr theVector, + CORBA::Long theNbTimes) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the a directon of rotation - CORBA::String_var aVecEntry = theVector->GetEntry(); - Handle(GEOM_Object) aVector = - GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry); + Handle(GEOM_Object) aVector = GetObjectImpl(theVector); if (aVector.IsNull()) return aGEOMObject._retn(); //Perform the rotation @@ -1154,29 +1041,23 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Obj */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theAngle, - CORBA::Long theNbTimes1, - CORBA::Double theStep, - CORBA::Long theNbTimes2) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theAngle, + CORBA::Long theNbTimes1, + CORBA::Double theStep, + CORBA::Long theNbTimes2) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the a directon of rotation - CORBA::String_var aVecEntry = theVector->GetEntry(); - Handle(GEOM_Object) aVector = - GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry); + Handle(GEOM_Object) aVector = GetObjectImpl(theVector); if (aVector.IsNull()) return aGEOMObject._retn(); //Perform the rotation @@ -1194,18 +1075,18 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Obj //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theCentPoint, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr theCentPoint, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { //Set a not done flag GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theCentPoint == NULL || thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); - //check if the object is a subshape + //check if the object is a sub-shape if (!theObject->IsMainShape()) { GetOperations()->SetErrorCode(SUBSHAPE_ERROR); return aGEOMObject._retn(); @@ -1214,27 +1095,19 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Get the central point of rotation - CORBA::String_var aCPEntry = theCentPoint->GetEntry(); - Handle(GEOM_Object) aCentPoint = - GetOperations()->GetEngine()->GetObject(theCentPoint->GetStudyID(), aCPEntry); + Handle(GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint); if (aCentPoint.IsNull()) return aGEOMObject._retn(); //Get the first point - CORBA::String_var aP1Entry = thePoint1->GetEntry(); - Handle(GEOM_Object) aPoint1 = - GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); if (aPoint1.IsNull()) return aGEOMObject._retn(); //Get the second point - CORBA::String_var aP2Entry = thePoint2->GetEntry(); - Handle(GEOM_Object) aPoint2 = - GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); if (aPoint2.IsNull()) return aGEOMObject._retn(); //Perform the translation @@ -1250,40 +1123,29 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints //============================================================================= GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theCentPoint, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr theCentPoint, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { GEOM::GEOM_Object_var aGEOMObject; //Set a not done flag GetOperations()->SetNotDone(); - if (theCentPoint == NULL || thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) - return aGEOMObject._retn(); - //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) aBasicObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); if (aBasicObject.IsNull()) return aGEOMObject._retn(); //Get the central point of rotation - CORBA::String_var aCPEntry = theCentPoint->GetEntry(); - Handle(GEOM_Object) aCentPoint = - GetOperations()->GetEngine()->GetObject(theCentPoint->GetStudyID(), aCPEntry); + Handle(GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint); if (aCentPoint.IsNull()) return aGEOMObject._retn(); //Get the first point - CORBA::String_var aP1Entry = thePoint1->GetEntry(); - Handle(GEOM_Object) aPoint1 = - GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry); + Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1); if (aPoint1.IsNull()) return aGEOMObject._retn(); //Get the second point - CORBA::String_var aP2Entry = thePoint2->GetEntry(); - Handle(GEOM_Object) aPoint2 = - GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry); + Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2); if (aPoint2.IsNull()) return aGEOMObject._retn(); //Perform the rotation @@ -1295,6 +1157,37 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy return GetObject(anObject); } +//============================================================================= +/*! + * TransformLikeOtherCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TransformLikeOtherCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theSample) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the object itself + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the sample object + Handle(GEOM_Object) aSample = GetObjectImpl(theSample); + if (aSample.IsNull()) return aGEOMObject._retn(); + + //Perform the transformation + Handle(GEOM_Object) aResObject = + GetOperations()->TransformLikeOtherCopy(anObject, aSample); + if (!GetOperations()->IsDone() || aResObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aResObject); +} + //============================================================================= /*! * RecomputeObject @@ -1307,20 +1200,12 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RecomputeObject GetOperations()->SetNotDone(); GEOM::GEOM_Object_var aGEOMObject; - if (theObject == NULL) return aGEOMObject._retn(); - - //check if the object is a subshape - //if (!theObject->IsMainShape()) { - // GetOperations()->SetErrorCode(SUBSHAPE_ERROR); - // return aGEOMObject._retn(); - //} + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); //Get the object itself - CORBA::String_var anEntry = theObject->GetEntry(); - Handle(GEOM_Object) anObject = - GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry); + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); if (anObject.IsNull()) return aGEOMObject._retn(); //Perform the recomputation diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.hh b/src/GEOM_I/GEOM_ITransformOperations_i.hh index e46758e01..f01f08c22 100644 --- a/src/GEOM_I/GEOM_ITransformOperations_i.hh +++ b/src/GEOM_I/GEOM_ITransformOperations_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_ITransformOperations_i_HeaderFile #define _GEOM_ITransformOperations_i_HeaderFile @@ -50,10 +51,12 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i : GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); - GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); + GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); - GEOM::GEOM_Object_ptr TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); + GEOM::GEOM_Object_ptr TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); GEOM::GEOM_Object_ptr TranslateVector (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector); @@ -66,10 +69,15 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i : CORBA::Double theDistance, CORBA::Boolean theCopy); - GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector, CORBA::Double theStep, CORBA::Long theNbTimes); + GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theStep, CORBA::Long theNbTimes); - GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector1, CORBA::Double theStep1, CORBA::Long theNbTimes1, - GEOM::GEOM_Object_ptr theVector2, CORBA::Double theStep2, CORBA::Long theNbTimes2); + GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector1, + CORBA::Double theStep1, CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, + CORBA::Double theStep2, CORBA::Long theNbTimes2); GEOM::GEOM_Object_ptr Rotate (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theAxis, @@ -114,6 +122,9 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i : GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, CORBA::Double theOffset); + GEOM::GEOM_Object_ptr ProjectShapeCopy (GEOM::GEOM_Object_ptr theSource, + GEOM::GEOM_Object_ptr theTarget); + GEOM::GEOM_Object_ptr ScaleShape (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr thePoint, CORBA::Double theFactor); @@ -158,6 +169,9 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i : GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr TransformLikeOtherCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theSample); + GEOM::GEOM_Object_ptr RecomputeObject (GEOM::GEOM_Object_ptr theObject); diff --git a/src/GEOM_I/GEOM_Object_i.cc b/src/GEOM_I/GEOM_Object_i.cc index 12ea73a99..bc8afb0f9 100644 --- a/src/GEOM_I/GEOM_Object_i.cc +++ b/src/GEOM_I/GEOM_Object_i.cc @@ -1,34 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include -//#include #include #include #include "utilities.h" #include -#include +#include #include #include @@ -39,6 +39,7 @@ #include #include #include +#include #ifdef WNT #pragma warning( disable:4786 ) @@ -64,6 +65,7 @@ GEOM_Object_i::GEOM_Object_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr GEOM_Object_i::~GEOM_Object_i() { + MESSAGE("GEOM_Object_i::~GEOM_Object_i"); GEOM_Engine::GetEngine()->RemoveObject(_impl); } @@ -115,6 +117,74 @@ GEOM::shape_type GEOM_Object_i::GetShapeType() return (GEOM::shape_type)_geom.ShapeType(); } +//============================================================================= +/*! + * GetTopologyType + */ +//============================================================================= +GEOM::shape_type GEOM_Object_i::GetTopologyType() +{ + TopoDS_Shape shape = _impl->GetValue(); + if(shape.IsNull()) return GEOM::SHAPE; + + if ( shape.ShapeType() == TopAbs_COMPOUND || shape.ShapeType() == TopAbs_COMPSOLID ) { + TopoDS_Shape shape_i; + TopoDS_Iterator It (shape, Standard_True, Standard_False); + for (; It.More(); It.Next()) { + if ( !shape_i.IsNull() ) return (GEOM::shape_type)shape.ShapeType(); + shape_i = It.Value(); + } + if ( !shape_i.IsNull() ) + return (GEOM::shape_type) shape_i.ShapeType(); + } + + return (GEOM::shape_type)shape.ShapeType(); +} + +static GEOM::shape_type getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin ) +{ + if ( shape.IsNull() ) + return GEOM::SHAPE; + + GEOM::shape_type ret = (GEOM::shape_type)shape.ShapeType(); + + if ( shape.ShapeType() == TopAbs_COMPOUND || shape.ShapeType() == TopAbs_COMPSOLID ) { + TopoDS_Iterator it(shape, Standard_True, Standard_False); + for (; it.More(); it.Next()) { + TopoDS_Shape sub_shape = it.Value(); + if ( sub_shape.IsNull() ) continue; + GEOM::shape_type stype = (GEOM::shape_type)getMinMaxShapeType( sub_shape, ismin ); + if ( stype == GEOM::SHAPE ) continue; + if ( ismin && stype > ret ) + ret = stype; + else if ( !ismin && ( ret < GEOM::SOLID || stype < ret ) ) + ret = stype; + } + } + + return ret; +} + +//============================================================================= +/*! + * GetMinShapeType + */ +//============================================================================= +GEOM::shape_type GEOM_Object_i::GetMinShapeType() +{ + return getMinMaxShapeType( _impl->GetValue(), true ); +} + +//============================================================================= +/*! + * GetMaxShapeType + */ +//============================================================================= +GEOM::shape_type GEOM_Object_i::GetMaxShapeType() +{ + return getMinMaxShapeType( _impl->GetValue(), false ); +} + //============================================================================= /*! * SetName @@ -146,7 +216,11 @@ char* GEOM_Object_i::GetName() //============================================================================= void GEOM_Object_i::SetColor(const SALOMEDS::Color& theColor) { - _impl->SetColor(theColor); + ::GEOM_Object::Color aColor; + aColor.R = theColor.R; + aColor.G = theColor.G; + aColor.B = theColor.B; + _impl->SetColor(aColor); } @@ -157,7 +231,11 @@ void GEOM_Object_i::SetColor(const SALOMEDS::Color& theColor) //============================================================================= SALOMEDS::Color GEOM_Object_i::GetColor() { - return _impl->GetColor(); + SALOMEDS::Color aColor; + aColor.R = _impl->GetColor().R; + aColor.G = _impl->GetColor().G; + aColor.B = _impl->GetColor().B; + return aColor; } @@ -183,6 +261,69 @@ CORBA::Boolean GEOM_Object_i::GetAutoColor() } +//============================================================================= +/*! + * SetMarkerStd + */ +//============================================================================= +void GEOM_Object_i::SetMarkerStd(GEOM::marker_type theType, GEOM::marker_size theSize) +{ + if ( theType == GEOM::MT_NONE || theSize == GEOM::MS_NONE ) { + _impl->UnsetMarker(); + } + else { + Aspect_TypeOfMarker aType = (Aspect_TypeOfMarker)( (int)theType-1 ); + double aSize = ((int)theSize+1)*0.5; + _impl->SetMarkerStd( aType, aSize ); + } +} + + +//============================================================================= +/*! + * SetMarkerTexture + */ +//============================================================================= +void GEOM_Object_i::SetMarkerTexture(CORBA::Long theTextureId) +{ + _impl->SetMarkerTexture( theTextureId ); +} + + +//============================================================================= +/*! + * GetMarkerType + */ +//============================================================================= +GEOM::marker_type GEOM_Object_i::GetMarkerType() +{ + return (GEOM::marker_type)( (int)_impl->GetMarkerType()+1 ); +} + + +//============================================================================= +/*! + * GetMarkerSize + */ +//============================================================================= +GEOM::marker_size GEOM_Object_i::GetMarkerSize() +{ + int aSize = (int)( _impl->GetMarkerSize()/0.5 ) - 1; + return aSize < GEOM::MS_10 || aSize > GEOM::MS_70 ? GEOM::MS_NONE : (GEOM::marker_size)aSize; +} + + +//============================================================================= +/*! + * GetMarkerTexture + */ +//============================================================================= +CORBA::Long GEOM_Object_i::GetMarkerTexture() +{ + return _impl->GetMarkerTexture(); +} + + //============================================================================= /*! * SetStudyEntry @@ -230,7 +371,7 @@ GEOM::ListOfGO* GEOM_Object_i::GetDependency() Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(aSeq->Value(i)); if (anObj.IsNull()) continue; TDF_Tool::Entry(anObj->GetEntry(), anEntry); - GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_duplicate(_engine->GetObject(anObj->GetDocID(), anEntry.ToCString())); + GEOM::GEOM_Object_var obj = _engine->GetObject(anObj->GetDocID(), anEntry.ToCString()); aList[i-1] = obj; } @@ -278,23 +419,18 @@ SALOMEDS::TMPFile* GEOM_Object_i::GetShapeStream() if(aShape.IsNull()) return NULL; - ostrstream streamShape; + std::ostringstream streamShape; //Write TopoDS_Shape in ASCII format to the stream BRepTools::Write(aShape, streamShape); //Returns the number of bytes that have been stored in the stream's buffer. - int size = streamShape.pcount(); - char* buf = new char [size]; - //Get pointer on internal character array in ostrstream - char* valueOfStream = streamShape.str(); - //Create copy of ostrstream content - memcpy(buf, valueOfStream, size); - //Allow automatic deletion of ostrstream content - streamShape.rdbuf()->freeze(0); - - CORBA::Octet* OctetBuf = (CORBA::Octet*)buf; + int size = streamShape.str().size(); + //Allocate octect buffer of required size + CORBA::Octet* OctetBuf = SALOMEDS::TMPFile::allocbuf(size); + //Copy ostrstream content to the octect buffer + memcpy(OctetBuf, streamShape.str().c_str(), size); + //Create and return TMPFile SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size,size,OctetBuf,1); return SeqFile._retn(); - } @@ -317,7 +453,7 @@ GEOM::ListOfLong* GEOM_Object_i::GetSubShapeIndices() GEOM::ListOfLong_var anIndices = new GEOM::ListOfLong; if(!_impl->IsMainShape()) { - Handle(GEOM_Function) aFunction = _impl->GetFunction(1); //Get SubShape function (always the first (and last) one) + Handle(GEOM_Function) aFunction = _impl->GetLastFunction(); //Get Sub-shape function (always the first (and last) one) if(aFunction.IsNull()) return anIndices._retn(); GEOM_ISubShape ISS(aFunction); Handle(TColStd_HArray1OfInteger) anArray = ISS.GetIndices(); @@ -342,7 +478,7 @@ GEOM::GEOM_Object_ptr GEOM_Object_i::GetMainShape() { GEOM::GEOM_Object_var obj; if(!_impl->IsMainShape()) { - Handle(GEOM_Function) aFunction = _impl->GetFunction(1); //Get SubShape function (always the first (and last) one) + Handle(GEOM_Function) aFunction = _impl->GetFunction(1); //Get Sub-shape function (always the first (and last) one) if(aFunction.IsNull()) return obj._retn(); GEOM_ISubShape ISS(aFunction); @@ -352,7 +488,7 @@ GEOM::GEOM_Object_ptr GEOM_Object_i::GetMainShape() if(aLabel.IsNull()) return obj._retn(); TCollection_AsciiString anEntry; TDF_Tool::Entry(aLabel, anEntry); - return GEOM::GEOM_Object::_duplicate(_engine->GetObject(_impl->GetDocID(), anEntry.ToCString())); + return _engine->GetObject(_impl->GetDocID(), anEntry.ToCString()); } return obj._retn(); @@ -363,6 +499,18 @@ bool GEOM_Object_i::IsShape() return !_impl->GetValue().IsNull() && _impl->GetType() != GEOM_MARKER; } +bool GEOM_Object_i::IsSame(GEOM::GEOM_Object_ptr other) +{ + TopoDS_Shape thisShape = _impl->GetValue(); + TopoDS_Shape otherShape; + if ( !CORBA::is_nil( other ) ) { + Handle(GEOM_Object) otherObject = GEOM_Engine::GetEngine()->GetObject( other->GetStudyID(), other->GetEntry(), false ); + if ( !otherObject.IsNull() ) + otherShape = otherObject->GetValue(); + } + return thisShape.IsSame( otherShape ); +} + void GEOM_Object_i::SetParameters(const char* theParameters) { _impl->SetParameters((char*)theParameters); diff --git a/src/GEOM_I/GEOM_Object_i.hh b/src/GEOM_I/GEOM_Object_i.hh index 13bb0290f..d52baa1c8 100644 --- a/src/GEOM_I/GEOM_Object_i.hh +++ b/src/GEOM_I/GEOM_Object_i.hh @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_Object_i_HeaderFile #define _GEOM_Object_i_HeaderFile @@ -50,6 +51,12 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual GEOM::shape_type GetShapeType(); + virtual GEOM::shape_type GetTopologyType(); + + virtual GEOM::shape_type GetMinShapeType(); + + virtual GEOM::shape_type GetMaxShapeType(); + virtual void SetName(const char* theName); virtual char* GetName(); @@ -62,6 +69,16 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual CORBA::Boolean GetAutoColor(); + void SetMarkerStd(GEOM::marker_type theType, GEOM::marker_size theSize); + + void SetMarkerTexture(CORBA::Long theTextureId); + + GEOM::marker_type GetMarkerType(); + + GEOM::marker_size GetMarkerSize(); + + CORBA::Long GetMarkerTexture(); + virtual void SetStudyEntry(const char* theEntry); virtual char* GetStudyEntry(); @@ -80,6 +97,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual GEOM::GEOM_Object_ptr GetMainShape(); + virtual bool IsSame(GEOM::GEOM_Object_ptr other); + virtual bool IsShape(); virtual void SetParameters(const char* theParameters); diff --git a/src/GEOM_I/Makefile.am b/src/GEOM_I/Makefile.am index 445804206..dfdba30a5 100644 --- a/src/GEOM_I/Makefile.am +++ b/src/GEOM_I/Makefile.am @@ -1,31 +1,29 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM : implementaion of GEOM_Gen.idl # File : Makefile.in # Author : Patrick GOLDBRONN (CEA) # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM # $Header$ -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # Libraries targets @@ -47,6 +45,7 @@ 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 @@ -65,6 +64,7 @@ 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 @@ -81,8 +81,7 @@ libGEOMEngine_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMAlgo \ -I$(srcdir)/../GEOM \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOMEngine_la_LDFLAGS = \ @@ -91,7 +90,7 @@ libGEOMEngine_la_LDFLAGS = \ ../GEOMImpl/libGEOMimpl.la \ ../SKETCHER/libGEOMSketcher.la \ ../GEOM/libGEOMbasic.la \ - $(KERNEL_LDFLAGS) -lSalomeNS -lSalomeContainer -lSalomeGenericObj -lTOOLSDS \ + $(KERNEL_LDFLAGS) -lOpUtil -lSalomeNS -lSalomeContainer -lSalomeGenericObj -lTOOLSDS \ $(CAS_DATAEXCHANGE) \ $(CAS_LDPATH) -lTKFillet -lTKOffset diff --git a/src/GEOM_I_Superv/GEOM_I_Superv.hxx b/src/GEOM_I_Superv/GEOM_I_Superv.hxx new file mode 100755 index 000000000..a32e932bf --- /dev/null +++ b/src/GEOM_I_Superv/GEOM_I_Superv.hxx @@ -0,0 +1,41 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOM_I_Superv.hxx +// Author : Roman NIKOLAEV +// Module : GEOM +// +#ifndef _GEOM_I_SUPERV_HXX_ +#define _GEOM_I_SUPERV_HXX_ + +#if defined WIN32 +# if defined GEOM_I_Superv_EXPORTS || defined GEOM_SupervEngine_EXPORTS +# define GEOM_I_SUPERV_EXPORT __declspec( dllexport ) +# else +# define GEOM_I_SUPERV_EXPORT __declspec( dllimport ) +# endif +#else +# define GEOM_I_SUPERV_EXPORT +#endif + + +#endif //_GEOM_I_SUPERV_HXX_ diff --git a/src/GEOM_I_Superv/GEOM_List_i.hh b/src/GEOM_I_Superv/GEOM_List_i.hh index 292cb4fb9..beea9ee4b 100644 --- a/src/GEOM_I_Superv/GEOM_List_i.hh +++ b/src/GEOM_I_Superv/GEOM_List_i.hh @@ -1,36 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef __GEOM_LIST_I_H__ #define __GEOM_LIST_I_H__ +#include "GEOM_I_Superv.hxx" + // IDL headers #include #include CORBA_SERVER_HEADER(GEOM_Superv) -#include "GEOM_Gen_i.hh" #include "utilities.h" template -class GEOM_List_i : +class GEOM_I_SUPERV_EXPORT GEOM_List_i : public virtual POA_GEOM::GEOM_List, public virtual PortableServer::RefCountServantBase { diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 159bb6f49..b3c2cf038 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1,24 +1,24 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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_Superv_i.hh" #include "SALOME_LifeCycleCORBA.hxx" @@ -27,15 +27,14 @@ #define isNewStudy(a,b) (a > 0 && a != b) -using namespace std; //============================================================================= // constructor: //============================================================================= GEOM_Superv_i::GEOM_Superv_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName) : + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName) { MESSAGE("GEOM_Superv_i::GEOM_Superv_i"); @@ -72,22 +71,22 @@ GEOM_Superv_i::~GEOM_Superv_i() { MESSAGE("GEOM_Superv_i::~GEOM_Superv_i"); if (!CORBA::is_nil(myBasicOp)) - myBasicOp->Destroy(); + myBasicOp->UnRegister(); if (!CORBA::is_nil(myBoolOp)) - myBoolOp->Destroy(); + myBoolOp->UnRegister(); if (!CORBA::is_nil(my3DPrimOp)) - my3DPrimOp->Destroy(); + my3DPrimOp->UnRegister(); delete name_service; } //============================================================================ -// function : register() +// function : register() // purpose : register 'name' in 'name_service' //============================================================================ void GEOM_Superv_i::register_name(char * name) { GEOM::GEOM_Superv_var g = _this(); - name_service->Register(g, name); + name_service->Register(g, name); } //============================================================================= @@ -95,7 +94,7 @@ void GEOM_Superv_i::register_name(char * name) //============================================================================= void GEOM_Superv_i::setGeomEngine() { - if ( !CORBA::is_nil(myGeomEngine) ) + if ( !CORBA::is_nil(myGeomEngine) ) return; // get GEOM_Gen engine @@ -104,7 +103,7 @@ void GEOM_Superv_i::setGeomEngine() std::string shortName=container_name.in(); shortName=shortName.substr(12); // substract "/Containers/" SALOME_LifeCycleCORBA* lcc = new SALOME_LifeCycleCORBA( name_service ); - Engines::Component_var comp = lcc->FindOrLoad_Component( shortName.c_str(), "GEOM" ); + Engines::EngineComponent_var comp = lcc->FindOrLoad_Component( shortName.c_str(), "GEOM" ); delete lcc; myGeomEngine = GEOM::GEOM_Gen::_narrow(comp); @@ -124,30 +123,30 @@ void GEOM_Superv_i::SetStudyID( CORBA::Long theId ) if ( !CORBA::is_nil(aSession) ) { int aStudyID = aSession->GetActiveStudyId(); if ( theId != aStudyID && aStudyID > 0) { // mkr : IPAL12128 - MESSAGE("Warning : given study ID theId="<object_to_string( myGeomEngine ); - + std::string anEngine = _orb->object_to_string( myGeomEngine ); + CORBA::Object_var anObj = name_service->Resolve("/myStudyManager"); if ( !CORBA::is_nil(anObj) ) { SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(anObj); if ( !CORBA::is_nil(aStudyManager) ) { - _PTR(Study) aDSStudy = ClientFactory::Study(aStudyManager->GetStudyByID(myStudyID)); - if ( aDSStudy ) { - _PTR(SComponent) aSCO = aDSStudy->FindComponent(myGeomEngine->ComponentDataType()); - if ( aSCO ) { - _PTR(StudyBuilder) aBuilder = aDSStudy->NewBuilder(); - if ( aBuilder ) aBuilder->LoadWith( aSCO, anEngine ); - } - } + _PTR(Study) aDSStudy = ClientFactory::Study(aStudyManager->GetStudyByID(myStudyID)); + if ( aDSStudy ) { + _PTR(SComponent) aSCO = aDSStudy->FindComponent(myGeomEngine->ComponentDataType()); + if ( aSCO ) { + _PTR(StudyBuilder) aBuilder = aDSStudy->NewBuilder(); + if ( aBuilder ) aBuilder->LoadWith( aSCO, anEngine ); + } + } } } } @@ -167,13 +166,14 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::CreateListOfGO() //============================================================================= // AddItemToListOfGO: //============================================================================= -void GEOM_Superv_i::AddItemToListOfGO(GEOM::GEOM_List_ptr& theList, - GEOM::GEOM_Object_ptr theObject) +void GEOM_Superv_i::AddItemToListOfGO(GEOM::GEOM_List_ptr& theList, + GEOM::GEOM_Object_ptr theObject) { MESSAGE("GEOM_Superv_i::AddItemToListOfGO(...)"); - if (GEOM_List_i* aList = + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate(theObject); + if (GEOM_List_i* aList = dynamic_cast*>(GetServant(theList, myPOA).in())) { - aList->AddObject(theObject); + aList->AddObject(anObj); MESSAGE(" NewLength = "<GetList().length()); } } @@ -191,11 +191,11 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::CreateListOfLong() //============================================================================= // AddItemToListOfLong: //============================================================================= -void GEOM_Superv_i::AddItemToListOfLong(GEOM::GEOM_List_ptr& theList, - CORBA::Long theObject) +void GEOM_Superv_i::AddItemToListOfLong(GEOM::GEOM_List_ptr& theList, + CORBA::Long theObject) { MESSAGE("GEOM_Superv_i::AddItemToListOfLong(...)"); - if (GEOM_List_i* aList = + if (GEOM_List_i* aList = dynamic_cast*>(GetServant(theList, myPOA).in())) { aList->AddObject(theObject); MESSAGE(" NewLength = "<GetList().length()); @@ -215,11 +215,11 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::CreateListOfDouble() //============================================================================= // AddItemToListOfDouble: //============================================================================= -void GEOM_Superv_i::AddItemToListOfDouble(GEOM::GEOM_List_ptr& theList, - CORBA::Double theObject) +void GEOM_Superv_i::AddItemToListOfDouble(GEOM::GEOM_List_ptr& theList, + CORBA::Double theObject) { MESSAGE("GEOM_Superv_i::AddItemToListOfDouble(...)"); - if (GEOM_List_i* aList = + if (GEOM_List_i* aList = dynamic_cast*>(GetServant(theList, myPOA).in())) { aList->AddObject(theObject); MESSAGE(" NewLength = "<GetList().length()); @@ -234,8 +234,12 @@ void GEOM_Superv_i::getBasicOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_IBasicOperations interface - if (CORBA::is_nil(myBasicOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myBasicOp) || 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); myBasicOp = myGeomEngine->GetIBasicOperations(myStudyID); + } } //============================================================================= @@ -246,8 +250,12 @@ void GEOM_Superv_i::get3DPrimOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_I3DPrimOperations interface - if (CORBA::is_nil(my3DPrimOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(my3DPrimOp) || 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); my3DPrimOp = myGeomEngine->GetI3DPrimOperations(myStudyID); + } } //============================================================================= @@ -258,8 +266,12 @@ void GEOM_Superv_i::getBoolOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_IBooleanOperations interface - if (CORBA::is_nil(myBoolOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myBoolOp) || 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); myBoolOp = myGeomEngine->GetIBooleanOperations(myStudyID); + } } //============================================================================= @@ -270,8 +282,12 @@ void GEOM_Superv_i::getInsOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_IInsertOperations interface - if (CORBA::is_nil(myInsOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myInsOp) || 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); myInsOp = myGeomEngine->GetIInsertOperations(myStudyID); + } } //============================================================================= @@ -282,8 +298,12 @@ void GEOM_Superv_i::getTransfOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_ITransformOperations interface - if (CORBA::is_nil(myTransfOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myTransfOp) || 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); myTransfOp = myGeomEngine->GetITransformOperations(myStudyID); + } } //============================================================================= @@ -294,8 +314,12 @@ void GEOM_Superv_i::getShapesOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_IShapesOperations interface - if (CORBA::is_nil(myShapesOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myShapesOp) || 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); myShapesOp = myGeomEngine->GetIShapesOperations(myStudyID); + } } //============================================================================= @@ -306,8 +330,12 @@ void GEOM_Superv_i::getBlocksOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_IBlocksOperations interface - if (CORBA::is_nil(myBlocksOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myBlocksOp) || 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); myBlocksOp = myGeomEngine->GetIBlocksOperations(myStudyID); + } } //============================================================================= @@ -318,8 +346,12 @@ void GEOM_Superv_i::getCurvesOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_ICurvesOperations interface - if (CORBA::is_nil(myCurvesOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myCurvesOp) || 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); myCurvesOp = myGeomEngine->GetICurvesOperations(myStudyID); + } } //============================================================================= @@ -330,8 +362,12 @@ void GEOM_Superv_i::getLocalOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_ILocalOperations interface - if (CORBA::is_nil(myLocalOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myLocalOp) || 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); myLocalOp = myGeomEngine->GetILocalOperations(myStudyID); + } } //============================================================================= @@ -342,15 +378,35 @@ void GEOM_Superv_i::getGroupOp() if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); // get GEOM_IGroupOperations interface - if (CORBA::is_nil(myGroupOp) || isNewStudy(myLastStudyID,myStudyID)) + if (CORBA::is_nil(myGroupOp) || 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); myGroupOp = myGeomEngine->GetIGroupOperations(myStudyID); + } +} + +//============================================================================= +// getAdvancedOp: +//============================================================================= +void GEOM_Superv_i::getAdvancedOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IAdvancedOperations interface + 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); + } } //============================================================================= // GetServant: //============================================================================= PortableServer::ServantBase_var GEOM_Superv_i::GetServant(CORBA::Object_ptr theObject, - PortableServer::POA_ptr thePOA) + PortableServer::POA_ptr thePOA) { if(CORBA::is_nil(theObject)) return NULL; PortableServer::Servant aServant = thePOA->reference_to_servant(theObject); @@ -362,8 +418,8 @@ PortableServer::ServantBase_var GEOM_Superv_i::GetServant(CORBA::Object_ptr // purpose : save OCAF/Geom document //============================================================================ SALOMEDS::TMPFile* GEOM_Superv_i::Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - CORBA::Boolean isMultiFile) + const char* theURL, + CORBA::Boolean isMultiFile) { SALOMEDS::TMPFile_var aStreamFile; return aStreamFile._retn(); @@ -372,10 +428,10 @@ SALOMEDS::TMPFile* GEOM_Superv_i::Save(SALOMEDS::SComponent_ptr theComponent, //============================================================================ // function : SaveASCII() // purpose : -//============================================================================ +//============================================================================ SALOMEDS::TMPFile* GEOM_Superv_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - CORBA::Boolean isMultiFile) + const char* theURL, + CORBA::Boolean isMultiFile) { SALOMEDS::TMPFile_var aStreamFile; return aStreamFile._retn(); @@ -384,11 +440,11 @@ SALOMEDS::TMPFile* GEOM_Superv_i::SaveASCII(SALOMEDS::SComponent_ptr theComponen //============================================================================ // function : Load() // purpose : -//============================================================================ +//============================================================================ CORBA::Boolean GEOM_Superv_i::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile) + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile) { return false; } @@ -396,11 +452,11 @@ CORBA::Boolean GEOM_Superv_i::Load(SALOMEDS::SComponent_ptr theComponent, //============================================================================ // function : LoadASCII() // purpose : -//============================================================================ +//============================================================================ CORBA::Boolean GEOM_Superv_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile) + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile) { return false; } @@ -427,9 +483,9 @@ char* GEOM_Superv_i::ComponentDataType() // purpose : //============================================================================ char* GEOM_Superv_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { return 0; } @@ -441,16 +497,16 @@ char* GEOM_Superv_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, // : The IOR (IORName) of object created is returned //============================================================================ char* GEOM_Superv_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { return 0; } //============================================================================ // function : CanPublishInStudy -// purpose : +// purpose : //============================================================================ CORBA::Boolean GEOM_Superv_i::CanPublishInStudy(CORBA::Object_ptr theIOR) { @@ -461,18 +517,32 @@ CORBA::Boolean GEOM_Superv_i::CanPublishInStudy(CORBA::Object_ptr theIOR) //============================================================================ // function : PublishInStudy -// purpose : +// purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Superv_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) throw (SALOME::SALOME_Exception) + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) { if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); return myGeomEngine->PublishInStudy(theStudy, theSObject, theObject, theName); } +//============================================================================ +// function : PublishNamedShapesInStudy +// purpose : +//============================================================================ +GEOM::ListOfGO* +GEOM_Superv_i::PublishNamedShapesInStudy(SALOMEDS::Study_ptr theStudy, + //SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject) +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + return myGeomEngine->PublishNamedShapesInStudy(theStudy, theObject); +} + //============================================================================ // function : CanCopy() // purpose : @@ -506,8 +576,8 @@ CORBA::Boolean GEOM_Superv_i::CanPaste(const char* theComponentName, CORBA::Long // purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Superv_i::PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject) + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject) { SALOMEDS::SObject_var aNewSO; return aNewSO._retn(); @@ -518,8 +588,8 @@ SALOMEDS::SObject_ptr GEOM_Superv_i::PasteInto(const SALOMEDS::TMPFile& theStrea // MakePointXYZ: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointXYZ(CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ) + CORBA::Double theY, + CORBA::Double theZ) { beginService( " GEOM_Superv_i::MakePointXYZ" ); MESSAGE("GEOM_Superv_i::MakePointXYZ"); @@ -534,9 +604,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointXYZ(CORBA::Double theX, // MakePointWithReference: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointWithReference (GEOM::GEOM_Object_ptr theReference, - CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ) + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ) { beginService( " GEOM_Superv_i::MakePointWithReference" ); MESSAGE("GEOM_Superv_i::MakePointWithReference"); @@ -550,7 +620,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointWithReference (GEOM::GEOM_Object_p // MakePointOnCurve: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve, - CORBA::Double theParameter) + CORBA::Double theParameter) { beginService( " GEOM_Superv_i::MakePointOnCurve" ); MESSAGE("GEOM_Superv_i::MakePointOnCurve"); @@ -560,11 +630,78 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the return anObj; } +//============================================================================= +// MakePointOnCurveByLength: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint) +{ + beginService( " GEOM_Superv_i::MakePointOnCurveByLength" ); + MESSAGE("GEOM_Superv_i::MakePointOnCurveByLength"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint); + endService( " GEOM_Superv_i::MakePointOnCurveByLength" ); + return anObj; +} + +//============================================================================= +// MakePointOnCurveByCoord +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter) +{ + beginService( " GEOM_Superv_i::MakePointOnCurveByCoord" ); + MESSAGE("GEOM_Superv_i::MakePointOnCurveByCoord"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = + myBasicOp->MakePointOnCurveByCoord(theRefCurve, theXParameter, + theYParameter, theZParameter); + endService( " GEOM_Superv_i::MakePointOnCurveByCoord" ); + return anObj; +} + +//============================================================================= +// MakePointOnSurface: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnSurface (GEOM::GEOM_Object_ptr theRefSurface, + CORBA::Double theUParameter, + CORBA::Double theVParameter) +{ + beginService( " GEOM_Superv_i::MakePointOnSurface" ); + MESSAGE("GEOM_Superv_i::MakePointOnSurface"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = + myBasicOp->MakePointOnSurface(theRefSurface, theUParameter, theVParameter); + endService( " GEOM_Superv_i::MakePointOnSurface" ); + return anObj; +} + +//============================================================================= +// MakePointOnSurfaceByCoord +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnSurfaceByCoord (GEOM::GEOM_Object_ptr theRefSurface, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter) +{ + beginService( " GEOM_Superv_i::MakePointOnSurfaceByCoord" ); + MESSAGE("GEOM_Superv_i::MakePointOnSurfaceByCoord"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = + myBasicOp->MakePointOnSurfaceByCoord(theRefSurface, theXParameter, + theYParameter, theZParameter); + endService( " GEOM_Superv_i::MakePointOnSurfaceByCoord" ); + return anObj; +} + //============================================================================= // MakePointOnLinesIntersection: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theRefLine1, - GEOM::GEOM_Object_ptr theRefLine2) + GEOM::GEOM_Object_ptr theRefLine2) { beginService( " GEOM_Superv_i::MakePointOnLinesIntersection" ); MESSAGE("GEOM_Superv_i::MakePointOnLinesIntersection"); @@ -578,7 +715,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnLinesIntersection (GEOM::GEOM_Ob // MakeTangentOnCurve: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve, - CORBA::Double theParameter) + CORBA::Double theParameter) { beginService( " GEOM_Superv_i::MakeTangentOnCurve" ); MESSAGE("GEOM_Superv_i::MakeTangentOnCurve"); @@ -592,8 +729,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentOnCurve (GEOM::GEOM_Object_ptr t // MakeVectorDXDYDZ: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeVectorDXDYDZ (CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ) + CORBA::Double theDY, + CORBA::Double theDZ) { beginService( " GEOM_Superv_i::MakeVectorDXDYDZ" ); MESSAGE("GEOM_Superv_i::MakeVectorDXDYDZ"); @@ -607,7 +744,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeVectorDXDYDZ (CORBA::Double theDX, // MakeVectorTwoPnt: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeVectorTwoPnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2) + GEOM::GEOM_Object_ptr thePnt2) { beginService( " GEOM_Superv_i::MakeVectorTwoPnt" ); MESSAGE("GEOM_Superv_i::MakeVector"); @@ -621,7 +758,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeVectorTwoPnt (GEOM::GEOM_Object_ptr the // MakeLineTwoPnt: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2) + GEOM::GEOM_Object_ptr thePnt2) { beginService( " GEOM_Superv_i::MakeLineTwoPnt"); MESSAGE("GEOM_Superv_i::MakeLineTwoPnt"); @@ -635,7 +772,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePn // MakeLineTwoFaces: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1, - GEOM::GEOM_Object_ptr theFace2) + GEOM::GEOM_Object_ptr theFace2) { beginService( " GEOM_Superv_i::MakeLineTwoFaces"); MESSAGE("GEOM_Superv_i::MakeLineTwoFaces"); @@ -649,9 +786,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoFaces (GEOM::GEOM_Object_ptr the // MakePlaneThreePnt: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3, - CORBA::Double theTrimSize) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + CORBA::Double theTrimSize) { beginService( " GEOM_Superv_i::MakePlaneThreePnt"); MESSAGE("GEOM_Superv_i::MakePlaneThreePnt"); @@ -665,9 +802,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneThreePnt (GEOM::GEOM_Object_ptr th // MakePlanePntVec: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlanePntVec (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theTrimSize) -{ + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theTrimSize) +{ beginService( " GEOM_Superv_i::MakePlanePntVec" ); MESSAGE("GEOM_Superv_i::MakePlanePntVec"); getBasicOp(); @@ -680,7 +817,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlanePntVec (GEOM::GEOM_Object_ptr theP // MakePlaneFace: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneFace (GEOM::GEOM_Object_ptr theFace, - CORBA::Double theTrimSize) + CORBA::Double theTrimSize) { beginService( " GEOM_Superv_i::MakePlaneFace" ); MESSAGE("GEOM_Superv_i::MakePlaneFace"); @@ -690,10 +827,40 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneFace (GEOM::GEOM_Object_ptr theFac return anObj; } +//============================================================================= +// MakePlane2Vec: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlane2Vec (GEOM::GEOM_Object_ptr theVec1, + GEOM::GEOM_Object_ptr theVec2, + CORBA::Double theTrimSize) +{ + beginService( " GEOM_Superv_i::MakePlane2Vec" ); + MESSAGE("GEOM_Superv_i::MakePlane2Vec"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePlane2Vec(theVec1, theVec2, theTrimSize); + endService( " GEOM_Superv_i::MakePlane2Vec" ); + return anObj; +} + +//============================================================================= +// MakePlaneLCS: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneLCS (GEOM::GEOM_Object_ptr theLCS, + CORBA::Double theTrimSize, + CORBA::Double theOrientation) +{ + beginService( " GEOM_Superv_i::MakePlaneLCS" ); + MESSAGE("GEOM_Superv_i::MakePlaneLCS"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePlaneLCS(theLCS, theTrimSize, theOrientation); + endService( " GEOM_Superv_i::MakePlaneLCS" ); + return anObj; +} + //============================================================================= // MakeMarker: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarker +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarker (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ, CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ) @@ -706,13 +873,41 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarker return anObj; } +//============================================================================= +// MakeMarkerFromShape: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarkerFromShape (GEOM::GEOM_Object_ptr theShape) +{ + beginService( " GEOM_Superv_i::MakeMarkerFromShape" ); + MESSAGE("GEOM_Superv_i::MakeMarkerFromShape"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakeMarkerFromShape(theShape); + endService( " GEOM_Superv_i::MakeMarkerFromShape" ); + return anObj; +} + +//============================================================================= +// MakeMarkerPntTwoVec: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarkerPntTwoVec (GEOM::GEOM_Object_ptr theOrigin, + GEOM::GEOM_Object_ptr theXVec, + GEOM::GEOM_Object_ptr theYVec) +{ + beginService( " GEOM_Superv_i::MakeMarkerPntTwoVec" ); + MESSAGE("GEOM_Superv_i::MakeMarkerPntTwoVec"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec); + endService( " GEOM_Superv_i::MakeMarkerPntTwoVec" ); + return anObj; +} + //============================================================================= // MakeTangentPlaneOnFace: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, - CORBA::Double theParameterU, - CORBA::Double theParameterV, - CORBA::Double theTrimSize) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theParameterU, + CORBA::Double theParameterV, + CORBA::Double theTrimSize) { beginService( " GEOM_Superv_i::MakeTangentPlaneOnFace" ); MESSAGE("GEOM_Superv_i::MakeTangentPlaneOnFace"); @@ -727,18 +922,18 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentPlaneOnFace (GEOM::GEOM_Object_p // MakeBox: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBox (CORBA::Double theX1, - CORBA::Double theY1, - CORBA::Double theZ1, - CORBA::Double theX2, - CORBA::Double theY2, - CORBA::Double theZ2) + CORBA::Double theY1, + CORBA::Double theZ1, + CORBA::Double theX2, + CORBA::Double theY2, + CORBA::Double theZ2) { beginService( " GEOM_Superv_i::MakeBox" ); MESSAGE("GEOM_Superv_i::MakeBox"); getBasicOp(); get3DPrimOp(); GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeBoxTwoPnt(myBasicOp->MakePointXYZ(theX1, theY1, theZ1), - myBasicOp->MakePointXYZ(theX2, theY2, theZ2)); + myBasicOp->MakePointXYZ(theX2, theY2, theZ2)); endService( " GEOM_Superv_i::MakeBox" ); return anObj; } @@ -746,9 +941,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBox (CORBA::Double theX1, //============================================================================= // MakeBoxDXDYDZ: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxDXDYDZ (CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) { beginService( " GEOM_Superv_i::MakeBoxDXDYDZ" ); MESSAGE("GEOM_Superv_i::MakeBoxDXDYDZ"); @@ -761,8 +956,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxDXDYDZ (CORBA::Double theDX, //============================================================================= // MakeBoxTwoPnt: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2) { beginService( " GEOM_Superv_i::MakeBoxTwoPnt" ); MESSAGE("GEOM_Superv_i::MakeBoxTwoPnt"); @@ -776,8 +971,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt // MakeFaceHW: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceHW (CORBA::Double theH, - CORBA::Double theW, - CORBA::Short theOrientation) + CORBA::Double theW, + CORBA::Short theOrientation) { beginService( " GEOM_Superv_i::MakeFaceHW" ); MESSAGE("GEOM_Superv_i::MakeFaceHW"); @@ -790,9 +985,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceHW (CORBA::Double theH, //============================================================================= // MakeFaceObjHW: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj, - CORBA::Double theH, - CORBA::Double theW) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj, + CORBA::Double theH, + CORBA::Double theW) { beginService( " GEOM_Superv_i::MakeFaceObjHW" ); MESSAGE("GEOM_Superv_i::MakeFaceObjHW"); @@ -806,8 +1001,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj // MakeDiskPntVecR: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theR) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR) { beginService( " GEOM_Superv_i::MakeDiskPntVecR" ); MESSAGE("GEOM_Superv_i::MakeDiskPntVecR"); @@ -821,8 +1016,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskPntVecR (GEOM::GEOM_Object_ptr theC // MakeDiskThreePnt: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskThreePnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) { beginService( " GEOM_Superv_i::MakeDiskThreePnt" ); MESSAGE("GEOM_Superv_i::MakeDiskThreePnt"); @@ -836,7 +1031,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskThreePnt (GEOM::GEOM_Object_ptr the // MakeDiskR: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskR (CORBA::Double theR, - CORBA::Short theOrientation) + CORBA::Short theOrientation) { beginService( " GEOM_Superv_i::MakeDiskR" ); MESSAGE("GEOM_Superv_i::MakeDiskR"); @@ -850,9 +1045,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskR (CORBA::Double theR, // MakeCylinderPntVecRH: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theRadius, - CORBA::Double theHeight) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + CORBA::Double theHeight) { beginService( " GEOM_Superv_i::MakeCylinderPntVecRH" ); MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRH"); @@ -865,24 +1060,24 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr //============================================================================= // MakeCylinderRH: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR, - CORBA::Double theH) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR, + CORBA::Double theH) { beginService( " GEOM_Superv_i::MakeCylinderRH" ); MESSAGE("GEOM_Superv_i::MakeCylinderRH"); get3DPrimOp(); GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRH(theR, theH); endService( " GEOM_Superv_i::MakeCylinderRH" ); - return anObj; + return anObj; } //============================================================================= // MakeSphere: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSphere (CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ, - CORBA::Double theRadius) + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theRadius) { beginService( " GEOM_Superv_i::MakeSphepe" ); MESSAGE("GEOM_Superv_i::MakeSphepe"); @@ -909,8 +1104,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSphereR (CORBA::Double theR) //============================================================================= // MakeSpherePntR: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSpherePntR (GEOM::GEOM_Object_ptr thePnt, - CORBA::Double theR) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSpherePntR (GEOM::GEOM_Object_ptr thePnt, + CORBA::Double theR) { beginService( " GEOM_Superv_i::MakeSpherePntR" ); MESSAGE("GEOM_Superv_i::MakeSpherePntR"); @@ -924,9 +1119,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSpherePntR (GEOM::GEOM_Object_ptr thePn // MakeTorusPntVecRR: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTorusPntVecRR (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theRMajor, - CORBA::Double theRMinor) + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, + CORBA::Double theRMinor) { beginService( " GEOM_Superv_i::MakeTorusPntVecRR" ); MESSAGE("GEOM_Superv_i::MakeTorusPntVecRR"); @@ -940,7 +1135,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTorusPntVecRR (GEOM::GEOM_Object_ptr th // MakeTorusRR: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTorusRR (CORBA::Double theRMajor, - CORBA::Double theRMinor) + CORBA::Double theRMinor) { beginService( " GEOM_Superv_i::MakeTorusRR" ); MESSAGE("GEOM_Superv_i::MakeTorusRR"); @@ -954,10 +1149,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTorusRR (CORBA::Double theRMajor, // MakeConePntVecR1R2H: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeConePntVecR1R2H (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theR1, - CORBA::Double theR2, - CORBA::Double theHeight) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight) { beginService( " GEOM_Superv_i::MakeConePntVecR1R2H" ); MESSAGE("GEOM_Superv_i::MakeConePntVecR1R2H"); @@ -970,9 +1165,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeConePntVecR1R2H (GEOM::GEOM_Object_ptr //============================================================================= // MakeConeR1R2H: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeConeR1R2H (CORBA::Double theR1, - CORBA::Double theR2, - CORBA::Double theHeight) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeConeR1R2H (CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight) { beginService( " GEOM_Superv_i::MakeConeR1R2H" ); MESSAGE("GEOM_Superv_i::MakeConeR1R2H"); @@ -986,8 +1181,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeConeR1R2H (CORBA::Double theR1, // MakePrismVecH: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theH) + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH) { beginService( " GEOM_Superv_i::MakePrismVecH" ); MESSAGE("GEOM_Superv_i::MakePrismVecH"); @@ -1001,8 +1196,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH (GEOM::GEOM_Object_ptr theBas // MakePrismVecH2Ways: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theH) + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH) { beginService( " GEOM_Superv_i::MakePrismVecH2Ways" ); MESSAGE("GEOM_Superv_i::MakePrismVecH2Ways"); @@ -1016,8 +1211,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH2Ways (GEOM::GEOM_Object_ptr t // MakePrismTwoPnt: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { beginService( " GEOM_Superv_i::MakePrismTwoPnt" ); MESSAGE("GEOM_Superv_i::MakePrismTwoPnt"); @@ -1031,8 +1226,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt (GEOM::GEOM_Object_ptr theB // MakePrismTwoPnt2Ways: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { beginService( " GEOM_Superv_i::MakePrismTwoPnt2Ways" ); MESSAGE("GEOM_Superv_i::MakePrismTwoPnt2Ways"); @@ -1046,7 +1241,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr // MakePrismDXDYDZ: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theBase, - CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) + CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) { beginService( " GEOM_Superv_i::MakePrismDXDYDZ" ); MESSAGE("GEOM_Superv_i::MakePrismDXDYDZ"); @@ -1060,7 +1255,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theB // MakePrismDXDYDZ: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismDXDYDZ2Ways (GEOM::GEOM_Object_ptr theBase, - CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) + CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) { beginService( " GEOM_Superv_i::MakePrismDXDYDZ2Ways" ); MESSAGE("GEOM_Superv_i::MakePrismDXDYDZ2Ways"); @@ -1073,8 +1268,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismDXDYDZ2Ways (GEOM::GEOM_Object_ptr //============================================================================= // MakePipe: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipe (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePath) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipe (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath) { beginService( " GEOM_Superv_i::MakePipe" ); MESSAGE("GEOM_Superv_i::MakePipe"); @@ -1088,8 +1283,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipe (GEOM::GEOM_Object_ptr theBase, // MakeRevolutionAxisAngle: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) { beginService( " GEOM_Superv_i::MakeRevolutionAxisAngle" ); MESSAGE("GEOM_Superv_i::MakeRevolutionAxisAngle"); @@ -1103,8 +1298,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle (GEOM::GEOM_Object_ // MakeRevolutionAxisAngle: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) { beginService( " GEOM_Superv_i::MakeRevolutionAxisAngle2Ways" ); MESSAGE("GEOM_Superv_i::MakeRevolutionAxisAngle2Ways"); @@ -1118,14 +1313,20 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Ob // MakeFilling: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theMinDeg, CORBA::Long theMaxDeg, - CORBA::Double theTol2D, CORBA::Double theTol3D, - CORBA::Long theNbIter, CORBA::Boolean theApprox) + CORBA::Long theMinDeg, + CORBA::Long theMaxDeg, + CORBA::Double theTol2D, + CORBA::Double theTol3D, + CORBA::Long theNbIter, + GEOM::filling_oper_method theMethod, + CORBA::Boolean theApprox) { beginService( " GEOM_Superv_i::MakeFilling" ); MESSAGE("GEOM_Superv_i::MakeFilling"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox); + GEOM::GEOM_Object_ptr anObj = + my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, + theNbIter, theMethod, theApprox); endService( " GEOM_Superv_i::MakeFilling" ); return anObj; } @@ -1135,8 +1336,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape // MakeBoolean: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2, - CORBA::Long theOperation) + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOperation) { beginService( " GEOM_Superv_i::MakeBoolean" ); // theOperation indicates the operation to be done: @@ -1152,9 +1353,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape // MakeThruSections: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections, - CORBA::Boolean theModeSolid, - CORBA::Double thePreci, - CORBA::Boolean theRuled) + CORBA::Boolean theModeSolid, + CORBA::Double thePreci, + CORBA::Boolean theRuled) { beginService( " GEOM_Superv_i::MakeThruSections" ); MESSAGE("GEOM_Superv_i::MakeThruSections"); @@ -1169,10 +1370,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeThruSections(const GEOM::ListOfGO& theS //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections (const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theLocations, - GEOM::GEOM_Object_ptr thePath, - CORBA::Boolean theWithContact, - CORBA::Boolean theWithCorrections) + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) { beginService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections"); @@ -1188,19 +1389,19 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithShellSections (const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theSubBases, - const GEOM::ListOfGO& theLocations, - GEOM::GEOM_Object_ptr thePath, - CORBA::Boolean theWithContact, - CORBA::Boolean theWithCorrections) + const GEOM::ListOfGO& theSubBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) { beginService( " GEOM_Superv_i::MakePipeWithShellSections" ); MESSAGE("GEOM_Superv_i::MakePipeWithShellSections"); get3DPrimOp(); GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipeWithShellSections(theBases, theSubBases, - theLocations, thePath, - theWithContact, theWithCorrections); + theLocations, thePath, + theWithContact, theWithCorrections); endService( " GEOM_Superv_i::MakePipeWithShellSections" ); return anObj; } @@ -1211,7 +1412,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithShellSections //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeShellsWithoutPath (const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theLocations) + const GEOM::ListOfGO& theLocations) { beginService( " GEOM_Superv_i::MakePipeShellsWithoutPath" ); MESSAGE("GEOM_Superv_i::MakePipeShellsWithoutPath"); @@ -1226,15 +1427,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeShellsWithoutPath //============================================================================= // MakePipe: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeBiNormalAlongVector - (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePath, - GEOM::GEOM_Object_ptr theVec) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeBiNormalAlongVector + (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath, + GEOM::GEOM_Object_ptr theVec) { beginService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" ); MESSAGE("GEOM_Superv_i::MakePipeBiNormalAlongVector"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipeBiNormalAlongVector(theBase, thePath, theVec); endService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" ); return anObj; @@ -1245,7 +1446,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeBiNormalAlongVector // MakeFuse: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFuse (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2) + GEOM::GEOM_Object_ptr theShape2) { beginService( " GEOM_Superv_i::MakeFuse" ); MESSAGE("GEOM_Superv_i::MakeFuse"); @@ -1259,33 +1460,33 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFuse (GEOM::GEOM_Object_ptr theShape1, // MakePartition: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr theShapes, - GEOM::GEOM_List_ptr theTools, - GEOM::GEOM_List_ptr theKeepInside, - GEOM::GEOM_List_ptr theRemoveInside, - CORBA::Short theLimit, - CORBA::Boolean theRemoveWebs, - GEOM::GEOM_List_ptr theMaterials, - CORBA::Short theKeepNonlimitShapes) + GEOM::GEOM_List_ptr theTools, + GEOM::GEOM_List_ptr theKeepInside, + GEOM::GEOM_List_ptr theRemoveInside, + CORBA::Short theLimit, + CORBA::Boolean theRemoveWebs, + GEOM::GEOM_List_ptr theMaterials, + CORBA::Short theKeepNonlimitShapes) { beginService( " GEOM_Superv_i::MakePartition" ); MESSAGE("GEOM_Superv_i::MakePartition"); - GEOM_List_i* aListImplS = + GEOM_List_i* aListImplS = dynamic_cast*>(GetServant(theShapes, myPOA).in()); - GEOM_List_i* aListImplT = + GEOM_List_i* aListImplT = dynamic_cast*>(GetServant(theTools, myPOA).in()); - GEOM_List_i* aListImplKI = + GEOM_List_i* aListImplKI = dynamic_cast*>(GetServant(theKeepInside, myPOA).in()); - GEOM_List_i* aListImplRI = + GEOM_List_i* aListImplRI = dynamic_cast*>(GetServant(theRemoveInside, myPOA).in()); - GEOM_List_i* aListImplM = + GEOM_List_i* aListImplM = dynamic_cast*>(GetServant(theMaterials, myPOA).in()); if (aListImplS && aListImplT && aListImplKI && aListImplRI && aListImplM) { getBoolOp(); GEOM::GEOM_Object_ptr anObj = - myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), - aListImplKI->GetList(), aListImplRI->GetList(), - theLimit, theRemoveWebs, aListImplM->GetList(), - theKeepNonlimitShapes); + myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), + aListImplKI->GetList(), aListImplRI->GetList(), + theLimit, theRemoveWebs, aListImplM->GetList(), + theKeepNonlimitShapes); endService( " GEOM_Superv_i::MakePartition" ); return anObj; } @@ -1297,7 +1498,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr theSha // MakeHalfPartition: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePlane) + GEOM::GEOM_Object_ptr thePlane) { beginService( " GEOM_Superv_i::MakeHalfPartition" ); MESSAGE("GEOM_Superv_i::MakeHalfPartition"); @@ -1324,9 +1525,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCopy (GEOM::GEOM_Object_ptr theOriginal //============================================================================= // Export: //============================================================================= -void GEOM_Superv_i::Export (GEOM::GEOM_Object_ptr theObject, - const char* theFileName, - const char* theFormatName) +void GEOM_Superv_i::Export (GEOM::GEOM_Object_ptr theObject, + const char* theFileName, + const char* theFormatName) { beginService( " GEOM_Superv_i::Export" ); MESSAGE("GEOM_Superv_i::Export"); @@ -1338,14 +1539,14 @@ void GEOM_Superv_i::Export (GEOM::GEOM_Object_ptr theObject, //============================================================================= // Import: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::Import (const char* theFileName, - const char* theFormatName) +GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportFile (const char* theFileName, + const char* theFormatName) { - beginService( " GEOM_Superv_i::Import" ); - MESSAGE("GEOM_Superv_i::Import"); + beginService( " GEOM_Superv_i::ImportFile" ); + MESSAGE("GEOM_Superv_i::ImportFile"); getInsOp(); - GEOM::GEOM_Object_ptr anObj = myInsOp->Import(theFileName, theFormatName); - endService( " GEOM_Superv_i::Import" ); + GEOM::GEOM_Object_ptr anObj = myInsOp->ImportFile(theFileName, theFormatName); + endService( " GEOM_Superv_i::ImportFile" ); return anObj; } @@ -1353,7 +1554,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::Import (const char* theFileName, // ImportTranslators: //============================================================================= void GEOM_Superv_i::ImportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns) + GEOM::string_array_out thePatterns) { beginService( " GEOM_Superv_i::ImportTranslators" ); MESSAGE("GEOM_Superv_i::ImportTranslators"); @@ -1366,7 +1567,7 @@ void GEOM_Superv_i::ImportTranslators (GEOM::string_array_out theFormats, // ExportTranslators: //============================================================================= void GEOM_Superv_i::ExportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns) + GEOM::string_array_out thePatterns) { beginService( " GEOM_Superv_i::ExportTranslators" ); MESSAGE("GEOM_Superv_i::ExportTranslators"); @@ -1380,8 +1581,8 @@ void GEOM_Superv_i::ExportTranslators (GEOM::string_array_out theFormats, // TranslateTwoPoints: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { beginService( " GEOM_Superv_i::TranslateTwoPoints" ); MESSAGE("GEOM_Superv_i::TranslateTwoPoints"); @@ -1395,8 +1596,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateTwoPoints (GEOM::GEOM_Object_ptr t // TranslateTwoPointsCopy: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { beginService( " GEOM_Superv_i::TranslateTwoPointsCopy" ); MESSAGE("GEOM_Superv_i::TranslateTwoPointsCopy"); @@ -1410,9 +1611,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateTwoPointsCopy (GEOM::GEOM_Object_p // TranslateDXDYDZ: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ) + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) { beginService( " GEOM_Superv_i::TranslateDXDYDZ" ); MESSAGE("GEOM_Superv_i::TranslateDXDYDZ"); @@ -1426,9 +1627,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateDXDYDZ (GEOM::GEOM_Object_ptr theO // TranslateDXDYDZCopy: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ) + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) { beginService( " GEOM_Superv_i::TranslateDXDYDZCopy" ); MESSAGE("GEOM_Superv_i::TranslateDXDYDZCopy"); @@ -1442,7 +1643,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr // TranslateVector: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVector (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector) + GEOM::GEOM_Object_ptr theVector) { beginService( " GEOM_Superv_i::TranslateVector" ); MESSAGE("GEOM_Superv_i::TranslateVector"); @@ -1456,7 +1657,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVector (GEOM::GEOM_Object_ptr theO // TranslateVectorCopy: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector) + GEOM::GEOM_Object_ptr theVector) { beginService( " GEOM_Superv_i::TranslateVectorCopy" ); MESSAGE("GEOM_Superv_i::TranslateVectorCopy"); @@ -1470,15 +1671,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVectorCopy (GEOM::GEOM_Object_ptr // TranslateVectorDistance: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVectorDistance (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theDistance, - CORBA::Boolean theCopy) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theDistance, + CORBA::Boolean theCopy) { beginService( " GEOM_Superv_i::TranslateVectorDistance" ); MESSAGE("GEOM_Superv_i::TranslateVectorDistance"); getTransfOp(); - GEOM::GEOM_Object_ptr anObj = myTransfOp->TranslateVectorDistance(theObject, - theVector, theDistance, theCopy); + GEOM::GEOM_Object_ptr anObj = myTransfOp->TranslateVectorDistance(theObject, + theVector, theDistance, theCopy); endService( " GEOM_Superv_i::TranslateVectorDistance" ); return anObj; } @@ -1487,9 +1688,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVectorDistance (GEOM::GEOM_Object_ // MultiTranslate1D: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theStep, - CORBA::Long theNbTimes) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theStep, + CORBA::Long theNbTimes) { beginService( " GEOM_Superv_i::MultiTranslate1D" ); MESSAGE("GEOM_Superv_i::MultiTranslate1D"); @@ -1503,18 +1704,18 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiTranslate1D (GEOM::GEOM_Object_ptr the // MultiTranslate2D: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector1, - CORBA::Double theStep1, - CORBA::Long theNbTimes1, - GEOM::GEOM_Object_ptr theVector2, - CORBA::Double theStep2, - CORBA::Long theNbTimes2) + GEOM::GEOM_Object_ptr theVector1, + CORBA::Double theStep1, + CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, + CORBA::Double theStep2, + CORBA::Long theNbTimes2) { beginService( " GEOM_Superv_i::MultiTranslate2D" ); MESSAGE("GEOM_Superv_i::MultiTranslate2D"); getTransfOp(); GEOM::GEOM_Object_ptr anObj = myTransfOp->MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1, - theVector2, theStep2, theNbTimes2); + theVector2, theStep2, theNbTimes2); endService( " GEOM_Superv_i::MultiTranslate2D" ); return anObj; } @@ -1523,8 +1724,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiTranslate2D (GEOM::GEOM_Object_ptr the // Rotate: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::Rotate (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) { beginService( " GEOM_Superv_i::Rotate" ); MESSAGE("GEOM_Superv_i::Rotate"); @@ -1538,8 +1739,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::Rotate (GEOM::GEOM_Object_ptr theObject, // RotateCopy: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::RotateCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) { beginService( " GEOM_Superv_i::RotateCopy" ); MESSAGE("GEOM_Superv_i::RotateCopy"); @@ -1552,9 +1753,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::RotateCopy (GEOM::GEOM_Object_ptr theObject // RotateThreePoints: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::RotateThreePoints (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theCentPoint, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr theCentPoint, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { beginService( " GEOM_Superv_i::RotateThreePoints" ); MESSAGE("GEOM_Superv_i::RotateThreePoints"); @@ -1568,9 +1769,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::RotateThreePoints (GEOM::GEOM_Object_ptr th // RotateThreePointsCopy: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::RotateThreePointsCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theCentPoint, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr theCentPoint, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { beginService( " GEOM_Superv_i::RotateThreePointsCopy" ); MESSAGE("GEOM_Superv_i::RotateThreePointsCopy"); @@ -1584,8 +1785,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::RotateThreePointsCopy (GEOM::GEOM_Object_pt // MultiRotate1D: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Long theNbTimes) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Long theNbTimes) { beginService( " GEOM_Superv_i::MultiRotate1D" ); MESSAGE("GEOM_Superv_i::MultiRotate1D"); @@ -1599,11 +1800,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObj // MultiRotate2D: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle, - CORBA::Long theNbTimes1, - CORBA::Double theStep, - CORBA::Long theNbTimes2) + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle, + CORBA::Long theNbTimes1, + CORBA::Double theStep, + CORBA::Long theNbTimes2) { beginService( " GEOM_Superv_i::MultiRotate2D" ); MESSAGE("GEOM_Superv_i::MultiRotate2D"); @@ -1616,8 +1817,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObj //============================================================================= // MirrorPlane: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlane (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePlane) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlane (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane) { beginService( " GEOM_Superv_i::MirrorPlane" ); MESSAGE("GEOM_Superv_i::MirrorPlane"); @@ -1630,8 +1831,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlane (GEOM::GEOM_Object_ptr theObjec //============================================================================= // MirrorPlaneCopy: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePlane) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane) { beginService( " GEOM_Superv_i::MirrorPlaneCopy" ); MESSAGE("GEOM_Superv_i::MirrorPlaneCopy"); @@ -1644,8 +1845,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlaneCopy (GEOM::GEOM_Object_ptr theO //============================================================================= // MirrorAxis: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxis (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxis (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis) { beginService( " GEOM_Superv_i::MirrorAxis" ); MESSAGE("GEOM_Superv_i::MirrorAxis"); @@ -1658,8 +1859,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxis (GEOM::GEOM_Object_ptr theObject //============================================================================= // MirrorAxisCopy: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis) { beginService( " GEOM_Superv_i::MirrorAxisCopy" ); MESSAGE("GEOM_Superv_i::MirrorAxisCopy"); @@ -1672,8 +1873,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxisCopy (GEOM::GEOM_Object_ptr theOb //============================================================================= // MirrorPoint: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPoint (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPoint (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint) { beginService( " GEOM_Superv_i::MirrorPoint" ); MESSAGE("GEOM_Superv_i::MirrorPoint"); @@ -1686,8 +1887,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPoint (GEOM::GEOM_Object_ptr theObjec //============================================================================= // MirrorPointCopy: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint) { beginService( " GEOM_Superv_i::MirrorPoint" ); MESSAGE("GEOM_Superv_i::MirrorPointCopy"); @@ -1700,8 +1901,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPointCopy (GEOM::GEOM_Object_ptr theO //============================================================================= // OffsetShape: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShape (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theOffset) +GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShape (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset) { beginService( " GEOM_Superv_i::OffsetShape" ); MESSAGE("GEOM_Superv_i::OffsetShape"); @@ -1714,8 +1915,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShape (GEOM::GEOM_Object_ptr theObjec //============================================================================= // OffsetShapeCopy: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theOffset) +GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset) { beginService( " GEOM_Superv_i::OffsetShapeCopy" ); MESSAGE("GEOM_Superv_i::OffsetShapeCopy"); @@ -1728,9 +1929,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theO //============================================================================= // ScaleShape: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShape (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactor) +GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) { beginService( " GEOM_Superv_i::ScaleShape" ); MESSAGE("GEOM_Superv_i::ScaleShape"); @@ -1743,9 +1944,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShape (GEOM::GEOM_Object_ptr theObject //============================================================================= // ScaleShapeCopy: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactor) +GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) { beginService( " GEOM_Superv_i::ScaleShapeCopy" ); MESSAGE("GEOM_Superv_i::ScaleShapeCopy"); @@ -1759,10 +1960,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeCopy (GEOM::GEOM_Object_ptr theOb // ScaleShapeAlongAxes: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactorX, - CORBA::Double theFactorY, - CORBA::Double theFactorZ) + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactorX, + CORBA::Double theFactorY, + CORBA::Double theFactorZ) { beginService( " GEOM_Superv_i::ScaleShapeAlongAxes" ); MESSAGE("GEOM_Superv_i::ScaleShapeAlongAxes"); @@ -1777,10 +1978,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr // ScaleShapeAlongAxesCopy: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactorX, - CORBA::Double theFactorY, - CORBA::Double theFactorZ) + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactorX, + CORBA::Double theFactorY, + CORBA::Double theFactorZ) { beginService( " GEOM_Superv_i::ScaleShapeAlongAxesCopy" ); MESSAGE("GEOM_Superv_i::ScaleShapeAlongAxesCopy"); @@ -1795,8 +1996,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ // PositionShape: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShape (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theStartLCS, - GEOM::GEOM_Object_ptr theEndLCS) + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) { beginService( " GEOM_Superv_i::PositionShape" ); MESSAGE("GEOM_Superv_i::PositionShape"); @@ -1810,8 +2011,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShape (GEOM::GEOM_Object_ptr theObj // PositionShapeCopy: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShapeCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theStartLCS, - GEOM::GEOM_Object_ptr theEndLCS) + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) { beginService( " GEOM_Superv_i::PositionShapeCopy" ); MESSAGE("GEOM_Superv_i::PositionShapeCopy"); @@ -1825,10 +2026,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShapeCopy (GEOM::GEOM_Object_ptr th // PositionAlongPath: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionAlongPath (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePath, - CORBA::Double theDistance, - CORBA::Boolean theCopy, - CORBA::Boolean theReverse) + GEOM::GEOM_Object_ptr thePath, + CORBA::Double theDistance, + CORBA::Boolean theCopy, + CORBA::Boolean theReverse) { beginService( " GEOM_Superv_i::PositionAlongPath" ); MESSAGE("GEOM_Superv_i::PositionAlongPath"); @@ -1843,7 +2044,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionAlongPath (GEOM::GEOM_Object_ptr th // Make: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEdge (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2) + GEOM::GEOM_Object_ptr thePnt2) { beginService( " GEOM_Superv_i::MakeEdge" ); MESSAGE("GEOM_Superv_i::MakeEdge"); @@ -1853,17 +2054,33 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEdge (GEOM::GEOM_Object_ptr thePnt1, return anObj; } +//============================================================================= +// MakeEdgeOnCurveByLength: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEdgeOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint) +{ + beginService( " GEOM_Superv_i::MakeEdgeOnCurveByLength" ); + MESSAGE("GEOM_Superv_i::MakeEdgeOnCurveByLength"); + getShapesOp(); + GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint); + endService( " GEOM_Superv_i::MakeEdgeOnCurveByLength" ); + return anObj; +} + //============================================================================= // MakeWire: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires, + CORBA::Double theTolerance) { beginService( " GEOM_Superv_i::MakeWire" ); MESSAGE("GEOM_Superv_i::MakeWire"); - if (GEOM_List_i* aListImplEW = + if (GEOM_List_i* aListImplEW = dynamic_cast*>(GetServant(theEdgesAndWires, myPOA).in())) { getShapesOp(); - GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeWire(aListImplEW->GetList()); + GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeWire(aListImplEW->GetList(), theTolerance); endService( " GEOM_Superv_i::MakeWire" ); return anObj; } @@ -1875,7 +2092,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWi // MakeFace: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFace (GEOM::GEOM_Object_ptr theWire, - CORBA::Boolean isPlanarWanted) + CORBA::Boolean isPlanarWanted) { beginService( " GEOM_Superv_i::MakeFace" ); MESSAGE("GEOM_Superv_i::MakeFace"); @@ -1889,11 +2106,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFace (GEOM::GEOM_Object_ptr theWire, // MakeFaceWires: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceWires (GEOM::GEOM_List_ptr theWires, - CORBA::Boolean isPlanarWanted) + CORBA::Boolean isPlanarWanted) { beginService( " GEOM_Superv_i::MakeFaceWires" ); MESSAGE("GEOM_Superv_i::MakeFaceWires"); - if (GEOM_List_i* aListImplW = + if (GEOM_List_i* aListImplW = dynamic_cast*>(GetServant(theWires, myPOA).in())) { getShapesOp(); GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeFaceWires(aListImplW->GetList(), isPlanarWanted); @@ -1911,7 +2128,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeShell (GEOM::GEOM_List_ptr theFacesAndS { beginService( " GEOM_Superv_i::MakeShell" ); MESSAGE("GEOM_Superv_i::MakeShell"); - if (GEOM_List_i* aListImplFS = + if (GEOM_List_i* aListImplFS = dynamic_cast*>(GetServant(theFacesAndShells, myPOA).in())) { getShapesOp(); GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeShell(aListImplFS->GetList()); @@ -1942,7 +2159,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSolidShells (GEOM::GEOM_List_ptr theShe { beginService( " GEOM_Superv_i::MakeSolidShells" ); MESSAGE("GEOM_Superv_i::MakeSolidShells"); - if (GEOM_List_i* aListImplS = + if (GEOM_List_i* aListImplS = dynamic_cast*>(GetServant(theShells, myPOA).in())) { getShapesOp(); GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeSolidShells(aListImplS->GetList()); @@ -1960,7 +2177,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes { beginService( " GEOM_Superv_i::MakeCompound" ); MESSAGE("GEOM_Superv_i::MakeCompound"); - if (GEOM_List_i* aListImpl = + if (GEOM_List_i* aListImpl = dynamic_cast*>(GetServant(theShapes, myPOA).in())) { getShapesOp(); GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeCompound(aListImpl->GetList()); @@ -1975,8 +2192,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes // MakeGlueFaces: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - CORBA::Boolean doKeepNonSolids) + CORBA::Double theTolerance, + CORBA::Boolean doKeepNonSolids) { beginService( " GEOM_Superv_i::MakeGlueFaces" ); MESSAGE("GEOM_Superv_i::MakeGlueFaces"); @@ -1991,7 +2208,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theSha // GetGlueFaces: //============================================================================= GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance) + CORBA::Double theTolerance) { beginService( " GEOM_Superv_i::GetGlueFaces" ); MESSAGE("GEOM_Superv_i::GetGlueFaces"); @@ -2007,15 +2224,17 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape, // MakeGlueFacesByList: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces, - CORBA::Boolean doKeepNonSolids) + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces, + CORBA::Boolean doKeepNonSolids, + CORBA::Boolean doGlueAllEdges) { beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); getShapesOp(); GEOM::GEOM_Object_ptr anObj = - myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids); + myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, + doKeepNonSolids, doGlueAllEdges); endService( " GEOM_Superv_i::MakeGlueFacesByList" ); return anObj; } @@ -2024,8 +2243,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr // MakeExplode: //============================================================================= GEOM::GEOM_List_ptr GEOM_Superv_i::MakeExplode (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - CORBA::Boolean isSorted) + CORBA::Long theShapeType, + CORBA::Boolean isSorted) { beginService( " GEOM_Superv_i::MakeExplode" ); MESSAGE("GEOM_Superv_i::MakeExplode"); @@ -2084,9 +2303,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ChangeOrientation (GEOM::GEOM_Object_ptr th //============================================================================= GEOM::GEOM_List_ptr GEOM_Superv_i::GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState) + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState) { beginService( " GEOM_Superv_i::GetShapesOnShape" ); MESSAGE("GEOM_Superv_i::GetShapesOnShape"); @@ -2105,14 +2324,14 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetShapesOnShape //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetShapesOnShapeAsCompound (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState) + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState) { beginService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" ); MESSAGE("GEOM_Superv_i::GetShapesOnShapeAsCompound"); getShapesOp(); - GEOM::GEOM_Object_ptr anObj = + GEOM::GEOM_Object_ptr anObj = myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState); endService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" ); return anObj; @@ -2124,9 +2343,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetShapesOnShapeAsCompound // MakeQuad4Vertices: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad4Vertices (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3, - GEOM::GEOM_Object_ptr thePnt4) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + GEOM::GEOM_Object_ptr thePnt4) { beginService( " GEOM_Superv_i::MakeQuad4Vertices" ); MESSAGE("GEOM_Superv_i::MakeQuad4Vertices"); @@ -2140,9 +2359,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad4Vertices (GEOM::GEOM_Object_ptr th // MakeQuad: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad (GEOM::GEOM_Object_ptr theEdge1, - GEOM::GEOM_Object_ptr theEdge2, - GEOM::GEOM_Object_ptr theEdge3, - GEOM::GEOM_Object_ptr theEdge4) + GEOM::GEOM_Object_ptr theEdge2, + GEOM::GEOM_Object_ptr theEdge3, + GEOM::GEOM_Object_ptr theEdge4) { beginService( " GEOM_Superv_i::MakeQuad" ); MESSAGE("GEOM_Superv_i::MakeQuad"); @@ -2156,7 +2375,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad (GEOM::GEOM_Object_ptr theEdge1, // MakeQuad2Edges: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad2Edges (GEOM::GEOM_Object_ptr theEdge1, - GEOM::GEOM_Object_ptr theEdge2) + GEOM::GEOM_Object_ptr theEdge2) { beginService( " GEOM_Superv_i::MakeQuad2Edges" ); MESSAGE("GEOM_Superv_i::MakeQuad2Edges"); @@ -2170,11 +2389,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad2Edges (GEOM::GEOM_Object_ptr theEd // MakeHexa: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHexa (GEOM::GEOM_Object_ptr theFace1, - GEOM::GEOM_Object_ptr theFace2, - GEOM::GEOM_Object_ptr theFace3, - GEOM::GEOM_Object_ptr theFace4, - GEOM::GEOM_Object_ptr theFace5, - GEOM::GEOM_Object_ptr theFace6) + GEOM::GEOM_Object_ptr theFace2, + GEOM::GEOM_Object_ptr theFace3, + GEOM::GEOM_Object_ptr theFace4, + GEOM::GEOM_Object_ptr theFace5, + GEOM::GEOM_Object_ptr theFace6) { beginService( " GEOM_Superv_i::MakeHexa" ); MESSAGE("GEOM_Superv_i::MakeHexa"); @@ -2188,7 +2407,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHexa (GEOM::GEOM_Object_ptr theFace1, // MakeHexa2Faces: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHexa2Faces (GEOM::GEOM_Object_ptr theFace1, - GEOM::GEOM_Object_ptr theFace2) + GEOM::GEOM_Object_ptr theFace2) { beginService( " GEOM_Superv_i::MakeHexa2Faces" ); MESSAGE("GEOM_Superv_i::MakeHexa2Faces"); @@ -2202,10 +2421,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHexa2Faces (GEOM::GEOM_Object_ptr theFa // GetPoint: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetPoint (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ, - CORBA::Double theEpsilon) + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theEpsilon) { beginService( " GEOM_Superv_i::GetPoint" ); MESSAGE("GEOM_Superv_i::GetPoint"); @@ -2219,8 +2438,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetPoint (GEOM::GEOM_Object_ptr theShape, // GetEdge: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetEdge (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) { beginService( " GEOM_Superv_i::GetEdge" ); MESSAGE("GEOM_Superv_i::GetEdge"); @@ -2234,7 +2453,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetEdge (GEOM::GEOM_Object_ptr theShape, // GetEdgeNearPoint: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { beginService( " GEOM_Superv_i::GetEdgeNearPoint" ); MESSAGE("GEOM_Superv_i::GetEdgeNearPoint"); @@ -2248,10 +2467,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetEdgeNearPoint (GEOM::GEOM_Object_ptr the // GetFaceByPoints: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByPoints (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2, - GEOM::GEOM_Object_ptr thePoint3, - GEOM::GEOM_Object_ptr thePoint4) + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + GEOM::GEOM_Object_ptr thePoint3, + GEOM::GEOM_Object_ptr thePoint4) { beginService( " GEOM_Superv_i::GetFaceByPoints" ); MESSAGE("GEOM_Superv_i::GetFaceByPoints"); @@ -2265,8 +2484,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByPoints (GEOM::GEOM_Object_ptr theS // GetFaceByEdges: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByEdges (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr theEdge1, - GEOM::GEOM_Object_ptr theEdge2) + GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2) { beginService( " GEOM_Superv_i::GetFaceByEdges" ); MESSAGE("GEOM_Superv_i::GetFaceByEdges"); @@ -2280,7 +2499,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByEdges (GEOM::GEOM_Object_ptr theSh // GetOppositeFace: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetOppositeFace (GEOM::GEOM_Object_ptr theBlock, - GEOM::GEOM_Object_ptr theFace) + GEOM::GEOM_Object_ptr theFace) { beginService( " GEOM_Superv_i::GetOppositeFace" ); MESSAGE("GEOM_Superv_i::GetOppositeFace"); @@ -2294,7 +2513,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetOppositeFace (GEOM::GEOM_Object_ptr theB // GetFaceNearPoint: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { beginService( " GEOM_Superv_i::GetFaceNearPoint" ); MESSAGE("GEOM_Superv_i::GetFaceNearPoint"); @@ -2308,7 +2527,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceNearPoint (GEOM::GEOM_Object_ptr the // GetFaceByNormale: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock, - GEOM::GEOM_Object_ptr theVector) + GEOM::GEOM_Object_ptr theVector) { beginService( " GEOM_Superv_i::GetFaceByNormale" ); MESSAGE("GEOM_Superv_i::GetFaceByNormale"); @@ -2322,9 +2541,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByNormale (GEOM::GEOM_Object_ptr the // IsCompoundOfBlocks: //============================================================================= CORBA::Boolean GEOM_Superv_i::IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - CORBA::Long theMinNbFaces, - CORBA::Long theMaxNbFaces, - CORBA::Long& theNbBlocks) + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces, + CORBA::Long& theNbBlocks) { beginService( " GEOM_Superv_i::IsCompoundOfBlocks" ); MESSAGE("GEOM_Superv_i::IsCompoundOfBlocks"); @@ -2337,7 +2556,7 @@ CORBA::Boolean GEOM_Superv_i::IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompo //============================================================================= // CheckCompoundOfBlocks: //============================================================================= -CORBA::Boolean GEOM_Superv_i::CheckCompoundOfBlocks +CORBA::Boolean GEOM_Superv_i::CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors) { @@ -2353,7 +2572,7 @@ CORBA::Boolean GEOM_Superv_i::CheckCompoundOfBlocks // PrintBCErrors: //============================================================================= char* GEOM_Superv_i::PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, - const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) + const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) { beginService( " GEOM_Superv_i::PrintBCErrors" ); MESSAGE("GEOM_Superv_i::PrintBCErrors"); @@ -2367,8 +2586,8 @@ char* GEOM_Superv_i::PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, // ExplodeCompoundOfBlocks: //============================================================================= GEOM::GEOM_List_ptr GEOM_Superv_i::ExplodeCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - CORBA::Long theMinNbFaces, - CORBA::Long theMaxNbFaces) + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces) { beginService( " GEOM_Superv_i::ExplodeCompoundOfBlocks" ); MESSAGE("GEOM_Superv_i::ExplodeCompoundOfBlocks"); @@ -2383,7 +2602,7 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::ExplodeCompoundOfBlocks (GEOM::GEOM_Object_pt // GetBlockNearPoint: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_Object_ptr thePoint) + GEOM::GEOM_Object_ptr thePoint) { beginService( " GEOM_Superv_i::GetBlockNearPoint" ); MESSAGE("GEOM_Superv_i::GetBlockNearPoint"); @@ -2397,11 +2616,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetBlockNearPoint (GEOM::GEOM_Object_ptr th // GetBlockByParts: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::GetBlockByParts (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_List_ptr theParts) + GEOM::GEOM_List_ptr theParts) { beginService( " GEOM_Superv_i::GetBlockByParts" ); MESSAGE("GEOM_Superv_i::GetBlockByParts"); - if (GEOM_List_i* aListImplP = + if (GEOM_List_i* aListImplP = dynamic_cast*>(GetServant(theParts, myPOA).in())) { getBlocksOp(); GEOM::GEOM_Object_ptr anObj = myBlocksOp->GetBlockByParts(theCompound, aListImplP->GetList()); @@ -2416,14 +2635,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetBlockByParts (GEOM::GEOM_Object_ptr theC // GetBlocksByParts: //============================================================================= GEOM::GEOM_List_ptr GEOM_Superv_i::GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_List_ptr theParts) + GEOM::GEOM_List_ptr theParts) { beginService( " GEOM_Superv_i::GetBlocksByParts" ); MESSAGE("GEOM_Superv_i::GetBlocksByParts"); - if (GEOM_List_i* aListImplP = + if (GEOM_List_i* aListImplP = dynamic_cast*>(GetServant(theParts, myPOA).in())) { getBlocksOp(); - + GEOM::ListOfGO* aBlocks = myBlocksOp->GetBlocksByParts(theCompound, aListImplP->GetList()); GEOM_List_i* aListPtr = new GEOM_List_i(*(aBlocks)); endService( " GEOM_Superv_i::GetBlocksByParts" ); @@ -2437,9 +2656,9 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetBlocksByParts (GEOM::GEOM_Object_ptr theCo // MakeMultiTransformation1D: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation1D (GEOM::GEOM_Object_ptr theBlock, - CORBA::Long theDirFace1, - CORBA::Long theDirFace2, - CORBA::Long theNbTimes) + CORBA::Long theDirFace1, + CORBA::Long theDirFace2, + CORBA::Long theNbTimes) { beginService( " GEOM_Superv_i::MakeMultiTransformation1D" ); MESSAGE("GEOM_Superv_i::MakeMultiTransformation1D"); @@ -2452,7 +2671,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation1D (GEOM::GEOM_Objec //============================================================================= // MakeMultiTransformation2D: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation2D +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation2D (GEOM::GEOM_Object_ptr theBlock, CORBA::Long theDirFace1U, CORBA::Long theDirFace2U, @@ -2464,9 +2683,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation2D beginService( " GEOM_Superv_i::MakeMultiTransformation2D" ); MESSAGE("GEOM_Superv_i::MakeMultiTransformation2D"); getBlocksOp(); - GEOM::GEOM_Object_ptr anObj = myBlocksOp->MakeMultiTransformation2D(theBlock, - theDirFace1U, theDirFace2U, theNbTimesU, - theDirFace1V, theDirFace2V, theNbTimesV); + GEOM::GEOM_Object_ptr anObj = myBlocksOp->MakeMultiTransformation2D(theBlock, + theDirFace1U, theDirFace2U, theNbTimesU, + theDirFace1V, theDirFace2V, theNbTimesV); endService( " GEOM_Superv_i::MakeMultiTransformation2D" ); return anObj; } @@ -2476,8 +2695,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation2D // MakeCirclePntVecR: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theR) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR) { beginService( " GEOM_Superv_i::MakeCirclePntVecR" ); MESSAGE("GEOM_Superv_i::MakeCirclePntVecR"); @@ -2491,8 +2710,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCirclePntVecR (GEOM::GEOM_Object_ptr th // MakeCircleThreePnt: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) { beginService( " GEOM_Superv_i::MakeCircleThreePnt" ); MESSAGE("GEOM_Superv_i::MakeCircleThreePnt"); @@ -2505,8 +2724,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleThreePnt (GEOM::GEOM_Object_ptr t // MakeCircleCenter2Pnt: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) { beginService( " GEOM_Superv_i::MakeCircleCenter2Pnt" ); MESSAGE("GEOM_Superv_i::MakeCircleCenter2Pnt"); @@ -2520,9 +2739,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr // MakeEllipse: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipse (GEOM::GEOM_Object_ptr theCenter, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theRMajor, - CORBA::Double theRMinor) + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, + CORBA::Double theRMinor) { beginService( " GEOM_Superv_i::MakeEllipse" ); MESSAGE("GEOM_Superv_i::MakeEllipse"); @@ -2532,12 +2751,29 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipse (GEOM::GEOM_Object_ptr theCente return anObj; } +//============================================================================= +// MakeEllipseVec: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, + CORBA::Double theRMinor, + GEOM::GEOM_Object_ptr theVectorMajor) +{ + beginService( " GEOM_Superv_i::MakeEllipseVec" ); + MESSAGE("GEOM_Superv_i::MakeEllipseVec"); + getCurvesOp(); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeEllipseVec(theCenter, theVector, theRMajor, theRMinor, theVectorMajor); + endService( " GEOM_Superv_i::MakeEllipseVec" ); + return anObj; +} + //============================================================================= // MakeArc: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArc (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) { beginService( " GEOM_Superv_i::MakeArc" ); MESSAGE("GEOM_Superv_i::MakeArc"); @@ -2567,8 +2803,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcCenter (GEOM::GEOM_Object_ptr theCen // MakeArcOfEllipse: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3) + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) { beginService( " GEOM_Superv_i::MakeArcOfEllipse" ); MESSAGE("GEOM_Superv_i::MakeArcOfEllipse"); @@ -2581,14 +2817,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcOfEllipse (GEOM::GEOM_Object_ptr the //============================================================================= // MakePolyline: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePolyline (GEOM::GEOM_List_ptr thePoints) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePolyline (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed) { beginService( " GEOM_Superv_i::MakePolyline" ); MESSAGE("GEOM_Superv_i::MakePolyline"); - if (GEOM_List_i* aListImplP = + if (GEOM_List_i* aListImplP = dynamic_cast*>(GetServant(thePoints, myPOA).in())) { getCurvesOp(); - GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakePolyline(aListImplP->GetList()); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakePolyline(aListImplP->GetList(), theIsClosed); endService( " GEOM_Superv_i::MakePolyline" ); return anObj; } @@ -2599,14 +2836,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePolyline (GEOM::GEOM_List_ptr thePoints //============================================================================= // MakeSplineBezier: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineBezier (GEOM::GEOM_List_ptr thePoints) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineBezier (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed) { beginService( " GEOM_Superv_i::MakeSplineBezier" ); MESSAGE("GEOM_Superv_i::MakeSplineBezier"); - if (GEOM_List_i* aListImplP = + if (GEOM_List_i* aListImplP = dynamic_cast*>(GetServant(thePoints, myPOA).in())) { getCurvesOp(); - GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeSplineBezier(aListImplP->GetList()); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeSplineBezier(aListImplP->GetList(), theIsClosed); endService( " GEOM_Superv_i::MakeSplineBezier" ); return anObj; } @@ -2617,14 +2855,16 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineBezier (GEOM::GEOM_List_ptr thePo //============================================================================= // MakeSplineInterpolation: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed, + CORBA::Boolean theDoReordering) { beginService( " GEOM_Superv_i::MakeSplineInterpolation" ); MESSAGE("GEOM_Superv_i::MakeSplineInterpolation"); - if (GEOM_List_i* aListImplP = + if (GEOM_List_i* aListImplP = dynamic_cast*>(GetServant(thePoints, myPOA).in())) { getCurvesOp(); - GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeSplineInterpolation(aListImplP->GetList()); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeSplineInterpolation(aListImplP->GetList(), theIsClosed, theDoReordering); endService( " GEOM_Superv_i::MakeSplineInterpolation" ); return anObj; } @@ -2635,12 +2875,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineInterpolation (GEOM::GEOM_List_pt //============================================================================= // MakeSketcher: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSketcher (const char* theCommand, - GEOM::GEOM_List_ptr theWorkingPlane) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSketcher (const char* theCommand, + GEOM::GEOM_List_ptr theWorkingPlane) { beginService( " GEOM_Superv_i::MakeSketcher" ); MESSAGE("GEOM_Superv_i::MakeSketcher"); - if (GEOM_List_i* aListImplWP = + if (GEOM_List_i* aListImplWP = dynamic_cast*>(GetServant(theWorkingPlane, myPOA).in())) { getCurvesOp(); GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeSketcher(theCommand, aListImplWP->GetList()); @@ -2658,7 +2898,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::Make3DSketcher ( GEOM::GEOM_List_ptr theCoo { beginService( " GEOM_Superv_i::Make3DSketcher" ); MESSAGE("GEOM_Superv_i::Make3DSketcher"); - if (GEOM_List_i* aListImpl = + if (GEOM_List_i* aListImpl = dynamic_cast*>(GetServant(theCoordinates, myPOA).in())) { getCurvesOp(); GEOM::GEOM_Object_ptr anObj = myCurvesOp->Make3DSketcher(aListImpl->GetList()); @@ -2674,7 +2914,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::Make3DSketcher ( GEOM::GEOM_List_ptr theCoo // MakeFilletAll: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletAll (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theR) + CORBA::Double theR) { beginService( " GEOM_Superv_i::MakeFilletAll" ); MESSAGE("GEOM_Superv_i::MakeFilletAllMakeSketcher"); @@ -2687,13 +2927,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletAll (GEOM::GEOM_Object_ptr theSha //============================================================================= // MakeFilletEdges: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theR, - GEOM::GEOM_List_ptr theEdges) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR, + GEOM::GEOM_List_ptr theEdges) { beginService( " GEOM_Superv_i::MakeFilletEdges" ); MESSAGE("GEOM_Superv_i::MakeFilletEdges"); - if (GEOM_List_i* aListImplE = + if (GEOM_List_i* aListImplE = dynamic_cast*>(GetServant(theEdges, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletEdges(theShape, theR, aListImplE->GetList()); @@ -2707,14 +2947,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdges (GEOM::GEOM_Object_ptr theS //============================================================================= // MakeFilletEdges R1 R2: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theR1, - CORBA::Double theR2, - GEOM::GEOM_List_ptr theEdges) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR1, + CORBA::Double theR2, + GEOM::GEOM_List_ptr theEdges) { beginService( " GEOM_Superv_i::MakeFilletEdgesR1R2" ); MESSAGE("GEOM_Superv_i::MakeFilletEdgesR1R2"); - if (GEOM_List_i* aListImplE = + if (GEOM_List_i* aListImplE = dynamic_cast*>(GetServant(theEdges, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletEdgesR1R2(theShape, theR1, @@ -2729,13 +2969,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr //============================================================================= // MakeFilletFaces: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theR, - GEOM::GEOM_List_ptr theFaces) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR, + GEOM::GEOM_List_ptr theFaces) { beginService( " GEOM_Superv_i::MakeFilletFaces" ); MESSAGE("GEOM_Superv_i::MakeFilletFaces"); - if (GEOM_List_i* aListImplF = + if (GEOM_List_i* aListImplF = dynamic_cast*>(GetServant(theFaces, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletFaces(theShape, theR, aListImplF->GetList()); @@ -2749,14 +2989,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFaces (GEOM::GEOM_Object_ptr theS //============================================================================= // MakeFilletFaces R1 R2: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theR1, - CORBA::Double theR2, - GEOM::GEOM_List_ptr theFaces) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR1, + CORBA::Double theR2, + GEOM::GEOM_List_ptr theFaces) { beginService( " GEOM_Superv_i::MakeFilletFacesR1R2" ); MESSAGE("GEOM_Superv_i::MakeFilletFacesR1R2"); - if (GEOM_List_i* aListImplF = + if (GEOM_List_i* aListImplF = dynamic_cast*>(GetServant(theFaces, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletFacesR1R2(theShape, theR1, theR2, @@ -2771,13 +3011,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr //============================================================================= // MakeFillet2D: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFillet2D (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theR, - GEOM::GEOM_List_ptr theVertexes) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFillet2D (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR, + GEOM::GEOM_List_ptr theVertexes) { beginService( " GEOM_Superv_i::MakeFillet2D" ); MESSAGE("GEOM_Superv_i::MakeFillet2D"); - if (GEOM_List_i* aListImplV = + if (GEOM_List_i* aListImplV = dynamic_cast*>(GetServant(theVertexes, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFillet2D(theShape, theR, aListImplV->GetList()); @@ -2788,6 +3028,28 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFillet2D (GEOM::GEOM_Object_ptr theShap return NULL; } +//============================================================================= +// MakeFillet1D: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFillet1D (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR, + GEOM::GEOM_List_ptr theVertexes, + CORBA::Boolean doIgnoreSecantVertices) +{ + beginService( " GEOM_Superv_i::MakeFillet1D" ); + MESSAGE("GEOM_Superv_i::MakeFillet1D"); + if (GEOM_List_i* aListImplV = + dynamic_cast*>(GetServant(theVertexes, myPOA).in())) { + getLocalOp(); + GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFillet1D + (theShape, theR, aListImplV->GetList(), doIgnoreSecantVertices); + endService( " GEOM_Superv_i::MakeFillet1D" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeFillet1D" ); + return NULL; +} + //============================================================================= // MakeChamferAll: //============================================================================= @@ -2800,13 +3062,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferAll (GEOM::GEOM_Object_ptr theSh endService( " GEOM_Superv_i::MakeChamferAll" ); return anObj; } - + //============================================================================= // MakeChamferEdge: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - CORBA::Long theFace1, CORBA::Long theFace2) + CORBA::Double theD1, CORBA::Double theD2, + CORBA::Long theFace1, CORBA::Long theFace2) { beginService( " GEOM_Superv_i::MakeChamferEdge" ); MESSAGE("GEOM_Superv_i::MakeChamferEdge"); @@ -2820,8 +3082,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdge (GEOM::GEOM_Object_ptr theS // MakeChamferEdgeAD: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - CORBA::Long theFace1, CORBA::Long theFace2) + CORBA::Double theD, CORBA::Double theAngle, + CORBA::Long theFace1, CORBA::Long theFace2) { beginService( " GEOM_Superv_i::MakeChamferEdgeAD" ); MESSAGE("GEOM_Superv_i::MakeChamferEdgeAD"); @@ -2835,12 +3097,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgeAD (GEOM::GEOM_Object_ptr th // MakeChamferFaces: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - GEOM::GEOM_List_ptr theFaces) + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theFaces) { beginService( " GEOM_Superv_i::MakeChamferFaces" ); MESSAGE("GEOM_Superv_i::MakeChamferFaces"); - if (GEOM_List_i* aListImplF = + if (GEOM_List_i* aListImplF = dynamic_cast*>(GetServant(theFaces, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferFaces(theShape, theD1, theD2, aListImplF->GetList()); @@ -2855,12 +3117,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFaces (GEOM::GEOM_Object_ptr the // MakeChamferFacesAD: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - GEOM::GEOM_List_ptr theFaces) + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theFaces) { beginService( " GEOM_Superv_i::MakeChamferFacesAD" ); MESSAGE("GEOM_Superv_i::MakeChamferFacesAD"); - if (GEOM_List_i* aListImplF = + if (GEOM_List_i* aListImplF = dynamic_cast*>(GetServant(theFaces, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferFacesAD(theShape, theD, theAngle, aListImplF->GetList()); @@ -2875,12 +3137,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFacesAD (GEOM::GEOM_Object_ptr t // MakeChamferEdges: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdges (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - GEOM::GEOM_List_ptr theEdges) + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theEdges) { beginService( " GEOM_Superv_i::MakeChamferEdges" ); MESSAGE("GEOM_Superv_i::MakeChamferEdges"); - if (GEOM_List_i* aListImplF = + if (GEOM_List_i* aListImplF = dynamic_cast*>(GetServant(theEdges, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdges(theShape, theD1, theD2, aListImplF->GetList()); @@ -2895,12 +3157,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdges (GEOM::GEOM_Object_ptr the // MakeChamferEdgesAD: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - GEOM::GEOM_List_ptr theEdges) + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theEdges) { beginService( " GEOM_Superv_i::MakeChamferEdgesAD" ); MESSAGE("GEOM_Superv_i::MakeChamferEdgesAD"); - if (GEOM_List_i* aListImplF = + if (GEOM_List_i* aListImplF = dynamic_cast*>(GetServant(theEdges, myPOA).in())) { getLocalOp(); GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdgesAD(theShape, theD, theAngle, aListImplF->GetList()); @@ -2915,9 +3177,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgesAD (GEOM::GEOM_Object_ptr t // MakeArchimede: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArchimede (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theWeight, - CORBA::Double theWaterDensity, - CORBA::Double theMeshingDeflection) + CORBA::Double theWeight, + CORBA::Double theWaterDensity, + CORBA::Double theMeshingDeflection) { beginService( " GEOM_Superv_i::MakeArchimede" ); MESSAGE("GEOM_Superv_i::MakeArchimede"); @@ -2931,7 +3193,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArchimede (GEOM::GEOM_Object_ptr theSha // GetSubShapeIndexMakeFilletAll: //============================================================================= CORBA::Long GEOM_Superv_i::GetSubShapeIndex (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr theSubShape) + GEOM::GEOM_Object_ptr theSubShape) { beginService( " GEOM_Superv_i::GetSubShapeIndex" ); MESSAGE("GEOM_Superv_i::GetSubShapeIndexMakeArchimede"); @@ -2945,8 +3207,8 @@ CORBA::Long GEOM_Superv_i::GetSubShapeIndex (GEOM::GEOM_Object_ptr theShape, //============================================================================= // CreateGroup: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::CreateGroup (GEOM::GEOM_Object_ptr theMainShape, - CORBA::Long theShapeType) +GEOM::GEOM_Object_ptr GEOM_Superv_i::CreateGroup (GEOM::GEOM_Object_ptr theMainShape, + CORBA::Long theShapeType) { beginService( " GEOM_Superv_i::CreateGroup" ); MESSAGE("GEOM_Superv_i::CreateGroup"); @@ -2959,8 +3221,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::CreateGroup (GEOM::GEOM_Object_ptr theMainS //============================================================================= // AddObject: //============================================================================= -void GEOM_Superv_i::AddObject (GEOM::GEOM_Object_ptr theGroup, - CORBA::Long theSubShapeId) +void GEOM_Superv_i::AddObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId) { beginService( " GEOM_Superv_i::AddObject" ); MESSAGE("GEOM_Superv_i::AddObject"); @@ -2972,8 +3234,8 @@ void GEOM_Superv_i::AddObject (GEOM::GEOM_Object_ptr theGroup, //============================================================================= // RemoveObject: //============================================================================= -void GEOM_Superv_i::RemoveObject (GEOM::GEOM_Object_ptr theGroup, - CORBA::Long theSubShapeId) +void GEOM_Superv_i::RemoveObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId) { beginService( " GEOM_Superv_i::RemoveObject" ); MESSAGE("GEOM_Superv_i::RemoveObject"); @@ -3024,16 +3286,167 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetObjects (GEOM::GEOM_Object_ptr theGroup) return aListPtr->_this(); } +//=============================== Advanced Operations ============================= +//============================================================================= +// MakePipeTShape +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShape + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Boolean theHexMesh) +{ + beginService( " GEOM_Superv_i::MakePipeTShape" ); + MESSAGE("GEOM_Superv_i::MakePipeTShape"); + getAdvancedOp(); + + GEOM::ListOfGO* aSeq = myAdvancedOp->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh); + GEOM_List_i* aSeqPtr = new GEOM_List_i(*(aSeq)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::MakePipeTShape" ); + return aSeqPtr->_this(); +} + +//============================================================================= +// MakePipeTShapeWithPosition +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3) +{ + beginService( " GEOM_Superv_i::MakePipeTShapeWithPosition" ); + MESSAGE("GEOM_Superv_i::MakePipeTShapeWithPosition"); + getAdvancedOp(); + + GEOM::ListOfGO* aSeq = myAdvancedOp->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3); + GEOM_List_i* aSeqPtr = new GEOM_List_i(*(aSeq)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::MakePipeTShapeWithPosition" ); + return aSeqPtr->_this(); +} + +//============================================================================= +// MakePipeTShapeChamfer +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeChamfer + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh) +{ + beginService( " GEOM_Superv_i::MakePipeTShapeChamfer" ); + MESSAGE("GEOM_Superv_i::MakePipeTShapeChamfer"); + getAdvancedOp(); + + GEOM::ListOfGO* aSeq = myAdvancedOp->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh); + GEOM_List_i* aSeqPtr = new GEOM_List_i(*(aSeq)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::MakePipeTShapeChamfer" ); + return aSeqPtr->_this(); +} + +//============================================================================= +// MakePipeTShapeChamferWithPosition +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeChamferWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3) +{ + beginService( " GEOM_Superv_i::MakePipeTShapeChamferWithPosition" ); + MESSAGE("GEOM_Superv_i::MakePipeTShapeChamferWithPosition"); + getAdvancedOp(); + + GEOM::ListOfGO* aSeq = myAdvancedOp->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3); + GEOM_List_i* aSeqPtr = new GEOM_List_i(*(aSeq)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::MakePipeTShapeChamferWithPosition" ); + return aSeqPtr->_this(); +} + +//============================================================================= +// MakePipeTShapeFillet +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeFillet + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh) +{ + beginService( " GEOM_Superv_i::MakePipeTShapeFillet" ); + MESSAGE("GEOM_Superv_i::MakePipeTShapeFillet"); + getAdvancedOp(); + + GEOM::ListOfGO* aSeq = myAdvancedOp->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh); + GEOM_List_i* aSeqPtr = new GEOM_List_i(*(aSeq)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::MakePipeTShapeFillet" ); + return aSeqPtr->_this(); +} + +//============================================================================= +// MakePipeTShapeFilletWithPosition +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeFilletWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3) +{ + beginService( " GEOM_Superv_i::MakePipeTShapeFilletWithPosition" ); + MESSAGE("GEOM_Superv_i::MakePipeTShapeFilletWithPosition"); + getAdvancedOp(); + + GEOM::ListOfGO* aSeq = myAdvancedOp->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3); + GEOM_List_i* aSeqPtr = new GEOM_List_i(*(aSeq)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::MakePipeTShapeFilletWithPosition" ); + return aSeqPtr->_this(); +} + +//============================================================================= +// MakeDividedDisk +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, + CORBA::Short theOrientation, GEOM::pattern thePattern) +{ + beginService( " GEOM_Superv_i::MakeDividedDisk" ); + MESSAGE("GEOM_Superv_i::MakeDividedDisk"); + getAdvancedOp(); + GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio, theOrientation, thePattern); + endService( " GEOM_Superv_i::MakeDividedDisk" ); + return anObj; +} + +//============================================================================= +// MakeDividedCylinder +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern) +{ + beginService( " GEOM_Superv_i::MakeDividedCylinder" ); + MESSAGE("GEOM_Superv_i::MakeDividedCylinder"); + getAdvancedOp(); + GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedCylinder(theR, theH, thePattern); + endService( " GEOM_Superv_i::MakeDividedCylinder" ); + return anObj; +} + +/*@@ insert new functions before this line @@ do not remove this line @@*/ + //===================================================================================== // EXPORTED METHODS //===================================================================================== extern "C" { +#ifdef WIN32 + __declspec( dllexport ) +#endif PortableServer::ObjectId * GEOM_SupervEngine_factory(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char * interfaceName) + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char * interfaceName) { GEOM_Superv_i * myGEOM_Superv_i = new GEOM_Superv_i(orb, poa, contId, instanceName, interfaceName); //Don't understand the reason why this component is registered ??? diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index b34c13214..7a9014af8 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -1,43 +1,49 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef __GEOM_SUPERV_I_H__ #define __GEOM_SUPERV_I_H__ +#include "GEOM_I_Superv.hxx" + // IDL headers #include +#include CORBA_CLIENT_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(GEOM_Superv) -#include "GEOM_Gen_i.hh" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" + #include "GEOM_List_i.hh" -class GEOM_Superv_i : public virtual POA_GEOM::GEOM_Superv, - public Engines_Component_i +class GEOM_I_SUPERV_EXPORT GEOM_Superv_i : public virtual POA_GEOM::GEOM_Superv, + public Engines_Component_i { public: GEOM_Superv_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName); + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); ~GEOM_Superv_i(); // generic method to be put in a super class @@ -53,588 +59,667 @@ public: void getBlocksOp(); void getCurvesOp(); void getLocalOp(); - void getGroupOp(); + void getGroupOp(); + void getAdvancedOp(); PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject, - PortableServer::POA_ptr thePOA); + PortableServer::POA_ptr thePOA); //-----------------------------------------------------------------------// // Set current stydy ID // //-----------------------------------------------------------------------// - void SetStudyID( CORBA::Long theId ); + void SetStudyID( CORBA::Long theId ); //-----------------------------------------------------------// - // Create ListOfGO and add items to it // + // Create ListOfGO and add items to it // //-----------------------------------------------------------// GEOM::GEOM_List_ptr CreateListOfGO(); - void AddItemToListOfGO(GEOM::GEOM_List_ptr& theList, - GEOM::GEOM_Object_ptr theObject); + void AddItemToListOfGO(GEOM::GEOM_List_ptr& theList, + GEOM::GEOM_Object_ptr theObject); //-----------------------------------------------------------// - // Create ListOfLong and add items to it // + // Create ListOfLong and add items to it // //-----------------------------------------------------------// GEOM::GEOM_List_ptr CreateListOfLong(); - void AddItemToListOfLong(GEOM::GEOM_List_ptr& theList, - CORBA::Long theObject); - + void AddItemToListOfLong(GEOM::GEOM_List_ptr& theList, + CORBA::Long theObject); + //-----------------------------------------------------------// - // Create ListOfDouble and add items to it // + // Create ListOfDouble and add items to it // //-----------------------------------------------------------// GEOM::GEOM_List_ptr CreateListOfDouble(); - void AddItemToListOfDouble(GEOM::GEOM_List_ptr& theList, - CORBA::Double theObject); + void AddItemToListOfDouble(GEOM::GEOM_List_ptr& theList, + CORBA::Double theObject); //-----------------------------------------------------------------------// // Inherited methods from SALOMEDS::Driver // - //-----------------------------------------------------------------------// + //-----------------------------------------------------------------------// SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - CORBA::Boolean isMultiFile); + const char* theURL, + CORBA::Boolean isMultiFile); SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - CORBA::Boolean isMultiFile); - + const char* theURL, + CORBA::Boolean isMultiFile); + CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile); + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile); CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile); + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile); void Close(SALOMEDS::SComponent_ptr theComponent); char* ComponentDataType(); char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII); + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII); + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR); SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) throw (SALOME::SALOME_Exception) ; + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) ; + + GEOM::ListOfGO* PublishNamedShapesInStudy(SALOMEDS::Study_ptr theStudy, + //SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject); CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID); CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject); + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject); //-----------------------------------------------------------// - // Primitives Construction : BasicOperations // + // Primitives Construction : BasicOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakePointXYZ (CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ); + CORBA::Double theY, + CORBA::Double theZ); GEOM::GEOM_Object_ptr MakePointWithReference (GEOM::GEOM_Object_ptr theReference, - CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ); + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ); GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve, - CORBA::Double theParameter); + CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint); + GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter); + GEOM::GEOM_Object_ptr MakePointOnSurface (GEOM::GEOM_Object_ptr theRefSurface, + CORBA::Double theUParameter, + CORBA::Double theVParameter); + GEOM::GEOM_Object_ptr MakePointOnSurfaceByCoord (GEOM::GEOM_Object_ptr theRefSurface, + CORBA::Double theXParameter, + CORBA::Double theYParameter, + CORBA::Double theZParameter); GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theRefLine1, - GEOM::GEOM_Object_ptr theRefLine2); + GEOM::GEOM_Object_ptr theRefLine2); GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve, - CORBA::Double theParameter); + CORBA::Double theParameter); GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ); + CORBA::Double theDY, + CORBA::Double theDZ); GEOM::GEOM_Object_ptr MakeVectorTwoPnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr thePnt2); GEOM::GEOM_Object_ptr MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr thePnt2); GEOM::GEOM_Object_ptr MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1, - GEOM::GEOM_Object_ptr theFace2); + GEOM::GEOM_Object_ptr theFace2); GEOM::GEOM_Object_ptr MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3, - CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + CORBA::Double theTrimSize); GEOM::GEOM_Object_ptr MakePlanePntVec (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theTrimSize); GEOM::GEOM_Object_ptr MakePlaneFace (GEOM::GEOM_Object_ptr theFace, - CORBA::Double theTrimSize); + CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr MakePlane2Vec (GEOM::GEOM_Object_ptr theVec1, + GEOM::GEOM_Object_ptr theVec2, + CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr MakePlaneLCS (GEOM::GEOM_Object_ptr theLCS, + CORBA::Double theTrimSize, + CORBA::Double theOrientation); GEOM::GEOM_Object_ptr MakeMarker (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ, - CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, - CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ); + CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, + CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ); + + GEOM::GEOM_Object_ptr MakeMarkerFromShape (GEOM::GEOM_Object_ptr theShape); + + GEOM::GEOM_Object_ptr MakeMarkerPntTwoVec (GEOM::GEOM_Object_ptr theOrigin, + GEOM::GEOM_Object_ptr theXVec, + GEOM::GEOM_Object_ptr theYVec); - GEOM::GEOM_Object_ptr MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, - CORBA::Double theParameterU, - CORBA::Double theParameterV, - CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theParameterU, + CORBA::Double theParameterV, + CORBA::Double theTrimSize); //-----------------------------------------------------------// // Primitives Construction : 3DPrimOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakeBox (CORBA::Double theX1, - CORBA::Double theY1, - CORBA::Double theZ1, - CORBA::Double theX2, - CORBA::Double theY2, - CORBA::Double theZ2); - GEOM::GEOM_Object_ptr MakeBoxDXDYDZ (CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ); - GEOM::GEOM_Object_ptr MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2); + CORBA::Double theY1, + CORBA::Double theZ1, + CORBA::Double theX2, + CORBA::Double theY2, + CORBA::Double theZ2); + GEOM::GEOM_Object_ptr MakeBoxDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + GEOM::GEOM_Object_ptr MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); GEOM::GEOM_Object_ptr MakeFaceHW (CORBA::Double theH, - CORBA::Double theW, - CORBA::Short theOrientation); - GEOM::GEOM_Object_ptr MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj, - CORBA::Double theH, - CORBA::Double theW); + CORBA::Double theW, + CORBA::Short theOrientation); + GEOM::GEOM_Object_ptr MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj, + CORBA::Double theH, + CORBA::Double theW); GEOM::GEOM_Object_ptr MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theR); + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR); GEOM::GEOM_Object_ptr MakeDiskThreePnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakeDiskR (CORBA::Double theR, - CORBA::Short theOrientation); + CORBA::Short theOrientation); GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theRadius, - CORBA::Double theHeight); - GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR, - CORBA::Double theH); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + CORBA::Double theHeight); + GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR, + CORBA::Double theH); GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ, - CORBA::Double theRadius); + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theRadius); GEOM::GEOM_Object_ptr MakeSphereR (CORBA::Double theR); - GEOM::GEOM_Object_ptr MakeSpherePntR (GEOM::GEOM_Object_ptr thePnt, - CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeSpherePntR (GEOM::GEOM_Object_ptr thePnt, + CORBA::Double theR); GEOM::GEOM_Object_ptr MakeTorusPntVecRR (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theRMajor, - CORBA::Double theRMinor); + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, + CORBA::Double theRMinor); GEOM::GEOM_Object_ptr MakeTorusRR (CORBA::Double theRMajor, - CORBA::Double theRMinor); + CORBA::Double theRMinor); GEOM::GEOM_Object_ptr MakeConePntVecR1R2H (GEOM::GEOM_Object_ptr thePnt, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theR1, - CORBA::Double theR2, - CORBA::Double theHeight); - GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1, - CORBA::Double theR2, - CORBA::Double theHeight); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight); + GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight); GEOM::GEOM_Object_ptr MakePrismVecH (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theH); + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH); GEOM::GEOM_Object_ptr MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theVec, - CORBA::Double theH); + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH); GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theBase, - CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ); + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); GEOM::GEOM_Object_ptr MakePrismDXDYDZ2Ways (GEOM::GEOM_Object_ptr theBase, - CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ); - GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePath); + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath); GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); GEOM::GEOM_Object_ptr MakeFilling (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theMinDeg, CORBA::Long theMaxDeg, - CORBA::Double theTol2D, CORBA::Double theTol3D, - CORBA::Long theNbIter, CORBA::Boolean theApprox); + CORBA::Long theMinDeg, CORBA::Long theMaxDeg, + CORBA::Double theTol2D, CORBA::Double theTol3D, + CORBA::Long theNbIter, + GEOM::filling_oper_method theMethod, + CORBA::Boolean theApprox); GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections, - CORBA::Boolean theModeSolid, - CORBA::Double thePreci, - CORBA::Boolean theRuled); - + CORBA::Boolean theModeSolid, + CORBA::Double thePreci, + CORBA::Boolean theRuled); + GEOM::GEOM_Object_ptr MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theLocations, - GEOM::GEOM_Object_ptr thePath, - CORBA::Boolean theWithContact, - CORBA::Boolean theWithCorrections); - + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections); + GEOM::GEOM_Object_ptr MakePipeWithShellSections(const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theSubBases, - const GEOM::ListOfGO& theLocations, - GEOM::GEOM_Object_ptr thePath, - CORBA::Boolean theWithContact, - CORBA::Boolean theWithCorrections); + const GEOM::ListOfGO& theSubBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections); GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases, - const GEOM::ListOfGO& theLocations); - + const GEOM::ListOfGO& theLocations); + GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase, - GEOM::GEOM_Object_ptr thePath, - GEOM::GEOM_Object_ptr theVec); + GEOM::GEOM_Object_ptr thePath, + GEOM::GEOM_Object_ptr theVec); //-----------------------------------------------------------// // BooleanOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2, - CORBA::Long theOperation); + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOperation); GEOM::GEOM_Object_ptr MakeFuse (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2); + GEOM::GEOM_Object_ptr theShape2); GEOM::GEOM_Object_ptr MakePartition (GEOM::GEOM_List_ptr theShapes, - GEOM::GEOM_List_ptr theTools, - GEOM::GEOM_List_ptr theKeepInside, - GEOM::GEOM_List_ptr theRemoveInside, - CORBA::Short theLimit, - CORBA::Boolean theRemoveWebs, - GEOM::GEOM_List_ptr theMaterials, - CORBA::Short theKeepNonlimitShapes); + GEOM::GEOM_List_ptr theTools, + GEOM::GEOM_List_ptr theKeepInside, + GEOM::GEOM_List_ptr theRemoveInside, + CORBA::Short theLimit, + CORBA::Boolean theRemoveWebs, + GEOM::GEOM_List_ptr theMaterials, + CORBA::Short theKeepNonlimitShapes); GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePlane); + GEOM::GEOM_Object_ptr thePlane); //-----------------------------------------------------------// // InsertOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakeCopy (GEOM::GEOM_Object_ptr theOriginal); - void Export (GEOM::GEOM_Object_ptr theObject, - const char* theFileName, - const char* theFormatName); - GEOM::GEOM_Object_ptr Import (const char* theFileName, - const char* theFormatName); + void Export (GEOM::GEOM_Object_ptr theObject, + const char* theFileName, + const char* theFormatName); + GEOM::GEOM_Object_ptr ImportFile (const char* theFileName, + const char* theFormatName); void ImportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns); + GEOM::string_array_out thePatterns); void ExportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns); + GEOM::string_array_out thePatterns); //-----------------------------------------------------------// // TransformOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ); + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); GEOM::GEOM_Object_ptr TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theDX, - CORBA::Double theDY, - CORBA::Double theDZ); + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); GEOM::GEOM_Object_ptr TranslateVector (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr theVector); GEOM::GEOM_Object_ptr TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr theVector); GEOM::GEOM_Object_ptr TranslateVectorDistance (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theDistance, - CORBA::Boolean theCopy); + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theDistance, + CORBA::Boolean theCopy); GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theStep, - CORBA::Long theNbTimes); + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theStep, + CORBA::Long theNbTimes); GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theVector1, - CORBA::Double theStep1, - CORBA::Long theNbTimes1, - GEOM::GEOM_Object_ptr theVector2, - CORBA::Double theStep2, - CORBA::Long theNbTimes2); + GEOM::GEOM_Object_ptr theVector1, + CORBA::Double theStep1, + CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, + CORBA::Double theStep2, + CORBA::Long theNbTimes2); GEOM::GEOM_Object_ptr Rotate (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); GEOM::GEOM_Object_ptr RotateCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); GEOM::GEOM_Object_ptr RotateThreePoints (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theCentPoint, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr theCentPoint, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr RotateThreePointsCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theCentPoint, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr theCentPoint, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr MultiRotate1D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Long theNbTimes); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Long theNbTimes); GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis, - CORBA::Double theAngle, - CORBA::Long theNbTimes1, - CORBA::Double theStep, - CORBA::Long theNbTimes2); - GEOM::GEOM_Object_ptr MirrorPlane (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePlane); - GEOM::GEOM_Object_ptr MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePlane); - GEOM::GEOM_Object_ptr MirrorAxis (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis); - GEOM::GEOM_Object_ptr MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theAxis); - GEOM::GEOM_Object_ptr MirrorPoint (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint); - GEOM::GEOM_Object_ptr MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint); - GEOM::GEOM_Object_ptr OffsetShape (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theOffset); - GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, - CORBA::Double theOffset); - GEOM::GEOM_Object_ptr ScaleShape (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactor); - GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactor); + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle, + CORBA::Long theNbTimes1, + CORBA::Double theStep, + CORBA::Long theNbTimes2); + GEOM::GEOM_Object_ptr MirrorPlane (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane); + GEOM::GEOM_Object_ptr MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane); + GEOM::GEOM_Object_ptr MirrorAxis (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis); + GEOM::GEOM_Object_ptr MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis); + GEOM::GEOM_Object_ptr MirrorPoint (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr OffsetShape (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset); + GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset); + GEOM::GEOM_Object_ptr ScaleShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor); + GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor); GEOM::GEOM_Object_ptr ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactorX, - CORBA::Double theFactorY, - CORBA::Double theFactorZ); + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactorX, + CORBA::Double theFactorY, + CORBA::Double theFactorZ); GEOM::GEOM_Object_ptr ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePoint, - CORBA::Double theFactorX, - CORBA::Double theFactorY, - CORBA::Double theFactorZ); + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactorX, + CORBA::Double theFactorY, + CORBA::Double theFactorZ); GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theStartLCS, - GEOM::GEOM_Object_ptr theEndLCS); + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS); GEOM::GEOM_Object_ptr PositionShapeCopy (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr theStartLCS, - GEOM::GEOM_Object_ptr theEndLCS); + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS); GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject, - GEOM::GEOM_Object_ptr thePath, - CORBA::Double theDistance, - CORBA::Boolean theCopy, - CORBA::Boolean theReverse); + GEOM::GEOM_Object_ptr thePath, + CORBA::Double theDistance, + CORBA::Boolean theCopy, + CORBA::Boolean theReverse); //-----------------------------------------------------------// // ShapesOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2); - GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires); + GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakeEdgeOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theLength, + GEOM::GEOM_Object_ptr theStartPoint); + GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires, + CORBA::Double theTolerance); GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire, - CORBA::Boolean isPlanarWanted); + CORBA::Boolean isPlanarWanted); GEOM::GEOM_Object_ptr MakeFaceWires (GEOM::GEOM_List_ptr theWires, - CORBA::Boolean isPlanarWanted); + CORBA::Boolean isPlanarWanted); GEOM::GEOM_Object_ptr MakeShell (GEOM::GEOM_List_ptr theFacesAndShells); GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell); GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells); GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes); GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - CORBA::Boolean doKeepNonSolids); + CORBA::Double theTolerance, + CORBA::Boolean doKeepNonSolids); GEOM::GEOM_List_ptr GetGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance); + CORBA::Double theTolerance); GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance, - const GEOM::ListOfGO& theFaces, - CORBA::Boolean doKeepNonSolids); + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces, + CORBA::Boolean doKeepNonSolids, + CORBA::Boolean doGlueAllEdges); GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape, - CORBA::Long theShapeType, - CORBA::Boolean isSorted); + CORBA::Long theShapeType, + CORBA::Boolean isSorted); CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape); CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape); GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theShape); GEOM::GEOM_List_ptr GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState); + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState); GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound (GEOM::GEOM_Object_ptr theCheckShape, - GEOM::GEOM_Object_ptr theShape, - CORBA::Short theShapeType, - GEOM::shape_state theState); + GEOM::GEOM_Object_ptr theShape, + CORBA::Short theShapeType, + GEOM::shape_state theState); //-----------------------------------------------------------// // BlocksOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakeQuad4Vertices (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3, - GEOM::GEOM_Object_ptr thePnt4); + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + GEOM::GEOM_Object_ptr thePnt4); GEOM::GEOM_Object_ptr MakeQuad (GEOM::GEOM_Object_ptr theEdge1, - GEOM::GEOM_Object_ptr theEdge2, - GEOM::GEOM_Object_ptr theEdge3, - GEOM::GEOM_Object_ptr theEdge4); + GEOM::GEOM_Object_ptr theEdge2, + GEOM::GEOM_Object_ptr theEdge3, + GEOM::GEOM_Object_ptr theEdge4); GEOM::GEOM_Object_ptr MakeQuad2Edges (GEOM::GEOM_Object_ptr theEdge1, - GEOM::GEOM_Object_ptr theEdge2); + GEOM::GEOM_Object_ptr theEdge2); GEOM::GEOM_Object_ptr MakeHexa (GEOM::GEOM_Object_ptr theFace1, - GEOM::GEOM_Object_ptr theFace2, - GEOM::GEOM_Object_ptr theFace3, - GEOM::GEOM_Object_ptr theFace4, - GEOM::GEOM_Object_ptr theFace5, - GEOM::GEOM_Object_ptr theFace6); + GEOM::GEOM_Object_ptr theFace2, + GEOM::GEOM_Object_ptr theFace3, + GEOM::GEOM_Object_ptr theFace4, + GEOM::GEOM_Object_ptr theFace5, + GEOM::GEOM_Object_ptr theFace6); GEOM::GEOM_Object_ptr MakeHexa2Faces (GEOM::GEOM_Object_ptr theFace1, - GEOM::GEOM_Object_ptr theFace2); + GEOM::GEOM_Object_ptr theFace2); GEOM::GEOM_Object_ptr GetPoint (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theX, - CORBA::Double theY, - CORBA::Double theZ, - CORBA::Double theEpsilon); + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theEpsilon); GEOM::GEOM_Object_ptr GetEdge (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr thePoint); GEOM::GEOM_Object_ptr GetFaceByPoints (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint1, - GEOM::GEOM_Object_ptr thePoint2, - GEOM::GEOM_Object_ptr thePoint3, - GEOM::GEOM_Object_ptr thePoint4); + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + GEOM::GEOM_Object_ptr thePoint3, + GEOM::GEOM_Object_ptr thePoint4); GEOM::GEOM_Object_ptr GetFaceByEdges (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr theEdge1, - GEOM::GEOM_Object_ptr theEdge2); + GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2); GEOM::GEOM_Object_ptr GetOppositeFace (GEOM::GEOM_Object_ptr theBlock, - GEOM::GEOM_Object_ptr theFace); + GEOM::GEOM_Object_ptr theFace); GEOM::GEOM_Object_ptr GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr thePoint); GEOM::GEOM_Object_ptr GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock, - GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr theVector); CORBA::Boolean IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - CORBA::Long theMinNbFaces, - CORBA::Long theMaxNbFaces, - CORBA::Long& theNbBlocks); + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces, + CORBA::Long& theNbBlocks); CORBA::Boolean CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors); + GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors); char* PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, - const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors); + const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors); GEOM::GEOM_List_ptr ExplodeCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - CORBA::Long theMinNbFaces, - CORBA::Long theMaxNbFaces); + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces); GEOM::GEOM_Object_ptr GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr thePoint); GEOM::GEOM_Object_ptr GetBlockByParts (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_List_ptr theParts); + GEOM::GEOM_List_ptr theParts); GEOM::GEOM_List_ptr GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound, - GEOM::GEOM_List_ptr theParts); + GEOM::GEOM_List_ptr theParts); GEOM::GEOM_Object_ptr MakeMultiTransformation1D (GEOM::GEOM_Object_ptr theBlock, - CORBA::Long theDirFace1, - CORBA::Long theDirFace2, - CORBA::Long theNbTimes); + CORBA::Long theDirFace1, + CORBA::Long theDirFace2, + CORBA::Long theNbTimes); GEOM::GEOM_Object_ptr MakeMultiTransformation2D (GEOM::GEOM_Object_ptr theBlock, - CORBA::Long theDirFace1U, - CORBA::Long theDirFace2U, - CORBA::Long theNbTimesU, - CORBA::Long theDirFace1V, - CORBA::Long theDirFace2V, - CORBA::Long theNbTimesV); + CORBA::Long theDirFace1U, + CORBA::Long theDirFace2U, + CORBA::Long theNbTimesU, + CORBA::Long theDirFace1V, + CORBA::Long theDirFace2V, + CORBA::Long theNbTimesV); //-----------------------------------------------------------// // CurvesOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theR); + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR); GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter, - GEOM::GEOM_Object_ptr theVector, - CORBA::Double theRMajor, CORBA::Double theRMinor); + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, CORBA::Double theRMinor); + GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, CORBA::Double theRMinor, + GEOM::GEOM_Object_ptr theVectorMajor); GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakeArcCenter (GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, CORBA::Boolean theSense); GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1, - GEOM::GEOM_Object_ptr thePnt2, - GEOM::GEOM_Object_ptr thePnt3); - GEOM::GEOM_Object_ptr MakePolyline (GEOM::GEOM_List_ptr thePoints); - GEOM::GEOM_Object_ptr MakeSplineBezier (GEOM::GEOM_List_ptr thePoints); - GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints); - GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, - GEOM::GEOM_List_ptr theWorkingPlane); + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr MakePolyline (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed); + GEOM::GEOM_Object_ptr MakeSplineBezier (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed); + GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed, + CORBA::Boolean theDoReordering); + GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, + GEOM::GEOM_List_ptr theWorkingPlane); GEOM::GEOM_Object_ptr Make3DSketcher (GEOM::GEOM_List_ptr theCoordinates); //-----------------------------------------------------------// // LocalOperations // //-----------------------------------------------------------// GEOM::GEOM_Object_ptr MakeFilletAll (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theR); + CORBA::Double theR); GEOM::GEOM_Object_ptr MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, - GEOM::GEOM_List_ptr theEdges); + GEOM::GEOM_List_ptr theEdges); GEOM::GEOM_Object_ptr MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1, - CORBA::Double theR2, GEOM::GEOM_List_ptr theEdges); + CORBA::Double theR2, GEOM::GEOM_List_ptr theEdges); GEOM::GEOM_Object_ptr MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, - GEOM::GEOM_List_ptr theFaces); + GEOM::GEOM_List_ptr theFaces); GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1, - CORBA::Double theR2, GEOM::GEOM_List_ptr theFaces); + CORBA::Double theR2, GEOM::GEOM_List_ptr theFaces); GEOM::GEOM_Object_ptr MakeFillet2D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, - GEOM::GEOM_List_ptr theVertexes); + GEOM::GEOM_List_ptr theVertexes); + GEOM::GEOM_Object_ptr MakeFillet1D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + GEOM::GEOM_List_ptr theVertexes, CORBA::Boolean doIgnoreSecantVertices); GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - CORBA::Long theFace1, CORBA::Long theFace2); + CORBA::Double theD1, CORBA::Double theD2, + CORBA::Long theFace1, CORBA::Long theFace2); GEOM::GEOM_Object_ptr MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - CORBA::Long theFace1, CORBA::Long theFace2); + CORBA::Double theD, CORBA::Double theAngle, + CORBA::Long theFace1, CORBA::Long theFace2); GEOM::GEOM_Object_ptr MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - GEOM::GEOM_List_ptr theFaces); + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theFaces); GEOM::GEOM_Object_ptr MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - GEOM::GEOM_List_ptr theFaces); + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theFaces); GEOM::GEOM_Object_ptr MakeChamferEdges (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD1, CORBA::Double theD2, - GEOM::GEOM_List_ptr theEdges); + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theEdges); GEOM::GEOM_Object_ptr MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theD, CORBA::Double theAngle, - GEOM::GEOM_List_ptr theEdges); + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theEdges); GEOM::GEOM_Object_ptr MakeArchimede (GEOM::GEOM_Object_ptr theShape, CORBA::Double theWeight, - CORBA::Double theWaterDensity, - CORBA::Double theMeshingDeflection); + CORBA::Double theWaterDensity, + CORBA::Double theMeshingDeflection); CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theShape, - GEOM::GEOM_Object_ptr theSubShape); + GEOM::GEOM_Object_ptr theSubShape); //-----------------------------------------------------------// // GroupOperations // //-----------------------------------------------------------// - GEOM::GEOM_Object_ptr CreateGroup (GEOM::GEOM_Object_ptr theMainShape, - CORBA::Long theShapeType); - void AddObject (GEOM::GEOM_Object_ptr theGroup, - CORBA::Long theSubShapeId); - void RemoveObject (GEOM::GEOM_Object_ptr theGroup, - CORBA::Long theSubShapeId); + GEOM::GEOM_Object_ptr CreateGroup (GEOM::GEOM_Object_ptr theMainShape, + CORBA::Long theShapeType); + void AddObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId); + void RemoveObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId); CORBA::Long GetType (GEOM::GEOM_Object_ptr theGroup); GEOM::GEOM_Object_ptr GetMainShape (GEOM::GEOM_Object_ptr theGroup); GEOM::GEOM_List_ptr GetObjects (GEOM::GEOM_Object_ptr theGroup); - + + //-----------------------------------------------------------// + // Advanced Operations // + //-----------------------------------------------------------// + GEOM::GEOM_List_ptr MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Boolean theHexMesh); + GEOM::GEOM_List_ptr MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::GEOM_List_ptr MakePipeTShapeChamfer (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh); + GEOM::GEOM_List_ptr MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::GEOM_List_ptr MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh); + GEOM::GEOM_List_ptr MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRF, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, + CORBA::Short theOrientation, GEOM::pattern thePattern); + GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern); + /*@@ insert new functions before this line @@ do not remove this line @@*/ + private: - SALOME_NamingService * name_service; + SALOME_NamingService * name_service; GEOM::GEOM_Gen_var myGeomEngine; CORBA::Long myStudyID; CORBA::Long myLastStudyID; // mkr : PAL10770 PortableServer::POA_var myPOA; - + GEOM::GEOM_IBasicOperations_var myBasicOp; GEOM::GEOM_I3DPrimOperations_var my3DPrimOp; GEOM::GEOM_IBooleanOperations_var myBoolOp; @@ -645,7 +730,7 @@ private: GEOM::GEOM_ICurvesOperations_var myCurvesOp; GEOM::GEOM_ILocalOperations_var myLocalOp; GEOM::GEOM_IGroupOperations_var myGroupOp; - + GEOM::GEOM_IAdvancedOperations_var myAdvancedOp; }; -#endif +#endif diff --git a/src/GEOM_I_Superv/Makefile.am b/src/GEOM_I_Superv/Makefile.am index 69edb9a10..e24863482 100644 --- a/src/GEOM_I_Superv/Makefile.am +++ b/src/GEOM_I_Superv/Makefile.am @@ -1,38 +1,37 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM : implementaion of GEOM_Superv.idl # File : Makefile.in # Author : Patrick GOLDBRONN (CEA) # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM # $Header$ + # Libraries targets -# include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files salomeinclude_HEADERS = \ GEOM_Superv_i.hh \ - GEOM_List_i.hh + GEOM_List_i.hh \ + GEOM_I_Superv.hxx # Libraries targets lib_LTLIBRARIES = libGEOM_SupervEngine.la @@ -46,6 +45,7 @@ libGEOM_SupervEngine_la_CPPFLAGS = \ $(CAS_CPPFLAGS) \ $(QT_INCLUDES) \ $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ $(BOOST_CPPFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ @@ -56,10 +56,10 @@ libGEOM_SupervEngine_la_CPPFLAGS = \ -I$(srcdir)/../GEOM \ -I$(srcdir)/../GEOM_I \ -I$(srcdir)/../GEOMAlgo \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGEOM_SupervEngine_la_LDFLAGS = \ + ../../idl/libSalomeIDLGEOM.la \ $(CORBA_LIBS) \ - $(KERNEL_LDFLAGS) -lSalomeGenericObj -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeContainer -lSalomeDSClient \ + $(KERNEL_LDFLAGS) -lSalomeGenericObj -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeContainer -lSalomeDSClient -lSALOMELocalTrace \ $(STDLIB) diff --git a/src/GEOM_PY/Makefile.am b/src/GEOM_PY/Makefile.am new file mode 100644 index 000000000..d22a74031 --- /dev/null +++ b/src/GEOM_PY/Makefile.am @@ -0,0 +1,28 @@ +# Copyright (C) 2007-2012 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 + +SUBDIRS= structelem + +mypkgpythondir = $(salomepythondir)/salome/geom +mypkgpython_PYTHON = \ + __init__.py \ + geomtools.py \ + sketcher.py diff --git a/src/GEOM_PY/__init__.py b/src/GEOM_PY/__init__.py new file mode 100644 index 000000000..7d1d2dd2d --- /dev/null +++ b/src/GEOM_PY/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# diff --git a/src/GEOM_PY/geomtools.py b/src/GEOM_PY/geomtools.py new file mode 100644 index 000000000..5a2062330 --- /dev/null +++ b/src/GEOM_PY/geomtools.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2007-2012 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 +# +""" +This module provides tools to facilitate the use of geom engine and geom +objects in Salome. +""" + +import salome +GEOM = None # GEOM module is loaded only when needed + +from salome.kernel.logger import Logger +from salome.kernel import termcolor +logger = Logger("salome.geom.geomtools", color = termcolor.RED) + +from salome.kernel.studyedit import getActiveStudyId, getStudyEditor +from salome.kernel.services import IDToObject, IDToSObject +try: + from salome.gui import helper as guihelper +except: + pass + +_geompys = {} + +def getGeompy(studyId = None): + """ + Return an object behaving exactly like geompy module, except that it is + associated with the study `studyId`. If `studyId` is :const:`None`, return + a pseudo geompy object for the current study. + """ + # We can't use geompy module because it initializes GEOM with + # salome.myStudy, which may not exist. So we use this trick to create + # a pseudo geompy module. + salome.salome_init() + if studyId is None: + studyId = getActiveStudyId() + if not _geompys.has_key(studyId): + import geompyDC + _geompys[studyId] = salome.lcc.FindOrLoadComponent("FactoryServer", + "GEOM") + _geompys[studyId].ShapeType = geompyDC.ShapeType + _geompys[studyId].GEOM = geompyDC.GEOM + _geompys[studyId].kind = geompyDC.kind + _geompys[studyId].info = geompyDC.info + _geompys[studyId].PackData = geompyDC.PackData + _geompys[studyId].ReadTexture = geompyDC.ReadTexture + study = salome.myStudyManager.GetStudyByID(studyId) + _geompys[studyId].init_geom(study) + return _geompys[studyId] + + +ModeWireFrame = 0 +ModeShading = 1 +DisplayMode=ModeShading +PreviewColor=[236,163,255] + +class GeomStudyTools: + """ + This class provides several methods to manipulate geom objects in Salome + study. The parameter `studyEditor` defines a + :class:`~salome.kernel.studyedit.StudyEditor` object used to access the study. If + :const:`None`, the method returns a :class:`~salome.kernel.studyedit.StudyEditor` + object on the current study. + + .. attribute:: editor + + This instance attribute contains the underlying + :class:`~salome.kernel.studyedit.StudyEditor` object. It can be used to access + the study but the attribute itself should not be modified. + + """ + + def __init__(self, studyEditor = None): + global GEOM + if GEOM is None: + GEOM = __import__("GEOM") + if studyEditor is None: + studyEditor = getStudyEditor() + self.editor = studyEditor + + # ====================================================================== + # Helper functions to add/remove a geometrical shape in/from the study + # ====================================================================== + def addShapeToStudy(self, shape,shapeName,folderName=None): + """ + Add a GEOM shape in the study. It returns the associated entry + that corresponds to the identifier of the entry in the study. This + entry can be used to retrieve an object in the study. A folderName + can be specified. In this case, a folder with this name is first + created in the Geometry part of the study, and the shape study + object is stored in this folder of the study. + + :type shape: GEOM object + :param shape: the GEOM object defining the shape + + :type shapeName: string + :param shapeName: the name for this shape in the study + + :type folderName: string + :param folderName: the name of a folder in the GEOM part of the study + """ + study = self.editor.study + studyId = study._get_StudyId() + geompy = getGeompy(studyId) + + if folderName is None: + # Insert the shape in the study by the standard way + entry = geompy.addToStudy( shape, shapeName ) + else: + # A folder name has been specified to embed this shape. Find + # or create a folder with this name in the Geometry study, and + # then store the shape in this folder. + geomStudyFolder = self.editor.findOrCreateComponent("GEOM") + shapeStudyFolder = self.editor.findOrCreateItem(geomStudyFolder,folderName) + + shapeIor = salome.orb.object_to_string(shape) + geomgui = salome.ImportComponentGUI("GEOM") + shapeIcon = geomgui.getShapeTypeIcon(shapeIor) + + shapeStudyObject = self.editor.createItem(shapeStudyFolder, + name=shapeName, + IOR=shapeIor, + icon=shapeIcon) + entry = shapeStudyObject.GetID() + + return entry + + def removeFromStudy(self, shapeStudyEntry): + """ + This removes the specified entry from the study. Note that this + operation does not destroy the underlying GEOM object, neither + erase the drawing in the viewer. + The underlying GEOM object is returned (so that it can be destroyed) + """ + study = self.editor.study + studyId = study._get_StudyId() + shape = self.getGeomObjectFromEntry(shapeStudyEntry) + studyObject = IDToSObject(shapeStudyEntry) + self.editor.removeItem(studyObject,True) + return shape + + # ====================================================================== + # Helper functions to display/erase a shape in/from the viewer. The + # shape must be previously put in the study and the study entry must + # be known. Note also that these function works implicitly on the + # active study (WARN: it does not ensure consistency with the + # study associated to the studyEditor used to initiate this + # object. It's up to you to be self-consistent (or to improve this + # python source code). + # ====================================================================== + + def displayShapeByName(self, shapeName, color = None, fit=True): + """ + Display the geometrical shape whose name in the study is `shapeName`. + + :type shapeName: string + :param shapeName: name of the geometrical shape + + :type color: tuple (triplet) + :param color: RGB components of the color of the shape + + :return: True if the shape was found, False otherwise + """ + logger.debug("displayShapeByName in PAL: %s with color %s" % + (shapeName, color)) + listSO = self.editor.study.FindObjectByName(shapeName, "GEOM") + for sObj in listSO: + entry = sObj.GetID() + geomObj = self.editor.getOrLoadObject(sObj) + if geomObj: + shape = geomObj._narrow(GEOM.GEOM_Object) + if shape: + return self.displayShapeByEntry(entry,color,fit) + return False + + def displayShapeByEntry(self, shapeStudyEntry, color = None, fit=True): + """ + Display the geometrical shape whose entry is given by + `entry`. You should prefer use this function instead of the + displayShapeByName which can have an unpredictible behavior in + the case where several objects exist with the same name in the + study. + """ + geomgui = salome.ImportComponentGUI("GEOM") + if fit: + geomgui.createAndDisplayFitAllGO(shapeStudyEntry) + else: + geomgui.createAndDisplayGO(shapeStudyEntry) + geomgui.setDisplayMode(shapeStudyEntry, DisplayMode) + if color is not None: + geomgui.setColor(shapeStudyEntry, color[0], color[1], color[2]) + return True + + def eraseShapeByEntry(self, shapeStudyEntry): + """ + Erase the geometrical shape whose entry is given by + `entry`. Please note that the shape is just erased from the + viewer. The associated study object still exists in the study, + and the geom object still exists in the GEOM engine. + """ + geomgui = salome.ImportComponentGUI("GEOM") + eraseFromAllWindows=True + geomgui.eraseGO(shapeStudyEntry,eraseFromAllWindows) + return True + + + # ====================================================================== + # Helper functions for a complete suppression of a shape from the + # SALOME session. + # ====================================================================== + def deleteShape(self,shapeStudyEntry): + """ + This completly deletes a geom shape. + + WARNING: please be aware that to delete a geom object, you have + three operations to perform: + + 1. erase the shape from the viewers + 2. remove the entry from the study + 3. destroy the underlying geom object + """ + self.eraseShapeByEntry(shapeStudyEntry) + shape = self.removeFromStudy(shapeStudyEntry) + shape.Destroy() + + # ====================================================================== + # Helper functions for interactivity with the object browser + # ====================================================================== + def getGeomObjectSelected(self): + ''' + Returns the GEOM object currently selected in the objects browser. + ''' + sobject, entry = guihelper.getSObjectSelected() + geomObject = self.getGeomObjectFromEntry(entry) + return geomObject + + def getGeomObjectFromEntry(self,entry): + ''' + Returns the GEOM object associated to the specified entry, + (the entry is the identifier of an item in the active study) + ''' + if entry is None: + return None + geomObject=IDToObject(entry, self.editor.study) + return geomObject._narrow(GEOM.GEOM_Object) + +# +# ================================================================== +# Use cases and demo functions +# ================================================================== +# + +# How to test? +# 1. Run a SALOME application including GEOM, and create a new study +# 2. In the console, enter: +# >>> from salome.geom import geomtools +# >>> geomtools.TEST_createBox() +# 3. Select the object named "box" in the browser +# 4. In the console, enter: +# >>> geomtools.TEST_getGeomObjectSelected() + +def TEST_createBox(): + geompy = getGeompy() + box = geompy.MakeBoxDXDYDZ(200, 200, 200) + geompy.addToStudy( box, 'box' ) + if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) + + +def TEST_getGeomObjectSelected(): + tool = GeomStudyTools() + myGeomObject = tool.getGeomObjectSelected() + print myGeomObject + +def TEST_createAndDeleteShape(): + """ + This test is a simple use case that illustrates how to create a + GEOM shape in a SALOME session (create the GEOM object, put in in + the study, and display the shape in a viewer) and delete a shape + from a SALOME session (erase the shape from the viewer, delete the + entry from the study, and finally destroy the underlying GEOM + object). + """ + import salome + salome.salome_init() + study = salome.myStudy + studyId = salome.myStudyId + + from salome.geom import geomtools + geompy = geomtools.getGeompy(studyId) + + from salome.kernel.studyedit import getStudyEditor + studyEditor = getStudyEditor(studyId) + + gst = geomtools.GeomStudyTools(studyEditor) + + # -------------------------------------------------- + # Create a first shape (GEOM object) + radius = 5 + length = 100 + cylinder = geompy.MakeCylinderRH(radius, length) + + # Register the shape in the study, at the root of the GEOM + # folder. A name must be specified. The register operation + # (addShapeToStudy) returns an identifier of the entry in the study. + cylinderName = "cyl.r%s.l%s"%(radius,length) + cylinderStudyEntry = gst.addShapeToStudy(cylinder, cylinderName) + + # Display the registered shape in a viewer + gst.displayShapeByEntry(cylinderStudyEntry) + + # -------------------------------------------------- + # A second shape + radius = 10 + sphere = geompy.MakeSphereR(radius) + sphereName = "sph.r%s"%radius + sphereStudyEntry = gst.addShapeToStudy(sphere, sphereName) + gst.displayShapeByEntry(sphereStudyEntry) + + # -------------------------------------------------- + # This new shape is stored in the study, but in a specific + # sub-folder, and is displayed in the viewer with a specific + # color. + length = 20 + box = geompy.MakeBoxDXDYDZ(length,length,length) + boxName = "box.l%s"%length + folderName = "boxset" + boxStudyEntry = gst.addShapeToStudy(box, boxName, folderName) + gst.displayShapeByEntry(boxStudyEntry,PreviewColor) + + # -------------------------------------------------- + # In this example, we illustrate how to erase a shape (the sphere) + # from the viewer. After this operation, the sphere is no longer + # displayed but still exists in the study. You can then redisplay + # it using the context menu of the SALOME object browser. + gst.eraseShapeByEntry(sphereStudyEntry) + + # -------------------------------------------------- + # In this last example, we completly delete an object from the + # SALOME session (erase from viewer, remove from study and finnaly + # destroy the object). This is done by a simple call to + # deleteShape(). + gst.deleteShape(cylinderStudyEntry) + + # -------------------------------------------------- + # At the end of the executioon of this test, you should have in + # the SALOME session: + # - the box, in a dedicated folder of the study, and displayed in the viewer + # - the sphere, in the standard place of the study, and not displayed + + # If you comment the deleteShape line, you should see the cylinder + # in the study and displayed in the viewer. + +if __name__ == "__main__": + #TEST_getGeomObjectSelected() + TEST_createAndDeleteShape() + + + diff --git a/src/GEOM_PY/sketcher.py b/src/GEOM_PY/sketcher.py new file mode 100644 index 000000000..aeba6b43b --- /dev/null +++ b/src/GEOM_PY/sketcher.py @@ -0,0 +1,140 @@ +# -*- coding: iso-8859-1 -*- +# +# Copyright (C) 2007-2012 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 +# +""" +This module provides the user with a simple python API to realize +various sketches from the GEOM text user interface. + +Example:: + + from salome.geom.sketcher import Sketcher + + # Create the sketch + mysketcher = Sketcher() + mysketcher.startAtPoint(0,0) + mysketcher.translateToPoint(100,0) + mysketcher.translateWithAngleAndLength(30,100) + mysketcher.intersectYWithAngle(15,100) + mysketcher.close() + + # Get the geom object + wire = mysketcher.getGeomWire() + + # Put it in the study + import geompy + geompy.addToStudy( wire, 'mysketch' ) + +Additionnal examples can be found as unit tests in the source code. +""" + +geompyEnable = True +try: + import geompy +except: + geompyEnable = False + + +class Sketcher: + + __sketch = None + __xstart = 0 + __ystart = 0 + + def __init__(self): + self.__sketch = "Sketcher:" + + def startAtPoint(self,x=0,y=0): + self.__sketch = "Sketcher:F "+str(x)+" "+str(y) + # the data x and y are registered to process the ending closure. + self.__xstart = x + self.__ystart = y + + def translateToPoint(self,x=10,y=0): + '''segment->point->absolute''' + self.__sketch = self.__sketch + ":TT "+str(x)+" "+str(y) + + def translateWithVector(self,deltax=10,deltay=0): + '''segment->point->relative''' + self.__sketch = self.__sketch + ":T "+str(deltax)+" "+str(deltay) + + #def translateToSelection(self,vertex): + # '''segment->point->selection''' + # self.__sketch = self.__sketch + ":T "+str(deltax)+" "+str(deltay) + + def translateWithAngleAndLength(self,angle=30,length=100): + '''segment->direction->angle+length''' + self.__sketch = self.__sketch + ":R "+str(angle)+":L "+str(length) + + def intersectXWithAngle(self,angle=30,x=100): + '''segment->direction->angle+length''' + self.__sketch = self.__sketch + ":R "+str(angle)+":IX "+str(x) + + def intersectYWithAngle(self,angle=30,y=100): + '''segment->direction->angle+length''' + self.__sketch = self.__sketch + ":R "+str(angle)+":IY "+str(y) + + def close(self): + ''' + add a segment to reach the starting point and get a closed wire. + ''' + self.__sketch = self.__sketch + ":WW" + + def toString(self): + return self.__sketch + + def getGeomWire(self): + if not geompyEnable: + return None + wire = geompy.MakeSketcher(self.__sketch, [0, 0, 0, 0, 0, 1, 1, 0, -0]) + return wire +# +# =============================================================== +# Use cases and unit tests +# =============================================================== +# +def TEST_toString(): + mysketcher = Sketcher() + + mysketcher.startAtPoint(1.234,4.321) + mysketcher.translateToPoint(2.234,5.321) + + expectedResult = "Sketcher:F 1.234 4.321:TT 2.234 5.321" + result = mysketcher.toString() + print "sketcher=",mysketcher.toString() + if result == expectedResult: + print "OK" + else: + print "Not OK" + +def TEST_usingGeom(): + mysketcher = Sketcher() + mysketcher.startAtPoint(0,0) + mysketcher.translateToPoint(100,0) + mysketcher.translateWithAngleAndLength(30,100) + mysketcher.intersectYWithAngle(15,100) + mysketcher.close() + wire = mysketcher.getGeomWire() + if geompyEnable: + geompy.addToStudy( wire, "Sketch" ) + + +if __name__ == "__main__": + #TEST_toString() + TEST_usingGeom() diff --git a/src/GEOM_PY/structelem/Makefile.am b/src/GEOM_PY/structelem/Makefile.am new file mode 100644 index 000000000..de334fe4f --- /dev/null +++ b/src/GEOM_PY/structelem/Makefile.am @@ -0,0 +1,26 @@ +# Copyright (C) 2007-2012 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 + +salomepypkgdir = $(salomepythondir)/salome/geom/structelem +salomepypkg_PYTHON = \ + __init__.py \ + parts.py \ + orientation.py diff --git a/src/GEOM_PY/structelem/__init__.py b/src/GEOM_PY/structelem/__init__.py new file mode 100644 index 000000000..8f90c0002 --- /dev/null +++ b/src/GEOM_PY/structelem/__init__.py @@ -0,0 +1,480 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2007-2012 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 +# +""" +This package is used to create and visualize structural elements. It contains +three modules: + +* This module :mod:`salome.geom.structelem` defines the main classes + :class:`StructuralElement` and :class:`StructuralElementManager` that can be + directly used to build structural elements. +* The module :mod:`salome.geom.structelem.parts` defines the classes corresponding to + the different parts (beams, grids, etc.) that make up a structural element. + It is used to build the geometric shapes in the structural element. +* The module :mod:`salome.geom.structelem.orientation` defines the classes that are + used to compute the orientation of the structural element parts and to build + the corresponding markers. + +A structural element is a set of geometric shapes (beams, grids, etc.) that +are built semi-automatically along a set of geometric primitives (edges for +instance). They are visualized with the same color as their base primitives in +the geom viewer. + +Structural elements are generally created by the +:class:`StructuralElementManager` class, from a list of commands describing +the element to create. + +Example:: + + commandList = [('VisuPoutreGenerale', {'Group_Maille': 'Edge_1'}), + ('VisuBarreCercle', + {'R': 30, 'Group_Maille': 'Edge_1', 'EP': 15}), + ] + + structElemManager = StructuralElementManager() + elem = structElemManager.createElement(commandList) + elem.display() + salome.sg.updateObjBrowser(True) + +""" + +import types + +import salome + +from salome.kernel.logger import Logger +from salome.kernel import termcolor +logger = Logger("salome.geom.structelem", color = termcolor.RED) +from salome.kernel.studyedit import getStudyEditor + +__all__ = ["parts", "orientation"] + +from salome.geom.structelem import parts +from salome.geom.structelem.parts import InvalidParameterError + +class StructuralElementManager: + """ + This class manages the structural elements in the study. It is used to + create a new structural element from a list of commands. The parameter + `studyId` defines the ID of the study in which the manager will create + structural elements. If it is :const:`None` or not specified, it will use + the ID of the current study as defined by + :func:`salome.kernel.studyedit.getActiveStudyId` function. + """ + def __init__(self, studyId = None): + self._studyEditor = getStudyEditor(studyId) + + def createElement(self, commandList): + """ + Create a structural element from the list of commands `commandList`. + Each command in this list represent a part of the structural element, + that is a specific kind of shape (circular beam, grid, etc.) + associated with one or several geometrical primitives. A command must + be a tuple. The first element is the structural element part class + name or alias name. The second element is a dictionary containing the + parameters describing the part. Valid class names are all the classes + defined in the module :mod:`~salome.geom.structelem.parts` and inheriting + class :class:`~parts.StructuralElementPart`. There are also several + aliases for backward compatibility. Here is the complete list: + + * :class:`~parts.GeneralBeam` + * :class:`~parts.CircularBeam` + * :class:`~parts.RectangularBeam` + * :class:`~parts.ThickShell` + * :class:`~parts.Grid` + + * :func:`~parts.VisuPoutreGenerale` (alias for + :class:`~parts.GeneralBeam`) + * :func:`~parts.VisuPoutreCercle` (alias for + :class:`~parts.CircularBeam`) + * :func:`~parts.VisuPoutreRectangle` (alias for + :class:`~parts.RectangularBeam`) + * :func:`~parts.VisuBarreGenerale` (alias for + :class:`~parts.GeneralBeam`) + * :func:`~parts.VisuBarreRectangle` (alias for + :class:`~parts.RectangularBeam`) + * :func:`~parts.VisuBarreCercle` (alias for + :class:`~parts.CircularBeam`) + * :func:`~parts.VisuCable` (alias for :class:`~parts.CircularBeam`) + * :func:`~parts.VisuCoque` (alias for :class:`~parts.ThickShell`) + * :func:`~parts.VisuGrille` (alias for :class:`~parts.Grid`) + + * ``Orientation``: This identifier is used to specify the orientation + of one or several 1D structural element parts (i.e. beams). The + parameters are described in class + :class:`~orientation.Orientation1D`. + + The valid parameters in the dictionary depend on the type of the + structural element part, and are detailed in the documentation of + the corresponding class. The only parameter that is common to all the + classes is "MeshGroups" (that can also be named "Group_Maille"). It + defines the name of the geometrical object(s) in the study that will + be used as primitives to build the structural element part. This + parameter can be either a list of strings or a single string with + comma separated names. + """ + logger.debug("StructuralElementManager.createElement: START") + logger.debug("Command list: %s" % commandList) + + element = StructuralElement(self._studyEditor.studyId) + orientationCmdList = [] + for command in commandList: + (parttype, parameters) = command + if parttype == "Orientation": + orientationCmdList += [command] + elif parttype not in dir(parts): + logger.warning('Invalid structural element part name "%s"' + ' in command %s, this command will be ' + 'ignored.' % (parttype, command)) + else: + (meshGroupList, newparams) = self._extractMeshGroups(command) + for meshGroup in meshGroupList: + # Get the geometrical primitive object + groupSObj = self._studyEditor.study.FindObject(meshGroup) + groupGeomObj = None + if groupSObj is not None: + groupGeomObj = \ + self._studyEditor.getOrLoadObject(groupSObj) + if groupGeomObj is None: + logger.error("Can't get geom object corresponding to " + 'mesh group "%s", structural element ' + "part %s will not be built." % + (groupName, part)) + continue + + # Create the part + try: + part = parts.__dict__[parttype]( + self._studyEditor.studyId, meshGroup, + groupGeomObj, newparams) + element.addPart(part) + except InvalidParameterError, e: + logger.error("Invalid parameter error: %s" % e) + raise + except: + logger.exception("Can't create structural element" + " part with command %s." % + str(command)) + + # Orientations are parsed after the parts because they must be + # associated with existing parts. + for command in orientationCmdList: + (parttype, parameters) = command + (meshGroupList, orientParams) = self._extractMeshGroups(command) + for meshGroup in meshGroupList: + element.addOrientation(meshGroup, orientParams) + + element.build() + logger.debug("StructuralElementManager.createElement: END") + return element + + def _extractMeshGroups(self, command): + """ + This method extracts the names of the mesh groups (i.e. the + geometrical objects used to build the structural element part) in the + command in parameter. It returns a tuple containing the mesh groups as + a list of strings and the other parameters of the command as a new + dictionary. + """ + (parttype, parameters) = command + newparams = parameters.copy() + groupMailleParam = newparams.pop("Group_Maille", None) + meshGroupParam = newparams.pop("MeshGroups", None) + if groupMailleParam is None and meshGroupParam is None: + logger.warning("No mesh group specified in command %s, this " + "command will be ignored." % command) + return ([], newparams) + elif groupMailleParam is not None and meshGroupParam is not None: + logger.warning('Both "MeshGroups" and "Group_Maille" specified in' + ' command %s, only "MeshGroups" will be used.' % + command) + elif groupMailleParam is not None and meshGroupParam is None: + meshGroupParam = groupMailleParam + + meshGroupList = [] + if type(meshGroupParam) == types.StringType: + meshGroupList = self._getMeshGroupListFromString(meshGroupParam) + else: + for item in meshGroupParam: + meshGroupList += self._getMeshGroupListFromString(item) + + if len(meshGroupList) == 0: + logger.warning("Mesh group list is empty in command %s, this " + "command will be ignored." % command) + + return (meshGroupList, newparams) + + def _getMeshGroupListFromString(self, meshString): + """ + This method splits the string in parameter to extract comma separated + names. Those names are returned as a list of strings. + """ + meshGroupList = [] + list = meshString.split(",") + for item in list: + strippedItem = item.strip() + if len(strippedItem) > 0: + meshGroupList.append(strippedItem) + return meshGroupList + + +class StructuralElement: + """ + This class represents a structural element, i.e. a set of geometrical + objects built along geometrical primitives. The parameter `studyId` + defines the ID of the study that will contain the structural element. If + it is :const:`None` or not specified, the constructor will use the ID of + the active study as defined by :func:`salome.kernel.studyedit.getActiveStudyId` + function. Structural elements are normally created by the class + :class:`StructuralElementManager`, so this class should not be + instantiated directly in the general case. + """ + _counter = 1 + _mainFolderTag = 14725 + + def __init__(self, studyId = None): + # _parts is the dictionary mapping group name to structural element + # part. _shapeDict is the dictionary mapping SubShapeID objects to + # structural element parts. Both are used to avoid duplicate shapes + # in structural elements. + self._parts = {} + self._shapeDict = {} + self._id = StructuralElement._counter + StructuralElement._counter += 1 + self._studyEditor = getStudyEditor(studyId) + logger.debug("Creating structural element in study %s" % + self._studyEditor.studyId) + self._SObject = None + + def _getSObject(self): + """ + Find or create the study object corresponding to the structural + element. This object is named "SE_N" where N is a numerical ID. + """ + if self._SObject is None: + geomComponent = self._studyEditor.study.FindComponent("GEOM") + mainFolder = self._studyEditor.setItemAtTag(geomComponent, + StructuralElement._mainFolderTag, + name = "Structural Elements") + self._SObject = self._studyEditor.findOrCreateItem(mainFolder, + name = "SE_" + str(self._id)) + return self._SObject + + def addPart(self, newpart): + """ + Add a part to the structural element. + + :type newpart: :class:`~parts.StructuralElementPart` + :param newpart: the part to add to the structural element. + + """ + newshapes = newpart.baseShapesSet + + # Check duplicate groups + if self._parts.has_key(newpart.groupName): + logger.warning('Mesh group "%s" is used several times in the ' + 'structural element. Only the last definition ' + 'will be used.' % newpart.groupName) + else: + # Check duplicate shapes + intersect = newshapes.intersection(self._shapeDict.keys()) + while len(intersect) > 0: + shape, = intersect + oldpartwithshape = self._shapeDict[shape] + oldpartshapes = oldpartwithshape.baseShapesSet + intersectwitholdpart = intersect.intersection(oldpartshapes) + logger.warning('Some shapes are common to groups "%s" and ' + '"%s". For those, the parameters defined for ' + '"%s" will be used.' % + (oldpartwithshape.groupName, newpart.groupName, + newpart.groupName)) + oldpartwithshape.baseShapesSet = \ + oldpartshapes.difference(intersectwitholdpart) + intersect = intersect.difference(intersectwitholdpart) + + # Finally add the new part in the structural element + self._parts[newpart.groupName] = newpart + for shape in newshapes: + self._shapeDict[shape] = newpart + + def addOrientation(self, meshGroup, orientParams): + """ + Add orientation information to a part in the structural element. This + information will be used to build the corresponding markers. + + :type meshGroup: string + :param meshGroup: the name of a geometrical primitive. The orientation + information will apply to the structural element + part built along this primitive. + + :type orientParams: dictionary + :param orientParams: parameters defining the orientation of the + structural element part. Those parameters are + detailed in class + :class:`~orientation.Orientation1D`. + + """ + if self._parts.has_key(meshGroup): + self._parts[meshGroup].addOrientation(orientParams) + else: + logger.warning('Mesh group "%s" not found in structural element, ' + 'cannot set orientation.' % meshGroup) + + def build(self): + """ + Build the geometric shapes and the markers corresponding to the + different parts of the structural element, and add them to the study. + """ + gg = salome.ImportComponentGUI("GEOM") + for part in self._parts.itervalues(): + # Build the structural element part + logger.debug("Building %s" % part) + try: + (shape, markers) = part.build() + if shape is None: + logger.error("Part %s has not been built" % part) + continue + except: + logger.exception("Couldn't build part %s" % part) + continue + + # Add the new objects to the study + IOR = self._studyEditor.study.ConvertObjectToIOR(shape) + shapeSObjName = part.name + "_" + part.groupName + icon = None + if salome.hasDesktop(): + icon = gg.getShapeTypeIcon(IOR) + shapeSObj = self._studyEditor.createItem(self._getSObject(), + name = shapeSObjName, IOR = IOR, + icon = icon) + if markers is not None and len(markers) > 0: + i = 1 + for marker in markers: + markerIOR = \ + self._studyEditor.study.ConvertObjectToIOR(marker) + markerSObjName = "Orient_" + shapeSObjName + if len(markers) > 1: + markerSObjName += "_%d" % i + markerSObj = self._studyEditor.createItem( + self._getSObject(), + name = markerSObjName, + IOR = markerIOR, + icon = "ICON_OBJBROWSER_LCS") + i += 1 + + def display(self): + """ + Display the structural element in the geom view. + """ + StructuralElement.showElement(self._SObject) + + @staticmethod + def showElement(theSObject): + """ + Display the structural element corresponding to the study object + `theSObject` + """ + if theSObject is not None: + gg = salome.ImportComponentGUI("GEOM") + aStudy = theSObject.GetStudy() + editor = getStudyEditor(aStudy._get_StudyId()) + aIterator = aStudy.NewChildIterator(theSObject) + aIterator.Init() + while aIterator.More(): + sobj = aIterator.Value() + icon = editor.getIcon(sobj) + if icon != "ICON_OBJBROWSER_LCS": + entry = aIterator.Value().GetID() + gg.createAndDisplayGO(entry) + gg.setDisplayMode(entry, 1) + aIterator.Next() + + +def TEST_CreateGeometry(): + import geompy + import SALOMEDS + geompy.init_geom(salome.myStudy) + Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) + edges = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["EDGE"]) + geompy.addToStudy(Box_1, "Box_1") + for i in range(len(edges)): + geompy.addToStudyInFather(Box_1, edges[i], "Edge_%d" % i) + faces = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"]) + faces[3].SetColor(SALOMEDS.Color(1.0,0.5,0.0)) + faces[4].SetColor(SALOMEDS.Color(0.0,1.0,0.5)) + for i in range(len(faces)): + geompy.addToStudyInFather(Box_1, faces[i], "Face_%d" % i) + Cylinder_1 = geompy.MakeCylinderRH(50, 200) + geompy.TranslateDXDYDZ(Cylinder_1, 300, 300, 0) + cyl_faces = geompy.SubShapeAllSorted(Cylinder_1, geompy.ShapeType["FACE"]) + geompy.addToStudy(Cylinder_1, "Cylinder_1") + for i in range(len(cyl_faces)): + geompy.addToStudyInFather(Cylinder_1, cyl_faces[i], "CylFace_%d" % i) + Cylinder_2 = geompy.MakeTranslation(Cylinder_1, 100, 100, 0) + cyl_faces2 = geompy.SubShapeAllSorted(Cylinder_2, + geompy.ShapeType["FACE"]) + geompy.addToStudy(Cylinder_2, "Cylinder_2") + for i in range(len(cyl_faces2)): + geompy.addToStudyInFather(Cylinder_2, cyl_faces2[i], + "CylFace2_%d" % i) + + +def TEST_StructuralElement(): + salome.salome_init() + TEST_CreateGeometry() + liste_commandes = [('Orientation', {'MeshGroups': 'Edge_4', + 'VECT_Y': (1.0, 0.0, 1.0)}), + ('Orientation', {'MeshGroups': 'Edge_5', + 'ANGL_VRIL': 45.0}), + ('GeneralBeam', {'MeshGroups': 'Edge_1, Edge_7', + 'A': 1, 'IY1': 20, 'IY2': 40, + 'IZ1': 60, 'IZ2': 30}), + ('VisuPoutreCercle', {'MeshGroups': ['Edge_6'], + 'R1': 30, 'R2': 20}), + ('CircularBeam', {'MeshGroups': ['Edge_2', 'Edge_3'], + 'R': 40, 'EP': 20}), + ('RectangularBeam', {'MeshGroups': 'Edge_4, Edge_5', + 'HZ1': 60, 'HY1': 40, + 'EPZ1': 15, 'EPY1': 10, + 'HZ2': 40, 'HY2': 60, + 'EPZ2': 10, 'EPY2': 15}), + ('VisuCable', {'MeshGroups': 'Edge_7', 'R': 5}), + ('VisuCoque', {'MeshGroups': 'Face_4', + 'Epais': 10, 'Excentre': 5, + 'angleAlpha': 45, 'angleBeta': 60}), + ('VisuCoque', {'MeshGroups': 'CylFace_2', 'Epais': 5}), + ('VisuGrille', {'MeshGroups': 'Face_5', 'Excentre': 5, + 'angleAlpha': 45, 'angleBeta': 60}), + ('VisuGrille', {'MeshGroups': 'CylFace2_2', + 'Excentre': 5, 'origAxeX': 400, + 'origAxeY': 400, 'origAxeZ': 0, + 'axeX': 0, 'axeY': 0, 'axeZ': 100}), + ] + + structElemManager = StructuralElementManager() + elem = structElemManager.createElement(liste_commandes) + if salome.hasDesktop(): + elem.display() + salome.sg.updateObjBrowser(True) + + +# Main function only used to test the module +if __name__ == "__main__": + TEST_StructuralElement() diff --git a/src/GEOM_PY/structelem/orientation.py b/src/GEOM_PY/structelem/orientation.py new file mode 100644 index 000000000..7ecae7789 --- /dev/null +++ b/src/GEOM_PY/structelem/orientation.py @@ -0,0 +1,262 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2007-2012 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 +# +""" +This module is used to compute the orientation of the different parts in a +structural element and to build the corresponding markers (trihedrons). +""" + +import math + +from salome.kernel.logger import Logger +from salome.kernel import termcolor +logger = Logger("__PAL_GEOM__.structelem.orientation", color = termcolor.RED) + + +class Orientation1D: + """ + This class is used to compute the orientation of 1D elements and to build + the corresponding markers. + """ + + def __init__(self): + self.geom = None + self._vectorYCoords = None + self._angle = 0.0 + + def __repr__(self): + reprdict = self.__dict__.copy() + del reprdict["geom"] + return '%s(%s)' % (self.__class__.__name__, reprdict) + + def addParams(self, params): + """ + Add orientation parameters. `params` is a dictionary containing one or + several orientation parameters. The valid parameters are: + + * "VECT_Y": Triplet defining the local Y axis (the X axis is the + main direction of the 1D element). + * "ANGL_VRIL": Angle of rotation along the X axis to define the local + coordinate system. + + The parameters can be specified several times. In this case, only the + first "VECT_Y" is taken into account, and the values of "ANGL_VRIL" + are added to obtain the total rotation angle. + """ + mydict = params.copy() + if mydict.has_key("VECT_Y"): + newVecCoords = mydict.pop("VECT_Y") + if self._vectorYCoords is None: + logger.debug("Setting orientation vector Y to %s" % + str(newVecCoords)) + self._vectorYCoords = newVecCoords + else: + logger.warning('Orientation parameter "VECT_Y" is specified ' + 'several times for the same mesh group, vector' + ' %s will be used' % str(self._vectorYCoords)) + if mydict.has_key("ANGL_VRIL"): + newAngle = mydict.pop("ANGL_VRIL") + self._angle += newAngle + logger.debug("Adding angle %f to orientation, new angle is %f." % + (newAngle, self._angle)) + if len(mydict) > 0: + logger.warning("Invalid orientation parameter(s) (ignored): %s" % + str(mydict)) + + def _getDefaultVecYZ(self, center, vecX): + """ + Get the vectors Y and Z for the default LCS, that use the main + direction of the 1D object as the local X axis and the global Z axis + to determine the local Z axis. + """ + xPoint = self.geom.MakeTranslationVector(center, vecX) + givenVecZ = self.geom.MakeVectorDXDYDZ(0.0, 0.0, 1.0) + angle = self.geom.GetAngleRadians(vecX, givenVecZ) + if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7: + logger.warning("Beam X axis is colinear to absolute Z axis. " + "Absolute X axis will be used to determine " + "local Z axis.") + givenVecZ = self.geom.MakeVectorDXDYDZ(1.0, 0.0, 0.0) + zPoint = self.geom.MakeTranslationVector(center, givenVecZ) + locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, xPoint, 1.0) + locY = self.geom.GetNormal(locPlaneZX) + yPoint = self.geom.MakeTranslationVector(center, locY) + locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint, yPoint, 1.0) + locZ = self.geom.GetNormal(locPlaneXY) + return (locY, locZ) + + def buildMarker(self, geom, center, vecX): + """ + Create a marker with origin `center` and X axis `vecX`. `geom` is the + pseudo-geompy object used to build the geometric shapes. + """ + (locY, locZ) = self.getVecYZ(geom, center, vecX) + marker = geom.MakeMarkerPntTwoVec(center, vecX, locY) + return marker + + def getVecYZ(self, geom, center, vecX): + """ + Get the vectors Y and Z for the LCS with origin `center` and X axis + `vecX`. `geom` is the pseudo-geompy object used to build the geometric + shapes. + """ + self.geom = geom + locY = None + locZ = None + if self._vectorYCoords is None: + (locY, locZ) = self._getDefaultVecYZ(center, vecX) + else: + xPoint = self.geom.MakeTranslationVector(center, vecX) + givenLocY = self.geom.MakeVectorDXDYDZ(self._vectorYCoords[0], + self._vectorYCoords[1], + self._vectorYCoords[2]) + angle = self.geom.GetAngleRadians(vecX, givenLocY) + if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7: + logger.warning("Vector Y is colinear to the beam X axis, " + "using default LCS.") + (locY, locZ) = self._getDefaultVecYZ(center, vecX) + else: + yPoint = self.geom.MakeTranslationVector(center, givenLocY) + locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint, + yPoint, 1.0) + locZ = self.geom.GetNormal(locPlaneXY) + zPoint = self.geom.MakeTranslationVector(center, locZ) + locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, + xPoint, 1.0) + locY = self.geom.GetNormal(locPlaneZX) + + if self._angle != 0.0: + angleRad = math.radians(self._angle) + locY = self.geom.Rotate(locY, vecX, angleRad) + locZ = self.geom.Rotate(locZ, vecX, angleRad) + + return (locY, locZ) + + +class Orientation2D: + """ + This class is used to compute the orientation of 2D elements and to build + the corresponding markers. Angles `alpha` and `beta` are used to determine + the local coordinate system for the 2D element. If `vect` is not + :const:`None`, it is used instead of `alpha` and `beta`. + """ + + def __init__(self, alpha, beta, vect): + self.geom = None + self._alpha = alpha + self._beta = beta + self._vect = vect + + def __repr__(self): + reprdict = self.__dict__.copy() + del reprdict["geom"] + return '%s(%s)' % (self.__class__.__name__, reprdict) + + def _buildDefaultMarker(self, center, normal, warnings = True): + """ + Create the default marker, that use the normal vector of the 2D object + as the local Z axis and the global X axis to determine the local X + axis. `warnings` can be used to enable or disable the logging of + warning messages. + """ + marker = None + globalVecX = self.geom.MakeVectorDXDYDZ(1.0, 0.0, 0.0) + angle = self.geom.GetAngleRadians(normal, globalVecX) + if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7: + if warnings: + logger.warning("Face normal is colinear to absolute X axis. " + "Absolute Y axis will be used to determine " + "local X axis.") + globalVecY = self.geom.MakeVectorDXDYDZ(0.0, 1.0, 0.0) + marker = self._buildMarkerRefVecX(center, normal, globalVecY) + else: + marker = self._buildMarkerRefVecX(center, normal, globalVecX) + return marker + + def _buildMarkerRefVecX(self, center, normal, refVecX): + """ + Create a marker using `normal` as Z axis and `refVecX` to determine + the X axis. + """ + xPoint = self.geom.MakeTranslationVector(center, refVecX) + zPoint = self.geom.MakeTranslationVector(center, normal) + locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, xPoint, 1.0) + locY = self.geom.GetNormal(locPlaneZX) + yPoint = self.geom.MakeTranslationVector(center, locY) + locPlaneYZ = self.geom.MakePlaneThreePnt(center, yPoint, zPoint, 1.0) + locX = self.geom.GetNormal(locPlaneYZ) + marker = self.geom.MakeMarkerPntTwoVec(center, locX, locY) + return marker + + def buildMarker(self, geom, center, normal, warnings = True): + """ + Create a marker with origin `center` and `normal` as Z axis. The other + axes are computed using the parameters alpha and beta of the + Orientation2D instance. `geom` is the pseudo-geompy object used to + build the geometric shapes. `warnings` can be used to enable or + disable the logging of warning messages. + """ + self.geom = geom + marker = None + refVecX = None + if self._vect is not None: + # Using vector parameter + if abs(self._vect[0]) <= 1e-7 and abs(self._vect[1]) <= 1e-7 and \ + abs(self._vect[2]) <= 1e-7: + if warnings: + logger.warning("Vector too small: %s, using default LCS" % + self._vect) + else: + refVecX = self.geom.MakeVectorDXDYDZ(self._vect[0], + self._vect[1], + self._vect[2]) + elif self._alpha is not None and self._beta is not None: + # Using alpha and beta angles + alphaRad = math.radians(self._alpha) + betaRad = math.radians(self._beta) + if abs(alphaRad) <= 1e-7 and abs(betaRad) <= 1e-7: + if warnings: + logger.warning("Angles too small: (%g, %g), using " + "default LCS" % (self._alpha, self._beta)) + else: + # rotate global CS with angles alpha and beta + refVecX = self.geom.MakeVectorDXDYDZ(1.0, 0.0, 0.0) + refVecY = self.geom.MakeVectorDXDYDZ(0.0, 1.0, 0.0) + globalVecZ = self.geom.MakeVectorDXDYDZ(0.0, 0.0, 1.0) + if abs(alphaRad) > 1e-7: + refVecX = self.geom.Rotate(refVecX, globalVecZ, alphaRad) + refVecY = self.geom.Rotate(refVecY, globalVecZ, alphaRad) + if abs(betaRad) > 1e-7: + refVecX = self.geom.Rotate(refVecX, refVecY, betaRad) + + if refVecX is not None: + # build local coordinate system + angle = self.geom.GetAngleRadians(normal, refVecX) + if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7: + if warnings: + logger.warning("Face normal is colinear to the reference " + "X axis, using default LCS.") + else: + marker = self._buildMarkerRefVecX(center, normal, refVecX) + + if marker is None: + marker = self._buildDefaultMarker(center, normal, warnings) + + return marker diff --git a/src/GEOM_PY/structelem/parts.py b/src/GEOM_PY/structelem/parts.py new file mode 100644 index 000000000..538724268 --- /dev/null +++ b/src/GEOM_PY/structelem/parts.py @@ -0,0 +1,1013 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2007-2012 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 +# +""" +This module defines the different structural element parts. It is used to +build the geometric shapes of the structural elements. It should not be used +directly in the general case. Structural elements should be created by the +class :class:`~salome.geom.structelem.StructuralElementManager`. +""" + +import math + +import salome +import SALOMEDS + +from salome.kernel.logger import Logger +from salome.kernel import termcolor +logger = Logger("salome.geom.structelem.parts", color = termcolor.RED) +from salome.geom.geomtools import getGeompy + +import orientation + +# Filling for the beams +FULL = "FULL" +HOLLOW = "HOLLOW" + +# Minimum dimension for the shapes to extrude +MIN_DIM_FOR_EXTRUDED_SHAPE = 2e-4 +MIN_LENGTH_FOR_EXTRUSION = 1e-4 +MIN_THICKNESS = 1e-5 + +# Colors for the structural elements +GREEN = SALOMEDS.Color(0.0, 1.0, 0.0) +LIGHT_GREEN = SALOMEDS.Color(0.0, 1.0, 170.0/255.0) +BLUE = SALOMEDS.Color(0.0, 0.0, 1.0) +LIGHT_BLUE = SALOMEDS.Color(0.0, 0.5, 1.0) +RED = SALOMEDS.Color(1.0, 0.0, 0.0) +LIGHT_RED = SALOMEDS.Color(1.0, 0.5, 0.5) +PURPLE = SALOMEDS.Color(170.0/255.0, 85.0/255.0, 1.0) +ORANGE = SALOMEDS.Color(1.0, 170.0/255.0, 0.0) + + +class InvalidParameterError(Exception): + """ + This exception is raised when an invalid parameter is used to build a + structural element part. + """ + + def __init__(self, groupName, expression, minValue, value): + self.groupName = groupName + self.expression = expression + self.minValue = minValue + self.value = value + + def __str__(self): + return "%s < %g (%s = %g in %s)" % (self.expression, self.minValue, + self.expression, self.value, + self.groupName) + + +class SubShapeID: + """ + This class enables the use of sub-shapes in sets or as dictionary keys. + It implements __eq__ and __hash__ methods so that sub-shapes with the same + CORBA object `mainShape` and the same `id` are considered equal. + """ + + def __init__(self, mainShape, id): + self._mainShape = mainShape + self._id = id + + def getObj(self, geom): + """ + Return the sub-shape (GEOM object). `geom` is a pseudo-geompy object + used to find the geometrical object. + """ + return geom.GetSubShape(self._mainShape, [self._id]) + + def __eq__(self, other): + return self._mainShape._is_equivalent(other._mainShape) and \ + self._id == other._id + + def __hash__(self): + return self._mainShape._hash(2147483647) ^ self._id + + +class StructuralElementPart: + """ + This class is the base class for all structural element parts. It should + not be instantiated directly (consider it as an "abstract" class). + + :type studyId: integer + :param studyId: the ID of the study in which the part is created. + + :type groupName: string + :param groupName: the name of the underlying geometrical primitive in the + study. + + :type groupGeomObj: GEOM object + :param groupGeomObj: the underlying geometrical primitive. + + :type parameters: dictionary + :param parameters: parameters defining the structural element (see + subclasses for details). + + :type name: string + :param name: name to use for the created object in the study. + + """ + + DEFAULT_NAME = "StructElemPart" + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = DEFAULT_NAME, color = None): + self._parameters = parameters + self.groupName = groupName + self._groupGeomObj = groupGeomObj + self._orientation = None + self._paramUserName = {} + self.name = name + self.geom = getGeompy(studyId) + self.baseShapesSet = set() + self.isMainShape = groupGeomObj.IsMainShape() + if not self.isMainShape: + mainShape = self.geom.GetMainShape(groupGeomObj) + listIDs = self.geom.GetObjectIDs(groupGeomObj) + if mainShape is not None and listIDs is not None: + for id in listIDs: + self.baseShapesSet.add(SubShapeID(mainShape, id)) + self.color = color + if self.color is None: + self.color = self._groupGeomObj.GetColor() + + def _getParameter(self, nameList, default = None): + """ + This method finds the value of a parameter in the parameters + dictionary. The argument is a list because some parameters can have + several different names. + """ + if len(nameList) > 0: + paramName = nameList[0] + for name in nameList: + if self._parameters.has_key(name): + self._paramUserName[paramName] = name + return self._parameters[name] + return default + + def _getParamUserName(self, paramName): + """ + This method finds the user name for a parameter. + """ + if self._paramUserName.has_key(paramName): + return self._paramUserName[paramName] + else: + return paramName + + def __repr__(self): + reprdict = self.__dict__.copy() + del reprdict["_parameters"] + del reprdict["groupName"] + del reprdict["_groupGeomObj"] + del reprdict["_paramUserName"] + del reprdict["name"] + del reprdict["geom"] + del reprdict["baseShapesSet"] + return '%s("%s", %s)' % (self.__class__.__name__, self.groupName, + reprdict) + + def addOrientation(self, orientParams): + """ + Add orientation information to the structural element part. See class + :class:`~salome.geom.structelem.orientation.Orientation1D` for the description + of the parameters. + """ + self._orientation.addParams(orientParams) + + def _checkSize(self, value, mindim, expression): + """ + This method checks that some parameters or some expressions involving + those parameters are greater than a minimum value. + """ + if value < mindim: + raise InvalidParameterError(self.groupName, expression, + mindim, value) + + def build(self): + """ + Build the geometric shapes and the markers corresponding to the + structural element part in the study `studyId`. + """ + shape = self._buildPart() + markers = self._buildMarkers() + shape.SetColor(self.color) + for marker in markers: + marker.SetColor(self.color) + return (shape, markers) + + def _buildPart(self): + """ + This abstract method must be implemented in subclasses and should + create the geometrical shape(s) of the structural element part. + """ + raise NotImplementedError("Method _buildPart not implemented in class" + " %s (it must be implemented in " + "StructuralElementPart subclasses)." % + self.__class__.__name__) + + def _buildMarkers(self): + """ + This abstract method must be implemented in subclasses and should + create the markers defining the orientation of the structural element + part. + """ + raise NotImplementedError("Method _buildMarker not implemented in " + "class %s (it must be implemented in " + "StructuralElementPart subclasses)." % + self.__class__.__name__) + + def _getSubShapes(self, minDim = MIN_LENGTH_FOR_EXTRUSION): + """ + Find and return the base sub-shapes in the structural element part. + """ + if self.isMainShape: + return [self._groupGeomObj] + subShapes = [] + for subShapeID in self.baseShapesSet: + subShape = subShapeID.getObj(self.geom) + length = self.geom.BasicProperties(subShape)[0] + if length < minDim: + logger.warning("Length too short (%s - ID %s, length = %g), " + "subshape will not be used in structural " + "element" % (self.groupName, subShapeID._id, + length)) + else: + subShapes.append(subShape) + return subShapes + + +class Beam(StructuralElementPart): + """ + This class is an "abstract" class for all 1D structural element parts. It + should not be instantiated directly. See class + :class:`StructuralElementPart` for the description of the parameters. + """ + + DEFAULT_NAME = "Beam" + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = DEFAULT_NAME, color = None): + StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj, + parameters, name, color) + self._orientation = orientation.Orientation1D() + + def _isReversed(self, path): + """ + This method checks if a 1D object is "reversed", i.e. if its + orientation is different than the orientation of the underlying OCC + object. + """ + length = self.geom.BasicProperties(path)[0] + p1 = self.geom.MakeVertexOnCurve(path, 0.0) + p2 = self.geom.GetFirstVertex(path) + dist = self.geom.MinDistance(p1, p2) + return dist > length / 2 + + def _getVertexAndTangentOnOrientedWire(self, path, param): + """ + Get a vertex and the corresponding tangent on a wire by parameter. + This method takes into account the "real" orientation of the wire + (i.e. the orientation of the underlying OCC object). + """ + if self._isReversed(path): + vertex = self.geom.MakeVertexOnCurve(path, 1.0 - param) + invtangent = self.geom.MakeTangentOnCurve(path, 1.0 - param) + tanpoint = self.geom.MakeTranslationVectorDistance(vertex, + invtangent, + -1.0) + tangent = self.geom.MakeVector(vertex, tanpoint) + else: + vertex = self.geom.MakeVertexOnCurve(path, param) + tangent = self.geom.MakeTangentOnCurve(path, param) + return (vertex, tangent) + + def _makeSolidPipeFromWires(self, wire1, wire2, point1, point2, path): + """ + Create a solid by the extrusion of section `wire1` to section `wire2` + along `path`. + """ + face1 = self.geom.MakeFace(wire1, True) + face2 = self.geom.MakeFace(wire2, True) + shell = self.geom.MakePipeWithDifferentSections([wire1, wire2], + [point1, point2], + path, False, False) + closedShell = self.geom.MakeShell([face1, face2, shell]) + solid = self.geom.MakeSolid([closedShell]) + return solid + + def _buildPart(self): + """ + Build the structural element part. + """ + # Get all the sub-shapes in the group (normally only edges and wires) + paths = self._getSubShapes() + listPipes = [] + withContact = False + withCorrection = False + + for path in paths: + # Build the sections (rectangular or circular) at each end of the + # beam + (fPoint, fNormal) = self._getVertexAndTangentOnOrientedWire(path, + 0.0) + (lPoint, lNormal) = self._getVertexAndTangentOnOrientedWire(path, + 1.0) + (outerWire1, innerWire1, outerWire2, innerWire2) = \ + self._makeSectionWires(fPoint, fNormal, lPoint, lNormal) + + # Create the resulting solid + outerSolid = self._makeSolidPipeFromWires(outerWire1, outerWire2, + fPoint, lPoint, path) + if self.filling == HOLLOW: + innerSolid = self._makeSolidPipeFromWires(innerWire1, + innerWire2, fPoint, + lPoint, path) + resultSolid = self.geom.MakeCut(outerSolid, innerSolid) + listPipes.append(resultSolid) + else: + listPipes.append(outerSolid) + + if len(listPipes) == 0: + return None + elif len(listPipes) == 1: + return listPipes[0] + else: + return self.geom.MakeCompound(listPipes) + + def _buildMarkers(self): + """ + Build the markers defining the orientation of the structural element + part. + """ + param = 0.5 + paths = self._getSubShapes() + listMarkers = [] + for path in paths: + (center, vecX) = self._getVertexAndTangentOnOrientedWire(path, + param) + marker = self._orientation.buildMarker(self.geom, center, vecX) + listMarkers.append(marker) + return listMarkers + + +class CircularBeam(Beam): + """ + This class defines a beam with a circular section. It can be full or + hollow, and its radius and thickness can vary from one end of the beam to + the other. The valid parameters for circular beams are: + + * "R1" or "R": radius at the first end of the beam. + * "R2" or "R": radius at the other end of the beam. + * "EP1" or "EP" (optional): thickness at the first end of the beam. + If not specified or equal to 0, the beam is considered full. + * "EP2" or "EP" (optional): thickness at the other end of the beam. + If not specified or equal to 0, the beam is considered full. + + See class :class:`StructuralElementPart` for the description of the + other parameters. + + """ + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = Beam.DEFAULT_NAME, color = None): + if color is None: + if parameters.has_key("R1"): # variable section + color = LIGHT_RED + else: # constant section + color = RED + + Beam.__init__(self, studyId, groupName, groupGeomObj, parameters, + name, color) + + self.R1 = self._getParameter(["R1", "R"]) + self.R2 = self._getParameter(["R2", "R"]) + self.EP1 = self._getParameter(["EP1", "EP"]) + self.EP2 = self._getParameter(["EP2", "EP"]) + + if self.EP1 is None or self.EP2 is None or \ + self.EP1 == 0 or self.EP2 == 0: + self.filling = FULL + else: + self.filling = HOLLOW + + logger.debug(repr(self)) + + # Check parameters + self._checkSize(self.R1, MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0, + self._getParamUserName("R1")) + self._checkSize(self.R2, MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0, + self._getParamUserName("R2")) + if self.filling == HOLLOW: + self._checkSize(self.EP1, MIN_THICKNESS, + self._getParamUserName("EP1")) + self._checkSize(self.EP2, MIN_THICKNESS, + self._getParamUserName("EP2")) + self._checkSize(self.R1 - self.EP1, + MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0, + "%s - %s" % (self._getParamUserName("R1"), + self._getParamUserName("EP1"))) + self._checkSize(self.R2 - self.EP2, + MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0, + "%s - %s" % (self._getParamUserName("R2"), + self._getParamUserName("EP2"))) + + def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal): + """ + Create the circular sections used to build the pipe. + """ + outerCircle1 = self.geom.MakeCircle(fPoint, fNormal, self.R1) + outerCircle2 = self.geom.MakeCircle(lPoint, lNormal, self.R2) + if self.filling == HOLLOW: + innerCircle1 = self.geom.MakeCircle(fPoint, fNormal, + self.R1 - self.EP1) + innerCircle2 = self.geom.MakeCircle(lPoint, lNormal, + self.R2 - self.EP2) + else: + innerCircle1 = None + innerCircle2 = None + + return (outerCircle1, innerCircle1, outerCircle2, innerCircle2) + + +class RectangularBeam(Beam): + """ + This class defines a beam with a rectangular section. It can be full or + hollow, and its dimensions can vary from one end of the beam to the other. + The valid parameters for rectangular beams are: + + * "HY1", "HY", "H1" or "H": width at the first end of the beam. + * "HZ1", "HZ", "H1" or "H": height at the first end of the beam. + * "HY2", "HY", "H2" or "H": width at the other end of the beam. + * "HZ2", "HZ", "H2" or "H": height at the other end of the beam. + * "EPY1", "EPY", "EP1" or "EP" (optional): thickness in the width + direction at the first end of the beam. If not specified or equal to 0, + the beam is considered full. + * "EPZ1", "EPZ", "EP1" or "EP" (optional): thickness in the height + direction at the first end of the beam. If not specified or equal to 0, + the beam is considered full. + * "EPY2", "EPY", "EP2" or "EP" (optional): thickness in the width + direction at the other end of the beam. If not specified or equal to 0, + the beam is considered full. + * "EPZ2", "EPZ", "EP2" or "EP" (optional): thickness in the height + direction at the other end of the beam. If not specified or equal to 0, + the beam is considered full. + + See class :class:`StructuralElementPart` for the description of the + other parameters. + + """ + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = Beam.DEFAULT_NAME, color = None): + if color is None: + if parameters.has_key("HY1") or parameters.has_key("H1"): + color = LIGHT_BLUE # variable section + else: # constant section + color = BLUE + + Beam.__init__(self, studyId, groupName, groupGeomObj, parameters, + name, color) + + self.HY1 = self._getParameter(["HY1", "HY", "H1", "H"]) + self.HZ1 = self._getParameter(["HZ1", "HZ", "H1", "H"]) + self.HY2 = self._getParameter(["HY2", "HY", "H2", "H"]) + self.HZ2 = self._getParameter(["HZ2", "HZ", "H2", "H"]) + self.EPY1 = self._getParameter(["EPY1", "EPY", "EP1", "EP"]) + self.EPZ1 = self._getParameter(["EPZ1", "EPZ", "EP1", "EP"]) + self.EPY2 = self._getParameter(["EPY2", "EPY", "EP2", "EP"]) + self.EPZ2 = self._getParameter(["EPZ2", "EPZ", "EP2", "EP"]) + + if self.EPY1 is None or self.EPZ1 is None or \ + self.EPY2 is None or self.EPZ2 is None or \ + self.EPY1 == 0 or self.EPZ1 == 0 or \ + self.EPY2 == 0 or self.EPZ2 == 0: + self.filling = FULL + else: + self.filling = HOLLOW + + logger.debug(repr(self)) + + # Check parameters + self._checkSize(self.HY1, MIN_DIM_FOR_EXTRUDED_SHAPE, + self._getParamUserName("HY1")) + self._checkSize(self.HZ1, MIN_DIM_FOR_EXTRUDED_SHAPE, + self._getParamUserName("HZ1")) + self._checkSize(self.HY2, MIN_DIM_FOR_EXTRUDED_SHAPE, + self._getParamUserName("HY2")) + self._checkSize(self.HZ2, MIN_DIM_FOR_EXTRUDED_SHAPE, + self._getParamUserName("HZ2")) + if self.filling == HOLLOW: + self._checkSize(self.EPY1, MIN_THICKNESS, + self._getParamUserName("EPY1")) + self._checkSize(self.EPZ1, MIN_THICKNESS, + self._getParamUserName("EPZ1")) + self._checkSize(self.EPY2, MIN_THICKNESS, + self._getParamUserName("EPY2")) + self._checkSize(self.EPZ2, MIN_THICKNESS, + self._getParamUserName("EPZ2")) + self._checkSize(self.HY1 - 2 * self.EPY1, + MIN_DIM_FOR_EXTRUDED_SHAPE, + "%s - 2 * %s" % (self._getParamUserName("HY1"), + self._getParamUserName("EPY1"))) + self._checkSize(self.HZ1 - 2 * self.EPZ1, + MIN_DIM_FOR_EXTRUDED_SHAPE, + "%s - 2 * %s" % (self._getParamUserName("HZ1"), + self._getParamUserName("EPZ1"))) + self._checkSize(self.HY2 - 2 * self.EPY2, + MIN_DIM_FOR_EXTRUDED_SHAPE, + "%s - 2 * %s" % (self._getParamUserName("HY2"), + self._getParamUserName("EPY2"))) + self._checkSize(self.HZ2 - 2 * self.EPZ2, + MIN_DIM_FOR_EXTRUDED_SHAPE, + "%s - 2 * %s" % (self._getParamUserName("HZ2"), + self._getParamUserName("EPZ2"))) + + def _makeRectangle(self, HY, HZ, lcs): + """ + Create a rectangle in the specified plane. + """ + halfHY = HY / 2.0 + halfHZ = HZ / 2.0 + sketchStr = "Sketcher:F %g %g:" % (-halfHY, -halfHZ) + sketchStr += "TT %g %g:" % (halfHY, -halfHZ) + sketchStr += "TT %g %g:" % (halfHY, halfHZ) + sketchStr += "TT %g %g:WW" % (-halfHY, halfHZ) + logger.debug('Drawing rectangle: "%s"' % sketchStr) + sketch = self.geom.MakeSketcherOnPlane(sketchStr, lcs) + return sketch + + def _makeSectionRectangles(self, point, vecX, HY, HZ, EPY, EPZ): + """ + Create one side of the rectangular sections used to build the pipe. + """ + (vecY, vecZ) = self._orientation.getVecYZ(self.geom, point, vecX) + lcs = self.geom.MakeMarkerPntTwoVec(point, vecY, vecZ) + outerRect = self._makeRectangle(HY, HZ, lcs) + if self.filling == HOLLOW: + innerRect = self._makeRectangle(HY - 2.0 * EPY, + HZ - 2.0 * EPZ, + lcs) + else: + innerRect = None + return (outerRect, innerRect) + + def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal): + """ + Create the rectangular sections used to build the pipe. + """ + (outerRect1, innerRect1) = \ + self._makeSectionRectangles(fPoint, fNormal, self.HY1, self.HZ1, + self.EPY1, self.EPZ1) + (outerRect2, innerRect2) = \ + self._makeSectionRectangles(lPoint, lNormal, self.HY2, self.HZ2, + self.EPY2, self.EPZ2) + return (outerRect1, innerRect1, outerRect2, innerRect2) + + +def getParameterInDict(nameList, parametersDict, default = None): + """ + This method finds the value of a parameter in the parameters + dictionary. The argument is a list because some parameters can have + several different names. + """ + for name in nameList: + if parametersDict.has_key(name): + return parametersDict[name] + return default + + +class GeneralBeam(RectangularBeam): + """ + This class defines a beam with a generic section. It is represented as a + full rectangular beam with the following parameters: + + * HY1 = sqrt(12 * IZ1 / A1) + * HZ1 = sqrt(12 * IY1 / A1) + * HY2 = sqrt(12 * IZ2 / A2) + * HZ2 = sqrt(12 * IY2 / A2) + + See class :class:`StructuralElementPart` for the description of the other + parameters. + """ + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = Beam.DEFAULT_NAME, color = None): + self.IY1 = getParameterInDict(["IY1", "IY"], parameters) + self.IZ1 = getParameterInDict(["IZ1", "IZ"], parameters) + self.IY2 = getParameterInDict(["IY2", "IY"], parameters) + self.IZ2 = getParameterInDict(["IZ2", "IZ"], parameters) + self.A1 = getParameterInDict(["A1", "A"], parameters) + self.A2 = getParameterInDict(["A2", "A"], parameters) + parameters["HY1"] = math.sqrt(12 * self.IZ1 / self.A1) + parameters["HZ1"] = math.sqrt(12 * self.IY1 / self.A1) + parameters["HY2"] = math.sqrt(12 * self.IZ2 / self.A2) + parameters["HZ2"] = math.sqrt(12 * self.IY2 / self.A2) + + if color is None: + if parameters.has_key("IY1"): # variable section + color = LIGHT_GREEN + else: # constant section + color = GREEN + + RectangularBeam.__init__(self, studyId, groupName, groupGeomObj, parameters, + name, color) + + +class StructuralElementPart2D(StructuralElementPart): + """ + This class is an "abstract" class for all 2D structural element parts. It + should not be instantiated directly. See class + :class:`StructuralElementPart` for the description of the parameters. + """ + + DEFAULT_NAME = "StructuralElementPart2D" + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = DEFAULT_NAME): + StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj, + parameters, name) + self._orientation = orientation.Orientation2D( + self._getParameter(["angleAlpha"]), + self._getParameter(["angleBeta"]), + self._getParameter(["Vecteur"])) + self.offset = self._getParameter(["Excentre"], 0.0) + + def _makeFaceOffset(self, face, offset, epsilon = 1e-6): + """ + Create a copy of a face at a given offset. + """ + if abs(offset) < epsilon: + return self.geom.MakeCopy(face) + else: + offsetObj = self.geom.MakeOffset(face, offset) + # We have to explode the resulting object into faces because it is + # created as a polyhedron and not as a single face + faces = self.geom.SubShapeAll(offsetObj, + self.geom.ShapeType["FACE"]) + return faces[0] + + def _buildMarkersWithOffset(self, offset): + """ + Build the markers for the structural element part with a given offset + from the base face. + """ + uParam = 0.5 + vParam = 0.5 + listMarkers = [] + subShapes = self._getSubShapes() + + for subShape in subShapes: + faces = self.geom.SubShapeAll(subShape, + self.geom.ShapeType["FACE"]) + for face in faces: + offsetFace = self._makeFaceOffset(face, offset) + # get tangent plane on surface by parameters + center = self.geom.MakeVertexOnSurface(offsetFace, + uParam, vParam) + tangPlane = self.geom.MakeTangentPlaneOnFace(offsetFace, + uParam, vParam, + 1.0) + normal = self.geom.GetNormal(tangPlane) + marker = self._orientation.buildMarker(self.geom, + center, normal) + listMarkers.append(marker) + + return listMarkers + + +class ThickShell(StructuralElementPart2D): + """ + This class defines a shell with a given thickness. It can be shifted from + the base face. The valid parameters for thick shells are: + + * "Epais": thickness of the shell. + * "Excentre": offset of the shell from the base face. + * "angleAlpha": angle used to build the markers (see class + :class:`~salome.geom.structelem.orientation.Orientation2D`) + * "angleBeta": angle used to build the markers (see class + :class:`~salome.geom.structelem.orientation.Orientation2D`) + * "Vecteur": vector used instead of the angles to build the markers (see + class :class:`~salome.geom.structelem.orientation.Orientation2D`) + + See class :class:`StructuralElementPart` for the description of the + other parameters. + """ + + DEFAULT_NAME = "ThickShell" + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = DEFAULT_NAME): + StructuralElementPart2D.__init__(self, studyId, groupName, + groupGeomObj, parameters, name) + self.thickness = self._getParameter(["Epais"]) + logger.debug(repr(self)) + + def _buildPart(self): + """ + Create the geometrical shapes corresponding to the thick shell. + """ + subShapes = self._getSubShapes() + listSolids = [] + + for subShape in subShapes: + faces = self.geom.SubShapeAll(subShape, + self.geom.ShapeType["FACE"]) + for face in faces: + shape = self._buildThickShellForFace(face) + listSolids.append(shape) + + if len(listSolids) == 0: + return None + elif len(listSolids) == 1: + return listSolids[0] + else: + return self.geom.MakeCompound(listSolids) + + def _buildThickShellForFace(self, face): + """ + Create the geometrical shapes corresponding to the thick shell for a + given face. + """ + epsilon = 1e-6 + if self.thickness < 2 * epsilon: + return self._makeFaceOffset(face, self.offset, epsilon) + + upperOffset = self.offset + self.thickness / 2.0 + lowerOffset = self.offset - self.thickness / 2.0 + ruledMode = True + modeSolid = False + + upperFace = self._makeFaceOffset(face, upperOffset, epsilon) + lowerFace = self._makeFaceOffset(face, lowerOffset, epsilon) + listShapes = [upperFace, lowerFace] + upperWires = self.geom.SubShapeAll(upperFace, + self.geom.ShapeType["WIRE"]) + lowerWires = self.geom.SubShapeAll(lowerFace, + self.geom.ShapeType["WIRE"]) + if self.geom.KindOfShape(face)[0] == self.geom.kind.CYLINDER2D: + # if the face is a cylinder, we remove the extra side edge + upperWires = self._removeCylinderExtraEdge(upperWires) + lowerWires = self._removeCylinderExtraEdge(lowerWires) + for i in range(len(upperWires)): + resShape = self.geom.MakeThruSections([upperWires[i], + lowerWires[i]], + modeSolid, epsilon, + ruledMode) + listShapes.append(resShape) + resultShell = self.geom.MakeShell(listShapes) + resultSolid = self.geom.MakeSolid([resultShell]) + return resultSolid + + def _removeCylinderExtraEdge(self, wires): + """ + Remove the side edge in a cylinder. + """ + result = [] + for wire in wires: + edges = self.geom.SubShapeAll(wire, self.geom.ShapeType["EDGE"]) + for edge in edges: + if self.geom.KindOfShape(edge)[0] == self.geom.kind.CIRCLE: + result.append(edge) + return result + + def _buildMarkers(self): + """ + Build the markers defining the orientation of the thick shell. + """ + return self._buildMarkersWithOffset(self.offset + + self.thickness / 2.0) + + +class Grid(StructuralElementPart2D): + """ + This class defines a grid. A grid is represented by a 2D face patterned + with small lines in the main direction of the grid frame. The valid + parameters for grids are: + + * "Excentre": offset of the grid from the base face. + * "angleAlpha": angle used to build the markers (see class + :class:`~salome.geom.structelem.orientation.Orientation2D`) + * "angleBeta": angle used to build the markers (see class + :class:`~salome.geom.structelem.orientation.Orientation2D`) + * "Vecteur": vector used instead of the angles to build the markers (see + class :class:`~salome.geom.structelem.orientation.Orientation2D`) + * "origAxeX": X coordinate of the origin of the axis used to determine the + orientation of the frame in the case of a cylindrical grid. + * "origAxeY": Y coordinate of the origin of the axis used to determine the + orientation of the frame in the case of a cylindrical grid. + * "origAxeZ": Z coordinate of the origin of the axis used to determine the + orientation of the frame in the case of a cylindrical grid. + * "axeX": X coordinate of the axis used to determine the orientation of + the frame in the case of a cylindrical grid. + * "axeY": Y coordinate of the axis used to determine the orientation of + the frame in the case of a cylindrical grid. + * "axeZ": Z coordinate of the axis used to determine the orientation of + the frame in the case of a cylindrical grid. + + See class :class:`StructuralElementPart` for the description of the + other parameters. + """ + + DEFAULT_NAME = "Grid" + + def __init__(self, studyId, groupName, groupGeomObj, parameters, + name = DEFAULT_NAME): + StructuralElementPart2D.__init__(self, studyId, groupName, + groupGeomObj, parameters, name) + self.xr = self._getParameter(["origAxeX"]) + self.yr = self._getParameter(["origAxeY"]) + self.zr = self._getParameter(["origAxeZ"]) + self.vx = self._getParameter(["axeX"]) + self.vy = self._getParameter(["axeY"]) + self.vz = self._getParameter(["axeZ"]) + logger.debug(repr(self)) + + def _buildPart(self): + """ + Create the geometrical shapes representing the grid. + """ + subShapes = self._getSubShapes() + listGridShapes = [] + + for subShape in subShapes: + faces = self.geom.SubShapeAll(subShape, + self.geom.ShapeType["FACE"]) + for face in faces: + if self.geom.KindOfShape(face)[0] == \ + self.geom.kind.CYLINDER2D and \ + self.xr is not None and self.yr is not None and \ + self.zr is not None and self.vx is not None and \ + self.vy is not None and self.vz is not None: + shape = self._buildGridForCylinderFace(face) + else: + shape = self._buildGridForNormalFace(face) + listGridShapes.append(shape) + + if len(listGridShapes) == 0: + return None + elif len(listGridShapes) == 1: + return listGridShapes[0] + else: + return self.geom.MakeCompound(listGridShapes) + + def _buildGridForNormalFace(self, face): + """ + Create the geometrical shapes representing the grid for a given + non-cylindrical face. + """ + baseFace = self._makeFaceOffset(face, self.offset) + gridList = [baseFace] + + # Compute display length for grid elements + p1 = self.geom.MakeVertexOnSurface(baseFace, 0.0, 0.0) + p2 = self.geom.MakeVertexOnSurface(baseFace, 0.1, 0.1) + length = self.geom.MinDistance(p1, p2) / 2.0 + + for u in range(1, 10): + uParam = u * 0.1 + for v in range(1, 10): + vParam = v * 0.1 + # get tangent plane on surface by parameters + center = self.geom.MakeVertexOnSurface(baseFace, + uParam, vParam) + tangPlane = self.geom.MakeTangentPlaneOnFace(baseFace, uParam, + vParam, 1.0) + + # use the marker to get the orientation of the frame + normal = self.geom.GetNormal(tangPlane) + marker = self._orientation.buildMarker(self.geom, center, + normal, False) + [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz] = self.geom.GetPosition(marker) + xPoint = self.geom.MakeTranslation(center, Xx * length, + Xy * length, Xz * length) + gridLine = self.geom.MakeLineTwoPnt(center, xPoint) + gridList.append(gridLine) + grid = self.geom.MakeCompound(gridList) + return grid + + def _buildGridForCylinderFace(self, face): + """ + Create the geometrical shapes representing the grid for a given + cylindrical face. + """ + baseFace = self._makeFaceOffset(face, self.offset) + gridList = [baseFace] + + # Compute display length for grid elements + p1 = self.geom.MakeVertexOnSurface(baseFace, 0.0, 0.0) + p2 = self.geom.MakeVertexOnSurface(baseFace, 0.1, 0.1) + length = self.geom.MinDistance(p1, p2) / 2.0 + + # Create reference vector V + origPoint = self.geom.MakeVertex(self.xr, self.yr, self.zr) + vPoint = self.geom.MakeTranslation(origPoint, + self.vx, self.vy, self.vz) + refVec = self.geom.MakeVector(origPoint, vPoint) + + for u in range(10): + uParam = u * 0.1 + for v in range(1, 10): + vParam = v * 0.1 + + # Compute the local orientation of the frame + center = self.geom.MakeVertexOnSurface(baseFace, + uParam, vParam) + locPlaneYZ = self.geom.MakePlaneThreePnt(origPoint, center, + vPoint, 1.0) + locOrient = self.geom.GetNormal(locPlaneYZ) + xPoint = self.geom.MakeTranslationVectorDistance(center, + locOrient, + length) + gridLine = self.geom.MakeLineTwoPnt(center, xPoint) + gridList.append(gridLine) + + grid = self.geom.MakeCompound(gridList) + return grid + + def _buildMarkers(self): + """ + Create the markers defining the orientation of the grid. + """ + return self._buildMarkersWithOffset(self.offset) + + +def VisuPoutreGenerale(studyId, groupName, groupGeomObj, parameters, + name = "POUTRE"): + """ + Alias for class :class:`GeneralBeam`. + """ + return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name) + +def VisuPoutreCercle(studyId, groupName, groupGeomObj, parameters, + name = "POUTRE"): + """ + Alias for class :class:`CircularBeam`. + """ + return CircularBeam(studyId, groupName, groupGeomObj, parameters, name) + +def VisuPoutreRectangle(studyId, groupName, groupGeomObj, parameters, + name = "POUTRE"): + """ + Alias for class :class:`RectangularBeam`. + """ + return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name) + +def VisuBarreGenerale(studyId, groupName, groupGeomObj, parameters, + name = "BARRE"): + """ + Alias for class :class:`GeneralBeam`. + """ + return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name, + color = ORANGE) + +def VisuBarreRectangle(studyId, groupName, groupGeomObj, parameters, + name = "BARRE"): + """ + Alias for class :class:`RectangularBeam`. + """ + return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name, + color = ORANGE) + +def VisuBarreCercle(studyId, groupName, groupGeomObj, parameters, + name = "BARRE"): + """ + Alias for class :class:`CircularBeam`. + """ + return CircularBeam(studyId, groupName, groupGeomObj, parameters, name, + color = ORANGE) + +def VisuCable(studyId, groupName, groupGeomObj, parameters, name = "CABLE"): + """ + Alias for class :class:`CircularBeam`. + """ + return CircularBeam(studyId, groupName, groupGeomObj, parameters, name, + color = PURPLE) + +def VisuCoque(studyId, groupName, groupGeomObj, parameters, name = "COQUE"): + """ + Alias for class :class:`ThickShell`. + """ + return ThickShell(studyId, groupName, groupGeomObj, parameters, name) + +def VisuGrille(studyId, groupName, groupGeomObj, parameters, name = "GRILLE"): + """ + Alias for class :class:`Grid`. + """ + return Grid(studyId, groupName, groupGeomObj, parameters, name) diff --git a/src/GEOM_SWIG/GEOM_Nut.py b/src/GEOM_SWIG/GEOM_Nut.py index d5624c17f..66ff092f3 100755 --- a/src/GEOM_SWIG/GEOM_Nut.py +++ b/src/GEOM_SWIG/GEOM_Nut.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + ##################################################################### #Created :17/02/2005 #Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey @@ -65,7 +67,7 @@ for i in range(0, len(CommonExplodedListEdges)): #Fillet applying #ID = geompy.GetSubShapeID(Common_1, CommonExplodedListEdges[0]) -Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [6]) +Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [5]) geompy.addToStudy(Fillet_1, "Fillet_1") #Chamfer applying diff --git a/src/GEOM_SWIG/GEOM_ObjectInfo.py b/src/GEOM_SWIG/GEOM_ObjectInfo.py index a5c57e9e0..8678a9de6 100644 --- a/src/GEOM_SWIG/GEOM_ObjectInfo.py +++ b/src/GEOM_SWIG/GEOM_ObjectInfo.py @@ -1,31 +1,29 @@ -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE # -# Copyright (C) 2003 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 +# 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 GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_ObjectInfo.py # Author : Michael ZORIN # Module : GEOM # $Header: - +# import salome import geompy diff --git a/src/GEOM_SWIG/GEOM_Partition1.py b/src/GEOM_SWIG/GEOM_Partition1.py index 14b7be011..c99748582 100755 --- a/src/GEOM_SWIG/GEOM_Partition1.py +++ b/src/GEOM_SWIG/GEOM_Partition1.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_Partition1.py # Module : GEOM @@ -83,7 +85,7 @@ geompy.addToStudy(alveole, "alveole before explode") subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"]) -## there are 9 subshapes +## there are 9 sub-shapes comp1 = geompy.MakeCompound([subshapes[0], subshapes[1]]); comp2 = geompy.MakeCompound([subshapes[2], subshapes[3]]); diff --git a/src/GEOM_SWIG/GEOM_Partition2.py b/src/GEOM_SWIG/GEOM_Partition2.py index 14375f6c9..838693dbb 100755 --- a/src/GEOM_SWIG/GEOM_Partition2.py +++ b/src/GEOM_SWIG/GEOM_Partition2.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_Partition2.py # Module : GEOM diff --git a/src/GEOM_SWIG/GEOM_Partition3.py b/src/GEOM_SWIG/GEOM_Partition3.py index c613a4b20..7fcbc8019 100755 --- a/src/GEOM_SWIG/GEOM_Partition3.py +++ b/src/GEOM_SWIG/GEOM_Partition3.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_Partition3.py # Module : GEOM diff --git a/src/GEOM_SWIG/GEOM_Partition4.py b/src/GEOM_SWIG/GEOM_Partition4.py index 6c5924711..b0240a5e7 100755 --- a/src/GEOM_SWIG/GEOM_Partition4.py +++ b/src/GEOM_SWIG/GEOM_Partition4.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_Partition4.py # Module : GEOM diff --git a/src/GEOM_SWIG/GEOM_Partition5.py b/src/GEOM_SWIG/GEOM_Partition5.py index 69c621a5f..8c22f0db4 100755 --- a/src/GEOM_SWIG/GEOM_Partition5.py +++ b/src/GEOM_SWIG/GEOM_Partition5.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_Partition5.py # Module : GEOM diff --git a/src/GEOM_SWIG/GEOM_Sketcher.py b/src/GEOM_SWIG/GEOM_Sketcher.py index 7ea56b3cb..e67172c27 100644 --- a/src/GEOM_SWIG/GEOM_Sketcher.py +++ b/src/GEOM_SWIG/GEOM_Sketcher.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_Sketcher.py # Author : Damien COQUERET, Open CASCADE @@ -45,12 +47,27 @@ import geompy #To Make Arc #"C radius length" : Create by direction, radius and length(in degree) +#"AA x y": Create by point at X & Y +#"A dx dy" : Create by point with DX & DY +#"UU x y radius flag1": Create by point at X & Y with given radiUs +#"U dx dy radius flag1" : Create by point with DX & DY with given radiUs +#"EE x y xc yc flag1 flag2": Create by point at X & Y with given cEnter +#"E dx dy dxc dyc radius flag1 flag2" : Create by point with DX & DY with given cEnter + +#Flag1 is 0 or 2 ... +# if 0 the drawn arc is the one of lower angle (< Pi) +# if 2 the drawn arc ius the one of greater angle (> Pi) + +#Flag2 is 0 or 1 ... +# if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7) +# if 1 the wire is built only if the end point is on the arc +# with a tolerance of 10^-7 on the distance else the creation fails #To finish #"WW" : Close Wire #Create Sketcher -Cmd = "Sketch:F 0 0:TT 0 100:C 100 180:WW" +Cmd = "Sketch:F 0 0:TT 0 100:C 100 180:AA -100 100:WW" Sketcher = geompy.MakeSketcher(Cmd) #(string)->GEOM_Shape_ptr #Add In Study diff --git a/src/GEOM_SWIG/GEOM_Spanner.py b/src/GEOM_SWIG/GEOM_Spanner.py index f95ab64e3..05c23aed6 100644 --- a/src/GEOM_SWIG/GEOM_Spanner.py +++ b/src/GEOM_SWIG/GEOM_Spanner.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ implementaion with Python # File : GEOM_Spanner.py # Author : Julia DOROVSKIKH @@ -103,7 +105,7 @@ def MakeSpanner (geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None): else: print "Prism 1 is not a hexahedral solid" - Prism1_faces = geompy.SubShapeAllSorted(Prism1, geompy.ShapeType["FACE"]) + Prism1_faces = geompy.SubShapeAllSortedCentres(Prism1, geompy.ShapeType["FACE"]) ii = 1 for aFace in Prism1_faces: name = geompy.SubShapeName(aFace, Prism1) @@ -381,7 +383,7 @@ def MakeSpanner (geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None): # ---- add long edges of the top face in study - FaceTop_edges = geompy.SubShapeAllSorted(FaceTop, geompy.ShapeType["EDGE"]) + FaceTop_edges = geompy.SubShapeAllSortedCentres(FaceTop, geompy.ShapeType["EDGE"]) Edge1 = FaceTop_edges[0] Edge2 = FaceTop_edges[3] Id_Edge1 = geompy.addToStudyInFather(FaceTop, Edge1, "Edge 1") diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index 317f1dc40..3e7c14dc2 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -1,44 +1,45 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_usinggeom.py # Author : Damien COQUERET, Open CASCADE # Module : GEOM -# + # ! Please, if you edit this example file, update also # ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_all.doc # ! as some sequences of symbols from this example are used during # ! documentation generation to identify certain places of this file -# -def TestAll (geompy, math): +def TestAll (geompy, math): + import GEOM + #Create base Variables nbtimes1 = 5 #Short nbtimes2 = 5 mindeg = 2 maxdeg = 5 nbiter = 5 - ShapeTypeFace = geompy.ShapeType["FACE"] - ShapeTypeEdge = geompy.ShapeType["EDGE"] WantPlanarFace = 1 #True radius = 10. #Double @@ -62,97 +63,114 @@ def TestAll (geompy, math): precision = 0.00001 #Create base points - p0 = geompy.MakeVertex(0. , 0. , 0. ) #(3 Doubles)->GEOM_Object_ptr + p0 = geompy.MakeVertex(0. , 0. , 0. ) #(3 Doubles)->GEOM_Object px = geompy.MakeVertex(100., 0. , 0. ) py = geompy.MakeVertex(0. , 100., 0. ) pz = geompy.MakeVertex(0. , 0. , 100.) pxyz = geompy.MakeVertex(100., 100., 100.) - p200 = geompy.MakeVertexWithRef(pxyz, 100., 100., 100.) #(GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr + p200 = geompy.MakeVertexWithRef(pxyz, 100., 100., 100.) #(GEOM_Object, 3 Doubles)->GEOM_Object #Create base directions - vx = geompy.MakeVector(p0, px) #(GEOM_Object_ptr, GEOM_Object_ptr)->GEOM_Object_ptr + vx = geompy.MakeVector(p0, px) #(GEOM_Object, GEOM_Object)->GEOM_Object vy = geompy.MakeVector(p0, py) vz = geompy.MakeVector(p0, pz) vxy = geompy.MakeVector(px, py) - vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.) #(3 Doubles)->GEOM_Object_ptr + vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.) #(3 Doubles)->GEOM_Object #Create local coordinate systems - cs1 = geompy.MakeMarker(50,50,50, 1,0,0, 0,1,0) #(9 Doubles)->GEOM_Object_ptr - cs2 = geompy.MakeMarker(70,80,10, 1,0,1, 1,1,0) #(9 Doubles)->GEOM_Object_ptr - cs3 = geompy.MakeMarkerPntTwoVec(pz, vxy, vz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr + cs1 = geompy.MakeMarker(50,50,50, 1,0,0, 0,1,0) #(9 Doubles)->GEOM_Object + cs2 = geompy.MakeMarker(70,80,10, 1,0,1, 1,1,0) #(9 Doubles)->GEOM_Object + cs3 = geompy.MakeMarkerPntTwoVec(pz, vxy, vz) #(3 GEOM_Object)->GEOM_Object #Create base geometry 2D - Line = geompy.MakeLineTwoPnt(p0, pxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - Line1 = geompy.MakeLine(pz, vxy) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - Line2 = geompy.MakeLineTwoPnt(pxyz, pz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - Plane = geompy.MakePlane(pz, vxyz, trimsize) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr - Plane1 = geompy.MakePlaneThreePnt(px, pz, p200, trimsize) #(4 Doubles)->GEOM_Object_ptr - - Arc = geompy.MakeArc(py, pz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr - Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr - Arc3 = geompy.MakeArcOfEllipse(p0, px, pz) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr - Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr - Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr - Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object_ptr)->GEOM_Object_ptr - Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr - Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr - Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr - Interpol = geompy.MakeInterpol([px, py, p200, pxyz]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr + Line = geompy.MakeLineTwoPnt(p0, pxyz) #(2 GEOM_Object)->GEOM_Object + Line1 = geompy.MakeLine(pz, vxy) #(2 GEOM_Object)->GEOM_Object + Line2 = geompy.MakeLineTwoPnt(pxyz, pz) #(2 GEOM_Object)->GEOM_Object + Plane = geompy.MakePlane(pz, vxyz, trimsize) #(2 GEOM_Object, Double)->GEOM_Object + Plane1 = geompy.MakePlaneThreePnt(px, pz, p200, trimsize) #(4 Doubles)->GEOM_Object + Plane2 = geompy.MakePlane2Vec(vx, vz, trimsize) #(2 GEOM_Object, Double)->GEOM_Object + Plane3 = geompy.MakePlaneLCS(cs1, trimsize, 3) #(1 GEOM_Object, 2 Double)->GEOM_Object + + Arc = geompy.MakeArc(py, pz, px) #(3 GEOM_Object)->GEOM_Object + Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object,Boolean)->GEOM_Object + Arc3 = geompy.MakeArcOfEllipse(p0, px, pz) #(3 GEOM_Object,Boolean)->GEOM_Object + Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object, Double)->GEOM_Object + Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object)->GEOM_Object + Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object)->GEOM_Object + Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object, 2 Doubles)->GEOM_Object + Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object)->GEOM_Object + Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object)->GEOM_Object + Interpol = geompy.MakeInterpol([px, py, p200, pxyz], True) #(List of GEOM_Object,Boolean)->GEOM_Object Sketcher = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW", - [100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object_ptr + [100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object Sketcher3d = geompy.Make3DSketcher([0,0,0, 50,50,50, 0,50,50, 10,0,0]) + + #Create local coordinate system from shape + cs4 = geompy.MakeMarkerFromShape(Plane) #Test point on curve creation - p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr + p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object, Double)->GEOM_Object + p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10 ) #(GEOM_Object, Double)->GEOM_Object + p_on_arc3 = geompy.MakeVertexOnCurveByLength(Arc, 50, py) #(GEOM_Object, Double, GEOM_Object)->GEOM_Object #Test point on lines intersection - p_on_l1l2 = geompy.MakeVertexOnLinesIntersection(Line1, Line2) #(2 GEOM_Object_ptr)->GEOM_Object_ptr + p_on_l1l2 = geompy.MakeVertexOnLinesIntersection(Line1, Line2) #(2 GEOM_Object)->GEOM_Object #Test tangent on curve creation - tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr + tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7) #(GEOM_Object, Double)->GEOM_Object + + #Test tangent on face creation + tan_vertex_1 = geompy.MakeVertex(0, 0, 0) + tan_vertex_2 = geompy.MakeVertex(0, 90, 30) + tan_vertex_3 = geompy.MakeVertex(100, 90, 0) + tan_vertex_4 = geompy.MakeVertex(-100, 90, 0) + tan_curve = geompy.MakeInterpol([tan_vertex_4, tan_vertex_2, tan_vertex_3, tan_vertex_1], False) + tan_extrusion = geompy.MakePrismDXDYDZ(tan_curve, 0, 30, -60) + tan_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150) #Create base geometry 3D - Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - Box1 = geompy.MakeBoxDXDYDZ(10, 20, 30) #(3 Doubles)->GEOM_Object_ptr - Box2 = geompy.MakeBox(10,20,30, 15,25,35) #(6 Doubles)->GEOM_Object_ptr - Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr - Cyl1 = geompy.MakeCylinderRH(radius2, height) #(2 Doubles)->GEOM_Object_ptr - Sphere = geompy.MakeSpherePntR(p0, radius1) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr - Sphere1 = geompy.MakeSphereR(radius) #(Double)->GEOM_Object_ptr - Sphere2 = geompy.MakeSphere(50, 70, 30, radius) #(4 Doubles)->GEOM_Object_ptr - Cone = geompy.MakeCone(p0, vz, radius2, radius, height) #(2 GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr - Cone1 = geompy.MakeConeR1R2H(radius1, radius, height) #(3 Doubles)->GEOM_Object_ptr - Torus = geompy.MakeTorus(p0, vz, radius2, radius) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr - Torus1 = geompy.MakeTorusRR(radius2, radius1) #(2 Doubles)->GEOM_Object_ptr + Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object)->GEOM_Object + Box1 = geompy.MakeBoxDXDYDZ(10, 20, 30) #(3 Doubles)->GEOM_Object + Box2 = geompy.MakeBox(10,20,30, 15,25,35) #(6 Doubles)->GEOM_Object + Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(2 GEOM_Object, 2 Doubles)->GEOM_Object + Cyl1 = geompy.MakeCylinderRH(radius2, height) #(2 Doubles)->GEOM_Object + Sphere = geompy.MakeSpherePntR(p0, radius1) #(GEOM_Object, Double)->GEOM_Object + Sphere1 = geompy.MakeSphereR(radius) #(Double)->GEOM_Object + Sphere2 = geompy.MakeSphere(50, 70, 30, radius) #(4 Doubles)->GEOM_Object + Cone = geompy.MakeCone(p0, vz, radius2, radius, height) #(2 GEOM_Object, 3 Doubles)->GEOM_Object + Cone1 = geompy.MakeConeR1R2H(radius1, radius, height) #(3 Doubles)->GEOM_Object + Torus = geompy.MakeTorus(p0, vz, radius2, radius) #(2 GEOM_Object, 2 Doubles)->GEOM_Object + Torus1 = geompy.MakeTorusRR(radius2, radius1) #(2 Doubles)->GEOM_Object #Boolean (Common, Cut, Fuse, Section) - Common = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object_ptr, Short)->GEOM_Object_ptr + Common = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object, Short)->GEOM_Object Cut = geompy.MakeBoolean(Box, Sphere, 2) Fuse = geompy.MakeBoolean(Box, Sphere, 3) Section = geompy.MakeBoolean(Box, Sphere, 4) #Create base objects - Edge = geompy.MakeEdge(p0, pxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - Wire = geompy.MakeWire([vxy, Arc]) #(List Of GEOM_Object_ptr)->GEOM_Object_ptr - Face = geompy.MakeFace(Wire, WantPlanarFace) #(GEOM_Object_ptr, Boolean)->GEOM_Object_ptr + Edge = geompy.MakeEdge(p0, pxyz) #(2 GEOM_Object)->GEOM_Object + Edge1 = geompy.MakeEdgeOnCurveByLength(Arc, 50, px) #(GEOM_Object, Double, GEOM_Object)->GEOM_Object + Wire = geompy.MakeWire([vxy, Arc]) #(List Of GEOM_Object)->GEOM_Object + Face = geompy.MakeFace(Wire, WantPlanarFace) #(GEOM_Object, Boolean)->GEOM_Object Face1 = geompy.MakeFaceWires([Wire, Sketcher], - WantPlanarFace) #(List of GEOM_Object_ptr, Boolean)->GEOM_Object_ptr + WantPlanarFace) #(List of GEOM_Object, Boolean)->GEOM_Object Face2 = geompy.MakeFace(Sketcher, WantPlanarFace) - Face3 = geompy.MakeFaceHW (100., 200., 1) #(2 Doubles, 1 Int)->GEOM_Object_ptr - Face4 = geompy.MakeFaceObjHW (vz, 200., 100.) #(1 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr - Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object_ptr, 1 Double)->GEOM_Object_ptr - Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr - Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object_ptr - Shell = geompy.MakeShell([Face, Face1]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr - - Prism1 = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr - prism1_faces = geompy.SubShapeAllSorted(Prism1, ShapeTypeFace) + Face3 = geompy.MakeFaceHW (100., 200., 1) #(2 Doubles, 1 Int)->GEOM_Object + Face4 = geompy.MakeFaceObjHW (vz, 200., 100.) #(1 GEOM_Object, 2 Doubles)->GEOM_Object + Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object, 1 Double)->GEOM_Object + Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object)->GEOM_Object + Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object + Shell = geompy.MakeShell([Face, Face1]) #(List of GEOM_Object)->GEOM_Object + + Prism1 = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object)->GEOM_Object + prism1_faces = geompy.SubShapeAllSortedCentres(Prism1, geompy.ShapeType["FACE"]) Shell1 = geompy.MakeShell([prism1_faces[0], prism1_faces[1], prism1_faces[3], prism1_faces[4], prism1_faces[5], prism1_faces[2]]) - Solid = geompy.MakeSolid([Shell1]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr + Solid = geompy.MakeSolid([Shell1]) #(List of GEOM_Object)->GEOM_Object ShapeListCompound = [] i = 0 @@ -160,59 +178,62 @@ def TestAll (geompy, math): S = geompy.MakeTranslation(Arc, i * 100., i * 100., i * 100.) ShapeListCompound.append(S) i = i + 1 - Compound = geompy.MakeCompound(ShapeListCompound) #(List of GEOM_Object_ptr)->GEOM_Object_ptr + Compound = geompy.MakeCompound(ShapeListCompound) #(List of GEOM_Object)->GEOM_Object #Test point on surface creation - p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object_ptr, Double, Double)->GEOM_Object_ptr + p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object, Double, Double)->GEOM_Object + p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object, Double, Double, Double)->GEOM_Object # Test plane from existing face creation - Plane2 = geompy.MakePlaneFace(Face, trimsize) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr + Plane2 = geompy.MakePlaneFace(Face, trimsize) #(GEOM_Object, Double)->GEOM_Object #ShapeList for Sewing S = geompy.MakeRotation(Face, vxy, angle1) #Test Line on Faces Intersection - Line3 = geompy.MakeLineTwoFaces(prism1_faces[0], prism1_faces[1]) #(2 GEOM_Object_ptr)->GEOM_Object_ptr + Line3 = geompy.MakeLineTwoFaces(prism1_faces[0], prism1_faces[1]) #(2 GEOM_Object)->GEOM_Object #Create advanced objects - Copy = geompy.MakeCopy(Box) #(GEOM_Object_ptr)->GEOM_Object_ptr - Prism = geompy.MakePrismVecH(Face, vz, 100.0) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr - Prism2Ways = geompy.MakePrismVecH2Ways(Face, vz, 10.0) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr - PrismDXDYDZ= geompy.MakePrismDXDYDZ(Face2, 10, 20, 100)#(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr - PrismDXDYDZ2Ways= geompy.MakePrismDXDYDZ2Ways(Face, 30, -20, 200)#(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr - Revolution = geompy.MakeRevolution(Face, vz, angle2) # - Revolution2Ways = geompy.MakeRevolution(Face, vz, angle1) # - Filling = geompy.MakeFilling(Compound, mindeg, maxdeg, - tol2d, tol3d, nbiter) #(GEOM_Object_ptr, 4 Doubles, Short)->GEOM_Object_ptr - Pipe = geompy.MakePipe(Wire, Edge) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - Sewing = geompy.MakeSewing([Face, S], precision) #(List Of GEOM_Object_ptr, Double)->GEOM_Object_ptr + Copy = geompy.MakeCopy(Box) #(GEOM_Object)->GEOM_Object + Prism = geompy.MakePrismVecH(Face, vz, 100.0) #(2 GEOM_Object, Double)->GEOM_Object + Prism2Ways = geompy.MakePrismVecH2Ways(Face, vz, 10.0) #(2 GEOM_Object, Double)->GEOM_Object + PrismTwoPnt = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object)->GEOM_Object + PrismTwoPnt2Ways = geompy.MakePrism2Ways(Face2, p0, pxyz) #(3 GEOM_Object)->GEOM_Object + PrismDXDYDZ = geompy.MakePrismDXDYDZ(Face2, 10, 20, 100)#(2 GEOM_Object, Double)->GEOM_Object + PrismDXDYDZ2Ways = geompy.MakePrismDXDYDZ2Ways(Face, 30, -20, 200)#(2 GEOM_Object, Double)->GEOM_Object + Revolution = geompy.MakeRevolution(Face, vz, angle2) # + Revolution2Ways = geompy.MakeRevolution(Face, vz, angle1) # + Filling = geompy.MakeFilling(Compound, mindeg, maxdeg, + tol2d, tol3d, nbiter) #(GEOM_Object, 4 Doubles, Short)->GEOM_Object + Pipe = geompy.MakePipe(Wire, Edge) #(2 GEOM_Object)->GEOM_Object + Sewing = geompy.MakeSewing([Face, S], precision) #(List Of GEOM_Object, Double)->GEOM_Object #Transform objects - Translation = geompy.MakeTranslationTwoPoints(Box, px, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr - TranslVect = geompy.MakeTranslationVector(Box, vxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - TranslVectD = geompy.MakeTranslationVectorDistance(Box, vxyz, 50.0) #(2 GEOM_Object_ptr)->GEOM_Object_ptr - Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr - RotatPnt = geompy.MakeRotationThreePoints(Box, px, py, pz) #(4 GEOM_Object_ptr)->GEOM_Object_ptr + Translation = geompy.MakeTranslationTwoPoints(Box, px, pz) #(3 GEOM_Object)->GEOM_Object + TranslVect = geompy.MakeTranslationVector(Box, vxyz) #(2 GEOM_Object)->GEOM_Object + TranslVectD = geompy.MakeTranslationVectorDistance(Box, vxyz, 50.0) #(2 GEOM_Object)->GEOM_Object + Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object, Double)->GEOM_Object + RotatPnt = geompy.MakeRotationThreePoints(Box, px, py, pz) #(4 GEOM_Object)->GEOM_Object #Scale by factor relatively given point - Scale1 = geompy.MakeScaleTransform(Box, pxyz, factor) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr + Scale1 = geompy.MakeScaleTransform(Box, pxyz, factor) #(2 GEOM_Object, Double)->GEOM_Object #Scale by factor relatively the origin of global CS Scale2 = geompy.MakeScaleTransform(Box, None, factor) # #Scale along axes of global CS by different factors. Scale relatively given point - Scale3 = geompy.MakeScaleAlongAxes(Box, pxyz, 1.5, 0.5, 3) #(2 GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr + Scale3 = geompy.MakeScaleAlongAxes(Box, pxyz, 1.5, 0.5, 3) #(2 GEOM_Object, 3 Doubles)->GEOM_Object #Scale along axes of global CS by different factors. Scale relatively the origin of global CS Scale4 = geompy.MakeScaleAlongAxes(Box, None, 1.5, 0.5, 3) # - Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr + Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(2 GEOM_Object)->GEOM_Object MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) # MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) # - Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object_ptr)->GEOM_Object_ptr - Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object_ptr, 1 Double, 2 Bool)->GEOM_Object_ptr - Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr + Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object)->GEOM_Object + Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object, 1 Double, 2 Bool)->GEOM_Object + Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object, Double)->GEOM_Object Orientation = geompy.ChangeOrientation(Box) #IDList for Fillet/Chamfer - prism_edges = geompy.SubShapeAllSorted(Prism, ShapeTypeEdge) + prism_edges = geompy.ExtractShapes(Prism, geompy.ShapeType["EDGE"], True) for anEdge in prism_edges: eid = geompy.GetSubShapeID(Prism, anEdge) @@ -227,7 +248,7 @@ def TestAll (geompy, math): IDlist_e.append(geompy.GetSubShapeID(Prism, prism_edges[1])) IDlist_e.append(geompy.GetSubShapeID(Prism, prism_edges[2])) - prism_faces = geompy.SubShapeAllSorted(Prism, ShapeTypeFace) + prism_faces = geompy.ExtractShapes(Prism, geompy.ShapeType["FACE"], True) f_ind_1 = geompy.GetSubShapeID(Prism, prism_faces[0]) f_ind_2 = geompy.GetSubShapeID(Prism, prism_faces[1]) @@ -235,19 +256,19 @@ def TestAll (geompy, math): IDlist_f = [f_ind_1, f_ind_2] #Local operations - Fillet2d = geompy.MakeFillet2D(Face3, radius, [4, 7, 9]) #(GEOM_Object_ptr, Double, ListOfLong)->GEOM_Object_ptr - Fillet = geompy.MakeFillet (Prism, radius, ShapeTypeEdge, - IDlist_e) #(GEOM_Object_ptr, Double, Short, ListOfLong)->GEOM_Object_ptr - Fillet2 = geompy.MakeFilletR1R2 (Prism, 7., 13., ShapeTypeEdge, - IDlist_e) #(GEOM_Object_ptr, Double, Double, Short, ListOfLong)->GEOM_Object_ptr + Fillet2d = geompy.MakeFillet2D(Face3, radius, [4, 7, 9]) #(GEOM_Object, Double, ListOfLong)->GEOM_Object + Fillet = geompy.MakeFillet (Prism, radius, geompy.ShapeType["EDGE"], + IDlist_e) #(GEOM_Object, Double, Short, ListOfLong)->GEOM_Object + Fillet2 = geompy.MakeFilletR1R2 (Prism, 7., 13., geompy.ShapeType["EDGE"], + IDlist_e) #(GEOM_Object, Double, Double, Short, ListOfLong)->GEOM_Object Chamfer = geompy.MakeChamferEdge(Prism, d1, d2, - f_ind_1, f_ind_2) #(GEOM_Object_ptr, 2 Doubles, 2 Long)->GEOM_Object_ptr + f_ind_1, f_ind_2) #(GEOM_Object, 2 Doubles, 2 Long)->GEOM_Object Chamfer2 = geompy.MakeChamferFaces(Prism, d1, d2, - IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr + IDlist_f) #(GEOM_Object, 2 Doubles, ListOfLong)->GEOM_Object Chamfer3 = geompy.MakeChamferEdges(Prism, d1, d2, - IDlist_e) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr + IDlist_e) #(GEOM_Object, 2 Doubles, ListOfLong)->GEOM_Object Chamfer4 = geompy.MakeChamferFacesAD(Prism, d1, 20. * math.pi / 180., - IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr + IDlist_f) #(GEOM_Object, 2 Doubles, ListOfLong)->GEOM_Object #End of Local operations #Create Patterns @@ -258,18 +279,18 @@ def TestAll (geompy, math): MultiRot2D = geompy.MultiRotate2D(Chamfer, vx, angle, nbtimes1, step1, nbtimes2) #Create Informations objects - CDG = geompy.MakeCDG(Prism) #(GEOM_Object_ptr)->GEOM_Object_ptr + CDG = geompy.MakeCDG(Prism) #(GEOM_Object)->GEOM_Object Archimede = geompy.Archimede(Box, weight, waterdensity, - meshingdeflection) #(GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr - mindist = geompy.MinDistanceComponents(TranslVect, Mirror) #(2 GEOM_Object_ptr)->4 Doubles + meshingdeflection) #(GEOM_Object, 3 Doubles)->GEOM_Object + mindist = geompy.MinDistanceComponents(TranslVect, Mirror) #(2 GEOM_Object)->4 Doubles print "Minumal distance between TranslVect and Mirror is", mindist[0], print "by components:", mindist[1], ",", mindist[2], ",", mindist[3] - CheckShape = geompy.CheckShape(Prism) #(GEOM_Object_ptr)->Boolean + CheckShape = geompy.CheckShape(Prism) #(GEOM_Object)->Boolean print "CheckShape(Prism) = ", CheckShape #Partition objects - Partition = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object_ptr)->GEOM_Object_ptr - Partition1 = geompy.MakeHalfPartition(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr + Partition = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object)->GEOM_Object + Partition1 = geompy.MakeHalfPartition(Box, Plane) #(2 GEOM_Object)->GEOM_Object #Add In Study id_p0 = geompy.addToStudy(p0, "Vertex 0") @@ -288,12 +309,15 @@ def TestAll (geompy, math): id_cs1 = geompy.addToStudy(cs1, "CS 50,50,50, 1,0,0, 0,1,0") id_cs2 = geompy.addToStudy(cs2, "CS 70,80,10, 1,0,1, 1,1,0") id_cs3 = geompy.addToStudy(cs3, "CS: pz, vxy, vz") + id_cs4 = geompy.addToStudy(cs4, "CS: Plane") id_Line = geompy.addToStudy(Line, "Line") id_Line1 = geompy.addToStudy(Line1, "Line by point and vector") id_Line3 = geompy.addToStudy(Line3, "Line on Two Faces Intersection") id_Plane = geompy.addToStudy(Plane, "Plane") id_Plane1 = geompy.addToStudy(Plane1, "Plane by 3 points") + id_Plane2 = geompy.addToStudy(Plane2, "Plane by 2 vectors") + id_Plane3 = geompy.addToStudy(Plane3, "Plane by LCS") id_Arc = geompy.addToStudy(Arc, "Arc") id_Arc2 = geompy.addToStudy(Arc2, "Arc2") @@ -309,9 +333,13 @@ def TestAll (geompy, math): id_Sketcher3d = geompy.addToStudy(Sketcher3d, "Sketcher 3D") id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc (0.25)") + id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc at(100, -10, 10)" ) + id_p_on_arc3 = geompy.addToStudy(p_on_arc3, "Vertex on Arc length 50 from Vertex X" ) + id_p_on_l1l2 = geompy.addToStudy(p_on_l1l2, "Vertex on Lines Intersection") - id_tan_on_arc = geompy.addToStudy(tan_on_arc, "Tangent on Arc (0.7)") + id_tan_on_arc = geompy.addToStudy(tan_on_arc, "Tangent on Arc (0.7)") + id_tan_on_face = geompy.addToStudy(tan_on_face, "Tangent on Face") id_Box = geompy.addToStudy(Box, "Box") id_Box1 = geompy.addToStudy(Box1, "Box 10x20x30") @@ -332,6 +360,7 @@ def TestAll (geompy, math): id_Section = geompy.addToStudy(Section, "Section") id_Edge = geompy.addToStudy(Edge, "Edge") + id_Edge1 = geompy.addToStudy(Edge1, "Edge on Arc length 50 from Vertex Y") id_Wire = geompy.addToStudy(Wire, "Wire") id_Face = geompy.addToStudy(Face, "Face") id_Face1 = geompy.addToStudy(Face1, "Face from two wires") @@ -344,6 +373,7 @@ def TestAll (geompy, math): id_Shell = geompy.addToStudy(Shell, "Shell") id_p_on_face = geompy.addToStudy(p_on_face, "Vertex on Face (0.1, 0.8)") + id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on Face at(0., 0., 0.)") id_Prism1 = geompy.addToStudy(Prism1, "Prism by Two Pnt") id_Shell1 = geompy.addToStudy(Shell1, "Shell from Prism1 faces") @@ -353,12 +383,14 @@ def TestAll (geompy, math): id_Plane2 = geompy.addToStudy(Plane2, "Plane on Face") id_Copy = geompy.addToStudy(Copy, "Copy") - id_Prism = geompy.addToStudy(Prism, "Prism") - id_Prism2Ways = geompy.addToStudy(Prism2Ways, "Prism2Ways") - id_PrismDXDYDZ= geompy.addToStudy(PrismDXDYDZ,"PrismDXDYDZ") - id_PrismDXDYDZ2Ways= geompy.addToStudy(PrismDXDYDZ2Ways,"PrismDXDYDZ2Ways") - id_Revolution = geompy.addToStudy(Revolution, "Revolution") - id_Revolution2Ways = geompy.addToStudy(Revolution2Ways, "Revolution2Ways") + id_Prism = geompy.addToStudy(Prism, "Prism") + id_Prism2Ways = geompy.addToStudy(Prism2Ways, "Prism2Ways") + id_PrismTwoPnt = geompy.addToStudy(PrismTwoPnt, "PrismTwoPnt") + id_PrismTwoPnt2Ways = geompy.addToStudy(PrismTwoPnt2Ways, "PrismTwoPnt2Ways") + id_PrismDXDYDZ = geompy.addToStudy(PrismDXDYDZ, "PrismDXDYDZ") + id_PrismDXDYDZ2Ways = geompy.addToStudy(PrismDXDYDZ2Ways, "PrismDXDYDZ2Ways") + id_Revolution = geompy.addToStudy(Revolution, "Revolution") + id_Revolution2Ways = geompy.addToStudy(Revolution2Ways, "Revolution2Ways") id_Filling = geompy.addToStudy(Filling, "Filling") id_Pipe = geompy.addToStudy(Pipe, "Pipe") id_Sewing = geompy.addToStudy(Sewing, "Sewing") @@ -407,11 +439,19 @@ def TestAll (geompy, math): name = geompy.SubShapeName(SubFace, Box) id_SubFace = geompy.addToStudyInFather(Box, SubFace, name) - # SubShapeSorted - SubFaceS = geompy.SubShapeSorted(Box, geompy.ShapeType["FACE"], [5]) + # SubShapeSortedCentres + SubFaceS = geompy.SubShapeSortedCentres(Box, geompy.ShapeType["FACE"], [5]) nameS = geompy.SubShapeName(SubFaceS, Box) id_SubFace = geompy.addToStudyInFather(Box, SubFaceS, nameS) + # GetExistingSubObjects + SubObjsAll = geompy.GetExistingSubObjects(Box, True) + print "For now, Box has the following created sub-objects:", SubObjsAll + + # GetGroups + SubGrpsAll = geompy.GetGroups(Box) + print "For now, Box has the following created groups:", SubGrpsAll + # SubShapeAll SubEdgeList = geompy.SubShapeAll(SubFace, geompy.ShapeType["EDGE"]) i=0 @@ -426,8 +466,8 @@ def TestAll (geompy, math): geompy.UnionIDs(group, SubEdgeIDsList) geompy.addToStudyInFather(SubFace, group, "Group of all edges") - # SubShapeAllSortedIDs - SubEdgeIDsList = geompy.SubShapeAllSortedIDs(SubFace, geompy.ShapeType["EDGE"]) + # SubShapeAllSortedCentresIDs + SubEdgeIDsList = geompy.SubShapeAllSortedCentresIDs(SubFace, geompy.ShapeType["EDGE"]) print "IDs of edges of SubFace:", SubEdgeIDsList, "(sorted)" # GetSubShape and GetSubShapeID @@ -437,4 +477,10 @@ def TestAll (geompy, math): if ind_e != ind: print "Error in GetSubShape or GetSubShapeID" + # RestoreSubShapes + geompy.RestoreSubShapes(Copy) + geompy.RestoreSubShapes(RotatPnt, [], GEOM.FSM_Transformed) + geompy.RestoreSubShapes(Partition, [Box]) + geompy.RestoreSubShapes(Partition1) + print "DONE" diff --git a/src/GEOM_SWIG/GEOM_TestHealing.py b/src/GEOM_SWIG/GEOM_TestHealing.py index b5f4d688a..abe4a9810 100644 --- a/src/GEOM_SWIG/GEOM_TestHealing.py +++ b/src/GEOM_SWIG/GEOM_TestHealing.py @@ -1,30 +1,30 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 GEOM_SWIG : binding of C++ implementaion with Python +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +# GEOM_SWIG : binding of C++ implementaion with Python # File : GEOM_TestHealing.py # Author : Julia DOROVSKIKH # Module : GEOM -# $Header$ -# + def TestProcessShape (geompy): ##Load shape from BREP file @@ -84,7 +84,7 @@ def TestSuppressFaces (geompy): #IDList for SuppHole faces = [] - faces = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) + faces = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"]) f_glob_id = geompy.GetSubShapeID(Box, faces[5]) @@ -235,7 +235,7 @@ def TestSuppressHoles (geompy): #IDList for SuppressFaces faces = [] - faces = geompy.SubShapeAllSorted(Cut, geompy.ShapeType["FACE"]) + faces = geompy.SubShapeAllSortedCentres(Cut, geompy.ShapeType["FACE"]) ind = 0 for face in faces: f_name = "FACE %d"%(ind) @@ -247,9 +247,10 @@ def TestSuppressHoles (geompy): f_glob_id_0 = geompy.GetSubShapeID(Cut, faces[0]) cut_without_f_0 = geompy.SuppressFaces(Cut, [f_glob_id_0]) + geompy.addToStudy(cut_without_f_0, "Cut without face 0") faces1 = [] - faces1 = geompy.SubShapeAllSorted(cut_without_f_0, geompy.ShapeType["FACE"]) + faces1 = geompy.SubShapeAllSortedCentres(cut_without_f_0, geompy.ShapeType["FACE"]) ind = 0 for face in faces1: f_name = "FACE %d"%(ind) @@ -259,25 +260,25 @@ def TestSuppressHoles (geompy): print "face ", ind, " global index = ", f_glob_id ind = ind + 1 - f_glob_id_5 = geompy.GetSubShapeID(cut_without_f_0, faces1[5]) - cut_without_f_0_5 = geompy.SuppressFaces(cut_without_f_0, [f_glob_id_5]) - cut_without_f_0_5_id = geompy.addToStudy(cut_without_f_0_5, "Cut without faces 0 and 5") + f_glob_id_3 = geompy.GetSubShapeID(cut_without_f_0, faces1[3]) + cut_without_f_0_3 = geompy.SuppressFaces(cut_without_f_0, [f_glob_id_3]) + cut_without_f_0_3_id = geompy.addToStudy(cut_without_f_0_3, "Cut without faces 0 and 3") #IDList for SuppHole wires = [] - wires = geompy.SubShapeAllSorted(cut_without_f_0_5, geompy.ShapeType["WIRE"]) + wires = geompy.SubShapeAllSortedCentres(cut_without_f_0_3, geompy.ShapeType["WIRE"]) ind = 0 for wire in wires: w_name = "WIRE %d"%(ind) - w_id = geompy.addToStudyInFather(cut_without_f_0_5, wire, w_name) + w_id = geompy.addToStudyInFather(cut_without_f_0_3, wire, w_name) - w_glob_id = geompy.GetSubShapeID(cut_without_f_0_5, wire) + w_glob_id = geompy.GetSubShapeID(cut_without_f_0_3, wire) print "wire ", ind, " global index = ", w_glob_id ind = ind + 1 - w_3 = geompy.GetSubShapeID(cut_without_f_0_5, wires[3]) + w_3 = geompy.GetSubShapeID(cut_without_f_0_3, wires[3]) - SuppHole3 = geompy.SuppressHoles(cut_without_f_0_5, [w_3]) + SuppHole3 = geompy.SuppressHoles(cut_without_f_0_3, [w_3]) SuppHole3_id = geompy.addToStudy(SuppHole3, "Supp Hole 3") def TestMakeSewing (geompy, math): @@ -312,7 +313,7 @@ def TestDivideEdge (geompy): Box = geompy.MakeBoxDXDYDZ(200., 200., 200.) #Divide Edge - box_edges = geompy.SubShapeAllSorted(Box, geompy.ShapeType["EDGE"]) + box_edges = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["EDGE"]) edge_ind = geompy.GetSubShapeID(Box, box_edges[1]) Divide = geompy.DivideEdge(Box, edge_ind, 0.5, 1) # Obj, ind, param, is_curve_param @@ -321,6 +322,51 @@ def TestDivideEdge (geompy): Id_Box = geompy.addToStudy(Box, "Box") Id_Divide = geompy.addToStudy(Divide, "Box with Divided Edge") +def TestFuseEdges (geompy): + + # create vertices + p1 = geompy.MakeVertex(0, 0, 0) + p2 = geompy.MakeVertex(70, 0, 0) + p3 = geompy.MakeVertex(70, 50, 0) + p4 = geompy.MakeVertex(70, 80, 0) + p5 = geompy.MakeVertex(50, 80, 0) + p6 = geompy.MakeVertex(20, 80, 0) + p7 = geompy.MakeVertex(0, 80, 0) + p8 = geompy.MakeVertex(0, 30, 0) + + points = [p1, p2, p3, p4, p5, p6, p7, p8] + + # make a wire + wire_1 = geompy.MakePolyline(points, True) + + # suppress some vertices in the wire + wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3]) + wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6]) + + # suppress all suitable vertices in the wire + wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, []) + + wires = [wire_1, wire_2, wire_3, wire_4] + + # add objects in the study + ii = 1 + for point in points: + geompy.addToStudy(point, "p%d"%ii) + ii = ii + 1 + pass + + ii = 1 + for wire in wires: + geompy.addToStudy(wire, "wire_%d"%ii) + wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"]) + jj = 1 + for point in wire_points: + geompy.addToStudyInFather(wire, point, "point_%d"%jj) + jj = jj + 1 + pass + ii = ii + 1 + pass + def TestHealingOperations (geompy, math): TestMakeSewing(geompy, math) @@ -330,3 +376,4 @@ def TestHealingOperations (geompy, math): TestCloseContour(geompy) TestSuppressFaces(geompy) TestProcessShape(geompy) + TestFuseEdges(geompy) diff --git a/src/GEOM_SWIG/GEOM_TestMeasures.py b/src/GEOM_SWIG/GEOM_TestMeasures.py index 08d341090..1621f2bf4 100644 --- a/src/GEOM_SWIG/GEOM_TestMeasures.py +++ b/src/GEOM_SWIG/GEOM_TestMeasures.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + def TestMeasureOperations (geompy, math): p0 = geompy.MakeVertex(0 , 0, 0) @@ -45,12 +47,31 @@ def TestMeasureOperations (geompy, math): else: print "\nBox is valid" + ####### Detect Self-intersections ####### + + [Face_1,Face_2] = geompy.SubShapes(box, [33, 23]) + Translation_1 = geompy.MakeTranslation(Face_1, 5, -15, -40) + Compound_1 = geompy.MakeCompound([Face_2, Translation_1]) + if geompy.CheckSelfIntersections(Compound_1) == True: + raise RuntimeError, "Existing self-intersection is not detected" + ####### WhatIs ####### Descr = geompy.WhatIs(box) print "\nBox 10x30x70 description:" print Descr + ####### NbShapes ####### + + NbSolids = geompy.NbShapes(box, geompy.ShapeType["SOLID"]) + print "\nBox 10x30x70 quantity of solids:", NbSolids + + ####### ShapeInfo ####### + + BoxInfo = geompy.ShapeInfo(box) + print "\nBox 10x30x70 shapes:" + print BoxInfo + ####### BasicProperties ####### Props = geompy.BasicProperties(box) @@ -113,7 +134,7 @@ def TestMeasureOperations (geompy, math): ####### GetNormal ####### - faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) + faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"]) face0 = faces[0] vnorm = geompy.GetNormal(face0) if vnorm is None: diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py index 76d4e2811..8e65788e2 100644 --- a/src/GEOM_SWIG/GEOM_TestOthers.py +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -1,34 +1,35 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# GEOM GEOM_SWIG : binding of C++ implementaion with Python # File : GEOM_TestOthers.py # Author : Julia DOROVSKIKH # Module : GEOM # $Header$ +# # ! Please, if you edit this example file, update also # ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_others.doc # ! as some sequences of symbols from this example are used during # ! documentation generation to identify certain places of this file -# + import os def TestExportImport (geompy, shape): @@ -75,7 +76,7 @@ def TestExportImport (geompy, shape): geompy.ExportSTEP(shape, fileExportImportSTEP) # Import - Import = geompy.Import(fileExportImport, "BREP") + Import = geompy.ImportFile(fileExportImport, "BREP") id_Import = geompy.addToStudy(Import, "Import") @@ -104,6 +105,8 @@ def TestOtherOperations (geompy, math): vy = geompy.MakeVectorDXDYDZ( 0, 1, 0) vz = geompy.MakeVectorDXDYDZ( 0, 0, 1) + v_y = geompy.MakeVectorDXDYDZ( 0, -1, 0) + p11 = geompy.MakeVertex( 0, 0, 0) p12 = geompy.MakeVertex(30, 0, 0) p13 = geompy.MakeVertex(30, 30, 0) @@ -177,7 +180,7 @@ def TestOtherOperations (geompy, math): # MakeFilletAll radius_fillet = 10. - face5 = geompy.SubShapeSorted(Box, geompy.ShapeType["FACE"], [5]) + face5 = geompy.SubShapeSortedCentres(Box, geompy.ShapeType["FACE"], [5]) f_glob_id = geompy.GetSubShapeID(Box, face5) SuppFace = geompy.SuppressFaces(Box, [f_glob_id]) @@ -192,7 +195,7 @@ def TestOtherOperations (geompy, math): # MakeChamfer d1 = 13. d2 = 7. - box_faces = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) + box_faces = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"]) f_ind_1 = geompy.GetSubShapeID(Box, box_faces[0]) f_ind_2 = geompy.GetSubShapeID(Box, box_faces[1]) f_ind_3 = geompy.GetSubShapeID(Box, box_faces[2]) @@ -201,16 +204,23 @@ def TestOtherOperations (geompy, math): [f_ind_1, f_ind_2, f_ind_3]) id_MakeChamfer = geompy.addToStudy(MakeChamfer, "MakeChamfer") - # NumberOfFaces + # NumberOf NumberOfFaces = geompy.NumberOfFaces(Box) if NumberOfFaces != 6: print "Bad number of faces in BOX!" - # NumberOfEdges NumberOfEdges = geompy.NumberOfEdges(Box) if NumberOfEdges != 12: print "Bad number of edges in BOX!" + NumberOfSolids = geompy.NumberOfSolids(Box) + if NumberOfSolids != 1: + print "Bad number of solids in BOX!" + + NumberOfShapes = geompy.NumberOfSubShapes(Box, geompy.ShapeType["SHAPE"]) + if NumberOfShapes != 34: + print "Bad number of shapes in BOX!" + # MakeBlockExplode Compound = geompy.MakeCompound([Box, Sphere]) MakeBlockExplode = geompy.MakeBlockExplode(Compound, 6, 6) @@ -320,18 +330,17 @@ def TestOtherOperations (geompy, math): v_0pp = geompy.MakeVectorDXDYDZ( 0, 1, 1) #v_0np = geompy.MakeVectorDXDYDZ( 0, -1, 1) - #v_p0p = geompy.MakeVectorDXDYDZ( 1, 0, 1) - #v_n0p = geompy.MakeVectorDXDYDZ(-1, 0, 1) - #v_pp0 = geompy.MakeVectorDXDYDZ( 1, 1, 0) - #v_np0 = geompy.MakeVectorDXDYDZ(-1, 1, 0) - v_0n0 = geompy.MakeVectorDXDYDZ( 0, -1, 0) + v_p0p = geompy.MakeVectorDXDYDZ( 1, 0, 1) + v_p0n = geompy.MakeVectorDXDYDZ(1, 0, -1) + v_pp0 = geompy.MakeVectorDXDYDZ( 1, 1, 0) + v_pn0 = geompy.MakeVectorDXDYDZ(1, -1, 0) #pln_0pp = geompy.MakePlane(p0, v_0pp, 300) #pln_0np = geompy.MakePlane(p0, v_0np, 300) - #pln_p0p = geompy.MakePlane(p0, v_p0p, 300) - #pln_n0p = geompy.MakePlane(p0, v_n0p, 300) - #pln_pp0 = geompy.MakePlane(p0, v_pp0, 300) - #pln_np0 = geompy.MakePlane(p0, v_np0, 300) + pln_p0p = geompy.MakePlane(p0, v_p0p, 300) + pln_p0n = geompy.MakePlane(p0, v_p0n, 300) + pln_pp0 = geompy.MakePlane(p0, v_pp0, 300) + pln_pn0 = geompy.MakePlane(p0, v_pn0, 300) # #part_objs = [b0, pln_0pp, pln_0np, pln_p0p, pln_n0p, pln_pp0, pln_np0] #part_tool_1 = geompy.MakePartition(part_objs, [], [], [b0]) @@ -410,17 +419,70 @@ def TestOtherOperations (geompy, math): geompy.addToStudy(freeFaces, "freeFaces") - # RemoveExtraEdges + # RemoveExtraEdges with union of all faces, sharing common surfaces + tools = [pln_pp0, pln_pn0, pln_p0p, pln_p0n] + + Partition_1 = geompy.MakePartition([Sphere], tools, [], [], geompy.ShapeType["SOLID"], 0, []) + geompy.addToStudy(Partition_1, "Partition_1") + + faces = geompy.SubShapeAllSortedCentres(Partition_1, geompy.ShapeType["FACE"]) + + Face_1 = faces[0] + Face_2 = faces[39] + Face_3 = faces[40] + + geompy.addToStudyInFather(Partition_1, Face_1, "Face_1") + geompy.addToStudyInFather(Partition_1, Face_2, "Face_2") + geompy.addToStudyInFather(Partition_1, Face_3, "Face_3") + + Vector_5 = geompy.MakeVectorDXDYDZ(0, 20, 0) + geompy.addToStudy(Vector_5, "Vector_5") + + Rotation_1 = geompy.MakeRotation(Face_1, Vector_5, 90*math.pi/180.0) + Rotation_2 = geompy.MakeRotation(Face_1, Vector_5, 180*math.pi/180.0) + Rotation_3 = geompy.MakeRotation(Face_1, Vector_5, 270*math.pi/180.0) + + geompy.addToStudy(Rotation_1, "Rotation_1") + geompy.addToStudy(Rotation_2, "Rotation_2") + geompy.addToStudy(Rotation_3, "Rotation_3") + + Vector_6 = geompy.MakeVectorDXDYDZ(0, 0, 20) + geompy.addToStudy(Vector_6, "Vector_6") + + Rotation_4 = geompy.MakeRotation(Face_1, Vector_6, 90*math.pi/180.0) + Rotation_5 = geompy.MakeRotation(Face_1, Vector_6, -90*math.pi/180.0) + geompy.addToStudy(Rotation_4, "Rotation_4") + geompy.addToStudy(Rotation_5, "Rotation_5") + + Shell_1 = geompy.MakeShell([Face_1, Rotation_1, Rotation_2, Rotation_3, Rotation_4, Rotation_5]) + Solid_1 = geompy.MakeSolid([Shell_1]) + NoExtraEdges_1 = geompy.RemoveExtraEdges(Solid_1, True) # doUnionFaces = True + + geompy.addToStudy(Shell_1, "Shell_1") + geompy.addToStudy(Solid_1, "Solid_1") + geompy.addToStudy(NoExtraEdges_1, "NoExtraEdges_1") + + # RemoveExtraEdges (by default, doUnionFaces = False) freeFacesWithoutExtra = geompy.RemoveExtraEdges(freeFaces) geompy.addToStudy(freeFacesWithoutExtra, "freeFacesWithoutExtra") # GetSharedShapes - sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra, + sharedFaces = geompy.GetSharedShapes(part, freeFaces, geompy.ShapeType["FACE"]) - + ind = 1 for shFace in sharedFaces: - geompy.addToStudy(shFace, "sharedFace") + geompy.addToStudy(shFace, "sharedFace_" + `ind`) + ind = ind + 1 + pass + + sharedEdges = geompy.GetSharedShapesMulti([part, freeFaces], + geompy.ShapeType["EDGE"]) + ind = 1 + for shEdge in sharedEdges: + geompy.addToStudy(shEdge, "sharedEdge_" + `ind`) + ind = ind + 1 + pass # CheckAndImprove blocksComp = geompy.CheckAndImprove(part) @@ -447,6 +509,17 @@ def TestOtherOperations (geompy, math): geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50, 50, 50)") geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)") + # GetVertexNearPoint(theShape, thePoint) + pb0_top_2_near = geompy.MakeVertex(40, 40, 40) + pb0_top_2 = geompy.GetVertexNearPoint(blocksComp, pb0_top_2_near) + + geompy.addToStudyInFather(blocksComp, pb0_top_2, "point from blocksComp near (40, 40, 40)") + + # GetEdge(theShape, thePoint1, thePoint2) + edge_top_y50 = geompy.GetEdge(blocksComp, pb0_top_1, pb0_top_2) + + geompy.addToStudyInFather(blocksComp, edge_top_y50, "edge from blocksComp by two points") + # GetEdgeNearPoint(theShape, thePoint) pmidle = geompy.MakeVertex(50, 0, 50) edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle) @@ -458,6 +531,11 @@ def TestOtherOperations (geompy, math): geompy.addToStudyInFather(blocksComp, b0_image, "b0 image") + # GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance) + b0_faces_plus = geompy.GetShapesNearPoint(blocksComp, pb0_top_2_near, geompy.ShapeType["FACE"], 0.01) + + geompy.addToStudyInFather(blocksComp, b0_faces_plus, "faces near point (40, 40, 40)") + # GetShapesOnPlane faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"], v_0pp, geompy.GEOM.ST_ONIN) @@ -474,13 +552,13 @@ def TestOtherOperations (geompy, math): # GetShapesOnPlaneWithLocation Loc = geompy.MakeVertex(0, -50, 0) edges_on_pln = geompy.GetShapesOnPlaneWithLocation(blocksComp, geompy.ShapeType["EDGE"], - v_0n0, Loc, geompy.GEOM.ST_ON) + v_y, Loc, geompy.GEOM.ST_ON) for edge_i in edges_on_pln: geompy.addToStudy(edge_i, "Edge on Plane (N = (0, -1, 0) & Location = (0, -50, 0)") - + # GetShapesOnPlaneWithLocationIDs edges_on_pln_ids = geompy.GetShapesOnPlaneWithLocationIDs( - blocksComp, geompy.ShapeType["EDGE"], v_0n0, Loc, geompy.GEOM.ST_ON) + blocksComp, geompy.ShapeType["EDGE"], v_y, Loc, geompy.GEOM.ST_ON) group_edges_on_pln = geompy.CreateGroup(blocksComp, geompy.ShapeType["EDGE"]) geompy.UnionIDs(group_edges_on_pln, edges_on_pln_ids) grname = "Group of edges on Plane (N = (0, -1, 0) & Location = (0, -50, 0))" @@ -499,6 +577,19 @@ def TestOtherOperations (geompy, math): geompy.UnionIDs(edges_in, edges_in_cyl_ids) geompy.addToStudy(edges_in, "Group of edges inside Cylinder (axis = (0, 1, 0), r = 55)") + # GetShapesOnCylinderWithLocation + edges_out_cyl = geompy.GetShapesOnCylinderWithLocation(blocksComp, geompy.ShapeType["EDGE"], + vy, p11, 55, geompy.GEOM.ST_OUT) + for edge_i in edges_out_cyl: + geompy.addToStudy(edge_i, "Edge out of Cylinder (axis = (0, 1, 0), loc = (0, 0, 0), r = 55)") + + # GetShapesOnCylinderWithLocationIDs + edges_in_cyl_ids = geompy.GetShapesOnCylinderWithLocationIDs(blocksComp, geompy.ShapeType["EDGE"], + vy, p11, 80, geompy.GEOM.ST_IN) + edges_in = geompy.CreateGroup(blocksComp, geompy.ShapeType["EDGE"]) + geompy.UnionIDs(edges_in, edges_in_cyl_ids) + geompy.addToStudy(edges_in, "Group of edges inside Cylinder (axis = (0, 1, 0), loc = (0, 0, 0), r = 80)") + # GetShapesOnSphere vertices_on_sph = geompy.GetShapesOnSphere(blocksComp, geompy.ShapeType["VERTEX"], p0, 100, geompy.GEOM.ST_ON) @@ -562,10 +653,10 @@ def TestOtherOperations (geompy, math): pcyl = geompy.MakeVertex(50, 50, -50) cyli = geompy.MakeCylinder(pcyl, vz, 40, 100) fuse = geompy.MakeFuse(sph1, cyli) - fuse = geompy.MakeFuse(fuse, sph2) + sh_1 = geompy.MakeFuse(fuse, sph2) # As after Fuse we have a compound, we need to obtain a solid from it - shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"]) - sh_1 = shsh[0] + #shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"]) + #sh_1 = shsh[0] geompy.addToStudy(sh_1, "sh_1") # GetShapesOnShape diff --git a/src/GEOM_SWIG/GEOM_blocks.py b/src/GEOM_SWIG/GEOM_blocks.py index 99be53789..3acf5f5fa 100644 --- a/src/GEOM_SWIG/GEOM_blocks.py +++ b/src/GEOM_SWIG/GEOM_blocks.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ implementaion with Python # File : GEOM_blocks.py # Author : Julia DOROVSKIKH diff --git a/src/GEOM_SWIG/GEOM_cyl2complementary.py b/src/GEOM_SWIG/GEOM_cyl2complementary.py index 7a28cfe4b..07ff303bb 100755 --- a/src/GEOM_SWIG/GEOM_cyl2complementary.py +++ b/src/GEOM_SWIG/GEOM_cyl2complementary.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : cyl2complementary_modified.py, PAL6700 diff --git a/src/GEOM_SWIG/GEOM_example.py b/src/GEOM_SWIG/GEOM_example.py index d5f2463a2..4e7e6bd97 100644 --- a/src/GEOM_SWIG/GEOM_example.py +++ b/src/GEOM_SWIG/GEOM_example.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_example.py # Author : Paul RASCLE, EDF diff --git a/src/GEOM_SWIG/GEOM_example2.py b/src/GEOM_SWIG/GEOM_example2.py index 000623295..9c18c56cf 100644 --- a/src/GEOM_SWIG/GEOM_example2.py +++ b/src/GEOM_SWIG/GEOM_example2.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_example2.py # Author : Paul RASCLE, EDF diff --git a/src/GEOM_SWIG/GEOM_example3.py b/src/GEOM_SWIG/GEOM_example3.py index 3c5bd0498..8e8c4b40b 100644 --- a/src/GEOM_SWIG/GEOM_example3.py +++ b/src/GEOM_SWIG/GEOM_example3.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_example3.py # Author : Paul RASCLE, EDF @@ -110,7 +112,7 @@ if not isinstance(gg, type(salome_ComponentGUI)): gg.setDisplayMode(id_torus1,1) gg.setDisplayMode(id_torus2,1) - gg.setDisplayMode(id_acyl,1) + gg.setVectorsMode(id_acyl,1,1) #gg.setDisplayMode(id_cage,1) gg.setColor(id_torus1,0,0,255) diff --git a/src/GEOM_SWIG/GEOM_example4.py b/src/GEOM_SWIG/GEOM_example4.py index 4406bd81d..701d40b72 100755 --- a/src/GEOM_SWIG/GEOM_example4.py +++ b/src/GEOM_SWIG/GEOM_example4.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_example4.py # Module : GEOM diff --git a/src/GEOM_SWIG/GEOM_example5.py b/src/GEOM_SWIG/GEOM_example5.py index 9edda83e1..4caaeb7ac 100644 --- a/src/GEOM_SWIG/GEOM_example5.py +++ b/src/GEOM_SWIG/GEOM_example5.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_example5.py # Author : Damien COQUERET, Open CASCADE diff --git a/src/GEOM_SWIG/GEOM_example6.py b/src/GEOM_SWIG/GEOM_example6.py index 904d4b897..0041e1c4a 100755 --- a/src/GEOM_SWIG/GEOM_example6.py +++ b/src/GEOM_SWIG/GEOM_example6.py @@ -1,60 +1,59 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# File : GEOM_example6.py +# Author : Dmitry MATVEITChEV +# Module : GEOM +# $Header$ # -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python -# File : GEOM_example6.py -# Author : Dmitry MATVEITCHEV -# Module : GEOM -# $Header$ -# -import salome -import geompy - -ind = 1 -circlelist = [] -while ind < 6: - x1 = 0. + (10. * ind) - y1 = 0. - z1 = 0. - x2 = 10. + (10. * ind) - y2 = 20. * (ind+1) - z2 = 30. * (ind+1) - x3 = 50. + (10. * ind) - y3 = 0. * (ind+1) - z3 = -10. * (ind+1) - - print x1, y1, z1, x2, y2, z2, x3, y3, z3 - - point1 = geompy.MakeVertex(x1, y1, z1) - name1 = "point1_%d"%(ind) - id_pt1 = geompy.addToStudy(point1, name1) - point2 = geompy.MakeVertex(x2, y2, z2) - name2 = "point2_%d"%(ind) - id_pt2 = geompy.addToStudy(point2, name2) - point3 = geompy.MakeVertex(x3, y3, z3) - name3 = "point3_%d"%(ind) - id_pt3 = geompy.addToStudy(point3, name3) - - name = "circle%d"%(ind) - circle = geompy.MakeCircleCenter2Pnt(point1, point2, point3) - id_circle = geompy.addToStudy(circle, name) - circlelist.append(circle) - ind = ind + 1 +import salome +import geompy + +ind = 1 +circlelist = [] +while ind < 6: + x1 = 0. + (10. * ind) + y1 = 0. + z1 = 0. + x2 = 10. + (10. * ind) + y2 = 20. * (ind+1) + z2 = 30. * (ind+1) + x3 = 50. + (10. * ind) + y3 = 0. * (ind+1) + z3 = -10. * (ind+1) + + print x1, y1, z1, x2, y2, z2, x3, y3, z3 + + point1 = geompy.MakeVertex(x1, y1, z1) + name1 = "point1_%d"%(ind) + id_pt1 = geompy.addToStudy(point1, name1) + point2 = geompy.MakeVertex(x2, y2, z2) + name2 = "point2_%d"%(ind) + id_pt2 = geompy.addToStudy(point2, name2) + point3 = geompy.MakeVertex(x3, y3, z3) + name3 = "point3_%d"%(ind) + id_pt3 = geompy.addToStudy(point3, name3) + + name = "circle%d"%(ind) + circle = geompy.MakeCircleCenter2Pnt(point1, point2, point3) + id_circle = geompy.addToStudy(circle, name) + circlelist.append(circle) + ind = ind + 1 diff --git a/src/GEOM_SWIG/GEOM_example7.py b/src/GEOM_SWIG/GEOM_example7.py new file mode 100644 index 000000000..fa7179665 --- /dev/null +++ b/src/GEOM_SWIG/GEOM_example7.py @@ -0,0 +1,51 @@ +# Copyright (C) 2007-2012 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 +# + +# --- +# File : GEOM_example7.py +# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +# --- +# +import salome +import geompy +import os +import GEOM + +data_dir = os.getenv('DATA_DIR') +if data_dir: + texture_1 = geompy.LoadTexture(os.path.join(data_dir, "Textures", "texture1.dat")) + texture_2 = geompy.LoadTexture(os.path.join(data_dir, "Textures", "texture2.dat")) + texture_3 = geompy.LoadTexture(os.path.join(data_dir, "Textures", "texture3.dat")) + + Vertex_1 = geompy.MakeVertex(0, 0, 0) + Vertex_2 = geompy.MakeVertex(100, 0, 0) + Vertex_3 = geompy.MakeVertex(0, 100, 0) + Vertex_4 = geompy.MakeVertex(0, 0, 100) + Vertex_5 = geompy.MakeVertex(100, 0, 100) + Vertex_1.SetMarkerTexture(texture_1); + Vertex_2.SetMarkerTexture(texture_2); + Vertex_3.SetMarkerTexture(texture_3); + Vertex_4.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25); + Vertex_5.SetMarkerStd(GEOM.MT_BALL, GEOM.MS_40); + geompy.addToStudy( Vertex_1, "Vertex_1" ) + geompy.addToStudy( Vertex_2, "Vertex_2" ) + geompy.addToStudy( Vertex_3, "Vertex_3" ) + geompy.addToStudy( Vertex_4, "Vertex_4" ) + geompy.addToStudy( Vertex_5, "Vertex_5" ) + pass diff --git a/src/GEOM_SWIG/GEOM_moteur.py b/src/GEOM_SWIG/GEOM_moteur.py index 22a6bd88c..b39172c3a 100644 --- a/src/GEOM_SWIG/GEOM_moteur.py +++ b/src/GEOM_SWIG/GEOM_moteur.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_moteur.py # Author : Damien COQUERET, Open CASCADE diff --git a/src/GEOM_SWIG/GEOM_shared_modules.py b/src/GEOM_SWIG/GEOM_shared_modules.py index 2bd68bcb2..cd25ebeec 100644 --- a/src/GEOM_SWIG/GEOM_shared_modules.py +++ b/src/GEOM_SWIG/GEOM_shared_modules.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + """ """ diff --git a/src/GEOM_SWIG/GEOM_shellSolid.py b/src/GEOM_SWIG/GEOM_shellSolid.py index 5ea176206..bc935d538 100755 --- a/src/GEOM_SWIG/GEOM_shellSolid.py +++ b/src/GEOM_SWIG/GEOM_shellSolid.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : shellSolid_modified.py, PAL6611 diff --git a/src/GEOM_SWIG/GEOM_tube_geom.py b/src/GEOM_SWIG/GEOM_tube_geom.py index 1e2d91689..fe81b8419 100755 --- a/src/GEOM_SWIG/GEOM_tube_geom.py +++ b/src/GEOM_SWIG/GEOM_tube_geom.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : tube_geom_corrected.py, PAL5243 diff --git a/src/GEOM_SWIG/GEOM_tube_geom_gg2.py b/src/GEOM_SWIG/GEOM_tube_geom_gg2.py index 6cc90f3c0..ee57b7b6c 100755 --- a/src/GEOM_SWIG/GEOM_tube_geom_gg2.py +++ b/src/GEOM_SWIG/GEOM_tube_geom_gg2.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Info. # Bug (from script, bug) : tube_geom_gg2_corrected.py, PAL5243 diff --git a/src/GEOM_SWIG/GEOM_usinggeom.py b/src/GEOM_SWIG/GEOM_usinggeom.py index 14d98ed37..5093069d5 100644 --- a/src/GEOM_SWIG/GEOM_usinggeom.py +++ b/src/GEOM_SWIG/GEOM_usinggeom.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : GEOM_usinggeom.py # Author : Damien COQUERET, Open CASCADE diff --git a/src/GEOM_SWIG/Makefile.am b/src/GEOM_SWIG/Makefile.am index 3b7c921fb..3fe82e1a4 100644 --- a/src/GEOM_SWIG/Makefile.am +++ b/src/GEOM_SWIG/Makefile.am @@ -1,31 +1,27 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : Makefile.in # Author : Nicolas REJNERI, Paul RASCLE # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM - - # Libraries targets # include $(top_srcdir)/adm_local/unix/make_common_starter.am @@ -48,6 +44,7 @@ dist_salomescript_DATA = \ GEOM_example4.py \ GEOM_example5.py \ GEOM_example6.py \ + GEOM_example7.py \ GEOM_moteur.py \ GEOM_TestAll.py \ GEOM_TestOthers.py \ diff --git a/src/GEOM_SWIG/PAL_MESH_019_020_geometry.py b/src/GEOM_SWIG/PAL_MESH_019_020_geometry.py index e2e5667d4..72a71c35e 100755 --- a/src/GEOM_SWIG/PAL_MESH_019_020_geometry.py +++ b/src/GEOM_SWIG/PAL_MESH_019_020_geometry.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + ##################################################################################### #Created :17/02/2005 #Auhtor :KOVALTCHUK Alexey diff --git a/src/GEOM_SWIG/PAL_MESH_028_geometry.py b/src/GEOM_SWIG/PAL_MESH_028_geometry.py index 0c52a7e94..d6815151e 100755 --- a/src/GEOM_SWIG/PAL_MESH_028_geometry.py +++ b/src/GEOM_SWIG/PAL_MESH_028_geometry.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + ##################################################################### #Created :17/02/2005 #Auhtor :KOVALTCHUK Alexey diff --git a/src/GEOM_SWIG/PAL_MESH_030_geometry.py b/src/GEOM_SWIG/PAL_MESH_030_geometry.py index e8503a489..8480121c3 100755 --- a/src/GEOM_SWIG/PAL_MESH_030_geometry.py +++ b/src/GEOM_SWIG/PAL_MESH_030_geometry.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + #============================================================================== # Created : 17/02/2005 # Author : Alexander KOVALEV diff --git a/src/GEOM_SWIG/PAL_MESH_033_geometry.py b/src/GEOM_SWIG/PAL_MESH_033_geometry.py index 06f3dfeb5..d624639c6 100755 --- a/src/GEOM_SWIG/PAL_MESH_033_geometry.py +++ b/src/GEOM_SWIG/PAL_MESH_033_geometry.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + ##################################################################### #Created :17/02/2005 #Auhtor :KOVALTCHUK Alexey diff --git a/src/GEOM_SWIG/PAL_MESH_035_geometry.py b/src/GEOM_SWIG/PAL_MESH_035_geometry.py index 615d41bad..9b3a28054 100755 --- a/src/GEOM_SWIG/PAL_MESH_035_geometry.py +++ b/src/GEOM_SWIG/PAL_MESH_035_geometry.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + ##################################################################### #Created :15/02/2005 #Auhtor :KOVALTCHUK Alexey diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 181f5f34f..9d45b34ac 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : batchmode_geompy.py # Author : Paul RASCLE, EDF diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 83b9fa7dd..13df41063 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -1,24 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# 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 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. +# 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 +# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : geompy.py # Author : Paul RASCLE, EDF @@ -37,5 +39,5 @@ for k in dir(geom): if k[0] == '_':continue globals()[k]=getattr(geom,k) del k -from geompyDC import ShapeType,GEOM,kind, info +from geompyDC import ShapeType, GEOM, kind, info, PackData, ReadTexture, EnumToLong diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 849095d4e..ca34d8893 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -1,25 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : geompy.py # Author : Paul RASCLE, EDF # Module : GEOM @@ -53,8 +50,10 @@ ## @defgroup l3_advanced Creating Advanced Geometrical Objects ## @{ ## @defgroup l4_decompose Decompose objects +## @defgroup l4_decompose_d Decompose objects deprecated methods ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape -## @defgroup l4_obtain Access to subshapes by a criteria +## @defgroup l4_obtain Access to sub-shapes by a criteria +## @defgroup l4_advanced Advanced objects creation functions ## @} @@ -64,10 +63,10 @@ ## @defgroup l3_basic_op Basic Operations ## @defgroup l3_boolean Boolean Operations ## @defgroup l3_transform Transformation Operations -## @defgroup l3_local Local Operations (Fillet and Chamfer) +## @defgroup l3_local Local Operations (Fillet, Chamfer and other Features) ## @defgroup l3_blocks_op Blocks Operations ## @defgroup l3_healing Repairing Operations -## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes +## @defgroup l3_restore_ss Restore presentation parameters and a tree of sub-shapes ## @} ## @defgroup l2_measure Using measurement tools @@ -82,41 +81,53 @@ from salome_notebook import * import GEOM import math +import os -## Enumeration ShapeType as a dictionary +## Enumeration ShapeType as a dictionary. \n +## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details. # @ingroup l1_geompy_auxiliary -ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} +ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} ## Raise an Error, containing the Method_name, if Operation is Failed ## @ingroup l1_geompy_auxiliary def RaiseIfFailed (Method_name, Operation): if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY": raise RuntimeError, Method_name + " : " + Operation.GetErrorCode() - + ## Return list of variables value from salome notebook -## @ingroup l1_geompy_auxiliary +## @ingroup l1_geompy_auxiliary def ParseParameters(*parameters): Result = [] - StringResult = "" + StringResult = [] for parameter in parameters: - if isinstance(parameter,str): - if notebook.isVariable(parameter): - Result.append(notebook.get(parameter)) - else: - raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!" + if isinstance(parameter, list): + lResults = ParseParameters(*parameter) + if len(lResults) > 0: + Result.append(lResults[:-1]) + StringResult += lResults[-1].split(":") + pass + pass else: - Result.append(parameter) + if isinstance(parameter,str): + if notebook.isVariable(parameter): + Result.append(notebook.get(parameter)) + else: + raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!" + pass + else: + Result.append(parameter) + pass + StringResult.append(str(parameter)) pass - - StringResult = StringResult + str(parameter) - StringResult = StringResult + ":" pass - StringResult = StringResult[:len(StringResult)-1] - Result.append(StringResult) + if Result: + Result.append(":".join(StringResult)) + else: + Result = ":".join(StringResult) return Result - + ## Return list of variables value from salome notebook -## @ingroup l1_geompy_auxiliary +## @ingroup l1_geompy_auxiliary def ParseList(list): Result = [] StringResult = "" @@ -127,15 +138,15 @@ def ParseList(list): else: Result.append(str(parameter)) pass - + StringResult = StringResult + str(parameter) StringResult = StringResult + ":" pass StringResult = StringResult[:len(StringResult)-1] return Result, StringResult - + ## Return list of variables value from salome notebook -## @ingroup l1_geompy_auxiliary +## @ingroup l1_geompy_auxiliary def ParseSketcherCommand(command): Result = "" StringResult = "" @@ -167,18 +178,193 @@ def ParseSketcherCommand(command): Result = Result[:len(Result)-1] return Result, StringResult -## Kinds of shape enumeration +## Helper function which can be used to pack the passed string to the byte data. +## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes. +## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception. +## For example, +## \code +## val = PackData("10001110") # val = 0xAE +## val = PackData("1") # val = 0x80 +## \endcode +## @param data unpacked data - a string containing '1' and '0' symbols +## @return data packed to the byte stream +## @ingroup l1_geompy_auxiliary +def PackData(data): + """ + Helper function which can be used to pack the passed string to the byte data. + Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes. + If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception. + + Parameters: + data unpacked data - a string containing '1' and '0' symbols + + Returns: + data packed to the byte stream + + Example of usage: + val = PackData("10001110") # val = 0xAE + val = PackData("1") # val = 0x80 + """ + bytes = len(data)/8 + if len(data)%8: bytes += 1 + res = "" + for b in range(bytes): + d = data[b*8:(b+1)*8] + val = 0 + for i in range(8): + val *= 2 + if i < len(d): + if d[i] == "1": val += 1 + elif d[i] != "0": + raise "Invalid symbol %s" % d[i] + pass + pass + res += chr(val) + pass + return res + +## Read bitmap texture from the text file. +## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap. +## A zero symbol ('0') represents transparent pixel of the texture bitmap. +## The function returns width and height of the pixmap in pixels and byte stream representing +## texture bitmap itself. +## +## This function can be used to read the texture to the byte stream in order to pass it to +## the AddTexture() function of geompy class. +## For example, +## \code +## import geompy +## geompy.init_geom(salome.myStudy) +## texture = geompy.readtexture('mytexture.dat') +## texture = geompy.AddTexture(*texture) +## obj.SetMarkerTexture(texture) +## \endcode +## @param fname texture file name +## @return sequence of tree values: texture's width, height in pixels and its byte stream +## @ingroup l1_geompy_auxiliary +def ReadTexture(fname): + """ + Read bitmap texture from the text file. + In that file, any non-zero symbol represents '1' opaque pixel of the bitmap. + A zero symbol ('0') represents transparent pixel of the texture bitmap. + The function returns width and height of the pixmap in pixels and byte stream representing + texture bitmap itself. + This function can be used to read the texture to the byte stream in order to pass it to + the AddTexture() function of geompy class. + + Parameters: + fname texture file name + + Returns: + sequence of tree values: texture's width, height in pixels and its byte stream + + Example of usage: + import geompy + geompy.init_geom(salome.myStudy) + texture = geompy.readtexture('mytexture.dat') + texture = geompy.AddTexture(*texture) + obj.SetMarkerTexture(texture) + """ + try: + f = open(fname) + lines = [ l.strip() for l in f.readlines()] + f.close() + maxlen = 0 + if lines: maxlen = max([len(x) for x in lines]) + lenbytes = maxlen/8 + if maxlen%8: lenbytes += 1 + bytedata="" + for line in lines: + if len(line)%8: + lenline = (len(line)/8+1)*8 + pass + else: + lenline = (len(line)/8)*8 + pass + for i in range(lenline/8): + byte="" + for j in range(8): + if i*8+j < len(line) and line[i*8+j] != "0": byte += "1" + else: byte += "0" + pass + bytedata += PackData(byte) + pass + for i in range(lenline/8, lenbytes): + bytedata += PackData("0") + pass + return lenbytes*8, len(lines), bytedata + except: + pass + return 0, 0, "" + +## Returns a long value from enumeration type +# Can be used for CORBA enumerator types like GEOM.shape_type +# @param theItem enumeration type +# @ingroup l1_geompy_auxiliary +def EnumToLong(theItem): + """ + Returns a long value from enumeration type + Can be used for CORBA enumerator types like geompy.ShapeType + + Parameters: + theItem enumeration type + """ + ret = theItem + if hasattr(theItem, "_v"): ret = theItem._v + return ret + +## Kinds of shape in terms of GEOM.GEOM_IKindOfShape.shape_kind enumeration +# and a list of parameters, describing the shape. +# List of parameters, describing the shape: +# - COMPOUND: [nb_solids nb_faces nb_edges nb_vertices] +# - COMPSOLID: [nb_solids nb_faces nb_edges nb_vertices] +# +# - SHELL: [info.CLOSED / info.UNCLOSED nb_faces nb_edges nb_vertices] +# +# - WIRE: [info.CLOSED / info.UNCLOSED nb_edges nb_vertices] +# +# - SPHERE: [xc yc zc R] +# - CYLINDER: [xb yb zb dx dy dz R H] +# - BOX: [xc yc zc ax ay az] +# - ROTATED_BOX: [xc yc zc zx zy zz xx xy xz ax ay az] +# - TORUS: [xc yc zc dx dy dz R_1 R_2] +# - CONE: [xb yb zb dx dy dz R_1 R_2 H] +# - POLYHEDRON: [nb_faces nb_edges nb_vertices] +# - SOLID: [nb_faces nb_edges nb_vertices] +# +# - SPHERE2D: [xc yc zc R] +# - CYLINDER2D: [xb yb zb dx dy dz R H] +# - TORUS2D: [xc yc zc dx dy dz R_1 R_2] +# - CONE2D: [xc yc zc dx dy dz R_1 R_2 H] +# - DISK_CIRCLE: [xc yc zc dx dy dz R] +# - DISK_ELLIPSE: [xc yc zc dx dy dz R_1 R_2] +# - POLYGON: [xo yo zo dx dy dz nb_edges nb_vertices] +# - PLANE: [xo yo zo dx dy dz] +# - PLANAR: [xo yo zo dx dy dz nb_edges nb_vertices] +# - FACE: [nb_edges nb_vertices] +# +# - CIRCLE: [xc yc zc dx dy dz R] +# - ARC_CIRCLE: [xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2] +# - ELLIPSE: [xc yc zc dx dy dz R_1 R_2] +# - ARC_ELLIPSE: [xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2] +# - LINE: [xo yo zo dx dy dz] +# - SEGMENT: [x1 y1 z1 x2 y2 z2] +# - EDGE: [nb_vertices] +# +# - VERTEX: [x y z] # @ingroup l1_geompy_auxiliary kind = GEOM.GEOM_IKindOfShape ## Information about closed/unclosed state of shell or wire # @ingroup l1_geompy_auxiliary class info: + """ + Information about closed/unclosed state of shell or wire + """ UNKNOWN = 0 CLOSED = 1 UNCLOSED = 2 - class geompyDC(GEOM._objref_GEOM_Gen): def __init__(self): @@ -199,6 +385,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): self.MeasuOp = None self.BlocksOp = None self.GroupOp = None + self.AdvOp = None pass ## @addtogroup l1_geompy_auxiliary @@ -230,12 +417,25 @@ class geompyDC(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) pass + ## Dump component to the Python script + # This method overrides IDL function to allow default values for the parameters. + def DumpPython(self, theStudy, theIsPublished=True, theIsMultiFile=True): + """ + Dump component to the Python script + This method overrides IDL function to allow default values for the parameters. + """ + return GEOM._objref_GEOM_Gen.DumpPython(self, theStudy, theIsPublished, theIsMultiFile) + ## Get name for sub-shape aSubObj of shape aMainObj # - # @ref swig_SubShapeAllSorted "Example" + # @ref swig_SubShapeName "Example" def SubShapeName(self,aSubObj, aMainObj): + """ + Get name for sub-shape aSubObj of shape aMainObj + """ # Example: see GEOM_TestAll.py #aSubId = orb.object_to_string(aSubObj) @@ -253,36 +453,87 @@ class geompyDC(GEOM._objref_GEOM_Gen): # \param doRestoreSubShapes if True, finds and publishes also # sub-shapes of aShape, corresponding to its arguments # and published sub-shapes of arguments - # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for + # \param theArgs,theFindMethod,theInheritFirstArg see RestoreSubShapes() for # these arguments description # \return study entry of the published shape in form of string # - # @ref swig_MakeQuad4Vertices "Example" + # @ref swig_all_addtostudy "Example" def addToStudy(self, aShape, aName, doRestoreSubShapes=False, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False): + """ + Publish in study aShape with name aName + + Parameters: + aShape the shape to be published + aName the name for the shape + doRestoreSubShapes if True, finds and publishes also + sub-shapes of aShape, corresponding to its arguments + and published sub-shapes of arguments + theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes() for + these arguments description + + Returns: + study entry of the published shape in form of string + + Example of usage: + id_block1 = geompy.addToStudy(Block1, "Block 1") + """ # Example: see GEOM_TestAll.py try: aSObject = self.AddInStudy(self.myStudy, aShape, aName, None) if doRestoreSubShapes: self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs, - theFindMethod, theInheritFirstArg) + theFindMethod, theInheritFirstArg, True ) except: print "addToStudy() failed" return "" return aShape.GetStudyEntry() ## Publish in study aShape with name aName as sub-object of previously published aFather + # \param aFather previously published object + # \param aShape the shape to be published as sub-object of aFather + # \param aName the name for the shape # - # @ref swig_SubShapeAllSorted "Example" + # \return study entry of the published shape in form of string + # @ref swig_all_addtostudyInFather "Example" def addToStudyInFather(self, aFather, aShape, aName): + """ + Publish in study aShape with name aName as sub-object of previously published aFather + + Parameters: + aFather previously published object + aShape the shape to be published as sub-object of aFather + aName the name for the shape + + Returns: + study entry of the published shape in form of string + """ # Example: see GEOM_TestAll.py try: - aSObject = self.AddInStudy(myStudy, aShape, aName, aFather) + aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather) except: print "addToStudyInFather() failed" return "" return aShape.GetStudyEntry() + ## Unpublish object in study + # + # \param obj the object to be unpublished + def hideInStudy(self, obj): + """ + Unpublish object in study + + Parameters: + obj the object to be unpublished + """ + ior = salome.orb.object_to_string(obj) + aSObject = self.myStudy.FindObjectIOR(ior) + if aSObject is not None: + genericAttribute = self.myBuilder.FindOrCreateAttribute(aSObject, "AttributeDrawable") + drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable) + drwAttribute.SetDrawable(False) + pass + # end of l1_geompy_auxiliary ## @} @@ -290,29 +541,107 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## @{ ## Publish sub-shapes, standing for arguments and sub-shapes of arguments - # To be used from python scripts out of geompy.addToStudy (non-default usage) - # \param theObject published GEOM object, arguments of which will be published - # \param theArgs list of GEOM_Object, operation arguments to be published. + # To be used from python scripts out of addToStudy() (non-default usage) + # \param theObject published GEOM.GEOM_Object, arguments of which will be published + # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published. # If this list is empty, all operation arguments will be published - # \param theFindMethod method to search subshapes, corresponding to arguments and - # their subshapes. Value from enumeration GEOM::find_shape_method. + # \param theFindMethod method to search sub-shapes, corresponding to arguments and + # their sub-shapes. Value from enumeration GEOM.find_shape_method. # \param theInheritFirstArg set properties of the first argument for theObject. - # Do not publish subshapes in place of arguments, but only - # in place of subshapes of the first argument, + # Do not publish sub-shapes in place of arguments, but only + # in place of sub-shapes of the first argument, # because the whole shape corresponds to the first argument. # Mainly to be used after transformations, but it also can be # usefull after partition with one object shape, and some other # operations, where only the first argument has to be considered. # If theObject has only one argument shape, this flag is automatically # considered as True, not regarding really passed value. - # \return True in case of success, False otherwise. + # \param theAddPrefix add prefix "from_" to names of restored sub-shapes, + # and prefix "from_subshapes_of_" to names of partially restored sub-shapes. + # \return list of published sub-shapes # # @ref tui_restore_prs_params "Example" - def RestoreSubShapes (self, theObject, theArgs=[], - theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False): + def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, + theInheritFirstArg=False, theAddPrefix=True): + """ + Publish sub-shapes, standing for arguments and sub-shapes of arguments + To be used from python scripts out of geompy.addToStudy (non-default usage) + + Parameters: + theObject published GEOM.GEOM_Object, arguments of which will be published + theArgs list of GEOM.GEOM_Object, operation arguments to be published. + If this list is empty, all operation arguments will be published + theFindMethod method to search sub-shapes, corresponding to arguments and + their sub-shapes. Value from enumeration GEOM.find_shape_method. + theInheritFirstArg set properties of the first argument for theObject. + Do not publish sub-shapes in place of arguments, but only + in place of sub-shapes of the first argument, + because the whole shape corresponds to the first argument. + Mainly to be used after transformations, but it also can be + usefull after partition with one object shape, and some other + operations, where only the first argument has to be considered. + If theObject has only one argument shape, this flag is automatically + considered as True, not regarding really passed value. + theAddPrefix add prefix "from_" to names of restored sub-shapes, + and prefix "from_subshapes_of_" to names of partially restored sub-shapes. + Returns: + list of published sub-shapes + """ # Example: see GEOM_TestAll.py return self.RestoreSubShapesO(self.myStudy, theObject, theArgs, - theFindMethod, theInheritFirstArg) + theFindMethod, theInheritFirstArg, theAddPrefix) + + ## Publish sub-shapes, standing for arguments and sub-shapes of arguments + # To be used from python scripts out of addToStudy() (non-default usage) + # \param theObject published GEOM.GEOM_Object, arguments of which will be published + # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published. + # If this list is empty, all operation arguments will be published + # \param theFindMethod method to search sub-shapes, corresponding to arguments and + # their sub-shapes. Value from enumeration GEOM::find_shape_method. + # \param theInheritFirstArg set properties of the first argument for theObject. + # Do not publish sub-shapes in place of arguments, but only + # in place of sub-shapes of the first argument, + # because the whole shape corresponds to the first argument. + # Mainly to be used after transformations, but it also can be + # usefull after partition with one object shape, and some other + # operations, where only the first argument has to be considered. + # If theObject has only one argument shape, this flag is automatically + # considered as True, not regarding really passed value. + # \param theAddPrefix add prefix "from_" to names of restored sub-shapes, + # and prefix "from_subshapes_of_" to names of partially restored sub-shapes. + # \return list of published sub-shapes + # + # @ref tui_restore_prs_params "Example" + def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, + theInheritFirstArg=False, theAddPrefix=True): + """ + Publish sub-shapes, standing for arguments and sub-shapes of arguments + To be used from python scripts out of geompy.addToStudy() (non-default usage) + + Parameters: + theObject published GEOM.GEOM_Object, arguments of which will be published + theArgs list of GEOM.GEOM_Object, operation arguments to be published. + If this list is empty, all operation arguments will be published + theFindMethod method to search sub-shapes, corresponding to arguments and + their sub-shapes. Value from enumeration GEOM::find_shape_method. + theInheritFirstArg set properties of the first argument for theObject. + Do not publish sub-shapes in place of arguments, but only + in place of sub-shapes of the first argument, + because the whole shape corresponds to the first argument. + Mainly to be used after transformations, but it also can be + usefull after partition with one object shape, and some other + operations, where only the first argument has to be considered. + If theObject has only one argument shape, this flag is automatically + considered as True, not regarding really passed value. + theAddPrefix add prefix "from_" to names of restored sub-shapes, + and prefix "from_subshapes_of_" to names of partially restored sub-shapes. + + Returns: + list of published sub-shapes + """ + # Example: see GEOM_TestAll.py + return self.RestoreGivenSubShapesO(self.myStudy, theObject, theArgs, + theFindMethod, theInheritFirstArg, theAddPrefix) # end of l3_restore_ss ## @} @@ -324,10 +653,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theX The X coordinate of the point. # @param theY The Y coordinate of the point. # @param theZ The Z coordinate of the point. - # @return New GEOM_Object, containing the created point. + # @return New GEOM.GEOM_Object, containing the created point. # # @ref tui_creation_point "Example" - def MakeVertex(self,theX, theY, theZ): + def MakeVertex(self, theX, theY, theZ): + """ + Create point by three coordinates. + + Parameters: + theX The X coordinate of the point. + theY The Y coordinate of the point. + theZ The Z coordinate of the point. + + Returns: + New GEOM.GEOM_Object, containing the created point. + """ # Example: see GEOM_TestAll.py theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ) anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ) @@ -341,10 +681,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theX Displacement from the referenced point along OX axis. # @param theY Displacement from the referenced point along OY axis. # @param theZ Displacement from the referenced point along OZ axis. - # @return New GEOM_Object, containing the created point. + # @return New GEOM.GEOM_Object, containing the created point. # # @ref tui_creation_point "Example" def MakeVertexWithRef(self,theReference, theX, theY, theZ): + """ + Create a point, distant from the referenced point + on the given distances along the coordinate axes. + + Parameters: + theReference The referenced point. + theX Displacement from the referenced point along OX axis. + theY Displacement from the referenced point along OY axis. + theZ Displacement from the referenced point along OZ axis. + + Returns: + New GEOM.GEOM_Object, containing the created point. + """ # Example: see GEOM_TestAll.py theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ) anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ) @@ -355,10 +708,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a point, corresponding to the given parameter on the given curve. # @param theRefCurve The referenced curve. # @param theParameter Value of parameter on the referenced curve. - # @return New GEOM_Object, containing the created point. + # @return New GEOM.GEOM_Object, containing the created point. # # @ref tui_creation_point "Example" def MakeVertexOnCurve(self,theRefCurve, theParameter): + """ + Create a point, corresponding to the given parameter on the given curve. + + Parameters: + theRefCurve The referenced curve. + theParameter Value of parameter on the referenced curve. + + Returns: + New GEOM.GEOM_Object, containing the created point. + + Example of usage: + p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) + """ # Example: see GEOM_TestAll.py theParameter, Parameters = ParseParameters(theParameter) anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter) @@ -366,15 +732,89 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj + ## Create a point by projection give coordinates on the given curve + # @param theRefCurve The referenced curve. + # @param theX X-coordinate in 3D space + # @param theY Y-coordinate in 3D space + # @param theZ Z-coordinate in 3D space + # @return New GEOM.GEOM_Object, containing the created point. + # + # @ref tui_creation_point "Example" + def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ): + """ + Create a point by projection give coordinates on the given curve + + Parameters: + theRefCurve The referenced curve. + theX X-coordinate in 3D space + theY Y-coordinate in 3D space + theZ Z-coordinate in 3D space + + Returns: + New GEOM.GEOM_Object, containing the created point. + + Example of usage: + p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10) + """ + # Example: see GEOM_TestAll.py + theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ) + anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ) + RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp) + anObj.SetParameters(Parameters) + return anObj + + ## Create a point, corresponding to the given length on the given curve. + # @param theRefCurve The referenced curve. + # @param theLength Length on the referenced curve. It can be negative. + # @param theStartPoint Point allowing to choose the direction for the calculation + # of the length. If None, start from the first point of theRefCurve. + # @return New GEOM.GEOM_Object, containing the created point. + # + # @ref tui_creation_point "Example" + def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None): + """ + Create a point, corresponding to the given length on the given curve. + + Parameters: + theRefCurve The referenced curve. + theLength Length on the referenced curve. It can be negative. + theStartPoint Point allowing to choose the direction for the calculation + of the length. If None, start from the first point of theRefCurve. + + Returns: + New GEOM.GEOM_Object, containing the created point. + """ + # Example: see GEOM_TestAll.py + theLength, Parameters = ParseParameters(theLength) + anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint) + RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp) + anObj.SetParameters(Parameters) + return anObj + ## Create a point, corresponding to the given parameters on the # given surface. # @param theRefSurf The referenced surface. # @param theUParameter Value of U-parameter on the referenced surface. # @param theVParameter Value of V-parameter on the referenced surface. - # @return New GEOM_Object, containing the created point. + # @return New GEOM.GEOM_Object, containing the created point. # # @ref swig_MakeVertexOnSurface "Example" def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter): + """ + Create a point, corresponding to the given parameters on the + given surface. + + Parameters: + theRefSurf The referenced surface. + theUParameter Value of U-parameter on the referenced surface. + theVParameter Value of V-parameter on the referenced surface. + + Returns: + New GEOM.GEOM_Object, containing the created point. + + Example of usage: + p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object, Double, Double)->GEOM_Object + """ theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter) # Example: see GEOM_TestAll.py anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter) @@ -382,12 +822,52 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters); return anObj + ## Create a point by projection give coordinates on the given surface + # @param theRefSurf The referenced surface. + # @param theX X-coordinate in 3D space + # @param theY Y-coordinate in 3D space + # @param theZ Z-coordinate in 3D space + # @return New GEOM.GEOM_Object, containing the created point. + # + # @ref swig_MakeVertexOnSurfaceByCoord "Example" + def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ): + """ + Create a point by projection give coordinates on the given surface + + Parameters: + theRefSurf The referenced surface. + theX X-coordinate in 3D space + theY Y-coordinate in 3D space + theZ Z-coordinate in 3D space + + Returns: + New GEOM.GEOM_Object, containing the created point. + + Example of usage: + p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object, Double, Double, Double)->GEOM_Object + """ + theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ) + # Example: see GEOM_TestAll.py + anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ) + RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp) + anObj.SetParameters(Parameters); + return anObj + ## Create a point on intersection of two lines. # @param theRefLine1, theRefLine2 The referenced lines. - # @return New GEOM_Object, containing the created point. + # @return New GEOM.GEOM_Object, containing the created point. # # @ref swig_MakeVertexOnLinesIntersection "Example" def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2): + """ + Create a point on intersection of two lines. + + Parameters: + theRefLine1, theRefLine2 The referenced lines. + + Returns: + New GEOM.GEOM_Object, containing the created point. + """ # Example: see GEOM_TestAll.py anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2) RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp) @@ -396,22 +876,74 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a tangent, corresponding to the given parameter on the given curve. # @param theRefCurve The referenced curve. # @param theParameter Value of parameter on the referenced curve. - # @return New GEOM_Object, containing the created tangent. + # @return New GEOM.GEOM_Object, containing the created tangent. # # @ref swig_MakeTangentOnCurve "Example" def MakeTangentOnCurve(self, theRefCurve, theParameter): + """ + Create a tangent, corresponding to the given parameter on the given curve. + + Parameters: + theRefCurve The referenced curve. + theParameter Value of parameter on the referenced curve. + + Returns: + New GEOM.GEOM_Object, containing the created tangent. + + Example of usage: + tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7) #(GEOM_Object, Double)->GEOM_Object + """ anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter) RaiseIfFailed("MakeTangentOnCurve", self.BasicOp) return anObj + ## Create a tangent plane, corresponding to the given parameter on the given face. + # @param theFace The face for which tangent plane should be built. + # @param theParameterV vertical value of the center point (0.0 - 1.0). + # @param theParameterU horisontal value of the center point (0.0 - 1.0). + # @param theTrimSize the size of plane. + # @return New GEOM.GEOM_Object, containing the created tangent. + # + # @ref swig_MakeTangentPlaneOnFace "Example" + def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize): + """ + Create a tangent plane, corresponding to the given parameter on the given face. + + Parameters: + theFace The face for which tangent plane should be built. + theParameterV vertical value of the center point (0.0 - 1.0). + theParameterU horisontal value of the center point (0.0 - 1.0). + theTrimSize the size of plane. + + Returns: + New GEOM.GEOM_Object, containing the created tangent. + + Example of usage: + an_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150) + """ + anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize) + RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp) + return anObj + ## Create a vector with the given components. # @param theDX X component of the vector. # @param theDY Y component of the vector. # @param theDZ Z component of the vector. - # @return New GEOM_Object, containing the created vector. + # @return New GEOM.GEOM_Object, containing the created vector. # # @ref tui_creation_vector "Example" def MakeVectorDXDYDZ(self,theDX, theDY, theDZ): + """ + Create a vector with the given components. + + Parameters: + theDX X component of the vector. + theDY Y component of the vector. + theDZ Z component of the vector. + + Returns: + New GEOM.GEOM_Object, containing the created vector. + """ # Example: see GEOM_TestAll.py theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ) @@ -422,10 +954,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a vector between two points. # @param thePnt1 Start point for the vector. # @param thePnt2 End point for the vector. - # @return New GEOM_Object, containing the created vector. + # @return New GEOM.GEOM_Object, containing the created vector. # # @ref tui_creation_vector "Example" def MakeVector(self,thePnt1, thePnt2): + """ + Create a vector between two points. + + Parameters: + thePnt1 Start point for the vector. + thePnt2 End point for the vector. + + Returns: + New GEOM.GEOM_Object, containing the created vector. + """ # Example: see GEOM_TestAll.py anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2) RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp) @@ -435,10 +977,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # and parrallel to the given direction # @param thePnt Point. The resulting line will pass through it. # @param theDir Direction. The resulting line will be parallel to it. - # @return New GEOM_Object, containing the created line. + # @return New GEOM.GEOM_Object, containing the created line. # # @ref tui_creation_line "Example" def MakeLine(self,thePnt, theDir): + """ + Create a line, passing through the given point + and parrallel to the given direction + + Parameters: + thePnt Point. The resulting line will pass through it. + theDir Direction. The resulting line will be parallel to it. + + Returns: + New GEOM.GEOM_Object, containing the created line. + """ # Example: see GEOM_TestAll.py anObj = self.BasicOp.MakeLine(thePnt, theDir) RaiseIfFailed("MakeLine", self.BasicOp) @@ -447,10 +1000,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a line, passing through the given points # @param thePnt1 First of two points, defining the line. # @param thePnt2 Second of two points, defining the line. - # @return New GEOM_Object, containing the created line. + # @return New GEOM.GEOM_Object, containing the created line. # # @ref tui_creation_line "Example" def MakeLineTwoPnt(self,thePnt1, thePnt2): + """ + Create a line, passing through the given points + + Parameters: + thePnt1 First of two points, defining the line. + thePnt2 Second of two points, defining the line. + + Returns: + New GEOM.GEOM_Object, containing the created line. + """ # Example: see GEOM_TestAll.py anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2) RaiseIfFailed("MakeLineTwoPnt", self.BasicOp) @@ -459,10 +1022,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a line on two faces intersection. # @param theFace1 First of two faces, defining the line. # @param theFace2 Second of two faces, defining the line. - # @return New GEOM_Object, containing the created line. + # @return New GEOM.GEOM_Object, containing the created line. # # @ref swig_MakeLineTwoFaces "Example" def MakeLineTwoFaces(self, theFace1, theFace2): + """ + Create a line on two faces intersection. + + Parameters: + theFace1 First of two faces, defining the line. + theFace2 Second of two faces, defining the line. + + Returns: + New GEOM.GEOM_Object, containing the created line. + """ # Example: see GEOM_TestAll.py anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2) RaiseIfFailed("MakeLineTwoFaces", self.BasicOp) @@ -473,10 +1046,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePnt Point, the plane has to pass through. # @param theVec Vector, defining the plane normal direction. # @param theTrimSize Half size of a side of quadrangle face, representing the plane. - # @return New GEOM_Object, containing the created plane. + # @return New GEOM.GEOM_Object, containing the created plane. # # @ref tui_creation_plane "Example" def MakePlane(self,thePnt, theVec, theTrimSize): + """ + Create a plane, passing through the given point + and normal to the given vector. + + Parameters: + thePnt Point, the plane has to pass through. + theVec Vector, defining the plane normal direction. + theTrimSize Half size of a side of quadrangle face, representing the plane. + + Returns: + New GEOM.GEOM_Object, containing the created plane. + """ # Example: see GEOM_TestAll.py theTrimSize, Parameters = ParseParameters(theTrimSize); anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize) @@ -489,10 +1074,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePnt2 Second of three points, defining the plane. # @param thePnt3 Fird of three points, defining the plane. # @param theTrimSize Half size of a side of quadrangle face, representing the plane. - # @return New GEOM_Object, containing the created plane. + # @return New GEOM.GEOM_Object, containing the created plane. # # @ref tui_creation_plane "Example" def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize): + """ + Create a plane, passing through the three given points + + Parameters: + thePnt1 First of three points, defining the plane. + thePnt2 Second of three points, defining the plane. + thePnt3 Fird of three points, defining the plane. + theTrimSize Half size of a side of quadrangle face, representing the plane. + + Returns: + New GEOM.GEOM_Object, containing the created plane. + """ # Example: see GEOM_TestAll.py theTrimSize, Parameters = ParseParameters(theTrimSize); anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize) @@ -503,10 +1100,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a plane, similar to the existing one, but with another size of representing face. # @param theFace Referenced plane or LCS(Marker). # @param theTrimSize New half size of a side of quadrangle face, representing the plane. - # @return New GEOM_Object, containing the created plane. + # @return New GEOM.GEOM_Object, containing the created plane. # # @ref tui_creation_plane "Example" def MakePlaneFace(self,theFace, theTrimSize): + """ + Create a plane, similar to the existing one, but with another size of representing face. + + Parameters: + theFace Referenced plane or LCS(Marker). + theTrimSize New half size of a side of quadrangle face, representing the plane. + + Returns: + New GEOM.GEOM_Object, containing the created plane. + """ # Example: see GEOM_TestAll.py theTrimSize, Parameters = ParseParameters(theTrimSize); anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize) @@ -514,42 +1121,127 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj + ## Create a plane, passing through the 2 vectors + # with center in a start point of the first vector. + # @param theVec1 Vector, defining center point and plane direction. + # @param theVec2 Vector, defining the plane normal direction. + # @param theTrimSize Half size of a side of quadrangle face, representing the plane. + # @return New GEOM.GEOM_Object, containing the created plane. + # + # @ref tui_creation_plane "Example" + def MakePlane2Vec(self,theVec1, theVec2, theTrimSize): + """ + Create a plane, passing through the 2 vectors + with center in a start point of the first vector. + + Parameters: + theVec1 Vector, defining center point and plane direction. + theVec2 Vector, defining the plane normal direction. + theTrimSize Half size of a side of quadrangle face, representing the plane. + + Returns: + New GEOM.GEOM_Object, containing the created plane. + """ + # Example: see GEOM_TestAll.py + theTrimSize, Parameters = ParseParameters(theTrimSize); + anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize) + RaiseIfFailed("MakePlane2Vec", self.BasicOp) + anObj.SetParameters(Parameters) + return anObj + + ## Create a plane, based on a Local coordinate system. + # @param theLCS coordinate system, defining plane. + # @param theTrimSize Half size of a side of quadrangle face, representing the plane. + # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3) + # @return New GEOM.GEOM_Object, containing the created plane. + # + # @ref tui_creation_plane "Example" + def MakePlaneLCS(self,theLCS, theTrimSize, theOrientation): + """ + Create a plane, based on a Local coordinate system. + + Parameters: + theLCS coordinate system, defining plane. + theTrimSize Half size of a side of quadrangle face, representing the plane. + theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3) + + Returns: + New GEOM.GEOM_Object, containing the created plane. + """ + # Example: see GEOM_TestAll.py + theTrimSize, Parameters = ParseParameters(theTrimSize); + anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation) + RaiseIfFailed("MakePlaneLCS", self.BasicOp) + anObj.SetParameters(Parameters) + return anObj + ## Create a local coordinate system. # @param OX,OY,OZ Three coordinates of coordinate system origin. # @param XDX,XDY,XDZ Three components of OX direction # @param YDX,YDY,YDZ Three components of OY direction - # @return New GEOM_Object, containing the created coordinate system. + # @return New GEOM.GEOM_Object, containing the created coordinate system. # # @ref swig_MakeMarker "Example" def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ): + """ + Create a local coordinate system. + + Parameters: + OX,OY,OZ Three coordinates of coordinate system origin. + XDX,XDY,XDZ Three components of OX direction + YDX,YDY,YDZ Three components of OY direction + + Returns: + New GEOM.GEOM_Object, containing the created coordinate system. + """ # Example: see GEOM_TestAll.py - OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ); + OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ); anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ) RaiseIfFailed("MakeMarker", self.BasicOp) anObj.SetParameters(Parameters) return anObj - ## Create a local coordinate system. + ## Create a local coordinate system from shape. + # @param theShape The initial shape to detect the coordinate system. + # @return New GEOM.GEOM_Object, containing the created coordinate system. + # + # @ref tui_creation_lcs "Example" + def MakeMarkerFromShape(self, theShape): + """ + Create a local coordinate system from shape. + + Parameters: + theShape The initial shape to detect the coordinate system. + + Returns: + New GEOM.GEOM_Object, containing the created coordinate system. + """ + anObj = self.BasicOp.MakeMarkerFromShape(theShape) + RaiseIfFailed("MakeMarkerFromShape", self.BasicOp) + return anObj + + ## Create a local coordinate system from point and two vectors. # @param theOrigin Point of coordinate system origin. # @param theXVec Vector of X direction # @param theYVec Vector of Y direction - # @return New GEOM_Object, containing the created coordinate system. + # @return New GEOM.GEOM_Object, containing the created coordinate system. # - # @ref swig_MakeMarker "Example" + # @ref tui_creation_lcs "Example" def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec): - O = self.PointCoordinates( theOrigin ) - OXOY = [] - for vec in [ theXVec, theYVec ]: - v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] ) - p1 = self.PointCoordinates( v1 ) - p2 = self.PointCoordinates( v2 ) - for i in range( 0, 3 ): - OXOY.append( p2[i] - p1[i] ) - # - anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2], - OXOY[0], OXOY[1], OXOY[2], - OXOY[3], OXOY[4], OXOY[5], ) - RaiseIfFailed("MakeMarker", self.BasicOp) + """ + Create a local coordinate system from point and two vectors. + + Parameters: + theOrigin Point of coordinate system origin. + theXVec Vector of X direction + theYVec Vector of Y direction + + Returns: + New GEOM.GEOM_Object, containing the created coordinate system. + + """ + anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec) + RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp) return anObj # end of l3_basic_go @@ -562,10 +1254,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePnt1 Start point of the arc. # @param thePnt2 Middle point of the arc. # @param thePnt3 End point of the arc. - # @return New GEOM_Object, containing the created arc. + # @return New GEOM.GEOM_Object, containing the created arc. # # @ref swig_MakeArc "Example" def MakeArc(self,thePnt1, thePnt2, thePnt3): + """ + Create an arc of circle, passing through three given points. + + Parameters: + thePnt1 Start point of the arc. + thePnt2 Middle point of the arc. + thePnt3 End point of the arc. + + Returns: + New GEOM.GEOM_Object, containing the created arc. + """ # Example: see GEOM_TestAll.py anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3) RaiseIfFailed("MakeArc", self.CurvesOp) @@ -576,23 +1279,46 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePnt2 Start point of the arc. (Gives also the radius of the arc) # @param thePnt3 End point of the arc (Gives also a direction) # @param theSense Orientation of the arc - # @return New GEOM_Object, containing the created arc. + # @return New GEOM.GEOM_Object, containing the created arc. # # @ref swig_MakeArc "Example" def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False): + """ + Create an arc of circle from a center and 2 points. + + Parameters: + thePnt1 Center of the arc + thePnt2 Start point of the arc. (Gives also the radius of the arc) + thePnt3 End point of the arc (Gives also a direction) + theSense Orientation of the arc + + Returns: + New GEOM.GEOM_Object, containing the created arc. + """ # Example: see GEOM_TestAll.py anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense) RaiseIfFailed("MakeArcCenter", self.CurvesOp) return anObj - + ## Create an arc of ellipse, of center and two points. # @param theCenter Center of the arc. # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2. # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2. - # @return New GEOM_Object, containing the created arc. + # @return New GEOM.GEOM_Object, containing the created arc. # # @ref swig_MakeArc "Example" def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2): + """ + Create an arc of ellipse, of center and two points. + + Parameters: + theCenter Center of the arc. + thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2. + thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2. + + Returns: + New GEOM.GEOM_Object, containing the created arc. + """ # Example: see GEOM_TestAll.py anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2) RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp) @@ -602,10 +1328,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePnt Circle center. # @param theVec Vector, normal to the plane of the circle. # @param theR Circle radius. - # @return New GEOM_Object, containing the created circle. + # @return New GEOM.GEOM_Object, containing the created circle. # # @ref tui_creation_circle "Example" def MakeCircle(self, thePnt, theVec, theR): + """ + Create a circle with given center, normal vector and radius. + + Parameters: + thePnt Circle center. + theVec Vector, normal to the plane of the circle. + theR Circle radius. + + Returns: + New GEOM.GEOM_Object, containing the created circle. + """ # Example: see GEOM_TestAll.py theR, Parameters = ParseParameters(theR) anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR) @@ -617,18 +1354,38 @@ class geompyDC(GEOM._objref_GEOM_Gen): # Center of the circle will be in the origin of global # coordinate system and normal vector will be codirected with Z axis # @param theR Circle radius. - # @return New GEOM_Object, containing the created circle. + # @return New GEOM.GEOM_Object, containing the created circle. def MakeCircleR(self, theR): + """ + Create a circle with given radius. + Center of the circle will be in the origin of global + coordinate system and normal vector will be codirected with Z axis + + Parameters: + theR Circle radius. + + Returns: + New GEOM.GEOM_Object, containing the created circle. + """ anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR) RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp) return anObj ## Create a circle, passing through three given points # @param thePnt1,thePnt2,thePnt3 Points, defining the circle. - # @return New GEOM_Object, containing the created circle. + # @return New GEOM.GEOM_Object, containing the created circle. # # @ref tui_creation_circle "Example" def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3): + """ + Create a circle, passing through three given points + + Parameters: + thePnt1,thePnt2,thePnt3 Points, defining the circle. + + Returns: + New GEOM.GEOM_Object, containing the created circle. + """ # Example: see GEOM_TestAll.py anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3) RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp) @@ -638,10 +1395,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # passing through the point2 as radius and laying in the plane, # defined by all three given points. # @param thePnt1,thePnt2,thePnt3 Points, defining the circle. - # @return New GEOM_Object, containing the created circle. + # @return New GEOM.GEOM_Object, containing the created circle. # # @ref swig_MakeCircle "Example" def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3): + """ + Create a circle, with given point1 as center, + passing through the point2 as radius and laying in the plane, + defined by all three given points. + + Parameters: + thePnt1,thePnt2,thePnt3 Points, defining the circle. + + Returns: + New GEOM.GEOM_Object, containing the created circle. + """ # Example: see GEOM_example6.py anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3) RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp) @@ -652,13 +1420,31 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theVec Vector, normal to the plane of the ellipse. # @param theRMajor Major ellipse radius. # @param theRMinor Minor ellipse radius. - # @return New GEOM_Object, containing the created ellipse. + # @param theVecMaj Vector, direction of the ellipse's main axis. + # @return New GEOM.GEOM_Object, containing the created ellipse. # # @ref tui_creation_ellipse "Example" - def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor): + def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None): + """ + Create an ellipse with given center, normal vector and radiuses. + + Parameters: + thePnt Ellipse center. + theVec Vector, normal to the plane of the ellipse. + theRMajor Major ellipse radius. + theRMinor Minor ellipse radius. + theVecMaj Vector, direction of the ellipse's main axis. + + Returns: + New GEOM.GEOM_Object, containing the created ellipse. + """ # Example: see GEOM_TestAll.py theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor) - anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor) + if theVecMaj is not None: + anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj) + else: + anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor) + pass RaiseIfFailed("MakeEllipse", self.CurvesOp) anObj.SetParameters(Parameters) return anObj @@ -668,45 +1454,137 @@ class geompyDC(GEOM._objref_GEOM_Gen): # coordinate system and normal vector will be codirected with Z axis # @param theRMajor Major ellipse radius. # @param theRMinor Minor ellipse radius. - # @return New GEOM_Object, containing the created ellipse. + # @return New GEOM.GEOM_Object, containing the created ellipse. def MakeEllipseRR(self, theRMajor, theRMinor): + """ + Create an ellipse with given radiuses. + Center of the ellipse will be in the origin of global + coordinate system and normal vector will be codirected with Z axis + + Parameters: + theRMajor Major ellipse radius. + theRMinor Minor ellipse radius. + + Returns: + New GEOM.GEOM_Object, containing the created ellipse. + """ anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor) RaiseIfFailed("MakeEllipse", self.CurvesOp) return anObj ## Create a polyline on the set of points. # @param thePoints Sequence of points for the polyline. - # @return New GEOM_Object, containing the created polyline. + # @param theIsClosed If True, build a closed wire. + # @return New GEOM.GEOM_Object, containing the created polyline. # # @ref tui_creation_curve "Example" - def MakePolyline(self,thePoints): + def MakePolyline(self, thePoints, theIsClosed=False): + """ + Create a polyline on the set of points. + + Parameters: + thePoints Sequence of points for the polyline. + theIsClosed If True, build a closed wire. + + Returns: + New GEOM.GEOM_Object, containing the created polyline. + """ # Example: see GEOM_TestAll.py - anObj = self.CurvesOp.MakePolyline(thePoints) + anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed) RaiseIfFailed("MakePolyline", self.CurvesOp) return anObj ## Create bezier curve on the set of points. # @param thePoints Sequence of points for the bezier curve. - # @return New GEOM_Object, containing the created bezier curve. + # @param theIsClosed If True, build a closed curve. + # @return New GEOM.GEOM_Object, containing the created bezier curve. # # @ref tui_creation_curve "Example" - def MakeBezier(self,thePoints): + def MakeBezier(self, thePoints, theIsClosed=False): + """ + Create bezier curve on the set of points. + + Parameters: + thePoints Sequence of points for the bezier curve. + theIsClosed If True, build a closed curve. + + Returns: + New GEOM.GEOM_Object, containing the created bezier curve. + """ # Example: see GEOM_TestAll.py - anObj = self.CurvesOp.MakeSplineBezier(thePoints) + anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed) RaiseIfFailed("MakeSplineBezier", self.CurvesOp) return anObj ## Create B-Spline curve on the set of points. # @param thePoints Sequence of points for the B-Spline curve. - # @return New GEOM_Object, containing the created B-Spline curve. + # @param theIsClosed If True, build a closed curve. + # @param theDoReordering If TRUE, the algo does not follow the order of + # \a thePoints but searches for the closest vertex. + # @return New GEOM.GEOM_Object, containing the created B-Spline curve. # # @ref tui_creation_curve "Example" - def MakeInterpol(self,thePoints): + def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False): + """ + Create B-Spline curve on the set of points. + + Parameters: + thePoints Sequence of points for the B-Spline curve. + theIsClosed If True, build a closed curve. + theDoReordering If True, the algo does not follow the order of + thePoints but searches for the closest vertex. + + Returns: + New GEOM.GEOM_Object, containing the created B-Spline curve. + """ # Example: see GEOM_TestAll.py - anObj = self.CurvesOp.MakeSplineInterpolation(thePoints) + anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering) RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp) return anObj + + ## Creates a curve using the parametric definition of the basic points. + # @param thexExpr parametric equation of the coordinates X. + # @param theyExpr parametric equation of the coordinates Y. + # @param thezExpr parametric equation of the coordinates Z. + # @param theParamMin the minimal value of the parameter. + # @param theParamMax the maximum value of the parameter. + # @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter. + # @param theCurveType the type of the curve. + # @param theNewMethod flag for switching to the new method if the flag is set to false a deprecated method is used which can lead to a bug. + # @return New GEOM.GEOM_Object, containing the created curve. + # + # @ref tui_creation_curve "Example" + def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr, + theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False ): + """ + Creates a curve using the parametric definition of the basic points. + + Parameters: + thexExpr parametric equation of the coordinates X. + theyExpr parametric equation of the coordinates Y. + thezExpr parametric equation of the coordinates Z. + theParamMin the minimal value of the parameter. + theParamMax the maximum value of the parameter. + theParamStep the number of steps if theNewMethod = True, else step value of the parameter. + theCurveType the type of the curve. + theNewMethod flag for switching to the new method if the flag is set to false a deprecated + method is used which can lead to a bug. + + Returns: + New GEOM.GEOM_Object, containing the created curve. + """ + theParamMin,theParamMax,theParamStep,Parameters = ParseParameters(theParamMin,theParamMax,theParamStep) + if theNewMethod: + anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType) + else: + anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType) + RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp) + anObj.SetParameters(Parameters) + return anObj + + + # end of l4_curves ## @} @@ -735,19 +1613,85 @@ class geompyDC(GEOM._objref_GEOM_Gen): # . # \n # - "C radius length" : Create arc by direction, radius and length(in degree) + # - "AA x y": Create arc by point at X & Y + # - "A dx dy" : Create arc by point with DX & DY + # - "A dx dy" : Create arc by point with DX & DY + # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs + # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs + # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates + # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates # . # \n # - "WW" : Close Wire (to finish) # - "WF" : Close Wire and build face (to finish) + # . + # \n + # - Flag1 (= reverse) is 0 or 2 ... + # - if 0 the drawn arc is the one of lower angle (< Pi) + # - if 2 the drawn arc ius the one of greater angle (> Pi) + # . + # \n + # - Flag2 (= control tolerance) is 0 or 1 ... + # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7) + # - if 1 the wire is built only if the end point is on the arc + # with a tolerance of 10^-7 on the distance else the creation fails # # @param theCommand String, defining the sketcher in local # coordinates of the working plane. # @param theWorkingPlane Nine double values, defining origin, # OZ and OX directions of the working plane. - # @return New GEOM_Object, containing the created wire. + # @return New GEOM.GEOM_Object, containing the created wire. # # @ref tui_sketcher_page "Example" def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]): + """ + Create a sketcher (wire or face), following the textual description, passed + through theCommand argument. + Edges of the resulting wire or face will be arcs of circles and/or linear segments. + Format of the description string have to be the following: + "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]" + Where: + - x1, y1 are coordinates of the first sketcher point (zero by default), + - CMD is one of + - "R angle" : Set the direction by angle + - "D dx dy" : Set the direction by DX & DY + + - "TT x y" : Create segment by point at X & Y + - "T dx dy" : Create segment by point with DX & DY + - "L length" : Create segment by direction & Length + - "IX x" : Create segment by direction & Intersect. X + - "IY y" : Create segment by direction & Intersect. Y + + - "C radius length" : Create arc by direction, radius and length(in degree) + - "AA x y": Create arc by point at X & Y + - "A dx dy" : Create arc by point with DX & DY + - "A dx dy" : Create arc by point with DX & DY + - "UU x y radius flag1": Create arc by point at X & Y with given radiUs + - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs + - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates + - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates + + - "WW" : Close Wire (to finish) + - "WF" : Close Wire and build face (to finish) + + - Flag1 (= reverse) is 0 or 2 ... + - if 0 the drawn arc is the one of lower angle (< Pi) + - if 2 the drawn arc ius the one of greater angle (> Pi) + + - Flag2 (= control tolerance) is 0 or 1 ... + - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7) + - if 1 the wire is built only if the end point is on the arc + with a tolerance of 10^-7 on the distance else the creation fails + + Parameters: + theCommand String, defining the sketcher in local + coordinates of the working plane. + theWorkingPlane Nine double values, defining origin, + OZ and OX directions of the working plane. + + Returns: + New GEOM.GEOM_Object, containing the created wire. + """ # Example: see GEOM_TestAll.py theCommand,Parameters = ParseSketcherCommand(theCommand) anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane) @@ -757,28 +1701,54 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a sketcher (wire or face), following the textual description, # passed through theCommand argument. \n - # For format of the description string see the previous method.\n + # For format of the description string see MakeSketcher() method.\n # @param theCommand String, defining the sketcher in local # coordinates of the working plane. # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane. - # @return New GEOM_Object, containing the created wire. + # @return New GEOM.GEOM_Object, containing the created wire. # # @ref tui_sketcher_page "Example" def MakeSketcherOnPlane(self, theCommand, theWorkingPlane): + """ + Create a sketcher (wire or face), following the textual description, + passed through theCommand argument. + For format of the description string see geompy.MakeSketcher() method. + + Parameters: + theCommand String, defining the sketcher in local + coordinates of the working plane. + theWorkingPlane Planar Face or LCS(Marker) of the working plane. + + Returns: + New GEOM.GEOM_Object, containing the created wire. + """ anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane) RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp) return anObj - - ## Create a sketcher wire, following the numerical description, + + ## Create a sketcher wire, following the numerical description, # passed through theCoordinates argument. \n - # @param theCoordinates double values, defining points to create a wire, + # @param theCoordinates double values, defining points to create a wire, # passing from it. - # @return New GEOM_Object, containing the created wire. + # @return New GEOM.GEOM_Object, containing the created wire. # # @ref tui_sketcher_page "Example" def Make3DSketcher(self, theCoordinates): + """ + Create a sketcher wire, following the numerical description, + passed through theCoordinates argument. + + Parameters: + theCoordinates double values, defining points to create a wire, + passing from it. + + Returns: + New GEOM_Object, containing the created wire. + """ + theCoordinates,Parameters = ParseParameters(theCoordinates) anObj = self.CurvesOp.Make3DSketcher(theCoordinates) RaiseIfFailed("Make3DSketcher", self.CurvesOp) + anObj.SetParameters(Parameters) return anObj # end of l3_sketcher @@ -789,8 +1759,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a box by coordinates of two opposite vertices. # + # @param x1,y1,z1 double values, defining first point it. + # @param x2,y2,z2 double values, defining first point it. + # + # @return New GEOM.GEOM_Object, containing the created box. # @ref tui_creation_box "Example" def MakeBox(self,x1,y1,z1,x2,y2,z2): + """ + Create a box by coordinates of two opposite vertices. + + Parameters: + x1,y1,z1 double values, defining first point. + x2,y2,z2 double values, defining second point. + + Returns: + New GEOM.GEOM_Object, containing the created box. + """ # Example: see GEOM_TestAll.py pnt1 = self.MakeVertex(x1,y1,z1) pnt2 = self.MakeVertex(x2,y2,z2) @@ -802,10 +1786,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theDX Length of Box edges, parallel to OX axis. # @param theDY Length of Box edges, parallel to OY axis. # @param theDZ Length of Box edges, parallel to OZ axis. - # @return New GEOM_Object, containing the created box. + # @return New GEOM.GEOM_Object, containing the created box. # # @ref tui_creation_box "Example" def MakeBoxDXDYDZ(self,theDX, theDY, theDZ): + """ + Create a box with specified dimensions along the coordinate axes + and with edges, parallel to the coordinate axes. + Center of the box will be at point (DX/2, DY/2, DZ/2). + + Parameters: + theDX Length of Box edges, parallel to OX axis. + theDY Length of Box edges, parallel to OY axis. + theDZ Length of Box edges, parallel to OZ axis. + + Returns: + New GEOM.GEOM_Object, containing the created box. + """ # Example: see GEOM_TestAll.py theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ) @@ -817,24 +1814,45 @@ class geompyDC(GEOM._objref_GEOM_Gen): # and with edges, parallel to the coordinate axes # @param thePnt1 First of two opposite vertices. # @param thePnt2 Second of two opposite vertices. - # @return New GEOM_Object, containing the created box. + # @return New GEOM.GEOM_Object, containing the created box. # # @ref tui_creation_box "Example" def MakeBoxTwoPnt(self,thePnt1, thePnt2): + """ + Create a box with two specified opposite vertices, + and with edges, parallel to the coordinate axes + + Parameters: + thePnt1 First of two opposite vertices. + thePnt2 Second of two opposite vertices. + + Returns: + New GEOM.GEOM_Object, containing the created box. + """ # Example: see GEOM_TestAll.py anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2) RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp) return anObj - - ## Create a face with specified dimensions along OX-OY coordinate axes, - # with edges, parallel to this coordinate axes. + + ## Create a face with specified dimensions with edges parallel to coordinate axes. # @param theH height of Face. # @param theW width of Face. - # @param theOrientation orientation belong axis OXY OYZ OZX - # @return New GEOM_Object, containing the created face. + # @param theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX + # @return New GEOM.GEOM_Object, containing the created face. # # @ref tui_creation_face "Example" def MakeFaceHW(self,theH, theW, theOrientation): + """ + Create a face with specified dimensions with edges parallel to coordinate axes. + + Parameters: + theH height of Face. + theW width of Face. + theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX + + Returns: + New GEOM.GEOM_Object, containing the created face. + """ # Example: see GEOM_TestAll.py theH,theW,Parameters = ParseParameters(theH, theW) anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation) @@ -845,13 +1863,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a face from another plane and two sizes, # vertical size and horisontal size. # @param theObj Normale vector to the creating face or - # the face object. + # the face object. # @param theH Height (vertical size). # @param theW Width (horisontal size). - # @return New GEOM_Object, containing the created face. + # @return New GEOM.GEOM_Object, containing the created face. # # @ref tui_creation_face "Example" def MakeFaceObjHW(self, theObj, theH, theW): + """ + Create a face from another plane and two sizes, + vertical size and horisontal size. + + Parameters: + theObj Normale vector to the creating face or + the face object. + theH Height (vertical size). + theW Width (horisontal size). + + Returns: + New GEOM_Object, containing the created face. + """ # Example: see GEOM_TestAll.py theH,theW,Parameters = ParseParameters(theH, theW) anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW) @@ -863,10 +1894,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePnt Disk center. # @param theVec Vector, normal to the plane of the disk. # @param theR Disk radius. - # @return New GEOM_Object, containing the created disk. + # @return New GEOM.GEOM_Object, containing the created disk. # # @ref tui_creation_disk "Example" def MakeDiskPntVecR(self,thePnt, theVec, theR): + """ + Create a disk with given center, normal vector and radius. + + Parameters: + thePnt Disk center. + theVec Vector, normal to the plane of the disk. + theR Disk radius. + + Returns: + New GEOM.GEOM_Object, containing the created disk. + """ # Example: see GEOM_TestAll.py theR,Parameters = ParseParameters(theR) anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR) @@ -876,10 +1918,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a disk, passing through three given points # @param thePnt1,thePnt2,thePnt3 Points, defining the disk. - # @return New GEOM_Object, containing the created disk. + # @return New GEOM.GEOM_Object, containing the created disk. # # @ref tui_creation_disk "Example" def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3): + """ + Create a disk, passing through three given points + + Parameters: + thePnt1,thePnt2,thePnt3 Points, defining the disk. + + Returns: + New GEOM.GEOM_Object, containing the created disk. + """ # Example: see GEOM_TestAll.py anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3) RaiseIfFailed("MakeDiskThreePnt", self.PrimOp) @@ -887,11 +1938,24 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a disk with specified dimensions along OX-OY coordinate axes. # @param theR Radius of Face. - # @param theOrientation set the orientation belong axis OXY or OYZ or OZX - # @return New GEOM_Object, containing the created disk. + # @param theOrientation set the orientation belong axis OXY or OYZ or OZX + # @return New GEOM.GEOM_Object, containing the created disk. # # @ref tui_creation_face "Example" def MakeDiskR(self,theR, theOrientation): + """ + Create a disk with specified dimensions along OX-OY coordinate axes. + + Parameters: + theR Radius of Face. + theOrientation set the orientation belong axis OXY or OYZ or OZX + + Returns: + New GEOM.GEOM_Object, containing the created disk. + + Example of usage: + Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object + """ # Example: see GEOM_TestAll.py theR,Parameters = ParseParameters(theR) anObj = self.PrimOp.MakeDiskR(theR, theOrientation) @@ -904,10 +1968,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theAxis Cylinder axis. # @param theR Cylinder radius. # @param theH Cylinder height. - # @return New GEOM_Object, containing the created cylinder. + # @return New GEOM.GEOM_Object, containing the created cylinder. # # @ref tui_creation_cylinder "Example" def MakeCylinder(self,thePnt, theAxis, theR, theH): + """ + Create a cylinder with given base point, axis, radius and height. + + Parameters: + thePnt Central point of cylinder base. + theAxis Cylinder axis. + theR Cylinder radius. + theH Cylinder height. + + Returns: + New GEOM.GEOM_Object, containing the created cylinder. + """ # Example: see GEOM_TestAll.py theR,theH,Parameters = ParseParameters(theR, theH) anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH) @@ -920,10 +1996,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # will be collinear to the OZ axis of the coordinate system. # @param theR Cylinder radius. # @param theH Cylinder height. - # @return New GEOM_Object, containing the created cylinder. + # @return New GEOM.GEOM_Object, containing the created cylinder. # # @ref tui_creation_cylinder "Example" def MakeCylinderRH(self,theR, theH): + """ + Create a cylinder with given radius and height at + the origin of coordinate system. Axis of the cylinder + will be collinear to the OZ axis of the coordinate system. + + Parameters: + theR Cylinder radius. + theH Cylinder height. + + Returns: + New GEOM.GEOM_Object, containing the created cylinder. + """ # Example: see GEOM_TestAll.py theR,theH,Parameters = ParseParameters(theR, theH) anObj = self.PrimOp.MakeCylinderRH(theR, theH) @@ -934,10 +2022,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a sphere with given center and radius. # @param thePnt Sphere center. # @param theR Sphere radius. - # @return New GEOM_Object, containing the created sphere. + # @return New GEOM.GEOM_Object, containing the created sphere. # # @ref tui_creation_sphere "Example" def MakeSpherePntR(self, thePnt, theR): + """ + Create a sphere with given center and radius. + + Parameters: + thePnt Sphere center. + theR Sphere radius. + + Returns: + New GEOM.GEOM_Object, containing the created sphere. + """ # Example: see GEOM_TestAll.py theR,Parameters = ParseParameters(theR) anObj = self.PrimOp.MakeSpherePntR(thePnt, theR) @@ -948,10 +2046,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a sphere with given center and radius. # @param x,y,z Coordinates of sphere center. # @param theR Sphere radius. - # @return New GEOM_Object, containing the created sphere. + # @return New GEOM.GEOM_Object, containing the created sphere. # # @ref tui_creation_sphere "Example" def MakeSphere(self, x, y, z, theR): + """ + Create a sphere with given center and radius. + + Parameters: + x,y,z Coordinates of sphere center. + theR Sphere radius. + + Returns: + New GEOM.GEOM_Object, containing the created sphere. + """ # Example: see GEOM_TestAll.py point = self.MakeVertex(x, y, z) anObj = self.MakeSpherePntR(point, theR) @@ -959,10 +2067,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a sphere with given radius at the origin of coordinate system. # @param theR Sphere radius. - # @return New GEOM_Object, containing the created sphere. + # @return New GEOM.GEOM_Object, containing the created sphere. # # @ref tui_creation_sphere "Example" def MakeSphereR(self, theR): + """ + Create a sphere with given radius at the origin of coordinate system. + + Parameters: + theR Sphere radius. + + Returns: + New GEOM.GEOM_Object, containing the created sphere. + """ # Example: see GEOM_TestAll.py theR,Parameters = ParseParameters(theR) anObj = self.PrimOp.MakeSphereR(theR) @@ -978,10 +2095,27 @@ class geompyDC(GEOM._objref_GEOM_Gen): # \note If both radiuses are non-zero, the cone will be truncated. # \note If the radiuses are equal, a cylinder will be created instead. # @param theH Cone height. - # @return New GEOM_Object, containing the created cone. + # @return New GEOM.GEOM_Object, containing the created cone. # # @ref tui_creation_cone "Example" def MakeCone(self,thePnt, theAxis, theR1, theR2, theH): + """ + Create a cone with given base point, axis, height and radiuses. + + Parameters: + thePnt Central point of the first cone base. + theAxis Cone axis. + theR1 Radius of the first cone base. + theR2 Radius of the second cone base. + theH Cone height. + + Note: + If both radiuses are non-zero, the cone will be truncated. + If the radiuses are equal, a cylinder will be created instead. + + Returns: + New GEOM.GEOM_Object, containing the created cone. + """ # Example: see GEOM_TestAll.py theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH) anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH) @@ -997,10 +2131,27 @@ class geompyDC(GEOM._objref_GEOM_Gen): # \note If both radiuses are non-zero, the cone will be truncated. # \note If the radiuses are equal, a cylinder will be created instead. # @param theH Cone height. - # @return New GEOM_Object, containing the created cone. + # @return New GEOM.GEOM_Object, containing the created cone. # # @ref tui_creation_cone "Example" def MakeConeR1R2H(self,theR1, theR2, theH): + """ + Create a cone with given height and radiuses at + the origin of coordinate system. Axis of the cone will + be collinear to the OZ axis of the coordinate system. + + Parameters: + theR1 Radius of the first cone base. + theR2 Radius of the second cone base. + theH Cone height. + + Note: + If both radiuses are non-zero, the cone will be truncated. + If the radiuses are equal, a cylinder will be created instead. + + Returns: + New GEOM.GEOM_Object, containing the created cone. + """ # Example: see GEOM_TestAll.py theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH) anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH) @@ -1013,10 +2164,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theVec Torus axis of symmetry. # @param theRMajor Torus major radius. # @param theRMinor Torus minor radius. - # @return New GEOM_Object, containing the created torus. + # @return New GEOM.GEOM_Object, containing the created torus. # # @ref tui_creation_torus "Example" def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor): + """ + Create a torus with given center, normal vector and radiuses. + + Parameters: + thePnt Torus central point. + theVec Torus axis of symmetry. + theRMajor Torus major radius. + theRMinor Torus minor radius. + + Returns: + New GEOM.GEOM_Object, containing the created torus. + """ # Example: see GEOM_TestAll.py theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor) anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor) @@ -1027,10 +2190,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a torus with given radiuses at the origin of coordinate system. # @param theRMajor Torus major radius. # @param theRMinor Torus minor radius. - # @return New GEOM_Object, containing the created torus. + # @return New GEOM.GEOM_Object, containing the created torus. # # @ref tui_creation_torus "Example" def MakeTorusRR(self, theRMajor, theRMinor): + """ + Create a torus with given radiuses at the origin of coordinate system. + + Parameters: + theRMajor Torus major radius. + theRMinor Torus minor radius. + + Returns: + New GEOM.GEOM_Object, containing the created torus. + """ # Example: see GEOM_TestAll.py theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor) anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor) @@ -1048,12 +2221,60 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theBase Base shape to be extruded. # @param thePoint1 First end of extrusion vector. # @param thePoint2 Second end of extrusion vector. - # @return New GEOM_Object, containing the created prism. + # @param theScaleFactor Use it to make prism with scaled second base. + # Nagative value means not scaled second base. + # @return New GEOM.GEOM_Object, containing the created prism. # # @ref tui_creation_prism "Example" - def MakePrism(self, theBase, thePoint1, thePoint2): + def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0): + """ + Create a shape by extrusion of the base shape along a vector, defined by two points. + + Parameters: + theBase Base shape to be extruded. + thePoint1 First end of extrusion vector. + thePoint2 Second end of extrusion vector. + theScaleFactor Use it to make prism with scaled second base. + Nagative value means not scaled second base. + + Returns: + New GEOM.GEOM_Object, containing the created prism. + """ # Example: see GEOM_TestAll.py - anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2) + anObj = None + Parameters = "" + if theScaleFactor > 0: + theScaleFactor,Parameters = ParseParameters(theScaleFactor) + anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor) + else: + anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2) + RaiseIfFailed("MakePrismTwoPnt", self.PrimOp) + anObj.SetParameters(Parameters) + return anObj + + ## Create a shape by extrusion of the base shape along a + # vector, defined by two points, in 2 Ways (forward/backward). + # @param theBase Base shape to be extruded. + # @param thePoint1 First end of extrusion vector. + # @param thePoint2 Second end of extrusion vector. + # @return New GEOM.GEOM_Object, containing the created prism. + # + # @ref tui_creation_prism "Example" + def MakePrism2Ways(self, theBase, thePoint1, thePoint2): + """ + Create a shape by extrusion of the base shape along a + vector, defined by two points, in 2 Ways (forward/backward). + + Parameters: + theBase Base shape to be extruded. + thePoint1 First end of extrusion vector. + thePoint2 Second end of extrusion vector. + + Returns: + New GEOM.GEOM_Object, containing the created prism. + """ + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2) RaiseIfFailed("MakePrismTwoPnt", self.PrimOp) return anObj @@ -1063,57 +2284,125 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theBase Base shape to be extruded. # @param theVec Direction of extrusion. # @param theH Prism dimension along theVec. - # @return New GEOM_Object, containing the created prism. + # @param theScaleFactor Use it to make prism with scaled second base. + # Negative value means not scaled second base. + # @return New GEOM.GEOM_Object, containing the created prism. # # @ref tui_creation_prism "Example" - def MakePrismVecH(self, theBase, theVec, theH): + def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0): + """ + Create a shape by extrusion of the base shape along the vector, + i.e. all the space, transfixed by the base shape during its translation + along the vector on the given distance. + + Parameters: + theBase Base shape to be extruded. + theVec Direction of extrusion. + theH Prism dimension along theVec. + theScaleFactor Use it to make prism with scaled second base. + Negative value means not scaled second base. + + Returns: + New GEOM.GEOM_Object, containing the created prism. + """ # Example: see GEOM_TestAll.py - theH,Parameters = ParseParameters(theH) - anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH) + anObj = None + Parameters = "" + if theScaleFactor > 0: + theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor) + anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor) + else: + theH,Parameters = ParseParameters(theH) + anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH) RaiseIfFailed("MakePrismVecH", self.PrimOp) anObj.SetParameters(Parameters) return anObj ## Create a shape by extrusion of the base shape along the vector, # i.e. all the space, transfixed by the base shape during its translation - # along the vector on the given distance in 2 Ways (forward/backward) . + # along the vector on the given distance in 2 Ways (forward/backward). # @param theBase Base shape to be extruded. # @param theVec Direction of extrusion. # @param theH Prism dimension along theVec in forward direction. - # @return New GEOM_Object, containing the created prism. + # @return New GEOM.GEOM_Object, containing the created prism. # # @ref tui_creation_prism "Example" def MakePrismVecH2Ways(self, theBase, theVec, theH): + """ + Create a shape by extrusion of the base shape along the vector, + i.e. all the space, transfixed by the base shape during its translation + along the vector on the given distance in 2 Ways (forward/backward). + + Parameters: + theBase Base shape to be extruded. + theVec Direction of extrusion. + theH Prism dimension along theVec in forward direction. + + Returns: + New GEOM.GEOM_Object, containing the created prism. + """ # Example: see GEOM_TestAll.py theH,Parameters = ParseParameters(theH) anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH) RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp) anObj.SetParameters(Parameters) return anObj - - ## Create a shape by extrusion of the base shape along the dx, dy, dz direction + + ## Create a shape by extrusion of the base shape along the dx, dy, dz direction # @param theBase Base shape to be extruded. # @param theDX, theDY, theDZ Directions of extrusion. - # @return New GEOM_Object, containing the created prism. + # @param theScaleFactor Use it to make prism with scaled second base. + # Nagative value means not scaled second base. + # @return New GEOM.GEOM_Object, containing the created prism. # # @ref tui_creation_prism "Example" - def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ): + def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0): + """ + Create a shape by extrusion of the base shape along the dx, dy, dz direction + + Parameters: + theBase Base shape to be extruded. + theDX, theDY, theDZ Directions of extrusion. + theScaleFactor Use it to make prism with scaled second base. + Nagative value means not scaled second base. + + Returns: + New GEOM.GEOM_Object, containing the created prism. + """ # Example: see GEOM_TestAll.py - theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) - anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ) + anObj = None + Parameters = "" + if theScaleFactor > 0: + theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor) + anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor) + else: + theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) + anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ) RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp) anObj.SetParameters(Parameters) return anObj - - ## Create a shape by extrusion of the base shape along the dx, dy, dz direction + + ## Create a shape by extrusion of the base shape along the dx, dy, dz direction # i.e. all the space, transfixed by the base shape during its translation - # along the vector on the given distance in 2 Ways (forward/backward) . + # along the vector on the given distance in 2 Ways (forward/backward). # @param theBase Base shape to be extruded. # @param theDX, theDY, theDZ Directions of extrusion. - # @return New GEOM_Object, containing the created prism. + # @return New GEOM.GEOM_Object, containing the created prism. # # @ref tui_creation_prism "Example" def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ): + """ + Create a shape by extrusion of the base shape along the dx, dy, dz direction + i.e. all the space, transfixed by the base shape during its translation + along the vector on the given distance in 2 Ways (forward/backward). + + Parameters: + theBase Base shape to be extruded. + theDX, theDY, theDZ Directions of extrusion. + + Returns: + New GEOM.GEOM_Object, containing the created prism. + """ # Example: see GEOM_TestAll.py theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ) @@ -1127,10 +2416,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theBase Base shape to be rotated. # @param theAxis Rotation axis. # @param theAngle Rotation angle in radians. - # @return New GEOM_Object, containing the created revolution. + # @return New GEOM.GEOM_Object, containing the created revolution. # # @ref tui_creation_revolution "Example" def MakeRevolution(self, theBase, theAxis, theAngle): + """ + Create a shape by revolution of the base shape around the axis + on the given angle, i.e. all the space, transfixed by the base + shape during its rotation around the axis on the given angle. + + Parameters: + theBase Base shape to be rotated. + theAxis Rotation axis. + theAngle Rotation angle in radians. + + Returns: + New GEOM.GEOM_Object, containing the created revolution. + """ # Example: see GEOM_TestAll.py theAngle,Parameters = ParseParameters(theAngle) anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle) @@ -1138,8 +2440,31 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj - ## The Same Revolution but in both ways forward&backward. + ## Create a shape by revolution of the base shape around the axis + # on the given angle, i.e. all the space, transfixed by the base + # shape during its rotation around the axis on the given angle in + # both directions (forward/backward) + # @param theBase Base shape to be rotated. + # @param theAxis Rotation axis. + # @param theAngle Rotation angle in radians. + # @return New GEOM.GEOM_Object, containing the created revolution. + # + # @ref tui_creation_revolution "Example" def MakeRevolution2Ways(self, theBase, theAxis, theAngle): + """ + Create a shape by revolution of the base shape around the axis + on the given angle, i.e. all the space, transfixed by the base + shape during its rotation around the axis on the given angle in + both directions (forward/backward). + + Parameters: + theBase Base shape to be rotated. + theAxis Rotation axis. + theAngle Rotation angle in radians. + + Returns: + New GEOM.GEOM_Object, containing the created revolution. + """ theAngle,Parameters = ParseParameters(theAngle) anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle) RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp) @@ -1153,33 +2478,105 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theTol2D a 2d tolerance to be reached # @param theTol3D a 3d tolerance to be reached # @param theNbIter a number of iteration of approximation algorithm + # @param theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method()) # @param isApprox if True, BSpline curves are generated in the process # of surface construction. By default it is False, that means - # the surface is created using Besier curves. The usage of + # the surface is created using given curves. The usage of # Approximation makes the algorithm work slower, but allows - # building the surface for rather complex cases - # @return New GEOM_Object, containing the created filling surface. + # building the surface for rather complex cases. + # @return New GEOM.GEOM_Object, containing the created filling surface. # # @ref tui_creation_filling "Example" - def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0): + def MakeFilling(self, theShape, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001, + theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0): + """ + Create a filling from the given compound of contours. + + Parameters: + theShape the compound of contours + theMinDeg a minimal degree of BSpline surface to create + theMaxDeg a maximal degree of BSpline surface to create + theTol2D a 2d tolerance to be reached + theTol3D a 3d tolerance to be reached + theNbIter a number of iteration of approximation algorithm + theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method()) + isApprox if True, BSpline curves are generated in the process + of surface construction. By default it is False, that means + the surface is created using given curves. The usage of + Approximation makes the algorithm work slower, but allows + building the surface for rather complex cases + + Returns: + New GEOM.GEOM_Object, containing the created filling surface. + + Example of usage: + filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5) + """ # Example: see GEOM_TestAll.py - theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, - theTol2D, theTol3D, theNbIter) + theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter) anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, - theTol2D, theTol3D, theNbIter, isApprox) + theTol2D, theTol3D, theNbIter, + theMethod, isApprox) RaiseIfFailed("MakeFilling", self.PrimOp) anObj.SetParameters(Parameters) return anObj + + ## Create a filling from the given compound of contours. + # This method corresponds to MakeFilling with isApprox=True + # @param theShape the compound of contours + # @param theMinDeg a minimal degree of BSpline surface to create + # @param theMaxDeg a maximal degree of BSpline surface to create + # @param theTol3D a 3d tolerance to be reached + # @return New GEOM.GEOM_Object, containing the created filling surface. + # + # @ref tui_creation_filling "Example" + def MakeFillingNew(self, theShape, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001): + """ + Create a filling from the given compound of contours. + This method corresponds to MakeFilling with isApprox=True + + Parameters: + theShape the compound of contours + theMinDeg a minimal degree of BSpline surface to create + theMaxDeg a maximal degree of BSpline surface to create + theTol3D a 3d tolerance to be reached + + Returns: + New GEOM.GEOM_Object, containing the created filling surface. + + Example of usage: + filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001) + """ + # Example: see GEOM_TestAll.py + theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D) + anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, + 0, theTol3D, 0, GEOM.FOM_Default, True) + RaiseIfFailed("MakeFillingNew", self.PrimOp) + anObj.SetParameters(Parameters) + return anObj + ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. # @param theSeqSections - set of specified sections. # @param theModeSolid - mode defining building solid or shell - # @param thePreci - precision 3D used for smoothing by default 1.e-6 + # @param thePreci - precision 3D used for smoothing # @param theRuled - mode defining type of the result surfaces (ruled or smoothed). - # @return New GEOM_Object, containing the created shell or solid. + # @return New GEOM.GEOM_Object, containing the created shell or solid. # # @ref swig_todo "Example" def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled): + """ + Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. + + Parameters: + theSeqSections - set of specified sections. + theModeSolid - mode defining building solid or shell + thePreci - precision 3D used for smoothing + theRuled - mode defining type of the result surfaces (ruled or smoothed). + + Returns: + New GEOM.GEOM_Object, containing the created shell or solid. + """ # Example: see GEOM_TestAll.py anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled) RaiseIfFailed("MakeThruSections", self.PrimOp) @@ -1189,10 +2586,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # the path shape. The path shape can be a wire or an edge. # @param theBase Base shape to be extruded. # @param thePath Path shape to extrude the base shape along it. - # @return New GEOM_Object, containing the created pipe. + # @return New GEOM.GEOM_Object, containing the created pipe. # # @ref tui_creation_pipe "Example" def MakePipe(self,theBase, thePath): + """ + Create a shape by extrusion of the base shape along + the path shape. The path shape can be a wire or an edge. + + Parameters: + theBase Base shape to be extruded. + thePath Path shape to extrude the base shape along it. + + Returns: + New GEOM.GEOM_Object, containing the created pipe. + """ # Example: see GEOM_TestAll.py anObj = self.PrimOp.MakePipe(theBase, thePath) RaiseIfFailed("MakePipe", self.PrimOp) @@ -1200,7 +2608,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a shape by extrusion of the profile shape along # the path shape. The path shape can be a wire or an edge. - # the several profiles can be specified in the several locations of path. + # the several profiles can be specified in the several locations of path. # @param theSeqBases - list of Bases shape to be extruded. # @param theLocations - list of locations on the path corresponding # specified list of the Bases shapes. Number of locations @@ -1210,12 +2618,31 @@ class geompyDC(GEOM._objref_GEOM_Gen): # contact with the spine. # @param theWithCorrection - defining that the section is rotated to be # orthogonal to the spine tangent in the correspondent point - # @return New GEOM_Object, containing the created pipe. + # @return New GEOM.GEOM_Object, containing the created pipe. # # @ref tui_creation_pipe_with_diff_sec "Example" def MakePipeWithDifferentSections(self, theSeqBases, theLocations, thePath, theWithContact, theWithCorrection): + """ + Create a shape by extrusion of the profile shape along + the path shape. The path shape can be a wire or an edge. + the several profiles can be specified in the several locations of path. + + Parameters: + theSeqBases - list of Bases shape to be extruded. + theLocations - list of locations on the path corresponding + specified list of the Bases shapes. Number of locations + should be equal to number of bases or list of locations can be empty. + thePath - Path shape to extrude the base shape along it. + theWithContact - the mode defining that the section is translated to be in + contact with the spine(0/1) + theWithCorrection - defining that the section is rotated to be + orthogonal to the spine tangent in the correspondent point (0/1) + + Returns: + New GEOM.GEOM_Object, containing the created pipe. + """ anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases, theLocations, thePath, theWithContact, theWithCorrection) @@ -1224,12 +2651,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a shape by extrusion of the profile shape along # the path shape. The path shape can be a wire or a edge. - # the several profiles can be specified in the several locations of path. + # the several profiles can be specified in the several locations of path. # @param theSeqBases - list of Bases shape to be extruded. Base shape must be # shell or face. If number of faces in neighbour sections # aren't coincided result solid between such sections will # be created using external boundaries of this shells. - # @param theSeqSubBases - list of corresponding subshapes of section shapes. + # @param theSeqSubBases - list of corresponding sub-shapes of section shapes. # This list is used for searching correspondences between # faces in the sections. Size of this list must be equal # to size of list of base shapes. @@ -1243,12 +2670,40 @@ class geompyDC(GEOM._objref_GEOM_Gen): # contact with the spine. # @param theWithCorrection - defining that the section is rotated to be # orthogonal to the spine tangent in the correspondent point - # @return New GEOM_Object, containing the created solids. + # @return New GEOM.GEOM_Object, containing the created solids. # # @ref tui_creation_pipe_with_shell_sec "Example" def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases, theLocations, thePath, theWithContact, theWithCorrection): + """ + Create a shape by extrusion of the profile shape along + the path shape. The path shape can be a wire or a edge. + the several profiles can be specified in the several locations of path. + + Parameters: + theSeqBases - list of Bases shape to be extruded. Base shape must be + shell or face. If number of faces in neighbour sections + aren't coincided result solid between such sections will + be created using external boundaries of this shells. + theSeqSubBases - list of corresponding sub-shapes of section shapes. + This list is used for searching correspondences between + faces in the sections. Size of this list must be equal + to size of list of base shapes. + theLocations - list of locations on the path corresponding + specified list of the Bases shapes. Number of locations + should be equal to number of bases. First and last + locations must be coincided with first and last vertexes + of path correspondingly. + thePath - Path shape to extrude the base shape along it. + theWithContact - the mode defining that the section is translated to be in + contact with the spine (0/1) + theWithCorrection - defining that the section is rotated to be + orthogonal to the spine tangent in the correspondent point (0/1) + + Returns: + New GEOM.GEOM_Object, containing the created solids. + """ anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases, theLocations, thePath, theWithContact, theWithCorrection) @@ -1257,13 +2712,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a shape by extrusion of the profile shape along # the path shape. This function is used only for debug pipe - # functionality - it is a version of previous function - # (MakePipeWithShellSections(...)) which give a possibility to - # recieve information about creating pipe between each pair of - # sections step by step. + # functionality - it is a version of function MakePipeWithShellSections() + # which give a possibility to recieve information about + # creating pipe between each pair of sections step by step. def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases, theLocations, thePath, theWithContact, theWithCorrection): + """ + Create a shape by extrusion of the profile shape along + the path shape. This function is used only for debug pipe + functionality - it is a version of previous function + geompy.MakePipeWithShellSections() which give a possibility to + recieve information about creating pipe between each pair of + sections step by step. + """ res = [] nbsect = len(theSeqBases) nbsubsect = len(theSeqSubBases) @@ -1295,10 +2757,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create solids between given sections # @param theSeqBases - list of sections (shell or face). # @param theLocations - list of corresponding vertexes - # @return New GEOM_Object, containing the created solids. + # @return New GEOM.GEOM_Object, containing the created solids. # # @ref tui_creation_pipe_without_path "Example" def MakePipeShellsWithoutPath(self, theSeqBases, theLocations): + """ + Create solids between given sections + + Parameters: + theSeqBases - list of sections (shell or face). + theLocations - list of corresponding vertexes + + Returns: + New GEOM.GEOM_Object, containing the created solids. + """ anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations) RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp) return anObj @@ -1311,10 +2783,25 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theVec Vector defines a constant binormal direction to keep the # same angle beetween the direction and the sections # along the sweep surface. - # @return New GEOM_Object, containing the created pipe. + # @return New GEOM.GEOM_Object, containing the created pipe. # # @ref tui_creation_pipe "Example" def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec): + """ + Create a shape by extrusion of the base shape along + the path shape with constant bi-normal direction along the given vector. + The path shape can be a wire or an edge. + + Parameters: + theBase Base shape to be extruded. + thePath Path shape to extrude the base shape along it. + theVec Vector defines a constant binormal direction to keep the + same angle beetween the direction and the sections + along the sweep surface. + + Returns: + New GEOM.GEOM_Object, containing the created pipe. + """ # Example: see GEOM_TestAll.py anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec) RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp) @@ -1329,67 +2816,196 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a linear edge with specified ends. # @param thePnt1 Point for the first end of edge. # @param thePnt2 Point for the second end of edge. - # @return New GEOM_Object, containing the created edge. + # @return New GEOM.GEOM_Object, containing the created edge. # # @ref tui_creation_edge "Example" def MakeEdge(self,thePnt1, thePnt2): + """ + Create a linear edge with specified ends. + + Parameters: + thePnt1 Point for the first end of edge. + thePnt2 Point for the second end of edge. + + Returns: + New GEOM.GEOM_Object, containing the created edge. + """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2) RaiseIfFailed("MakeEdge", self.ShapesOp) return anObj + ## Create a new edge, corresponding to the given length on the given curve. + # @param theRefCurve The referenced curve (edge). + # @param theLength Length on the referenced curve. It can be negative. + # @param theStartPoint Any point can be selected for it, the new edge will begin + # at the end of \a theRefCurve, close to the selected point. + # If None, start from the first point of \a theRefCurve. + # @return New GEOM.GEOM_Object, containing the created edge. + # + # @ref tui_creation_edge "Example" + def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None): + """ + Create a new edge, corresponding to the given length on the given curve. + + Parameters: + theRefCurve The referenced curve (edge). + theLength Length on the referenced curve. It can be negative. + theStartPoint Any point can be selected for it, the new edge will begin + at the end of theRefCurve, close to the selected point. + If None, start from the first point of theRefCurve. + + Returns: + New GEOM.GEOM_Object, containing the created edge. + """ + # Example: see GEOM_TestAll.py + theLength, Parameters = ParseParameters(theLength) + anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint) + RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp) + anObj.SetParameters(Parameters) + return anObj + + ## Create an edge from specified wire. + # @param theWire source Wire + # @param theLinearTolerance linear tolerance value (default = 1e-07) + # @param theAngularTolerance angular tolerance value (default = 1e-12) + # @return New GEOM.GEOM_Object, containing the created edge. + # + # @ref tui_creation_edge "Example" + def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12): + """ + Create an edge from specified wire. + + Parameters: + theWire source Wire + theLinearTolerance linear tolerance value (default = 1e-07) + theAngularTolerance angular tolerance value (default = 1e-12) + + Returns: + New GEOM.GEOM_Object, containing the created edge. + """ + # Example: see GEOM_TestAll.py + anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance) + RaiseIfFailed("MakeEdgeWire", self.ShapesOp) + return anObj + ## Create a wire from the set of edges and wires. # @param theEdgesAndWires List of edges and/or wires. - # @return New GEOM_Object, containing the created wire. + # @param theTolerance Maximum distance between vertices, that will be merged. + # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()) + # @return New GEOM.GEOM_Object, containing the created wire. # # @ref tui_creation_wire "Example" - def MakeWire(self,theEdgesAndWires): + def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07): + """ + Create a wire from the set of edges and wires. + + Parameters: + theEdgesAndWires List of edges and/or wires. + theTolerance Maximum distance between vertices, that will be merged. + Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()). + + Returns: + New GEOM.GEOM_Object, containing the created wire. + """ # Example: see GEOM_TestAll.py - anObj = self.ShapesOp.MakeWire(theEdgesAndWires) + anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance) RaiseIfFailed("MakeWire", self.ShapesOp) return anObj ## Create a face on the given wire. # @param theWire closed Wire or Edge to build the face on. - # @param isPlanarWanted If TRUE, only planar face will be built. - # If impossible, NULL object will be returned. - # @return New GEOM_Object, containing the created face. + # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face. + # If the tolerance of the obtained planar face is less + # than 1e-06, this face will be returned, otherwise the + # algorithm tries to build any suitable face on the given + # wire and prints a warning message. + # @return New GEOM.GEOM_Object, containing the created face. # # @ref tui_creation_face "Example" - def MakeFace(self,theWire, isPlanarWanted): + def MakeFace(self, theWire, isPlanarWanted): + """ + Create a face on the given wire. + + Parameters: + theWire closed Wire or Edge to build the face on. + isPlanarWanted If TRUE, the algorithm tries to build a planar face. + If the tolerance of the obtained planar face is less + than 1e-06, this face will be returned, otherwise the + algorithm tries to build any suitable face on the given + wire and prints a warning message. + + Returns: + New GEOM.GEOM_Object, containing the created face. + """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted) - RaiseIfFailed("MakeFace", self.ShapesOp) + if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG": + print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built." + else: + RaiseIfFailed("MakeFace", self.ShapesOp) return anObj ## Create a face on the given wires set. # @param theWires List of closed wires or edges to build the face on. - # @param isPlanarWanted If TRUE, only planar face will be built. - # If impossible, NULL object will be returned. - # @return New GEOM_Object, containing the created face. + # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face. + # If the tolerance of the obtained planar face is less + # than 1e-06, this face will be returned, otherwise the + # algorithm tries to build any suitable face on the given + # wire and prints a warning message. + # @return New GEOM.GEOM_Object, containing the created face. # # @ref tui_creation_face "Example" - def MakeFaceWires(self,theWires, isPlanarWanted): + def MakeFaceWires(self, theWires, isPlanarWanted): + """ + Create a face on the given wires set. + + Parameters: + theWires List of closed wires or edges to build the face on. + isPlanarWanted If TRUE, the algorithm tries to build a planar face. + If the tolerance of the obtained planar face is less + than 1e-06, this face will be returned, otherwise the + algorithm tries to build any suitable face on the given + wire and prints a warning message. + + Returns: + New GEOM.GEOM_Object, containing the created face. + """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted) - RaiseIfFailed("MakeFaceWires", self.ShapesOp) + if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG": + print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built." + else: + RaiseIfFailed("MakeFaceWires", self.ShapesOp) return anObj - ## Shortcut to MakeFaceWires() + ## See MakeFaceWires() method for details. # # @ref tui_creation_face "Example 1" # \n @ref swig_MakeFaces "Example 2" - def MakeFaces(self,theWires, isPlanarWanted): + def MakeFaces(self, theWires, isPlanarWanted): + """ + See geompy.MakeFaceWires() method for details. + """ # Example: see GEOM_TestOthers.py anObj = self.MakeFaceWires(theWires, isPlanarWanted) return anObj ## Create a shell from the set of faces and shells. # @param theFacesAndShells List of faces and/or shells. - # @return New GEOM_Object, containing the created shell. + # @return New GEOM.GEOM_Object, containing the created shell. # # @ref tui_creation_shell "Example" def MakeShell(self,theFacesAndShells): + """ + Create a shell from the set of faces and shells. + + Parameters: + theFacesAndShells List of faces and/or shells. + + Returns: + New GEOM.GEOM_Object, containing the created shell. + """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeShell(theFacesAndShells) RaiseIfFailed("MakeShell", self.ShapesOp) @@ -1397,21 +3013,45 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a solid, bounded by the given shells. # @param theShells Sequence of bounding shells. - # @return New GEOM_Object, containing the created solid. + # @return New GEOM.GEOM_Object, containing the created solid. # # @ref tui_creation_solid "Example" - def MakeSolid(self,theShells): + def MakeSolid(self, theShells): + """ + Create a solid, bounded by the given shells. + + Parameters: + theShells Sequence of bounding shells. + + Returns: + New GEOM.GEOM_Object, containing the created solid. + """ # Example: see GEOM_TestAll.py + if len(theShells) == 1: + descr = self.MeasuOp.IsGoodForSolid(theShells[0]) + #if len(descr) > 0: + # raise RuntimeError, "MakeSolidShells : " + descr + if descr == "WRN_SHAPE_UNCLOSED": + raise RuntimeError, "MakeSolidShells : Unable to create solid from unclosed shape" anObj = self.ShapesOp.MakeSolidShells(theShells) RaiseIfFailed("MakeSolidShells", self.ShapesOp) return anObj ## Create a compound of the given shapes. # @param theShapes List of shapes to put in compound. - # @return New GEOM_Object, containing the created compound. + # @return New GEOM.GEOM_Object, containing the created compound. # # @ref tui_creation_compound "Example" def MakeCompound(self,theShapes): + """ + Create a compound of the given shapes. + + Parameters: + theShapes List of shapes to put in compound. + + Returns: + New GEOM.GEOM_Object, containing the created compound. + """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeCompound(theShapes) RaiseIfFailed("MakeCompound", self.ShapesOp) @@ -1427,8 +3067,17 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theShape Shape to count faces of. # @return Quantity of faces. # - # @ref swig_NumberOfFaces "Example" - def NumberOfFaces(self,theShape): + # @ref swig_NumberOf "Example" + def NumberOfFaces(self, theShape): + """ + Gives quantity of faces in the given shape. + + Parameters: + theShape Shape to count faces of. + + Returns: + Quantity of faces. + """ # Example: see GEOM_TestOthers.py nb_faces = self.ShapesOp.NumberOfFaces(theShape) RaiseIfFailed("NumberOfFaces", self.ShapesOp) @@ -1438,13 +3087,64 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theShape Shape to count edges of. # @return Quantity of edges. # - # @ref swig_NumberOfEdges "Example" - def NumberOfEdges(self,theShape): + # @ref swig_NumberOf "Example" + def NumberOfEdges(self, theShape): + """ + Gives quantity of edges in the given shape. + + Parameters: + theShape Shape to count edges of. + + Returns: + Quantity of edges. + """ # Example: see GEOM_TestOthers.py nb_edges = self.ShapesOp.NumberOfEdges(theShape) RaiseIfFailed("NumberOfEdges", self.ShapesOp) return nb_edges + ## Gives quantity of sub-shapes of type theShapeType in the given shape. + # @param theShape Shape to count sub-shapes of. + # @param theShapeType Type of sub-shapes to count (see ShapeType()) + # @return Quantity of sub-shapes of given type. + # + # @ref swig_NumberOf "Example" + def NumberOfSubShapes(self, theShape, theShapeType): + """ + Gives quantity of sub-shapes of type theShapeType in the given shape. + + Parameters: + theShape Shape to count sub-shapes of. + theShapeType Type of sub-shapes to count (see geompy.ShapeType) + + Returns: + Quantity of sub-shapes of given type. + """ + # Example: see GEOM_TestOthers.py + nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType) + RaiseIfFailed("NumberOfSubShapes", self.ShapesOp) + return nb_ss + + ## Gives quantity of solids in the given shape. + # @param theShape Shape to count solids in. + # @return Quantity of solids. + # + # @ref swig_NumberOf "Example" + def NumberOfSolids(self, theShape): + """ + Gives quantity of solids in the given shape. + + Parameters: + theShape Shape to count solids in. + + Returns: + Quantity of solids. + """ + # Example: see GEOM_TestOthers.py + nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["SOLID"]) + RaiseIfFailed("NumberOfSolids", self.ShapesOp) + return nb_solids + # end of l2_measure ## @} @@ -1457,15 +3157,27 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_ChangeOrientation "Example" def ChangeOrientation(self,theShape): + """ + Reverses an orientation the given shape. + + Parameters: + theShape Shape to be reversed. + + Returns: + The reversed copy of theShape. + """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.ChangeOrientation(theShape) RaiseIfFailed("ChangeOrientation", self.ShapesOp) return anObj - ## Shortcut to ChangeOrientation() + ## See ChangeOrientation() method for details. # # @ref swig_OrientationChange "Example" def OrientationChange(self,theShape): + """ + See geompy.ChangeOrientation method for details. + """ # Example: see GEOM_TestOthers.py anObj = self.ChangeOrientation(theShape) return anObj @@ -1483,6 +3195,16 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref tui_measurement_tools_page "Example" def GetFreeFacesIDs(self,theShape): + """ + Retrieve all free faces from the given shape. + Free face is a face, which is not shared between two shells of the shape. + + Parameters: + theShape Shape to find free faces in. + + Returns: + List of IDs of all free faces, contained in theShape. + """ # Example: see GEOM_TestOthers.py anIDs = self.ShapesOp.GetFreeFacesIDs(theShape) RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp) @@ -1496,33 +3218,103 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_GetSharedShapes "Example" def GetSharedShapes(self,theShape1, theShape2, theShapeType): + """ + Get all sub-shapes of theShape1 of the given type, shared with theShape2. + + Parameters: + theShape1 Shape to find sub-shapes in. + theShape2 Shape to find shared sub-shapes with. + theShapeType Type of sub-shapes to be retrieved. + + Returns: + List of sub-shapes of theShape1, shared with theShape2. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType) RaiseIfFailed("GetSharedShapes", self.ShapesOp) return aList + ## Get all sub-shapes, shared by all shapes in the list theShapes. + # @param theShapes Shapes to find common sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @return List of objects, that are sub-shapes of all given shapes. + # + # @ref swig_GetSharedShapes "Example" + def GetSharedShapesMulti(self, theShapes, theShapeType): + """ + Get all sub-shapes, shared by all shapes in the list theShapes. + + Parameters: + theShapes Shapes to find common sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + + Returns: + List of GEOM.GEOM_Object, that are sub-shapes of all given shapes. + """ + # Example: see GEOM_TestOthers.py + aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType) + RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp) + return aList + ## Find in theShape all sub-shapes of type theShapeType, # situated relatively the specified plane by the certain way, # defined through theState parameter. # @param theShape Shape to find sub-shapes of. - # @param theShapeType Type of sub-shapes to be retrieved. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theAx1 Vector (or line, or linear edge), specifying normal # direction and location of the plane to find shapes on. - # @param theState The state of the subshapes to find. It can be one of - # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @return List of all found sub-shapes. # # @ref swig_GetShapesOnPlane "Example" def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState): + """ + Find in theShape all sub-shapes of type theShapeType, + situated relatively the specified plane by the certain way, + defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAx1 Vector (or line, or linear edge), specifying normal + direction and location of the plane to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState) RaiseIfFailed("GetShapesOnPlane", self.ShapesOp) return aList - ## Works like the above method, but returns list of sub-shapes indices + ## Find in theShape all sub-shapes of type theShapeType, + # situated relatively the specified plane by the certain way, + # defined through theState parameter. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theAx1 Vector (or line, or linear edge), specifying normal + # direction and location of the plane to find shapes on. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices. # # @ref swig_GetShapesOnPlaneIDs "Example" def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState): + """ + Find in theShape all sub-shapes of type theShapeType, + situated relatively the specified plane by the certain way, + defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAx1 Vector (or line, or linear edge), specifying normal + direction and location of the plane to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState) RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp) @@ -1532,26 +3324,66 @@ class geompyDC(GEOM._objref_GEOM_Gen): # situated relatively the specified plane by the certain way, # defined through theState parameter. # @param theShape Shape to find sub-shapes of. - # @param theShapeType Type of sub-shapes to be retrieved. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theAx1 Vector (or line, or linear edge), specifying normal # direction of the plane to find shapes on. # @param thePnt Point specifying location of the plane to find shapes on. - # @param theState The state of the subshapes to find. It can be one of - # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @return List of all found sub-shapes. # # @ref swig_GetShapesOnPlaneWithLocation "Example" def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState): + """ + Find in theShape all sub-shapes of type theShapeType, + situated relatively the specified plane by the certain way, + defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAx1 Vector (or line, or linear edge), specifying normal + direction and location of the plane to find shapes on. + thePnt Point specifying location of the plane to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState) RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp) return aList - ## Works like the above method, but returns list of sub-shapes indices + ## Find in theShape all sub-shapes of type theShapeType, + # situated relatively the specified plane by the certain way, + # defined through theState parameter. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theAx1 Vector (or line, or linear edge), specifying normal + # direction of the plane to find shapes on. + # @param thePnt Point specifying location of the plane to find shapes on. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices. # # @ref swig_GetShapesOnPlaneWithLocationIDs "Example" def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState): + """ + Find in theShape all sub-shapes of type theShapeType, + situated relatively the specified plane by the certain way, + defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAx1 Vector (or line, or linear edge), specifying normal + direction and location of the plane to find shapes on. + thePnt Point specifying location of the plane to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState) @@ -1561,51 +3393,188 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively # the specified cylinder by the certain way, defined through \a theState parameter. # @param theShape Shape to find sub-shapes of. - # @param theShapeType Type of sub-shapes to be retrieved. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theAxis Vector (or line, or linear edge), specifying # axis of the cylinder to find shapes on. # @param theRadius Radius of the cylinder to find shapes on. - # @param theState The state of the subshapes to find. It can be one of - # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @return List of all found sub-shapes. # # @ref swig_GetShapesOnCylinder "Example" def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified cylinder by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAxis Vector (or line, or linear edge), specifying + axis of the cylinder to find shapes on. + theRadius Radius of the cylinder to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState) RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp) return aList - ## Works like the above method, but returns list of sub-shapes indices + ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + # the specified cylinder by the certain way, defined through \a theState parameter. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theAxis Vector (or line, or linear edge), specifying + # axis of the cylinder to find shapes on. + # @param theRadius Radius of the cylinder to find shapes on. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices. # # @ref swig_GetShapesOnCylinderIDs "Example" def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified cylinder by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAxis Vector (or line, or linear edge), specifying + axis of the cylinder to find shapes on. + theRadius Radius of the cylinder to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState) RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp) return aList + ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + # the specified cylinder by the certain way, defined through \a theState parameter. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theAxis Vector (or line, or linear edge), specifying + # axis of the cylinder to find shapes on. + # @param thePnt Point specifying location of the bottom of the cylinder. + # @param theRadius Radius of the cylinder to find shapes on. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes. + # + # @ref swig_GetShapesOnCylinderWithLocation "Example" + def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified cylinder by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAxis Vector (or line, or linear edge), specifying + axis of the cylinder to find shapes on. + theRadius Radius of the cylinder to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ + # Example: see GEOM_TestOthers.py + aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState) + RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp) + return aList + + ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + # the specified cylinder by the certain way, defined through \a theState parameter. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theAxis Vector (or line, or linear edge), specifying + # axis of the cylinder to find shapes on. + # @param thePnt Point specifying location of the bottom of the cylinder. + # @param theRadius Radius of the cylinder to find shapes on. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices + # + # @ref swig_GetShapesOnCylinderWithLocationIDs "Example" + def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified cylinder by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theAxis Vector (or line, or linear edge), specifying + axis of the cylinder to find shapes on. + theRadius Radius of the cylinder to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ + # Example: see GEOM_TestOthers.py + aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState) + RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp) + return aList + ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively # the specified sphere by the certain way, defined through \a theState parameter. # @param theShape Shape to find sub-shapes of. - # @param theShapeType Type of sub-shapes to be retrieved. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theCenter Point, specifying center of the sphere to find shapes on. # @param theRadius Radius of the sphere to find shapes on. - # @param theState The state of the subshapes to find. It can be one of - # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @return List of all found sub-shapes. # # @ref swig_GetShapesOnSphere "Example" def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified sphere by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theCenter Point, specifying center of the sphere to find shapes on. + theRadius Radius of the sphere to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState) RaiseIfFailed("GetShapesOnSphere", self.ShapesOp) return aList - ## Works like the above method, but returns list of sub-shapes indices + ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + # the specified sphere by the certain way, defined through \a theState parameter. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theCenter Point, specifying center of the sphere to find shapes on. + # @param theRadius Radius of the sphere to find shapes on. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices. # # @ref swig_GetShapesOnSphereIDs "Example" def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified sphere by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theCenter Point, specifying center of the sphere to find shapes on. + theRadius Radius of the sphere to find shapes on. + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState) RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp) @@ -1614,19 +3583,34 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively # the specified quadrangle by the certain way, defined through \a theState parameter. # @param theShape Shape to find sub-shapes of. - # @param theShapeType Type of sub-shapes to be retrieved. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theTopLeftPoint Point, specifying top left corner of a quadrangle # @param theTopRigthPoint Point, specifying top right corner of a quadrangle # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle - # @param theState The state of the subshapes to find. It can be one of - # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @return List of all found sub-shapes. # # @ref swig_GetShapesOnQuadrangle "Example" def GetShapesOnQuadrangle(self, theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified quadrangle by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theTopLeftPoint Point, specifying top left corner of a quadrangle + theTopRigthPoint Point, specifying top right corner of a quadrangle + theBottomLeftPoint Point, specifying bottom left corner of a quadrangle + theBottomRigthPoint Point, specifying bottom right corner of a quadrangle + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, @@ -1634,12 +3618,38 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp) return aList - ## Works like the above method, but returns list of sub-shapes indices + ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + # the specified quadrangle by the certain way, defined through \a theState parameter. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theTopLeftPoint Point, specifying top left corner of a quadrangle + # @param theTopRigthPoint Point, specifying top right corner of a quadrangle + # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle + # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices. # # @ref swig_GetShapesOnQuadrangleIDs "Example" def GetShapesOnQuadrangleIDs(self, theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified quadrangle by the certain way, defined through theState parameter. + + Parameters: + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theTopLeftPoint Point, specifying top left corner of a quadrangle + theTopRigthPoint Point, specifying top right corner of a quadrangle + theBottomLeftPoint Point, specifying bottom left corner of a quadrangle + theBottomRigthPoint Point, specifying bottom right corner of a quadrangle + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ + # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, @@ -1651,22 +3661,53 @@ class geompyDC(GEOM._objref_GEOM_Gen): # the specified \a theBox by the certain way, defined through \a theState parameter. # @param theBox Shape for relative comparing. # @param theShape Shape to find sub-shapes of. - # @param theShapeType Type of sub-shapes to be retrieved. - # @param theState The state of the subshapes to find. It can be one of - # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @return List of all found sub-shapes. # # @ref swig_GetShapesOnBox "Example" def GetShapesOnBox(self, theBox, theShape, theShapeType, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified theBox by the certain way, defined through theState parameter. + + Parameters: + theBox Shape for relative comparing. + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState) RaiseIfFailed("GetShapesOnBox", self.ShapesOp) return aList - ## Works like the above method, but returns list of sub-shapes indices + ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + # the specified \a theBox by the certain way, defined through \a theState parameter. + # @param theBox Shape for relative comparing. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices. # # @ref swig_GetShapesOnBoxIDs "Example" def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState): + """ + Find in theShape all sub-shapes of type theShapeType, situated relatively + the specified theBox by the certain way, defined through theState parameter. + + Parameters: + theBox Shape for relative comparing. + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState) RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp) @@ -1675,35 +3716,90 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find in \a theShape all sub-shapes of type \a theShapeType, # situated relatively the specified \a theCheckShape by the # certain way, defined through \a theState parameter. - # @param theCheckShape Shape for relative comparing. + # @param theCheckShape Shape for relative comparing. It must be a solid. # @param theShape Shape to find sub-shapes of. - # @param theShapeType Type of sub-shapes to be retrieved. - # @param theState The state of the subshapes to find. It can be one of - # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @return List of all found sub-shapes. # # @ref swig_GetShapesOnShape "Example" def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState): + """ + Find in theShape all sub-shapes of type theShapeType, + situated relatively the specified theCheckShape by the + certain way, defined through theState parameter. + + Parameters: + theCheckShape Shape for relative comparing. It must be a solid. + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape, theShapeType, theState) RaiseIfFailed("GetShapesOnShape", self.ShapesOp) return aList - ## Works like the above method, but returns result as compound + ## Find in \a theShape all sub-shapes of type \a theShapeType, + # situated relatively the specified \a theCheckShape by the + # certain way, defined through \a theState parameter. + # @param theCheckShape Shape for relative comparing. It must be a solid. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return All found sub-shapes as compound. # # @ref swig_GetShapesOnShapeAsCompound "Example" def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState): + """ + Find in theShape all sub-shapes of type theShapeType, + situated relatively the specified theCheckShape by the + certain way, defined through theState parameter. + + Parameters: + theCheckShape Shape for relative comparing. It must be a solid. + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + All found sub-shapes as compound. + """ # Example: see GEOM_TestOthers.py anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState) RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp) return anObj - ## Works like the above method, but returns list of sub-shapes indices + ## Find in \a theShape all sub-shapes of type \a theShapeType, + # situated relatively the specified \a theCheckShape by the + # certain way, defined through \a theState parameter. + # @param theCheckShape Shape for relative comparing. It must be a solid. + # @param theShape Shape to find sub-shapes of. + # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) + # @param theState The state of the sub-shapes to find (see GEOM::shape_state) + # @return List of all found sub-shapes indices. # # @ref swig_GetShapesOnShapeIDs "Example" def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState): + """ + Find in theShape all sub-shapes of type theShapeType, + situated relatively the specified theCheckShape by the + certain way, defined through theState parameter. + + Parameters: + theCheckShape Shape for relative comparing. It must be a solid. + theShape Shape to find sub-shapes of. + theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType) + theState The state of the sub-shapes to find (see GEOM::shape_state) + + Returns: + List of all found sub-shapes indices. + """ # Example: see GEOM_TestOthers.py aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape, theShapeType, theState) @@ -1714,12 +3810,45 @@ class geompyDC(GEOM._objref_GEOM_Gen): # coincident with \a theShapeWhat or could be a part of it. # @param theShapeWhere Shape to find sub-shapes of. # @param theShapeWhat Shape, specifying what to find. + # @param isNewImplementation implementation of GetInPlace functionality + # (default = False, old alghorithm based on shape properties) # @return Group of all found sub-shapes or a single found sub-shape. # + # @note This function has a restriction on argument shapes. + # If \a theShapeWhere has curved parts with significantly + # outstanding centres (i.e. the mass centre of a part is closer to + # \a theShapeWhat than to the part), such parts will not be found. + # @image html get_in_place_lost_part.png + # # @ref swig_GetInPlace "Example" - def GetInPlace(self,theShapeWhere, theShapeWhat): + def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False): + """ + Get sub-shape(s) of theShapeWhere, which are + coincident with theShapeWhat or could be a part of it. + + Parameters: + theShapeWhere Shape to find sub-shapes of. + theShapeWhat Shape, specifying what to find. + isNewImplementation Implementation of GetInPlace functionality + (default = False, old alghorithm based on shape properties) + + Returns: + Group of all found sub-shapes or a single found sub-shape. + + + Note: + This function has a restriction on argument shapes. + If theShapeWhere has curved parts with significantly + outstanding centres (i.e. the mass centre of a part is closer to + theShapeWhat than to the part), such parts will not be found. + """ # Example: see GEOM_TestOthers.py - anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat) + anObj = None + if isNewImplementation: + anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat) + else: + anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat) + pass RaiseIfFailed("GetInPlace", self.ShapesOp) return anObj @@ -1739,6 +3868,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_GetInPlace "Example" def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat): + """ + Implementation of this method is based on a saved history of an operation, + produced theShapeWhere. The theShapeWhat must be among this operation's + arguments (an argument shape or a sub-shape of an argument shape). + The operation could be the Partition or one of boolean operations, + performed on simple shapes (not on compounds). + + Parameters: + theShapeWhere Shape to find sub-shapes of. + theShapeWhat Shape, specifying what to find (must be in the + building history of the ShapeWhere). + + Returns: + Group of all found sub-shapes or a single found sub-shape. + """ # Example: see GEOM_TestOthers.py anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat) RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp) @@ -1748,14 +3892,50 @@ class geompyDC(GEOM._objref_GEOM_Gen): # equal to \a theShapeWhat. # @param theShapeWhere Shape to find sub-shape of. # @param theShapeWhat Shape, specifying what to find. - # @return New GEOM_Object for found sub-shape. + # @return New GEOM.GEOM_Object for found sub-shape. # # @ref swig_GetSame "Example" def GetSame(self,theShapeWhere, theShapeWhat): + """ + Get sub-shape of theShapeWhere, which is + equal to theShapeWhat. + + Parameters: + theShapeWhere Shape to find sub-shape of. + theShapeWhat Shape, specifying what to find. + + Returns: + New GEOM.GEOM_Object for found sub-shape. + """ anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat) RaiseIfFailed("GetSame", self.ShapesOp) return anObj + + ## Get sub-shape indices of theShapeWhere, which is + # equal to \a theShapeWhat. + # @param theShapeWhere Shape to find sub-shape of. + # @param theShapeWhat Shape, specifying what to find. + # @return List of all found sub-shapes indices. + # + # @ref swig_GetSame "Example" + def GetSameIDs(self,theShapeWhere, theShapeWhat): + """ + Get sub-shape indices of theShapeWhere, which is + equal to theShapeWhat. + + Parameters: + theShapeWhere Shape to find sub-shape of. + theShapeWhat Shape, specifying what to find. + + Returns: + List of all found sub-shapes indices. + """ + anObj = self.ShapesOp.GetSameIDs(theShapeWhere, theShapeWhat) + RaiseIfFailed("GetSameIDs", self.ShapesOp) + return anObj + + # end of l4_obtain ## @} @@ -1764,17 +3944,46 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Obtain a composite sub-shape of aShape, composed from sub-shapes # of aShape, selected by their unique IDs inside aShape + # @param aShape Shape to get sub-shape of. + # @param ListOfID List of sub-shapes indices. + # @return Found sub-shape. # # @ref swig_all_decompose "Example" def GetSubShape(self, aShape, ListOfID): + """ + Obtain a composite sub-shape of aShape, composed from sub-shapes + of aShape, selected by their unique IDs inside aShape + + Parameters: + aShape Shape to get sub-shape of. + ListOfID List of sub-shapes indices. + + Returns: + Found sub-shape. + """ # Example: see GEOM_TestAll.py anObj = self.AddSubShape(aShape,ListOfID) return anObj ## Obtain unique ID of sub-shape aSubShape inside aShape + # of aShape, selected by their unique IDs inside aShape + # @param aShape Shape to get sub-shape of. + # @param aSubShape Sub-shapes of aShape. + # @return ID of found sub-shape. # # @ref swig_all_decompose "Example" def GetSubShapeID(self, aShape, aSubShape): + """ + Obtain unique ID of sub-shape aSubShape inside aShape + of aShape, selected by their unique IDs inside aShape + + Parameters: + aShape Shape to get sub-shape of. + aSubShape Sub-shapes of aShape. + + Returns: + ID of found sub-shape. + """ # Example: see GEOM_TestAll.py anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape) RaiseIfFailed("GetSubShapeIndex", self.LocalOp) @@ -1786,83 +3995,305 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## @addtogroup l4_decompose ## @{ - ## Explode a shape on subshapes of a given type. + ## Get all sub-shapes and groups of \a theShape, + # that were created already by any other methods. + # @param theShape Any shape. + # @param theGroupsOnly If this parameter is TRUE, only groups will be + # returned, else all found sub-shapes and groups. + # @return List of existing sub-objects of \a theShape. + # + # @ref swig_all_decompose "Example" + def GetExistingSubObjects(self, theShape, theGroupsOnly = False): + """ + Get all sub-shapes and groups of theShape, + that were created already by any other methods. + + Parameters: + theShape Any shape. + theGroupsOnly If this parameter is TRUE, only groups will be + returned, else all found sub-shapes and groups. + + Returns: + List of existing sub-objects of theShape. + """ + # Example: see GEOM_TestAll.py + ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly) + RaiseIfFailed("GetExistingSubObjects", self.ShapesOp) + return ListObj + + ## Get all groups of \a theShape, + # that were created already by any other methods. + # @param theShape Any shape. + # @return List of existing groups of \a theShape. + # + # @ref swig_all_decompose "Example" + def GetGroups(self, theShape): + """ + Get all groups of theShape, + that were created already by any other methods. + + Parameters: + theShape Any shape. + + Returns: + List of existing groups of theShape. + """ + # Example: see GEOM_TestAll.py + ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True) + RaiseIfFailed("GetExistingSubObjects", self.ShapesOp) + return ListObj + + ## Explode a shape on sub-shapes of a given type. + # If the shape itself matches the type, it is also returned. # @param aShape Shape to be exploded. - # @param aType Type of sub-shapes to be retrieved. + # @param aType Type of sub-shapes to be retrieved (see ShapeType()) # @return List of sub-shapes of type theShapeType, contained in theShape. # # @ref swig_all_decompose "Example" def SubShapeAll(self, aShape, aType): + """ + Explode a shape on sub-shapes of a given type. + If the shape itself matches the type, it is also returned. + + Parameters: + aShape Shape to be exploded. + aType Type of sub-shapes to be retrieved (see geompy.ShapeType) + + Returns: + List of sub-shapes of type theShapeType, contained in theShape. + """ # Example: see GEOM_TestAll.py - ListObj = self.ShapesOp.MakeExplode(aShape,aType,0) - RaiseIfFailed("MakeExplode", self.ShapesOp) + ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False) + RaiseIfFailed("SubShapeAll", self.ShapesOp) return ListObj - ## Explode a shape on subshapes of a given type. + ## Explode a shape on sub-shapes of a given type. # @param aShape Shape to be exploded. - # @param aType Type of sub-shapes to be retrieved. + # @param aType Type of sub-shapes to be retrieved (see ShapeType()) # @return List of IDs of sub-shapes. # # @ref swig_all_decompose "Example" def SubShapeAllIDs(self, aShape, aType): - ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0) + """ + Explode a shape on sub-shapes of a given type. + + Parameters: + aShape Shape to be exploded (see geompy.ShapeType) + aType Type of sub-shapes to be retrieved (see geompy.ShapeType) + + Returns: + List of IDs of sub-shapes. + """ + ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False) RaiseIfFailed("SubShapeAllIDs", self.ShapesOp) return ListObj - ## Explode a shape on subshapes of a given type. + ## Obtain a compound of sub-shapes of aShape, + # selected by they indices in list of all sub-shapes of type aType. + # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] + # @param aShape Shape to get sub-shape of. + # @param ListOfInd List of sub-shapes indices. + # @param aType Type of sub-shapes to be retrieved (see ShapeType()) + # @return A compound of sub-shapes of aShape. + # + # @ref swig_all_decompose "Example" + def SubShape(self, aShape, aType, ListOfInd): + """ + Obtain a compound of sub-shapes of aShape, + selected by they indices in list of all sub-shapes of type aType. + Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] + + Parameters: + aShape Shape to get sub-shape of. + ListOfID List of sub-shapes indices. + aType Type of sub-shapes to be retrieved (see geompy.ShapeType) + + Returns: + A compound of sub-shapes of aShape. + """ + # Example: see GEOM_TestAll.py + ListOfIDs = [] + AllShapeIDsList = self.SubShapeAllIDs(aShape, aType) + for ind in ListOfInd: + ListOfIDs.append(AllShapeIDsList[ind - 1]) + anObj = self.GetSubShape(aShape, ListOfIDs) + return anObj + + ## Explode a shape on sub-shapes of a given type. # Sub-shapes will be sorted by coordinates of their gravity centers. + # If the shape itself matches the type, it is also returned. # @param aShape Shape to be exploded. - # @param aType Type of sub-shapes to be retrieved. + # @param aType Type of sub-shapes to be retrieved (see ShapeType()) # @return List of sub-shapes of type theShapeType, contained in theShape. # # @ref swig_SubShapeAllSorted "Example" - def SubShapeAllSorted(self, aShape, aType): + def SubShapeAllSortedCentres(self, aShape, aType): + """ + Explode a shape on sub-shapes of a given type. + Sub-shapes will be sorted by coordinates of their gravity centers. + If the shape itself matches the type, it is also returned. + + Parameters: + aShape Shape to be exploded. + aType Type of sub-shapes to be retrieved (see geompy.ShapeType) + + Returns: + List of sub-shapes of type theShapeType, contained in theShape. + """ # Example: see GEOM_TestAll.py - ListObj = self.ShapesOp.MakeExplode(aShape,aType,1) - RaiseIfFailed("MakeExplode", self.ShapesOp) + ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, True) + RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp) return ListObj - ## Explode a shape on subshapes of a given type. + ## Explode a shape on sub-shapes of a given type. # Sub-shapes will be sorted by coordinates of their gravity centers. # @param aShape Shape to be exploded. - # @param aType Type of sub-shapes to be retrieved. + # @param aType Type of sub-shapes to be retrieved (see ShapeType()) # @return List of IDs of sub-shapes. # # @ref swig_all_decompose "Example" - def SubShapeAllSortedIDs(self, aShape, aType): - ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1) + def SubShapeAllSortedCentresIDs(self, aShape, aType): + """ + Explode a shape on sub-shapes of a given type. + Sub-shapes will be sorted by coordinates of their gravity centers. + + Parameters: + aShape Shape to be exploded. + aType Type of sub-shapes to be retrieved (see geompy.ShapeType) + + Returns: + List of IDs of sub-shapes. + """ + ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, True) RaiseIfFailed("SubShapeAllIDs", self.ShapesOp) return ListIDs ## Obtain a compound of sub-shapes of aShape, - # selected by they indices in list of all sub-shapes of type aType. + # selected by they indices in sorted list of all sub-shapes of type aType. # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] + # @param aShape Shape to get sub-shape of. + # @param ListOfInd List of sub-shapes indices. + # @param aType Type of sub-shapes to be retrieved (see ShapeType()) + # @return A compound of sub-shapes of aShape. # # @ref swig_all_decompose "Example" - def SubShape(self, aShape, aType, ListOfInd): + def SubShapeSortedCentres(self, aShape, aType, ListOfInd): + """ + Obtain a compound of sub-shapes of aShape, + selected by they indices in sorted list of all sub-shapes of type aType. + Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] + + Parameters: + aShape Shape to get sub-shape of. + ListOfID List of sub-shapes indices. + aType Type of sub-shapes to be retrieved (see geompy.ShapeType) + + Returns: + A compound of sub-shapes of aShape. + """ # Example: see GEOM_TestAll.py ListOfIDs = [] - AllShapeList = self.SubShapeAll(aShape, aType) + AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType) for ind in ListOfInd: - ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1])) + ListOfIDs.append(AllShapeIDsList[ind - 1]) anObj = self.GetSubShape(aShape, ListOfIDs) return anObj - ## Obtain a compound of sub-shapes of aShape, - # selected by they indices in sorted list of all sub-shapes of type aType. - # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] + ## Extract shapes (excluding the main shape) of given type. + # @param aShape The shape. + # @param aType The shape type (see ShapeType()) + # @param isSorted Boolean flag to switch sorting on/off. + # @return List of sub-shapes of type aType, contained in aShape. + # + # @ref swig_FilletChamfer "Example" + def ExtractShapes(self, aShape, aType, isSorted = False): + """ + Extract shapes (excluding the main shape) of given type. + + Parameters: + aShape The shape. + aType The shape type (see geompy.ShapeType) + isSorted Boolean flag to switch sorting on/off. + + Returns: + List of sub-shapes of type aType, contained in aShape. + """ + # Example: see GEOM_TestAll.py + ListObj = self.ShapesOp.ExtractSubShapes(aShape, aType, isSorted) + RaiseIfFailed("ExtractSubShapes", self.ShapesOp) + return ListObj + + ## Get a set of sub-shapes defined by their unique IDs inside aShape + # @param aShape Main shape. + # @param anIDs List of unique IDs of sub-shapes inside aShape. + # @return List of GEOM.GEOM_Object, corresponding to found sub-shapes. # # @ref swig_all_decompose "Example" - def SubShapeSorted(self,aShape, aType, ListOfInd): + def SubShapes(self, aShape, anIDs): + """ + Get a set of sub-shapes defined by their unique IDs inside theMainShape + + Parameters: + aShape Main shape. + anIDs List of unique IDs of sub-shapes inside theMainShape. + + Returns: + List of GEOM.GEOM_Object, corresponding to found sub-shapes. + """ # Example: see GEOM_TestAll.py + ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs) + RaiseIfFailed("SubShapes", self.ShapesOp) + return ListObj + + # end of l4_decompose + ## @} + + ## @addtogroup l4_decompose_d + ## @{ + + ## Deprecated method + # It works like SubShapeAllSortedCentres(), but wrongly + # defines centres of faces, shells and solids. + def SubShapeAllSorted(self, aShape, aType): + """ + Deprecated method + It works like geompy.SubShapeAllSortedCentres, but wrongly + defines centres of faces, shells and solids. + """ + ListObj = self.ShapesOp.MakeExplode(aShape, aType, True) + RaiseIfFailed("MakeExplode", self.ShapesOp) + return ListObj + + ## Deprecated method + # It works like SubShapeAllSortedCentresIDs(), but wrongly + # defines centres of faces, shells and solids. + def SubShapeAllSortedIDs(self, aShape, aType): + """ + Deprecated method + It works like geompy.SubShapeAllSortedCentresIDs, but wrongly + defines centres of faces, shells and solids. + """ + ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, aType, True) + RaiseIfFailed("SubShapeAllIDs", self.ShapesOp) + return ListIDs + + ## Deprecated method + # It works like SubShapeSortedCentres(), but has a bug + # (wrongly defines centres of faces, shells and solids). + def SubShapeSorted(self, aShape, aType, ListOfInd): + """ + Deprecated method + It works like geompy.SubShapeSortedCentres, but has a bug + (wrongly defines centres of faces, shells and solids). + """ ListOfIDs = [] - AllShapeList = self.SubShapeAllSorted(aShape, aType) + AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, aType) for ind in ListOfInd: - ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1])) + ListOfIDs.append(AllShapeIDsList[ind - 1]) anObj = self.GetSubShape(aShape, ListOfIDs) return anObj - # end of l4_decompose + # end of l4_decompose_d ## @} ## @addtogroup l3_healing @@ -1875,13 +4306,163 @@ class geompyDC(GEOM._objref_GEOM_Gen): # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.). # @param theValues List of values of parameters, in the same order # as parameters are listed in theParameters list. - # @return New GEOM_Object, containing processed shape. # - # @ref tui_shape_processing "Example" - def ProcessShape(self,theShape, theOperators, theParameters, theValues): + # + # Operators and Parameters: \n + # + # * \b FixShape - corrects invalid shapes. \n + # - \b FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them. \n + # - \b FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction. \n + # + # * \b FixFaceSize - removes small faces, such as spots and strips.\n + # - \b FixFaceSize.Tolerance - defines minimum possible face size. \n + # - \b DropSmallEdges - removes edges, which merge with neighbouring edges. \n + # - \b DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.\n + # + # * \b SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical + # surfaces in segments using a certain angle. \n + # - \b SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments + # if Angle=180, four if Angle=90, etc). \n + # - \b SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.\n + # + # * \b SplitClosedFaces - splits closed faces in segments. + # The number of segments depends on the number of splitting points.\n + # - \b SplitClosedFaces.NbSplitPoints - the number of splitting points.\n + # + # * \b SplitContinuity - splits shapes to reduce continuities of curves and surfaces.\n + # - \b SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.\n + # - \b SplitContinuity.SurfaceContinuity - required continuity for surfaces.\n + # - \b SplitContinuity.CurveContinuity - required continuity for curves.\n + # This and the previous parameters can take the following values:\n + # \b Parametric \b Continuity \n + # \b C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces + # are coincidental. The curves or surfaces may still meet at an angle, giving rise to a sharp corner or edge).\n + # \b C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces are parallel, + # ruling out sharp edges).\n + # \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces + # are of the same magnitude).\n + # \b CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of curves + # or surfaces (d/du C(u)) are the same at junction. \n + # \b Geometric \b Continuity \n + # \b G1: first derivatives are proportional at junction.\n + # The curve tangents thus have the same direction, but not necessarily the same magnitude. + # i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).\n + # \b G2: first and second derivatives are proportional at junction. + # As the names imply, geometric continuity requires the geometry to be continuous, while parametric + # continuity requires that the underlying parameterization was continuous as well. + # Parametric continuity of order n implies geometric continuity of order n, but not vice-versa.\n + # + # * \b BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:\n + # - \b BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.\n + # - \b BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.\n + # - \b BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.\n + # - \b BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation + # with the specified parameters.\n + # - \b BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation + # with the specified parameters.\n + # - \b BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.\n + # - \b BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.\n + # - \b BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.\n + # - \b BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.\n + # + # * \b ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.\n + # - \b ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.\n + # - \b ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.\n + # - \b ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.\n + # - \b ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.\n + # + # * \b SameParameter - fixes edges of 2D and 3D curves not having the same parameter.\n + # - \b SameParameter.Tolerance3d - defines tolerance for fixing of edges.\n + # + # + # @return New GEOM.GEOM_Object, containing processed shape. + # + # \n @ref tui_shape_processing "Example" + def ProcessShape(self, theShape, theOperators, theParameters, theValues): + """ + Apply a sequence of Shape Healing operators to the given object. + + Parameters: + theShape Shape to be processed. + theValues List of values of parameters, in the same order + as parameters are listed in theParameters list. + theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.). + theParameters List of names of parameters + ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.). + Operators and Parameters: + + * FixShape - corrects invalid shapes. + * FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them. + * FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction. + * FixFaceSize - removes small faces, such as spots and strips. + * FixFaceSize.Tolerance - defines minimum possible face size. + * DropSmallEdges - removes edges, which merge with neighbouring edges. + * DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges. + * SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical surfaces + in segments using a certain angle. + * SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments + if Angle=180, four if Angle=90, etc). + * SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments. + * SplitClosedFaces - splits closed faces in segments. The number of segments depends on the number of + splitting points. + * SplitClosedFaces.NbSplitPoints - the number of splitting points. + * SplitContinuity - splits shapes to reduce continuities of curves and surfaces. + * SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry. + * SplitContinuity.SurfaceContinuity - required continuity for surfaces. + * SplitContinuity.CurveContinuity - required continuity for curves. + This and the previous parameters can take the following values: + + Parametric Continuity: + C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces are + coincidental. The curves or surfaces may still meet at an angle, + giving rise to a sharp corner or edge). + C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces + are parallel, ruling out sharp edges). + C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves + or surfaces are of the same magnitude). + CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of + curves or surfaces (d/du C(u)) are the same at junction. + + Geometric Continuity: + G1: first derivatives are proportional at junction. + The curve tangents thus have the same direction, but not necessarily the same magnitude. + i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c). + G2: first and second derivatives are proportional at junction. As the names imply, + geometric continuity requires the geometry to be continuous, while parametric continuity requires + that the underlying parameterization was continuous as well. Parametric continuity of order n implies + geometric continuity of order n, but not vice-versa. + * BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters: + * BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary. + * BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation. + * BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation. + * BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation with + the specified parameters. + * BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation with + the specified parameters. + * BSplineRestriction.RequiredDegree - required degree of the resulting BSplines. + * BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines. + * BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves. + * BSplineRestriction.Continuity2d - continuity of the resulting 2D curves. + * ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces. + * ToBezier.SurfaceMode - if checked in, allows conversion of surfaces. + * ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves. + * ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves. + * ToBezier.MaxTolerance - defines tolerance for detection and correction of problems. + * SameParameter - fixes edges of 2D and 3D curves not having the same parameter. + * SameParameter.Tolerance3d - defines tolerance for fixing of edges. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + + Note: For more information look through SALOME Geometry User's Guide-> + -> Introduction to Geometry-> Repairing Operations-> Shape Processing + """ # Example: see GEOM_TestHealing.py theValues,Parameters = ParseList(theValues) anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues) + # To avoid script failure in case of good argument shape + if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg": + return theShape RaiseIfFailed("ProcessShape", self.HealOp) for string in (theOperators + theParameters): Parameters = ":" + Parameters @@ -1893,19 +4474,43 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject Shape to be processed. # @param theFaces Indices of faces to be removed, if EMPTY then the method # removes ALL faces of the given object. - # @return New GEOM_Object, containing processed shape. + # @return New GEOM.GEOM_Object, containing processed shape. # # @ref tui_suppress_faces "Example" def SuppressFaces(self,theObject, theFaces): + """ + Remove faces from the given object (shape). + + Parameters: + theObject Shape to be processed. + theFaces Indices of faces to be removed, if EMPTY then the method + removes ALL faces of the given object. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ # Example: see GEOM_TestHealing.py anObj = self.HealOp.SuppressFaces(theObject, theFaces) RaiseIfFailed("SuppressFaces", self.HealOp) return anObj ## Sewing of some shapes into single shape. + # @param ListShape Shapes to be processed. + # @param theTolerance Required tolerance value. + # @return New GEOM.GEOM_Object, containing processed shape. # # @ref tui_sewing "Example" def MakeSewing(self, ListShape, theTolerance): + """ + Sewing of some shapes into single shape. + + Parameters: + ListShape Shapes to be processed. + theTolerance Required tolerance value. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ # Example: see GEOM_TestHealing.py comp = self.MakeCompound(ListShape) anObj = self.Sew(comp, theTolerance) @@ -1914,8 +4519,18 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Sewing of the given object. # @param theObject Shape to be processed. # @param theTolerance Required tolerance value. - # @return New GEOM_Object, containing processed shape. + # @return New GEOM.GEOM_Object, containing processed shape. def Sew(self, theObject, theTolerance): + """ + Sewing of the given object. + + Parameters: + theObject Shape to be processed. + theTolerance Required tolerance value. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ # Example: see MakeSewing() above theTolerance,Parameters = ParseParameters(theTolerance) anObj = self.HealOp.Sew(theObject, theTolerance) @@ -1927,10 +4542,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject Shape to be processed. # @param theWires Indices of wires to be removed, if EMPTY then the method # removes ALL internal wires of the given object. - # @return New GEOM_Object, containing processed shape. + # @return New GEOM.GEOM_Object, containing processed shape. # # @ref tui_suppress_internal_wires "Example" def SuppressInternalWires(self,theObject, theWires): + """ + Remove internal wires and edges from the given object (face). + + Parameters: + theObject Shape to be processed. + theWires Indices of wires to be removed, if EMPTY then the method + removes ALL internal wires of the given object. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ # Example: see GEOM_TestHealing.py anObj = self.HealOp.RemoveIntWires(theObject, theWires) RaiseIfFailed("RemoveIntWires", self.HealOp) @@ -1940,10 +4566,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject Shape to be processed. # @param theWires Indices of wires to be removed, if EMPTY then the method # removes ALL internal holes of the given object - # @return New GEOM_Object, containing processed shape. + # @return New GEOM.GEOM_Object, containing processed shape. # # @ref tui_suppress_holes "Example" def SuppressHoles(self,theObject, theWires): + """ + Remove internal closed contours (holes) from the given object. + + Parameters: + theObject Shape to be processed. + theWires Indices of wires to be removed, if EMPTY then the method + removes ALL internal holes of the given object + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ # Example: see GEOM_TestHealing.py anObj = self.HealOp.FillHoles(theObject, theWires) RaiseIfFailed("FillHoles", self.HealOp) @@ -1952,13 +4589,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Close an open wire. # @param theObject Shape to be processed. # @param theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape, - # if -1, then theObject itself is a wire. - # @param isCommonVertex If TRUE : closure by creation of a common vertex, - # If FALS : closure by creation of an edge between ends. - # @return New GEOM_Object, containing processed shape. + # if [ ], then theObject itself is a wire. + # @param isCommonVertex If True : closure by creation of a common vertex, + # If False : closure by creation of an edge between ends. + # @return New GEOM.GEOM_Object, containing processed shape. # # @ref tui_close_contour "Example" def CloseContour(self,theObject, theWires, isCommonVertex): + """ + Close an open wire. + + Parameters: + theObject Shape to be processed. + theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape, + if [ ], then theObject itself is a wire. + isCommonVertex If True : closure by creation of a common vertex, + If False : closure by creation of an edge between ends. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ # Example: see GEOM_TestHealing.py anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex) RaiseIfFailed("CloseContour", self.HealOp) @@ -1970,12 +4620,27 @@ class geompyDC(GEOM._objref_GEOM_Gen): # if -1, then theObject itself is the edge. # @param theValue Value of parameter on edge or length parameter, # depending on \a isByParameter. - # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], + # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], \n # if FALSE : \a theValue is treated as a length parameter [0..1] - # @return New GEOM_Object, containing processed shape. + # @return New GEOM.GEOM_Object, containing processed shape. # # @ref tui_add_point_on_edge "Example" def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter): + """ + Addition of a point to a given edge object. + + Parameters: + theObject Shape to be processed. + theEdgeIndex Index of edge to be divided within theObject's shape, + if -1, then theObject itself is the edge. + theValue Value of parameter on edge or length parameter, + depending on isByParameter. + isByParameter If TRUE : theValue is treated as a curve parameter [0..1], + if FALSE : theValue is treated as a length parameter [0..1] + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ # Example: see GEOM_TestHealing.py theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter) anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter) @@ -1983,35 +4648,111 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj + ## Suppress the vertices in the wire in case if adjacent edges are C1 continuous. + # @param theWire Wire to minimize the number of C1 continuous edges in. + # @param theVertices A list of vertices to suppress. If the list + # is empty, all vertices in a wire will be assumed. + # @return New GEOM.GEOM_Object with modified wire. + # + # @ref tui_fuse_collinear_edges "Example" + def FuseCollinearEdgesWithinWire(self, theWire, theVertices = []): + """ + Suppress the vertices in the wire in case if adjacent edges are C1 continuous. + + Parameters: + theWire Wire to minimize the number of C1 continuous edges in. + theVertices A list of vertices to suppress. If the list + is empty, all vertices in a wire will be assumed. + + Returns: + New GEOM.GEOM_Object with modified wire. + """ + anObj = self.HealOp.FuseCollinearEdgesWithinWire(theWire, theVertices) + RaiseIfFailed("FuseCollinearEdgesWithinWire", self.HealOp) + return anObj + ## Change orientation of the given object. Updates given shape. # @param theObject Shape to be processed. + # @return Updated theObject # # @ref swig_todo "Example" def ChangeOrientationShell(self,theObject): + """ + Change orientation of the given object. Updates given shape. + + Parameters: + theObject Shape to be processed. + + Returns: + Updated theObject + """ theObject = self.HealOp.ChangeOrientation(theObject) RaiseIfFailed("ChangeOrientation", self.HealOp) pass ## Change orientation of the given object. # @param theObject Shape to be processed. - # @return New GEOM_Object, containing processed shape. + # @return New GEOM.GEOM_Object, containing processed shape. # # @ref swig_todo "Example" - def ChangeOrientationShellCopy(self,theObject): + def ChangeOrientationShellCopy(self, theObject): + """ + Change orientation of the given object. + + Parameters: + theObject Shape to be processed. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ anObj = self.HealOp.ChangeOrientationCopy(theObject) RaiseIfFailed("ChangeOrientationCopy", self.HealOp) return anObj - ## Get a list of wires (wrapped in GEOM_Object-s), + ## Try to limit tolerance of the given object by value \a theTolerance. + # @param theObject Shape to be processed. + # @param theTolerance Required tolerance value. + # @return New GEOM.GEOM_Object, containing processed shape. + # + # @ref tui_limit_tolerance "Example" + def LimitTolerance(self, theObject, theTolerance = 1e-07): + """ + Try to limit tolerance of the given object by value theTolerance. + + Parameters: + theObject Shape to be processed. + theTolerance Required tolerance value. + + Returns: + New GEOM.GEOM_Object, containing processed shape. + """ + anObj = self.HealOp.LimitTolerance(theObject, theTolerance) + RaiseIfFailed("LimitTolerance", self.HealOp) + return anObj + + ## Get a list of wires (wrapped in GEOM.GEOM_Object-s), # that constitute a free boundary of the given shape. # @param theObject Shape to get free boundary of. - # @return [status, theClosedWires, theOpenWires] - # status: FALSE, if an error(s) occured during the method execution. - # theClosedWires: Closed wires on the free boundary of the given shape. - # theOpenWires: Open wires on the free boundary of the given shape. + # @return [\a status, \a theClosedWires, \a theOpenWires] + # \n \a status: FALSE, if an error(s) occured during the method execution. + # \n \a theClosedWires: Closed wires on the free boundary of the given shape. + # \n \a theOpenWires: Open wires on the free boundary of the given shape. # # @ref tui_measurement_tools_page "Example" - def GetFreeBoundary(self,theObject): + def GetFreeBoundary(self, theObject): + """ + Get a list of wires (wrapped in GEOM.GEOM_Object-s), + that constitute a free boundary of the given shape. + + Parameters: + theObject Shape to get free boundary of. + + Returns: + [status, theClosedWires, theOpenWires] + status: FALSE, if an error(s) occured during the method execution. + theClosedWires: Closed wires on the free boundary of the given shape. + theOpenWires: Open wires on the free boundary of the given shape. + """ # Example: see GEOM_TestHealing.py anObj = self.HealOp.GetFreeBoundary(theObject) RaiseIfFailed("GetFreeBoundary", self.HealOp) @@ -2022,10 +4763,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theTolerance Maximum distance between faces, which can be considered as coincident. # @param doKeepNonSolids If FALSE, only solids will present in the result, # otherwise all initial shapes. - # @return New GEOM_Object, containing a copy of theShape without coincident faces. + # @return New GEOM.GEOM_Object, containing a copy of theShape without coincident faces. # # @ref tui_glue_faces "Example" def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True): + """ + Replace coincident faces in theShape by one face. + + Parameters: + theShape Initial shape. + theTolerance Maximum distance between faces, which can be considered as coincident. + doKeepNonSolids If FALSE, only solids will present in the result, + otherwise all initial shapes. + + Returns: + New GEOM.GEOM_Object, containing a copy of theShape without coincident faces. + """ # Example: see GEOM_Spanner.py theTolerance,Parameters = ParseParameters(theTolerance) anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids) @@ -2038,11 +4791,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theShape Initial shape. # @param theTolerance Maximum distance between faces, # which can be considered as coincident. - # @return ListOfGO. + # @return GEOM.ListOfGO # - # @ref swig_todo "Example" + # @ref tui_glue_faces "Example" def GetGlueFaces(self, theShape, theTolerance): - # Example: see GEOM_Spanner.py + """ + Find coincident faces in theShape for possible gluing. + + Parameters: + theShape Initial shape. + theTolerance Maximum distance between faces, + which can be considered as coincident. + + Returns: + GEOM.ListOfGO + """ anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance) RaiseIfFailed("GetGlueFaces", self.ShapesOp) return anObj @@ -2055,15 +4818,115 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theFaces List of faces for gluing. # @param doKeepNonSolids If FALSE, only solids will present in the result, # otherwise all initial shapes. - # @return New GEOM_Object, containing a copy of theShape + # @param doGlueAllEdges If TRUE, all coincident edges of theShape + # will be glued, otherwise only the edges, + # belonging to theFaces. + # @return New GEOM.GEOM_Object, containing a copy of theShape # without some faces. # - # @ref swig_todo "Example" - def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True): - # Example: see GEOM_Spanner.py - anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids) + # @ref tui_glue_faces "Example" + def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, + doKeepNonSolids=True, doGlueAllEdges=True): + """ + Replace coincident faces in theShape by one face + in compliance with given list of faces + + Parameters: + theShape Initial shape. + theTolerance Maximum distance between faces, + which can be considered as coincident. + theFaces List of faces for gluing. + doKeepNonSolids If FALSE, only solids will present in the result, + otherwise all initial shapes. + doGlueAllEdges If TRUE, all coincident edges of theShape + will be glued, otherwise only the edges, + belonging to theFaces. + + Returns: + New GEOM.GEOM_Object, containing a copy of theShape + without some faces. + """ + anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, + doKeepNonSolids, doGlueAllEdges) + if anObj is None: + raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode() + return anObj + + ## Replace coincident edges in theShape by one edge. + # @param theShape Initial shape. + # @param theTolerance Maximum distance between edges, which can be considered as coincident. + # @return New GEOM.GEOM_Object, containing a copy of theShape without coincident edges. + # + # @ref tui_glue_edges "Example" + def MakeGlueEdges(self, theShape, theTolerance): + """ + Replace coincident edges in theShape by one edge. + + Parameters: + theShape Initial shape. + theTolerance Maximum distance between edges, which can be considered as coincident. + + Returns: + New GEOM.GEOM_Object, containing a copy of theShape without coincident edges. + """ + theTolerance,Parameters = ParseParameters(theTolerance) + anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance) + if anObj is None: + raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode() + anObj.SetParameters(Parameters) + return anObj + + ## Find coincident edges in theShape for possible gluing. + # @param theShape Initial shape. + # @param theTolerance Maximum distance between edges, + # which can be considered as coincident. + # @return GEOM.ListOfGO + # + # @ref tui_glue_edges "Example" + def GetGlueEdges(self, theShape, theTolerance): + """ + Find coincident edges in theShape for possible gluing. + + Parameters: + theShape Initial shape. + theTolerance Maximum distance between edges, + which can be considered as coincident. + + Returns: + GEOM.ListOfGO + """ + anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance) + RaiseIfFailed("GetGlueEdges", self.ShapesOp) + return anObj + + ## Replace coincident edges in theShape by one edge + # in compliance with given list of edges. + # @param theShape Initial shape. + # @param theTolerance Maximum distance between edges, + # which can be considered as coincident. + # @param theEdges List of edges for gluing. + # @return New GEOM.GEOM_Object, containing a copy of theShape + # without some edges. + # + # @ref tui_glue_edges "Example" + def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges): + """ + Replace coincident edges in theShape by one edge + in compliance with given list of edges. + + Parameters: + theShape Initial shape. + theTolerance Maximum distance between edges, + which can be considered as coincident. + theEdges List of edges for gluing. + + Returns: + New GEOM.GEOM_Object, containing a copy of theShape + without some edges. + """ + anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges) if anObj is None: - raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode() + raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode() return anObj # end of l3_healing @@ -2079,48 +4942,115 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Perform one of boolean operations on two given shapes. # @param theShape1 First argument for boolean operation. # @param theShape2 Second argument for boolean operation. - # @param theOperation Indicates the operation to be done: + # @param theOperation Indicates the operation to be done:\n # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section. - # @return New GEOM_Object, containing the result shape. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_fuse "Example" def MakeBoolean(self,theShape1, theShape2, theOperation): + """ + Perform one of boolean operations on two given shapes. + + Parameters: + theShape1 First argument for boolean operation. + theShape2 Second argument for boolean operation. + theOperation Indicates the operation to be done: + 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + """ # Example: see GEOM_TestAll.py anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation) RaiseIfFailed("MakeBoolean", self.BoolOp) return anObj - ## Shortcut to MakeBoolean(s1, s2, 1) + ## Perform Common boolean operation on two given shapes. + # @param theShape1 First argument for boolean operation. + # @param theShape2 Second argument for boolean operation. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_common "Example 1" # \n @ref swig_MakeCommon "Example 2" - def MakeCommon(self, s1, s2): + def MakeCommon(self, theShape1, theShape2): + """ + Perform Common boolean operation on two given shapes. + + Parameters: + theShape1 First argument for boolean operation. + theShape2 Second argument for boolean operation. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + """ # Example: see GEOM_TestOthers.py - return self.MakeBoolean(s1, s2, 1) + return self.MakeBoolean(theShape1, theShape2, 1) - ## Shortcut to MakeBoolean(s1, s2, 2) + ## Perform Cut boolean operation on two given shapes. + # @param theShape1 First argument for boolean operation. + # @param theShape2 Second argument for boolean operation. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_cut "Example 1" # \n @ref swig_MakeCommon "Example 2" - def MakeCut(self, s1, s2): + def MakeCut(self, theShape1, theShape2): + """ + Perform Cut boolean operation on two given shapes. + + Parameters: + theShape1 First argument for boolean operation. + theShape2 Second argument for boolean operation. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + """ # Example: see GEOM_TestOthers.py - return self.MakeBoolean(s1, s2, 2) + return self.MakeBoolean(theShape1, theShape2, 2) - ## Shortcut to MakeBoolean(s1, s2, 3) + ## Perform Fuse boolean operation on two given shapes. + # @param theShape1 First argument for boolean operation. + # @param theShape2 Second argument for boolean operation. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_fuse "Example 1" # \n @ref swig_MakeCommon "Example 2" - def MakeFuse(self, s1, s2): + def MakeFuse(self, theShape1, theShape2): + """ + Perform Fuse boolean operation on two given shapes. + + Parameters: + theShape1 First argument for boolean operation. + theShape2 Second argument for boolean operation. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + """ # Example: see GEOM_TestOthers.py - return self.MakeBoolean(s1, s2, 3) + return self.MakeBoolean(theShape1, theShape2, 3) - ## Shortcut to MakeBoolean(s1, s2, 4) + ## Perform Section boolean operation on two given shapes. + # @param theShape1 First argument for boolean operation. + # @param theShape2 Second argument for boolean operation. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_section "Example 1" # \n @ref swig_MakeCommon "Example 2" - def MakeSection(self, s1, s2): + def MakeSection(self, theShape1, theShape2): + """ + Perform Section boolean operation on two given shapes. + + Parameters: + theShape1 First argument for boolean operation. + theShape2 Second argument for boolean operation. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + """ # Example: see GEOM_TestOthers.py - return self.MakeBoolean(s1, s2, 4) + return self.MakeBoolean(theShape1, theShape2, 4) # end of l3_boolean ## @} @@ -2131,19 +5061,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Perform partition operation. # @param ListShapes Shapes to be intersected. # @param ListTools Shapes to intersect theShapes. - # !!!NOTE: Each compound from ListShapes and ListTools will be exploded - # in order to avoid possible intersection between shapes from - # this compound. - # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum). - # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with - # type <= Limit are kept in the result, - # else - shapes with type > Limit are kept - # also (if they exist) + # @param Limit Type of resulting shapes (see ShapeType()).\n + # If this parameter is set to -1 ("Auto"), most appropriate shape limit + # type will be detected automatically. + # @param KeepNonlimitShapes if this parameter == 0, then only shapes of + # target type (equal to Limit) are kept in the result, + # else standalone shapes of lower dimension + # are kept also (if they exist). + # @note Each compound from ListShapes and ListTools will be exploded + # in order to avoid possible intersection between shapes from this compound. # # After implementation new version of PartitionAlgo (October 2006) # other parameters are ignored by current functionality. They are kept # in this function only for support old versions. - # Ignored parameters: # @param ListKeepInside Shapes, outside which the results will be deleted. # Each shape from theKeepInside must belong to theShapes also. # @param ListRemoveInside Shapes, inside which the results will be deleted. @@ -2152,13 +5082,52 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param ListMaterials Material indices for each shape. Make sence, # only if theRemoveWebs is TRUE. # - # @return New GEOM_Object, containing the result shapes. + # @return New GEOM.GEOM_Object, containing the result shapes. # # @ref tui_partition "Example" def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[], KeepNonlimitShapes=0): + """ + Perform partition operation. + + Parameters: + ListShapes Shapes to be intersected. + ListTools Shapes to intersect theShapes. + Limit Type of resulting shapes (see geompy.ShapeType) + If this parameter is set to -1 ("Auto"), most appropriate shape limit + type will be detected automatically. + KeepNonlimitShapes if this parameter == 0, then only shapes of + target type (equal to Limit) are kept in the result, + else standalone shapes of lower dimension + are kept also (if they exist). + Note: + Each compound from ListShapes and ListTools will be exploded + in order to avoid possible intersection between shapes from + this compound. + + After implementation new version of PartitionAlgo (October 2006) other + parameters are ignored by current functionality. They are kept in this + function only for support old versions. + + Ignored parameters: + ListKeepInside Shapes, outside which the results will be deleted. + Each shape from theKeepInside must belong to theShapes also. + ListRemoveInside Shapes, inside which the results will be deleted. + Each shape from theRemoveInside must belong to theShapes also. + RemoveWebs If TRUE, perform Glue 3D algorithm. + ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE. + + Returns: + New GEOM.GEOM_Object, containing the result shapes. + """ # Example: see GEOM_TestAll.py + if Limit == ShapeType["AUTO"]: + # automatic detection of the most appropriate shape limit type + lim = GEOM.SHAPE + for s in ListShapes: lim = min( lim, s.GetMaxShapeType() ) + Limit = EnumToLong(lim) + pass anObj = self.BoolOp.MakePartition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, Limit, RemoveWebs, ListMaterials, @@ -2173,16 +5142,38 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # Description of all parameters as in previous method MakePartition() # - # !!!NOTE: Passed compounds (via ListShapes or via ListTools) + # @note Passed compounds (via ListShapes or via ListTools) # have to consist of nonintersecting shapes. # - # @return New GEOM_Object, containing the result shapes. + # @return New GEOM.GEOM_Object, containing the result shapes. # # @ref swig_todo "Example" def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, + Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[], KeepNonlimitShapes=0): + """ + Perform partition operation. + This method may be useful if it is needed to make a partition for + compound contains nonintersected shapes. Performance will be better + since intersection between shapes from compound is not performed. + + Parameters: + Description of all parameters as in method geompy.MakePartition + + NOTE: + Passed compounds (via ListShapes or via ListTools) + have to consist of nonintersecting shapes. + + Returns: + New GEOM.GEOM_Object, containing the result shapes. + """ + if Limit == ShapeType["AUTO"]: + # automatic detection of the most appropriate shape limit type + lim = GEOM.SHAPE + for s in ListShapes: lim = min( lim, s.GetMaxShapeType() ) + Limit = EnumToLong(lim) + pass anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools, ListKeepInside, ListRemoveInside, Limit, RemoveWebs, ListMaterials, @@ -2190,13 +5181,16 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp) return anObj - ## Shortcut to MakePartition() + ## See method MakePartition() for more information. # # @ref tui_partition "Example 1" # \n @ref swig_Partition "Example 2" def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[], KeepNonlimitShapes=0): + """ + See method geompy.MakePartition for more information. + """ # Example: see GEOM_TestOthers.py anObj = self.MakePartition(ListShapes, ListTools, ListKeepInside, ListRemoveInside, @@ -2207,10 +5201,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Perform partition of the Shape with the Plane # @param theShape Shape to be intersected. # @param thePlane Tool shape, to intersect theShape. - # @return New GEOM_Object, containing the result shape. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_partition "Example" def MakeHalfPartition(self,theShape, thePlane): + """ + Perform partition of the Shape with the Plane + + Parameters: + theShape Shape to be intersected. + thePlane Tool shape, to intersect theShape. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + """ # Example: see GEOM_TestAll.py anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane) RaiseIfFailed("MakeHalfPartition", self.BoolOp) @@ -2227,11 +5231,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject The object to be translated. # @param thePoint1 Start point of translation vector. # @param thePoint2 End point of translation vector. - # @return New GEOM_Object, containing the translated object. + # @return New GEOM.GEOM_Object, containing the translated object. # # @ref tui_translation "Example 1" # \n @ref swig_MakeTranslationTwoPoints "Example 2" def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2): + """ + Translate the given object along the vector, specified + by its end points, creating its copy before the translation. + + Parameters: + theObject The object to be translated. + thePoint1 Start point of translation vector. + thePoint2 End point of translation vector. + + Returns: + New GEOM.GEOM_Object, containing the translated object. + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2) RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp) @@ -2240,10 +5256,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Translate the given object along the vector, specified by its components. # @param theObject The object to be translated. # @param theDX,theDY,theDZ Components of translation vector. - # @return Translated GEOM_Object. + # @return Translated GEOM.GEOM_Object. # # @ref tui_translation "Example" def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ): + """ + Translate the given object along the vector, specified by its components. + + Parameters: + theObject The object to be translated. + theDX,theDY,theDZ Components of translation vector. + + Returns: + Translated GEOM.GEOM_Object. + """ # Example: see GEOM_TestAll.py theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ) @@ -2255,10 +5281,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # by its components, creating its copy before the translation. # @param theObject The object to be translated. # @param theDX,theDY,theDZ Components of translation vector. - # @return New GEOM_Object, containing the translated object. + # @return New GEOM.GEOM_Object, containing the translated object. # # @ref tui_translation "Example" def MakeTranslation(self,theObject, theDX, theDY, theDZ): + """ + Translate the given object along the vector, specified + by its components, creating its copy before the translation. + + Parameters: + theObject The object to be translated. + theDX,theDY,theDZ Components of translation vector. + + Returns: + New GEOM.GEOM_Object, containing the translated object. + """ # Example: see GEOM_TestAll.py theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ) @@ -2270,10 +5307,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # creating its copy before the translation. # @param theObject The object to be translated. # @param theVector The translation vector. - # @return New GEOM_Object, containing the translated object. + # @return New GEOM.GEOM_Object, containing the translated object. # # @ref tui_translation "Example" def MakeTranslationVector(self,theObject, theVector): + """ + Translate the given object along the given vector, + creating its copy before the translation. + + Parameters: + theObject The object to be translated. + theVector The translation vector. + + Returns: + New GEOM.GEOM_Object, containing the translated object. + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector) RaiseIfFailed("TranslateVectorCopy", self.TrsfOp) @@ -2284,10 +5332,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theVector The translation vector. # @param theDistance The translation distance. # @param theCopy Flag used to translate object itself or create a copy. - # @return Translated GEOM_Object. + # @return New GEOM.GEOM_Object, containing the translated object. # # @ref tui_translation "Example" def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy): + """ + Translate the given object along the given vector on given distance. + + Parameters: + theObject The object to be translated. + theVector The translation vector. + theDistance The translation distance. + theCopy Flag used to translate object itself or create a copy. + + Returns: + New GEOM.GEOM_Object, containing the translated object. + """ # Example: see GEOM_TestAll.py theDistance,Parameters = ParseParameters(theDistance) anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy) @@ -2300,10 +5360,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject The object to be translated. # @param theVector The translation vector. # @param theDistance The translation distance. - # @return New GEOM_Object, containing the translated object. + # @return New GEOM.GEOM_Object, containing the translated object. # # @ref tui_translation "Example" def MakeTranslationVectorDistance(self, theObject, theVector, theDistance): + """ + Translate the given object along the given vector on given distance, + creating its copy before the translation. + + Parameters: + theObject The object to be translated. + theVector The translation vector. + theDistance The translation distance. + + Returns: + New GEOM.GEOM_Object, containing the translated object. + """ # Example: see GEOM_TestAll.py theDistance,Parameters = ParseParameters(theDistance) anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1) @@ -2315,10 +5387,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject The object to be rotated. # @param theAxis Rotation axis. # @param theAngle Rotation angle in radians. - # @return Rotated GEOM_Object. + # @return New GEOM.GEOM_Object, containing the rotated object. # # @ref tui_rotation "Example" def Rotate(self,theObject, theAxis, theAngle): + """ + Rotate the given object around the given axis on the given angle. + + Parameters: + theObject The object to be rotated. + theAxis Rotation axis. + theAngle Rotation angle in radians. + + Returns: + New GEOM.GEOM_Object, containing the rotated object. + """ # Example: see GEOM_TestAll.py flag = False if isinstance(theAngle,str): @@ -2336,10 +5419,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject The object to be rotated. # @param theAxis Rotation axis. # @param theAngle Rotation angle in radians. - # @return New GEOM_Object, containing the rotated object. + # @return New GEOM.GEOM_Object, containing the rotated object. # # @ref tui_rotation "Example" def MakeRotation(self,theObject, theAxis, theAngle): + """ + Rotate the given object around the given axis + on the given angle, creating its copy before the rotatation. + + Parameters: + theObject The object to be rotated. + theAxis Rotation axis. + theAngle Rotation angle in radians. + + Returns: + New GEOM.GEOM_Object, containing the rotated object. + """ # Example: see GEOM_TestAll.py flag = False if isinstance(theAngle,str): @@ -2355,13 +5450,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Rotate given object around vector perpendicular to plane # containing three points, creating its copy before the rotatation. # @param theObject The object to be rotated. - # @param theCentPoint central point - the axis is the vector perpendicular to the plane + # @param theCentPoint central point the axis is the vector perpendicular to the plane # containing the three points. - # @param thePoint1,thePoint2 - in a perpendicular plane of the axis. - # @return New GEOM_Object, containing the rotated object. + # @param thePoint1,thePoint2 in a perpendicular plane of the axis. + # @return New GEOM.GEOM_Object, containing the rotated object. # # @ref tui_rotation "Example" def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2): + """ + Rotate given object around vector perpendicular to plane + containing three points, creating its copy before the rotatation. + + Parameters: + theObject The object to be rotated. + theCentPoint central point the axis is the vector perpendicular to the plane + containing the three points. + thePoint1,thePoint2 in a perpendicular plane of the axis. + + Returns: + New GEOM.GEOM_Object, containing the rotated object. + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2) RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp) @@ -2372,10 +5480,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePoint Center point for scaling. # Passing None for it means scaling relatively the origin of global CS. # @param theFactor Scaling factor value. - # @return New GEOM_Object, containing the scaled shape. + # @return New GEOM.GEOM_Object, containing the scaled shape. # # @ref tui_scale "Example" def MakeScaleTransform(self, theObject, thePoint, theFactor): + """ + Scale the given object by the factor, creating its copy before the scaling. + + Parameters: + theObject The object to be scaled. + thePoint Center point for scaling. + Passing None for it means scaling relatively the origin of global CS. + theFactor Scaling factor value. + + Returns: + New GEOM.GEOM_Object, containing the scaled shape. + """ # Example: see GEOM_TestAll.py theFactor, Parameters = ParseParameters(theFactor) anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor) @@ -2389,10 +5509,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param thePoint Center point for scaling. # Passing None for it means scaling relatively the origin of global CS. # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis. - # @return New GEOM_Object, containing the scaled shape. + # @return New GEOM.GEOM_Object, containing the scaled shape. # # @ref swig_scale "Example" def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ): + """ + Scale the given object by different factors along coordinate axes, + creating its copy before the scaling. + + Parameters: + theObject The object to be scaled. + thePoint Center point for scaling. + Passing None for it means scaling relatively the origin of global CS. + theFactorX,theFactorY,theFactorZ Scaling factors along each axis. + + Returns: + New GEOM.GEOM_Object, containing the scaled shape. + """ # Example: see GEOM_TestAll.py theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ) anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint, @@ -2405,10 +5538,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): # to the given one relatively the given plane. # @param theObject The object to be mirrored. # @param thePlane Plane of symmetry. - # @return New GEOM_Object, containing the mirrored shape. + # @return New GEOM.GEOM_Object, containing the mirrored shape. # # @ref tui_mirror "Example" def MakeMirrorByPlane(self,theObject, thePlane): + """ + Create an object, symmetrical to the given one relatively the given plane. + + Parameters: + theObject The object to be mirrored. + thePlane Plane of symmetry. + + Returns: + New GEOM.GEOM_Object, containing the mirrored shape. + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane) RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp) @@ -2418,10 +5561,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): # to the given one relatively the given axis. # @param theObject The object to be mirrored. # @param theAxis Axis of symmetry. - # @return New GEOM_Object, containing the mirrored shape. + # @return New GEOM.GEOM_Object, containing the mirrored shape. # # @ref tui_mirror "Example" def MakeMirrorByAxis(self,theObject, theAxis): + """ + Create an object, symmetrical to the given one relatively the given axis. + + Parameters: + theObject The object to be mirrored. + theAxis Axis of symmetry. + + Returns: + New GEOM.GEOM_Object, containing the mirrored shape. + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis) RaiseIfFailed("MirrorAxisCopy", self.TrsfOp) @@ -2431,10 +5584,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # to the given one relatively the given point. # @param theObject The object to be mirrored. # @param thePoint Point of symmetry. - # @return New GEOM_Object, containing the mirrored shape. + # @return New GEOM.GEOM_Object, containing the mirrored shape. # # @ref tui_mirror "Example" def MakeMirrorByPoint(self,theObject, thePoint): + """ + Create an object, symmetrical + to the given one relatively the given point. + + Parameters: + theObject The object to be mirrored. + thePoint Point of symmetry. + + Returns: + New GEOM.GEOM_Object, containing the mirrored shape. + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint) RaiseIfFailed("MirrorPointCopy", self.TrsfOp) @@ -2443,16 +5607,38 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Modify the Location of the given object by LCS, # creating its copy before the setting. # @param theObject The object to be displaced. - # @param theStartLCS Coordinate system to perform displacement from it. + # @param theStartLCS Coordinate system to perform displacement from it.\n # If \a theStartLCS is NULL, displacement - # will be performed from global CS. + # will be performed from global CS.\n # If \a theObject itself is used as \a theStartLCS, # its location will be changed to \a theEndLCS. # @param theEndLCS Coordinate system to perform displacement to it. - # @return New GEOM_Object, containing the displaced shape. + # @return New GEOM.GEOM_Object, containing the displaced shape. # # @ref tui_modify_location "Example" def MakePosition(self,theObject, theStartLCS, theEndLCS): + """ + Modify the Location of the given object by LCS, creating its copy before the setting. + + Parameters: + theObject The object to be displaced. + theStartLCS Coordinate system to perform displacement from it. + If theStartLCS is NULL, displacement + will be performed from global CS. + If theObject itself is used as theStartLCS, + its location will be changed to theEndLCS. + theEndLCS Coordinate system to perform displacement to it. + + Returns: + New GEOM.GEOM_Object, containing the displaced shape. + + Example of usage: + # create local coordinate systems + cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0) + cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0) + # modify the location of the given object + position = geompy.MakePosition(cylinder, cs1, cs2) + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS) RaiseIfFailed("PositionShapeCopy", self.TrsfOp) @@ -2461,13 +5647,29 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Modify the Location of the given object by Path, # @param theObject The object to be displaced. # @param thePath Wire or Edge along that the object will be translated. - # @param theDistance progress of Path (0 = start location, 1 = end of path location). - # @param theCopy is to create a copy objects if true. - # @param theReverse - 0 for usual direction, 1 to reverse path direction. - # @return New GEOM_Object, containing the displaced shape. + # @param theDistance progress of Path (0 = start location, 1 = end of path location). + # @param theCopy is to create a copy objects if true. + # @param theReverse 0 - for usual direction, 1 - to reverse path direction. + # @return New GEOM.GEOM_Object, containing the displaced shape. # # @ref tui_modify_location "Example" def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse): + """ + Modify the Location of the given object by Path + + Parameters: + theObject The object to be displaced. + thePath Wire or Edge along that the object will be translated. + theDistance progress of Path (0 = start location, 1 = end of path location). + theCopy is to create a copy objects if true. + theReverse 0 - for usual direction, 1 - to reverse path direction. + + Returns: + New GEOM.GEOM_Object, containing the displaced shape. + + Example of usage: + position = geompy.PositionAlongPath(cylinder, circle, 0.75, 1, 1) + """ # Example: see GEOM_TestAll.py anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse) RaiseIfFailed("PositionAlongPath", self.TrsfOp) @@ -2476,10 +5678,25 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create new object as offset of the given one. # @param theObject The base object for the offset. # @param theOffset Offset value. - # @return New GEOM_Object, containing the offset object. + # @return New GEOM.GEOM_Object, containing the offset object. # # @ref tui_offset "Example" def MakeOffset(self,theObject, theOffset): + """ + Create new object as offset of the given one. + + Parameters: + theObject The base object for the offset. + theOffset Offset value. + + Returns: + New GEOM.GEOM_Object, containing the offset object. + + Example of usage: + box = geompy.MakeBox(20, 20, 20, 200, 200, 200) + # create a new object as offset of the given object + offset = geompy.MakeOffset(box, 70.) + """ # Example: see GEOM_TestAll.py theOffset, Parameters = ParseParameters(theOffset) anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset) @@ -2487,6 +5704,28 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj + ## Create new object as projection of the given one on a 2D surface. + # @param theSource The source object for the projection. It can be a point, edge or wire. + # @param theTarget The target object. It can be planar or cylindrical face. + # @return New GEOM.GEOM_Object, containing the projection. + # + # @ref tui_projection "Example" + def MakeProjection(self, theSource, theTarget): + """ + Create new object as projection of the given one on a 2D surface. + + Parameters: + theSource The source object for the projection. It can be a point, edge or wire. + theTarget The target object. It can be planar or cylindrical face. + + Returns: + New GEOM.GEOM_Object, containing the projection. + """ + # Example: see GEOM_TestAll.py + anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget) + RaiseIfFailed("ProjectShapeCopy", self.TrsfOp) + return anObj + # ----------------------------------------------------------------------------- # Patterns # ----------------------------------------------------------------------------- @@ -2496,11 +5735,27 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theVector Direction of the translation. # @param theStep Distance to translate on. # @param theNbTimes Quantity of translations to be done. - # @return New GEOM_Object, containing compound of all + # @return New GEOM.GEOM_Object, containing compound of all # the shapes, obtained after each translation. # # @ref tui_multi_translation "Example" def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes): + """ + Translate the given object along the given vector a given number times + + Parameters: + theObject The object to be translated. + theVector Direction of the translation. + theStep Distance to translate on. + theNbTimes Quantity of translations to be done. + + Returns: + New GEOM.GEOM_Object, containing compound of all + the shapes, obtained after each translation. + + Example of usage: + r1d = geompy.MakeMultiTranslation1D(prism, vect, 20, 4) + """ # Example: see GEOM_TestAll.py theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes) anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes) @@ -2516,12 +5771,31 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theVector2 Direction of the second translation. # @param theStep2 Step of the second translation. # @param theNbTimes2 Quantity of translations to be done along theVector2. - # @return New GEOM_Object, containing compound of all + # @return New GEOM.GEOM_Object, containing compound of all # the shapes, obtained after each translation. # # @ref tui_multi_translation "Example" def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1, theVector2, theStep2, theNbTimes2): + """ + Conseqently apply two specified translations to theObject specified number of times. + + Parameters: + theObject The object to be translated. + theVector1 Direction of the first translation. + theStep1 Step of the first translation. + theNbTimes1 Quantity of translations to be done along theVector1. + theVector2 Direction of the second translation. + theStep2 Step of the second translation. + theNbTimes2 Quantity of translations to be done along theVector2. + + Returns: + New GEOM.GEOM_Object, containing compound of all + the shapes, obtained after each translation. + + Example of usage: + tr2d = geompy.MakeMultiTranslation2D(prism, vect1, 20, 4, vect2, 80, 3) + """ # Example: see GEOM_TestAll.py theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2) anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1, @@ -2535,11 +5809,27 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theObject The object to be rotated. # @param theAxis The rotation axis. # @param theNbTimes Quantity of rotations to be done. - # @return New GEOM_Object, containing compound of all the + # @return New GEOM.GEOM_Object, containing compound of all the # shapes, obtained after each rotation. # # @ref tui_multi_rotation "Example" def MultiRotate1D(self,theObject, theAxis, theNbTimes): + """ + Rotate the given object around the given axis a given number times. + Rotation angle will be 2*PI/theNbTimes. + + Parameters: + theObject The object to be rotated. + theAxis The rotation axis. + theNbTimes Quantity of rotations to be done. + + Returns: + New GEOM.GEOM_Object, containing compound of all the + shapes, obtained after each rotation. + + Example of usage: + rot1d = geompy.MultiRotate1D(prism, vect, 4) + """ # Example: see GEOM_TestAll.py theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes) anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes) @@ -2558,11 +5848,33 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theNbTimes1 Quantity of rotations to be done. # @param theStep Translation distance. # @param theNbTimes2 Quantity of translations to be done. - # @return New GEOM_Object, containing compound of all the + # @return New GEOM.GEOM_Object, containing compound of all the # shapes, obtained after each transformation. # # @ref tui_multi_rotation "Example" def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2): + """ + Rotate the given object around the + given axis on the given angle a given number + times and multi-translate each rotation result. + Translation direction passes through center of gravity + of rotated shape and its projection on the rotation axis. + + Parameters: + theObject The object to be rotated. + theAxis Rotation axis. + theAngle Rotation angle in graduces. + theNbTimes1 Quantity of rotations to be done. + theStep Translation distance. + theNbTimes2 Quantity of translations to be done. + + Returns: + New GEOM.GEOM_Object, containing compound of all the + shapes, obtained after each transformation. + + Example of usage: + rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5) + """ # Example: see GEOM_TestAll.py theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2) anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2) @@ -2571,16 +5883,34 @@ class geompyDC(GEOM._objref_GEOM_Gen): return anObj ## The same, as MultiRotate1D(), but axis is given by direction and point + # # @ref swig_MakeMultiRotation "Example" def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes): + """ + The same, as geompy.MultiRotate1D, but axis is given by direction and point + + Example of usage: + pz = geompy.MakeVertex(0, 0, 100) + vy = geompy.MakeVectorDXDYDZ(0, 100, 0) + MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6) + """ # Example: see GEOM_TestOthers.py aVec = self.MakeLine(aPoint,aDir) anObj = self.MultiRotate1D(aShape,aVec,aNbTimes) return anObj ## The same, as MultiRotate2D(), but axis is given by direction and point + # # @ref swig_MakeMultiRotation "Example" def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2): + """ + The same, as MultiRotate2D(), but axis is given by direction and point + + Example of usage: + pz = geompy.MakeVertex(0, 0, 100) + vy = geompy.MakeVectorDXDYDZ(0, 100, 0) + MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3) + """ # Example: see GEOM_TestOthers.py aVec = self.MakeLine(aPoint,aDir) anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2) @@ -2595,11 +5925,24 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Perform a fillet on all edges of the given shape. # @param theShape Shape, to perform fillet on. # @param theR Fillet radius. - # @return New GEOM_Object, containing the result shape. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_fillet "Example 1" # \n @ref swig_MakeFilletAll "Example 2" def MakeFilletAll(self,theShape, theR): + """ + Perform a fillet on all edges of the given shape. + + Parameters: + theShape Shape, to perform fillet on. + theR Fillet radius. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + Example of usage: + filletall = geompy.MakeFilletAll(prism, 10.) + """ # Example: see GEOM_TestOthers.py theR,Parameters = ParseParameters(theR) anObj = self.LocalOp.MakeFilletAll(theShape, theR) @@ -2610,13 +5953,38 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Perform a fillet on the specified edges/faces of the given shape # @param theShape Shape, to perform fillet on. # @param theR Fillet radius. - # @param theShapeType Type of shapes in theListShapes. + # @param theShapeType Type of shapes in theListShapes (see ShapeType()) # @param theListShapes Global indices of edges/faces to perform fillet on. - # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). - # @return New GEOM_Object, containing the result shape. + # \note Global index of sub-shape can be obtained, using method GetSubShapeID(). + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_fillet "Example" def MakeFillet(self,theShape, theR, theShapeType, theListShapes): + """ + Perform a fillet on the specified edges/faces of the given shape + + Parameters: + theShape Shape, to perform fillet on. + theR Fillet radius. + theShapeType Type of shapes in theListShapes (see geompy.ShapeTypes) + theListShapes Global indices of edges/faces to perform fillet on. + + Note: + Global index of sub-shape can be obtained, using method geompy.GetSubShapeID + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + Example of usage: + # get the list of IDs (IDList) for the fillet + prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"]) + IDlist_e = [] + IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0])) + IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1])) + IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2])) + # make a fillet on the specified edges of the given shape + fillet = geompy.MakeFillet(prism, 10., geompy.ShapeType["EDGE"], IDlist_e) + """ # Example: see GEOM_TestAll.py theR,Parameters = ParseParameters(theR) anObj = None @@ -2629,8 +5997,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj - ## The same that MakeFillet but with two Fillet Radius R1 and R2 + ## The same that MakeFillet() but with two Fillet Radius R1 and R2 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes): + """ + The same that geompy.MakeFillet but with two Fillet Radius R1 and R2 + + Example of usage: + # get the list of IDs (IDList) for the fillet + prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"]) + IDlist_e = [] + IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0])) + IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1])) + IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2])) + # make a fillet on the specified edges of the given shape + fillet = geompy.MakeFillet(prism, 10., 15., geompy.ShapeType["EDGE"], IDlist_e) + """ theR1,theR2,Parameters = ParseParameters(theR1,theR2) anObj = None if theShapeType == ShapeType["EDGE"]: @@ -2641,29 +6022,112 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp) anObj.SetParameters(Parameters) return anObj - - ## Perform a fillet on the specified edges/faces of the given shape - # @param theShape - Face Shape to perform fillet on. - # @param theR - Fillet radius. + + ## Perform a fillet on the specified edges of the given shape + # @param theShape Wire Shape to perform fillet on. + # @param theR Fillet radius. + # @param theListOfVertexes Global indices of vertexes to perform fillet on. + # \note Global index of sub-shape can be obtained, using method GetSubShapeID() + # \note The list of vertices could be empty, + # in this case fillet will done done at all vertices in wire + # @param doIgnoreSecantVertices If FALSE, fillet radius is always limited + # by the length of the edges, nearest to the fillet vertex. + # But sometimes the next edge is C1 continuous with the one, nearest to + # the fillet point, and such two (or more) edges can be united to allow + # bigger radius. Set this flag to TRUE to allow collinear edges union, + # thus ignoring the secant vertex (vertices). + # @return New GEOM.GEOM_Object, containing the result shape. + # + # @ref tui_fillet2d "Example" + def MakeFillet1D(self,theShape, theR, theListOfVertexes, doIgnoreSecantVertices = True): + """ + Perform a fillet on the specified edges of the given shape + + Parameters: + theShape Wire Shape to perform fillet on. + theR Fillet radius. + theListOfVertexes Global indices of vertexes to perform fillet on. + doIgnoreSecantVertices If FALSE, fillet radius is always limited + by the length of the edges, nearest to the fillet vertex. + But sometimes the next edge is C1 continuous with the one, nearest to + the fillet point, and such two (or more) edges can be united to allow + bigger radius. Set this flag to TRUE to allow collinear edges union, + thus ignoring the secant vertex (vertices). + Note: + Global index of sub-shape can be obtained, using method geompy.GetSubShapeID + + The list of vertices could be empty,in this case fillet will done done at all vertices in wire + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + Example of usage: + # create wire + Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4]) + # make fillet at given wire vertices with giver radius + Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10]) + """ + # Example: see GEOM_TestAll.py + theR,doIgnoreSecantVertices,Parameters = ParseParameters(theR,doIgnoreSecantVertices) + anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes, doIgnoreSecantVertices) + RaiseIfFailed("MakeFillet1D", self.LocalOp) + anObj.SetParameters(Parameters) + return anObj + + ## Perform a fillet at the specified vertices of the given face/shell. + # @param theShape Face or Shell shape to perform fillet on. + # @param theR Fillet radius. # @param theListOfVertexes Global indices of vertexes to perform fillet on. - # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). - # @return New GEOM_Object, containing the result shape. + # \note Global index of sub-shape can be obtained, using method GetSubShapeID(). + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_fillet2d "Example" - def MakeFillet2D(self,theShape, theR, theListOfVertexes): + def MakeFillet2D(self, theShape, theR, theListOfVertexes): + """ + Perform a fillet at the specified vertices of the given face/shell. + + Parameters: + theShape Face or Shell shape to perform fillet on. + theR Fillet radius. + theListOfVertexes Global indices of vertexes to perform fillet on. + Note: + Global index of sub-shape can be obtained, using method geompy.GetSubShapeID + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + Example of usage: + face = geompy.MakeFaceHW(100, 100, 1) + fillet2d = geompy.MakeFillet2D(face, 30, [7, 9]) + """ # Example: see GEOM_TestAll.py + theR,Parameters = ParseParameters(theR) anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes) RaiseIfFailed("MakeFillet2D", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## Perform a symmetric chamfer on all edges of the given shape. # @param theShape Shape, to perform chamfer on. # @param theD Chamfer size along each face. - # @return New GEOM_Object, containing the result shape. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_chamfer "Example 1" # \n @ref swig_MakeChamferAll "Example 2" def MakeChamferAll(self,theShape, theD): + """ + Perform a symmetric chamfer on all edges of the given shape. + + Parameters: + theShape Shape, to perform chamfer on. + theD Chamfer size along each face. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + Example of usage: + chamfer_all = geompy.MakeChamferAll(prism, 10.) + """ # Example: see GEOM_TestOthers.py theD,Parameters = ParseParameters(theD) anObj = self.LocalOp.MakeChamferAll(theShape, theD) @@ -2677,11 +6141,33 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theD1 Chamfer size along \a theFace1. # @param theD2 Chamfer size along \a theFace2. # @param theFace1,theFace2 Global indices of two faces of \a theShape. - # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). - # @return New GEOM_Object, containing the result shape. + # \note Global index of sub-shape can be obtained, using method GetSubShapeID(). + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_chamfer "Example" def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2): + """ + Perform a chamfer on edges, common to the specified faces, + with distance D1 on the Face1 + + Parameters: + theShape Shape, to perform chamfer on. + theD1 Chamfer size along theFace1. + theD2 Chamfer size along theFace2. + theFace1,theFace2 Global indices of two faces of theShape. + + Note: + Global index of sub-shape can be obtained, using method geompy.GetSubShapeID + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + Example of usage: + prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"]) + f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0]) + f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1]) + chamfer_e = geompy.MakeChamferEdge(prism, 10., 10., f_ind_1, f_ind_2) + """ # Example: see GEOM_TestAll.py theD1,theD2,Parameters = ParseParameters(theD1,theD2) anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2) @@ -2689,9 +6175,36 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj - ## The Same that MakeChamferEdge but with params theD is chamfer length and - # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) + ## Perform a chamfer on edges + # @param theShape Shape, to perform chamfer on. + # @param theD Chamfer length + # @param theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) + # @param theFace1,theFace2 Global indices of two faces of \a theShape. + # \note Global index of sub-shape can be obtained, using method GetSubShapeID(). + # @return New GEOM.GEOM_Object, containing the result shape. def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2): + """ + Perform a chamfer on edges + + Parameters: + theShape Shape, to perform chamfer on. + theD1 Chamfer size along theFace1. + theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees). + theFace1,theFace2 Global indices of two faces of theShape. + + Note: + Global index of sub-shape can be obtained, using method geompy.GetSubShapeID + + Returns: + New GEOM.GEOM_Object, containing the result shape. + + Example of usage: + prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"]) + f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0]) + f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1]) + ang = 30 + chamfer_e = geompy.MakeChamferEdge(prism, 10., ang, f_ind_1, f_ind_2) + """ flag = False if isinstance(theAngle,str): flag = True @@ -2711,11 +6224,29 @@ class geompyDC(GEOM._objref_GEOM_Gen): # will be get along face, which is nearer to \a theFaces beginning. # @param theD2 Chamfer size along another of two faces, connected to the edge. # @param theFaces Sequence of global indices of faces of \a theShape. - # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). - # @return New GEOM_Object, containing the result shape. + # \note Global index of sub-shape can be obtained, using method GetSubShapeID(). + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_chamfer "Example" def MakeChamferFaces(self,theShape, theD1, theD2, theFaces): + """ + Perform a chamfer on all edges of the specified faces, + with distance D1 on the first specified face (if several for one edge) + + Parameters: + theShape Shape, to perform chamfer on. + theD1 Chamfer size along face from theFaces. If both faces, + connected to the edge, are in theFaces, theD1 + will be get along face, which is nearer to theFaces beginning. + theD2 Chamfer size along another of two faces, connected to the edge. + theFaces Sequence of global indices of faces of theShape. + + + Note: Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). + + Returns: + New GEOM.GEOM_Object, containing the result shape. + """ # Example: see GEOM_TestAll.py theD1,theD2,Parameters = ParseParameters(theD1,theD2) anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces) @@ -2723,11 +6254,15 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj - ## The Same that MakeChamferFaces but with params theD is chamfer lenght and + ## The Same that MakeChamferFaces() but with params theD is chamfer lenght and # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) # # @ref swig_FilletChamfer "Example" def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces): + """ + The Same that geompy.MakeChamferFaces but with params theD is chamfer lenght and + theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) + """ flag = False if isinstance(theAngle,str): flag = True @@ -2744,19 +6279,35 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theShape Shape, to perform chamfer on. # @param theD1,theD2 Chamfer size # @param theEdges Sequence of edges of \a theShape. - # @return New GEOM_Object, containing the result shape. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref swig_FilletChamfer "Example" def MakeChamferEdges(self, theShape, theD1, theD2, theEdges): + """ + Perform a chamfer on edges, + with distance D1 on the first specified face (if several for one edge) + + Parameters: + theShape Shape, to perform chamfer on. + theD1,theD2 Chamfer size + theEdges Sequence of edges of theShape. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + """ theD1,theD2,Parameters = ParseParameters(theD1,theD2) anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges) RaiseIfFailed("MakeChamferEdges", self.LocalOp) anObj.SetParameters(Parameters) return anObj - ## The Same that MakeChamferEdges but with params theD is chamfer lenght and + ## The Same that MakeChamferEdges() but with params theD is chamfer lenght and # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges): + """ + The Same that geompy.MakeChamferEdges but with params theD is chamfer lenght and + theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) + """ flag = False if isinstance(theAngle,str): flag = True @@ -2768,10 +6319,13 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) return anObj - ## Shortcut to MakeChamferEdge() and MakeChamferFaces() + ## /sa MakeChamferEdge() and MakeChamferFaces() # # @ref swig_MakeChamfer "Example" def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape): + """ + See geompy.MakeChamferEdge() and geompy.MakeChamferFaces() functions for more information. + """ # Example: see GEOM_TestOthers.py anObj = None if aShapeType == ShapeType["EDGE"]: @@ -2779,6 +6333,64 @@ class geompyDC(GEOM._objref_GEOM_Gen): else: anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape) return anObj + + ## Remove material from a solid by extrusion of the base shape on the given distance. + # @param theInit Shape to remove material from. It must be a solid or + # a compound made of a single solid. + # @param theBase Closed edge or wire defining the base shape to be extruded. + # @param theH Prism dimension along the normal to theBase + # @param theAngle Draft angle in degrees. + # @return New GEOM.GEOM_Object, containing the initial shape with removed material + # + # @ref tui_creation_prism "Example" + def MakeExtrudedCut(self, theInit, theBase, theH, theAngle): + """ + Add material to a solid by extrusion of the base shape on the given distance. + + Parameters: + theInit Shape to remove material from. It must be a solid or a compound made of a single solid. + theBase Closed edge or wire defining the base shape to be extruded. + theH Prism dimension along the normal to theBase + theAngle Draft angle in degrees. + + Returns: + New GEOM.GEOM_Object, containing the initial shape with removed material. + """ + # Example: see GEOM_TestAll.py + #theH,Parameters = ParseParameters(theH) + anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False) + RaiseIfFailed("MakeExtrudedBoss", self.PrimOp) + #anObj.SetParameters(Parameters) + return anObj + + ## Add material to a solid by extrusion of the base shape on the given distance. + # @param theInit Shape to add material to. It must be a solid or + # a compound made of a single solid. + # @param theBase Closed edge or wire defining the base shape to be extruded. + # @param theH Prism dimension along the normal to theBase + # @param theAngle Draft angle in degrees. + # @return New GEOM.GEOM_Object, containing the initial shape with added material + # + # @ref tui_creation_prism "Example" + def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle): + """ + Add material to a solid by extrusion of the base shape on the given distance. + + Parameters: + theInit Shape to add material to. It must be a solid or a compound made of a single solid. + theBase Closed edge or wire defining the base shape to be extruded. + theH Prism dimension along the normal to theBase + theAngle Draft angle in degrees. + + Returns: + New GEOM.GEOM_Object, containing the initial shape with added material. + """ + # Example: see GEOM_TestAll.py + #theH,Parameters = ParseParameters(theH) + anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True) + RaiseIfFailed("MakeExtrudedBoss", self.PrimOp) + #anObj.SetParameters(Parameters) + return anObj # end of l3_local ## @} @@ -2792,11 +6404,25 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theWeight Weight og the shape. # @param theWaterDensity Density of the water. # @param theMeshDeflection Deflection of the mesh, using to compute the section. - # @return New GEOM_Object, containing a section of \a theShape + # @return New GEOM.GEOM_Object, containing a section of \a theShape # by a plane, corresponding to water level. # # @ref tui_archimede "Example" def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection): + """ + Perform an Archimde operation on the given shape with given parameters. + The object presenting the resulting face is returned. + + Parameters: + theShape Shape to be put in water. + theWeight Weight og the shape. + theWaterDensity Density of the water. + theMeshDeflection Deflection of the mesh, using to compute the section. + + Returns: + New GEOM.GEOM_Object, containing a section of theShape + by a plane, corresponding to water level. + """ # Example: see GEOM_TestAll.py theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters( theWeight,theWaterDensity,theMeshDeflection) @@ -2816,6 +6442,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref tui_measurement_tools_page "Example" def PointCoordinates(self,Point): + """ + Get point coordinates + + Returns: + [x, y, z] + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.PointCoordinates(Point) RaiseIfFailed("PointCoordinates", self.MeasuOp) @@ -2824,13 +6456,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Get summarized length of all wires, # area of surface and volume of the given shape. # @param theShape Shape to define properties of. - # @return [theLength, theSurfArea, theVolume] - # theLength: Summarized length of all wires of the given shape. - # theSurfArea: Area of surface of the given shape. + # @return [theLength, theSurfArea, theVolume]\n + # theLength: Summarized length of all wires of the given shape.\n + # theSurfArea: Area of surface of the given shape.\n # theVolume: Volume of the given shape. # # @ref tui_measurement_tools_page "Example" def BasicProperties(self,theShape): + """ + Get summarized length of all wires, + area of surface and volume of the given shape. + + Parameters: + theShape Shape to define properties of. + + Returns: + [theLength, theSurfArea, theVolume] + theLength: Summarized length of all wires of the given shape. + theSurfArea: Area of surface of the given shape. + theVolume: Volume of the given shape. + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.GetBasicProperties(theShape) RaiseIfFailed("GetBasicProperties", self.MeasuOp) @@ -2845,6 +6490,18 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref tui_measurement_tools_page "Example" def BoundingBox(self,theShape): + """ + Get parameters of bounding box of the given shape + + Parameters: + theShape Shape to obtain bounding box of. + + Returns: + [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax] + Xmin,Xmax: Limits of shape along OX axis. + Ymin,Ymax: Limits of shape along OY axis. + Zmin,Zmax: Limits of shape along OZ axis. + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.GetBoundingBox(theShape) RaiseIfFailed("GetBoundingBox", self.MeasuOp) @@ -2858,17 +6515,56 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref tui_measurement_tools_page "Example" def Inertia(self,theShape): + """ + Get inertia matrix and moments of inertia of theShape. + + Parameters: + theShape Shape to calculate inertia of. + + Returns: + [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz] + I(1-3)(1-3): Components of the inertia matrix of the given shape. + Ix,Iy,Iz: Moments of inertia of the given shape. + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.GetInertia(theShape) RaiseIfFailed("GetInertia", self.MeasuOp) return aTuple + ## Get if coords are included in the shape (ST_IN or ST_ON) + # @param theShape Shape + # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...] + # @param tolerance to be used (default is 1.0e-7) + # @return list_of_boolean = [res1, res2, ...] + def AreCoordsInside(self, theShape, coords, tolerance=1.e-7): + """ + Get if coords are included in the shape (ST_IN or ST_ON) + + Parameters: + theShape Shape + coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...] + tolerance to be used (default is 1.0e-7) + + Returns: + list_of_boolean = [res1, res2, ...] + """ + return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance) + ## Get minimal distance between the given shapes. # @param theShape1,theShape2 Shapes to find minimal distance between. # @return Value of the minimal distance between the given shapes. # # @ref tui_measurement_tools_page "Example" def MinDistance(self, theShape1, theShape2): + """ + Get minimal distance between the given shapes. + + Parameters: + theShape1,theShape2 Shapes to find minimal distance between. + + Returns: + Value of the minimal distance between the given shapes. + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2) RaiseIfFailed("GetMinDistance", self.MeasuOp) @@ -2880,6 +6576,15 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_all_measure "Example" def MinDistanceComponents(self, theShape1, theShape2): + """ + Get minimal distance between the given shapes. + + Parameters: + theShape1,theShape2 Shapes to find minimal distance between. + + Returns: + Value of the minimal distance between the given shapes. + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2) RaiseIfFailed("GetMinDistance", self.MeasuOp) @@ -2888,41 +6593,142 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Get angle between the given shapes in degrees. # @param theShape1,theShape2 Lines or linear edges to find angle between. + # @note If both arguments are vectors, the angle is computed in accordance + # with their orientations, otherwise the minimum angle is computed. # @return Value of the angle between the given shapes in degrees. # # @ref tui_measurement_tools_page "Example" def GetAngle(self, theShape1, theShape2): + """ + Get angle between the given shapes in degrees. + + Parameters: + theShape1,theShape2 Lines or linear edges to find angle between. + + Note: + If both arguments are vectors, the angle is computed in accordance + with their orientations, otherwise the minimum angle is computed. + + Returns: + Value of the angle between the given shapes in degrees. + """ # Example: see GEOM_TestMeasures.py anAngle = self.MeasuOp.GetAngle(theShape1, theShape2) RaiseIfFailed("GetAngle", self.MeasuOp) return anAngle + ## Get angle between the given shapes in radians. # @param theShape1,theShape2 Lines or linear edges to find angle between. + # @note If both arguments are vectors, the angle is computed in accordance + # with their orientations, otherwise the minimum angle is computed. # @return Value of the angle between the given shapes in radians. # # @ref tui_measurement_tools_page "Example" def GetAngleRadians(self, theShape1, theShape2): + """ + Get angle between the given shapes in radians. + + Parameters: + theShape1,theShape2 Lines or linear edges to find angle between. + + + Note: + If both arguments are vectors, the angle is computed in accordance + with their orientations, otherwise the minimum angle is computed. + + Returns: + Value of the angle between the given shapes in radians. + """ # Example: see GEOM_TestMeasures.py anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180. RaiseIfFailed("GetAngle", self.MeasuOp) return anAngle + ## Get angle between the given vectors in degrees. + # @param theShape1,theShape2 Vectors to find angle between. + # @param theFlag If True, the normal vector is defined by the two vectors cross, + # if False, the opposite vector to the normal vector is used. + # @return Value of the angle between the given vectors in degrees. + # + # @ref tui_measurement_tools_page "Example" + def GetAngleVectors(self, theShape1, theShape2, theFlag = True): + """ + Get angle between the given vectors in degrees. + + Parameters: + theShape1,theShape2 Vectors to find angle between. + theFlag If True, the normal vector is defined by the two vectors cross, + if False, the opposite vector to the normal vector is used. + + Returns: + Value of the angle between the given vectors in degrees. + """ + anAngle = self.MeasuOp.GetAngleBtwVectors(theShape1, theShape2) + if not theFlag: + anAngle = 360. - anAngle + RaiseIfFailed("GetAngleVectors", self.MeasuOp) + return anAngle + + ## The same as GetAngleVectors, but the result is in radians. + def GetAngleRadiansVectors(self, theShape1, theShape2, theFlag = True): + """ + Get angle between the given vectors in radians. + + Parameters: + theShape1,theShape2 Vectors to find angle between. + theFlag If True, the normal vector is defined by the two vectors cross, + if False, the opposite vector to the normal vector is used. + + Returns: + Value of the angle between the given vectors in radians. + """ + anAngle = self.GetAngleVectors(theShape1, theShape2, theFlag)*math.pi/180. + return anAngle + ## @name Curve Curvature Measurement # Methods for receiving radius of curvature of curves # in the given point ## @{ ## Measure curvature of a curve at a point, set by parameter. + # @param theCurve a curve. + # @param theParam parameter. + # @return radius of curvature of \a theCurve. + # # @ref swig_todo "Example" def CurveCurvatureByParam(self, theCurve, theParam): + """ + Measure curvature of a curve at a point, set by parameter. + + Parameters: + theCurve a curve. + theParam parameter. + + Returns: + radius of curvature of theCurve. + """ # Example: see GEOM_TestMeasures.py aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam) RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp) return aCurv - ## @details + ## Measure curvature of a curve at a point. + # @param theCurve a curve. + # @param thePoint given point. + # @return radius of curvature of \a theCurve. + # # @ref swig_todo "Example" def CurveCurvatureByPoint(self, theCurve, thePoint): + """ + Measure curvature of a curve at a point. + + Parameters: + theCurve a curve. + thePoint given point. + + Returns: + radius of curvature of theCurve. + """ aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint) RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp) return aCurv @@ -2933,31 +6739,91 @@ class geompyDC(GEOM._objref_GEOM_Gen): # in the given point ## @{ - ## @details + ## Measure max radius of curvature of surface. + # @param theSurf the given surface. + # @param theUParam Value of U-parameter on the referenced surface. + # @param theVParam Value of V-parameter on the referenced surface. + # @return max radius of curvature of theSurf. + # ## @ref swig_todo "Example" def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam): + """ + Measure max radius of curvature of surface. + + Parameters: + theSurf the given surface. + theUParam Value of U-parameter on the referenced surface. + theVParam Value of V-parameter on the referenced surface. + + Returns: + max radius of curvature of theSurf. + """ # Example: see GEOM_TestMeasures.py aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam) RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp) return aSurf - ## @details + ## Measure max radius of curvature of surface in the given point + # @param theSurf the given surface. + # @param thePoint given point. + # @return max radius of curvature of theSurf. + # ## @ref swig_todo "Example" def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint): + """ + Measure max radius of curvature of surface in the given point. + + Parameters: + theSurf the given surface. + thePoint given point. + + Returns: + max radius of curvature of theSurf. + """ aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint) RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp) return aSurf - ## @details + ## Measure min radius of curvature of surface. + # @param theSurf the given surface. + # @param theUParam Value of U-parameter on the referenced surface. + # @param theVParam Value of V-parameter on the referenced surface. + # @return min radius of curvature of theSurf. + # ## @ref swig_todo "Example" def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam): + """ + Measure min radius of curvature of surface. + + Parameters: + theSurf the given surface. + theUParam Value of U-parameter on the referenced surface. + theVParam Value of V-parameter on the referenced surface. + + Returns: + Min radius of curvature of theSurf. + """ aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam) RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp) return aSurf - ## @details + ## Measure min radius of curvature of surface in the given point + # @param theSurf the given surface. + # @param thePoint given point. + # @return min radius of curvature of theSurf. + # ## @ref swig_todo "Example" def MinSurfaceCurvatureByPoint(self, theSurf, thePoint): + """ + Measure min radius of curvature of surface in the given point. + + Parameters: + theSurf the given surface. + thePoint given point. + + Returns: + Min radius of curvature of theSurf. + """ aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint) RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp) return aSurf @@ -2965,13 +6831,25 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Get min and max tolerances of sub-shapes of theShape # @param theShape Shape, to get tolerances of. - # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax] - # FaceMin,FaceMax: Min and max tolerances of the faces. - # EdgeMin,EdgeMax: Min and max tolerances of the edges. + # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]\n + # FaceMin,FaceMax: Min and max tolerances of the faces.\n + # EdgeMin,EdgeMax: Min and max tolerances of the edges.\n # VertMin,VertMax: Min and max tolerances of the vertices. # # @ref tui_measurement_tools_page "Example" def Tolerance(self,theShape): + """ + Get min and max tolerances of sub-shapes of theShape + + Parameters: + theShape Shape, to get tolerances of. + + Returns: + [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax] + FaceMin,FaceMax: Min and max tolerances of the faces. + EdgeMin,EdgeMax: Min and max tolerances of the edges. + VertMin,VertMax: Min and max tolerances of the vertices. + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.GetTolerance(theShape) RaiseIfFailed("GetTolerance", self.MeasuOp) @@ -2983,30 +6861,181 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref tui_measurement_tools_page "Example" def WhatIs(self,theShape): + """ + Obtain description of the given shape (number of sub-shapes of each type) + + Parameters: + theShape Shape to be described. + + Returns: + Description of the given shape. + """ # Example: see GEOM_TestMeasures.py aDescr = self.MeasuOp.WhatIs(theShape) RaiseIfFailed("WhatIs", self.MeasuOp) return aDescr + ## Obtain quantity of shapes of the given type in \a theShape. + # If \a theShape is of type \a theType, it is also counted. + # @param theShape Shape to be described. + # @param theType the given ShapeType(). + # @return Quantity of shapes of type \a theType in \a theShape. + # + # @ref tui_measurement_tools_page "Example" + def NbShapes (self, theShape, theType): + """ + Obtain quantity of shapes of the given type in theShape. + If theShape is of type theType, it is also counted. + + Parameters: + theShape Shape to be described. + theType the given geompy.ShapeType + + Returns: + Quantity of shapes of type theType in theShape. + """ + # Example: see GEOM_TestMeasures.py + listSh = self.SubShapeAllIDs(theShape, theType) + Nb = len(listSh) + t = EnumToLong(theShape.GetShapeType()) + theType = EnumToLong(theType) + if t == theType: + Nb = Nb + 1 + pass + return Nb + + ## Obtain quantity of shapes of each type in \a theShape. + # The \a theShape is also counted. + # @param theShape Shape to be described. + # @return Dictionary of ShapeType() with bound quantities of shapes. + # + # @ref tui_measurement_tools_page "Example" + def ShapeInfo (self, theShape): + """ + Obtain quantity of shapes of each type in theShape. + The theShape is also counted. + + Parameters: + theShape Shape to be described. + + Returns: + Dictionary of geompy.ShapeType with bound quantities of shapes. + """ + # Example: see GEOM_TestMeasures.py + aDict = {} + for typeSh in ShapeType: + if typeSh in ( "AUTO", "SHAPE" ): continue + listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh]) + Nb = len(listSh) + if EnumToLong(theShape.GetShapeType()) == ShapeType[typeSh]: + Nb = Nb + 1 + pass + aDict[typeSh] = Nb + pass + return aDict + ## Get a point, situated at the centre of mass of theShape. # @param theShape Shape to define centre of mass of. - # @return New GEOM_Object, containing the created point. + # @return New GEOM.GEOM_Object, containing the created point. # # @ref tui_measurement_tools_page "Example" def MakeCDG(self,theShape): + """ + Get a point, situated at the centre of mass of theShape. + + Parameters: + theShape Shape to define centre of mass of. + + Returns: + New GEOM.GEOM_Object, containing the created point. + """ # Example: see GEOM_TestMeasures.py anObj = self.MeasuOp.GetCentreOfMass(theShape) RaiseIfFailed("GetCentreOfMass", self.MeasuOp) return anObj + ## Get a vertex sub-shape by index depended with orientation. + # @param theShape Shape to find sub-shape. + # @param theIndex Index to find vertex by this index (starting from zero) + # @return New GEOM.GEOM_Object, containing the created vertex. + # + # @ref tui_measurement_tools_page "Example" + def GetVertexByIndex(self,theShape, theIndex): + """ + Get a vertex sub-shape by index depended with orientation. + + Parameters: + theShape Shape to find sub-shape. + theIndex Index to find vertex by this index (starting from zero) + + Returns: + New GEOM.GEOM_Object, containing the created vertex. + """ + # Example: see GEOM_TestMeasures.py + anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex) + RaiseIfFailed("GetVertexByIndex", self.MeasuOp) + return anObj + + ## Get the first vertex of wire/edge depended orientation. + # @param theShape Shape to find first vertex. + # @return New GEOM.GEOM_Object, containing the created vertex. + # + # @ref tui_measurement_tools_page "Example" + def GetFirstVertex(self,theShape): + """ + Get the first vertex of wire/edge depended orientation. + + Parameters: + theShape Shape to find first vertex. + + Returns: + New GEOM.GEOM_Object, containing the created vertex. + """ + # Example: see GEOM_TestMeasures.py + anObj = self.GetVertexByIndex(theShape, 0) + RaiseIfFailed("GetFirstVertex", self.MeasuOp) + return anObj + + ## Get the last vertex of wire/edge depended orientation. + # @param theShape Shape to find last vertex. + # @return New GEOM.GEOM_Object, containing the created vertex. + # + # @ref tui_measurement_tools_page "Example" + def GetLastVertex(self,theShape): + """ + Get the last vertex of wire/edge depended orientation. + + Parameters: + theShape Shape to find last vertex. + + Returns: + New GEOM.GEOM_Object, containing the created vertex. + """ + # Example: see GEOM_TestMeasures.py + nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"]) + anObj = self.GetVertexByIndex(theShape, (nb_vert-1)) + RaiseIfFailed("GetLastVertex", self.MeasuOp) + return anObj + ## Get a normale to the given face. If the point is not given, # the normale is calculated at the center of mass. # @param theFace Face to define normale of. # @param theOptionalPoint Point to compute the normale at. - # @return New GEOM_Object, containing the created vector. + # @return New GEOM.GEOM_Object, containing the created vector. # # @ref swig_todo "Example" def GetNormal(self, theFace, theOptionalPoint = None): + """ + Get a normale to the given face. If the point is not given, + the normale is calculated at the center of mass. + + Parameters: + theFace Face to define normale of. + theOptionalPoint Point to compute the normale at. + + Returns: + New GEOM.GEOM_Object, containing the created vector. + """ # Example: see GEOM_TestMeasures.py anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint) RaiseIfFailed("GetNormal", self.MeasuOp) @@ -3014,13 +7043,33 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Check a topology of the given shape. # @param theShape Shape to check validity of. - # @param theIsCheckGeom If FALSE, only the shape's topology will be checked, + # @param theIsCheckGeom If FALSE, only the shape's topology will be checked, \n # if TRUE, the shape's geometry will be checked also. + # @param theReturnStatus If FALSE and if theShape is invalid, a description \n + # of problem is printed. + # if TRUE and if theShape is invalid, the description + # of problem is also returned. # @return TRUE, if the shape "seems to be valid". - # If theShape is invalid, prints a description of problem. # # @ref tui_measurement_tools_page "Example" - def CheckShape(self,theShape, theIsCheckGeom = 0): + def CheckShape(self,theShape, theIsCheckGeom = 0, theReturnStatus = 0): + """ + Check a topology of the given shape. + + Parameters: + theShape Shape to check validity of. + theIsCheckGeom If FALSE, only the shape's topology will be checked, + if TRUE, the shape's geometry will be checked also. + theReturnStatus If FALSE and if theShape is invalid, a description + of problem is printed. + if TRUE and if theShape is invalid, the description + of problem is returned. + + Returns: + TRUE, if the shape "seems to be valid". + If theShape is invalid, prints a description of problem. + This description can also be returned. + """ # Example: see GEOM_TestMeasures.py if theIsCheckGeom: (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape) @@ -3029,7 +7078,30 @@ class geompyDC(GEOM._objref_GEOM_Gen): (IsValid, Status) = self.MeasuOp.CheckShape(theShape) RaiseIfFailed("CheckShape", self.MeasuOp) if IsValid == 0: - print Status + if theReturnStatus == 0: + print Status + if theReturnStatus == 1: + return (IsValid, Status) + return IsValid + + ## Detect self-intersections in the given shape. + # @param theShape Shape to check. + # @return TRUE, if the shape contains no self-intersections. + # + # @ref tui_measurement_tools_page "Example" + def CheckSelfIntersections(self, theShape): + """ + Detect self-intersections in the given shape. + + Parameters: + theShape Shape to check. + + Returns: + TRUE, if the shape contains no self-intersections. + """ + # Example: see GEOM_TestMeasures.py + (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape) + RaiseIfFailed("CheckSelfIntersections", self.MeasuOp) return IsValid ## Get position (LCS) of theShape. @@ -3046,6 +7118,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_todo "Example" def GetPosition(self,theShape): + """ + Get position (LCS) of theShape. + Origin of the LCS is situated at the shape's center of mass. + Axes of the LCS are obtained from shape's location or, + if the shape is a planar face, from position of its plane. + + Parameters: + theShape Shape to calculate position of. + + Returns: + [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz]. + Ox,Oy,Oz: Coordinates of shape's LCS origin. + Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction. + Xx,Xy,Xz: Coordinates of shape's LCS X direction. + """ # Example: see GEOM_TestMeasures.py aTuple = self.MeasuOp.GetPosition(theShape) RaiseIfFailed("GetPosition", self.MeasuOp) @@ -3054,53 +7141,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Get kind of theShape. # # @param theShape Shape to get a kind of. - # @return Returns a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration + # @return Returns a kind of shape in terms of GEOM.GEOM_IKindOfShape.shape_kind enumeration # and a list of parameters, describing the shape. # @note Concrete meaning of each value, returned via \a theIntegers - # or \a theDoubles list depends on the kind of the shape. - # The full list of possible outputs is: - # - # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices - # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices - # - # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices - # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices - # - # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices - # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices - # - # - geompy.kind.SPHERE xc yc zc R - # - geompy.kind.CYLINDER xb yb zb dx dy dz R H - # - geompy.kind.BOX xc yc zc ax ay az - # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az - # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2 - # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H - # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices - # - geompy.kind.SOLID nb_faces nb_edges nb_vertices - # - # - geompy.kind.SPHERE2D xc yc zc R - # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H - # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2 - # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H - # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R - # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2 - # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices - # - geompy.kind.PLANE xo yo zo dx dy dz - # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices - # - geompy.kind.FACE nb_edges nb_vertices - # - # - geompy.kind.CIRCLE xc yc zc dx dy dz R - # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2 - # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2 - # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2 - # - geompy.kind.LINE xo yo zo dx dy dz - # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2 - # - geompy.kind.EDGE nb_vertices - # - # - geompy.kind.VERTEX x y z + # or \a theDoubles list depends on the kind() of the shape. # # @ref swig_todo "Example" def KindOfShape(self,theShape): + """ + Get kind of theShape. + + Parameters: + theShape Shape to get a kind of. + + Returns: + a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration + and a list of parameters, describing the shape. + Note: + Concrete meaning of each value, returned via theIntegers + or theDoubles list depends on the geompy.kind of the shape + """ # Example: see GEOM_TestMeasures.py aRoughTuple = self.MeasuOp.KindOfShape(theShape) RaiseIfFailed("KindOfShape", self.MeasuOp) @@ -3131,35 +7191,94 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theFileName The file, containing the shape. # @param theFormatName Specify format for the file reading. # Available formats can be obtained with InsertOp.ImportTranslators() method. - # @return New GEOM_Object, containing the imported shape. + # If format 'IGES_SCALE' is used instead 'IGES' length unit will be + # set to 'meter' and result model will be scaled. + # @return New GEOM.GEOM_Object, containing the imported shape. # # @ref swig_Import_Export "Example" - def Import(self,theFileName, theFormatName): + def ImportFile(self,theFileName, theFormatName): + """ + Import a shape from the BREP or IGES or STEP file + (depends on given format) with given name. + + Parameters: + theFileName The file, containing the shape. + theFormatName Specify format for the file reading. + Available formats can be obtained with geompy.InsertOp.ImportTranslators() method. + If format 'IGES_SCALE' is used instead 'IGES' length unit will be + set to 'meter' and result model will be scaled. + + Returns: + New GEOM.GEOM_Object, containing the imported shape. + """ # Example: see GEOM_TestOthers.py - anObj = self.InsertOp.Import(theFileName, theFormatName) + anObj = self.InsertOp.ImportFile(theFileName, theFormatName) + RaiseIfFailed("Import", self.InsertOp) + return anObj + + ## Deprecated analog of ImportFile() + def Import(self,theFileName, theFormatName): + """ + Deprecated analog of geompy.ImportFile + """ + print "WARNING: Function Import is deprecated, use ImportFile instead" + anObj = self.InsertOp.ImportFile(theFileName, theFormatName) RaiseIfFailed("Import", self.InsertOp) return anObj - ## Shortcut to Import() for BREP format + ## Shortcut to ImportFile() for BREP format # # @ref swig_Import_Export "Example" def ImportBREP(self,theFileName): + """ + geompy.ImportFile(...) function for BREP format + """ # Example: see GEOM_TestOthers.py - return self.Import(theFileName, "BREP") + return self.ImportFile(theFileName, "BREP") - ## Shortcut to Import() for IGES format + ## Shortcut to ImportFile() for IGES format # # @ref swig_Import_Export "Example" def ImportIGES(self,theFileName): + """ + geompy.ImportFile(...) function for IGES format + """ + # Example: see GEOM_TestOthers.py + return self.ImportFile(theFileName, "IGES") + + ## Return length unit from given IGES file + # + # @ref swig_Import_Export "Example" + def GetIGESUnit(self,theFileName): + """ + Return length unit from given IGES file + """ # Example: see GEOM_TestOthers.py - return self.Import(theFileName, "IGES") + anObj = self.InsertOp.ImportFile(theFileName, "IGES_UNIT") + #RaiseIfFailed("Import", self.InsertOp) + # recieve name using returned vertex + UnitName = "M" + if anObj.GetShapeType() == GEOM.VERTEX: + vertices = [anObj] + else: + vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"]) + if len(vertices)>0: + p = self.PointCoordinates(vertices[0]) + if abs(p[0]-0.01) < 1.e-6: + UnitName = "CM" + elif abs(p[0]-0.001) < 1.e-6: + UnitName = "MM" + return UnitName - ## Shortcut to Import() for STEP format + ## Shortcut to ImportFile() for STEP format # # @ref swig_Import_Export "Example" def ImportSTEP(self,theFileName): + """ + geompy.ImportFile(...) function for STEP format + """ # Example: see GEOM_TestOthers.py - return self.Import(theFileName, "STEP") + return self.ImportFile(theFileName, "STEP") ## Export the given shape into a file with given name. # @param theObject Shape to be stored in the file. @@ -3169,6 +7288,15 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_Import_Export "Example" def Export(self,theObject, theFileName, theFormatName): + """ + Export the given shape into a file with given name. + + Parameters: + theObject Shape to be stored in the file. + theFileName Name of the file to store the given shape in. + theFormatName Specify format for the shape storage. + Available formats can be obtained with geompy.InsertOp.ImportTranslators() method. + """ # Example: see GEOM_TestOthers.py self.InsertOp.Export(theObject, theFileName, theFormatName) if self.InsertOp.IsDone() == 0: @@ -3180,6 +7308,9 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_Import_Export "Example" def ExportBREP(self,theObject, theFileName): + """ + geompy.Export(...) function for BREP format + """ # Example: see GEOM_TestOthers.py return self.Export(theObject, theFileName, "BREP") @@ -3187,6 +7318,9 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_Import_Export "Example" def ExportIGES(self,theObject, theFileName): + """ + geompy.Export(...) function for IGES format + """ # Example: see GEOM_TestOthers.py return self.Export(theObject, theFileName, "IGES") @@ -3194,6 +7328,9 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_Import_Export "Example" def ExportSTEP(self,theObject, theFileName): + """ + geompy.Export(...) function for STEP format + """ # Example: see GEOM_TestOthers.py return self.Export(theObject, theFileName, "STEP") @@ -3206,10 +7343,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a quadrangle face from four edges. Order of Edges is not # important. It is not necessary that edges share the same vertex. # @param E1,E2,E3,E4 Edges for the face bound. - # @return New GEOM_Object, containing the created face. + # @return New GEOM.GEOM_Object, containing the created face. # # @ref tui_building_by_blocks_page "Example" def MakeQuad(self,E1, E2, E3, E4): + """ + Create a quadrangle face from four edges. Order of Edges is not + important. It is not necessary that edges share the same vertex. + + Parameters: + E1,E2,E3,E4 Edges for the face bound. + + Returns: + New GEOM.GEOM_Object, containing the created face. + + Example of usage: + qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4) + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4) RaiseIfFailed("MakeQuad", self.BlocksOp) @@ -3218,10 +7368,32 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a quadrangle face on two edges. # The missing edges will be built by creating the shortest ones. # @param E1,E2 Two opposite edges for the face. - # @return New GEOM_Object, containing the created face. + # @return New GEOM.GEOM_Object, containing the created face. # # @ref tui_building_by_blocks_page "Example" def MakeQuad2Edges(self,E1, E2): + """ + Create a quadrangle face on two edges. + The missing edges will be built by creating the shortest ones. + + Parameters: + E1,E2 Two opposite edges for the face. + + Returns: + New GEOM.GEOM_Object, containing the created face. + + Example of usage: + # create vertices + p1 = geompy.MakeVertex( 0., 0., 0.) + p2 = geompy.MakeVertex(150., 30., 0.) + p3 = geompy.MakeVertex( 0., 120., 50.) + p4 = geompy.MakeVertex( 0., 40., 70.) + # create edges + edge1 = geompy.MakeEdge(p1, p2) + edge2 = geompy.MakeEdge(p3, p4) + # create a quadrangle face from two edges + qface2 = geompy.MakeQuad2Edges(edge1, edge2) + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.MakeQuad2Edges(E1, E2) RaiseIfFailed("MakeQuad2Edges", self.BlocksOp) @@ -3230,11 +7402,30 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a quadrangle face with specified corners. # The missing edges will be built by creating the shortest ones. # @param V1,V2,V3,V4 Corner vertices for the face. - # @return New GEOM_Object, containing the created face. + # @return New GEOM.GEOM_Object, containing the created face. # # @ref tui_building_by_blocks_page "Example 1" # \n @ref swig_MakeQuad4Vertices "Example 2" def MakeQuad4Vertices(self,V1, V2, V3, V4): + """ + Create a quadrangle face with specified corners. + The missing edges will be built by creating the shortest ones. + + Parameters: + V1,V2,V3,V4 Corner vertices for the face. + + Returns: + New GEOM.GEOM_Object, containing the created face. + + Example of usage: + # create vertices + p1 = geompy.MakeVertex( 0., 0., 0.) + p2 = geompy.MakeVertex(150., 30., 0.) + p3 = geompy.MakeVertex( 0., 120., 50.) + p4 = geompy.MakeVertex( 0., 40., 70.) + # create a quadrangle from four points in its corners + qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4) + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4) RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp) @@ -3243,11 +7434,24 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a hexahedral solid, bounded by the six given faces. Order of # faces is not important. It is not necessary that Faces share the same edge. # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid. - # @return New GEOM_Object, containing the created solid. + # @return New GEOM.GEOM_Object, containing the created solid. # # @ref tui_building_by_blocks_page "Example 1" # \n @ref swig_MakeHexa "Example 2" def MakeHexa(self,F1, F2, F3, F4, F5, F6): + """ + Create a hexahedral solid, bounded by the six given faces. Order of + faces is not important. It is not necessary that Faces share the same edge. + + Parameters: + F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid. + + Returns: + New GEOM.GEOM_Object, containing the created solid. + + Example of usage: + solid = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6) + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6) RaiseIfFailed("MakeHexa", self.BlocksOp) @@ -3256,11 +7460,24 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a hexahedral solid between two given faces. # The missing faces will be built by creating the smallest ones. # @param F1,F2 Two opposite faces for the hexahedral solid. - # @return New GEOM_Object, containing the created solid. + # @return New GEOM.GEOM_Object, containing the created solid. # # @ref tui_building_by_blocks_page "Example 1" # \n @ref swig_MakeHexa2Faces "Example 2" def MakeHexa2Faces(self,F1, F2): + """ + Create a hexahedral solid between two given faces. + The missing faces will be built by creating the smallest ones. + + Parameters: + F1,F2 Two opposite faces for the hexahedral solid. + + Returns: + New GEOM.GEOM_Object, containing the created solid. + + Example of usage: + solid1 = geompy.MakeHexa2Faces(qface1, qface2) + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.MakeHexa2Faces(F1, F2) RaiseIfFailed("MakeHexa2Faces", self.BlocksOp) @@ -3277,22 +7494,73 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theX,theY,theZ Coordinates of the sought vertex. # @param theEpsilon Maximum allowed distance between the resulting # vertex and point with the given coordinates. - # @return New GEOM_Object, containing the found vertex. + # @return New GEOM.GEOM_Object, containing the found vertex. # # @ref swig_GetPoint "Example" - def GetPoint(self,theShape, theX, theY, theZ, theEpsilon): + def GetPoint(self, theShape, theX, theY, theZ, theEpsilon): + """ + Get a vertex, found in the given shape by its coordinates. + + Parameters: + theShape Block or a compound of blocks. + theX,theY,theZ Coordinates of the sought vertex. + theEpsilon Maximum allowed distance between the resulting + vertex and point with the given coordinates. + + Returns: + New GEOM.GEOM_Object, containing the found vertex. + + Example of usage: + pnt = geompy.GetPoint(shape, -50, 50, 50, 0.01) + """ # Example: see GEOM_TestOthers.py anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon) RaiseIfFailed("GetPoint", self.BlocksOp) return anObj + ## Find a vertex of the given shape, which has minimal distance to the given point. + # @param theShape Any shape. + # @param thePoint Point, close to the desired vertex. + # @return New GEOM.GEOM_Object, containing the found vertex. + # + # @ref swig_GetVertexNearPoint "Example" + def GetVertexNearPoint(self, theShape, thePoint): + """ + Find a vertex of the given shape, which has minimal distance to the given point. + + Parameters: + theShape Any shape. + thePoint Point, close to the desired vertex. + + Returns: + New GEOM.GEOM_Object, containing the found vertex. + + Example of usage: + pmidle = geompy.MakeVertex(50, 0, 50) + edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle) + """ + # Example: see GEOM_TestOthers.py + anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint) + RaiseIfFailed("GetVertexNearPoint", self.BlocksOp) + return anObj + ## Get an edge, found in the given shape by two given vertices. # @param theShape Block or a compound of blocks. # @param thePoint1,thePoint2 Points, close to the ends of the desired edge. - # @return New GEOM_Object, containing the found edge. + # @return New GEOM.GEOM_Object, containing the found edge. # - # @ref swig_todo "Example" - def GetEdge(self,theShape, thePoint1, thePoint2): + # @ref swig_GetEdge "Example" + def GetEdge(self, theShape, thePoint1, thePoint2): + """ + Get an edge, found in the given shape by two given vertices. + + Parameters: + theShape Block or a compound of blocks. + thePoint1,thePoint2 Points, close to the ends of the desired edge. + + Returns: + New GEOM.GEOM_Object, containing the found edge. + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2) RaiseIfFailed("GetEdge", self.BlocksOp) @@ -3301,10 +7569,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find an edge of the given shape, which has minimal distance to the given point. # @param theShape Block or a compound of blocks. # @param thePoint Point, close to the desired edge. - # @return New GEOM_Object, containing the found edge. + # @return New GEOM.GEOM_Object, containing the found edge. # # @ref swig_GetEdgeNearPoint "Example" - def GetEdgeNearPoint(self,theShape, thePoint): + def GetEdgeNearPoint(self, theShape, thePoint): + """ + Find an edge of the given shape, which has minimal distance to the given point. + + Parameters: + theShape Block or a compound of blocks. + thePoint Point, close to the desired edge. + + Returns: + New GEOM.GEOM_Object, containing the found edge. + """ # Example: see GEOM_TestOthers.py anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint) RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp) @@ -3313,10 +7591,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Returns a face, found in the given shape by four given corner vertices. # @param theShape Block or a compound of blocks. # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face. - # @return New GEOM_Object, containing the found face. + # @return New GEOM.GEOM_Object, containing the found face. # # @ref swig_todo "Example" def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4): + """ + Returns a face, found in the given shape by four given corner vertices. + + Parameters: + theShape Block or a compound of blocks. + thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face. + + Returns: + New GEOM.GEOM_Object, containing the found face. + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4) RaiseIfFailed("GetFaceByPoints", self.BlocksOp) @@ -3325,10 +7613,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Get a face of block, found in the given shape by two given edges. # @param theShape Block or a compound of blocks. # @param theEdge1,theEdge2 Edges, close to the edges of the desired face. - # @return New GEOM_Object, containing the found face. + # @return New GEOM.GEOM_Object, containing the found face. # # @ref swig_todo "Example" def GetFaceByEdges(self,theShape, theEdge1, theEdge2): + """ + Get a face of block, found in the given shape by two given edges. + + Parameters: + theShape Block or a compound of blocks. + theEdge1,theEdge2 Edges, close to the edges of the desired face. + + Returns: + New GEOM.GEOM_Object, containing the found face. + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2) RaiseIfFailed("GetFaceByEdges", self.BlocksOp) @@ -3337,10 +7635,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find a face, opposite to the given one in the given block. # @param theBlock Must be a hexahedral solid. # @param theFace Face of \a theBlock, opposite to the desired face. - # @return New GEOM_Object, containing the found face. + # @return New GEOM.GEOM_Object, containing the found face. # # @ref swig_GetOppositeFace "Example" def GetOppositeFace(self,theBlock, theFace): + """ + Find a face, opposite to the given one in the given block. + + Parameters: + theBlock Must be a hexahedral solid. + theFace Face of theBlock, opposite to the desired face. + + Returns: + New GEOM.GEOM_Object, containing the found face. + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace) RaiseIfFailed("GetOppositeFace", self.BlocksOp) @@ -3349,10 +7657,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find a face of the given shape, which has minimal distance to the given point. # @param theShape Block or a compound of blocks. # @param thePoint Point, close to the desired face. - # @return New GEOM_Object, containing the found face. + # @return New GEOM.GEOM_Object, containing the found face. # # @ref swig_GetFaceNearPoint "Example" - def GetFaceNearPoint(self,theShape, thePoint): + def GetFaceNearPoint(self, theShape, thePoint): + """ + Find a face of the given shape, which has minimal distance to the given point. + + Parameters: + theShape Block or a compound of blocks. + thePoint Point, close to the desired face. + + Returns: + New GEOM.GEOM_Object, containing the found face. + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint) RaiseIfFailed("GetFaceNearPoint", self.BlocksOp) @@ -3361,15 +7679,57 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find a face of block, whose outside normale has minimal angle with the given vector. # @param theBlock Block or a compound of blocks. # @param theVector Vector, close to the normale of the desired face. - # @return New GEOM_Object, containing the found face. + # @return New GEOM.GEOM_Object, containing the found face. # # @ref swig_todo "Example" def GetFaceByNormale(self, theBlock, theVector): + """ + Find a face of block, whose outside normale has minimal angle with the given vector. + + Parameters: + theBlock Block or a compound of blocks. + theVector Vector, close to the normale of the desired face. + + Returns: + New GEOM.GEOM_Object, containing the found face. + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector) RaiseIfFailed("GetFaceByNormale", self.BlocksOp) return anObj + ## Find all sub-shapes of type \a theShapeType of the given shape, + # which have minimal distance to the given point. + # @param theShape Any shape. + # @param thePoint Point, close to the desired shape. + # @param theShapeType Defines what kind of sub-shapes is searched GEOM::shape_type + # @param theTolerance The tolerance for distances comparison. All shapes + # with distances to the given point in interval + # [minimal_distance, minimal_distance + theTolerance] will be gathered. + # @return New GEOM_Object, containing a group of all found shapes. + # + # @ref swig_GetShapesNearPoint "Example" + def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07): + """ + Find all sub-shapes of type theShapeType of the given shape, + which have minimal distance to the given point. + + Parameters: + theShape Any shape. + thePoint Point, close to the desired shape. + theShapeType Defines what kind of sub-shapes is searched (see GEOM::shape_type) + theTolerance The tolerance for distances comparison. All shapes + with distances to the given point in interval + [minimal_distance, minimal_distance + theTolerance] will be gathered. + + Returns: + New GEOM_Object, containing a group of all found shapes. + """ + # Example: see GEOM_TestOthers.py + anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance) + RaiseIfFailed("GetShapesNearPoint", self.BlocksOp) + return anObj + # end of l3_blocks_op ## @} @@ -3390,6 +7750,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_measurement_tools_page "Example 1" # \n @ref swig_CheckCompoundOfBlocks "Example 2" def CheckCompoundOfBlocks(self,theCompound): + """ + Check, if the compound of blocks is given. + To be considered as a compound of blocks, the + given shape must satisfy the following conditions: + - Each element of the compound should be a Block (6 faces and 12 edges). + - A connection between two Blocks should be an entire quadrangle face or an entire edge. + - The compound should be connexe. + - The glue between two quadrangle faces should be applied. + + Parameters: + theCompound The compound to check. + + Returns: + TRUE, if the given shape is a compound of blocks. + If theCompound is not valid, prints all discovered errors. + """ # Example: see GEOM_Spanner.py (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound) RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp) @@ -3402,12 +7778,29 @@ class geompyDC(GEOM._objref_GEOM_Gen): # Unite faces and edges, sharing one surface. It means that # this faces must have references to one C++ surface object (handle). # @param theShape The compound or single solid to remove irregular edges from. + # @param doUnionFaces If True, then unite faces. If False (the default value), + # do not unite faces. # @return Improved shape. # # @ref swig_RemoveExtraEdges "Example" - def RemoveExtraEdges(self,theShape): + def RemoveExtraEdges(self, theShape, doUnionFaces=False): + """ + Remove all seam and degenerated edges from theShape. + Unite faces and edges, sharing one surface. It means that + this faces must have references to one C++ surface object (handle). + + Parameters: + theShape The compound or single solid to remove irregular edges from. + doUnionFaces If True, then unite faces. If False (the default value), + do not unite faces. + + Returns: + Improved shape. + """ # Example: see GEOM_TestOthers.py - anObj = self.BlocksOp.RemoveExtraEdges(theShape) + nbFacesOptimum = -1 # -1 means do not unite faces + if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces + anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum) RaiseIfFailed("RemoveExtraEdges", self.BlocksOp) return anObj @@ -3419,6 +7812,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_CheckAndImprove "Example" def CheckAndImprove(self,theShape): + """ + Check, if the given shape is a blocks compound. + Fix all detected errors. + + Note: + Single block can be also fixed by this method. + + Parameters: + theShape The compound to check and improve. + + Returns: + Improved compound. + """ # Example: see GEOM_TestOthers.py anObj = self.BlocksOp.CheckAndImprove(theShape) RaiseIfFailed("CheckAndImprove", self.BlocksOp) @@ -3435,11 +7841,25 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theMinNbFaces If solid has lower number of faces, it is not a block. # @param theMaxNbFaces If solid has higher number of faces, it is not a block. # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted. - # @return List of GEOM_Objects, containing the retrieved blocks. + # @return List of GEOM.GEOM_Object, containing the retrieved blocks. # # @ref tui_explode_on_blocks "Example 1" # \n @ref swig_MakeBlockExplode "Example 2" def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces): + """ + Get all the blocks, contained in the given compound. + + Parameters: + theCompound The compound to explode. + theMinNbFaces If solid has lower number of faces, it is not a block. + theMaxNbFaces If solid has higher number of faces, it is not a block. + + Note: + If theMaxNbFaces = 0, the maximum number of faces is not restricted. + + Returns: + List of GEOM.GEOM_Object, containing the retrieved blocks. + """ # Example: see GEOM_TestOthers.py theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces) aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces) @@ -3453,10 +7873,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theCompound Compound, to find block in. # @param thePoint Point, close to the desired block. If the point lays on # boundary between some blocks, we return block with nearest center. - # @return New GEOM_Object, containing the found block. + # @return New GEOM.GEOM_Object, containing the found block. # # @ref swig_todo "Example" def GetBlockNearPoint(self,theCompound, thePoint): + """ + Find block, containing the given point inside its volume or on boundary. + + Parameters: + theCompound Compound, to find block in. + thePoint Point, close to the desired block. If the point lays on + boundary between some blocks, we return block with nearest center. + + Returns: + New GEOM.GEOM_Object, containing the found block. + """ # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint) RaiseIfFailed("GetBlockNearPoint", self.BlocksOp) @@ -3465,10 +7896,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Find block, containing all the elements, passed as the parts, or maximum quantity of them. # @param theCompound Compound, to find block in. # @param theParts List of faces and/or edges and/or vertices to be parts of the found block. - # @return New GEOM_Object, containing the found block. + # @return New GEOM.GEOM_Object, containing the found block. # # @ref swig_GetBlockByParts "Example" def GetBlockByParts(self,theCompound, theParts): + """ + Find block, containing all the elements, passed as the parts, or maximum quantity of them. + + Parameters: + theCompound Compound, to find block in. + theParts List of faces and/or edges and/or vertices to be parts of the found block. + + Returns: + New GEOM_Object, containing the found block. + """ # Example: see GEOM_TestOthers.py anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts) RaiseIfFailed("GetBlockByParts", self.BlocksOp) @@ -3477,10 +7918,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Return all blocks, containing all the elements, passed as the parts. # @param theCompound Compound, to find blocks in. # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks. - # @return List of GEOM_Objects, containing the found blocks. + # @return List of GEOM.GEOM_Object, containing the found blocks. # # @ref swig_todo "Example" def GetBlocksByParts(self,theCompound, theParts): + """ + Return all blocks, containing all the elements, passed as the parts. + + Parameters: + theCompound Compound, to find blocks in. + theParts List of faces and/or edges and/or vertices to be parts of the found blocks. + + Returns: + List of GEOM.GEOM_Object, containing the found blocks. + """ # Example: see GEOM_Spanner.py aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts) RaiseIfFailed("GetBlocksByParts", self.BlocksOp) @@ -3493,10 +7944,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param DirFace2 ID of Second direction face. # @param NbTimes Quantity of transformations to be done. # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID(). - # @return New GEOM_Object, containing the result shape. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_multi_transformation "Example" def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes): + """ + Multi-transformate block and glue the result. + Transformation is defined so, as to superpose direction faces. + + Parameters: + Block Hexahedral solid to be multi-transformed. + DirFace1 ID of First direction face. + DirFace2 ID of Second direction face. + NbTimes Quantity of transformations to be done. + + Note: + Unique ID of sub-shape can be obtained, using method GetSubShapeID(). + + Returns: + New GEOM.GEOM_Object, containing the result shape. + """ # Example: see GEOM_Spanner.py DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes) anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes) @@ -3509,11 +7976,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation. # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation. # @param NbTimesU,NbTimesV Quantity of transformations to be done. - # @return New GEOM_Object, containing the result shape. + # @return New GEOM.GEOM_Object, containing the result shape. # # @ref tui_multi_transformation "Example" def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU, DirFace1V, DirFace2V, NbTimesV): + """ + Multi-transformate block and glue the result. + + Parameters: + Block Hexahedral solid to be multi-transformed. + DirFace1U,DirFace2U IDs of Direction faces for the first transformation. + DirFace1V,DirFace2V IDs of Direction faces for the second transformation. + NbTimesU,NbTimesV Quantity of transformations to be done. + + Returns: + New GEOM.GEOM_Object, containing the result shape. + """ # Example: see GEOM_Spanner.py DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters( DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV) @@ -3528,10 +8007,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # edge of this group directly or through other opposite edges. # Notion of Opposite Edge make sence only on quadrangle face. # @param theShape Shape to build propagation groups on. - # @return List of GEOM_Objects, each of them is a propagation group. + # @return List of GEOM.GEOM_Object, each of them is a propagation group. # # @ref swig_Propagate "Example" def Propagate(self,theShape): + """ + Build all possible propagation groups. + Propagation group is a set of all edges, opposite to one (main) + edge of this group directly or through other opposite edges. + Notion of Opposite Edge make sence only on quadrangle face. + + Parameters: + theShape Shape to build propagation groups on. + + Returns: + List of GEOM.GEOM_Object, each of them is a propagation group. + """ # Example: see GEOM_TestOthers.py listChains = self.BlocksOp.Propagate(theShape) RaiseIfFailed("Propagate", self.BlocksOp) @@ -3543,59 +8034,111 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## @addtogroup l3_groups ## @{ - ## Creates a new group which will store sub shapes of theMainShape + ## Creates a new group which will store sub-shapes of theMainShape # @param theMainShape is a GEOM object on which the group is selected - # @param theShapeType defines a shape type of the group + # @param theShapeType defines a shape type of the group (see GEOM::shape_type) # @return a newly created GEOM group # # @ref tui_working_with_groups_page "Example 1" # \n @ref swig_CreateGroup "Example 2" def CreateGroup(self,theMainShape, theShapeType): + """ + Creates a new group which will store sub-shapes of theMainShape + + Parameters: + theMainShape is a GEOM object on which the group is selected + theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID", + "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE". + + Returns: + a newly created GEOM group + + Example of usage: + group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) + + """ # Example: see GEOM_TestOthers.py anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType) RaiseIfFailed("CreateGroup", self.GroupOp) return anObj - ## Adds a sub object with ID theSubShapeId to the group - # @param theGroup is a GEOM group to which the new sub shape is added - # @param theSubShapeID is a sub shape ID in the main object. - # \note Use method GetSubShapeID() to get an unique ID of the sub shape + ## Adds a sub-object with ID theSubShapeId to the group + # @param theGroup is a GEOM group to which the new sub-shape is added + # @param theSubShapeID is a sub-shape ID in the main object. + # \note Use method GetSubShapeID() to get an unique ID of the sub-shape # # @ref tui_working_with_groups_page "Example" def AddObject(self,theGroup, theSubShapeID): + """ + Adds a sub-object with ID theSubShapeId to the group + + Parameters: + theGroup is a GEOM group to which the new sub-shape is added + theSubShapeID is a sub-shape ID in the main object. + + Note: + Use method GetSubShapeID() to get an unique ID of the sub-shape + """ # Example: see GEOM_TestOthers.py self.GroupOp.AddObject(theGroup, theSubShapeID) - RaiseIfFailed("AddObject", self.GroupOp) + if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT": + RaiseIfFailed("AddObject", self.GroupOp) + pass pass - ## Removes a sub object with ID \a theSubShapeId from the group - # @param theGroup is a GEOM group from which the new sub shape is removed - # @param theSubShapeID is a sub shape ID in the main object. - # \note Use method GetSubShapeID() to get an unique ID of the sub shape + ## Removes a sub-object with ID \a theSubShapeId from the group + # @param theGroup is a GEOM group from which the new sub-shape is removed + # @param theSubShapeID is a sub-shape ID in the main object. + # \note Use method GetSubShapeID() to get an unique ID of the sub-shape # # @ref tui_working_with_groups_page "Example" def RemoveObject(self,theGroup, theSubShapeID): + """ + Removes a sub-object with ID theSubShapeId from the group + + Parameters: + theGroup is a GEOM group from which the new sub-shape is removed + theSubShapeID is a sub-shape ID in the main object. + + Note: + Use method GetSubShapeID() to get an unique ID of the sub-shape + """ # Example: see GEOM_TestOthers.py self.GroupOp.RemoveObject(theGroup, theSubShapeID) RaiseIfFailed("RemoveObject", self.GroupOp) pass ## Adds to the group all the given shapes. No errors, if some shapes are alredy included. - # @param theGroup is a GEOM group to which the new sub shapes are added. - # @param theSubShapes is a list of sub shapes to be added. + # @param theGroup is a GEOM group to which the new sub-shapes are added. + # @param theSubShapes is a list of sub-shapes to be added. # # @ref tui_working_with_groups_page "Example" def UnionList (self,theGroup, theSubShapes): + """ + Adds to the group all the given shapes. No errors, if some shapes are alredy included. + + Parameters: + theGroup is a GEOM group to which the new sub-shapes are added. + theSubShapes is a list of sub-shapes to be added. + """ # Example: see GEOM_TestOthers.py self.GroupOp.UnionList(theGroup, theSubShapes) RaiseIfFailed("UnionList", self.GroupOp) pass - ## Works like the above method, but argument - # theSubShapes here is a list of sub-shapes indices + ## Adds to the group all the given shapes. No errors, if some shapes are alredy included. + # @param theGroup is a GEOM group to which the new sub-shapes are added. + # @param theSubShapes is a list of indices of sub-shapes to be added. # # @ref swig_UnionIDs "Example" def UnionIDs(self,theGroup, theSubShapes): + """ + Adds to the group all the given shapes. No errors, if some shapes are alredy included. + + Parameters: + theGroup is a GEOM group to which the new sub-shapes are added. + theSubShapes is a list of indices of sub-shapes to be added. + """ # Example: see GEOM_TestOthers.py self.GroupOp.UnionIDs(theGroup, theSubShapes) RaiseIfFailed("UnionIDs", self.GroupOp) @@ -3607,47 +8150,197 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref tui_working_with_groups_page "Example" def DifferenceList (self,theGroup, theSubShapes): + """ + Removes from the group all the given shapes. No errors, if some shapes are not included. + + Parameters: + theGroup is a GEOM group from which the sub-shapes are removed. + theSubShapes is a list of sub-shapes to be removed. + """ # Example: see GEOM_TestOthers.py self.GroupOp.DifferenceList(theGroup, theSubShapes) RaiseIfFailed("DifferenceList", self.GroupOp) pass - ## Works like the above method, but argument - # theSubShapes here is a list of sub-shapes indices + ## Removes from the group all the given shapes. No errors, if some shapes are not included. + # @param theGroup is a GEOM group from which the sub-shapes are removed. + # @param theSubShapes is a list of indices of sub-shapes to be removed. # # @ref swig_DifferenceIDs "Example" def DifferenceIDs(self,theGroup, theSubShapes): + """ + Removes from the group all the given shapes. No errors, if some shapes are not included. + + Parameters: + theGroup is a GEOM group from which the sub-shapes are removed. + theSubShapes is a list of indices of sub-shapes to be removed. + """ # Example: see GEOM_TestOthers.py self.GroupOp.DifferenceIDs(theGroup, theSubShapes) RaiseIfFailed("DifferenceIDs", self.GroupOp) pass - ## Returns a list of sub objects ID stored in the group + ## Returns a list of sub-objects ID stored in the group # @param theGroup is a GEOM group for which a list of IDs is requested # # @ref swig_GetObjectIDs "Example" def GetObjectIDs(self,theGroup): + """ + Returns a list of sub-objects ID stored in the group + + Parameters: + theGroup is a GEOM group for which a list of IDs is requested + """ # Example: see GEOM_TestOthers.py ListIDs = self.GroupOp.GetObjects(theGroup) RaiseIfFailed("GetObjects", self.GroupOp) return ListIDs - ## Returns a type of sub objects stored in the group + ## Returns a type of sub-objects stored in the group # @param theGroup is a GEOM group which type is returned. # # @ref swig_GetType "Example" def GetType(self,theGroup): + """ + Returns a type of sub-objects stored in the group + + Parameters: + theGroup is a GEOM group which type is returned. + """ # Example: see GEOM_TestOthers.py aType = self.GroupOp.GetType(theGroup) RaiseIfFailed("GetType", self.GroupOp) return aType + ## Convert a type of geom object from id to string value + # @param theId is a GEOM obect type id. + # @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... ) + # @ref swig_GetType "Example" + def ShapeIdToType(self, theId): + """ + Convert a type of geom object from id to string value + + Parameters: + theId is a GEOM obect type id. + + Returns: + type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... ) + """ + if theId == 0: + return "COPY" + if theId == 1: + return "IMPORT" + if theId == 2: + return "POINT" + if theId == 3: + return "VECTOR" + if theId == 4: + return "PLANE" + if theId == 5: + return "LINE" + if theId == 6: + return "TORUS" + if theId == 7: + return "BOX" + if theId == 8: + return "CYLINDER" + if theId == 9: + return "CONE" + if theId == 10: + return "SPHERE" + if theId == 11: + return "PRISM" + if theId == 12: + return "REVOLUTION" + if theId == 13: + return "BOOLEAN" + if theId == 14: + return "PARTITION" + if theId == 15: + return "POLYLINE" + if theId == 16: + return "CIRCLE" + if theId == 17: + return "SPLINE" + if theId == 18: + return "ELLIPSE" + if theId == 19: + return "CIRC_ARC" + if theId == 20: + return "FILLET" + if theId == 21: + return "CHAMFER" + if theId == 22: + return "EDGE" + if theId == 23: + return "WIRE" + if theId == 24: + return "FACE" + if theId == 25: + return "SHELL" + if theId == 26: + return "SOLID" + if theId == 27: + return "COMPOUND" + if theId == 28: + return "SUBSHAPE" + if theId == 29: + return "PIPE" + if theId == 30: + return "ARCHIMEDE" + if theId == 31: + return "FILLING" + if theId == 32: + return "EXPLODE" + if theId == 33: + return "GLUED" + if theId == 34: + return "SKETCHER" + if theId == 35: + return "CDG" + if theId == 36: + return "FREE_BOUNDS" + if theId == 37: + return "GROUP" + if theId == 38: + return "BLOCK" + if theId == 39: + return "MARKER" + if theId == 40: + return "THRUSECTIONS" + if theId == 41: + return "COMPOUNDFILTER" + if theId == 42: + return "SHAPES_ON_SHAPE" + if theId == 43: + return "ELLIPSE_ARC" + if theId == 44: + return "3DSKETCHER" + if theId == 45: + return "FILLET_2D" + if theId == 46: + return "FILLET_1D" + if theId == 201: + return "PIPETSHAPE" + return "Shape Id not exist." + ## Returns a main shape associated with the group # @param theGroup is a GEOM group for which a main shape object is requested # @return a GEOM object which is a main shape for theGroup # # @ref swig_GetMainShape "Example" def GetMainShape(self,theGroup): + """ + Returns a main shape associated with the group + + Parameters: + theGroup is a GEOM group for which a main shape object is requested + + Returns: + a GEOM object which is a main shape for theGroup + + Example of usage: BoxCopy = geompy.GetMainShape(CreateGroup) + """ # Example: see GEOM_TestOthers.py anObj = self.GroupOp.GetMainShape(theGroup) RaiseIfFailed("GetMainShape", self.GroupOp) @@ -3655,9 +8348,28 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create group of edges of theShape, whose length is in range [min_length, max_length]. # If include_min/max == 0, edges with length == min/max_length will not be included in result. - # - # @ref swig_todo "Example" + # @param theShape given shape (see GEOM.GEOM_Object) + # @param min_length minimum length of edges of theShape + # @param max_length maximum length of edges of theShape + # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1) + # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1) + # @return a newly created GEOM group of edges + # @@ref swig_todo "Example" def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1): + """ + Create group of edges of theShape, whose length is in range [min_length, max_length]. + If include_min/max == 0, edges with length == min/max_length will not be included in result. + + Parameters: + theShape given shape + min_length minimum length of edges of theShape + max_length maximum length of edges of theShape + include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1) + include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1) + + Returns: + a newly created GEOM group of edges. + """ edges = self.SubShapeAll(theShape, ShapeType["EDGE"]) edges_in_range = [] for edge in edges: @@ -3682,9 +8394,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create group of edges of selected shape, whose length is in range [min_length, max_length]. # If include_min/max == 0, edges with length == min/max_length will not be included in result. - # + # @param min_length minimum length of edges of selected shape + # @param max_length maximum length of edges of selected shape + # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1) + # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1) + # @return a newly created GEOM group of edges # @ref swig_todo "Example" def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1): + """ + Create group of edges of selected shape, whose length is in range [min_length, max_length]. + If include_min/max == 0, edges with length == min/max_length will not be included in result. + + Parameters: + min_length minimum length of edges of selected shape + max_length maximum length of edges of selected shape + include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1) + include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1) + + Returns: + a newly created GEOM group of edges. + """ nb_selected = sg.SelectedCount() if nb_selected < 1: print "Select a shape before calling this function, please." @@ -3713,21 +8442,362 @@ class geompyDC(GEOM._objref_GEOM_Gen): # end of l3_groups ## @} + ## @addtogroup l4_advanced + ## @{ + + ## Create a T-shape object with specified caracteristics for the main + # and the incident pipes (radius, width, half-length). + # The extremities of the main pipe are located on junctions points P1 and P2. + # The extremity of the incident pipe is located on junction point P3. + # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and + # the main plane of the T-shape is XOY. + # @param theR1 Internal radius of main pipe + # @param theW1 Width of main pipe + # @param theL1 Half-length of main pipe + # @param theR2 Internal radius of incident pipe (R2 < R1) + # @param theW2 Width of incident pipe (R2+W2 < R1+W1) + # @param theL2 Half-length of incident pipe + # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True) + # @param theP1 1st junction point of main pipe + # @param theP2 2nd junction point of main pipe + # @param theP3 Junction point of incident pipe + # @return List of GEOM.GEOM_Object, containing the created shape and propagation groups. + # + # @ref tui_creation_pipetshape "Example" + def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None): + """ + Create a T-shape object with specified caracteristics for the main + and the incident pipes (radius, width, half-length). + The extremities of the main pipe are located on junctions points P1 and P2. + The extremity of the incident pipe is located on junction point P3. + If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and + the main plane of the T-shape is XOY. + + Paremeters: + theR1 Internal radius of main pipe + theW1 Width of main pipe + theL1 Half-length of main pipe + theR2 Internal radius of incident pipe (R2 < R1) + theW2 Width of incident pipe (R2+W2 < R1+W1) + theL2 Half-length of incident pipe + theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True) + theP1 1st junction point of main pipe + theP2 2nd junction point of main pipe + theP3 Junction point of incident pipe + + Returns: + List of GEOM_Object, containing the created shape and propagation groups. + + Example of usage: + # create PipeTShape object + pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0) + # create PipeTShape object with position + pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3) + """ + theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2) + if (theP1 and theP2 and theP3): + anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3) + else: + anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh) + RaiseIfFailed("MakePipeTShape", self.AdvOp) + if Parameters: anObj[0].SetParameters(Parameters) + return anObj + + ## Create a T-shape object with chamfer and with specified caracteristics for the main + # and the incident pipes (radius, width, half-length). The chamfer is + # created on the junction of the pipes. + # The extremities of the main pipe are located on junctions points P1 and P2. + # The extremity of the incident pipe is located on junction point P3. + # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and + # the main plane of the T-shape is XOY. + # @param theR1 Internal radius of main pipe + # @param theW1 Width of main pipe + # @param theL1 Half-length of main pipe + # @param theR2 Internal radius of incident pipe (R2 < R1) + # @param theW2 Width of incident pipe (R2+W2 < R1+W1) + # @param theL2 Half-length of incident pipe + # @param theH Height of the chamfer. + # @param theW Width of the chamfer. + # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True) + # @param theP1 1st junction point of main pipe + # @param theP2 2nd junction point of main pipe + # @param theP3 Junction point of incident pipe + # @return List of GEOM.GEOM_Object, containing the created shape and propagation groups. + # + # @ref tui_creation_pipetshape "Example" + def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None): + """ + Create a T-shape object with chamfer and with specified caracteristics for the main + and the incident pipes (radius, width, half-length). The chamfer is + created on the junction of the pipes. + The extremities of the main pipe are located on junctions points P1 and P2. + The extremity of the incident pipe is located on junction point P3. + If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and + the main plane of the T-shape is XOY. + + Paremeters: + theR1 Internal radius of main pipe + theW1 Width of main pipe + theL1 Half-length of main pipe + theR2 Internal radius of incident pipe (R2 < R1) + theW2 Width of incident pipe (R2+W2 < R1+W1) + theL2 Half-length of incident pipe + theH Height of the chamfer. + theW Width of the chamfer. + theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True) + theP1 1st junction point of main pipe + theP2 2nd junction point of main pipe + theP3 Junction point of incident pipe + + Returns: + List of GEOM_Object, containing the created shape and propagation groups. + + Example of usage: + # create PipeTShape with chamfer object + pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0) + # create PipeTShape with chamfer object with position + pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3) + """ + theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW) + if (theP1 and theP2 and theP3): + anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3) + else: + anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh) + RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp) + if Parameters: anObj[0].SetParameters(Parameters) + return anObj + + ## Create a T-shape object with fillet and with specified caracteristics for the main + # and the incident pipes (radius, width, half-length). The fillet is + # created on the junction of the pipes. + # The extremities of the main pipe are located on junctions points P1 and P2. + # The extremity of the incident pipe is located on junction point P3. + # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and + # the main plane of the T-shape is XOY. + # @param theR1 Internal radius of main pipe + # @param theW1 Width of main pipe + # @param theL1 Half-length of main pipe + # @param theR2 Internal radius of incident pipe (R2 < R1) + # @param theW2 Width of incident pipe (R2+W2 < R1+W1) + # @param theL2 Half-length of incident pipe + # @param theRF Radius of curvature of fillet. + # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True) + # @param theP1 1st junction point of main pipe + # @param theP2 2nd junction point of main pipe + # @param theP3 Junction point of incident pipe + # @return List of GEOM.GEOM_Object, containing the created shape and propagation groups. + # + # @ref tui_creation_pipetshape "Example" + def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None): + """ + Create a T-shape object with fillet and with specified caracteristics for the main + and the incident pipes (radius, width, half-length). The fillet is + created on the junction of the pipes. + The extremities of the main pipe are located on junctions points P1 and P2. + The extremity of the incident pipe is located on junction point P3. + + Paremeters: + If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and + the main plane of the T-shape is XOY. + theR1 Internal radius of main pipe + theW1 Width of main pipe + heL1 Half-length of main pipe + theR2 Internal radius of incident pipe (R2 < R1) + theW2 Width of incident pipe (R2+W2 < R1+W1) + theL2 Half-length of incident pipe + theRF Radius of curvature of fillet. + theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True) + theP1 1st junction point of main pipe + theP2 2nd junction point of main pipe + theP3 Junction point of incident pipe + + Returns: + List of GEOM_Object, containing the created shape and propagation groups. + + Example of usage: + # create PipeTShape with fillet object + pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0) + # create PipeTShape with fillet object with position + pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3) + + """ + theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF) + if (theP1 and theP2 and theP3): + anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3) + else: + anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh) + RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp) + if Parameters: anObj[0].SetParameters(Parameters) + return anObj + + ## This function allows creating a disk already divided into blocks. It + # can be used to create divided pipes for later meshing in hexaedra. + # @param theR Radius of the disk + # @param theOrientation Orientation of the plane on which the disk will be built + # 1 = XOY, 2 = OYZ, 3 = OZX + # @param thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON + # @return New GEOM_Object, containing the created shape. + # + # @ref tui_creation_divideddisk "Example" + def MakeDividedDisk(self, theR, theOrientation, thePattern ): + theR, Parameters = ParseParameters(theR) + anObj = self.AdvOp.MakeDividedDisk(theR, 67.0, theOrientation, thePattern) + RaiseIfFailed("MakeDividedDisk", self.AdvOp) + if Parameters: anObj.SetParameters(Parameters) + return anObj + + ## This function allows creating a disk already divided into blocks. It + # can be used to create divided pipes for later meshing in hexaedra. + # @param theCenter Center of the disk + # @param theVector Normal vector to the plane of the created disk + # @param theRadius Radius of the disk + # @param thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON + # @return New GEOM_Object, containing the created shape. + # + # @ref tui_creation_divideddisk "Example" + def MakeDividedDiskPntVecR(self, theCenter, theVector, theRadius, thePattern): + theRadius, Parameters = ParseParameters(theRadius) + anObj = self.AdvOp.MakeDividedDiskPntVecR(theCenter, theVector, theRadius, 67.0, thePattern) + RaiseIfFailed("MakeDividedDiskPntVecR", self.AdvOp) + if Parameters: anObj.SetParameters(Parameters) + return anObj + + ## Builds a cylinder prepared for hexa meshes + # @param theR Radius of the cylinder + # @param theH Height of the cylinder + # @param thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON + # @return New GEOM_Object, containing the created shape. + # + # @ref tui_creation_dividedcylinder "Example" + def MakeDividedCylinder(self, theR, theH, thePattern): + theR, theH, Parameters = ParseParameters(theR, theH) + anObj = self.AdvOp.MakeDividedCylinder(theR, theH, thePattern) + RaiseIfFailed("MakeDividedCylinder", self.AdvOp) + if Parameters: anObj.SetParameters(Parameters) + return anObj + + #@@ insert new functions before this line @@ do not remove this line @@# + + # end of l4_advanced + ## @} + ## Create a copy of the given object - # @ingroup l1_geompy_auxiliary # - # @ref swig_all_advanced "Example" + # @param theOriginal geometry object for copy + # @return unique object identifier + # @ingroup l1_geompy_auxiliary + # @ref swig_MakeCopy "Example" def MakeCopy(self,theOriginal): + """ + Create a copy of the given object + + Paremeters: + theOriginal geometry object for copy + + Returns: + unique object identifier + + Example of usage: Copy = geompy.MakeCopy(Box) + """ # Example: see GEOM_TestAll.py anObj = self.InsertOp.MakeCopy(theOriginal) RaiseIfFailed("MakeCopy", self.InsertOp) return anObj ## Add Path to load python scripts from + # @param Path a path to load python scripts from # @ingroup l1_geompy_auxiliary def addPath(self,Path): + """ + Add Path to load python scripts from + + Parameters: + Path a path to load python scripts from + """ if (sys.path.count(Path) < 1): sys.path.append(Path) + pass + pass + + ## Load marker texture from the file + # @param Path a path to the texture file + # @return unique texture identifier + # @ingroup l1_geompy_auxiliary + def LoadTexture(self, Path): + """ + Load marker texture from the file + + Parameters: + Path a path to the texture file + + Returns: + unique texture identifier + """ + # Example: see GEOM_TestAll.py + ID = self.InsertOp.LoadTexture(Path) + RaiseIfFailed("LoadTexture", self.InsertOp) + return ID + + ## Get entry of the object + # @param obj geometry object + # @return unique object identifier + # @ingroup l1_geompy_auxiliary + def getObjectID(self, obj): + """ + Get entry of the object + + Parameters: + obj geometry object + + Returns: + unique object identifier + """ + ID = "" + entry = salome.ObjectToID(obj) + if entry is not None: + lst = entry.split(":") + if len(lst) > 0: + ID = lst[-1] # -1 means last item in the list + return "GEOM_" + ID + return ID + + + + ## Add marker texture. @a Width and @a Height parameters + # specify width and height of the texture in pixels. + # If @a RowData is @c True, @a Texture parameter should represent texture data + # packed into the byte array. If @a RowData is @c False (default), @a Texture + # parameter should be unpacked string, in which '1' symbols represent opaque + # pixels and '0' represent transparent pixels of the texture bitmap. + # + # @param Width texture width in pixels + # @param Height texture height in pixels + # @param Texture texture data + # @param RowData if @c True, @a Texture data are packed in the byte stream + # @return unique texture identifier + # @ingroup l1_geompy_auxiliary + def AddTexture(self, Width, Height, Texture, RowData=False): + """ + Add marker texture. Width and Height parameters + specify width and height of the texture in pixels. + If RowData is True, Texture parameter should represent texture data + packed into the byte array. If RowData is False (default), Texture + parameter should be unpacked string, in which '1' symbols represent opaque + pixels and '0' represent transparent pixels of the texture bitmap. + + Parameters: + Width texture width in pixels + Height texture height in pixels + Texture texture data + RowData if True, Texture data are packed in the byte stream + + Returns: + return unique texture identifier + """ + if not RowData: Texture = PackData(Texture) + ID = self.InsertOp.AddTexture(Width, Height, Texture) + RaiseIfFailed("AddTexture", self.InsertOp) + return ID import omniORB #Register the new proxy for GEOM_Gen diff --git a/src/GEOM_SWIG_WITHIHM/Makefile.am b/src/GEOM_SWIG_WITHIHM/Makefile.am index 1fcd94b42..e468bfb0d 100644 --- a/src/GEOM_SWIG_WITHIHM/Makefile.am +++ b/src/GEOM_SWIG_WITHIHM/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # File : Makefile.in # Author : Nicolas REJNERI, Paul RASCLE @@ -55,12 +53,14 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../GEOMGUI SWIG_SOURCES = libGEOM_Swig.i -libGEOM_Swig.py: swig_wrap.cpp +salomepython_PYTHON = libGEOM_Swig.py +salomepyexec_LTLIBRARIES = _libGEOM_Swig.la -# Libraries targets -lib_LTLIBRARIES = _libGEOM_Swig.la +libGEOM_Swig.py: swig_wrap.cpp +BUILT_SOURCES = swig_wrap.cpp _libGEOM_Swig_la_SOURCES = $(SWIG_SOURCES) -nodist__libGEOM_Swig_la_SOURCES = swig_wrap.cpp +nodist__libGEOM_Swig_la_SOURCES = $(BUILT_SOURCES) + salomeinclude_HEADERS = $(SWIG_SOURCES) _libGEOM_Swig_la_CPPFLAGS = \ @@ -74,8 +74,7 @@ _libGEOM_Swig_la_CPPFLAGS = \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ -I$(srcdir)/../GEOMGUI \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl _libGEOM_Swig_la_LDFLAGS = -module _libGEOM_Swig_la_LIBADD = \ @@ -87,14 +86,3 @@ swig_wrap.cpp : $(SWIG_SOURCES) CLEANFILES = swig_wrap.cpp libGEOM_Swig.py -# -# =============================================================== -# Files to be installed -# =============================================================== -# - -# Scripts to be installed (distributed) -dist_salomescript_DATA = - -# Scripts to be installed (non-distributed) -nodist_salomescript_DATA = libGEOM_Swig.py diff --git a/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i index 2ca52598a..fc1b8fea4 100644 --- a/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i +++ b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : libGeometry_Swig.i // Created : Tue Mar 26 15:04:48 2002 // Author : Nicolas REJNERI, Paul RASCLE diff --git a/src/GenerationGUI/GenerationGUI.cxx b/src/GenerationGUI/GenerationGUI.cxx index 0b16254ac..b341a92b0 100644 --- a/src/GenerationGUI/GenerationGUI.cxx +++ b/src/GenerationGUI/GenerationGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -26,6 +27,7 @@ #include "GenerationGUI.h" #include +#include "GeometryGUI_Operations.h" #include #include @@ -67,10 +69,10 @@ bool GenerationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; switch ( theCommandID ) { - case 4031: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent ); break; - case 4032: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent ); break; - case 4033: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent ); break; - case 4034: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpPrism: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpRevolution: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpFilling: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpPipe: aDlg = new GenerationGUI_PipeDlg ( getGeometryGUI(), parent ); break; default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; } diff --git a/src/GenerationGUI/GenerationGUI.h b/src/GenerationGUI/GenerationGUI.h index 17a28b815..90514bd76 100644 --- a/src/GenerationGUI/GenerationGUI.h +++ b/src/GenerationGUI/GenerationGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/GenerationGUI/GenerationGUI.pro b/src/GenerationGUI/GenerationGUI.pro deleted file mode 100644 index 124ba1499..000000000 --- a/src/GenerationGUI/GenerationGUI.pro +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GenerationGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -CAS_LDPATH = -L$${CASROOT}/Linux/lib - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../GEOMGUI ../DlgRef ../GEOMBase ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMFiltersSelection $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMBase $${CAS_LDPATH} -lTKOffset - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += GENERATIONGUI_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -SOURCES = GenerationGUI.cxx -SOURCES += GenerationGUI_PrismDlg.cxx -SOURCES += GenerationGUI_RevolDlg.cxx -SOURCES += GenerationGUI_FillingDlg.cxx -SOURCES += GenerationGUI_PipeDlg.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index 4f46e1962..cee8cec19 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -1,28 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : GenerationGUI_FillingDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "GenerationGUI_FillingDlg.h" #include @@ -44,41 +44,42 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) - : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) +GenerationGUI_FillingDlg::GenerationGUI_FillingDlg (GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, Qt::WindowFlags fl) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) { - QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLING" ) ) ); - QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FILLING"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); - setWindowTitle( tr( "GEOM_FILLING_TITLE" ) ); + setWindowTitle(tr("GEOM_FILLING_TITLE")); /***************************************************************/ - mainFrame()->GroupConstructors->setTitle( tr ( "GEOM_FILLING" ) ); - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->GroupConstructors->setTitle(tr ("GEOM_FILLING")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton2->close(); - mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_1Sel5Spin1Check( centralWidget() ); - GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupPoints->TextLabel1->setText( tr( "GEOM_FILLING_COMPOUND" ) ); - GroupPoints->TextLabel2->setText( tr( "GEOM_FILLING_MIN_DEG" ) ); - GroupPoints->TextLabel3->setText( tr( "GEOM_FILLING_TOL_2D" ) ); - GroupPoints->TextLabel4->setText( tr( "GEOM_FILLING_NB_ITER" ) ); - GroupPoints->TextLabel5->setText( tr( "GEOM_FILLING_MAX_DEG" ) ); - GroupPoints->TextLabel6->setText( tr( "GEOM_FILLING_TOL_3D" ) ); - GroupPoints->CheckBox1->setText( tr( "GEOM_FILLING_APPROX" ) ); - GroupPoints->PushButton1->setIcon( image1 ); - GroupPoints->LineEdit1->setReadOnly( true ); - - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupPoints ); + GroupPoints = new DlgRef_1Sel5Spin1Check(centralWidget()); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_FILLING_COMPOUND")); + GroupPoints->TextLabel2->setText(tr("GEOM_FILLING_MIN_DEG")); + GroupPoints->TextLabel3->setText(tr("GEOM_FILLING_TOL_2D")); + GroupPoints->TextLabel4->setText(tr("GEOM_FILLING_NB_ITER")); + GroupPoints->TextLabel5->setText(tr("GEOM_FILLING_MAX_DEG")); + GroupPoints->TextLabel6->setText(tr("GEOM_FILLING_TOL_3D")); + GroupPoints->CheckBox1->setText(tr("GEOM_FILLING_APPROX")); + GroupPoints->TextLabel7->setText(tr("GEOM_FILLING_METHOD")); + GroupPoints->PushButton1->setIcon(image1); + GroupPoints->LineEdit1->setReadOnly(true); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupPoints); /***************************************************************/ - setHelpFileName( "create_filling_page.html" ); + setHelpFileName("create_filling_page.html"); /* Initialisations */ Init(); @@ -101,95 +102,92 @@ void GenerationGUI_FillingDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setReadOnly( true ); - - myMinDeg = 2; - myMaxDeg = 5; - myTol3D = 0.0001; - myTol2D = 0.0001; - myNbIter = 0; - myIsApprox = false; - myOkCompound = false; + GroupPoints->LineEdit1->setReadOnly(true); - globalSelection( GEOM_COMPOUND ); + globalSelection(GEOM_COMPOUND); - double SpecificStep1 = 1; + int SpecificStep1 = 1; double SpecificStep2 = 0.0001; /* min, max, step and decimals for spin boxes & initial values */ - initSpinBox( GroupPoints->SpinBox1, 2.0, MAX_NUMBER, SpecificStep1, 3 ); - initSpinBox( GroupPoints->SpinBox2, 0.00001, 10000.0, SpecificStep2, 5 ); - initSpinBox( GroupPoints->SpinBox3, 0.0, MAX_NUMBER, SpecificStep1, 3 ); - initSpinBox( GroupPoints->SpinBox4, 1.0, MAX_NUMBER, SpecificStep1, 3 ); - initSpinBox( GroupPoints->SpinBox5, 0.00001, 10000.0, SpecificStep2, 5 ); - - GroupPoints->SpinBox1->setValue( myMinDeg ); - GroupPoints->SpinBox2->setValue( myTol2D ); - GroupPoints->SpinBox3->setValue( myNbIter ); - GroupPoints->SpinBox4->setValue( myMaxDeg ); - GroupPoints->SpinBox5->setValue( myTol3D ); + initSpinBox(GroupPoints->SpinBox1, 2, MAX_NUMBER, SpecificStep1); + initSpinBox(GroupPoints->SpinBox2, 0.00001, 10000.0, SpecificStep2, "len_tol_precision"); + initSpinBox(GroupPoints->SpinBox3, 0, MAX_NUMBER, SpecificStep1); + initSpinBox(GroupPoints->SpinBox4, 1, MAX_NUMBER, SpecificStep1); + initSpinBox(GroupPoints->SpinBox5, 0.00001, 10000.0, SpecificStep2, "len_tol_precision"); + + GroupPoints->SpinBox1->setValue(2); + GroupPoints->SpinBox2->setValue(0.0001); + GroupPoints->SpinBox3->setValue(0); + GroupPoints->SpinBox4->setValue(5); + GroupPoints->SpinBox5->setValue(0.0001); + + GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_DEFAULT")); + GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_USEORI")); + GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_AUTO")); + + showOnlyPreviewControl(); /* signals and slots connections */ - connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect( GroupPoints->SpinBox1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupPoints->SpinBox4, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); - connect( GroupPoints->SpinBox5, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(MethodChanged())); - connect( GroupPoints->CheckBox1, SIGNAL( stateChanged( int ) ), this, SLOT( ApproxChanged() ) ); + connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox5, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); + connect(GroupPoints->CheckBox1, SIGNAL(stateChanged(int)), + this, SLOT(ApproxChanged())); - connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + // san: Commented, as all spin boxes here either are integer or use specific non-default step value + //connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); - initName( tr( "GEOM_FILLING" ) ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName(tr("GEOM_FILLING")); + resize(100,100); } //================================================================================= // function : SetDoubleSpinBoxStep() // purpose : Double spin box management //================================================================================= -void GenerationGUI_FillingDlg::SetDoubleSpinBoxStep( double step ) +void GenerationGUI_FillingDlg::SetDoubleSpinBoxStep(double step) { - GroupPoints->SpinBox1->setSingleStep(step); GroupPoints->SpinBox2->setSingleStep(step); - GroupPoints->SpinBox3->setSingleStep(step); - GroupPoints->SpinBox4->setSingleStep(step); GroupPoints->SpinBox5->setSingleStep(step); } - //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void GenerationGUI_FillingDlg::ClickOnOk() { - if ( ClickOnApply() ) + setIsApplyAndClose(true); + if (ClickOnApply()) ClickOnCancel(); } - //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= bool GenerationGUI_FillingDlg::ClickOnApply() { - if ( !onAccept() ) + if (!onAccept()) return false; initName(); return true; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case @@ -199,39 +197,20 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myOkCompound = false; - return; - } - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult) - return; - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - TopoDS_Shape S; - myOkCompound = false; - - if (GEOMBase::GetShape(aSelectedObject, S) && S.ShapeType() == TopAbs_COMPOUND) { - // myCompound should be a compound of edges - for (TopoDS_Iterator it (S); it.More(); it.Next()) - if (it.Value().ShapeType() != TopAbs_EDGE) - return; - myCompound = aSelectedObject; - myOkCompound = true; + myCompound = getSelected(TopAbs_COMPOUND); + if (myCompound) { + if (myCompound->GetMaxShapeType() < GEOM::WIRE || myCompound->GetMinShapeType() > GEOM::EDGE) { + myCompound.nullify(); + } + else { + QString aName = GEOMBase::GetName(myCompound.get()); + myEditCurrentArgument->setText(aName); + } } } - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); - displayPreview(); + processPreview(); } //================================================================================= @@ -241,31 +220,16 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() void GenerationGUI_FillingDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - globalSelection( GEOM_ALLSHAPES ); + globalSelection(GEOM_ALLSHAPES); - if ( send == GroupPoints->PushButton1 ) { + if (send == GroupPoints->PushButton1) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection( GEOM_COMPOUND ); + globalSelection(GEOM_COMPOUND); this->SelectionIntoArgument(); } } - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GenerationGUI_FillingDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } -} - - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -273,44 +237,38 @@ void GenerationGUI_FillingDlg::LineEditReturnPressed() void GenerationGUI_FillingDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - globalSelection( GEOM_COMPOUND ); - displayPreview(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + globalSelection(GEOM_COMPOUND); + processPreview(); } - //================================================================================= // function : enterEvent() // purpose : //================================================================================= -void GenerationGUI_FillingDlg::enterEvent( QEvent* ) +void GenerationGUI_FillingDlg::enterEvent(QEvent*) { - if ( !mainFrame()->GroupConstructors->isEnabled() ) + if (!mainFrame()->GroupConstructors->isEnabled()) ActivateThisDialog(); } - //================================================================================= // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue ) +void GenerationGUI_FillingDlg::ValueChangedInSpinBox(double newValue) +{ + processPreview(); +} + +//================================================================================= +// function : MethodChanged +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::MethodChanged() { - QObject* send = (QObject*)sender(); - - if ( send == GroupPoints->SpinBox1 ) - myMinDeg = int( newValue ); - else if ( send == GroupPoints->SpinBox2 ) - myTol2D = newValue; - else if ( send == GroupPoints->SpinBox3 ) - myNbIter = int(newValue); - else if ( send == GroupPoints->SpinBox4 ) - myMaxDeg = int(newValue); - else if ( send == GroupPoints->SpinBox5 ) - myTol3D = newValue; - - displayPreview(); + processPreview(); } //================================================================================= @@ -319,8 +277,30 @@ void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue ) //================================================================================= void GenerationGUI_FillingDlg::ApproxChanged() { - myIsApprox = GroupPoints->CheckBox1->isChecked(); - displayPreview(); + if (GroupPoints->CheckBox1->isChecked()) { + // tol2d + GroupPoints->TextLabel3->setEnabled(false); + GroupPoints->SpinBox2->setEnabled(false); + // nbIter + GroupPoints->TextLabel4->setEnabled(false); + GroupPoints->SpinBox3->setEnabled(false); + // method + GroupPoints->TextLabel7->setEnabled(false); + GroupPoints->ComboBox1->setEnabled(false); + } + else { + // tol2d + GroupPoints->TextLabel3->setEnabled(true); + GroupPoints->SpinBox2->setEnabled(true); + // nbIter + GroupPoints->TextLabel4->setEnabled(true); + GroupPoints->SpinBox3->setEnabled(true); + // method + GroupPoints->TextLabel7->setEnabled(true); + GroupPoints->ComboBox1->setEnabled(true); + } + + processPreview(); } //================================================================================= @@ -329,38 +309,54 @@ void GenerationGUI_FillingDlg::ApproxChanged() //================================================================================= GEOM::GEOM_IOperations_ptr GenerationGUI_FillingDlg::createOperation() { - return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); + return getGeomEngine()->GetI3DPrimOperations(getStudyId()); } //================================================================================= // function : isValid // purpose : //================================================================================= -bool GenerationGUI_FillingDlg::isValid( QString& msg ) +bool GenerationGUI_FillingDlg::isValid(QString& msg) { - bool ok = true; - ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox4->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox5->isValid( msg, !IsPreview() ) && ok; - - return myOkCompound > 0 && ok; + bool ok = GroupPoints->SpinBox1->isValid(msg, !IsPreview()) && + GroupPoints->SpinBox2->isValid(msg, !IsPreview()) && + GroupPoints->SpinBox3->isValid(msg, !IsPreview()) && + GroupPoints->SpinBox4->isValid(msg, !IsPreview()) && + GroupPoints->SpinBox5->isValid(msg, !IsPreview()) && + myCompound; + return ok; } //================================================================================= // function : execute // purpose : //================================================================================= -bool GenerationGUI_FillingDlg::execute( ObjectList& objects ) +bool GenerationGUI_FillingDlg::execute(ObjectList& objects) { - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = + GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + + GEOM::filling_oper_method aMethod; + switch (GroupPoints->ComboBox1->currentIndex()) + { + case 0: aMethod = GEOM::FOM_Default; break; + case 1: aMethod = GEOM::FOM_UseOri; break; + case 2: aMethod = GEOM::FOM_AutoCorrect; break; + default: break; + } - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling( - myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter, myIsApprox ); - if ( !anObj->_is_nil() ) + GEOM::GEOM_Object_var anObj = + anOper->MakeFilling(myCompound.get(), + GroupPoints->SpinBox1->value(), + GroupPoints->SpinBox4->value(), + GroupPoints->SpinBox2->value(), + GroupPoints->SpinBox5->value(), + GroupPoints->SpinBox3->value(), + aMethod, + GroupPoints->CheckBox1->isChecked()); + if (!anObj->_is_nil()) { - if ( !IsPreview() ) + if (!IsPreview()) { QStringList aParameters; aParameters << GroupPoints->SpinBox1->text(); @@ -368,9 +364,9 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects ) aParameters << GroupPoints->SpinBox3->text(); aParameters << GroupPoints->SpinBox4->text(); aParameters << GroupPoints->SpinBox5->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } - objects.push_back( anObj._retn() ); + objects.push_back(anObj._retn()); } return true; diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.h b/src/GenerationGUI/GenerationGUI_FillingDlg.h index ed4de1d3d..b9b02eaf8 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.h +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI_FillingDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef GENERATIONGUI_FILLINGDLG_H #define GENERATIONGUI_FILLINGDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel5Spin1Check; @@ -53,25 +55,17 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myCompound; /* compound of curves */ - Standard_Integer myMinDeg; - Standard_Integer myMaxDeg; - Standard_Real myTol3D; - Standard_Real myTol2D; - Standard_Integer myNbIter; - bool myIsApprox; - bool myOkCompound; /* to check when curv. compound is defined */ - + GEOM::GeomObjPtr myCompound; /* compound of curves */ DlgRef_1Sel5Spin1Check* GroupPoints; private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox( double ); + void MethodChanged(); void ApproxChanged(); void SetDoubleSpinBoxStep( double ); }; diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index e560176dc..42abb189e 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI_PipeDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -113,11 +114,13 @@ void GenerationGUI_PipeDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit3->setText(""); - myBase = myPath = myVec = GEOM::GEOM_Object::_nil(); - myOkBase = myOkPath = myOkVec = false; + myPath.nullify(); + myVec.nullify(); GroupPoints->CheckButton1->setEnabled(false); + showOnlyPreviewControl(); + // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -128,13 +131,10 @@ void GenerationGUI_PipeDlg::Init() connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked())); initName(tr("GEOM_PIPE")); + resize(100,100); GroupPoints->TextLabel3->hide(); GroupPoints->PushButton3->hide(); @@ -153,25 +153,28 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId ) { erasePreview(); - switch (constructorId) - { - case 0: - { - GroupPoints->TextLabel3->hide(); - GroupPoints->PushButton3->hide(); - GroupPoints->LineEdit3->hide(); - break; - } - case 1: - { - GroupPoints->TextLabel3->show(); - GroupPoints->PushButton3->show(); - GroupPoints->LineEdit3->show(); - break; - } + switch (constructorId) { + case 0: + GroupPoints->TextLabel3->hide(); + GroupPoints->PushButton3->hide(); + GroupPoints->LineEdit3->hide(); + GroupPoints->PushButton1->click(); + break; + case 1: + GroupPoints->TextLabel3->show(); + GroupPoints->PushButton3->show(); + GroupPoints->LineEdit3->show(); + break; + default: + break; } - displayPreview(); + qApp->processEvents(); + updateGeometry(); + resize(100,100); + + SelectionIntoArgument(); + processPreview(); } //================================================================================= @@ -185,15 +188,16 @@ void GenerationGUI_PipeDlg::SelectionTypeButtonClicked() localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else { TColStd_MapOfInteger aMap; + aMap.Add(GEOM_COMPOUND); aMap.Add(GEOM_WIRE); aMap.Add(GEOM_LINE); globalSelection(aMap); } - if(myEditCurrentArgument == GroupPoints->LineEdit2) { + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { myEditCurrentArgument->setText(""); - myOkPath = false; + myPath.nullify(); } - displayPreview(); + processPreview(); } //================================================================================= @@ -202,6 +206,7 @@ void GenerationGUI_PipeDlg::SelectionTypeButtonClicked() //================================================================================= void GenerationGUI_PipeDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -217,7 +222,7 @@ bool GenerationGUI_PipeDlg::ClickOnApply() initName(); if ( getConstructorId() != 1 ) - ConstructorsClicked( getConstructorId() ); + ConstructorsClicked( getConstructorId() ); // activate selection and connect selection manager GroupPoints->PushButton1->click(); return true; @@ -231,122 +236,49 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() { erasePreview(); myEditCurrentArgument->setText(""); - if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false; - else if (myEditCurrentArgument == GroupPoints->LineEdit3) myOkVec = false; - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || aSelectedObject->_is_nil()) - return; - - TopoDS_Shape S; - if (!GEOMBase::GetShape(aSelectedObject, S)) - return; - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - if (S.ShapeType() == TopAbs_COMPSOLID || - S.ShapeType() == TopAbs_COMPOUND || - S.ShapeType() == TopAbs_SOLID || - S.ShapeType() == TopAbs_SHAPE) - return; - if ( getConstructorId() == 1 && - (S.ShapeType() == TopAbs_SHELL || - S.ShapeType() == TopAbs_VERTEX)) - return; - - myBase = aSelectedObject; - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); - myOkBase = true; - if (!myOkPath) - GroupPoints->PushButton2->click(); - else if (!myOkVec) - GroupPoints->PushButton3->click(); + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myBaseObjects.clear(); + QList objects = getSelected( TopAbs_SHAPE, -1 ); + for ( int i = 0; i < objects.count(); i++ ) { + GEOM::shape_type stype = objects[i]->GetMaxShapeType(); + GEOM::shape_type maxallowed = getConstructorId() == 1 ? GEOM::FACE : GEOM::SHELL; + GEOM::shape_type minallowed = getConstructorId() == 1 ? GEOM::EDGE : GEOM::VERTEX; + if ( stype < maxallowed || stype > minallowed ) + continue; + myBaseObjects << objects[i]; + } + if ( !myBaseObjects.isEmpty() ) { + QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } } - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupPoints->LineEdit3) { - myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false; - bool myOk = false; - QString aName = GEOMBase::GetName(aSelectedObject); - - if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){ - myPath = aSelectedObject; - myOkPath = true; - myEditCurrentArgument->setText(aName); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + QList types; + types << TopAbs_EDGE << TopAbs_WIRE; + myPath = getSelected( types ); + if ( myPath ) { + QString aName = GEOMBase::GetName( myPath.get() ); + myEditCurrentArgument->setText( aName ); + if ( getConstructorId() == 1 && !myVec ) + GroupPoints->PushButton3->click(); + else if ( myBaseObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + } + } + else if (myEditCurrentArgument == GroupPoints->LineEdit3) { + myVec = getSelected( TopAbs_EDGE ); + if ( myVec ) { + QString aName = GEOMBase::GetName( myVec.get() ); + myEditCurrentArgument->setText( aName ); + if ( myBaseObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + else if ( !myPath ) + GroupPoints->PushButton2->click(); } - else - { - if (aSelectedObject != myBase) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName.append(":edge_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - myOk = true; - } - else { // get Object from study - aSelectedObject = aFindedObject; - myOk = true; - } - } - else { - myOk = true; - if (S.ShapeType() != TopAbs_EDGE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - myOk = false; - } - } - if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myPath = aSelectedObject; - myOkPath = myOk; - } - else if (myEditCurrentArgument == GroupPoints->LineEdit3) { - myVec = aSelectedObject; - myOkVec = myOk; - } - } - myEditCurrentArgument->setText(aName); - - if (myOkPath) { - if (!myOkBase) - GroupPoints->PushButton1->click(); - else if (!myOkVec) - GroupPoints->PushButton3->click(); - } - else if (myOkVec) { - if (!myOkBase) - GroupPoints->PushButton1->click(); - else if (!myOkPath) - GroupPoints->PushButton2->click(); - } - } } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -376,6 +308,7 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else { TColStd_MapOfInteger aMap; + aMap.Add(GEOM_COMPOUND); aMap.Add(GEOM_WIRE); aMap.Add(GEOM_LINE); globalSelection(aMap); @@ -397,27 +330,7 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GenerationGUI_PipeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 || - send == GroupPoints->LineEdit3) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } - - if (send == GroupPoints->LineEdit2) - GroupPoints->CheckButton1->setEnabled(true); - else - GroupPoints->CheckButton1->setEnabled(false); + processPreview(); } //================================================================================= @@ -428,7 +341,7 @@ void GenerationGUI_PipeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked(getConstructorId()); } @@ -458,12 +371,18 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PipeDlg::createOperation() //================================================================================= bool GenerationGUI_PipeDlg::isValid (QString&) { + bool ok = false; switch ( getConstructorId() ) { case 0 : - return myOkBase && myOkPath; + ok = !myBaseObjects.isEmpty() && myPath; + break; case 1 : - return myOkBase && myOkPath && myOkVec; + ok = !myBaseObjects.isEmpty() && myPath && myVec; + break; + default: + break; } + return ok; } //================================================================================= @@ -474,19 +393,21 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects) { GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) { - case 0 : - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakePipe(myBase, myPath); - break; - case 1 : - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePipeBiNormalAlongVector(myBase, myPath, myVec); - break; - } - - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + for (int i = 0; i < myBaseObjects.count(); i++) { + switch ( getConstructorId() ) { + case 0 : + anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get()); + break; + case 1 : + anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get()); + break; + } + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + } return true; } @@ -496,9 +417,15 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects) //================================================================================= void GenerationGUI_PipeDlg::addSubshapesToStudy() { - QMap objMap; - - objMap[GroupPoints->LineEdit2->text()] = myPath; + GEOMBase::PublishSubObject( myPath.get() ); + GEOMBase::PublishSubObject( myVec.get() ); +} - addSubshapesToFather(objMap); +//================================================================================= +// function : extractPrefix +// purpose : redefined from GEOMBase_Helper class +//================================================================================= +bool GenerationGUI_PipeDlg::extractPrefix() const +{ + return myBaseObjects.count() > 1; } diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index ed0b92625..eb69a3196 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI_PipeDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef GENERATIONGUI_PIPEDLG_H #define GENERATIONGUI_PIPEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_3Sel1Check; @@ -48,26 +50,23 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); virtual void addSubshapesToStudy(); + virtual bool extractPrefix() const; private: void Init(); void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myBase; /* Base shape */ - GEOM::GEOM_Object_var myPath; /* Shape, defining the path */ - GEOM::GEOM_Object_var myVec; /* Vector, defining the constant binormal direction */ - bool myOkBase; - bool myOkPath; - bool myOkVec; /* to check when arguments are defined */ + QList myBaseObjects; /* Base shapes */ + GEOM::GeomObjPtr myPath; /* Shape, defining the path */ + GEOM::GeomObjPtr myVec; /* Vector, defining the constant binormal direction */ - DlgRef_3Sel1Check* GroupPoints; + DlgRef_3Sel1Check* GroupPoints; private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index e4ff74ff3..b5cc5e31a 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI_PrismDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "GenerationGUI_PrismDlg.h" #include @@ -41,6 +42,7 @@ #include #include #include +#include #include @@ -53,8 +55,7 @@ //================================================================================= GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), - myInitial(true) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM"))); @@ -71,47 +72,49 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWi mainFrame()->RadioButton3->setIcon(image3); mainFrame()->RadioButton1->setChecked(true); - myBothway = myBothway2 = myBothway3 = false; - - GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget()); - GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV")); - GroupPoints->TextLabel1->setText(tr("GEOM_BASE")); - GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_HEIGHT")); - GroupPoints->PushButton1->setIcon(image1); - GroupPoints->PushButton2->setIcon(image1); - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); - GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY")); - GroupPoints->CheckButton1->setChecked(myBothway); - GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); - - GroupPoints2 = new DlgRef_3Sel1Check(centralWidget()); - GroupPoints2->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P")); - GroupPoints2->TextLabel1->setText(tr("GEOM_BASE")); - GroupPoints2->TextLabel2->setText(tr("GEOM_POINT_I").arg(1)); - GroupPoints2->TextLabel3->setText(tr("GEOM_POINT_I").arg(2)); - GroupPoints2->PushButton1->setIcon(image1); - GroupPoints2->PushButton2->setIcon(image1); - GroupPoints2->PushButton3->setIcon(image1); - GroupPoints2->CheckButton1->setText(tr("GEOM_BOTHWAY")); - GroupPoints2->CheckButton1->setChecked(myBothway2); - - GroupPoints3 = new DlgRef_1Sel3Spin1Check(centralWidget()); - GroupPoints3->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ")); - GroupPoints3->TextLabel1->setText(tr("GEOM_BASE")); - GroupPoints3->PushButton1->setIcon(image1); - GroupPoints3->TextLabel2->setText(tr("GEOM_DX")); - GroupPoints3->TextLabel3->setText(tr("GEOM_DY")); - GroupPoints3->TextLabel4->setText(tr("GEOM_DZ")); - GroupPoints3->CheckButton1->setText(tr("GEOM_BOTHWAY")); - GroupPoints3->CheckButton1->setChecked(myBothway3); + + GroupVecH = new DlgRef_2Sel1Spin3Check1Spin(centralWidget()); + GroupVecH->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV")); + GroupVecH->TextLabel1->setText(tr("GEOM_BASE")); + GroupVecH->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupVecH->TextLabel3->setText(tr("GEOM_HEIGHT")); + GroupVecH->TextLabel4->setText(tr("GEOM_SCALE_FACTOR")); + GroupVecH->PushButton1->setIcon(image1); + GroupVecH->PushButton2->setIcon(image1); + GroupVecH->LineEdit1->setReadOnly(true); + GroupVecH->LineEdit2->setReadOnly(true); + GroupVecH->CheckBox1->setText(tr("GEOM_BOTHWAY")); + GroupVecH->CheckBox2->setText(tr("GEOM_REVERSE")); + GroupVecH->CheckBox3->setText(tr("GEOM_SCALE_PRISM")); + + Group2Points = new DlgRef_3Sel2Check3Spin(centralWidget()); + Group2Points->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P")); + Group2Points->TextLabel1->setText(tr("GEOM_BASE")); + Group2Points->TextLabel2->setText(tr("GEOM_POINT_I").arg(1)); + Group2Points->TextLabel3->setText(tr("GEOM_POINT_I").arg(2)); + Group2Points->TextLabel4->setText(tr("GEOM_SCALE_FACTOR")); + Group2Points->PushButton1->setIcon(image1); + Group2Points->PushButton2->setIcon(image1); + Group2Points->PushButton3->setIcon(image1); + Group2Points->CheckBox1->setText(tr("GEOM_BOTHWAY")); + Group2Points->CheckBox2->setText(tr("GEOM_SCALE_PRISM")); + + GroupDXDYDZ = new DlgRef_1Sel3Spin2Check1Spin(centralWidget()); + GroupDXDYDZ->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ")); + GroupDXDYDZ->TextLabel1->setText(tr("GEOM_BASE")); + GroupDXDYDZ->PushButton1->setIcon(image1); + GroupDXDYDZ->TextLabel2->setText(tr("GEOM_DX")); + GroupDXDYDZ->TextLabel3->setText(tr("GEOM_DY")); + GroupDXDYDZ->TextLabel4->setText(tr("GEOM_DZ")); + GroupDXDYDZ->TextLabel5->setText(tr("GEOM_SCALE_FACTOR")); + GroupDXDYDZ->CheckBox1->setText(tr("GEOM_BOTHWAY")); + GroupDXDYDZ->CheckBox2->setText(tr("GEOM_SCALE_PRISM")); QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); - layout->addWidget(GroupPoints); - layout->addWidget(GroupPoints2); - layout->addWidget(GroupPoints3); + layout->addWidget(GroupVecH); + layout->addWidget(Group2Points); + layout->addWidget(GroupDXDYDZ); /***************************************************************/ setHelpFileName("create_extrusion_page.html"); @@ -139,76 +142,98 @@ void GenerationGUI_PrismDlg::Init() double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6); // VSR:TODO : DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6); // VSR:TODO : DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 6); // VSR:TODO : DBL_DIGITS_DISPLAY - GroupPoints3->SpinBox_DX->setValue(0.0); - GroupPoints3->SpinBox_DY->setValue(0.0); - GroupPoints3->SpinBox_DZ->setValue(0.0); + double aScaleFactor = 2.0; + double aScaleStep = 0.5; + double aScaleMin = Precision::Confusion() * 10.0; + + initSpinBox(GroupVecH->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + GroupVecH->SpinBox_DX->setValue(100.0); - initSpinBox(GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY - GroupPoints->SpinBox_DX->setValue(100.0); + initSpinBox(GroupDXDYDZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDXDYDZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDXDYDZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" ); + GroupDXDYDZ->SpinBox_DX->setValue(0.0); + GroupDXDYDZ->SpinBox_DY->setValue(0.0); + GroupDXDYDZ->SpinBox_DZ->setValue(0.0); + + initSpinBox(GroupVecH->SpinBox_DY, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" ); + initSpinBox(Group2Points->SpinBox1, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" ); + initSpinBox(GroupDXDYDZ->SpinBox_SC, aScaleMin, COORD_MAX, aScaleStep, "parametric_precision" ); + + GroupVecH->SpinBox_DY->setValue(aScaleFactor); + Group2Points->SpinBox1->setValue(aScaleFactor); + GroupDXDYDZ->SpinBox_SC->setValue(aScaleFactor); + + // hide not used controls + Group2Points->TextLabel5->hide(); + Group2Points->TextLabel6->hide(); + + Group2Points->SpinBox2->hide(); + Group2Points->SpinBox3->hide(); // init variables - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit2->setReadOnly(true); + myEditCurrentArgument = GroupVecH->LineEdit1; + GroupVecH->LineEdit1->setReadOnly(true); + GroupVecH->LineEdit2->setReadOnly(true); - GroupPoints2->LineEdit1->setReadOnly(true); - GroupPoints2->LineEdit2->setReadOnly(true); - GroupPoints2->LineEdit3->setReadOnly(true); + Group2Points->LineEdit1->setReadOnly(true); + Group2Points->LineEdit2->setReadOnly(true); + Group2Points->LineEdit3->setReadOnly(true); - GroupPoints3->LineEdit1->setReadOnly(true); + GroupDXDYDZ->LineEdit1->setReadOnly(true); - GroupPoints->LineEdit1->setText(""); - GroupPoints->LineEdit2->setText(""); + GroupVecH->LineEdit1->setText(""); + GroupVecH->LineEdit2->setText(""); - GroupPoints2->LineEdit1->setText(""); - GroupPoints2->LineEdit2->setText(""); - GroupPoints2->LineEdit3->setText(""); + Group2Points->LineEdit1->setText(""); + Group2Points->LineEdit2->setText(""); + Group2Points->LineEdit3->setText(""); - GroupPoints3->LineEdit1->setText(""); + GroupDXDYDZ->LineEdit1->setText(""); - myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); - myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; + myBaseObjects.clear(); + myPoint1.nullify(); + myPoint2.nullify(); + myVec.nullify(); + showOnlyPreviewControl(); + // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupVecH->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupVecH->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupVecH->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); - connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - - connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); - - connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints3->SpinBox_DZ, SIGNAL(valueChanged (double)), this, SLOT(ValueChangedInSpinBox())); - connect(GroupPoints3->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); + connect(GroupVecH->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); + connect(GroupVecH->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + connect(GroupVecH->CheckBox3, SIGNAL(toggled(bool)), this, SLOT(onScalePrism())); + connect(GroupVecH->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(Group2Points->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2Points->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2Points->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2Points->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); + connect(Group2Points->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism())); + connect(Group2Points->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(GroupDXDYDZ->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDXDYDZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDXDYDZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDXDYDZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDXDYDZ->SpinBox_SC, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDXDYDZ->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); + connect(GroupDXDYDZ->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism())); initName(tr("GEOM_EXTRUSION")); ConstructorsClicked(0); + onBothway(); } //================================================================================= @@ -217,10 +242,10 @@ void GenerationGUI_PrismDlg::Init() //================================================================================= void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step) { - GroupPoints->SpinBox_DX->setSingleStep(step); - GroupPoints3->SpinBox_DX->setSingleStep(step); - GroupPoints3->SpinBox_DY->setSingleStep(step); - GroupPoints3->SpinBox_DZ->setSingleStep(step); + GroupVecH->SpinBox_DX->setSingleStep(step); + GroupDXDYDZ->SpinBox_DX->setSingleStep(step); + GroupDXDYDZ->SpinBox_DY->setSingleStep(step); + GroupDXDYDZ->SpinBox_DZ->setSingleStep(step); } //================================================================================= @@ -229,62 +254,46 @@ void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step) //================================================================================= void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId) { - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - switch (constructorId) { case 0: - { - GroupPoints2->hide(); - GroupPoints3->hide(); - GroupPoints->show(); + Group2Points->hide(); + GroupDXDYDZ->hide(); + GroupVecH->show(); - GroupPoints->LineEdit1->setText(GroupPoints2->LineEdit1->text()); // keep base - GroupPoints->LineEdit2->setText(""); - myVec = GEOM::GEOM_Object::_nil(); - myOkVec = false; + GroupVecH->LineEdit2->setText(""); + myVec.nullify(); - GroupPoints->PushButton1->click(); - break; - } + GroupVecH->PushButton1->click(); + break; case 1: - { - GroupPoints->hide(); - GroupPoints2->show(); - GroupPoints3->hide(); - - GroupPoints2->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base - GroupPoints2->LineEdit2->setText(""); - GroupPoints2->LineEdit3->setText(""); - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - myOkPnt1 = myOkPnt2 = false; - - GroupPoints2->PushButton1->click(); - break; - } - case 2: - { - GroupPoints->hide(); - GroupPoints2->hide(); - GroupPoints3->show(); + GroupVecH->hide(); + Group2Points->show(); + GroupDXDYDZ->hide(); - GroupPoints3->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base + Group2Points->LineEdit2->setText(""); + Group2Points->LineEdit3->setText(""); + myPoint1.nullify(); + myPoint2.nullify(); - GroupPoints3->PushButton1->click(); - break; - } + Group2Points->PushButton1->click(); + break; + case 2: + GroupVecH->hide(); + Group2Points->hide(); + GroupDXDYDZ->show(); + + GroupDXDYDZ->PushButton1->click(); + break; + default: + break; } qApp->processEvents(); updateGeometry(); resize(minimumSizeHint()); - if (myInitial) { - myInitial = false; - SelectionIntoArgument(); - } - else { - displayPreview(); - } + SelectionIntoArgument(); + processPreview(); } //================================================================================= @@ -293,6 +302,7 @@ void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId) //================================================================================= void GenerationGUI_PrismDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -321,172 +331,62 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (getConstructorId() == 0) - { - if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myOkBase = false; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myOkVec = false; - return; + if ( myEditCurrentArgument == GroupVecH->LineEdit1 || + myEditCurrentArgument == Group2Points->LineEdit1 || + myEditCurrentArgument == GroupDXDYDZ->LineEdit1 ) { + myBaseObjects.clear(); + QList objects = getSelected( TopAbs_SHAPE, -1 ); + for ( int i = 0; i < objects.count(); i++ ) { + GEOM::shape_type stype = objects[i]->GetMaxShapeType(); + if ( stype < GEOM::SHELL || stype > GEOM::VERTEX ) + continue; + myBaseObjects << objects[i]; } - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape - bool myOk = true; - TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName.append(":edge_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - } - else { // Global Selection - if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - myOk = false; - } - } + if ( !myBaseObjects.isEmpty() ) { + QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() ); + GroupVecH->LineEdit1->setText( aName ); + Group2Points->LineEdit1->setText( aName ); + GroupDXDYDZ->LineEdit1->setText( aName ); } - - myEditCurrentArgument->setText(aName); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - myBase = aSelectedObject; - myOkBase = true; - if (!myOkVec) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) { - myOkVec = true; - myVec = aSelectedObject; - if (!myOkBase) - GroupPoints->PushButton1->click(); + else { + GroupVecH->LineEdit1->setText( "" ); + Group2Points->LineEdit1->setText( "" ); + GroupDXDYDZ->LineEdit1->setText( "" ); } } - else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points - if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints2->LineEdit1) - myOkBase = false; - else if (myEditCurrentArgument == GroupPoints2->LineEdit2) { - myPoint1 = GEOM::GEOM_Object::_nil(); - myOkPnt1 = false; - } - else if (myEditCurrentArgument == GroupPoints2->LineEdit3) { - myPoint2 = GEOM::GEOM_Object::_nil(); - myOkPnt2 = false; - } - return; - } - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - TopoDS_Shape aShape; - bool myOk = true; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName.append(":vertex_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; - } - } - else { - if ((aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2) || - (aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3)) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - myOk = false; - } - } - } - - myEditCurrentArgument->setText(aName); - - if (myEditCurrentArgument == GroupPoints2->LineEdit1) { - myOkBase = true; - myBase = aSelectedObject; - if (!myOkPnt1) - GroupPoints2->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) { - myOkPnt1 = true; - myPoint1 = aSelectedObject; - if (!myOkPnt2) - GroupPoints2->PushButton3->click(); + else if ( myEditCurrentArgument == GroupVecH->LineEdit2 ) { + myVec = getSelected( TopAbs_EDGE ); + if ( myVec ) { + QString aName = GEOMBase::GetName( myVec.get() ); + myEditCurrentArgument->setText( aName ); + if ( myBaseObjects.isEmpty() ) + GroupVecH->PushButton1->click(); } - else if (myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk) { - myOkPnt2 = true; - myPoint2 = aSelectedObject; - if (!myOkBase) - GroupPoints2->PushButton1->click(); + } + if ( myEditCurrentArgument == Group2Points->LineEdit2 ) { + myPoint1 = getSelected( TopAbs_VERTEX ); + if ( myPoint1 ) { + QString aName = GEOMBase::GetName( myPoint1.get() ); + myEditCurrentArgument->setText( aName ); + if ( !myPoint2 ) + Group2Points->PushButton3->click(); + else if ( myBaseObjects.isEmpty() ) + Group2Points->PushButton1->click(); } } - else if (getConstructorId() == 2) { // extrusion using dx dy dz - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - myBase = aSelectedObject; - myOkBase = true; - myEditCurrentArgument->setText(aName); + if ( myEditCurrentArgument == Group2Points->LineEdit3 ) { + myPoint2 = getSelected( TopAbs_VERTEX ); + if ( myPoint2 ) { + QString aName = GEOMBase::GetName( myPoint2.get() ); + myEditCurrentArgument->setText( aName ); + if ( myBaseObjects.isEmpty() ) + Group2Points->PushButton1->click(); + else if ( !myPoint1 ) + Group2Points->PushButton2->click(); + } } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -499,42 +399,42 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); globalSelection(GEOM_ALLSHAPES); - if (send == GroupPoints->PushButton1) { - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->PushButton2->setDown(false); - GroupPoints->LineEdit2->setEnabled(false); + if (send == GroupVecH->PushButton1) { + myEditCurrentArgument = GroupVecH->LineEdit1; + GroupVecH->PushButton2->setDown(false); + GroupVecH->LineEdit2->setEnabled(false); } - else if (send == GroupPoints->PushButton2) { - myEditCurrentArgument = GroupPoints->LineEdit2; - GroupPoints->PushButton1->setDown(false); - GroupPoints->LineEdit1->setEnabled(false); + else if (send == GroupVecH->PushButton2) { + myEditCurrentArgument = GroupVecH->LineEdit2; + GroupVecH->PushButton1->setDown(false); + GroupVecH->LineEdit1->setEnabled(false); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); } - else if (send == GroupPoints2->PushButton1) { - myEditCurrentArgument = GroupPoints2->LineEdit1; - GroupPoints2->PushButton2->setDown(false); - GroupPoints2->PushButton3->setDown(false); - GroupPoints2->LineEdit2->setEnabled(false); - GroupPoints2->LineEdit3->setEnabled(false); + else if (send == Group2Points->PushButton1) { + myEditCurrentArgument = Group2Points->LineEdit1; + Group2Points->PushButton2->setDown(false); + Group2Points->PushButton3->setDown(false); + Group2Points->LineEdit2->setEnabled(false); + Group2Points->LineEdit3->setEnabled(false); } - else if (send == GroupPoints2->PushButton2) { - myEditCurrentArgument = GroupPoints2->LineEdit2; - GroupPoints2->PushButton1->setDown(false); - GroupPoints2->PushButton3->setDown(false); - GroupPoints2->LineEdit1->setEnabled(false); - GroupPoints2->LineEdit3->setEnabled(false); + else if (send == Group2Points->PushButton2) { + myEditCurrentArgument = Group2Points->LineEdit2; + Group2Points->PushButton1->setDown(false); + Group2Points->PushButton3->setDown(false); + Group2Points->LineEdit1->setEnabled(false); + Group2Points->LineEdit3->setEnabled(false); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); } - else if (send == GroupPoints2->PushButton3) { - myEditCurrentArgument = GroupPoints2->LineEdit3; - GroupPoints2->PushButton1->setDown(false); - GroupPoints2->PushButton2->setDown(false); - GroupPoints2->LineEdit1->setEnabled(false); - GroupPoints2->LineEdit2->setEnabled(false); + else if (send == Group2Points->PushButton3) { + myEditCurrentArgument = Group2Points->LineEdit3; + Group2Points->PushButton1->setDown(false); + Group2Points->PushButton2->setDown(false); + Group2Points->LineEdit1->setEnabled(false); + Group2Points->LineEdit2->setEnabled(false); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); } - else if (send == GroupPoints3->PushButton1) { - myEditCurrentArgument = GroupPoints3->LineEdit1; + else if (send == GroupDXDYDZ->PushButton1) { + myEditCurrentArgument = GroupDXDYDZ->LineEdit1; } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -546,25 +446,7 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GenerationGUI_PrismDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 || - send == GroupPoints2->LineEdit1 || - send == GroupPoints2->LineEdit2 || - send == GroupPoints2->LineEdit3 || - send == GroupPoints3->LineEdit1) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -576,7 +458,7 @@ void GenerationGUI_PrismDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -597,16 +479,7 @@ void GenerationGUI_PrismDlg::enterEvent (QEvent*) //================================================================================= void GenerationGUI_PrismDlg::ValueChangedInSpinBox() { - displayPreview(); -} - -//================================================================================= -// function : getHeight() -// purpose : -//================================================================================= -double GenerationGUI_PrismDlg::getHeight() const -{ - return GroupPoints->SpinBox_DX->value(); + processPreview(); } //================================================================================= @@ -624,24 +497,82 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation() //================================================================================= bool GenerationGUI_PrismDlg::isValid (QString& msg) { - bool ok = true; - if( getConstructorId() == 0 ) - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - else if( getConstructorId() == 2 ) - { - ok = GroupPoints3->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + bool ok = false; + switch ( getConstructorId() ) { + case 0: + ok = GroupVecH->SpinBox_DX->isValid( msg, !IsPreview() ) && + !myBaseObjects.isEmpty() && myVec; + break; + case 1: + ok = !myBaseObjects.isEmpty() && myPoint1 && myPoint2; + break; + case 2: + ok = GroupDXDYDZ->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupDXDYDZ->SpinBox_DY->isValid( msg, !IsPreview() ) && + GroupDXDYDZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && + !myBaseObjects.isEmpty(); + break; + default: + break; } - if (getConstructorId() == 0) - return (myOkBase && myOkVec) && ok; // by vector and height - else if (getConstructorId() == 1) - return (myOkBase && myOkPnt1 && myOkPnt2); // by two points - else if (getConstructorId() == 2) - return myOkBase && ok; + return ok; +} + +//================================================================================= +// function : onReverse() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::onReverse() +{ + double anOldValue = GroupVecH->SpinBox_DX->value(); + GroupVecH->SpinBox_DX->setValue(-anOldValue); +} + +//================================================================================= +// function : onBothway() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::onBothway() +{ + GroupVecH->CheckBox2->setEnabled(!GroupVecH->CheckBox1->isChecked()); // is reversed + GroupVecH->CheckBox3->setEnabled(!GroupVecH->CheckBox1->isChecked()); // is scaled + GroupVecH->TextLabel4->setEnabled(!GroupVecH->CheckBox1->isChecked() && + GroupVecH->CheckBox3->isChecked()); // scale factor + GroupVecH->SpinBox_DY->setEnabled(!GroupVecH->CheckBox1->isChecked() && + GroupVecH->CheckBox3->isChecked()); // scale factor + + Group2Points->CheckBox2->setEnabled(!Group2Points->CheckBox1->isChecked()); // is scaled + Group2Points->TextLabel4->setEnabled(!Group2Points->CheckBox1->isChecked() && + Group2Points->CheckBox2->isChecked()); // scale factor + Group2Points->SpinBox1->setEnabled(!Group2Points->CheckBox1->isChecked() && + Group2Points->CheckBox2->isChecked()); // scale factor + + GroupDXDYDZ->CheckBox2->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked()); // is scaled + GroupDXDYDZ->TextLabel5->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked() && + GroupDXDYDZ->CheckBox2->isChecked()); // scale factor + GroupDXDYDZ->SpinBox_SC->setEnabled(!GroupDXDYDZ->CheckBox1->isChecked() && + GroupDXDYDZ->CheckBox2->isChecked()); // scale factor + + processPreview(); +} + +//================================================================================= +// function : onScalePrism() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::onScalePrism() +{ + GroupVecH->TextLabel4->setEnabled(GroupVecH->CheckBox3->isChecked()); + GroupVecH->SpinBox_DY->setEnabled(GroupVecH->CheckBox3->isChecked()); + + Group2Points->TextLabel4->setEnabled(Group2Points->CheckBox2->isChecked()); + Group2Points->SpinBox1->setEnabled(Group2Points->CheckBox2->isChecked()); + + GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked()); + GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked()); - return false; + processPreview(); } //================================================================================= @@ -653,118 +584,95 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects) QStringList aParameters; GEOM::GEOM_Object_var anObj; - switch (getConstructorId()) { - case 0: - if (!myBothway) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismVecH(myBase, myVec, getHeight()); - } - else { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismVecH2Ways(myBase, myVec, getHeight()); - } + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); - if (!anObj->_is_nil() && !IsPreview()) - { - aParameters << GroupPoints->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); - } + for (int i = 0; i < myBaseObjects.count(); i++) { + switch (getConstructorId()) { + case 0: + if (GroupVecH->CheckBox1->isChecked()) + anObj = anOper->MakePrismVecH2Ways(myBaseObjects[i].get(), myVec.get(), + GroupVecH->SpinBox_DX->value()); + else { + if (GroupVecH->CheckBox3->isChecked()) + anObj = anOper->MakePrismVecHWithScaling(myBaseObjects[i].get(), myVec.get(), + GroupVecH->SpinBox_DX->value(), + GroupVecH->SpinBox_DY->value()); + else + anObj = anOper->MakePrismVecH(myBaseObjects[i].get(), myVec.get(), + GroupVecH->SpinBox_DX->value()); + } - break; - case 1: - if (!myBothway2) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismTwoPnt(myBase, myPoint1, myPoint2); - } - else { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2); - } - break; - case 2: - double dx = GroupPoints3->SpinBox_DX->value(); - double dy = GroupPoints3->SpinBox_DY->value(); - double dz = GroupPoints3->SpinBox_DZ->value(); + if (!anObj->_is_nil() && !IsPreview()) { + aParameters << GroupVecH->SpinBox_DX->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + break; + case 1: + if (Group2Points->CheckBox1->isChecked()) + anObj = anOper->MakePrismTwoPnt2Ways(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get()); + else { + if (Group2Points->CheckBox2->isChecked()) + anObj = anOper->MakePrismTwoPntWithScaling(myBaseObjects[i].get(), myPoint1.get(), + myPoint2.get(), Group2Points->SpinBox1->value()); + else + anObj = anOper->MakePrismTwoPnt(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get()); + } + break; + case 2: + double dx = GroupDXDYDZ->SpinBox_DX->value(); + double dy = GroupDXDYDZ->SpinBox_DY->value(); + double dz = GroupDXDYDZ->SpinBox_DZ->value(); - if (!myBothway3) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismDXDYDZ(myBase, dx, dy, dz); - } - else { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismDXDYDZ2Ways(myBase, dx, dy, dz); - } + if (GroupDXDYDZ->CheckBox1->isChecked()) + anObj = anOper->MakePrismDXDYDZ2Ways(myBaseObjects[i].get(), dx, dy, dz); + else { + if (GroupDXDYDZ->CheckBox2->isChecked()) + anObj = anOper->MakePrismDXDYDZWithScaling(myBaseObjects[i].get(), dx, dy, dz, + GroupDXDYDZ->SpinBox_SC->value()); + else + anObj = anOper->MakePrismDXDYDZ(myBaseObjects[i].get(), dx, dy, dz); + } - if (!anObj->_is_nil() && !IsPreview()) - { - aParameters << GroupPoints3->SpinBox_DX->text(); - aParameters << GroupPoints3->SpinBox_DY->text(); - aParameters << GroupPoints3->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + if (!anObj->_is_nil() && !IsPreview()) { + aParameters << GroupDXDYDZ->SpinBox_DX->text(); + aParameters << GroupDXDYDZ->SpinBox_DY->text(); + aParameters << GroupDXDYDZ->SpinBox_DZ->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + break; } - break; + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); } - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); - return true; } //================================================================================= -// function : onReverse() -// purpose : -//================================================================================= -void GenerationGUI_PrismDlg::onReverse() -{ - double anOldValue = GroupPoints->SpinBox_DX->value(); - GroupPoints->SpinBox_DX->setValue(-anOldValue); -} - -//================================================================================= -// function : onBothway() -// purpose : +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection //================================================================================= -void GenerationGUI_PrismDlg::onBothway() +void GenerationGUI_PrismDlg::addSubshapesToStudy() { - bool anOldValue; switch (getConstructorId()) { case 0: - anOldValue = myBothway; - myBothway = !anOldValue; - GroupPoints->CheckButton2->setEnabled(!myBothway); - displayPreview(); + GEOMBase::PublishSubObject( myVec.get() ); break; case 1: - anOldValue = myBothway2; - myBothway2 = !anOldValue; - displayPreview(); + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); break; - case 2: - anOldValue = myBothway3; - myBothway3 = !anOldValue; - displayPreview(); + default: break; } } //================================================================================= -// function : addSubshapeToStudy -// purpose : virtual method to add new SubObjects if local selection +// function : extractPrefix +// purpose : redefined from GEOMBase_Helper class //================================================================================= -void GenerationGUI_PrismDlg::addSubshapesToStudy() +bool GenerationGUI_PrismDlg::extractPrefix() const { - QMap objMap; - - switch (getConstructorId()) { - case 0: - objMap[GroupPoints->LineEdit2->text()] = myVec; - break; - case 1: - objMap[GroupPoints2->LineEdit2->text()] = myPoint1; - objMap[GroupPoints2->LineEdit3->text()] = myPoint2; - break; - } - addSubshapesToFather(objMap); + return myBaseObjects.count() > 1; } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index 1ccc7461b..5b1524517 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -1,36 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI_PrismDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #ifndef GENERATIONGUI_PRISMDLG_H #define GENERATIONGUI_PRISMDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" -class DlgRef_2Sel1Spin2Check; -class DlgRef_3Sel1Check; -class DlgRef_1Sel3Spin1Check; +class DlgRef_2Sel1Spin3Check1Spin; +class DlgRef_3Sel2Check3Spin; +class DlgRef_1Sel3Spin2Check1Spin; //================================================================================= // class : GenerationGUI_PrismDlg @@ -50,37 +52,25 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); virtual void addSubshapesToStudy(); + virtual bool extractPrefix() const; private: void Init(); void enterEvent( QEvent* ); - double getHeight() const; private: - GEOM::GEOM_Object_var myBase; /* Base shape */ - GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */ - GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ - - bool myOkBase; - bool myOkVec; - bool myOkPnt1; - bool myOkPnt2; - bool myBothway; - bool myBothway2; - bool myBothway3; - - // to initialize the first selection field with a selected object on the dialog creation - bool myInitial; + QList myBaseObjects; /* Base shapes */ + GEOM::GeomObjPtr myVec; /* Vector, defining the direction */ + GEOM::GeomObjPtr myPoint1, myPoint2; /* Points for extrusion */ - DlgRef_2Sel1Spin2Check* GroupPoints; - DlgRef_3Sel1Check* GroupPoints2; // for second layout for extrusion using 2 points - DlgRef_1Sel3Spin1Check* GroupPoints3; + DlgRef_2Sel1Spin3Check1Spin* GroupVecH; + DlgRef_3Sel2Check3Spin* Group2Points; + DlgRef_1Sel3Spin2Check1Spin* GroupDXDYDZ; private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); @@ -88,6 +78,7 @@ private slots: void SetDoubleSpinBoxStep( double ); void onReverse(); void onBothway(); + void onScalePrism(); }; #endif // GENERATIONGUI_PRISMDLG_H diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 2a5d00b43..5e1e3f022 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI_RevolDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "GenerationGUI_RevolDlg.h" #include @@ -67,11 +68,10 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg (GeometryGUI* theGeometryGUI, QWi mainFrame()->RadioButton2->close(); mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - myBothway = false; GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget()); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); GroupPoints->PushButton1->setIcon(image1); @@ -109,7 +109,7 @@ void GenerationGUI_RevolDlg::Init() { // min, max, step and decimals for spin boxes & initial values double SpecificStep = 5; - initSpinBox(GroupPoints->SpinBox_DX, -360.0, 360.0, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupPoints->SpinBox_DX, -360.0, 360.0, SpecificStep, "angle_precision" ); GroupPoints->SpinBox_DX->setValue(45.0); // init variables @@ -118,8 +118,11 @@ void GenerationGUI_RevolDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myBase = myAxis = GEOM::GEOM_Object::_nil(); - myOkBase = myOkAxis = false; + + myBaseObjects.clear(); + myAxis.nullify(); + + showOnlyPreviewControl(); // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -128,16 +131,15 @@ void GenerationGUI_RevolDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); + // san: We don't need this, as the default step value is not used in this dialog box + //connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); initName(tr("GEOM_REVOLUTION")); + resize(100,100); GroupPoints->PushButton1->click(); SelectionIntoArgument(); @@ -158,6 +160,7 @@ void GenerationGUI_RevolDlg::SetDoubleSpinBoxStep (double step) //================================================================================= void GenerationGUI_RevolDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -177,32 +180,6 @@ bool GenerationGUI_RevolDlg::ClickOnApply() return true; } -//======================================================================= -//function : isAcceptableBase -//purpose : return true if theBase can be used as algo argument -//======================================================================= -static bool isAcceptableBase (const TopoDS_Shape& theBase) -{ - switch (theBase.ShapeType()) { - case TopAbs_VERTEX: - case TopAbs_EDGE: - case TopAbs_WIRE: - case TopAbs_FACE: - case TopAbs_SHELL: - return true; - case TopAbs_SOLID: - case TopAbs_COMPSOLID: - return false; - case TopAbs_COMPOUND: { - TopExp_Explorer exp(theBase, TopAbs_SOLID); - return !exp.More(); - } - default: - return false; - } - return false; -} - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection is changed or on dialog initialization or activation @@ -211,81 +188,31 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() { erasePreview(); myEditCurrentArgument->setText(""); - if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkAxis = false; - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || aSelectedObject->_is_nil()) - return; - - TopoDS_Shape S; - if (!GEOMBase::GetShape(aSelectedObject, S) || S.IsNull()) - return; - QString aName = GEOMBase::GetName(aSelectedObject); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - if (!isAcceptableBase(S)) - return; - - myBase = aSelectedObject; - myOkBase = true; - myEditCurrentArgument->setText(aName); - if (!myOkAxis) - GroupPoints->PushButton2->click(); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myBaseObjects.clear(); + QList objects = getSelected( TopAbs_SHAPE, -1 ); + for ( int i = 0; i < objects.count(); i++ ) { + GEOM::shape_type stype = objects[i]->GetMaxShapeType(); + if ( stype < GEOM::SHELL || stype > GEOM::VERTEX ) + continue; + myBaseObjects << objects[i]; + } + if ( !myBaseObjects.isEmpty() ) { + QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } } else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName.append(":edge_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); - myOkAxis = true; - } - else { - myAxis = aFindedObject; - myOkAxis = true; - } + myAxis = getSelected( TopAbs_EDGE ); + if ( myAxis ) { + QString aName = GEOMBase::GetName( myAxis.get() ); + myEditCurrentArgument->setText( aName ); + if ( myBaseObjects.isEmpty() ) + GroupPoints->PushButton1->click(); } - else { - myOkAxis = true; - if (S.ShapeType() != TopAbs_EDGE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - myOkAxis = false; - } - myAxis = aSelectedObject; - } - myEditCurrentArgument->setText(aName); - if (myOkAxis && !myOkBase) - GroupPoints->PushButton1->click(); } - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -319,21 +246,7 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GenerationGUI_RevolDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -344,9 +257,9 @@ void GenerationGUI_RevolDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); - displayPreview(); + processPreview(); } //================================================================================= @@ -365,7 +278,7 @@ void GenerationGUI_RevolDlg::enterEvent (QEvent*) //================================================================================= void GenerationGUI_RevolDlg::ValueChangedInSpinBox() { - displayPreview(); + processPreview(); } //================================================================================= @@ -392,8 +305,7 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_RevolDlg::createOperation() //================================================================================= bool GenerationGUI_RevolDlg::isValid (QString& msg) { - bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ); - return myOkBase && myOkAxis && ok; + return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myBaseObjects.isEmpty() && myAxis; } //================================================================================= @@ -403,25 +315,24 @@ bool GenerationGUI_RevolDlg::isValid (QString& msg) bool GenerationGUI_RevolDlg::execute (ObjectList& objects) { GEOM::GEOM_Object_var anObj; - - if (!myBothway) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeRevolutionAxisAngle(myBase, myAxis, getAngle() * PI180); - } - else { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeRevolutionAxisAngle2Ways(myBase, myAxis, getAngle() * PI180); - } - - if (!anObj->_is_nil()) - { - if (!IsPreview()) - { - QStringList aParameters; - aParameters << GroupPoints->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + + for (int i = 0; i < myBaseObjects.count(); i++) { + if (!GroupPoints->CheckButton1->isChecked()) + anObj = anOper->MakeRevolutionAxisAngle(myBaseObjects[i].get(), myAxis.get(), + getAngle() * M_PI / 180.); + else + anObj = anOper->MakeRevolutionAxisAngle2Ways(myBaseObjects[i].get(), myAxis.get(), + getAngle() * M_PI / 180.); + + if (!anObj->_is_nil()) { + if (!IsPreview()) { + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + objects.push_back(anObj._retn()); } - objects.push_back(anObj._retn()); } return true; @@ -443,10 +354,8 @@ void GenerationGUI_RevolDlg::onReverse() //================================================================================= void GenerationGUI_RevolDlg::onBothway() { - bool anOldValue = myBothway; - myBothway = !anOldValue; - GroupPoints->CheckButton2->setEnabled(!myBothway); - displayPreview(); + GroupPoints->CheckButton2->setEnabled(!GroupPoints->CheckButton1->isChecked()); + processPreview(); } //================================================================================= @@ -455,9 +364,14 @@ void GenerationGUI_RevolDlg::onBothway() //================================================================================= void GenerationGUI_RevolDlg::addSubshapesToStudy() { - QMap objMap; - - objMap[GroupPoints->LineEdit2->text()] = myAxis; + GEOMBase::PublishSubObject( myAxis.get() ); +} - addSubshapesToFather(objMap); +//================================================================================= +// function : extractPrefix +// purpose : redefined from GEOMBase_Helper class +//================================================================================= +bool GenerationGUI_RevolDlg::extractPrefix() const +{ + return myBaseObjects.count() > 1; } diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h index 89318effc..e39eff4a0 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.h +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GenerationGUI_RevolDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef GENERATIONGUI_REVOLUTIONDLG_H #define GENERATIONGUI_REVOLUTIONDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel1Spin2Check; @@ -48,6 +50,7 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); virtual void addSubshapesToStudy(); + virtual bool extractPrefix() const; private: void Init(); @@ -55,11 +58,8 @@ private: double getAngle() const; private: - GEOM::GEOM_Object_var myBase; /* Base shape */ - GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */ - bool myOkBase; - bool myOkAxis; - bool myBothway; + QList myBaseObjects; /* Base shapes */ + GEOM::GeomObjPtr myAxis; /* Axis of the revolution */ DlgRef_2Sel1Spin2Check* GroupPoints; @@ -67,7 +67,6 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(); diff --git a/src/GenerationGUI/Makefile.am b/src/GenerationGUI/Makefile.am index 8fd63002e..35afde04d 100644 --- a/src/GenerationGUI/Makefile.am +++ b/src/GenerationGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GENERATIONGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -79,8 +77,7 @@ libGenerationGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGenerationGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ diff --git a/src/GroupGUI/GroupGUI.cxx b/src/GroupGUI/GroupGUI.cxx index 89d84ebf2..990263407 100644 --- a/src/GroupGUI/GroupGUI.cxx +++ b/src/GroupGUI/GroupGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GroupGUI.cxx // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) @@ -27,6 +28,8 @@ #include "GroupGUI_GroupDlg.h" #include +#include "GeometryGUI_Operations.h" + #include #include @@ -74,17 +77,17 @@ bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) if ( aStudy->GetProperties()->IsLocked() ) { SUIT_MessageBox::warning( parent, - tr( "WRN_WARNING" ), - tr( "WRN_STUDY_LOCKED" ) ); + tr( "WRN_WARNING" ), + tr( "WRN_STUDY_LOCKED" ) ); return false; } switch ( theCommandID ) { - case 800: - case 8001: // CREATE GROUP + case GEOMOp::OpGroupCreate: + case GEOMOp::OpGroupCreatePopup: // CREATE GROUP aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::CreateGroup, getGeometryGUI(), parent ); break; - case 801: // EDIT GROUP + case GEOMOp::OpGroupEdit: // EDIT GROUP { SALOME_ListIO aList; aList.Clear(); @@ -94,14 +97,13 @@ bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) aSelMgr->selectedObjects( aList ); if ( aList.Extent() == 1 ) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( aList.First(), aResult ); - - if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { - aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent ); - break; - } + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( aList.First() ); + + if ( !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { + aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent ); + break; + } } SUIT_MessageBox::warning( parent, tr( "WRN_WARNING" ), tr( "NO_GROUP" ) ); break; diff --git a/src/GroupGUI/GroupGUI.h b/src/GroupGUI/GroupGUI.h index a0e97d948..8cb96b913 100644 --- a/src/GroupGUI/GroupGUI.h +++ b/src/GroupGUI/GroupGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : GroupGUI.h // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index e17b859aa..5d51da8fb 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -1,157 +1,196 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : GroupGUI_GroupDlg.cxx -// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// GEOM GEOMGUI : GUI for Geometry component +// File : GroupGUI_GroupDlg.cxx +// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) + #include "GroupGUI_GroupDlg.h" +#include +#include +#include +#include + +#include +#include + #include + +#include +#include +#include +#include +#include + #include #include #include #include -#include -#include - -#include -#include -#include -#include -#include +#include +#include #include #include #include #include +#include +#include + +#include +#include +#include #include #include #include +#include + enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 }; -GroupGUI_GroupDlg::GroupGUI_GroupDlg( Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent ) - : GEOMBase_Skeleton( theGeometryGUI, parent, false ), - myMode( mode ), - myBusy( false ) +GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false), + myMode(mode), + myBusy(false), + myIsShapeType(false), + myIsHiddenMain(false) { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QPixmap image0 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_VERTEX" ) ) ); - QPixmap image1 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_EDGE" ) ) ); - QPixmap image2 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_FACE" ) ) ); - QPixmap image3 ( resMgr->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_SOLID" ) ) ); - QPixmap iconSelect ( resMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap image0 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX"))); + QPixmap image1 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_EDGE"))); + QPixmap image2 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_FACE"))); + QPixmap image3 (resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_SOLID"))); + QPixmap iconSelect (resMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); - setWindowTitle( myMode == CreateGroup ? tr( "CREATE_GROUP_TITLE" ) : tr( "EDIT_GROUP_TITLE" ) ); + setWindowTitle(myMode == CreateGroup ? tr("CREATE_GROUP_TITLE") : tr("EDIT_GROUP_TITLE")); // Shape type button group - mainFrame()->GroupConstructors->setEnabled( myMode == CreateGroup ); - mainFrame()->GroupConstructors->setTitle( tr( "SHAPE_TYPE" ) ); - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setIcon( image1 ); - mainFrame()->RadioButton3->setIcon( image2 ); - mainFrame()->RadioButton4->setIcon( image3 ); + mainFrame()->GroupConstructors->setEnabled(myMode == CreateGroup); + mainFrame()->GroupConstructors->setTitle(tr("SHAPE_TYPE")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setIcon(image1); + mainFrame()->RadioButton3->setIcon(image2); + mainFrame()->RadioButton4->setIcon(image3); mainFrame()->RadioButton4->show(); // Group name - mainFrame()->GroupBoxName->setTitle( tr( "GROUP_NAME" ) ); + mainFrame()->GroupBoxName->setTitle(tr("GROUP_NAME")); // Main shape and sub-shapes - QGroupBox* GroupMedium = new QGroupBox( tr( "MAIN_SUB_SHAPES" ), centralWidget() ); - QGridLayout* aMedLayout = new QGridLayout( GroupMedium ); - aMedLayout->setMargin( 9 ); - aMedLayout->setSpacing( 6 ); - - QLabel* aMainLabel = new QLabel( tr( "MAIN_SHAPE" ), GroupMedium ); - - mySelBtn = new QPushButton( GroupMedium ); - mySelBtn->setIcon( iconSelect ); - mySelBtn->setEnabled( myMode == CreateGroup ); - - myMainName = new QLineEdit( GroupMedium ); - myMainName->setReadOnly( true ); - myMainName->setEnabled( myMode == CreateGroup ); - - QLabel* aSecondLabel = new QLabel( tr( "SECOND_SHAPE" ), GroupMedium ); - - mySelBtn2 = new QPushButton( GroupMedium ); - mySelBtn2->setIcon( iconSelect ); - mySelBtn2->setEnabled( false ); - - myShape2Name = new QLineEdit( GroupMedium ); - myShape2Name->setReadOnly( true ); - myShape2Name->setEnabled( false ); - - mySelectionWayGroupBox = new QGroupBox( tr("SHAPE_SEL_RESTR"), GroupMedium ); - mySelectionWayGroup = new QButtonGroup( mySelectionWayGroupBox ); - QRadioButton* allSubs = new QRadioButton( tr( "NO_RESTR" ) , mySelectionWayGroupBox ); - QRadioButton* inPlaceSubs = new QRadioButton( tr( "GEOM_PARTS_OF_SHAPE2" ), mySelectionWayGroupBox ); - QRadioButton* shape2Subs = new QRadioButton( tr( "SUBSHAPES_OF_SHAPE2" ) , mySelectionWayGroupBox ); - QVBoxLayout* mySelWayLayout = new QVBoxLayout( mySelectionWayGroupBox ); - mySelWayLayout->setMargin( 9 ); - mySelWayLayout->setSpacing( 6 ); - mySelWayLayout->addWidget( allSubs ); - mySelWayLayout->addWidget( inPlaceSubs ); - mySelWayLayout->addWidget( shape2Subs ); - mySelectionWayGroup->addButton( allSubs, ALL_SUBSHAPES ); - mySelectionWayGroup->addButton( inPlaceSubs, GET_IN_PLACE ); - mySelectionWayGroup->addButton( shape2Subs, SUBSHAPES_OF_SHAPE2 ); - allSubs->setChecked( true ); - - mySelAllBtn = new QPushButton( tr( "SELECT_ALL" ), GroupMedium ); - myAddBtn = new QPushButton( tr( "ADD" ), GroupMedium ); - myRemBtn = new QPushButton( tr( "REMOVE" ), GroupMedium ); - myIdList = new QListWidget( GroupMedium ); - - myIdList->setSelectionMode( QAbstractItemView::ExtendedSelection ); - myIdList->setFlow( QListView::TopToBottom ); - myIdList->setWrapping( true ); - - aMedLayout->addWidget( aMainLabel, 0, 0 ); - aMedLayout->addWidget( mySelBtn, 0, 1 ); - aMedLayout->addWidget( myMainName, 0, 2, 1, 2 ); - aMedLayout->addWidget( aSecondLabel, 1, 0 ); - aMedLayout->addWidget( mySelBtn2, 1, 1 ); - aMedLayout->addWidget( myShape2Name, 1, 2, 1, 2 ); - aMedLayout->addWidget( mySelectionWayGroupBox, 2, 0, 3, 3 ); - aMedLayout->addWidget( mySelAllBtn, 2, 3 ); - aMedLayout->addWidget( myAddBtn, 3, 3 ); - aMedLayout->addWidget( myRemBtn, 4, 3 ); - aMedLayout->addWidget( myIdList, 5, 0, 1, 4 ); - aMedLayout->setRowStretch( 5, 1 ); - - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupMedium ); - - setHelpFileName( "work_with_groups_page.html" ); + QGroupBox* GroupMedium = new QGroupBox(tr("MAIN_SUB_SHAPES"), centralWidget()); + QGridLayout* aMedLayout = new QGridLayout(GroupMedium); + aMedLayout->setMargin(9); + aMedLayout->setSpacing(6); + + QLabel* aMainLabel = new QLabel(tr("MAIN_SHAPE"), GroupMedium); + + mySelBtn = new QPushButton(GroupMedium); + mySelBtn->setIcon(iconSelect); + mySelBtn->setEnabled(myMode == CreateGroup); + + myMainName = new QLineEdit(GroupMedium); + myMainName->setReadOnly(true); + myMainName->setEnabled(myMode == CreateGroup); + + myRestrictGroupBox = new QGroupBox(tr("SHAPE_SEL_RESTR"), GroupMedium); + myRestrictGroup = new QButtonGroup(myRestrictGroupBox); + QRadioButton* allSubs = new QRadioButton(tr("NO_RESTR") , myRestrictGroupBox); + QRadioButton* inPlaceSubs = new QRadioButton(tr("GEOM_PARTS_OF_SHAPE2"), myRestrictGroupBox); + QRadioButton* shape2Subs = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2") , myRestrictGroupBox); + QGridLayout* aRestrictLayout = new QGridLayout(myRestrictGroupBox); + + QLabel* aSecondLabel = new QLabel(tr("SECOND_SHAPE"), myRestrictGroupBox); + mySelBtn2 = new QPushButton(myRestrictGroupBox); + mySelBtn2->setIcon(iconSelect); + mySelBtn2->setEnabled(false); + myShape2Name = new QLineEdit(myRestrictGroupBox); + myShape2Name->setReadOnly(true); + myShape2Name->setEnabled(false); + + aRestrictLayout->setMargin(9); + aRestrictLayout->setSpacing(6); + aRestrictLayout->addWidget(allSubs, 0, 0, 1, 3); + aRestrictLayout->addWidget(inPlaceSubs, 1, 0, 1, 3); + aRestrictLayout->addWidget(shape2Subs, 2, 0, 1, 3); + aRestrictLayout->addWidget(aSecondLabel, 3, 0); + aRestrictLayout->addWidget(mySelBtn2, 3, 1); + aRestrictLayout->addWidget(myShape2Name, 3, 2); + myRestrictGroup->addButton(allSubs, ALL_SUBSHAPES); + myRestrictGroup->addButton(inPlaceSubs, GET_IN_PLACE); + myRestrictGroup->addButton(shape2Subs, SUBSHAPES_OF_SHAPE2); + myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj)); + allSubs->setChecked(true); + + myShowOnlyBtn = new QPushButton(tr("SHOW_ONLY_SELECTED"), GroupMedium); + myHideSelBtn = new QPushButton(tr("HIDE_SELECTED"), GroupMedium); + myShowAllBtn = new QPushButton(tr("SHOW_ALL_SUB_SHAPES"), GroupMedium); + + mySelAllBtn = new QPushButton(tr("SELECT_ALL"), GroupMedium); + myAddBtn = new QPushButton(tr("ADD"), GroupMedium); + myRemBtn = new QPushButton(tr("REMOVE"), GroupMedium); + + myIdList = new QListWidget(GroupMedium); + + myIdList->setSelectionMode(QAbstractItemView::ExtendedSelection); + myIdList->setFlow(QListView::TopToBottom); + myIdList->setWrapping(true); + + aMedLayout->addWidget(aMainLabel, 0, 0); + aMedLayout->addWidget(mySelBtn, 0, 1); + aMedLayout->addWidget(myMainName, 0, 2, 1, 2); + aMedLayout->addWidget(myRestrictGroupBox, 1, 0, 4, 3); + + aMedLayout->addWidget(myShowOnlyBtn, 1, 3); + aMedLayout->addWidget(myHideSelBtn, 2, 3); + aMedLayout->addWidget(myShowAllBtn, 3, 3); + + aMedLayout->addWidget(myIdList, 5, 0, 4, 3); + aMedLayout->addWidget(mySelAllBtn, 5, 3); + aMedLayout->addWidget(myAddBtn, 6, 3); + aMedLayout->addWidget(myRemBtn, 7, 3); + + aMedLayout->setColumnStretch(2, 5); + aMedLayout->setRowStretch(5, 5); + aMedLayout->setRowStretch(8, 5); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupMedium); + + setHelpFileName("work_with_groups_page.html"); Init(); + updateState(); } GroupGUI_GroupDlg::~GroupGUI_GroupDlg() { + if (myIsHiddenMain) { + GEOM_Displayer* aDisplayer = getDisplayer(); + aDisplayer->Display(myMainObj); + myIsHiddenMain = false; + } } //================================================================================= @@ -160,61 +199,65 @@ GroupGUI_GroupDlg::~GroupGUI_GroupDlg() //================================================================================= void GroupGUI_GroupDlg::Init() { - // san -- TODO: clear selected sub-shapes... - //mySelSubBtn->setChecked( true ); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - if ( myMode == CreateGroup ) { - initName( tr( "GROUP_PREFIX" ) ); + //unset shape type to avoid preparation of selection before exact user shape type selection + unsetConstructorId(); + myIsShapeType = false; + + if (myMode == CreateGroup) { + initName(tr("GROUP_PREFIX")); // Get ready for main shape selection myEditCurrentArgument = myMainName; - connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - connect( mySelBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); + connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); } else if (myMode == EditGroup) { SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); if (aSelList.Extent()) { - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOMBase::ConvertIOinGEOMObject(aSelList.First()); - if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { + if (!CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) { myGroup = anObj; - mainFrame()->ResultName->setText( GEOMBase::GetName( myGroup ) ); + mainFrame()->ResultName->setText(GEOMBase::GetName(myGroup)); - GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); - myMainObj = anOp->GetMainShape( myGroup ); - if ( !CORBA::is_nil( myMainObj ) ) - myMainName->setText( GEOMBase::GetName( myMainObj ) ); + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + myMainObj = anOper->GetMainShape(myGroup); + if (!CORBA::is_nil(myMainObj)) + myMainName->setText(GEOMBase::GetName(myMainObj)); - setShapeType( (TopAbs_ShapeEnum)anOp->GetType( myGroup ) ); + setShapeType((TopAbs_ShapeEnum)anOper->GetType(myGroup)); - GEOM::ListOfLong_var aCurrList = anOp->GetObjects( myGroup ); - for ( int i = 0, n = aCurrList->length(); i < n; i++ ) - myIdList->addItem( new QListWidgetItem( QString( "%1" ).arg( aCurrList[i] ) ) ); + GEOM::ListOfLong_var aCurrList = anOper->GetObjects(myGroup); + for (int i = 0, n = aCurrList->length(); i < n; i++) + myIdList->addItem(new QListWidgetItem(QString("%1").arg(aCurrList[i]))); myEditCurrentArgument = 0; } - connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); } } - connect( aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ); + connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect( mySelectionWayGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( SetEditCurrentArgument() ) ); - connect( mySelAllBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( add() ) ); - connect( myRemBtn, SIGNAL( clicked() ), this, SLOT( remove() ) ); - connect( myIdList, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); + connect(myRestrictGroup, SIGNAL(buttonClicked(int)), this, SLOT(SetEditCurrentArgument())); + connect(mySelAllBtn, SIGNAL(clicked()), this, SLOT(selectAllSubShapes())); + connect(myAddBtn, SIGNAL(clicked()), this, SLOT(add())); + connect(myRemBtn, SIGNAL(clicked()), this, SLOT(remove())); + connect(myShowOnlyBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(myHideSelBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(myShowAllBtn, SIGNAL(clicked()), this, SLOT(showOnlySelected())); + connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); setInPlaceObj(GEOM::GEOM_Object::_nil()); @@ -227,22 +270,22 @@ void GroupGUI_GroupDlg::Init() // function : enterEvent() // purpose : //================================================================================= -void GroupGUI_GroupDlg::enterEvent( QEvent* e ) +void GroupGUI_GroupDlg::enterEvent(QEvent* e) { - if ( !buttonCancel()->isEnabled() ) + if (!buttonCancel()->isEnabled()) ActivateThisDialog(); } -//======================================================================= +//================================================================================= //function : closeEvent //purpose : remove temporary geom object -//======================================================================= - -void GroupGUI_GroupDlg::closeEvent( QCloseEvent* e ) +//================================================================================= +void GroupGUI_GroupDlg::closeEvent(QCloseEvent* e) { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); + setInPlaceObj(GEOM::GEOM_Object::_nil()); + erasePreview(true); - GEOMBase_Skeleton::closeEvent( e ); + GEOMBase_Skeleton::closeEvent(e); } //================================================================================= @@ -251,8 +294,10 @@ void GroupGUI_GroupDlg::closeEvent( QCloseEvent* e ) //================================================================================= void GroupGUI_GroupDlg::ClickOnOk() { - if ( ClickOnApply() ) + setIsApplyAndClose(true); + if (ClickOnApply()) ClickOnCancel(); + setIsApplyAndClose(false); } //================================================================================= @@ -261,17 +306,24 @@ void GroupGUI_GroupDlg::ClickOnOk() //================================================================================= bool GroupGUI_GroupDlg::ClickOnApply() { - if ( !onAccept( myMode == CreateGroup, true ) ) + if(!isApplyAndClose()) + setIsDisableBrowsing( true ); + + if (!onAccept(myMode == CreateGroup, true,isApplyAndClose())) return false; - if ( myMode == CreateGroup ) - { - initName(); - myIdList->clear(); - ConstructorsClicked( getConstructorId() ); - } + if(!isApplyAndClose()) + setIsDisableBrowsing( false ); + + if (myMode == CreateGroup) + { + initName(); + myIdList->clear(); + ConstructorsClicked(getConstructorId()); + } else activateSelection(); + return true; } @@ -283,30 +335,12 @@ void GroupGUI_GroupDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); activateSelection(); } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GroupGUI_GroupDlg::LineEditReturnPressed() -{ - QLineEdit* send = ( QLineEdit* )sender(); - - if ( send == myMainName && !myEditCurrentArgument ) { - myEditCurrentArgument = myMainName; - activateSelection(); - } - else - GEOMBase_Skeleton::LineEditReturnPressed(); - - updateState(); -} - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -315,37 +349,24 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if ( send == mySelBtn ) { + if (send == mySelBtn) { myEditCurrentArgument = myMainName; - myShape2Name->setText( "" ); + myShape2Name->setText(""); } - else if ( /*(QRadioButton*)sender() == mySelSubBtn ||*/ send == mySelAllBtn ) - myEditCurrentArgument = 0; - else if ( send == mySelBtn2 || sender() == mySelectionWayGroup ) { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); - //if ( myPlaceCheckBox->isChecked() ) - myShape2Name->setText( "" ); - if ( subSelectionWay() != ALL_SUBSHAPES ) - { + else if (send == mySelBtn2 || sender() == myRestrictGroup) { + setInPlaceObj(GEOM::GEOM_Object::_nil()); + myShape2Name->setText(""); + if (subSelectionWay() != ALL_SUBSHAPES) { myEditCurrentArgument = myShape2Name; } else { - //myEditCurrentArgument = myMainName; myEditCurrentArgument = 0; } } activateSelection(); - if ( send == mySelAllBtn ) { -// myShape2Name->setText( "" ); -// myPlaceCheckBox->setChecked( false ); -// mySelBtn2->setEnabled( false ); -// myShape2Name->setEnabled( false ); - selectAllSubShapes(); - } - else - updateState(); + updateState(); } //================================================================================= @@ -354,13 +375,13 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument() //================================================================================= void GroupGUI_GroupDlg::onGetInPlace() { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); - myEditCurrentArgument->setText( "" ); + setInPlaceObj(GEOM::GEOM_Object::_nil()); + myEditCurrentArgument->setText(""); bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); myIdList->clearSelection(); - myIdList->blockSignals( isBlocked ); + myIdList->blockSignals(isBlocked); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; @@ -369,24 +390,23 @@ void GroupGUI_GroupDlg::onGetInPlace() if (aSelList.Extent() != 1) return; - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { + GEOMBase::ConvertIOinGEOMObject(aSelList.First()); + if (GEOMBase::IsShape(anObj)) { if (!anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent(myGroup)) { SUIT_OverrideCursor wc; myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - if ( subSelectionWay() == GET_IN_PLACE ) { + if (subSelectionWay() == GET_IN_PLACE) { GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj); - setInPlaceObj( aGetInPlaceObj ); + setInPlaceObj(aGetInPlaceObj); } else { bool isVisible = true; - if ( SALOME_View* view = GEOM_Displayer::GetActiveView() ) - isVisible = view->isVisible( aSelList.First() ); - setInPlaceObj( anObj, isVisible ); + if (SALOME_View* view = GEOM_Displayer::GetActiveView()) + isVisible = view->isVisible(aSelList.First()); + setInPlaceObj(anObj, isVisible); } myEditCurrentArgument = 0; //myBusy = true; // just activate but do not select in the list @@ -396,54 +416,50 @@ void GroupGUI_GroupDlg::onGetInPlace() } } -//======================================================================= +//================================================================================= //function : setInPlaceObj //purpose : temporarily add an object to study and remove old InPlaceObj -//======================================================================= - -void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj, const bool isVisible ) +//================================================================================= +void GroupGUI_GroupDlg::setInPlaceObj(GEOM::GEOM_Object_var theObj, const bool isVisible) { - if ( ! myInPlaceObj->_is_equivalent( theObj ) ) + if (!myInPlaceObj->_is_equivalent(theObj)) { - const char* tmpName = "__InPlaceObj__"; - // remove old InPlaceObj - if ( !myInPlaceObj->_is_nil() ) { - if ( myInPlaceObjSelectState == GET_IN_PLACE || - myInPlaceObjSelectState == SUBSHAPES_OF_INVISIBLE_SHAPE2 ) { - // hide temporary object or initially invisible shape 2 (issue 0014047) - GEOM_Displayer aDisplayer(getStudy()); - aDisplayer.Erase( myInPlaceObj, true ); - } - if (_PTR(SObject) SO = getStudy()->studyDS()->FindObject( tmpName )) { - getStudy()->studyDS()->NewBuilder()->RemoveObjectWithChildren( SO ); - getGeomEngine()->RemoveObject(myInPlaceObj); - } - } - // publish InPlaceObj to enable localSelection(InPlaceObj) - if ( !theObj->_is_nil() && subSelectionWay() == GET_IN_PLACE ) { - SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS()); - SALOMEDS::SObject_var aSO = - getGeomEngine()->AddInStudy(aStudyDS, theObj, tmpName, myMainObj); - } myInPlaceObj = theObj; } + // build map of indices myMain2InPlaceIndices.Clear(); - if ( !myInPlaceObj->_is_nil() ) { - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); + if (!myInPlaceObj->_is_nil()) { + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); + GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId()); - GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode( myInPlaceObj, getShapeType(), false); - for (int i = 0; i < aSubObjects->length(); i++) + GEOM::ListOfGO_var aSubObjects = aShapesOp->MakeExplode(myInPlaceObj, getShapeType(), false); + for ( int i = 0; i < aSubObjects->length(); i++ ) { - CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i] ); - if ( aMainIndex >= 0 && aPlaceIndex > 0) - myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex ); + GEOM::ListOfLong_var aCurrList = aShapesOp->GetSameIDs( myMainObj, aSubObjects[i] ); + if( aCurrList->length() > 1 ) { + //rnv : To Fix the 21561: EDF 2184 GEOM: Group with second shape restriction. + // In case if GetSameIDs(...) method return more then one ID use + // GetSharedShapes(...) method to get sub-shapes of the second shape. + GEOM::ListOfGO_var aSubObjects2 = aShapesOp->GetSharedShapes( myMainObj, aSubObjects[i], getShapeType() ); + for( int j = 0; j < aSubObjects2->length(); j++ ) { + CORBA::Long aMainIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects2[j] ); + CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i]); + if ( aMainIndex >= 0 && aPlaceIndex > 0 ) { + myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex ); + } + } + } else if(aCurrList->length() > 0 ) { + CORBA::Long aMainIndex = aCurrList[0]; + CORBA::Long aPlaceIndex = aLocOp->GetSubShapeIndex( myInPlaceObj, aSubObjects[i] ); + if ( aMainIndex >= 0 && aPlaceIndex > 0) { + myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex ); + } + } } } myInPlaceObjSelectState = subSelectionWay(); - if ( myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible ) + if (myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible) myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2; } @@ -453,289 +469,296 @@ void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj, const bool //================================================================================= void GroupGUI_GroupDlg::SelectionIntoArgument() { -// if (myPlaceCheckBox->isChecked() && myEditCurrentArgument == myShape2Name ) if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name) { onGetInPlace(); return; } - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - if (myEditCurrentArgument == myMainName) { // Selection of a main shape is active myEditCurrentArgument->setText(""); myIdList->clear(); - if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + int nbSel = aSelList.Extent(); + + if (nbSel == 1) { GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - - if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { - myMainObj = anObj; - myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) ); - // activate subshapes selection by default - myEditCurrentArgument = 0; - activateSelection(); - updateState(); - return; + GEOMBase::ConvertIOinGEOMObject(aSelList.First()); + + if (GEOMBase::IsShape(anObj)) { + if (myIsHiddenMain) { + GEOM_Displayer* aDisplayer = getDisplayer(); + aDisplayer->Display(myMainObj); + myIsHiddenMain = false; + } + myMainObj = anObj; + myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); + // activate sub-shapes selection by default + myEditCurrentArgument = 0; + activateSelection(); + updateState(); } } - - myMainObj = GEOM::GEOM_Object::_nil(); + else { + if (myIsHiddenMain) { + GEOM_Displayer* aDisplayer = getDisplayer(); + aDisplayer->Display(myMainObj); + myIsHiddenMain = false; + } + myMainObj = GEOM::GEOM_Object::_nil(); + } } else { // an attempt to synchronize list box selection with 3d viewer - if ( myBusy ) { + if (myBusy || myMainObj->_is_nil()) { return; } bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); myIdList->clearSelection(); TColStd_IndexedMapOfInteger aMapIndex; + int nbSel = getSelectedSubshapes(aMapIndex); - LightApp_SelectionMgr::MapEntryOfMapOfInteger aMap; - aSelMgr->selectedSubOwners( aMap ); - if ( aMap.Size() == 1 ) - aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); - bool subselected = aMapIndex.Extent(); - - // convert inPlace indices to main indices - //if ( subselected && myPlaceCheckBox->isChecked() ) - if ( subselected && subSelectionWay() != ALL_SUBSHAPES ) - { - TColStd_IndexedMapOfInteger aMapIndex2; - - TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip( myMain2InPlaceIndices ); - for ( ; m2ip.More(); m2ip.Next() ) { - int inPlaceId = m2ip.Value(); - if ( aMapIndex.Contains( inPlaceId )) { - aMapIndex2.Add( m2ip.Key() ); - } - } - aMapIndex = aMapIndex2; - } - - // try to find out and process the object browser selection - if ( !subselected ) { - globalSelection( GEOM_ALLSHAPES ); - - GEOM::ListOfGO anObjects; - GEOMBase::ConvertListOfIOInListOfGO(aSelList, anObjects); - - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - - for (int i = 0; i < anObjects.length(); i++) - { - GEOM::GEOM_Object_var aGeomObj = anObjects[i]; - GEOM::ListOfGO_var aSubObjects = new GEOM::ListOfGO(); - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aGeomObj, aShape, getShapeType()) ) - { - aSubObjects->length(1); - aSubObjects[0] = aGeomObj; - } - else if (aGeomObj->GetType() == GEOM_GROUP) - aSubObjects = aShapesOp->MakeExplode( aGeomObj, getShapeType(), false); - else - continue; - - for (int i = 0; i < aSubObjects->length(); i++) - { - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) ) - { - CORBA::Long anIndex; - anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - if ( anIndex >= 0 ) { - //if ( myPlaceCheckBox->isChecked() && ! myMain2InPlaceIndices.IsBound( anIndex )) - if ( subSelectionWay() != ALL_SUBSHAPES && - ! myMain2InPlaceIndices.IsBound( anIndex )) - continue; - aMapIndex.Add( anIndex ); - } - } + if (nbSel) { + QMap aMap; + for (int i = 0, n = myIdList->count(); i < n; i++) + aMap.insert(myIdList->item(i)->text().toInt(), i); + + bool highlight = false; + for (int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++) { + if (aMap.contains(aMapIndex(ii))) { + myIdList->item(aMap[aMapIndex(ii)])->setSelected(true); + highlight = true; } } - if ( !myMainObj->_is_nil() /*&& mySelSubBtn->isChecked()*/) - if ( subSelectionWay() == ALL_SUBSHAPES ) - localSelection( myMainObj, getShapeType() ); - else if ( !myInPlaceObj->_is_nil() ) - localSelection( myInPlaceObj, getShapeType() ); + if (highlight) + highlightSubShapes(); } + myIdList->blockSignals(isBlocked); - if (aMapIndex.Extent() >= 1) { - QMap aMap; - for ( int i = 0, n = myIdList->count(); i < n; i++ ) - aMap.insert( myIdList->item( i )->text().toInt(), i ); - - for ( int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++ ) { - if ( aMap.contains( aMapIndex( ii ) ) ) - myIdList->item( aMap[aMapIndex( ii )])->setSelected( true ); - } - } - myIdList->blockSignals( isBlocked ); + updateState(nbSel); } - - updateState(); } //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void GroupGUI_GroupDlg::ConstructorsClicked( int constructorId ) +void GroupGUI_GroupDlg::ConstructorsClicked(int constructorId) { + if (getConstructorId() != constructorId) + setConstructorId(constructorId); + + myIsShapeType = true; myIdList->clear(); + myEditCurrentArgument = 0; + + setInPlaceObj(myInPlaceObj); // to rebuild myMain2InPlaceIndices activateSelection(); updateState(); - setInPlaceObj( myInPlaceObj ); // to rebuild myMain2InPlaceIndices } //================================================================================= // function : selectAllSubShapes -// purpose : +// purpose : //================================================================================= void GroupGUI_GroupDlg::selectAllSubShapes() { - if ( CORBA::is_nil( myMainObj ) ) + if (CORBA::is_nil(myMainObj) || !myIsShapeType) return; GEOM::ListOfLong_var aSubShapes; -// if ( !myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() == ALL_SUBSHAPES ) - { - myIdList->clear(); - GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false); + GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations(getStudyId()); + aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false); + if (aSubShapes->length() > 0) { + if (subSelectionWay() == ALL_SUBSHAPES) + { + myIdList->clear(); // for sorted final list? - if ( !aShOp->IsDone() ) - return; - } - else - { - aSubShapes = new GEOM::ListOfLong(); - aSubShapes->length( myMain2InPlaceIndices.Extent() ); - TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip( myMain2InPlaceIndices ); - for ( int i = 0; m2ip.More(); i++, m2ip.Next() ) - aSubShapes[ i ] = m2ip.Key(); - } - bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); - - for ( int i = 0, n = aSubShapes->length(); i < n; i++ ) { - CORBA::Long anIndex = aSubShapes[i]; - if ( anIndex < 0 ) - continue; - - QListWidgetItem* anItem = 0; - QString text = QString( "%1" ).arg( anIndex ); - if ( !myInPlaceObj->_is_nil() ) { - QList found = myIdList->findItems( text, Qt::MatchExactly ); - if ( found.count() ) anItem = found[0]; + if (!aShOp->IsDone()) + return; } - if ( !anItem ) { - anItem = new QListWidgetItem( text ); - myIdList->addItem( anItem ); + else + { + aSubShapes = new GEOM::ListOfLong(); + aSubShapes->length(myMain2InPlaceIndices.Extent()); + TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip (myMain2InPlaceIndices); + for (int i = 0; m2ip.More(); i++, m2ip.Next()) + aSubShapes[i] = m2ip.Key(); } - anItem->setSelected( true ); - } - myIdList->blockSignals( isBlocked ); - highlightSubShapes(); + bool isBlocked = myIdList->signalsBlocked(); + myIdList->blockSignals(true); + + for (int i = 0, n = aSubShapes->length(); i < n; i++) { + CORBA::Long anIndex = aSubShapes[i]; + if (anIndex < 0) + continue; + + QListWidgetItem* anItem = 0; + QString text = QString("%1").arg(anIndex); + if (!myInPlaceObj->_is_nil()) { + QList found = myIdList->findItems(text, Qt::MatchExactly); + if (found.count()) anItem = found[0]; + } + if (!anItem) { + anItem = new QListWidgetItem(text); + myIdList->addItem(anItem); + } + anItem->setSelected(true); + } + + myIdList->blockSignals(isBlocked); + highlightSubShapes(); + } } //================================================================================= -// function : add -// purpose : +// function : showOnlySelected +// purpose : //================================================================================= -void GroupGUI_GroupDlg::add() +void GroupGUI_GroupDlg::showOnlySelected() { - TColStd_MapOfInteger aMap; - for ( int i = 0, n = myIdList->count(); i < n; i++ ) - aMap.Add( myIdList->item( i )->text().toInt() ); + if (CORBA::is_nil(myMainObj) || !myIsShapeType) + return; - TColStd_IndexedMapOfInteger aMapIndex; + QPushButton* send = (QPushButton*)sender(); + if (send == myShowAllBtn) { + activateSelection(); + return; + } - SALOME_ListIO aSelIOs; - SalomeApp_Application* app = myGeomGUI->getApp(); - if ( app ) { - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( aSelMgr ) { - LightApp_SelectionMgr::MapEntryOfMapOfInteger aMap; - aSelMgr->selectedSubOwners( aMap ); - if ( aMap.Size() == 1 ) - aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); - } + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + GEOM_Displayer* aDisplayer = getDisplayer(); + + if (send == myHideSelBtn) { + aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true); } - GEOM::ListOfGO anObjects; - // get selected sub-shapes of myInPlaceObj - if ( aMapIndex.Extent() > 0 && !myInPlaceObj->_is_nil() ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + else { + // Mantis issue 0021421: do not hide main shape, if explode on VERTEX + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if (view) { + CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO"); + if (view->isVisible(io)) myIsHiddenMain = true; + } - anObjects.length( aMapIndex.Extent() ); - for ( int i = 1; i <= aMapIndex.Extent(); i++ ) - anObjects[ i-1 ] = aShapesOp->GetSubShape( myInPlaceObj, aMapIndex( i )); + aDisplayer->EraseAll(/*forced = false, updateViewer = true*/); + aDisplayer->Display(aSelList, true); - aMapIndex.Clear(); + // Mantis issue 0021421: do not hide main shape, if explode on VERTEX + if (getShapeType() == TopAbs_VERTEX && myIsHiddenMain) { + aDisplayer->Display(myMainObj); + } + + // for the case when selected ids were not displayed in the viewer: Mantis issue 0021367 + highlightSubShapes(); } +} - // try to find out and process the object browser selection or InPlace sub-shapes - if ( !aMapIndex.Extent() ) - { - if ( anObjects.length() == 0 ) - GEOMBase::ConvertListOfIOInListOfGO(aSelIOs, anObjects); +//================================================================================= +// function : getSelectedSubshapes +// purpose : +//================================================================================= +int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex) +{ + theMapIndex.Clear(); - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + SalomeApp_Application* app = myGeomGUI->getApp(); + if (!app || myMainObj->_is_nil()) + return 0; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); - for (int i = 0; i < anObjects.length(); i++) + // try to find out and process the global selection + // (of not published objects and of published sub-shapes) + { + SALOME_ListIteratorOfListIO anIter (aSelList); + for (int i = 0; anIter.More(); anIter.Next(), i++) { - GEOM::GEOM_Object_var aGeomObj = anObjects[i]; - GEOM::ListOfGO_var aSubObjects = new GEOM::ListOfGO(); - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aGeomObj, aShape, getShapeType()) ) + Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); + QString anEntry = anIObj->getEntry(); + QString str = "_"; + int index = anEntry.lastIndexOf(str); + if (index > 0) // selection among special preview { - aSubObjects->length(1); - aSubObjects[0] = aGeomObj; + anEntry.remove(0, index+1); + int anIndex = anEntry.toInt(); + if (anIndex) + theMapIndex.Add(anIndex); } - else if (aGeomObj->GetType() == GEOM_GROUP) - aSubObjects = aShapesOp->MakeExplode( aGeomObj, getShapeType(), false); - else - break; - - for (int i = 0; i < aSubObjects->length(); i++) + else // selection among published shapes { + SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); + if (!appStudy) return 0; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData())); + GEOM::GEOM_Object_var aGeomObj = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) ) - { - CORBA::Long anIndex; - anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - if ( anIndex >= 0 ) - aMapIndex.Add( anIndex ); + if (GEOMBase::GetShape(aGeomObj, aShape)) { + if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) { + TopTools_IndexedMapOfShape aMainMap; + TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); + TopExp::MapShapes(aMainShape, aMainMap); + + TopExp_Explorer anExp (aShape, getShapeType()); + for (; anExp.More(); anExp.Next()) { + TopoDS_Shape aSubShape = anExp.Current(); + int anIndex = aMainMap.FindIndex(aSubShape); + if (anIndex >= 0) { + if (subSelectionWay() != ALL_SUBSHAPES && + !myMain2InPlaceIndices.IsBound(anIndex)) + continue; + theMapIndex.Add(anIndex); + } + } + } } } - } + } // for aSelList } - if ( aMapIndex.Extent() >= 1 ) { + return theMapIndex.Extent(); +} + +//================================================================================= +// function : add +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::add() +{ + TColStd_IndexedMapOfInteger aMapIndex; + int nbSel = getSelectedSubshapes(aMapIndex); + + TColStd_MapOfInteger aMap; + for (int i = 0, n = myIdList->count(); i < n; i++) + aMap.Add(myIdList->item(i)->text().toInt()); + + if (nbSel > 0) { bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); - for ( int i = 1, n = aMapIndex.Extent(); i <= n; i++ ) { - if ( aMap.Contains( aMapIndex( i ) ) ) + for (int i = 1, n = aMapIndex.Extent(); i <= n; i++) { + if (aMap.Contains(aMapIndex(i))) continue; - QListWidgetItem* anItem = new QListWidgetItem( QString( "%1" ).arg( aMapIndex( i ) ) ); - myIdList->addItem( anItem ); - anItem->setSelected( true ); + QListWidgetItem* anItem = new QListWidgetItem(QString("%1").arg(aMapIndex(i))); + myIdList->addItem(anItem); + anItem->setSelected(true); } - myIdList->blockSignals( isBlocked ); + myIdList->blockSignals(isBlocked); } updateState(); @@ -743,30 +766,29 @@ void GroupGUI_GroupDlg::add() //================================================================================= // function : remove -// purpose : +// purpose : //================================================================================= void GroupGUI_GroupDlg::remove() { bool isBlocked = myIdList->signalsBlocked(); - myIdList->blockSignals( true ); + myIdList->blockSignals(true); - QListIterator it( myIdList->selectedItems() ); - while ( it.hasNext() ) + QListIterator it (myIdList->selectedItems()); + while (it.hasNext()) delete it.next(); - myIdList->blockSignals( isBlocked ); + myIdList->blockSignals(isBlocked); highlightSubShapes(); } -//======================================================================= +//================================================================================= //function : subSelectionWay -//purpose : -//======================================================================= - +//purpose : +//================================================================================= int GroupGUI_GroupDlg::subSelectionWay() const { - return mySelectionWayGroup->checkedId(); + return myRestrictGroup->checkedId(); } //================================================================================= @@ -775,7 +797,7 @@ int GroupGUI_GroupDlg::subSelectionWay() const //================================================================================= TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const { - switch ( getConstructorId() ) { + switch (getConstructorId()) { case 0: return TopAbs_VERTEX; case 1: return TopAbs_EDGE; case 2: return TopAbs_FACE; @@ -788,133 +810,149 @@ TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const // function : setShapeType() // purpose : //================================================================================= -void GroupGUI_GroupDlg::setShapeType( const TopAbs_ShapeEnum theType ) +void GroupGUI_GroupDlg::setShapeType(const TopAbs_ShapeEnum theType) { int anId = 0; - switch ( theType ) { + switch (theType) { case TopAbs_VERTEX: anId = 0; break; case TopAbs_EDGE: anId = 1; break; case TopAbs_FACE: anId = 2; break; case TopAbs_SOLID: anId = 3; break; } - setConstructorId( anId ); + setConstructorId(anId); + if (!myIsShapeType) + { + myIsShapeType = true; + // workaround to avoid set checked button 0 + setConstructorId(anId); + } } - //================================================================================= // function : activateSelection // purpose : Activate selection in accordance with myEditCurrentArgument //================================================================================= void GroupGUI_GroupDlg::activateSelection() { - globalSelection( GEOM_ALLSHAPES ); + bool isApply = ((QPushButton*)sender() == buttonApply()); + if(!isApply) + erasePreview(false); // local selection - if ( !myMainObj->_is_nil() && !myEditCurrentArgument/* && mySelSubBtn->isChecked()*/) { -// if ( !myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() == ALL_SUBSHAPES ) - localSelection( myMainObj, getShapeType() ); - else if ( !myInPlaceObj->_is_nil() ) - localSelection( myInPlaceObj, getShapeType() ); + if (!myMainObj->_is_nil() && + !myEditCurrentArgument && + myIsShapeType) // check if shape type is already choosen by user + { + GEOM_Displayer* aDisplayer = getDisplayer(); + + // Mantis issue 0021421: do not hide main shape, if explode on VERTEX + if (getShapeType() == TopAbs_VERTEX) { + if (myIsHiddenMain) + aDisplayer->Display(myMainObj); + } + else { + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if (view) { + CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO"); + if (view->isVisible(io)) { + aDisplayer->Erase(myMainObj, false, false); + myIsHiddenMain = true; + } + } + } + if(!isApply) { + int prevDisplayMode = aDisplayer->SetDisplayMode(0); + + SUIT_ViewWindow* aViewWindow = 0; + SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); + if (activeStudy) + aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (aViewWindow == 0) return; + + SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); + if (aViewManager->getType() != OCCViewer_Viewer::Type() && + aViewManager->getType() != SVTK_Viewer::Type()) + return; + + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView == 0) return; + + TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); + TopoDS_Shape aRestrictionShape; + + if (subSelectionWay() == ALL_SUBSHAPES) { + aRestrictionShape = aMainShape; + + TopTools_IndexedMapOfShape aSubShapesMap; + TopExp::MapShapes(aMainShape, aSubShapesMap); + CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); + QString anEntryBase = aMainEntry.in(); + + TopExp_Explorer anExp (aRestrictionShape, getShapeType()); + for (; anExp.More(); anExp.Next()) { + TopoDS_Shape aSubShape = anExp.Current(); + int index = aSubShapesMap.FindIndex(aSubShape); + QString anEntry = anEntryBase + QString("_%1").arg(index); + + SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView); + if (aPrs) { + displayPreview(aPrs, true, false); // append, do not update + // TODO: map or delete Prs + } + } + } + else if (!myInPlaceObj->_is_nil()) { + TopTools_IndexedMapOfShape aSubShapesMap; + TopExp::MapShapes(aMainShape, aSubShapesMap); + CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); + QString anEntryBase = aMainEntry.in(); + + TColStd_DataMapIteratorOfDataMapOfIntegerInteger aM2IPit (myMain2InPlaceIndices); + for (; aM2IPit.More(); aM2IPit.Next()) { + int index = aM2IPit.Key(); + TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index); + QString anEntry = anEntryBase + QString("_%1").arg(index); + + SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView); + if (aPrs) { + displayPreview(aPrs, true, false); // append, do not update + } + } + } + else ; + + aDisplayer->UpdateViewer(); + aDisplayer->SetDisplayMode(prevDisplayMode); + } } + globalSelection(GEOM_ALLSHAPES); + SelectionIntoArgument(); } //================================================================================= // function : updateState -// purpose : +// purpose : //================================================================================= -void GroupGUI_GroupDlg::updateState() +void GroupGUI_GroupDlg::updateState (bool isAdd) { - bool isAdd = false; - - TColStd_IndexedMapOfInteger aMapIndex; - - SALOME_ListIO aSelIOs; - SalomeApp_Application* app = myGeomGUI->getApp(); - if ( app ) { - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( aSelMgr ) { - LightApp_SelectionMgr::MapEntryOfMapOfInteger aMap; - aSelMgr->selectedSubOwners( aMap ); - if ( aMap.Size() == 1 ) - aMapIndex = LightApp_SelectionMgr::MapEntryOfMapOfInteger::Iterator( aMap ).Value(); - } - } - - // try to find out and process the object browser selection - if ( !aMapIndex.Extent() && !CORBA::is_nil( myMainObj ) ) { - GEOM::ListOfGO anObjects; - //GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), anObjects); - GEOMBase::ConvertListOfIOInListOfGO(aSelIOs, anObjects); - - GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - - isAdd = true; - - for (int i = 0; i < anObjects.length(); i++) - { - GEOM::GEOM_Object_var aGeomObj = anObjects[i]; - GEOM::ListOfGO_var aSubObjects = new GEOM::ListOfGO(); - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aGeomObj, aShape, getShapeType()) ) { - aSubObjects->length(1); - aSubObjects[0] = aGeomObj; - } - else if (aGeomObj->GetType() == GEOM_GROUP) { - aSubObjects = aShapesOp->MakeExplode( aGeomObj, getShapeType(), false); - } - else { - aMapIndex.Clear(); - break; - } - - for (int i = 0; i < aSubObjects->length(); i++) - { - TopoDS_Shape aShape; - aSubObjects[i]; - if ( GEOMBase::GetShape(aSubObjects[i], aShape, getShapeType()) ) - { - CORBA::Long anIndex; - anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] ); - if ( anIndex >= 0 ) - aMapIndex.Add( anIndex ); - else - isAdd = false; - } - else - isAdd = false; + myAddBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd); + //myShowOnlyBtn->setEnabled(!myEditCurrentArgument && !CORBA::is_nil(myMainObj) && isAdd); - if ( !isAdd ) { - aMapIndex.Clear(); - break; - } - } - if ( !isAdd ) { - aMapIndex.Clear(); - break; - } - } - } + bool hasSel = myIdList->selectedItems().count() > 0; - isAdd = aMapIndex.Extent() > 0; + myRemBtn->setEnabled(hasSel); + myRestrictGroupBox->setEnabled(!CORBA::is_nil(myMainObj)); + mySelAllBtn->setEnabled(!CORBA::is_nil(myMainObj)); - myAddBtn->setEnabled( !myEditCurrentArgument && !CORBA::is_nil( myMainObj ) && isAdd ); - bool hasSel = myIdList->selectedItems().count() > 0; - myRemBtn->setEnabled( hasSel ); - //mySelSubBtn->setEnabled( !CORBA::is_nil( myMainObj ) ); - //myPlaceCheckBox->setEnabled( !CORBA::is_nil( myMainObj ) ); - mySelectionWayGroupBox->setEnabled( !CORBA::is_nil( myMainObj ) ); - mySelAllBtn->setEnabled( !CORBA::is_nil( myMainObj ) ); -// mySelBtn2->setEnabled( myPlaceCheckBox->isChecked() ); -// myShape2Name->setEnabled( myPlaceCheckBox->isChecked() ); - mySelBtn2->setEnabled( subSelectionWay() != ALL_SUBSHAPES ); - myShape2Name->setEnabled( subSelectionWay() != ALL_SUBSHAPES ); -// if ( !myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() == ALL_SUBSHAPES ) - setInPlaceObj( GEOM::GEOM_Object::_nil() ); + mySelBtn2->setEnabled(subSelectionWay() != ALL_SUBSHAPES); + myShape2Name->setEnabled(subSelectionWay() != ALL_SUBSHAPES); + if (subSelectionWay() == ALL_SUBSHAPES) + setInPlaceObj(GEOM::GEOM_Object::_nil()); } //================================================================================= @@ -932,20 +970,7 @@ void GroupGUI_GroupDlg::selectionChanged() //================================================================================= void GroupGUI_GroupDlg::highlightSubShapes() { - if ( CORBA::is_nil( myMainObj ) ) - return; - - Standard_Boolean isOk; - char* objIOR; - - if ( myInPlaceObj->_is_nil() ) - objIOR = GEOMBase::GetIORFromObject( myMainObj ); - else - objIOR = GEOMBase::GetIORFromObject( myInPlaceObj ); - - Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape( objIOR, isOk, true ); - free( objIOR ); - if ( !isOk || aSh.IsNull() ) + if (CORBA::is_nil(myMainObj)) return; TColStd_MapOfInteger anIds; @@ -953,36 +978,99 @@ void GroupGUI_GroupDlg::highlightSubShapes() myBusy = true; int ii = 0, nn = myIdList->count(); - for ( ; ii < nn; ii++ ) + for (; ii < nn; ii++) { - if ( myIdList->item( ii )->isSelected() ) { - int id = myIdList->item( ii )->text().toInt(); - // if ( myPlaceCheckBox->isChecked() ) - if ( subSelectionWay() != ALL_SUBSHAPES ) - { - if ( myMain2InPlaceIndices.IsBound( id ) ) - id = myMain2InPlaceIndices( id ); - else { - myIdList->item( ii )->setSelected( false ); - continue; - } + if (myIdList->item(ii)->isSelected()) { + int id = myIdList->item(ii)->text().toInt(); + if (subSelectionWay() != ALL_SUBSHAPES && + !myMain2InPlaceIndices.IsBound(id)) { + //myIdList->item(ii)->setSelected(false); + } + else { + anIds.Add(id); } - anIds.Add( id ); } } SalomeApp_Application* app = myGeomGUI->getApp(); LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); aSelMgr->clearSelected(); - aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); + SUIT_ViewWindow* aViewWindow = 0; + SUIT_Study* activeStudy = app->activeStudy(); + if (activeStudy) + aViewWindow = app->desktop()->activeWindow(); + if (aViewWindow == 0) return; + + SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); + if (aViewManager->getType() != OCCViewer_Viewer::Type() && + aViewManager->getType() != SVTK_Viewer::Type()) + return; + + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView == 0) return; + + // TODO??: use here GEOMBase_Helper::myPreview instead of ic->DisplayedObjects() + + OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)aViewManager)->getOCCViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + AIS_ListOfInteractive List; + //ic->DisplayedObjects(List); + ic->ObjectsInside(List); // Mantis issue 0021367 + + SALOME_ListIO aSelList; + + // To highlight the selected sub-shape in Object Browser, if it's already published under the main shape + GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations(getStudyId()); + QMap childsMap; + SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); + if (appStudy) { + _PTR(Study) aStudy = appStudy->studyDS(); + CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); + QString anEntry = aMainEntry.in(); + _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData())); + _PTR(ChildIterator) anIt (aStudy->NewChildIterator(aSObj)); + for (anIt->InitEx(true); anIt->More(); anIt->Next()) { + GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value())); + if (!CORBA::is_nil(aChild)) { + int index = aLocOp->GetSubShapeIndex(myMainObj, aChild); + CORBA::String_var aChildEntry = aChild->GetStudyEntry(); + QString anEntry = aChildEntry.in(); + childsMap.insert(index, anEntry); + } + } + } + + AIS_ListIteratorOfListOfInteractive ite (List); + for (; ite.More(); ite.Next()) { + if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if (aSh->hasIO()) { + Handle(SALOME_InteractiveObject) anIO = aSh->getIO(); + QString anEntry = anIO->getEntry(); + int index = anEntry.lastIndexOf("_"); + anEntry.remove(0, index+1); + int anIndex = anEntry.toInt(); + if (anIds.Contains(anIndex)) { + aSelList.Append(anIO); + if (childsMap.contains (anIndex)) { + Handle(SALOME_InteractiveObject) tmpIO = new SALOME_InteractiveObject(childsMap.value(anIndex).toLatin1().constData(), "GEOM", "TEMP_IO"); + aSelList.Append(tmpIO); + } + } + } + } + } + aSelMgr->setSelectedObjects(aSelList); myBusy = false; if (nn < 3000) - updateState(); + updateState(aSelList.Extent() > 0); else { - myAddBtn->setEnabled( true ); - myRemBtn->setEnabled( true ); + myAddBtn->setEnabled(true); + myAddBtn->setEnabled(true); + myRemBtn->setEnabled(true); } } @@ -992,11 +1080,11 @@ void GroupGUI_GroupDlg::highlightSubShapes() //================================================================================= GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation() { - return getGeomEngine()->GetIGroupOperations( getStudyId() ); + return getGeomEngine()->GetIGroupOperations(getStudyId()); } #define RETURN_WITH_MSG(a, b) \ - if ( !(a) ) { \ + if (!(a)) { \ theMessage += (b); \ return false; \ } @@ -1005,23 +1093,23 @@ GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation() // function : isValid() // purpose : Verify validity of input data //================================================================================= -bool GroupGUI_GroupDlg::isValid( QString& theMessage ) +bool GroupGUI_GroupDlg::isValid(QString& theMessage) { SalomeApp_Study* study = getStudy(); ASSERT(study); - RETURN_WITH_MSG ( !study->studyDS()->GetProperties()->IsLocked(), tr( "GEOM_STUDY_LOCKED" ) ) + RETURN_WITH_MSG (!study->studyDS()->GetProperties()->IsLocked(), tr("GEOM_STUDY_LOCKED")) - if ( myMode == CreateGroup ) { - RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_MAIN_OBJ" ) ) + if (myMode == CreateGroup) { + RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_MAIN_OBJ")) } else { - RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_GROUP" ) ) + RETURN_WITH_MSG(!CORBA::is_nil(myMainObj), tr("NO_GROUP")) } QString aName (getNewObjectName()); - RETURN_WITH_MSG ( !aName.trimmed().isEmpty(), tr( "EMPTY_NAME" ) ) + RETURN_WITH_MSG (!aName.trimmed().isEmpty(), tr("EMPTY_NAME")) - RETURN_WITH_MSG ( myIdList->count(), tr( "EMPTY_LIST" ) ) + RETURN_WITH_MSG (myIdList->count(), tr("EMPTY_LIST")) return true; } @@ -1029,29 +1117,27 @@ bool GroupGUI_GroupDlg::isValid( QString& theMessage ) // function : execute // purpose : //================================================================================= -bool GroupGUI_GroupDlg::execute( ObjectList& objects ) +bool GroupGUI_GroupDlg::execute(ObjectList& objects) { - setInPlaceObj( GEOM::GEOM_Object::_nil() ); - - GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); GEOM::GEOM_Object_var aGroup; if (myMode == CreateGroup) - aGroup = anOp->CreateGroup(myMainObj, getShapeType()); + aGroup = anOper->CreateGroup(myMainObj, getShapeType()); else if (myMode == EditGroup) aGroup = myGroup; - if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOp->IsDone())) + if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOper->IsDone())) return false; - GEOM::ListOfLong_var aCurrList = anOp->GetObjects(aGroup); - if (!anOp->IsDone()) + GEOM::ListOfLong_var aCurrList = anOper->GetObjects(aGroup); + if (!anOper->IsDone()) return false; if (aCurrList->length() > 0) { - anOp->DifferenceIDs(aGroup, aCurrList); - if (!anOp->IsDone()) + anOper->DifferenceIDs(aGroup, aCurrList); + if (!anOper->IsDone()) return false; } @@ -1063,26 +1149,24 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects ) for (ii = 0; ii < nn; ii++) { aNewList[ii] = myIdList->item(ii)->text().toInt(); } - anOp->UnionIDs(aGroup, aNewList); - if (!anOp->IsDone()) + anOper->UnionIDs(aGroup, aNewList); + if (!anOper->IsDone()) return false; } SalomeApp_Study* study = getStudy(); - if ( study ) { - char* objIOR = GEOMBase::GetIORFromObject( aGroup ); - std::string IOR( objIOR ); - free( objIOR ); - if ( IOR != "" ) { - _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); - if ( SO ) { + if (study) { + QString objIOR = GEOMBase::GetIORFromObject(aGroup); + if (objIOR != "") { + _PTR(SObject) SO (study->studyDS()->FindObjectIOR(objIOR.toLatin1().constData())); + if (SO) { _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder()); - aBuilder->SetName( SO, getNewObjectName().toLatin1().constData() ); + aBuilder->SetName(SO, getNewObjectName().toLatin1().constData()); } } } - objects.push_back( aGroup._retn() ); + objects.push_back(aGroup._retn()); return true; } @@ -1090,14 +1174,14 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects ) //================================================================ // Function : getFather // Purpose : Get father object for object to be added in study -// ( called with addInStudy method ) +// (called with addInStudy method) //================================================================ -GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather( GEOM::GEOM_Object_ptr theObj ) +GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather(GEOM::GEOM_Object_ptr theObj) { GEOM::GEOM_Object_var aFatherObj; - if ( theObj->GetType() == GEOM_GROUP ) { - GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); - aFatherObj = anOp->GetMainShape( theObj ); + if (theObj->GetType() == GEOM_GROUP) { + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + aFatherObj = anOper->GetMainShape(theObj); } return aFatherObj._retn(); } diff --git a/src/GroupGUI/GroupGUI_GroupDlg.h b/src/GroupGUI/GroupGUI_GroupDlg.h index 5edccedcd..438f52b10 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.h +++ b/src/GroupGUI/GroupGUI_GroupDlg.h @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : GroupGUI_GroupDlg.h -// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// GEOM GEOMGUI : GUI for Geometry component +// File : GroupGUI_GroupDlg.h +// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) + #ifndef GROUPGUI_GROUPDLG_H #define GROUPGUI_GROUPDLG_H @@ -30,6 +31,7 @@ #include #include +#include class QGroupBox; class QLineEdit; @@ -50,47 +52,51 @@ public: EditGroup } Mode; - GroupGUI_GroupDlg( Mode mode, GeometryGUI*, QWidget* parent = 0 ); + GroupGUI_GroupDlg (Mode mode, GeometryGUI*, QWidget* parent = 0); ~GroupGUI_GroupDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); - virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr ); - - void closeEvent( QCloseEvent* ); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); + + void closeEvent (QCloseEvent*); private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); - void ConstructorsClicked( int ); - + void ConstructorsClicked(int); + void selectAllSubShapes(); void add(); void remove(); + void showOnlySelected(); void selectionChanged(); - + private: void Init(); - void enterEvent( QEvent* ); - int subSelectionWay() const; + void enterEvent (QEvent*); + + int subSelectionWay() const; TopAbs_ShapeEnum getShapeType() const; - void setShapeType( const TopAbs_ShapeEnum ); + void setShapeType (const TopAbs_ShapeEnum); void activateSelection(); - void updateState(); + void updateState (bool isAdd = false); void highlightSubShapes(); void onGetInPlace(); - void setInPlaceObj( GEOM::GEOM_Object_var, const bool isVisible=1); + void setInPlaceObj (GEOM::GEOM_Object_var, const bool isVisible=1); + int getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex); private: Mode myMode; bool myBusy; + bool myIsShapeType; + bool myIsHiddenMain; GEOM::GEOM_Object_var myMainObj; GEOM::GEOM_Object_var myGroup; GEOM::GEOM_Object_var myInPlaceObj; @@ -101,11 +107,14 @@ private: QLineEdit* myMainName; QPushButton* mySelBtn2; QLineEdit* myShape2Name; - QGroupBox* mySelectionWayGroupBox; - QButtonGroup* mySelectionWayGroup; + QGroupBox* myRestrictGroupBox; + QButtonGroup* myRestrictGroup; QPushButton* mySelAllBtn; QPushButton* myAddBtn; QPushButton* myRemBtn; + QPushButton* myShowOnlyBtn; + QPushButton* myHideSelBtn; + QPushButton* myShowAllBtn; QListWidget* myIdList; }; diff --git a/src/GroupGUI/Makefile.am b/src/GroupGUI/Makefile.am index 0a93e2c4d..068c3587a 100755 --- a/src/GroupGUI/Makefile.am +++ b/src/GroupGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM GROUPGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) @@ -67,8 +65,7 @@ libGroupGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libGroupGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ diff --git a/src/IGESExport/IGESExport.cxx b/src/IGESExport/IGESExport.cxx index 475b41db2..1349b8a96 100644 --- a/src/IGESExport/IGESExport.cxx +++ b/src/IGESExport/IGESExport.cxx @@ -1,40 +1,46 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: IGESExport.cxx -// Created: Wed May 19 14:49:45 2004 -// Author: Pavel TELKOV -// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: IGESExport.cxx +// Created: Wed May 19 14:49:45 2004 +// Author: Pavel TELKOV + #include "utilities.h" +#include + #include #include #include -#include #include +#include + +#include + +#include #ifdef WNT - #if defined IGESEXPORT_EXPORTS + #if defined IGESEXPORT_EXPORTS || defined IGESExport_EXPORTS #if defined WIN32 #define IGESEXPORT_EXPORT __declspec( dllexport ) #else @@ -51,6 +57,63 @@ #define IGESEXPORT_EXPORT #endif +//============================================================================= +/*! + * KindOfBRep + * \return 0 if theShape contains only simple entities (wires, edges and vertices), + * 1 if theShape contains only complex entities (shells, solids and compsolids) + * 2 if theShape contains only indifferent entities (faces) + * -1 if theShape contains both simple and complex entities (and in this case it + * cannot be saved without any loss neither in BRepMode == 0 nor in BRepMode == 1) + */ +//============================================================================= +int KindOfBRep (const TopoDS_Shape& theShape) +{ + int aKind = 2; + + switch (theShape.ShapeType()) + { + case TopAbs_COMPOUND: + { + bool isSimple = false; + bool isComplex = false; + TopoDS_Iterator anIt (theShape, Standard_True, Standard_True); + for (; anIt.More(); anIt.Next()) { + TopoDS_Shape aS = anIt.Value(); + int aKindSub = KindOfBRep(aS); + if (aKindSub == 0) + isSimple = true; + else if (aKindSub == 1) + isComplex = true; + else if (aKindSub == -1) { + return -1; // heterogeneous + } + } + if (isSimple && isComplex) + aKind = -1; // heterogeneous + else if (isSimple) + aKind = 0; + else if (isComplex) + aKind = 1; + } + break; + case TopAbs_COMPSOLID: + case TopAbs_SOLID: + case TopAbs_SHELL: + aKind = 1; + break; + case TopAbs_WIRE: + case TopAbs_EDGE: + case TopAbs_VERTEX: + aKind = 0; + break; + default: + aKind = 2; + } + + return aKind; +} + //============================================================================= /*! * @@ -64,31 +127,55 @@ IGESEXPORT_EXPORT const TCollection_AsciiString& theFileName, const TCollection_AsciiString& theFormatName ) { + bool ok = false; + + // define, whether to write only faces (5.1 IGES format) + // or shells and solids also (5.3 IGES format) + int aBrepMode = 0; + if (theFormatName.IsEqual("IGES_5_3")) + aBrepMode = 1; + MESSAGE("Export IGES into file " << theFileName.ToCString()); - try - { - // define, whether to write only faces (5.1 IGES format) - // or shells and solids also (5.3 IGES format) - int aBrepMode = 0; - if (theFormatName.IsEqual("IGES_5_3")) + + // Mantis issue 0021350: check being exported shape, as some standalone + // entities (edges, wires and vertices) cannot be saved in BRepMode + if (aBrepMode == 1) { + int aKind = KindOfBRep(theShape); + if (aKind == -1) + Standard_Failure::Raise("EXPORT_IGES_HETEROGENEOUS_COMPOUND"); + else if (aKind == 2) aBrepMode = 1; + else + aBrepMode = aKind; + } + + // commented for 0021350: Please don't catch exceptions silently and send an + // inappropriate error message instead, it is disturbing for the user and for us + //try + { + // Set "C" numeric locale to save numbers correctly + Kernel_Utils::Localizer loc; // initialize writer IGESControl_Controller::Init(); //IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"), - // Interface_Static::IVal("write.iges.brep.mode")); - IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"), aBrepMode); + // Interface_Static::IVal("write.iges.brep.mode")); + IGESControl_Writer ICW ("M", aBrepMode); // "write.iges.unit" ->> VSR 15.09.09: export explicitly in meters + Interface_Static::SetCVal("xstep.cascade.unit","M"); + + // 09.03.2010 skl for bug 0020726 + // change default value "Average" to "Max" + Interface_Static::SetCVal("write.precision.mode","Max"); // perform shape writing - ICW.AddShape( theShape ); - ICW.ComputeModel(); - if ( ICW.Write( theFileName.ToCString() ) ) - return 1; - } - catch(Standard_Failure) - { - //THROW_SALOME_CORBA_EXCEPTION("Exception catched in IGESExport", SALOME::BAD_PARAM); + if (ICW.AddShape( theShape )) { + ICW.ComputeModel(); + ok = ICW.Write( theFileName.ToCString() ); + } } - return 0; + //catch(Standard_Failure) + //{ + //} + return ok; } } diff --git a/src/IGESExport/IGESExport.pro b/src/IGESExport/IGESExport.pro deleted file mode 100644 index 9e0e6b303..000000000 --- a/src/IGESExport/IGESExport.pro +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = IGESExport -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${STDLIB} $${CAS_LDPATH} -lTKIGES $${KERNEL_LDFLAGS} -lSALOMELocalTrace - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += IGESEXPORT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -SOURCES = IGESExport.cxx diff --git a/src/IGESExport/Makefile.am b/src/IGESExport/Makefile.am index 317442f8a..694aee5b0 100644 --- a/src/IGESExport/Makefile.am +++ b/src/IGESExport/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Pavel TELKOV # Modified by : Alexander BORODIN (OCN) - autotools usage @@ -42,4 +40,4 @@ libIGESExport_la_CPPFLAGS = \ libIGESExport_la_LDFLAGS = \ $(STDLIB) \ $(CAS_LDPATH) -lTKIGES \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics diff --git a/src/IGESImport/IGESImport.cxx b/src/IGESImport/IGESImport.cxx index 4830e7743..cff70de18 100644 --- a/src/IGESImport/IGESImport.cxx +++ b/src/IGESImport/IGESImport.cxx @@ -1,39 +1,58 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: IGESImport.cxx -// Created: Wed May 19 14:36:35 2004 -// Author: Pavel TELKOV -// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File: IGESImport.cxx +// Created: Wed May 19 14:36:35 2004 +// Author: Pavel TELKOV + #include "utilities.h" +#include + #include #include +#include +#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include #include +#include +#include +#include #ifdef WNT - #if defined IGESIMPORT_EXPORTS + #if defined IGESIMPORT_EXPORTS || defined IGESImport_EXPORTS #if defined WIN32 #define IGESIMPORT_EXPORT __declspec( dllexport ) #else @@ -60,15 +79,55 @@ extern "C" { IGESIMPORT_EXPORT TopoDS_Shape Import (const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& /*theFormatName*/, - TCollection_AsciiString& theError) + const TCollection_AsciiString& theFormatName, + TCollection_AsciiString& theError, + const TDF_Label& theShapeLabel) { + // Set "C" numeric locale to save numbers correctly + Kernel_Utils::Localizer loc; + IGESControl_Reader aReader; TopoDS_Shape aResShape; + Interface_Static::SetCVal("xstep.cascade.unit","M"); try { IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString()); if (status == IFSelect_RetDone) { + + if (theFormatName == "IGES_UNIT") { + Handle(IGESData_IGESModel) aModel = + Handle(IGESData_IGESModel)::DownCast(aReader.Model()); + gp_Pnt P(1.0,0.0,0.0); + if (!aModel.IsNull()) { + Handle(TCollection_HAsciiString) aUnitName = + aModel->GlobalSection().UnitName(); + //cout<<"aUnitName = "<ToCString()<String()=="CM") { + P = gp_Pnt(0.01,0.0,0.0); + } + } + BRep_Builder B; + TopoDS_Vertex V; + B.MakeVertex(V,P,1.e-7); + aResShape = V; + return aResShape; + } + if (theFormatName == "IGES_SCALE") { + //cout<<"need re-scale a model"<GlobalSection(); + aGS.SetUnitFlag(6); + aModel->SetGlobalSection(aGS); + } + } + MESSAGE("ImportIGES : all Geometry Transfer"); //OCC 5.1.2 porting // aReader.Clear(); @@ -79,6 +138,38 @@ IGESIMPORT_EXPORT MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes()); aResShape = aReader.OneShape(); + // BEGIN: Store names of sub-shapes from file + Handle(Interface_InterfaceModel) Model = aReader.WS()->Model(); + Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader(); + if (!TR.IsNull()) { + Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess(); + Standard_Integer nb = Model->NbEntities(); + for (Standard_Integer i = 1; i <= nb; i++) { + Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast(Model->Value(i)); + if (ent.IsNull() || ! ent->HasName()) continue; + + // find target shape + Handle(Transfer_Binder) binder = TP->Find(ent); + if (binder.IsNull()) continue; + TopoDS_Shape S = TransferBRep::ShapeResult(binder); + if (S.IsNull()) continue; + + // create label and set shape + TDF_Label L; + TDF_TagSource aTag; + L = aTag.NewChild(theShapeLabel); + TNaming_Builder tnBuild (L); + tnBuild.Generated(S); + + // set a name + TCollection_AsciiString string = ent->NameValue()->String(); + string.LeftAdjust(); + string.RightAdjust(); + TCollection_ExtendedString str (string); + TDataStd_Name::Set(L, str); + } + } + // END: Store names } else { // switch (status) { // case IFSelect_RetVoid: @@ -97,7 +188,7 @@ IGESIMPORT_EXPORT // break; // } theError = "Wrong format of the imported file. Can't import file."; - aResShape.Nullify(); + aResShape.Nullify(); } } catch(Standard_Failure) { diff --git a/src/IGESImport/IGESImport.pro b/src/IGESImport/IGESImport.pro deleted file mode 100644 index 33db63680..000000000 --- a/src/IGESImport/IGESImport.pro +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = IGESImport -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${STDLIB} $${CAS_LDPATH} -lTKIGES $${KERNEL_LDFLAGS} -lSALOMELocalTrace - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += IGESIMPORT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -SOURCES = IGESImport.cxx diff --git a/src/IGESImport/Makefile.am b/src/IGESImport/Makefile.am index 0252162d6..b6001bf34 100644 --- a/src/IGESImport/Makefile.am +++ b/src/IGESImport/Makefile.am @@ -1,30 +1,27 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # File : Makefile.in # Author : Pavel TELKOV # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM # $Header$ -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # Libraries targets @@ -39,7 +36,7 @@ libIGESImport_la_CPPFLAGS = \ $(CAS_CPPFLAGS) \ $(KERNEL_CXXFLAGS) -libIGESImport_la_LDFLAGS = \ - $(STDLIB) \ - $(CAS_LDPATH) -lTKIGES \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace +libIGESImport_la_LDFLAGS = \ + $(STDLIB) \ + $(CAS_LDPATH) -lTKIGES -lTKCAF -lTKLCAF \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics diff --git a/src/Makefile.am b/src/Makefile.am index 88531e27c..862b90287 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,49 +1,48 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : src (source files directory) -# -SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER GEOM BREPExport \ - BREPImport IGESExport IGESImport STEPExport STEPImport \ - STLExport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv \ - GEOM_SWIG + +SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER OCC2VTK GEOM \ + BREPExport BREPImport IGESExport IGESImport STEPExport \ + STEPImport STLExport VTKExport ShHealOper GEOMImpl GEOM_I \ + GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY + +if WITH_OPENCV + SUBDIRS += ShapeRecognition +endif if GEOM_ENABLE_GUI - SUBDIRS += OBJECT DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI \ + SUBDIRS += OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase GEOMToolsGUI \ DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI \ BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI \ - GroupGUI BlocksGUI GEOM_SWIG_WITHIHM + GroupGUI BlocksGUI AdvancedGUI GEOM_SWIG_WITHIHM endif -DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER GEOM BREPExport \ +DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo \ + SKETCHER OCC2VTK GEOM BREPExport \ BREPImport IGESExport IGESImport STEPExport STEPImport STLExport \ - ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG \ - OBJECT DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI \ - DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI \ - BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI \ - MeasureGUI GroupGUI BlocksGUI GEOM_SWIG_WITHIHM - -####################################### -# Not used packages are listed below -####################################### -# GEOMDS NMTAlgo PARTITION + VTKExport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv \ + GEOM_SWIG OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \ + GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \ + EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \ + RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \ + GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition diff --git a/src/Material/Makefile.am b/src/Material/Makefile.am new file mode 100644 index 000000000..c0c43367f --- /dev/null +++ b/src/Material/Makefile.am @@ -0,0 +1,55 @@ +# Copyright (C) 2007-2012 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 +# + +# File : Makefile.am +# Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com) +# Package : Material +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# Libraries targets +lib_LTLIBRARIES = libMaterial.la + +# header files +salomeinclude_HEADERS = \ + Material.h \ + Material_Model.h \ + Material_ResourceMgr.h + +dist_libMaterial_la_SOURCES = \ + Material_Model.cxx \ + Material_ResourceMgr.cxx + +# additional information to compile and link file +libMaterial_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(VTK_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + -I$(srcdir)/../OBJECT + +libMaterial_la_LDFLAGS = -lVTKViewer -lOCCViewer -lsuit -lSalomeApp \ + ../OBJECT/libGEOMObject.la \ + $(GUI_LDFLAGS) -lqtx \ + $(QT_MT_LIBS) \ + $(CAS_LDFLAGS) -lTKV3d -lTKGeomBase \ + $(VTK_LIBS) + +dist_salomeres_DATA = resources/SalomeMaterial.xml diff --git a/src/Material/Material.h b/src/Material/Material.h new file mode 100644 index 000000000..c7ec1339d --- /dev/null +++ b/src/Material/Material.h @@ -0,0 +1,36 @@ +// Copyright (C) 2007-2012 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 +// + +// File : Material.h +// Author : Margarita KARPUNINA, Open CASCADE S.A.S. +// +#ifndef MATERIAL_H +#define MATERIAL_H + +#if defined WIN32 +# if defined MATERIAL_SALOME_EXPORTS || defined Material_EXPORTS +# define MATERIAL_SALOME_EXPORT _declspec( dllexport ) +# else +# define MATERIAL_SALOME_EXPORT _declspec( dllimport ) +# endif +#else +# define MATERIAL_SALOME_EXPORT +#endif + +#endif // MATERIAL_H diff --git a/src/Material/Material_Model.cxx b/src/Material/Material_Model.cxx new file mode 100644 index 000000000..9744571c5 --- /dev/null +++ b/src/Material/Material_Model.cxx @@ -0,0 +1,610 @@ +// Copyright (C) 2007-2012 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 +// + +// File : Material_Model.cxx +// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com) +// + +#include "Material_Model.h" +#include "GEOM_VTKPropertyMaterial.hxx" +#include "Material_ResourceMgr.h" + +/*! + \brief Constructor + + Create new SALOME material model with default properties. +*/ +Material_Model::Material_Model() +{ + myReflection = ReflectionList(4); + init(); // set default properties +} + +/*! + \brief Destructor +*/ +Material_Model::~Material_Model() +{ +} + +/*! + \brief Initialize material data from the given properties list + \param props material properties + \sa toProperties() +*/ +void Material_Model::fromProperties( const QString& props ) +{ + // reset to default values + init(); + + // parse material properties + QStringList propList = props.split( ":", QString::SkipEmptyParts ); + foreach ( QString prop, propList ) + { + QStringList pdata = prop.split( "=" ); + if ( pdata.count() < 2 ) continue; + QString key = pdata[0].trimmed().toLower(); + QString data = pdata[1].trimmed().toLower(); + bool dblOk, boolOk; + double dblValue = data.toDouble( &dblOk ); + bool boolValue = (bool)( data.toInt( &boolOk ) ); + QColor colorValue; + + if ( key == "ambientcolor" && Qtx::stringToColor( data, colorValue ) ) { + setColor( Ambient, colorValue ); + } + else if ( key == "diffusecolor" && Qtx::stringToColor( data, colorValue ) ) { + setColor( Diffuse, colorValue ); + } + else if ( key == "specularcolor" && Qtx::stringToColor( data, colorValue ) ) { + setColor( Specular, colorValue ); + } + else if ( key == "emissivecolor" && Qtx::stringToColor( data, colorValue ) ) { + setColor( Emissive, colorValue ); + } + else if ( key == "ambientcoefficient" && dblOk ) { + setReflection( Ambient, dblValue ); + } + else if ( key == "diffusecoefficient" && dblOk ) { + setReflection( Diffuse, dblValue ); + } + else if ( key == "specularcoefficient" && dblOk ) { + setReflection( Specular, dblValue ); + } + else if ( key == "emissivecoefficient" && dblOk ) { + setReflection( Emissive, dblValue ); + } + else if ( key == "shininess" && dblOk ) { + setShininess( dblValue ); + } + else if ( key == "transparency" && dblOk ) { + setTransparency( dblValue ); + } + else if ( key == "physical" && boolOk ) { + setPhysical( boolValue ); + } + else if ( key == "ambient" && boolOk ) { + setReflection( Ambient, boolValue ); + } + else if ( key == "diffuse" && boolOk ) { + setReflection( Diffuse, boolValue ); + } + else if ( key == "specular" && boolOk ) { + setReflection( Specular, boolValue ); + } + else if ( key == "emissive" && boolOk ) { + setReflection( Emissive, boolValue ); + } + } +} + +/*! + \brief Get material properties string representation + \return string representing of material properties + \sa fromProperties() +*/ +QString Material_Model::toProperties() +{ + QStringList props; + QString fmt = "%1=%2"; + + // physical + props << fmt.arg( "Physical" ).arg( isPhysical() ); + + // shininess + props << fmt.arg( "Shininess" ).arg( shininess() ); + + //transparency + props << fmt.arg( "Transparency" ).arg( transparency() ); + + // ambient reflection + props << fmt.arg( "Ambient" ).arg( hasReflection( Ambient ) ); + if ( color( Ambient ).isValid() ) + props << fmt.arg( "AmbientColor" ).arg( Qtx::colorToString( color( Ambient ) ) ); + props << fmt.arg( "AmbientCoefficient" ).arg( reflection( Ambient ) ); + + // diffuse reflection + props << fmt.arg( "Diffuse" ).arg( hasReflection( Diffuse ) ); + if ( color( Diffuse ).isValid() ) + props << fmt.arg( "DiffuseColor" ).arg( Qtx::colorToString( color( Diffuse ) ) ); + props << fmt.arg( "DiffuseCoefficient" ).arg( reflection( Diffuse ) ); + + // specular reflection + props << fmt.arg( "Specular" ).arg( hasReflection( Specular ) ); + if ( color( Specular ).isValid() ) + props << fmt.arg( "SpecularColor" ).arg( Qtx::colorToString( color( Specular ) ) ); + props << fmt.arg( "SpecularCoefficient" ).arg( reflection( Specular ) ); + + // emissive reflection + props << fmt.arg( "Emissive" ).arg( hasReflection( Emissive ) ); + if ( color( Emissive ).isValid() ) + props << fmt.arg( "EmissiveColor" ).arg( Qtx::colorToString( color( Emissive ) ) ); + props << fmt.arg( "EmissiveCoefficient" ).arg( reflection( Emissive ) ); + + return props.join( ":" ); +} + +/*! + \brief Initialize material model from the resources + + This function can be used to retrieve material properties from the resource file. + + \param material material name (if not specified, model is initialized by default material) + \param resMgr resource manager (if not specified, new resources manager is created) + \sa toResources() +*/ +void Material_Model::fromResources( const QString& material, QtxResourceMgr* resMgr ) +{ + static QString common = "[common]"; + + // reset to default values + init(); + + // material name is not specified: use default values + if ( material.isEmpty() ) return; + + bool ownResourcesMgr = resMgr == 0; + + if ( ownResourcesMgr ) + resMgr = new Material_ResourceMgr(); + + // read common section + if ( material != common && resMgr->hasSection( common ) ) + fromResources( common, resMgr ); + + // physical + if ( resMgr->hasValue( material, "physical" ) ) { + setPhysical( resMgr->booleanValue( material, "physical" ) ); + } + + // shininess + if ( resMgr->hasValue( material, "shininess" ) ) { + setShininess( resMgr->doubleValue( material, "shininess" ) ); + } + + // transparency + if ( resMgr->hasValue( material, "transparency" ) ) { + setTransparency( resMgr->doubleValue( material, "transparency" ) ); + } + + // ambient reflection + if ( resMgr->hasValue( material, "ambient-color" ) ) { + setColor( Ambient, resMgr->colorValue( material, "ambient-color" ) ); + } + if ( resMgr->hasValue( material, "ambient-coefficient" ) ) { + setReflection( Ambient, resMgr->doubleValue( material, "ambient-coefficient" ) ); + } + if ( resMgr->hasValue( material, "ambient" ) ) { + setReflection( Ambient, resMgr->booleanValue( material, "ambient" ) ); + } + + // diffuse reflection + if ( resMgr->hasValue( material, "diffuse-color" ) ) { + setColor( Diffuse, resMgr->colorValue( material, "diffuse-color" ) ); + } + if ( resMgr->hasValue( material, "diffuse-coefficient" ) ) { + setReflection( Diffuse, resMgr->doubleValue( material, "diffuse-coefficient" ) ); + } + if ( resMgr->hasValue( material, "diffuse" ) ) { + setReflection( Diffuse, resMgr->booleanValue( material, "diffuse" ) ); + } + + // specular reflection + if ( resMgr->hasValue( material, "specular-color" ) ) { + setColor( Specular, resMgr->colorValue( material, "specular-color" ) ); + } + if ( resMgr->hasValue( material, "specular-coefficient" ) ) { + setReflection( Specular, resMgr->doubleValue( material, "specular-coefficient" ) ); + } + if ( resMgr->hasValue( material, "specular" ) ) { + setReflection( Specular, resMgr->booleanValue( material, "specular" ) ); + } + + // emissive reflection + if ( resMgr->hasValue( material, "emissive-color" ) ) { + setColor( Emissive, resMgr->colorValue( material, "emissive-color" ) ); + } + if ( resMgr->hasValue( material, "emissive-coefficient" ) ) { + setReflection( Emissive, resMgr->doubleValue( material, "emissive-coefficient" ) ); + } + if ( resMgr->hasValue( material, "emissive" ) ) { + setReflection( Emissive, resMgr->booleanValue( material, "emissive" ) ); + } + + if ( ownResourcesMgr ) + delete resMgr; +} + +/*! + \brief Save material properties to the resource file. + \param material material name + \param resMgr resource manager + \sa fromResources() +*/ +void Material_Model::toResources( const QString& material, QtxResourceMgr* resMgr ) +{ + if ( resMgr && !material.isEmpty() ) { + // remove resources section (to clean-up all previous properties) + resMgr->remove( material ); + + // physical + resMgr->setValue( material, "physical", isPhysical() ); + + // shininess + resMgr->setValue( material, "shininess", shininess() ); + + // transparency + resMgr->setValue( material, "transparency", transparency() ); + + // ambient reflection + if ( color( Ambient ).isValid() ) + resMgr->setValue( material, "ambient-color", color( Ambient ) ); + resMgr->setValue( material, "ambient-coefficient", reflection( Ambient ) ); + resMgr->setValue( material, "ambient", hasReflection( Ambient ) ); + + // diffuse reflection + if ( color( Diffuse ).isValid() ) + resMgr->setValue( material, "diffuse-color", color( Diffuse ) ); + resMgr->setValue( material, "diffuse-coefficient", reflection( Diffuse ) ); + resMgr->setValue( material, "diffuse", hasReflection( Diffuse ) ); + + // Specular reflection + if ( color( Specular ).isValid() ) + resMgr->setValue( material, "specular-color", color( Specular ) ); + resMgr->setValue( material, "specular-coefficient", reflection( Specular ) ); + resMgr->setValue( material, "specular", hasReflection( Specular ) ); + + // Emissive reflection + if ( color( Emissive ).isValid() ) + resMgr->setValue( material, "emissive-color", color( Emissive ) ); + resMgr->setValue( material, "emissive-coefficient", reflection( Emissive ) ); + resMgr->setValue( material, "emissive", hasReflection( Emissive ) ); + } +} + +/*! + \brief Initialize material model from the preferences + + The material name is retrieved from the "material" parameter of the "Geometry" section + of the specified resources manager. + + \param resMgr resources manager + \sa fromResources(), toResources() +*/ +// void Material_Model::fromPreferences( QtxResourceMgr* resMgr ) +// { +// if ( resMgr ) { +// // default material is Plastic +// fromResources( resMgr->stringValue( "Geometry", "material", "Plastic" ) ); +// } +// } + +/*! + \brief Get material type + \return \c true if material is physical or \c false otherwise + \sa setPhysical() +*/ +bool Material_Model::isPhysical() const +{ + return myIsPhysical; +} + +/*! + \brief Set material type + \param value \c true if material is physical or \c false otherwise + \sa isPhysical() +*/ +void Material_Model::setPhysical( bool value ) +{ + myIsPhysical = value; +} + +/*! + \brief Check if given reflection is enabled + \param type reflection type + \return \c true if specified reflection type is enabled or \c false otherwise + \sa setReflection(ReflectionType, bool) +*/ +bool Material_Model::hasReflection( ReflectionType type ) const +{ + bool value = false; + if ( type >= 0 && type < 4 ) + value = myReflection[ type ].enabled; + return value; +} + +/*! + \brief Enable/disable given reflection type + \param type reflection type + \param value boolean flag + \sa hasReflection() +*/ +void Material_Model::setReflection( ReflectionType type, bool value ) +{ + if ( type >= 0 && type < 4 ) + myReflection[ type ].enabled = value; +} + +/*! + \brief Get color value for the given reflection type + \param type reflection type + \return color associated with the specified reflection type + \sa setColor() +*/ +QColor Material_Model::color( ReflectionType type ) const +{ + QColor value; + if ( type >= 0 && type < 4 ) + value = myReflection[ type ].color; + return value; +} + +/*! + \brief Set color value for the given reflection type + \param type reflection type + \param value color to be used for specified reflection type + \sa color() +*/ +void Material_Model::setColor( ReflectionType type, const QColor& value ) +{ + if ( type >= 0 && type < 4 ) + myReflection[ type ].color = value; +} + +/*! + \brief Get coefficient value for the given reflection type + \param type reflection type + \return coefficient value for the specified reflection type + \sa setReflection(ReflectionType, double) +*/ +double Material_Model::reflection( ReflectionType type ) const +{ + double value = 0.0; + if ( type >= 0 && type < 4 ) + value = myReflection[ type ].coef; + return value; +} + +/*! + \brief Set coefficient value for the given reflection type + \param type reflection type + \param value coefficient to be used by the given reflection type + \sa reflection() +*/ +void Material_Model::setReflection( ReflectionType type, double value ) +{ + if ( type >= 0 && type < 4 ) + myReflection[ type ].coef = value; +} + +/*! + \brief Get shininess value + \return shininess value of the material + \sa setShininess() +*/ +double Material_Model::shininess() const +{ + return myShininess; +} + +/*! + \brief Set shininess value + \param value new shininess value + \sa shininess() +*/ +void Material_Model::setShininess( double value ) +{ + myShininess = value; +} + +/*! + \brief Get transparency value + \return transparency value of the material + \sa setTransparency() +*/ +double Material_Model::transparency() const +{ + return myTransparency; +} + +/*! + \brief Set transparency value + \param value new transparency value + \sa transparency() +*/ +void Material_Model::setTransparency( double value ) +{ + myTransparency = value; +} + +/*! + \brief Initialize material model with default values +*/ +void Material_Model::init() +{ + QColor c; + + // non-physical by default + setPhysical( false ); + // shininess + setShininess( 0.039 ); + // transparency + setTransparency( 0.0 ); + + // ambient reflection (enabled by default) + Qtx::stringToColor( "#333333", c ); + setColor( Ambient, c ); + setReflection( Ambient, 0.3 ); + setReflection( Ambient, true ); + + // diffuse reflection (enabled by default) + Qtx::stringToColor( "#000000", c ); + setColor( Diffuse, c ); + setReflection( Diffuse, 0.65 ); + setReflection( Diffuse, true ); + + // specular reflection (enabled by default) + Qtx::stringToColor( "#ffffff", c ); + setColor( Specular, c ); + setReflection( Specular, 0.0 ); + setReflection( Specular, true ); + + // emissive reflection (disabled by default) + Qtx::stringToColor( "#000000", c ); + setColor( Emissive, c ); + setReflection( Emissive, 0.0 ); + setReflection( Emissive, false ); +} + +/*! + \brief Construct OCCT material aspect from material model + \return material aspect object with corresponding properties +*/ +Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect() +{ + // Get material aspect from the current model + Graphic3d_MaterialAspect aspect; + + QColor c; + + // ambient reflection + if ( color( Ambient ).isValid() ) { + c = color( Ambient ); + aspect.SetAmbientColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); + } + aspect.SetAmbient( reflection( Ambient )); + if ( hasReflection( Ambient ) ) + aspect.SetReflectionModeOn( Graphic3d_TOR_AMBIENT ); + else + aspect.SetReflectionModeOff( Graphic3d_TOR_AMBIENT ); + + // diffuse reflection + if ( color( Diffuse ).isValid() ) { + c = color( Diffuse ); + aspect.SetDiffuseColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); + } + aspect.SetDiffuse( reflection( Diffuse )); + if ( hasReflection( Diffuse ) ) + aspect.SetReflectionModeOn( Graphic3d_TOR_DIFFUSE ); + else + aspect.SetReflectionModeOff( Graphic3d_TOR_DIFFUSE ); + + // specular reflection + if ( color( Specular ).isValid() ) { + c = color( Specular ); + aspect.SetSpecularColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); + } + aspect.SetSpecular( reflection( Specular )); + if ( hasReflection( Specular ) ) + aspect.SetReflectionModeOn( Graphic3d_TOR_SPECULAR ); + else + aspect.SetReflectionModeOff( Graphic3d_TOR_SPECULAR ); + + // emissive reflection + if ( color( Emissive ).isValid() ) { + c = color( Emissive ); + aspect.SetEmissiveColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); + } + aspect.SetEmissive( reflection( Emissive )); + if ( hasReflection( Emissive ) ) + aspect.SetReflectionModeOn( Graphic3d_TOR_EMISSION ); + else + aspect.SetReflectionModeOff( Graphic3d_TOR_EMISSION ); + + // shininess + aspect.SetShininess( shininess() ); + + // transparency + aspect.SetTransparency( transparency() ); + + // material type + aspect.SetMaterialType( isPhysical() ? Graphic3d_MATERIAL_PHYSIC : Graphic3d_MATERIAL_ASPECT ); + + return aspect; +} + +/*! + \brief Construct VTK property from material model + \return VTK property with correspondent material properties +*/ +GEOM_VTKPropertyMaterial* Material_Model::getMaterialVTKProperty() +{ + // NOTE: In VTK it's impossible to switch on/off specific reflection type + // NOTE: In VTK emissive reflection type is not supported + // NOTE: In VTK shininess is specified via SpecularPower attribute + // NOTE: In VTK transparency is specified via Opacity attribute + + // Get material properties from the current model + GEOM_VTKPropertyMaterial* prop = GEOM_VTKPropertyMaterial::New(); + + QColor c; + + // ambient reflection + if ( color( Ambient ).isValid() && hasReflection( Ambient ) ) { + c = color( Ambient ); + prop->SetAmbientColor( c.redF(), c.greenF(), c.blueF() ); + prop->SetAmbient( reflection( Ambient ) ); + } + + // diffuse reflection + if ( color( Diffuse ).isValid() && hasReflection( Diffuse ) ) { + c = color( Diffuse ); + prop->SetDiffuseColor( c.redF(), c.greenF(), c.blueF() ); + prop->SetDiffuse( reflection( Diffuse ) ); + } + + // specular reflection + if ( color( Specular ).isValid() && hasReflection( Specular ) ) { + c = color( Specular ); + prop->SetSpecularColor( c.redF(), c.greenF(), c.blueF() ); + prop->SetSpecular( reflection( Specular ) ); + } + + // shininess + prop->SetSpecularPower( shininess()*100.0 ); + + // transparency + prop->SetOpacity( 1 - transparency() ); + + // material type + prop->SetPhysical( isPhysical() ); + + return prop; +} + diff --git a/src/Material/Material_Model.h b/src/Material/Material_Model.h new file mode 100644 index 000000000..3f3c8ff24 --- /dev/null +++ b/src/Material/Material_Model.h @@ -0,0 +1,96 @@ +// Copyright (C) 2007-2012 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 +// + +// File : Material_Model.h +// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com) +// +#ifndef MATERIAL_MODEL_H +#define MATERIAL_MODEL_H + +#include "Material.h" + +#include +#include +#include +#include + +#include + +class QtxResourceMgr; +class GEOM_VTKPropertyMaterial; + +class MATERIAL_SALOME_EXPORT Material_Model +{ +public: + //! Reflection type + typedef enum { + Ambient, //!< Ambient + Diffuse, //!< Diffuse + Specular, //!< Specular + Emissive //!< Emissive + } ReflectionType; + + Material_Model(); + virtual ~Material_Model(); + + void fromProperties( const QString& ); + QString toProperties(); + void fromResources( const QString& = QString(), QtxResourceMgr* = 0 ); + void toResources( const QString&, QtxResourceMgr* ); + + bool isPhysical() const; + void setPhysical( bool ); + + bool hasReflection( ReflectionType ) const; + void setReflection( ReflectionType, bool ); + + QColor color( ReflectionType ) const; + void setColor( ReflectionType, const QColor& ); + + double reflection( ReflectionType ) const; + void setReflection( ReflectionType, double ); + + double shininess() const; + void setShininess( double ); + + double transparency() const; + void setTransparency( double ); + + Graphic3d_MaterialAspect getMaterialOCCAspect(); + GEOM_VTKPropertyMaterial* getMaterialVTKProperty(); + +private: + void init(); + +private: + typedef struct { + QColor color; + double coef; + bool enabled; + } ReflectionData; + + typedef QVector ReflectionList; + + bool myIsPhysical; + double myShininess; + double myTransparency; + ReflectionList myReflection; +}; + +#endif // MATERIAL_MODEL_H diff --git a/src/Material/Material_ResourceMgr.cxx b/src/Material/Material_ResourceMgr.cxx new file mode 100644 index 000000000..97853f532 --- /dev/null +++ b/src/Material/Material_ResourceMgr.cxx @@ -0,0 +1,116 @@ +// Copyright (C) 2007-2012 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 +// + +// File : Material_ResourceMgr.cxx +// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com) + +#include "Material_ResourceMgr.h" + +/*! + \class Material_ResourceMgr + \brief Material properties resources manager. + + This class is used to manage the material properties throughout the application + in the similar way as QtxResourceMgr does it with application preferences. + + Standard material types are stored in the global application settings files + (named as SalomeMaterial.xml). User-defined materials are stored in user's home + directory - in the file .SalomeMaterialrc. + + The Material_ResourceMgr class is used by material properties dialog box + (GEOMToolsGUI_MaterialPropertiesDlg class). +*/ + +/*! + \brief Constructor +*/ +Material_ResourceMgr::Material_ResourceMgr() + : QtxResourceMgr( "SalomeMaterial", "%1Config" ) +{ + if ( dirList().isEmpty() && ::getenv( "GEOM_ROOT_DIR" ) ) + setDirList( QStringList() << Qtx::addSlash( ::getenv( "GEOM_ROOT_DIR" ) ) + "share/salome/resources/geom" ); + setCurrentFormat( "xml" ); +} + +/*! + \brief Destructor +*/ +Material_ResourceMgr::~Material_ResourceMgr() +{ +} + +/*! + \brief Get list of avaiable materials + \param theType material type + \param theSort if \c true (default), returns a list of materials sorted by name + \return list of avaiable materials names +*/ +QStringList Material_ResourceMgr::materials( MaterialType theType, bool theSort ) +{ + // store original working mode + WorkingMode m = workingMode(); + + QStringList slglobal, sluser; + + // retrieve all materials : global + user + setWorkingMode( AllowUserValues ); + sluser = sections(); + + // retrieve only global materials + setWorkingMode( IgnoreUserValues ); + slglobal = sections(); + + // remove global materials from user list to obtain only user materials + QMutableListIterator it( sluser ); + while ( it.hasNext() ) { + QString s = it.next(); + if ( slglobal.contains( s ) ) it.remove(); + } + + // remove 'common' material + slglobal.removeAll("[common]"); + + // restore original working mode + setWorkingMode( m ); + + // sort if necessary (separately global and user materials) + if ( theSort ) { + qSort( slglobal ); + qSort( sluser ); + } + + // combine the materials to obtain result list + QStringList result; + + switch ( theType ) { + case Global: + result = slglobal; + break; + case User: + result = sluser; + break; + case All: + result = slglobal + sluser; + break; + default: + break; + } + + return result; +} diff --git a/src/Material/Material_ResourceMgr.h b/src/Material/Material_ResourceMgr.h new file mode 100644 index 000000000..a98a531d7 --- /dev/null +++ b/src/Material/Material_ResourceMgr.h @@ -0,0 +1,47 @@ +// Copyright (C) 2007-2012 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 +// + +// File : Material_ResourceMgr.h +// Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com) +// +#ifndef MATERIAL_RESOURCEMGR_H +#define MATERIAL_RESOURCEMGR_H + +#include "Material.h" + +#include + +class MATERIAL_SALOME_EXPORT Material_ResourceMgr : public QtxResourceMgr +{ +public: + //! Material type + typedef enum { + Global, //!< Global materials + User, //!< User materials + All //!< All materials + } MaterialType; + + Material_ResourceMgr(); + ~Material_ResourceMgr(); + + QStringList materials( MaterialType = All, bool = true ); + +}; + +#endif // MATERIAL_RESOURCEMGR_H diff --git a/src/Material/resources/SalomeMaterial.xml b/src/Material/resources/SalomeMaterial.xml new file mode 100644 index 000000000..d1e26882c --- /dev/null +++ b/src/Material/resources/SalomeMaterial.xml @@ -0,0 +1,218 @@ + + +
    + + + + + + + + + + + + + + + +
    +
    + + + + +
    +
    + + + + +
    +
    + + + + +
    +
    + + + + + + + +
    +
    + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    + + + + + + + + +
    +
    diff --git a/src/MeasureGUI/Makefile.am b/src/MeasureGUI/Makefile.am index 3e5229249..8b0541a9a 100644 --- a/src/MeasureGUI/Makefile.am +++ b/src/MeasureGUI/Makefile.am @@ -1,29 +1,27 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM MEASUREGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : MeasureGUI -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files @@ -42,6 +40,7 @@ salomeinclude_HEADERS = \ MeasureGUI_WhatisDlg.h \ MeasureGUI_CheckShapeDlg.h \ MeasureGUI_CheckCompoundOfBlocksDlg.h \ + MeasureGUI_CheckSelfIntersectionsDlg.h \ MeasureGUI_PointDlg.h # Libraries targets @@ -61,7 +60,8 @@ dist_libMeasureGUI_la_SOURCES = \ MeasureGUI_MaxToleranceDlg.cxx \ MeasureGUI_WhatisDlg.cxx \ MeasureGUI_CheckShapeDlg.cxx \ - MeasureGUI_CheckCompoundOfBlocksDlg.cxx \ + MeasureGUI_CheckCompoundOfBlocksDlg.cxx \ + MeasureGUI_CheckSelfIntersectionsDlg.cxx \ MeasureGUI_PointDlg.cxx MOC_FILES = \ @@ -78,6 +78,7 @@ MOC_FILES = \ MeasureGUI_WhatisDlg_moc.cxx \ MeasureGUI_CheckShapeDlg_moc.cxx \ MeasureGUI_CheckCompoundOfBlocksDlg_moc.cxx \ + MeasureGUI_CheckSelfIntersectionsDlg_moc.cxx \ MeasureGUI_PointDlg_moc.cxx nodist_libMeasureGUI_la_SOURCES = \ @@ -116,9 +117,9 @@ libMeasureGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOM \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libMeasureGUI_la_LDFLAGS = \ - ../GEOMBase/libGEOMBase.la + $(CAS_LDFLAGS) -lTKGeomBase \ + ../GEOMBase/libGEOMBase.la ../DlgRef/libDlgRef.la diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index a240d7562..e1ddbfcff 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -1,31 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. -// + #include "MeasureGUI.h" #include +#include "GeometryGUI_Operations.h" #include #include @@ -40,6 +42,7 @@ #include "MeasureGUI_WhatisDlg.h" // Method WHATIS #include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND +#include "MeasureGUI_CheckSelfIntersectionsDlg.h" // Method CHECK SELF INTERSCTIONS #include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES #include @@ -74,40 +77,43 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* dlg = 0; switch ( theCommandID ) { - case 701: + case GEOMOp::OpProperties: dlg = new MeasureGUI_PropertiesDlg( getGeometryGUI(), parent ); break; // LENGTH, AREA AND VOLUME - case 702: + case GEOMOp::OpCenterMass: dlg = new MeasureGUI_CenterMassDlg( getGeometryGUI(), parent ); - break; // CENTER MASS - case 703: + break; // CENTER MASS7 + case GEOMOp::OpInertia: dlg = new MeasureGUI_InertiaDlg( getGeometryGUI(), parent ); break; // INERTIA - case 704 : + case GEOMOp::OpNormale : dlg = new MeasureGUI_NormaleDlg( getGeometryGUI(), parent ); break; // NORMALE - case 7041: + case GEOMOp::OpBoundingBox: dlg = new MeasureGUI_BndBoxDlg( getGeometryGUI(), parent ); break; // BOUNDING BOX - case 7042: + case GEOMOp::OpMinDistance: dlg = new MeasureGUI_DistanceDlg( getGeometryGUI(), parent ); break; // MIN DISTANCE - case 7043: + case GEOMOp::OpAngle: dlg = new MeasureGUI_AngleDlg( getGeometryGUI(), parent ); break; // ANGLE - case 705: + case GEOMOp::OpTolerance: dlg = new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent ); break; // MAXTOLERANCE - case 706: + case GEOMOp::OpWhatIs: dlg = new MeasureGUI_WhatisDlg( getGeometryGUI(), parent ); break; // WHATIS - case 707: + case GEOMOp::OpCheckShape: dlg = new MeasureGUI_CheckShapeDlg( getGeometryGUI(), parent ); break; // CHECKSHAPE - case 7072: + case GEOMOp::OpCheckCompound: dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent ); break; // CHECKCOMPOUND - case 708: + case GEOMOp::OpCheckSelfInters: + dlg = new MeasureGUI_CheckSelfIntersectionsDlg( getGeometryGUI(), parent ); + break; // CHECK SELF INTERSCTIONS + case GEOMOp::OpPointCoordinates: dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent ); break; // POINT COORDINATES default: diff --git a/src/MeasureGUI/MeasureGUI.h b/src/MeasureGUI/MeasureGUI.h index 71d34a71b..ce2aeb277 100644 --- a/src/MeasureGUI/MeasureGUI.h +++ b/src/MeasureGUI/MeasureGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -32,6 +33,12 @@ // class : MeasureGUI // purpose : //================================================================================= + +#define DISPLAY_PREVIEW_MACRO \ +SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); \ +int w = resMgr->integerValue("Geometry", "measures_line_width", 1); \ +displayPreview(true, false, true, true, w, -1, -1); + class MeasureGUI : public GEOMGUI { public: diff --git a/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.ui b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.ui index 7ad9f5cda..30b225aad 100644 --- a/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.ui +++ b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.ui @@ -59,7 +59,7 @@ - 250 + 300 0 diff --git a/src/MeasureGUI/MeasureGUI_1Sel1TextView2ListBox_QTD.ui b/src/MeasureGUI/MeasureGUI_1Sel1TextView2ListBox_QTD.ui index eb01d0230..380f868ce 100644 --- a/src/MeasureGUI/MeasureGUI_1Sel1TextView2ListBox_QTD.ui +++ b/src/MeasureGUI/MeasureGUI_1Sel1TextView2ListBox_QTD.ui @@ -72,7 +72,14 @@
    - + + + + 300 + 0 + + + diff --git a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx index 6c6cff648..90a87dcd9 100644 --- a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx @@ -1,28 +1,26 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component -// File : MeasureGUI_AngleDlg.cxx -// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. -// +// File : MeasureGUI_AngleDlg.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. + #include "MeasureGUI_AngleDlg.h" #include "MeasureGUI_Widgets.h" @@ -30,6 +28,8 @@ #include #include +#include + #include #include #include @@ -55,6 +55,9 @@ #include #include #include +#include +#include +#include // QT Includes #include @@ -161,10 +164,7 @@ void MeasureGUI_AngleDlg::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); if (aSelList.Extent() > 0) { - Standard_Boolean testResult = Standard_False; - aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult) - aSelectedObject = GEOM::GEOM_Object::_nil(); + aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); } // clear selection @@ -198,7 +198,9 @@ void MeasureGUI_AngleDlg::processObject() double anAngle = 0.; if (getParameters(anAngle)) { - myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(anAngle)); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "angle_precision", 6 ); + myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(anAngle, aPrecision)); redisplayPreview(); } else { @@ -215,17 +217,18 @@ bool MeasureGUI_AngleDlg::getParameters (double& theAngle) { QString msg; if (isValid(msg)) { + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { - theAngle = GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->GetAngle(myObj, myObj2); + theAngle = anOper->GetAngle(myObj, myObj2); } catch(const SALOME::SALOME_Exception& e) { SalomeApp_Tools::QtCatchCorbaException(e); return false; } - bool isDone = getOperation()->IsDone(); + bool isDone = anOper->IsDone(); if (!isDone) { - CORBA::String_var aMsg = getOperation()->GetErrorCode(); + CORBA::String_var aMsg = anOper->GetErrorCode(); SUIT_MessageBox::warning(this, QObject::tr("WRN_WARNING"), QObject::tr(aMsg.in())); @@ -309,7 +312,7 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() if (anAngle > Precision::Angular()) { try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif TopoDS_Shape S1, S2; @@ -350,8 +353,8 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() aLabel.sprintf("%.1f", anAngle); Handle(AIS_AngleDimension) anIO = new AIS_AngleDimension - (anEdge1, anEdge2, aPlane, anAngle * PI180, - TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().data())); + (anEdge1, anEdge2, aPlane, anAngle * M_PI / 180., + TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().data())); Handle(Geom_Line) geom_lin1,geom_lin2; gp_Pnt ptat11,ptat12,ptat21,ptat22; Standard_Boolean isInfinite1,isInfinite2; @@ -378,6 +381,12 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() anIO->SetArrowSize(arrowSize); } + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); + Handle(Prs3d_AngleAspect) asp = new Prs3d_AngleAspect(); + asp->LineAspect()->SetWidth(w); + anIO->Attributes()->SetAngleAspect(asp); + SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); diff --git a/src/MeasureGUI/MeasureGUI_AngleDlg.h b/src/MeasureGUI/MeasureGUI_AngleDlg.h index ae9de088c..fa24fbdda 100644 --- a/src/MeasureGUI/MeasureGUI_AngleDlg.h +++ b/src/MeasureGUI/MeasureGUI_AngleDlg.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_AngleDlg.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index a3d718caf..3544009ac 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_BndBoxDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -26,7 +27,10 @@ #include "MeasureGUI_BndBoxDlg.h" #include "MeasureGUI_Widgets.h" +#include "GeometryGUI.h" + #include +#include #include #include @@ -86,6 +90,12 @@ MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( GeometryGUI* GUI, QWidget* parent ) myGrp->LineEdit22->setReadOnly( true ); myGrp->LineEdit31->setReadOnly( true ); myGrp->LineEdit32->setReadOnly( true ); + myGrp->LineEdit11->setMinimumWidth(120); + myGrp->LineEdit12->setMinimumWidth(120); + myGrp->LineEdit21->setMinimumWidth(120); + myGrp->LineEdit22->setMinimumWidth(120); + myGrp->LineEdit31->setMinimumWidth(120); + myGrp->LineEdit32->setMinimumWidth(120); myGrp->PushButton1->setIcon( image1 ); myGrp->LineEdit1->setReadOnly( true ); @@ -140,14 +150,17 @@ void MeasureGUI_BndBoxDlg::processObject() myGrp->LineEdit32->setText( "" ); } else { - myGrp->LineEdit11->setText( tr( "%1" ).arg( aXMin, 12, 'f', 6 ) ); - myGrp->LineEdit12->setText( tr( "%1" ).arg( aXMax, 12, 'f', 6 ) ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + + myGrp->LineEdit11->setText( DlgRef::PrintDoubleValue( aXMin, aPrecision ) ); + myGrp->LineEdit12->setText( DlgRef::PrintDoubleValue( aXMax, aPrecision ) ); - myGrp->LineEdit21->setText( tr( "%1" ).arg( aYMin, 12, 'f', 6 ) ); - myGrp->LineEdit22->setText( tr( "%1" ).arg( aYMax, 12, 'f', 6 ) ); + myGrp->LineEdit21->setText( DlgRef::PrintDoubleValue( aYMin, aPrecision ) ); + myGrp->LineEdit22->setText( DlgRef::PrintDoubleValue( aYMax, aPrecision ) ); - myGrp->LineEdit31->setText( tr( "%1" ).arg( aZMin, 12, 'f', 6 ) ); - myGrp->LineEdit32->setText( tr( "%1" ).arg( aZMax, 12, 'f', 6 ) ); + myGrp->LineEdit31->setText( DlgRef::PrintDoubleValue( aZMin, aPrecision ) ); + myGrp->LineEdit32->setText( DlgRef::PrintDoubleValue( aZMax, aPrecision ) ); } } @@ -162,72 +175,63 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax, if ( myObj->_is_nil() ) return false; else { + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { Handle(Poly_Triangulation) Trtn = 0; - Handle(GEOM_Object) anObject = GEOM_Engine::GetEngine()->GetObject(myObj->GetStudyID(), myObj->GetEntry()); - if (!anObject.IsNull()) - { - Handle(GEOM_Function) aRefShape = anObject->GetLastFunction(); - if (!aRefShape.IsNull()) - { - TopoDS_Shape aShape = aRefShape->GetValue(); - if (!aShape.IsNull()) - { - TopLoc_Location l; - Handle(Poly_Triangulation) T; - TopExp_Explorer ex; - for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) { - const TopoDS_Face& F = TopoDS::Face(ex.Current()); - - BRepAdaptor_Surface surf(F); - if (surf.GetType() == GeomAbs_Sphere) - { - T = BRep_Tool::Triangulation(F, l); - if (!T.IsNull()) { - Handle(Poly_Triangulation) NullTrtn = 0; - (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(NullTrtn); - Trtn = T; - break; - } - } - else - break; - } - } - } - } + GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen(); + if ( CORBA::is_nil(aGeomGen) ) + return false; + + QString IOR = GEOMBase::GetIORFromObject( myObj ); + GEOM::GEOM_Object_var anObject = aGeomGen->GetIORFromString( IOR.toLatin1().constData() ); + if ( CORBA::is_nil(anObject) ) + return false; - GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetBoundingBox( - myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax ); + TopoDS_Shape aShape; + GEOMBase::GetShape(anObject, aShape, TopAbs_SHAPE); + if ( aShape.IsNull() ) + return false; - if (!Trtn.IsNull()) - { - Handle(GEOM_Function) aRefShape = anObject->GetLastFunction(); - if (!aRefShape.IsNull()) - { - TopoDS_Shape aShape = aRefShape->GetValue(); - if (!aShape.IsNull()) - { - TopLoc_Location l; - Handle(Poly_Triangulation) T; - TopExp_Explorer ex; - for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) { - const TopoDS_Face& F = TopoDS::Face(ex.Current()); - (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(Trtn); - break; - } - } - } + TopLoc_Location l; + Handle(Poly_Triangulation) T; + TopExp_Explorer ex; + for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) { + const TopoDS_Face& F = TopoDS::Face(ex.Current()); + BRepAdaptor_Surface surf(F); + if (surf.GetType() == GeomAbs_Sphere) { + T = BRep_Tool::Triangulation(F, l); + if (!T.IsNull()) { + Handle(Poly_Triangulation) NullTrtn = 0; + (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(NullTrtn); + Trtn = T; + break; + } + } + else + break; } - + + anOper->GetBoundingBox( myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax ); + + if (!Trtn.IsNull()) { + TopLoc_Location l; + Handle(Poly_Triangulation) T; + TopExp_Explorer ex; + for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) { + const TopoDS_Face& F = TopoDS::Face(ex.Current()); + (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(Trtn); + break; + } + } + } catch( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } } diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h index 9d12e3de6..8fd3af034 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_BndBoxDlg.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -50,8 +51,8 @@ protected: private: void Init(); bool getParameters( double&, double&, - double&, double&, - double&, double& ); + double&, double&, + double&, double& ); private: MeasureGUI_1Sel6LineEdit* myGrp; diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index fe3a2c06f..84676e669 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_CenterMassDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -116,7 +117,7 @@ void MeasureGUI_CenterMassDlg::Init() connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_POINT") ); globalSelection(); @@ -169,18 +170,17 @@ void MeasureGUI_CenterMassDlg::SelectionIntoArgument() return; } - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (!testResult || aSelectedObject->_is_nil()) { + if ( aSelectedObject->_is_nil() ) { processObject(); return; } myObj = aSelectedObject; processObject(); - displayPreview(); + displayPreview(true); } //================================================================================= @@ -218,10 +218,10 @@ void MeasureGUI_CenterMassDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection(); - displayPreview(); + displayPreview(true); } //================================================================================= @@ -243,11 +243,14 @@ void MeasureGUI_CenterMassDlg::processObject() getParameters( x, y, z ); myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); - myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( x ) ); - myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( y ) ); - myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( z ) ); - displayPreview(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( x, aPrecision ) ); + myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( y, aPrecision ) ); + myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( z, aPrecision ) ); + + displayPreview(true); } } @@ -290,9 +293,9 @@ bool MeasureGUI_CenterMassDlg::getParameters( double& theX, double& theY, double return false; else { try { - GEOM::GEOM_Object_var anObj; - anObj = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetCentreOfMass( myObj ); - if ( !getOperation()->IsDone() ) + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj ); + if ( !anOper->IsDone() ) return false; TopoDS_Shape aShape; @@ -324,9 +327,8 @@ bool MeasureGUI_CenterMassDlg::getParameters( double& theX, double& theY, double //================================================================================= bool MeasureGUI_CenterMassDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; - - anObj = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetCentreOfMass( myObj ); + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h index 4de61e99a..d3100620e 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_CenterMassDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx index 90c6adf71..ac4272130 100644 --- a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx @@ -1,28 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_CheckCompoundOfBlocksDlg.cxx // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) // +#include "MeasureGUI.h" #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" #include "MeasureGUI_Widgets.h" @@ -123,8 +125,8 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::Init() connect( myGrp->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_BLOCKS_COMPOUND") ); buttonOk()->setEnabled( false ); @@ -175,11 +177,10 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument() return; } - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if ( !testResult || aSelectedObject->_is_nil() ) { + if ( aSelectedObject->_is_nil() ) { myGrp->LineEdit1->setText( "" ); processObject(); return; @@ -188,7 +189,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument() myObj = aSelectedObject; myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); processObject(); - displayPreview(); + DISPLAY_PREVIEW_MACRO; } //================================================================================= @@ -228,7 +229,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::ActivateThisDialog() connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); - displayPreview(); + DISPLAY_PREVIEW_MACRO } //================================================================================= @@ -236,23 +237,25 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::ActivateThisDialog() // purpose : //================================================================================= bool MeasureGUI_CheckCompoundOfBlocksDlg::getBCErrors( bool& theIsCompoundOfBlocks, - GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) + GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) { if ( myObj->_is_nil() ) return false; else { + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() ); try { GEOM::GEOM_IBlocksOperations::BCErrors_var aErrs; - theIsCompoundOfBlocks = - GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->CheckCompoundOfBlocks( myObj, aErrs ); - theErrors = aErrs; + theIsCompoundOfBlocks = anOper->CheckCompoundOfBlocks( myObj, aErrs ); + if (anOper->IsDone() && aErrs->length() > 0) + //if (anOper->IsDone() && !aErrs._is_nil()) + theErrors = aErrs; } catch ( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } } @@ -266,6 +269,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::processObject() bool isCompoundOfBlocks; GEOM::GEOM_IBlocksOperations::BCErrors aErrs; if ( !getBCErrors( isCompoundOfBlocks, aErrs ) ) { + aMsg += tr( "GEOM_CHECK_BLOCKS_COMPOUND_FAILED" ); myGrp->TextView1->setText( aMsg ); myGrp->ListBox1->clear(); myGrp->ListBox2->clear(); @@ -277,7 +281,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::processObject() aMsg += tr( "GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS" ); buttonOk()->setEnabled( false ); buttonApply()->setEnabled( false ); - } + } else { aMsg += tr( "GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS" ); buttonOk()->setEnabled( true ); @@ -295,29 +299,29 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::processObject() aErrStr = ""; switch ( aErrs[i].error ) { case GEOM::GEOM_IBlocksOperations::NOT_BLOCK : - aErrStr = "Not a Block"; + aErrStr = "Not a Block"; break; case GEOM::GEOM_IBlocksOperations::EXTRA_EDGE : - aErrStr = "Extra Edge"; + aErrStr = "Extra Edge"; break; case GEOM::GEOM_IBlocksOperations::INVALID_CONNECTION : - aErrStr = "Invalid Connection"; - aErrStr += aConSfx; - aErrStr += QString::number( aConNum ); - aConNum++; + aErrStr = "Invalid Connection"; + aErrStr += aConSfx; + aErrStr += QString::number( aConNum ); + aConNum++; break; case GEOM::GEOM_IBlocksOperations::NOT_CONNECTED : - aErrStr = "Not Connected"; + aErrStr = "Not Connected"; break; case GEOM::GEOM_IBlocksOperations::NOT_GLUED : - aErrStr = "Not Glued"; - aErrStr += aGluedSfx; - aErrStr += QString::number( aGluedNum ); - aGluedNum++; + aErrStr = "Not Glued"; + aErrStr += aGluedSfx; + aErrStr += QString::number( aGluedNum ); + aGluedNum++; break; default : - aErrStr = ""; - break; + aErrStr = ""; + break; } if ( !aErrStr.isEmpty() ) aErrList.append( aErrStr ); @@ -355,24 +359,19 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onErrorsListSelectionChanged() myGrp->ListBox2->clear(); return; } - + GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aCurItem]; GEOM::ListOfLong aObjLst = aErr.incriminated; - TopoDS_Shape aSelShape; - TopoDS_Shape aSubShape; - TopTools_IndexedMapOfShape anIndices; QStringList aSubShapeList; - QString aSubShapeName( "" ); - Standard_CString aTypeString; + TopoDS_Shape aSelShape; if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) { - TopExp::MapShapes( aSelShape, anIndices); + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes( aSelShape, anIndices ); for ( int i = 0, n = aObjLst.length(); i < n; i++ ) { - aSubShapeName = ""; - aSubShape = anIndices.FindKey(aObjLst[i]); - if ( GEOMBase::GetShapeTypeString( aSubShape, aTypeString ) ) - aSubShapeName = QString( aTypeString ) + QString( "_" ) + QString::number( aObjLst[i] ); - if ( !aSubShapeName.isEmpty() ) - aSubShapeList.append( aSubShapeName ); + TopoDS_Shape aSubShape = anIndices.FindKey( aObjLst[i] ); + QString aType = GEOMBase::GetShapeTypeString( aSubShape ); + if ( !aType.isEmpty() ) + aSubShapeList.append( QString( "%1_%2" ).arg( aType ).arg( aObjLst[i] ) ); } } myGrp->ListBox2->clear(); @@ -391,7 +390,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged() return; QList aIds; for ( int i = 0, n = myGrp->ListBox2->count(); i < n; i++ ) { - if ( myGrp->ListBox2->item( i )->isSelected() ) + if ( myGrp->ListBox2->item( i )->isSelected() ) aIds.append( i ); } if ( aIds.count() < 1 ) @@ -404,11 +403,11 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged() myGrp->ListBox2->clear(); return; } - + GEOM::GEOM_IBlocksOperations::BCError aErr = aErrs[aErrCurItem]; GEOM::ListOfLong aObjLst = aErr.incriminated; TopoDS_Shape aSelShape; - TopoDS_Shape aSubShape; + TopoDS_Shape aSubShape; TopTools_IndexedMapOfShape anIndices; if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) { QString aMess; @@ -420,13 +419,15 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged() QList::iterator it; for ( it = aIds.begin(); it != aIds.end(); ++it ) { aSubShape = anIndices.FindKey(aObjLst[(*it)]); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); try { getDisplayer()->SetColor( Quantity_NOC_RED ); - getDisplayer()->SetWidth( 3 ); + getDisplayer()->SetWidth( w ); getDisplayer()->SetToActivate( false ); aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs( aSubShape ) : 0; if ( aPrs ) - displayPreview( aPrs, true ); + displayPreview( aPrs, true ); } catch ( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); @@ -472,9 +473,8 @@ bool MeasureGUI_CheckCompoundOfBlocksDlg::isValid( QString& ) //================================================================================= bool MeasureGUI_CheckCompoundOfBlocksDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; - - anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->CheckAndImprove( myObj ); + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->CheckAndImprove( myObj ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h index 4de051f6e..ddbde0949 100644 --- a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h +++ b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_CheckCompoundOfBlocksDlg.h // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) @@ -65,7 +66,7 @@ private: void Init(); void enterEvent( QEvent* ); bool getBCErrors( bool&, - GEOM::GEOM_IBlocksOperations::BCErrors& ); + GEOM::GEOM_IBlocksOperations::BCErrors& ); void activateSelection(); private: diff --git a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx new file mode 100644 index 000000000..df12686dd --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx @@ -0,0 +1,250 @@ +// Copyright (C) 2007-2012 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 : MeasureGUI_CheckSelfIntersectionsDlg.cxx +// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) + +#include "MeasureGUI_CheckSelfIntersectionsDlg.h" +#include "MeasureGUI_Widgets.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#define TEXTEDIT_FONT_FAMILY "Courier" +#define TEXTEDIT_FONT_SIZE 11 + +//================================================================================= +// class : MeasureGUI_CheckSelfIntersectionsDlg() +// purpose : Constructs a MeasureGUI_CheckSelfIntersectionsDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// true to construct a modal dialog. +//================================================================================= +MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (GeometryGUI* GUI, QWidget* parent) + : MeasureGUI_Skeleton(GUI, parent, false) +{ + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHECK_SELF_INTERSECTIONS"))); + QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS")); + mainFrame()->RadioButton1->setIcon(image0); + + myGrp = new MeasureGUI_1Sel1TextView2ListBox (centralWidget()); + myGrp->GroupBox1->setTitle(tr("GEOM_CHECK_INFOS")); + myGrp->TextLabel1->setText(tr("GEOM_OBJECT")); + + myGrp->TextView1->setReadOnly(true); + QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE); + aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias); + myGrp->TextView1->setFont(aFont); + + myGrp->PushButton1->setIcon(image1); + myGrp->LineEdit1->setReadOnly(true); + + myGrp->TextLabel2->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_ERRORS")); + myGrp->TextLabel3->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES")); + + myGrp->ListBox2->setSelectionMode(QAbstractItemView::ExtendedSelection); + + QVBoxLayout* layout = new QVBoxLayout (centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(myGrp); + + /***************************************************************/ + + myHelpFileName = "using_measurement_tools_page.html#check_self_intersections_anchor"; + + /* Initialisation */ + Init(); +} + +//================================================================================= +// function : ~MeasureGUI_CheckSelfIntersectionsDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_CheckSelfIntersectionsDlg::~MeasureGUI_CheckSelfIntersectionsDlg() +{ +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::Init() +{ + mySelBtn = myGrp->PushButton1; + mySelEdit = myGrp->LineEdit1; + MeasureGUI_Skeleton::Init(); + + connect(myGrp->ListBox1, SIGNAL(itemSelectionChanged()), SLOT(onErrorsListSelectionChanged())); + connect(myGrp->ListBox2, SIGNAL(itemSelectionChanged()), SLOT(onSubShapesListSelectionChanged())); +} + +//================================================================================= +// function : processObject +// purpose : +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::processObject() +{ + myGrp->ListBox1->clear(); + myGrp->ListBox2->clear(); + erasePreview(); + + if (myObj->_is_nil()) + return; + + QString aMsg (""); + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation()); + bool isGood = false, isFailed = false; + int nbPairs = 0; + try { + isGood = anOper->CheckSelfIntersections(myObj, myInters); + nbPairs = myInters->length()/2; + if (nbPairs*2 != myInters->length()) { + isFailed = true; + } + } + catch (const SALOME::SALOME_Exception& e) { + SalomeApp_Tools::QtCatchCorbaException(e); + isFailed = true; + } + if (isFailed) { + aMsg += tr("GEOM_CHECK_SELF_INTERSECTIONS_FAILED"); + myGrp->TextView1->setText(aMsg); + return; + } + + // Status + if (isGood) { + aMsg += tr("GEOM_NO_SELF_INTERSECTIONS"); + } + else { + aMsg += tr("GEOM_SELF_INTERSECTIONS_FOUND"); + } + myGrp->TextView1->setText(aMsg); + + // Pairs + QStringList aErrList; + QString aErrStr (""); + for (int i = 1; i <= nbPairs; i++) { + aErrStr = "Intersection # "; + aErrStr += QString::number(i); + aErrList.append(aErrStr); + } + + myGrp->ListBox1->addItems(aErrList); +} + +//================================================================================= +// function : onErrorsListSelectionChanged +// purpose : +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::onErrorsListSelectionChanged() +{ + erasePreview(); + int aCurItem = myGrp->ListBox1->currentRow(); + if (aCurItem < 0) + return; + + //int nbPairs = myInters->length()/2; + + QStringList aSubShapeList; + TopoDS_Shape aSelShape; + if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aSelShape, anIndices); + + TopoDS_Shape aSubShape = anIndices.FindKey(myInters[aCurItem*2]); + QString aType = GEOMBase::GetShapeTypeString(aSubShape); + if (!aType.isEmpty()) + aSubShapeList.append(QString("%1_%2").arg(aType).arg(myInters[aCurItem*2])); + aSubShape = anIndices.FindKey(myInters[aCurItem*2 + 1]); + aType = GEOMBase::GetShapeTypeString(aSubShape); + if (!aType.isEmpty()) + aSubShapeList.append(QString("%1_%2").arg(aType).arg(myInters[aCurItem*2 + 1])); + } + myGrp->ListBox2->clear(); + myGrp->ListBox2->addItems(aSubShapeList); +} + +//================================================================================= +// function : onSubShapesListSelectionChanged +// purpose : +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::onSubShapesListSelectionChanged() +{ + erasePreview(); + + // Current pair + int aErrCurItem = myGrp->ListBox1->currentRow(); + if (aErrCurItem < 0) + return; + + // Selected IDs + QList aIds; + for (int i = 0, n = myGrp->ListBox2->count(); i < n; i++) { + if (myGrp->ListBox2->item(i)->isSelected()) + aIds.append(i); + } + if (aIds.count() < 1) + return; + + TopoDS_Shape aSelShape; + TopoDS_Shape aSubShape; + TopTools_IndexedMapOfShape anIndices; + if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) { + SALOME_Prs* aPrs = 0; + TopExp::MapShapes(aSelShape, anIndices); + QList::iterator it; + for (it = aIds.begin(); it != aIds.end(); ++it) { + aSubShape = anIndices.FindKey(myInters[aErrCurItem*2 + (*it)]); + try { + getDisplayer()->SetColor(Quantity_NOC_RED); + getDisplayer()->SetWidth(3); + getDisplayer()->SetToActivate(false); + aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0; + if (aPrs) + displayPreview(aPrs, true); + } + catch (const SALOME::SALOME_Exception& e) { + SalomeApp_Tools::QtCatchCorbaException(e); + } + } + } +} diff --git a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h new file mode 100644 index 000000000..8671706b3 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h @@ -0,0 +1,63 @@ +// Copyright (C) 2007-2012 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 : MeasureGUI_CheckSelfIntersectionsDlg.h + +#ifndef MEASUREGUI_CHECKSELFINTERDLG_H +#define MEASUREGUI_CHECKSELFINTERDLG_H + +#include + +class MeasureGUI_1Sel1TextView2ListBox; + +//================================================================================= +// class : MeasureGUI_CheckSelfIntersectionsDlg +// purpose : +//================================================================================= + +class MeasureGUI_CheckSelfIntersectionsDlg : public MeasureGUI_Skeleton +{ + Q_OBJECT + +public: + MeasureGUI_CheckSelfIntersectionsDlg(GeometryGUI*, QWidget*); + ~MeasureGUI_CheckSelfIntersectionsDlg(); + +protected: + // redefined from GEOMBase_Helper and MeasureGUI_Skeleton + virtual void processObject(); + +private slots: + void onErrorsListSelectionChanged(); + void onSubShapesListSelectionChanged(); + +private: + void Init(); + +private: + MeasureGUI_1Sel1TextView2ListBox* myGrp; + + GEOM::ListOfLong_var myInters; +}; + +#endif // MEASUREGUI_CHECKSELFINTERDLG_H diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx index 9fd3c2228..7cd562cd7 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_CheckShapeDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -98,7 +99,7 @@ void MeasureGUI_CheckShapeDlg::Init() MeasureGUI_Skeleton::Init(); connect( myGrp->CheckBox1, SIGNAL( toggled( bool) ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); } //================================================================================= @@ -110,15 +111,14 @@ bool MeasureGUI_CheckShapeDlg::getParameters ( bool& theIsValid, QString& theMsg if ( myObj->_is_nil() ) return false; else { + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { char* aMsg; bool isCheckGeometry = myGrp->CheckBox1->isChecked(); - GEOM::GEOM_IMeasureOperations_ptr aMeasureOp = - GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); if ( isCheckGeometry ) - theIsValid = aMeasureOp->CheckShapeWithGeometry( myObj, aMsg ); + theIsValid = anOper->CheckShapeWithGeometry( myObj, aMsg ); else - theIsValid = aMeasureOp->CheckShape( myObj, aMsg ); + theIsValid = anOper->CheckShape( myObj, aMsg ); theMsg = aMsg; } catch( const SALOME::SALOME_Exception& e ) { @@ -126,7 +126,7 @@ bool MeasureGUI_CheckShapeDlg::getParameters ( bool& theIsValid, QString& theMsg return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } } diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h index 5a1619bd2..ebb8ccc70 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_CheckShapeDlg.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index a684ce804..ffd630a9a 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_DistanceDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -44,6 +45,9 @@ // OCCT Includes #include #include +#include +#include +#include #include #include #include @@ -141,10 +145,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); if (aSelList.Extent() > 0) { - Standard_Boolean testResult = Standard_False; - aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult) - aSelectedObject = GEOM::GEOM_Object::_nil(); + aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); } // clear selection @@ -179,12 +180,15 @@ void MeasureGUI_DistanceDlg::processObject() gp_Pnt aPnt1, aPnt2; double aDist = 0.; if (getParameters(aDist, aPnt1, aPnt2)) { - myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist)); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + + myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist, aPrecision)); gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ(); - myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X())); - myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y())); - myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z())); + myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X(), aPrecision)); + myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y(), aPrecision)); + myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z(), aPrecision)); redisplayPreview(); } @@ -207,10 +211,11 @@ bool MeasureGUI_DistanceDlg::getParameters (double& theDistance, { QString msg; if (isValid(msg)) { + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); + try { double x1, y1, z1, x2, y2, z2; - theDistance = GEOM::GEOM_IMeasureOperations::_narrow(getOperation())-> - GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2); + theDistance = anOper->GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2); thePnt1.SetCoord(x1, y1, z1); thePnt2.SetCoord(x2, y2, z2); @@ -220,7 +225,7 @@ bool MeasureGUI_DistanceDlg::getParameters (double& theDistance, return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } return false; @@ -325,6 +330,12 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension( aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData())); anIO->SetArrowSize(aDist/20); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int w = resMgr->integerValue("Geometry", "measures_line_width", 1); + Handle(Prs3d_LengthAspect) asp = new Prs3d_LengthAspect(); + asp->LineAspect()->SetWidth(w); + anIO->Attributes()->SetLengthAspect(asp); SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.h b/src/MeasureGUI/MeasureGUI_DistanceDlg.h index 08f00cdbc..2c4e9c56d 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.h +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_DistanceDlg.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -56,8 +57,8 @@ protected: private: void Init(); bool getParameters( double&, - gp_Pnt&, - gp_Pnt& ); + gp_Pnt&, + gp_Pnt& ); private: QLineEdit* myEditCurrentArgument; QLineEdit* mySelEdit2; diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index 2ff5495be..389345dd9 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_InertiaDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -27,6 +28,7 @@ #include "MeasureGUI_Widgets.h" #include +#include #include @@ -141,21 +143,21 @@ void MeasureGUI_InertiaDlg::processObject() myGrp->LineEdit43->setText( "" ); } else { - myGrp->LineEdit11->setText( QString( "%1" ).arg( aMat( 1, 1 ), 12, 'e', 4 ) ); - myGrp->LineEdit12->setText( QString( "%1" ).arg( aMat( 1, 2 ), 12, 'e', 4 ) ); - myGrp->LineEdit13->setText( QString( "%1" ).arg( aMat( 1, 3 ), 12, 'e', 4 ) ); + myGrp->LineEdit11->setText( DlgRef::PrintDoubleValue( aMat( 1, 1 ), -6 ) ); + myGrp->LineEdit12->setText( DlgRef::PrintDoubleValue( aMat( 1, 2 ), -6 ) ); + myGrp->LineEdit13->setText( DlgRef::PrintDoubleValue( aMat( 1, 3 ), -6 ) ); - myGrp->LineEdit21->setText( QString( "%1" ).arg( aMat( 2, 1 ), 12, 'e', 4 ) ); - myGrp->LineEdit22->setText( QString( "%1" ).arg( aMat( 2, 2 ), 12, 'e', 4 ) ); - myGrp->LineEdit23->setText( QString( "%1" ).arg( aMat( 2, 3 ), 12, 'e', 4 ) ); + myGrp->LineEdit21->setText( DlgRef::PrintDoubleValue( aMat( 2, 1 ), -6 ) ); + myGrp->LineEdit22->setText( DlgRef::PrintDoubleValue( aMat( 2, 2 ), -6 ) ); + myGrp->LineEdit23->setText( DlgRef::PrintDoubleValue( aMat( 2, 3 ), -6 ) ); - myGrp->LineEdit31->setText( QString( "%1" ).arg( aMat( 3, 1 ), 12, 'e', 4 ) ); - myGrp->LineEdit32->setText( QString( "%1" ).arg( aMat( 3, 2 ), 12, 'e', 4 ) ); - myGrp->LineEdit33->setText( QString( "%1" ).arg( aMat( 3, 3 ), 12, 'e', 4 ) ); + myGrp->LineEdit31->setText( DlgRef::PrintDoubleValue( aMat( 3, 1 ), -6 ) ); + myGrp->LineEdit32->setText( DlgRef::PrintDoubleValue( aMat( 3, 2 ), -6 ) ); + myGrp->LineEdit33->setText( DlgRef::PrintDoubleValue( aMat( 3, 3 ), -6 ) ); - myGrp->LineEdit41->setText( QString( "%1" ).arg( anIXYZ.X(), 12, 'e', 4 ) ); - myGrp->LineEdit42->setText( QString( "%1" ).arg( anIXYZ.Y(), 12, 'e', 4 ) ); - myGrp->LineEdit43->setText( QString( "%1" ).arg( anIXYZ.Z(), 12, 'e', 4 ) ); + myGrp->LineEdit41->setText( DlgRef::PrintDoubleValue( anIXYZ.X(), -6 ) ); + myGrp->LineEdit42->setText( DlgRef::PrintDoubleValue( anIXYZ.Y(), -6 ) ); + myGrp->LineEdit43->setText( DlgRef::PrintDoubleValue( anIXYZ.Z(), -6 ) ); } } @@ -169,13 +171,14 @@ bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I, if ( myObj->_is_nil() ) return false; else { + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { double x, y, z; - GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetInertia( myObj, - I( 1, 1 ), I( 1, 2 ), I( 1, 3 ), - I( 2, 1 ), I( 2, 2 ), I( 2, 3 ), - I( 3, 1 ), I( 3, 2 ), I( 3, 3 ), - x, y, z ); + anOper->GetInertia( myObj, + I( 1, 1 ), I( 1, 2 ), I( 1, 3 ), + I( 2, 1 ), I( 2, 2 ), I( 2, 3 ), + I( 3, 1 ), I( 3, 2 ), I( 3, 3 ), + x, y, z ); theIXYZ.SetCoord( x, y, z ); } @@ -184,6 +187,6 @@ bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I, return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } } diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.h b/src/MeasureGUI/MeasureGUI_InertiaDlg.h index 1187fa569..6e57605ab 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.h +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_InertiaDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index 59630ab7d..a886d9a84 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -1,30 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_MaxToleranceDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. // #include "MeasureGUI_MaxToleranceDlg.h" #include "MeasureGUI_Widgets.h" +#include "DlgRef.h" #include #include @@ -130,14 +132,17 @@ void MeasureGUI_MaxToleranceDlg::processObject() double invalidMin = RealLast(); double invalidMax = -RealLast(); - myGrp->LineEdit11->setText( aMinFaceToler != invalidMin ? QString( "%1" ).arg( aMinFaceToler, 5, 'e', 8 ) : QString("") ); - myGrp->LineEdit12->setText( aMaxFaceToler != invalidMax ? QString( "%1" ).arg( aMaxFaceToler, 5, 'e', 8 ) : QString("") ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "len_tol_precision", -9); + + myGrp->LineEdit11->setText( aMinFaceToler != invalidMin ? DlgRef::PrintDoubleValue( aMinFaceToler, aPrecision ) : QString("") ); + myGrp->LineEdit12->setText( aMaxFaceToler != invalidMax ? DlgRef::PrintDoubleValue( aMaxFaceToler, aPrecision ) : QString("") ); - myGrp->LineEdit21->setText( aMinEdgeToler != invalidMin ? QString( "%1" ).arg( aMinEdgeToler, 5, 'e', 8 ) : QString("") ); - myGrp->LineEdit22->setText( aMaxEdgeToler != invalidMax ? QString( "%1" ).arg( aMaxEdgeToler, 5, 'e', 8 ) : QString("") ); + myGrp->LineEdit21->setText( aMinEdgeToler != invalidMin ? DlgRef::PrintDoubleValue( aMinEdgeToler, aPrecision ) : QString("") ); + myGrp->LineEdit22->setText( aMaxEdgeToler != invalidMax ? DlgRef::PrintDoubleValue( aMaxEdgeToler, aPrecision ) : QString("") ); - myGrp->LineEdit31->setText( aMinVertexToler != invalidMin ? QString( "%1" ).arg( aMinVertexToler, 5, 'e', 8 ) : QString("") ); - myGrp->LineEdit32->setText( aMaxVertexToler != invalidMax ? QString( "%1" ).arg( aMaxVertexToler, 5, 'e', 8 ) : QString("") ); + myGrp->LineEdit31->setText( aMinVertexToler != invalidMin ? DlgRef::PrintDoubleValue( aMinVertexToler, aPrecision ) : QString("") ); + myGrp->LineEdit32->setText( aMaxVertexToler != invalidMax ? DlgRef::PrintDoubleValue( aMaxVertexToler, aPrecision ) : QString("") ); } //================================================================================= @@ -156,16 +161,17 @@ bool MeasureGUI_MaxToleranceDlg::getParameters( double& theMinFaceToler, if ( myObj->_is_nil() ) return false; else { + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { - GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetTolerance( myObj, - theMinFaceToler, theMaxFaceToler, theMinEdgeToler, - theMaxEdgeToler, theMinVertexToler, theMaxVertexToler ); + anOper->GetTolerance( myObj, + theMinFaceToler, theMaxFaceToler, theMinEdgeToler, + theMaxEdgeToler, theMinVertexToler, theMaxVertexToler ); } catch( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } } diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h index 65ed53617..52f764d6e 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_MaxToleranceDlg.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -49,7 +50,7 @@ protected: private: void Init(); bool getParameters( double&, double&, double&, - double&, double&, double& ); + double&, double&, double& ); private: MeasureGUI_1Sel6LineEdit* myGrp; diff --git a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx index b5207d790..6484ad1f2 100644 --- a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx @@ -1,28 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_NormaleDlg.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // +#include "MeasureGUI.h" #include "MeasureGUI_NormaleDlg.h" #include @@ -173,11 +172,10 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument() return; // nbSel == 1 - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (!testResult || CORBA::is_nil(aSelectedObject)) + if ( CORBA::is_nil(aSelectedObject) ) return; QString aName = GEOMBase::GetName(aSelectedObject); @@ -249,7 +247,7 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument() GroupArgs->PushButton1->click(); } - displayPreview(); + DISPLAY_PREVIEW_MACRO } //================================================================================= @@ -289,7 +287,7 @@ void MeasureGUI_NormaleDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); + DISPLAY_PREVIEW_MACRO } //================================================================================= @@ -314,9 +312,9 @@ void MeasureGUI_NormaleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); - displayPreview(); + DISPLAY_PREVIEW_MACRO } //================================================================================= @@ -354,8 +352,8 @@ bool MeasureGUI_NormaleDlg::isValid (QString&) //================================================================================= bool MeasureGUI_NormaleDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj = - GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->GetNormal(myFace, myPoint); + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->GetNormal(myFace, myPoint); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); diff --git a/src/MeasureGUI/MeasureGUI_NormaleDlg.h b/src/MeasureGUI/MeasureGUI_NormaleDlg.h index 60eef7b17..faf262bb7 100644 --- a/src/MeasureGUI/MeasureGUI_NormaleDlg.h +++ b/src/MeasureGUI/MeasureGUI_NormaleDlg.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_NormaleDlg.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.cxx b/src/MeasureGUI/MeasureGUI_PointDlg.cxx index bba75ea59..d68c20512 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PointDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_PointDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -134,11 +135,10 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() if (aSelList.Extent() < 1) return; - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (!testResult || aSelectedObject->_is_nil()) + if ( aSelectedObject->_is_nil() ) return; myObj = aSelectedObject; @@ -171,9 +171,11 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() if ( !aPoint.IsNull() ) { gp_Pnt aPnt = BRep_Tool::Pnt( aPoint ); myGrp->LineEdit1->setText( aName ); - myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aPnt.X() ) ); - myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( aPnt.Y() ) ); - myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aPnt.Z() ) ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aPnt.X(), aPrecision ) ); + myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( aPnt.Y(), aPrecision ) ); + myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aPnt.Z(), aPrecision ) ); } } catch( ... ) diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.h b/src/MeasureGUI/MeasureGUI_PointDlg.h index 09989c456..8e43c0292 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.h +++ b/src/MeasureGUI/MeasureGUI_PointDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_PointDlg.h // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index 7f45b5a80..426be51d1 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_PropertiesDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -138,9 +139,11 @@ void MeasureGUI_PropertiesDlg::processObject() myGrp->LineEdit4->setText( "" ); } else { - myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aLength ) ); - myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( anArea ) ); - myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aVolume ) ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aLength, aPrecision ) ); + myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( anArea, aPrecision ) ); + myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aVolume, aPrecision ) ); } } @@ -155,16 +158,16 @@ bool MeasureGUI_PropertiesDlg::getParameters( double& theLength, if ( myObj->_is_nil() ) return false; else { + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { - GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetBasicProperties( - myObj, theLength, theArea, theVolume ); + anOper->GetBasicProperties( myObj, theLength, theArea, theVolume ); } catch( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } } @@ -174,16 +177,13 @@ bool MeasureGUI_PropertiesDlg::getParameters( double& theLength, //================================================================================= SALOME_Prs* MeasureGUI_PropertiesDlg::buildPrs() { - TopoDS_Shape aShape, aResult; - - if ( myObj->_is_nil() || - !GEOMBase::GetShape( myObj, aShape ) || - aShape.IsNull() || - aShape.ShapeType() != TopAbs_EDGE || - !GEOMBase::CreateArrowForLinearEdge( aShape, aResult ) || - aResult.IsNull() ) - return 0; - - return getDisplayer()->BuildPrs( aResult ); + SALOME_Prs* prs = 0; + TopoDS_Shape shape; + if ( GEOMBase::GetShape( myObj, shape, TopAbs_EDGE ) ) { + shape = GEOMBase::CreateArrowForLinearEdge( shape ); + if ( !shape.IsNull() ) + prs = getDisplayer()->BuildPrs( shape ); + } + return prs; } diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h index 20eaac748..c8e37fd78 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_PropertiesDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -52,8 +53,8 @@ protected: private: void Init(); bool getParameters( double&, - double&, - double& ); + double&, + double& ); private: MeasureGUI_1Sel3LineEdit* myGrp; diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx index 96cb3b82a..83ca1072c 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_Skeleton.cxx // Author : Damine COQUERET, Open CASCADE S.A.S. @@ -49,7 +50,7 @@ // TRUE to construct a modal dialog. //================================================================================= MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI* GUI, QWidget* parent, - bool modal, Qt::WindowFlags f ) + bool modal, Qt::WindowFlags f ) : QDialog( parent, f ), GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( GUI ) @@ -96,33 +97,33 @@ void MeasureGUI_Skeleton::Init() /* signals and slots connections */ connect( buttonClose(), SIGNAL( clicked() ), - this, SLOT( ClickOnCancel() ) ); + this, SLOT( ClickOnCancel() ) ); connect( buttonHelp(), SIGNAL( clicked() ), - this, SLOT( ClickOnHelp() ) ); + this, SLOT( ClickOnHelp() ) ); if ( myGeomGUI ) { connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), - this, SLOT ( DeactivateActiveDialog() ) ); + this, SLOT ( DeactivateActiveDialog() ) ); connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), - this, SLOT ( ClickOnCancel() ) ); + this, SLOT ( ClickOnCancel() ) ); } if ( mySelEdit ) { connect( mySelEdit, SIGNAL( returnPressed() ), - this, SLOT( LineEditReturnPressed() ) ); + this, SLOT( LineEditReturnPressed() ) ); } if ( mySelBtn ) { connect( mySelBtn, SIGNAL( clicked() ), - this, SLOT ( SetEditCurrentArgument() ) ); + this, SLOT ( SetEditCurrentArgument() ) ); } LightApp_SelectionMgr* aSel = ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(); if ( aSel ) { connect( aSel, SIGNAL( currentSelectionChanged() ), - this, SLOT ( SelectionIntoArgument() ) ) ; + this, SLOT ( SelectionIntoArgument() ) ) ; } /* displays Dialog */ @@ -160,8 +161,8 @@ void MeasureGUI_Skeleton::ClickOnHelp() platform = "application"; #endif SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), - tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ) ); + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ) ); } } @@ -222,7 +223,7 @@ void MeasureGUI_Skeleton::ActivateThisDialog() LightApp_SelectionMgr* aSel = ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(); if ( aSel ) connect( aSel, SIGNAL( currentSelectionChanged() ), - this, SLOT ( SelectionIntoArgument() ) ) ; + this, SLOT ( SelectionIntoArgument() ) ) ; redisplayPreview(); activateSelection(); @@ -253,10 +254,7 @@ void MeasureGUI_Skeleton::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); if (aSelList.Extent() > 0) { - Standard_Boolean testResult = Standard_False; - aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult) - aSelectedObject = GEOM::GEOM_Object::_nil(); + aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); } if (aSelectedObject->_is_nil()) { diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.h b/src/MeasureGUI/MeasureGUI_Skeleton.h index 01633884f..737732bbd 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.h +++ b/src/MeasureGUI/MeasureGUI_Skeleton.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_Skeleton.h // Author : Damine COQUERET, Open CASCADE S.A.S. diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 202b3faf3..7c528b4b9 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_WhatisDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -208,9 +209,10 @@ bool MeasureGUI_WhatisDlg::getParameters( QString& theText ) if ( myObj->_is_nil() ) return false; + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { - theText = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->WhatIs( myObj ); + theText = anOper->WhatIs( myObj ); } catch( const SALOME::SALOME_Exception& e ) { @@ -218,7 +220,7 @@ bool MeasureGUI_WhatisDlg::getParameters( QString& theText ) return false; } - return getOperation()->IsDone(); + return anOper->IsDone(); } //================================================================================= @@ -230,6 +232,9 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) QString aKindStr(""); theParameters = ""; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aLenPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + if ( myObj->_is_nil() ) return aKindStr; @@ -237,21 +242,21 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) GEOM::ListOfLong_var anInts; GEOM::ListOfDouble_var aDbls; - GEOM::GEOM_IMeasureOperations_var anOp = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); + GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); try { - aKind = anOp->KindOfShape( myObj, anInts, aDbls ); + aKind = anOper->KindOfShape( myObj, anInts, aDbls ); } catch( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); return aKindStr; } - if ( !anOp->IsDone() ) + if ( !anOper->IsDone() ) return aKindStr; -#define PRINT_DOUBLE(val) QString(" %1").arg( DlgRef::PrintDoubleValue( val ) ) +#define PRINT_DOUBLE(val, tol) DlgRef::PrintDoubleValue( val, tol ) switch ( aKind ) { case GEOM::GEOM_IKindOfShape::COMPOUND: @@ -282,84 +287,84 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) case GEOM::GEOM_IKindOfShape::SPHERE: aKindStr = tr( "GEOM_SPHERE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3] ); + "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CYLINDER: aKindStr = tr( "GEOM_CYLINDER" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7] ); + "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::BOX: aKindStr = tr( "GEOM_BOX" ); theParameters = tr( "GEOM_CENTER") + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + "Ax :" + PRINT_DOUBLE( aDbls[3] ) + - "\n" + "Ay :" + PRINT_DOUBLE( aDbls[4] ) + - "\n" + "Az :" + PRINT_DOUBLE( aDbls[5] ); + "\n" + "Ax :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + "Ay :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + "Az :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ROTATED_BOX: aKindStr = tr( "GEOM_BOX" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\nZ Axis:" + - "\n" + "Zx :" + PRINT_DOUBLE( aDbls[3] ) + - "\n" + "Zy :" + PRINT_DOUBLE( aDbls[4] ) + - "\n" + "Zz :" + PRINT_DOUBLE( aDbls[5] ) + + "\n" + "Zx :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + "Zy :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + "Zz :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\nX Axis:" + - "\n" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7] ) + - "\n" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8] ) + + "\n" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "\n" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + "\nDimensions along local axes:" + - "\n" + "Ax :" + PRINT_DOUBLE( aDbls[9] ) + - "\n" + "Ay :" + PRINT_DOUBLE( aDbls[10] ) + - "\n" + "Az :" + PRINT_DOUBLE( aDbls[11] ); + "\n" + "Ax :" + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + + "\n" + "Ay :" + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + + "\n" + "Az :" + PRINT_DOUBLE( aDbls[11], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::TORUS: aKindStr = tr( "GEOM_TORUS" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] ); + "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CONE: aKindStr = tr( "GEOM_CONE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8] ); + "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::POLYHEDRON: aKindStr = tr( "GEOM_POLYHEDRON" ); @@ -371,114 +376,114 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) case GEOM::GEOM_IKindOfShape::SPHERE2D: aKindStr = tr( "GEOM_SURFSPHERE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3] ); + "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CYLINDER2D: aKindStr = tr( "GEOM_SURFCYLINDER" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7] ); + "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::TORUS2D: aKindStr = tr( "GEOM_SURFTORUS" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] ); + "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CONE2D: aKindStr = tr( "GEOM_SURFCONE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8] ); + "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::DISK_CIRCLE: aKindStr = tr( "GEOM_DISK_CIRCLE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ); + "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::DISK_ELLIPSE: aKindStr = tr( "GEOM_DISK_ELLIPSE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7] ); + "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::POLYGON: aKindStr = tr( "GEOM_POLYGON" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ); + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::PLANE: aKindStr = tr( "GEOM_PLANE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ); + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::PLANAR: aKindStr = tr( "GEOM_PLANAR_FACE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ); + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::FACE: aKindStr = tr( "GEOM_FACE" ); @@ -487,94 +492,94 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) case GEOM::GEOM_IKindOfShape::CIRCLE: aKindStr = tr( "GEOM_CIRCLE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ); + "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ARC_CIRCLE: aKindStr = tr( "GEOM_ARC" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ) + + "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + "\n" + tr( "GEOM_POINT_I" ).arg( 1 ) + - "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9] ) + + "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) + - "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12] ); + "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ELLIPSE: aKindStr = tr( "GEOM_ELLIPSE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7] ); + "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE: aKindStr = tr( "GEOM_ARC_ELLIPSE" ); theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) + + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6] ) + - "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7] ) + + "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + "\n" + tr( "GEOM_POINT_I" ).arg( 1 ) + - "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10] ) + + "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) + - "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13] ); + "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::LINE: aKindStr = tr( "GEOM_LINE" ); theParameters = tr( "GEOM_POSITION" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_DIRECTION" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ); + "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::SEGMENT: aKindStr = tr( "GEOM_SEGMENT" ); theParameters = tr( "GEOM_POINT_I" ).arg( 1 ) + - "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2] ) + + "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) + - "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3] ) + - "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4] ) + - "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5] ); + "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::EDGE: aKindStr = tr( "GEOM_EDGE" ); @@ -582,10 +587,18 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) case GEOM::GEOM_IKindOfShape::VERTEX: aKindStr = tr( "GEOM_VERTEX" ); theParameters = tr( "GEOM_COORDINATES" ) + - "\n" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0] ) + - "\n" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1] ) + - "\n" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2] ); + "\n" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "\n" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "\n" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ); break; + case GEOM::GEOM_IKindOfShape::ADVANCED: + { + QString strid = QString( "GEOM_ADVANCED_%1" ).arg( myObj->GetType() ); + aKindStr = tr( strid.toLatin1().constData() ) == strid ? + tr( "GEOM_ADVANCED" ).arg( myObj->GetType() ) : + tr( strid.toLatin1().constData() ); + break; + } default: break; } diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.h b/src/MeasureGUI/MeasureGUI_WhatisDlg.h index 432cdd82d..c5e31ccbd 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.h +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : MeasureGUI_WhatisDlg.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. diff --git a/src/MeasureGUI/MeasureGUI_Widgets.cxx b/src/MeasureGUI/MeasureGUI_Widgets.cxx index bac7f4a28..5cb2936fd 100644 --- a/src/MeasureGUI/MeasureGUI_Widgets.cxx +++ b/src/MeasureGUI/MeasureGUI_Widgets.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : MeasureGUI_Widgets.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // @@ -42,7 +40,7 @@ MeasureGUI_1Sel12LineEdit::~MeasureGUI_1Sel12LineEdit() ////////////////////////////////////////// MeasureGUI_1Sel1TextView1Check::MeasureGUI_1Sel1TextView1Check( QWidget* parent, - Qt::WindowFlags f ) + Qt::WindowFlags f ) : QWidget( parent, f ) { setupUi( this ); @@ -57,7 +55,7 @@ MeasureGUI_1Sel1TextView1Check::~MeasureGUI_1Sel1TextView1Check() ////////////////////////////////////////// MeasureGUI_1Sel1TextView2ListBox::MeasureGUI_1Sel1TextView2ListBox( QWidget* parent, - Qt::WindowFlags f ) + Qt::WindowFlags f ) : QWidget( parent, f ) { setupUi( this ); diff --git a/src/MeasureGUI/MeasureGUI_Widgets.h b/src/MeasureGUI/MeasureGUI_Widgets.h index 8ef4837a2..17067d067 100644 --- a/src/MeasureGUI/MeasureGUI_Widgets.h +++ b/src/MeasureGUI/MeasureGUI_Widgets.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : MeasureGUI_Widgets.h // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // diff --git a/src/NMTAlgo/Makefile.am b/src/NMTAlgo/Makefile.am deleted file mode 100644 index 407b7510b..000000000 --- a/src/NMTAlgo/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2007-2008 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 NMTAlgo : partition algorithm -# File : Makefile.in -# Author : Julia DOROVSKIKH -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : GEOM -# $Header$ -# -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -# header files -salomeinclude_HEADERS = \ - NMTAlgo_Splitter1.hxx \ - NMTAlgo_Splitter1.ixx \ - NMTAlgo_Splitter1.jxx \ - NMTAlgo_Splitter.hxx \ - NMTAlgo_Splitter.ixx \ - NMTAlgo_Splitter.jxx \ - NMTAlgo_Builder.hxx \ - NMTAlgo_Builder.ixx \ - NMTAlgo_Builder.jxx \ - NMTAlgo_Algo.hxx \ - NMTAlgo_Algo.ixx \ - NMTAlgo_Algo.jxx \ - NMTAlgo_Loop3d.hxx \ - NMTAlgo_Loop3d.ixx \ - NMTAlgo_Loop3d.jxx \ - NMTAlgo_Tools.hxx \ - NMTAlgo_Tools.ixx \ - NMTAlgo_Tools.jxx - -# Libraries targets -lib_LTLIBRARIES = libNMTAlgo.la - -dist_libNMTAlgo_la_SOURCES = \ - NMTAlgo_Algo.cxx \ - NMTAlgo_Builder.cxx \ - NMTAlgo_Loop3d.cxx \ - NMTAlgo_Splitter.cxx \ - NMTAlgo_Splitter1.cxx \ - NMTAlgo_Splitter_1.cxx \ - NMTAlgo_Splitter_2.cxx \ - NMTAlgo_Tools.cxx - -# additional information to compile and link file - -libNMTAlgo_la_CPPFLAGS = \ - $(CAS_CPPFLAGS) \ - $(KERNEL_CXXFLAGS) \ - -I$(srcdir)/../NMTDS \ - -I$(srcdir)/../NMTTools - -libNMTAlgo_la_LDFLAGS = \ - $(STDLIB) \ - $(CAS_LDPATH) -lTKBool -lTKBO \ - $(KERNEL_LDFLAGS) \ - ../NMTTools/libNMTTools.la diff --git a/src/NMTAlgo/NMTAlgo.cdl b/src/NMTAlgo/NMTAlgo.cdl deleted file mode 100644 index 1af7ea7e2..000000000 --- a/src/NMTAlgo/NMTAlgo.cdl +++ /dev/null @@ -1,59 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTAlgo.cdl --- Created: Tue Jan 27 14:39:05 2004 --- Author: Peter KURNEV - - -package NMTAlgo - - ---Purpose: - -uses - TCollection, - TColStd, - gp, - TopAbs, - TopoDS, - TopTools, - - BooleanOperations, - BOPTColStd, - IntTools, - BOPTools, - BOP, - - NMTDS, - NMTTools, - - BRep, - BRepAlgo - -is - deferred class Algo; - class Splitter; - class Splitter1; --modified by NIZNHY-PKV Wed Feb 11 14:28:50 2004 - class Builder; - class Tools; - class Loop3d; - -end NMTAlgo; diff --git a/src/NMTAlgo/NMTAlgo.pro b/src/NMTAlgo/NMTAlgo.pro deleted file mode 100644 index 213e5be2b..000000000 --- a/src/NMTAlgo/NMTAlgo.pro +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = NMTAlgo -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} ../NMTDS ../NMTTools - -LIBS += $${STDLIB} $${CAS_LDPATH} -lTKBool -lTKBO $${KERNEL_LDFLAGS} -L$$(GEOM_ROOT_DIR)/lib -lNMTTools - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = NMTAlgo_Splitter1.hxx -HEADERS += NMTAlgo_Splitter.hxx -HEADERS += NMTAlgo_Builder.hxx -HEADERS += NMTAlgo_Algo.hxx - -SOURCES = NMTAlgo_Algo.cxx -SOURCES += NMTAlgo_Builder.cxx -SOURCES += NMTAlgo_Loop3d.cxx -SOURCES += NMTAlgo_Splitter.cxx -SOURCES += NMTAlgo_Splitter1.cxx -SOURCES += NMTAlgo_Splitter_1.cxx -SOURCES += NMTAlgo_Splitter_2.cxx -SOURCES += NMTAlgo_Tools.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/NMTAlgo/NMTAlgo_Algo.cdl b/src/NMTAlgo/NMTAlgo_Algo.cdl deleted file mode 100644 index 546ab20e8..000000000 --- a/src/NMTAlgo/NMTAlgo_Algo.cdl +++ /dev/null @@ -1,78 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTAlgo_Algo.cdl --- Created: Tue Jan 27 14:41:04 2004 --- Author: Peter KURNEV - - -deferred class Algo from NMTAlgo - - ---Purpose: - -uses - Shape from TopoDS, - - DSFiller from NMTTools, - PDSFiller from NMTTools - ---raises - -is - Initialize - returns Algo from NMTAlgo; - ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Algo();" - - - SetFiller(me:out; - aDSF: DSFiller from NMTTools); - - Filler(me) - returns DSFiller from NMTTools; - ---C++: return const & - - ComputeWithFiller(me:out; - aDSF: DSFiller from NMTTools) - is virtual; - - Clear (me:out) - is virtual; - - Shape (me) - returns Shape from TopoDS; - ---C++: return const & - - IsDone(me) - returns Boolean from Standard; - - ErrorStatus (me) - returns Integer from Standard; - -fields - myDSFiller : PDSFiller from NMTTools is protected; - myShape : Shape from TopoDS is protected; - -- - myIsDone : Boolean from Standard is protected; - myIsComputed : Boolean from Standard is protected; - myErrorStatus : Integer from Standard is protected; - myDraw : Integer from Standard is protected; - -end Algo; diff --git a/src/NMTAlgo/NMTAlgo_Algo.cxx b/src/NMTAlgo/NMTAlgo_Algo.cxx deleted file mode 100644 index 3beffd3db..000000000 --- a/src/NMTAlgo/NMTAlgo_Algo.cxx +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTAlgo_Algo.cxx -// Created: Tue Jan 27 14:58:21 2004 -// Author: Peter KURNEV -// -// -#include -#include -//======================================================================= -// function: NMTAlgo_Algo::NMTAlgo_Algo -// purpose: -//======================================================================= - NMTAlgo_Algo::NMTAlgo_Algo() -: - myDSFiller(NULL), - myIsDone(Standard_False), - myIsComputed(Standard_False), - myErrorStatus(1) -{ - myDraw=0; - // - char* xr=getenv("MDISP"); - if (xr!=NULL) { - if (!strcmp (xr, "yes")) { - myDraw=1; - } - } -} -//======================================================================= -// function: NMTAlgo_Algo -// purpose: -//======================================================================= - NMTAlgo_Algo::~NMTAlgo_Algo() -{ - Clear(); -} -//======================================================================= -// function: Clear -// purpose: -//======================================================================= - void NMTAlgo_Algo::Clear() -{ - myIsDone=Standard_False; - myIsComputed=Standard_False; - myErrorStatus=1; -} -//======================================================================= -// function: SetFiller -// purpose: -//======================================================================= - void NMTAlgo_Algo::SetFiller(const NMTTools_DSFiller& aDSF) -{ - myDSFiller=(NMTTools_DSFiller *)&aDSF; -} -//======================================================================= -// function: Filler -// purpose: -//======================================================================= - const NMTTools_DSFiller& NMTAlgo_Algo::Filler()const -{ - return *myDSFiller; -} -//======================================================================= -// function: ComputeWithFiller -// purpose: -//======================================================================= - void NMTAlgo_Algo::ComputeWithFiller(const NMTTools_DSFiller& aDSF) -{ - SetFiller(aDSF); -} -//======================================================================= -// function: Shape -// purpose: -//======================================================================= - const TopoDS_Shape& NMTAlgo_Algo::Shape()const -{ - return myShape; -} -//======================================================================= -// function: IsDone -// purpose: -//======================================================================= - Standard_Boolean NMTAlgo_Algo::IsDone()const -{ - return myIsDone; -} -//======================================================================= -// function: ErrorStatus -// purpose: -//======================================================================= - Standard_Integer NMTAlgo_Algo::ErrorStatus()const -{ - return myErrorStatus; -} -/* -//======================================================================= -// function: Compute -// purpose: -//======================================================================= - void NMTAlgo_Algo::Compute() -{ -} -//======================================================================= -// function: SetCompositeShape -// purpose: -//======================================================================= - void NMTAlgo_Algo::SetCompositeShape(const TopoDS_Shape& aS) -{ - myCompositeShape=aS; -} -//======================================================================= -// function: CompositeShape -// purpose: -//======================================================================= - const TopoDS_Shape& NMTAlgo_Algo::CompositeShape()const -{ - return myCompositeShape; -} -*/ diff --git a/src/NMTAlgo/NMTAlgo_Algo.hxx b/src/NMTAlgo/NMTAlgo_Algo.hxx deleted file mode 100644 index dc73c1088..000000000 --- a/src/NMTAlgo/NMTAlgo_Algo.hxx +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTAlgo_Algo_HeaderFile -#define _NMTAlgo_Algo_HeaderFile - -#ifndef _NMTTools_PDSFiller_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -class NMTTools_DSFiller; -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class NMTAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT void SetFiller(const NMTTools_DSFiller& aDSF) ; -Standard_EXPORT const NMTTools_DSFiller& Filler() const; -Standard_EXPORT virtual void ComputeWithFiller(const NMTTools_DSFiller& aDSF) ; -Standard_EXPORT virtual void Clear() ; -Standard_EXPORT const TopoDS_Shape& Shape() const; -Standard_EXPORT Standard_Boolean IsDone() const; -Standard_EXPORT Standard_Integer ErrorStatus() const; - - - - - -protected: - - // Methods PROTECTED - // -Standard_EXPORT NMTAlgo_Algo(); -Standard_EXPORT virtual ~NMTAlgo_Algo(); - - - // Fields PROTECTED - // -NMTTools_PDSFiller myDSFiller; -TopoDS_Shape myShape; -Standard_Boolean myIsDone; -Standard_Boolean myIsComputed; -Standard_Integer myErrorStatus; -Standard_Integer myDraw; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTAlgo/NMTAlgo_Algo.ixx b/src/NMTAlgo/NMTAlgo_Algo.ixx deleted file mode 100644 index cb4c135df..000000000 --- a/src/NMTAlgo/NMTAlgo_Algo.ixx +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2007-2008 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 diff --git a/src/NMTAlgo/NMTAlgo_Algo.jxx b/src/NMTAlgo/NMTAlgo_Algo.jxx deleted file mode 100644 index fc8787025..000000000 --- a/src/NMTAlgo/NMTAlgo_Algo.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_DSFiller_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Algo_HeaderFile -#include -#endif diff --git a/src/NMTAlgo/NMTAlgo_Builder.cdl b/src/NMTAlgo/NMTAlgo_Builder.cdl deleted file mode 100644 index 9527e0a21..000000000 --- a/src/NMTAlgo/NMTAlgo_Builder.cdl +++ /dev/null @@ -1,98 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTAlgo_Builder.cdl --- Created: Tue Jan 27 15:09:45 2004 --- Author: Peter KURNEV - - -class Builder from NMTAlgo - inherits Algo from NMTAlgo - - ---Purpose: - -uses - Shape from TopoDS, - Face from TopoDS, - Edge from TopoDS, - IndexedMapOfShape from TopTools, - IndexedDataMapOfShapeListOfShape from TopTools, - IndexedDataMapOfShapeShape from TopTools, - Image from BRepAlgo, - DSFiller from NMTTools ---raises - -is - Create - returns Builder from NMTAlgo; - ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Builder();" - - Clear (me:out) - is redefined; - - ComputeWithFiller(me:out; - aDSF: DSFiller from NMTTools) - is redefined; - - FillImagesEdges (me:out) - is protected; - - FillIn2DParts (me:out) - is protected; - - FillImagesFaces (me:out) - is protected; - - FillSDFaces (me:out) - is protected; - - --- Queries - SplitVertices (me:out) - is protected; - - IsSectionEdge (me; - E : Edge from TopoDS) - returns Boolean from Standard - is protected; - - HasSameDomainF(me; - F : Face from TopoDS) - returns Boolean from Standard - is protected; - - IsSameDomainF(me; - F1 : Face from TopoDS; - F2 : Face from TopoDS) - returns Boolean from Standard - is protected; - -fields - - myImagesEdges : Image from BRepAlgo is protected; - myImagesFaces : Image from BRepAlgo is protected; - - myQueryShapes : IndexedMapOfShape from TopTools is protected; - -- - myIn2DParts : IndexedDataMapOfShapeListOfShape from TopTools is protected; - mySectionParts : IndexedDataMapOfShapeListOfShape from TopTools is protected; - mySDFaces : IndexedDataMapOfShapeShape from TopTools is protected; - -- -end Builder; diff --git a/src/NMTAlgo/NMTAlgo_Builder.cxx b/src/NMTAlgo/NMTAlgo_Builder.cxx deleted file mode 100644 index b5a1fceb9..000000000 --- a/src/NMTAlgo/NMTAlgo_Builder.cxx +++ /dev/null @@ -1,669 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTAlgo_Inter3d.cxx -// Created: Tue Jan 27 15:14:13 2004 -// Author: Peter KURNEV -// -// -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -//======================================================================= -// function: NMTAlgo_Inter3d::NMTAlgo_Inter3d() -// purpose: -//======================================================================= - NMTAlgo_Builder::NMTAlgo_Builder() -: - NMTAlgo_Algo() -{ -} -//======================================================================= -// function: ~NMTAlgo_Builder -// purpose: -//======================================================================= - NMTAlgo_Builder::~NMTAlgo_Builder() -{ - Clear(); -} -//======================================================================= -// function: Clear -// purpose: -//======================================================================= - void NMTAlgo_Builder::Clear() -{ - NMTAlgo_Algo::Clear(); - // - myImagesEdges.Clear(); - myImagesFaces.Clear(); - myIn2DParts.Clear(); - mySectionParts.Clear(); - mySDFaces.Clear(); -} -//======================================================================= -// function: ComputeWithFiller -// purpose: -//======================================================================= - void NMTAlgo_Builder::ComputeWithFiller(const NMTTools_DSFiller& aDSF) -{ - myErrorStatus=0; - myIsDone=Standard_False; - // - SetFiller(aDSF); - // edges - FillImagesEdges(); - // faces - FillIn2DParts(); - FillImagesFaces(); - FillSDFaces(); -} - -//======================================================================= -// function: FillSDFaces -// purpose: -//======================================================================= - void NMTAlgo_Builder::FillSDFaces() -{ - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); - BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); - IntTools_Context& aCtx= pPF->ChangeContext(); - // - Standard_Boolean bIsSDF; - Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC; - TopTools_ListIteratorOfListOfShape aItF1, aItF2; - NMTTools_ListOfCoupleOfShape aLCS; - // - mySDFaces.Clear(); - // - // 1. For each FF find among images of faces - // all pairs of same domain faces (SDF) [=> aLCS] - aNbFF=aFFs.Extent(); - for (i=1; i<=aNbFF; ++i) { - BOPTools_SSInterference& aFF=aFFs(i); - aFF.Indices(nF1, nF2); - // - const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1)); - const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2)); - // - // if there are no in/on 2D split parts the faces nF1, nF2 - // can not be SDF - const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks(); - aNbPBInOn=aLPBInOn.Extent(); - if (!aNbPBInOn) { - continue; - } - // - // if there is at least one section edge between faces nF1, nF2 - // they can not be SDF - BOPTools_SequenceOfCurves& aSC=aFF.Curves(); - aNbC=aSC.Length(); - if (aNbC) { - continue; - } - // - // the faces are suspected to be SDF. - // Try to find SDF among images of nF1, nF2 - const TopTools_ListOfShape& aLF1=myImagesFaces.Image(aF1); - const TopTools_ListOfShape& aLF2=myImagesFaces.Image(aF2); - // - aItF1.Initialize(aLF1); - for (; aItF1.More(); aItF1.Next()) { - const TopoDS_Face& aF1x=TopoDS::Face(aItF1.Value()); - // - aItF2.Initialize(aLF2); - for (; aItF2.More(); aItF2.Next()) { - const TopoDS_Face& aF2y=TopoDS::Face(aItF2.Value()); - bIsSDF=NMTTools_Tools::AreFacesSameDomain(aF1x, aF2y, aCtx); - if (bIsSDF) { - NMTTools_CoupleOfShape aCS; - // - aCS.SetShape1(aF1x); - aCS.SetShape2(aF2y); - aLCS.Append(aCS); - } - } - } - }//for (i=1; i<=aNbFF; ++i) - // - aNbC=aLCS.Extent(); - if (!aNbC) { - return; - } - // - // 2. Find Chains - NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC; - // - NMTTools_Tools::FindChains(aLCS, aMC); - // - // 3. Fill the map of SDF mySDFaces - aNbC=aMC.Extent(); - for (i=1; i<=aNbC; ++i) { - const TopoDS_Shape& aF=aMC.FindKey(i); - const TopTools_IndexedMapOfShape& aMSDF=aMC(i); - // - aNbFF=aMSDF.Extent(); - for (j=1; j<=aNbFF; ++j) { - const TopoDS_Shape& aFSD=aMSDF(j); - mySDFaces.Add(aFSD, aF); - } - } - // -} -//======================================================================= -// function: FillImagesFaces -// purpose: -//======================================================================= - void NMTAlgo_Builder::FillImagesFaces() -{ - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - IntTools_Context& aCtx= pPF->ChangeContext(); - // - Standard_Integer i, j, aNb, aNbE; - TopTools_IndexedMapOfShape aMFence, aME; - TColStd_IndexedMapOfInteger aMFP; - // - // 1. Select Faces to process (MFP) - aNb=aDS.NumberOfShapesOfTheObject(); - for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aF=aDS.Shape(i); - if (aF.ShapeType()!=TopAbs_FACE) { - continue; - } - if (aMFence.Contains(aF)) { - continue; - } - aMFence.Add(aF); - // - if (myIn2DParts.Contains(aF)) { - aMFP.Add(i); - continue; - } - // - if (mySectionParts.Contains(aF)) { - aMFP.Add(i); - continue; - } - // - aME.Clear(); - TopExp::MapShapes(aF, TopAbs_EDGE, aME); - // - aNbE=aME.Extent(); - for(j=1; j<=aNbE; ++j) { - const TopoDS_Shape& aE=aME(j); - // - if (myImagesEdges.HasImage(aE)) { - aMFP.Add(i); - break; - } - } - }// for (i=1; i<=aNb; ++i) - // - // 2. ProcessFaces - Standard_Boolean bToReverse, bIsClosed, bIsDegenerated; - Standard_Integer aNbF, nF; - TopoDS_Face aFF; - TopoDS_Edge aSp; - TopExp_Explorer anExp; - TopTools_ListIteratorOfListOfShape aIt; - BRepAlgo_Image aImagesFaces; - TopAbs_Orientation anOriF; - // - aNbF=aMFP.Extent(); - for (i=1; i<=aNbF; ++i) { - nF=aMFP(i); - const TopoDS_Face& aF=TopoDS::Face(aDS.Shape(nF)); - anOriF=aF.Orientation(); - aFF=aF; - aFF.Orientation(TopAbs_FORWARD); - // - aMFence.Clear(); - // - // 2.1. Fill WES - BOP_WireEdgeSet aWES; - aWES.Initialize(aFF); - // - // 2.1.1. Add Split parts - anExp.Init(aFF, TopAbs_EDGE); - for (; anExp.More(); anExp.Next()) { - const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current()); - // - if (!myImagesEdges.HasImage(aE)) { - aWES.AddStartElement(aE); - continue; - } - // - bIsDegenerated=BRep_Tool::Degenerated(aE); - bIsClosed=BRep_Tool::IsClosed(aE, aF); - // - const TopTools_ListOfShape& aLIE=myImagesEdges.Image(aE); - aIt.Initialize(aLIE); - for (; aIt.More(); aIt.Next()) { - aSp=TopoDS::Edge(aIt.Value()); - // - if (bIsDegenerated) { - aSp.Orientation(aE.Orientation()); - aWES.AddStartElement(aSp); - continue; - } - // - if (bIsClosed){ - if (!aMFence.Contains(aSp)){ - aMFence.Add(aSp); - // - if (!BRep_Tool::IsClosed(aSp, aF)){ - BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF); - } - // - aSp.Orientation(TopAbs_FORWARD); - aWES.AddStartElement(aSp); - // - aSp.Orientation(TopAbs_REVERSED); - aWES.AddStartElement(aSp); - continue; - } - } - // - bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, aCtx); - if (bToReverse) { - aSp.Reverse(); - } - aWES.AddStartElement(aSp); - } - } - // - // 2.1.2. Add In2D Parts - if (myIn2DParts.Contains(aF)) { - const TopTools_ListOfShape& aLE=myIn2DParts.FindFromKey(aF); - aIt.Initialize(aLE); - for (; aIt.More(); aIt.Next()) { - aSp=TopoDS::Edge(aIt.Value()); - // - aSp.Orientation(TopAbs_FORWARD); - aWES.AddStartElement(aSp); - // - aSp.Orientation(TopAbs_REVERSED); - aWES.AddStartElement(aSp); - } - } - // - // 2.1.3. Add Section Parts - if (mySectionParts.Contains(aF)) { - const TopTools_ListOfShape& aLE=mySectionParts.FindFromKey(aF); - aIt.Initialize(aLE); - for (; aIt.More(); aIt.Next()) { - aSp=TopoDS::Edge(aIt.Value()); - // - aSp.Orientation(TopAbs_FORWARD); - aWES.AddStartElement(aSp); - // - aSp.Orientation(TopAbs_REVERSED); - aWES.AddStartElement(aSp); - } - } - // - // 2.2. Build images Faces - BOP_FaceBuilder aFB; - // - aFB.SetTreatment(0); // 0-Do Internal Edges - aFB.SetTreatSDScales(0); // what is 0 ?? - // - aFB.Do(aWES); - // - TopTools_ListOfShape aLFR; - // - const TopTools_ListOfShape& aLF=aFB.NewFaces(); - - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - TopoDS_Shape& aFR=aIt.Value(); - if (anOriF==TopAbs_REVERSED) { - aFR.Orientation(TopAbs_REVERSED); - } - aLFR.Append(aFR); - } - - // - // 2.3. Collect images Faces - myImagesFaces.Bind(aF, aLFR); - }//for (i=1; i<=aNbF; ++i) -} -//======================================================================= -// function: FillIn2DParts -// purpose: -//======================================================================= - void NMTAlgo_Builder::FillIn2DParts() -{ - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); - BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); - // - Standard_Integer i, j, aNb, nF1, nF2, aNbFF, iFF, nSpIn, nSpSc, aNbCurves; - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aFFMap; - BOPTools_ListOfPaveBlock aLPBIn, aLPBSc; - BOPTools_ListIteratorOfListOfPaveBlock aItPBIn, aItPBSc; - TopTools_IndexedMapOfShape aMF, aMFence; - TopTools_ListOfShape aLSpIn, aLSpSc; - // - BOP_BuilderTools::DoMap(aFFs, aFFMap); - // - // 1. Collect Splits In 2D (myIn2DParts) and - // Section Edges (mySectionParts) - // for each source face that involved in FF - aNb=aFFMap.Extent(); - for (i=1; i<=aNb; ++i) { - nF1=aFFMap.FindKey(i); - const TopoDS_Shape& aF=aDS.Shape(nF1); - // - if (aMF.Contains(aF)) { - continue; - } - aMF.Add(aF); - // - aLPBIn.Clear(); - aLPBSc.Clear(); - // - const TColStd_IndexedMapOfInteger& aFFIndicesMap=aFFMap.FindFromIndex(i); - // - aNbFF=aFFIndicesMap.Extent(); - for (j=1; j<=aNbFF; ++j) { - iFF=aFFIndicesMap(j); - BOPTools_SSInterference& aFF=aFFs(iFF); - nF2=aFF.OppositeIndex(nF1); - // - // In 2D - pPF->RealSplitsInFace(0, nF2, nF1, aLPBIn); - // - // Sections - BOPTools_SequenceOfCurves& aSC=aFF.Curves(); - aNbCurves=aSC.Length(); - if (!aNbCurves) { - continue; - } - // - const BOPTools_Curve& aBC=aSC(1); - const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks(); - // - aItPBSc.Initialize(aLPB); - for (; aItPBSc.More(); aItPBSc.Next()) { - const BOPTools_PaveBlock& aPBSc=aItPBSc.Value(); - aLPBSc.Append(aPBSc); - } - }// for (j=1; j<=aNbFF; ++j) - // - // In 2D Parts - aMFence.Clear(); - // - aLSpIn.Clear(); - aItPBIn.Initialize(aLPBIn); - for (; aItPBIn.More(); aItPBIn.Next()) { - const BOPTools_PaveBlock& aPBR=aItPBIn.Value(); - nSpIn=aPBR.Edge(); - const TopoDS_Shape& aSpIn=aDS.Shape(nSpIn); - if (!aMFence.Contains(aSpIn)){ - aMFence.Add(aSpIn); - aLSpIn.Append(aSpIn); - } - } - myIn2DParts.Add(aF, aLSpIn); - // - // Section Parts - aLSpSc.Clear(); - aItPBSc.Initialize(aLPBSc); - for (; aItPBSc.More(); aItPBSc.Next()) { - const BOPTools_PaveBlock& aPBSc=aItPBSc.Value(); - nSpSc=aPBSc.Edge(); - const TopoDS_Shape& aSpSc=aDS.Shape(nSpSc); - if (!aMFence.Contains(aSpSc)){ - aMFence.Add(aSpSc); - aLSpSc.Append(aSpSc); - } - } - mySectionParts.Add(aF, aLSpSc); - } //for (i=1; i<=aNb; ++i) -} - -//======================================================================= -// function: FillImagesEdges -// purpose: -//======================================================================= - void NMTAlgo_Builder::FillImagesEdges() -{ - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool(); - // - Standard_Integer nE, aNb, aNbSp, nSp; - BOPTools_ListIteratorOfListOfPaveBlock aIt; - TopTools_IndexedMapOfShape aMFence; - TopTools_ListOfShape aLSp; - // - aNb=aDS.NumberOfShapesOfTheObject(); - for (nE=1; nE<=aNb; ++nE) { - const TopoDS_Shape& aE=aDS.Shape(nE); - if (aE.ShapeType()!=TopAbs_EDGE) { - continue; - } - if (aMFence.Contains(aE)) { - continue; - } - aMFence.Add(aE); - // - const BOPTools_ListOfPaveBlock& aLPB=aSSP(aDS.RefEdge(nE)); - aNbSp=aLPB.Extent(); - // - if (!aNbSp) {// no splits - //myImagesEdges.Bind(aE, aE); - continue; - } - // - //modified by NIZNHY-PKV Fri Jan 21 17:01:10 2005 f - if (aNbSp==1) { - const BOPTools_PaveBlock& aPB1=aLPB.First(); - const BOPTools_PaveBlock& aPBR1=pPF->RealPaveBlock(aPB1); - nSp=aPBR1.Edge(); - const TopoDS_Shape& aSp1=aDS.Shape(nSp); - if (aSp1.IsSame(aE)) { - continue; - } - } - //modified by NIZNHY-PKV Fri Jan 21 17:01:14 2005 t - // - aLSp.Clear(); - aIt.Initialize(aLPB); - for (; aIt.More(); aIt.Next()) { - const BOPTools_PaveBlock& aPB=aIt.Value(); - const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB); - nSp=aPBR.Edge(); - const TopoDS_Shape& aSp=aDS.Shape(nSp); - aLSp.Append(aSp); - } - myImagesEdges.Bind(aE, aLSp); - } -} -//======================================================================= -// function: SplitVertices -// purpose: -//======================================================================= - void NMTAlgo_Builder::SplitVertices() -{ - const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); - NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); - const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool(); - // - Standard_Integer nE, aNb, aNbSp, nV1, nV2; - BOPTools_ListIteratorOfListOfPaveBlock aIt; - // - myQueryShapes.Clear(); - // - aNb=aDS.NumberOfShapesOfTheObject(); - for (nE=1; nE<=aNb; ++nE) { - const TopoDS_Shape& aE=aDS.Shape(nE); - if (aE.ShapeType()!=TopAbs_EDGE) { - continue; - } - // - const BOPTools_ListOfPaveBlock& aLPB=aSSP(aDS.RefEdge(nE)); - aNbSp=aLPB.Extent(); - // - if (!aNbSp) {// no splits - continue; - } - // - aIt.Initialize(aLPB); - for (; aIt.More(); aIt.Next()) { - const BOPTools_PaveBlock& aPB=aIt.Value(); - const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB); - // - nV1=aPBR.Pave1().Index(); - if (aDS.IsNewShape(nV1)) { - const TopoDS_Shape& aV1=aDS.Shape(nV1); - myQueryShapes.Add(aV1); - } - // - nV2=aPBR.Pave2().Index(); - if (aDS.IsNewShape(nV2)) { - const TopoDS_Shape& aV2=aDS.Shape(nV2); - myQueryShapes.Add(aV2); - } - } - } -} -//======================================================================= -// function: IsSectionEdge -// purpose: -//======================================================================= - Standard_Boolean NMTAlgo_Builder::IsSectionEdge(const TopoDS_Edge& aE)const -{ - return myImagesEdges.HasImage(aE); -} -//======================================================================= -// function: IsSameDomainF -// purpose: -//======================================================================= - Standard_Boolean NMTAlgo_Builder::HasSameDomainF(const TopoDS_Face& aF1)const -{ - Standard_Boolean bFlag=Standard_False; - TopTools_ListIteratorOfListOfShape aItF1; - // - const TopTools_ListOfShape& aLF1=myImagesFaces.Image(aF1); - aItF1.Initialize(aLF1); - for (; aItF1.More(); aItF1.Next()) { - const TopoDS_Shape& aF1x=aItF1.Value(); - // - if (mySDFaces.Contains(aF1x)){ - return !bFlag; - } - } - return bFlag; -} -//======================================================================= -// function: IsSameDomainF -// purpose: -//======================================================================= - Standard_Boolean NMTAlgo_Builder::IsSameDomainF(const TopoDS_Face& aF1, - const TopoDS_Face& aF2)const -{ - Standard_Boolean bFlag=Standard_False; - TopTools_ListIteratorOfListOfShape aItF1, aItF2; - // - const TopTools_ListOfShape& aLF1=myImagesFaces.Image(aF1); - const TopTools_ListOfShape& aLF2=myImagesFaces.Image(aF2); - // - aItF1.Initialize(aLF1); - for (; aItF1.More(); aItF1.Next()) { - const TopoDS_Shape& aF1x=aItF1.Value(); - // - if (!mySDFaces.Contains(aF1x)){ - continue; - } - const TopoDS_Shape& aFSD1x=mySDFaces.FindFromKey(aF1x); - // - aItF2.Initialize(aLF2); - for (; aItF2.More(); aItF2.Next()) { - const TopoDS_Shape& aF2y=aItF2.Value(); - if (!mySDFaces.Contains(aF2y)){ - continue; - } - const TopoDS_Shape& aFSD2y=mySDFaces.FindFromKey(aF2y); - if (aFSD1x.IsSame(aFSD2y)) { - return !bFlag; - } - } - } - return bFlag; -} diff --git a/src/NMTAlgo/NMTAlgo_Builder.hxx b/src/NMTAlgo/NMTAlgo_Builder.hxx deleted file mode 100644 index a5df73c8e..000000000 --- a/src/NMTAlgo/NMTAlgo_Builder.hxx +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTAlgo_Builder_HeaderFile -#define _NMTAlgo_Builder_HeaderFile - -#ifndef _BRepAlgo_Image_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Algo_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class NMTTools_DSFiller; -class TopoDS_Edge; -class TopoDS_Face; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class NMTAlgo_Builder : public NMTAlgo_Algo { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT NMTAlgo_Builder(); -Standard_EXPORT virtual ~NMTAlgo_Builder(); -Standard_EXPORT virtual void Clear() ; -Standard_EXPORT virtual void ComputeWithFiller(const NMTTools_DSFiller& aDSF) ; - - - - - -protected: - - // Methods PROTECTED - // -Standard_EXPORT void FillImagesEdges() ; -Standard_EXPORT void FillIn2DParts() ; -Standard_EXPORT void FillImagesFaces() ; -Standard_EXPORT void FillSDFaces() ; -Standard_EXPORT void SplitVertices() ; -Standard_EXPORT Standard_Boolean IsSectionEdge(const TopoDS_Edge& E) const; -Standard_EXPORT Standard_Boolean HasSameDomainF(const TopoDS_Face& F) const; -Standard_EXPORT Standard_Boolean IsSameDomainF(const TopoDS_Face& F1,const TopoDS_Face& F2) const; - - - // Fields PROTECTED - // -BRepAlgo_Image myImagesEdges; -BRepAlgo_Image myImagesFaces; -TopTools_IndexedMapOfShape myQueryShapes; -TopTools_IndexedDataMapOfShapeListOfShape myIn2DParts; -TopTools_IndexedDataMapOfShapeListOfShape mySectionParts; -TopTools_IndexedDataMapOfShapeShape mySDFaces; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTAlgo/NMTAlgo_Builder.ixx b/src/NMTAlgo/NMTAlgo_Builder.ixx deleted file mode 100644 index 283ec7648..000000000 --- a/src/NMTAlgo/NMTAlgo_Builder.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTAlgo/NMTAlgo_Builder.jxx b/src/NMTAlgo/NMTAlgo_Builder.jxx deleted file mode 100644 index f3e4dbe5a..000000000 --- a/src/NMTAlgo/NMTAlgo_Builder.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_DSFiller_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Builder_HeaderFile -#include -#endif diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.cdl b/src/NMTAlgo/NMTAlgo_Loop3d.cdl deleted file mode 100644 index 190825523..000000000 --- a/src/NMTAlgo/NMTAlgo_Loop3d.cdl +++ /dev/null @@ -1,87 +0,0 @@ --- Copyright (C) 2007-2008 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 --- - -class Loop3d from NMTAlgo - - ---Purpose: Builds the shells from a set of faces. - -- Provides methods for comparing faces mutual - -- location. - -uses - Vec from gp, - MapOfOrientedShape from TopTools, - IndexedDataMapOfShapeListOfShape from TopTools, - Face from TopoDS, - Edge from TopoDS, - ListOfShape from TopTools, - Shape from TopoDS - -is - - Create - returns Loop3d from NMTAlgo ; - - AddConstFaces (me:out; - S : Shape from TopoDS) - ---Purpose: Add faces of as unique faces in the result. - is static; - - AddSectionFaces (me:out; - S : Shape from TopoDS) - ---Purpose: Add faces of as double faces in the result. - is static; - - MakeShells (me:out; - AvoidFacesMap : MapOfOrientedShape from TopTools) - returns ListOfShape from TopTools is static; - ---Purpose: Make and return shells. - -- can contain faces that must not be - -- added to result shells. - ---C++: return const & - - - ---Category: class methods - - IsInside (myclass; E : Edge from TopoDS; - F1, F2 : Face from TopoDS; - CountDot : Boolean from Standard; - Dot : in out Real from Standard; - GoodOri : in out Boolean from Standard) - returns Boolean from Standard; - ---Purpose: check if is inside by edge . - -- if , compute : scalar production of - -- normalized vectors pointing inside faces, and - -- check if faces are oriented well for sewing - - Normal (myclass; E : Edge from TopoDS; - F : Face from TopoDS) - returns Vec from gp; - - -fields - - myNewShells : ListOfShape from TopTools; -- result - - myFaces : ListOfShape from TopTools; - myEFMap : IndexedDataMapOfShapeListOfShape from TopTools; - -end Loop3d; diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.cxx b/src/NMTAlgo/NMTAlgo_Loop3d.cxx deleted file mode 100644 index 5517e95c7..000000000 --- a/src/NMTAlgo/NMTAlgo_Loop3d.cxx +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -//using namespace std; -// -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static - TopoDS_Edge FindEinF(const TopoDS_Edge&, const TopoDS_Face&); -static - gp_Vec NextNormal(const TopoDS_Edge&, const TopoDS_Face&); - -//======================================================================= -//function : -//purpose : -//======================================================================= - NMTAlgo_Loop3d::NMTAlgo_Loop3d() -{ -} - -//======================================================================= -//function : AddConstFaces -//purpose : Add faces of as unique faces in the result. -//======================================================================= - void NMTAlgo_Loop3d::AddConstFaces(const TopoDS_Shape& S) -{ - TopExp_Explorer FaceExp(S, TopAbs_FACE); - for (; FaceExp.More(); FaceExp.Next()){ - myFaces.Append( FaceExp.Current() ); - } - TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, myEFMap); -} - -//======================================================================= -//function : AddSectionFaces -//purpose : Add faces of as double faces in the result. -//======================================================================= - void NMTAlgo_Loop3d::AddSectionFaces(const TopoDS_Shape& S) -{ - AddConstFaces( S ); - AddConstFaces( S.Reversed() ); -} - -//======================================================================= -//function : MakeShells -//purpose : Make and return shells. -// can contain faces that must not be -// added to result shells. -//======================================================================= - const TopTools_ListOfShape& NMTAlgo_Loop3d::MakeShells - (const TopTools_MapOfOrientedShape& AvoidFacesMap) -{ - myNewShells.Clear(); - - BRep_Builder Builder; - TopTools_MapOfShape CheckedEdgesMap; - TopTools_MapOfOrientedShape AddedFacesMap; - - TopTools_ListIteratorOfListOfShape itF (myFaces); - for (; itF.More(); itF.Next()) { - const TopoDS_Shape& FF = itF.Value(); - if (AvoidFacesMap.Contains( FF ) || - ! AddedFacesMap.Add( FF ) ) - continue; - - // make a new shell - TopoDS_Shell Shell; - Builder.MakeShell(Shell); - Builder.Add(Shell,FF); - - // clear the maps from shapes added to previous Shell - TopTools_MapIteratorOfMapOfShape itEM (CheckedEdgesMap); - for (; itEM.More(); itEM.Next()) { - TopTools_ListOfShape& FL = myEFMap.ChangeFromKey( itEM.Key()); - TopTools_ListIteratorOfListOfShape it (FL); - while ( it.More()) { - if (AddedFacesMap.Contains( it.Value())) - FL.Remove( it ); - else - it.Next(); - } - } - CheckedEdgesMap.Clear(); - - - // loop on faces added to Shell; add their neighbor faces to Shell and so on - TopoDS_Iterator itAddedF (Shell); - for (; itAddedF.More(); itAddedF.Next()){ - const TopoDS_Face& F = TopoDS::Face (itAddedF.Value()); - - // loop on edges of F; find a good neighbor face of F by E - TopExp_Explorer EdgeExp(F, TopAbs_EDGE); - for (; EdgeExp.More(); EdgeExp.Next()){ - const TopoDS_Edge& E = TopoDS::Edge( EdgeExp.Current()); - if (! CheckedEdgesMap.Add( E )) - continue; - - // candidate faces list - const TopTools_ListOfShape& FL = myEFMap.ChangeFromKey(E); - if (FL.IsEmpty()) - continue; - // select one of neighbors - TopoDS_Face SelF; - if (FL.Extent() == 2) { - if (! F.IsSame( FL.First() )) - SelF = TopoDS::Face( FL.First() ); - else if (!F.IsSame( FL.Last() )) - SelF = TopoDS::Face( FL.Last() ); - } - else { - // check if a face already added to Shell shares E - TopTools_ListIteratorOfListOfShape it (FL); - Standard_Boolean found = Standard_False; - for (; !found && it.More(); it.Next()) - if (F != it.Value()) - found = AddedFacesMap.Contains( it.Value() ); - if (found) - continue; - // select basing on geometrical check - Standard_Boolean GoodOri, inside; - Standard_Real dot, MaxDot = -100; - TopTools_ListOfShape TangFL; // tangent faces - for ( it.Initialize( FL ) ; it.More(); it.Next()) { - const TopoDS_Face& NeighborF = TopoDS::Face( it.Value()); - if (NeighborF.IsSame( F )) - continue; - inside = NMTAlgo_Loop3d::IsInside( E, F, NeighborF, 1, dot, GoodOri); - if (!GoodOri) - continue; - if (!inside) - dot = -dot - 3; - if (dot < MaxDot) - continue; - if ( IsEqual( dot, MaxDot)) - TangFL.Append(SelF); - else - TangFL.Clear(); - MaxDot = dot; - SelF = NeighborF; - } - if (!TangFL.IsEmpty()) { - for (it.Initialize( TangFL ); it.More(); it.Next()) { - const TopoDS_Face& NeighborF = TopoDS::Face( it.Value()); - if (NMTAlgo_Loop3d:: IsInside( E, SelF , NeighborF, 0, dot, GoodOri)) - SelF = NeighborF; - } - } - } - if (!SelF.IsNull() && - AddedFacesMap.Add( SelF ) && - !AvoidFacesMap.Contains( SelF )) - Builder.Add( Shell, SelF); - - } // loop on edges of F - - } // loop on the faces added to Shell - - // Shell is complete - myNewShells.Append( Shell ); - - } // loop on myFaces - - - // prepare to the next call - myFaces.Clear(); - myEFMap.Clear(); - - return myNewShells; -} -//======================================================================= -//function : Normal -//purpose : -//======================================================================= - gp_Vec NMTAlgo_Loop3d::Normal(const TopoDS_Edge& E, - const TopoDS_Face& F) -{ - gp_Vec Norm, V1, V2; - Standard_Real First, Last; - gp_Pnt Ps; - - Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface (E, F, First, Last); - Handle(Geom_Surface) Sf = BRep_Tool::Surface(F); - - gp_Pnt2d p = C2d->Value( 0.5*(First+Last) ); - Sf->D1(p.X(), p.Y(), Ps, V1, V2); - Norm = V1.Crossed(V2); - - if (F.Orientation() == TopAbs_REVERSED ) - Norm.Reverse(); - - return Norm; -} -//======================================================================= -//function : IsInside -//purpose : check if is inside by edge . -// if , compute : scalar production of -// normalized vectors pointing inside faces, and -// check if faces are oriented well for sewing -//======================================================================= - Standard_Boolean NMTAlgo_Loop3d::IsInside(const TopoDS_Edge& E, - const TopoDS_Face& F1, - const TopoDS_Face& F2, - const Standard_Boolean CountDot, - Standard_Real& Dot, - Standard_Boolean& GoodOri) -{ - Standard_Real f, l; - gp_Pnt P; - gp_Vec Vc1, Vc2, Vin1, Vin2, Nf1, Nf2; - Handle(Geom_Curve) Curve = BRep_Tool::Curve(E,f,l); - Curve->D1( 0.5*(f + l), P, Vc2); - TopoDS_Edge E1, E2 = FindEinF (E, F2); - if (E2.Orientation() == TopAbs_REVERSED ) Vc2.Reverse(); - - Nf1 = Normal(E,F1); - Nf2 = Normal(E,F2); - - Standard_Real sin = - Nf1.CrossSquareMagnitude(Nf2) / Nf1.SquareMagnitude() / Nf2.SquareMagnitude(); - Standard_Boolean tangent = sin < 0.001; - - Standard_Boolean inside = 0; - if (tangent) { - E1 = FindEinF (E, F1); - gp_Vec NNf1 = NextNormal(E1,F1); - gp_Vec NNf2 = NextNormal(E2,F2); - Vin2 = NNf2.Crossed(Vc2); - inside = Vin2 * NNf1 < 0; - } - else { - Vin2 = Nf2.Crossed(Vc2); - inside = Vin2 * Nf1 < 0; - } - - if (!CountDot) return inside; - - if (tangent) - Vin2 = Nf2.Crossed(Vc2); - else - E1 = FindEinF (E, F1); - - Vc1 = Vc2; - if (E1.Orientation() != E2.Orientation()) - Vc1.Reverse(); - Vin1 = Nf1.Crossed(Vc1); - - if (tangent) { - Standard_Real N1N2 = Nf1 * Nf2; - GoodOri = (Vin2 * Vin1 < 0) ? N1N2 > 0 : N1N2 < 0; - } - else { - Standard_Real V1N2 = Vin1 * Nf2; - GoodOri = ( inside ? V1N2 <= 0 : V1N2 >= 0); - } - - Vin1.Normalize(); - Vin2.Normalize(); - - Dot = Vin2 * Vin1; - - return inside; -} -//======================================================================= -//function : NextNormal -//purpose : find normal to F at point a little inside F near the middle of E -//warning : E must be properly oriented in F. -//======================================================================= -gp_Vec NextNormal(const TopoDS_Edge& E, - const TopoDS_Face& F) -{ - Standard_Real First, Last; - - Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface (E, F, First, Last); - Handle(Geom_Surface) Sf = BRep_Tool::Surface(F); - - gp_Pnt2d p; - gp_Vec2d v; - C2d->D1( 0.5*(First+Last), p, v); - if (E.Orientation() != F.Orientation()) - v.Reverse(); - gp_Dir2d dir( -v.Y(), v.X() ); // dir inside F - - Standard_Real duv = 1e-6; // this is not Ok and may give incorrect result if - // resolutionUV of compared faces is very different. To have a good result, - //it is necessary to get normal to faces at points equidistant from E in 3D - - p.SetX( p.X() + dir.X()*duv ); - p.SetY( p.Y() + dir.Y()*duv ); - - gp_Pnt Ps; - gp_Vec Norm, V1, V2; - Sf->D1( p.X(), p.Y(), Ps, V1, V2); - Norm = V1.Crossed(V2); - - if (F.Orientation() == TopAbs_REVERSED ) - Norm.Reverse(); - - return Norm; -} -//======================================================================= -//function : FindEinF -//purpose : find E in F -//======================================================================= -TopoDS_Edge FindEinF(const TopoDS_Edge& E, - const TopoDS_Face& F) -{ - TopExp_Explorer expl (F, TopAbs_EDGE); - for (; expl.More(); expl.Next()) - if( E.IsSame( expl.Current() )) - return TopoDS::Edge(expl.Current()); - TopoDS_Edge nullE; - return nullE; -} diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.hxx b/src/NMTAlgo/NMTAlgo_Loop3d.hxx deleted file mode 100644 index b0dfb5adb..000000000 --- a/src/NMTAlgo/NMTAlgo_Loop3d.hxx +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTAlgo_Loop3d_HeaderFile -#define _NMTAlgo_Loop3d_HeaderFile - -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -class TopoDS_Shape; -class TopTools_ListOfShape; -class TopTools_MapOfOrientedShape; -class TopoDS_Edge; -class TopoDS_Face; -class gp_Vec; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class NMTAlgo_Loop3d { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT NMTAlgo_Loop3d(); -Standard_EXPORT void AddConstFaces(const TopoDS_Shape& S) ; -Standard_EXPORT void AddSectionFaces(const TopoDS_Shape& S) ; -Standard_EXPORT const TopTools_ListOfShape& MakeShells(const TopTools_MapOfOrientedShape& AvoidFacesMap) ; -Standard_EXPORT static Standard_Boolean IsInside(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const Standard_Boolean CountDot,Standard_Real& Dot,Standard_Boolean& GoodOri) ; -Standard_EXPORT static gp_Vec Normal(const TopoDS_Edge& E,const TopoDS_Face& F) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopTools_ListOfShape myNewShells; -TopTools_ListOfShape myFaces; -TopTools_IndexedDataMapOfShapeListOfShape myEFMap; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.ixx b/src/NMTAlgo/NMTAlgo_Loop3d.ixx deleted file mode 100644 index 97c229d65..000000000 --- a/src/NMTAlgo/NMTAlgo_Loop3d.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.jxx b/src/NMTAlgo/NMTAlgo_Loop3d.jxx deleted file mode 100644 index 02c10b8dd..000000000 --- a/src/NMTAlgo/NMTAlgo_Loop3d.jxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfOrientedShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _gp_Vec_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Loop3d_HeaderFile -#include -#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter.cdl b/src/NMTAlgo/NMTAlgo_Splitter.cdl deleted file mode 100644 index 48f5dbd6e..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter.cdl +++ /dev/null @@ -1,200 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTAlgo_Splitter.cdl --- Created: Tue Jan 27 15:09:45 2004 --- Author: Peter KURNEV - - -class Splitter from NMTAlgo - inherits Builder from NMTAlgo - - ---Purpose: - -uses - Builder from BRep, - ShapeEnum from TopAbs, - Compound from TopoDS, - Face from TopoDS, - Edge from TopoDS, - Shape from TopoDS, - MapOfOrientedShape from TopTools, - IndexedMapOfShape from TopTools, - DataMapOfShapeShape from TopTools, - DataMapOfShapeListOfShape from TopTools, - ListOfShape from TopTools, - MapOfShape from TopTools, - AsDes from BRepAlgo, - Image from BRepAlgo, - - DSFiller from NMTTools - ---raises - -is - Create - returns Splitter from NMTAlgo; - ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Splitter();" - - AddShape (me:out; - S : Shape from TopoDS) - is virtual; - - AddTool (me:out; - S : Shape from TopoDS) - is virtual; - - Compute(me:out) - is virtual; - - Build (me:out; - aLimit:ShapeEnum from TopAbs=TopAbs_SHAPE) - is virtual; - - ComputeWithFiller(me:out; - aDSF: DSFiller from NMTTools) - is redefined; - -----vv - KeepShapesInside (me:out; - S : Shape from TopoDS); - ---Purpose: remove shapes that are outside of S from result. - -- S should be an object shape. - ---Warning: call it after Build() - - RemoveShapesInside (me:out; - S : Shape from TopoDS); - ---Purpose: remove shapes that are inside S from result. - -- S should be an object shape. - ---Warning: call it after Build() - - Modified(me:out; - S : Shape from TopoDS) - returns ListOfShape from TopTools; - ---Purpose: Returns the list of shapes modified from the shape . - ---C++: return const & - ---Level: Public - - Generated(me:out; - S : Shape from TopoDS) - returns ListOfShape from TopTools; - ---Purpose: Returns the list of shapes generated from the shape . - ---C++: return const & - ---Level: Public - - IsDeleted (me:out; - S : Shape from TopoDS) - returns Boolean from Standard; -----^^ - - Clear (me:out) - is redefined; - - SourceShapes(me) - returns ListOfShape from TopTools; - ---C++: return const & - - FillResult(me:out) - is protected; - - FillImageShape(me:out) - is protected; - - SplittedFaces (me:out) - is protected; - - SplittedWires (me:out) - is protected; - - SplitsAndSections (me:out) - is protected; - - ShellsAndSolids(me:out) - is protected; - - MakeShells(me:out; - aS :Shape from TopoDS; - aLNS:out ListOfShape from TopTools) - is protected; - - MakeSolids (me:out; - Solid : Shape from TopoDS; - Shells: out ListOfShape from TopTools) - is protected; - - FindFacesInside (me:out; - S : Shape from TopoDS; - CheckClosed : Boolean from Standard= Standard_False; - All : Boolean from Standard= Standard_False) - returns Shape from TopoDS - is protected; - - IsInside (myclass; - S1,S2 : Shape from TopoDS) - returns Boolean from Standard is protected; - ---Purpose: Return True if the first vertex of S1 inside S2. - -- If S1.IsNull(), check infinite point against S2. - - GetOriginalShape(me; - aShape : Shape from TopoDS) - returns Shape from TopoDS - is protected; - ---modified by NIZNHY-PKV Tue Feb 1 10:24:39 2005f - FindImage(me:out; - aS : Shape from TopoDS; - aLIms: out ListOfShape from TopTools) - is protected; ---modified by NIZNHY-PKV Tue Feb 1 10:24:47 2005t - -fields - myDoneStep : ShapeEnum from TopAbs is protected; -- rebuilt level - myBuilder : Builder from BRep is protected; - - myListShapes : ListOfShape from TopTools is protected; -- object shapes - myMapFaces : MapOfShape from TopTools is protected; -- object faces - myMapTools : MapOfShape from TopTools is protected; -- tool faces - myEqualEdges : MapOfShape from TopTools is protected; -- equal splits - myNewSection : MapOfShape from TopTools is protected; -- new secton edges - myClosedShapes : MapOfShape from TopTools is protected; - myWrappingSolid: MapOfShape from TopTools is protected; -- solids having other shapes inside - myFaceShapeMap : DataMapOfShapeShape from TopTools is protected; -- to find a shape by face - - myInternalFaces: DataMapOfShapeShape from TopTools is protected; -- shape and its internal faces - myIntNotClFaces: DataMapOfShapeShape from TopTools is protected; -- internal but not closed - - myImageShape : Image from BRepAlgo is protected; - - -- avoid rebuilding twice commont part of solids - myAddedFacesMap: MapOfOrientedShape from TopTools is protected; - --***-- - mySourceShapes : ListOfShape from TopTools is protected; - myLimit : ShapeEnum from TopAbs is protected; - myToolShapes : MapOfShape from TopTools is protected; - myObjShapes : MapOfShape from TopTools is protected; - myMapSIFC : DataMapOfShapeShape from TopTools is protected; -----vv - myGenerated : ListOfShape from TopTools is protected; - --modified by NIZNHY-PKV Mon Jan 24 09:45:10 2005f - myModifiedFaces: DataMapOfShapeListOfShape from TopTools is protected; - --modified by NIZNHY-PKV Mon Jan 24 09:45:14 2005t -----^^ -end Splitter; diff --git a/src/NMTAlgo/NMTAlgo_Splitter.cxx b/src/NMTAlgo/NMTAlgo_Splitter.cxx deleted file mode 100644 index 56a5de310..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter.cxx +++ /dev/null @@ -1,632 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTAlgo_Splitter.cxx -// Created: Thu Jan 29 17:13:03 2004 -// Author: Peter KURNEV -// -// -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -// -#include -#include -#include -#include - - -static - Standard_Boolean isClosed(const TopoDS_Shape& theShape); - -//======================================================================= -//function : NMTAlgo_Spliter::NMTAlgo_Splitter -//purpose : -//======================================================================= - NMTAlgo_Splitter::NMTAlgo_Splitter() -: - NMTAlgo_Builder() -{ - myErrorStatus=0; -} -//======================================================================= -// function: ~NMTAlgo_Splitter -// purpose: -//======================================================================= - NMTAlgo_Splitter::~NMTAlgo_Splitter() -{ - Clear(); - - if (myDSFiller){ - delete myDSFiller; - } -} -//======================================================================= -// function: SourceShapes -// purpose: -//======================================================================= - const TopTools_ListOfShape& NMTAlgo_Splitter::SourceShapes()const -{ - return mySourceShapes; -} -//======================================================================= -//function : Clear -//purpose : -//======================================================================= - void NMTAlgo_Splitter::Clear() -{ - NMTAlgo_Builder::Clear(); - // - myListShapes.Clear(); - myMapFaces.Clear(); - myMapTools.Clear(); - myClosedShapes.Clear(); - myEqualEdges.Clear(); - myNewSection.Clear(); - myWrappingSolid.Clear(); - myFaceShapeMap.Clear(); - myInternalFaces.Clear(); - myIntNotClFaces.Clear(); - // - myImageShape.Clear(); - myAddedFacesMap.Clear(); - // - myDoneStep = TopAbs_SHAPE; - myIsComputed=Standard_False; - mySourceShapes.Clear(); - myObjShapes.Clear(); - myToolShapes.Clear(); - myMapSIFC.Clear(); - //modified by NIZNHY-PKV Mon Jan 24 09:47:37 2005f - myModifiedFaces.Clear(); - //modified by NIZNHY-PKV Mon Jan 24 09:47:41 2005t - myErrorStatus=0; -} -//======================================================================= -//function : AddShape -//purpose : add object Shape to be splited -//======================================================================= - void NMTAlgo_Splitter::AddShape(const TopoDS_Shape& aS) -{ - myErrorStatus=0; - if (myIsComputed) { - // DS is already computed - myErrorStatus=100; - return; - } - // - if (aS.IsNull()){ - // Null shape is not allowed here - myErrorStatus=101; - return; - } - // - TopAbs_ShapeEnum aType=aS.ShapeType(); - // - if (aType < TopAbs_SOLID) { - // compound or compsolid - TopoDS_Iterator it (aS); - for (; it.More(); it.Next()) { - const TopoDS_Shape& aSS=it.Value(); - AddShape(aSS); - // to know compound by shape - myFaceShapeMap.Bind(aSS, aS); - } - return; - } - //--- - myObjShapes.Add(aS); - mySourceShapes.Append(aS); - //--- - // - TopExp_Explorer exp(aS, TopAbs_FACE); - if (!exp.More()) { - // do not split edges and vertices - return; - } - // not to add twice the same S - Standard_Integer nbFacesBefore = myMapFaces.Extent(); - // - for (; exp.More(); exp.Next()) { - const TopoDS_Shape& aFace = exp.Current(); - if (!myFaceShapeMap.IsBound(aFace)) { - // keep shape of tool face added as object - myFaceShapeMap.Bind(aFace, aS); - } - if (myMapFaces.Add(aFace)){ - myImagesFaces.SetRoot(aFace); - } - } - // - if (nbFacesBefore == myMapFaces.Extent()){ - return; - } - // solids must be processed before all - if (aType==TopAbs_SOLID){ - myListShapes.Prepend(aS); - } - else{ - myListShapes.Append(aS); - } - if (isClosed(aS)){ - myClosedShapes.Add(aS); - } -} -//======================================================================= -//function : AddTool -//purpose : add cutting tool that will _NOT_ be in result -//======================================================================= - void NMTAlgo_Splitter::AddTool(const TopoDS_Shape& aS) -{ - myErrorStatus=0; - if (myIsComputed) { - // DS is already computed - myErrorStatus=100; - return; - } - // - if (aS.IsNull()){ - // Null shape is not allowed here - myErrorStatus=101; - return; - } - // - TopAbs_ShapeEnum aType=aS.ShapeType(); - - if (aType < TopAbs_SOLID) { // compound or compsolid - TopoDS_Iterator it (aS); - for (; it.More(); it.Next()) { - const TopoDS_Shape& aSS=it.Value(); - AddTool(aSS); - myFaceShapeMap.Bind(aSS, aS); // to know compound by shape - } - return; - } - //--- - myToolShapes.Add(aS); - mySourceShapes.Append(aS); - //--- - // - TopExp_Explorer exp(aS, TopAbs_FACE); - for (; exp.More(); exp.Next()) { - const TopoDS_Shape& aFace = exp.Current(); - myMapTools.Add(aFace); - myFaceShapeMap.Bind(aFace, aS); - } - // - // solids must be processed before all - if (aType==TopAbs_SOLID){ - myListShapes.Prepend(aS); - } - else{ - myListShapes.Append(aS); - } - // - if (isClosed(aS)) { - myClosedShapes.Add(aS); - } -} -//======================================================================= -// function: Compute -// purpose: -//======================================================================= - void NMTAlgo_Splitter::Compute() -{ - if (!mySourceShapes.Extent()){ - // No source shapes to treat - myErrorStatus=103; - return; - } - // - BRep_Builder aBB; - TopoDS_Compound aCS; - TopTools_ListIteratorOfListOfShape aIt; - // - aBB.MakeCompound(aCS); - // - aIt.Initialize(mySourceShapes); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - aBB.Add(aCS, aS); - } - // - NMTTools_DSFiller* pDSF=new NMTTools_DSFiller; - // - pDSF->SetCompositeShape(aCS); - pDSF->Perform(); - // - myIsComputed=Standard_False; - // - NMTAlgo_Splitter::ComputeWithFiller(*pDSF); -} -//======================================================================= -// function: ComputeWithFiller -// purpose: -//======================================================================= - void NMTAlgo_Splitter::ComputeWithFiller(const NMTTools_DSFiller& aDSF) -{ - myErrorStatus=0; - // - if (myIsComputed) { - // DS is already computed - myErrorStatus=100; - return; - } - // - if (!mySourceShapes.Extent()) { - // No source shapes to treat - myErrorStatus=103; - return; - } - // - if (!aDSF.IsDone()) { - // NMTTools_DSFiller failed - myErrorStatus=104; - return; - } - // - NMTAlgo_Builder::ComputeWithFiller(aDSF); - // - myIsComputed=Standard_True; -} -//======================================================================= -//function : Build -//purpose : -//======================================================================= - void NMTAlgo_Splitter::Build(const TopAbs_ShapeEnum aLimit) -{ - myErrorStatus=0; - myLimit=aLimit; - // - if (!myIsComputed){ - myErrorStatus=102;// DS is not computed - return; - } - // - TopoDS_Compound aCShape; - // - myBuilder.MakeCompound(aCShape); - myShape=aCShape; - // - // 1. VERTEX - // - if (myLimit==TopAbs_VERTEX) { - SplitVertices(); - FillResult(); - return; - } - // - // 2. EDGE - if (myLimit==TopAbs_EDGE) { - SplitsAndSections(); - FillResult(); - return; - } - // - // 3. WIRE - FillImageShape(); - // - if (myLimit==TopAbs_WIRE) { - SplittedWires(); - FillResult(); - return; - } - // - // 4. FACE - // - if (myLimit==TopAbs_FACE) { - SplittedFaces(); - FillResult(); - return; - } - // - // 5.6. SHELL / SOLID - ShellsAndSolids(); - BOP_CorrectTolerances::CorrectTolerances(myShape, 0.01); -} -//======================================================================= -// function: SplitsAndSections -// purpose: -//======================================================================= - void NMTAlgo_Splitter::SplitsAndSections() -{ - Standard_Integer i, aNbE, aNbF; - TopTools_ListIteratorOfListOfShape aItLS, aIt; - TopTools_IndexedMapOfShape aME, aMF; - // - myQueryShapes.Clear(); - // - // 1. Splits / no splits - aItLS.Initialize(myListShapes); - for ( ;aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aS=aItLS.Value(); - // - if (myToolShapes.Contains(aS)) { - continue; // skip tool Shapes - } - // - TopExp::MapShapes(aS, TopAbs_EDGE, aME); - TopExp::MapShapes(aS, TopAbs_FACE, aMF); - } - // - // 1. Splits / no splits - aNbE=aME.Extent(); - for (i=1; i<=aNbE; ++i) { - const TopoDS_Shape& aE=aME(i); - // - if (!myImagesEdges.HasImage(aE)) { - myQueryShapes.Add(aE); - } - else { - const TopTools_ListOfShape& aLSp=myImagesEdges.Image(aE); - // - aIt.Initialize(aLSp); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSp=aIt.Value(); - myQueryShapes.Add(aSp); - } - } - } - // - // 2. Sections - aNbF=aMF.Extent(); - for (i=1; i<=aNbF; ++i) { - const TopoDS_Shape& aF=aMF(i); - if (mySectionParts.Contains(aF)) { - const TopTools_ListOfShape& aLSc=mySectionParts.FindFromKey(aF); - aIt.Initialize(aLSc); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSc=aIt.Value(); - myQueryShapes.Add(aSc); - } - } - } -} -//======================================================================= -// function: SplittedWires -// purpose: -//======================================================================= - void NMTAlgo_Splitter::SplittedWires() -{ - Standard_Integer i, aNbF; - TopoDS_Iterator aIt; - TopTools_IndexedMapOfShape aMF; - // - SplittedFaces(); - // - aMF=myQueryShapes; - myQueryShapes.Clear(); - // - aNbF=aMF.Extent(); - for (i=1; i<=aNbF; ++i) { - const TopoDS_Shape& aF=aMF(i); - aIt.Initialize(aF); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aW=aIt.Value(); - myQueryShapes.Add(aW); - } - } -} -//======================================================================= -// function: SplittedFaces -// purpose: -//======================================================================= - void NMTAlgo_Splitter::SplittedFaces() -{ - TopTools_ListIteratorOfListOfShape aIt; - TopoDS_Iterator aItF; - // - myQueryShapes.Clear(); - // - aIt.Initialize(myListShapes); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - // - if (myToolShapes.Contains(aS)) { - continue; - } - // - const TopoDS_Shape& aFC = myImageShape.Image(aS).First(); - aItF.Initialize(aFC); - for (; aItF.More(); aItF.Next()) { - const TopoDS_Shape& aF=aItF.Value(); - myQueryShapes.Add(aF); - } - } -} -//======================================================================= -//function : FillImageShape -//purpose : -//======================================================================= - void NMTAlgo_Splitter::FillImageShape() -{ - Standard_Integer i, aNbF, iSense; - TopTools_ListIteratorOfListOfShape aItS, aItFI; - TopExp_Explorer aExp; - TopAbs_Orientation aOriFS; - TopoDS_Face aFIx, aFIy; - BRep_Builder aBB; - // - myImageShape.Clear(); - //modified by NIZNHY-PKV Mon Jan 24 09:48:15 2005f - myModifiedFaces.Clear(); - //modified by NIZNHY-PKV Mon Jan 24 09:48:18 2005t - // - aItS.Initialize(myListShapes); - for ( ;aItS.More(); aItS.Next()) { - const TopoDS_Shape& aS=aItS.Value(); - // - myQueryShapes.Clear(); - // - aExp.Init(aS, TopAbs_FACE); - for (; aExp.More(); aExp.Next()) { - const TopoDS_Face& aFS=TopoDS::Face(aExp.Current()); - aOriFS= aFS.Orientation(); - // - if (!myImagesFaces.HasImage(aFS)) { - myQueryShapes.Add(aFS); - //modified by NIZNHY-PKV Mon Jan 24 09:50:42 2005 f - if (!myModifiedFaces.IsBound(aFS)) { - TopTools_ListOfShape aLS; - // - aLS.Append(aFS); - myModifiedFaces.Bind(aFS, aLS); - } - //modified by NIZNHY-PKV Mon Jan 24 09:50:44 2005 t - continue; - } - // - const TopTools_ListOfShape& aLFI=myImagesFaces.Image(aFS); - aItFI.Initialize(aLFI); - for (; aItFI.More(); aItFI.Next()) { - const TopoDS_Face& aFI=TopoDS::Face(aItFI.Value()); - aFIx=aFI; - aFIx.Orientation(aOriFS); - // - if (mySDFaces.Contains(aFIx)) { - const TopoDS_Face& aFSDI=TopoDS::Face(mySDFaces.FindFromKey(aFIx)); - TopoDS_Face aFSDIx=aFSDI; - // - iSense=NMTAlgo_Tools::Sense(aFIx, aFSDIx); - // - if (iSense < 0) { - aFSDIx.Reverse(); - } - myQueryShapes.Add(aFSDIx); - //modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f - aFIy=aFSDIx; - //modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t - } - else { - myQueryShapes.Add(aFIx); - //modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f - aFIy=aFIx; - //modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t - } - //modified by NIZNHY-PKV Mon Jan 24 09:53:38 2005f - if (!myModifiedFaces.IsBound(aFS)) { - TopTools_ListOfShape aLS; - // - aLS.Append(aFIy); - myModifiedFaces.Bind(aFS, aLS); - } - else { - TopTools_ListOfShape& aLS=myModifiedFaces.ChangeFind(aFS); - aLS.Append(aFIy); - } - //modified by NIZNHY-PKV Mon Jan 24 09:53:43 2005t - } - }//for (; aExp.More(); aExp.Next()) { - // - TopoDS_Compound aCompound; - // - aBB.MakeCompound(aCompound); - // - aNbF=myQueryShapes.Extent(); - for (i=1; i<=aNbF; ++i) { - const TopoDS_Shape& aF=myQueryShapes(i); - aBB.Add(aCompound, aF); - } - // - myImageShape.Bind(aS, aCompound); - }// for ( ;aItS.More(); aItS.Next()) - // - myQueryShapes.Clear(); -} -//======================================================================= -//function : FillResult -//purpose : -//======================================================================= - void NMTAlgo_Splitter::FillResult() -{ - Standard_Integer i, aNb; - // - aNb=myQueryShapes.Extent(); - for (i=1; i<=aNb; ++i) { - const TopoDS_Shape& aS=myQueryShapes(i); - myBuilder.Add (myShape, aS); - } - BOP_CorrectTolerances::CorrectTolerances(myShape, 0.01); -} -//======================================================================= -//function : isClosed -//purpose : check id a shape is closed, ie is a solid or a closed shell -//======================================================================= - Standard_Boolean isClosed(const TopoDS_Shape& theShape) -{ - Standard_Boolean isClosed = (theShape.ShapeType() == TopAbs_SOLID); - // - if (!isClosed && theShape.ShapeType() == TopAbs_SHELL) { - TopTools_IndexedDataMapOfShapeListOfShape MEF; - TopExp::MapShapesAndAncestors(theShape, TopAbs_EDGE, TopAbs_FACE, MEF); - for (Standard_Integer i=1; isClosed && i<=MEF.Extent(); ++i) - isClosed = ( MEF(i).Extent() != 1 ); - } - // - return isClosed; -} -// -// myErrorStatus -// -// 100 - DS is already computed -// 101 - Null shape is not allowed here -// 102 - DS is not computed -// 103 - No source shapes to treat -// 104 - NMTTools_DSFiller failed diff --git a/src/NMTAlgo/NMTAlgo_Splitter.hxx b/src/NMTAlgo/NMTAlgo_Splitter.hxx deleted file mode 100644 index 64aa244e4..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter.hxx +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTAlgo_Splitter_HeaderFile -#define _NMTAlgo_Splitter_HeaderFile - -#ifndef _TopAbs_ShapeEnum_HeaderFile -#include -#endif -#ifndef _BRep_Builder_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _BRepAlgo_Image_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfOrientedShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Builder_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class TopoDS_Shape; -class NMTTools_DSFiller; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class NMTAlgo_Splitter : public NMTAlgo_Builder { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT NMTAlgo_Splitter(); -Standard_EXPORT virtual ~NMTAlgo_Splitter(); -Standard_EXPORT virtual void AddShape(const TopoDS_Shape& S) ; -Standard_EXPORT virtual void AddTool(const TopoDS_Shape& S) ; -Standard_EXPORT virtual void Compute() ; -Standard_EXPORT virtual void Build(const TopAbs_ShapeEnum aLimit = TopAbs_SHAPE) ; -Standard_EXPORT virtual void ComputeWithFiller(const NMTTools_DSFiller& aDSF) ; -Standard_EXPORT void KeepShapesInside(const TopoDS_Shape& S) ; -Standard_EXPORT void RemoveShapesInside(const TopoDS_Shape& S) ; -Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ; -Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ; -Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S) ; -Standard_EXPORT virtual void Clear() ; -Standard_EXPORT const TopTools_ListOfShape& SourceShapes() const; - - - - - -protected: - - // Methods PROTECTED - // -Standard_EXPORT void FillResult() ; -Standard_EXPORT void FillImageShape() ; -Standard_EXPORT void SplittedFaces() ; -Standard_EXPORT void SplittedWires() ; -Standard_EXPORT void SplitsAndSections() ; -Standard_EXPORT void ShellsAndSolids() ; -Standard_EXPORT void MakeShells(const TopoDS_Shape& aS,TopTools_ListOfShape& aLNS) ; -Standard_EXPORT void MakeSolids(const TopoDS_Shape& Solid,TopTools_ListOfShape& Shells) ; -Standard_EXPORT TopoDS_Shape FindFacesInside(const TopoDS_Shape& S,const Standard_Boolean CheckClosed = Standard_False,const Standard_Boolean All = Standard_False) ; -Standard_EXPORT static Standard_Boolean IsInside(const TopoDS_Shape& S1,const TopoDS_Shape& S2) ; -Standard_EXPORT TopoDS_Shape GetOriginalShape(const TopoDS_Shape& aShape) const; -Standard_EXPORT void FindImage(const TopoDS_Shape& aS,TopTools_ListOfShape& aLIms) ; - - - // Fields PROTECTED - // -TopAbs_ShapeEnum myDoneStep; -BRep_Builder myBuilder; -TopTools_ListOfShape myListShapes; -TopTools_MapOfShape myMapFaces; -TopTools_MapOfShape myMapTools; -TopTools_MapOfShape myEqualEdges; -TopTools_MapOfShape myNewSection; -TopTools_MapOfShape myClosedShapes; -TopTools_MapOfShape myWrappingSolid; -TopTools_DataMapOfShapeShape myFaceShapeMap; -TopTools_DataMapOfShapeShape myInternalFaces; -TopTools_DataMapOfShapeShape myIntNotClFaces; -BRepAlgo_Image myImageShape; -TopTools_MapOfOrientedShape myAddedFacesMap; -TopTools_ListOfShape mySourceShapes; -TopAbs_ShapeEnum myLimit; -TopTools_MapOfShape myToolShapes; -TopTools_MapOfShape myObjShapes; -TopTools_DataMapOfShapeShape myMapSIFC; -TopTools_ListOfShape myGenerated; -TopTools_DataMapOfShapeListOfShape myModifiedFaces; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter.ixx b/src/NMTAlgo/NMTAlgo_Splitter.ixx deleted file mode 100644 index 53377eb6e..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTAlgo/NMTAlgo_Splitter.jxx b/src/NMTAlgo/NMTAlgo_Splitter.jxx deleted file mode 100644 index f76213b04..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _NMTTools_DSFiller_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Splitter_HeaderFile -#include -#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.cdl b/src/NMTAlgo/NMTAlgo_Splitter1.cdl deleted file mode 100644 index 8449ca340..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter1.cdl +++ /dev/null @@ -1,92 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTAlgo_Splitter1.cdl --- Created: Wed Feb 11 14:23:25 2004 --- Author: Peter KURNEV - - -class Splitter1 from NMTAlgo - inherits Splitter from NMTAlgo - - ---Purpose: - -uses - ShapeEnum from TopAbs, - Shape from TopoDS, - DataMapOfShapeInteger from TopTools - ---raises - -is - Create - returns Splitter1 from NMTAlgo; - ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Splitter1();" - - Clear (me:out) - is redefined; - - AddShape (me:out; - aS : Shape from TopoDS) - is redefined; - - - AddTool(me:out; - aS : Shape from TopoDS) - is redefined; - - - SetMaterial (me:out; - aS : Shape from TopoDS; - aM : Integer from Standard=0); - - SetRemoveWebs(me:out; - bFlag:Boolean from Standard); - - RemoveWebs(me) - returns Boolean from Standard; - - GetMaterialTable(me) - returns DataMapOfShapeInteger from TopTools; - ---C++: return const & - - Build (me:out; - Limit:ShapeEnum from TopAbs=TopAbs_SHAPE) - is redefined; - - -- protected block - TreatSolids (me:out) - is protected; - - TreatWebs (me:out) - is protected; - - RestParts (me:out) - is protected; - - -fields - myRemoveWebs : Boolean from Standard is protected; - myMapSWM : DataMapOfShapeInteger from TopTools is protected; - myMapSWMOut : DataMapOfShapeInteger from TopTools is protected; - myRestParts : Shape from TopoDS is protected; - -end Splitter1; diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.cxx b/src/NMTAlgo/NMTAlgo_Splitter1.cxx deleted file mode 100644 index 911e7a8f9..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter1.cxx +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTAlgo_Splitter1.cxx -// Created: Wed Feb 11 14:26:27 2004 -// Author: Peter KURNEV -// -// -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//function : NMTAlgo_Spliter1::NMTAlgo_Splitter1 -//purpose : -//======================================================================= - NMTAlgo_Splitter1::NMTAlgo_Splitter1() -: - NMTAlgo_Splitter() -{ - myRemoveWebs=Standard_False; -} -//======================================================================= -// function: ~NMTAlgo_Splitter1 -// purpose: -//======================================================================= - NMTAlgo_Splitter1::~NMTAlgo_Splitter1() -{ - Clear(); -} -//======================================================================= -//function : Clear -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::Clear() -{ - NMTAlgo_Splitter::Clear(); - // - myRemoveWebs=Standard_False; - myMapSWM.Clear(); - myMapSWMOut.Clear(); -} -//======================================================================= -//function : SetRemoveWebs -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::SetRemoveWebs(const Standard_Boolean bFlag) -{ - myRemoveWebs=bFlag; -} -//======================================================================= -//function : RemoveWebs -//purpose : -//======================================================================= - Standard_Boolean NMTAlgo_Splitter1::RemoveWebs()const -{ - return myRemoveWebs; -} -//======================================================================= -//function : GetMaterialTable -//purpose : -//======================================================================= - const TopTools_DataMapOfShapeInteger& NMTAlgo_Splitter1::GetMaterialTable()const -{ - return myMapSWMOut; -} -//======================================================================= -//function : SetMaterial -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::SetMaterial(const TopoDS_Shape& aS, - const Standard_Integer iMt) -{ - TopExp_Explorer aExp; - // - aExp.Init(aS, TopAbs_SOLID); - for(; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aSd=aExp.Current(); - myMapSWM.Bind(aSd, iMt); - } -} -//======================================================================= -//function : AddShape -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::AddShape(const TopoDS_Shape& aS) -{ - SetMaterial(aS, 0); - NMTAlgo_Splitter::AddShape(aS); -} -//======================================================================= -//function : AddToolWithMaterial -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::AddTool(const TopoDS_Shape& aS) - -{ - SetMaterial(aS, 0); - NMTAlgo_Splitter::AddTool(aS); -} -//======================================================================= -//function : Build -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::Build(const TopAbs_ShapeEnum aLimit) -{ - NMTAlgo_Splitter::Build(aLimit); - // - myMapSWMOut.Clear(); - // - TreatSolids(); - // - if (myRemoveWebs && myMapSWMOut.Extent()) { - RestParts(); - TreatWebs(); - } -} -//======================================================================= -//function : TreatWebs -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::TreatWebs() -{ - Standard_Integer nMt; - TopTools_DataMapOfIntegerListOfShape aMMLS; - TopoDS_Iterator aIt; - TopTools_DataMapIteratorOfDataMapOfShapeInteger aIt2; - TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape aIt1; - TopTools_ListIteratorOfListOfShape aItS; - TopoDS_Compound aCx; - TopoDS_Shape aCSR; - // - aIt2.Initialize(myMapSWMOut); - for (; aIt2.More(); aIt2.Next()) { - const TopoDS_Shape& aS=aIt2.Key(); - nMt=aIt2.Value(); - // - if (aMMLS.IsBound(nMt)){ - TopTools_ListOfShape& aLS=aMMLS.ChangeFind(nMt); - aLS.Append(aS); - } - else { - TopTools_ListOfShape aLS; - aLS.Append(aS); - aMMLS.Bind(nMt, aLS); - } - } - // - myMapSWMOut.Clear(); - myBuilder.MakeCompound(aCx); - // - aIt1.Initialize(aMMLS); - for (; aIt1.More(); aIt1.Next()) { - nMt=aIt1.Key(); - // - TopoDS_Compound aCS; - myBuilder.MakeCompound(aCS); - const TopTools_ListOfShape& aLS=aIt1.Value(); - aItS.Initialize(aLS); - for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aS=aItS.Value(); - myBuilder.Add(aCS, aS); - } - // - NMTAlgo_Tools::BreakWebs(aCS, aCSR); - // - aIt.Initialize(aCSR); - for(; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - myBuilder.Add(aCx, aS); - // - myMapSWMOut.Bind(aS, nMt); - } - } - // - aIt.Initialize(myRestParts); - for(; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - myBuilder.Add(aCx, aS); - } - // - myShape=aCx; -} - -//======================================================================= -//function : RestParts -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::RestParts() -{ - TopoDS_Iterator aIt; - TopoDS_Compound aR; - // - myBuilder.MakeCompound(aR); - // - aIt.Initialize(myShape); - for(; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Value(); - if (aS.ShapeType()==TopAbs_SOLID){ - if (myMapSWMOut.IsBound(aS)) { - continue; - } - } - myBuilder.Add(aR, aS); - } - myRestParts=aR; -} -//======================================================================= -//function : TreatSolids -//purpose : -//======================================================================= - void NMTAlgo_Splitter1::TreatSolids() -{ - Standard_Integer i, j, aNbSd, aNbSdx, nMtMax, nMt; - TopAbs_ShapeEnum aType; - TopoDS_Iterator aIt; - TopTools_IndexedMapOfShape aMSo, aMSd; - TopTools_IndexedDataMapOfShapeListOfShape aMFS; - TopTools_ListIteratorOfListOfShape aItS, aItLS; - NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMCS; - // - TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); - TopExp::MapShapes(myShape, TopAbs_SOLID, aMSo); - // - aNbSd=aMSo.Extent(); - if (!aNbSd) { - return; - } - // - aItS.Initialize(myListShapes); - for ( ;aItS.More(); aItS.Next()) { - const TopoDS_Shape& aS=aItS.Value(); - // - aType=aS.ShapeType(); - if (aType != TopAbs_SOLID) { - continue; - } - // - if (myToolShapes.Contains(aS)) { - continue; - } - // - if (!myMapSIFC.IsBound(aS)){ - continue; - } - // - aMSd.Clear(); - // - const TopoDS_Shape& aIFC=myMapSIFC.Find(aS); - // - aIt.Initialize(aIFC); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aIF=aIt.Value(); - if (aMFS.Contains(aIF)) { - const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aIF); - aItLS.Initialize(aLS); - for ( ;aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aSd=aItLS.Value(); - if (!aMSd.Contains(aSd)) { - aMSd.Add(aSd); - } - } - } - } - // - aNbSd=aMSd.Extent(); - if (!aNbSd) { - //modified by NIZNHY-PKV Thu Dec 23 15:07:46 2004 f - Standard_Boolean bFound; - //modified by NIZNHY-PKV Thu Dec 23 15:07:49 2004 t - TopoDS_Shape aSd; - // - const TopoDS_Shape& aFC=myImageShape.Image(aS).First(); - //modified by NIZNHY-PKV Thu Dec 23 15:08:17 2004 f - //NMTAlgo_Tools::FindImageSolid(aFC, aMSo, aSd); - //aMSd.Add(aSd); - bFound=NMTAlgo_Tools::FindImageSolid(aFC, aMSo, aSd); - if (!aSd.IsNull()) { - aMSd.Add(aSd); - } - //modified by NIZNHY-PKV Thu Dec 23 15:09:02 2004 t - } - aMCS.Add(aS, aMSd); - } //for ( ;aItS.More(); aItS.Next()) - // - aMFS.Clear(); - // - aNbSd=aMCS.Extent(); - for (i=1; i<=aNbSd; ++i) { - const TopoDS_Shape& aSd=aMCS.FindKey(i); - const TopTools_IndexedMapOfShape& aMSdx=aMCS(i); - aNbSdx=aMSdx.Extent(); - for (j=1; j<=aNbSdx; ++j) { - const TopoDS_Shape& aSdx=aMSdx(j); - // - if (aMFS.Contains(aSdx)) { - TopTools_ListOfShape& aLS=aMFS.ChangeFromKey(aSdx); - aLS.Append(aSd); - } - else { - TopTools_ListOfShape aLS; - aLS.Append(aSd); - aMFS.Add(aSdx, aLS); - } - } - } - // - // Assign materials values to subsolids - // - myMapSWMOut.Clear(); - // - aNbSdx=aMFS.Extent(); - for (i=1; i<=aNbSdx; ++i) { - const TopoDS_Shape& aSdx=aMFS.FindKey(i); - const TopTools_ListOfShape& aLS=aMFS(i); - aItLS.Initialize(aLS); - for (j=0; aItLS.More(); aItLS.Next(), ++j) { - const TopoDS_Shape& aSd=aItLS.Value(); - // - if (!myMapSWM.IsBound(aSd)){ - continue; - } - // - nMt=myMapSWM.Find(aSd); - if (!j) { - nMtMax=nMt; - continue; - } - if (nMt>nMtMax) { - nMtMax=nMt; - } - } - myMapSWMOut.Bind(aSdx, nMtMax); - } - // -} diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.hxx b/src/NMTAlgo/NMTAlgo_Splitter1.hxx deleted file mode 100644 index c9e733d3e..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter1.hxx +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTAlgo_Splitter1_HeaderFile -#define _NMTAlgo_Splitter1_HeaderFile - -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Splitter_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile -#include -#endif -class TopoDS_Shape; -class TopTools_DataMapOfShapeInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class NMTAlgo_Splitter1 : public NMTAlgo_Splitter { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT NMTAlgo_Splitter1(); -Standard_EXPORT virtual ~NMTAlgo_Splitter1(); -Standard_EXPORT virtual void Clear() ; -Standard_EXPORT virtual void AddShape(const TopoDS_Shape& aS) ; -Standard_EXPORT virtual void AddTool(const TopoDS_Shape& aS) ; -Standard_EXPORT void SetMaterial(const TopoDS_Shape& aS,const Standard_Integer aM = 0) ; -Standard_EXPORT void SetRemoveWebs(const Standard_Boolean bFlag) ; -Standard_EXPORT Standard_Boolean RemoveWebs() const; -Standard_EXPORT const TopTools_DataMapOfShapeInteger& GetMaterialTable() const; -Standard_EXPORT virtual void Build(const TopAbs_ShapeEnum Limit = TopAbs_SHAPE) ; - - - - - -protected: - - // Methods PROTECTED - // -Standard_EXPORT void TreatSolids() ; -Standard_EXPORT void TreatWebs() ; -Standard_EXPORT void RestParts() ; - - - // Fields PROTECTED - // -Standard_Boolean myRemoveWebs; -TopTools_DataMapOfShapeInteger myMapSWM; -TopTools_DataMapOfShapeInteger myMapSWMOut; -TopoDS_Shape myRestParts; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.ixx b/src/NMTAlgo/NMTAlgo_Splitter1.ixx deleted file mode 100644 index 479cf4180..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter1.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.jxx b/src/NMTAlgo/NMTAlgo_Splitter1.jxx deleted file mode 100644 index c804ba376..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter1.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Splitter1_HeaderFile -#include -#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter_1.cxx b/src/NMTAlgo/NMTAlgo_Splitter_1.cxx deleted file mode 100644 index b2135883f..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter_1.cxx +++ /dev/null @@ -1,948 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTAlgo_Splitter_1.cxx -// Created: Mon Feb 2 14:58:54 2004 -// Author: Peter KURNEV -// -// -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -// -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// -static - void RefineShells(const TopoDS_Shape& , - TopTools_ListOfShape&); -static - void RefineSolids(const TopoDS_Shape& , - TopTools_ListOfShape&); - -static - void GetPlanes (const TopoDS_Edge& anEx, - const TopTools_IndexedDataMapOfShapeListOfShape& anEFMapx, - const TopoDS_Face& aF1, - TopAbs_State& aStPF1); - -//======================================================================= -//function : ShellsAndSolids -//purpose : -//======================================================================= - void NMTAlgo_Splitter::ShellsAndSolids() -{ - Standard_Boolean bMakeSolids; - TopAbs_ShapeEnum aType; - TopTools_ListIteratorOfListOfShape aItS; - TopTools_ListOfShape aLNS; - // - myAddedFacesMap.Clear(); - bMakeSolids=(myLimit==TopAbs_SHAPE || myLimit TopAbs_SHELL) { - continue;//face,wire,... - } - // - aLNS.Clear(); - // - MakeShells (aS, aLNS); - // - if (bMakeSolids && aType==TopAbs_SOLID) { - MakeSolids(aS, aLNS); - } - // - TopTools_ListIteratorOfListOfShape it (aLNS); - for (; it.More(); it.Next()) { - myBuilder.Add (myShape, it.Value()); - } - } - // - // add split faces - aItS.Initialize(myListShapes); - for ( ;aItS.More(); aItS.Next()) { - const TopoDS_Shape& aS=aItS.Value(); - // - aType=aS.ShapeType(); - if (aType!=TopAbs_FACE || myMapTools.Contains(aS)) { - continue; - } - // - const TopoDS_Shape& aCSF=myImageShape.Image(aS).First(); - TopoDS_Iterator itS(aCSF); - for (; itS.More(); itS.Next()){ - const TopoDS_Shape& aF=itS.Value(); - if (!myAddedFacesMap.Contains(aF)){ - myBuilder.Add (myShape, aF); - } - } - } -} -//======================================================================= -//function : MakeShells -//purpose : split S into compound of shells -//======================================================================= -void NMTAlgo_Splitter::MakeShells(const TopoDS_Shape& aS, - TopTools_ListOfShape& aLNS) -{ - NMTAlgo_Loop3d aShellMaker; - // - // get compound of split faces of aS - const TopoDS_Shape& aFC=myImageShape.Image(aS).First(); - aShellMaker.AddConstFaces(aFC); - // - // add split faces inside aS - TopoDS_Shape aIFC; - if (myClosedShapes.Contains(aS)) { - // - // internal faces compound - aIFC=FindFacesInside(aS, Standard_True); - aShellMaker.AddSectionFaces(aIFC); - } - // - aLNS=aShellMaker.MakeShells(myAddedFacesMap); - // - RefineShells(aS, aLNS); - // - // Add faces added to new shell to myAddedFacesMap: - // avoid rebuilding twice common part of 2 solids. - TopTools_ListIteratorOfListOfShape itS(aLNS); - TopExp_Explorer expF; - for (; itS.More(); itS.Next()) { - const TopoDS_Shape& aSh=itS.Value(); - expF.Init (aSh, TopAbs_FACE); - for (; expF.More(); expF.Next()){ - const TopoDS_Shape& aFx=expF.Current(); - myAddedFacesMap.Add (aFx); - } - } -} -//======================================================================= -//function : MakeSolids -//purpose : make solids out of Shells -//======================================================================= -void NMTAlgo_Splitter::MakeSolids(const TopoDS_Shape& theSolid, - TopTools_ListOfShape& theShellList) -{ - // for a solid wrapping other shells or solids without intersection, - // it is necessary to find shells making holes in it - Standard_Boolean isWrapping; - TopTools_ListOfShape aNewSolids; // result - TopTools_ListOfShape aHoleShells; - TopoDS_Shape anInfinitePointShape; - TopTools_DataMapOfShapeShape aInOutMap; - TopTools_ListIteratorOfListOfShape aShellIt, aSolisIt; - // - isWrapping = myWrappingSolid.Contains(theSolid); - if (!isWrapping && !theShellList.IsEmpty()) { - // check if theSolid initially has internal shells - TopoDS_Iterator aShellExp (theSolid); - aShellExp.Next(); - isWrapping = aShellExp.More(); - } - // - aShellIt.Initialize(theShellList); - for ( ; aShellIt.More(); aShellIt.Next()) { - const TopoDS_Shape & aShell = aShellIt.Value(); - // check if a shell is a hole of theSolid - if (isWrapping && IsInside(anInfinitePointShape, aShell)){ - aHoleShells.Append(aShell); - } - else { - // make a solid from a shell - TopoDS_Solid Solid; - myBuilder.MakeSolid( Solid ); - myBuilder.Add (Solid, aShell); - - aNewSolids.Append (Solid); - } - } - // - // find outer a shell most close to each hole shell - aShellIt.Initialize(aHoleShells); - for (; aShellIt.More(); aShellIt.Next()){ - const TopoDS_Shape & aHole = aShellIt.Value(); - // - aSolisIt.Initialize(aNewSolids); - for ( ; aSolisIt.More(); aSolisIt.Next()) { - const TopoDS_Shape & aSolid = aSolisIt.Value(); - // - if (! IsInside(aHole, aSolid)){ - continue; - } - // - if ( aInOutMap.IsBound (aHole)){ - const TopoDS_Shape & aSolid2 = aInOutMap( aHole ); - if ( IsInside( aSolid, aSolid2 )) { - aInOutMap.UnBind( aHole ); - aInOutMap.Bind ( aHole, aSolid ); - } - } - else{ - aInOutMap.Bind (aHole, aSolid); - } - } - // - // add aHole to a solid - if (aInOutMap.IsBound( aHole )){ - TopoDS_Shape & aSolid=aInOutMap(aHole); - myBuilder.Add (aSolid, aHole); - } - } - // - theShellList.Clear(); - // - RefineSolids(theSolid, aNewSolids); - // - theShellList.Append(aNewSolids); -} - -//======================================================================= -//function : FindFacesInside -//purpose : return compound of faces of other shapes that are -// inside . -// is an object shape. -// makes avoid faces that do not form a -// closed shell -// makes return already added faces -//======================================================================= - TopoDS_Shape NMTAlgo_Splitter::FindFacesInside(const TopoDS_Shape& theShape, - const Standard_Boolean CheckClosed, - const Standard_Boolean All) -{ - TopExp_Explorer expl; - TopAbs_State aState; - // - // ================================================ - // check if internal faces have been already found - // ================================================ - if (myInternalFaces.IsBound(theShape)) { - TopoDS_Shape aIntFComp = myInternalFaces.Find (theShape); - TopoDS_Shape aIntRemFComp = myIntNotClFaces.Find (theShape); - - expl.Init( aIntRemFComp, TopAbs_FACE); - if (CheckClosed || !expl.More()){ - return aIntFComp; - } - // - TopoDS_Compound C; - myBuilder.MakeCompound( C ); - // add removed faces - for (; expl.More(); expl.Next()){ - myBuilder.Add( C, expl.Current() ); - } - // add good internal faces - expl.Init( aIntFComp, TopAbs_FACE); - for (; expl.More(); expl.Next()) { - myBuilder.Add( C, expl.Current() ); - } - // - return C; - } - - // =================================== - // get data for internal faces search - // =================================== - // - // compound of split faces of theShape - const TopoDS_Shape& CSF = myImageShape.Image(theShape).First(); - // - TopTools_MapOfShape MSE, MFP; - //xf - TopTools_IndexedMapOfShape aMFCSF; - //xt - TopTools_DataMapOfShapeListOfShape DMSEFP; - TopTools_MapIteratorOfMapOfShape itm; - TopTools_ListOfShape EmptyL; - TopTools_ListIteratorOfListOfShape itl; - TopTools_IndexedDataMapOfShapeListOfShape DMEF; - // - // MSE filling: map of new section edges of CSF - expl.Init(CSF, TopAbs_EDGE); - for (; expl.More(); expl.Next()) { - const TopoDS_Shape& aE = expl.Current() ; - MSE.Add(aE); - } - // - // DMEF: map edge of CSF - faces of CSF - TopExp::MapShapesAndAncestors(CSF, TopAbs_EDGE, TopAbs_FACE, DMEF); - //xf - TopExp::MapShapes(CSF, TopAbs_FACE, aMFCSF); - //xt - // - // Fill - // 1. MFP - a map of faces to process: map of resulting faces except - // those of theShape; we`ll add to C those of them which are inside CSF - // 2. DMSEFP - edge of MSE => faces of MFP - // - itl.Initialize(myListShapes); - for (;itl.More(); itl.Next()) { - const TopoDS_Shape& aShape = itl.Value(); - // - if ( theShape.IsSame(aShape)) { - continue; - } - // fill maps - // iterate on split faces of aShape - const TopoDS_Shape& CSF1 = myImageShape.Image(aShape).First(); - TopoDS_Iterator itF (CSF1); - for ( ; itF.More(); itF.Next()) { - const TopoDS_Shape& aF1 = itF.Value(); - MFP.Add(aF1); - // iterate on edges of split faces of aShape, - // add to DMSEFP edges that are new - expl.Init(aF1, TopAbs_EDGE); - for (; expl.More(); expl.Next()) { - TopoDS_Shape aE1 = expl.Current(); - if ( MSE.Contains(aE1)) {// section edge - if (!DMSEFP.IsBound(aE1)) { - DMSEFP.Bind(aE1, EmptyL); - } - DMSEFP(aE1).Append(aF1); - } - } - } - }//for (;itl.More(); itl.Next()) - // - // add tool faces... (is absent) - // - // =========================== - // find faces inside theShape - // =========================== - Standard_Boolean sameDom1, sameDom2; - Standard_Boolean skipAlreadyAdded = Standard_False; - Standard_Boolean GoodOri, inside; - Standard_Real dot; - TopTools_ListOfShape KeepFaces; - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit; - - // iterate on section edges, check faces of other shapes - // sharing section edges and put internal faces to KeepFaces - Mapit.Initialize(DMSEFP); - for (; Mapit.More() ; Mapit.Next()) { - // a new edge of theShape - const TopoDS_Edge& E = TopoDS::Edge (Mapit.Key()); - // - //Standard_Boolean isSectionE=IsSectionEdge(E);//(OrigE); - // - // split faces of other shapes sharing E - TopTools_ListOfShape& LSF = DMSEFP.ChangeFind(E); - // - itl.Initialize( LSF ); - while (itl.More()) { - // a split faces of other shape - TopoDS_Face aFace1 = TopoDS::Face(itl.Value()); - // remove aFace1 form DMSEFP and MFP - LSF.Remove( itl ); // == itl.Next(); - if (!MFP.Remove(aFace1)) { - continue; // was not is MFP (i.e already checked) - } - // - // check if aFace1 was already added to 2 shells - if (!All && - myAddedFacesMap.Contains(aFace1) && - myAddedFacesMap.Contains(aFace1.Reversed())) { - skipAlreadyAdded = Standard_True; - } - // - //xf - if (aMFCSF.Contains(aFace1)) { - // the face aFace1 can not be inside CSF - // if CSF contains the aFace1 - continue; - } - //xt - // - TopoDS_Shape anOrigFace = aFace1; - if (myImagesFaces.IsImage(aFace1)){ - anOrigFace = myImagesFaces.Root(aFace1); - } - // - // <- A was here - // - // check that anOrigFace is not same domain with CSF faces it intersects - // - const TopTools_ListOfShape& FL = DMEF.FindFromKey(E); //faces of CSF sharing E - // - const TopoDS_Shape& origF1 = myImagesFaces.IsImage(FL.First()) ? - myImagesFaces.Root(FL.First()) : FL.First(); - // - const TopoDS_Shape& origF2 = myImagesFaces.IsImage(FL.Last()) ? - myImagesFaces.Root(FL.Last()) : FL.Last(); - // - sameDom1 = anOrigFace.IsSame( origF1 ); - sameDom2 = anOrigFace.IsSame( origF2 ); - // - if (!(sameDom1 || sameDom2) && HasSameDomainF( TopoDS::Face(anOrigFace) )) { - sameDom1 = IsSameDomainF( TopoDS::Face(anOrigFace), TopoDS::Face(origF1)); - if (origF1 == origF2) { - sameDom2 = sameDom1; - } - } - if (sameDom1 && sameDom2){ - continue; - } - // - if (sameDom1 || sameDom2) { - inside = NMTAlgo_Loop3d::IsInside (E, - TopoDS::Face(FL.First()), - TopoDS::Face(FL.Last()), - 1, dot, GoodOri); - if (inside || (dot + Precision::Angular() >= 1.0)) { - continue; // E is convex between origF1 and origF2 or they are tangent - } - } - // - GetPlanes(E, DMEF, aFace1, aState); - if (aState==TopAbs_IN) { - KeepFaces.Append(aFace1); - } - } //while (itl.More()) { - } //for (; Mapit.More() ; Mapit.Next() ) - - // =================================================== - // add not distributed faces connected with KeepFaces - // =================================================== - - // ultimate list of internal faces - TopTools_ListOfShape KeptFaces; - // - // add to MFP not split tool faces as well, they may be connected with - // tool faces interfering with theShape - /* - itm.Initialize(myMapTools); - for (; itm.More(); itm.Next() ) { - const TopoDS_Shape& aToolFace = itm.Key(); - if (!myImageShape.HasImage(aToolFace)){ - MFP.Add (aToolFace); - } - } - */ - // - if (MFP.IsEmpty()) - KeptFaces.Append (KeepFaces); - // - while (!KeepFaces.IsEmpty()) { - // KeepEdges : map of edges of faces kept last time - TopTools_IndexedMapOfShape KeepEdges; - for ( itl.Initialize(KeepFaces); itl.More(); itl.Next() ) { - TopExp::MapShapes( itl.Value(), TopAbs_EDGE, KeepEdges); - KeptFaces.Append( itl.Value() ); - } - // - KeepFaces.Clear(); - // - // keep faces connected with already kept faces by KeepEdges - for ( itm.Initialize(MFP); itm.More(); itm.Next() ) { - const TopoDS_Shape& FP = itm.Key(); - for (expl.Init(FP,TopAbs_EDGE); expl.More(); expl.Next()) { - const TopoDS_Shape& se = expl.Current(); - if (!MSE.Contains(se) && KeepEdges.Contains(se) ) { - KeepFaces.Append(FP); - MFP.Remove(FP); - break; - } - } - } - } - - // =============================================================== - // here MFP contains faces outer of theShape and those of shapes - // which do not interfere with theShape at all and between which - // there may be those wrapped by theShape and whose faces may be - // needed to be returned as well - // =============================================================== - - Standard_Boolean isSolid = (theShape.ShapeType() == TopAbs_SOLID); - if (All || isSolid) // All is for sub-result removal - { - for ( itm.Initialize( MFP ); itm.More(); itm.Next() ) { - TopoDS_Shape aFace = itm.Key(); - - // find a shape aFace originates from - TopoDS_Shape anOrigShape = GetOriginalShape( aFace ); - - // find out if all faces of anOrigShape are not in MFP - // and by the way remove them from MFP - Standard_Boolean isAllOut = Standard_True; - TopoDS_Shape aSplitFaces = anOrigShape; - if (myImageShape.HasImage(anOrigShape)) - aSplitFaces = myImageShape.Image(anOrigShape).First(); - - TopTools_ListOfShape aSplitFaceL; - for (expl.Init( aSplitFaces, TopAbs_FACE ); expl.More(); expl.Next()) - { - const TopoDS_Shape & aSpFace = expl.Current(); - // a tool face which become object has image but the whole tool shape has not - if (myImageShape.HasImage( aSpFace )) - { - TopExp_Explorer exF (myImageShape.Image( aSpFace ).First(), TopAbs_FACE ); - for ( ; exF.More(); exF.Next() ) - { - aSplitFaceL.Append( exF.Current() ); - if ( ! MFP.Remove( exF.Current() )) - isAllOut = Standard_False; - } - } - else - { - aSplitFaceL.Append( aSpFace ); - if ( ! MFP.Remove( aSpFace )) - isAllOut = Standard_False; - } - } - itm.Initialize( MFP ); - if ( !isAllOut ) - continue; - - // classify anOrigShape against theShape - if (IsInside (anOrigShape, theShape)) { - if (isSolid && myClosedShapes.Contains(anOrigShape)) { - // to make a special care at solid reconstruction - myWrappingSolid.Add ( theShape ); - } - // keep faces of an internal shape anOrigShape - KeptFaces.Append( aSplitFaceL ); - } - } - } - - // ==================================================== - // check if kept faces form a shell without free edges - // ==================================================== - - DMEF.Clear(); // edge - kept faces - MFP.Clear(); // reuse it for wrong faces - if (CheckClosed) { - for (itl.Initialize(KeptFaces); itl.More(); itl.Next() ) - TopExp::MapShapesAndAncestors(itl.Value(), TopAbs_EDGE, TopAbs_FACE, DMEF); - - Standard_Integer i, nb = DMEF.Extent(); - Standard_Boolean isClosed = Standard_False; - while (!isClosed) { - isClosed = Standard_True; - for (i=1; isClosed && i<=nb; ++i) { - const TopoDS_Shape& E = DMEF.FindKey( i ); - if (! BRep_Tool::Degenerated( TopoDS::Edge( E )) && - ! MSE.Contains( E )) - isClosed = ( DMEF(i).Extent() != 1 ); - } - if (!isClosed) { - const TopoDS_Shape& F = DMEF.FindFromIndex( i-1 ).First(); // bad face - MFP.Add( F ); - // remove bad face from DMEF - for (expl.Init( F, TopAbs_EDGE); expl.More(); expl.Next()) { - const TopoDS_Shape& E = expl.Current(); - TopTools_ListOfShape& FL = DMEF.ChangeFromKey( E ); - for (itl.Initialize( FL ); itl.More(); itl.Next() ) { - if ( F.IsSame( itl.Value() )) { - FL.Remove( itl ); - break; - } - } - } - } - } - } - - // ============== - // make a result - // ============== - - TopoDS_Compound C; - // compound of removed internal faces - TopoDS_Compound CNotCl; - - myBuilder.MakeCompound(C); - myBuilder.MakeCompound(CNotCl); - - // add to compounds - itl.Initialize(KeptFaces); - for (; itl.More(); itl.Next() ) { - TopoDS_Shape & aIntFace = itl.Value(); - // - if (!All && - myAddedFacesMap.Contains(aIntFace) && - myAddedFacesMap.Contains(aIntFace.Reversed())) { - continue; - } - // - if (! MFP.Contains( aIntFace )){ - myBuilder.Add(C, aIntFace); - } - else{ - myBuilder.Add(CNotCl, aIntFace); - } - } - // - if (!skipAlreadyAdded && CheckClosed) { - myInternalFaces.Bind(theShape, C); - myIntNotClFaces.Bind(theShape, CNotCl); - } - // - // - if (!myMapSIFC.IsBound(theShape)) { - TopoDS_Compound aCIF; - myBuilder.MakeCompound(aCIF); - // - itl.Initialize(KeptFaces); - for (; itl.More(); itl.Next() ) { - TopoDS_Shape & aIntFace = itl.Value(); - if (! MFP.Contains(aIntFace )){ - myBuilder.Add(aCIF, aIntFace); - } - } - myMapSIFC.Bind(theShape, aCIF); - } - // - return C; -} -//======================================================================= -//function : IsInside -//purpose : Return True if the first vertex of S1 inside S2. -// If S1.IsNull(), check infinite point against S2. -//======================================================================= -Standard_Boolean NMTAlgo_Splitter::IsInside (const TopoDS_Shape& theS1, - const TopoDS_Shape& theS2) -{ - BRepClass3d_SolidClassifier aClassifier( theS2 ); - // - TopExp_Explorer expl(theS1, TopAbs_VERTEX); - // - if (!expl.More()){ - aClassifier.PerformInfinitePoint( ::RealSmall()); - } - else { - const TopoDS_Vertex & aVertex = TopoDS::Vertex( expl.Current() ); - aClassifier.Perform (BRep_Tool::Pnt( aVertex ), - BRep_Tool::Tolerance( aVertex )); - } - // - return ( aClassifier.State() == TopAbs_IN ); -} -//======================================================================= -//function : GetOriginalShape -//purpose : Return the shape aShape originates from. aShape -// should be a face or more complex result shape -//======================================================================= -TopoDS_Shape NMTAlgo_Splitter::GetOriginalShape(const TopoDS_Shape& theShape) const -{ - TopoDS_Shape anOrigShape; - - TopExp_Explorer expl( theShape, TopAbs_FACE); - if (expl.More()) { - TopoDS_Shape aFace = expl.Current(); - if (myImagesFaces.IsImage( aFace )) - aFace = myImagesFaces.Root( aFace ); - anOrigShape = myFaceShapeMap.Find( aFace ); - } - return anOrigShape; -} -//======================================================================= -//function :RefineShells -//purpose : -//======================================================================= -void RefineShells(const TopoDS_Shape& aS, - TopTools_ListOfShape& aLNS) -{ - Standard_Boolean bFound; - Standard_Integer iS, jS, aNbSOrs, aNbSIms, aNbFOrs, aNbFIms, kFOrs, aNb; - TopTools_ListIteratorOfListOfShape aIt; - TopTools_IndexedMapOfShape aMSOrs, aMSIms, aMFOrs, aMFIms; - TopTools_IndexedDataMapOfShapeShape aMImOr; - TopTools_ListOfShape aLS; - // - TopExp::MapShapes(aS, TopAbs_SHELL, aMSOrs); - aIt.Initialize(aLNS); - for (;aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSh=aIt.Value(); - aMSIms.Add(aSh); - } - // - aNbSOrs=aMSOrs.Extent(); - aNbSIms=aMSIms.Extent(); - // - for (iS=1; iS<=aNbSOrs; ++iS) { - const TopoDS_Shape& aSOr=aMSOrs(iS); - aMFOrs.Clear(); - TopExp::MapShapes(aSOr, TopAbs_FACE, aMFOrs); - aNbFOrs=aMFOrs.Extent(); - // - for (jS=1; jS<=aNbSIms; ++jS) { - const TopoDS_Shape& aSIm=aMSIms(jS); - if (aMImOr.Contains(aSIm)) { - continue; - } - // - aMFIms.Clear(); - TopExp::MapShapes(aSIm, TopAbs_FACE, aMFIms); - aNbFIms=aMFIms.Extent(); - // - if (aNbFIms==aNbFOrs) { - bFound=Standard_True; - for (kFOrs=1; kFOrs<=aNbFOrs; ++kFOrs) { - const TopoDS_Shape& aFOr=aMFOrs(kFOrs); - if (!aMFIms.Contains(aFOr)) { - bFound=Standard_False; - break; //next aSIm - } - } - if (bFound){ - aMImOr.Add(aSIm, aSOr); - break; //next aSOr - } - } //if (aNbFIms==aNbFOrs) - } - } - // - aNb=aMImOr.Extent(); - aIt.Initialize(aLNS); - for (;aIt.More(); aIt.Next()) { - const TopoDS_Shape& aSh=aIt.Value(); - if (aMImOr.Contains(aSh)) { - const TopoDS_Shape& aSOr=aMImOr.FindFromKey(aSh); - aLS.Append(aSOr); - } - else { - aLS.Append(aSh); - } - } - // - aLNS.Clear(); - aLNS.Append(aLS); -} - -//======================================================================= -//function :RefineSolids -//purpose : -//======================================================================= -void RefineSolids(const TopoDS_Shape& aSolidOr, - TopTools_ListOfShape& aLNS) -{ - Standard_Integer aNb, iS, aNbSOrs, aNbSIms; - TopoDS_Shape aSolidIm; - TopTools_IndexedMapOfShape aMSOrs, aMSIms; - // - aNb=aLNS.Extent(); - if (aNb!=1) { - return; - } - // - aSolidIm=aLNS.First(); - - TopExp::MapShapes(aSolidOr, TopAbs_SHELL, aMSOrs); - TopExp::MapShapes(aSolidIm, TopAbs_SHELL, aMSIms); - aNbSOrs=aMSOrs.Extent(); - aNbSIms=aMSIms.Extent(); - if (aNbSOrs!=aNbSIms) { - return; - } - // - for (iS=1; iS<=aNbSOrs; ++iS) { - const TopoDS_Shape& aSOr=aMSOrs(iS); - if (!aMSIms.Contains(aSOr)) { - return; - } - } - // - aLNS.Clear(); - aLNS.Append(aSolidOr); -} -//======================================================================= -//function : GetPlanes -//purpose : -//======================================================================= -void GetPlanes (const TopoDS_Edge& anEx, - const TopTools_IndexedDataMapOfShapeListOfShape& anEFMapx, - const TopoDS_Face& aF1, - TopAbs_State& aStPF1) - -{ - Standard_Boolean bIsAdjExists; - Standard_Real aT, aT1, aT2; - TopAbs_Orientation anOrEx, anOr; - gp_Dir aDNFx1, aDNFx2, aDNF1; - gp_Pnt aPx, aPx1, aPx2, aPF1; - TopoDS_Edge aERight, aSpxSimm; - TopoDS_Face aFx1, aFx2, aFF1; - TopTools_ListIteratorOfListOfShape anIt; - // - // Point on Edge - Handle(Geom_Curve)aC3D =BRep_Tool::Curve(anEx, aT1, aT2); - aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); - - aC3D->D0(aT, aPx); - // - anOrEx=anEx.Orientation(); - - aSpxSimm=anEx; - if (anOrEx==TopAbs_FORWARD) { - aSpxSimm.Orientation(TopAbs_REVERSED); - } - else if (anOrEx==TopAbs_REVERSED){ - aSpxSimm.Orientation(TopAbs_FORWARD); - } - // - const TopTools_ListOfShape& aLF=anEFMapx.FindFromKey(anEx); - anIt.Initialize(aLF); - for (; anIt.More(); anIt.Next()) { - const TopoDS_Shape& aFE=anIt.Value(); - aFx1=TopoDS::Face(aFE); - anOr=BOPTools_Tools3D::Orientation(anEx, aFx1); - if (anOr==anOrEx){ - break; - } - } - // - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (anEx, aFx1, aT, aPx1, aDNFx1); - // - bIsAdjExists=BOPTools_Tools3D::GetAdjacentFace (aFx1, anEx, anEFMapx, aFx2); - if (!bIsAdjExists) { - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx1, aT, aPx2, aDNFx2); - } - else { - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx2, aT, aPx2, aDNFx2); - } - // - aFF1=aF1; - aFF1.Orientation(TopAbs_FORWARD); - BOPTools_Tools3D::OrientEdgeOnFace (anEx, aFF1, aERight); - BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aERight, aFF1, aT, aPF1, aDNF1); - // - { - Standard_Real d12, d1, anAlfa12, anAlfa1, aTwoPI; - - aTwoPI=Standard_PI+Standard_PI; - - gp_Vec aVx1(aPx, aPx1); - gp_Dir aDBx1 (aVx1); - gp_Pln aPlnToCompare (aPx, aDNFx1); - - gp_Vec aVx2(aPx, aPx2); - gp_Dir aDBx2 (aVx2); - - anAlfa12=aDBx1.Angle(aDBx2); - d12=BOPTools_Tools3D::SignDistance(aPx2, aPlnToCompare); - if (d12 < 0.) { - anAlfa12=aTwoPI-anAlfa12; - } - - gp_Vec aVF1(aPx, aPF1); - gp_Dir aDBF1 (aVF1); - anAlfa1=aDBx1.Angle(aDBF1); - d1=BOPTools_Tools3D::SignDistance(aPF1, aPlnToCompare); - if (d1 < 0.) { - anAlfa1=aTwoPI-anAlfa1; - } - - aStPF1=TopAbs_OUT; - if (anAlfa1 > anAlfa12) { - aStPF1=TopAbs_IN; - } - } -} - -//modified by NIZNHY-PKV Fri Feb 25 17:00:03 2005t XX -/* - A - // - TopoDS_Shape aFace2; - if ( !isSectionE ) { - while (itl.More()) { - aFace2 = itl.Value(); - // - TopoDS_Shape anOrigFace2 = aFace2; - if (myImagesFaces.IsImage(aFace2)) { - anOrigFace2 = myImagesFaces.Root(aFace2); - } - // - if (!MFP.Contains( aFace2 )) { - LSF.Remove( itl ); - continue; - } - //if (anOrigFace.IsSame( myImagesFaces.Root( aFace2 ))) - if (anOrigFace.IsSame(anOrigFace2)) { - break; - } - itl.Next(); - } - if (itl.More()) { // aFace2 found, remove it from maps - LSF.Remove( itl ); - MFP.Remove(aFace2); - } - else{ - aFace2.Nullify(); - } - itl.Initialize( LSF ); - } - */ diff --git a/src/NMTAlgo/NMTAlgo_Splitter_2.cxx b/src/NMTAlgo/NMTAlgo_Splitter_2.cxx deleted file mode 100644 index 3262ee8ba..000000000 --- a/src/NMTAlgo/NMTAlgo_Splitter_2.cxx +++ /dev/null @@ -1,680 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTAlgo_Splitter_2.cxx -// Created: Mon Feb 9 15:07:51 2004 -// Author: Igor FEOKTISTOV -// -// -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//======================================================================= -//function : KeepShapesInside -//purpose : remove shapes that are outside of S from result -//======================================================================= - void NMTAlgo_Splitter::KeepShapesInside (const TopoDS_Shape& S) -{ - TopoDS_Iterator it; - if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid - for (it.Initialize( S ); it.More(); it.Next()) - KeepShapesInside( it.Value()); - return; - } - - Standard_Boolean isTool = Standard_False; - if (!myImageShape.HasImage( S )) { - //isTool = CheckTool( S ); - //if (!isTool) return; - return; - } - - // build map of internal faces - TopTools_IndexedMapOfShape MIF; - TopoDS_Shape IntFacesComp = FindFacesInside( S, Standard_False, Standard_True); - TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF ); - - TopoDS_Compound C; - myBuilder.MakeCompound(C); - - TopAbs_ShapeEnum anInternalShapeType = TopAbs_SHAPE; - if (!MIF.IsEmpty()) - { - // leave in the result only those shapes having a face in MIF - for (it.Initialize( myShape ); it.More(); it.Next()) { - const TopoDS_Shape & aResShape = it.Value(); - TopExp_Explorer expResF( aResShape, TopAbs_FACE ); - for (; expResF.More(); expResF.Next()) { - if ( MIF.Contains( expResF.Current())) { - myBuilder.Add( C, aResShape ); - if (aResShape.ShapeType() < anInternalShapeType) - anInternalShapeType = aResShape.ShapeType(); - break; - } - } - } - } - - // may be S was not split by internal faces then it is missing - // in myShape, add it - if (!isTool && - (anInternalShapeType > TopAbs_SOLID || S.ShapeType() > TopAbs_SOLID)) - { - TopTools_IndexedMapOfShape MSF; // map of split faces of S - TopExp::MapShapes( myImageShape.Image(S).First(), TopAbs_FACE, MSF); - - // find a shape having all faces in MSF - for (it.Initialize( myShape ); it.More(); it.Next()) { - TopExp_Explorer expResF( it.Value(), TopAbs_FACE ); - for (; expResF.More(); expResF.Next()) { - if (! MSF.Contains( expResF.Current())) - break; - } - if (! expResF.More()) { - myBuilder.Add( C, it.Value() ); - break; - } - } - } - - myShape = C; -} - -//======================================================================= -//function : RemoveShapesInside -//purpose : remove shapes that are inside S from result -//======================================================================= - void NMTAlgo_Splitter::RemoveShapesInside (const TopoDS_Shape& S) -{ - TopoDS_Iterator it; - if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid - it.Initialize( S ); - for (; it.More(); it.Next()) { - RemoveShapesInside( it.Value()); - } - return; - } - // - Standard_Boolean isTool; - TopoDS_Shape IntFacesComp; - TopoDS_Compound C; - TopTools_IndexedMapOfShape MIF; // map of internal faces - TopTools_MapOfShape RFM; - TopTools_MapIteratorOfMapOfShape itF; - // - isTool=myToolShapes.Contains(S); - //isTool = Standard_False; - if (!myImageShape.HasImage( S )) { - return; - } - // - IntFacesComp = FindFacesInside( S, Standard_False, Standard_True); - // - TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF); - if (MIF.IsEmpty()) { - return; - } - // add to MIF split faces of S - const TopoDS_Shape& aSIm=myImageShape.Image(S).First(); - TopExp::MapShapes(aSIm, TopAbs_FACE, MIF); - // - // leave in the result only those shapes not having all face in MIF - myBuilder.MakeCompound(C); - // - // RFM : faces of removed shapes that encounter once - it.Initialize(myShape); - for (; it.More(); it.Next()) { - TopExp_Explorer expResF; - // - const TopoDS_Shape& aSR=it.Value(); - // - expResF.Init(aSR, TopAbs_FACE); - for (; expResF.More(); expResF.Next()) { - const TopoDS_Shape& aFR=expResF.Current(); - if (!MIF.Contains(aFR)) { - break; - } - } - // - if (expResF.More()) { - // add shape to result - myBuilder.Add(C, aSR); - } - else { - // add faces of a removed shape to RFM - for (expResF.ReInit(); expResF.More(); expResF.Next()) { - const TopoDS_Shape& aF = expResF.Current(); - if (!RFM.Remove(aF)) { - RFM.Add(aF); - } - } - } - }// for (; it.More(); it.Next()) - // - // - TopoDS_Compound aCx; - // - myBuilder.MakeCompound(aCx); - itF.Initialize (RFM); - for (; itF.More(); itF.Next()) { - const TopoDS_Shape& aF=itF.Key(); - myBuilder.Add(aCx, aF); - } - // - if (!isTool) { - // rebuild S, it must remain in the result - Standard_Boolean isClosed = Standard_False; - switch (S.ShapeType()) { - case TopAbs_SOLID : - isClosed = Standard_True; break; - case TopAbs_SHELL: { - TopTools_IndexedDataMapOfShapeListOfShape MEF; - TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, MEF); - Standard_Integer i; - for (i=1; isClosed && i<=MEF.Extent(); ++i) { - isClosed = ( MEF(i).Extent() != 1 ); - } - break; - } - default: - isClosed = Standard_False; - } - // - if (isClosed) { - // add to a new shape external faces of removed shapes, ie those in RFM - TopoDS_Shell Shell; - myBuilder.MakeShell(Shell); - // exclude redundant internal face with edges encounterd only once - TopTools_IndexedDataMapOfShapeListOfShape MEF; - // - itF.Initialize (RFM); - for ( ; itF.More(); itF.Next()) { - const TopoDS_Shape& aF=itF.Key(); - TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, MEF); - } - // add only faces forming a closed shell - for (itF.Reset() ; itF.More(); itF.Next()) { - const TopoDS_Shape& aF=itF.Key(); - TopExp_Explorer expE (aF, TopAbs_EDGE); - for (; expE.More(); expE.Next()) { - if (MEF.FindFromKey(expE.Current()).Extent() == 1) { - break; - } - } - if (!expE.More()) { - myBuilder.Add( Shell, aF); - } - else { - //int a=0; - } - } - - if (S.ShapeType() == TopAbs_SOLID) { - TopoDS_Solid Solid; - myBuilder.MakeSolid( Solid ); - myBuilder.Add (Solid, Shell); - myBuilder.Add (C, Solid); - } - else { - myBuilder.Add (C, Shell); - } - } // if (isClosed) { - else { - it.Initialize(aSIm); - for (; it.More(); it.Next()) { - myBuilder.Add (C, it.Value()); - } - } - } - // - myShape = C; -} -// -//modified by NIZNHY-PKV Tue Feb 1 16:02:29 2005 f -//======================================================================= -//function : Modified -//purpose : -//======================================================================= -const TopTools_ListOfShape& NMTAlgo_Splitter::Modified (const TopoDS_Shape& S) - -{ - TopAbs_ShapeEnum aType; - // - myGenerated.Clear(); - // - aType=S.ShapeType(); - // - switch (aType) { - case TopAbs_SOLID: - case TopAbs_FACE: - case TopAbs_EDGE: - case TopAbs_VERTEX: - FindImage(S, myGenerated); - break; - - case TopAbs_SHELL: - break; - - case TopAbs_WIRE: - break; - - default: - break; - } - // - return myGenerated; -} -//modified by NIZNHY-PKV Tue Feb 1 16:02:33 2005 t -//======================================================================= -//function : IsDeleted -//purpose : -//======================================================================= -Standard_Boolean NMTAlgo_Splitter::IsDeleted (const TopoDS_Shape& S) - -{ - const TopTools_ListOfShape& aL = Modified(S); - if(aL.Extent() != 0) return Standard_False; - - TopTools_MapOfShape aMap; - TopExp_Explorer anExp; - - TopAbs_ShapeEnum aType = S.ShapeType(); - - if(aType == TopAbs_VERTEX || - aType == TopAbs_EDGE || - aType == TopAbs_FACE ) { - - anExp.Init(myShape, aType); - for(; anExp.More(); anExp.Next()) { - if(S.IsSame(anExp.Current())) return Standard_False; - } - - } - - return Standard_True; -} -//======================================================================= -//function : Generated -//purpose : -//======================================================================= -const TopTools_ListOfShape& NMTAlgo_Splitter::Generated(const TopoDS_Shape& S) -{ - myGenerated.Clear(); - TopTools_ListIteratorOfListOfShape it; - TopTools_MapOfShape aMap; - TopExp_Explorer anExp; - Standard_Boolean bCheckVert = Standard_False; - - if(S.ShapeType() == TopAbs_FACE) { - if (mySectionParts.Contains(S)) { - it.Initialize(mySectionParts.FindFromKey(S)); - anExp.Init(myShape, TopAbs_EDGE); - - for(; anExp.More(); anExp.Next()) { - aMap.Add(anExp.Current()); - } - - for (; it.More(); it.Next()) { - if(aMap.Contains(it.Value())) { - myGenerated.Append(it.Value()); - } - } - } - - NMTTools_PaveFiller& aPF = myDSFiller->ChangePaveFiller(); - const NMTDS_ShapesDataStructure& aDS = myDSFiller->DS(); - const BOPTools_PInterferencePool& anIP = aPF.InterfPool(); - - Standard_Integer aNbS = aDS.NumberOfSourceShapes(); - Standard_Integer anIndex = 0, i; - - for(i = 1; i <= aNbS; ++i) { - - const TopoDS_Shape& aS = aDS.Shape(i); - if(S.IsSame(aS)) { - anIndex = i; - break; - } - - } - - if(anIndex == 0) return myGenerated; - if(!anIP->HasInterference(anIndex)) return myGenerated; - - const BOPTools_CArray1OfESInterference& aESs = anIP->ESInterferences(); - Standard_Integer aNbI = aESs.Extent(); - - if(aNbI == 0) return myGenerated; - - for(i = 1; i <= aNbI; ++i) { - - const BOPTools_ESInterference& aES = aESs(i); - Standard_Integer ind1, ind2; - aES.Indices(ind1, ind2); - - if(ind1 == anIndex || ind2 == anIndex) { - - Standard_Integer aNSI = aES.NewShape(); - if(aDS.GetShapeType(aNSI) == TopAbs_VERTEX) { - myGenerated.Append(aDS.Shape(aNSI)); - bCheckVert = Standard_True; - } - - } - - } - - if(bCheckVert) { - aMap.Clear(); - anExp.Init(myShape, TopAbs_VERTEX); - - for(; anExp.More(); anExp.Next()) { - aMap.Add(anExp.Current()); - } - - it.Initialize(myGenerated); - for (; it.More(); it.Next()) { - - if(it.Value().ShapeType() != TopAbs_VERTEX) continue; - - if(!aMap.Contains(it.Value())) { - myGenerated.Remove(it); - } - - } - } - - return myGenerated; - } - - if(S.ShapeType() == TopAbs_EDGE) { - - NMTTools_PaveFiller& aPF = myDSFiller->ChangePaveFiller(); - const NMTDS_ShapesDataStructure& aDS = myDSFiller->DS(); - const BOPTools_PInterferencePool& anIP = aPF.InterfPool(); - - Standard_Integer aNbS = aDS.NumberOfSourceShapes(); - Standard_Integer anIndex = 0, i; - - for(i = 1; i <= aNbS; ++i) { - - const TopoDS_Shape& aS = aDS.Shape(i); - if(S.IsSame(aS)) { - anIndex = i; - break; - } - - } - - if(anIndex == 0) return myGenerated; - if(!anIP->HasInterference(anIndex)) return myGenerated; - - const BOPTools_CArray1OfEEInterference& aEEs = anIP->EEInterferences(); - Standard_Integer aNbI = aEEs.Extent(); - - for(i = 1; i <= aNbI; ++i) { - - const BOPTools_EEInterference& aEE = aEEs(i); - Standard_Integer ind1, ind2; - aEE.Indices(ind1, ind2); - - if(ind1 == anIndex || ind2 == anIndex) { - - Standard_Integer aNSI = aEE.NewShape(); - if(aDS.GetShapeType(aNSI) == TopAbs_VERTEX) { - myGenerated.Append(aDS.Shape(aNSI)); - bCheckVert = Standard_True; - } - - } - - } - - const BOPTools_CArray1OfESInterference& aESs = anIP->ESInterferences(); - aNbI = aESs.Extent(); - - for(i = 1; i <= aNbI; ++i) { - - const BOPTools_ESInterference& aES = aESs(i); - Standard_Integer ind1, ind2; - aES.Indices(ind1, ind2); - - if(ind1 == anIndex || ind2 == anIndex) { - - Standard_Integer aNSI = aES.NewShape(); - if(aDS.GetShapeType(aNSI) == TopAbs_VERTEX) { - myGenerated.Append(aDS.Shape(aNSI)); - bCheckVert = Standard_True; - } - - } - - } - - if(bCheckVert) { - aMap.Clear(); - anExp.Init(myShape, TopAbs_VERTEX); - - for(; anExp.More(); anExp.Next()) { - aMap.Add(anExp.Current()); - } - - it.Initialize(myGenerated); - for (; it.More(); it.Next()) { - - if(!aMap.Contains(it.Value())) { - myGenerated.Remove(it); - } - } - } - return myGenerated; - } - return myGenerated; -} -//modified by NIZNHY-PKV Tue Feb 1 10:26:18 2005f -//======================================================================= -//function : FindImage -//purpose : -//======================================================================= -void NMTAlgo_Splitter::FindImage(const TopoDS_Shape& aS, - TopTools_ListOfShape& aLIms) -{ - TopAbs_ShapeEnum aType; - // - aType=aS.ShapeType(); - // - if (aType==TopAbs_SOLID) { - Standard_Boolean bHasImage, bHasInternalFaces; - Standard_Integer i, aNbSd; - TopTools_IndexedMapOfShape aMSo, aMSd; - TopoDS_Iterator aIt; - TopTools_IndexedDataMapOfShapeListOfShape aMFS; - TopTools_ListIteratorOfListOfShape aItLS; - // - bHasInternalFaces=myMapSIFC.IsBound(aS); - if (bHasInternalFaces){ - TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); - // - const TopoDS_Shape& aIFC=myMapSIFC.Find(aS); - // - aIt.Initialize(aIFC); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aIF=aIt.Value(); - if (aMFS.Contains(aIF)) { - const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aIF); - // - aItLS.Initialize(aLS); - for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aSx=aItLS.Value(); - aMSd.Add(aSx); - } - } - } - // - aNbSd=aMSd.Extent(); - if (aNbSd) { - for (i=1; i<=aNbSd; ++i) { - const TopoDS_Shape& aSx=aMSd(i); - if (!aSx.IsSame(aS)) { - aLIms.Append(aSx); - } - } - return; - } - } - // - bHasImage=myImageShape.HasImage(aS); - if (!bHasImage) { - return; - } - // - TopoDS_Shape aSd; - // - TopExp::MapShapes(myShape, TopAbs_SOLID, aMSo); - // - const TopoDS_Shape& aFC=myImageShape.Image(aS).First(); - bHasImage=NMTAlgo_Tools::FindImageSolid(aFC, aMSo, aSd); - if (bHasImage) { - if (!aSd.IsSame(aS)) { - aLIms.Append(aSd); - } - } - } //if (aType==TopAbs_SOLID) { - //== - else if (aType==TopAbs_FACE) { - TopTools_MapOfShape aMap; - TopTools_ListIteratorOfListOfShape aIt; - TopExp_Explorer anExp; - // - if (myModifiedFaces.IsBound(aS)) { - anExp.Init(myShape, aType); - for(; anExp.More(); anExp.Next()) { - aMap.Add(anExp.Current()); - } - // - const TopTools_ListOfShape& aLS=myModifiedFaces.Find(aS); - aIt.Initialize(aLS); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aFx=aIt.Value(); - if (!aFx.IsSame(aS)) { - if (aMap.Contains(aFx)) { - aLIms.Append(aFx); - } - } - } - } - } // else if (aType==TopAbs_FACE) - //== - else if (aType==TopAbs_EDGE) { - TopTools_MapOfShape aMap; - TopTools_ListIteratorOfListOfShape aIt; - TopExp_Explorer anExp; - // - if (myImagesEdges.HasImage(aS)) { - anExp.Init(myShape, aType); - for(; anExp.More(); anExp.Next()) { - aMap.Add(anExp.Current()); - } - // - const TopTools_ListOfShape& aLE=myImagesEdges.Image(aS); - aIt.Initialize(aLE); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aEx=aIt.Value(); - if (!aEx.IsSame(aS)) { - if(aMap.Contains(aEx)) { - aLIms.Append(aEx); - } - } - } - } - }// else if (aType==TopAbs_EDGE) - //== - else if (aType==TopAbs_VERTEX) { - Standard_Integer aNbS, anIndex, i, aSDVInd; - TopExp_Explorer anExp; - // - const NMTTools_DSFiller& aDSF = Filler(); - const NMTTools_PaveFiller& aPF = aDSF.PaveFiller(); - const NMTDS_ShapesDataStructure& aDS = aDSF.DS(); - // - aNbS = aDS.NumberOfSourceShapes(); - anIndex = 0; - // - for(i=1; i<=aNbS; ++i) { - const TopoDS_Shape& aSx = aDS.Shape(i); - if(aS.IsSame(aSx)) { - anIndex = i; - break; - } - } - // - if(!anIndex) { - return; - } - // - aSDVInd=aPF.FindSDVertex(anIndex); - if(!aSDVInd) { - return; - } - // - const TopoDS_Shape& aSDV=aDS.Shape(aSDVInd); - // - anExp.Init(myShape, aType); - for(; anExp.More(); anExp.Next()) { - const TopoDS_Shape& aVx=anExp.Current(); - if(aSDV.IsSame(aVx)) { - aLIms.Append(aSDV); - break; - } - } - }// else if (aType==TopAbs_VERTEX) -} -//modified by NIZNHY-PKV Tue Feb 1 10:26:22 2005t - diff --git a/src/NMTAlgo/NMTAlgo_Tools.cdl b/src/NMTAlgo/NMTAlgo_Tools.cdl deleted file mode 100644 index b27b601a1..000000000 --- a/src/NMTAlgo/NMTAlgo_Tools.cdl +++ /dev/null @@ -1,90 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTAlgo_Tools.cdl --- Created: Fri Jan 30 16:29:14 2004 --- Author: Peter KURNEV - - -class Tools from NMTAlgo - - ---Purpose: - -uses - Orientation from TopAbs, - - Shape from TopoDS, - Edge from TopoDS, - Face from TopoDS, - Shell from TopoDS, - - ListOfShape from TopTools, - IndexedMapOfShape from TopTools ---raises - -is - OrientFacesOnShell (myclass; - aShell: Shell from TopoDS; - aShellNew: out Shell from TopoDS); - - OrientFacesOnShell (myclass; - aF : Face from TopoDS; - aSh : out Shell from TopoDS); - - Orientation(myclass; - aE: Edge from TopoDS; - aF: Face from TopoDS) - returns Orientation from TopAbs; - - Sense (myclass; - aF1: Face from TopoDS; - aF2: Face from TopoDS) - returns Integer from Standard; - - IsInside (myclass; - aS1: Shape from TopoDS; - aS2: Shape from TopoDS) - returns Boolean from Standard; - - MakeShells(myclass; - aFC:Shape from TopoDS; - aLS:out ListOfShape from TopTools); - - MakeSolids(myclass; - aLS:out ListOfShape from TopTools); - - MakeSolids(myclass; - aFC:Shape from TopoDS; - aLS:out ListOfShape from TopTools); - - BreakWebs (myclass; - aS1: Shape from TopoDS; - aS2:out Shape from TopoDS); - - FindImageSolid (myclass; - aFC : Shape from TopoDS; - aMSo : IndexedMapOfShape from TopTools; - aSo : out Shape from TopoDS) - returns Boolean from Standard; - ---fields - -end Tools; diff --git a/src/NMTAlgo/NMTAlgo_Tools.cxx b/src/NMTAlgo/NMTAlgo_Tools.cxx deleted file mode 100644 index 35ea5e2f5..000000000 --- a/src/NMTAlgo/NMTAlgo_Tools.cxx +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTAlgo_Tools.cxx -// Created: Fri Jan 30 16:30:45 2004 -// Author: Peter KURNEV -// -// -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include - - -//======================================================================= -// function: Sense -// purpose: -//======================================================================= - Standard_Integer NMTAlgo_Tools::Sense (const TopoDS_Face& aF1, - const TopoDS_Face& aF2) -{ - Standard_Integer iSense=0; - gp_Dir aDNF1, aDNF2; - TopoDS_Edge aE1, aE2; - TopExp_Explorer anExp; - // - anExp.Init(aF1, TopAbs_EDGE); - for (; anExp.More(); anExp.Next()) { - aE1=TopoDS::Edge(anExp.Current()); - if (!BRep_Tool::Degenerated(aE1)) { - if (!BRep_Tool::IsClosed(aE1, aF1)) { - break; - } - } - } - // - anExp.Init(aF2, TopAbs_EDGE); - for (; anExp.More(); anExp.Next()) { - aE2=TopoDS::Edge(anExp.Current()); - if (!BRep_Tool::Degenerated(aE2)) { - if (!BRep_Tool::IsClosed(aE2, aF2)) { - if (aE2.IsSame(aE1)) { - iSense=1; - break; - } - } - } - } - // - if (!iSense) { - return iSense; - } - // - BOPTools_Tools3D::GetNormalToFaceOnEdge(aE1, aF1, aDNF1); - BOPTools_Tools3D::GetNormalToFaceOnEdge(aE2, aF2, aDNF2); - // - iSense=BOPTools_Tools3D::SenseFlag(aDNF1, aDNF2); - // - return iSense; -} - -//======================================================================= -// function: OrientFacesOnShell -// purpose: -//======================================================================= - void NMTAlgo_Tools::OrientFacesOnShell (const TopoDS_Face& aF1, - TopoDS_Shell& aSh) -{ - Standard_Integer aNbFSh, iSenseFlag; - gp_Dir aDNF1, aDNF2; - TopExp_Explorer anExp; - TopoDS_Edge aE1, aESh; - TopTools_IndexedDataMapOfShapeListOfShape aMEFSh; - // - anExp.Init(aF1, TopAbs_EDGE); - for (; anExp.More(); anExp.Next()) { - aE1=TopoDS::Edge(anExp.Current()); - if (!BRep_Tool::Degenerated(aE1)) { - break; - } - } - // - BOPTools_Tools3D::GetNormalToFaceOnEdge(aE1, aF1, aDNF1); - // - TopExp::MapShapesAndAncestors(aSh, TopAbs_EDGE, TopAbs_FACE, aMEFSh); - if (aMEFSh.Contains(aE1)) { - const TopTools_ListOfShape& aLFSh=aMEFSh.FindFromKey(aE1); - aNbFSh=aLFSh.Extent(); - if (aNbFSh==1) { - const TopoDS_Face& aFSh=TopoDS::Face(aLFSh.First()); - // - BOPTools_Tools3D::OrientEdgeOnFace(aE1, aFSh, aESh); - BOPTools_Tools3D::GetNormalToFaceOnEdge(aESh, aFSh, aDNF2); - // - iSenseFlag=BOPTools_Tools3D::SenseFlag(aDNF1, aDNF2); - if (iSenseFlag==1) { - return; - } - // - anExp.Init(aSh, TopAbs_FACE); - for (; anExp.More(); anExp.Next()) { - const TopoDS_Shape& aFx=anExp.Current(); - TopoDS_Shape *pFx=(TopoDS_Shape *)&aFx; - pFx->Reverse(); - } - } - } -} -//======================================================================= -// function: OrientFacesOnShell -// purpose: -//======================================================================= - void NMTAlgo_Tools::OrientFacesOnShell (const TopoDS_Shell& aShell, - TopoDS_Shell& aShellNew) -{ - Standard_Boolean bIsProcessed1, bIsProcessed2; - Standard_Integer i, aNbE, aNbF, j; - TopAbs_Orientation anOrE1, anOrE2; - - TopTools_IndexedDataMapOfShapeListOfShape aEFMap; - TopTools_IndexedMapOfShape aProcessedFaces; - BRep_Builder aBB; - - aBB.MakeShell(aShellNew); - - TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aEFMap); - - aNbE=aEFMap.Extent(); - // - // One seam edge in aEFMap contains 2 equivalent faces. - for (i=1; i<=aNbE; i++) { - TopTools_ListOfShape& aLF=aEFMap.ChangeFromIndex(i); - - if (aLF.Extent()>1) { - TopTools_ListOfShape aLFTmp; - TopTools_IndexedMapOfShape aFM; - - TopTools_ListIteratorOfListOfShape anIt(aLF); - for (; anIt.More(); anIt.Next()) { - const TopoDS_Shape& aF=anIt.Value(); - if (!aFM.Contains(aF)) { - aFM.Add(aF); - aLFTmp.Append(aF); - } - } - aLF.Clear(); - aLF=aLFTmp; - } - } - // - // Do - for (i=1; i<=aNbE; i++) { - const TopoDS_Edge& aE=TopoDS::Edge(aEFMap.FindKey(i)); - - if (BRep_Tool::Degenerated(aE)) { - continue; - } - - const TopTools_ListOfShape& aLF=aEFMap.FindFromIndex(i); - aNbF=aLF.Extent(); - - if (aNbF==2) { - TopoDS_Face& aF1=TopoDS::Face(aLF.First()); - TopoDS_Face& aF2=TopoDS::Face(aLF.Last() ); - - - bIsProcessed1=aProcessedFaces.Contains(aF1); - bIsProcessed2=aProcessedFaces.Contains(aF2); - - if (bIsProcessed1 && bIsProcessed2) { - continue; - } - - if (!bIsProcessed1 && !bIsProcessed2) { - aProcessedFaces.Add(aF1); - aBB.Add(aShellNew, aF1); - - bIsProcessed1=!bIsProcessed1; - } - - // - TopoDS_Face aF1x, aF2x; - - aF1x=aF1; - if (bIsProcessed1) { - j=aProcessedFaces.FindIndex(aF1); - aF1x=TopoDS::Face(aProcessedFaces.FindKey(j)); - } - - aF2x=aF2; - if (bIsProcessed2) { - j=aProcessedFaces.FindIndex(aF2); - aF2x=TopoDS::Face(aProcessedFaces.FindKey(j)); - } - // - - anOrE1=NMTAlgo_Tools::Orientation(aE, aF1x); - anOrE2=NMTAlgo_Tools::Orientation(aE, aF2x); - - if (bIsProcessed1 && !bIsProcessed2) { - - if (anOrE1==anOrE2) { - if (!BRep_Tool::IsClosed(aE, aF1) && - !BRep_Tool::IsClosed(aE, aF2)) { - aF2.Reverse(); - } - } - aProcessedFaces.Add(aF2); - aBB.Add(aShellNew, aF2); - } - - else if (!bIsProcessed1 && bIsProcessed2) { - if (anOrE1==anOrE2) { - if (!BRep_Tool::IsClosed(aE, aF1) && - !BRep_Tool::IsClosed(aE, aF2)) { - aF1.Reverse(); - } - } - aProcessedFaces.Add(aF1); - aBB.Add(aShellNew, aF1); - } - } - } - // - // - for (i=1; i<=aNbE; i++) { - const TopoDS_Edge& aE=TopoDS::Edge(aEFMap.FindKey(i)); - - if (BRep_Tool::Degenerated(aE)) { - continue; - } - - const TopTools_ListOfShape& aLF=aEFMap.FindFromIndex(i); - aNbF=aLF.Extent(); - if (aNbF!=2) { - TopTools_ListIteratorOfListOfShape anIt(aLF); - for(; anIt.More(); anIt.Next()) { - const TopoDS_Face& aF=TopoDS::Face(anIt.Value()); - if (!aProcessedFaces.Contains(aF)) { - aProcessedFaces.Add(aF); - aBB.Add(aShellNew, aF); - } - } - } - } -} -//======================================================================= -//function : Orientation -//purpose : -//======================================================================= - TopAbs_Orientation NMTAlgo_Tools::Orientation(const TopoDS_Edge& anE, - const TopoDS_Face& aF) -{ - TopAbs_Orientation anOr=TopAbs_INTERNAL; - - TopExp_Explorer anExp; - anExp.Init(aF, TopAbs_EDGE); - for (; anExp.More(); anExp.Next()) { - const TopoDS_Edge& anEF1=TopoDS::Edge(anExp.Current()); - if (anEF1.IsSame(anE)) { - anOr=anEF1.Orientation(); - break; - } - } - return anOr; -} -//======================================================================= -//function : IsInside -//purpose : Return True if the first vertex of S1 inside S2. -// If S1.IsNull(), check infinite point against S2. -//======================================================================= - Standard_Boolean NMTAlgo_Tools::IsInside (const TopoDS_Shape& theS1, - const TopoDS_Shape& theS2) -{ - BRepClass3d_SolidClassifier aClassifier( theS2 ); - // - TopExp_Explorer expl(theS1, TopAbs_VERTEX); - // - if (!expl.More()){ - aClassifier.PerformInfinitePoint( ::RealSmall()); - } - else { - const TopoDS_Vertex & aVertex = TopoDS::Vertex( expl.Current() ); - aClassifier.Perform (BRep_Tool::Pnt( aVertex ), - BRep_Tool::Tolerance( aVertex )); - } - // - return ( aClassifier.State() == TopAbs_IN ); -} -//======================================================================= -//function : MakeShells -//purpose : -//======================================================================= - void NMTAlgo_Tools::MakeShells (const TopoDS_Shape& aFC, - TopTools_ListOfShape& aLNS) -{ - NMTAlgo_Loop3d aShellMaker; - TopTools_MapOfOrientedShape aMTmp; - // - aShellMaker.AddConstFaces(aFC); - aLNS=aShellMaker.MakeShells(aMTmp); -} -//======================================================================= -//function : MakeSolids -//purpose : -//======================================================================= - void NMTAlgo_Tools::MakeSolids(const TopoDS_Shape& aFC, - TopTools_ListOfShape& theShellList) -{ - NMTAlgo_Tools::MakeShells(aFC, theShellList); - NMTAlgo_Tools::MakeSolids(theShellList); -} -//======================================================================= -//function : MakeSolids -//purpose : -//======================================================================= - void NMTAlgo_Tools::MakeSolids(TopTools_ListOfShape& theShellList) -{ - TopTools_ListOfShape aHoleShells, aNewSolids; - TopoDS_Shape anInfinitePointShape; - TopTools_DataMapOfShapeShape aInOutMap; - TopTools_ListIteratorOfListOfShape aShellIt, aSolisIt; - BRep_Builder aBB; - // - aShellIt.Initialize(theShellList); - for ( ; aShellIt.More(); aShellIt.Next()) { - const TopoDS_Shape & aShell = aShellIt.Value(); - // check if a shell is a hole of theSolid - if (NMTAlgo_Tools::IsInside(anInfinitePointShape, aShell)){ - aHoleShells.Append(aShell); - } - else { - // make a solid from a shell - TopoDS_Solid Solid; - aBB.MakeSolid( Solid ); - aBB.Add (Solid, aShell); - aNewSolids.Append (Solid); - } - } - // - // find outer a shell most close to each hole shell - aShellIt.Initialize(aHoleShells); - for (; aShellIt.More(); aShellIt.Next()){ - const TopoDS_Shape & aHole = aShellIt.Value(); - // - aSolisIt.Initialize(aNewSolids); - for ( ; aSolisIt.More(); aSolisIt.Next()) { - const TopoDS_Shape & aSolid = aSolisIt.Value(); - // - if (! NMTAlgo_Tools::IsInside(aHole, aSolid)){ - continue; - } - // - if ( aInOutMap.IsBound (aHole)){ - const TopoDS_Shape & aSolid2 = aInOutMap( aHole ); - if ( IsInside( aSolid, aSolid2 )) { - aInOutMap.UnBind( aHole ); - aInOutMap.Bind ( aHole, aSolid ); - } - } - else{ - aInOutMap.Bind (aHole, aSolid); - } - } - // - // add aHole to a solid - if (aInOutMap.IsBound( aHole )){ - TopoDS_Shape & aSolid=aInOutMap(aHole); - aBB.Add (aSolid, aHole); - } - } - theShellList.Clear(); - theShellList.Append( aNewSolids ); -} -//======================================================================= -//function : BreakWebs -//purpose : -//======================================================================= - void NMTAlgo_Tools::BreakWebs(const TopoDS_Shape& aCS, - TopoDS_Shape& aCSR) -{ - Standard_Integer i, aNbF, aNbS; - TopTools_IndexedDataMapOfShapeListOfShape aMFS; - TopTools_MapOfShape aMF; - - TopoDS_Compound aFC, aCR; - BRep_Builder aBB; - // - aBB.MakeCompound(aFC); - TopExp::MapShapesAndAncestors(aCS, TopAbs_FACE, TopAbs_SOLID, aMFS); - // - aNbF=aMFS.Extent(); - for (i=1; i<=aNbF; ++i) { - const TopoDS_Shape& aF=aMFS.FindKey(i); - const TopTools_ListOfShape& aLS=aMFS(i); - aNbS=aLS.Extent(); - if (aNbS==2) { - aMF.Add(aF); - } - else { - aBB.Add(aFC, aF); - } - } - // - if (!aMF.Extent()) { - aCSR=aCS; - return; - } - // - TopTools_ListOfShape aLNS; - TopTools_ListIteratorOfListOfShape aItS; - // - NMTAlgo_Tools::MakeShells(aFC, aLNS); - NMTAlgo_Tools::MakeSolids(aLNS); - // - aBB.MakeCompound(aCR); - aItS.Initialize(aLNS); - for ( ;aItS.More(); aItS.Next()) { - const TopoDS_Shape& aS=aItS.Value(); - aBB.Add(aCR, aS); - } - aCSR=aCR; -} -//======================================================================= -//function : FindImageSolid -//purpose : -//======================================================================= - Standard_Boolean NMTAlgo_Tools::FindImageSolid(const TopoDS_Shape& aFC, - const TopTools_IndexedMapOfShape& aMSo, - TopoDS_Shape& aSox) -{ - Standard_Boolean bFound=Standard_False; - Standard_Integer i, j, aNbSo, aNbF, aNbFSo; - TopoDS_Iterator aIt; - TopTools_IndexedMapOfShape aMFC, aMFSo; - // - aIt.Initialize(aFC); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aF=aIt.Value(); - aMFC.Add(aF); - } - // - aNbF=aMFC.Extent(); - aNbSo=aMSo.Extent(); - for (i=1; i<=aNbSo; ++i) { - const TopoDS_Shape& aSo=aMSo(i); - // - bFound=Standard_True; - aMFSo.Clear(); - TopExp::MapShapes(aSo, TopAbs_FACE, aMFSo); - // - aNbFSo=aMFSo.Extent(); - if (aNbFSo!=aNbF) { - bFound=Standard_False; - continue; - } - // - for (j=1; j<=aNbFSo; ++j) { - const TopoDS_Shape& aFSo=aMFSo(j); - if (!aMFC.Contains(aFSo)) { - bFound=Standard_False; - break; - } - } - if (bFound) { - aSox=aSo; - return bFound; - } - } - return bFound; -} diff --git a/src/NMTAlgo/NMTAlgo_Tools.hxx b/src/NMTAlgo/NMTAlgo_Tools.hxx deleted file mode 100644 index d804a886e..000000000 --- a/src/NMTAlgo/NMTAlgo_Tools.hxx +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTAlgo_Tools_HeaderFile -#define _NMTAlgo_Tools_HeaderFile - -#ifndef _TopAbs_Orientation_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class TopoDS_Shell; -class TopoDS_Face; -class TopoDS_Edge; -class TopoDS_Shape; -class TopTools_ListOfShape; -class TopTools_IndexedMapOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class NMTAlgo_Tools { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static void OrientFacesOnShell(const TopoDS_Shell& aShell,TopoDS_Shell& aShellNew) ; -Standard_EXPORT static void OrientFacesOnShell(const TopoDS_Face& aF,TopoDS_Shell& aSh) ; -Standard_EXPORT static TopAbs_Orientation Orientation(const TopoDS_Edge& aE,const TopoDS_Face& aF) ; -Standard_EXPORT static Standard_Integer Sense(const TopoDS_Face& aF1,const TopoDS_Face& aF2) ; -Standard_EXPORT static Standard_Boolean IsInside(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; -Standard_EXPORT static void MakeShells(const TopoDS_Shape& aFC,TopTools_ListOfShape& aLS) ; -Standard_EXPORT static void MakeSolids(TopTools_ListOfShape& aLS) ; -Standard_EXPORT static void MakeSolids(const TopoDS_Shape& aFC,TopTools_ListOfShape& aLS) ; -Standard_EXPORT static void BreakWebs(const TopoDS_Shape& aS1,TopoDS_Shape& aS2) ; -Standard_EXPORT static Standard_Boolean FindImageSolid(const TopoDS_Shape& aFC,const TopTools_IndexedMapOfShape& aMSo,TopoDS_Shape& aSo) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTAlgo/NMTAlgo_Tools.ixx b/src/NMTAlgo/NMTAlgo_Tools.ixx deleted file mode 100644 index 90f39ea0d..000000000 --- a/src/NMTAlgo/NMTAlgo_Tools.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTAlgo/NMTAlgo_Tools.jxx b/src/NMTAlgo/NMTAlgo_Tools.jxx deleted file mode 100644 index 080737905..000000000 --- a/src/NMTAlgo/NMTAlgo_Tools.jxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shell_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _NMTAlgo_Tools_HeaderFile -#include -#endif diff --git a/src/NMTDS/FILES b/src/NMTDS/FILES new file mode 100644 index 000000000..e60c1fcdc --- /dev/null +++ b/src/NMTDS/FILES @@ -0,0 +1,66 @@ +Basics_OCCTVersion.hxx + +NMTDS_BoxBndTree.cxx +NMTDS_BoxBndTree.hxx +NMTDS_BndSphereTree.cxx +NMTDS_BndSphereTree.hxx +NMTDS_BndSphere.hxx +NMTDS_BndSphere.cxx +NMTDS_BndSphere.lxx +NMTDS_IndexRange.hxx +NMTDS_IndexRange.cxx +NMTDS_InterfPool.hxx +NMTDS_InterfPool.cxx +NMTDS_Iterator.hxx +NMTDS_Iterator.cxx +NMTDS_IteratorCheckerSI.hxx +NMTDS_IteratorCheckerSI.cxx +NMTDS_Pair.hxx +NMTDS_Pair.cxx +NMTDS_PairBoolean.hxx +NMTDS_PairBoolean.cxx +NMTDS_PairMapHasher.hxx +NMTDS_PairMapHasher.cxx +NMTDS_PassKey.hxx +NMTDS_PassKey.cxx +NMTDS_PassKeyBoolean.hxx +NMTDS_PassKeyBoolean.cxx +NMTDS_PassKeyMapHasher.hxx +NMTDS_PassKeyMapHasher.cxx +NMTDS_PassKeyShape.hxx +NMTDS_PassKeyShape.cxx +NMTDS_PassKeyShapeMapHasher.hxx +NMTDS_PassKeyShapeMapHasher.cxx +NMTDS_Tools.hxx +NMTDS_Tools.cxx +NMTDS_ShapesDataStructure.hxx +NMTDS_ShapesDataStructure.cxx +NMTDS_InterfType.hxx +NMTDS_PInterfPool.hxx +NMTDS_PIterator.hxx +NMTDS_PShapesDataStructure.hxx + +NMTDS_ListOfPassKey.hxx +NMTDS_ListIteratorOfListOfPassKey.hxx +NMTDS_ListOfPassKeyBoolean.hxx +NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx +NMTDS_ListOfPair.hxx +NMTDS_ListIteratorOfListOfPair.hxx +NMTDS_ListOfPairBoolean.hxx +NMTDS_ListIteratorOfListOfPairBoolean.hxx +NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +NMTDS_MapOfPassKey.hxx +NMTDS_MapIteratorOfMapOfPassKey.hxx +NMTDS_MapOfPassKeyBoolean.hxx +NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx +NMTDS_MapOfPairBoolean.hxx +NMTDS_MapIteratorOfMapOfPairBoolean.hxx +NMTDS_IndexedDataMapOfShapeBox.hxx +NMTDS_IndexedDataMapOfIntegerShape.hxx +NMTDS_IndexedDataMapOfShapeBndSphere.hxx +NMTDS_DataMapOfIntegerMapOfInteger.hxx +NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx + +NMTDS_CArray1OfIndexRange.hxx +NMTDS_CArray1OfIndexRange.cxx diff --git a/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx deleted file mode 100644 index f3b700b7c..000000000 --- a/src/NMTDS/Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile -#define _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger); - -class Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(const NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& operator=(const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)& operator=(const NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger* operator->() const - { - return (NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)(); - - Standard_EXPORT static const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx b/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx deleted file mode 100644 index ae1c3f807..000000000 --- a/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#define _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger); - -class Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& operator=(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& operator=(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger* operator->() const - { - return (NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)(); - - Standard_EXPORT static const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx b/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx deleted file mode 100644 index 947e3c130..000000000 --- a/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#define _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape); - -class Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& operator=(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)& operator=(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape* operator->() const - { - return (NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)(); - - Standard_EXPORT static const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx b/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx deleted file mode 100644 index de064dc6f..000000000 --- a/src/NMTDS/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#define _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox); - -class Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& operator=(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)& operator=(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox* operator->() const - { - return (NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)(); - - Standard_EXPORT static const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx b/src/NMTDS/Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx deleted file mode 100644 index 0e68f8ec1..000000000 --- a/src/NMTDS/Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#define _Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors); - -class Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)(const Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)(const NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& operator=(const Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& operator=(const NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors* operator->() const - { - return (NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)(); - - Standard_EXPORT static const Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_ListNodeOfListOfPassKey.hxx b/src/NMTDS/Handle_NMTDS_ListNodeOfListOfPassKey.hxx deleted file mode 100644 index 6a3d44c1b..000000000 --- a/src/NMTDS/Handle_NMTDS_ListNodeOfListOfPassKey.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_ListNodeOfListOfPassKey_HeaderFile -#define _Handle_NMTDS_ListNodeOfListOfPassKey_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_ListNodeOfListOfPassKey; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKey); - -class Handle(NMTDS_ListNodeOfListOfPassKey) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_ListNodeOfListOfPassKey)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_ListNodeOfListOfPassKey)(const Handle(NMTDS_ListNodeOfListOfPassKey)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_ListNodeOfListOfPassKey)(const NMTDS_ListNodeOfListOfPassKey* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_ListNodeOfListOfPassKey)& operator=(const Handle(NMTDS_ListNodeOfListOfPassKey)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_ListNodeOfListOfPassKey)& operator=(const NMTDS_ListNodeOfListOfPassKey* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_ListNodeOfListOfPassKey* operator->() const - { - return (NMTDS_ListNodeOfListOfPassKey *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_ListNodeOfListOfPassKey)(); - - Standard_EXPORT static const Handle(NMTDS_ListNodeOfListOfPassKey) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_ListNodeOfListOfPassKeyBoolean.hxx b/src/NMTDS/Handle_NMTDS_ListNodeOfListOfPassKeyBoolean.hxx deleted file mode 100644 index 39679e002..000000000 --- a/src/NMTDS/Handle_NMTDS_ListNodeOfListOfPassKeyBoolean.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile -#define _Handle_NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_ListNodeOfListOfPassKeyBoolean; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKeyBoolean); - -class Handle(NMTDS_ListNodeOfListOfPassKeyBoolean) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)(const Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)(const NMTDS_ListNodeOfListOfPassKeyBoolean* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)& operator=(const Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)& operator=(const NMTDS_ListNodeOfListOfPassKeyBoolean* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_ListNodeOfListOfPassKeyBoolean* operator->() const - { - return (NMTDS_ListNodeOfListOfPassKeyBoolean *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)(); - - Standard_EXPORT static const Handle(NMTDS_ListNodeOfListOfPassKeyBoolean) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_StdMapNodeOfMapOfPassKey.hxx b/src/NMTDS/Handle_NMTDS_StdMapNodeOfMapOfPassKey.hxx deleted file mode 100644 index 0aa36f7e2..000000000 --- a/src/NMTDS/Handle_NMTDS_StdMapNodeOfMapOfPassKey.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile -#define _Handle_NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_StdMapNodeOfMapOfPassKey; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKey); - -class Handle(NMTDS_StdMapNodeOfMapOfPassKey) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_StdMapNodeOfMapOfPassKey)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_StdMapNodeOfMapOfPassKey)(const Handle(NMTDS_StdMapNodeOfMapOfPassKey)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_StdMapNodeOfMapOfPassKey)(const NMTDS_StdMapNodeOfMapOfPassKey* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_StdMapNodeOfMapOfPassKey)& operator=(const Handle(NMTDS_StdMapNodeOfMapOfPassKey)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_StdMapNodeOfMapOfPassKey)& operator=(const NMTDS_StdMapNodeOfMapOfPassKey* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_StdMapNodeOfMapOfPassKey* operator->() const - { - return (NMTDS_StdMapNodeOfMapOfPassKey *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_StdMapNodeOfMapOfPassKey)(); - - Standard_EXPORT static const Handle(NMTDS_StdMapNodeOfMapOfPassKey) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx b/src/NMTDS/Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx deleted file mode 100644 index 05e4c0912..000000000 --- a/src/NMTDS/Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile -#define _Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_StdMapNodeOfMapOfPassKeyBoolean; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKeyBoolean); - -class Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)(const Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)(const NMTDS_StdMapNodeOfMapOfPassKeyBoolean* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)& operator=(const Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)& operator=(const NMTDS_StdMapNodeOfMapOfPassKeyBoolean* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_StdMapNodeOfMapOfPassKeyBoolean* operator->() const - { - return (NMTDS_StdMapNodeOfMapOfPassKeyBoolean *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)(); - - Standard_EXPORT static const Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTDS/Makefile.am b/src/NMTDS/Makefile.am index f2dcd7560..a8a43b8dd 100644 --- a/src/NMTDS/Makefile.am +++ b/src/NMTDS/Makefile.am @@ -1,149 +1,98 @@ -# Copyright (C) 2007-2008 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. +# 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. # -# 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 +# 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. # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# 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 NMTAlgo : partition algorithm # File : Makefile.in # Author : Julia DOROVSKIKH # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM -# $Header$ -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files salomeinclude_HEADERS = \ - Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx \ - Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ - Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ - Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ - Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx \ - Handle_NMTDS_ListNodeOfListOfPassKeyBoolean.hxx \ - Handle_NMTDS_ListNodeOfListOfPassKey.hxx \ - Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx \ - Handle_NMTDS_StdMapNodeOfMapOfPassKey.hxx \ + NMTDS_BndSphere.hxx \ + NMTDS_BndSphere.lxx \ + NMTDS_BndSphereTree.hxx \ + NMTDS_BoxBndTree.hxx \ NMTDS_CArray1OfIndexRange.hxx \ NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx \ - NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx \ NMTDS_DataMapOfIntegerMapOfInteger.hxx \ - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ - NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ NMTDS_IndexedDataMapOfIntegerShape.hxx \ + NMTDS_IndexedDataMapOfShapeBndSphere.hxx \ NMTDS_IndexedDataMapOfShapeBox.hxx \ NMTDS_IndexRange.hxx \ - NMTDS_IndexRange.ixx \ - NMTDS_IndexRange.jxx \ NMTDS_InterfPool.hxx \ - NMTDS_InterfPool.ixx \ - NMTDS_InterfPool.jxx \ NMTDS_InterfType.hxx \ - NMTDS_Iterator.hxx \ - NMTDS_Iterator.ixx \ - NMTDS_Iterator.jxx \ NMTDS_IteratorCheckerSI.hxx \ - NMTDS_IteratorCheckerSI.ixx \ - NMTDS_IteratorCheckerSI.jxx \ + NMTDS_Iterator.hxx \ NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx \ + NMTDS_ListIteratorOfListOfPairBoolean.hxx \ + NMTDS_ListIteratorOfListOfPair.hxx \ NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx \ NMTDS_ListIteratorOfListOfPassKey.hxx \ - NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx \ - NMTDS_ListNodeOfListOfPassKeyBoolean.hxx \ - NMTDS_ListNodeOfListOfPassKey.hxx \ NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx \ + NMTDS_ListOfPairBoolean.hxx \ + NMTDS_ListOfPair.hxx \ NMTDS_ListOfPassKeyBoolean.hxx \ NMTDS_ListOfPassKey.hxx \ + NMTDS_MapIteratorOfMapOfPairBoolean.hxx \ NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx \ NMTDS_MapIteratorOfMapOfPassKey.hxx \ + NMTDS_MapOfPairBoolean.hxx \ NMTDS_MapOfPassKeyBoolean.hxx \ NMTDS_MapOfPassKey.hxx \ + NMTDS_PairBoolean.hxx \ + NMTDS_Pair.hxx \ + NMTDS_PairMapHasher.hxx \ NMTDS_PassKeyBoolean.hxx \ - NMTDS_PassKeyBoolean.ixx \ - NMTDS_PassKeyBoolean.jxx \ - NMTDS_PInterfPool.hxx \ - NMTDS_PIterator.hxx \ NMTDS_PassKey.hxx \ - NMTDS_PassKey.ixx \ - NMTDS_PassKey.jxx \ NMTDS_PassKeyMapHasher.hxx \ - NMTDS_PassKeyMapHasher.ixx \ - NMTDS_PassKeyMapHasher.jxx \ NMTDS_PassKeyShape.hxx \ - NMTDS_PassKeyShape.ixx \ - NMTDS_PassKeyShape.jxx \ NMTDS_PassKeyShapeMapHasher.hxx \ - NMTDS_PassKeyShapeMapHasher.ixx \ - NMTDS_PassKeyShapeMapHasher.jxx \ + NMTDS_PInterfPool.hxx \ + NMTDS_PIterator.hxx \ NMTDS_PShapesDataStructure.hxx \ NMTDS_ShapesDataStructure.hxx \ - NMTDS_ShapesDataStructure.ixx \ - NMTDS_ShapesDataStructure.jxx \ - NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx \ - NMTDS_StdMapNodeOfMapOfPassKey.hxx \ - NMTDS_Tools.hxx \ - NMTDS_Tools.ixx \ - NMTDS_Tools.jxx \ - NMTDS_BoxBndTree.hxx + NMTDS_Tools.hxx # Libraries targets lib_LTLIBRARIES = libNMTDS.la dist_libNMTDS_la_SOURCES = \ - NMTDS_CArray1OfIndexRange_0.cxx \ - NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx \ - NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx \ - NMTDS_DataMapOfIntegerMapOfInteger_0.cxx \ - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx \ - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \ - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx \ - NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx \ - NMTDS_IndexedDataMapOfIntegerShape_0.cxx \ - NMTDS_IndexedDataMapOfShapeBox_0.cxx \ + NMTDS_BndSphere.cxx \ + NMTDS_BndSphereTree.cxx \ + NMTDS_BoxBndTree.cxx \ + NMTDS_CArray1OfIndexRange.cxx \ NMTDS_IndexRange.cxx \ NMTDS_InterfPool.cxx \ - NMTDS_Iterator.cxx \ NMTDS_IteratorCheckerSI.cxx \ - NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx \ - NMTDS_ListIteratorOfListOfPassKey_0.cxx \ - NMTDS_ListIteratorOfListOfPassKeyBoolean_0.cxx \ - NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx \ - NMTDS_ListNodeOfListOfPassKey_0.cxx \ - NMTDS_ListNodeOfListOfPassKeyBoolean_0.cxx \ - NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx \ - NMTDS_ListOfPassKey_0.cxx \ - NMTDS_ListOfPassKeyBoolean_0.cxx \ - NMTDS_MapIteratorOfMapOfPassKey_0.cxx \ - NMTDS_MapIteratorOfMapOfPassKeyBoolean_0.cxx \ - NMTDS_MapOfPassKey_0.cxx \ - NMTDS_MapOfPassKeyBoolean_0.cxx \ + NMTDS_Iterator.cxx \ + NMTDS_PairBoolean.cxx \ + NMTDS_Pair.cxx \ + NMTDS_PairMapHasher.cxx \ NMTDS_PassKeyBoolean.cxx \ NMTDS_PassKey.cxx \ NMTDS_PassKeyMapHasher.cxx \ NMTDS_PassKeyShape.cxx \ NMTDS_PassKeyShapeMapHasher.cxx \ NMTDS_ShapesDataStructure.cxx \ - NMTDS_StdMapNodeOfMapOfPassKey_0.cxx \ - NMTDS_StdMapNodeOfMapOfPassKeyBoolean_0.cxx \ - NMTDS_Tools.cxx \ - NMTDS_BoxBndTree.cxx + NMTDS_Tools.cxx # additional information to compile and link file @@ -156,18 +105,8 @@ libNMTDS_la_LDFLAGS = \ $(CAS_LDPATH) -lTKBool -lTKBO # extra dist files -CDL_FILES = \ - NMTDS.cdl \ - NMTDS_IndexRange.cdl \ - NMTDS_InterfPool.cdl \ - NMTDS_Iterator.cdl \ - NMTDS_IteratorCheckerSI.cdl \ - NMTDS_PassKey.cdl \ - NMTDS_PassKeyBoolean.cdl \ - NMTDS_PassKeyMapHasher.cdl \ - NMTDS_PassKeyShape.cdl \ - NMTDS_PassKeyShapeMapHasher.cdl \ - NMTDS_ShapesDataStructure.cdl \ - NMTDS_Tools.cdl +CDL_FILES = NMTDS.cdl -EXTRA_DIST += $(CDL_FILES) +EXTRA_DIST += \ + $(CDL_FILES) \ + FILES diff --git a/src/NMTDS/NMTDS.cdl b/src/NMTDS/NMTDS.cdl index bcee78278..de747be18 100644 --- a/src/NMTDS/NMTDS.cdl +++ b/src/NMTDS/NMTDS.cdl @@ -1,24 +1,25 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: NMTDS.cdl -- Created: Fri Nov 28 10:13:19 2003 -- Author: Peter KURNEV @@ -27,93 +28,67 @@ package NMTDS ---Purpose: -uses - TCollection, - TColStd, - Bnd, - TopoDS, - TopAbs, - TopTools, - BooleanOperations, - BOPTools, - BOPTColStd +--uses + --TCollection, + --TColStd, + --gp, + --Bnd, + --TopoDS, + --TopAbs, + --TopTools, + --BooleanOperations, + --BOPTools, + --BOPTColStd is - enumeration InterfType is - TI_VV, - TI_VE, - TI_VF, - TI_EE, - TI_EF, - TI_FF, - TI_UNKNOWN - end InterfType; + imported InterfType from NMTDS; + imported BndSphere from NMTDS; + imported IndexRange from NMTDS; + imported InterfPool from NMTDS; + imported Iterator from NMTDS; + imported IteratorCheckerSI from NMTDS; + imported Pair from NMTDS; + imported PairBoolean from NMTDS; + imported PairMapHasher from NMTDS; + imported PassKey from NMTDS; + imported PassKeyBoolean from NMTDS; + imported PassKeyMapHasher from NMTDS; + imported PassKeyShape from NMTDS; + imported PassKeyShapeMapHasher from NMTDS; + imported Tools from NMTDS; + imported ShapesDataStructure from NMTDS; + imported PShapesDataStructure from NMTDS; + imported PIterator from NMTDS; + imported PInterfPool from NMTDS; -- - class ShapesDataStructure; - class IndexRange; - - -- Modified to Add new classes Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - class Iterator; - - class PassKey; - class PassKeyBoolean; - class PassKeyMapHasher; - -- Contribution of Samtech www.samcef.com END - class PassKeyShape; - class PassKeyShapeMapHasher; - --modified by NIZNHY-PKV Tue Feb 6 10:40:02 2007f - class IteratorCheckerSI; - class Tools; - class InterfPool; - --modified by NIZNHY-PKV Tue Feb 6 10:40:04 2007t - pointer PShapesDataStructure to ShapesDataStructure from NMTDS; - pointer PIterator to Iterator from NMTDS; - pointer PInterfPool to InterfPool from NMTDS; + imported ListOfPassKey from NMTDS; + imported ListIteratorOfListOfPassKey from NMTDS; + + imported ListOfPassKeyBoolean from NMTDS; + imported ListIteratorOfListOfPassKeyBoolean from NMTDS; - class CArray1OfIndexRange instantiates - CArray1 from BOPTColStd(IndexRange from NMTDS); + imported ListOfPair from NMTDS; + imported ListIteratorOfListOfPair from NMTDS; + + imported ListOfPairBoolean from NMTDS; + imported ListIteratorOfListOfPairBoolean from NMTDS; - class ListOfIndexedDataMapOfShapeAncestorsSuccessors instantiates - List from TCollection(IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations); - - class IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger instantiates - IndexedDataMap from TCollection(Integer from Standard, - IndexedDataMapOfShapeInteger from BooleanOperations, - MapIntegerHasher from TColStd); + imported ListOfIndexedDataMapOfShapeAncestorsSuccessors from NMTDS; + imported ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors from NMTDS; - -- Modified to Add new classes Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - class ListOfPassKey instantiates - List from TCollection(PassKey from NMTDS); + imported MapOfPassKey from NMTDS; + imported MapIteratorOfMapOfPassKey from NMTDS; - class MapOfPassKey instantiates - Map from TCollection(PassKey from NMTDS, - PassKeyMapHasher from NMTDS); - - class ListOfPassKeyBoolean instantiates - List from TCollection(PassKeyBoolean from NMTDS); - - class MapOfPassKeyBoolean instantiates - Map from TCollection(PassKeyBoolean from NMTDS, - PassKeyMapHasher from NMTDS); - -- Contribution of Samtech www.samcef.com END - ---modified by NIZNHY-PKV Tue Oct 10 11:19:06 2006f - class IndexedDataMapOfShapeBox - instantiates IndexedDataMap from TCollection (Shape from TopoDS, - Box from Bnd, - ShapeMapHasher from TopTools); - class IndexedDataMapOfIntegerShape - instantiates IndexedDataMap from TCollection (Integer from Standard, - Shape from TopoDS, - MapIntegerHasher from TColStd); - - class DataMapOfIntegerMapOfInteger - instantiates DataMap from TCollection (Integer from Standard, - MapOfInteger from TColStd, - MapIntegerHasher from TColStd); - ---modified by NIZNHY-PKV Tue Oct 10 11:19:08 2006t + imported MapOfPairBoolean from NMTDS; + imported MapIteratorOfMapOfPairBoolean from NMTDS; + + imported IndexedDataMapOfShapeBox from NMTDS; + imported IndexedDataMapOfIntegerShape from NMTDS; + imported IndexedDataMapOfShapeBndSphere from NMTDS; + imported DataMapOfIntegerMapOfInteger from NMTDS; + imported DataMapIteratorOfDataMapOfIntegerMapOfInteger from NMTDS; + + imported CArray1OfIndexRange from NMTDS; + end NMTDS; diff --git a/src/NMTDS/NMTDS.pro b/src/NMTDS/NMTDS.pro deleted file mode 100644 index 7b489ee01..000000000 --- a/src/NMTDS/NMTDS.pro +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = NMTDS -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${STDLIB} $${CAS_LDPATH} -lTKBool -lTKBO - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx -HEADERS += Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx -HEADERS += Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx -HEADERS += Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx -HEADERS += Handle_NMTDS_ListNodeOfListOfPassKeyBoolean.hxx -HEADERS += Handle_NMTDS_ListNodeOfListOfPassKey.hxx -HEADERS += Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx -HEADERS += Handle_NMTDS_StdMapNodeOfMapOfPassKey.hxx -HEADERS += NMTDS_CArray1OfIndexRange.hxx -HEADERS += NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx -HEADERS += NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx -HEADERS += NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx -HEADERS += NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx -HEADERS += NMTDS_IndexedDataMapOfIntegerShape.hxx -HEADERS += NMTDS_IndexedDataMapOfShapeBox.hxx -HEADERS += NMTDS_IndexRange.hxx -HEADERS += NMTDS_Iterator.hxx -HEADERS += NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx -HEADERS += NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx -HEADERS += NMTDS_ListIteratorOfListOfPassKey.hxx -HEADERS += NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx -HEADERS += NMTDS_ListNodeOfListOfPassKeyBoolean.hxx -HEADERS += NMTDS_ListNodeOfListOfPassKey.hxx -HEADERS += NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx -HEADERS += NMTDS_ListOfPassKeyBoolean.hxx -HEADERS += NMTDS_ListOfPassKey.hxx -HEADERS += NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx -HEADERS += NMTDS_MapIteratorOfMapOfPassKey.hxx -HEADERS += NMTDS_MapOfPassKeyBoolean.hxx -HEADERS += NMTDS_MapOfPassKey.hxx -HEADERS += NMTDS_PassKeyBoolean.hxx -HEADERS += NMTDS_PassKey.hxx -HEADERS += NMTDS_PassKeyMapHasher.hxx -HEADERS += NMTDS_PShapesDataStructure.hxx -HEADERS += NMTDS_ShapesDataStructure.hxx -HEADERS += NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx -HEADERS += NMTDS_StdMapNodeOfMapOfPassKey.hxx -HEADERS += NMTDS_BoxBndTree.hxx - -SOURCES = NMTDS_CArray1OfIndexRange_0.cxx -SOURCES += NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx -SOURCES += NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx -SOURCES += NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx -SOURCES += NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx -SOURCES += NMTDS_IndexedDataMapOfIntegerShape_0.cxx -SOURCES += NMTDS_IndexedDataMapOfShapeBox_0.cxx -SOURCES += NMTDS_IndexRange.cxx -SOURCES += NMTDS_Iterator.cxx -SOURCES += NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx -SOURCES += NMTDS_ListIteratorOfListOfPassKey_0.cxx -SOURCES += NMTDS_ListIteratorOfListOfPassKeyBoolean_0.cxx -SOURCES += NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx -SOURCES += NMTDS_ListNodeOfListOfPassKey_0.cxx -SOURCES += NMTDS_ListNodeOfListOfPassKeyBoolean_0.cxx -SOURCES += NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx -SOURCES += NMTDS_ListOfPassKey_0.cxx -SOURCES += NMTDS_ListOfPassKeyBoolean_0.cxx -SOURCES += NMTDS_MapIteratorOfMapOfPassKey_0.cxx -SOURCES += NMTDS_MapIteratorOfMapOfPassKeyBoolean_0.cxx -SOURCES += NMTDS_MapOfPassKey_0.cxx -SOURCES += NMTDS_MapOfPassKeyBoolean_0.cxx -SOURCES += NMTDS_PassKeyBoolean.cxx -SOURCES += NMTDS_PassKey.cxx -SOURCES += NMTDS_PassKeyMapHasher.cxx -SOURCES += NMTDS_ShapesDataStructure.cxx -SOURCES += NMTDS_StdMapNodeOfMapOfPassKey_0.cxx -SOURCES += NMTDS_StdMapNodeOfMapOfPassKeyBoolean_0.cxx -SOURCES += NMTDS_BoxBndTree.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/NMTDS/NMTDS_BndSphere.cxx b/src/NMTDS/NMTDS_BndSphere.cxx new file mode 100644 index 000000000..6d1b2d8b2 --- /dev/null +++ b/src/NMTDS/NMTDS_BndSphere.cxx @@ -0,0 +1,57 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_BndSphere.cxx +// Created: +// Author: Peter KURNEV +// +// +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_BndSphere::NMTDS_BndSphere() +{ + myCenter.SetCoord(0., 0., 0.); + myRadius=0.; + myGap=0.; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTDS_BndSphere::~NMTDS_BndSphere() +{ +} +//======================================================================= +//function : IsOut +//purpose : +//======================================================================= + Standard_Boolean NMTDS_BndSphere::IsOut(const NMTDS_BndSphere& theOther)const +{ + Standard_Real aD2, aT2; + // + aD2=myCenter.SquareDistance(theOther.myCenter); + aT2=myRadius+myGap+theOther.myRadius+theOther.myGap; + aT2=aT2*aT2; + // + return aD2>aT2; +} diff --git a/src/NMTDS/NMTDS_BndSphere.hxx b/src/NMTDS/NMTDS_BndSphere.hxx new file mode 100644 index 000000000..9e5f6554e --- /dev/null +++ b/src/NMTDS/NMTDS_BndSphere.hxx @@ -0,0 +1,73 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_BndSphere.hxx +// Created: +// Author: Peter KURNEV +// + +#ifndef _NMTDS_BndSphere_HeaderFile +#define _NMTDS_BndSphere_HeaderFile + +#include +#include +#include +#include +#include + +//======================================================================= +//class : NMTDS_BndSphere +//purpose : +//======================================================================= +class NMTDS_BndSphere { + public: + Standard_EXPORT + NMTDS_BndSphere(); + + Standard_EXPORT + virtual ~NMTDS_BndSphere(); + + void SetCenter(const gp_Pnt& theP) ; + + const gp_Pnt& Center() const; + + void SetRadius(const Standard_Real theR) ; + + Standard_Real Radius() const; + + void SetGap(const Standard_Real theGap) ; + + Standard_Real Gap() const; + + void Add(const NMTDS_BndSphere& theOther) ; + + Standard_EXPORT + Standard_Boolean IsOut(const NMTDS_BndSphere& theOther) const; + + Standard_Real SquareExtent() const; + + protected: + gp_Pnt myCenter; + Standard_Real myRadius; + Standard_Real myGap; +}; + +#include + +#endif diff --git a/src/NMTDS/NMTDS_BndSphere.lxx b/src/NMTDS/NMTDS_BndSphere.lxx new file mode 100644 index 000000000..a7be22637 --- /dev/null +++ b/src/NMTDS/NMTDS_BndSphere.lxx @@ -0,0 +1,108 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_BndSphere.lxx +// Created: +// Author: Peter KURNEV +// +//======================================================================= +//function : SetCenter +//purpose : +//======================================================================= + inline void NMTDS_BndSphere::SetCenter(const gp_Pnt& theP) +// +{ + myCenter=theP; +} +//======================================================================= +//function : Center +//purpose : +//======================================================================= + inline const gp_Pnt& NMTDS_BndSphere::Center()const +{ + return myCenter; +} +//======================================================================= +//function : SetRadius +//purpose : +//======================================================================= + inline void NMTDS_BndSphere::SetRadius(const Standard_Real theR) +{ + myRadius=theR; +} +//======================================================================= +//function : Radius +//purpose : +//======================================================================= + inline Standard_Real NMTDS_BndSphere::Radius()const +{ + return myRadius; +} +//======================================================================= +//function : SetGap +//purpose : +//======================================================================= + inline void NMTDS_BndSphere::SetGap(const Standard_Real theGap) +{ + myGap=theGap; +} +//======================================================================= +//function : Gap +//purpose : +//======================================================================= + inline Standard_Real NMTDS_BndSphere::Gap()const +{ + return myGap; +} +//======================================================================= +//function : Add +//purpose : +//======================================================================= + inline void NMTDS_BndSphere::Add(const NMTDS_BndSphere& theOther) +{ + Standard_Real aTmax, aR, aT, aTOther; + gp_Pnt aPc; + // + aPc.SetXYZ(0.5*(myCenter.XYZ()+theOther.myCenter.XYZ())); + // + aR=aPc.Distance(myCenter); + // + aT=myRadius+myGap; + aTOther=theOther.myRadius+theOther.myGap; + aTmax=(aT>aTOther) ? aT: aTOther; + // + aR=aR+aTmax; + // + myCenter=aPc; + myRadius=aR; +} +//======================================================================= +//function : SquareExtent +//purpose : +//======================================================================= + inline Standard_Real NMTDS_BndSphere::SquareExtent()const +{ + Standard_Real aD; + // + aD=myRadius+myGap; + aD=aD+aD; + aD=aD*aD; + // + return aD; +} diff --git a/src/NMTDS/NMTDS_BndSphereTree.cxx b/src/NMTDS/NMTDS_BndSphereTree.cxx new file mode 100644 index 000000000..a6b449ac9 --- /dev/null +++ b/src/NMTDS/NMTDS_BndSphereTree.cxx @@ -0,0 +1,89 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_BndSphereTree.cxx +// Created: +// Author: Peter KURNEV +// +// +#include +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_BndSphereTreeSelector::NMTDS_BndSphereTreeSelector() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTDS_BndSphereTreeSelector::~NMTDS_BndSphereTreeSelector() +{ +} +//======================================================================= +//function : Reject +//purpose : +//======================================================================= + Standard_Boolean NMTDS_BndSphereTreeSelector::Reject (const NMTDS_BndSphere& aBox) const +{ + Standard_Boolean bRet; + // + bRet=myBox.IsOut(aBox); + return bRet; +} +//======================================================================= +//function : Accept +//purpose : +//======================================================================= + Standard_Boolean NMTDS_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex) +{ + Standard_Boolean bRet=Standard_False; + // + if (myFence.Add(aIndex)) { + myIndices.Append(aIndex); + bRet=!bRet; + } + return bRet; +} +//======================================================================= +//function : SetBox +//purpose : +//======================================================================= + void NMTDS_BndSphereTreeSelector::SetBox(const NMTDS_BndSphere& aBox) +{ + myBox=aBox; +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= + void NMTDS_BndSphereTreeSelector::Clear() +{ + myFence.Clear(); + myIndices.Clear(); +} +//======================================================================= +//function : Indices +//purpose : +//======================================================================= + const TColStd_ListOfInteger& NMTDS_BndSphereTreeSelector::Indices() const +{ + return myIndices; +} diff --git a/src/NMTDS/NMTDS_BndSphereTree.hxx b/src/NMTDS/NMTDS_BndSphereTree.hxx new file mode 100644 index 000000000..1721f1dc0 --- /dev/null +++ b/src/NMTDS/NMTDS_BndSphereTree.hxx @@ -0,0 +1,53 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_BndSphereTree.hxx +// Created: +// Author: Peter KURNEV +// +// +#ifndef NMTDS_BndSphereTree_HeaderFile +#define NMTDS_BndSphereTree_HeaderFile + +#include +#include +#include +#include + +typedef NCollection_UBTree NMTDS_BndSphereTree; + + class NMTDS_BndSphereTreeSelector : public NMTDS_BndSphereTree::Selector { + public: + Standard_EXPORT NMTDS_BndSphereTreeSelector(); + Standard_EXPORT virtual Standard_Boolean Reject(const NMTDS_BndSphere&) const; + Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &); + Standard_EXPORT virtual ~NMTDS_BndSphereTreeSelector(); + + Standard_EXPORT void Clear(); + Standard_EXPORT void SetBox(const NMTDS_BndSphere&); + Standard_EXPORT const TColStd_ListOfInteger& Indices() const; + + protected: + NMTDS_BndSphere myBox; + TColStd_MapOfInteger myFence; + TColStd_ListOfInteger myIndices; + + }; + +#endif diff --git a/src/NMTDS/NMTDS_BoxBndTree.cxx b/src/NMTDS/NMTDS_BoxBndTree.cxx index 88c4e31eb..055007096 100644 --- a/src/NMTDS/NMTDS_BoxBndTree.cxx +++ b/src/NMTDS/NMTDS_BoxBndTree.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_BoxBndTree.cxx -// Created: Tue Oct 17 13:04:11 2006 -// Author: Peter KURNEV -// + +// File: NMTDS_BoxBndTree.cxx +// Created: Tue Oct 17 13:04:11 2006 +// Author: Peter KURNEV +// // #include //======================================================================= diff --git a/src/NMTDS/NMTDS_BoxBndTree.hxx b/src/NMTDS/NMTDS_BoxBndTree.hxx index 5ff1fe74e..9ab98bb43 100755 --- a/src/NMTDS/NMTDS_BoxBndTree.hxx +++ b/src/NMTDS/NMTDS_BoxBndTree.hxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_BoxBndTree.hxx -// Created: Tue Oct 17 12:50:31 2006 -// Author: Peter KURNEV -// + +// File: NMTDS_BoxBndTree.hxx +// Created: Tue Oct 17 12:50:31 2006 +// Author: Peter KURNEV +// // #ifndef NMTDS_BoxBndTree_HeaderFile #define NMTDS_BoxBndTree_HeaderFile diff --git a/src/NMTDS/NMTDS_CArray1OfIndexRange.cxx b/src/NMTDS/NMTDS_CArray1OfIndexRange.cxx new file mode 100644 index 000000000..c984bebf2 --- /dev/null +++ b/src/NMTDS/NMTDS_CArray1OfIndexRange.cxx @@ -0,0 +1,40 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_CArray1OfIndexRange.hxx +// Created: +// Author: Peter KURNEV +// + +#include + +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _Standard_OutOfMemory_HeaderFile +#include +#endif + + +#define Array1Item NMTDS_IndexRange +#define Array1Item_hxx +#define BOPTColStd_CArray1 NMTDS_CArray1OfIndexRange +#define BOPTColStd_CArray1_hxx +#include + diff --git a/src/NMTDS/NMTDS_CArray1OfIndexRange.hxx b/src/NMTDS/NMTDS_CArray1OfIndexRange.hxx index 27d922022..b2451b241 100644 --- a/src/NMTDS/NMTDS_CArray1OfIndexRange.hxx +++ b/src/NMTDS/NMTDS_CArray1OfIndexRange.hxx @@ -1,170 +1,121 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTDS_BndSphere.hxx +// Created: +// Author: Peter KURNEV +// + #ifndef _NMTDS_CArray1OfIndexRange_HeaderFile #define _NMTDS_CArray1OfIndexRange_HeaderFile -#ifndef _Standard_Address_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif +#include + class Standard_OutOfRange; class Standard_OutOfMemory; -class NMTDS_IndexRange; -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - +//======================================================================= +//function : NMTDS_CArray1OfIndexRange +//purpose : +//======================================================================= class NMTDS_CArray1OfIndexRange { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_CArray1OfIndexRange(const Standard_Integer Length = 0,const Standard_Integer BlockLength = 5); - - -Standard_EXPORT void Resize(const Standard_Integer theNewLength) ; - - -Standard_EXPORT void Destroy() ; -~NMTDS_CArray1OfIndexRange() -{ - Destroy(); -} - - - -Standard_EXPORT Standard_Integer Length() const; - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT Standard_Integer FactLength() const; - - -Standard_EXPORT Standard_Integer Append(const NMTDS_IndexRange& Value) ; - - -Standard_EXPORT void Remove(const Standard_Integer Index) ; - - -Standard_EXPORT const NMTDS_IndexRange& Value(const Standard_Integer Index) const; - const NMTDS_IndexRange& operator ()(const Standard_Integer Index) const -{ - return Value(Index); -} - - - -Standard_EXPORT NMTDS_IndexRange& ChangeValue(const Standard_Integer Index) ; - NMTDS_IndexRange& operator ()(const Standard_Integer Index) -{ - return ChangeValue(Index); -} - - - -Standard_EXPORT void SetBlockLength(const Standard_Integer aBL) ; - - -Standard_EXPORT Standard_Integer BlockLength() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_CArray1OfIndexRange(const NMTDS_CArray1OfIndexRange& AnArray); - - -Standard_EXPORT NMTDS_CArray1OfIndexRange& Assign(const NMTDS_CArray1OfIndexRange& Other) ; - NMTDS_CArray1OfIndexRange& operator =(const NMTDS_CArray1OfIndexRange& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const; - - - // Fields PRIVATE - // -Standard_Address myStart; -Standard_Integer myLength; -Standard_Integer myFactLength; -Standard_Integer myBlockLength; -Standard_Boolean myIsAllocated; - - + public: + + Standard_EXPORT + NMTDS_CArray1OfIndexRange(const Standard_Integer Length = 0, + const Standard_Integer BlockLength = 5); + + Standard_EXPORT + void Resize(const Standard_Integer theNewLength) ; + + Standard_EXPORT + void Destroy() ; + + ~NMTDS_CArray1OfIndexRange() { + Destroy(); + } + + Standard_EXPORT + Standard_Integer Length() const; + + Standard_EXPORT + Standard_Integer Extent() const; + + Standard_EXPORT + Standard_Integer FactLength() const; + + Standard_EXPORT + Standard_Integer Append(const NMTDS_IndexRange& Value) ; + + Standard_EXPORT + void Remove(const Standard_Integer Index) ; + + Standard_EXPORT + const NMTDS_IndexRange& Value(const Standard_Integer Index) const; + + const NMTDS_IndexRange& operator ()(const Standard_Integer Index) const { + return Value(Index); + } + + Standard_EXPORT + NMTDS_IndexRange& ChangeValue(const Standard_Integer Index) ; + + NMTDS_IndexRange& operator ()(const Standard_Integer Index) { + return ChangeValue(Index); + } + + Standard_EXPORT + void SetBlockLength(const Standard_Integer aBL) ; + + Standard_EXPORT + Standard_Integer BlockLength() const; + + Standard_EXPORT + void Purge() ; + + private: + Standard_EXPORT + NMTDS_CArray1OfIndexRange(const NMTDS_CArray1OfIndexRange& AnArray); + + Standard_EXPORT + NMTDS_CArray1OfIndexRange& Assign(const NMTDS_CArray1OfIndexRange& Other) ; + + NMTDS_CArray1OfIndexRange& operator =(const NMTDS_CArray1OfIndexRange& Other) { + return Assign(Other); + } + + Standard_EXPORT + Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const; + + + Standard_Address myStart; + Standard_Integer myLength; + Standard_Integer myFactLength; + Standard_Integer myBlockLength; + Standard_Boolean myIsAllocated; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_CArray1OfIndexRange_0.cxx b/src/NMTDS/NMTDS_CArray1OfIndexRange_0.cxx deleted file mode 100644 index ec98e7475..000000000 --- a/src/NMTDS/NMTDS_CArray1OfIndexRange_0.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_OutOfMemory_HeaderFile -#include -#endif -#ifndef _NMTDS_IndexRange_HeaderFile -#include -#endif - - -#define Array1Item NMTDS_IndexRange -#define Array1Item_hxx -#define BOPTColStd_CArray1 NMTDS_CArray1OfIndexRange -#define BOPTColStd_CArray1_hxx -#include - diff --git a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx index 7456aa64c..e139ab938 100644 --- a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx +++ b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx @@ -1,117 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile -#define _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +// File: NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger.hxx +// Created: Mon Feb 20 09:31:43 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TColStd_MapOfInteger; -class TColStd_MapIntegerHasher; -class NMTDS_DataMapOfIntegerMapOfInteger; -class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; +#ifndef NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile +#define NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#include #endif - -class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger(); - - -Standard_EXPORT NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger(const NMTDS_DataMapOfIntegerMapOfInteger& aMap); - - -Standard_EXPORT void Initialize(const NMTDS_DataMapOfIntegerMapOfInteger& aMap) ; - - -Standard_EXPORT const Standard_Integer& Key() const; - - -Standard_EXPORT const TColStd_MapOfInteger& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx deleted file mode 100644 index b6d62d957..000000000 --- a/src/NMTDS/NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_0.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TColStd_MapOfInteger_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif -#ifndef _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TColStd_MapOfInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() -#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger -#define TCollection_DataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx deleted file mode 100644 index 0bfd4cdf3..000000000 --- a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile -#define _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TColStd_MapOfInteger_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TColStd_MapOfInteger; -class TColStd_MapIntegerHasher; -class NMTDS_DataMapOfIntegerMapOfInteger; -class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger; - - - -class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger(const Standard_Integer& K,const TColStd_MapOfInteger& I,const TCollection_MapNodePtr& n); - - Standard_Integer& Key() const; - - TColStd_MapOfInteger& Value() const; -//Standard_EXPORT ~NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myKey; -TColStd_MapOfInteger myValue; - - -}; - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TColStd_MapOfInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() -#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx deleted file mode 100644 index 8c8b273b7..000000000 --- a/src/NMTDS/NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_0.cxx +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TColStd_MapOfInteger_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif -#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif -//NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::~NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger", - sizeof(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger))) { - _anOtherObject = Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)((Handle(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) ; -} -//Standard_Boolean NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger::~Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger() {} -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TColStd_MapOfInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() -#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger -#define TCollection_DataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx index 09e17e834..69278c1a5 100644 --- a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx +++ b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger.hxx @@ -1,156 +1,40 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile -#define _NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TColStd_MapOfInteger; -class TColStd_MapIntegerHasher; -class NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger; -class NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_DataMapOfIntegerMapOfInteger : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger& Assign(const NMTDS_DataMapOfIntegerMapOfInteger& Other) ; - NMTDS_DataMapOfIntegerMapOfInteger& operator =(const NMTDS_DataMapOfIntegerMapOfInteger& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTDS_DataMapOfIntegerMapOfInteger() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const TColStd_MapOfInteger& I) ; - +// File: NMTDS_DataMapOfIntegerMapOfInteger.hxx +// Created: Mon Feb 20 09:27:40 2012 +// Author: +// -Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; +#ifndef NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile +#define NMTDS_DataMapOfIntegerMapOfInteger_HeaderFile -Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT const TColStd_MapOfInteger& Find(const Standard_Integer& K) const; - const TColStd_MapOfInteger& operator()(const Standard_Integer& K) const -{ - return Find(K); -} - - - -Standard_EXPORT TColStd_MapOfInteger& ChangeFind(const Standard_Integer& K) ; - TColStd_MapOfInteger& operator()(const Standard_Integer& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_DataMapOfIntegerMapOfInteger(const NMTDS_DataMapOfIntegerMapOfInteger& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +typedef NCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger; +typedef NMTDS_DataMapOfIntegerMapOfInteger::Iterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger; + +#undef _NCollection_MapHasher #endif diff --git a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx b/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx deleted file mode 100644 index f2bfe7c1c..000000000 --- a/src/NMTDS/NMTDS_DataMapOfIntegerMapOfInteger_0.cxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TColStd_MapOfInteger_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif -#ifndef _NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TColStd_MapOfInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger -#define TCollection_DataMapNode_Type_() NMTDS_DataMapNodeOfDataMapOfIntegerMapOfInteger_Type_() -#define TCollection_DataMap NMTDS_DataMapOfIntegerMapOfInteger -#define TCollection_DataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_IndexRange.cdl b/src/NMTDS/NMTDS_IndexRange.cdl deleted file mode 100644 index 7591eb00f..000000000 --- a/src/NMTDS/NMTDS_IndexRange.cdl +++ /dev/null @@ -1,57 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_IndexRange.cdl --- Created: Fri Nov 28 10:31:05 2003 --- Author: Peter KURNEV --- -class IndexRange from NMTDS - - ---Purpose: - ---uses ---raises - -is - Create - returns IndexRange from NMTDS; - - SetFirst(me:out; - aFirst:Integer from Standard); - - SetLast(me:out; - aLast:Integer from Standard); - - First(me) - returns Integer from Standard; - - Last(me) - returns Integer from Standard; - - IsInRange(me; - aIndex:Integer from Standard) - returns Boolean from Standard; - -fields - myFirst : Integer from Standard is protected; - myLast : Integer from Standard is protected; - -end IndexRange; diff --git a/src/NMTDS/NMTDS_IndexRange.cxx b/src/NMTDS/NMTDS_IndexRange.cxx index 55c488ae4..83969f5ae 100644 --- a/src/NMTDS/NMTDS_IndexRange.cxx +++ b/src/NMTDS/NMTDS_IndexRange.cxx @@ -1,30 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_IndexRange.cxx -// Created: Fri Nov 28 10:34:59 2003 -// Author: Peter KURNEV -// + +// File: NMTDS_IndexRange.cxx +// Created: Fri Nov 28 10:34:59 2003 +// Author: Peter KURNEV +// // -#include +#include + //======================================================================= //function :NMTDS_IndexRange::NMTDS_IndexRange //purpose : diff --git a/src/NMTDS/NMTDS_IndexRange.hxx b/src/NMTDS/NMTDS_IndexRange.hxx index 4dad2f6ae..84b055745 100644 --- a/src/NMTDS/NMTDS_IndexRange.hxx +++ b/src/NMTDS/NMTDS_IndexRange.hxx @@ -1,114 +1,62 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef _NMTDS_IndexRange_HeaderFile -#define _NMTDS_IndexRange_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif +// File: NMTDS_IndexRange.hxx +// Created: +// Author: Peter KURNEV +// +// +#ifndef _NMTDS_IndexRange_HeaderFile +#define _NMTDS_IndexRange_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - +#include +#include +//======================================================================= +//class : NMTDS_IndexRange +//purpose : +//======================================================================= class NMTDS_IndexRange { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_IndexRange(); - - -Standard_EXPORT void SetFirst(const Standard_Integer aFirst) ; - - -Standard_EXPORT void SetLast(const Standard_Integer aLast) ; - - -Standard_EXPORT Standard_Integer First() const; - - -Standard_EXPORT Standard_Integer Last() const; - - -Standard_EXPORT Standard_Boolean IsInRange(const Standard_Integer aIndex) const; - - - - + public: + + Standard_EXPORT + NMTDS_IndexRange(); + + Standard_EXPORT void SetFirst(const Standard_Integer aFirst) ; + + Standard_EXPORT void SetLast(const Standard_Integer aLast) ; + + Standard_EXPORT Standard_Integer First() const; + + Standard_EXPORT Standard_Integer Last() const; + + Standard_EXPORT Standard_Boolean IsInRange(const Standard_Integer aIndex) const; protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Standard_Integer myFirst; -Standard_Integer myLast; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + Standard_Integer myFirst; + Standard_Integer myLast; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_IndexRange.ixx b/src/NMTDS/NMTDS_IndexRange.ixx deleted file mode 100644 index 5c9a8d46f..000000000 --- a/src/NMTDS/NMTDS_IndexRange.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_IndexRange.jxx b/src/NMTDS/NMTDS_IndexRange.jxx deleted file mode 100644 index a93688411..000000000 --- a/src/NMTDS/NMTDS_IndexRange.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_IndexRange_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx b/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx deleted file mode 100644 index 189c2495d..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#define _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#include -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _BooleanOperations_IndexedDataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class BooleanOperations_IndexedDataMapOfShapeInteger; -class TColStd_MapIntegerHasher; -class NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger; - - - -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger(const Standard_Integer& K1,const Standard_Integer K2,const BooleanOperations_IndexedDataMapOfShapeInteger& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - Standard_Integer& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - BooleanOperations_IndexedDataMapOfShapeInteger& Value() const; -//Standard_EXPORT ~NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myKey1; -Standard_Integer myKey2; -BooleanOperations_IndexedDataMapOfShapeInteger myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem BooleanOperations_IndexedDataMapOfShapeInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx b/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx deleted file mode 100644 index 14ba8e595..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _BooleanOperations_IndexedDataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#include -#endif -//NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger::~NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger", - sizeof(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger))) { - _anOtherObject = Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)((Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) ; -} -//Standard_Boolean NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger::~Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger() {} -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem BooleanOperations_IndexedDataMapOfShapeInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx b/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx deleted file mode 100644 index 4b10b9e87..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#define _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#include -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class TColStd_MapIntegerHasher; -class NMTDS_IndexedDataMapOfIntegerShape; - - - -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape(const Standard_Integer& K1,const Standard_Integer K2,const TopoDS_Shape& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - Standard_Integer& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - TopoDS_Shape& Value() const; -//Standard_EXPORT ~NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myKey1; -Standard_Integer myKey2; -TopoDS_Shape myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx b/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx deleted file mode 100644 index 15a8485f4..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_IndexedDataMapOfIntegerShape_HeaderFile -#include -#endif -//NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::~NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape", - sizeof(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape))) { - _anOtherObject = Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)((Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) ; -} -//Standard_Boolean NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape::~Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape() {} -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx b/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx deleted file mode 100644 index 04ee903da..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#define _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Bnd_Box_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class Bnd_Box; -class TopTools_ShapeMapHasher; -class NMTDS_IndexedDataMapOfShapeBox; - - - -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox(const TopoDS_Shape& K1,const Standard_Integer K2,const Bnd_Box& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - TopoDS_Shape& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - Bnd_Box& Value() const; -//Standard_EXPORT ~NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey1; -Standard_Integer myKey2; -Bnd_Box myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Bnd_Box -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfShapeBox -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx b/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx deleted file mode 100644 index a63d890cf..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Bnd_Box_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_IndexedDataMapOfShapeBox_HeaderFile -#include -#endif -//NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::~NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox", - sizeof(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox))) { - _anOtherObject = Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)((Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) ; -} -//Standard_Boolean NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox::~Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Bnd_Box -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfShapeBox -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx b/src/NMTDS/NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx deleted file mode 100644 index 7bfc49cca..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#define _NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class BooleanOperations_IndexedDataMapOfShapeInteger; -class TColStd_MapIntegerHasher; -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger& Assign(const NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger& Other) ; - NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger& operator =(const NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const Standard_Integer& K,const BooleanOperations_IndexedDataMapOfShapeInteger& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const Standard_Integer& K,const BooleanOperations_IndexedDataMapOfShapeInteger& T) ; - - -Standard_EXPORT void RemoveLast() ; - - -Standard_EXPORT Standard_Boolean Contains(const Standard_Integer& K) const; - - -Standard_EXPORT const Standard_Integer& FindKey(const Standard_Integer I) const; - - -Standard_EXPORT const BooleanOperations_IndexedDataMapOfShapeInteger& FindFromIndex(const Standard_Integer I) const; - const BooleanOperations_IndexedDataMapOfShapeInteger& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} - - - -Standard_EXPORT BooleanOperations_IndexedDataMapOfShapeInteger& ChangeFromIndex(const Standard_Integer I) ; - BooleanOperations_IndexedDataMapOfShapeInteger& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const Standard_Integer& K) const; - - -Standard_EXPORT const BooleanOperations_IndexedDataMapOfShapeInteger& FindFromKey(const Standard_Integer& K) const; - - -Standard_EXPORT BooleanOperations_IndexedDataMapOfShapeInteger& ChangeFromKey(const Standard_Integer& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger(const NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx b/src/NMTDS/NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx deleted file mode 100644 index 887e0a2f2..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_0.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _BooleanOperations_IndexedDataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem BooleanOperations_IndexedDataMapOfShapeInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerShape.hxx b/src/NMTDS/NMTDS_IndexedDataMapOfIntegerShape.hxx index a97123c77..8ae674ea8 100644 --- a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerShape.hxx +++ b/src/NMTDS/NMTDS_IndexedDataMapOfIntegerShape.hxx @@ -1,171 +1,42 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_IndexedDataMapOfIntegerShape_HeaderFile -#define _NMTDS_IndexedDataMapOfIntegerShape_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class TColStd_MapIntegerHasher; -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_IndexedDataMapOfIntegerShape : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_IndexedDataMapOfIntegerShape(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTDS_IndexedDataMapOfIntegerShape& Assign(const NMTDS_IndexedDataMapOfIntegerShape& Other) ; - NMTDS_IndexedDataMapOfIntegerShape& operator =(const NMTDS_IndexedDataMapOfIntegerShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTDS_IndexedDataMapOfIntegerShape() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const Standard_Integer& K,const TopoDS_Shape& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const Standard_Integer& K,const TopoDS_Shape& T) ; - - -Standard_EXPORT void RemoveLast() ; - +// File: NMTDS_IndexedDataMapOfIntegerShape.hxx +// Created: Mon Feb 20 09:20:07 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const Standard_Integer& K) const; +#ifndef NMTDS_IndexedDataMapOfIntegerShape_HeaderFile +#define NMTDS_IndexedDataMapOfIntegerShape_HeaderFile -Standard_EXPORT const Standard_Integer& FindKey(const Standard_Integer I) const; - - -Standard_EXPORT const TopoDS_Shape& FindFromIndex(const Standard_Integer I) const; - const TopoDS_Shape& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} - - - -Standard_EXPORT TopoDS_Shape& ChangeFromIndex(const Standard_Integer I) ; - TopoDS_Shape& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const Standard_Integer& K) const; - - -Standard_EXPORT const TopoDS_Shape& FindFromKey(const Standard_Integer& K) const; - - -Standard_EXPORT TopoDS_Shape& ChangeFromKey(const Standard_Integer& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_IndexedDataMapOfIntegerShape(const NMTDS_IndexedDataMapOfIntegerShape& Other); - - - // Fields PRIVATE - // - - -}; - +#include +#include +#include +#define _NCollection_MapHasher +#include +typedef NCollection_IndexedDataMap NMTDS_IndexedDataMapOfIntegerShape; + +#undef _NCollection_MapHasher -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerShape_0.cxx b/src/NMTDS/NMTDS_IndexedDataMapOfIntegerShape_0.cxx deleted file mode 100644 index a1bf5c5be..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapOfIntegerShape_0.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TopoDS_Shape -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfIntegerShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_IndexedDataMapOfShapeBndSphere.hxx b/src/NMTDS/NMTDS_IndexedDataMapOfShapeBndSphere.hxx new file mode 100644 index 000000000..23a1df289 --- /dev/null +++ b/src/NMTDS/NMTDS_IndexedDataMapOfShapeBndSphere.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_IndexedDataMapOfShapeBndSphere.hxx +// Created: Mon Feb 20 09:17:01 2012 +// Author: +// + + +#ifndef NMTDS_IndexedDataMapOfShapeBndSphere_HeaderFile +#define NMTDS_IndexedDataMapOfShapeBndSphere_HeaderFile + +#include +#include +#include + +#define _NCollection_MapHasher +#include + + + +typedef NCollection_IndexedDataMap NMTDS_IndexedDataMapOfShapeBndSphere; + +#undef _NCollection_MapHasher + + + + +#endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapOfShapeBox.hxx b/src/NMTDS/NMTDS_IndexedDataMapOfShapeBox.hxx index 1be992921..7c50c3925 100644 --- a/src/NMTDS/NMTDS_IndexedDataMapOfShapeBox.hxx +++ b/src/NMTDS/NMTDS_IndexedDataMapOfShapeBox.hxx @@ -1,172 +1,44 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_IndexedDataMapOfShapeBox_HeaderFile -#define _NMTDS_IndexedDataMapOfShapeBox_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class Bnd_Box; -class TopTools_ShapeMapHasher; -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_IndexedDataMapOfShapeBox : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_IndexedDataMapOfShapeBox(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTDS_IndexedDataMapOfShapeBox& Assign(const NMTDS_IndexedDataMapOfShapeBox& Other) ; - NMTDS_IndexedDataMapOfShapeBox& operator =(const NMTDS_IndexedDataMapOfShapeBox& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTDS_IndexedDataMapOfShapeBox() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const Bnd_Box& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const Bnd_Box& T) ; - - -Standard_EXPORT void RemoveLast() ; +// File: NMTDS_IndexedDataMapOfShapeBox.hxx +// Created: Mon Feb 20 09:17:01 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; +#ifndef NMTDS_IndexedDataMapOfShapeBox_HeaderFile +#define NMTDS_IndexedDataMapOfShapeBox_HeaderFile -Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; +#include +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT const Bnd_Box& FindFromIndex(const Standard_Integer I) const; - const Bnd_Box& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} +typedef NCollection_IndexedDataMap NMTDS_IndexedDataMapOfShapeBox; + +#undef _NCollection_MapHasher -Standard_EXPORT Bnd_Box& ChangeFromIndex(const Standard_Integer I) ; - Bnd_Box& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; - - -Standard_EXPORT const Bnd_Box& FindFromKey(const TopoDS_Shape& K) const; - - -Standard_EXPORT Bnd_Box& ChangeFromKey(const TopoDS_Shape& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_IndexedDataMapOfShapeBox(const NMTDS_IndexedDataMapOfShapeBox& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/NMTDS/NMTDS_IndexedDataMapOfShapeBox_0.cxx b/src/NMTDS/NMTDS_IndexedDataMapOfShapeBox_0.cxx deleted file mode 100644 index 1d753c44d..000000000 --- a/src/NMTDS/NMTDS_IndexedDataMapOfShapeBox_0.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Bnd_Box_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem Bnd_Box -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox -#define TCollection_IndexedDataMapNode_Type_() NMTDS_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_Type_() -#define TCollection_IndexedDataMap NMTDS_IndexedDataMapOfShapeBox -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTDS/NMTDS_InterfPool.cdl b/src/NMTDS/NMTDS_InterfPool.cdl deleted file mode 100644 index 9b763286a..000000000 --- a/src/NMTDS/NMTDS_InterfPool.cdl +++ /dev/null @@ -1,150 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_InterfPool.cdl --- Created: Wed Feb 21 10:10:58 2007 --- Author: Peter KURNEV --- -class InterfPool from NMTDS - - ---Purpose: - -uses - MapOfPassKeyBoolean from NMTDS, - ListOfPassKeyBoolean from NMTDS, - PassKeyBoolean from NMTDS, - InterfType from NMTDS, - -- - CArray1OfSSInterference from BOPTools, - CArray1OfESInterference from BOPTools, - CArray1OfVSInterference from BOPTools, - CArray1OfEEInterference from BOPTools, - CArray1OfVEInterference from BOPTools, - CArray1OfVVInterference from BOPTools - ---raises - -is - Create - returns InterfPool from NMTDS; - ---C++: alias "Standard_EXPORT virtual ~NMTDS_InterfPool();" - - - Add (me:out; - aPKB : PassKeyBoolean from NMTDS; - aType: InterfType from NMTDS) - returns Boolean from Standard; - - Add (me:out; - aInd1 : Integer from Standard; - aInd2 : Integer from Standard; - aType : InterfType from NMTDS) - returns Boolean from Standard; - - Add (me:out; - aInd1 : Integer from Standard; - aInd2 : Integer from Standard; - bFlag : Boolean from Standard; - aType : InterfType from NMTDS) - returns Boolean from Standard; - - Contains(me; - aPKB : PassKeyBoolean from NMTDS) - returns Boolean from Standard; - - Contains(me; - aInd1 : Integer from Standard; - aInd2 : Integer from Standard) - returns Boolean from Standard; - - Get(me) - returns ListOfPassKeyBoolean from NMTDS; - ---C++: return const & - - Get(me; - aType : InterfType from NMTDS) - returns ListOfPassKeyBoolean from NMTDS; - ---C++: return const & - - Get(me; - aInd : Integer from Standard) - returns ListOfPassKeyBoolean from NMTDS; - ---C++: return const & - - Get(me; - aInd : Integer from Standard; - aType: InterfType from NMTDS) - returns ListOfPassKeyBoolean from NMTDS; - ---C++: return const & - - -- - -- Interferences - -- - SSInterferences (me:out) - returns CArray1OfSSInterference from BOPTools; - ---C++: return & - ---Purpose: - --- Returns the reference to array Of F/F interferences - --- - ESInterferences (me:out) - returns CArray1OfESInterference from BOPTools; - ---C++: return & - ---Purpose: - --- Returns the reference to array Of E/F interferences - --- - VSInterferences (me:out) - returns CArray1OfVSInterference from BOPTools; - ---C++: return & - ---Purpose: - --- Returns the reference to array Of V/F interferences - --- - EEInterferences (me:out) - returns CArray1OfEEInterference from BOPTools; - ---C++: return & - ---Purpose: - --- Returns the reference to arrray Of E/E interferences - --- - VEInterferences (me:out) - returns CArray1OfVEInterference from BOPTools; - ---C++: return & - ---Purpose: - --- Returns the reference to arrray Of V/E interferences - --- - VVInterferences (me:out) - returns CArray1OfVVInterference from BOPTools; - ---C++: return & - ---Purpose: - --- Returns the reference to arrray Of V/V interferences - --- - -fields - myTable : MapOfPassKeyBoolean from NMTDS [6] is protected; - myList : ListOfPassKeyBoolean from NMTDS is protected; - myMaxInd: Integer from Standard is protected; - -- - mySSInterferences : CArray1OfSSInterference from BOPTools is protected; - myESInterferences : CArray1OfESInterference from BOPTools is protected; - myVSInterferences : CArray1OfVSInterference from BOPTools is protected; - myEEInterferences : CArray1OfEEInterference from BOPTools is protected; - myVEInterferences : CArray1OfVEInterference from BOPTools is protected; - myVVInterferences : CArray1OfVVInterference from BOPTools is protected; - -end InterfPool; diff --git a/src/NMTDS/NMTDS_InterfPool.cxx b/src/NMTDS/NMTDS_InterfPool.cxx index d601d5cd8..025946bab 100644 --- a/src/NMTDS/NMTDS_InterfPool.cxx +++ b/src/NMTDS/NMTDS_InterfPool.cxx @@ -1,34 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: NMTDS_.InterfPoolcxx -// Created: Wed Feb 21 10:35:35 2007 -// Author: Peter KURNEV -// -// -#include -#include -#include -#include -#include + +// File: NMTDS_InterfPool.cxx +// Author: Peter KURNEV + +#include + +#include +#include +#include +#include + +#include static Standard_Integer TypeToInteger(const NMTDS_InterfType aType); @@ -37,7 +36,7 @@ static //function : //purpose : //======================================================================= - NMTDS_InterfPool::NMTDS_InterfPool() +NMTDS_InterfPool::NMTDS_InterfPool() { myMaxInd=6; } @@ -52,8 +51,8 @@ static //function : Add //purpose : //======================================================================= - Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PassKeyBoolean& aPKB, - const NMTDS_InterfType aType) +Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PairBoolean& aPKB, + const NMTDS_InterfType aType) { Standard_Boolean bRet; Standard_Integer iType; @@ -70,11 +69,11 @@ static //function : Add //purpose : //======================================================================= - Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1, - const Standard_Integer aInd2, - const NMTDS_InterfType aType) +Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1, + const Standard_Integer aInd2, + const NMTDS_InterfType aType) { - NMTDS_PassKeyBoolean aPKB; + NMTDS_PairBoolean aPKB; // aPKB.SetIds(aInd1, aInd2); return Add(aPKB, aType); @@ -83,12 +82,12 @@ static //function : Add //purpose : //======================================================================= - Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1, - const Standard_Integer aInd2, - const Standard_Boolean bFlag, - const NMTDS_InterfType aType) +Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1, + const Standard_Integer aInd2, + const Standard_Boolean bFlag, + const NMTDS_InterfType aType) { - NMTDS_PassKeyBoolean aPKB; + NMTDS_PairBoolean aPKB; // aPKB.SetIds(aInd1, aInd2); aPKB.SetFlag(bFlag); @@ -98,7 +97,7 @@ static //function : Contains //purpose : //======================================================================= - Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PassKeyBoolean& aPKB)const +Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PairBoolean& aPKB)const { Standard_Boolean bRet; Standard_Integer i; @@ -116,9 +115,9 @@ static //purpose : //======================================================================= Standard_Boolean NMTDS_InterfPool::Contains(const Standard_Integer aInd1, - const Standard_Integer aInd2)const + const Standard_Integer aInd2)const { - NMTDS_PassKeyBoolean aPKB; + NMTDS_PairBoolean aPKB; // aPKB.SetIds(aInd1, aInd2); return Contains(aPKB); @@ -127,20 +126,20 @@ static //function : Get //purpose : //======================================================================= - const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get()const +const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get()const { Standard_Integer i; - NMTDS_ListOfPassKeyBoolean* pL; + NMTDS_ListOfPairBoolean* pL; // - pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL=(NMTDS_ListOfPairBoolean*)&myList; pL->Clear(); // for (i=0; iAppend(aPKB); } } @@ -150,23 +149,24 @@ static //function : Get //purpose : //======================================================================= - const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd)const +const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get + (const Standard_Integer aInd)const { Standard_Integer i, n1, n2; - NMTDS_ListOfPassKeyBoolean* pL; + NMTDS_ListOfPairBoolean* pL; // - pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL=(NMTDS_ListOfPairBoolean*)&myList; pL->Clear(); // for (i=0; iAppend(aPKB); + pL->Append(aPKB); } } } @@ -176,21 +176,22 @@ static //function : Get //purpose : //======================================================================= - const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const NMTDS_InterfType aType)const +const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get + (const NMTDS_InterfType aType)const { Standard_Integer iType; - NMTDS_ListOfPassKeyBoolean* pL; + NMTDS_ListOfPairBoolean* pL; // - pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL=(NMTDS_ListOfPairBoolean*)&myList; pL->Clear(); // iType=TypeToInteger(aType); if (iType>-1 && iTypeAppend(aPKB); } } @@ -200,21 +201,22 @@ static //function : Get //purpose : //======================================================================= - const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd, - const NMTDS_InterfType aType)const +const NMTDS_ListOfPairBoolean& NMTDS_InterfPool::Get + (const Standard_Integer aInd, + const NMTDS_InterfType aType)const { Standard_Integer n1, n2; - NMTDS_ListOfPassKeyBoolean *pL, aLPKB; - NMTDS_ListIteratorOfListOfPassKeyBoolean aIt; + NMTDS_ListOfPairBoolean *pL, aLPKB; + NMTDS_ListIteratorOfListOfPairBoolean aIt; // aLPKB=Get(aType); // - pL=(NMTDS_ListOfPassKeyBoolean*)&myList; + pL=(NMTDS_ListOfPairBoolean*)&myList; pL->Clear(); // aIt.Initialize (aLPKB); for (; aIt.More(); aIt.Next()) { - const NMTDS_PassKeyBoolean& aPKB=aIt.Value(); + const NMTDS_PairBoolean& aPKB=aIt.Value(); aPKB.Ids(n1, n2); if(n1==aInd || n2==aInd) { pL->Append(aPKB); @@ -227,7 +229,7 @@ static //function : SSInterferences //purpose : //=========================================================================== - BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences() +BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences() { return mySSInterferences; } @@ -235,7 +237,7 @@ static //function : ESInterferences //purpose : //=========================================================================== - BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences() +BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences() { return myESInterferences; } @@ -243,7 +245,7 @@ static //function : VSInterferences //purpose : //=========================================================================== - BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences() +BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences() { return myVSInterferences; } @@ -251,7 +253,7 @@ static //function : EEInterferences //purpose : //=========================================================================== - BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences() +BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences() { return myEEInterferences; } @@ -259,7 +261,7 @@ static //function : VEInterferences //purpose : //=========================================================================== - BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences() +BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences() { return myVEInterferences; } @@ -267,11 +269,29 @@ static //function : VVInterferences //purpose : //=========================================================================== - BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences() +BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences() { return myVVInterferences; } -//////////////////// + +//modified by NIZNHY-PKV Mon Dec 12 09:07:54 2011f +//======================================================================= +//function : Purge +//purpose : +//======================================================================= +void NMTDS_InterfPool::Purge() +{ +#if OCC_VERSION_LARGE > 0x06050200 + myVVInterferences.Purge(); + myVEInterferences.Purge(); + myEEInterferences.Purge(); + myVSInterferences.Purge(); + myESInterferences.Purge(); + mySSInterferences.Purge(); +#endif +} +//modified by NIZNHY-PKV Mon Dec 12 09:07:58 2011t + //======================================================================= //function : TypeToInteger //purpose : diff --git a/src/NMTDS/NMTDS_InterfPool.hxx b/src/NMTDS/NMTDS_InterfPool.hxx index 3722c0046..71dc6c2ae 100644 --- a/src/NMTDS/NMTDS_InterfPool.hxx +++ b/src/NMTDS/NMTDS_InterfPool.hxx @@ -1,193 +1,123 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: NMTDS_InterfPool.hxx // +// Author: Peter KURNEV + #ifndef _NMTDS_InterfPool_HeaderFile #define _NMTDS_InterfPool_HeaderFile -#ifndef _NMTDS_MapOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile +#include +#include + #include -#endif -#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile #include -#endif -#ifndef _BOPTools_CArray1OfESInterference_HeaderFile #include -#endif -#ifndef _BOPTools_CArray1OfVSInterference_HeaderFile #include -#endif -#ifndef _BOPTools_CArray1OfEEInterference_HeaderFile #include -#endif -#ifndef _BOPTools_CArray1OfVEInterference_HeaderFile #include -#endif -#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _NMTDS_InterfType_HeaderFile #include -#endif -class NMTDS_PassKeyBoolean; -class NMTDS_ListOfPassKeyBoolean; -class BOPTools_CArray1OfSSInterference; -class BOPTools_CArray1OfESInterference; -class BOPTools_CArray1OfVSInterference; -class BOPTools_CArray1OfEEInterference; -class BOPTools_CArray1OfVEInterference; -class BOPTools_CArray1OfVVInterference; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - +#include +#include +#include + +//======================================================================= +//class : NMTDS_InterfPool +//purpose : +//======================================================================= class NMTDS_InterfPool { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_InterfPool(); -Standard_EXPORT virtual ~NMTDS_InterfPool(); - - -Standard_EXPORT Standard_Boolean Add(const NMTDS_PassKeyBoolean& aPKB,const NMTDS_InterfType aType) ; - - -Standard_EXPORT Standard_Boolean Add(const Standard_Integer aInd1,const Standard_Integer aInd2,const NMTDS_InterfType aType) ; - - -Standard_EXPORT Standard_Boolean Add(const Standard_Integer aInd1,const Standard_Integer aInd2,const Standard_Boolean bFlag,const NMTDS_InterfType aType) ; - - -Standard_EXPORT Standard_Boolean Contains(const NMTDS_PassKeyBoolean& aPKB) const; - - -Standard_EXPORT Standard_Boolean Contains(const Standard_Integer aInd1,const Standard_Integer aInd2) const; - - -Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get() const; - - -Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const NMTDS_InterfType aType) const; - - -Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const Standard_Integer aInd) const; - - -Standard_EXPORT const NMTDS_ListOfPassKeyBoolean& Get(const Standard_Integer aInd,const NMTDS_InterfType aType) const; - - -//! Returns the reference to array Of F/F interferences
    -Standard_EXPORT BOPTools_CArray1OfSSInterference& SSInterferences() ; - - -//! Returns the reference to array Of E/F interferences
    -Standard_EXPORT BOPTools_CArray1OfESInterference& ESInterferences() ; - - -//! Returns the reference to array Of V/F interferences
    -Standard_EXPORT BOPTools_CArray1OfVSInterference& VSInterferences() ; - - -//! Returns the reference to arrray Of E/E interferences
    -Standard_EXPORT BOPTools_CArray1OfEEInterference& EEInterferences() ; - - -//! Returns the reference to arrray Of V/E interferences
    -Standard_EXPORT BOPTools_CArray1OfVEInterference& VEInterferences() ; - - -//! Returns the reference to arrray Of V/V interferences
    -Standard_EXPORT BOPTools_CArray1OfVVInterference& VVInterferences() ; - - - - + public: + Standard_EXPORT + NMTDS_InterfPool(); + Standard_EXPORT + virtual ~NMTDS_InterfPool(); + + Standard_EXPORT + Standard_Boolean Add(const NMTDS_PairBoolean& aPKB, + const NMTDS_InterfType aType) ; + + Standard_EXPORT + Standard_Boolean Add(const Standard_Integer aInd1, + const Standard_Integer aInd2, + const NMTDS_InterfType aType) ; + + Standard_EXPORT + Standard_Boolean Add(const Standard_Integer aInd1, + const Standard_Integer aInd2, + const Standard_Boolean bFlag, + const NMTDS_InterfType aType) ; + + Standard_EXPORT + Standard_Boolean Contains(const NMTDS_PairBoolean& aPKB) const; + + Standard_EXPORT + Standard_Boolean Contains(const Standard_Integer aInd1, + const Standard_Integer aInd2) const; + + Standard_EXPORT + const NMTDS_ListOfPairBoolean& Get() const; + + Standard_EXPORT + const NMTDS_ListOfPairBoolean& Get(const NMTDS_InterfType aType) const; + + Standard_EXPORT + const NMTDS_ListOfPairBoolean& Get(const Standard_Integer aInd) const; + + Standard_EXPORT + const NMTDS_ListOfPairBoolean& Get(const Standard_Integer aInd, + const NMTDS_InterfType aType) const; + + //! Returns the reference to array Of F/F interferences
    + Standard_EXPORT BOPTools_CArray1OfSSInterference& SSInterferences() ; + + //! Returns the reference to array Of E/F interferences
    + Standard_EXPORT BOPTools_CArray1OfESInterference& ESInterferences() ; + + //! Returns the reference to array Of V/F interferences
    + Standard_EXPORT BOPTools_CArray1OfVSInterference& VSInterferences() ; + + //! Returns the reference to arrray Of E/E interferences
    + Standard_EXPORT BOPTools_CArray1OfEEInterference& EEInterferences() ; + + //! Returns the reference to arrray Of V/E interferences
    + Standard_EXPORT BOPTools_CArray1OfVEInterference& VEInterferences() ; + + //! Returns the reference to arrray Of V/V interferences
    + Standard_EXPORT BOPTools_CArray1OfVVInterference& VVInterferences() ; + + Standard_EXPORT void Purge() ; protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -NMTDS_MapOfPassKeyBoolean myTable[6]; -NMTDS_ListOfPassKeyBoolean myList; -Standard_Integer myMaxInd; -BOPTools_CArray1OfSSInterference mySSInterferences; -BOPTools_CArray1OfESInterference myESInterferences; -BOPTools_CArray1OfVSInterference myVSInterferences; -BOPTools_CArray1OfEEInterference myEEInterferences; -BOPTools_CArray1OfVEInterference myVEInterferences; -BOPTools_CArray1OfVVInterference myVVInterferences; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + NMTDS_MapOfPairBoolean myTable[6]; + NMTDS_ListOfPairBoolean myList; + Standard_Integer myMaxInd; + BOPTools_CArray1OfSSInterference mySSInterferences; + BOPTools_CArray1OfESInterference myESInterferences; + BOPTools_CArray1OfVSInterference myVSInterferences; + BOPTools_CArray1OfEEInterference myEEInterferences; + BOPTools_CArray1OfVEInterference myVEInterferences; + BOPTools_CArray1OfVVInterference myVVInterferences; + +private: }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_InterfPool.ixx b/src/NMTDS/NMTDS_InterfPool.ixx deleted file mode 100644 index a26acd90d..000000000 --- a/src/NMTDS/NMTDS_InterfPool.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_InterfPool.jxx b/src/NMTDS/NMTDS_InterfPool.jxx deleted file mode 100644 index 5ec012a71..000000000 --- a/src/NMTDS/NMTDS_InterfPool.jxx +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfESInterference_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfVSInterference_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfEEInterference_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfVEInterference_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile -#include -#endif -#ifndef _NMTDS_InterfPool_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_InterfType.hxx b/src/NMTDS/NMTDS_InterfType.hxx index 166313341..5bf1e72a8 100644 --- a/src/NMTDS/NMTDS_InterfType.hxx +++ b/src/NMTDS/NMTDS_InterfType.hxx @@ -1,30 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTDS_InterfType.hxx +// Created: +// Author: Peter KURNEV +// + + #ifndef _NMTDS_InterfType_HeaderFile #define _NMTDS_InterfType_HeaderFile -enum NMTDS_InterfType { - NMTDS_TI_VV, +enum NMTDS_InterfType { +NMTDS_TI_VV, NMTDS_TI_VE, NMTDS_TI_VF, NMTDS_TI_EE, @@ -33,7 +37,6 @@ NMTDS_TI_FF, NMTDS_TI_UNKNOWN }; - #ifndef _Standard_PrimitiveTypes_HeaderFile #include #endif diff --git a/src/NMTDS/NMTDS_Iterator.cdl b/src/NMTDS/NMTDS_Iterator.cdl deleted file mode 100755 index 0bb5a13a1..000000000 --- a/src/NMTDS/NMTDS_Iterator.cdl +++ /dev/null @@ -1,95 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_Iterator.cdl --- Created: Sun May 07 14:58:16 2006 --- Author: Peter KURNEV --- -class Iterator from NMTDS - - ---Purpose: - -uses - DataMapOfIntegerListOfInteger from TColStd, - ShapeEnum from TopAbs, - ShapesDataStructure from NMTDS, - PShapesDataStructure from NMTDS, - ListOfPassKeyBoolean from NMTDS, - ListIteratorOfListOfPassKeyBoolean from NMTDS, - PassKeyBoolean from NMTDS - ---raises - -is - Create - returns Iterator from NMTDS; - ---C++: alias "Standard_EXPORT virtual ~NMTDS_Iterator();" - - - SetDS(me:out; - pDS:PShapesDataStructure from NMTDS); - - DS(me) - returns ShapesDataStructure from NMTDS; - ---C++:return const & - - Initialize(me: out; - aType1: ShapeEnum from TopAbs; - aType2: ShapeEnum from TopAbs); - More(me) - returns Boolean from Standard; - - Next(me: out); - - Current(me; aIndex1:out Integer from Standard; - aIndex2:out Integer from Standard; - aWithSubShape: out Boolean from Standard); - - Prepare(me:out) - is virtual; - - Intersect(me:out) - is virtual protected; - - ExpectedLength(me) - returns Integer from Standard; - - BlockLength(me) - returns Integer from Standard; - - SDVertices(me) - returns DataMapOfIntegerListOfInteger from TColStd; - ---C++:return const & - - FillMVSD(myclass; - aMVSD1:DataMapOfIntegerListOfInteger from TColStd; - aMVSD2:out DataMapOfIntegerListOfInteger from TColStd); - -fields - myDS :PShapesDataStructure from NMTDS is protected; - myLists :ListOfPassKeyBoolean from NMTDS [6] is protected; - myIterator :ListIteratorOfListOfPassKeyBoolean from NMTDS is protected; - myEmptyList:ListOfPassKeyBoolean from NMTDS is protected; - myLength :Integer from Standard is protected; - -- - myMVSD :DataMapOfIntegerListOfInteger from TColStd is protected; - -end Iterator; diff --git a/src/NMTDS/NMTDS_Iterator.cxx b/src/NMTDS/NMTDS_Iterator.cxx index a4069a595..00bd62623 100755 --- a/src/NMTDS/NMTDS_Iterator.cxx +++ b/src/NMTDS/NMTDS_Iterator.cxx @@ -1,29 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_Iterator.cxx -// Created: Sun May 07 15:04:41 2006 -// Author: Peter KURNEV -// -#include + +// File: NMTDS_Iterator.cxx +// Author: Peter KURNEV + +#include // #include // @@ -46,19 +46,20 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include #include +#include //======================================================================= //function : NMTDS_Iterator //purpose : //======================================================================= - NMTDS_Iterator::NMTDS_Iterator() +NMTDS_Iterator::NMTDS_Iterator() { myDS=NULL; myLength=0; @@ -67,14 +68,14 @@ //function : ~NMTDS_Iterator //purpose : //======================================================================= - NMTDS_Iterator::~NMTDS_Iterator() +NMTDS_Iterator::~NMTDS_Iterator() { } //======================================================================= // function: SetDS // purpose: //======================================================================= - void NMTDS_Iterator::SetDS(const NMTDS_PShapesDataStructure& aDS) +void NMTDS_Iterator::SetDS(const NMTDS_PShapesDataStructure& aDS) { myDS=aDS; } @@ -82,7 +83,7 @@ // function: DS // purpose: //======================================================================= - const NMTDS_ShapesDataStructure& NMTDS_Iterator::DS()const +const NMTDS_ShapesDataStructure& NMTDS_Iterator::DS()const { return *myDS; } @@ -90,7 +91,7 @@ // function: ExpectedLength // purpose: //======================================================================= - Standard_Integer NMTDS_Iterator::ExpectedLength() const +Standard_Integer NMTDS_Iterator::ExpectedLength() const { return myLength; } @@ -98,9 +99,9 @@ // function: BlockLength // purpose: //======================================================================= - Standard_Integer NMTDS_Iterator::BlockLength() const +Standard_Integer NMTDS_Iterator::BlockLength() const { - Standard_Integer aNbIIs; + Standard_Integer aNbIIs, iTresh; Standard_Real aCfPredict=.5; aNbIIs=ExpectedLength(); @@ -108,6 +109,13 @@ if (aNbIIs<=1) { return 1; } + //modified by NIZNHY-PKV Mon Dec 12 08:50:50 2011f + iTresh=1000; + if (aNbIIs>iTresh) { + aNbIIs=iTresh; + return aNbIIs; + } + //modified by NIZNHY-PKV Mon Dec 12 08:50:54 2011t // aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs); return aNbIIs; @@ -116,8 +124,8 @@ // function: Initialize // purpose: //======================================================================= - void NMTDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) +void NMTDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) { Standard_Integer iX; // @@ -135,7 +143,7 @@ // function: More // purpose: //======================================================================= - Standard_Boolean NMTDS_Iterator::More()const +Standard_Boolean NMTDS_Iterator::More()const { return myIterator.More(); } @@ -143,7 +151,7 @@ // function: Next // purpose: //======================================================================= - void NMTDS_Iterator::Next() +void NMTDS_Iterator::Next() { myIterator.Next(); } @@ -151,11 +159,11 @@ // function: Current // purpose: //======================================================================= - void NMTDS_Iterator::Current(Standard_Integer& aIndex1, - Standard_Integer& aIndex2, - Standard_Boolean& aWithSubShape) const +void NMTDS_Iterator::Current(Standard_Integer& aIndex1, + Standard_Integer& aIndex2, + Standard_Boolean& aWithSubShape) const { - const NMTDS_PassKeyBoolean& aPKB=myIterator.Value(); + const NMTDS_PairBoolean& aPKB=myIterator.Value(); aPKB.Ids(aIndex1, aIndex2); aWithSubShape=aPKB.Flag(); } @@ -163,7 +171,7 @@ // function: SDVertices // purpose: //======================================================================= - const TColStd_DataMapOfIntegerListOfInteger& NMTDS_Iterator::SDVertices()const +const TColStd_DataMapOfIntegerListOfInteger& NMTDS_Iterator::SDVertices()const { return myMVSD; } @@ -171,7 +179,7 @@ // function: Prepare // purpose: //======================================================================= - void NMTDS_Iterator::Prepare() +void NMTDS_Iterator::Prepare() { Standard_Integer i; // @@ -190,22 +198,19 @@ // function: Intersect // purpose: //======================================================================= - void NMTDS_Iterator::Intersect() +void NMTDS_Iterator::Intersect() { Standard_Boolean bFlag; Standard_Integer aNb, i, aNbB, aNbR, iFlag; - Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV; + Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR, k, aNbLV, aNbLV1; TColStd_ListIteratorOfListOfInteger aIt; TColStd_DataMapOfIntegerInteger aMII; - //modified by NIZNHY-PKV Mon Jan 22 15:08:00 2007f - //TColStd_MapOfInteger aMFence; TColStd_DataMapOfIntegerListOfInteger aMVSD; TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; - //modified by NIZNHY-PKV Mon Jan 22 10:21:50 2007t TopTools_DataMapOfShapeInteger aMSI; TopAbs_ShapeEnum aTi, aTj; - NMTDS_PassKeyBoolean aPKXB; - NMTDS_MapOfPassKeyBoolean aMPKXB; + NMTDS_PairBoolean aPKXB; + NMTDS_MapOfPairBoolean aMPKXB; NMTDS_IndexedDataMapOfShapeBox aMSB; // NMTDS_BoxBndTreeSelector aSelector; @@ -250,7 +255,7 @@ const TopoDS_Shape& aSi=myDS->Shape(i); aTi=aSi.ShapeType(); if (!NMTDS_Tools::HasBRep(aTi)){ - continue; + continue; } const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi); aSelector.Clear(); @@ -259,7 +264,7 @@ aNbSD=aBBTree.Select(aSelector); // if (!aNbSD){ - continue; + continue; } // const TColStd_ListOfInteger& aLI=aSelector.Indices(); @@ -269,56 +274,60 @@ // aIt.Initialize(aLI); for (; aIt.More(); aIt.Next()) { - jB=aIt.Value(); // box index in MII - j=aMII.Find(jB); // DS index - if (j>=i1 && j<=i2) { - continue;// same range - } - // - aPKXB.SetIds(i, j); - // - if (aMPKXB.Add(aPKXB)) { - bFlag=Standard_False;// Bounding boxes are intersected - const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); - const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); - if (aBoxi.IsOut(aBoxj)) { - bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected - } - const TopoDS_Shape& aSj=myDS->Shape(j); - aTj=aSj.ShapeType(); - iX=NMTDS_Tools::TypeToInteger(aTi, aTj); - //bFlag=(iStatus==2); - aPKXB.SetFlag(bFlag); - myLists[iX].Append(aPKXB); - // - // VSD prepare - if (iX==5) { //VV - aLV.Append(j); - } - }// if (aMPKXB.Add(aPKXB)) { + jB=aIt.Value(); // box index in MII + j=aMII.Find(jB); // DS index + if (j>=i1 && j<=i2) { + continue;// same range + } + // + aPKXB.SetIds(i, j); + // + if (aMPKXB.Add(aPKXB)) { + bFlag=Standard_False;// Bounding boxes are intersected + const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); + const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); + if (aBoxi.IsOut(aBoxj)) { + bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected + } + const TopoDS_Shape& aSj=myDS->Shape(j); + aTj=aSj.ShapeType(); + iX=NMTDS_Tools::TypeToInteger(aTi, aTj); + //bFlag=(iStatus==2); + aPKXB.SetFlag(bFlag); + myLists[iX].Append(aPKXB); + // + // VSD prepare + if (iX==5) { //VV + aLV.Append(j); + } + }// if (aMPKXB.Add(aPKXB)) { }// for (; aIt.More(); aIt.Next()) { // // VSD treatment aNbLV=aLV.Extent(); if (aNbLV) { - TColStd_ListOfInteger aLV1; + TColStd_ListOfInteger aLV1; + // + const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + j=aIt.Value(); + const TopoDS_Shape& aSj=myDS->Shape(j); + const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); + iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); + if (!iFlag) { + aLV1.Append(j); + } + else { + aPKXB.SetIds(i, j); + aMPKXB.Remove(aPKXB); + } + } // - const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi); - aIt.Initialize(aLV); - for (; aIt.More(); aIt.Next()) { - j=aIt.Value(); - const TopoDS_Shape& aSj=myDS->Shape(j); - const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); - iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); - if (!iFlag) { - aLV1.Append(j); - } - else { - aPKXB.SetIds(i, j); - aMPKXB.Remove(aPKXB); - } + aNbLV1=aLV1.Extent(); + if (aNbLV1) { + aMVSD.Bind(i, aLV1); } - aMVSD.Bind(i, aLV1); } }//for (i=i1; i<=i2; ++i) { }//for (iR=1; iR -#endif -#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile +#include +#include + #include -#endif -#ifndef _TColStd_DataMapOfIntegerListOfInteger_HeaderFile #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class NMTDS_ShapesDataStructure; -class TColStd_DataMapOfIntegerListOfInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - +#include +#include +#include +#include + +//======================================================================= +//class : NMTDS_Iterator +//purpose : +//======================================================================= class NMTDS_Iterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_Iterator(); -Standard_EXPORT virtual ~NMTDS_Iterator(); - - -Standard_EXPORT void SetDS(const NMTDS_PShapesDataStructure& pDS) ; - - -Standard_EXPORT const NMTDS_ShapesDataStructure& DS() const; - - -Standard_EXPORT void Initialize(const TopAbs_ShapeEnum aType1,const TopAbs_ShapeEnum aType2) ; - - -Standard_EXPORT Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; - - -Standard_EXPORT void Current(Standard_Integer& aIndex1,Standard_Integer& aIndex2,Standard_Boolean& aWithSubShape) const; - - -Standard_EXPORT virtual void Prepare() ; - - -Standard_EXPORT Standard_Integer ExpectedLength() const; - - -Standard_EXPORT Standard_Integer BlockLength() const; - - -Standard_EXPORT const TColStd_DataMapOfIntegerListOfInteger& SDVertices() const; - - -Standard_EXPORT static void FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD1,TColStd_DataMapOfIntegerListOfInteger& aMVSD2) ; - - - - + public: + Standard_EXPORT + NMTDS_Iterator(); + + Standard_EXPORT + virtual ~NMTDS_Iterator(); + + Standard_EXPORT + void SetDS(const NMTDS_PShapesDataStructure& pDS) ; + + Standard_EXPORT + const NMTDS_ShapesDataStructure& DS() const; + + Standard_EXPORT + void Initialize(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) ; + + Standard_EXPORT + Standard_Boolean More() const; + + Standard_EXPORT + void Next() ; + + Standard_EXPORT + void Current(Standard_Integer& aIndex1, + Standard_Integer& aIndex2, + Standard_Boolean& aWithSubShape) const; + + Standard_EXPORT + virtual void Prepare() ; + + Standard_EXPORT + Standard_Integer ExpectedLength() const; + + Standard_EXPORT + Standard_Integer BlockLength() const; + + Standard_EXPORT + const TColStd_DataMapOfIntegerListOfInteger& SDVertices() const; + + Standard_EXPORT + static void FillMVSD(const TColStd_DataMapOfIntegerListOfInteger& aMVSD1, + TColStd_DataMapOfIntegerListOfInteger& aMVSD2) ; protected: - - // Methods PROTECTED - // - - -Standard_EXPORT virtual void Intersect() ; - - - // Fields PROTECTED - // -NMTDS_PShapesDataStructure myDS; -NMTDS_ListOfPassKeyBoolean myLists[6]; -NMTDS_ListIteratorOfListOfPassKeyBoolean myIterator; -NMTDS_ListOfPassKeyBoolean myEmptyList; -Standard_Integer myLength; -TColStd_DataMapOfIntegerListOfInteger myMVSD; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + Standard_EXPORT + virtual void Intersect() ; + // + + NMTDS_PShapesDataStructure myDS; + NMTDS_ListOfPairBoolean myLists[6]; + NMTDS_ListIteratorOfListOfPairBoolean myIterator; + NMTDS_ListOfPairBoolean myEmptyList; + Standard_Integer myLength; + TColStd_DataMapOfIntegerListOfInteger myMVSD; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_Iterator.ixx b/src/NMTDS/NMTDS_Iterator.ixx deleted file mode 100644 index 641e32522..000000000 --- a/src/NMTDS/NMTDS_Iterator.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_Iterator.jxx b/src/NMTDS/NMTDS_Iterator.jxx deleted file mode 100644 index ead7afaf6..000000000 --- a/src/NMTDS/NMTDS_Iterator.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_ShapesDataStructure_HeaderFile -#include -#endif -#ifndef _TColStd_DataMapOfIntegerListOfInteger_HeaderFile -#include -#endif -#ifndef _NMTDS_Iterator_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.cdl b/src/NMTDS/NMTDS_IteratorCheckerSI.cdl deleted file mode 100644 index 1c15c39c6..000000000 --- a/src/NMTDS/NMTDS_IteratorCheckerSI.cdl +++ /dev/null @@ -1,43 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_IteratorCheckerSI.cdl --- Created: Tue Feb 6 10:18:27 2007 --- Author: Peter KURNEV --- -class IteratorCheckerSI from NMTDS - inherits Iterator from NMTDS - - ---Purpose: - ---uses ---raises - -is - Create - returns IteratorCheckerSI from NMTDS; - ---C++: alias "Standard_EXPORT virtual ~NMTDS_IteratorCheckerSI();" - - Intersect(me:out) - is redefined protected; - ---fields -end IteratorCheckerSI; diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.cxx b/src/NMTDS/NMTDS_IteratorCheckerSI.cxx index 310827edd..275333e9d 100644 --- a/src/NMTDS/NMTDS_IteratorCheckerSI.cxx +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.cxx @@ -1,29 +1,26 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: NMTDS_IteratorChecker.cxx -// Created: Tue Feb 6 10:37:59 2007 -// Author: Peter KURNEV -// -#include + +// File: NMTDS_IteratorChecker.hxx +// Author: Peter KURNEV + +#include #include #include @@ -50,8 +47,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -59,7 +56,7 @@ //function : //purpose : //======================================================================= - NMTDS_IteratorCheckerSI::NMTDS_IteratorCheckerSI() +NMTDS_IteratorCheckerSI::NMTDS_IteratorCheckerSI() : NMTDS_Iterator() { @@ -68,14 +65,14 @@ //function : ~ //purpose : //======================================================================= - NMTDS_IteratorCheckerSI::~NMTDS_IteratorCheckerSI() +NMTDS_IteratorCheckerSI::~NMTDS_IteratorCheckerSI() { } //======================================================================= // function: Intersect // purpose: //======================================================================= - void NMTDS_IteratorCheckerSI::Intersect() +void NMTDS_IteratorCheckerSI::Intersect() { Standard_Boolean bFlag; Standard_Integer aNbS, i, aNbA, aNbB, iFlag; @@ -86,10 +83,10 @@ TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD; TopTools_DataMapOfShapeInteger aMSI; TopAbs_ShapeEnum aTi, aTj; - NMTDS_PassKeyBoolean aPKXB; - NMTDS_MapOfPassKeyBoolean aMPKXB; + NMTDS_PairBoolean aPKXB; + NMTDS_MapOfPairBoolean aMPKXB; NMTDS_IndexedDataMapOfShapeBox aMSB; - NMTDS_MapOfPassKeyBoolean aMPA;//myPairsAvoid + NMTDS_MapOfPairBoolean aMPA;//myPairsAvoid // NMTDS_BoxBndTreeSelector aSelector; NMTDS_BoxBndTree aBBTree; @@ -103,22 +100,22 @@ aTi=aSi.ShapeType(); if (NMTDS_Tools::HasBRep(aTi)) { if (aTi!=TopAbs_VERTEX) { - TColStd_IndexedMapOfInteger aMA; - // - myDS->GetAllSuccessors(i, aMA); - // - aNbA=aMA.Extent(); - for (j=1; j<=aNbA; ++j) { - iX=aMA(j); - aPKXB.Clear(); - aPKXB.SetIds(i, iX); - aMPA.Add(aPKXB); - } + TColStd_IndexedMapOfInteger aMA; + // + myDS->GetAllSuccessors(i, aMA); + // + aNbA=aMA.Extent(); + for (j=1; j<=aNbA; ++j) { + iX=aMA(j); + aPKXB.Clear(); + aPKXB.SetIds(i, iX); + aMPA.Add(aPKXB); + } } else { - aPKXB.Clear(); - aPKXB.SetIds(i, i); - aMPA.Add(aPKXB); + aPKXB.Clear(); + aPKXB.SetIds(i, i); + aMPA.Add(aPKXB); } // Bnd_Box aBoxEx; @@ -170,27 +167,27 @@ // aPKXB.SetIds(i, j); if (aMPA.Contains(aPKXB)) { - continue; + continue; } // if (aMPKXB.Add(aPKXB)) { - bFlag=Standard_False;// Bounding boxes are intersected - const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); - const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); - if (aBoxi.IsOut(aBoxj)) { - bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected - } - const TopoDS_Shape& aSj=myDS->Shape(j); - aTj=aSj.ShapeType(); - iX=NMTDS_Tools::TypeToInteger(aTi, aTj); - //bFlag=(iStatus==2); - aPKXB.SetFlag(bFlag); - myLists[iX].Append(aPKXB); - // - // VSD prepare - if (iX==5) { //VV - aLV.Append(j); - } + bFlag=Standard_False;// Bounding boxes are intersected + const Bnd_Box& aBoxi=myDS->GetBoundingBox(i); + const Bnd_Box& aBoxj=myDS->GetBoundingBox(j); + if (aBoxi.IsOut(aBoxj)) { + bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected + } + const TopoDS_Shape& aSj=myDS->Shape(j); + aTj=aSj.ShapeType(); + iX=NMTDS_Tools::TypeToInteger(aTi, aTj); + //bFlag=(iStatus==2); + aPKXB.SetFlag(bFlag); + myLists[iX].Append(aPKXB); + // + // VSD prepare + if (iX==5) { //VV + aLV.Append(j); + } }// if (aMPKXB.Add(aPKXB)) { }// for (; aIt.More(); aIt.Next()) { // @@ -202,18 +199,18 @@ const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi); aIt.Initialize(aLV); for (; aIt.More(); aIt.Next()) { - j=aIt.Value(); - const TopoDS_Shape& aSj=myDS->Shape(j); - const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); - iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); - if (!iFlag) { - aLV1.Append(j); - } - else { - aPKXB.SetIds(i, j); - aMPKXB.Remove(aPKXB); - } - } + j=aIt.Value(); + const TopoDS_Shape& aSj=myDS->Shape(j); + const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj); + iFlag=NMTDS_Tools::ComputeVV(aVi, aVj); + if (!iFlag) { + aLV1.Append(j); + } + else { + aPKXB.SetIds(i, j); + aMPKXB.Remove(aPKXB); + } + } aMVSD.Bind(i, aLV1); } }//for (i=1; i<=aNbS; ++i) { diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.hxx b/src/NMTDS/NMTDS_IteratorCheckerSI.hxx index e083f88e4..3278a86c4 100644 --- a/src/NMTDS/NMTDS_IteratorCheckerSI.hxx +++ b/src/NMTDS/NMTDS_IteratorCheckerSI.hxx @@ -1,98 +1,46 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_IteratorCheckerSI_HeaderFile -#define _NMTDS_IteratorCheckerSI_HeaderFile -#ifndef _NMTDS_Iterator_HeaderFile -#include -#endif +// File: NMTDS_IteratorChecker.cxx +// Author: Peter KURNEV +#ifndef _NMTDS_IteratorCheckerSI_HeaderFile +#define _NMTDS_IteratorCheckerSI_HeaderFile -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - +#include +//======================================================================= +//class : NMTDS_IteratorCheckerSI +//purpose : +//======================================================================= class NMTDS_IteratorCheckerSI : public NMTDS_Iterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_IteratorCheckerSI(); -Standard_EXPORT virtual ~NMTDS_IteratorCheckerSI(); - - - - + public: + + Standard_EXPORT + NMTDS_IteratorCheckerSI(); + Standard_EXPORT + virtual ~NMTDS_IteratorCheckerSI(); protected: - - // Methods PROTECTED - // - - -Standard_EXPORT virtual void Intersect() ; - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + Standard_EXPORT + virtual void Intersect() ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.ixx b/src/NMTDS/NMTDS_IteratorCheckerSI.ixx deleted file mode 100644 index b9fc4a7d9..000000000 --- a/src/NMTDS/NMTDS_IteratorCheckerSI.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_IteratorCheckerSI.jxx b/src/NMTDS/NMTDS_IteratorCheckerSI.jxx deleted file mode 100644 index 569dce04a..000000000 --- a/src/NMTDS/NMTDS_IteratorCheckerSI.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_IteratorCheckerSI_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx b/src/NMTDS/NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx index dd32df2ab..b2738719c 100644 --- a/src/NMTDS/NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +++ b/src/NMTDS/NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx @@ -1,143 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#define _NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoMoreObject; -class Standard_NoSuchObject; -class NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors; -class BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors; -class NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors(); - - -Standard_EXPORT NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors(const NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& L); - - -Standard_EXPORT void Initialize(const NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& L) ; - - Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; +// File: NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// -Standard_EXPORT BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& Value() const; - - -friend class NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Address current; -Standard_Address previous; - - -}; - -#define Item BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_Type_() -#define TCollection_List NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// +#ifndef NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile +#define NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile +#ifndef NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile +#include +#endif #endif diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx b/src/NMTDS/NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx deleted file mode 100644 index b2866f1e1..000000000 --- a/src/NMTDS/NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoMoreObject_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif - - -#define Item BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_Type_() -#define TCollection_List NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfPair.hxx b/src/NMTDS/NMTDS_ListIteratorOfListOfPair.hxx new file mode 100644 index 000000000..958ce936b --- /dev/null +++ b/src/NMTDS/NMTDS_ListIteratorOfListOfPair.hxx @@ -0,0 +1,32 @@ +// Copyright (C) 2007-2012 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 +// +// File: NMTDS_ListIteratorOfListOfPair.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// + + +#ifndef NMTDS_ListIteratorOfListOfPair_HeaderFile +#define NMTDS_ListIteratorOfListOfPair_HeaderFile + +#ifndef NMTDS_ListOfPair_HeaderFile +#include +#endif + +#endif diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfPairBoolean.hxx b/src/NMTDS/NMTDS_ListIteratorOfListOfPairBoolean.hxx new file mode 100644 index 000000000..4353f75be --- /dev/null +++ b/src/NMTDS/NMTDS_ListIteratorOfListOfPairBoolean.hxx @@ -0,0 +1,32 @@ +// Copyright (C) 2007-2012 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 +// +// File: NMTDS_ListIteratorOfListOfPairBoolean.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// + + +#ifndef NMTDS_ListIteratorOfListOfPairBoolean_HeaderFile +#define NMTDS_ListIteratorOfListOfPairBoolean_HeaderFile + +#ifndef NMTDS_ListOfPairBoolean_HeaderFile +#include +#endif + +#endif diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKey.hxx b/src/NMTDS/NMTDS_ListIteratorOfListOfPassKey.hxx index ae3b3990e..8f7980ea2 100644 --- a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKey.hxx +++ b/src/NMTDS/NMTDS_ListIteratorOfListOfPassKey.hxx @@ -1,143 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_ListIteratorOfListOfPassKey_HeaderFile -#define _NMTDS_ListIteratorOfListOfPassKey_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfPassKey_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoMoreObject; -class Standard_NoSuchObject; -class NMTDS_ListOfPassKey; -class NMTDS_PassKey; -class NMTDS_ListNodeOfListOfPassKey; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_ListIteratorOfListOfPassKey { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_ListIteratorOfListOfPassKey(); - - -Standard_EXPORT NMTDS_ListIteratorOfListOfPassKey(const NMTDS_ListOfPassKey& L); - - -Standard_EXPORT void Initialize(const NMTDS_ListOfPassKey& L) ; - - Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; +// File: NMTDS_ListIteratorOfListOfPassKey.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// -Standard_EXPORT NMTDS_PassKey& Value() const; - - -friend class NMTDS_ListOfPassKey; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Address current; -Standard_Address previous; - - -}; - -#define Item NMTDS_PassKey -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKey -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKey_Type_() -#define TCollection_List NMTDS_ListOfPassKey -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// +#ifndef NMTDS_ListIteratorOfListOfPassKey_HeaderFile +#define NMTDS_ListIteratorOfListOfPassKey_HeaderFile +#ifndef NMTDS_ListOfPassKey_HeaderFile +#include +#endif #endif diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx b/src/NMTDS/NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx index efb4d8be9..908b61d72 100644 --- a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx +++ b/src/NMTDS/NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx @@ -1,143 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile -#define _NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoMoreObject; -class Standard_NoSuchObject; -class NMTDS_ListOfPassKeyBoolean; -class NMTDS_PassKeyBoolean; -class NMTDS_ListNodeOfListOfPassKeyBoolean; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_ListIteratorOfListOfPassKeyBoolean { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_ListIteratorOfListOfPassKeyBoolean(); - - -Standard_EXPORT NMTDS_ListIteratorOfListOfPassKeyBoolean(const NMTDS_ListOfPassKeyBoolean& L); - - -Standard_EXPORT void Initialize(const NMTDS_ListOfPassKeyBoolean& L) ; - - Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; +// File: NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// -Standard_EXPORT NMTDS_PassKeyBoolean& Value() const; - - -friend class NMTDS_ListOfPassKeyBoolean; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Address current; -Standard_Address previous; - - -}; - -#define Item NMTDS_PassKeyBoolean -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKeyBoolean -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKeyBoolean_Type_() -#define TCollection_List NMTDS_ListOfPassKeyBoolean -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// +#ifndef NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile +#define NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile +#ifndef NMTDS_ListOfPassKeyBoolean_HeaderFile +#include +#endif #endif diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKeyBoolean_0.cxx b/src/NMTDS/NMTDS_ListIteratorOfListOfPassKeyBoolean_0.cxx deleted file mode 100644 index 161054c20..000000000 --- a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKeyBoolean_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoMoreObject_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile -#include -#endif - - -#define Item NMTDS_PassKeyBoolean -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKeyBoolean -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKeyBoolean_Type_() -#define TCollection_List NMTDS_ListOfPassKeyBoolean -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKey_0.cxx b/src/NMTDS/NMTDS_ListIteratorOfListOfPassKey_0.cxx deleted file mode 100644 index 017140d0f..000000000 --- a/src/NMTDS/NMTDS_ListIteratorOfListOfPassKey_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoMoreObject_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfPassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_ListNodeOfListOfPassKey_HeaderFile -#include -#endif - - -#define Item NMTDS_PassKey -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKey -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKey_Type_() -#define TCollection_List NMTDS_ListOfPassKey -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx b/src/NMTDS/NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx deleted file mode 100644 index 24a28af7e..000000000 --- a/src/NMTDS/NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#define _NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif - -#ifndef _BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors; -class NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors; -class NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors; - - - -class NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors(const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& I,const TCollection_MapNodePtr& n); - - BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& Value() const; -//Standard_EXPORT ~NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors myValue; - - -}; - -#define Item BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_Type_() -#define TCollection_List NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx b/src/NMTDS/NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx deleted file mode 100644 index 875b786e4..000000000 --- a/src/NMTDS/NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -//NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors::~NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors", - sizeof(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors))) { - _anOtherObject = Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)((Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) ; -} -//Standard_Boolean NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors::~Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors() {} -#define Item BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_Type_() -#define TCollection_List NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListNodeOfListOfPassKey.hxx b/src/NMTDS/NMTDS_ListNodeOfListOfPassKey.hxx deleted file mode 100644 index c67b7845d..000000000 --- a/src/NMTDS/NMTDS_ListNodeOfListOfPassKey.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_ListNodeOfListOfPassKey_HeaderFile -#define _NMTDS_ListNodeOfListOfPassKey_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfPassKey_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class NMTDS_PassKey; -class NMTDS_ListOfPassKey; -class NMTDS_ListIteratorOfListOfPassKey; - - - -class NMTDS_ListNodeOfListOfPassKey : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_ListNodeOfListOfPassKey(const NMTDS_PassKey& I,const TCollection_MapNodePtr& n); - - NMTDS_PassKey& Value() const; -//Standard_EXPORT ~NMTDS_ListNodeOfListOfPassKey(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -NMTDS_PassKey myValue; - - -}; - -#define Item NMTDS_PassKey -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKey -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKey_Type_() -#define TCollection_List NMTDS_ListOfPassKey -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_ListNodeOfListOfPassKeyBoolean.hxx b/src/NMTDS/NMTDS_ListNodeOfListOfPassKeyBoolean.hxx deleted file mode 100644 index c2f743118..000000000 --- a/src/NMTDS/NMTDS_ListNodeOfListOfPassKeyBoolean.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile -#define _NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class NMTDS_PassKeyBoolean; -class NMTDS_ListOfPassKeyBoolean; -class NMTDS_ListIteratorOfListOfPassKeyBoolean; - - - -class NMTDS_ListNodeOfListOfPassKeyBoolean : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_ListNodeOfListOfPassKeyBoolean(const NMTDS_PassKeyBoolean& I,const TCollection_MapNodePtr& n); - - NMTDS_PassKeyBoolean& Value() const; -//Standard_EXPORT ~NMTDS_ListNodeOfListOfPassKeyBoolean(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -NMTDS_PassKeyBoolean myValue; - - -}; - -#define Item NMTDS_PassKeyBoolean -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKeyBoolean -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKeyBoolean_Type_() -#define TCollection_List NMTDS_ListOfPassKeyBoolean -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_ListNodeOfListOfPassKeyBoolean_0.cxx b/src/NMTDS/NMTDS_ListNodeOfListOfPassKeyBoolean_0.cxx deleted file mode 100644 index 7145c1532..000000000 --- a/src/NMTDS/NMTDS_ListNodeOfListOfPassKeyBoolean_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile -#include -#endif -//NMTDS_ListNodeOfListOfPassKeyBoolean::~NMTDS_ListNodeOfListOfPassKeyBoolean() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_ListNodeOfListOfPassKeyBoolean_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_ListNodeOfListOfPassKeyBoolean", - sizeof(NMTDS_ListNodeOfListOfPassKeyBoolean), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_ListNodeOfListOfPassKeyBoolean) Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_ListNodeOfListOfPassKeyBoolean) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKeyBoolean))) { - _anOtherObject = Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)((Handle(NMTDS_ListNodeOfListOfPassKeyBoolean)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_ListNodeOfListOfPassKeyBoolean::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKeyBoolean) ; -} -//Standard_Boolean NMTDS_ListNodeOfListOfPassKeyBoolean::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKeyBoolean) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_ListNodeOfListOfPassKeyBoolean::~Handle_NMTDS_ListNodeOfListOfPassKeyBoolean() {} -#define Item NMTDS_PassKeyBoolean -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKeyBoolean -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKeyBoolean_Type_() -#define TCollection_List NMTDS_ListOfPassKeyBoolean -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListNodeOfListOfPassKey_0.cxx b/src/NMTDS/NMTDS_ListNodeOfListOfPassKey_0.cxx deleted file mode 100644 index dcca753f7..000000000 --- a/src/NMTDS/NMTDS_ListNodeOfListOfPassKey_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_ListOfPassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_ListIteratorOfListOfPassKey_HeaderFile -#include -#endif -//NMTDS_ListNodeOfListOfPassKey::~NMTDS_ListNodeOfListOfPassKey() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_ListNodeOfListOfPassKey_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_ListNodeOfListOfPassKey", - sizeof(NMTDS_ListNodeOfListOfPassKey), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_ListNodeOfListOfPassKey) Handle(NMTDS_ListNodeOfListOfPassKey)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_ListNodeOfListOfPassKey) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKey))) { - _anOtherObject = Handle(NMTDS_ListNodeOfListOfPassKey)((Handle(NMTDS_ListNodeOfListOfPassKey)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_ListNodeOfListOfPassKey::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKey) ; -} -//Standard_Boolean NMTDS_ListNodeOfListOfPassKey::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_ListNodeOfListOfPassKey) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_ListNodeOfListOfPassKey::~Handle_NMTDS_ListNodeOfListOfPassKey() {} -#define Item NMTDS_PassKey -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKey -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKey_Type_() -#define TCollection_List NMTDS_ListOfPassKey -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx b/src/NMTDS/NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx index bc3715363..f89d3e3ac 100644 --- a/src/NMTDS/NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +++ b/src/NMTDS/NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx @@ -1,197 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#define _NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors; -class BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors; -class NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors(); - - -Standard_EXPORT void Assign(const NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& Other) ; - void operator=(const NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& Other) -{ - Assign(Other); -} - - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT void Clear() ; -~NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors() -{ - Clear(); -} - - - Standard_Boolean IsEmpty() const; - - -Standard_EXPORT void Prepend(const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& I) ; - - -Standard_EXPORT void Prepend(const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& I,NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors& theIt) ; - - -Standard_EXPORT void Prepend(NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& Other) ; - - -Standard_EXPORT void Append(const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& I) ; - - -Standard_EXPORT void Append(const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& I,NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors& theIt) ; - - -Standard_EXPORT void Append(NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& Other) ; +// File: NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// -Standard_EXPORT BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& First() const; +#ifndef NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile +#define NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile +#include +#include -Standard_EXPORT BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& Last() const; - - -Standard_EXPORT void RemoveFirst() ; - - -Standard_EXPORT void Remove(NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors& It) ; - - -Standard_EXPORT void InsertBefore(const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& I,NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors& It) ; - - -Standard_EXPORT void InsertBefore(NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& Other,NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors& It) ; - - -Standard_EXPORT void InsertAfter(const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& I,NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors& It) ; - - -Standard_EXPORT void InsertAfter(NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& Other,NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors& It) ; - - -friend class NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors(const NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors& Other); - - - // Fields PRIVATE - // -Standard_Address myFirst; -Standard_Address myLast; - - -}; - -#define Item BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_Type_() -#define TCollection_List NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - +typedef NCollection_List NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors; +typedef NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors::Iterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors; #endif diff --git a/src/NMTDS/NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx b/src/NMTDS/NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx deleted file mode 100644 index 66eede0c1..000000000 --- a/src/NMTDS/NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif - - -#define Item BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_Type_() -#define TCollection_List NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListOfPair.hxx b/src/NMTDS/NMTDS_ListOfPair.hxx new file mode 100644 index 000000000..400cd66fb --- /dev/null +++ b/src/NMTDS/NMTDS_ListOfPair.hxx @@ -0,0 +1,34 @@ +// Copyright (C) 2007-2012 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 +// +// File: NMTDS_ListOfPair.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// + + +#ifndef NMTDS_ListOfPair_HeaderFile +#define NMTDS_ListOfPair_HeaderFile + +#include +#include + +typedef NCollection_List NMTDS_ListOfPair; +typedef NMTDS_ListOfPair::Iterator NMTDS_ListIteratorOfListOfPair; + +#endif diff --git a/src/NMTDS/NMTDS_ListOfPairBoolean.hxx b/src/NMTDS/NMTDS_ListOfPairBoolean.hxx new file mode 100644 index 000000000..e45f4b91a --- /dev/null +++ b/src/NMTDS/NMTDS_ListOfPairBoolean.hxx @@ -0,0 +1,34 @@ +// Copyright (C) 2007-2012 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 +// +// File: NMTDS_ListOfPairBoolean.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// + + +#ifndef NMTDS_ListOfPairBoolean_HeaderFile +#define NMTDS_ListOfPairBoolean_HeaderFile + +#include +#include + +typedef NCollection_List NMTDS_ListOfPairBoolean; +typedef NMTDS_ListOfPairBoolean::Iterator NMTDS_ListIteratorOfListOfPairBoolean; + +#endif diff --git a/src/NMTDS/NMTDS_ListOfPassKey.hxx b/src/NMTDS/NMTDS_ListOfPassKey.hxx index 390a3a5d1..3c920f215 100644 --- a/src/NMTDS/NMTDS_ListOfPassKey.hxx +++ b/src/NMTDS/NMTDS_ListOfPassKey.hxx @@ -1,197 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_ListOfPassKey_HeaderFile -#define _NMTDS_ListOfPassKey_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfPassKey_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTDS_ListIteratorOfListOfPassKey; -class NMTDS_PassKey; -class NMTDS_ListNodeOfListOfPassKey; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_ListOfPassKey { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_ListOfPassKey(); - - -Standard_EXPORT void Assign(const NMTDS_ListOfPassKey& Other) ; - void operator=(const NMTDS_ListOfPassKey& Other) -{ - Assign(Other); -} - - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT void Clear() ; -~NMTDS_ListOfPassKey() -{ - Clear(); -} - - - Standard_Boolean IsEmpty() const; - - -Standard_EXPORT void Prepend(const NMTDS_PassKey& I) ; - - -Standard_EXPORT void Prepend(const NMTDS_PassKey& I,NMTDS_ListIteratorOfListOfPassKey& theIt) ; - - -Standard_EXPORT void Prepend(NMTDS_ListOfPassKey& Other) ; - - -Standard_EXPORT void Append(const NMTDS_PassKey& I) ; - - -Standard_EXPORT void Append(const NMTDS_PassKey& I,NMTDS_ListIteratorOfListOfPassKey& theIt) ; - - -Standard_EXPORT void Append(NMTDS_ListOfPassKey& Other) ; +// File: NMTDS_ListOfPassKey.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// -Standard_EXPORT NMTDS_PassKey& First() const; +#ifndef NMTDS_ListOfPassKey_HeaderFile +#define NMTDS_ListOfPassKey_HeaderFile +#include +#include -Standard_EXPORT NMTDS_PassKey& Last() const; - - -Standard_EXPORT void RemoveFirst() ; - - -Standard_EXPORT void Remove(NMTDS_ListIteratorOfListOfPassKey& It) ; - - -Standard_EXPORT void InsertBefore(const NMTDS_PassKey& I,NMTDS_ListIteratorOfListOfPassKey& It) ; - - -Standard_EXPORT void InsertBefore(NMTDS_ListOfPassKey& Other,NMTDS_ListIteratorOfListOfPassKey& It) ; - - -Standard_EXPORT void InsertAfter(const NMTDS_PassKey& I,NMTDS_ListIteratorOfListOfPassKey& It) ; - - -Standard_EXPORT void InsertAfter(NMTDS_ListOfPassKey& Other,NMTDS_ListIteratorOfListOfPassKey& It) ; - - -friend class NMTDS_ListIteratorOfListOfPassKey; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_ListOfPassKey(const NMTDS_ListOfPassKey& Other); - - - // Fields PRIVATE - // -Standard_Address myFirst; -Standard_Address myLast; - - -}; - -#define Item NMTDS_PassKey -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKey -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKey_Type_() -#define TCollection_List NMTDS_ListOfPassKey -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - +typedef NCollection_List NMTDS_ListOfPassKey; +typedef NMTDS_ListOfPassKey::Iterator NMTDS_ListIteratorOfListOfPassKey; #endif diff --git a/src/NMTDS/NMTDS_ListOfPassKeyBoolean.hxx b/src/NMTDS/NMTDS_ListOfPassKeyBoolean.hxx index d4dec7ded..402b6f1d7 100644 --- a/src/NMTDS/NMTDS_ListOfPassKeyBoolean.hxx +++ b/src/NMTDS/NMTDS_ListOfPassKeyBoolean.hxx @@ -1,197 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_ListOfPassKeyBoolean_HeaderFile -#define _NMTDS_ListOfPassKeyBoolean_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTDS_ListIteratorOfListOfPassKeyBoolean; -class NMTDS_PassKeyBoolean; -class NMTDS_ListNodeOfListOfPassKeyBoolean; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_ListOfPassKeyBoolean { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_ListOfPassKeyBoolean(); - - -Standard_EXPORT void Assign(const NMTDS_ListOfPassKeyBoolean& Other) ; - void operator=(const NMTDS_ListOfPassKeyBoolean& Other) -{ - Assign(Other); -} - - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT void Clear() ; -~NMTDS_ListOfPassKeyBoolean() -{ - Clear(); -} - - - Standard_Boolean IsEmpty() const; - - -Standard_EXPORT void Prepend(const NMTDS_PassKeyBoolean& I) ; - - -Standard_EXPORT void Prepend(const NMTDS_PassKeyBoolean& I,NMTDS_ListIteratorOfListOfPassKeyBoolean& theIt) ; - - -Standard_EXPORT void Prepend(NMTDS_ListOfPassKeyBoolean& Other) ; - - -Standard_EXPORT void Append(const NMTDS_PassKeyBoolean& I) ; - - -Standard_EXPORT void Append(const NMTDS_PassKeyBoolean& I,NMTDS_ListIteratorOfListOfPassKeyBoolean& theIt) ; - - -Standard_EXPORT void Append(NMTDS_ListOfPassKeyBoolean& Other) ; +// File: NMTDS_ListOfPassKeyBoolean.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// -Standard_EXPORT NMTDS_PassKeyBoolean& First() const; +#ifndef NMTDS_ListOfPassKeyBoolean_HeaderFile +#define NMTDS_ListOfPassKeyBoolean_HeaderFile +#include +#include -Standard_EXPORT NMTDS_PassKeyBoolean& Last() const; - - -Standard_EXPORT void RemoveFirst() ; - - -Standard_EXPORT void Remove(NMTDS_ListIteratorOfListOfPassKeyBoolean& It) ; - - -Standard_EXPORT void InsertBefore(const NMTDS_PassKeyBoolean& I,NMTDS_ListIteratorOfListOfPassKeyBoolean& It) ; - - -Standard_EXPORT void InsertBefore(NMTDS_ListOfPassKeyBoolean& Other,NMTDS_ListIteratorOfListOfPassKeyBoolean& It) ; - - -Standard_EXPORT void InsertAfter(const NMTDS_PassKeyBoolean& I,NMTDS_ListIteratorOfListOfPassKeyBoolean& It) ; - - -Standard_EXPORT void InsertAfter(NMTDS_ListOfPassKeyBoolean& Other,NMTDS_ListIteratorOfListOfPassKeyBoolean& It) ; - - -friend class NMTDS_ListIteratorOfListOfPassKeyBoolean; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_ListOfPassKeyBoolean(const NMTDS_ListOfPassKeyBoolean& Other); - - - // Fields PRIVATE - // -Standard_Address myFirst; -Standard_Address myLast; - - -}; - -#define Item NMTDS_PassKeyBoolean -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKeyBoolean -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKeyBoolean_Type_() -#define TCollection_List NMTDS_ListOfPassKeyBoolean -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - +typedef NCollection_List NMTDS_ListOfPassKeyBoolean; +typedef NMTDS_ListOfPassKeyBoolean::Iterator NMTDS_ListIteratorOfListOfPassKeyBoolean; #endif diff --git a/src/NMTDS/NMTDS_ListOfPassKeyBoolean_0.cxx b/src/NMTDS/NMTDS_ListOfPassKeyBoolean_0.cxx deleted file mode 100644 index 5b289b553..000000000 --- a/src/NMTDS/NMTDS_ListOfPassKeyBoolean_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_ListIteratorOfListOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_ListNodeOfListOfPassKeyBoolean_HeaderFile -#include -#endif - - -#define Item NMTDS_PassKeyBoolean -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKeyBoolean -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKeyBoolean -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKeyBoolean_Type_() -#define TCollection_List NMTDS_ListOfPassKeyBoolean -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_ListOfPassKey_0.cxx b/src/NMTDS/NMTDS_ListOfPassKey_0.cxx deleted file mode 100644 index a68d4c892..000000000 --- a/src/NMTDS/NMTDS_ListOfPassKey_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_ListIteratorOfListOfPassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_ListNodeOfListOfPassKey_HeaderFile -#include -#endif - - -#define Item NMTDS_PassKey -#define Item_hxx -#define TCollection_ListNode NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTDS_ListIteratorOfListOfPassKey -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTDS_ListNodeOfListOfPassKey -#define TCollection_ListNode_Type_() NMTDS_ListNodeOfListOfPassKey_Type_() -#define TCollection_List NMTDS_ListOfPassKey -#define TCollection_List_hxx -#include - diff --git a/src/NMTDS/NMTDS_MapIteratorOfMapOfPairBoolean.hxx b/src/NMTDS/NMTDS_MapIteratorOfMapOfPairBoolean.hxx new file mode 100644 index 000000000..5bce39236 --- /dev/null +++ b/src/NMTDS/NMTDS_MapIteratorOfMapOfPairBoolean.hxx @@ -0,0 +1,33 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_MapIteratorOfMapOfPairBoolean.hxx +// Created: Mon Feb 20 08:22:39 2012 +// Author: +// + + +#ifndef NMTDS_MapIteratorOfMapOfPairBoolean_HeaderFile +#define NMTDS_MapIteratorOfMapOfPairBoolean_HeaderFile + +#ifndef NMTDS_MapOfPairBoolean_HeaderFile +#include +#endif + +#endif diff --git a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKey.hxx b/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKey.hxx index bdb843bfe..b96214eda 100644 --- a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKey.hxx +++ b/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKey.hxx @@ -1,111 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_MapIteratorOfMapOfPassKey_HeaderFile -#define _NMTDS_MapIteratorOfMapOfPassKey_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTDS_PassKey; -class NMTDS_PassKeyMapHasher; -class NMTDS_MapOfPassKey; -class NMTDS_StdMapNodeOfMapOfPassKey; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_MapIteratorOfMapOfPassKey : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_MapIteratorOfMapOfPassKey(); - - -Standard_EXPORT NMTDS_MapIteratorOfMapOfPassKey(const NMTDS_MapOfPassKey& aMap); - - -Standard_EXPORT void Initialize(const NMTDS_MapOfPassKey& aMap) ; - - -Standard_EXPORT const NMTDS_PassKey& Key() const; +// File: NMRCol_MapIteratorOfMapOfPassKey.hxx +// Created: Mon Feb 20 08:22:39 2012 +// Author: +// +#ifndef NMRCol_MapIteratorOfMapOfPassKey_HeaderFile +#define NMRCol_MapIteratorOfMapOfPassKey_HeaderFile - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - +#ifndef NMTDS_MapOfPassKey_HeaderFile +#include +#endif #endif diff --git a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx b/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx index 52f2bc1df..db4dc221d 100644 --- a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx +++ b/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx @@ -1,111 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_MapIteratorOfMapOfPassKeyBoolean_HeaderFile -#define _NMTDS_MapIteratorOfMapOfPassKeyBoolean_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTDS_PassKeyBoolean; -class NMTDS_PassKeyMapHasher; -class NMTDS_MapOfPassKeyBoolean; -class NMTDS_StdMapNodeOfMapOfPassKeyBoolean; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_MapIteratorOfMapOfPassKeyBoolean : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_MapIteratorOfMapOfPassKeyBoolean(); - - -Standard_EXPORT NMTDS_MapIteratorOfMapOfPassKeyBoolean(const NMTDS_MapOfPassKeyBoolean& aMap); - - -Standard_EXPORT void Initialize(const NMTDS_MapOfPassKeyBoolean& aMap) ; - - -Standard_EXPORT const NMTDS_PassKeyBoolean& Key() const; +// File: NMRCol_MapIteratorOfMapOfPassKeyBoolean.hxx +// Created: Mon Feb 20 08:22:39 2012 +// Author: +// +#ifndef NMRCol_MapIteratorOfMapOfPassKeyBoolean_HeaderFile +#define NMRCol_MapIteratorOfMapOfPassKeyBoolean_HeaderFile - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - +#ifndef NMTDS_MapOfPassKeyBoolean_HeaderFile +#include +#endif #endif diff --git a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKeyBoolean_0.cxx b/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKeyBoolean_0.cxx deleted file mode 100644 index e601bd0a3..000000000 --- a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKeyBoolean_0.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_MapOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile -#include -#endif - - -#define TheKey NMTDS_PassKeyBoolean -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKeyBoolean -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKeyBoolean_Type_() -#define TCollection_Map NMTDS_MapOfPassKeyBoolean -#define TCollection_Map_hxx -#include - diff --git a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKey_0.cxx b/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKey_0.cxx deleted file mode 100644 index 611ca7092..000000000 --- a/src/NMTDS/NMTDS_MapIteratorOfMapOfPassKey_0.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_MapOfPassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile -#include -#endif - - -#define TheKey NMTDS_PassKey -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKey -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKey_Type_() -#define TCollection_Map NMTDS_MapOfPassKey -#define TCollection_Map_hxx -#include - diff --git a/src/NMTDS/NMTDS_MapOfPairBoolean.hxx b/src/NMTDS/NMTDS_MapOfPairBoolean.hxx new file mode 100644 index 000000000..0fdb9c41d --- /dev/null +++ b/src/NMTDS/NMTDS_MapOfPairBoolean.hxx @@ -0,0 +1,40 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_MapOfPairBoolean.hxx +// Created: Mon Feb 20 08:19:07 2012 +// Author: +// + + +#ifndef NMTDS_MapOfPairBoolean_HeaderFile +#define NMTDS_MapOfPairBoolean_HeaderFile + +#include +#include + +#define _NCollection_MapHasher +#include + +typedef NCollection_Map NMTDS_MapOfPairBoolean; +typedef NMTDS_MapOfPairBoolean::Iterator NMTDS_MapIteratorOfMapOfPairBoolean; + +#undef _NCollection_MapHasher + +#endif diff --git a/src/NMTDS/NMTDS_MapOfPassKey.hxx b/src/NMTDS/NMTDS_MapOfPassKey.hxx index e20be33a2..4648a43cf 100644 --- a/src/NMTDS/NMTDS_MapOfPassKey.hxx +++ b/src/NMTDS/NMTDS_MapOfPassKey.hxx @@ -1,139 +1,40 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_MapOfPassKey_HeaderFile -#define _NMTDS_MapOfPassKey_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class NMTDS_PassKey; -class NMTDS_PassKeyMapHasher; -class NMTDS_StdMapNodeOfMapOfPassKey; -class NMTDS_MapIteratorOfMapOfPassKey; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_MapOfPassKey : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_MapOfPassKey(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTDS_MapOfPassKey& Assign(const NMTDS_MapOfPassKey& Other) ; - NMTDS_MapOfPassKey& operator =(const NMTDS_MapOfPassKey& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTDS_MapOfPassKey() -{ - Clear(); -} - +// File: NMTDS_MapOfPassKey.hxx +// Created: Mon Feb 20 08:19:07 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Add(const NMTDS_PassKey& aKey) ; +#ifndef NMTDS_MapOfPassKey_HeaderFile +#define NMTDS_MapOfPassKey_HeaderFile -Standard_EXPORT Standard_Boolean Contains(const NMTDS_PassKey& aKey) const; +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT Standard_Boolean Remove(const NMTDS_PassKey& aKey) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_MapOfPassKey(const NMTDS_MapOfPassKey& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +typedef NCollection_Map NMTDS_MapOfPassKey; +typedef NMTDS_MapOfPassKey::Iterator NMTDS_MapIteratorOfMapOfPassKey; +#undef _NCollection_MapHasher #endif diff --git a/src/NMTDS/NMTDS_MapOfPassKeyBoolean.hxx b/src/NMTDS/NMTDS_MapOfPassKeyBoolean.hxx index d3fcfd8ed..bbc2596e6 100644 --- a/src/NMTDS/NMTDS_MapOfPassKeyBoolean.hxx +++ b/src/NMTDS/NMTDS_MapOfPassKeyBoolean.hxx @@ -1,139 +1,40 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTDS_MapOfPassKeyBoolean_HeaderFile -#define _NMTDS_MapOfPassKeyBoolean_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class NMTDS_PassKeyBoolean; -class NMTDS_PassKeyMapHasher; -class NMTDS_StdMapNodeOfMapOfPassKeyBoolean; -class NMTDS_MapIteratorOfMapOfPassKeyBoolean; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_MapOfPassKeyBoolean : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_MapOfPassKeyBoolean(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTDS_MapOfPassKeyBoolean& Assign(const NMTDS_MapOfPassKeyBoolean& Other) ; - NMTDS_MapOfPassKeyBoolean& operator =(const NMTDS_MapOfPassKeyBoolean& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTDS_MapOfPassKeyBoolean() -{ - Clear(); -} - +// File: NMTDS_MapOfPassKeyBoolean.hxx +// Created: Mon Feb 20 08:19:07 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Add(const NMTDS_PassKeyBoolean& aKey) ; +#ifndef NMTDS_MapOfPassKeyBoolean_HeaderFile +#define NMTDS_MapOfPassKeyBoolean_HeaderFile -Standard_EXPORT Standard_Boolean Contains(const NMTDS_PassKeyBoolean& aKey) const; +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT Standard_Boolean Remove(const NMTDS_PassKeyBoolean& aKey) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTDS_MapOfPassKeyBoolean(const NMTDS_MapOfPassKeyBoolean& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +typedef NCollection_Map NMTDS_MapOfPassKeyBoolean; +typedef NMTDS_MapOfPassKeyBoolean::Iterator NMTDS_MapIteratorOfMapOfPassKeyBoolean; +#undef _NCollection_MapHasher #endif diff --git a/src/NMTDS/NMTDS_MapOfPassKeyBoolean_0.cxx b/src/NMTDS/NMTDS_MapOfPassKeyBoolean_0.cxx deleted file mode 100644 index 4eb82501e..000000000 --- a/src/NMTDS/NMTDS_MapOfPassKeyBoolean_0.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_MapIteratorOfMapOfPassKeyBoolean_HeaderFile -#include -#endif - - -#define TheKey NMTDS_PassKeyBoolean -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKeyBoolean -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKeyBoolean_Type_() -#define TCollection_Map NMTDS_MapOfPassKeyBoolean -#define TCollection_Map_hxx -#include - diff --git a/src/NMTDS/NMTDS_MapOfPassKey_0.cxx b/src/NMTDS/NMTDS_MapOfPassKey_0.cxx deleted file mode 100644 index 2a2a23e96..000000000 --- a/src/NMTDS/NMTDS_MapOfPassKey_0.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_MapIteratorOfMapOfPassKey_HeaderFile -#include -#endif - - -#define TheKey NMTDS_PassKey -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKey -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKey_Type_() -#define TCollection_Map NMTDS_MapOfPassKey -#define TCollection_Map_hxx -#include - diff --git a/src/NMTDS/NMTDS_PInterfPool.hxx b/src/NMTDS/NMTDS_PInterfPool.hxx index 0e7f04d8f..68a45c7dc 100644 --- a/src/NMTDS/NMTDS_PInterfPool.hxx +++ b/src/NMTDS/NMTDS_PInterfPool.hxx @@ -1,24 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTDS_PInterfPool.hxx +// Author: Peter KURNEV + #ifndef _NMTDS_PInterfPool_HeaderFile #define _NMTDS_PInterfPool_HeaderFile diff --git a/src/NMTDS/NMTDS_PIterator.hxx b/src/NMTDS/NMTDS_PIterator.hxx index 0cc2973f4..8c745d979 100644 --- a/src/NMTDS/NMTDS_PIterator.hxx +++ b/src/NMTDS/NMTDS_PIterator.hxx @@ -1,24 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTDS_PIterator.hxx +// Author: Peter KURNEV + #ifndef _NMTDS_PIterator_HeaderFile #define _NMTDS_PIterator_HeaderFile diff --git a/src/NMTDS/NMTDS_PShapesDataStructure.hxx b/src/NMTDS/NMTDS_PShapesDataStructure.hxx index 0bebcb823..66c380da6 100644 --- a/src/NMTDS/NMTDS_PShapesDataStructure.hxx +++ b/src/NMTDS/NMTDS_PShapesDataStructure.hxx @@ -1,24 +1,28 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTDS_PShapesDataStructure.hxx +// Author: Peter KURNEV + #ifndef _NMTDS_PShapesDataStructure_HeaderFile #define _NMTDS_PShapesDataStructure_HeaderFile diff --git a/src/NMTDS/NMTDS_Pair.cxx b/src/NMTDS/NMTDS_Pair.cxx new file mode 100644 index 000000000..5e2fd50bc --- /dev/null +++ b/src/NMTDS/NMTDS_Pair.cxx @@ -0,0 +1,150 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_Pair.cxx +// Author: Peter KURNEV + +#include + +#include +#include +#include +#include + +#ifdef WNT +#pragma warning( disable : 4101) +#endif + +static + Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv); + +//======================================================================= +//function : +//purpose : +//======================================================================= +NMTDS_Pair::NMTDS_Pair() +{ + Clear(); +} +//======================================================================= +//function : +//purpose : +//======================================================================= +NMTDS_Pair::NMTDS_Pair(const NMTDS_Pair& aOther) +{ + myId1=aOther.myId1; + myId2=aOther.myId2; +} +//======================================================================= +//function :operator = +//purpose : +//======================================================================= + NMTDS_Pair& NMTDS_Pair::operator =(const NMTDS_Pair& aOther) +{ + myId1=aOther.myId1; + myId2=aOther.myId2; + return *this; +} +//======================================================================= +//function :~ +//purpose : +//======================================================================= + NMTDS_Pair::~NMTDS_Pair() +{ +} +//======================================================================= +//function :Clear +//purpose : +//======================================================================= + void NMTDS_Pair::Clear() +{ + myId1=0; + myId2=0; +} +//======================================================================= +//function :SetIds +//purpose : +//======================================================================= + void NMTDS_Pair::SetIds(const Standard_Integer aId1, + const Standard_Integer aId2) +{ + Clear(); + myId1=aId1; + myId2=aId2; + if (aId1>aId2) { + myId1=aId2; + myId2=aId1; + } +} +//======================================================================= +//function :Ids +//purpose : +//======================================================================= + void NMTDS_Pair::Ids(Standard_Integer& aId1, + Standard_Integer& aId2) const +{ + aId1=myId1; + aId2=myId2; +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean NMTDS_Pair::IsEqual(const NMTDS_Pair& aOther) const +{ + + Standard_Boolean bRet; + // + bRet=(myId1==aOther.myId1 && myId2==aOther.myId2);//ZZ + return bRet; +} +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer NMTDS_Pair::HashCode(const Standard_Integer aUpper) const +{ + Standard_Integer aSum; + // + aSum=0; + aSum+=NormalizedId(myId1, 2); + aSum+=NormalizedId(myId2, 2); + return ::HashCode(aSum, aUpper); +} +//======================================================================= +// function: NormalizedId +// purpose : +//======================================================================= +Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv) +{ + Standard_Integer aMax, aTresh, aIdRet; + // + aIdRet=aId; + aMax=::IntegerLast(); + aTresh=aMax/aDiv; + if (aId>aTresh) { + aIdRet=aId%aTresh; + } + return aIdRet; +} diff --git a/src/NMTDS/NMTDS_Pair.hxx b/src/NMTDS/NMTDS_Pair.hxx new file mode 100644 index 000000000..d0a4de9f9 --- /dev/null +++ b/src/NMTDS/NMTDS_Pair.hxx @@ -0,0 +1,73 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_Pair.hxx +// Author: Peter KURNEV + +#ifndef _NMTDS_Pair_HeaderFile +#define _NMTDS_Pair_HeaderFile + +#include +#include +#include +#include + +//======================================================================= +//function : NMTDS_Pair +//purpose : +//======================================================================= +class NMTDS_Pair { + public: + Standard_EXPORT + NMTDS_Pair(); + + Standard_EXPORT + virtual ~NMTDS_Pair(); + + Standard_EXPORT + NMTDS_Pair(const NMTDS_Pair& Other); + + Standard_EXPORT + NMTDS_Pair& operator =(const NMTDS_Pair& Other); + + Standard_EXPORT + void Clear() ; + + Standard_EXPORT + void SetIds(const Standard_Integer aI1, + const Standard_Integer aI2) ; + + Standard_EXPORT + void Ids(Standard_Integer& aI1, + Standard_Integer& aI2) const; + + Standard_EXPORT + Standard_Boolean IsEqual(const NMTDS_Pair& aOther) const; + + Standard_EXPORT + Standard_Integer HashCode(const Standard_Integer Upper) const; + +protected: +Standard_Integer myId1; +Standard_Integer myId2; +}; +#endif diff --git a/src/NMTDS/NMTDS_PairBoolean.cxx b/src/NMTDS/NMTDS_PairBoolean.cxx new file mode 100644 index 000000000..9067d5c94 --- /dev/null +++ b/src/NMTDS/NMTDS_PairBoolean.cxx @@ -0,0 +1,70 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_PairBoolean.cxx +// Author: Peter KURNEV + +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTDS_PairBoolean::NMTDS_PairBoolean() +: + myFlag(Standard_False), + NMTDS_Pair() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + NMTDS_PairBoolean::~NMTDS_PairBoolean() +{ +} +//======================================================================= +//function :operator = +//purpose : +//======================================================================= + NMTDS_PairBoolean& NMTDS_PairBoolean::operator =(const NMTDS_PairBoolean& anOther) +{ + myFlag=anOther.myFlag; + NMTDS_Pair::operator =(anOther); + return *this; +} +//======================================================================= +//function :SetFlag +//purpose : +//======================================================================= + void NMTDS_PairBoolean::SetFlag(const Standard_Boolean aFlag) +{ + myFlag=aFlag; +} +//======================================================================= +//function :Flag +//purpose : +//======================================================================= + Standard_Boolean NMTDS_PairBoolean::Flag()const +{ + return myFlag; +} diff --git a/src/NMTDS/NMTDS_PairBoolean.hxx b/src/NMTDS/NMTDS_PairBoolean.hxx new file mode 100644 index 000000000..308c8fc05 --- /dev/null +++ b/src/NMTDS/NMTDS_PairBoolean.hxx @@ -0,0 +1,58 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_PairBoolean.hxx +// Author: Peter KURNEV + +#ifndef _NMTDS_PairBoolean_HeaderFile +#define _NMTDS_PairBoolean_HeaderFile + +#include +#include +#include +#include + +//======================================================================= +//class : NMTDS_PairBoolean +//purpose : +//======================================================================= +class NMTDS_PairBoolean : public NMTDS_Pair { + public: + Standard_EXPORT + NMTDS_PairBoolean(); + + Standard_EXPORT + virtual ~NMTDS_PairBoolean(); + + Standard_EXPORT + void SetFlag(const Standard_Boolean aFlag) ; + + Standard_EXPORT + NMTDS_PairBoolean& operator =(const NMTDS_PairBoolean& Other); + + Standard_EXPORT + Standard_Boolean Flag() const; + +protected: + Standard_Boolean myFlag; +}; +#endif diff --git a/src/NMTDS/NMTDS_PairMapHasher.cxx b/src/NMTDS/NMTDS_PairMapHasher.cxx new file mode 100644 index 000000000..3dadcc181 --- /dev/null +++ b/src/NMTDS/NMTDS_PairMapHasher.cxx @@ -0,0 +1,45 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_PairMapHasher.cxx +// Author: Peter KURNEV + +#include + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= +Standard_Integer NMTDS_PairMapHasher::HashCode(const NMTDS_Pair& aPK, + const Standard_Integer Upper) +{ + return aPK.HashCode(Upper); +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= +Standard_Boolean NMTDS_PairMapHasher::IsEqual(const NMTDS_Pair& aPK1, + const NMTDS_Pair& aPK2) +{ + return aPK1.IsEqual(aPK2); +} diff --git a/src/NMTDS/NMTDS_PairMapHasher.hxx b/src/NMTDS/NMTDS_PairMapHasher.hxx new file mode 100644 index 000000000..19dfea723 --- /dev/null +++ b/src/NMTDS/NMTDS_PairMapHasher.hxx @@ -0,0 +1,49 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTDS_PairMapHasher.cxx +// Author: Peter KURNEV + +#ifndef _NMTDS_PairMapHasher_HeaderFile +#define _NMTDS_PairMapHasher_HeaderFile + +#include +#include +#include +#include +#include + +//======================================================================= +//class : NMTDS_PairMapHasher +//purpose : +//======================================================================= +class NMTDS_PairMapHasher { + public: + Standard_EXPORT + static Standard_Integer HashCode(const NMTDS_Pair& aPKey, + const Standard_Integer Upper) ; + + Standard_EXPORT + static Standard_Boolean IsEqual(const NMTDS_Pair& aPKey1, + const NMTDS_Pair& aPKey2) ; +}; +#endif diff --git a/src/NMTDS/NMTDS_PassKey.cdl b/src/NMTDS/NMTDS_PassKey.cdl deleted file mode 100755 index 62284b520..000000000 --- a/src/NMTDS/NMTDS_PassKey.cdl +++ /dev/null @@ -1,97 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_PassKey.cdl --- Created: Mon Nov 20 12:16:13 2006 --- Author: Peter KURNEV --- -class PassKey from NMTDS - - ---Purpose: - -uses - Shape from TopoDS, - IndexedMapOfInteger from TColStd, - ListOfInteger from TColStd - ---raises - -is - Create - returns PassKey from NMTDS; - ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKey();" - - Create(Other:PassKey from NMTDS) - returns PassKey from NMTDS; - ---C++: alias "Standard_EXPORT NMTDS_PassKey& operator =(const NMTDS_PassKey& Other);" - - Clear(me:out); - - SetIds(me:out; - aI1 :Integer from Standard); - - SetIds(me:out; - aI1 :Integer from Standard; - aI2 :Integer from Standard); - - SetIds(me:out; - aI1 :Integer from Standard; - aI2 :Integer from Standard; - aI3 :Integer from Standard); - - SetIds(me:out; - aI1 :Integer from Standard; - aI2 :Integer from Standard; - aI3 :Integer from Standard; - aI4 :Integer from Standard); - - SetIds(me:out; - aLS :ListOfInteger from TColStd); - - NbIds(me) - returns Integer from Standard; - - IsEqual(me; - aOther:PassKey from NMTDS) - returns Boolean from Standard; - - HashCode(me; - Upper : Integer from Standard) - returns Integer from Standard; - - Id(me; - aIndex: Integer from Standard) - returns Integer from Standard; - - Ids(me; - aI1 :out Integer from Standard; - aI2 :out Integer from Standard); - - Dump(me; - aHex:Integer from Standard=0); - - -fields - myNbIds: Integer from Standard is protected; - mySum : Integer from Standard is protected; - myMap : IndexedMapOfInteger from TColStd is protected; - -end PassKey; diff --git a/src/NMTDS/NMTDS_PassKey.cxx b/src/NMTDS/NMTDS_PassKey.cxx index 91e1da956..4d8aa41aa 100755 --- a/src/NMTDS/NMTDS_PassKey.cxx +++ b/src/NMTDS/NMTDS_PassKey.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_Algo.cxx -// Created: Sat Dec 04 12:39:47 2004 -// Author: Peter KURNEV -// + +// File: NMTDS_PassKey.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include #include #include @@ -37,7 +38,7 @@ static Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv); + const Standard_Integer aDiv); //======================================================================= //function : @@ -90,7 +91,7 @@ static //purpose : //======================================================================= void NMTDS_PassKey::SetIds(const Standard_Integer aId1) - + { Clear(); myNbIds=1; @@ -102,7 +103,7 @@ static //purpose : //======================================================================= void NMTDS_PassKey::SetIds(const Standard_Integer aId1, - const Standard_Integer aId2) + const Standard_Integer aId2) { TColStd_ListOfInteger aLI; // @@ -115,8 +116,8 @@ static //purpose : //======================================================================= void NMTDS_PassKey::SetIds(const Standard_Integer aId1, - const Standard_Integer aId2, - const Standard_Integer aId3) + const Standard_Integer aId2, + const Standard_Integer aId3) { TColStd_ListOfInteger aLI; // @@ -130,9 +131,9 @@ static //purpose : //======================================================================= void NMTDS_PassKey::SetIds(const Standard_Integer aId1, - const Standard_Integer aId2, - const Standard_Integer aId3, - const Standard_Integer aId4) + const Standard_Integer aId2, + const Standard_Integer aId3, + const Standard_Integer aId4) { TColStd_ListOfInteger aLI; // @@ -189,7 +190,7 @@ static //purpose : //======================================================================= void NMTDS_PassKey::Ids(Standard_Integer& aId1, - Standard_Integer& aId2) const + Standard_Integer& aId2) const { aId1=0; aId2=0; @@ -241,7 +242,7 @@ static // purpose : //======================================================================= Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv) + const Standard_Integer aDiv) { Standard_Integer aMax, aTresh, aIdRet; // diff --git a/src/NMTDS/NMTDS_PassKey.hxx b/src/NMTDS/NMTDS_PassKey.hxx index b75f63029..88fb6cb0f 100644 --- a/src/NMTDS/NMTDS_PassKey.hxx +++ b/src/NMTDS/NMTDS_PassKey.hxx @@ -1,145 +1,103 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: NMTDS_PassKey.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _NMTDS_PassKey_HeaderFile #define _NMTDS_PassKey_HeaderFile -#ifndef _Standard_Integer_HeaderFile +#include +#include #include -#endif -#ifndef _TColStd_IndexedMapOfInteger_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class TColStd_ListOfInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - +#include +//======================================================================= +//function : NMTDS_PassKey +//purpose : +//======================================================================= class NMTDS_PassKey { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_PassKey(); -Standard_EXPORT virtual ~NMTDS_PassKey(); - - -Standard_EXPORT NMTDS_PassKey(const NMTDS_PassKey& Other); -Standard_EXPORT NMTDS_PassKey& operator =(const NMTDS_PassKey& Other); - - -Standard_EXPORT void Clear() ; - - -Standard_EXPORT void SetIds(const Standard_Integer aI1) ; - - -Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2) ; - - -Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3) ; - - -Standard_EXPORT void SetIds(const Standard_Integer aI1,const Standard_Integer aI2,const Standard_Integer aI3,const Standard_Integer aI4) ; - - -Standard_EXPORT void SetIds(const TColStd_ListOfInteger& aLS) ; - - -Standard_EXPORT Standard_Integer NbIds() const; - - -Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKey& aOther) const; - - -Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; - - -Standard_EXPORT Standard_Integer Id(const Standard_Integer aIndex) const; - - -Standard_EXPORT void Ids(Standard_Integer& aI1,Standard_Integer& aI2) const; - - -Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; - - - - + public: + Standard_EXPORT + NMTDS_PassKey(); + + Standard_EXPORT + virtual ~NMTDS_PassKey(); + + Standard_EXPORT + NMTDS_PassKey(const NMTDS_PassKey& Other); + + Standard_EXPORT + NMTDS_PassKey& operator =(const NMTDS_PassKey& Other); + + Standard_EXPORT + void Clear() ; + + Standard_EXPORT + void SetIds(const Standard_Integer aI1) ; + + Standard_EXPORT + void SetIds(const Standard_Integer aI1, + const Standard_Integer aI2) ; + + Standard_EXPORT + void SetIds(const Standard_Integer aI1, + const Standard_Integer aI2, + const Standard_Integer aI3) ; + + Standard_EXPORT + void SetIds(const Standard_Integer aI1, + const Standard_Integer aI2, + const Standard_Integer aI3, + const Standard_Integer aI4) ; + + Standard_EXPORT + void SetIds(const TColStd_ListOfInteger& aLS) ; + + Standard_EXPORT + Standard_Integer NbIds() const; + + Standard_EXPORT + Standard_Boolean IsEqual(const NMTDS_PassKey& aOther) const; + + Standard_EXPORT + Standard_Integer HashCode(const Standard_Integer Upper) const; + + Standard_EXPORT + Standard_Integer Id(const Standard_Integer aIndex) const; + + Standard_EXPORT + void Ids(Standard_Integer& aI1,Standard_Integer& aI2) const; + + Standard_EXPORT + void Dump(const Standard_Integer aHex = 0) const; protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Standard_Integer myNbIds; -Standard_Integer mySum; -TColStd_IndexedMapOfInteger myMap; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + Standard_Integer myNbIds; + Standard_Integer mySum; + TColStd_IndexedMapOfInteger myMap; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_PassKey.ixx b/src/NMTDS/NMTDS_PassKey.ixx deleted file mode 100644 index fee442621..000000000 --- a/src/NMTDS/NMTDS_PassKey.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_PassKey.jxx b/src/NMTDS/NMTDS_PassKey.jxx deleted file mode 100644 index 65bb207de..000000000 --- a/src/NMTDS/NMTDS_PassKey.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TColStd_ListOfInteger_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.cdl b/src/NMTDS/NMTDS_PassKeyBoolean.cdl deleted file mode 100755 index 73b93b234..000000000 --- a/src/NMTDS/NMTDS_PassKeyBoolean.cdl +++ /dev/null @@ -1,52 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_PassKeyBoolean.cdl --- Created: --- Author: Peter KURNEV --- -class PassKeyBoolean from NMTDS - inherits PassKey from NMTDS - - ---Purpose: - -uses - Shape from TopoDS, - ListOfInteger from TColStd - ---raises - -is - Create - returns PassKeyBoolean from NMTDS; - ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKeyBoolean();" - - SetFlag(me:out; - aFlag: Boolean from Standard); - ---C++: alias " Standard_EXPORT NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other);" - - Flag(me) - returns Boolean from Standard; - -fields - myFlag: Boolean from Standard is protected; - -end PassKeyBoolean; diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.cxx b/src/NMTDS/NMTDS_PassKeyBoolean.cxx index d2636052c..dc0c77704 100755 --- a/src/NMTDS/NMTDS_PassKeyBoolean.cxx +++ b/src/NMTDS/NMTDS_PassKeyBoolean.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_PassKeyBoolean.cxx -// Created: Mon May 15 14:31:05 2006 -// Author: Peter KURNEV -// + +// File: NMTDS_PassKeyBoolean.cxx +// Created: Mon May 15 14:31:05 2006 +// Author: Peter KURNEV +// // -#include +#include //======================================================================= //function : diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.hxx b/src/NMTDS/NMTDS_PassKeyBoolean.hxx index aa0cc5b50..210efb63f 100644 --- a/src/NMTDS/NMTDS_PassKeyBoolean.hxx +++ b/src/NMTDS/NMTDS_PassKeyBoolean.hxx @@ -1,106 +1,60 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: NMTDS_PassKeyBoolean.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _NMTDS_PassKeyBoolean_HeaderFile #define _NMTDS_PassKeyBoolean_HeaderFile -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - +#include +#include +//======================================================================= +//class : NMTDS_PassKeyBoolean +//purpose : +//======================================================================= class NMTDS_PassKeyBoolean : public NMTDS_PassKey { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_PassKeyBoolean(); -Standard_EXPORT virtual ~NMTDS_PassKeyBoolean(); - - -Standard_EXPORT void SetFlag(const Standard_Boolean aFlag) ; - Standard_EXPORT NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other); - - -Standard_EXPORT Standard_Boolean Flag() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Standard_Boolean myFlag; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + public: + Standard_EXPORT + NMTDS_PassKeyBoolean(); + + Standard_EXPORT + virtual ~NMTDS_PassKeyBoolean(); + + Standard_EXPORT + void SetFlag(const Standard_Boolean aFlag) ; + + Standard_EXPORT + NMTDS_PassKeyBoolean& operator =(const NMTDS_PassKeyBoolean& Other); + + Standard_EXPORT + Standard_Boolean Flag() const; + + protected: + Standard_Boolean myFlag; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.ixx b/src/NMTDS/NMTDS_PassKeyBoolean.ixx deleted file mode 100644 index f879f4ff7..000000000 --- a/src/NMTDS/NMTDS_PassKeyBoolean.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_PassKeyBoolean.jxx b/src/NMTDS/NMTDS_PassKeyBoolean.jxx deleted file mode 100644 index b4559ce9b..000000000 --- a/src/NMTDS/NMTDS_PassKeyBoolean.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.cdl b/src/NMTDS/NMTDS_PassKeyMapHasher.cdl deleted file mode 100755 index 052e9aa97..000000000 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.cdl +++ /dev/null @@ -1,47 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_PassKeyMapHasher.cdl --- Created: --- Author: Peter KURNEV --- -class PassKeyMapHasher from NMTDS - - ---Purpose: - -uses - PassKey from NMTDS - ---raises - -is - HashCode(myclass; - aPKey : PassKey from NMTDS; - Upper : Integer from Standard) - returns Integer from Standard; - - - IsEqual(myclass; - aPKey1 : PassKey from NMTDS; - aPKey2 : PassKey from NMTDS) - returns Boolean from Standard; - -end PassKeyMapHasher; diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.cxx b/src/NMTDS/NMTDS_PassKeyMapHasher.cxx index 2afd292d0..3b55d93db 100755 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.cxx +++ b/src/NMTDS/NMTDS_PassKeyMapHasher.cxx @@ -1,37 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_PassKeyMapHasher.cxx -// Created: -// Author: Peter KURNEV -// + +// File: NMTDS_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include //======================================================================= //function : HashCode //purpose : //======================================================================= Standard_Integer NMTDS_PassKeyMapHasher::HashCode(const NMTDS_PassKey& aPK, - const Standard_Integer Upper) + const Standard_Integer Upper) { return aPK.HashCode(Upper); } @@ -40,7 +41,7 @@ //purpose : //======================================================================= Standard_Boolean NMTDS_PassKeyMapHasher::IsEqual(const NMTDS_PassKey& aPK1, - const NMTDS_PassKey& aPK2) + const NMTDS_PassKey& aPK2) { return aPK1.IsEqual(aPK2); } diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.hxx b/src/NMTDS/NMTDS_PassKeyMapHasher.hxx index 372e21411..1ad371c3e 100644 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.hxx +++ b/src/NMTDS/NMTDS_PassKeyMapHasher.hxx @@ -1,101 +1,52 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: NMTDS_PassKeyMapHasher.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _NMTDS_PassKeyMapHasher_HeaderFile #define _NMTDS_PassKeyMapHasher_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class NMTDS_PassKey; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif +#include +#include +#include +//======================================================================= +//function : NMTDS_PassKeyMapHasher +//purpose : +//======================================================================= class NMTDS_PassKeyMapHasher { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Integer HashCode(const NMTDS_PassKey& aPKey,const Standard_Integer Upper) ; - - -Standard_EXPORT static Standard_Boolean IsEqual(const NMTDS_PassKey& aPKey1,const NMTDS_PassKey& aPKey2) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + public: + Standard_EXPORT + static Standard_Integer HashCode(const NMTDS_PassKey& aPKey, + const Standard_Integer Upper) ; + + Standard_EXPORT + static Standard_Boolean IsEqual(const NMTDS_PassKey& aPKey1, + const NMTDS_PassKey& aPKey2) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.ixx b/src/NMTDS/NMTDS_PassKeyMapHasher.ixx deleted file mode 100644 index 8c37b4e0c..000000000 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_PassKeyMapHasher.jxx b/src/NMTDS/NMTDS_PassKeyMapHasher.jxx deleted file mode 100644 index 7487e5b18..000000000 --- a/src/NMTDS/NMTDS_PassKeyMapHasher.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyMapHasher_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_PassKeyShape.cdl b/src/NMTDS/NMTDS_PassKeyShape.cdl deleted file mode 100644 index 8721823be..000000000 --- a/src/NMTDS/NMTDS_PassKeyShape.cdl +++ /dev/null @@ -1,95 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_PassKeyShape.cdl --- Created: --- Author: Peter KURNEV --- -class PassKeyShape from NMTDS - - ---Purpose: - -uses - Shape from TopoDS, - ListOfShape from TopTools, - IndexedMapOfShape from TopTools - ---raises - -is - Create - returns PassKeyShape from NMTDS; - ---C++: alias "Standard_EXPORT virtual ~NMTDS_PassKeyShape();" - - Create(Other:PassKeyShape from NMTDS) - returns PassKeyShape from NMTDS; - - Assign(me:out; - Other : PassKeyShape from NMTDS) - returns PassKeyShape from NMTDS; - ---C++: alias operator = - ---C++: return & - - SetShapes(me:out; - aS :Shape from TopoDS); - - SetShapes(me:out; - aS1 :Shape from TopoDS; - aS2 :Shape from TopoDS); - - SetShapes(me:out; - aS1 :Shape from TopoDS; - aS2 :Shape from TopoDS; - aS3 :Shape from TopoDS); - - SetShapes(me:out; - aS1 :Shape from TopoDS; - aS2 :Shape from TopoDS; - aS3 :Shape from TopoDS; - aS4 :Shape from TopoDS); - - SetShapes(me:out; - aLS :ListOfShape from TopTools); - - Clear(me:out); - - - NbIds(me) - returns Integer from Standard; - - IsEqual(me; - aOther:PassKeyShape from NMTDS) - returns Boolean from Standard; - - HashCode(me; - Upper : Integer from Standard) - returns Integer from Standard; - - Dump(me; - aHex:Integer from Standard=0); - -fields - myNbIds:Integer from Standard is protected; - mySum :Integer from Standard is protected; - myUpper:Integer from Standard is protected; - myMap :IndexedMapOfShape from TopTools is protected; - -end PassKeyShape; diff --git a/src/NMTDS/NMTDS_PassKeyShape.cxx b/src/NMTDS/NMTDS_PassKeyShape.cxx index 804acd5c5..5010c582a 100644 --- a/src/NMTDS/NMTDS_PassKeyShape.cxx +++ b/src/NMTDS/NMTDS_PassKeyShape.cxx @@ -1,38 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: NMTDS_PassKeyShape.cxx -// Created: -// Author: Peter KURNEV -// + +// File: NMTDS_PassKeyShape.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include #include #include +#include static Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv); + const Standard_Integer aDiv); //======================================================================= //function : //purpose : @@ -86,7 +85,7 @@ static //purpose : //======================================================================= void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1) - + { Standard_Integer aHC; // @@ -101,7 +100,7 @@ static //purpose : //======================================================================= void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2) + const TopoDS_Shape& aS2) { TopTools_ListOfShape aLS; // @@ -114,8 +113,8 @@ static //purpose : //======================================================================= void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3) + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) { TopTools_ListOfShape aLS; // @@ -129,9 +128,9 @@ static //purpose : //======================================================================= void NMTDS_PassKeyShape::SetShapes(const TopoDS_Shape& aS1, - const TopoDS_Shape& aS2, - const TopoDS_Shape& aS3, - const TopoDS_Shape& aS4) + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) { TopTools_ListOfShape aLS; // @@ -214,7 +213,7 @@ static // purpose : //======================================================================= Standard_Integer NormalizedId(const Standard_Integer aId, - const Standard_Integer aDiv) + const Standard_Integer aDiv) { Standard_Integer aMax, aTresh, aIdRet; // diff --git a/src/NMTDS/NMTDS_PassKeyShape.hxx b/src/NMTDS/NMTDS_PassKeyShape.hxx index 4f9583ecf..1498499bf 100644 --- a/src/NMTDS/NMTDS_PassKeyShape.hxx +++ b/src/NMTDS/NMTDS_PassKeyShape.hxx @@ -1,148 +1,100 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: NMTDS_PassKeyShape.hxx +// Created: +// Author: Peter KURNEV +// // #ifndef _NMTDS_PassKeyShape_HeaderFile #define _NMTDS_PassKeyShape_HeaderFile -#ifndef _Standard_Integer_HeaderFile +#include +#include #include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class TopoDS_Shape; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - +#include +#include +//======================================================================= +//function : NMTDS_PassKeyShape +//purpose : +//======================================================================= class NMTDS_PassKeyShape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_PassKeyShape(); -Standard_EXPORT virtual ~NMTDS_PassKeyShape(); - - -Standard_EXPORT NMTDS_PassKeyShape(const NMTDS_PassKeyShape& Other); - - -Standard_EXPORT NMTDS_PassKeyShape& Assign(const NMTDS_PassKeyShape& Other) ; - NMTDS_PassKeyShape& operator =(const NMTDS_PassKeyShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS) ; - - -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ; - - -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3) ; - - -Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2,const TopoDS_Shape& aS3,const TopoDS_Shape& aS4) ; - - -Standard_EXPORT void SetShapes(const TopTools_ListOfShape& aLS) ; - - -Standard_EXPORT void Clear() ; - - -Standard_EXPORT Standard_Integer NbIds() const; - - -Standard_EXPORT Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aOther) const; - - -Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const; - - -Standard_EXPORT void Dump(const Standard_Integer aHex = 0) const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Standard_Integer myNbIds; -Standard_Integer mySum; -Standard_Integer myUpper; -TopTools_IndexedMapOfShape myMap; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + public: + Standard_EXPORT + NMTDS_PassKeyShape(); + + Standard_EXPORT + virtual ~NMTDS_PassKeyShape(); + + Standard_EXPORT + NMTDS_PassKeyShape(const NMTDS_PassKeyShape& Other); + + Standard_EXPORT + NMTDS_PassKeyShape& Assign(const NMTDS_PassKeyShape& Other) ; + + NMTDS_PassKeyShape& operator =(const NMTDS_PassKeyShape& Other) { + return Assign(Other); + } + + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS) ; + + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) ; + + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) ; + + Standard_EXPORT + void SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) ; + + Standard_EXPORT + void SetShapes(const TopTools_ListOfShape& aLS) ; + + Standard_EXPORT + void Clear() ; + + Standard_EXPORT + Standard_Integer NbIds() const; + + Standard_EXPORT + Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aOther) const; + + Standard_EXPORT + Standard_Integer HashCode(const Standard_Integer Upper) const; + + Standard_EXPORT + void Dump(const Standard_Integer aHex = 0) const; + + protected: + Standard_Integer myNbIds; + Standard_Integer mySum; + Standard_Integer myUpper; + TopTools_IndexedMapOfShape myMap; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_PassKeyShape.ixx b/src/NMTDS/NMTDS_PassKeyShape.ixx deleted file mode 100644 index c98d33542..000000000 --- a/src/NMTDS/NMTDS_PassKeyShape.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_PassKeyShape.jxx b/src/NMTDS/NMTDS_PassKeyShape.jxx deleted file mode 100644 index 7b7553bcf..000000000 --- a/src/NMTDS/NMTDS_PassKeyShape.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyShape_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl deleted file mode 100644 index 6fc92b1e5..000000000 --- a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cdl +++ /dev/null @@ -1,47 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_PassKeyMapHasher.cdl --- Created: --- Author: Peter KURNEV --- -class PassKeyShapeMapHasher from NMTDS - - ---Purpose: - -uses - PassKeyShape from NMTDS - ---raises - -is - HashCode(myclass; - aPKey : PassKeyShape from NMTDS; - Upper : Integer from Standard) - returns Integer from Standard; - - - IsEqual(myclass; - aPKey1 : PassKeyShape from NMTDS; - aPKey2 : PassKeyShape from NMTDS) - returns Boolean from Standard; - -end PassKeyShapeMapHasher; diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx index b8fa38230..4ff71d48e 100644 --- a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.cxx @@ -1,37 +1,35 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: NMTDS_PassKeyMapHasher.cxx -// Created: -// Author: Peter KURNEV -// + +// File: NMTDS_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// // -#include +#include //======================================================================= //function : HashCode //purpose : //======================================================================= Standard_Integer NMTDS_PassKeyShapeMapHasher::HashCode(const NMTDS_PassKeyShape& aPK, - const Standard_Integer Upper) + const Standard_Integer Upper) { return aPK.HashCode(Upper); } @@ -40,7 +38,7 @@ //purpose : //======================================================================= Standard_Boolean NMTDS_PassKeyShapeMapHasher::IsEqual(const NMTDS_PassKeyShape& aPK1, - const NMTDS_PassKeyShape& aPK2) + const NMTDS_PassKeyShape& aPK2) { return aPK1.IsEqual(aPK2); } diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx index 909ebb5cd..a674091db 100644 --- a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx +++ b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.hxx @@ -1,101 +1,48 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: NMTDS_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// // #ifndef _NMTDS_PassKeyShapeMapHasher_HeaderFile #define _NMTDS_PassKeyShapeMapHasher_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class NMTDS_PassKeyShape; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - +#include +#include +#include +//======================================================================= +//function : NMTDS_PassKeyShapeMapHasher +//purpose : +//======================================================================= class NMTDS_PassKeyShapeMapHasher { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Integer HashCode(const NMTDS_PassKeyShape& aPKey,const Standard_Integer Upper) ; - - -Standard_EXPORT static Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aPKey1,const NMTDS_PassKeyShape& aPKey2) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + public: + Standard_EXPORT + static Standard_Integer HashCode(const NMTDS_PassKeyShape& aPKey, + const Standard_Integer Upper) ; + + Standard_EXPORT + static Standard_Boolean IsEqual(const NMTDS_PassKeyShape& aPKey1, + const NMTDS_PassKeyShape& aPKey2) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx deleted file mode 100644 index 32be52eaf..000000000 --- a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx b/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx deleted file mode 100644 index 34fa8cc5e..000000000 --- a/src/NMTDS/NMTDS_PassKeyShapeMapHasher.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_PassKeyShape_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyShapeMapHasher_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cdl b/src/NMTDS/NMTDS_ShapesDataStructure.cdl deleted file mode 100644 index ba1f59f48..000000000 --- a/src/NMTDS/NMTDS_ShapesDataStructure.cdl +++ /dev/null @@ -1,99 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_ShapesDataStructure.cdl --- Created: Mon Dec 1 10:17:05 2003 --- Author: Peter KURNEV --- -class ShapesDataStructure from NMTDS - inherits ShapesDataStructure from BooleanOperations - - ---Purpose: - -uses - Box from Bnd, - IndexedMapOfInteger from TColStd, - Shape from TopoDS, - IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations, - CArray1OfIndexRange from NMTDS, - IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger from NMTDS ---raises - -is - Create - returns ShapesDataStructure from NMTDS; - - SetCompositeShape(me:out; - aS:Shape from TopoDS); - - Init(me:out); - - Ranges(me) - returns CArray1OfIndexRange from NMTDS; - ---C++: return const & - - CompositeShape(me) - returns Shape from TopoDS; - ---C++: return const & - - ShapeRangeIndex(me; - aId:Integer from Standard) - returns Integer from Standard; - - Rank (me; - anIndex:Integer from Standard) - returns Integer from Standard - is redefined; - - ShapeIndex (me; - aS:Shape from TopoDS; - iRank:Integer from Standard) - returns Integer from Standard - is redefined; - --- Modified to Add new methods Thu Sep 14 14:35:18 2006 --- Contribution of Samtech www.samcef.com BEGIN - FillMap (me; - aS :Shape from TopoDS; - aMSA: out IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations; - aMS : out IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations); - - FillSubshapes (me; - aS :Shape from TopoDS; - aMSA:out IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations; - aMS :out IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations); --- Contribution of Samtech www.samcef.com END - - GetAllSuccessors(me; - anIndex:Integer from Standard; - aScrs :out IndexedMapOfInteger from TColStd); - - ComputeBoxEx(me; - anIndex:Integer from Standard; - aBox:out Box from Bnd); - -fields - myCompositeShape: Shape from TopoDS is protected; - myRanges : CArray1OfIndexRange from NMTDS is protected; - myShapeIndexMap : IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger from NMTDS is protected; - -end ShapesDataStructure; - diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cxx b/src/NMTDS/NMTDS_ShapesDataStructure.cxx index c10daf236..ef679ed2f 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.cxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cxx @@ -1,30 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTDS_ShapesDataStructure.cxx -// Created: Mon Dec 1 10:21:04 2003 -// Author: Peter KURNEV -// -// -#include + +// File: NMTDS_ShapesDataStructure.cxx +// Author: Peter KURNEV + +#include #include #include #include @@ -41,18 +40,18 @@ static void ComputeBoxExS(const Standard_Integer aIx, - const NMTDS_ShapesDataStructure* pDS, - Bnd_Box& aBoxEx); + const NMTDS_ShapesDataStructure* pDS, + Bnd_Box& aBoxEx); static void GetAllSuccessorsS(const Standard_Integer nS, - const NMTDS_ShapesDataStructure* myDS, - TColStd_IndexedMapOfInteger& aMA); + const NMTDS_ShapesDataStructure* myDS, + TColStd_IndexedMapOfInteger& aMA); //=========================================================================== //function : NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure //purpose : //=========================================================================== - NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure() +NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure() : BooleanOperations_ShapesDataStructure() {} @@ -60,7 +59,7 @@ static //function : SetCompositeShape //purpose : //=========================================================================== - void NMTDS_ShapesDataStructure::SetCompositeShape(const TopoDS_Shape& aS) +void NMTDS_ShapesDataStructure::SetCompositeShape(const TopoDS_Shape& aS) { myCompositeShape=aS; } @@ -68,7 +67,7 @@ static //function : CompositeShape //purpose : //=========================================================================== - const TopoDS_Shape& NMTDS_ShapesDataStructure::CompositeShape()const +const TopoDS_Shape& NMTDS_ShapesDataStructure::CompositeShape()const { return myCompositeShape; } @@ -76,17 +75,15 @@ static //function : Ranges //purpose : //=========================================================================== - const NMTDS_CArray1OfIndexRange& NMTDS_ShapesDataStructure::Ranges()const +const NMTDS_CArray1OfIndexRange& NMTDS_ShapesDataStructure::Ranges()const { return myRanges; } -// Modified to Add new methods Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN //=========================================================================== //function : FillMap //purpose : //=========================================================================== - void NMTDS_ShapesDataStructure::FillMap +void NMTDS_ShapesDataStructure::FillMap (const TopoDS_Shape& aS, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const @@ -110,8 +107,8 @@ static for(j=1; j<=aNbSc; ++j) { aIndex=aAS1.GetSuccessor(j); if(aMFence.Add(aIndex)) { - BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS2=aMSA.ChangeFromIndex(aIndex); - aAS2.SetNewAncestor(iX); + BooleanOperations_AncestorsSeqAndSuccessorsSeq& aAS2=aMSA.ChangeFromIndex(aIndex); + aAS2.SetNewAncestor(iX); } } } @@ -120,7 +117,7 @@ static //function : FillSubshapes //purpose : //=========================================================================== - void NMTDS_ShapesDataStructure::FillSubshapes +void NMTDS_ShapesDataStructure::FillSubshapes (const TopoDS_Shape& aS, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA, BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const @@ -152,12 +149,11 @@ static } } } -// Contribution of Samtech www.samcef.com END //=========================================================================== //function : Init //purpose : //=========================================================================== - void NMTDS_ShapesDataStructure::Init() +void NMTDS_ShapesDataStructure::Init() { Standard_Integer i, j, aNbSx, aNbS, aShift, aNbRanges; Standard_Integer iFirst, iLast; @@ -170,30 +166,21 @@ static for (; anIt.More(); anIt.Next()) { const TopoDS_Shape& aSx=anIt.Value(); BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMS; - //modified by NIZNHY-PKV Tue Feb 27 17:05:47 2007f - //FillMap(aSx, aMSA, aMS); - //aLx.Append(aMS); // if (!aMSA.Contains(aSx)) { FillMap(aSx, aMSA, aMS); aLx.Append(aMS); } - //modified by NIZNHY-PKV Tue Feb 27 17:06:03 2007t } aNbS=aMSA.Extent(); // // Fill myRanges - //modified by NIZNHY-PKV Tue Feb 27 17:10:07 2007f i=aLx.Extent(); - //modified by NIZNHY-PKV Tue Feb 27 17:10:10 2007t myRanges.Resize(i); aLit.Initialize(aLx); for (i=1; aLit.More(); aLit.Next(), ++i) { - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSx=aLit.Value(); aNbSx=aMSx.Extent(); - // Contribution of Samtech www.samcef.com END if (i==1) { iFirst=1; iLast=aNbSx; @@ -208,34 +195,14 @@ static } // myNumberOfShapesOfTheObject=aNbS; - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - //myNumberOfShapesOfTheTool=aNbS; - //myLength=3*aNbS; myNumberOfShapesOfTheTool=0; myLength=2*aNbS; - // Contribution of Samtech www.samcef.com END // // Allocate the whole Table myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences) Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences)); - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN // // Fill the table - - //aShift=0; - //for (i=0; i<2; ++i) { - // if (i) { - // aShift=aNbS; - // } - // for (j=1; j<=aNbS; ++j) { - // const TopoDS_Shape& aSx=aMSA.FindKey(j); - // const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx= - // aMSA.FindFromIndex(j); - // InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift); - // } - //} aShift=0; for (j=1; j<=aNbS; ++j) { @@ -243,24 +210,21 @@ static const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx=aMSA.FindFromIndex(j); InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift); } - // Contribution of Samtech www.samcef.com END - // // myShapeIndexMap myShapeIndexMap.Clear(); // + //modified by NIZNHY-PKV Mon Dec 12 09:01:53 2011f aNbRanges=myRanges.Extent(); for (i=1; i<=aNbRanges; ++i){ - BooleanOperations_IndexedDataMapOfShapeInteger aSIM; - // const NMTDS_IndexRange& aR=myRanges(i); iFirst=aR.First(); iLast =aR.Last(); for (j=iFirst; j<=iLast; ++j) { const TopoDS_Shape& aS=Shape(j); - aSIM.Add(aS, j); + myShapeIndexMap.Bind(aS, j); } - myShapeIndexMap.Add(i, aSIM); } + //modified by NIZNHY-PKV Mon Dec 12 09:02:00 2011t // // myRefEdges iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool; @@ -279,7 +243,8 @@ static //function : ShapeRangeIndex //purpose : //=========================================================================== - Standard_Integer NMTDS_ShapesDataStructure::ShapeRangeIndex(const Standard_Integer aId)const +Standard_Integer NMTDS_ShapesDataStructure::ShapeRangeIndex + (const Standard_Integer aId)const { Standard_Boolean bFound; Standard_Integer i, aNbR, aIdx, aNbS, aZero=0; @@ -309,7 +274,8 @@ static //function : Rank //purpose : //=========================================================================== - Standard_Integer NMTDS_ShapesDataStructure::Rank(const Standard_Integer aId)const +Standard_Integer NMTDS_ShapesDataStructure::Rank + (const Standard_Integer aId)const { Standard_Boolean bFound; Standard_Integer i, aNbR, aNbS, aZero=0; @@ -334,41 +300,21 @@ static //function : ShapeIndex //purpose : //=========================================================================== - Standard_Integer NMTDS_ShapesDataStructure::ShapeIndex(const TopoDS_Shape& aS, - const Standard_Integer aRank)const +Standard_Integer NMTDS_ShapesDataStructure::ShapeIndex + (const TopoDS_Shape& aS, + const Standard_Integer aRank)const { - Standard_Boolean bFound; - Standard_Integer aIndex=0; + Standard_Address pIndex; + Standard_Integer aIndex; // - bFound=myShapeIndexMap.Contains(aRank); - if (!bFound) { - return aIndex; - } - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN + aIndex=0; // - //const BooleanOperations_IndexedDataMapOfShapeInteger& aSIM= - // myShapeIndexMap.FindFromKey(aRank); - // - //bFound=aSIM.Contains(aS); - //if (!bFound) { - // return aIndex; - //} - // - //aIndex=aSIM.FindFromKey(aS); - // - Standard_Integer i, aNbRanks; - // - aNbRanks=myShapeIndexMap.Extent(); - for (i=1; i<=aNbRanks; ++i){ - const BooleanOperations_IndexedDataMapOfShapeInteger& aSIM=myShapeIndexMap.FindFromKey(i); - bFound=aSIM.Contains(aS); - if (bFound) { - aIndex=aSIM.FindFromKey(aS); - return aIndex; - } + //modified by NIZNHY-PKV Mon Dec 12 09:02:48 2011f + pIndex=myShapeIndexMap.Find1(aS); + if (pIndex) { + aIndex=*((Standard_Integer*)pIndex); } - // Contribution of Samtech www.samcef.com END + //modified by NIZNHY-PKV Mon Dec 12 09:02:54 2011t return aIndex; } @@ -376,8 +322,9 @@ static //function : ComputeBoxEx //purpose : //======================================================================= - void NMTDS_ShapesDataStructure::ComputeBoxEx (const Standard_Integer aIx, - Bnd_Box& aBoxEx)const +void NMTDS_ShapesDataStructure::ComputeBoxEx + (const Standard_Integer aIx, + Bnd_Box& aBoxEx)const { ComputeBoxExS(aIx, this, aBoxEx); } @@ -385,8 +332,9 @@ static //function : GetAllSuccessors //purpose : //======================================================================= - void NMTDS_ShapesDataStructure::GetAllSuccessors(const Standard_Integer nS, - TColStd_IndexedMapOfInteger& aMA)const +void NMTDS_ShapesDataStructure::GetAllSuccessors + (const Standard_Integer nS, + TColStd_IndexedMapOfInteger& aMA)const { GetAllSuccessorsS(nS, this, aMA); } @@ -395,8 +343,8 @@ static //purpose : //======================================================================= void GetAllSuccessorsS(const Standard_Integer nS, - const NMTDS_ShapesDataStructure* myDS, - TColStd_IndexedMapOfInteger& aMA) + const NMTDS_ShapesDataStructure* myDS, + TColStd_IndexedMapOfInteger& aMA) { TopAbs_ShapeEnum aT; Standard_Integer i, nSx, aNbSuccessors, *pSuccessors; @@ -423,9 +371,9 @@ void GetAllSuccessorsS(const Standard_Integer nS, // function: ComputeBoxExS // purpose: //======================================================================= - void ComputeBoxExS(const Standard_Integer aIx, - const NMTDS_ShapesDataStructure* pDS, - Bnd_Box& aBoxEx) +void ComputeBoxExS(const Standard_Integer aIx, + const NMTDS_ShapesDataStructure* pDS, + Bnd_Box& aBoxEx) { Standard_Integer i, aNbS, iS; // diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.hxx b/src/NMTDS/NMTDS_ShapesDataStructure.hxx index 2dede1f65..e574b92ec 100644 --- a/src/NMTDS/NMTDS_ShapesDataStructure.hxx +++ b/src/NMTDS/NMTDS_ShapesDataStructure.hxx @@ -1,147 +1,96 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + + #ifndef _NMTDS_ShapesDataStructure_HeaderFile #define _NMTDS_ShapesDataStructure_HeaderFile -#ifndef _TopoDS_Shape_HeaderFile +#include +#include #include -#endif -#ifndef _NMTDS_CArray1OfIndexRange_HeaderFile #include -#endif -#ifndef _NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _BooleanOperations_ShapesDataStructure_HeaderFile +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -class TopoDS_Shape; -class NMTDS_CArray1OfIndexRange; -class BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors; -class TColStd_IndexedMapOfInteger; -class Bnd_Box; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_ShapesDataStructure : public BooleanOperations_ShapesDataStructure { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTDS_ShapesDataStructure(); - - -Standard_EXPORT void SetCompositeShape(const TopoDS_Shape& aS) ; - - -Standard_EXPORT void Init() ; - - -Standard_EXPORT const NMTDS_CArray1OfIndexRange& Ranges() const; - - -Standard_EXPORT const TopoDS_Shape& CompositeShape() const; - - -Standard_EXPORT Standard_Integer ShapeRangeIndex(const Standard_Integer aId) const; - - -Standard_EXPORT virtual Standard_Integer Rank(const Standard_Integer anIndex) const; - - -Standard_EXPORT virtual Standard_Integer ShapeIndex(const TopoDS_Shape& aS,const Standard_Integer iRank) const; - - -Standard_EXPORT void FillMap(const TopoDS_Shape& aS,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const; - - -Standard_EXPORT void FillSubshapes(const TopoDS_Shape& aS,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const; - - -Standard_EXPORT void GetAllSuccessors(const Standard_Integer anIndex,TColStd_IndexedMapOfInteger& aScrs) const; - - -Standard_EXPORT void ComputeBoxEx(const Standard_Integer anIndex,Bnd_Box& aBox) const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopoDS_Shape myCompositeShape; -NMTDS_CArray1OfIndexRange myRanges; -NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger myShapeIndexMap; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +#include +#include +#include +#include +#include + +//======================================================================= +//class : NMTDS_ShapesDataStructure +//purpose : +//======================================================================= +class NMTDS_ShapesDataStructure : public BooleanOperations_ShapesDataStructure +{ + public: + Standard_EXPORT + NMTDS_ShapesDataStructure(); + + Standard_EXPORT + void SetCompositeShape(const TopoDS_Shape& aS) ; + + Standard_EXPORT + void Init() ; + + Standard_EXPORT + const NMTDS_CArray1OfIndexRange& Ranges() const; + + Standard_EXPORT + const TopoDS_Shape& CompositeShape() const; + + Standard_EXPORT + Standard_Integer ShapeRangeIndex(const Standard_Integer aId) const; + + Standard_EXPORT + virtual Standard_Integer Rank(const Standard_Integer anIndex) const; + + Standard_EXPORT + virtual Standard_Integer ShapeIndex(const TopoDS_Shape& aS, + const Standard_Integer iRank) const; + + Standard_EXPORT + void FillMap(const TopoDS_Shape& aS, + BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA, + BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const; + + Standard_EXPORT + void FillSubshapes(const TopoDS_Shape& aS, + BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA, + BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const; + + Standard_EXPORT + void GetAllSuccessors(const Standard_Integer anIndex, + TColStd_IndexedMapOfInteger& aScrs) const; + + Standard_EXPORT + void ComputeBoxEx(const Standard_Integer anIndex, + Bnd_Box& aBox) const; + + + protected: + TopoDS_Shape myCompositeShape; + NMTDS_CArray1OfIndexRange myRanges; + TopTools_DataMapOfShapeInteger myShapeIndexMap; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.ixx b/src/NMTDS/NMTDS_ShapesDataStructure.ixx deleted file mode 100644 index 2eb57d133..000000000 --- a/src/NMTDS/NMTDS_ShapesDataStructure.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.jxx b/src/NMTDS/NMTDS_ShapesDataStructure.jxx deleted file mode 100644 index f14232fd4..000000000 --- a/src/NMTDS/NMTDS_ShapesDataStructure.jxx +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _NMTDS_CArray1OfIndexRange_HeaderFile -#include -#endif -#ifndef _BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#include -#endif -#ifndef _TColStd_IndexedMapOfInteger_HeaderFile -#include -#endif -#ifndef _Bnd_Box_HeaderFile -#include -#endif -#ifndef _NMTDS_ShapesDataStructure_HeaderFile -#include -#endif diff --git a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKey.hxx b/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKey.hxx deleted file mode 100644 index 196074ff4..000000000 --- a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKey.hxx +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile -#define _NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_StdMapNodeOfMapOfPassKey_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class NMTDS_PassKey; -class NMTDS_PassKeyMapHasher; -class NMTDS_MapOfPassKey; -class NMTDS_MapIteratorOfMapOfPassKey; - - - -class NMTDS_StdMapNodeOfMapOfPassKey : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_StdMapNodeOfMapOfPassKey(const NMTDS_PassKey& K,const TCollection_MapNodePtr& n); - - NMTDS_PassKey& Key() const; -//Standard_EXPORT ~NMTDS_StdMapNodeOfMapOfPassKey(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -NMTDS_PassKey myKey; - - -}; - -#define TheKey NMTDS_PassKey -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKey -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKey_Type_() -#define TCollection_Map NMTDS_MapOfPassKey -#define TCollection_Map_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_StdMapNode -#undef TCollection_StdMapNode_hxx -#undef TCollection_MapIterator -#undef TCollection_MapIterator_hxx -#undef Handle_TCollection_StdMapNode -#undef TCollection_StdMapNode_Type_ -#undef TCollection_Map -#undef TCollection_Map_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx b/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx deleted file mode 100644 index 61cba228b..000000000 --- a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKeyBoolean.hxx +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile -#define _NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class NMTDS_PassKeyBoolean; -class NMTDS_PassKeyMapHasher; -class NMTDS_MapOfPassKeyBoolean; -class NMTDS_MapIteratorOfMapOfPassKeyBoolean; - - - -class NMTDS_StdMapNodeOfMapOfPassKeyBoolean : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTDS_StdMapNodeOfMapOfPassKeyBoolean(const NMTDS_PassKeyBoolean& K,const TCollection_MapNodePtr& n); - - NMTDS_PassKeyBoolean& Key() const; -//Standard_EXPORT ~NMTDS_StdMapNodeOfMapOfPassKeyBoolean(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -NMTDS_PassKeyBoolean myKey; - - -}; - -#define TheKey NMTDS_PassKeyBoolean -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKeyBoolean -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKeyBoolean_Type_() -#define TCollection_Map NMTDS_MapOfPassKeyBoolean -#define TCollection_Map_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_StdMapNode -#undef TCollection_StdMapNode_hxx -#undef TCollection_MapIterator -#undef TCollection_MapIterator_hxx -#undef Handle_TCollection_StdMapNode -#undef TCollection_StdMapNode_Type_ -#undef TCollection_Map -#undef TCollection_Map_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKeyBoolean_0.cxx b/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKeyBoolean_0.cxx deleted file mode 100644 index 154519c8e..000000000 --- a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKeyBoolean_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_MapOfPassKeyBoolean_HeaderFile -#include -#endif -#ifndef _NMTDS_MapIteratorOfMapOfPassKeyBoolean_HeaderFile -#include -#endif -//NMTDS_StdMapNodeOfMapOfPassKeyBoolean::~NMTDS_StdMapNodeOfMapOfPassKeyBoolean() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_StdMapNodeOfMapOfPassKeyBoolean_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_StdMapNodeOfMapOfPassKeyBoolean", - sizeof(NMTDS_StdMapNodeOfMapOfPassKeyBoolean), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean) Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKeyBoolean))) { - _anOtherObject = Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)((Handle(NMTDS_StdMapNodeOfMapOfPassKeyBoolean)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_StdMapNodeOfMapOfPassKeyBoolean::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKeyBoolean) ; -} -//Standard_Boolean NMTDS_StdMapNodeOfMapOfPassKeyBoolean::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKeyBoolean) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean::~Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean() {} -#define TheKey NMTDS_PassKeyBoolean -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKeyBoolean -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKeyBoolean -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKeyBoolean_Type_() -#define TCollection_Map NMTDS_MapOfPassKeyBoolean -#define TCollection_Map_hxx -#include - diff --git a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKey_0.cxx b/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKey_0.cxx deleted file mode 100644 index 27fa652b3..000000000 --- a/src/NMTDS/NMTDS_StdMapNodeOfMapOfPassKey_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _NMTDS_PassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_PassKeyMapHasher_HeaderFile -#include -#endif -#ifndef _NMTDS_MapOfPassKey_HeaderFile -#include -#endif -#ifndef _NMTDS_MapIteratorOfMapOfPassKey_HeaderFile -#include -#endif -//NMTDS_StdMapNodeOfMapOfPassKey::~NMTDS_StdMapNodeOfMapOfPassKey() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTDS_StdMapNodeOfMapOfPassKey_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTDS_StdMapNodeOfMapOfPassKey", - sizeof(NMTDS_StdMapNodeOfMapOfPassKey), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTDS_StdMapNodeOfMapOfPassKey) Handle(NMTDS_StdMapNodeOfMapOfPassKey)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTDS_StdMapNodeOfMapOfPassKey) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKey))) { - _anOtherObject = Handle(NMTDS_StdMapNodeOfMapOfPassKey)((Handle(NMTDS_StdMapNodeOfMapOfPassKey)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTDS_StdMapNodeOfMapOfPassKey::DynamicType() const -{ - return STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKey) ; -} -//Standard_Boolean NMTDS_StdMapNodeOfMapOfPassKey::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTDS_StdMapNodeOfMapOfPassKey) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTDS_StdMapNodeOfMapOfPassKey::~Handle_NMTDS_StdMapNodeOfMapOfPassKey() {} -#define TheKey NMTDS_PassKey -#define TheKey_hxx -#define Hasher NMTDS_PassKeyMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTDS_MapIteratorOfMapOfPassKey -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTDS_StdMapNodeOfMapOfPassKey -#define TCollection_StdMapNode_Type_() NMTDS_StdMapNodeOfMapOfPassKey_Type_() -#define TCollection_Map NMTDS_MapOfPassKey -#define TCollection_Map_hxx -#include - diff --git a/src/NMTDS/NMTDS_Tools.cdl b/src/NMTDS/NMTDS_Tools.cdl deleted file mode 100644 index 1506fa7b6..000000000 --- a/src/NMTDS/NMTDS_Tools.cdl +++ /dev/null @@ -1,63 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTDS_Tools.cdl --- Created: Tue Feb 20 14:56:14 2007 --- Author: Peter KURNEV --- -class Tools from NMTDS - - ---Purpose: - -uses - ShapeEnum from TopAbs, - Vertex from TopoDS, - Shape from TopoDS, - IndexedDataMapOfShapeShape from TopTools - ---raises - -is - TypeToInteger(myclass; - aT1: ShapeEnum from TopAbs; - aT2: ShapeEnum from TopAbs) - returns Integer from Standard; - - HasBRep(myclass; - aT: ShapeEnum from TopAbs) - returns Boolean from Standard; - - ComputeVV(myclass; - aV1:Vertex from TopoDS; - aV2:Vertex from TopoDS) - returns Integer from Standard; - - CopyShape(myclass; - aS:Shape from TopoDS; - aSC:out Shape from TopoDS); - - CopyShape(myclass; - aS:Shape from TopoDS; - aSC :out Shape from TopoDS; - aMSS :out IndexedDataMapOfShapeShape from TopTools); ---fields - -end Tools; diff --git a/src/NMTDS/NMTDS_Tools.cxx b/src/NMTDS/NMTDS_Tools.cxx index b49af9da3..f34ce68e5 100644 --- a/src/NMTDS/NMTDS_Tools.cxx +++ b/src/NMTDS/NMTDS_Tools.cxx @@ -1,30 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: NMTDS_Tools.cxx -// Created: Tue Feb 20 14:57:28 2007 -// Author: Peter KURNEV -// -// -#include + +// File: NMTDS_Tools.cxx +// Created: Tue Feb 20 14:57:28 2007 +// Author: Peter KURNEV + +#include #include #include #include @@ -34,16 +31,16 @@ #include #include -void CopySource(const TopoDS_Shape& aS, - TopTools_IndexedDataMapOfShapeShape& aMapSS, - TopoDS_Shape& aSC); +void CopySource(const TopoDS_Shape& aS, + TopTools_IndexedDataMapOfShapeShape& aMapSS, + TopoDS_Shape& aSC); //======================================================================= //function : CopyShape -//purpose : +//purpose : //======================================================================= - void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC) + void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC) { TopTools_IndexedDataMapOfShapeShape aMapSS; // @@ -51,25 +48,26 @@ void CopySource(const TopoDS_Shape& aS, } //======================================================================= //function : CopyShape -//purpose : +//purpose : //======================================================================= - void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC, - TopTools_IndexedDataMapOfShapeShape& aMapSS) + void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC, + TopTools_IndexedDataMapOfShapeShape& aMapSS) { CopySource(aS, aMapSS, aSC); } //======================================================================= //function : CopySource -//purpose : +//purpose : //======================================================================= -void CopySource(const TopoDS_Shape& aS, - TopTools_IndexedDataMapOfShapeShape& aMapSS, - TopoDS_Shape& aSC) +void CopySource(const TopoDS_Shape& aS, + TopTools_IndexedDataMapOfShapeShape& aMapSS, + TopoDS_Shape& aSC) { Standard_Boolean bFree; TopAbs_ShapeEnum aT; TopoDS_Iterator aIt; + TopoDS_Shape aSF; BRep_Builder BB; // aT=aS.ShapeType(); @@ -86,13 +84,22 @@ void CopySource(const TopoDS_Shape& aS, // bFree=aSC.Free(); aSC.Free(Standard_True); - aIt.Initialize(aS); + aSF=aS; + if (aT==TopAbs_EDGE){ + TopAbs_Orientation aOr; + // + aOr=aS.Orientation(); + if(aOr==TopAbs_INTERNAL) { + aSF.Orientation(TopAbs_FORWARD); + } + } + aIt.Initialize(aSF); for (; aIt.More(); aIt.Next()) { TopoDS_Shape aSCx; // const TopoDS_Shape& aSx=aIt.Value(); // - CopySource (aSx, aMapSS, aSCx); + CopySource (aSx, aMapSS, aSCx); // aSCx.Orientation(aSx.Orientation()); BB.Add(aSC, aSCx); @@ -101,10 +108,10 @@ void CopySource(const TopoDS_Shape& aS, } //======================================================================= // function: ComputeVV -// purpose: +// purpose: //======================================================================= - Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1, - const TopoDS_Vertex& aV2) + Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1, + const TopoDS_Vertex& aV2) { Standard_Real aTolV1, aTolV2, aTolSum, aTolSum2, aD2; gp_Pnt aP1, aP2; @@ -125,7 +132,7 @@ void CopySource(const TopoDS_Shape& aS, } //======================================================================= // function: HasBRep -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi) { @@ -133,10 +140,10 @@ void CopySource(const TopoDS_Shape& aS, } //======================================================================= //function : TypeToInteger -//purpose : +//purpose : //======================================================================= Standard_Integer NMTDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) + const TopAbs_ShapeEnum aType2) { Standard_Integer iRet, iT1, iT2, iX; // @@ -170,5 +177,5 @@ void CopySource(const TopoDS_Shape& aS, default: break; } - return iRet; + return iRet; } diff --git a/src/NMTDS/NMTDS_Tools.hxx b/src/NMTDS/NMTDS_Tools.hxx index ca5f8984f..e30d8924c 100644 --- a/src/NMTDS/NMTDS_Tools.hxx +++ b/src/NMTDS/NMTDS_Tools.hxx @@ -1,115 +1,63 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTDS_Tools.hxx +// Created: +// Author: Peter KURNEV + #ifndef _NMTDS_Tools_HeaderFile #define _NMTDS_Tools_HeaderFile -#ifndef _Standard_Integer_HeaderFile +#include +#include #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class TopoDS_Vertex; -class TopoDS_Shape; -class TopTools_IndexedDataMapOfShapeShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTDS_Tools { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aT1,const TopAbs_ShapeEnum aT2) ; - - -Standard_EXPORT static Standard_Boolean HasBRep(const TopAbs_ShapeEnum aT) ; - - -Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& aV1,const TopoDS_Vertex& aV2) ; - - -Standard_EXPORT static void CopyShape(const TopoDS_Shape& aS,TopoDS_Shape& aSC) ; - - -Standard_EXPORT static void CopyShape(const TopoDS_Shape& aS,TopoDS_Shape& aSC,TopTools_IndexedDataMapOfShapeShape& aMSS) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - +#include +#include +#include + +//======================================================================= +//function : NMTDS_Tools +//purpose : +//======================================================================= +class NMTDS_Tools +{ + public: + Standard_EXPORT + static Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aT1, + const TopAbs_ShapeEnum aT2) ; + + Standard_EXPORT + static Standard_Boolean HasBRep(const TopAbs_ShapeEnum aT) ; + + Standard_EXPORT + static Standard_Integer ComputeVV(const TopoDS_Vertex& aV1, + const TopoDS_Vertex& aV2) ; + + Standard_EXPORT + static void CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC) ; + + Standard_EXPORT + static void CopyShape(const TopoDS_Shape& aS, + TopoDS_Shape& aSC, + TopTools_IndexedDataMapOfShapeShape& aMSS) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTDS/NMTDS_Tools.ixx b/src/NMTDS/NMTDS_Tools.ixx deleted file mode 100644 index da643aa19..000000000 --- a/src/NMTDS/NMTDS_Tools.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTDS/NMTDS_Tools.jxx b/src/NMTDS/NMTDS_Tools.jxx deleted file mode 100644 index 5fdfd4c5d..000000000 --- a/src/NMTDS/NMTDS_Tools.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _NMTDS_Tools_HeaderFile -#include -#endif diff --git a/src/NMTTools/FILES b/src/NMTTools/FILES new file mode 100644 index 000000000..63a775bc7 --- /dev/null +++ b/src/NMTTools/FILES @@ -0,0 +1,52 @@ +NMTTools_PaveFiller_0.cxx +NMTTools_PaveFiller_1.cxx +NMTTools_PaveFiller_2.cxx +NMTTools_PaveFiller_3.cxx +NMTTools_PaveFiller_4.cxx +NMTTools_PaveFiller_5.cxx +NMTTools_PaveFiller_6.cxx +NMTTools_PaveFiller_7.cxx +NMTTools_PaveFiller_8.cxx +NMTTools_PaveFiller_9.cxx + + +NMTTools_CoupleOfShape.hxx +NMTTools_CoupleOfShape.cxx +NMTTools_CommonBlock.hxx +NMTTools_CommonBlock.cxx +NMTTools_CommonBlockAPI.hxx +NMTTools_CommonBlockAPI.cxx +NMTTools_FaceInfo.hxx +NMTTools_FaceInfo.cxx +NMTTools_FaceInfo.lxx +NMTTools_Tools.hxx +NMTTools_Tools.cxx +NMTTools_PaveFiller.hxx +NMTTools_PaveFiller.cxx +NMTTools_PPaveFiller.hxx +NMTTools_DEProcessor.hxx +NMTTools_DEProcessor.cxx +NMTTools_CheckerSI.hxx +NMTTools_CheckerSI.cxx +NMTTools_CheckerSI_1.cxx + +NMTTools_ListOfCommonBlock.hxx +NMTTools_ListIteratorOfListOfCommonBlock.hxx +NMTTools_ListOfCoupleOfShape.hxx +NMTTools_ListIteratorOfListOfCoupleOfShape.hxx + +NMTTools_MapOfPaveBlock.hxx +NMTTools_MapIteratorOfMapOfPaveBlock.hxx + +NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx +NMTTools_IndexedDataMapOfShapePaveBlock.hxx +NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx + +NMTTools_DataMapOfIntegerListOfPaveBlock.hxx +NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx + +NMTTools_DataMapOfIntegerFaceInfo.hxx +NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx + +NMTTools_CommonBlockPool.hxx +NMTTools_CommonBlockPool.cxx diff --git a/src/NMTTools/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx b/src/NMTTools/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx deleted file mode 100644 index ae1c3f807..000000000 --- a/src/NMTTools/Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile -#define _Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger); - -class Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& operator=(const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)& operator=(const NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger* operator->() const - { - return (NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger)(); - - Standard_EXPORT static const Handle(NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx b/src/NMTTools/Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx deleted file mode 100644 index 0e68f8ec1..000000000 --- a/src/NMTTools/Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile -#define _Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors); - -class Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) : public Handle(TCollection_MapNode) { - public: - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)():Handle(TCollection_MapNode)() {} - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)(const Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)(const NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& operator=(const Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)& operator=(const NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors* operator->() const - { - return (NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors)(); - - Standard_EXPORT static const Handle(NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx b/src/NMTTools/Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx deleted file mode 100644 index 37052ceed..000000000 --- a/src/NMTTools/Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#define _Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock); - -class Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock) : public Handle(TCollection_MapNode) { - public: - Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)():Handle(TCollection_MapNode)() {} - Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)(const Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)(const NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)& operator=(const Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)& operator=(const NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock* operator->() const - { - return (NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)(); - - Standard_EXPORT static const Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx b/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx deleted file mode 100644 index 9be2a7b53..000000000 --- a/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_HeaderFile -#define _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger); - -class Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger) : public Handle(TCollection_MapNode) { - public: - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)():Handle(TCollection_MapNode)() {} - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)(const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)(const NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)& operator=(const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)& operator=(const NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger* operator->() const - { - return (NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)(); - - Standard_EXPORT static const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx b/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx deleted file mode 100644 index 4bde10714..000000000 --- a/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#define _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape); - -class Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape) : public Handle(TCollection_MapNode) { - public: - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)():Handle(TCollection_MapNode)() {} - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)(const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)(const NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)& operator=(const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)& operator=(const NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape* operator->() const - { - return (NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)(); - - Standard_EXPORT static const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx b/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx deleted file mode 100644 index 26f899d6a..000000000 --- a/src/NMTTools/Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_HeaderFile -#define _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock); - -class Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock) : public Handle(TCollection_MapNode) { - public: - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)():Handle(TCollection_MapNode)() {} - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)(const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)(const NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)& operator=(const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)& operator=(const NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock* operator->() const - { - return (NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)(); - - Standard_EXPORT static const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTTools_ListNodeOfListOfCommonBlock.hxx b/src/NMTTools/Handle_NMTTools_ListNodeOfListOfCommonBlock.hxx deleted file mode 100644 index fb7fd9bbc..000000000 --- a/src/NMTTools/Handle_NMTTools_ListNodeOfListOfCommonBlock.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTTools_ListNodeOfListOfCommonBlock_HeaderFile -#define _Handle_NMTTools_ListNodeOfListOfCommonBlock_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTTools_ListNodeOfListOfCommonBlock; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTTools_ListNodeOfListOfCommonBlock); - -class Handle(NMTTools_ListNodeOfListOfCommonBlock) : public Handle(TCollection_MapNode) { - public: - Handle(NMTTools_ListNodeOfListOfCommonBlock)():Handle(TCollection_MapNode)() {} - Handle(NMTTools_ListNodeOfListOfCommonBlock)(const Handle(NMTTools_ListNodeOfListOfCommonBlock)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTTools_ListNodeOfListOfCommonBlock)(const NMTTools_ListNodeOfListOfCommonBlock* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTTools_ListNodeOfListOfCommonBlock)& operator=(const Handle(NMTTools_ListNodeOfListOfCommonBlock)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTTools_ListNodeOfListOfCommonBlock)& operator=(const NMTTools_ListNodeOfListOfCommonBlock* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTTools_ListNodeOfListOfCommonBlock* operator->() const - { - return (NMTTools_ListNodeOfListOfCommonBlock *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTTools_ListNodeOfListOfCommonBlock)(); - - Standard_EXPORT static const Handle(NMTTools_ListNodeOfListOfCommonBlock) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx b/src/NMTTools/Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx deleted file mode 100644 index 646478105..000000000 --- a/src/NMTTools/Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile -#define _Handle_NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTTools_ListNodeOfListOfCoupleOfShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTTools_ListNodeOfListOfCoupleOfShape); - -class Handle(NMTTools_ListNodeOfListOfCoupleOfShape) : public Handle(TCollection_MapNode) { - public: - Handle(NMTTools_ListNodeOfListOfCoupleOfShape)():Handle(TCollection_MapNode)() {} - Handle(NMTTools_ListNodeOfListOfCoupleOfShape)(const Handle(NMTTools_ListNodeOfListOfCoupleOfShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTTools_ListNodeOfListOfCoupleOfShape)(const NMTTools_ListNodeOfListOfCoupleOfShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTTools_ListNodeOfListOfCoupleOfShape)& operator=(const Handle(NMTTools_ListNodeOfListOfCoupleOfShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTTools_ListNodeOfListOfCoupleOfShape)& operator=(const NMTTools_ListNodeOfListOfCoupleOfShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTTools_ListNodeOfListOfCoupleOfShape* operator->() const - { - return (NMTTools_ListNodeOfListOfCoupleOfShape *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTTools_ListNodeOfListOfCoupleOfShape)(); - - Standard_EXPORT static const Handle(NMTTools_ListNodeOfListOfCoupleOfShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Handle_NMTTools_StdMapNodeOfMapOfPaveBlock.hxx b/src/NMTTools/Handle_NMTTools_StdMapNodeOfMapOfPaveBlock.hxx deleted file mode 100644 index 47559616e..000000000 --- a/src/NMTTools/Handle_NMTTools_StdMapNodeOfMapOfPaveBlock.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 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 _Handle_NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile -#define _Handle_NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class NMTTools_StdMapNodeOfMapOfPaveBlock; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(NMTTools_StdMapNodeOfMapOfPaveBlock); - -class Handle(NMTTools_StdMapNodeOfMapOfPaveBlock) : public Handle(TCollection_MapNode) { - public: - Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)():Handle(TCollection_MapNode)() {} - Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)(const Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)(const NMTTools_StdMapNodeOfMapOfPaveBlock* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)& operator=(const Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)& operator=(const NMTTools_StdMapNodeOfMapOfPaveBlock* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - NMTTools_StdMapNodeOfMapOfPaveBlock* operator->() const - { - return (NMTTools_StdMapNodeOfMapOfPaveBlock *)ControlAccess(); - } - -// Standard_EXPORT ~Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)(); - - Standard_EXPORT static const Handle(NMTTools_StdMapNodeOfMapOfPaveBlock) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/NMTTools/Makefile.am b/src/NMTTools/Makefile.am index 59c6b1f8d..f498dad8a 100644 --- a/src/NMTTools/Makefile.am +++ b/src/NMTTools/Makefile.am @@ -1,88 +1,56 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM NMTTools : partition algorithm # File : Makefile.in # Author : Julia DOROVSKIKH # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM -# $Header$ -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am -# header files +# header files salomeinclude_HEADERS = \ - Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx \ - Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx \ - Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx \ - Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx \ - Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx \ - Handle_NMTTools_ListNodeOfListOfCommonBlock.hxx \ - Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx \ NMTTools_CheckerSI.hxx \ - NMTTools_CheckerSI.ixx \ - NMTTools_CheckerSI.jxx \ NMTTools_CommonBlockAPI.hxx \ - NMTTools_CommonBlockAPI.ixx \ - NMTTools_CommonBlockAPI.jxx \ NMTTools_CommonBlock.hxx \ - NMTTools_CommonBlock.ixx \ - NMTTools_CommonBlock.jxx \ NMTTools_CommonBlockPool.hxx \ NMTTools_CoupleOfShape.hxx \ - NMTTools_CoupleOfShape.ixx \ - NMTTools_CoupleOfShape.jxx \ + NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx \ + NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx \ + NMTTools_DataMapOfIntegerFaceInfo.hxx \ + NMTTools_DataMapOfIntegerListOfPaveBlock.hxx \ NMTTools_DEProcessor.hxx \ - NMTTools_DEProcessor.ixx \ - NMTTools_DEProcessor.jxx \ - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx \ - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx \ - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx \ + NMTTools_FaceInfo.hxx \ + NMTTools_FaceInfo.lxx \ NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx \ NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx \ NMTTools_IndexedDataMapOfShapePaveBlock.hxx \ - NMTTools_IteratorOfCoupleOfShape.hxx \ - NMTTools_IteratorOfCoupleOfShape.ixx \ - NMTTools_IteratorOfCoupleOfShape.jxx \ NMTTools_ListIteratorOfListOfCommonBlock.hxx \ NMTTools_ListIteratorOfListOfCoupleOfShape.hxx \ - NMTTools_ListNodeOfListOfCommonBlock.hxx \ - NMTTools_ListNodeOfListOfCoupleOfShape.hxx \ NMTTools_ListOfCommonBlock.hxx \ NMTTools_ListOfCoupleOfShape.hxx \ - NMTTools_PaveFiller.hxx \ - NMTTools_PaveFiller.ixx \ - NMTTools_PaveFiller.jxx \ - NMTTools_PPaveFiller.hxx \ - NMTTools_Tools.hxx \ - NMTTools_Tools.ixx \ - NMTTools_Tools.jxx \ - Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx \ - Handle_NMTTools_StdMapNodeOfMapOfPaveBlock.hxx \ - NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx \ - NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx \ - NMTTools_DataMapOfIntegerListOfPaveBlock.hxx \ NMTTools_MapIteratorOfMapOfPaveBlock.hxx \ NMTTools_MapOfPaveBlock.hxx \ - NMTTools_StdMapNodeOfMapOfPaveBlock.hxx + NMTTools_PaveFiller.hxx \ + NMTTools_PPaveFiller.hxx \ + NMTTools_Tools.hxx # Libraries targets lib_LTLIBRARIES = libNMTTools.la @@ -92,22 +60,10 @@ dist_libNMTTools_la_SOURCES = \ NMTTools_CheckerSI_1.cxx \ NMTTools_CommonBlockAPI.cxx \ NMTTools_CommonBlock.cxx \ - NMTTools_CommonBlockPool_0.cxx \ + NMTTools_CommonBlockPool.cxx \ NMTTools_CoupleOfShape.cxx \ NMTTools_DEProcessor.cxx \ - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx \ - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx \ - NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx \ - NMTTools_IndexedDataMapOfIndexedMapOfInteger_0.cxx \ - NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_0.cxx \ - NMTTools_IndexedDataMapOfShapePaveBlock_0.cxx \ - NMTTools_IteratorOfCoupleOfShape.cxx \ - NMTTools_ListIteratorOfListOfCommonBlock_0.cxx \ - NMTTools_ListIteratorOfListOfCoupleOfShape_0.cxx \ - NMTTools_ListNodeOfListOfCommonBlock_0.cxx \ - NMTTools_ListNodeOfListOfCoupleOfShape_0.cxx \ - NMTTools_ListOfCommonBlock_0.cxx \ - NMTTools_ListOfCoupleOfShape_0.cxx \ + NMTTools_FaceInfo.cxx \ NMTTools_PaveFiller_0.cxx \ NMTTools_PaveFiller_1.cxx \ NMTTools_PaveFiller_2.cxx \ @@ -119,13 +75,7 @@ dist_libNMTTools_la_SOURCES = \ NMTTools_PaveFiller_8.cxx \ NMTTools_PaveFiller_9.cxx \ NMTTools_PaveFiller.cxx \ - NMTTools_Tools.cxx \ - NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_0.cxx \ - NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_0.cxx \ - NMTTools_DataMapOfIntegerListOfPaveBlock_0.cxx \ - NMTTools_MapIteratorOfMapOfPaveBlock_0.cxx \ - NMTTools_MapOfPaveBlock_0.cxx \ - NMTTools_StdMapNodeOfMapOfPaveBlock_0.cxx + NMTTools_Tools.cxx # additional information to compile and link file @@ -140,30 +90,9 @@ libNMTTools_la_LDFLAGS = \ $(CAS_LDPATH) -lTKBool -lTKBO \ $(KERNEL_LDFLAGS) -CDL_FILES = \ - NMTTools.cdl \ - NMTTools_CheckerSI.cdl \ - NMTTools_CommonBlock.cdl \ - NMTTools_CommonBlockAPI.cdl \ - NMTTools_CoupleOfShape.cdl \ - NMTTools_DEProcessor.cdl \ - NMTTools_IteratorOfCoupleOfShape.cdl \ - NMTTools_PaveFiller.cdl \ - NMTTools_Tools.cdl - -EXTRA_DIST += $(CDL_FILES) +CDL_FILES = \ + NMTTools.cdl -######################################## -# Non-used (obsolete?) files -######################################## -# NMTTools_PCurveMaker.cdl -# NMTTools_PCurveMaker.cxx -# NMTTools_PCurveMaker.hxx -# NMTTools_PCurveMaker.ixx -# NMTTools_PCurveMaker.jxx -# NMTTools_PDSFiller.hxx -# NMTTools_DSFiller.cdl -# NMTTools_DSFiller.cxx -# NMTTools_DSFiller.hxx -# NMTTools_DSFiller.ixx -# NMTTools_DSFiller.jxx +EXTRA_DIST += \ + $(CDL_FILES) \ + FILES diff --git a/src/NMTTools/NMTTools.cdl b/src/NMTTools/NMTTools.cdl index 727b8331e..e3ce88466 100644 --- a/src/NMTTools/NMTTools.cdl +++ b/src/NMTTools/NMTTools.cdl @@ -1,98 +1,129 @@ --- Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +-- Copyright (C) 2007-2012 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 +-- 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 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. +-- 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 +-- 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 +-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -- + -- File: NMTTools.cdl -- Created: Thu Dec 4 16:55:49 2003 -- Author: Peter KURNEV -- -- -package NMTTools +package NMTTools + + ---Purpose: - ---Purpose: +uses -uses - TCollection, TColStd, - gp, - TopAbs, - TopoDS, - TopTools, + gp, + TopAbs, + TopoDS, + TopTools, Geom2d, BooleanOperations, BOPTColStd, IntTools, - BOPTools, - + BOPTools, NMTDS -is - --class IteratorOfCoupleOfShape; - --class DSFiller; - class PaveFiller; - class Tools; - class CommonBlock; - class CommonBlockAPI; - --class PCurveMaker; - class DEProcessor; - class CoupleOfShape; - --modified by NIZNHY-PKV Mon Feb 19 11:39:24 2007f - class CheckerSI; - --modified by NIZNHY-PKV Mon Feb 19 11:39:27 2007t - - pointer PPaveFiller to PaveFiller from NMTTools; - --pointer PDSFiller to DSFiller from NMTTools; - - class ListOfCommonBlock instantiates - List from TCollection(CommonBlock from NMTTools); - - class CommonBlockPool instantiates - CArray1 from BOPTColStd (ListOfCommonBlock from NMTTools); - - class IndexedDataMapOfIndexedMapOfInteger instantiates - IndexedDataMap from TCollection (Integer from Standard, - IndexedMapOfInteger from TColStd, - MapIntegerHasher from TColStd); - - class IndexedDataMapOfShapePaveBlock instantiates - IndexedDataMap from TCollection (Shape from TopoDS, - PaveBlock from BOPTools, - ShapeMapHasher from TopTools); - - class IndexedDataMapOfShapeIndexedMapOfShape instantiates - IndexedDataMap from TCollection (Shape from TopoDS, - IndexedMapOfShape from TopTools, - ShapeMapHasher from TopTools); - - class ListOfCoupleOfShape instantiates - List from TCollection(CoupleOfShape from NMTTools); +is + imported CoupleOfShape from NMTTools; + imported CommonBlock from NMTTools; + imported CommonBlockAPI from NMTTools; + imported FaceInfo from NMTTools; + imported Tools from NMTTools; + imported PaveFiller from NMTTools; + imported PPaveFiller from NMTTools; + imported DEProcessor from NMTTools; + imported CheckerSI from NMTTools; + -- + imported ListOfCommonBlock from NMTTools; + imported ListIteratorOfListOfCommonBlock from NMTTools; + + imported ListOfCoupleOfShape from NMTTools; + imported ListIteratorOfListOfCoupleOfShape from NMTTools; + + imported MapOfPaveBlock from NMTTools; + imported MapIteratorOfMapOfPaveBlock from NMTTools; + + imported IndexedDataMapOfIndexedMapOfInteger from NMTTools; + imported IndexedDataMapOfShapePaveBlock from NMTTools; + imported IndexedDataMapOfShapeIndexedMapOfShape from NMTTools; + + imported DataMapOfIntegerListOfPaveBlock from NMTTools; + imported DataMapIteratorOfDataMapOfIntegerListOfPaveBlock from NMTTools; + + imported DataMapOfIntegerFaceInfo from NMTTools; + imported DataMapIteratorOfDataMapOfIntegerFaceInfo from NMTTools; + + imported CommonBlockPool from NMTTools; + + -- + --class PaveFiller; + --class Tools; + --class CommonBlock; + --class CommonBlockAPI; + --class FaceInfo; + --class CoupleOfShape; + --class CheckerSI; + --class DEProcessor; + --pointer PPaveFiller to PaveFiller from NMTTools; + -- + --class ListOfCommonBlock instantiates + -- List from TCollection(CommonBlock from NMTTools); + + --class ListOfCoupleOfShape instantiates + -- List from TCollection(CoupleOfShape from NMTTools); +-- + --class MapOfPaveBlock instantiates + -- Map from TCollection (PaveBlock from BOPTools, + -- PaveBlockMapHasher from BOPTools); +-- + --class IndexedDataMapOfIndexedMapOfInteger instantiates + -- IndexedDataMap from TCollection (Integer from Standard, + -- IndexedMapOfInteger from TColStd, + -- MapIntegerHasher from TColStd); + + --class IndexedDataMapOfShapePaveBlock instantiates + -- IndexedDataMap from TCollection (Shape from TopoDS, + -- PaveBlock from BOPTools, + -- ShapeMapHasher from TopTools); + + --class IndexedDataMapOfShapeIndexedMapOfShape instantiates + -- IndexedDataMap from TCollection (Shape from TopoDS, + -- IndexedMapOfShape from TopTools, + -- ShapeMapHasher from TopTools); + +-- + --class DataMapOfIntegerListOfPaveBlock instantiates + -- DataMap from TCollection(Integer from Standard, + -- ListOfPaveBlock from BOPTools, + -- MapIntegerHasher from TColStd); + --class DataMapOfIntegerFaceInfo instantiates + -- DataMap from TCollection(Integer from Standard, + -- FaceInfo from NMTTools, + -- MapIntegerHasher from TColStd); -- - class DataMapOfIntegerListOfPaveBlock instantiates - DataMap from TCollection(Integer from Standard, - ListOfPaveBlock from BOPTools, - MapIntegerHasher from TColStd); - - class MapOfPaveBlock instantiates - Map from TCollection (PaveBlock from BOPTools, - PaveBlockMapHasher from BOPTools); + --class CommonBlockPool instantiates + -- CArray1 from BOPTColStd (ListOfCommonBlock from NMTTools); -- end NMTTools; diff --git a/src/NMTTools/NMTTools.pro b/src/NMTTools/NMTTools.pro deleted file mode 100644 index 109a94959..000000000 --- a/src/NMTTools/NMTTools.pro +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = NMTTools -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} ../NMTDS - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lNMTDS $${STDLIB} $${CAS_LDPATH} -lTKBool -lTKBO $${KERNEL_LDFLAGS} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx -HEADERS += Handle_NMTDS_ListNodeOfListOfIndexedDataMapOfShapeAncestorsSuccessors.hxx -HEADERS += Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx -HEADERS += Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx -HEADERS += Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx -HEADERS += Handle_NMTTools_ListNodeOfListOfCommonBlock.hxx -HEADERS += Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx -HEADERS += NMTTools_CommonBlockAPI.hxx -HEADERS += NMTTools_CommonBlock.hxx -HEADERS += NMTTools_CommonBlockPool.hxx -HEADERS += NMTTools_CoupleOfShape.hxx -HEADERS += NMTTools_DEProcessor.hxx -HEADERS += NMTTools_DSFiller.hxx -HEADERS += NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx -HEADERS += NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx -HEADERS += NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx -HEADERS += NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx -HEADERS += NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx -HEADERS += NMTTools_IndexedDataMapOfShapePaveBlock.hxx -HEADERS += NMTTools_IteratorOfCoupleOfShape.hxx -HEADERS += NMTTools_ListIteratorOfListOfCommonBlock.hxx -HEADERS += NMTTools_ListIteratorOfListOfCoupleOfShape.hxx -HEADERS += NMTTools_ListNodeOfListOfCommonBlock.hxx -HEADERS += NMTTools_ListNodeOfListOfCoupleOfShape.hxx -HEADERS += NMTTools_ListOfCommonBlock.hxx -HEADERS += NMTTools_ListOfCoupleOfShape.hxx -HEADERS += NMTTools_PaveFiller.hxx -HEADERS += NMTTools_PCurveMaker.hxx -HEADERS += NMTTools_PDSFiller.hxx -HEADERS += NMTTools_PPaveFiller.hxx -HEADERS += NMTTools_Tools.hxx -HEADERS += Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx -HEADERS += Handle_NMTTools_StdMapNodeOfMapOfPaveBlock.hxx -HEADERS += NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx -HEADERS += NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx -HEADERS += NMTTools_DataMapOfIntegerListOfPaveBlock.hxx -HEADERS += NMTTools_MapIteratorOfMapOfPaveBlock.hxx -HEADERS += NMTTools_MapOfPaveBlock.hxx -HEADERS += NMTTools_StdMapNodeOfMapOfPaveBlock.hxx - -SOURCES = NMTTools_CommonBlockAPI.cxx -SOURCES += NMTTools_CommonBlock.cxx -SOURCES += NMTTools_CommonBlockPool_0.cxx -SOURCES += NMTTools_CoupleOfShape.cxx -SOURCES += NMTTools_DEProcessor.cxx -SOURCES += NMTTools_DSFiller.cxx -SOURCES += NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx -SOURCES += NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx -SOURCES += NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx -SOURCES += NMTTools_IndexedDataMapOfIndexedMapOfInteger_0.cxx -SOURCES += NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_0.cxx -SOURCES += NMTTools_IndexedDataMapOfShapePaveBlock_0.cxx -SOURCES += NMTTools_IteratorOfCoupleOfShape.cxx -SOURCES += NMTTools_ListIteratorOfListOfCommonBlock_0.cxx -SOURCES += NMTTools_ListIteratorOfListOfCoupleOfShape_0.cxx -SOURCES += NMTTools_ListNodeOfListOfCommonBlock_0.cxx -SOURCES += NMTTools_ListNodeOfListOfCoupleOfShape_0.cxx -SOURCES += NMTTools_ListOfCommonBlock_0.cxx -SOURCES += NMTTools_ListOfCoupleOfShape_0.cxx -SOURCES += NMTTools_PaveFiller_0.cxx -SOURCES += NMTTools_PaveFiller_1.cxx -SOURCES += NMTTools_PaveFiller_2.cxx -SOURCES += NMTTools_PaveFiller_3.cxx -SOURCES += NMTTools_PaveFiller_4.cxx -SOURCES += NMTTools_PaveFiller_5.cxx -SOURCES += NMTTools_PaveFiller_6.cxx -SOURCES += NMTTools_PaveFiller_7.cxx -SOURCES += NMTTools_PaveFiller_8.cxx -SOURCES += NMTTools_PaveFiller_9.cxx -SOURCES += NMTTools_PaveFiller.cxx -SOURCES += NMTTools_PCurveMaker.cxx -SOURCES += NMTTools_Tools.cxx -SOURCES += NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_0.cxx -SOURCES += NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_0.cxx -SOURCES += NMTTools_DataMapOfIntegerListOfPaveBlock_0.cxx -SOURCES += NMTTools_MapIteratorOfMapOfPaveBlock_0.cxx -SOURCES += NMTTools_MapOfPaveBlock_0.cxx -SOURCES += NMTTools_StdMapNodeOfMapOfPaveBlock_0.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/NMTTools/NMTTools_CheckerSI.cdl b/src/NMTTools/NMTTools_CheckerSI.cdl deleted file mode 100644 index 9267d8272..000000000 --- a/src/NMTTools/NMTTools_CheckerSI.cdl +++ /dev/null @@ -1,66 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_CheckerSI.cdl --- Created: Mon Feb 19 11:23:55 2007 --- Author: Peter KURNEV --- -class CheckerSI from NMTTools - inherits PaveFiller from NMTTools - ---Purpose: - -uses - ShapeEnum from TopAbs - ---raises - -is - - Create - returns CheckerSI from NMTTools; - ---C++: alias "Standard_EXPORT virtual ~NMTTools_CheckerSI();" - - Perform (me:out) - is redefined; - - Init (me:out) - is redefined protected; - - Clear (me:out) - is redefined protected; - - PreparePaveBlocks (me:out; - nE:Integer from Standard) - is redefined protected; - - PreparePaveBlocks (me:out; - aType1: ShapeEnum from TopAbs; - aType2: ShapeEnum from TopAbs) - is redefined protected; - - StopStatus(me) - returns Integer from Standard; - - -fields - myStopStatus: Integer from Standard is protected; - -end CheckerSI; diff --git a/src/NMTTools/NMTTools_CheckerSI.cxx b/src/NMTTools/NMTTools_CheckerSI.cxx index fd7cd2c2b..dd724ba6a 100644 --- a/src/NMTTools/NMTTools_CheckerSI.cxx +++ b/src/NMTTools/NMTTools_CheckerSI.cxx @@ -1,38 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: NMTTools_CheckerSI.cxx -// Created: Mon Feb 19 11:32:08 2007 -// Author: Peter KURNEV + +// File: NMTTools_CheckerSI.cxx +// Created: Mon Feb 19 11:32:08 2007 +// Author: Peter KURNEV // -#include +#include #include #include #include #include +#include //======================================================================= -//function : -//purpose : +//function : +//purpose : //======================================================================= NMTTools_CheckerSI::NMTTools_CheckerSI() : @@ -42,14 +41,14 @@ } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= NMTTools_CheckerSI::~NMTTools_CheckerSI() { } //======================================================================= //function : Clear -//purpose : +//purpose : //======================================================================= void NMTTools_CheckerSI::Clear() { @@ -57,7 +56,7 @@ } //======================================================================= //function : StopStatus -//purpose : +//purpose : //======================================================================= Standard_Integer NMTTools_CheckerSI::StopStatus()const { @@ -65,7 +64,7 @@ } //======================================================================= //function : Init -//purpose : +//purpose : //======================================================================= void NMTTools_CheckerSI::Init() { @@ -85,16 +84,19 @@ myDSIt->SetDS(myDS); myDSIt->Prepare(); // - // 4. + // 3. myNbSources=myDS->NumberOfShapesOfTheObject()+ myDS->NumberOfShapesOfTheTool(); myNbEdges=myDS->NbEdges(); - // 5 + // 4 myIP=new NMTDS_InterfPool; + // + // 5 + myContext=new IntTools_Context; } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void NMTTools_CheckerSI::Perform() { @@ -166,7 +168,7 @@ // MakePCurves(); // - // 7. Postprocessing + // 7. Postprocessing UpdatePaveBlocks(); // NMTTools_DEProcessor aDEP(*this); diff --git a/src/NMTTools/NMTTools_CheckerSI.hxx b/src/NMTTools/NMTTools_CheckerSI.hxx index 2bd804de4..ff9000ad5 100644 --- a/src/NMTTools/NMTTools_CheckerSI.hxx +++ b/src/NMTTools/NMTTools_CheckerSI.hxx @@ -1,120 +1,69 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: NMTTools_CheckerSI.hxx +// Created: Mon Feb 19 11:32:08 2007 +// Author: Peter KURNEV // #ifndef _NMTTools_CheckerSI_HeaderFile #define _NMTTools_CheckerSI_HeaderFile -#ifndef _Standard_Integer_HeaderFile +#include +#include #include -#endif -#ifndef _NMTTools_PaveFiller_HeaderFile #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile #include -#endif - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_CheckerSI : public NMTTools_PaveFiller { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_CheckerSI(); -Standard_EXPORT virtual ~NMTTools_CheckerSI(); - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT Standard_Integer StopStatus() const; +//======================================================================= +//class : NMTTools_CheckerSI +//purpose : +//======================================================================= +class NMTTools_CheckerSI : public NMTTools_PaveFiller +{ + public: + Standard_EXPORT + NMTTools_CheckerSI(); + Standard_EXPORT + virtual ~NMTTools_CheckerSI(); + Standard_EXPORT + virtual void Perform() ; + Standard_EXPORT + Standard_Integer StopStatus() const; -protected: + protected: + Standard_EXPORT + virtual void Init() ; - // Methods PROTECTED - // + Standard_EXPORT + virtual void Clear() ; + Standard_EXPORT + virtual void PreparePaveBlocks(const Standard_Integer nE) ; -Standard_EXPORT virtual void Init() ; - - -Standard_EXPORT virtual void Clear() ; - - -Standard_EXPORT virtual void PreparePaveBlocks(const Standard_Integer nE) ; - - -Standard_EXPORT virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1,const TopAbs_ShapeEnum aType2) ; - - - // Fields PROTECTED - // -Standard_Integer myStopStatus; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) ; + Standard_Integer myStopStatus; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_CheckerSI.ixx b/src/NMTTools/NMTTools_CheckerSI.ixx deleted file mode 100644 index ebd56f247..000000000 --- a/src/NMTTools/NMTTools_CheckerSI.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_CheckerSI.jxx b/src/NMTTools/NMTTools_CheckerSI.jxx deleted file mode 100644 index 774127cac..000000000 --- a/src/NMTTools/NMTTools_CheckerSI.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_CheckerSI_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_CheckerSI_1.cxx b/src/NMTTools/NMTTools_CheckerSI_1.cxx index a0c9f978b..eb00dec0f 100755 --- a/src/NMTTools/NMTTools_CheckerSI_1.cxx +++ b/src/NMTTools/NMTTools_CheckerSI_1.cxx @@ -1,29 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: NMTTools_CheckerSI.cxx -// Created: Mon Feb 19 11:32:08 2007 -// Author: Peter KURNEV + +// File: NMTTools_CheckerSI.cxx +// Created: Mon Feb 19 11:32:08 2007 +// Author: Peter KURNEV // -#include +#include #include #include @@ -48,28 +46,28 @@ static Standard_Boolean IsValid(const TopoDS_Edge& aE, - const TopoDS_Vertex& aV, - const Standard_Real aTV1, - const Standard_Real aTV2); + const TopoDS_Vertex& aV, + const Standard_Real aTV1, + const Standard_Real aTV2); //======================================================================= // function: PreparePaveBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_CheckerSI::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) + void NMTTools_CheckerSI::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) { NMTTools_PaveFiller::PreparePaveBlocks(aType1, aType2); } //======================================================================= // function: PreparePaveBlocks -// purpose: +// purpose: //======================================================================= void NMTTools_CheckerSI::PreparePaveBlocks(const Standard_Integer nE) { myIsDone=Standard_False; // - char buf[32]={"SR"}; + // char buf[32]={"SR"}; Standard_Boolean bIsValid; Standard_Integer nV1, nV2, iErr; Standard_Real aT1, aT2; @@ -77,7 +75,7 @@ static TopoDS_Vertex aV1, aV2; // BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); - // Edge + // Edge aE=TopoDS::Edge(myDS->Shape(nE)); if (BRep_Tool::Degenerated(aE)) { myIsDone=Standard_True; @@ -85,7 +83,7 @@ static } // BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); - + BOPTools_PaveBlockIterator aPBIt(nE, aPS); for (; aPBIt.More(); aPBIt.Next()) { BOPTools_PaveBlock& aPB=aPBIt.Value(); @@ -98,15 +96,15 @@ static // const BOPTools_Pave& aPave2=aPB.Pave2(); nV2=aPave2.Index(); - aV2=TopoDS::Vertex(myDS->Shape(nV2)); + aV2=TopoDS::Vertex(myDS->Shape(nV2)); aT2=aPave2.Param(); // bIsValid=Standard_True; if (nV1==nV2) { bIsValid=IsValid(aE, aV1, aT1, aT2); if (!bIsValid) { - //printf(" pb SR: nV nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); - myStopStatus=1; + //printf(" pb SR: nV nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2); + myStopStatus=1; } } // @@ -123,18 +121,18 @@ static } aPB.SetShrunkRange(aSR); aLPB.Append(aPB); - } //for (; aPBIt.More(); aPBIt.Next()) + } //for (; aPBIt.More(); aPBIt.Next()) myIsDone=Standard_True; } //======================================================================= //function : IsValid -//purpose : +//purpose : //======================================================================= Standard_Boolean IsValid(const TopoDS_Edge& aE, - const TopoDS_Vertex& aV, - const Standard_Real aTV1, - const Standard_Real aTV2) + const TopoDS_Vertex& aV, + const Standard_Real aTV1, + const Standard_Real aTV2) { Standard_Boolean bRet; Standard_Integer i, aNbP, aNbP1; diff --git a/src/NMTTools/NMTTools_CommonBlock.cdl b/src/NMTTools/NMTTools_CommonBlock.cdl deleted file mode 100644 index 406208a05..000000000 --- a/src/NMTTools/NMTTools_CommonBlock.cdl +++ /dev/null @@ -1,107 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_CommonBlock.cdl --- Created: Tue Dec 9 12:11:48 2003 --- Author: Peter KURNEV --- --- -class CommonBlock from NMTTools - - ---Purpose: - -uses - ListOfInteger from TColStd, - PaveBlock from BOPTools, - ListOfPaveBlock from BOPTools - ---raises - -is - Create - returns CommonBlock from NMTTools; - - AddPaveBlock(me:out; - aPB : PaveBlock from BOPTools); - - AddFace(me:out; - aF : Integer from Standard); - - AddFaces(me:out; - aLF: ListOfInteger from TColStd); - - PaveBlocks(me) - returns ListOfPaveBlock from BOPTools; - ---C++: return const & - - Faces (me) - returns ListOfInteger from TColStd; - ---C++: return const & - - PaveBlock1 (me) - returns PaveBlock from BOPTools; - ---C++: return const & - - PaveBlock1 (me:out; - anIx: Integer from Standard) - returns PaveBlock from BOPTools; - ---C++: return & - - PaveBlockOnEdge (me:out; - anIndex: Integer from Standard) - returns PaveBlock from BOPTools; - ---C++: return & - - IsPaveBlockOnFace (me; - anIndex: Integer from Standard) - returns Boolean from Standard; - - IsPaveBlockOnEdge (me; - anIndex: Integer from Standard) - returns Boolean from Standard; - - IsEqual (me; - aCB:CommonBlock from NMTTools) - returns Boolean from Standard; - - Contains(me; - aPB:PaveBlock from BOPTools) - returns Boolean from Standard; - --- SetEdge (me:out; --- anEdge:Integer from Standard); - --- Edge (me) --- returns Integer from Standard; - -fields - myPaveBlocks: ListOfPaveBlock from BOPTools is protected; - myFaces : ListOfInteger from TColStd is protected; - -end CommonBlock; - - - - - - - - diff --git a/src/NMTTools/NMTTools_CommonBlock.cxx b/src/NMTTools/NMTTools_CommonBlock.cxx index 94ff2e98c..701bf3790 100644 --- a/src/NMTTools/NMTTools_CommonBlock.cxx +++ b/src/NMTTools/NMTTools_CommonBlock.cxx @@ -1,44 +1,45 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_CommonBlock.cxx -// Created: Tue Dec 9 12:23:29 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_CommonBlock.cxx +// Created: Tue Dec 9 12:23:29 2003 +// Author: Peter KURNEV +// // -#include +#include #include #include //======================================================================= // function: NMTTools_CommonBlock::NMTTools_CommonBlock() -// purpose: +// purpose: //======================================================================= NMTTools_CommonBlock::NMTTools_CommonBlock() { } //======================================================================= // function: AddPaveBlock -// purpose: +// purpose: //======================================================================= void NMTTools_CommonBlock::AddPaveBlock(const BOPTools_PaveBlock& aPB) { @@ -46,7 +47,7 @@ } //======================================================================= // function: AddFace -// purpose: +// purpose: //======================================================================= void NMTTools_CommonBlock::AddFace(const Standard_Integer aF) { @@ -54,7 +55,7 @@ } //======================================================================= // function: AddFaces -// purpose: +// purpose: //======================================================================= void NMTTools_CommonBlock::AddFaces(const TColStd_ListOfInteger& aLF) { @@ -66,7 +67,7 @@ } //======================================================================= // function: PaveBlocks -// purpose: +// purpose: //======================================================================= const BOPTools_ListOfPaveBlock& NMTTools_CommonBlock::PaveBlocks()const { @@ -74,7 +75,7 @@ } //======================================================================= // function: Faces -// purpose: +// purpose: //======================================================================= const TColStd_ListOfInteger& NMTTools_CommonBlock::Faces()const { @@ -82,7 +83,7 @@ } //======================================================================= // function: PaveBlock1 -// purpose: +// purpose: //======================================================================= const BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1()const { @@ -90,7 +91,7 @@ } //======================================================================= // function: PaveBlock1 -// purpose: +// purpose: //======================================================================= BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1(const Standard_Integer aIx) { @@ -98,7 +99,7 @@ } //======================================================================= // function: PaveBlockOnEdge -// purpose: +// purpose: //======================================================================= BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlockOnEdge(const Standard_Integer aIx) { @@ -117,7 +118,7 @@ } //======================================================================= // function: IsPaveBlockOnFace -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnFace(const Standard_Integer aIx)const { @@ -135,7 +136,7 @@ } //======================================================================= // function: IsPaveBlockOnEdge -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnEdge(const Standard_Integer aIx)const { @@ -154,7 +155,7 @@ } //======================================================================= // function: IsEqual -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_CommonBlock::IsEqual(const NMTTools_CommonBlock& aOther)const { @@ -188,7 +189,7 @@ } //======================================================================= // function: Contains -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_CommonBlock::Contains(const BOPTools_PaveBlock& aPBx)const { @@ -214,7 +215,7 @@ /* //======================================================================= // function: SetEdge -// purpose: +// purpose: //======================================================================= void NMTTools_CommonBlock::SetEdge(const Standard_Integer anEdge) { @@ -228,7 +229,7 @@ } //======================================================================= // function: Edge -// purpose: +// purpose: //======================================================================= Standard_Integer NMTTools_CommonBlock::Edge()const { diff --git a/src/NMTTools/NMTTools_CommonBlock.hxx b/src/NMTTools/NMTTools_CommonBlock.hxx index d13b2c496..94dc4d9b2 100644 --- a/src/NMTTools/NMTTools_CommonBlock.hxx +++ b/src/NMTTools/NMTTools_CommonBlock.hxx @@ -1,144 +1,91 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTTools_CommonBlock.hxx +// Created: Tue Dec 9 12:23:29 2003 +// Author: Peter KURNEV +// +// + #ifndef _NMTTools_CommonBlock_HeaderFile #define _NMTTools_CommonBlock_HeaderFile -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile +#include +#include #include -#endif -#ifndef _TColStd_ListOfInteger_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class BOPTools_PaveBlock; -class TColStd_ListOfInteger; -class BOPTools_ListOfPaveBlock; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif +#include +//======================================================================= +//function : NMTTools_CommonBlock +//purpose : +//======================================================================= class NMTTools_CommonBlock { + public: + Standard_EXPORT + NMTTools_CommonBlock(); -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_CommonBlock(); - - -Standard_EXPORT void AddPaveBlock(const BOPTools_PaveBlock& aPB) ; - - -Standard_EXPORT void AddFace(const Standard_Integer aF) ; - - -Standard_EXPORT void AddFaces(const TColStd_ListOfInteger& aLF) ; - - -Standard_EXPORT const BOPTools_ListOfPaveBlock& PaveBlocks() const; + Standard_EXPORT + void AddPaveBlock(const BOPTools_PaveBlock& aPB) ; + Standard_EXPORT + void AddFace(const Standard_Integer aF) ; -Standard_EXPORT const TColStd_ListOfInteger& Faces() const; + Standard_EXPORT + void AddFaces(const TColStd_ListOfInteger& aLF) ; + Standard_EXPORT + const BOPTools_ListOfPaveBlock& PaveBlocks() const; -Standard_EXPORT const BOPTools_PaveBlock& PaveBlock1() const; + Standard_EXPORT + const TColStd_ListOfInteger& Faces() const; + Standard_EXPORT + const BOPTools_PaveBlock& PaveBlock1() const; -Standard_EXPORT BOPTools_PaveBlock& PaveBlock1(const Standard_Integer anIx) ; + Standard_EXPORT + BOPTools_PaveBlock& PaveBlock1(const Standard_Integer anIx) ; + Standard_EXPORT + BOPTools_PaveBlock& PaveBlockOnEdge(const Standard_Integer anIndex) ; -Standard_EXPORT BOPTools_PaveBlock& PaveBlockOnEdge(const Standard_Integer anIndex) ; + Standard_EXPORT + Standard_Boolean IsPaveBlockOnFace(const Standard_Integer anIndex) const; + Standard_EXPORT + Standard_Boolean IsPaveBlockOnEdge(const Standard_Integer anIndex) const; -Standard_EXPORT Standard_Boolean IsPaveBlockOnFace(const Standard_Integer anIndex) const; - - -Standard_EXPORT Standard_Boolean IsPaveBlockOnEdge(const Standard_Integer anIndex) const; - - -Standard_EXPORT Standard_Boolean IsEqual(const NMTTools_CommonBlock& aCB) const; - - -Standard_EXPORT Standard_Boolean Contains(const BOPTools_PaveBlock& aPB) const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -BOPTools_ListOfPaveBlock myPaveBlocks; -TColStd_ListOfInteger myFaces; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + Standard_EXPORT + Standard_Boolean IsEqual(const NMTTools_CommonBlock& aCB) const; + Standard_EXPORT + Standard_Boolean Contains(const BOPTools_PaveBlock& aPB) const; + protected: + BOPTools_ListOfPaveBlock myPaveBlocks; + TColStd_ListOfInteger myFaces; }; - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_CommonBlock.ixx b/src/NMTTools/NMTTools_CommonBlock.ixx deleted file mode 100644 index f335f8981..000000000 --- a/src/NMTTools/NMTTools_CommonBlock.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_CommonBlock.jxx b/src/NMTTools/NMTTools_CommonBlock.jxx deleted file mode 100644 index be3140a9c..000000000 --- a/src/NMTTools/NMTTools_CommonBlock.jxx +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2007-2008 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 _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _TColStd_ListOfInteger_HeaderFile -#include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_CommonBlock_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.cdl b/src/NMTTools/NMTTools_CommonBlockAPI.cdl deleted file mode 100644 index 601f6535f..000000000 --- a/src/NMTTools/NMTTools_CommonBlockAPI.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_CommonBlockAPI.cdl --- Created: Mon Dec 15 11:35:46 2003 --- Author: Peter KURNEV --- --- -class CommonBlockAPI from NMTTools - - ---Purpose: - -uses - ListOfCommonBlock from NMTTools, - ListOfPaveBlock from BOPTools, - PaveBlock from BOPTools, - CommonBlock from NMTTools - ---raises - -is - Create (aList:ListOfCommonBlock from NMTTools) - returns CommonBlockAPI from NMTTools; - - List(me) - returns ListOfCommonBlock from NMTTools; - ---C++: return const & - ---Purpose: - --- Selector - --- - CommonPaveBlocks(me; - anE:Integer from Standard) - returns ListOfPaveBlock from BOPTools; - ---C++: return const & - ---Purpose: - --- Returns all PaveBlock-s (from the list) that are - --- common for the given edge with DS-index - --- - IsCommonBlock (me; - aPB: PaveBlock from BOPTools) - returns Boolean from Standard; - ---Purpose: - --- Returns TRUE if given PaveBlock is - --- common for the Blocks from the list - - CommonBlock(me; - aPB: PaveBlock from BOPTools) - returns CommonBlock from NMTTools; - ---C++: return & - -fields - myListOfCommonBlock :Address from Standard; - myListOfPaveBlock :ListOfPaveBlock from BOPTools; - -end CommonBlockAPI; diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.cxx b/src/NMTTools/NMTTools_CommonBlockAPI.cxx index 817f328cb..4593ef860 100644 --- a/src/NMTTools/NMTTools_CommonBlockAPI.cxx +++ b/src/NMTTools/NMTTools_CommonBlockAPI.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_CommonBlockAPI.cxx -// Created: Mon Dec 15 11:38:04 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_CommonBlockAPI.cxx +// Created: Mon Dec 15 11:38:04 2003 +// Author: Peter KURNEV +// // -#include +#include #include #include @@ -36,7 +37,7 @@ //======================================================================= // function: NMTTools_CommonBlockAPI::NMTTools_CommonBlockAPI -// purpose: +// purpose: //======================================================================= NMTTools_CommonBlockAPI::NMTTools_CommonBlockAPI (const NMTTools_ListOfCommonBlock& aLCB) { @@ -44,7 +45,7 @@ } //======================================================================= // function: List -// purpose: +// purpose: //======================================================================= const NMTTools_ListOfCommonBlock& NMTTools_CommonBlockAPI::List () const { @@ -75,8 +76,8 @@ const BOPTools_PaveBlock& aPB=anItPB.Value(); anECurrent=aPB.OriginalEdge(); if (anECurrent==anE) { - pmyListOfPaveBlock->Append(aPB); - break; + pmyListOfPaveBlock->Append(aPB); + break; } } } @@ -84,7 +85,7 @@ } //======================================================================= // function: IsCommonBlock -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_CommonBlockAPI::IsCommonBlock(const BOPTools_PaveBlock& aPB) const { @@ -106,7 +107,7 @@ //======================================================================= // function: CommonBlock -// purpose: +// purpose: //======================================================================= NMTTools_CommonBlock& NMTTools_CommonBlockAPI::CommonBlock(const BOPTools_PaveBlock& aPB)const { @@ -119,14 +120,14 @@ // anItCB.Initialize(*pLCB); for (; anItCB.More(); anItCB.Next()) { - NMTTools_CommonBlock& aCB=anItCB.Value(); + NMTTools_CommonBlock& aCB=anItCB.ChangeValue(); // const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); anItPB.Initialize(aLPB); for (; anItPB.More(); anItPB.Next()) { const BOPTools_PaveBlock& aPBx=anItPB.Value(); if (aPBx.IsEqual(aPB)) { - return aCB; + return aCB; } } } diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.hxx b/src/NMTTools/NMTTools_CommonBlockAPI.hxx index 7b717d706..d9c4aa4e7 100644 --- a/src/NMTTools/NMTTools_CommonBlockAPI.hxx +++ b/src/NMTTools/NMTTools_CommonBlockAPI.hxx @@ -1,126 +1,74 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: NMTTools_CommonBlockAPI.hxx +// Created: Mon Dec 15 11:38:04 2003 +// Author: Peter KURNEV +// // #ifndef _NMTTools_CommonBlockAPI_HeaderFile #define _NMTTools_CommonBlockAPI_HeaderFile -#ifndef _Standard_Address_HeaderFile +#include +#include #include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -class NMTTools_ListOfCommonBlock; -class BOPTools_ListOfPaveBlock; -class BOPTools_PaveBlock; -class NMTTools_CommonBlock; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_CommonBlockAPI { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_CommonBlockAPI(const NMTTools_ListOfCommonBlock& aList); - +#include +#include +#include +#include + +//======================================================================= +//class : NMTTools_CommonBlockAPI +//purpose : +//======================================================================= +class NMTTools_CommonBlockAPI +{ + public: + Standard_EXPORT + NMTTools_CommonBlockAPI(const NMTTools_ListOfCommonBlock& aList); //! Selector
    -Standard_EXPORT const NMTTools_ListOfCommonBlock& List() const; - + Standard_EXPORT + const NMTTools_ListOfCommonBlock& List() const; //! Returns all PaveBlock-s (from the list) that are
    //! common for the given edge with DS-index
    -Standard_EXPORT const BOPTools_ListOfPaveBlock& CommonPaveBlocks(const Standard_Integer anE) const; - + Standard_EXPORT + const BOPTools_ListOfPaveBlock& CommonPaveBlocks(const Standard_Integer anE) const; //! Returns TRUE if given PaveBlock is
    //! common for the Blocks from the list
    -Standard_EXPORT Standard_Boolean IsCommonBlock(const BOPTools_PaveBlock& aPB) const; - - -Standard_EXPORT NMTTools_CommonBlock& CommonBlock(const BOPTools_PaveBlock& aPB) const; - - - - + Standard_EXPORT + Standard_Boolean IsCommonBlock(const BOPTools_PaveBlock& aPB) const; + Standard_EXPORT + NMTTools_CommonBlock& CommonBlock(const BOPTools_PaveBlock& aPB) const; protected: +//private: - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // Standard_Address myListOfCommonBlock; BOPTools_ListOfPaveBlock myListOfPaveBlock; - - }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.ixx b/src/NMTTools/NMTTools_CommonBlockAPI.ixx deleted file mode 100644 index fdca4ca4a..000000000 --- a/src/NMTTools/NMTTools_CommonBlockAPI.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.jxx b/src/NMTTools/NMTTools_CommonBlockAPI.jxx deleted file mode 100644 index 68ffe0ae9..000000000 --- a/src/NMTTools/NMTTools_CommonBlockAPI.jxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_ListOfCommonBlock_HeaderFile -#include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_CommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_CommonBlockAPI_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_CommonBlockPool.cxx b/src/NMTTools/NMTTools_CommonBlockPool.cxx new file mode 100644 index 000000000..d49252b41 --- /dev/null +++ b/src/NMTTools/NMTTools_CommonBlockPool.cxx @@ -0,0 +1,42 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTTools_CommonBlockPool.cxx +// Created: +// Author: Peter KURNEV +// +// + + +#include + +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _Standard_OutOfMemory_HeaderFile +#include +#endif + + +#define Array1Item NMTTools_ListOfCommonBlock +#define Array1Item_hxx +#define BOPTColStd_CArray1 NMTTools_CommonBlockPool +#define BOPTColStd_CArray1_hxx +#include + diff --git a/src/NMTTools/NMTTools_CommonBlockPool.hxx b/src/NMTTools/NMTTools_CommonBlockPool.hxx index 4c131de93..57a95d332 100644 --- a/src/NMTTools/NMTTools_CommonBlockPool.hxx +++ b/src/NMTTools/NMTTools_CommonBlockPool.hxx @@ -1,170 +1,122 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +// File: NMTTools_CommonBlockPool.hxx +// Created: +// Author: Peter KURNEV +// // + #ifndef _NMTTools_CommonBlockPool_HeaderFile #define _NMTTools_CommonBlockPool_HeaderFile -#ifndef _Standard_Address_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif +#include + class Standard_OutOfRange; class Standard_OutOfMemory; -class NMTTools_ListOfCommonBlock; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif -class NMTTools_CommonBlockPool { -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_CommonBlockPool(const Standard_Integer Length = 0,const Standard_Integer BlockLength = 5); - - -Standard_EXPORT void Resize(const Standard_Integer theNewLength) ; - - -Standard_EXPORT void Destroy() ; -~NMTTools_CommonBlockPool() +//======================================================================= +//class : NMTTools_CommonBlockPool +//purpose : +//======================================================================= +class NMTTools_CommonBlockPool { - Destroy(); -} + public: + Standard_EXPORT + NMTTools_CommonBlockPool(const Standard_Integer Length = 0,const Standard_Integer BlockLength = 5); + Standard_EXPORT + void Resize(const Standard_Integer theNewLength) ; + Standard_EXPORT + void Destroy() ; -Standard_EXPORT Standard_Integer Length() const; + ~NMTTools_CommonBlockPool() { + Destroy(); + } + Standard_EXPORT + Standard_Integer Length() const; -Standard_EXPORT Standard_Integer Extent() const; + Standard_EXPORT + Standard_Integer Extent() const; + Standard_EXPORT + Standard_Integer FactLength() const; -Standard_EXPORT Standard_Integer FactLength() const; + Standard_EXPORT + Standard_Integer Append(const NMTTools_ListOfCommonBlock& Value) ; + Standard_EXPORT + void Remove(const Standard_Integer Index) ; -Standard_EXPORT Standard_Integer Append(const NMTTools_ListOfCommonBlock& Value) ; + Standard_EXPORT + const NMTTools_ListOfCommonBlock& Value(const Standard_Integer Index) const; + const NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) const { + return Value(Index); + } -Standard_EXPORT void Remove(const Standard_Integer Index) ; - - -Standard_EXPORT const NMTTools_ListOfCommonBlock& Value(const Standard_Integer Index) const; - const NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) const -{ - return Value(Index); -} - - - -Standard_EXPORT NMTTools_ListOfCommonBlock& ChangeValue(const Standard_Integer Index) ; - NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) -{ - return ChangeValue(Index); -} - - - -Standard_EXPORT void SetBlockLength(const Standard_Integer aBL) ; - - -Standard_EXPORT Standard_Integer BlockLength() const; + Standard_EXPORT + NMTTools_ListOfCommonBlock& ChangeValue(const Standard_Integer Index) ; + NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) { + return ChangeValue(Index); + } + Standard_EXPORT + void SetBlockLength(const Standard_Integer aBL) ; + Standard_EXPORT + Standard_Integer BlockLength() const; + Standard_EXPORT + void Purge() ; protected: - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_CommonBlockPool(const NMTTools_CommonBlockPool& AnArray); +private: + Standard_EXPORT + NMTTools_CommonBlockPool(const NMTTools_CommonBlockPool& AnArray); + Standard_EXPORT + NMTTools_CommonBlockPool& Assign(const NMTTools_CommonBlockPool& Other) ; -Standard_EXPORT NMTTools_CommonBlockPool& Assign(const NMTTools_CommonBlockPool& Other) ; - NMTTools_CommonBlockPool& operator =(const NMTTools_CommonBlockPool& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const; + NMTTools_CommonBlockPool& operator =(const NMTTools_CommonBlockPool& Other) { + return Assign(Other); + } - - // Fields PRIVATE - // -Standard_Address myStart; -Standard_Integer myLength; -Standard_Integer myFactLength; -Standard_Integer myBlockLength; -Standard_Boolean myIsAllocated; + Standard_EXPORT + Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const; + Standard_Address myStart; + Standard_Integer myLength; + Standard_Integer myFactLength; + Standard_Integer myBlockLength; + Standard_Boolean myIsAllocated; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_CommonBlockPool_0.cxx b/src/NMTTools/NMTTools_CommonBlockPool_0.cxx deleted file mode 100644 index 72b005821..000000000 --- a/src/NMTTools/NMTTools_CommonBlockPool_0.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_OutOfMemory_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCommonBlock_HeaderFile -#include -#endif - - -#define Array1Item NMTTools_ListOfCommonBlock -#define Array1Item_hxx -#define BOPTColStd_CArray1 NMTTools_CommonBlockPool -#define BOPTColStd_CArray1_hxx -#include - diff --git a/src/NMTTools/NMTTools_CoupleOfShape.cdl b/src/NMTTools/NMTTools_CoupleOfShape.cdl deleted file mode 100644 index e9cc2d30e..000000000 --- a/src/NMTTools/NMTTools_CoupleOfShape.cdl +++ /dev/null @@ -1,58 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_CoupleOfShape.cdl --- Created: Wed Jan 28 15:03:39 2004 --- Author: Peter KURNEV --- --- -class CoupleOfShape from NMTTools - - ---Purpose: - -uses - Shape from TopoDS - ---raises - -is - Create - returns CoupleOfShape from NMTTools; - - SetShape1(me:out; - aS: Shape from TopoDS); - - SetShape2(me:out; - aS: Shape from TopoDS); - - Shape1(me) - returns Shape from TopoDS; - ---C++: return const & - - Shape2(me) - returns Shape from TopoDS; - ---C++: return const & - -fields - myShape1:Shape from TopoDS is protected; - myShape2:Shape from TopoDS is protected; - -end CoupleOfShape; diff --git a/src/NMTTools/NMTTools_CoupleOfShape.cxx b/src/NMTTools/NMTTools_CoupleOfShape.cxx index 5736b977c..80726d9bd 100644 --- a/src/NMTTools/NMTTools_CoupleOfShape.cxx +++ b/src/NMTTools/NMTTools_CoupleOfShape.cxx @@ -1,40 +1,41 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_CoupleOfShape.cxx -// Created: Wed Jan 28 15:06:11 2004 -// Author: Peter KURNEV -// + +// File: NMTTools_CoupleOfShape.cxx +// Created: Wed Jan 28 15:06:11 2004 +// Author: Peter KURNEV +// // -#include +#include //======================================================================= // function: NMTTools_CoupleOfShape::NMTTools_CoupleOfShape -// purpose: +// purpose: //======================================================================= NMTTools_CoupleOfShape::NMTTools_CoupleOfShape() {} //======================================================================= // function: SetShape1 -// purpose: +// purpose: //======================================================================= void NMTTools_CoupleOfShape::SetShape1(const TopoDS_Shape& aS) { @@ -42,7 +43,7 @@ } //======================================================================= // function: SetShape2 -// purpose: +// purpose: //======================================================================= void NMTTools_CoupleOfShape::SetShape2(const TopoDS_Shape& aS) { @@ -50,7 +51,7 @@ } //======================================================================= // function: Shape1 -// purpose: +// purpose: //======================================================================= const TopoDS_Shape& NMTTools_CoupleOfShape::Shape1()const { @@ -58,7 +59,7 @@ } //======================================================================= // function: Shape2 -// purpose: +// purpose: //======================================================================= const TopoDS_Shape& NMTTools_CoupleOfShape::Shape2()const { diff --git a/src/NMTTools/NMTTools_CoupleOfShape.hxx b/src/NMTTools/NMTTools_CoupleOfShape.hxx index 870b5261d..fef9a00fe 100644 --- a/src/NMTTools/NMTTools_CoupleOfShape.hxx +++ b/src/NMTTools/NMTTools_CoupleOfShape.hxx @@ -1,109 +1,61 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: NMTTools_CoupleOfShape.hxx +// Created: Wed Jan 28 15:06:11 2004 +// Author: Peter KURNEV +// // #ifndef _NMTTools_CoupleOfShape_HeaderFile #define _NMTTools_CoupleOfShape_HeaderFile -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -class TopoDS_Shape; - - -#ifndef _Standard_HeaderFile #include -#endif -#ifndef _Standard_Macro_HeaderFile #include -#endif - - -class NMTTools_CoupleOfShape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_CoupleOfShape(); - - -Standard_EXPORT void SetShape1(const TopoDS_Shape& aS) ; - - -Standard_EXPORT void SetShape2(const TopoDS_Shape& aS) ; - - -Standard_EXPORT const TopoDS_Shape& Shape1() const; - - -Standard_EXPORT const TopoDS_Shape& Shape2() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -TopoDS_Shape myShape1; -TopoDS_Shape myShape2; - +#include -private: +//======================================================================= +//class : NMTTools_CoupleOfShape +//purpose : +//======================================================================= +class NMTTools_CoupleOfShape +{ + public: + Standard_EXPORT + NMTTools_CoupleOfShape(); - // Methods PRIVATE - // + Standard_EXPORT + void SetShape1(const TopoDS_Shape& aS) ; + Standard_EXPORT + void SetShape2(const TopoDS_Shape& aS) ; - // Fields PRIVATE - // + Standard_EXPORT + const TopoDS_Shape& Shape1() const; + Standard_EXPORT + const TopoDS_Shape& Shape2() const; + protected: + TopoDS_Shape myShape1; + TopoDS_Shape myShape2; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_CoupleOfShape.ixx b/src/NMTTools/NMTTools_CoupleOfShape.ixx deleted file mode 100644 index 65ba2898a..000000000 --- a/src/NMTTools/NMTTools_CoupleOfShape.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_CoupleOfShape.jxx b/src/NMTTools/NMTTools_CoupleOfShape.jxx deleted file mode 100644 index 64230757c..000000000 --- a/src/NMTTools/NMTTools_CoupleOfShape.jxx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _NMTTools_CoupleOfShape_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_DEProcessor.cdl b/src/NMTTools/NMTTools_DEProcessor.cdl deleted file mode 100644 index d4e279c42..000000000 --- a/src/NMTTools/NMTTools_DEProcessor.cdl +++ /dev/null @@ -1,124 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_DEProcessor.cdl --- Created: Wed Sep 12 12:08:37 2001 --- Author: Peter KURNEV --- --- -class DEProcessor from NMTTools - - ---Purpose: - -- - -- The Algorithm to compute and store in interferences' pool - --- and in the Data Structure the following values - --- for degenerated edges - --- 1. Paves/Pave set(s) - --- 2. Split parts - --- 3. States (3D) for split parts - --- - -uses - - Vertex from TopoDS, - Edge from TopoDS, - Face from TopoDS, - - PPaveFiller from NMTTools, - PaveFiller from NMTTools, - --PDSFiller from NMTTools, - ListOfPaveBlock from BOPTools, - PShapesDataStructure from NMTDS, - IndexedDataMapOfIntegerDEInfo from BOPTools - - -is - --Create (aFiller:out PDSFiller from NMTTools) - -- returns DEProcessor from NMTTools; - ---Purpose: - --- Constructor - --- - Create (aFiller:out PaveFiller from NMTTools) - returns DEProcessor from NMTTools; - ---Purpose: - --- Constructor - --- - Do(me:out); - ---Purpose: - --- Launches the processor - --- - IsDone(me) - returns Boolean from Standard; - ---Purpose: - --- Returns TRUE if it is Ok - --- - --- - --- Private block - --- - --- - FindDegeneratedEdges (me:out) - is protected; - - DoPaves (me:out) - is protected; - - FindPaveBlocks (me:out; - nED:Integer from Standard; - nVD:Integer from Standard; - nFD:Integer from Standard; - aLPB:out ListOfPaveBlock from BOPTools) - is protected; - - FillPaveSet (me:out; - nED:Integer from Standard; - nVD:Integer from Standard; - nFD:Integer from Standard; - aLPB: ListOfPaveBlock from BOPTools) - is protected; - - FillSplitEdgesPool(me:out; - nED:Integer from Standard) - is protected; - - MakeSplitEdges(me:out; - nED:Integer from Standard; - nFD:Integer from Standard) - is protected; - - MakeSplitEdge (me:out; - aS1: Edge from TopoDS; - aF : Face from TopoDS; - aV1: Vertex from TopoDS; - aP1: Real from Standard; - aV2: Vertex from TopoDS; - aP2: Real from Standard; - aNewEdge:out Edge from TopoDS) - is protected; - -fields - - --myDSFiller: PDSFiller from NMTTools is protected; - myFiller : PPaveFiller from NMTTools is protected; - myDS : PShapesDataStructure from NMTDS is protected; - myIsDone : Boolean from Standard is protected; - myDEMap : IndexedDataMapOfIntegerDEInfo from BOPTools is protected; - -end DEProcessor; diff --git a/src/NMTTools/NMTTools_DEProcessor.cxx b/src/NMTTools/NMTTools_DEProcessor.cxx index 538c998b4..7a1501a38 100644 --- a/src/NMTTools/NMTTools_DEProcessor.cxx +++ b/src/NMTTools/NMTTools_DEProcessor.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_DEProcessor.cxx -// Created: Wed Sep 12 12:10:52 2001 -// Author: Peter KURNEV -// + +// File: NMTTools_DEProcessor.cxx +// Created: Wed Sep 12 12:10:52 2001 +// Author: Peter KURNEV +// // -#include +#include #include @@ -90,8 +91,8 @@ #include //======================================================================= -// function: -// purpose: +// function: +// purpose: //======================================================================= NMTTools_DEProcessor::NMTTools_DEProcessor(NMTTools_PaveFiller& aPaveFiller) : @@ -102,7 +103,7 @@ } //======================================================================= // function: IsDone -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_DEProcessor::IsDone() const { @@ -110,7 +111,7 @@ } //======================================================================= // function: Do -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::Do() { @@ -130,7 +131,7 @@ } //======================================================================= // function: FindDegeneratedEdges -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::FindDegeneratedEdges() { @@ -150,38 +151,38 @@ const TopoDS_Shape aS=myDS->Shape(i); if (aS.ShapeType()==TopAbs_EDGE) { const TopoDS_Edge& aE=TopoDS::Edge(aS); - + if (BRep_Tool::Degenerated(aE)) { - iRankE=myDS->Rank(i); - aV=TopExp::FirstVertex(aE); - nVx=myDS->ShapeIndex(aV, iRankE); - // - nV=nVx; - ip=myFiller->FindSDVertex(nV); - if (ip) { - nV=ip; - } - // - TColStd_ListOfInteger aLFn; - const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE); - TopTools_ListIteratorOfListOfShape anIt(aLF); - for (; anIt.More(); anIt.Next()) { - const TopoDS_Shape& aF=anIt.Value(); - nF=myDS->ShapeIndex(aF, iRankE); - aLFn.Append(nF); - } - BOPTools_DEInfo aDEInfo; - aDEInfo.SetVertex(nV); - aDEInfo.SetFaces(aLFn); - - myDEMap.Add (i, aDEInfo); + iRankE=myDS->Rank(i); + aV=TopExp::FirstVertex(aE); + nVx=myDS->ShapeIndex(aV, iRankE); + // + nV=nVx; + ip=myFiller->FindSDVertex(nV); + if (ip) { + nV=ip; + } + // + TColStd_ListOfInteger aLFn; + const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE); + TopTools_ListIteratorOfListOfShape anIt(aLF); + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape& aF=anIt.Value(); + nF=myDS->ShapeIndex(aF, iRankE); + aLFn.Append(nF); + } + BOPTools_DEInfo aDEInfo; + aDEInfo.SetVertex(nV); + aDEInfo.SetFaces(aLFn); + + myDEMap.Add (i, aDEInfo); } } } } //======================================================================= // function: DoPaves -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::DoPaves() { @@ -201,18 +202,18 @@ TColStd_ListIteratorOfListOfInteger anIt(nLF); for (; anIt.More(); anIt.Next()) { nFD=anIt.Value(); - + BOPTools_ListOfPaveBlock aLPB; FindPaveBlocks(nED, nVD, nFD, aLPB); // aNbLPB=aLPB.Extent(); if (!aNbLPB) { - continue; + continue; } // FillPaveSet (nED, nVD, nFD, aLPB); } - // + // // Fill aSplitEdges for the edge nED FillSplitEdgesPool(nED); // @@ -223,12 +224,12 @@ } //======================================================================= // function: FindPaveBlocks -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::FindPaveBlocks(const Standard_Integer , - const Standard_Integer nVD, - const Standard_Integer nFD, - BOPTools_ListOfPaveBlock& aLPBOut) + const Standard_Integer nVD, + const Standard_Integer nFD, + BOPTools_ListOfPaveBlock& aLPBOut) { BOPTools_ListIteratorOfListOfPaveBlock anIt; Standard_Integer i, aNb, nF2, nV; @@ -244,7 +245,7 @@ continue; } // - // Split Parts + // Split Parts const BOPTools_ListOfPaveBlock& aLPBSplits=aFF.PaveBlocks(); anIt.Initialize(aLPBSplits); for (; anIt.More(); anIt.Next()) { @@ -253,20 +254,20 @@ const BOPTools_Pave& aPave1=aPBSp.Pave1(); nV=aPave1.Index(); if (nV==nVD) { - aLPBOut.Append(aPBSp); - continue; + aLPBOut.Append(aPBSp); + continue; } // const BOPTools_Pave& aPave2=aPBSp.Pave2(); nV=aPave2.Index(); if (nV==nVD) { - aLPBOut.Append(aPBSp); - continue; + aLPBOut.Append(aPBSp); + continue; } } // // Section Parts - Standard_Integer j, aNbCurves; + Standard_Integer j, aNbCurves; // BOPTools_SequenceOfCurves& aSC=aFF.Curves(); aNbCurves=aSC.Length(); @@ -276,33 +277,33 @@ // anIt.Initialize(aLPBSe); for (; anIt.More(); anIt.Next()) { - const BOPTools_PaveBlock& aPBSe=anIt.Value(); - // - const BOPTools_Pave& aPv1=aPBSe.Pave1(); - nV=aPv1.Index(); - if (nV==nVD) { - aLPBOut.Append(aPBSe); - continue; - } - // - const BOPTools_Pave& aPv2=aPBSe.Pave2(); - nV=aPv2.Index(); - if (nV==nVD) { - aLPBOut.Append(aPBSe); - continue; - } + const BOPTools_PaveBlock& aPBSe=anIt.Value(); + // + const BOPTools_Pave& aPv1=aPBSe.Pave1(); + nV=aPv1.Index(); + if (nV==nVD) { + aLPBOut.Append(aPBSe); + continue; + } + // + const BOPTools_Pave& aPv2=aPBSe.Pave2(); + nV=aPv2.Index(); + if (nV==nVD) { + aLPBOut.Append(aPBSe); + continue; + } } } } } //======================================================================= // function: FillPaveSet -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::FillPaveSet (const Standard_Integer nED, - const Standard_Integer nVD, - const Standard_Integer nFD, - const BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nVD, + const Standard_Integer nFD, + const BOPTools_ListOfPaveBlock& aLPB) { Standard_Boolean bIsDone, bXDir, bRejectFlag; Standard_Integer nE, aNbPoints, j; @@ -312,7 +313,7 @@ // aDT=Precision::PConfusion(); // - BOPTools_PaveSet& aPaveSet= + BOPTools_PaveSet& aPaveSet= (myFiller->ChangePavePool()).ChangeValue(myDS->RefEdge(nED)); // // Clear aPaveSet, aSplitEdges @@ -340,13 +341,13 @@ BOPTools_Pave aPave2 (nVD, aTD2, BooleanOperations_UnknownInterference); aPaveSet.Append(aPave2); // - // Fill other paves + // Fill other paves BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB); for (; anIt.More(); anIt.Next()) { const BOPTools_PaveBlock& aPB=anIt.Value(); nE=aPB.Edge(); const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE)); - + Handle(Geom2d_Curve) aC2D=BRep_Tool::CurveOnSurface(aE, aDF, aT1, aT2); // // Intersection @@ -366,63 +367,63 @@ bIsDone=aGInter.IsDone(); if(bIsDone) { aNbPoints=aGInter.NbPoints(); - if (aNbPoints) { - for (j=1; j<=aNbPoints; ++j) { - aP2D=aGInter.Point(j).Value(); - Handle(Geom2d_Line) aCLDE; - // - //modified by NIZNHY-PKV Thu Mar 20 17:37:32 2008f - Handle(Geom2d_TrimmedCurve) aCLDET1= - Handle(Geom2d_TrimmedCurve)::DownCast(aC2DDE1); - if (aCLDET1.IsNull()) { - aCLDE=Handle(Geom2d_Line)::DownCast(aC2DDE1); - } - else { - Handle(Geom2d_Curve) aBasisCurve=aCLDET1->BasisCurve(); - aCLDE=Handle(Geom2d_Line)::DownCast(aBasisCurve); - } - //aCLDE=Handle(Geom2d_Line)::DownCast(aC2DDE1); - //modified by NIZNHY-PKV Thu Mar 20 17:37:37 2008t - - if (aCLDE.IsNull()) { - continue; - } - - aLDE=aCLDE->Lin2d(); - aX=ElCLib::Parameter(aLDE, aP2D); - // - if (fabs (aX-aTD1) < aDT || fabs (aX-aTD2) < aDT) { - continue; - } - if (aX < aTD1 || aX > aTD2) { - continue; - } - // - bRejectFlag=Standard_False; - const BOPTools_ListOfPave& aListOfPave=aPaveSet.Set(); - BOPTools_ListIteratorOfListOfPave aPaveIt(aListOfPave); - for (; aPaveIt.More(); aPaveIt.Next()) { - const BOPTools_Pave& aPavex=aPaveIt.Value(); - aXx=aPavex.Param(); - if (fabs (aX-aXx) < aDT) { - bRejectFlag=Standard_True; - break; - } - } - if (bRejectFlag) { - continue; - } - // - BOPTools_Pave aPave(nVD, aX, BooleanOperations_UnknownInterference); - aPaveSet.Append(aPave); - } + if (aNbPoints) { + for (j=1; j<=aNbPoints; ++j) { + aP2D=aGInter.Point(j).Value(); + Handle(Geom2d_Line) aCLDE; + // + //modified by NIZNHY-PKV Thu Mar 20 17:37:32 2008f + Handle(Geom2d_TrimmedCurve) aCLDET1= + Handle(Geom2d_TrimmedCurve)::DownCast(aC2DDE1); + if (aCLDET1.IsNull()) { + aCLDE=Handle(Geom2d_Line)::DownCast(aC2DDE1); + } + else { + Handle(Geom2d_Curve) aBasisCurve=aCLDET1->BasisCurve(); + aCLDE=Handle(Geom2d_Line)::DownCast(aBasisCurve); + } + //aCLDE=Handle(Geom2d_Line)::DownCast(aC2DDE1); + //modified by NIZNHY-PKV Thu Mar 20 17:37:37 2008t + + if (aCLDE.IsNull()) { + continue; + } + + aLDE=aCLDE->Lin2d(); + aX=ElCLib::Parameter(aLDE, aP2D); + // + if (fabs (aX-aTD1) < aDT || fabs (aX-aTD2) < aDT) { + continue; + } + if (aX < aTD1 || aX > aTD2) { + continue; + } + // + bRejectFlag=Standard_False; + const BOPTools_ListOfPave& aListOfPave=aPaveSet.Set(); + BOPTools_ListIteratorOfListOfPave aPaveIt(aListOfPave); + for (; aPaveIt.More(); aPaveIt.Next()) { + const BOPTools_Pave& aPavex=aPaveIt.Value(); + aXx=aPavex.Param(); + if (fabs (aX-aXx) < aDT) { + bRejectFlag=Standard_True; + break; + } + } + if (bRejectFlag) { + continue; + } + // + BOPTools_Pave aPave(nVD, aX, BooleanOperations_UnknownInterference); + aPaveSet.Append(aPave); + } } } } } //======================================================================= // function: FillSplitEdgesPool -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::FillSplitEdgesPool (const Standard_Integer nED) { @@ -436,7 +437,7 @@ const BOPTools_PavePool& aPavePool=myFiller->PavePool(); BOPTools_PavePool* pPavePool=(BOPTools_PavePool*) &aPavePool; BOPTools_PaveSet& aPaveSet= pPavePool->ChangeValue(myDS->RefEdge(nED)); - + BOPTools_PaveBlockIterator aPBIt(nED, aPaveSet); for (; aPBIt.More(); aPBIt.Next()) { BOPTools_PaveBlock& aPB=aPBIt.Value(); @@ -445,50 +446,88 @@ } //======================================================================= // function: MakeSplitEdges -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::MakeSplitEdges (const Standard_Integer nED, - const Standard_Integer nFD) + const Standard_Integer nFD) { const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool(); const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nED)); - Standard_Integer nV1, nV2, aNewShapeIndex; - Standard_Real t1, t2; + Standard_Integer nV1, nV2, aNbPB, aNewShapeIndex; + Standard_Real t1, t2; TopoDS_Edge aE, aESplit; TopoDS_Vertex aV1, aV2; - + BOPTools_ListIteratorOfListOfPaveBlock aPBIt; + // const TopoDS_Edge aDE=TopoDS::Edge(myDS->Shape(nED)); const TopoDS_Face aDF=TopoDS::Face(myDS->Shape(nFD)); - - BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges); - + // + //modified by NIZNHY-PKV Wed Oct 20 13:20:37 2010f + aNbPB=aSplitEdges.Extent(); + if (aNbPB==1) { + Standard_Real aT1, aT2, dT1, dT2, aDT; + Handle(Geom2d_Curve) aC2D; + // + BOPTools_PaveBlock& aPB=aSplitEdges.First(); + // + const BOPTools_Pave& aPave1=aPB.Pave1(); + t1=aPave1.Param(); + const BOPTools_Pave& aPave2=aPB.Pave2(); + t2=aPave2.Param(); + //// + nV1=aPave1.Index(); + aV1=*((TopoDS_Vertex*)&myDS->GetShape(nV1)); + // + aV2=TopExp::FirstVertex(aDE); + if (aV2.IsSame(aV1)) { + aC2D=BRep_Tool::CurveOnSurface(aDE, aDF, aT1, aT2); + dT1=aT1-t1; + if (dT1<0.) { + dT1=-dT1; + } + // + dT2=aT2-t2; + if (dT2<0.) { + dT2=-dT2; + } + aDT=Precision::PConfusion(); + if(dT1Clear(); + return; + } + } + } + //modified by NIZNHY-PKV Wed Oct 20 13:20:39 2010t + // + aPBIt.Initialize(aSplitEdges); for (; aPBIt.More(); aPBIt.Next()) { BOPTools_PaveBlock& aPB=aPBIt.Value(); - + const BOPTools_Pave& aPave1=aPB.Pave1(); nV1=aPave1.Index(); t1=aPave1.Param(); aV1=TopoDS::Vertex(myDS->GetShape(nV1)); aV1.Orientation(TopAbs_FORWARD); - + const BOPTools_Pave& aPave2=aPB.Pave2(); nV2=aPave2.Index(); t2=aPave2.Param(); aV2=TopoDS::Vertex(myDS->GetShape(nV2)); aV2.Orientation(TopAbs_REVERSED); - - MakeSplitEdge(aDE, aDF, aV1, t1, aV2, t2, aESplit); + + MakeSplitEdge(aDE, aDF, aV1, t1, aV2, t2, aESplit); // // Add Split Part of the Original Edge to the DS BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; - + anASSeq.SetNewSuccessor(nV1); anASSeq.SetNewOrientation(aV1.Orientation()); - + anASSeq.SetNewSuccessor(nV2); anASSeq.SetNewOrientation(aV2.Orientation()); - + myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq); aNewShapeIndex=myDS->NumberOfInsertedShapes(); myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN); @@ -500,15 +539,15 @@ } //======================================================================= // function: MakeSplitEdge -// purpose: +// purpose: //======================================================================= void NMTTools_DEProcessor::MakeSplitEdge (const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const TopoDS_Vertex& aV1, - const Standard_Real aP1, - const TopoDS_Vertex& aV2, - const Standard_Real aP2, - TopoDS_Edge& aNewEdge) + const TopoDS_Face& aF, + const TopoDS_Vertex& aV1, + const Standard_Real aP1, + const TopoDS_Vertex& aV2, + const Standard_Real aP2, + TopoDS_Edge& aNewEdge) { Standard_Real aTol=1.e-7; diff --git a/src/NMTTools/NMTTools_DEProcessor.hxx b/src/NMTTools/NMTTools_DEProcessor.hxx index c3587312f..e2ee6e089 100644 --- a/src/NMTTools/NMTTools_DEProcessor.hxx +++ b/src/NMTTools/NMTTools_DEProcessor.hxx @@ -1,58 +1,42 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTTools_DEProcessor.hxx +// Created: Wed Sep 12 12:10:52 2001 +// Author: Peter KURNEV +// + #ifndef _NMTTools_DEProcessor_HeaderFile #define _NMTTools_DEProcessor_HeaderFile -#ifndef _NMTTools_PPaveFiller_HeaderFile +#include +#include #include -#endif -#ifndef _NMTDS_PShapesDataStructure_HeaderFile #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _BOPTools_IndexedDataMapOfIntegerDEInfo_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile +#include #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -class NMTTools_PaveFiller; -class BOPTools_ListOfPaveBlock; -class TopoDS_Edge; -class TopoDS_Face; -class TopoDS_Vertex; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif //!
    @@ -63,97 +47,71 @@ class TopoDS_Vertex; //! 2. Split parts
    //! 3. States (3D) for split parts
    //!
    +//======================================================================= +//class : NMTTools_DEProcessor +//purpose : +//======================================================================= class NMTTools_DEProcessor { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // //! Constructor
    //!
    //! Constructor
    //!
    -Standard_EXPORT NMTTools_DEProcessor(NMTTools_PaveFiller& aFiller); - + Standard_EXPORT + NMTTools_DEProcessor(NMTTools_PaveFiller& aFiller); //! Launches the processor
    -Standard_EXPORT void Do() ; - + Standard_EXPORT + void Do() ; //! Returns TRUE if it is Ok
    -Standard_EXPORT Standard_Boolean IsDone() const; - - + Standard_EXPORT + Standard_Boolean IsDone() const; protected: - - // Methods PROTECTED - // - - -Standard_EXPORT void FindDegeneratedEdges() ; - - -Standard_EXPORT void DoPaves() ; - - -Standard_EXPORT void FindPaveBlocks(const Standard_Integer nED,const Standard_Integer nVD,const Standard_Integer nFD,BOPTools_ListOfPaveBlock& aLPB) ; - - -Standard_EXPORT void FillPaveSet(const Standard_Integer nED,const Standard_Integer nVD,const Standard_Integer nFD,const BOPTools_ListOfPaveBlock& aLPB) ; - - -Standard_EXPORT void FillSplitEdgesPool(const Standard_Integer nED) ; - - -Standard_EXPORT void MakeSplitEdges(const Standard_Integer nED,const Standard_Integer nFD) ; - - -Standard_EXPORT void MakeSplitEdge(const TopoDS_Edge& aS1,const TopoDS_Face& aF,const TopoDS_Vertex& aV1,const Standard_Real aP1,const TopoDS_Vertex& aV2,const Standard_Real aP2,TopoDS_Edge& aNewEdge) ; - - - // Fields PROTECTED - // -NMTTools_PPaveFiller myFiller; -NMTDS_PShapesDataStructure myDS; -Standard_Boolean myIsDone; -BOPTools_IndexedDataMapOfIntegerDEInfo myDEMap; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - + Standard_EXPORT + void FindDegeneratedEdges() ; + + Standard_EXPORT + void DoPaves() ; + + Standard_EXPORT + void FindPaveBlocks(const Standard_Integer nED, + const Standard_Integer nVD, + const Standard_Integer nFD, + BOPTools_ListOfPaveBlock& aLPB) ; + + Standard_EXPORT + void FillPaveSet(const Standard_Integer nED, + const Standard_Integer nVD, + const Standard_Integer nFD, + const BOPTools_ListOfPaveBlock& aLPB) ; + + Standard_EXPORT + void FillSplitEdgesPool(const Standard_Integer nED) ; + + Standard_EXPORT + void MakeSplitEdges(const Standard_Integer nED, + const Standard_Integer nFD) ; + + Standard_EXPORT + void MakeSplitEdge(const TopoDS_Edge& aS1, + const TopoDS_Face& aF, + const TopoDS_Vertex& aV1, + const Standard_Real aP1, + const TopoDS_Vertex& aV2, + const Standard_Real aP2, + TopoDS_Edge& aNewEdge) ; + + + NMTTools_PPaveFiller myFiller; + NMTDS_PShapesDataStructure myDS; + Standard_Boolean myIsDone; + BOPTools_IndexedDataMapOfIntegerDEInfo myDEMap; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_DEProcessor.ixx b/src/NMTTools/NMTTools_DEProcessor.ixx deleted file mode 100644 index e7f2e54f8..000000000 --- a/src/NMTTools/NMTTools_DEProcessor.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_DEProcessor.jxx b/src/NMTTools/NMTTools_DEProcessor.jxx deleted file mode 100644 index 9b5931f0e..000000000 --- a/src/NMTTools/NMTTools_DEProcessor.jxx +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_PaveFiller_HeaderFile -#include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _NMTTools_DEProcessor_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_DSFiller.cdl b/src/NMTTools/NMTTools_DSFiller.cdl deleted file mode 100644 index bf9522076..000000000 --- a/src/NMTTools/NMTTools_DSFiller.cdl +++ /dev/null @@ -1,99 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_DSFiller.cdl --- Created: Fri Dec 5 13:57:03 2003 --- Author: Peter KURNEV --- --- -class DSFiller from NMTTools - - ---Purpose: - -uses - Shape from TopoDS, - InterferencePool from BOPTools, - PInterferencePool from BOPTools, - ShapesDataStructure from NMTDS, - PShapesDataStructure from NMTDS, - PPaveFiller from NMTTools, - PaveFiller from NMTTools ---raises - -is - Create - returns DSFiller from NMTTools; - - Destroy (me:out); - ---C++: alias ~ - ---Purpose: Destructor - -- - -- Selectors/Modifiers - SetCompositeShape (me:out; - aS: Shape from TopoDS); - - CompositeShape(me) - returns Shape from TopoDS; - ---C++: return const& - - SetNewFiller(me; - aFlag:Boolean from Standard); - - IsNewFiller(me) - returns Boolean from Standard; - -- - -- Perform the algo - Perform (me:out); - -- - -- Protected section - Clear (me:out) - is protected; - -- - -- Query section - DS (me) - returns ShapesDataStructure from NMTDS; - ---C++: return const & - - InterfPool (me) - returns InterferencePool from BOPTools; - ---C++: return const & - - IsDone(me) - returns Boolean from Standard; - - PaveFiller(me) - returns PaveFiller from NMTTools; - ---C++: return const & - - ChangePaveFiller (me:out) - returns PaveFiller from NMTTools; - ---C++: return & - -fields - myCompositeShape : Shape from TopoDS is protected; - myDS : PShapesDataStructure from NMTDS is protected; - myInterfPool : PInterferencePool from BOPTools is protected; - myPaveFiller : PPaveFiller from NMTTools is protected; - - myIsDone : Boolean from Standard is protected; - myIsNewFiller : Boolean from Standard is protected; - -end DSFiller; diff --git a/src/NMTTools/NMTTools_DSFiller.cxx b/src/NMTTools/NMTTools_DSFiller.cxx deleted file mode 100644 index 861a72c82..000000000 --- a/src/NMTTools/NMTTools_DSFiller.cxx +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTTools_DSFiller.cxx -// Created: Fri Dec 5 14:06:34 2003 -// Author: Peter KURNEV -// -// -#include -#include - -//======================================================================= -// function: NMTTools_DSFiller::NMTTools_DSFiller -// purpose: -//======================================================================= - NMTTools_DSFiller::NMTTools_DSFiller() -{ - myPaveFiller=NULL; - myInterfPool=NULL; - myDS=NULL; - myIsNewFiller=Standard_True; - myIsDone=Standard_False; -} -//======================================================================= -// function:Destroy -// purpose: -//======================================================================= - void NMTTools_DSFiller::Destroy() -{ - Clear(); -} -//======================================================================= -// function: Clear -// purpose: -//======================================================================= - void NMTTools_DSFiller::Clear() -{ - if (myPaveFiller!=NULL) { - delete myPaveFiller; - } - if (myInterfPool!=NULL) { - delete myInterfPool; - } - if (myDS!=NULL) { - delete myDS; - } - myPaveFiller=NULL; - myInterfPool=NULL; - myDS=NULL; -} -//======================================================================= -// function: SetCompositeShape -// purpose: -//======================================================================= - void NMTTools_DSFiller::SetCompositeShape(const TopoDS_Shape& aS) -{ - myCompositeShape=aS; -} -//======================================================================= -// function: CompositeShape -// purpose: -//======================================================================= - const TopoDS_Shape& NMTTools_DSFiller::CompositeShape()const -{ - return myCompositeShape; -} -//======================================================================= -// function: SetNewFiller -// purpose: -//======================================================================= - void NMTTools_DSFiller::SetNewFiller(const Standard_Boolean aFlag) const -{ - NMTTools_DSFiller* pDSFiller=(NMTTools_DSFiller*)this; - pDSFiller->myIsNewFiller=aFlag; -} -//======================================================================= -// function: IsNewFiller -// purpose: -//======================================================================= - Standard_Boolean NMTTools_DSFiller::IsNewFiller() const -{ - return myIsNewFiller; -} -//======================================================================= -// function: DS -// purpose: -//======================================================================= - const NMTDS_ShapesDataStructure& NMTTools_DSFiller::DS () const -{ - return *myDS; -} -//======================================================================= -// function: InterfPool -// purpose: -//======================================================================= - const BOPTools_InterferencePool& NMTTools_DSFiller::InterfPool () const -{ - return *myInterfPool; -} -//======================================================================= -// function: IsDone -// purpose: -//======================================================================= - Standard_Boolean NMTTools_DSFiller::IsDone()const -{ - return myIsDone; -} -//======================================================================= -// function: PaveFiller -// purpose: -//======================================================================= - const NMTTools_PaveFiller& NMTTools_DSFiller::PaveFiller()const -{ - return *myPaveFiller; -} -//======================================================================= -// function: ChangePaveFiller -// purpose: -//======================================================================= - NMTTools_PaveFiller& NMTTools_DSFiller::ChangePaveFiller() -{ - return *myPaveFiller; -} -//======================================================================= -// function: Perform -// purpose: -//======================================================================= - void NMTTools_DSFiller::Perform() -{ - myIsDone=Standard_False; - // - if (myCompositeShape.IsNull()) { - return; - } - // - // - // Clear contents of the DS if it was before - Clear(); - // - myIsNewFiller=Standard_True; - // - myDS = new NMTDS_ShapesDataStructure; - myDS->SetCompositeShape(myCompositeShape); - myDS->Init(); - // - myInterfPool= new BOPTools_InterferencePool (*myDS); - // - myPaveFiller = new NMTTools_PaveFiller(*myInterfPool); - myPaveFiller->Perform(); - myIsDone=myPaveFiller->IsDone(); -} diff --git a/src/NMTTools/NMTTools_DSFiller.hxx b/src/NMTTools/NMTTools_DSFiller.hxx deleted file mode 100644 index 2f0064412..000000000 --- a/src/NMTTools/NMTTools_DSFiller.hxx +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_DSFiller_HeaderFile -#define _NMTTools_DSFiller_HeaderFile - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _NMTDS_PShapesDataStructure_HeaderFile -#include -#endif -#ifndef _BOPTools_PInterferencePool_HeaderFile -#include -#endif -#ifndef _NMTTools_PPaveFiller_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class TopoDS_Shape; -class NMTDS_ShapesDataStructure; -class BOPTools_InterferencePool; -class NMTTools_PaveFiller; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_DSFiller { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_DSFiller(); - -//! Destructor
    -//!
    -//! Selectors/Modifiers
    -Standard_EXPORT void Destroy() ; -~NMTTools_DSFiller() -{ - Destroy(); -} - - - -Standard_EXPORT void SetCompositeShape(const TopoDS_Shape& aS) ; - - -Standard_EXPORT const TopoDS_Shape& CompositeShape() const; - - -Standard_EXPORT void SetNewFiller(const Standard_Boolean aFlag) const; - - -Standard_EXPORT Standard_Boolean IsNewFiller() const; - - -Standard_EXPORT void Perform() ; - - -Standard_EXPORT const NMTDS_ShapesDataStructure& DS() const; - - -Standard_EXPORT const BOPTools_InterferencePool& InterfPool() const; - - -Standard_EXPORT Standard_Boolean IsDone() const; - - -Standard_EXPORT const NMTTools_PaveFiller& PaveFiller() const; - - -Standard_EXPORT NMTTools_PaveFiller& ChangePaveFiller() ; - - - - - -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT void Clear() ; - - - // Fields PROTECTED - // -TopoDS_Shape myCompositeShape; -NMTDS_PShapesDataStructure myDS; -BOPTools_PInterferencePool myInterfPool; -NMTTools_PPaveFiller myPaveFiller; -Standard_Boolean myIsDone; -Standard_Boolean myIsNewFiller; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_DSFiller.ixx b/src/NMTTools/NMTTools_DSFiller.ixx deleted file mode 100644 index 798cc4a14..000000000 --- a/src/NMTTools/NMTTools_DSFiller.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_DSFiller.jxx b/src/NMTTools/NMTTools_DSFiller.jxx deleted file mode 100644 index b9e272ee0..000000000 --- a/src/NMTTools/NMTTools_DSFiller.jxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _NMTDS_ShapesDataStructure_HeaderFile -#include -#endif -#ifndef _BOPTools_InterferencePool_HeaderFile -#include -#endif -#ifndef _NMTTools_PaveFiller_HeaderFile -#include -#endif -#ifndef _NMTTools_DSFiller_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx b/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx new file mode 100644 index 000000000..1117b0d7d --- /dev/null +++ b/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx @@ -0,0 +1,32 @@ +// Copyright (C) 2007-2012 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 +// +// File: NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo.hxx +// Created: Mon Feb 20 12:24:47 2012 +// Author: +// + + +#ifndef NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo_HeaderFile +#define NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo_HeaderFile + +#ifndef NMTTools_DataMapOfIntegerFaceInfo_HeaderFile +#include +#endif + +#endif diff --git a/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx b/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx index cafca05ea..415d7db84 100644 --- a/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx +++ b/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx @@ -1,117 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#define _NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile +// File: NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock.hxx +// Created: Mon Feb 20 12:04:52 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class BOPTools_ListOfPaveBlock; -class TColStd_MapIntegerHasher; -class NMTTools_DataMapOfIntegerListOfPaveBlock; -class NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock; +#ifndef NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile +#define NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile +#include #endif - -class NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock(); - - -Standard_EXPORT NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock(const NMTTools_DataMapOfIntegerListOfPaveBlock& aMap); - - -Standard_EXPORT void Initialize(const NMTTools_DataMapOfIntegerListOfPaveBlock& aMap) ; - - -Standard_EXPORT const Standard_Integer& Key() const; - - -Standard_EXPORT const BOPTools_ListOfPaveBlock& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_0.cxx b/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_0.cxx deleted file mode 100644 index dddb91544..000000000 --- a/src/NMTTools/NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_0.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem BOPTools_ListOfPaveBlock -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_Type_() NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_Type_() -#define TCollection_DataMap NMTTools_DataMapOfIntegerListOfPaveBlock -#define TCollection_DataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx b/src/NMTTools/NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx deleted file mode 100644 index bd3a90005..000000000 --- a/src/NMTTools/NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#define _NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class BOPTools_ListOfPaveBlock; -class TColStd_MapIntegerHasher; -class NMTTools_DataMapOfIntegerListOfPaveBlock; -class NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock; - - - -class NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock(const Standard_Integer& K,const BOPTools_ListOfPaveBlock& I,const TCollection_MapNodePtr& n); - - Standard_Integer& Key() const; - - BOPTools_ListOfPaveBlock& Value() const; -//Standard_EXPORT ~NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myKey; -BOPTools_ListOfPaveBlock myValue; - - -}; - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem BOPTools_ListOfPaveBlock -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_Type_() NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_Type_() -#define TCollection_DataMap NMTTools_DataMapOfIntegerListOfPaveBlock -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_0.cxx b/src/NMTTools/NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_0.cxx deleted file mode 100644 index 3b091cdfc..000000000 --- a/src/NMTTools/NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_0.cxx +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif -//NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock::~NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock", - sizeof(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock) Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock))) { - _anOtherObject = Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)((Handle(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock::DynamicType() const -{ - return STANDARD_TYPE(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock) ; -} -//Standard_Boolean NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock::~Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock() {} -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem BOPTools_ListOfPaveBlock -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_Type_() NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_Type_() -#define TCollection_DataMap NMTTools_DataMapOfIntegerListOfPaveBlock -#define TCollection_DataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_DataMapOfIntegerFaceInfo.hxx b/src/NMTTools/NMTTools_DataMapOfIntegerFaceInfo.hxx new file mode 100644 index 000000000..7d97931fb --- /dev/null +++ b/src/NMTTools/NMTTools_DataMapOfIntegerFaceInfo.hxx @@ -0,0 +1,40 @@ +// Copyright (C) 2007-2012 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 +// +// File: NMTTools_DataMapOfIntegerFaceInfo.hxx +// Created: Mon Feb 20 12:21:55 2012 +// Author: +// + + +#ifndef NMTTools_DataMapOfIntegerFaceInfo_HeaderFile +#define NMTTools_DataMapOfIntegerFaceInfo_HeaderFile + +#include +#include + +#define _NCollection_MapHasher +#include + +typedef NCollection_DataMap NMTTools_DataMapOfIntegerFaceInfo; +typedef NMTTools_DataMapOfIntegerFaceInfo::Iterator NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo; + +#undef _NCollection_MapHasher + + +#endif diff --git a/src/NMTTools/NMTTools_DataMapOfIntegerListOfPaveBlock.hxx b/src/NMTTools/NMTTools_DataMapOfIntegerListOfPaveBlock.hxx index 4ee635d04..805c92eca 100644 --- a/src/NMTTools/NMTTools_DataMapOfIntegerListOfPaveBlock.hxx +++ b/src/NMTTools/NMTTools_DataMapOfIntegerListOfPaveBlock.hxx @@ -1,156 +1,41 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile -#define _NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class BOPTools_ListOfPaveBlock; -class TColStd_MapIntegerHasher; -class NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock; -class NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_DataMapOfIntegerListOfPaveBlock : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_DataMapOfIntegerListOfPaveBlock(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTTools_DataMapOfIntegerListOfPaveBlock& Assign(const NMTTools_DataMapOfIntegerListOfPaveBlock& Other) ; - NMTTools_DataMapOfIntegerListOfPaveBlock& operator =(const NMTTools_DataMapOfIntegerListOfPaveBlock& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTTools_DataMapOfIntegerListOfPaveBlock() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const BOPTools_ListOfPaveBlock& I) ; +// File: NMTTools_DataMapOfIntegerListOfPaveBlock.hxx +// Created: Mon Feb 20 09:27:40 2012 +// Author: +// -Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; +#ifndef NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile +#define NMTTools_DataMapOfIntegerListOfPaveBlock_HeaderFile -Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT const BOPTools_ListOfPaveBlock& Find(const Standard_Integer& K) const; - const BOPTools_ListOfPaveBlock& operator()(const Standard_Integer& K) const -{ - return Find(K); -} +typedef NCollection_DataMap NMTTools_DataMapOfIntegerListOfPaveBlock; +typedef NMTTools_DataMapOfIntegerListOfPaveBlock::Iterator NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock; - - -Standard_EXPORT BOPTools_ListOfPaveBlock& ChangeFind(const Standard_Integer& K) ; - BOPTools_ListOfPaveBlock& operator()(const Standard_Integer& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_DataMapOfIntegerListOfPaveBlock(const NMTTools_DataMapOfIntegerListOfPaveBlock& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +#undef _NCollection_MapHasher #endif diff --git a/src/NMTTools/NMTTools_DataMapOfIntegerListOfPaveBlock_0.cxx b/src/NMTTools/NMTTools_DataMapOfIntegerListOfPaveBlock_0.cxx deleted file mode 100644 index ba1f46649..000000000 --- a/src/NMTTools/NMTTools_DataMapOfIntegerListOfPaveBlock_0.cxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem BOPTools_ListOfPaveBlock -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock -#define TCollection_DataMapNode_Type_() NMTTools_DataMapNodeOfDataMapOfIntegerListOfPaveBlock_Type_() -#define TCollection_DataMap NMTTools_DataMapOfIntegerListOfPaveBlock -#define TCollection_DataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_FaceInfo.cxx b/src/NMTTools/NMTTools_FaceInfo.cxx new file mode 100644 index 000000000..26bbcdcd9 --- /dev/null +++ b/src/NMTTools/NMTTools_FaceInfo.cxx @@ -0,0 +1,28 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTTools_FaceInfo.cxx +// Created: Tue Dec 9 12:23:29 2003 +// Author: Peter KURNEV +// +// +#include diff --git a/src/NMTTools/NMTTools_FaceInfo.hxx b/src/NMTTools/NMTTools_FaceInfo.hxx new file mode 100644 index 000000000..6a37fb79c --- /dev/null +++ b/src/NMTTools/NMTTools_FaceInfo.hxx @@ -0,0 +1,124 @@ +// Copyright (C) 2007-2012 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 +// + +// File: NMTTools_FaceInfo.hxx +// Created: Tue Dec 9 12:23:29 2003 +// Author: Peter KURNEV +// +// +#ifndef _NMTTools_FaceInfo_HeaderFile +#define _NMTTools_FaceInfo_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//class : NMTTools_FaceInfo +//purpose : +//======================================================================= +class NMTTools_FaceInfo { + public: + + //! Empty contructor
    + //!
    + NMTTools_FaceInfo(); + + virtual ~NMTTools_FaceInfo(); + + //! Clears the contents
    + Standard_EXPORT void Clear() ; + + //! Modifier
    + //! Sets the index of the face
    + void SetIndex(const Standard_Integer theI) ; + + //! Selector
    + //! Returns the index of the face
    + //!
    + //! In
    + //!
    + Standard_Integer Index() const; + + //! Selector
    + //! Returns the pave blocks of the face
    + //! that have state In
    + const NMTTools_MapOfPaveBlock& PaveBlocksIn() const; + +//! Selector/Modifier
    + //! Returns the pave blocks
    + //! of the face
    + //! that have state In
    + NMTTools_MapOfPaveBlock& ChangePaveBlocksIn() ; + + //! Selector
    + //! Returns the list of indices for vertices
    + //! of the face
    + //! that have state In
    + const TColStd_MapOfInteger& VerticesIn() const; + + //! Selector/Modifier
    + //! Returns the list of indices for vertices
    + //! of the face
    + //! that have state In
    + //!
    + //! On
    + //!
    + TColStd_MapOfInteger& ChangeVerticesIn() ; + + //! Selector
    + //! Returns the pave blocks of the face
    + //! that have state On
    + const NMTTools_MapOfPaveBlock& PaveBlocksOn() const; + + //! Selector/Modifier
    + //! Returns the pave blocks
    + //! of the face
    + //! that have state On
    + NMTTools_MapOfPaveBlock& ChangePaveBlocksOn() ; + + //! Selector
    + //! Returns the list of indices for vertices
    + //! of the face
    + //! that have state On
    + const TColStd_MapOfInteger& VerticesOn() const; + + //! Selector/Modifier
    + //! Returns the list of indices for vertices
    + //! of the face
    + //! that have state On
    + TColStd_MapOfInteger& ChangeVerticesOn() ; + + protected: + Standard_Integer myIndex; + NMTTools_MapOfPaveBlock myPaveBlocksIn; + TColStd_MapOfInteger myVerticesIn; + NMTTools_MapOfPaveBlock myPaveBlocksOn; + TColStd_MapOfInteger myVerticesOn; +}; + +#include +#endif diff --git a/src/NMTTools/NMTTools_FaceInfo.lxx b/src/NMTTools/NMTTools_FaceInfo.lxx new file mode 100644 index 000000000..7a14228cc --- /dev/null +++ b/src/NMTTools/NMTTools_FaceInfo.lxx @@ -0,0 +1,136 @@ +// Copyright (C) 2007-2012 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 +// +// File: NMTTools_FaceInfo.lxx +// Created: Tue Dec 9 12:23:29 2003 +// Author: Peter KURNEV +// +// + +//======================================================================= +//function : +//purpose : +//======================================================================= +inline NMTTools_FaceInfo::NMTTools_FaceInfo() +: + myIndex(-1) +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +inline NMTTools_FaceInfo::~NMTTools_FaceInfo() +{ + Clear(); +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +inline void NMTTools_FaceInfo::Clear() +{ + myIndex=-1; + myPaveBlocksIn.Clear(); + myVerticesIn.Clear(); + myPaveBlocksOn.Clear(); + myVerticesOn.Clear(); +} +//======================================================================= +//function : SetIndex +//purpose : +//======================================================================= + inline void NMTTools_FaceInfo::SetIndex(const Standard_Integer theI) +{ + myIndex=theI; +} +//======================================================================= +//function : Index +//purpose : +//======================================================================= + inline Standard_Integer NMTTools_FaceInfo::Index()const +{ + return myIndex; +} +//======================================================================= +//function : PaveBlockIn +//purpose : +//======================================================================= + inline const NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::PaveBlocksIn()const +{ + return myPaveBlocksIn; +} +//======================================================================= +//function : ChangePaveBlocksIn +//purpose : +//======================================================================= + inline NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::ChangePaveBlocksIn() +{ + return myPaveBlocksIn; +} +//======================================================================= +//function : VerticesIn +//purpose : +//======================================================================= + inline const TColStd_MapOfInteger& NMTTools_FaceInfo::VerticesIn()const +{ + return myVerticesIn; +} +//======================================================================= +//function : ChangeVerticesIn +//purpose : +//======================================================================= + inline TColStd_MapOfInteger& NMTTools_FaceInfo::ChangeVerticesIn() +{ + return myVerticesIn; +} +//======================================================================= +//function : PaveBlockOn +//purpose : +//======================================================================= + inline const NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::PaveBlocksOn()const +{ + return myPaveBlocksOn; +} +//======================================================================= +//function : ChangePaveBlocksOn +//purpose : +//======================================================================= + inline NMTTools_MapOfPaveBlock& NMTTools_FaceInfo::ChangePaveBlocksOn() +{ + return myPaveBlocksOn; +} +//======================================================================= +//function : VerticesOn +//purpose : +//======================================================================= + inline const TColStd_MapOfInteger& NMTTools_FaceInfo::VerticesOn()const +{ + return myVerticesOn; +} +//======================================================================= +//function : ChangeVerticesOn +//purpose : +//======================================================================= + inline TColStd_MapOfInteger& NMTTools_FaceInfo::ChangeVerticesOn() +{ + return myVerticesOn; +} diff --git a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx b/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx deleted file mode 100644 index 3774d3411..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_HeaderFile -#define _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_HeaderFile -#include -#endif - -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TColStd_IndexedMapOfInteger_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TColStd_IndexedMapOfInteger; -class TColStd_MapIntegerHasher; -class NMTTools_IndexedDataMapOfIndexedMapOfInteger; - - - -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger(const Standard_Integer& K1,const Standard_Integer K2,const TColStd_IndexedMapOfInteger& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - Standard_Integer& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - TColStd_IndexedMapOfInteger& Value() const; -//Standard_EXPORT ~NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Integer myKey1; -Standard_Integer myKey2; -TColStd_IndexedMapOfInteger myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TColStd_IndexedMapOfInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx b/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx deleted file mode 100644 index 7989209e2..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TColStd_IndexedMapOfInteger_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile -#include -#endif -//NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger::~NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger", - sizeof(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger) Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger))) { - _anOtherObject = Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)((Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger::DynamicType() const -{ - return STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger) ; -} -//Standard_Boolean NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger::~Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger() {} -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TColStd_IndexedMapOfInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx b/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx deleted file mode 100644 index 9b24aa885..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#define _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class TopTools_IndexedMapOfShape; -class TopTools_ShapeMapHasher; -class NMTTools_IndexedDataMapOfShapeIndexedMapOfShape; - - - -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape(const TopoDS_Shape& K1,const Standard_Integer K2,const TopTools_IndexedMapOfShape& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - TopoDS_Shape& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - TopTools_IndexedMapOfShape& Value() const; -//Standard_EXPORT ~NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey1; -Standard_Integer myKey2; -TopTools_IndexedMapOfShape myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem TopTools_IndexedMapOfShape -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx b/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx deleted file mode 100644 index 628f0b740..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#include -#endif -//NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape::~NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape", - sizeof(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape) Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape))) { - _anOtherObject = Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)((Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape::DynamicType() const -{ - return STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape) ; -} -//Standard_Boolean NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape::~Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem TopTools_IndexedMapOfShape -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx b/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx deleted file mode 100644 index b89241660..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock.hxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_HeaderFile -#define _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -class TopoDS_Shape; -class BOPTools_PaveBlock; -class TopTools_ShapeMapHasher; -class NMTTools_IndexedDataMapOfShapePaveBlock; - - - -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock(const TopoDS_Shape& K1,const Standard_Integer K2,const BOPTools_PaveBlock& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); - - TopoDS_Shape& Key1() const; - - Standard_Integer& Key2() const; - - TCollection_MapNodePtr& Next2() const; - - BOPTools_PaveBlock& Value() const; -//Standard_EXPORT ~NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Shape myKey1; -Standard_Integer myKey2; -BOPTools_PaveBlock myValue; -TCollection_MapNodePtr myNext2; - - -}; - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem BOPTools_PaveBlock -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_hxx -#undef Handle_TCollection_IndexedDataMapNode -#undef TCollection_IndexedDataMapNode_Type_ -#undef TCollection_IndexedDataMap -#undef TCollection_IndexedDataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx b/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx deleted file mode 100644 index 311306e41..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapOfShapePaveBlock_HeaderFile -#include -#endif -//NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock::~NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock", - sizeof(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock) Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock))) { - _anOtherObject = Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)((Handle(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock::DynamicType() const -{ - return STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock) ; -} -//Standard_Boolean NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock::~Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock() {} -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem BOPTools_PaveBlock -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx b/src/NMTTools/NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx index 98cf95b4a..479a13158 100644 --- a/src/NMTTools/NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx +++ b/src/NMTTools/NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx @@ -1,171 +1,42 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile -#define _NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TColStd_IndexedMapOfInteger; -class TColStd_MapIntegerHasher; -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_IndexedDataMapOfIndexedMapOfInteger : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_IndexedDataMapOfIndexedMapOfInteger(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTTools_IndexedDataMapOfIndexedMapOfInteger& Assign(const NMTTools_IndexedDataMapOfIndexedMapOfInteger& Other) ; - NMTTools_IndexedDataMapOfIndexedMapOfInteger& operator =(const NMTTools_IndexedDataMapOfIndexedMapOfInteger& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTTools_IndexedDataMapOfIndexedMapOfInteger() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const Standard_Integer& K,const TColStd_IndexedMapOfInteger& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const Standard_Integer& K,const TColStd_IndexedMapOfInteger& T) ; - - -Standard_EXPORT void RemoveLast() ; - +// File: NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx +// Created: Mon Feb 20 09:20:07 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const Standard_Integer& K) const; +#ifndef NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile +#define NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile -Standard_EXPORT const Standard_Integer& FindKey(const Standard_Integer I) const; - - -Standard_EXPORT const TColStd_IndexedMapOfInteger& FindFromIndex(const Standard_Integer I) const; - const TColStd_IndexedMapOfInteger& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} - - - -Standard_EXPORT TColStd_IndexedMapOfInteger& ChangeFromIndex(const Standard_Integer I) ; - TColStd_IndexedMapOfInteger& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const Standard_Integer& K) const; - - -Standard_EXPORT const TColStd_IndexedMapOfInteger& FindFromKey(const Standard_Integer& K) const; - - -Standard_EXPORT TColStd_IndexedMapOfInteger& ChangeFromKey(const Standard_Integer& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_IndexedDataMapOfIndexedMapOfInteger(const NMTTools_IndexedDataMapOfIndexedMapOfInteger& Other); - - - // Fields PRIVATE - // - - -}; +#include +#include +#include +#define _NCollection_MapHasher +#include +typedef NCollection_IndexedDataMap NMTTools_IndexedDataMapOfIndexedMapOfInteger; +#undef _NCollection_MapHasher -// other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/NMTTools/NMTTools_IndexedDataMapOfIndexedMapOfInteger_0.cxx b/src/NMTTools/NMTTools_IndexedDataMapOfIndexedMapOfInteger_0.cxx deleted file mode 100644 index 4b7aaac90..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapOfIndexedMapOfInteger_0.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TColStd_IndexedMapOfInteger_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_HeaderFile -#include -#endif - - -#define TheKey Standard_Integer -#define TheKey_hxx -#define TheItem TColStd_IndexedMapOfInteger -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfIndexedMapOfInteger -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx b/src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx index 02fbc923c..6dbe387cb 100644 --- a/src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx +++ b/src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx @@ -1,172 +1,47 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#define _NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class TopTools_IndexedMapOfShape; -class TopTools_ShapeMapHasher; -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_IndexedDataMapOfShapeIndexedMapOfShape : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_IndexedDataMapOfShapeIndexedMapOfShape(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& Assign(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& Other) ; - NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& operator =(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTTools_IndexedDataMapOfShapeIndexedMapOfShape() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const TopTools_IndexedMapOfShape& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const TopTools_IndexedMapOfShape& T) ; - - -Standard_EXPORT void RemoveLast() ; - +// File: NMTTools_IndexedDataMapOfIndexedMapOfInteger.hxx +// Created: Mon Feb 20 09:20:07 2012 +// Author: +// +// File: NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx +// Created: Mon Feb 20 11:59:23 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; +#ifndef NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile +#define NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; +#include +#include +#include -Standard_EXPORT const TopTools_IndexedMapOfShape& FindFromIndex(const Standard_Integer I) const; - const TopTools_IndexedMapOfShape& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} +#define _NCollection_MapHasher +#include +typedef NCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapeIndexedMapOfShape; -Standard_EXPORT TopTools_IndexedMapOfShape& ChangeFromIndex(const Standard_Integer I) ; - TopTools_IndexedMapOfShape& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; - - -Standard_EXPORT const TopTools_IndexedMapOfShape& FindFromKey(const TopoDS_Shape& K) const; - - -Standard_EXPORT TopTools_IndexedMapOfShape& ChangeFromKey(const TopoDS_Shape& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_IndexedDataMapOfShapeIndexedMapOfShape(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +#undef _NCollection_MapHasher #endif + diff --git a/src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_0.cxx b/src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_0.cxx deleted file mode 100644 index f349c91a7..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_0.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem TopTools_IndexedMapOfShape -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapeIndexedMapOfShape -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_IndexedDataMapOfShapePaveBlock.hxx b/src/NMTTools/NMTTools_IndexedDataMapOfShapePaveBlock.hxx index 78ad92772..db2546036 100644 --- a/src/NMTTools/NMTTools_IndexedDataMapOfShapePaveBlock.hxx +++ b/src/NMTTools/NMTTools_IndexedDataMapOfShapePaveBlock.hxx @@ -1,172 +1,40 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_IndexedDataMapOfShapePaveBlock_HeaderFile -#define _NMTTools_IndexedDataMapOfShapePaveBlock_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_OutOfRange; -class Standard_NoSuchObject; -class TopoDS_Shape; -class BOPTools_PaveBlock; -class TopTools_ShapeMapHasher; -class NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_IndexedDataMapOfShapePaveBlock : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_IndexedDataMapOfShapePaveBlock(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTTools_IndexedDataMapOfShapePaveBlock& Assign(const NMTTools_IndexedDataMapOfShapePaveBlock& Other) ; - NMTTools_IndexedDataMapOfShapePaveBlock& operator =(const NMTTools_IndexedDataMapOfShapePaveBlock& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTTools_IndexedDataMapOfShapePaveBlock() -{ - Clear(); -} - - - -Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const BOPTools_PaveBlock& I) ; - - -Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const BOPTools_PaveBlock& T) ; - - -Standard_EXPORT void RemoveLast() ; - - -Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; +// File: NMTTools_IndexedDataMapOfShapePaveBlock.hxx +// Created: Mon Feb 20 11:55:34 2012 +// Author: +// -Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; +#ifndef NMTTools_IndexedDataMapOfShapePaveBlock_HeaderFile +#define NMTTools_IndexedDataMapOfShapePaveBlock_HeaderFile +#include +#include +#include -Standard_EXPORT const BOPTools_PaveBlock& FindFromIndex(const Standard_Integer I) const; - const BOPTools_PaveBlock& operator ()(const Standard_Integer I) const -{ - return FindFromIndex(I); -} +#define _NCollection_MapHasher +#include +typedef NCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapePaveBlock; - -Standard_EXPORT BOPTools_PaveBlock& ChangeFromIndex(const Standard_Integer I) ; - BOPTools_PaveBlock& operator ()(const Standard_Integer I) -{ - return ChangeFromIndex(I); -} - - - -Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; - - -Standard_EXPORT const BOPTools_PaveBlock& FindFromKey(const TopoDS_Shape& K) const; - - -Standard_EXPORT BOPTools_PaveBlock& ChangeFromKey(const TopoDS_Shape& K) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_IndexedDataMapOfShapePaveBlock(const NMTTools_IndexedDataMapOfShapePaveBlock& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +#undef _NCollection_MapHasher #endif diff --git a/src/NMTTools/NMTTools_IndexedDataMapOfShapePaveBlock_0.cxx b/src/NMTTools/NMTTools_IndexedDataMapOfShapePaveBlock_0.cxx deleted file mode 100644 index 7266c017e..000000000 --- a/src/NMTTools/NMTTools_IndexedDataMapOfShapePaveBlock_0.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_OutOfRange_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _TopTools_ShapeMapHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_HeaderFile -#include -#endif - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheItem BOPTools_PaveBlock -#define TheItem_hxx -#define Hasher TopTools_ShapeMapHasher -#define Hasher_hxx -#define TCollection_IndexedDataMapNode NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMapNode_hxx -#define Handle_TCollection_IndexedDataMapNode Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMapNode_Type_() NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_Type_() -#define TCollection_IndexedDataMap NMTTools_IndexedDataMapOfShapePaveBlock -#define TCollection_IndexedDataMap_hxx -#include - diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cdl b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cdl deleted file mode 100644 index 9be78d98b..000000000 --- a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cdl +++ /dev/null @@ -1,74 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_IteratorOfCoupleOfShape.cdl --- Created: Thu Dec 4 16:57:48 2003 --- Author: Peter KURNEV --- --- -class IteratorOfCoupleOfShape from NMTTools - inherits IteratorOfCoupleOfShape from BOPTools - - ---Purpose: - -uses - ShapeEnum from TopAbs, - IndexedMapOfCoupleOfInteger from BOPTools, - PShapesDataStructure from NMTDS, - ShapesDataStructure from NMTDS - -raises - NoSuchObject from Standard - -is - Create - returns IteratorOfCoupleOfShape from NMTTools; - - SetDS(me:out; - pDS:PShapesDataStructure from NMTDS); - - Initialize(me: in out; - Type1: ShapeEnum from TopAbs; - Type2: ShapeEnum from TopAbs) - raises NoSuchObject from Standard - is redefined; - - Current(me; Index1: in out Integer from Standard; - Index2: in out Integer from Standard; - WithSubShape: out Boolean from Standard) - is redefined; - - More(me) - returns Boolean from Standard - is redefined; - - DS(me) - returns ShapesDataStructure from NMTDS; - ---C++:return const & - -fields - myPNMTPS : PShapesDataStructure from NMTDS is protected; - myMap : IndexedMapOfCoupleOfInteger from BOPTools is protected; - myIndex1 : Integer from Standard is protected; - myIndex2 : Integer from Standard is protected; - myWithSubShapeFlag: Boolean from Standard is protected; - -end IteratorOfCoupleOfShape; diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cxx b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cxx deleted file mode 100644 index 8cf489a9b..000000000 --- a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cxx +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTTools_IteratorOfCoupleOfShape.cxx -// Created: Thu Dec 4 17:00:03 2003 -// Author: Peter KURNEV -// -// -#include -#include -#include -#include -#include -#include - -//======================================================================= -// function: -// purpose: -//======================================================================= - NMTTools_IteratorOfCoupleOfShape::NMTTools_IteratorOfCoupleOfShape() -: - BOPTools_IteratorOfCoupleOfShape() -{ - myIndex1=0; - myIndex2=0; - myWithSubShapeFlag=Standard_False; -} -//======================================================================= -// function: SetDS -// purpose: -//======================================================================= - void NMTTools_IteratorOfCoupleOfShape::SetDS(const NMTDS_PShapesDataStructure& PDS) -{ - myPNMTPS=PDS; - SetDataStructure(myPNMTPS); -} -//======================================================================= -// function: Initialize -// purpose: -//======================================================================= - void NMTTools_IteratorOfCoupleOfShape::Initialize(const TopAbs_ShapeEnum Type1, - const TopAbs_ShapeEnum Type2) -{ - if(myPDS==NULL) { - Standard_NoSuchObject::Raise("NMTTools_IteratorOfCoupleOfShape::Initialize: myPDS==NULL"); - } - // - myType1 = Type1; - myType2 = Type2; - myCurrentIndex1 = -1; - myCurrentIndex2 = -1; - // - myFirstLowerIndex=1; - myFirstUpperIndex=myPNMTPS->NumberOfShapesOfTheObject(); - mySecondLowerIndex=myFirstUpperIndex+1; - mySecondUpperIndex=myFirstUpperIndex+myPNMTPS->NumberOfShapesOfTheTool(); - // - Standard_Integer n1, n2, aIR1, aIR2;//, aN1, aN2, aNS; - // - const NMTDS_CArray1OfIndexRange& aRanges=myPNMTPS->Ranges(); - // - //aNS=myPNMTPS->NumberOfShapesOfTheObject(); - myIndex1=0; - myIndex2=0; - myWithSubShapeFlag=Standard_False; - // - myListOfCouple.Clear(); - myMap.Clear(); - // - NextP(); - for (; MoreP(); NextP()) { - CurrentP(n1, n2); - // - aIR1=myPNMTPS->ShapeRangeIndex(n1); - aIR2=myPNMTPS->ShapeRangeIndex(n2); - if (aIR1==aIR2){ - continue; - } - // - BOPTools_CoupleOfInteger aCouple(n1, n2); - myListOfCouple.Append(aCouple); - // - /* - aN1=(n1>aNS)? n1-aNS : n1; - aN2=(n2>aNS)? n2-aNS : n2; - BOPTools_CoupleOfInteger aCoupleX(aN1, aN2); - myMap.Add(aCoupleX); - */ - } - myIterator.Initialize(myListOfCouple); -} -//======================================================================= -// function: Current -// purpose: -//======================================================================= - void NMTTools_IteratorOfCoupleOfShape::Current(Standard_Integer& aIndex1, - Standard_Integer& aIndex2, - Standard_Boolean& aWithSubShape) const -{ - aIndex1=myIndex1; - aIndex2=myIndex2; - aWithSubShape=myWithSubShapeFlag; -} -//======================================================================= -// function: More -// purpose: -//======================================================================= - Standard_Boolean NMTTools_IteratorOfCoupleOfShape::More()const -{ - Standard_Boolean bMore, bWithSubShape; - Standard_Integer n1, n2, aNS, aN1, aN2; - BOPTools_CoupleOfInteger aCoupleX; - NMTTools_IteratorOfCoupleOfShape* pIt=(NMTTools_IteratorOfCoupleOfShape*)this; - // - aNS=myPNMTPS->NumberOfShapesOfTheObject(); - pIt->myIndex1=0; - pIt->myIndex2=0; - pIt->myWithSubShapeFlag=Standard_False; - // - while (1) { - bMore=myIterator.More(); - if (!bMore) { - break; - } - // - BOPTools_IteratorOfCoupleOfShape::Current(n1, n2, bWithSubShape); - aN1=(n1>aNS)? n1-aNS : n1; - aN2=(n2>aNS)? n2-aNS : n2; - aCoupleX.SetCouple(aN1, aN2); - if (!myMap.Contains(aCoupleX)) { - pIt->myMap.Add(aCoupleX); - // - pIt->myIndex1=aN1; - pIt->myIndex2=aN2; - pIt->myWithSubShapeFlag=bWithSubShape; - break; - } - // - pIt->Next(); - } - return bMore; -} diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.hxx b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.hxx deleted file mode 100644 index 67128fb0c..000000000 --- a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.hxx +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_IteratorOfCoupleOfShape_HeaderFile -#define _NMTTools_IteratorOfCoupleOfShape_HeaderFile - -#ifndef _NMTDS_PShapesDataStructure_HeaderFile -#include -#endif -#ifndef _BOPTools_IndexedMapOfCoupleOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _BOPTools_IteratorOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTDS_ShapesDataStructure; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_IteratorOfCoupleOfShape : public BOPTools_IteratorOfCoupleOfShape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_IteratorOfCoupleOfShape(); - - -Standard_EXPORT void SetDS(const NMTDS_PShapesDataStructure& pDS) ; - - -Standard_EXPORT virtual void Initialize(const TopAbs_ShapeEnum Type1,const TopAbs_ShapeEnum Type2) ; - - -Standard_EXPORT virtual void Current(Standard_Integer& Index1,Standard_Integer& Index2,Standard_Boolean& WithSubShape) const; - - -Standard_EXPORT virtual Standard_Boolean More() const; - - -Standard_EXPORT const NMTDS_ShapesDataStructure& DS() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -NMTDS_PShapesDataStructure myPNMTPS; -BOPTools_IndexedMapOfCoupleOfInteger myMap; -Standard_Integer myIndex1; -Standard_Integer myIndex2; -Standard_Boolean myWithSubShapeFlag; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.ixx b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.ixx deleted file mode 100644 index 35f563b13..000000000 --- a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.jxx b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.jxx deleted file mode 100644 index b2c3333a3..000000000 --- a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.jxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTDS_ShapesDataStructure_HeaderFile -#include -#endif -#ifndef _NMTTools_IteratorOfCoupleOfShape_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_ListIteratorOfListOfCommonBlock.hxx b/src/NMTTools/NMTTools_ListIteratorOfListOfCommonBlock.hxx index e4d4eb1fd..160530caf 100644 --- a/src/NMTTools/NMTTools_ListIteratorOfListOfCommonBlock.hxx +++ b/src/NMTTools/NMTTools_ListIteratorOfListOfCommonBlock.hxx @@ -1,143 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_ListIteratorOfListOfCommonBlock_HeaderFile -#define _NMTTools_ListIteratorOfListOfCommonBlock_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_ListNodeOfListOfCommonBlock_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoMoreObject; -class Standard_NoSuchObject; -class NMTTools_ListOfCommonBlock; -class NMTTools_CommonBlock; -class NMTTools_ListNodeOfListOfCommonBlock; +// File: NMTDS_ListIteratorOfListOfCommonBlock.hxx +// Created: Mon Feb 20 11:25:23 2012 +// Author: +// +#ifndef NMTDS_ListIteratorOfListOfCommonBlock_HeaderFile +#define NMTDS_ListIteratorOfListOfCommonBlock_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef NMTTools_ListOfCommonBlock_HeaderFile +#include #endif - -class NMTTools_ListIteratorOfListOfCommonBlock { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_ListIteratorOfListOfCommonBlock(); - - -Standard_EXPORT NMTTools_ListIteratorOfListOfCommonBlock(const NMTTools_ListOfCommonBlock& L); - - -Standard_EXPORT void Initialize(const NMTTools_ListOfCommonBlock& L) ; - - Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; - - -Standard_EXPORT NMTTools_CommonBlock& Value() const; - - -friend class NMTTools_ListOfCommonBlock; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Address current; -Standard_Address previous; - - -}; - -#define Item NMTTools_CommonBlock -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCommonBlock -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCommonBlock_Type_() -#define TCollection_List NMTTools_ListOfCommonBlock -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_ListIteratorOfListOfCommonBlock_0.cxx b/src/NMTTools/NMTTools_ListIteratorOfListOfCommonBlock_0.cxx deleted file mode 100644 index 8c92815c1..000000000 --- a/src/NMTTools/NMTTools_ListIteratorOfListOfCommonBlock_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoMoreObject_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_CommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_ListNodeOfListOfCommonBlock_HeaderFile -#include -#endif - - -#define Item NMTTools_CommonBlock -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCommonBlock -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCommonBlock_Type_() -#define TCollection_List NMTTools_ListOfCommonBlock -#define TCollection_List_hxx -#include - diff --git a/src/NMTTools/NMTTools_ListIteratorOfListOfCoupleOfShape.hxx b/src/NMTTools/NMTTools_ListIteratorOfListOfCoupleOfShape.hxx index dad1e219b..0a1b3ca3d 100644 --- a/src/NMTTools/NMTTools_ListIteratorOfListOfCoupleOfShape.hxx +++ b/src/NMTTools/NMTTools_ListIteratorOfListOfCoupleOfShape.hxx @@ -1,143 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_ListIteratorOfListOfCoupleOfShape_HeaderFile -#define _NMTTools_ListIteratorOfListOfCoupleOfShape_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoMoreObject; -class Standard_NoSuchObject; -class NMTTools_ListOfCoupleOfShape; -class NMTTools_CoupleOfShape; -class NMTTools_ListNodeOfListOfCoupleOfShape; +// File: NMTDS_ListIteratorOfListOfCoupleOfShape.hxx +// Created: Mon Feb 20 11:25:23 2012 +// Author: +// +#ifndef NMTDS_ListIteratorOfListOfCoupleOfShape_HeaderFile +#define NMTDS_ListIteratorOfListOfCoupleOfShape_HeaderFile -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include +#ifndef NMTTools_ListOfCoupleOfShape_HeaderFile +#include #endif - -class NMTTools_ListIteratorOfListOfCoupleOfShape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_ListIteratorOfListOfCoupleOfShape(); - - -Standard_EXPORT NMTTools_ListIteratorOfListOfCoupleOfShape(const NMTTools_ListOfCoupleOfShape& L); - - -Standard_EXPORT void Initialize(const NMTTools_ListOfCoupleOfShape& L) ; - - Standard_Boolean More() const; - - -Standard_EXPORT void Next() ; - - -Standard_EXPORT NMTTools_CoupleOfShape& Value() const; - - -friend class NMTTools_ListOfCoupleOfShape; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Address current; -Standard_Address previous; - - -}; - -#define Item NMTTools_CoupleOfShape -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCoupleOfShape -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCoupleOfShape_Type_() -#define TCollection_List NMTTools_ListOfCoupleOfShape -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_ListIteratorOfListOfCoupleOfShape_0.cxx b/src/NMTTools/NMTTools_ListIteratorOfListOfCoupleOfShape_0.cxx deleted file mode 100644 index 246c8f0e1..000000000 --- a/src/NMTTools/NMTTools_ListIteratorOfListOfCoupleOfShape_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoMoreObject_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_CoupleOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile -#include -#endif - - -#define Item NMTTools_CoupleOfShape -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCoupleOfShape -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCoupleOfShape_Type_() -#define TCollection_List NMTTools_ListOfCoupleOfShape -#define TCollection_List_hxx -#include - diff --git a/src/NMTTools/NMTTools_ListNodeOfListOfCommonBlock.hxx b/src/NMTTools/NMTTools_ListNodeOfListOfCommonBlock.hxx deleted file mode 100644 index ce0b0608e..000000000 --- a/src/NMTTools/NMTTools_ListNodeOfListOfCommonBlock.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_ListNodeOfListOfCommonBlock_HeaderFile -#define _NMTTools_ListNodeOfListOfCommonBlock_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_ListNodeOfListOfCommonBlock_HeaderFile -#include -#endif - -#ifndef _NMTTools_CommonBlock_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class NMTTools_CommonBlock; -class NMTTools_ListOfCommonBlock; -class NMTTools_ListIteratorOfListOfCommonBlock; - - - -class NMTTools_ListNodeOfListOfCommonBlock : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTTools_ListNodeOfListOfCommonBlock(const NMTTools_CommonBlock& I,const TCollection_MapNodePtr& n); - - NMTTools_CommonBlock& Value() const; -//Standard_EXPORT ~NMTTools_ListNodeOfListOfCommonBlock(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -NMTTools_CommonBlock myValue; - - -}; - -#define Item NMTTools_CommonBlock -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCommonBlock -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCommonBlock_Type_() -#define TCollection_List NMTTools_ListOfCommonBlock -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_ListNodeOfListOfCommonBlock_0.cxx b/src/NMTTools/NMTTools_ListNodeOfListOfCommonBlock_0.cxx deleted file mode 100644 index 793bcf9ed..000000000 --- a/src/NMTTools/NMTTools_ListNodeOfListOfCommonBlock_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _NMTTools_CommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_ListIteratorOfListOfCommonBlock_HeaderFile -#include -#endif -//NMTTools_ListNodeOfListOfCommonBlock::~NMTTools_ListNodeOfListOfCommonBlock() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTTools_ListNodeOfListOfCommonBlock_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTTools_ListNodeOfListOfCommonBlock", - sizeof(NMTTools_ListNodeOfListOfCommonBlock), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTTools_ListNodeOfListOfCommonBlock) Handle(NMTTools_ListNodeOfListOfCommonBlock)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTTools_ListNodeOfListOfCommonBlock) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTTools_ListNodeOfListOfCommonBlock))) { - _anOtherObject = Handle(NMTTools_ListNodeOfListOfCommonBlock)((Handle(NMTTools_ListNodeOfListOfCommonBlock)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTTools_ListNodeOfListOfCommonBlock::DynamicType() const -{ - return STANDARD_TYPE(NMTTools_ListNodeOfListOfCommonBlock) ; -} -//Standard_Boolean NMTTools_ListNodeOfListOfCommonBlock::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTTools_ListNodeOfListOfCommonBlock) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTTools_ListNodeOfListOfCommonBlock::~Handle_NMTTools_ListNodeOfListOfCommonBlock() {} -#define Item NMTTools_CommonBlock -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCommonBlock -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCommonBlock_Type_() -#define TCollection_List NMTTools_ListOfCommonBlock -#define TCollection_List_hxx -#include - diff --git a/src/NMTTools/NMTTools_ListNodeOfListOfCoupleOfShape.hxx b/src/NMTTools/NMTTools_ListNodeOfListOfCoupleOfShape.hxx deleted file mode 100644 index 6b54795d2..000000000 --- a/src/NMTTools/NMTTools_ListNodeOfListOfCoupleOfShape.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile -#define _NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile -#include -#endif - -#ifndef _NMTTools_CoupleOfShape_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class NMTTools_CoupleOfShape; -class NMTTools_ListOfCoupleOfShape; -class NMTTools_ListIteratorOfListOfCoupleOfShape; - - - -class NMTTools_ListNodeOfListOfCoupleOfShape : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTTools_ListNodeOfListOfCoupleOfShape(const NMTTools_CoupleOfShape& I,const TCollection_MapNodePtr& n); - - NMTTools_CoupleOfShape& Value() const; -//Standard_EXPORT ~NMTTools_ListNodeOfListOfCoupleOfShape(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -NMTTools_CoupleOfShape myValue; - - -}; - -#define Item NMTTools_CoupleOfShape -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCoupleOfShape -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCoupleOfShape_Type_() -#define TCollection_List NMTTools_ListOfCoupleOfShape -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_ListNodeOfListOfCoupleOfShape_0.cxx b/src/NMTTools/NMTTools_ListNodeOfListOfCoupleOfShape_0.cxx deleted file mode 100644 index 912f0a39c..000000000 --- a/src/NMTTools/NMTTools_ListNodeOfListOfCoupleOfShape_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _NMTTools_CoupleOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_ListIteratorOfListOfCoupleOfShape_HeaderFile -#include -#endif -//NMTTools_ListNodeOfListOfCoupleOfShape::~NMTTools_ListNodeOfListOfCoupleOfShape() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTTools_ListNodeOfListOfCoupleOfShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTTools_ListNodeOfListOfCoupleOfShape", - sizeof(NMTTools_ListNodeOfListOfCoupleOfShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTTools_ListNodeOfListOfCoupleOfShape) Handle(NMTTools_ListNodeOfListOfCoupleOfShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTTools_ListNodeOfListOfCoupleOfShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTTools_ListNodeOfListOfCoupleOfShape))) { - _anOtherObject = Handle(NMTTools_ListNodeOfListOfCoupleOfShape)((Handle(NMTTools_ListNodeOfListOfCoupleOfShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTTools_ListNodeOfListOfCoupleOfShape::DynamicType() const -{ - return STANDARD_TYPE(NMTTools_ListNodeOfListOfCoupleOfShape) ; -} -//Standard_Boolean NMTTools_ListNodeOfListOfCoupleOfShape::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTTools_ListNodeOfListOfCoupleOfShape) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTTools_ListNodeOfListOfCoupleOfShape::~Handle_NMTTools_ListNodeOfListOfCoupleOfShape() {} -#define Item NMTTools_CoupleOfShape -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCoupleOfShape -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCoupleOfShape_Type_() -#define TCollection_List NMTTools_ListOfCoupleOfShape -#define TCollection_List_hxx -#include - diff --git a/src/NMTTools/NMTTools_ListOfCommonBlock.hxx b/src/NMTTools/NMTTools_ListOfCommonBlock.hxx index 7e664fd9a..ebca6d403 100644 --- a/src/NMTTools/NMTTools_ListOfCommonBlock.hxx +++ b/src/NMTTools/NMTTools_ListOfCommonBlock.hxx @@ -1,197 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_ListOfCommonBlock_HeaderFile -#define _NMTTools_ListOfCommonBlock_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_ListNodeOfListOfCommonBlock_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTTools_ListIteratorOfListOfCommonBlock; -class NMTTools_CommonBlock; -class NMTTools_ListNodeOfListOfCommonBlock; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_ListOfCommonBlock { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_ListOfCommonBlock(); - - -Standard_EXPORT void Assign(const NMTTools_ListOfCommonBlock& Other) ; - void operator=(const NMTTools_ListOfCommonBlock& Other) -{ - Assign(Other); -} - - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT void Clear() ; -~NMTTools_ListOfCommonBlock() -{ - Clear(); -} - - - Standard_Boolean IsEmpty() const; - - -Standard_EXPORT void Prepend(const NMTTools_CommonBlock& I) ; - - -Standard_EXPORT void Prepend(const NMTTools_CommonBlock& I,NMTTools_ListIteratorOfListOfCommonBlock& theIt) ; - - -Standard_EXPORT void Prepend(NMTTools_ListOfCommonBlock& Other) ; - - -Standard_EXPORT void Append(const NMTTools_CommonBlock& I) ; - - -Standard_EXPORT void Append(const NMTTools_CommonBlock& I,NMTTools_ListIteratorOfListOfCommonBlock& theIt) ; - - -Standard_EXPORT void Append(NMTTools_ListOfCommonBlock& Other) ; +// File: NMTTools_ListOfCommonBlock.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// +#ifndef NMTTools_ListOfCommonBlock_HeaderFile +#define NMTTools_ListOfCommonBlock_HeaderFile -Standard_EXPORT NMTTools_CommonBlock& First() const; - - -Standard_EXPORT NMTTools_CommonBlock& Last() const; - - -Standard_EXPORT void RemoveFirst() ; - - -Standard_EXPORT void Remove(NMTTools_ListIteratorOfListOfCommonBlock& It) ; - - -Standard_EXPORT void InsertBefore(const NMTTools_CommonBlock& I,NMTTools_ListIteratorOfListOfCommonBlock& It) ; - - -Standard_EXPORT void InsertBefore(NMTTools_ListOfCommonBlock& Other,NMTTools_ListIteratorOfListOfCommonBlock& It) ; - - -Standard_EXPORT void InsertAfter(const NMTTools_CommonBlock& I,NMTTools_ListIteratorOfListOfCommonBlock& It) ; - - -Standard_EXPORT void InsertAfter(NMTTools_ListOfCommonBlock& Other,NMTTools_ListIteratorOfListOfCommonBlock& It) ; - - -friend class NMTTools_ListIteratorOfListOfCommonBlock; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_ListOfCommonBlock(const NMTTools_ListOfCommonBlock& Other); - - - // Fields PRIVATE - // -Standard_Address myFirst; -Standard_Address myLast; - - -}; - -#define Item NMTTools_CommonBlock -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCommonBlock -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCommonBlock_Type_() -#define TCollection_List NMTTools_ListOfCommonBlock -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// +#include +#include +typedef NCollection_List NMTTools_ListOfCommonBlock; +typedef NMTTools_ListOfCommonBlock::Iterator NMTTools_ListIteratorOfListOfCommonBlock; #endif diff --git a/src/NMTTools/NMTTools_ListOfCommonBlock_0.cxx b/src/NMTTools/NMTTools_ListOfCommonBlock_0.cxx deleted file mode 100644 index 160550ecb..000000000 --- a/src/NMTTools/NMTTools_ListOfCommonBlock_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTTools_ListIteratorOfListOfCommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_CommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_ListNodeOfListOfCommonBlock_HeaderFile -#include -#endif - - -#define Item NMTTools_CommonBlock -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCommonBlock -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCommonBlock -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCommonBlock_Type_() -#define TCollection_List NMTTools_ListOfCommonBlock -#define TCollection_List_hxx -#include - diff --git a/src/NMTTools/NMTTools_ListOfCoupleOfShape.hxx b/src/NMTTools/NMTTools_ListOfCoupleOfShape.hxx index 27a971107..6660a46f2 100644 --- a/src/NMTTools/NMTTools_ListOfCoupleOfShape.hxx +++ b/src/NMTTools/NMTTools_ListOfCoupleOfShape.hxx @@ -1,197 +1,33 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile -#define _NMTTools_ListOfCoupleOfShape_HeaderFile - -#ifndef _Standard_Address_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class NMTTools_ListIteratorOfListOfCoupleOfShape; -class NMTTools_CoupleOfShape; -class NMTTools_ListNodeOfListOfCoupleOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_ListOfCoupleOfShape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_ListOfCoupleOfShape(); - - -Standard_EXPORT void Assign(const NMTTools_ListOfCoupleOfShape& Other) ; - void operator=(const NMTTools_ListOfCoupleOfShape& Other) -{ - Assign(Other); -} - - - -Standard_EXPORT Standard_Integer Extent() const; - - -Standard_EXPORT void Clear() ; -~NMTTools_ListOfCoupleOfShape() -{ - Clear(); -} - - - Standard_Boolean IsEmpty() const; - - -Standard_EXPORT void Prepend(const NMTTools_CoupleOfShape& I) ; - - -Standard_EXPORT void Prepend(const NMTTools_CoupleOfShape& I,NMTTools_ListIteratorOfListOfCoupleOfShape& theIt) ; - - -Standard_EXPORT void Prepend(NMTTools_ListOfCoupleOfShape& Other) ; - - -Standard_EXPORT void Append(const NMTTools_CoupleOfShape& I) ; - - -Standard_EXPORT void Append(const NMTTools_CoupleOfShape& I,NMTTools_ListIteratorOfListOfCoupleOfShape& theIt) ; - - -Standard_EXPORT void Append(NMTTools_ListOfCoupleOfShape& Other) ; +// File: NMTTools_ListOfCoupleOfShape.hxx +// Created: Mon Feb 20 07:27:34 2012 +// Author: +// +#ifndef NMTTools_ListOfCoupleOfShape_HeaderFile +#define NMTTools_ListOfCoupleOfShape_HeaderFile -Standard_EXPORT NMTTools_CoupleOfShape& First() const; - - -Standard_EXPORT NMTTools_CoupleOfShape& Last() const; - - -Standard_EXPORT void RemoveFirst() ; - - -Standard_EXPORT void Remove(NMTTools_ListIteratorOfListOfCoupleOfShape& It) ; - - -Standard_EXPORT void InsertBefore(const NMTTools_CoupleOfShape& I,NMTTools_ListIteratorOfListOfCoupleOfShape& It) ; - - -Standard_EXPORT void InsertBefore(NMTTools_ListOfCoupleOfShape& Other,NMTTools_ListIteratorOfListOfCoupleOfShape& It) ; - - -Standard_EXPORT void InsertAfter(const NMTTools_CoupleOfShape& I,NMTTools_ListIteratorOfListOfCoupleOfShape& It) ; - - -Standard_EXPORT void InsertAfter(NMTTools_ListOfCoupleOfShape& Other,NMTTools_ListIteratorOfListOfCoupleOfShape& It) ; - - -friend class NMTTools_ListIteratorOfListOfCoupleOfShape; - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_ListOfCoupleOfShape(const NMTTools_ListOfCoupleOfShape& Other); - - - // Fields PRIVATE - // -Standard_Address myFirst; -Standard_Address myLast; - - -}; - -#define Item NMTTools_CoupleOfShape -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCoupleOfShape -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCoupleOfShape_Type_() -#define TCollection_List NMTTools_ListOfCoupleOfShape -#define TCollection_List_hxx - -#include - -#undef Item -#undef Item_hxx -#undef TCollection_ListNode -#undef TCollection_ListNode_hxx -#undef TCollection_ListIterator -#undef TCollection_ListIterator_hxx -#undef Handle_TCollection_ListNode -#undef TCollection_ListNode_Type_ -#undef TCollection_List -#undef TCollection_List_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// +#include +#include +typedef NCollection_List NMTTools_ListOfCoupleOfShape; +typedef NMTTools_ListOfCoupleOfShape::Iterator NMTTools_ListIteratorOfListOfCoupleOfShape; #endif diff --git a/src/NMTTools/NMTTools_ListOfCoupleOfShape_0.cxx b/src/NMTTools/NMTTools_ListOfCoupleOfShape_0.cxx deleted file mode 100644 index 3861f4069..000000000 --- a/src/NMTTools/NMTTools_ListOfCoupleOfShape_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _NMTTools_ListIteratorOfListOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_CoupleOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_ListNodeOfListOfCoupleOfShape_HeaderFile -#include -#endif - - -#define Item NMTTools_CoupleOfShape -#define Item_hxx -#define TCollection_ListNode NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_hxx -#define TCollection_ListIterator NMTTools_ListIteratorOfListOfCoupleOfShape -#define TCollection_ListIterator_hxx -#define Handle_TCollection_ListNode Handle_NMTTools_ListNodeOfListOfCoupleOfShape -#define TCollection_ListNode_Type_() NMTTools_ListNodeOfListOfCoupleOfShape_Type_() -#define TCollection_List NMTTools_ListOfCoupleOfShape -#define TCollection_List_hxx -#include - diff --git a/src/NMTTools/NMTTools_MapIteratorOfMapOfPaveBlock.hxx b/src/NMTTools/NMTTools_MapIteratorOfMapOfPaveBlock.hxx index c00274562..bf94f3757 100644 --- a/src/NMTTools/NMTTools_MapIteratorOfMapOfPaveBlock.hxx +++ b/src/NMTTools/NMTTools_MapIteratorOfMapOfPaveBlock.hxx @@ -1,111 +1,32 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile -#define _NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile +// File: NMTTools_MapIteratorOfMapOfPaveBlock.hxx +// Created: Mon Feb 20 11:47:30 2012 +// Author: +// -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class BOPTools_PaveBlock; -class BOPTools_PaveBlockMapHasher; -class NMTTools_MapOfPaveBlock; -class NMTTools_StdMapNodeOfMapOfPaveBlock; +#ifndef NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile +#define NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile -#ifndef _Standard_HeaderFile -#include +#ifndef NMTTools_MapOfPaveBlock_HeaderFile +#include #endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_MapIteratorOfMapOfPaveBlock : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_MapIteratorOfMapOfPaveBlock(); - - -Standard_EXPORT NMTTools_MapIteratorOfMapOfPaveBlock(const NMTTools_MapOfPaveBlock& aMap); - - -Standard_EXPORT void Initialize(const NMTTools_MapOfPaveBlock& aMap) ; - - -Standard_EXPORT const BOPTools_PaveBlock& Key() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - #endif diff --git a/src/NMTTools/NMTTools_MapIteratorOfMapOfPaveBlock_0.cxx b/src/NMTTools/NMTTools_MapIteratorOfMapOfPaveBlock_0.cxx deleted file mode 100644 index d22f3ace7..000000000 --- a/src/NMTTools/NMTTools_MapIteratorOfMapOfPaveBlock_0.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlockMapHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_MapOfPaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile -#include -#endif - - -#define TheKey BOPTools_PaveBlock -#define TheKey_hxx -#define Hasher BOPTools_PaveBlockMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTTools_MapIteratorOfMapOfPaveBlock -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_Type_() NMTTools_StdMapNodeOfMapOfPaveBlock_Type_() -#define TCollection_Map NMTTools_MapOfPaveBlock -#define TCollection_Map_hxx -#include - diff --git a/src/NMTTools/NMTTools_MapOfPaveBlock.hxx b/src/NMTTools/NMTTools_MapOfPaveBlock.hxx index 6dc17138f..9def69219 100644 --- a/src/NMTTools/NMTTools_MapOfPaveBlock.hxx +++ b/src/NMTTools/NMTTools_MapOfPaveBlock.hxx @@ -1,139 +1,40 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _NMTTools_MapOfPaveBlock_HeaderFile -#define _NMTTools_MapOfPaveBlock_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class BOPTools_PaveBlock; -class BOPTools_PaveBlockMapHasher; -class NMTTools_StdMapNodeOfMapOfPaveBlock; -class NMTTools_MapIteratorOfMapOfPaveBlock; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -class NMTTools_MapOfPaveBlock : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_MapOfPaveBlock(const Standard_Integer NbBuckets = 1); - - -Standard_EXPORT NMTTools_MapOfPaveBlock& Assign(const NMTTools_MapOfPaveBlock& Other) ; - NMTTools_MapOfPaveBlock& operator =(const NMTTools_MapOfPaveBlock& Other) -{ - return Assign(Other); -} - - - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; - - -Standard_EXPORT void Clear() ; -~NMTTools_MapOfPaveBlock() -{ - Clear(); -} - +// File: NMTTools_MapOfPaveBlock.hxx +// Created: Mon Feb 20 08:19:07 2012 +// Author: +// -Standard_EXPORT Standard_Boolean Add(const BOPTools_PaveBlock& aKey) ; +#ifndef NMTTools_MapOfPaveBlock_HeaderFile +#define NMTTools_MapOfPaveBlock_HeaderFile -Standard_EXPORT Standard_Boolean Contains(const BOPTools_PaveBlock& aKey) const; +#include +#include +#define _NCollection_MapHasher +#include -Standard_EXPORT Standard_Boolean Remove(const BOPTools_PaveBlock& aKey) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - -Standard_EXPORT NMTTools_MapOfPaveBlock(const NMTTools_MapOfPaveBlock& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// +typedef NCollection_Map NMTTools_MapOfPaveBlock; +typedef NMTTools_MapOfPaveBlock::Iterator NMTTools_MapIteratorOfMapOfPaveBlock; +#undef _NCollection_MapHasher #endif diff --git a/src/NMTTools/NMTTools_MapOfPaveBlock_0.cxx b/src/NMTTools/NMTTools_MapOfPaveBlock_0.cxx deleted file mode 100644 index c2efd4b3b..000000000 --- a/src/NMTTools/NMTTools_MapOfPaveBlock_0.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlockMapHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile -#include -#endif - - -#define TheKey BOPTools_PaveBlock -#define TheKey_hxx -#define Hasher BOPTools_PaveBlockMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTTools_MapIteratorOfMapOfPaveBlock -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_Type_() NMTTools_StdMapNodeOfMapOfPaveBlock_Type_() -#define TCollection_Map NMTTools_MapOfPaveBlock -#define TCollection_Map_hxx -#include - diff --git a/src/NMTTools/NMTTools_PCurveMaker.cdl b/src/NMTTools/NMTTools_PCurveMaker.cdl deleted file mode 100644 index a32211778..000000000 --- a/src/NMTTools/NMTTools_PCurveMaker.cdl +++ /dev/null @@ -1,56 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_PCurveMaker.cdl --- Created: --- Author: Peter KURNEV --- --- -class PCurveMaker from NMTTools - - ---Purpose: - -- Class provides computation p-curves for the edges and theirs - --- split parts - -uses - PDSFiller from NMTTools - -is - Create (aFiller:out PDSFiller from NMTTools) - returns PCurveMaker from NMTTools; - ---Purpose: - --- Constructor - --- - Do(me:out); - ---Purpose: - --- Launch the processor - --- - IsDone(me) - returns Boolean from Standard; - ---Purpose: - --- Returns TRUE if Ok - --- - -fields - myDSFiller: PDSFiller from NMTTools is protected; - myIsDone : Boolean from Standard is protected; - -end PCurveMaker; diff --git a/src/NMTTools/NMTTools_PCurveMaker.cxx b/src/NMTTools/NMTTools_PCurveMaker.cxx deleted file mode 100644 index 91a8bc14c..000000000 --- a/src/NMTTools/NMTTools_PCurveMaker.cxx +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (C) 2007-2008 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 -// -// File: NMTTools_PCurveMaker.cxx -// Created: -// Author: Peter KURNEV -// -// -#include - -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -//======================================================================= -// function: NMTTools_PCurveMaker -// purpose: -//======================================================================= - NMTTools_PCurveMaker::NMTTools_PCurveMaker(NMTTools_PDSFiller& pDSFiller) -: - myIsDone(Standard_False) -{ - myDSFiller=pDSFiller; -} -//======================================================================= -// function: IsDone -// purpose: -//======================================================================= - Standard_Boolean NMTTools_PCurveMaker::IsDone() const -{ - return myIsDone; -} -//======================================================================= -// function: Do -// purpose: -//======================================================================= - void NMTTools_PCurveMaker::Do() -{ - Standard_Integer i, aNb, nF1, nF2, nE; - BOPTools_ListIteratorOfListOfPaveBlock anIt; - TopoDS_Face aF1FWD, aF2FWD; - // - NMTTools_PaveFiller *pFiller=(NMTTools_PaveFiller*) &(myDSFiller->PaveFiller()); - NMTDS_ShapesDataStructure *pDS=pFiller->DS(); - // - BOPTools_CArray1OfSSInterference& aFFs=(pFiller->InterfPool())->SSInterferences(); - // - aNb=aFFs.Extent(); - for (i=1; i<=aNb; ++i) { - BOPTools_SSInterference& aFF=aFFs(i); - // Faces - aFF.Indices(nF1, nF2); - const TopoDS_Face& aF1=TopoDS::Face(pDS->Shape(nF1)); - const TopoDS_Face& aF2=TopoDS::Face(pDS->Shape(nF2)); - // - // 1.Forwarding the Faces - aF1FWD=aF1; - aF1FWD.Orientation(TopAbs_FORWARD); - aF2FWD=aF2; - aF2FWD.Orientation(TopAbs_FORWARD); - // - // 2. In, On parts processing - const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks(); - anIt.Initialize(aLPBInOn); - for (; anIt.More(); anIt.Next()) { - const BOPTools_PaveBlock& aPB=anIt.Value(); - const BOPTools_PaveBlock& aPBInOn=pFiller->RealPaveBlock(aPB); - // - nE=aPBInOn.Edge(); - const TopoDS_Edge& aE=TopoDS::Edge(pDS->Shape(nE)); - - BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); - BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); - } - } // for (i=1; i<=aNb; i++) - myIsDone=Standard_True; -} - diff --git a/src/NMTTools/NMTTools_PCurveMaker.hxx b/src/NMTTools/NMTTools_PCurveMaker.hxx deleted file mode 100644 index 25e94667a..000000000 --- a/src/NMTTools/NMTTools_PCurveMaker.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_PCurveMaker_HeaderFile -#define _NMTTools_PCurveMaker_HeaderFile - -#ifndef _NMTTools_PDSFiller_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - -//! Class provides computation p-curves for the edges and theirs
    -//! split parts
    -class NMTTools_PCurveMaker { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -//! Constructor
    -Standard_EXPORT NMTTools_PCurveMaker(NMTTools_PDSFiller& aFiller); - - -//! Launch the processor
    -Standard_EXPORT void Do() ; - - -//! Returns TRUE if Ok
    -Standard_EXPORT Standard_Boolean IsDone() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -NMTTools_PDSFiller myDSFiller; -Standard_Boolean myIsDone; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_PCurveMaker.ixx b/src/NMTTools/NMTTools_PCurveMaker.ixx deleted file mode 100644 index 2b0b74625..000000000 --- a/src/NMTTools/NMTTools_PCurveMaker.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_PCurveMaker.jxx b/src/NMTTools/NMTTools_PCurveMaker.jxx deleted file mode 100644 index edf46c82d..000000000 --- a/src/NMTTools/NMTTools_PCurveMaker.jxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_PCurveMaker_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_PDSFiller.hxx b/src/NMTTools/NMTTools_PDSFiller.hxx deleted file mode 100644 index abffc2acd..000000000 --- a/src/NMTTools/NMTTools_PDSFiller.hxx +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_PDSFiller_HeaderFile -#define _NMTTools_PDSFiller_HeaderFile - -class NMTTools_DSFiller; - -typedef NMTTools_DSFiller* NMTTools_PDSFiller; - -#endif diff --git a/src/NMTTools/NMTTools_PPaveFiller.hxx b/src/NMTTools/NMTTools_PPaveFiller.hxx index 0d373a0a4..516d71f52 100644 --- a/src/NMTTools/NMTTools_PPaveFiller.hxx +++ b/src/NMTTools/NMTTools_PPaveFiller.hxx @@ -1,23 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: NMTTools_PPaveFiller.hxx +// Created: Tue Dec 9 12:23:29 2003 +// Author: Peter KURNEV +// // #ifndef _NMTTools_PPaveFiller_HeaderFile #define _NMTTools_PPaveFiller_HeaderFile diff --git a/src/NMTTools/NMTTools_PaveFiller.cdl b/src/NMTTools/NMTTools_PaveFiller.cdl deleted file mode 100644 index 0a79bf1df..000000000 --- a/src/NMTTools/NMTTools_PaveFiller.cdl +++ /dev/null @@ -1,524 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_PaveFiller.cdl --- Created: Fri Dec 5 14:35:00 2003 --- Author: Peter KURNEV --- --- -class PaveFiller from NMTTools - - ---Purpose: - -uses - DataMapOfIntegerInteger from TColStd, - Pnt from gp, - ShapeEnum from TopAbs, - Vertex from TopoDS, - Face from TopoDS, - Shape from TopoDS, - -- Modified to add new definitions Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - Edge from TopoDS, - ListOfShape from TopTools, - DataMapOfShapeShape from TopTools, - ListOfInteger from TColStd, - -- Contribution of Samtech www.samcef.com END - - Context from IntTools, - ShrunkRange from IntTools, - - IndexedDataMapOfShapeInteger from BooleanOperations, - - PavePool from BOPTools, - PaveBlock from BOPTools, - ListOfPaveBlock from BOPTools, - SplitShapesPool from BOPTools, - Pave from BOPTools, - PaveSet from BOPTools, - Curve from BOPTools, - SSInterference from BOPTools, - - IDMapOfPaveBlockIMapOfPaveBlock from BOPTools, - IDMapOfPaveBlockIMapOfInteger from BOPTools, - SSIntersectionAttribute from BOPTools, - - CommonBlockPool from NMTTools, - CommonBlock from NMTTools, - ListOfCommonBlock from NMTTools, - - ShapesDataStructure from NMTDS, - - -- Modified to add new definitions Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - PShapesDataStructure from NMTDS, - Iterator from NMTDS, - IndexedDataMapOfIndexedMapOfInteger from NMTTools, - -- Contribution of Samtech www.samcef.com END - - PIterator from NMTDS, - PInterfPool from NMTDS - ---raises - -is - Create - returns PaveFiller from NMTTools; - ---C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller();" - - - - SetCompositeShape (me:out; - aS: Shape from TopoDS); - - CompositeShape(me) - returns Shape from TopoDS; - ---C++: return const& - - - DS(me:out) - returns PShapesDataStructure from NMTDS; - - DSIt(me:out) - returns PIterator from NMTDS; - - IP(me:out) - returns PInterfPool from NMTDS; - -- - -- Perform the algo - -- Modified to add new method Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - Init (me:out) - is virtual protected; - -- Contribution of Samtech www.samcef.com END - - Clear (me:out) - is virtual protected; - - Perform (me:out) - is virtual; - - PerformVV (me:out) - is virtual protected; - - PerformVE (me:out) - is virtual protected; - - PerformVF (me:out) - is virtual protected; - - PerformEE (me:out) - is virtual protected; - - PerformEF (me:out) - is virtual protected; - - PerformFF (me:out) - is virtual protected; - - MakeSplitEdges(me:out) - is protected; - - PreparePaveBlocks (me:out; - aType1: ShapeEnum from TopAbs; - aType2: ShapeEnum from TopAbs) - is virtual protected; - - CorrectShrunkRanges(me:out; - aSide: Integer from Standard; - aPave: Pave from BOPTools; - aSR : out ShrunkRange from IntTools) - is protected; - - PreparePaveBlocks (me:out; - anE:Integer from Standard) - is virtual protected; - - - PrepareEdges (me:out) - is virtual protected; - - -- - -- Query section - IsDone(me) - returns Boolean from Standard; - - Context(me) - returns Context from IntTools; - ---C++:return const & - - ChangeContext(me:out) - returns Context from IntTools; - ---C++:return & - - PavePool(me) - returns PavePool from BOPTools; - ---C++:return const & - - ChangePavePool(me:out) - returns PavePool from BOPTools; - ---C++:return & - - CommonBlockPool(me) - returns CommonBlockPool from NMTTools; - ---C++:return const & - - ChangeCommonBlockPool(me:out) - returns CommonBlockPool from NMTTools; - ---C++:return & - - SplitShapesPool(me) - returns SplitShapesPool from BOPTools; - ---C++:return const & - - ChangeSplitShapesPool(me:out) - returns SplitShapesPool from BOPTools; - ---C++:return & - - FindSDVertex (me; - nV: Integer from Standard) - returns Integer from Standard; - - IsSuccessorsComputed (me; - iF1:Integer from Standard; - iF2:Integer from Standard) - returns Boolean from Standard - is protected; - - IsBlocksCoinside (me; - aPB1:PaveBlock from BOPTools; - aPB2:PaveBlock from BOPTools) - returns Boolean from Standard - is protected; - - RefinePavePool(me:out) - is protected; - - CheckFacePaves(me:out; - aV : Vertex from TopoDS; - nF: Integer from Standard) - returns Integer from Standard - is protected; - - ReplaceCommonBlocks (me:out; - aLCB: ListOfCommonBlock from NMTTools) - is protected; - - RemoveCommonBlocks (me:out; - aLCB: ListOfCommonBlock from NMTTools) - is protected; - - SplitCommonBlocks (me:out; - aLCB: ListOfCommonBlock from NMTTools) - is protected; - - SplitCommonBlock (me:out; - aCB : CommonBlock from NMTTools; - aLCB: out ListOfCommonBlock from NMTTools) - is protected; - - EECommonBlocks(me:out; - aM:IDMapOfPaveBlockIMapOfPaveBlock from BOPTools) - is protected; - - EFCommonBlocks(me:out; - aMapCB:IDMapOfPaveBlockIMapOfInteger from BOPTools) - is protected; - - EENewVertices (me:out; - aM:IndexedDataMapOfShapeInteger from BooleanOperations) - is protected; - - EENewVertices (me:out; - aV:Vertex from TopoDS; - aM:IndexedDataMapOfShapeInteger from BooleanOperations) - is protected; - - EFNewVertices (me:out; - aM:IndexedDataMapOfShapeInteger from BooleanOperations) - is protected; - - EFNewVertices (me:out; - aV:Vertex from TopoDS; - aM:IndexedDataMapOfShapeInteger from BooleanOperations) - is protected; - - UpdateCommonBlocks(me:out) - is protected; - - UpdatePaveBlocks(me:out) - is protected; - - SplitIndex(me; - aPB:PaveBlock from BOPTools) - returns Integer from Standard - is protected; - - MakeBlocks(me:out) - is protected; - - -------------------------------------------------------------- - --- - --- Some API FUNCTIONS - --- - SplitsInFace(me:out; - aBid:Integer from Standard; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfInteger from TColStd) - returns Integer from Standard; - - SplitsInFace(me:out; - nE1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfInteger from TColStd) - returns Integer from Standard; - - SplitsOnEdge(me:out; - nE1 :Integer from Standard; - nE2 :Integer from Standard; - aLs :out ListOfInteger from TColStd) - returns Integer from Standard; - - SplitsOnFace(me:out; - nE1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfInteger from TColStd) - returns Integer from Standard; - - SplitsOnFace(me:out; - aBid:Integer from Standard; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfInteger from TColStd) - returns Integer from Standard; - - SplitsInFace(me:out; - aBid:Integer from Standard; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools) - returns Integer from Standard; - - SplitsInFace(me:out; - nE1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools) - returns Integer from Standard; - - SplitsOnEdge(me:out; - nE1 :Integer from Standard; - nE2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools) - returns Integer from Standard; - - SplitsOnFace(me:out; - nE1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools) - returns Integer from Standard; - - SplitsOnFace(me:out; - aBid:Integer from Standard; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools) - returns Integer from Standard; - -- - SplitsFace (me:out; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools) - returns Integer from Standard; - - SplitsFace (me:out; - nF2 :Integer from Standard; - aLs :out ListOfInteger from TColStd) - returns Integer from Standard; - - CommonBlocksFace (me:out; - nF :Integer from Standard; - aLCB:out ListOfCommonBlock from NMTTools) - returns Integer from Standard; - - PrepareFace(me:out; - nF : Integer from Standard; - aF : out Face from TopoDS); - - -- - RealPaveBlock(me:out; - aPB:PaveBlock from BOPTools) - returns PaveBlock from BOPTools; - ---C++: return const & - - --modified by NIZNHY-PKV Fri Nov 30 10:30:54 2007 f - RealPaveBlock(me:out; - aPB:PaveBlock from BOPTools; - aLB:out ListOfInteger from TColStd; - aIsCommonBlock:out Integer from Standard) - returns PaveBlock from BOPTools; - ---C++: return const & - --modified by NIZNHY-PKV Fri Nov 30 10:30:58 2007 t - - RealSplitsFace (me:out; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools); - - HasRealSplitsInOnFace (me:out; - nF1 :Integer from Standard; - nF2 :Integer from Standard) - returns Boolean from Standard; - - RealSplitsInFace(me:out; - aBid:Integer from Standard; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools); - - RealSplitsInFace(me:out; - nE1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools); - - RealSplitsOnEdge(me:out; - nE1 :Integer from Standard; - nE2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools); - - RealSplitsOnFace(me:out; - nE1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools); - - RealSplitsOnFace(me:out; - aBid:Integer from Standard; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLs :out ListOfPaveBlock from BOPTools); - -- - PrepareSetForFace(me:out; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLPB: ListOfPaveBlock from BOPTools; - aPSF:out PaveSet from BOPTools); - - PutPaveOnCurve(me:out; - aPSF: PaveSet from BOPTools; - aTol: Real from Standard; - aBC : out Curve from BOPTools); - - PutBoundPaveOnCurve (me:out; - aBC :out Curve from BOPTools; - aFF :out SSInterference from BOPTools); - - PutBoundPaveOnCurve (me:out; - aP : Pnt from gp; - aT : Real from Standard; - aBC :out Curve from BOPTools; - aFF :out SSInterference from BOPTools); - - FindPave (me:out; - aP : Pnt from gp; - aTpV: Real from Standard; - aPS : PaveSet from BOPTools; - aPV :out Pave from BOPTools) - returns Boolean from Standard; - - CheckIntermediatePoint(me:out; - aPB : PaveBlock from BOPTools; - aPBR: PaveBlock from BOPTools; - aTol: Real from Standard) - returns Integer from Standard; - - - IsExistingPaveBlock (me:out; - aPB : PaveBlock from BOPTools; - aLPB: ListOfPaveBlock from BOPTools; - aTol: Real from Standard) - returns Boolean from Standard; - - MakePCurves (me:out); - - -- Modified to add new methods Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - PerformVF1(me:out) - is protected; - - MakeAloneVertices(me:out) - is protected; - - AloneVertices(me) - returns IndexedDataMapOfIndexedMapOfInteger from NMTTools; - ---C++: return const & - -- Contribution of Samtech www.samcef.com END - - IsExistingPaveBlock (me:out; - aPB : PaveBlock from BOPTools; - aLPB: ListOfShape from TopTools; - aTol: Real from Standard) - returns Boolean from Standard; - - -- - CheckCoincidence (me:out; - aPB : PaveBlock from BOPTools; - aLPB: ListOfPaveBlock from BOPTools) - returns Boolean from Standard; - -- - - CheckIntermediatePoint(me:out; - aPB : PaveBlock from BOPTools; - aE : Edge from TopoDS; - aTol: Real from Standard) - returns Integer from Standard; - - -- Modified to add new method Thu Sep 14 14:35:18 2006 - -- Contribution of Samtech www.samcef.com BEGIN - SharedEdges(me:out; - nF1 :Integer from Standard; - nF2 :Integer from Standard; - aLNE :out ListOfInteger from TColStd; - aLSE :out ListOfShape from TopTools); - -- Contribution of Samtech www.samcef.com END - - FuseVertices(me; - aC:Shape from TopoDS; - aDMVV: out DataMapOfShapeShape from TopTools); - -fields - myDS : PShapesDataStructure from NMTDS is protected; - myIsDone : Boolean from Standard is protected; - myNbSources : Integer from Standard is protected; - myNbEdges : Integer from Standard is protected; - - myPavePool : PavePool from BOPTools is protected; - myPavePoolNew : PavePool from BOPTools is protected; - myCommonBlockPool : CommonBlockPool from NMTTools is protected; - mySplitShapesPool : SplitShapesPool from BOPTools is protected; - -- - myContext : Context from IntTools is protected; - mySectionAttribute : SSIntersectionAttribute from BOPTools is protected; - myAloneVertices : IndexedDataMapOfIndexedMapOfInteger from NMTTools is protected; - -- - myVSD : DataMapOfIntegerInteger from TColStd is protected; - myDSIt : PIterator from NMTDS is protected; - myCompositeShape : Shape from TopoDS is protected; - myIP : PInterfPool from NMTDS is protected; - -end PaveFiller; diff --git a/src/NMTTools/NMTTools_PaveFiller.cxx b/src/NMTTools/NMTTools_PaveFiller.cxx index cbac88266..b98bc4fa6 100644 --- a/src/NMTTools/NMTTools_PaveFiller.cxx +++ b/src/NMTTools/NMTTools_PaveFiller.cxx @@ -1,32 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller.cxx -// Created: Fri Dec 5 14:58:54 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_PaveFiller.cxx +// Created: Fri Dec 5 14:58:54 2003 +// Author: Peter KURNEV +// // -#include +#include // #include +#include #include #include #include @@ -34,7 +36,7 @@ //======================================================================= // function: NMTTools_PaveFiller::NMTTools_PaveFiller -// purpose: +// purpose: //======================================================================= NMTTools_PaveFiller::NMTTools_PaveFiller() { @@ -47,7 +49,7 @@ } //======================================================================= // function: ~ -// purpose: +// purpose: //======================================================================= NMTTools_PaveFiller::~NMTTools_PaveFiller() { @@ -55,19 +57,19 @@ } //======================================================================= // function: Clear -// purpose: +// purpose: //======================================================================= void NMTTools_PaveFiller::Clear() { if (myDSIt) { delete myDSIt; - } + } if (myDS) { delete myDS; } myDSIt=NULL; myDS=NULL; - + if (myIP) { delete myIP; } @@ -75,7 +77,7 @@ } //======================================================================= // function: SetCompositeShape -// purpose: +// purpose: //======================================================================= void NMTTools_PaveFiller::SetCompositeShape(const TopoDS_Shape& aS) { @@ -83,7 +85,7 @@ } //======================================================================= // function: CompositeShape -// purpose: +// purpose: //======================================================================= const TopoDS_Shape& NMTTools_PaveFiller::CompositeShape()const { @@ -91,7 +93,7 @@ } //======================================================================= // function: DS -// purpose: +// purpose: //======================================================================= NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS() { @@ -99,7 +101,7 @@ } //======================================================================= // function: DSIt -// purpose: +// purpose: //======================================================================= NMTDS_PIterator NMTTools_PaveFiller::DSIt() { @@ -107,7 +109,7 @@ } //======================================================================= // function: IP -// purpose: +// purpose: //======================================================================= NMTDS_PInterfPool NMTTools_PaveFiller::IP() { @@ -115,7 +117,7 @@ } //======================================================================= // function:IsDone -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_PaveFiller::IsDone() const { @@ -123,23 +125,15 @@ } //======================================================================= // function: Context -// purpose: -//======================================================================= - const IntTools_Context& NMTTools_PaveFiller::Context() const -{ - return myContext; -} -//======================================================================= -// function: ChangeContext -// purpose: +// purpose: //======================================================================= - IntTools_Context& NMTTools_PaveFiller::ChangeContext() + const Handle(IntTools_Context)& NMTTools_PaveFiller::Context() const { return myContext; } //======================================================================= // function: PavePool -// purpose: +// purpose: //======================================================================= const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const { @@ -147,15 +141,23 @@ } //======================================================================= // function: ChangePavePool -// purpose: +// purpose: //======================================================================= BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool() { return myPavePool; } //======================================================================= +// function: ChangePavePoolNew +// purpose: +//======================================================================= + BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePoolNew() +{ + return myPavePoolNew; +} +//======================================================================= // function: CommonBlockPool -// purpose: +// purpose: //======================================================================= const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const { @@ -163,7 +165,7 @@ } //======================================================================= // function: ChangeCommonBlockPool -// purpose: +// purpose: //======================================================================= NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool() { @@ -171,7 +173,7 @@ } //======================================================================= // function: SplitShapesPool -// purpose: +// purpose: //======================================================================= const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const { @@ -179,7 +181,7 @@ } //======================================================================= // function: ChangeSplitShapesPool -// purpose: +// purpose: //======================================================================= BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool() { @@ -187,7 +189,7 @@ } //======================================================================= // function: Init -// purpose: +// purpose: //======================================================================= void NMTTools_PaveFiller::Init() { @@ -214,11 +216,14 @@ // // 4 myIP=new NMTDS_InterfPool; + // + // 5 + myContext=new IntTools_Context; } //======================================================================= // function: Perform -// purpose: +// purpose: //======================================================================= void NMTTools_PaveFiller::Perform() { @@ -227,17 +232,14 @@ //---------------- try { // 0. - // Modified Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN Init(); - // Contribution of Samtech www.samcef.com END //1.VV // PerformVV(); // // 2.VE myPavePool.Resize (myNbEdges); - + PrepareEdges(); PerformVE(); @@ -260,6 +262,10 @@ myPavePoolNew.Destroy(); myPavePoolNew.Resize (myNbEdges); // + //modified by NIZNHY-PKV Mon Dec 12 09:13:53 2011f + UpdateCommonBlocks(0); + //modified by NIZNHY-PKV Mon Dec 12 09:13:56 2011t + // // 5.EF PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE); PerformEF(); @@ -267,7 +273,7 @@ RefinePavePool(); // myPavePoolNew.Destroy(); - + MakeSplitEdges(); UpdateCommonBlocks(); @@ -279,17 +285,17 @@ // MakePCurves(); // - // 7.Postprocessing + // 7.Postprocessing UpdatePaveBlocks(); // NMTTools_DEProcessor aDEP(*this); aDEP.Do(); // - // Modified to treat Alone Vertices Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN MakeAloneVertices(); - // Contribution of Samtech www.samcef.com END // + //modified by NIZNHY-PKV Mon Dec 12 09:14:23 2011f + myIP->Purge(); + //modified by NIZNHY-PKV Mon Dec 12 09:14:27 2011t myIsDone=Standard_True; } catch (BOPTColStd_Failure& ) { diff --git a/src/NMTTools/NMTTools_PaveFiller.hxx b/src/NMTTools/NMTTools_PaveFiller.hxx index 6269aa77d..765e5aba3 100644 --- a/src/NMTTools/NMTTools_PaveFiller.hxx +++ b/src/NMTTools/NMTTools_PaveFiller.hxx @@ -1,83 +1,88 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File: NMTTools_PaveFiller.hxx +// Created: Fri Dec 5 14:58:54 2003 +// Author: Peter KURNEV +// // #ifndef _NMTTools_PaveFiller_HeaderFile #define _NMTTools_PaveFiller_HeaderFile -#ifndef _NMTDS_PShapesDataStructure_HeaderFile +#include +#include #include -#endif -#ifndef _Standard_Boolean_HeaderFile #include -#endif -#ifndef _Standard_Integer_HeaderFile #include -#endif -#ifndef _BOPTools_PavePool_HeaderFile #include -#endif -#ifndef _NMTTools_CommonBlockPool_HeaderFile #include -#endif -#ifndef _BOPTools_SplitShapesPool_HeaderFile #include -#endif -#ifndef _IntTools_Context_HeaderFile -#include -#endif -#ifndef _BOPTools_SSIntersectionAttribute_HeaderFile +#include #include -#endif -#ifndef _NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile #include -#endif -#ifndef _TColStd_DataMapOfIntegerInteger_HeaderFile #include -#endif -#ifndef _NMTDS_PIterator_HeaderFile #include -#endif -#ifndef _TopoDS_Shape_HeaderFile #include -#endif -#ifndef _NMTDS_PInterfPool_HeaderFile #include -#endif -#ifndef _TopAbs_ShapeEnum_HeaderFile +#include #include -#endif -#ifndef _Standard_Real_HeaderFile +#include #include -#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* class TopoDS_Shape; class BOPTools_Pave; class IntTools_ShrunkRange; -class IntTools_Context; class BOPTools_PavePool; class NMTTools_CommonBlockPool; class BOPTools_SplitShapesPool; class BOPTools_PaveBlock; class TopoDS_Vertex; class NMTTools_ListOfCommonBlock; -class NMTTools_CommonBlock; class BOPTools_IDMapOfPaveBlockIMapOfPaveBlock; class BOPTools_IDMapOfPaveBlockIMapOfInteger; class BooleanOperations_IndexedDataMapOfShapeInteger; @@ -92,344 +97,404 @@ class NMTTools_IndexedDataMapOfIndexedMapOfInteger; class TopTools_ListOfShape; class TopoDS_Edge; class TopTools_DataMapOfShapeShape; +class TCoLSTD_MapOfInteger; +*/ -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - +//======================================================================= +//function : NMTTools_PaveFiller +//purpose : +//======================================================================= class NMTTools_PaveFiller { + public: + Standard_EXPORT + NMTTools_PaveFiller(); -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT NMTTools_PaveFiller(); -Standard_EXPORT virtual ~NMTTools_PaveFiller(); - - -Standard_EXPORT void SetCompositeShape(const TopoDS_Shape& aS) ; - - -Standard_EXPORT const TopoDS_Shape& CompositeShape() const; - - -Standard_EXPORT NMTDS_PShapesDataStructure DS() ; - - -Standard_EXPORT NMTDS_PIterator DSIt() ; - - -Standard_EXPORT NMTDS_PInterfPool IP() ; - - -Standard_EXPORT virtual void Perform() ; - - -Standard_EXPORT Standard_Boolean IsDone() const; - - -Standard_EXPORT const IntTools_Context& Context() const; - - -Standard_EXPORT IntTools_Context& ChangeContext() ; - - -Standard_EXPORT const BOPTools_PavePool& PavePool() const; - - -Standard_EXPORT BOPTools_PavePool& ChangePavePool() ; - - -Standard_EXPORT const NMTTools_CommonBlockPool& CommonBlockPool() const; - - -Standard_EXPORT NMTTools_CommonBlockPool& ChangeCommonBlockPool() ; - - -Standard_EXPORT const BOPTools_SplitShapesPool& SplitShapesPool() const; - - -Standard_EXPORT BOPTools_SplitShapesPool& ChangeSplitShapesPool() ; - - -Standard_EXPORT Standard_Integer FindSDVertex(const Standard_Integer nV) const; - - -Standard_EXPORT Standard_Integer SplitsInFace(const Standard_Integer aBid,const Standard_Integer nF1,const Standard_Integer nF2,TColStd_ListOfInteger& aLs) ; - - -Standard_EXPORT Standard_Integer SplitsInFace(const Standard_Integer nE1,const Standard_Integer nF2,TColStd_ListOfInteger& aLs) ; - - -Standard_EXPORT Standard_Integer SplitsOnEdge(const Standard_Integer nE1,const Standard_Integer nE2,TColStd_ListOfInteger& aLs) ; - - -Standard_EXPORT Standard_Integer SplitsOnFace(const Standard_Integer nE1,const Standard_Integer nF2,TColStd_ListOfInteger& aLs) ; - - -Standard_EXPORT Standard_Integer SplitsOnFace(const Standard_Integer aBid,const Standard_Integer nF1,const Standard_Integer nF2,TColStd_ListOfInteger& aLs) ; - - -Standard_EXPORT Standard_Integer SplitsInFace(const Standard_Integer aBid,const Standard_Integer nF1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; - - -Standard_EXPORT Standard_Integer SplitsInFace(const Standard_Integer nE1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; - + Standard_EXPORT + virtual ~NMTTools_PaveFiller(); -Standard_EXPORT Standard_Integer SplitsOnEdge(const Standard_Integer nE1,const Standard_Integer nE2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + void SetCompositeShape(const TopoDS_Shape& aS) ; + Standard_EXPORT + const TopoDS_Shape& CompositeShape() const; -Standard_EXPORT Standard_Integer SplitsOnFace(const Standard_Integer nE1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + NMTDS_PShapesDataStructure DS() ; + Standard_EXPORT + NMTDS_PIterator DSIt() ; -Standard_EXPORT Standard_Integer SplitsOnFace(const Standard_Integer aBid,const Standard_Integer nF1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + NMTDS_PInterfPool IP() ; + Standard_EXPORT + virtual void Perform() ; -Standard_EXPORT Standard_Integer SplitsFace(const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + Standard_Boolean IsDone() const; + Standard_EXPORT + const Handle_IntTools_Context& Context() const; -Standard_EXPORT Standard_Integer SplitsFace(const Standard_Integer nF2,TColStd_ListOfInteger& aLs) ; + Standard_EXPORT + const BOPTools_PavePool& PavePool() const; + Standard_EXPORT + BOPTools_PavePool& ChangePavePool() ; -Standard_EXPORT Standard_Integer CommonBlocksFace(const Standard_Integer nF,NMTTools_ListOfCommonBlock& aLCB) ; + Standard_EXPORT + const NMTTools_CommonBlockPool& CommonBlockPool() const; + Standard_EXPORT + NMTTools_CommonBlockPool& ChangeCommonBlockPool() ; -Standard_EXPORT void PrepareFace(const Standard_Integer nF,TopoDS_Face& aF) ; + Standard_EXPORT + const BOPTools_SplitShapesPool& SplitShapesPool() const; + Standard_EXPORT + BOPTools_SplitShapesPool& ChangeSplitShapesPool() ; -Standard_EXPORT const BOPTools_PaveBlock& RealPaveBlock(const BOPTools_PaveBlock& aPB) ; + Standard_EXPORT + Standard_Integer FindSDVertex(const Standard_Integer nV) const; + + Standard_EXPORT + Standard_Integer SplitsInFace(const Standard_Integer aBid, + const Standard_Integer nF1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aLs) ; + Standard_EXPORT + Standard_Integer SplitsInFace(const Standard_Integer nE1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aLs) ; -Standard_EXPORT const BOPTools_PaveBlock& RealPaveBlock(const BOPTools_PaveBlock& aPB,TColStd_ListOfInteger& aLB,Standard_Integer& aIsCommonBlock) ; + Standard_EXPORT + Standard_Integer SplitsOnEdge(const Standard_Integer nE1, + const Standard_Integer nE2, + TColStd_ListOfInteger& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsOnFace(const Standard_Integer nE1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsOnFace(const Standard_Integer aBid, + const Standard_Integer nF1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsInFace(const Standard_Integer aBid, + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsInFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsOnEdge(const Standard_Integer nE1, + const Standard_Integer nE2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsOnFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsOnFace(const Standard_Integer aBid, + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsFace(const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + Standard_Integer SplitsFace(const Standard_Integer nF2, + TColStd_ListOfInteger& aLs) ; + + Standard_EXPORT + Standard_Integer CommonBlocksFace(const Standard_Integer nF, + NMTTools_ListOfCommonBlock& aLCB) ; + + Standard_EXPORT + void PrepareFace(const Standard_Integer nF, + TopoDS_Face& aF) ; + + Standard_EXPORT + const BOPTools_PaveBlock& RealPaveBlock(const BOPTools_PaveBlock& aPB) ; + + Standard_EXPORT + const BOPTools_PaveBlock& RealPaveBlock(const BOPTools_PaveBlock& aPB, + TColStd_ListOfInteger& aLB, + Standard_Integer& aIsCommonBlock) ; + + Standard_EXPORT + void RealSplitsFace(const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + Standard_Boolean HasRealSplitsInOnFace(const Standard_Integer nF1, + const Standard_Integer nF2) ; + + Standard_EXPORT + void RealSplitsInFace(const Standard_Integer aBid, + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + void RealSplitsInFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + void RealSplitsInFace(const Standard_Integer nF1, + BOPTools_ListOfPaveBlock& aLPB) ; + + Standard_EXPORT + void RealSplitsOnEdge(const Standard_Integer nE1, + const Standard_Integer nE2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + void RealSplitsOnFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + void RealSplitsOnFace(const Standard_Integer aBid, + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLs) ; + + Standard_EXPORT + void PrepareSetForFace(const Standard_Integer nF1, + const Standard_Integer nF2, + const BOPTools_ListOfPaveBlock& aLPB, + BOPTools_PaveSet& aPSF) ; + + Standard_EXPORT + void PutPaveOnCurve(const BOPTools_PaveSet& aPSF, + const Standard_Real aTol, + BOPTools_Curve& aBC) ; + + Standard_EXPORT + void PutBoundPaveOnCurve(BOPTools_Curve& aBC, + BOPTools_SSInterference& aFF) ; + + Standard_EXPORT + void PutBoundPaveOnCurve(const gp_Pnt& aP, + const Standard_Real aT, + BOPTools_Curve& aBC, + BOPTools_SSInterference& aFF) ; + + Standard_EXPORT + Standard_Boolean FindPave(const gp_Pnt& aP, + const Standard_Real aTpV, + const BOPTools_PaveSet& aPS, + BOPTools_Pave& aPV) ; + + Standard_EXPORT + Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlock& aPB, + const BOPTools_PaveBlock& aPBR, + const Standard_Real aTol) ; + + Standard_EXPORT + Standard_Boolean IsExistingPaveBlock(const BOPTools_PaveBlock& aPB, + const BOPTools_ListOfPaveBlock& aLPB, + const Standard_Real aTol) ; + + Standard_EXPORT + void MakePCurves() ; + + Standard_EXPORT + const NMTTools_IndexedDataMapOfIndexedMapOfInteger& AloneVertices() const; + + Standard_EXPORT + Standard_Boolean IsExistingPaveBlock(const BOPTools_PaveBlock& aPB, + const TopTools_ListOfShape& aLPB, + const Standard_Real aTol) ; + Standard_EXPORT + Standard_Boolean CheckCoincidence(const BOPTools_PaveBlock& aPB, + const BOPTools_ListOfPaveBlock& aLPB) ; -Standard_EXPORT void RealSplitsFace(const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlock& aPB, + const TopoDS_Edge& aE, + const Standard_Real aTol) ; + Standard_EXPORT + void SharedEdges(const Standard_Integer nF1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aLNE, + TopTools_ListOfShape& aLSE) ; -Standard_EXPORT Standard_Boolean HasRealSplitsInOnFace(const Standard_Integer nF1,const Standard_Integer nF2) ; + Standard_EXPORT + void FuseVertices(const TopoDS_Shape& aC, + TopTools_DataMapOfShapeShape& aDMVV) const; + Standard_EXPORT + void TreatPaveBlocks(NMTTools_ListOfCommonBlock& theLCB) ; -Standard_EXPORT void RealSplitsInFace(const Standard_Integer aBid,const Standard_Integer nF1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + BOPTools_PavePool& ChangePavePoolNew() ; + Standard_EXPORT + Standard_Boolean CheckCoincidence(const BOPTools_PaveBlock& aPB1, + const BOPTools_PaveBlock& aPB2) ; -Standard_EXPORT void RealSplitsInFace(const Standard_Integer nE1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + void PutClosingPaveOnCurve(BOPTools_Curve& aBC, + BOPTools_SSInterference& aFF) ; + protected: + Standard_EXPORT + virtual void Init() ; -Standard_EXPORT void RealSplitsOnEdge(const Standard_Integer nE1,const Standard_Integer nE2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + virtual void Clear() ; + Standard_EXPORT + virtual void PerformVV() ; -Standard_EXPORT void RealSplitsOnFace(const Standard_Integer nE1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + virtual void PerformVE() ; + Standard_EXPORT + virtual void PerformVF() ; -Standard_EXPORT void RealSplitsOnFace(const Standard_Integer aBid,const Standard_Integer nF1,const Standard_Integer nF2,BOPTools_ListOfPaveBlock& aLs) ; + Standard_EXPORT + virtual void PerformEE() ; + Standard_EXPORT + virtual void PerformEF() ; -Standard_EXPORT void PrepareSetForFace(const Standard_Integer nF1,const Standard_Integer nF2,const BOPTools_ListOfPaveBlock& aLPB,BOPTools_PaveSet& aPSF) ; + Standard_EXPORT + virtual void PerformFF() ; + Standard_EXPORT + void MakeSplitEdges() ; -Standard_EXPORT void PutPaveOnCurve(const BOPTools_PaveSet& aPSF,const Standard_Real aTol,BOPTools_Curve& aBC) ; + Standard_EXPORT + virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) ; + Standard_EXPORT + void CorrectShrunkRanges(const Standard_Integer aSide, + const BOPTools_Pave& aPave, + IntTools_ShrunkRange& aSR) ; -Standard_EXPORT void PutBoundPaveOnCurve(BOPTools_Curve& aBC,BOPTools_SSInterference& aFF) ; + Standard_EXPORT + virtual void PreparePaveBlocks(const Standard_Integer anE) ; + Standard_EXPORT + virtual void PrepareEdges() ; -Standard_EXPORT void PutBoundPaveOnCurve(const gp_Pnt& aP,const Standard_Real aT,BOPTools_Curve& aBC,BOPTools_SSInterference& aFF) ; + Standard_EXPORT + Standard_Boolean IsSuccessorsComputed(const Standard_Integer iF1, + const Standard_Integer iF2) const; + Standard_EXPORT + Standard_Boolean IsBlocksCoinside(const BOPTools_PaveBlock& aPB1, + const BOPTools_PaveBlock& aPB2) const; -Standard_EXPORT Standard_Boolean FindPave(const gp_Pnt& aP,const Standard_Real aTpV,const BOPTools_PaveSet& aPS,BOPTools_Pave& aPV) ; + Standard_EXPORT + void RefinePavePool() ; + Standard_EXPORT + Standard_Integer CheckFacePaves(const TopoDS_Vertex& aV, + const Standard_Integer nF) ; -Standard_EXPORT Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,const BOPTools_PaveBlock& aPBR,const Standard_Real aTol) ; + Standard_EXPORT + void ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ; + Standard_EXPORT + void RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ; -Standard_EXPORT Standard_Boolean IsExistingPaveBlock(const BOPTools_PaveBlock& aPB,const BOPTools_ListOfPaveBlock& aLPB,const Standard_Real aTol) ; + Standard_EXPORT + void SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ; + Standard_EXPORT + void SplitCommonBlock(const NMTTools_CommonBlock& aCB,NMTTools_ListOfCommonBlock& aLCB) ; -Standard_EXPORT void MakePCurves() ; + Standard_EXPORT + void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aM) ; + Standard_EXPORT + void EFCommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB) ; -Standard_EXPORT const NMTTools_IndexedDataMapOfIndexedMapOfInteger& AloneVertices() const; + Standard_EXPORT + void EENewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; + Standard_EXPORT + void EENewVertices(const TopoDS_Vertex& aV, + const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; -Standard_EXPORT Standard_Boolean IsExistingPaveBlock(const BOPTools_PaveBlock& aPB,const TopTools_ListOfShape& aLPB,const Standard_Real aTol) ; + Standard_EXPORT + void EFNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; + Standard_EXPORT + void EFNewVertices(const TopoDS_Vertex& aV, + const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; -Standard_EXPORT Standard_Boolean CheckCoincidence(const BOPTools_PaveBlock& aPB,const BOPTools_ListOfPaveBlock& aLPB) ; + Standard_EXPORT + void UpdateCommonBlocks() ; + Standard_EXPORT + void UpdateCommonBlocks(const Standard_Integer aI) ; -Standard_EXPORT Standard_Integer CheckIntermediatePoint(const BOPTools_PaveBlock& aPB,const TopoDS_Edge& aE,const Standard_Real aTol) ; + Standard_EXPORT + void UpdatePaveBlocks() ; + Standard_EXPORT + Standard_Integer SplitIndex(const BOPTools_PaveBlock& aPB) const; -Standard_EXPORT void SharedEdges(const Standard_Integer nF1,const Standard_Integer nF2,TColStd_ListOfInteger& aLNE,TopTools_ListOfShape& aLSE) ; + Standard_EXPORT + void MakeBlocks() ; + Standard_EXPORT + void PerformVF1() ; -Standard_EXPORT void FuseVertices(const TopoDS_Shape& aC,TopTools_DataMapOfShapeShape& aDMVV) const; + Standard_EXPORT + void MakeAloneVertices() ; + Standard_EXPORT + void FillFaceInfo() ; + Standard_EXPORT + void CorrectTolR3D(const BOPTools_SSInterference& aFF, + const TColStd_MapOfInteger& aMVStick, + Standard_Real& aTolR3D) ; + NMTDS_PShapesDataStructure myDS; + Standard_Boolean myIsDone; + Standard_Integer myNbSources; + Standard_Integer myNbEdges; + BOPTools_PavePool myPavePool; + BOPTools_PavePool myPavePoolNew; + NMTTools_CommonBlockPool myCommonBlockPool; + BOPTools_SplitShapesPool mySplitShapesPool; + Handle_IntTools_Context myContext; + BOPTools_SSIntersectionAttribute mySectionAttribute; + NMTTools_IndexedDataMapOfIndexedMapOfInteger myAloneVertices; + TColStd_DataMapOfIntegerInteger myVSD; + NMTDS_PIterator myDSIt; + TopoDS_Shape myCompositeShape; + NMTDS_PInterfPool myIP; + NMTTools_DataMapOfIntegerFaceInfo myFaceInfo; -protected: - - // Methods PROTECTED - // - - -Standard_EXPORT virtual void Init() ; - - -Standard_EXPORT virtual void Clear() ; - - -Standard_EXPORT virtual void PerformVV() ; - - -Standard_EXPORT virtual void PerformVE() ; - - -Standard_EXPORT virtual void PerformVF() ; - - -Standard_EXPORT virtual void PerformEE() ; - - -Standard_EXPORT virtual void PerformEF() ; - - -Standard_EXPORT virtual void PerformFF() ; - - -Standard_EXPORT void MakeSplitEdges() ; - - -Standard_EXPORT virtual void PreparePaveBlocks(const TopAbs_ShapeEnum aType1,const TopAbs_ShapeEnum aType2) ; - - -Standard_EXPORT void CorrectShrunkRanges(const Standard_Integer aSide,const BOPTools_Pave& aPave,IntTools_ShrunkRange& aSR) ; - - -Standard_EXPORT virtual void PreparePaveBlocks(const Standard_Integer anE) ; - - -Standard_EXPORT virtual void PrepareEdges() ; - - -Standard_EXPORT Standard_Boolean IsSuccessorsComputed(const Standard_Integer iF1,const Standard_Integer iF2) const; - - -Standard_EXPORT Standard_Boolean IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,const BOPTools_PaveBlock& aPB2) const; - - -Standard_EXPORT void RefinePavePool() ; - - -Standard_EXPORT Standard_Integer CheckFacePaves(const TopoDS_Vertex& aV,const Standard_Integer nF) ; - - -Standard_EXPORT void ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ; - - -Standard_EXPORT void RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ; - - -Standard_EXPORT void SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) ; - - -Standard_EXPORT void SplitCommonBlock(const NMTTools_CommonBlock& aCB,NMTTools_ListOfCommonBlock& aLCB) ; - - -Standard_EXPORT void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aM) ; - - -Standard_EXPORT void EFCommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB) ; - - -Standard_EXPORT void EENewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; - - -Standard_EXPORT void EENewVertices(const TopoDS_Vertex& aV,const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; - - -Standard_EXPORT void EFNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; - - -Standard_EXPORT void EFNewVertices(const TopoDS_Vertex& aV,const BooleanOperations_IndexedDataMapOfShapeInteger& aM) ; - - -Standard_EXPORT void UpdateCommonBlocks() ; - - -Standard_EXPORT void UpdatePaveBlocks() ; - - -Standard_EXPORT Standard_Integer SplitIndex(const BOPTools_PaveBlock& aPB) const; - - -Standard_EXPORT void MakeBlocks() ; - - -Standard_EXPORT void PerformVF1() ; - - -Standard_EXPORT void MakeAloneVertices() ; - - - // Fields PROTECTED - // -NMTDS_PShapesDataStructure myDS; -Standard_Boolean myIsDone; -Standard_Integer myNbSources; -Standard_Integer myNbEdges; -BOPTools_PavePool myPavePool; -BOPTools_PavePool myPavePoolNew; -NMTTools_CommonBlockPool myCommonBlockPool; -BOPTools_SplitShapesPool mySplitShapesPool; -IntTools_Context myContext; -BOPTools_SSIntersectionAttribute mySectionAttribute; -NMTTools_IndexedDataMapOfIndexedMapOfInteger myAloneVertices; -TColStd_DataMapOfIntegerInteger myVSD; -NMTDS_PIterator myDSIt; -TopoDS_Shape myCompositeShape; -NMTDS_PInterfPool myIP; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // + // private: }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_PaveFiller.ixx b/src/NMTTools/NMTTools_PaveFiller.ixx deleted file mode 100644 index 210065e01..000000000 --- a/src/NMTTools/NMTTools_PaveFiller.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_PaveFiller.jxx b/src/NMTTools/NMTTools_PaveFiller.jxx deleted file mode 100644 index ec28fecac..000000000 --- a/src/NMTTools/NMTTools_PaveFiller.jxx +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _BOPTools_Pave_HeaderFile -#include -#endif -#ifndef _IntTools_ShrunkRange_HeaderFile -#include -#endif -#ifndef _IntTools_Context_HeaderFile -#include -#endif -#ifndef _BOPTools_PavePool_HeaderFile -#include -#endif -#ifndef _NMTTools_CommonBlockPool_HeaderFile -#include -#endif -#ifndef _BOPTools_SplitShapesPool_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCommonBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_CommonBlock_HeaderFile -#include -#endif -#ifndef _BOPTools_IDMapOfPaveBlockIMapOfPaveBlock_HeaderFile -#include -#endif -#ifndef _BOPTools_IDMapOfPaveBlockIMapOfInteger_HeaderFile -#include -#endif -#ifndef _BooleanOperations_IndexedDataMapOfShapeInteger_HeaderFile -#include -#endif -#ifndef _TColStd_ListOfInteger_HeaderFile -#include -#endif -#ifndef _BOPTools_ListOfPaveBlock_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveSet_HeaderFile -#include -#endif -#ifndef _BOPTools_Curve_HeaderFile -#include -#endif -#ifndef _BOPTools_SSInterference_HeaderFile -#include -#endif -#ifndef _gp_Pnt_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapOfIndexedMapOfInteger_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _NMTTools_PaveFiller_HeaderFile -#include -#endif diff --git a/src/NMTTools/NMTTools_PaveFiller_0.cxx b/src/NMTTools/NMTTools_PaveFiller_0.cxx index 7a787ebac..832b0b0f0 100644 --- a/src/NMTTools/NMTTools_PaveFiller_0.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_0.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller_0.cxx -// Created: Mon Dec 8 11:45:51 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_PaveFiller_0.cxx +// Created: Mon Dec 8 11:45:51 2003 +// Author: Peter KURNEV +// // -#include +#include #include #include @@ -35,10 +36,10 @@ //======================================================================= // function:IsSuccesstorsComputed -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_PaveFiller::IsSuccessorsComputed(const Standard_Integer aN1, - const Standard_Integer aN2)const + const Standard_Integer aN2)const { Standard_Boolean bComputed; Standard_Integer i, nSuc, n1, n2, ntmp, aNbS; @@ -58,7 +59,7 @@ aNbS=aMSuc.Extent(); for (i=1; i<=aNbS; ++i) { nSuc=aMSuc(i); - bComputed=myIP->Contains(n1, nSuc); + bComputed=myIP->Contains(n1, nSuc); if (bComputed) { break; } @@ -68,13 +69,13 @@ /* //======================================================================= // function: ExpectedPoolLength -// purpose: +// purpose: //======================================================================= Standard_Integer NMTTools_PaveFiller::ExpectedPoolLength()const { Standard_Integer aNbIIs; Standard_Real aCfPredict=.5; - // Modified Thu Sep 14 14:35:18 2006 + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //const BOPTools_ListOfCoupleOfInteger& aLC=myDSIt.ListOfCouple(); //aNbIIs=aLC.Extent(); @@ -86,18 +87,18 @@ } // aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs); - + return aNbIIs; } */ /* //======================================================================= //function : SortTypes -//purpose : +//purpose : //======================================================================= void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat, - Standard_Integer& theWith)const -{ + Standard_Integer& theWith)const +{ Standard_Integer aWhat, aWith; Standard_Boolean aReverseFlag; TopAbs_ShapeEnum aType1, aType2; @@ -113,7 +114,7 @@ if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE) { aReverseFlag=Standard_False; } - if (aType1==TopAbs_VERTEX && + if (aType1==TopAbs_VERTEX && (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) { aReverseFlag=Standard_False; } diff --git a/src/NMTTools/NMTTools_PaveFiller_1.cxx b/src/NMTTools/NMTTools_PaveFiller_1.cxx index 8685855c0..0f566f218 100644 --- a/src/NMTTools/NMTTools_PaveFiller_1.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_1.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller_1.cxx -// Created: Mon Dec 8 11:47:55 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_PaveFiller_1.cxx +// Created: Mon Dec 8 11:47:55 2003 +// Author: Peter KURNEV +// // -#include +#include #include #include @@ -50,9 +51,9 @@ //======================================================================= // function: PerformVV -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PerformVV() + void NMTTools_PaveFiller::PerformVV() { myIsDone=Standard_False; // @@ -123,15 +124,15 @@ for (i=0; aItX.More(); aItX.Next(), ++i) { aItY.Initialize(aLIX); for (j=0; aItY.More(); aItY.Next(), ++j) { - if (j>i) { - n1=aItX.Value(); - n2=aItY.Value(); - myIP->Add(n1, n2, Standard_True, NMTDS_TI_VV); - // - BOPTools_VVInterference aVV(n1, n2); - aVV.SetNewShape(nVnew); - aVVs.Append(aVV); - } + if (j>i) { + n1=aItX.Value(); + n2=aItY.Value(); + myIP->Add(n1, n2, Standard_True, NMTDS_TI_VV); + // + BOPTools_VVInterference aVV(n1, n2); + aVV.SetNewShape(nVnew); + aVVs.Append(aVV); + } } } }//for (; aIt1.More(); aIt1.Next()) { @@ -139,7 +140,7 @@ } //======================================================================= // function: FindSDVertex -// purpose: +// purpose: //======================================================================= Standard_Integer NMTTools_PaveFiller::FindSDVertex(const Standard_Integer nV)const { @@ -154,9 +155,9 @@ /* //======================================================================= // function: PerformNewVertices -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PerformNewVertices() + void NMTTools_PaveFiller::PerformNewVertices() { } */ diff --git a/src/NMTTools/NMTTools_PaveFiller_2.cxx b/src/NMTTools/NMTTools_PaveFiller_2.cxx index e400245ca..be0cbe728 100644 --- a/src/NMTTools/NMTTools_PaveFiller_2.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_2.cxx @@ -1,30 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller_2.cxx -// Created: Mon Dec 8 12:02:56 2003 -// Author: Peter KURNEV -// -// -#include + +// File: NMTTools_PaveFiller_2.cxx +// Created: Mon Dec 8 12:02:56 2003 +// Author: Peter KURNEV + +#include + +#include + +#include #include @@ -48,33 +52,39 @@ #include #include + #include #include #include -// -// Modified Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN + + #include #include #include +#include static Standard_Boolean Contains(const TopoDS_Edge& aE, - const TopoDS_Vertex& aV); -// Contribution of Samtech www.samcef.com END + const TopoDS_Vertex& aV); //======================================================================= // function: PerformVE -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PerformVE() +void NMTTools_PaveFiller::PerformVE() { myIsDone=Standard_False; // Standard_Boolean bJustAdd; - Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVEs, aBlockLength, iSDV, nV1; + Standard_Integer n1, n2, anIndexIn, aFlag, aWhat; + Standard_Integer aWith, aNbVEs, aBlockLength, iSDV, nV1; Standard_Real aT; +#if OCC_VERSION_LARGE > 0x06030008 + // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method + Standard_Boolean bToUpdateVertex; + Standard_Real aDist; +#endif TopoDS_Vertex aV1; TopoDS_Edge aE2; BOPTools_IndexedMapOfCoupleOfInteger aSnareMap; @@ -98,18 +108,17 @@ static aWhat=n1; // Vertex aWith=n2; // Edge if (myDS->GetShapeType(n1)==TopAbs_EDGE) { - aWhat=n2; - aWith=n1; + aWhat=n2; + aWith=n1; } // if(bJustAdd) { - //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); - continue; + continue; } // Edge aE2=TopoDS::Edge(myDS->Shape(aWith)); if (BRep_Tool::Degenerated(aE2)){ - continue; + continue; } // Vertex nV1=aWhat; @@ -117,73 +126,89 @@ static // iSDV=FindSDVertex(aWhat); if (iSDV) { - nV1=iSDV; - aV1=TopoDS::Vertex(myDS->Shape(nV1)); - // Modified to find same domain vertex Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - Standard_Integer nVE, iSDVE, iRet; - // - BooleanOperations_OnceExplorer aExp(*myDS); - iRet=0; - aExp.Init(aWith, TopAbs_VERTEX); - for (; aExp.More(); aExp.Next()) { - nVE=aExp.Current(); - iSDVE=FindSDVertex(nVE); - if (iSDVE==iSDV) { - iRet=1; - break; - } - } - if (iRet) { - continue; - } + nV1=iSDV; + aV1=TopoDS::Vertex(myDS->Shape(nV1)); + // Modified to find same domain vertex Thu Sep 14 14:35:18 2006 + // Contribution of Samtech www.samcef.com BEGIN + Standard_Integer nVE, iSDVE, iRet; + // + BooleanOperations_OnceExplorer aExp(*myDS); + iRet=0; + aExp.Init(aWith, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nVE=aExp.Current(); + iSDVE=FindSDVertex(nVE); + if (iSDVE==iSDV) { + iRet=1; + break; + } + } + if (iRet) { + continue; + } } else { - if (Contains(aE2, aV1)) { - continue; - } - // Contribution of Samtech www.samcef.com END + if (Contains(aE2, aV1)) { + continue; + } + // Contribution of Samtech www.samcef.com END } // - aFlag=myContext.ComputeVE (aV1, aE2, aT); + //modified by NIZNHY-PKV Mon Dec 28 08:58:05 2009f +#if OCC_VERSION_LARGE > 0x06030008 + // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method + aFlag = myContext->ComputeVE (aV1, aE2, aT, bToUpdateVertex, aDist); +#else + aFlag = myContext->ComputeVE (aV1, aE2, aT); +#endif + //modified by NIZNHY-PKV Mon Dec 28 08:58:13 2009t // if (!aFlag) { - // Add Interference to the Pool - BOPTools_VEInterference anInterf (aWhat, aWith, aT); - anIndexIn=aVEs.Append(anInterf); - // - // Add Pave to the Edge's myPavePool - aCouple.SetCouple(nV1, aWith); - if (!aSnareMap.Contains(aCouple)){ - aSnareMap.Add(aCouple); - // - BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); - aPave.SetInterference(anIndexIn); - BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); - aPaveSet.Append(aPave); - } - // - // State for the Vertex in DS; - myDS->SetState (aWhat, BooleanOperations_ON); - // Insert Vertex in Interference Object - BOPTools_VEInterference& aVE=aVEs(anIndexIn); - aVE.SetNewShape(aWhat); - // qqf - { - myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VE); - } - // qqt - } - //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); + // Add Interference to the Pool + BOPTools_VEInterference anInterf (aWhat, aWith, aT); + anIndexIn=aVEs.Append(anInterf); + // + // Add Pave to the Edge's myPavePool + aCouple.SetCouple(nV1, aWith); + if (!aSnareMap.Contains(aCouple)){ + aSnareMap.Add(aCouple); + // + BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); + aPave.SetInterference(anIndexIn); + BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); + aPaveSet.Append(aPave); + } + // + // State for the Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VEInterference& aVE=aVEs(anIndexIn); + aVE.SetNewShape(aWhat); + // + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VE); + // + //modified by NIZNHY-PKV Mon Dec 28 09:00:54 2009f +#if OCC_VERSION_LARGE > 0x06030008 + // In OCCT6.3.0sp9 is changed a signature of IntTools_Context::ComputeVE() method + if (bToUpdateVertex) { + BRep_Builder aBB; + // + aBB.UpdateVertex(aV1, aDist); + } +#endif + //modified by NIZNHY-PKV Mon Dec 28 09:00:57 2009t + // + } //if (!aFlag) { } } myIsDone=Standard_True; } + //======================================================================= // function: PrepareEdges -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PrepareEdges() +void NMTTools_PaveFiller::PrepareEdges() { Standard_Integer i, nV, ii, aNBSuc, ip, aNbShapesObject; Standard_Real aT; @@ -197,7 +222,7 @@ static aE=TopoDS::Edge(myDS->Shape(i)); // if (BRep_Tool::Degenerated(aE)){ - continue; + continue; } // BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(i)); @@ -205,34 +230,34 @@ static // A <- aNBSuc=myDS->NumberOfSuccessors(i); for (ii=1; ii <=aNBSuc; ii++) { - nV=myDS->GetSuccessor(i, ii); - anOr=myDS->GetOrientation(i, ii); - aV=TopoDS::Vertex(myDS->Shape(nV)); - aV.Orientation(anOr); - aT=BRep_Tool::Parameter(aV, aE); - // - ip=FindSDVertex(nV); - if (ip) { - aV=TopoDS::Vertex(myDS->Shape(ip)); - aV.Orientation(anOr);// XX ? if the edge is closed it'll be amazing result - nV=ip; - } - // - BOPTools_Pave aPave(nV, aT); - aPaveSet.Append (aPave); + nV=myDS->GetSuccessor(i, ii); + anOr=myDS->GetOrientation(i, ii); + aV=TopoDS::Vertex(myDS->Shape(nV)); + aV.Orientation(anOr); + aT=BRep_Tool::Parameter(aV, aE); + // + ip=FindSDVertex(nV); + if (ip) { + aV=TopoDS::Vertex(myDS->Shape(ip)); + aV.Orientation(anOr);// XX ? if the edge is closed it'll be amazing result + nV=ip; + } + // + BOPTools_Pave aPave(nV, aT); + aPaveSet.Append (aPave); } } } } -// Modified Thu Sep 14 14:35:18 2006 +// Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= //function : Contains -//purpose : +//purpose : //======================================================================= Standard_Boolean Contains(const TopoDS_Edge& aE, - const TopoDS_Vertex& aV) + const TopoDS_Vertex& aV) { Standard_Boolean bRet; TopoDS_Iterator aIt; diff --git a/src/NMTTools/NMTTools_PaveFiller_3.cxx b/src/NMTTools/NMTTools_PaveFiller_3.cxx index 039cbbc1b..e1061d1e3 100644 --- a/src/NMTTools/NMTTools_PaveFiller_3.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_3.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller_3.cxx -// Created: Mon Dec 8 16:06:56 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_PaveFiller_3.cxx +// Created: Mon Dec 8 16:06:56 2003 +// Author: Peter KURNEV +// // -#include +#include #include #include @@ -39,19 +40,18 @@ #include #include #include +#include -// Modified Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN static Standard_Boolean Contains(const TopoDS_Face& aF, - const TopoDS_Vertex& aV); -// Contribution of Samtech www.samcef.com END + const TopoDS_Vertex& aV); + //======================================================================= // function: PerformVF -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PerformVF() + void NMTTools_PaveFiller::PerformVF() { myIsDone=Standard_False; // @@ -63,7 +63,7 @@ static // BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences(); // - // V/E Interferences + // V/E Interferences myDSIt->Initialize(TopAbs_VERTEX, TopAbs_FACE); // // BlockLength correction @@ -80,63 +80,63 @@ static aWhat=n1; // Vertex aWith=n2; // Face if (myDS->GetShapeType(n1)==TopAbs_FACE) { - aWhat=n2; - aWith=n1; + aWhat=n2; + aWith=n1; } // iSDV=FindSDVertex(aWhat); - // + // if(aJustAdd) { - //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); - continue; + //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); + continue; } // aV1=TopoDS::Vertex(myDS->Shape(aWhat)); if (iSDV) { - aV1=TopoDS::Vertex(myDS->Shape(iSDV)); + aV1=TopoDS::Vertex(myDS->Shape(iSDV)); } - // + // aF2=TopoDS::Face(myDS->Shape(aWith)); // - // Modified Thu Sep 14 14:35:18 2006 + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN if (Contains(aF2, aV1)) { - continue; + continue; } // Contribution of Samtech www.samcef.com END // - aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + aFlag=myContext->ComputeVS (aV1, aF2, aU, aV); // if (!aFlag) { - // - // Add Interference to the Pool - BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV); - anIndexIn=aVSs.Append(anInterf); - // - // SetState for Vertex in DS; - myDS->SetState (aWhat, BooleanOperations_ON); - // Insert Vertex in Interference Object - BOPTools_VSInterference& aVS=aVSs(anIndexIn); - aVS.SetNewShape(aWhat); - // qqf - { - myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VF); - } - // qqt + // + // Add Interference to the Pool + BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV); + anIndexIn=aVSs.Append(anInterf); + // + // SetState for Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VSInterference& aVS=aVSs(anIndexIn); + aVS.SetNewShape(aWhat); + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VF); + } + // qqt } //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); } } myIsDone=Standard_True; } -// Modified Thu Sep 14 14:35:18 2006 +// Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= //function : Contains -//purpose : +//purpose : //======================================================================= Standard_Boolean Contains(const TopoDS_Face& aF, - const TopoDS_Vertex& aV) + const TopoDS_Vertex& aV) { Standard_Boolean bRet; TopExp_Explorer aExp; diff --git a/src/NMTTools/NMTTools_PaveFiller_4.cxx b/src/NMTTools/NMTTools_PaveFiller_4.cxx index f16ced3ab..188676c70 100644 --- a/src/NMTTools/NMTTools_PaveFiller_4.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_4.cxx @@ -1,31 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: NMTTools_PaveFiller_4.cxx -// Created: Mon Dec 8 17:08:58 2003 -// Author: Peter KURNEV -// -// -#include +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File: NMTTools_PaveFiller_4.cxx +// Created: Mon Dec 8 17:08:58 2003 +// Author: Peter KURNEV + +#include + #include #include @@ -33,6 +32,8 @@ #include #include +#include + #include #include #include @@ -63,6 +64,8 @@ #include #include #include +#include +#include #include #include @@ -98,53 +101,51 @@ #include #include -// Modified Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN #include #include #include #include #include -// Contribution of Samtech www.samcef.com END -// -// - +#include +#include static void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI, - TopTools_DataMapOfShapeListOfShape& myImages, - TopTools_DataMapOfShapeShape& myOrigins); + TopTools_DataMapOfShapeListOfShape& myImages, + TopTools_DataMapOfShapeShape& myOrigins); static - void MakeNewVertex(const TopTools_ListOfShape& aLV, - TopoDS_Vertex& aNewVertex); + void MakeNewVertex(const TopTools_ListOfShape& aLV, + TopoDS_Vertex& aNewVertex); - -static +static void VertexParameters(const IntTools_CommonPrt& aCPart, - Standard_Real& aT1, - Standard_Real& aT2); + Standard_Real& aT1, + Standard_Real& aT2); + static Standard_Boolean IsOnPave(const Standard_Real& aT1, - const IntTools_Range& aRange, - const Standard_Real& aTolerance); -static - void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB); + const IntTools_Range& aRange, + const Standard_Real& aTolerance); + +// static +// void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB); static void ProcessBlock(const BOPTools_PaveBlock& aPB, - const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, - BOPTools_IMapOfPaveBlock& aProcessedBlocks, - BOPTools_IMapOfPaveBlock& aChain); + const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, + BOPTools_IMapOfPaveBlock& aProcessedBlocks, + BOPTools_IMapOfPaveBlock& aChain); + static void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, - NMTTools_ListOfCommonBlock& aLCB); + NMTTools_ListOfCommonBlock& aLCB); //======================================================================= // function: PerformEE -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PerformEE() +void NMTTools_PaveFiller::PerformEE() { myIsDone=Standard_False; // @@ -154,7 +155,7 @@ static Standard_Integer aNbLPB1, aNbLPB2; Standard_Real aTolE1, aTolE2, aDeflection=0.01; BOPTools_ListIteratorOfListOfPaveBlock anIt1, anIt2; - TopoDS_Edge aEWhat, aEWith; + TopoDS_Edge aEWhat, aEWith; TopoDS_Vertex aNewVertex; BooleanOperations_IndexedDataMapOfShapeInteger aMapVI; BOPTools_IDMapOfPaveBlockIMapOfPaveBlock aMapCB; @@ -173,22 +174,15 @@ static for (; myDSIt->More(); myDSIt->Next()) { myDSIt->Current(n1, n2, bJustAdd); anIndexIn = 0; - // - //if (myIntrPool->IsComputed(n1, n2)) { - // continue; - //} - // - nE1=n1; - nE2=n2; + nE1=n1; + nE2=n2; // if(bJustAdd) { - //myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn); continue; } // const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));//mpv const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv - // if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){ continue; @@ -200,12 +194,12 @@ static BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1)); BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2)); // - // Modified Thu Sep 14 14:35:18 2006 + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN aNbLPB1=aLPB1.Extent(); aNbLPB2=aLPB2.Extent(); - - //if (aE1.IsSame(aE2) && aNbLPB1==1 && aNbLPB2==1) { + // + //if (aE1.IsSame(aE2) && aNbLPB1==1 && aNbLPB2==1) { // continue; //} // Contribution of Samtech www.samcef.com END @@ -218,225 +212,311 @@ static const Bnd_Box& aBB1=aShrunkRange1.BndBox(); // for (anIt2.Initialize(aLPB2); anIt2.More(); anIt2.Next()) { - BOPTools_PaveBlock& aPB2=anIt2.Value(); - const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange(); - - const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange(); - const Bnd_Box& aBB2=aShrunkRange2.BndBox(); - // - if (aBB1.IsOut (aBB2)) { - continue; - } - // - // EE - IntTools_EdgeEdge aEE; - aEE.SetEdge1 (aE1); - aEE.SetEdge2 (aE2); - aEE.SetTolerance1 (aTolE1); - aEE.SetTolerance2 (aTolE2); - aEE.SetDiscretize (aDiscretize); - aEE.SetDeflection (aDeflection); - // - IntTools_Range anewSR1 = aSR1; - IntTools_Range anewSR2 = aSR2; - // - BOPTools_Tools::CorrectRange (aE1, aE2, aSR1, anewSR1); - BOPTools_Tools::CorrectRange (aE2, aE1, aSR2, anewSR2); - // - aEE.SetRange1(anewSR1); - aEE.SetRange2(anewSR2); - - aEE.Perform(); - // - anIndexIn=0; - // - if (aEE.IsDone()) { - // reverse order if it is necessary - aEWhat=aE1; - aEWith=aE2; - aWhat=nE1; - aWith=nE2; - if (aEE.Order()) { - aTmp=aWhat; - aWhat=aWith; - aWith=aTmp; - aEWhat=aE2; - aEWith=aE1; - } - // - const IntTools_SequenceOfCommonPrts& aCPrts=aEE.CommonParts(); - aNbCPrts=aCPrts.Length(); - for (i=1; i<=aNbCPrts; i++) { - const IntTools_CommonPrt& aCPart=aCPrts(i); - const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2(); - // - anIndexIn=0; - // - TopAbs_ShapeEnum aType=aCPart.Type(); - switch (aType) { - case TopAbs_VERTEX: { - Standard_Real aT1, aT2, aTol=Precision::PConfusion(); - Standard_Boolean bIsOnPave1, bIsOnPave2; - IntTools_Range aR1, aR2; - // - VertexParameters(aCPart, aT1, aT2); - // - //decide to keep the pave or not - aR1 = (aEE.Order()) ? anewSR2 : anewSR1; - aR2 = (aEE.Order()) ? anewSR1 : anewSR2; - // - bIsOnPave1=IsOnPave(aT1, aR1, aTol); - bIsOnPave2=IsOnPave(aT2, aR2, aTol); - // - if(bIsOnPave1 || bIsOnPave2) { - continue; - } - // - BOPTools_Tools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aNewVertex); - // - //modified by NIZNHY-PKV Mon Jun 19 11:40:09 2007f - { - Standard_Integer nV11, nV12, nV21, nV22, nVS[2], k, j, iFound; - Standard_Real aTolVx, aTolVnew, aD2, aDT2; - TColStd_MapOfInteger aMV; - gp_Pnt aPnew, aPx; - // - iFound=0; - j=-1; - nV11=aPB1.Pave1().Index(); - nV12=aPB1.Pave2().Index(); - nV21=aPB2.Pave1().Index(); - nV22=aPB2.Pave2().Index(); - aMV.Add(nV11); - aMV.Add(nV12); - // - if (aMV.Contains(nV21)) { - ++j; - nVS[j]=nV21; - } - if (aMV.Contains(nV22)) { - ++j; - nVS[j]=nV22; - } - // - aTolVnew=BRep_Tool::Tolerance(aNewVertex); - aPnew=BRep_Tool::Pnt(aNewVertex); - // - for (k=0; k<=j; ++k) { - const TopoDS_Vertex& aVx=TopoDS::Vertex(myDS->Shape(nVS[k])); - aTolVx=BRep_Tool::Tolerance(aVx); - aPx=BRep_Tool::Pnt(aVx); - aD2=aPnew.SquareDistance(aPx); - // - aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx); - // - if (aD2Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); - } - // qqt - // - // Collect - aMapVI.Add(aNewVertex, anIndexIn); - } - break; - - case TopAbs_EDGE: { - Standard_Integer aNbComPrt2; - Standard_Boolean aCoinsideFlag; - // - aNbComPrt2=aRanges2.Length(); - aCoinsideFlag=IsBlocksCoinside(aPB1, aPB2); - // - if (aNbComPrt2>1 || !aCoinsideFlag) { - //myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); - break; - } - // - // Fill aMapCB - if (aMapCB.Contains(aPB1)) { - BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB1); - aMapPB.Add(aPB1); - aMapPB.Add(aPB2); - } - else { - BOPTools_IMapOfPaveBlock aMapPB; - aMapPB.Add(aPB1); - aMapPB.Add(aPB2); - aMapCB.Add(aPB1, aMapPB); - } - // - if (aMapCB.Contains(aPB2)) { - BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB2); - aMapPB.Add(aPB1); - aMapPB.Add(aPB2); - } - else { - BOPTools_IMapOfPaveBlock aMapPB; - aMapPB.Add(aPB1); - aMapPB.Add(aPB2); - aMapCB.Add(aPB2, aMapPB); - } - // qqf - { - myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); - } - // qqt - } - break; - default: - break; - } // switch (aType) - } // for (i=1; i<=aNbCPrts; i++) - }// if (aEE.IsDone()) - } // for (; anIt2.More(); anIt2.Next()) - } // for (; anIt1.More(); anIt1.Next()) - }// for (; myDSIt.More(); myDSIt.Next()) - // - EENewVertices (aMapVI); - EECommonBlocks(aMapCB); - // Modified to invoke new nethod Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN + BOPTools_PaveBlock& aPB2=anIt2.Value(); + const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange(); + // + const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange(); + const Bnd_Box& aBB2=aShrunkRange2.BndBox(); + // + if (aBB1.IsOut (aBB2)) { + continue; + } + // + // EE + IntTools_EdgeEdge aEE; + aEE.SetEdge1 (aE1); + aEE.SetEdge2 (aE2); + aEE.SetTolerance1 (aTolE1); + aEE.SetTolerance2 (aTolE2); + aEE.SetDiscretize (aDiscretize); + aEE.SetDeflection (aDeflection); + // + IntTools_Range anewSR1 = aSR1; + IntTools_Range anewSR2 = aSR2; + // + BOPTools_Tools::CorrectRange (aE1, aE2, aSR1, anewSR1); + BOPTools_Tools::CorrectRange (aE2, aE1, aSR2, anewSR2); + // + aEE.SetRange1(anewSR1); + aEE.SetRange2(anewSR2); + // + aEE.Perform(); + // + anIndexIn=0; + // + if (aEE.IsDone()) { + // reverse order if it is necessary + aEWhat=aE1; + aEWith=aE2; + aWhat=nE1; + aWith=nE2; + if (aEE.Order()) { + aTmp=aWhat; + aWhat=aWith; + aWith=aTmp; + aEWhat=aE2; + aEWith=aE1; + } + // + const IntTools_SequenceOfCommonPrts& aCPrts=aEE.CommonParts(); + aNbCPrts=aCPrts.Length(); + for (i=1; i<=aNbCPrts; i++) { + const IntTools_CommonPrt& aCPart=aCPrts(i); + const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2(); + // + anIndexIn=0; + // + TopAbs_ShapeEnum aType=aCPart.Type(); + switch (aType) { + case TopAbs_VERTEX: { + Standard_Real aT1, aT2, aTol=Precision::PConfusion(); + Standard_Boolean bIsOnPave1, bIsOnPave2; + IntTools_Range aR1, aR2; + // + VertexParameters(aCPart, aT1, aT2); + // + //decide to keep the pave or not + aR1 = (aEE.Order()) ? anewSR2 : anewSR1; + aR2 = (aEE.Order()) ? anewSR1 : anewSR2; + // + aTol=0.8*aTol; + bIsOnPave1=IsOnPave(aT1, aR1, aTol); + bIsOnPave2=IsOnPave(aT2, aR2, aTol); + // + if(bIsOnPave1 || bIsOnPave2) { + continue; + } + // + BOPTools_Tools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aNewVertex); + // + { + Standard_Integer nV11, nV12, nV21, nV22, nVS[2], k, j, iFound; + Standard_Real aTolVx, aTolVnew, aD2, aDT2; + TColStd_MapOfInteger aMV; + gp_Pnt aPnew, aPx; + // + iFound=0; + j=-1; + nV11=aPB1.Pave1().Index(); + nV12=aPB1.Pave2().Index(); + nV21=aPB2.Pave1().Index(); + nV22=aPB2.Pave2().Index(); + aMV.Add(nV11); + aMV.Add(nV12); + // + if (aMV.Contains(nV21)) { + ++j; + nVS[j]=nV21; + } + if (aMV.Contains(nV22)) { + ++j; + nVS[j]=nV22; + } + // + aTolVnew=BRep_Tool::Tolerance(aNewVertex); + aPnew=BRep_Tool::Pnt(aNewVertex); + // + for (k=0; k<=j; ++k) { + const TopoDS_Vertex& aVx=TopoDS::Vertex(myDS->Shape(nVS[k])); + aTolVx=BRep_Tool::Tolerance(aVx); + aPx=BRep_Tool::Pnt(aVx); + aD2=aPnew.SquareDistance(aPx); + // + aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx); + // + if (aD2Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); + } + // qqt + // + // Collect + aMapVI.Add(aNewVertex, anIndexIn); + } + break; + + case TopAbs_EDGE: { + Standard_Integer aNbComPrt2; + Standard_Boolean aCoinsideFlag; + // + aNbComPrt2=aRanges2.Length(); + aCoinsideFlag=IsBlocksCoinside(aPB1, aPB2); + // + if (aNbComPrt2>1 || !aCoinsideFlag) { + break; + } + // + // Fill aMapCB + if (aMapCB.Contains(aPB1)) { + BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB1); + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + } + else { + BOPTools_IMapOfPaveBlock aMapPB; + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + aMapCB.Add(aPB1, aMapPB); + } + // + if (aMapCB.Contains(aPB2)) { + BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB2); + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + } + else { + BOPTools_IMapOfPaveBlock aMapPB; + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + aMapCB.Add(aPB2, aMapPB); + } + // qqf + { + myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_EE); + } + // qqt + } + break; + default: + break; + } // switch (aType) + } // for (i=1; i<=aNbCPrts; i++) + }// if (aEE.IsDone()) + } // for (; anIt2.More(); anIt2.Next()) + } // for (; anIt1.More(); anIt1.Next()) + }// for (; myDSIt.More(); myDSIt.Next()) + // + { + NMTTools_ListOfCommonBlock aLCB; + // + FindChains(aMapCB, aLCB); + EENewVertices (aMapVI); + //TreatPaveBlocks(*this, aLCB); + TreatPaveBlocks(aLCB); + ReplaceCommonBlocks(aLCB); + } + // PerformVF1(); - // Contribution of Samtech www.samcef.com BEGIN + // myIsDone=Standard_True; } + +//======================================================================= +// function:TreatPaveBlocks +// purpose: +//======================================================================= +void NMTTools_PaveFiller::TreatPaveBlocks (NMTTools_ListOfCommonBlock& theLCB) +{ + Standard_Boolean bFound; + Standard_Integer nE, nV, nVp, iFlag; + Standard_Real aT; + TColStd_MapOfInteger aMI; + TColStd_MapIteratorOfMapOfInteger aItMI; + NMTTools_ListIteratorOfListOfCommonBlock aItLCB; + BOPTools_ListIteratorOfListOfPaveBlock aItLPB; + BOPTools_ListIteratorOfListOfPave aItLP; + // + aItLCB.Initialize(theLCB); + for (; aItLCB.More(); aItLCB.Next()) { + const NMTTools_CommonBlock& aCB=aItLCB.Value(); + // + aMI.Clear(); + const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); + // + // 1 -> aMI + aItLPB.Initialize(aLPB); + for (; aItLPB.More(); aItLPB.Next()) { + const BOPTools_PaveBlock& aPB=aItLPB.Value(); + nE=aPB.OriginalEdge(); + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + BOPTools_ListOfPave& aLP=aPaveSet.ChangeSet(); + // + aItLP.Initialize(aLP); + for (; aItLP.More(); aItLP.Next()) { + const BOPTools_Pave& aPave=aItLP.Value(); + nV=aPave.Index(); + aMI.Add(nV); + } + }//for (; anItLPB.More(); anItLPB.Next()) { + // + // 2 + aItLPB.Initialize(aLPB); + for (; aItLPB.More(); aItLPB.Next()) { + const BOPTools_PaveBlock& aPB=aItLPB.Value(); + nE=aPB.OriginalEdge(); + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + BOPTools_ListOfPave& aLP=aPaveSet.ChangeSet(); + // + aItMI.Initialize(aMI); + for (; aItMI.More(); aItMI.Next()) { + nV=aItMI.Key(); + bFound=Standard_False; + aItLP.Initialize(aLP); + for (; aItLP.More(); aItLP.Next()) { + const BOPTools_Pave& aPave=aItLP.Value(); + nVp=aPave.Index(); + if (nVp==nV) { + bFound=!bFound; + break; + } + } + // + if (!bFound) { + // Append Pave of nV to rhe edge nE + const TopoDS_Edge& aE=*(TopoDS_Edge*)(&myDS->Shape(nE)); + const TopoDS_Vertex& aV= *(TopoDS_Vertex*)(&myDS->Shape(nV)); + iFlag=myContext->ComputeVE (aV, aE, aT); + if (!iFlag) { + BOPTools_Pave aPave; + // + aPave.SetInterference(-1); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(nV); + aPave.SetParam(aT); + aPaveSet.Append(aPave); + } + } + }//for (; aItMI.More(); aItMI.Next()) { + }//for (; anItLPB.More(); anItLPB.Next()) { + } +} + //======================================================================= // function:EECommonBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB) +void NMTTools_PaveFiller::EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB) { NMTTools_ListOfCommonBlock aLCB; // FindChains(aMapCB, aLCB); ReplaceCommonBlocks(aLCB); } + //======================================================================= // function:EENewVertices -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) { Standard_Integer aNb, aNbVSD, nVnew, nIEE, nE[2], j, iFlag; Standard_Real aT; - TopoDS_Edge aE; + TopoDS_Edge aE; TopTools_DataMapOfShapeListOfShape myImages; TopTools_DataMapOfShapeShape myOrigins; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; @@ -448,11 +528,11 @@ static BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); // aNb=aMapVI.Extent(); - if (!aNb) { // no new vertices, no new problems + if (!aNb) { // no new vertices, no new problems return; } // - // 0. + // 0. if (aNb==1) { TopoDS_Vertex aV1=TopoDS::Vertex(aMapVI.FindKey(1)); EENewVertices(aV1, aMapVI); @@ -488,19 +568,19 @@ static aEE.SetNewShape(nVnew); // for (j=0; j<2; ++j) { - if (aMFence.Add(nE[j])) { - aE=TopoDS::Edge(myDS->Shape(nE[j])); - iFlag=myContext.ComputeVE (aVnew, aE, aT); - if (!iFlag) { - aPave.SetInterference(-1); - aPave.SetType (BooleanOperations_EdgeEdge); - aPave.SetIndex(nVnew); - aPave.SetParam(aT); - // - BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE[j])); - aPaveSet.Append(aPave); - } - }// if (aMFence.Add(nE[j])) { + if (aMFence.Add(nE[j])) { + aE=TopoDS::Edge(myDS->Shape(nE[j])); + iFlag=myContext->ComputeVE (aVnew, aE, aT); + if (!iFlag) { + aPave.SetInterference(-1); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(nVnew); + aPave.SetParam(aT); + // + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE[j])); + aPaveSet.Append(aPave); + } + }// if (aMFence.Add(nE[j])) { }// for (j=0; j<2; ++j) { }//for (; aIt.More(); aIt.Next()) { }// for (; aItIm.More(); aItIm.Next()) @@ -510,11 +590,11 @@ static // completely rewritten //======================================================================= //function : TreatNewVertices -//purpose : +//purpose : //======================================================================= void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI, - TopTools_DataMapOfShapeListOfShape& myImages, - TopTools_DataMapOfShapeShape& myOrigins) + TopTools_DataMapOfShapeListOfShape& myImages, + TopTools_DataMapOfShapeShape& myOrigins) { Standard_Integer j, i, aNbV, aNbVSD; Standard_Real aTol; @@ -546,13 +626,13 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap Bnd_Box aBox; // aTol=BRep_Tool::Tolerance(TopoDS::Vertex(aV)); - aBox.SetGap(aTol); + aBox.SetGap(aTol); BRepBndLib::Add(aV, aBox); // aTreeFiller.Add(i, aBox); // aMIS.Add(i, aV); - aMSB.Add(aV, aBox); + aMSB.Add(aV, aBox); } // aTreeFiller.Fill(); @@ -575,49 +655,49 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap aNbIP=aMIP.Extent(); aIt1.Initialize(aMIP); for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); - if (aMIPC.Contains(aIP)) { - continue; - } - // - const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); - const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); - // - aSelector.Clear(); - aSelector.SetBox(aBoxVP); - // - aNbVSD=aBBTree.Select(aSelector); - if (!aNbVSD) { - continue; // it must not be - } - // - const TColStd_ListOfInteger& aLI=aSelector.Indices(); - aIt.Initialize(aLI); - for (; aIt.More(); aIt.Next()) { - aIP1=aIt.Value(); - if (aMIP.Contains(aIP1)) { - continue; - } - aMIP1.Add(aIP1); - } //for (; aIt.More(); aIt.Next()) { + aIP=aIt1.Key(); + if (aMIPC.Contains(aIP)) { + continue; + } + // + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); + // + aSelector.Clear(); + aSelector.SetBox(aBoxVP); + // + aNbVSD=aBBTree.Select(aSelector); + if (!aNbVSD) { + continue; // it must not be + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + aIP1=aIt.Value(); + if (aMIP.Contains(aIP1)) { + continue; + } + aMIP1.Add(aIP1); + } //for (; aIt.More(); aIt.Next()) { }//for(; aIt1.More(); aIt1.Next()) { // aNbIP1=aMIP1.Extent(); if (!aNbIP1) { - break; // from while(1) + break; // from while(1) } // aIt1.Initialize(aMIP); for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); - aMIPC.Add(aIP); + aIP=aIt1.Key(); + aMIPC.Add(aIP); } // aMIP.Clear(); aIt1.Initialize(aMIP1); for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); - aMIP.Add(aIP); + aIP=aIt1.Key(); + aMIP.Add(aIP); } aMIP1.Clear(); }// while(1) @@ -632,7 +712,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap aIP=aIt1.Key(); const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); if (!j) { - aVF=aVP; + aVF=aVP; } aLVSD.Append(aVP); aMVProcessed.Add(aVP); @@ -680,18 +760,18 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap for (; aItS.More(); aItS.Next()) { const TopoDS_Shape& aVSD=aItS.Value(); if (!myOrigins.IsBound(aVSD)) { - myOrigins.Bind(aVSD, aV); + myOrigins.Bind(aVSD, aV); } } } } -// + //======================================================================= //function : MakeNewVertex -//purpose : +//purpose : //======================================================================= -void MakeNewVertex(const TopTools_ListOfShape& aLV, - TopoDS_Vertex& aNewVertex) +void MakeNewVertex(const TopTools_ListOfShape& aLV, + TopoDS_Vertex& aNewVertex) { Standard_Integer aNbV; Standard_Real aTolV, aD, aDmax; @@ -732,16 +812,17 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, // aBB.MakeVertex (aNewVertex, aPGC, aDmax); } + //======================================================================= // function:EENewVertices -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, - const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, + const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) { Standard_Integer i, aNewShape, nE1, nE2; Standard_Real aT1, aT2; - BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; BOPTools_Pave aPave; // BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); @@ -774,11 +855,12 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); aPaveSet2.Append(aPave); } + //======================================================================= // function: RefinePavePool -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::RefinePavePool() +void NMTTools_PaveFiller::RefinePavePool() { Standard_Integer i, aNbNew; @@ -792,34 +874,35 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, // aNbNew=aNewLP.Extent(); if (aNbNew) { - BOPTools_ListIteratorOfListOfPave anIt(aNewLP); - for (; anIt.More(); anIt.Next()) { - const BOPTools_Pave& aPave=anIt.Value(); - aPS.Append(aPave); - } - // Clear the ListOfPaveBlock - BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(i)); - aLPB.Clear(); - // Prepare the paveBlocks for that egde again - PreparePaveBlocks(i); + BOPTools_ListIteratorOfListOfPave anIt(aNewLP); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Pave& aPave=anIt.Value(); + aPS.Append(aPave); + } + // Clear the ListOfPaveBlock + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(i)); + aLPB.Clear(); + // Prepare the paveBlocks for that egde again + PreparePaveBlocks(i); } aNewLP.Clear(); } } } + //======================================================================= // function: PreparePaveBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, - const TopAbs_ShapeEnum aType2) +void NMTTools_PaveFiller::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) { myIsDone=Standard_False; // Standard_Boolean bOk1, bOk2, bOk3, bFlag; Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits; TColStd_MapOfInteger aMap; - + // bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; @@ -833,10 +916,10 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, for (; myDSIt->More(); myDSIt->Next()) { myDSIt->Current(n1, n2, bFlag); // - nE[0]=n1; - nE[1]=n2; + nE[0]=n1; + nE[1]=n2; if (myDS->GetShapeType(n1)!=TopAbs_EDGE) { - nE[0]=n2; + nE[0]=n2; nE[1]=n1; } // @@ -844,22 +927,23 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE[i])); aNbSplits=aLPB.Extent(); if (!aNbSplits) { - if (aMap.Add(nE[i])) { - PreparePaveBlocks(nE[i]); - if (!myIsDone) { - return; - } - } + if (aMap.Add(nE[i])) { + PreparePaveBlocks(nE[i]); + if (!myIsDone) { + return; + } + } } } - }// for (; myDSIt.More(); myDSIt.Next()) + }// for (; myDSIt.More(); myDSIt.Next()) myIsDone=Standard_True; } + //======================================================================= // function: PreparePaveBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE) +void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE) { myIsDone=Standard_False; // @@ -869,7 +953,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, TopoDS_Vertex aV1, aV2; // BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); - // Edge + // Edge aE=TopoDS::Edge(myDS->Shape(nE)); if (BRep_Tool::Degenerated(aE)) { myIsDone=Standard_True; @@ -877,7 +961,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, } // BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); - + // BOPTools_PaveBlockIterator aPBIt(nE, aPS); for (; aPBIt.More(); aPBIt.Next()) { BOPTools_PaveBlock& aPB=aPBIt.Value(); @@ -898,13 +982,13 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE); BOPTColStd_Dump::PrintMessage(buf); sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); - throw - BOPTColStd_Failure(buf) ; + throw + BOPTColStd_Failure(buf) ; } // if (iErr==6) { sprintf(buf, - "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); + "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); BOPTColStd_Dump::PrintMessage(buf); } else { @@ -915,16 +999,17 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, // aPB.SetShrunkRange(aSR); aLPB.Append(aPB); - } //for (; aPBIt.More(); aPBIt.Next()) + } //for (; aPBIt.More(); aPBIt.Next()) myIsDone=Standard_True; } + //======================================================================= // function: CorrectShrunkRanges -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::CorrectShrunkRanges(const Standard_Integer aSide, - const BOPTools_Pave& aPave, - IntTools_ShrunkRange& aShrunkRange) +void NMTTools_PaveFiller::CorrectShrunkRanges(const Standard_Integer aSide, + const BOPTools_Pave& aPave, + IntTools_ShrunkRange& aShrunkRange) { BooleanOperations_KindOfInterference aType; Standard_Integer anIndexInterf ; @@ -949,7 +1034,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, const IntTools_Range& aSR=aShrunkRange.ShrunkRange(); const TopoDS_Edge& aE=aShrunkRange.Edge(); - + IntTools_Range aNewRange; IntTools_Range aCPRange; @@ -971,11 +1056,8 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, tNV=tV+aCoeff*(tNV-tV); aNewRange.SetFirst(tNV); aNewRange.SetLast (aSR.Last()); - //modified by NIZNHY-PKV Tue Jan 23 14:07:55 2007f - //if(aNewRange.First() > aNewRange.Last()) { if(aNewRange.First() < aNewRange.Last()) { - //modified by NIZNHY-PKV Tue Jan 23 14:08:02 2007t - aShrunkRange.SetShrunkRange(aNewRange); + aShrunkRange.SetShrunkRange(aNewRange); } } } @@ -987,18 +1069,18 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, aNewRange.SetLast (tNV); if(aNewRange.First() < aNewRange.Last()) { - aShrunkRange.SetShrunkRange(aNewRange); + aShrunkRange.SetShrunkRange(aNewRange); } } } } + //======================================================================= // function: IsBlocksCoinside -// purpose: +// purpose: //======================================================================= - Standard_Boolean - NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1, - const BOPTools_PaveBlock& aPB2) const +Standard_Boolean NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1, + const BOPTools_PaveBlock& aPB2) const { Standard_Boolean bRetFlag=Standard_True; Standard_Real aTolV11, aTolV12, aTolV21, aTolV22; @@ -1014,7 +1096,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, aTolV12=BRep_Tool::Tolerance(aV12); aTolV21=BRep_Tool::Tolerance(aV21); aTolV22=BRep_Tool::Tolerance(aV22); - + aP11=BRep_Tool::Pnt(aV11); aP12=BRep_Tool::Pnt(aV12); aP21=BRep_Tool::Pnt(aV21); @@ -1041,20 +1123,22 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, } return !bRetFlag; } + //======================================================================= // function: ReplaceCommonBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) +void NMTTools_PaveFiller::ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) { RemoveCommonBlocks(aLCB); SplitCommonBlocks(aLCB); } + //======================================================================= // function: SplitCommonBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) +void NMTTools_PaveFiller::SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) { Standard_Integer nE; NMTTools_ListOfCommonBlock aLCBx; @@ -1077,17 +1161,17 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, // anItLPE.Initialize(aLPBx); for (; anItLPE.More(); anItLPE.Next()) { - const BOPTools_PaveBlock& aPBx=anItLPE.Value(); - nE=aPBx.OriginalEdge(); - NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE)); - aLCBE.Append(aCBx); + const BOPTools_PaveBlock& aPBx=anItLPE.Value(); + nE=aPBx.OriginalEdge(); + NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE)); + aLCBE.Append(aCBx); } } } - // Modified to provide the order of edges - // in common block where the edge with max + // Modified to provide the order of edges + // in common block where the edge with max // tolerance value will be the first - // Thu Sep 14 14:35:18 2006 + // Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN Standard_Integer i, iMax, aNb, aNbCB, nSp; Standard_Real aTolSp, aTolMax; @@ -1108,33 +1192,33 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, // anIt.Initialize(aLCBE); for (; anIt.More(); anIt.Next()) { - NMTTools_CommonBlock& aCBE=anIt.Value(); + NMTTools_CommonBlock& aCBE=anIt.ChangeValue(); const BOPTools_ListOfPaveBlock& aLPBE=aCBE.PaveBlocks(); // aTolMax=-1.; anItLPE.Initialize(aLPBE); for (i=0; anItLPE.More(); anItLPE.Next(), ++i) { - const BOPTools_PaveBlock& aPB=anItLPE.Value(); - nSp=aPB.OriginalEdge(); - const TopoDS_Edge& aSp=TopoDS::Edge(myDS->Shape(nSp)); - aTolSp=BRep_Tool::Tolerance(aSp); - if (aTolSp>aTolMax) { - iMax=i; - aTolSp=aTolMax; - } + const BOPTools_PaveBlock& aPB=anItLPE.Value(); + nSp=aPB.OriginalEdge(); + const TopoDS_Edge& aSp=TopoDS::Edge(myDS->Shape(nSp)); + aTolSp=BRep_Tool::Tolerance(aSp); + if (aTolSp>aTolMax) { + iMax=i; + aTolSp=aTolMax; + } } // BOPTools_ListOfPaveBlock aLPBx; // anItLPE.Initialize(aLPBE); for (i=0; anItLPE.More(); anItLPE.Next(), ++i) { - const BOPTools_PaveBlock& aPB=anItLPE.Value(); - if (i==iMax) { - aLPBx.Prepend(aPB); - } - else { - aLPBx.Append(aPB); - } + const BOPTools_PaveBlock& aPB=anItLPE.Value(); + if (i==iMax) { + aLPBx.Prepend(aPB); + } + else { + aLPBx.Append(aPB); + } } // pLPBE=(BOPTools_ListOfPaveBlock *)&aLPBE; @@ -1144,11 +1228,12 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, }//for (nE=1; nE<=aNb; ++nE) { // Contribution of Samtech www.samcef.com END } + //======================================================================= // function: RemoveCommonBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) +void NMTTools_PaveFiller::RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) { Standard_Integer nE; NMTTools_ListOfCommonBlock aLCBx; @@ -1160,7 +1245,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, const NMTTools_CommonBlock& aCB=anItCB.Value(); const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); // - // Remove aCB from each edge + // Remove aCB from each edge anItLPB.Initialize(aLPB); for (; anItLPB.More(); anItLPB.Next()) { const BOPTools_PaveBlock& aPB=anItLPB.Value(); @@ -1169,33 +1254,34 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE)); anItCBE.Initialize(aLCBE); for (; anItCBE.More(); anItCBE.Next()) { - const NMTTools_CommonBlock& aCBE=anItCBE.Value(); - if (aCBE.IsEqual(aCB)) { - aLCBE.Remove(anItCBE); - break; - } + const NMTTools_CommonBlock& aCBE=anItCBE.Value(); + if (aCBE.IsEqual(aCB)) { + aLCBE.Remove(anItCBE); + break; + } } } } } + //======================================================================= // function: SplitCommonBlock -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB, - NMTTools_ListOfCommonBlock& aLCBx) +void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB, + NMTTools_ListOfCommonBlock& aLCBx) { - Standard_Integer i, j, k, nE, aNbE, aNbSPBx, aNbPB; + Standard_Boolean bIsCoincided; + Standard_Integer i, j,nE, aNbE, aNbSPBx, aNbPB, k; BOPTools_SequenceOfPaveBlock aSPBx; BOPTools_ListIteratorOfListOfPaveBlock anItLPB; BOPTools_ListIteratorOfListOfPave anIt; - - BOPTools_PaveBlockIterator anPBIt; + BOPTools_PaveBlockIterator anPBIt; // const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); aNbE=aLPB.Extent(); // - // 1. Whether we realy need to split the common block ? + // 1. Checking: Whether we realy need to split the common block ? anItLPB.Initialize(aLPB); for (; anItLPB.More(); anItLPB.Next()) { const BOPTools_PaveBlock& aPB=anItLPB.Value(); @@ -1210,7 +1296,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, for (; anIt.More(); anIt.Next()) { const BOPTools_Pave& aPx=anIt.Value(); if (aPB.IsInBlock(aPx)) { - aPSx.Append(aPx); + aPSx.Append(aPx); } } aNbPB=aPSx.Set().Extent(); @@ -1247,7 +1333,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, for (; anIt.More(); anIt.Next()) { const BOPTools_Pave& aPx=anIt.Value(); if (aPB.IsInBlock(aPx)) { - aPSx.Append(aPx); + aPSx.Append(aPx); } } // @@ -1259,21 +1345,44 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, } } // - // 3. Do new common blocks + // 3. Do new common blocks // const TColStd_ListOfInteger& aLF=aCB.Faces(); aNbSPBx=aSPBx.Length(); aNbPB=aNbSPBx/aNbE; // + Standard_Integer k1, k2, n11, n12, n21, n22; + // for (i=1; i<=aNbPB; ++i) { NMTTools_CommonBlock aCBx; // aCBx.AddFaces(aLF); // - for (j=1; j<=aNbE; ++j) { - k=i+(j-1)*aNbPB; - const BOPTools_PaveBlock& aPB=aSPBx(k); - aCBx.AddPaveBlock(aPB); + const BOPTools_PaveBlock& aPB1=aSPBx(i); + n11=aPB1.Pave1().Index(); + n12=aPB1.Pave2().Index(); + // + aCBx.AddPaveBlock(aPB1); + // + for (j=2; j<=aNbE; ++j) { + k1=(j-1)*aNbPB+1; + k2=k1+aNbPB-1; + for(k=k1; k<=k2; ++k) { + const BOPTools_PaveBlock& aPB2=aSPBx(k); + n21=aPB2.Pave1().Index(); + n22=aPB2.Pave2().Index(); + if ((n21==n11 && n22==n12) || (n21==n12 && n22==n11)) { + //modified by NIZNHY-PKV Thu Nov 11 08:13:24 2010f + bIsCoincided=CheckCoincidence(aPB2, aPB1); + if (bIsCoincided) { + aCBx.AddPaveBlock(aPB2); + break; + } + //aCBx.AddPaveBlock(aPB2); + //break; + //modified by NIZNHY-PKV Thu Nov 11 08:13:31 2010t + } + } } aLCBx.Append(aCBx); } @@ -1281,11 +1390,11 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV, //======================================================================= // function: VertexParameters -// purpose: +// purpose: //======================================================================= void VertexParameters(const IntTools_CommonPrt& aCPart, - Standard_Real& aT1, - Standard_Real& aT2) + Standard_Real& aT1, + Standard_Real& aT2) { const IntTools_Range& aR1=aCPart.Range1(); aT1=0.5*(aR1.First()+aR1.Last()); @@ -1304,13 +1413,14 @@ void VertexParameters(const IntTools_CommonPrt& aCPart, aT2 = aCPart.VertexParameter2(); } } + //======================================================================= // function: KeepPave -// purpose: +// purpose: //======================================================================= Standard_Boolean IsOnPave(const Standard_Real& aT1, - const IntTools_Range& aRange, - const Standard_Real& aTolerance) + const IntTools_Range& aRange, + const Standard_Real& aTolerance) { Standard_Boolean firstisonpave1, firstisonpave2, bIsOnPave; // @@ -1322,10 +1432,10 @@ Standard_Boolean IsOnPave(const Standard_Real& aT1, //======================================================================= // function:FindChains -// purpose: +// purpose: //======================================================================= void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, - NMTTools_ListOfCommonBlock& aLCB) + NMTTools_ListOfCommonBlock& aLCB) { Standard_Integer i, j, aNbCB, aNbPB; BOPTools_IMapOfPaveBlock aProcessedBlocks, aChain; @@ -1358,14 +1468,15 @@ void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, aChain.Clear(); } } + //======================================================================= // function:ProcessBlock -// purpose: +// purpose: //======================================================================= void ProcessBlock(const BOPTools_PaveBlock& aPB, - const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, - BOPTools_IMapOfPaveBlock& aProcessedBlocks, - BOPTools_IMapOfPaveBlock& aChain) + const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, + BOPTools_IMapOfPaveBlock& aProcessedBlocks, + BOPTools_IMapOfPaveBlock& aChain) { Standard_Integer j, aNbPB; // @@ -1384,11 +1495,11 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, } // Modified to provide VS interference between // vertex as result of EE and a Face of argument -// Thu Sep 14 14:35:18 2006 +// Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= -// function: PerformVF1 -// purpose: +// function: PerformVF1 +// purpose: //======================================================================= void NMTTools_PaveFiller::PerformVF1() { @@ -1424,7 +1535,7 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, const TopoDS_Shape& aSnew=myDS->Shape(nNewShape); if (aSnew.ShapeType()!=TopAbs_VERTEX) { continue; - } + } // const TopoDS_Vertex& aVnew=TopoDS::Vertex(aSnew); // @@ -1439,19 +1550,64 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB, const TopoDS_Face& aF=TopoDS::Face(myDS->Shape(nF)); const Bnd_Box& aBF=myDS->GetBoundingBox(nF); if (aBF.IsOut(aBV)) { - continue; + continue; } // anIndexIn=0; - aFlag=myContext.ComputeVS (aVnew, aF, aU, aV); + aFlag=myContext->ComputeVS (aVnew, aF, aU, aV); if (!aFlag) { - BOPTools_VSInterference anInterf (nNewShape, nF, aU, aV); - // - anIndexIn=aVSs.Append(anInterf); - BOPTools_VSInterference& aVS=aVSs(anIndexIn); - aVS.SetNewShape(nNewShape);//-> + BOPTools_VSInterference anInterf (nNewShape, nF, aU, aV); + // + anIndexIn=aVSs.Append(anInterf); + BOPTools_VSInterference& aVS=aVSs(anIndexIn); + aVS.SetNewShape(nNewShape);//-> } } } -} +} // Contribution of Samtech www.samcef.com END +//modified by NIZNHY-PKV Thu Nov 11 08:13:48 2010f +//======================================================================= +// function: CheckCoincidence +// purpose: +//======================================================================= +Standard_Boolean NMTTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPB1, + const BOPTools_PaveBlock& aPB2) +{ + Standard_Boolean bRet; + Standard_Integer nE1, nE2, aNbPoints; + Standard_Real aT11, aT12, aT21, aT22, aT1m, aD, aTol, aT2x; + gp_Pnt aP1m; + // + bRet=Standard_False; + // + aT11=aPB1.Pave1().Param(); + aT12=aPB1.Pave2().Param(); + aT1m=IntTools_Tools::IntermediatePoint (aT11, aT12); + nE1=aPB1.OriginalEdge(); + const TopoDS_Edge& aE1=(*(TopoDS_Edge*)(&myDS->Shape(nE1))); + BOPTools_Tools::PointOnEdge(aE1, aT1m, aP1m); + // + aT21=aPB2.Pave1().Param(); + aT22=aPB2.Pave2().Param(); + nE2=aPB2.OriginalEdge(); + const TopoDS_Edge& aE2=(*(TopoDS_Edge*)(&myDS->Shape(nE2))); + // + GeomAPI_ProjectPointOnCurve& aPPC=myContext->ProjPC(aE2); + aPPC.Perform(aP1m); + aNbPoints=aPPC.NbPoints(); + if (aNbPoints) { + aD=aPPC.LowerDistance(); + // + aTol=BRep_Tool::Tolerance(aE1); + aTol=aTol+BRep_Tool::Tolerance(aE2); + if (aDaT21 && aT2x + +// File: NMTTools_PaveFiller_5.cxx +// Created: Mon Dec 15 11:28:33 2003 +// Author: Peter KURNEV +// // -#include +#include #include @@ -48,10 +49,10 @@ #include #include #include -#include #include #include #include +#include #include #include @@ -87,17 +88,17 @@ static void VertexParameter(const IntTools_CommonPrt& aCPart, - Standard_Real& aT); + Standard_Real& aT); static Standard_Boolean IsOnPave(const Standard_Real& aTR, - const IntTools_Range& aCPRange, - const Standard_Real& aTolerance); + const IntTools_Range& aCPRange, + const Standard_Real& aTolerance); // //======================================================================= // function: PerformEF -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PerformEF() + void NMTTools_PaveFiller::PerformEF() { Standard_Boolean bJustAdd; Standard_Integer n1, n2, anIndexIn, nE, nF, aNbEFs, aBlockLength; @@ -131,10 +132,10 @@ static // anIndexIn = 0; // - nE=n1; + nE=n1; nF=n2; if (myDS->GetShapeType(n2)==TopAbs_EDGE) { - nE=n2; + nE=n2; nF=n1; } // @@ -160,8 +161,8 @@ static // aTolF=BRep_Tool::Tolerance(aF); aTolE=BRep_Tool::Tolerance(aE); - - const Bnd_Box& aBBF=myDS->GetBoundingBox(nF); + + const Bnd_Box& aBBF=myDS->GetBoundingBox(nF); // // Process each PaveBlock on edge nE BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); @@ -170,7 +171,7 @@ static for (; anIt.More(); anIt.Next()) { BOPTools_PaveBlock& aPB=anIt.Value(); if (aCBAPIF.IsCommonBlock(aPB)) { - continue; + continue; } // const IntTools_ShrunkRange& aShrunkRange=aPB.ShrunkRange(); @@ -178,9 +179,9 @@ static const Bnd_Box& aBBE=aShrunkRange.BndBox(); // if (aBBF.IsOut (aBBE)) { - continue; + continue; } - // + // // EF IntTools_EdgeFace aEF; aEF.SetEdge (aE); @@ -189,113 +190,113 @@ static aEF.SetTolF (aTolF); aEF.SetDiscretize (aDiscretize); aEF.SetDeflection (aDeflection); - // - aEF.SetContext((IntTools_PContext)&myContext); - // + // + aEF.SetContext(myContext); + // IntTools_Range anewSR = aSR; - // - // Correction of the Shrunk Range + // + // Correction of the Shrunk Range BOPTools_Tools::CorrectRange(aE, aF, aSR, anewSR); aEF.SetRange (anewSR); // aEF.Perform(); // if (aEF.IsDone()) { - Standard_Boolean bCoinsideFlag; - Standard_Integer i, aNbCPrts; - TopAbs_ShapeEnum aType; - // - const IntTools_SequenceOfCommonPrts& aCPrts=aEF.CommonParts(); - // - aNbCPrts=aCPrts.Length(); - for (i=1; i<=aNbCPrts; ++i) { - anIndexIn=0; - // - const IntTools_CommonPrt& aCPart=aCPrts(i); - aType=aCPart.Type(); - // - switch (aType) { - // - case TopAbs_VERTEX: { - Standard_Boolean bIsOnPave1, bIsOnPave2; - Standard_Integer nVF; - Standard_Real aT, aTolToDecide; - TopoDS_Vertex aNewVertex; - // - const IntTools_Range& aR=aCPart.Range1(); - // - // New Vertex - VertexParameter(aCPart, aT); - BOPTools_Tools::MakeNewVertex(aE, aT, aF, aNewVertex); - // - //decide to add pave or not - aTolToDecide=5.e-8; - bIsOnPave1=IsOnPave(anewSR.First(), aR, aTolToDecide); - bIsOnPave2=IsOnPave(anewSR.Last() , aR, aTolToDecide); - // - if (!bIsOnPave1 && !bIsOnPave2) { - nVF=CheckFacePaves(aNewVertex, nF); - if (!nVF) { - // really new vertex - // Add Interference to the Pool - BOPTools_ESInterference anInterf (nE, nF, aCPart); - anIndexIn=aEFs.Append(anInterf); - anInterf.SetNewShape(0); - // - aMapVI.Add(aNewVertex, anIndexIn); - aIMPBx.Add(aPB); - // - myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); - // - }// if (!nVF) - }// if (!bIsOnPave1 && !bIsOnPave2) - // - //modified by NIZNHY-PKV Fri Apr 18 10:55:38 2008f - else { - const BOPTools_Pave& aPave=(bIsOnPave1)? aPB.Pave1() : aPB.Pave2(); - nVF=aPave.Index(); - const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF)); - BOPTools_Tools::UpdateVertex (aVF, aNewVertex); - } - //modified by NIZNHY-PKV Fri Apr 18 10:55:40 2008t - // - }// case TopAbs_VERTEX: - break; - // - case TopAbs_EDGE: { - bCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext); - if (!bCoinsideFlag) { - break; - } - // - // Fill aMapCB - if (aMapCB.Contains(aPB)) { - TColStd_IndexedMapOfInteger& aMapF=aMapCB.ChangeFromKey(aPB); - aMapF.Add(nF); - } - else { - TColStd_IndexedMapOfInteger aMapF; - aMapF.Add(nF); - aMapCB.Add(aPB, aMapF); - } - // - aIMPBx.Add(aPB); - myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); - }// case TopAbs_EDGE: - break; + Standard_Boolean bCoinsideFlag; + Standard_Integer i, aNbCPrts; + TopAbs_ShapeEnum aType; + // + const IntTools_SequenceOfCommonPrts& aCPrts=aEF.CommonParts(); + // + aNbCPrts=aCPrts.Length(); + for (i=1; i<=aNbCPrts; ++i) { + anIndexIn=0; + // + const IntTools_CommonPrt& aCPart=aCPrts(i); + aType=aCPart.Type(); + // + switch (aType) { + // + case TopAbs_VERTEX: { + Standard_Boolean bIsOnPave1, bIsOnPave2; + Standard_Integer nVF; + Standard_Real aT, aTolToDecide; + TopoDS_Vertex aNewVertex; + // + const IntTools_Range& aR=aCPart.Range1(); + // + // New Vertex + VertexParameter(aCPart, aT); + BOPTools_Tools::MakeNewVertex(aE, aT, aF, aNewVertex); + // + //decide to add pave or not + aTolToDecide=5.e-8; + bIsOnPave1=IsOnPave(anewSR.First(), aR, aTolToDecide); + bIsOnPave2=IsOnPave(anewSR.Last() , aR, aTolToDecide); + // + if (!bIsOnPave1 && !bIsOnPave2) { + nVF=CheckFacePaves(aNewVertex, nF); + if (!nVF) { + // really new vertex + // Add Interference to the Pool + BOPTools_ESInterference anInterf (nE, nF, aCPart); + anIndexIn=aEFs.Append(anInterf); + anInterf.SetNewShape(0); + // + aMapVI.Add(aNewVertex, anIndexIn); + aIMPBx.Add(aPB); + // + myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); + // + }// if (!nVF) + }// if (!bIsOnPave1 && !bIsOnPave2) + // + //modified by NIZNHY-PKV Fri Apr 18 10:55:38 2008f + else { + const BOPTools_Pave& aPave=(bIsOnPave1)? aPB.Pave1() : aPB.Pave2(); + nVF=aPave.Index(); + const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF)); + BOPTools_Tools::UpdateVertex (aVF, aNewVertex); + } + //modified by NIZNHY-PKV Fri Apr 18 10:55:40 2008t + // + }// case TopAbs_VERTEX: + break; + // + case TopAbs_EDGE: { + bCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext); + if (!bCoinsideFlag) { + break; + } + // + // Fill aMapCB + if (aMapCB.Contains(aPB)) { + TColStd_IndexedMapOfInteger& aMapF=aMapCB.ChangeFromKey(aPB); + aMapF.Add(nF); + } + else { + TColStd_IndexedMapOfInteger aMapF; + aMapF.Add(nF); + aMapCB.Add(aPB, aMapF); + } + // + aIMPBx.Add(aPB); + myIP->Add(nE, nF, Standard_True, NMTDS_TI_EF); + }// case TopAbs_EDGE: + break; - default: - break; - } // switch (aType) - } // for (i=1; i<=aNbCPrts; i++) + default: + break; + } // switch (aType) + } // for (i=1; i<=aNbCPrts; i++) } //if (aEF.IsDone()) - } // for (; anIt.More(); anIt.Next()) - }// for (; myDSIt.More(); myDSIt.Next()) + } // for (; anIt.More(); anIt.Next()) + }// for (; myDSIt.More(); myDSIt.Next()) // // Treat New vertices EFNewVertices(aMapVI); // - // Add draft Common Blocks of EF type + // Add draft Common Blocks of EF type EFCommonBlocks(aMapCB); // // Collect all CB we suspected to split by new vertices @@ -310,15 +311,15 @@ static nEx=aPBx.OriginalEdge(); NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nEx)); if (aLCB.Extent()) { - NMTTools_CommonBlockAPI aCBAPIx(aLCB); - if (aCBAPIx.IsCommonBlock(aPBx)) { - NMTTools_CommonBlock& aCBx=aCBAPIx.CommonBlock(aPBx); - const BOPTools_PaveBlock& aPB1=aCBx.PaveBlock1(); - if (!aMx.Contains(aPB1)){ - aMx.Add(aPB1); - aLCBx.Append(aCBx); - } - } + NMTTools_CommonBlockAPI aCBAPIx(aLCB); + if (aCBAPIx.IsCommonBlock(aPBx)) { + NMTTools_CommonBlock& aCBx=aCBAPIx.CommonBlock(aPBx); + const BOPTools_PaveBlock& aPB1=aCBx.PaveBlock1(); + if (!aMx.Contains(aPB1)){ + aMx.Add(aPB1); + aLCBx.Append(aCBx); + } + } } } } @@ -332,7 +333,7 @@ static } //======================================================================= // function:EFCommonBlocks -// purpose: +// purpose: //======================================================================= void NMTTools_PaveFiller::EFCommonBlocks (const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB) @@ -353,8 +354,8 @@ static if (aCBAPI.IsCommonBlock(aPB)) { NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB); for (j=1; j<=aNbF; ++j) { - nF=aMapF(j); - aCB.AddFace(nF); + nF=aMapF(j); + aCB.AddFace(nF); } } else { @@ -362,8 +363,8 @@ static // aCB.AddPaveBlock(aPB); for (j=1; j<=aNbF; ++j) { - nF=aMapF(j); - aCB.AddFace(nF); + nF=aMapF(j); + aCB.AddFace(nF); } aLCB.Append(aCB); } @@ -371,10 +372,10 @@ static } //======================================================================= // function:EFNewVertices -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::EFNewVertices - (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) + void NMTTools_PaveFiller::EFNewVertices + (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) { Standard_Integer i, j, aNb, aNewShape, aFlag, iX, aNbVV, aNbSimple; Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges, iTmp; @@ -388,7 +389,7 @@ static TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; // aNb=aMapVI.Extent(); - if (!aNb) { // no new vertices, no new problems + if (!aNb) { // no new vertices, no new problems return; } // @@ -408,7 +409,7 @@ static aBB.Add(aCompound, aV); } // - // 2. VV intersection between these vertices + // 2. VV intersection between these vertices // using the auxiliary Filler NMTTools_PaveFiller tPF; // @@ -446,7 +447,7 @@ static EFNewVertices(aV, aMapVI); } // - // 3. Fill Maps : NewVertex-edges (aMNVE) + // 3. Fill Maps : NewVertex-edges (aMNVE) // NewVertex-interferences (aMNVIEE) aNb=aVVInterfs.Extent(); for (i=1; i<=aNb; ++i) { @@ -518,35 +519,35 @@ static BOPTools_ESInterference& aEF=aEFs(iX); aEF.SetNewShape(aNewShape); } - // - // Update Paves on all edges + // + // Update Paves on all edges const TColStd_IndexedMapOfInteger& aME=aMNVE(i); aNbEdges=aME.Extent(); for (j=1; j<=aNbEdges; ++j) { nE=aME(j); const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv // - aFlag=myContext.ComputeVE (aNewVertex, aE, aT); + aFlag=myContext->ComputeVE (aNewVertex, aE, aT); // if (!aFlag) { - aPave.SetInterference(-1); - aPave.SetType (BooleanOperations_EdgeSurface); - aPave.SetIndex(aNewShape); - aPave.SetParam(aT); - // - BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); - aPaveSet.Append(aPave); + aPave.SetInterference(-1); + aPave.SetType (BooleanOperations_EdgeSurface); + aPave.SetIndex(aNewShape); + aPave.SetParam(aT); + // + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + aPaveSet.Append(aPave); } } } } //======================================================================= // function:EFNewVertices -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::EFNewVertices + void NMTTools_PaveFiller::EFNewVertices (const TopoDS_Vertex& aNewVertex, - const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) + const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) { Standard_Integer i, aNewShape, nE, nF; Standard_Real aT; @@ -584,9 +585,9 @@ static } //======================================================================= // function: CheckFacePaves -// purpose: +// purpose: //======================================================================= - Standard_Integer NMTTools_PaveFiller::CheckFacePaves + Standard_Integer NMTTools_PaveFiller::CheckFacePaves (const TopoDS_Vertex& aNewVertex, const Standard_Integer nF) { @@ -594,7 +595,7 @@ static BOPTools_ListIteratorOfListOfPave anIt; TColStd_IndexedMapOfInteger aMVF; // - iRet=0; + iRet=0; // BooleanOperations_OnceExplorer aExp(*myDS); aExp.Init(nF, TopAbs_EDGE); @@ -624,10 +625,10 @@ static // //======================================================================= // function: VertexParameter -// purpose: +// purpose: //======================================================================= void VertexParameter(const IntTools_CommonPrt& aCPart, - Standard_Real& aT) + Standard_Real& aT) { const IntTools_Range& aR=aCPart.Range1(); aT=0.5*(aR.First()+aR.Last()); @@ -638,11 +639,11 @@ void VertexParameter(const IntTools_CommonPrt& aCPart, } //======================================================================= // function: IsOnPave -// purpose: +// purpose: //======================================================================= Standard_Boolean IsOnPave(const Standard_Real& aTR, - const IntTools_Range& aCPRange, - const Standard_Real& aTolerance) + const IntTools_Range& aCPRange, + const Standard_Real& aTolerance) { Standard_Boolean bIsOnPave; Standard_Real aT1, aT2, dT1, dT2; @@ -654,7 +655,7 @@ Standard_Boolean IsOnPave(const Standard_Real& aTR, return bIsOnPave; } // - dT1=Abs(aTR-aT1); + dT1=Abs(aTR-aT1); dT2=Abs(aTR-aT2); bIsOnPave=(dT1<=aTolerance || dT2<=aTolerance); return bIsOnPave; diff --git a/src/NMTTools/NMTTools_PaveFiller_6.cxx b/src/NMTTools/NMTTools_PaveFiller_6.cxx index e55e4dff4..3f897dedd 100644 --- a/src/NMTTools/NMTTools_PaveFiller_6.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_6.cxx @@ -1,31 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// IMPROVED by NIZNHY-PKV Thu Oct 12 16:03:33 2006 -// File: NMTTools_PaveFiller_6.cxx -// Created: Fri Dec 19 10:27:31 2003 -// Author: Peter KURNEV -// -// -#include +// File: NMTTools_PaveFiller_6.cxx +// Created: Fri Dec 19 10:27:31 2003 +// Author: Peter KURNEV + +#include + +#include #include @@ -34,13 +34,16 @@ #include #include #include -#include #include +#include + #include #include #include #include +#include +#include #include @@ -75,9 +78,11 @@ #include #include #include +#include #include - +#include +#include #include #include #include @@ -86,6 +91,8 @@ #include #include #include +#include +#include #include #include @@ -93,38 +100,38 @@ #include #include +#include #include +#include +#include #include #include - #include #include +#include +#include +#include static - void SharedEdges1(const TopoDS_Face& aF1, - const TopoDS_Face& aF2, - TopTools_ListOfShape& aLS); -static - Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, - IntTools_Context& aCtx); + Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, + const Handle(IntTools_Context)& aCtx); //======================================================================= // function: PerformFF -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PerformFF() + void NMTTools_PaveFiller::PerformFF() { myIsDone=Standard_False; // - Standard_Boolean bJustAdd;//, bIsComputed, bIsFound; - Standard_Integer n1, n2, anIndexIn, nF1, nF2, aBlockLength, aNbFFs; Standard_Boolean bToApproxC3d, bToApproxC2dOnS1, bToApproxC2dOnS2, bIsDone; + Standard_Boolean bJustAdd, bToSplit; + Standard_Integer n1, n2, anIndexIn, nF1, nF2, aBlockLength, aNbFFs; Standard_Integer aNbCurves, aNbPoints; Standard_Real anApproxTol, aTolR3D, aTolR2D; BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMapWhat, aMapWith; IntTools_SequenceOfPntOn2Faces aPnts; IntTools_SequenceOfCurves aCvs; - BooleanOperations_KindOfInterference aTypeFF=BooleanOperations_SurfaceSurface; // BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // @@ -138,6 +145,10 @@ static aFFs.SetBlockLength(aNbFFs); } // + //modified by NIZNHY-PKV Thu Sep 15 08:02:52 2011f + bToSplit=Standard_False; + //modified by NIZNHY-PKV Thu Sep 15 08:02:55 2011t + // for (; myDSIt->More(); myDSIt->Next()) { myDSIt->Current(n1, n2, bJustAdd); // @@ -163,25 +174,16 @@ static // IntTools_FaceFace aFF; // - aFF.SetParameters (bToApproxC3d, bToApproxC2dOnS1, - bToApproxC2dOnS2, anApproxTol); + aFF.SetParameters (bToApproxC3d, bToApproxC2dOnS1, + bToApproxC2dOnS2, anApproxTol); // aFF.Perform(aF1, aF2); // bIsDone=aFF.IsDone(); // - if (!bIsDone) { - /* - if (!bIsFound) { - myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); - } - else { - BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts); - anIndexIn=aFFs.Append(anInterf); - myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); - } - */ + BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts); + anIndexIn=aFFs.Append(anInterf); continue; } // @@ -189,9 +191,15 @@ static aTolR2D=aFF.TolReached2d(); if (aTolR3D < 1.e-7){ aTolR3D=1.e-7; - } + } // + //modified by NIZNHY-PKV Thu Sep 15 08:03:02 2011f +#if OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher + aFF.PrepareLines3D(bToSplit); +#else aFF.PrepareLines3D(); +#endif // OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher + //modified by NIZNHY-PKV Thu Sep 15 08:03:04 2011t // const IntTools_SequenceOfCurves& aCvsX=aFF.Lines(); const IntTools_SequenceOfPntOn2Faces& aPntsX=aFF.Points(); @@ -210,163 +218,121 @@ static anIndexIn=aFFs.Append(anInterf); } // - }// for (; myDSIt.More(); myDSIt.Next()) + }// for (; myDSIt.More(); myDSIt.Next()) // myIsDone=Standard_True; } + //======================================================================= // function: MakeBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::MakeBlocks() +void NMTTools_PaveFiller::MakeBlocks() { myIsDone=Standard_False; // Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D, bIsCoincided; Standard_Boolean bIsMicroEdge, bHasES; - Standard_Integer i, aNbFFs, nF1, nF2, aBid=0; + Standard_Integer i, aNbFFs, nF1, nF2; Standard_Integer nV1, nV2, j, aNbCurves; Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion(); + TopoDS_Face aF1, aF2; NMTTools_IndexedDataMapOfShapePaveBlock aMEPB; BooleanOperations_IndexedDataMapOfShapeInteger aMapEI; - BOPTools_ListIteratorOfListOfPaveBlock anIt; + BOPTools_ListIteratorOfListOfPaveBlock anIt; // BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // - aNbFFs=aFFs.Extent(); - // - NMTTools_DataMapOfIntegerListOfPaveBlock aMFInOn; - NMTTools_DataMapIteratorOfDataMapOfIntegerListOfPaveBlock aItMF; - //--- - { - Standard_Integer aNbS, aNbF, nF, aNbOn, nSp; - TopAbs_ShapeEnum aType; - BOPTools_ListIteratorOfListOfPaveBlock anItPB; - NMTTools_ListIteratorOfListOfCommonBlock aItCB; - TColStd_ListIteratorOfListOfInteger aItF; - // - aNbS=myDS->NumberOfShapesOfTheObject(); - for (i=1; i<=aNbS; ++i) { - const TopoDS_Shape& aS=myDS->Shape(i); - aType=aS.ShapeType(); - // - if (aType==TopAbs_EDGE) { - const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i)); - aItCB.Initialize(aLCB); - for (; aItCB.More(); aItCB.Next()) { - const NMTTools_CommonBlock& aCB=aItCB.Value(); - const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1(); - // - const TColStd_ListOfInteger& aLF=aCB.Faces(); - aNbF=aLF.Extent(); - if (aNbF) { - aItF.Initialize(aLF); - for (; aItF.More(); aItF.Next()) { - nF=aItF.Value(); - if (aMFInOn.IsBound(nF)) { - BOPTools_ListOfPaveBlock& aLPB=aMFInOn.ChangeFind(nF); - aLPB.Append(aPB1); - } - else { - BOPTools_ListOfPaveBlock aLPB; - aLPB.Append(aPB1); - aMFInOn.Bind(nF, aLPB); - } - } - }// if (aNbF) { - } // for (; aItCB.More(); aItCB.Next()) { - }//if (aS.ShapeType()==TopAbs_EDGE) { - // - else if (aType==TopAbs_FACE) { - BOPTools_ListOfPaveBlock aLPBOn; - // - nF=i; - RealSplitsFace(nF, aLPBOn); - // - aNbOn=aLPBOn.Extent(); - if (aNbOn) { - if (aMFInOn.IsBound(nF)) { - BOPTools_ListOfPaveBlock& aLPB=aMFInOn.ChangeFind(nF); - aLPB.Append(aLPBOn); - } - else { - aMFInOn.Bind(nF, aLPBOn); - } - } - } - } // for (i=1; i<=aNbS; ++i) { - // - // Refine ListOfPaveBlocks - aItMF.Initialize(aMFInOn); - for(; aItMF.More(); aItMF.Next()) { - TColStd_MapOfInteger aMTmp; - BOPTools_ListOfPaveBlock aLPBX; - // - nF=aItMF.Key(); - BOPTools_ListOfPaveBlock& aLPB=aMFInOn.ChangeFind(nF); - anItPB.Initialize(aLPB); - for (; anItPB.More(); anItPB.Next()) { - const BOPTools_PaveBlock& aPB=anItPB.Value(); - nSp=aPB.Edge(); - if (aMTmp.Add(nSp)) { - aLPBX.Append(aPB); - } - } - aLPB.Clear(); - aLPB.Append(aLPBX); - } - } - //--- + // - // 1. Produce Section Edges from intersection curves + // 1. Make Section Edges from intersection curves // between each pair of faces aNbFFs=aFFs.Extent(); + if (!aNbFFs) { + return; + } + // + FillFaceInfo(); // for (i=1; i<=aNbFFs; ++i) { + BOPTools_ListOfPaveBlock aLPB; + TColStd_MapOfInteger aMVStick; + TopTools_ListOfShape aLSE; + TColStd_ListOfInteger aLNE; + BOPTools_PaveSet aPSF; + NMTTools_MapOfPaveBlock aMPBX; + TColStd_MapIteratorOfMapOfInteger aItMI; + NMTTools_MapIteratorOfMapOfPaveBlock aItMPB; + // BOPTools_SSInterference& aFFi=aFFs(i); - // + // // Faces aFFi.Indices(nF1, nF2); - const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv - const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv + aF1=*((TopoDS_Face*)(&myDS->Shape(nF1))); + aF2=*((TopoDS_Face*)(&myDS->Shape(nF2))); // - BOPTools_ListOfPaveBlock aLPB; + SharedEdges(nF1, nF2, aLNE, aLSE); + aFFi.SetSharedEdges(aLNE); // - //--- - { - BOPTools_ListIteratorOfListOfPaveBlock anItPB; - NMTTools_MapOfPaveBlock aMPB; - // - if (aMFInOn.IsBound(nF1)) { - const BOPTools_ListOfPaveBlock& aLPBF1=aMFInOn.Find(nF1); - anItPB.Initialize(aLPBF1); - for (; anItPB.More(); anItPB.Next()) { - const BOPTools_PaveBlock& aPB=anItPB.Value(); - if (aMPB.Add(aPB)) { - aLPB.Append(aPB); - } + // aMVStick + const NMTTools_FaceInfo& aFI1=myFaceInfo.Find(nF1); + const NMTTools_FaceInfo& aFI2=myFaceInfo.Find(nF2); + // + const TColStd_MapOfInteger& aMVOn1=aFI1.VerticesOn(); + const TColStd_MapOfInteger& aMVIn1=aFI1.VerticesIn(); + const TColStd_MapOfInteger& aMVOn2=aFI2.VerticesOn(); + const TColStd_MapOfInteger& aMVIn2=aFI2.VerticesIn(); + // + for (j=0; j<2; ++j) { + const TColStd_MapOfInteger& aMV1=(!j) ? aMVOn1 :aMVIn1; + aItMI.Initialize(aMV1); + for (; aItMI.More(); aItMI.Next()) { + nV1=aItMI.Key(); + if (aMVOn2.Contains(nV1) || aMVIn2.Contains(nV1)) { + aMVStick.Add(nV1); } } - if (aMFInOn.IsBound(nF2)) { - const BOPTools_ListOfPaveBlock& aLPBF2=aMFInOn.Find(nF2); - anItPB.Initialize(aLPBF2); - for (; anItPB.More(); anItPB.Next()) { - const BOPTools_PaveBlock& aPB=anItPB.Value(); - if (aMPB.Contains(aPB)) { + } + // + // aLPB + const NMTTools_MapOfPaveBlock& aMPBIn1=aFI1.PaveBlocksIn(); + const NMTTools_MapOfPaveBlock& aMPBOn1=aFI1.PaveBlocksOn(); + const NMTTools_MapOfPaveBlock& aMPBIn2=aFI2.PaveBlocksIn(); + const NMTTools_MapOfPaveBlock& aMPBOn2=aFI2.PaveBlocksOn(); + // + aMPBX.Clear(); + for (j=0; j<4; ++j) { + NMTTools_MapOfPaveBlock *pMPB; + // + if (!j) { + pMPB=((NMTTools_MapOfPaveBlock*)&aMPBIn1); + } + else if (j==1) { + pMPB=((NMTTools_MapOfPaveBlock*)&aMPBOn1); + } + else if (j==2) { + pMPB=((NMTTools_MapOfPaveBlock*)&aMPBIn2); + } + else if (j==3) { + pMPB=((NMTTools_MapOfPaveBlock*)&aMPBOn2); + } + // + const NMTTools_MapOfPaveBlock& aMPB=*pMPB; + aItMPB.Initialize(aMPB); + for (; aItMPB.More(); aItMPB.Next()) { + const BOPTools_PaveBlock& aPB=aItMPB.Key(); + if (aMPBX.Add(aPB)) { + aLPB.Append(aPB); + } + // + else { + if (j>1) { aFFi.AppendBlock(aPB); } - else { - aLPB.Append(aPB); - } } + // } } - //--- - // - TopTools_ListOfShape aLSE; - TColStd_ListOfInteger aLNE; - SharedEdges(nF1, nF2, aLNE, aLSE); - aFFi.SetSharedEdges(aLNE); // BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves(); aNbCurves=aSCvs.Length(); @@ -374,21 +340,20 @@ static continue; } // - // Contribution of Samtech www.samcef.com END aTolR3D=aFFi.TolR3D(); aTol2D=(aTolR3D < 1.e-3) ? 1.e-3 : aTolR3D; // - BOPTools_PaveSet aPSF; + CorrectTolR3D(aFFi, aMVStick, aTolR3D); // PrepareSetForFace (nF1, nF2, aLPB, aPSF); // // Put Paves On Curves for (j=1; j<=aNbCurves; ++j) { BOPTools_Curve& aBC=aSCvs(j); - // DEBUG const IntTools_Curve& aC=aBC.Curve(); - Handle (Geom_Curve) aC3D= aC.Curve(); - // + // DEBUG f + Handle(Geom_Curve) aC3D = aC.Curve(); + // DEBUG t PutPaveOnCurve (aPSF, aTolR3D, aBC); } // @@ -397,6 +362,16 @@ static BOPTools_Curve& aBC=aSCvs(j); PutBoundPaveOnCurve (aBC, aFFi); } + //modified by NIZNHY-PKV Wed Sep 14 13:12:14 2011f +#if OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher + // + // Put closing pave if needded + for (j=1; j<=aNbCurves; ++j) { + BOPTools_Curve& aBC=aSCvs(j); + PutClosingPaveOnCurve (aBC, aFFi); + } +#endif // OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher + //modified by NIZNHY-PKV Wed Sep 14 13:12:17 2011t // // Pave Blocks on Curves bHasES=Standard_False; @@ -407,80 +382,83 @@ static // BOPTools_PaveBlockIterator aPBIter(0, aPaveSet); for (; aPBIter.More(); aPBIter.Next()) { - BOPTools_PaveBlock& aPBNew=aPBIter.Value(); - aPBNew.SetCurve(aIC); - aPBNew.SetFace1(nF1); - aPBNew.SetFace2(nF2); - // - nV1=aPBNew.Pave1().Index(); - nV2=aPBNew.Pave2().Index(); - aT1=aPBNew.Pave1().Param(); - aT2=aPBNew.Pave2().Param(); - // - if((nV1==nV2) && (Abs(aT2 - aT1) < aTolPPC)) { - continue;// mkk ft ??? - } - // - // 1 - bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D); - if (bIsExistingPaveBlock) { - continue; - } - // - bIsCoincided=CheckCoincidence(aPBNew, aLPB); - if(bIsCoincided) { - continue; - } - // - // Modified - // to provide checking whether aPBNew already exists in list - // of section edges aLSE - // Thu Sep 14 14:35:18 2006 - // Contribution of Samtech www.samcef.com BEGIN - // 2 - bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLSE, aTolR3D); - if (bIsExistingPaveBlock) { - continue; - } - // Contribution of Samtech www.samcef.com END - // - // Checking of validity in 2D - // - bIsValidIn2D=myContext.IsValidBlockForFaces(aT1, aT2, aIC, aF1, aF2, aTol2D); - if (!bIsValidIn2D) { - continue; - } - // - // - // Make Section Edge - TopoDS_Edge aES; - // - const TopoDS_Vertex aV1=TopoDS::Vertex(myDS->Shape(nV1));//mpv - const TopoDS_Vertex aV2=TopoDS::Vertex(myDS->Shape(nV2));//mpv - // - BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); - // - NMTTools_Tools::UpdateEdge (aES, aTolR3D); - bIsMicroEdge=IsMicroEdge(aES, myContext); - if (bIsMicroEdge) { - continue; - } - // - - { - Handle(Geom2d_Curve) aC2D1, aC2D2; - // - aC2D1=aIC.FirstCurve2d(); - aC2D2=aIC.SecondCurve2d(); - // - NMTTools_Tools::MakePCurve(aES, aF1, aC2D1); - NMTTools_Tools::MakePCurve(aES, aF2, aC2D2); - } - // - aMEPB.Add(aES, aPBNew); - aMapEI.Add(aES, i); + BOPTools_PaveBlock& aPBNew=aPBIter.Value(); + aPBNew.SetCurve(aIC); + aPBNew.SetFace1(nF1); + aPBNew.SetFace2(nF2); + // + nV1=aPBNew.Pave1().Index(); + nV2=aPBNew.Pave2().Index(); + aT1=aPBNew.Pave1().Param(); + aT2=aPBNew.Pave2().Param(); + // + if((nV1==nV2) && (Abs(aT2 - aT1) < aTolPPC)) { + continue;// mkk ft ??? + } + // + // 1 + bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPB, aTolR3D); + if (bIsExistingPaveBlock) { + continue; + } + // + bIsCoincided=CheckCoincidence(aPBNew, aLPB); + if(bIsCoincided) { + continue; + } + // + // 2 + bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLSE, aTolR3D); + if (bIsExistingPaveBlock) { + continue; + } // - bHasES=Standard_True; + // Checking of validity in 2D + // + bIsValidIn2D=myContext->IsValidBlockForFaces(aT1, aT2, aIC, aF1, aF2, aTol2D); + if (!bIsValidIn2D) { + continue; + } + // + // + // Make Section Edge + TopoDS_Edge aES; + // + const TopoDS_Vertex aV1=TopoDS::Vertex(myDS->Shape(nV1)); + const TopoDS_Vertex aV2=TopoDS::Vertex(myDS->Shape(nV2)); + // + { + Standard_Real aT; + // + myContext->IsVertexOnLine(aV1, aIC, aTolR3D, aT); + BOPTools_Tools::UpdateVertex (aIC, aT, aV1); + // + myContext->IsVertexOnLine(aV2, aIC, aTolR3D, aT); + BOPTools_Tools::UpdateVertex (aIC, aT, aV2); + } + // + BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); + // + NMTTools_Tools::UpdateEdge (aES, aTolR3D); + bIsMicroEdge=IsMicroEdge(aES, myContext); + if (bIsMicroEdge) { + continue; + } + // + { + Handle(Geom2d_Curve) aC2D1, aC2D2; + // + aC2D1=aIC.FirstCurve2d(); + aC2D2=aIC.SecondCurve2d(); + // + NMTTools_Tools::MakePCurve(aES, aF1, aC2D1); + NMTTools_Tools::MakePCurve(aES, aF2, aC2D2); + } + // + aMEPB.Add(aES, aPBNew); + aMapEI.Add(aES, i); + // + bHasES=Standard_True; }// for (; aPBIter.More(); aPBIter.Next()) } // end of for (j=1; j<=aNbCurves; ++j) // qqf @@ -491,7 +469,7 @@ static }// for (i=1; i<=aNbFFs; ++i) //============================================================= // - // II. Post treatment + // II. Post treatment // // Input data: aMEPB, aMapEI // Result : section edges in myDS @@ -502,7 +480,7 @@ static if (!aNbSE) { // there is nothing to do here return; - } + } // BRep_Builder aBB; TopoDS_Compound aCompound; @@ -523,7 +501,6 @@ static // 2.1.VV tPF.Init(); tPF.PerformVV(); - //tPF.PerformNewVertices(); qq // // 2.2.VE tPF.myPavePool.Resize (tPF.myNbEdges); @@ -537,7 +514,7 @@ static tPF.myCommonBlockPool.Resize (tPF.myNbEdges); tPF.mySplitShapesPool.Resize (tPF.myNbEdges); tPF.myPavePoolNew .Resize (tPF.myNbEdges); - + tPF.PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE); tPF.PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE); // @@ -563,7 +540,7 @@ static // aNbLines=tDS.NumberOfInsertedShapes(); aNbOld=tDS.NumberOfShapesOfTheObject(); - // + // // 3.1 Links between indices in tDS and DS (kept in aMNewOld) // // 3.1.1.Old vertices [ links ] @@ -579,14 +556,14 @@ static nV1=aPBSE.Pave1().Index(); const TopoDS_Shape aV1=myDS->Shape(nV1);//mpv if (aV1.IsSame(aV)) { - aMNewOld.Add(i, nV1); - break; + aMNewOld.Add(i, nV1); + break; } nV2=aPBSE.Pave2().Index(); const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv if (aV2.IsSame(aV)) { - aMNewOld.Add(i, nV2); - break; + aMNewOld.Add(i, nV2); + break; } } } @@ -624,7 +601,7 @@ static BOPTools_SSInterference& aFFi=aFFs(iFF); BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves(); // - BOPTools_Curve& aBC=aSCvs(1); + BOPTools_Curve& aBC=aSCvs(1); // const BOPTools_ListOfPaveBlock& aLPB=aSSP(tDS.RefEdge(i)); aNbPB=aLPB.Extent(); @@ -666,27 +643,27 @@ static const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2)); // if (aCBAPI.IsCommonBlock(aPB)) { - // it can be Common Block - Standard_Real aTolEx; - Handle(Geom2d_Curve) aC2D1, aC2D2; - TopoDS_Face aF1FWD, aF2FWD; - // - NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB); - const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks(); - // - aPB=aCB.PaveBlock1(); - mE=aPB.Edge(); // index of edge in tDS - const TopoDS_Edge& aEx=TopoDS::Edge(tDS.Shape(mE)); - aTolEx=BRep_Tool::Tolerance(aEx); + // it can be Common Block + Standard_Real aTolEx; + Handle(Geom2d_Curve) aC2D1, aC2D2; + TopoDS_Face aF1FWD, aF2FWD; // - aF1FWD=aF1; - aF1FWD.Orientation(TopAbs_FORWARD); - aF2FWD=aF2; - aF2FWD.Orientation(TopAbs_FORWARD); - // - NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1); - NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2); - NMTTools_Tools::UpdateEdge (aEx, aTolEx); + NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB); + //const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks(); + // + aPB=aCB.PaveBlock1(); + mE=aPB.Edge(); // index of edge in tDS + const TopoDS_Edge& aEx=TopoDS::Edge(tDS.Shape(mE)); + aTolEx=BRep_Tool::Tolerance(aEx); + // + aF1FWD=aF1; + aF1FWD.Orientation(TopAbs_FORWARD); + aF2FWD=aF2; + aF2FWD.Orientation(TopAbs_FORWARD); + // + NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1); + NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2); + NMTTools_Tools::UpdateEdge (aEx, aTolEx); } //if (aCBAPI.IsCommonBlock(aPB)) // // new SE @@ -706,22 +683,22 @@ static const TopoDS_Shape aV2=myDS->Shape(nV2);//mpv // if (!aMNewOld.Contains(mE)) { - // add new SE to the myDS - BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; - // - anASSeq.SetNewSuccessor(nV1); - anASSeq.SetNewOrientation(aV1.Orientation()); + // add new SE to the myDS + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + // + anASSeq.SetNewSuccessor(nV1); + anASSeq.SetNewOrientation(aV1.Orientation()); - anASSeq.SetNewSuccessor(nV2); - anASSeq.SetNewOrientation(aV2.Orientation()); - - myDS->InsertShapeAndAncestorsSuccessors(aSp, anASSeq); - nE=myDS->NumberOfInsertedShapes(); - // - aMNewOld.Add(mE, nE); + anASSeq.SetNewSuccessor(nV2); + anASSeq.SetNewOrientation(aV2.Orientation()); + + myDS->InsertShapeAndAncestorsSuccessors(aSp, anASSeq); + nE=myDS->NumberOfInsertedShapes(); + // + aMNewOld.Add(mE, nE); } else { - nE=aMNewOld.FindFromKey(mE); + nE=aMNewOld.FindFromKey(mE); } // Form PaveBlock; BOPTools_PaveBlock aPBx; @@ -742,16 +719,17 @@ static aPBx.SetEdge(nE); // aBC.AppendNewBlock(aPBx); - }// for (; aIt.More(); aIt.Next()) - }// for (i=1; i<=aNbOld; ++i) + }// for (; aIt.More(); aIt.Next()) + }// for (i=1; i<=aNbOld; ++i) // myIsDone=Standard_True; } + //======================================================================= // function: MakePCurves -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::MakePCurves() +void NMTTools_PaveFiller::MakePCurves() { Standard_Integer i, aNb, nF1, nF2, nE; Standard_Integer aNbCB, aNbF, nSp, nF; @@ -784,15 +762,14 @@ static const BOPTools_PaveBlock& aPB=anIt.Value(); nE=aPB.Edge(); const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv - + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); } - } + } // Check common blocks between edges and faces // Build P-Curves if they were not built in previos block. - // - // The main case is :arguments for e.g aEdge, aFace -> no FFs, + // The main case is :arguments for e.g aEdge, aFace -> no FFs, // but p-curves are needed. // aNb=myDS->NumberOfShapesOfTheObject(); @@ -822,8 +799,8 @@ static // const TColStd_ListOfInteger& aLF=aCB.Faces(); aNbF=aLF.Extent(); - if (!aNbF) { - continue; + if (!aNbF) { + continue; } // nSp=aPB1.Edge(); @@ -831,22 +808,23 @@ static // aItF.Initialize(aLF); for (; aItF.More(); aItF.Next()) { - nF=aItF.Value(); - aF1FWD=TopoDS::Face(myDS->Shape(nF)); - aF1FWD.Orientation(TopAbs_FORWARD); - // - BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aSp, aF1FWD); + nF=aItF.Value(); + aF1FWD=TopoDS::Face(myDS->Shape(nF)); + aF1FWD.Orientation(TopAbs_FORWARD); + // + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aSp, aF1FWD); } // for (; aItCB.More(); aItCB.Next()) { }//if (aS.ShapeType()==TopAbs_EDGE) { - } + } } + //======================================================================= // function: IsExistingPaveBlock -// purpose: +// purpose: //======================================================================= - Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew, - const BOPTools_ListOfPaveBlock& aLPBR, - const Standard_Real aTolR3D) +Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew, + const BOPTools_ListOfPaveBlock& aLPBR, + const Standard_Real aTolR3D) { Standard_Boolean bFlag; Standard_Integer nVNew1, nVNew2, nV1, nV2, iC; @@ -865,19 +843,20 @@ static // iC=CheckIntermediatePoint(aPBNew, aPBR, aTolR3D); if (!iC) { - return !bFlag; + return !bFlag; } } } return bFlag; } + //======================================================================= // function: IsExistingPaveBlock -// purpose: +// purpose: //======================================================================= - Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew, - const TopTools_ListOfShape& aLSE, - const Standard_Real aTolR3D) +Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew, + const TopTools_ListOfShape& aLSE, + const Standard_Real aTolR3D) { Standard_Boolean bFlag; Standard_Integer aNbSE, iC; @@ -894,29 +873,26 @@ static anIt.Initialize(aLSE); for (; anIt.More(); anIt.Next()) { const TopoDS_Edge& aE=TopoDS::Edge(anIt.Value()); - //modified by NIZNHY-PKV Mon Nov 17 09:54:43 2008f //0019974 aTolE=BRep_Tool::Tolerance(aE); aTol=aTolR3D; if (aTolE>aTol) { aTol=aTolE; } iC=CheckIntermediatePoint(aPBNew, aE, aTol); - //iC=CheckIntermediatePoint(aPBNew, aE, aTolR3D); - //modified by NIZNHY-PKV Mon Nov 17 09:54:45 2008t if (!iC) { return !bFlag; } } return bFlag; } + //======================================================================= // function: CheckIntermediatePoint -// purpose: +// purpose: //======================================================================= - Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB, - const BOPTools_PaveBlock& aPBR, - const Standard_Real aTolC) - +Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB, + const BOPTools_PaveBlock& aPBR, + const Standard_Real aTolC) { Standard_Integer iVM, nE2; // @@ -926,24 +902,25 @@ static // return iVM; } + //======================================================================= // function: CheckIntermediatePoint -// purpose: +// purpose: //======================================================================= - Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB, - const TopoDS_Edge& aE2, - const Standard_Real aTolC) +Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB, + const TopoDS_Edge& aE2, + const Standard_Real aTolC) { Standard_Real aT11, aT12, aTM, aTmp; Standard_Integer iVM; gp_Pnt aPM; BRep_Builder aBB; TopoDS_Vertex aVM; - // + // // Vertex const BOPTools_Pave& aPave11=aPB.Pave1(); aT11=aPave11.Param(); - // + // const BOPTools_Pave& aPave12=aPB.Pave2(); aT12=aPave12.Param(); // @@ -954,17 +931,18 @@ static // aBB.MakeVertex (aVM, aPM, aTolC); // - iVM=myContext.ComputeVE(aVM, aE2, aTmp); + iVM=myContext->ComputeVE(aVM, aE2, aTmp); // return iVM; } + //======================================================================= // function: PutBoundPaveOnCurve -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PutBoundPaveOnCurve(BOPTools_Curve& aBC, - BOPTools_SSInterference& aFFi) -{ +void NMTTools_PaveFiller::PutBoundPaveOnCurve(BOPTools_Curve& aBC, + BOPTools_SSInterference& aFFi) +{ Standard_Boolean bHasBounds, bVF; Standard_Integer nF1, nF2; Standard_Real aT1, aT2, aTolR3D; @@ -986,25 +964,26 @@ static const TopoDS_Face aF1=TopoDS::Face(myDS->GetShape(nF1));//mpv const TopoDS_Face aF2=TopoDS::Face(myDS->GetShape(nF2));//mpv // - bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); + bVF=myContext->IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); if (bVF) { PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi); } // - bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); + bVF=myContext->IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); if (bVF) { PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi); } } + //======================================================================= // function: PutBoundPaveOnCurve -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PutBoundPaveOnCurve(const gp_Pnt& aP, - const Standard_Real aT, - BOPTools_Curve& aBC, - BOPTools_SSInterference& aFFi) -{ +void NMTTools_PaveFiller::PutBoundPaveOnCurve(const gp_Pnt& aP, + const Standard_Real aT, + BOPTools_Curve& aBC, + BOPTools_SSInterference& aFFi) +{ Standard_Boolean bFound1, bFound2; Standard_Integer nV; Standard_Real aTolV=aFFi.TolR3D(); @@ -1043,7 +1022,7 @@ static const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv BOPTools_Tools::UpdateVertex (aIC, aT, aV); } - + if (!bFound1 && bFound2) { nV=aPave2.Index(); aPave.SetIndex(nV); @@ -1054,18 +1033,19 @@ static BOPTools_Tools::UpdateVertex (aIC, aT, aV); } } + //======================================================================= // function: FindPave -// purpose: +// purpose: //======================================================================= - Standard_Boolean NMTTools_PaveFiller::FindPave(const gp_Pnt& aP, - const Standard_Real aTolPV, - const BOPTools_PaveSet& aPS, - BOPTools_Pave& aPave) +Standard_Boolean NMTTools_PaveFiller::FindPave(const gp_Pnt& aP, + const Standard_Real aTolPV, + const BOPTools_PaveSet& aPS, + BOPTools_Pave& aPave) { Standard_Integer nV; Standard_Boolean bIsVertex=Standard_False; - + const BOPTools_ListOfPave& aLP=aPS.Set(); BOPTools_ListIteratorOfListOfPave anIt(aLP); for (; anIt.More(); anIt.Next()) { @@ -1080,16 +1060,17 @@ static } return bIsVertex; } + //======================================================================= // function: PrepareSetForFace -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PrepareSetForFace(const Standard_Integer ,//nF1, - const Standard_Integer ,//nF2, - const BOPTools_ListOfPaveBlock& aLPBC, - BOPTools_PaveSet& aPSF) +void NMTTools_PaveFiller::PrepareSetForFace(const Standard_Integer ,//nF1, + const Standard_Integer ,//nF2, + const BOPTools_ListOfPaveBlock& aLPBC, + BOPTools_PaveSet& aPSF) { - Standard_Integer nV1, nV2; + Standard_Integer nV1, nV2; TColStd_MapOfInteger aMap; BOPTools_ListIteratorOfListOfPaveBlock anIt; // @@ -1110,93 +1091,13 @@ static } } } -//======================================================================= -// function: PutPaveOnCurve -// purpose: -//======================================================================= - void NMTTools_PaveFiller::PutPaveOnCurve(const BOPTools_PaveSet& aPaveSet, - const Standard_Real aTolR3D, - BOPTools_Curve& aBC) -{ - Standard_Integer nV; - Standard_Boolean bIsVertexOnLine; - Standard_Real aT; - BOPTools_ListIteratorOfListOfPave anIt; - Bnd_Box aBBC; - GeomAdaptor_Curve aGAC; - // - const IntTools_Curve& aC=aBC.Curve(); - Handle (Geom_Curve) aC3D= aC.Curve(); - aGAC.Load(aC3D); - BndLib_Add3dCurve::Add(aGAC, aTolR3D, aBBC); - // - const BOPTools_ListOfPave& aLP=aPaveSet.Set(); - anIt.Initialize(aLP); - for (; anIt.More(); anIt.Next()) { - const BOPTools_Pave& aPave=anIt.Value(); - // - nV=aPave.Index(); - const TopoDS_Vertex aV=TopoDS::Vertex(myDS->Shape(nV));//mpv - // - Bnd_Box aBBV; - BRepBndLib::Add(aV, aBBV); - if (aBBC.IsOut(aBBV)){ - continue; - } - // - bIsVertexOnLine=myContext.IsVertexOnLine(aV, aC, aTolR3D, aT); - // - if (bIsVertexOnLine) { - BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface); - BOPTools_PaveSet& aPS=aBC.Set(); - aPS.Append(aPaveNew); - //<-B - BOPTools_Tools::UpdateVertex (aC, aT, aV); - } - } -} -///////////// - - -//======================================================================= -//function : SharedEdges1 -//purpose : -//======================================================================= -void SharedEdges1(const TopoDS_Face& aF1, - const TopoDS_Face& aF2, - TopTools_ListOfShape& aLS) -{ - Standard_Integer i, aNbE, aNbF;; - TopTools_IndexedDataMapOfShapeListOfShape aMEF; - // - TopExp::MapShapesAndAncestors(aF1, TopAbs_EDGE, TopAbs_FACE, aMEF); - TopExp::MapShapesAndAncestors(aF2, TopAbs_EDGE, TopAbs_FACE, aMEF); - // - aNbE=aMEF.Extent(); - for (i=1; i<=aNbE; ++i) { - const TopTools_ListOfShape& aLF=aMEF.FindFromIndex(i); - aNbF=aLF.Extent(); - if (aNbF>1) { - if (aNbF==2) { - const TopoDS_Shape& aF1x=aLF.First(); - const TopoDS_Shape& aF2x=aLF.Last(); - if (aF1x.IsSame(aF2x)) { - continue; - } - } - const TopoDS_Shape& aE=aMEF.FindKey(i); - aLS.Append (aE); - } - } -} //======================================================================= // function: CheckCoincidence -// purpose: +// purpose: //======================================================================= - Standard_Boolean NMTTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPBNew, - const BOPTools_ListOfPaveBlock& aLPBFF) - +Standard_Boolean NMTTools_PaveFiller::CheckCoincidence(const BOPTools_PaveBlock& aPBNew, + const BOPTools_ListOfPaveBlock& aLPBFF) { Standard_Boolean bRet; Standard_Real aTE; @@ -1207,7 +1108,7 @@ void SharedEdges1(const TopoDS_Face& aF1, const BOPTools_Pave& aPave11=aPBNew.Pave1(); nV11=aPave11.Index(); const TopoDS_Vertex& aV11=TopoDS::Vertex(myDS->Shape(nV11)); - + // V12 const BOPTools_Pave& aPave12=aPBNew.Pave2(); nV12=aPave12.Index(); @@ -1223,7 +1124,7 @@ void SharedEdges1(const TopoDS_Face& aF1, // V21 const BOPTools_Pave& aPave21=aPBR.Pave1(); nV21=aPave21.Index(); - + // V22 const BOPTools_Pave& aPave22=aPBR.Pave2(); nV22=aPave22.Index(); @@ -1246,7 +1147,7 @@ void SharedEdges1(const TopoDS_Face& aF1, iCount++; iV++; if (iCount>iCountExt) { - break; + break; } } // @@ -1255,17 +1156,17 @@ void SharedEdges1(const TopoDS_Face& aF1, iCount++; iV++; if (iCount>iCountExt) { - break; + break; } } // VE if (!iV) { - iVE=myContext.ComputeVE (aV11, aE2, aTE); + iVE=myContext->ComputeVE (aV11, aE2, aTE); if (!iVE) { - iCount++; - if (iCount>iCountExt) { - break; - } + iCount++; + if (iCount>iCountExt) { + break; + } } } // VV @@ -1275,7 +1176,7 @@ void SharedEdges1(const TopoDS_Face& aF1, iCount++; iV++; if (iCount>iCountExt) { - break; + break; } } // @@ -1284,17 +1185,17 @@ void SharedEdges1(const TopoDS_Face& aF1, iCount++; iV++; if (iCount>iCountExt) { - break; + break; } } // VE if (!iV) { - iVE=myContext.ComputeVE (aV12, aE2, aTE); + iVE=myContext->ComputeVE (aV12, aE2, aTE); if (!iVE) { - iCount++; - if (iCount>iCountExt) { - break; - } + iCount++; + if (iCount>iCountExt) { + break; + } } } } // next aPBR @@ -1304,10 +1205,10 @@ void SharedEdges1(const TopoDS_Face& aF1, //======================================================================= //function : IsMicroEdge -//purpose : +//purpose : //======================================================================= -Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, - IntTools_Context& aCtx) +Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, + const Handle(IntTools_Context)& aCtx) { Standard_Boolean bRet; Standard_Integer iErr; @@ -1316,15 +1217,15 @@ Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, TopoDS_Vertex aV1, aV2; IntTools_Range aR; // - bRet=(BRep_Tool::Degenerated(aE) || - !BRep_Tool::IsGeometric(aE)); + bRet=(BRep_Tool::Degenerated(aE) || + !BRep_Tool::IsGeometric(aE)); if (bRet) { return bRet; } // aC3D=BRep_Tool::Curve(aE, aT1, aT2); TopExp::Vertices(aE, aV1, aV2); - aT1=BRep_Tool::Parameter(aV1, aE); + aT1=BRep_Tool::Parameter(aV1, aE); aT2=BRep_Tool::Parameter(aV2, aE); if (aT2Shape(nV)); + // + Bnd_Box aBBV; + BRepBndLib::Add(aV, aBBV); + if (aBBC.IsOut(aBBV)){ + continue; + } + // + bIsVertexOnLine=myContext->IsVertexOnLine(aV, aC, aTolR3D, aT); + // + // + if (bIsVertexOnLine) { + BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface); + BOPTools_PaveSet& aPS=aBC.Set(); + aPS.Append(aPaveNew); + //<-B + } + } +} +// +//======================================================================= +//function : FillFaceInfo +//purpose : +//======================================================================= +void NMTTools_PaveFiller::FillFaceInfo() +{ + Standard_Integer i, aNbS, aNbFFs, nF, aNbVFs, aNbEFs, j, n1, n2, nX, aNbF; + TopAbs_ShapeEnum aType; + TopoDS_Shape aS; + TColStd_ListIteratorOfListOfInteger aItF; + BOPTools_ListIteratorOfListOfPaveBlock anItPB; + NMTTools_DataMapIteratorOfDataMapOfIntegerFaceInfo aItMFI; + NMTTools_ListIteratorOfListOfCommonBlock aItCB; + // + myFaceInfo.Clear(); + // + BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); + BOPTools_CArray1OfVSInterference& aVFs=myIP->VSInterferences(); + BOPTools_CArray1OfESInterference& aEFs=myIP->ESInterferences(); + // + aNbFFs=aFFs.Extent(); + if (!aNbFFs) { + return; + } + // + // 0. + for (i=1; i<=aNbFFs; ++i) { + NMTTools_FaceInfo aFI; + // + BOPTools_SSInterference& aFFi=aFFs(i); + aFFi.Indices(n1, n2); + myFaceInfo.Bind(n1, aFI); + myFaceInfo.Bind(n2, aFI); + } + // + // 1. + aNbS=myDS->NumberOfShapesOfTheObject(); + for (i=1; i<=aNbS; ++i) { + aS=myDS->Shape(i); + aType=aS.ShapeType(); + if (aType==TopAbs_EDGE) { + const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i)); + aItCB.Initialize(aLCB); + for (; aItCB.More(); aItCB.Next()) { + const NMTTools_CommonBlock& aCB=aItCB.Value(); + const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1(); + const TColStd_ListOfInteger& aLF=aCB.Faces(); + aNbF=aLF.Extent(); + if (!aNbF) { + continue; + } + // + aItF.Initialize(aLF); + for (; aItF.More(); aItF.Next()) { + nF=aItF.Value(); + if (!myFaceInfo.IsBound(nF)) { + continue; + } + // + NMTTools_FaceInfo& aFI=myFaceInfo.ChangeFind(nF); + aFI.ChangePaveBlocksIn().Add(aPB1); + // + n1=aPB1.Pave1().Index(); + n2=aPB1.Pave2().Index(); + aFI.ChangeVerticesIn().Add(n1); + aFI.ChangeVerticesIn().Add(n2); + } + } + }// if (aType==TopAbs_EDGE) { + else if (aType==TopAbs_FACE) { + if (!myFaceInfo.IsBound(i)) { + continue; + } + // + BOPTools_ListOfPaveBlock aLPBOn; + // + nF=i; + NMTTools_FaceInfo& aFI=myFaceInfo.ChangeFind(nF); + // + RealSplitsFace(nF, aLPBOn); + // + anItPB.Initialize(aLPBOn); + for (; anItPB.More(); anItPB.Next()) { + const BOPTools_PaveBlock &aPB=anItPB.Value(); + aFI.ChangePaveBlocksOn().Add(aPB); + // + n1=aPB.Pave1().Index(); + n2=aPB.Pave2().Index(); + aFI.ChangeVerticesOn().Add(n1); + aFI.ChangeVerticesOn().Add(n2); + } + // + }// else if (aType==TopAbs_FACE) { + }// for (i=1; i<=aNbS; ++i) { + // + // 2. + aItMFI.Initialize(myFaceInfo); + for (; aItMFI.More(); aItMFI.Next()) { + nF=aItMFI.Key(); + NMTTools_FaceInfo& aFI=*((NMTTools_FaceInfo*)&aItMFI.Value()); + // + aFI.SetIndex(nF); + // + // + // 2.1 aVFs + aNbVFs=aVFs.Extent(); + for (j=1; j<=aNbVFs; ++j) { + BOPTools_VSInterference& aVFj=aVFs(j); + aVFj.Indices(n1, n2); + if (nF==n1) { + aFI.ChangeVerticesIn().Add(n2); + } + else if (nF==n2){ + aFI.ChangeVerticesIn().Add(n1); + } + }// for (j=1; j<=aNbVFs; ++j) { + // + // 2.2 aEFs + aNbEFs=aEFs.Extent(); + for (j=1; j<=aNbEFs; ++j) { + BOPTools_ESInterference& aEFj=aEFs(j); + aEFj.Indices(n1, n2); + if (!(nF==n1 || nF==n2)) { + continue; + } + // + nX=aEFj.NewShape(); + if (nX<1) { + continue; + } + // + aS=myDS->Shape(nX); + aType=aS.ShapeType(); + if (aType!=TopAbs_VERTEX) { + continue; + } + // + aFI.ChangeVerticesIn().Add(nX); + }// for (j=1; j<=aNbEFs; ++j) { + }// for (; aItMFI.More(); aItMFI.Next()) { +} + + +#include +#include +#include +#include +//======================================================================= +//function : CorrectTolR3D +//purpose : Attempt to correct the value of tolerance aTolR3D for +// the intersection curve in order to +// compel it to pass through the sticks. +// Prerequisites: +// 2. The are based on B-Spline surfaces; +// 1. There is at least the one intersection curve; +// 2. The faces have stick vertices to catch the curve; +// 3. The intersection angle is rather small (0.7-7 deg) +// +//======================================================================= +void NMTTools_PaveFiller::CorrectTolR3D(const BOPTools_SSInterference& aFF, + const TColStd_MapOfInteger& aMVStick, + Standard_Real& aTolR3D) + +{ + Standard_Boolean bHasBounds; + Standard_Integer i, nF[2], nV, aNbCurves; + Standard_Real aT1, aT2, aU, aV, aT, aA, aTolV, aTolVmax; + Standard_Real aTolR, aTolTresh, aAmin, aAmax; + TColStd_MapIteratorOfMapOfInteger aIt; + gp_Pnt aP, aP1, aP2; + gp_Dir aDN[2]; + gp_Vec aVT; + Handle(Geom_Surface) aS[2]; + Handle(Geom_Curve) aC3D; + GeomAdaptor_Surface aGAS; + GeomAbs_SurfaceType aType; + TopoDS_Face aF[2]; + // + aTolTresh=0.0005; + aAmin=0.012;// 0.7-7 deg + aAmax=0.12; + // + if (!aMVStick.Extent()) { + return; + } + // + BOPTools_SSInterference& aFFi=*((BOPTools_SSInterference*)&aFF); + BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves(); + aNbCurves=aSCvs.Length(); + if (aNbCurves!=1){ + return; + } + // + aFFi.Indices(nF[0], nF[1]); + for (i=0; i<2; ++i) { + aF[i]=*((TopoDS_Face*)(&myDS->Shape(nF[i]))); + aS[i]=BRep_Tool::Surface(aF[i]); + aGAS.Load(aS[i]); + aType=aGAS.GetType(); + if (aType!=GeomAbs_BSplineSurface) { + return; + } + } + // + BOPTools_Curve& aBC=aSCvs(1); + const IntTools_Curve& aIC=aBC.Curve(); + bHasBounds=aIC.HasBounds(); + if (!bHasBounds){ + return; + } + // + aIC.Bounds (aT1, aT2, aP1, aP2); + aT=IntTools_Tools::IntermediatePoint(aT1, aT2); + aC3D=aIC.Curve(); + aC3D->D0(aT, aP); + // + for (i=0; i<2; ++i) { + GeomAPI_ProjectPointOnSurf& aPPS=myContext->ProjPS(aF[i]); + aPPS.Perform(aP); + aPPS.LowerDistanceParameters(aU, aV); + BOPTools_Tools3D::GetNormalToSurface(aS[i], aU, aV, aDN[i]); + } + // + aA=aDN[0].Angle(aDN[1]); + aA=fabs(aA); + if (aA > 0.5*M_PI) { + aA = M_PI - aA; + } + // + if (aAaAmax) { + return; + } + // + aTolVmax=-1.; + aIt.Initialize(aMVStick); + for (; aIt.More(); aIt.Next()) { + nV=aIt.Key(); + const TopoDS_Vertex& aV=*((TopoDS_Vertex*)(&myDS->Shape(nV))); + aTolV=BRep_Tool::Tolerance(aV); + if (aTolV>aTolVmax) { + aTolVmax=aTolV; + } + } + // + + aTolR=aTolVmax/aA; + if (aTolR 0x06050100 // For OCCT6.5.2 and higher +//======================================================================= +// function: PutClosingPaveOnCurve +// purpose: +//======================================================================= +void NMTTools_PaveFiller::PutClosingPaveOnCurve(BOPTools_Curve& aBC, + BOPTools_SSInterference& aFFi) +{ + Standard_Boolean bIsClosed, bHasBounds, bAdded; + Standard_Integer nVC, j; + Standard_Real aT[2], aTolR3D, aTC, dT, aTx; + gp_Pnt aP[2] ; + BOPTools_Pave aPVx; + BOPTools_ListIteratorOfListOfPave aItLP; + // + const IntTools_Curve& aIC=aBC.Curve(); + const Handle (Geom_Curve)& aC3D=aIC.Curve(); + if(aC3D.IsNull()) { + return; + } + // + bIsClosed=IntTools_Tools::IsClosed(aC3D); + if (!bIsClosed) { + return; + } + // + bHasBounds=aIC.HasBounds (); + if (!bHasBounds){ + return; + } + // + bAdded=Standard_False; + dT=Precision::PConfusion(); + aTolR3D=aFFi.TolR3D(); + aIC.Bounds (aT[0], aT[1], aP[0], aP[1]); + // + BOPTools_PaveSet& aFFiPS=aFFi.NewPaveSet(); + BOPTools_PaveSet& aCPS=aBC.Set(); + // + const BOPTools_ListOfPave& aLP=aCPS.Set(); + aItLP.Initialize(aLP); + for (; aItLP.More() && !bAdded; aItLP.Next()) { + const BOPTools_Pave& aPC=aItLP.Value(); + nVC=aPC.Index(); + const TopoDS_Vertex aVC=TopoDS::Vertex(myDS->Shape(nVC)); + aTC=aPC.Param(); + // + for (j=0; j<2; ++j) { + if (fabs(aTC-aT[j]) < dT) { + aTx=(!j) ? aT[1] : aT[0]; + aPVx.SetIndex(nVC); + aPVx.SetParam(aTx); + // + aCPS.Append(aPVx); + aFFiPS.Append(aPVx); + // + bAdded=Standard_True; + break; + } + } + } +} +#endif // OCC_VERSION_LARGE > 0x06050100 // For OCCT6.5.2 and higher +//modified by NIZNHY-PKV Wed Sep 14 13:21:17 2011t diff --git a/src/NMTTools/NMTTools_PaveFiller_7.cxx b/src/NMTTools/NMTTools_PaveFiller_7.cxx index 86f232ad3..a365d7a73 100644 --- a/src/NMTTools/NMTTools_PaveFiller_7.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_7.cxx @@ -1,30 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller_7.cxx -// Created: Thu Dec 18 15:14:55 2003 -// Author: Peter KURNEV -// -// -#include + +// File: NMTTools_PaveFiller_7.cxx +// Author: Peter KURNEV + +#include #include #include @@ -32,26 +31,27 @@ #include #include -#include -#include #include #include +#include + +#include #include -#include -#include #include +#include #include +#include #include -#include -#include +#include #include #include #include +#include +#include #include -#include #include #include @@ -62,6 +62,7 @@ #include #include #include +#include #include @@ -80,19 +81,16 @@ #include #include +#include #include -// Modified Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN -static - void FuseVertices(const TopoDS_Shape& aCompound, - TopTools_DataMapOfShapeShape& aDMVV); -// Contribution of Samtech www.samcef.com END +#include + //======================================================================= // function: MakeSplitEdges -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::MakeSplitEdges() +void NMTTools_PaveFiller::MakeSplitEdges() { myIsDone=Standard_False; // @@ -114,7 +112,7 @@ static continue; } // - anOri=aE.Orientation(); + anOri=aE.Orientation(); aE.Orientation(TopAbs_FORWARD); // // Making Split Edges @@ -124,7 +122,7 @@ static BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges); // aNbPaveBlocks=aSplitEdges.Extent(); - + for (; aPBIt.More(); aPBIt.Next()) { BOPTools_PaveBlock& aPB=aPBIt.Value(); // aPave1 @@ -141,15 +139,15 @@ static aV2.Orientation(TopAbs_REVERSED); //xx if (aNbPaveBlocks==1) { - bIsNewVertex1=myDS->IsNewShape (nV1); - bIsNewVertex2=myDS->IsNewShape (nV2); - if (!bIsNewVertex1 && !bIsNewVertex2) { - aPB.SetEdge(i); - continue; - } + bIsNewVertex1=myDS->IsNewShape (nV1); + bIsNewVertex2=myDS->IsNewShape (nV2); + if (!bIsNewVertex1 && !bIsNewVertex2) { + aPB.SetEdge(i); + continue; + } } //xx - BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit); + BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit); // // Add Split Part of the Original Edge to the DS BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; @@ -161,8 +159,8 @@ static anASSeq.SetNewOrientation(aV2.Orientation()); // if (anOri==TopAbs_INTERNAL) { - anASSeq.SetNewAncestor(i); - aESplit.Orientation(anOri); + anASSeq.SetNewAncestor(i); + aESplit.Orientation(anOri); } // myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq); @@ -173,14 +171,193 @@ static aPB.SetEdge(aNewShapeIndex); // } - } + } myIsDone=Standard_True; } //======================================================================= // function: UpdateCommonBlocks -// purpose: +// purpose: +//======================================================================= +void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer) +{ + Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints, aNbLCB, nF; + Standard_Real aTolEx, aTolExMax, aTSRMax[2], aTx[2], aTmp; + TColStd_ListIteratorOfListOfInteger aItLI; + gp_Pnt aPMax[2]; + TopoDS_Edge aEMax; + BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPBS; + NMTTools_ListIteratorOfListOfCommonBlock aItLCB; + NMTTools_MapOfPaveBlock aMPB; + // + myIsDone=Standard_False; + // + aNbS=myDS->NumberOfShapesOfTheObject(); + for (nE=1; nE<=aNbS; ++nE) { + if (myDS->GetShapeType(nE)!=TopAbs_EDGE){ + continue; + } + // + const TopoDS_Edge& aE=*((TopoDS_Edge*)&myDS->Shape(nE)); + if (BRep_Tool::Degenerated(aE)){ + continue; + } + // + NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE)); + //modified by NIZNHY-PKV Thu Jan 19 09:03:19 2012f + aNbLCB=aLCB.Extent(); + if (!aNbLCB) { + continue; + } + // 0 + NMTTools_ListOfCommonBlock aLCBx; + // + aItLCB.Initialize(aLCB); + for (; aItLCB.More(); aItLCB.Next()) { + NMTTools_CommonBlock aCBx; + // + NMTTools_CommonBlock& aCB=aItLCB.ChangeValue(); + const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks(); + aItLPB.Initialize(aLPB); + for (; aItLPB.More(); aItLPB.Next()) { + const BOPTools_PaveBlock& aPBx=aItLPB.Value(); + nEx=aPBx.OriginalEdge(); + BOPTools_ListOfPaveBlock& aLPBS=mySplitShapesPool(myDS->RefEdge(nEx)); + aItLPBS.Initialize(aLPBS); + for (; aItLPBS.More(); aItLPBS.Next()) { + const BOPTools_PaveBlock& aPBSx=aItLPBS.Value(); + if (aPBSx.IsEqual(aPBx)) { + aCBx.AddPaveBlock(aPBSx); + break; + } + }// for (; aItLPBS.More(); aItLPBS.Next()) { + }// for (; aItLPB.More(); aItLPB.Next()) { + // + const TColStd_ListOfInteger& aLI=aCB.Faces(); + aItLI.Initialize(aLI); + for (; aItLI.More(); aItLI.Next()) { + nF=aItLI.Value(); + aCBx.AddFace(nF); + } + // + aLCBx.Append(aCBx); + }//for (; aItLCB.More(); aItLCB.Next()) { + // + aLCB.Clear(); + // + aItLCB.Initialize(aLCBx); + for (; aItLCB.More(); aItLCB.Next()) { + NMTTools_CommonBlock& aCBx=aItLCB.ChangeValue(); + aLCB.Append(aCBx); + } + //modified by NIZNHY-PKV Thu Jan 19 09:03:30 2012t + // 1 + aItLCB.Initialize(aLCB); + for (; aItLCB.More(); aItLCB.Next()) { + NMTTools_CommonBlock& aCB=aItLCB.ChangeValue(); + // + BOPTools_PaveBlock aPBMax; + aTolExMax=-1.; + const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks(); + aItLPB.Initialize(aLPB); + for (; aItLPB.More(); aItLPB.Next()) { + const BOPTools_PaveBlock& aPBx=aItLPB.Value(); + nEx=aPBx.OriginalEdge(); + const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx)); + aTolEx=BRep_Tool::Tolerance(aEx); + if (aTolEx>aTolExMax) { + aTolExMax=aTolEx; + aEMax=aEx; + aPBMax=aPBx; + } + } + // + // 2 + if (aMPB.Contains(aPBMax)) { + continue; + } + aMPB.Add(aPBMax); + // + nEMax=aPBMax.OriginalEdge(); + const IntTools_ShrunkRange& aISRMax=aPBMax.ShrunkRange(); + const IntTools_Range& aSRMax=aISRMax.ShrunkRange(); + const Bnd_Box& aBoxMax=aISRMax.BndBox(); + aSRMax.Range(aTSRMax[0], aTSRMax[1]); + for (j=0; j<2; ++j) { + BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]); + } + // + // 3 + aItLPB.Initialize(aLPB); + for (; aItLPB.More(); aItLPB.Next()) { + const BOPTools_PaveBlock& aPBx=aItLPB.Value(); + nEx=aPBx.OriginalEdge(); + if (nEx==nEMax) { + continue; + } + // + const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx)); + GeomAPI_ProjectPointOnCurve& aPPCx=myContext->ProjPC(aEx); + // + for (j=0; j<2; ++j) { + aPPCx.Perform(aPMax[j]); + aNbPoints=aPPCx.NbPoints(); + if (!aNbPoints) { + break; + } + aTx[j]=aPPCx.LowerDistanceParameter(); + } + if (!aNbPoints) { + // correction the range is impossible due to + // a projection problem + continue; + } + // + if (aTx[0]>aTx[1]){ + aTmp=aTx[0]; + aTx[0]=aTx[1]; + aTx[1]=aTmp; + } + // + // 4 Correction + // 4.1 aPBx + { + const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange(); + IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange()); + Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox()); + // + pSRx->SetFirst(aTx[0]); + pSRx->SetLast(aTx[1]); + *pBoxx=aBoxMax; + } + // + // 4.2 aPBSx + BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx)); + aItLPBS.Initialize(aLPBSx); + for (; aItLPBS.More(); aItLPBS.Next()) { + const BOPTools_PaveBlock& aPBSx=aItLPBS.Value(); + if (!aPBSx.IsEqual(aPBx)) { + continue; + } + // + const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange(); + IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange()); + Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox()); + // + pSRx->SetFirst(aTx[0]); + pSRx->SetLast(aTx[1]); + *pBoxx=aBoxMax; + } + // + // + }//for (; aItLPB.More(); aItLPB.Next()) { + }//for (; aItLCB.More(); aItLCB.Next()) { + }//for (nE=1; nE<=aNbS; ++nE) { +} +//======================================================================= +// function: UpdateCommonBlocks +// purpose: //======================================================================= - void NMTTools_PaveFiller::UpdateCommonBlocks() +void NMTTools_PaveFiller::UpdateCommonBlocks() { myIsDone=Standard_False; // @@ -199,40 +376,38 @@ static } // NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE)); - BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool (myDS->RefEdge(nE)); + /*BOPTools_ListOfPaveBlock& aLPB=*/mySplitShapesPool (myDS->RefEdge(nE)); // aCBIt.Initialize(aLCB); for (; aCBIt.More(); aCBIt.Next()) { - NMTTools_CommonBlock& aCB=aCBIt.Value(); + NMTTools_CommonBlock& aCB=aCBIt.ChangeValue(); // - //modified by NIZNHY-PKV Wed Nov 8 15:59:46 2006f // Among all PBs of aCB the first PB will be one - // that have max tolerance value + // that have max tolerance value { - Standard_Real aTolEx, aTolExMax; - BOPTools_ListOfPaveBlock *pLPB, aLPBx; - // - aTolExMax=-1.; - pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks(); - aPBIt.Initialize(*pLPB); - for (; aPBIt.More(); aPBIt.Next()) { - const BOPTools_PaveBlock& aPBx=aPBIt.Value(); - nEx=aPBx.OriginalEdge(); - const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx)); - aTolEx=BRep_Tool::Tolerance(aEx); - if (aTolEx>aTolExMax) { - aTolExMax=aTolEx; - aLPBx.Prepend(aPBx); - } - else{ - aLPBx.Append(aPBx); - } - } - // - pLPB->Clear(); - *pLPB=aLPBx; + Standard_Real aTolEx, aTolExMax; + BOPTools_ListOfPaveBlock *pLPB, aLPBx; + // + aTolExMax=-1.; + pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks(); + aPBIt.Initialize(*pLPB); + for (; aPBIt.More(); aPBIt.Next()) { + const BOPTools_PaveBlock& aPBx=aPBIt.Value(); + nEx=aPBx.OriginalEdge(); + const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx)); + aTolEx=BRep_Tool::Tolerance(aEx); + if (aTolEx>aTolExMax) { + aTolExMax=aTolEx; + aLPBx.Prepend(aPBx); + } + else{ + aLPBx.Append(aPBx); + } + } + // + pLPB->Clear(); + *pLPB=aLPBx; } - //modified by NIZNHY-PKV Wed Nov 8 15:59:50 2006t // BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE); nSp=SplitIndex(aPB); @@ -241,14 +416,14 @@ static const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks(); aPBIt.Initialize(aCBLPB); for (; aPBIt.More(); aPBIt.Next()) { - BOPTools_PaveBlock& aPBx=aPBIt.Value(); - nEx=aPBx.OriginalEdge(); - if (nEx==nE) { - continue; - } - // - nSpx=SplitIndex(aPBx); - aPBx.SetEdge(nSpx); + BOPTools_PaveBlock& aPBx=aPBIt.Value(); + nEx=aPBx.OriginalEdge(); + if (nEx==nE) { + continue; + } + // + nSpx=SplitIndex(aPBx); + aPBx.SetEdge(nSpx); } // } @@ -256,9 +431,10 @@ static } //======================================================================= // function: SplitIndex -// purpose: +// purpose: //======================================================================= - Standard_Integer NMTTools_PaveFiller::SplitIndex(const BOPTools_PaveBlock& aPBx)const +Standard_Integer NMTTools_PaveFiller::SplitIndex + (const BOPTools_PaveBlock& aPBx) const { Standard_Integer anOriginalEdge, anEdgeIndex=0; @@ -275,16 +451,16 @@ static } } return anEdgeIndex; -} +} + //======================================================================= // function: UpdatePaveBlocks -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::UpdatePaveBlocks() +void NMTTools_PaveFiller::UpdatePaveBlocks() { myIsDone=Standard_False; // - Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB; Standard_Real aT1, aT2; TColStd_IndexedMapOfInteger aMF, aME; @@ -314,20 +490,20 @@ static aE=TopoDS::Edge(aExp.Current()); // if (BRep_Tool::Degenerated(aE)) { - continue; + continue; } // nE=myDS->ShapeIndex(aE, iRankF); // if (aME.Contains(nE)) { - continue; + continue; } aME.Add(nE); // BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); aNbPB=aLPB.Extent(); if (aNbPB) { - continue; + continue; } TopExp::Vertices(aE, aV1, aV2); // @@ -349,16 +525,13 @@ static aLPB.Append(aPB); } } -} -// Modified -// to treat Alone Vertices between faces -// Thu Sep 14 14:35:18 2006 -// Contribution of Samtech www.samcef.com BEGIN +} + //======================================================================= // function: MakeAloneVertices -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::MakeAloneVertices() +void NMTTools_PaveFiller::MakeAloneVertices() { Standard_Integer i, aNbFFs, nF1, nF2, j, aNbPnts, nFx, aNbV; Standard_Real aTolF1, aTolF2, aTolSum, aTolV; @@ -416,7 +589,7 @@ static // 2. Try to fuse alone vertices themselves; FuseVertices(aCompound, aDMVV); // - // if some are fused, replace them by new ones + // if some are fused, replace them by new ones aItDMVFF.Initialize(aDMVFF); for (; aItDMVFF.More(); aItDMVFF.Next()) { const TopoDS_Shape& aVx=aItDMVFF.Key(); @@ -427,23 +600,23 @@ static } else { const TopoDS_Shape& aVy=aDMVV.Find(aVx); - + if (aDMVFF1.IsBound(aVy)) { - TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy); - aIt.Initialize(aLIx); - for(; aIt.More(); aIt.Next()) { - nFx=aIt.Value(); - aLIy.Append(nFx); - } + TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy); + aIt.Initialize(aLIx); + for(; aIt.More(); aIt.Next()) { + nFx=aIt.Value(); + aLIy.Append(nFx); + } } - else { - aDMVFF1.Bind(aVy, aLIx); + else { + aDMVFF1.Bind(aVy, aLIx); } } } aDMVFF.Clear(); // - // refine lists of faces in aDMVFF1; + // refine lists of faces in aDMVFF1; aItDMVFF.Initialize(aDMVFF1); for (; aItDMVFF.More(); aItDMVFF.Next()) { TColStd_MapOfInteger aMIy; @@ -455,7 +628,7 @@ static for(; aIt.More(); aIt.Next()) { nFx=aIt.Value(); if (aMIy.Add(nFx)) { - aLIy.Append(nFx); + aLIy.Append(nFx); } } aLIx.Clear(); @@ -474,7 +647,7 @@ static continue; } // - nVSD=FindSDVertex(i); + nVSD=FindSDVertex(i); nV=(nVSD) ? nVSD : i; const TopoDS_Shape& aVx=myDS->Shape(nV); if (!aDMVI.IsBound(aVx)) { @@ -493,7 +666,7 @@ static aDMVI.Bind(aS, i); } } - // + // // 4. Initialize BoundSortBox on aDMVI // Handle(Bnd_HArray1OfBox) aHAB; @@ -517,7 +690,7 @@ static } aBSB.Initialize(aHAB); // - // 5. Compare + // 5. Compare aItDMVFF.Initialize(aDMVFF1); for (; aItDMVFF.More(); aItDMVFF.Next()) { Bnd_Box aBoxV; @@ -540,16 +713,16 @@ static // aIt.Initialize(aLIFF); for (; aIt.More(); aIt.Next()) { - nFx=aIt.Value(); - if (myAloneVertices.Contains(nFx)) { - TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx); - aMVx.Add(nV); - } - else { - TColStd_IndexedMapOfInteger aMVx; - aMVx.Add(nV); - myAloneVertices.Add(nFx, aMVx); - } + nFx=aIt.Value(); + if (myAloneVertices.Contains(nFx)) { + TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx); + aMVx.Add(nV); + } + else { + TColStd_IndexedMapOfInteger aMVx; + aMVx.Add(nV); + myAloneVertices.Add(nFx, aMVx); + } } } } @@ -569,16 +742,16 @@ static const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i); aNbAV=aMAV.Extent(); for(j=1; j<=aNbAV; ++j) { - nV=aMAV(j); - if (aMAVF.Contains(nV)) { - TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV); - aMF.Add(nF); - } - else{ - TColStd_IndexedMapOfInteger aMF; - aMF.Add(nF); - aMAVF.Add(nV, aMF); - } + nV=aMAV(j); + if (aMAVF.Contains(nV)) { + TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV); + aMF.Add(nF); + } + else{ + TColStd_IndexedMapOfInteger aMF; + aMF.Add(nF); + aMAVF.Add(nV, aMF); + } } } // @@ -588,11 +761,11 @@ static const TColStd_IndexedMapOfInteger& aMF=aMAVF(i); aNbF=aMF.Extent(); for(j=1; jAdd(nF1, nF2, Standard_True, NMTDS_TI_FF); - } + nF1=aMF(j); + for(k=j+1; k<=aNbF; ++k) { + nF2=aMF(k); + myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF); + } } } } @@ -600,18 +773,20 @@ static } //======================================================================= // function: AloneVertices -// purpose: +// purpose: //======================================================================= - const NMTTools_IndexedDataMapOfIndexedMapOfInteger& NMTTools_PaveFiller::AloneVertices()const +const NMTTools_IndexedDataMapOfIndexedMapOfInteger& + NMTTools_PaveFiller::AloneVertices()const { return myAloneVertices; } //======================================================================= // function: FuseVertices -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::FuseVertices(const TopoDS_Shape& aCompound, - TopTools_DataMapOfShapeShape& aDMVV)const +void NMTTools_PaveFiller::FuseVertices + (const TopoDS_Shape& aCompound, + TopTools_DataMapOfShapeShape& aDMVV)const { Standard_Integer i, aNbVV, n1, n2, nX; NMTTools_PaveFiller tPF; @@ -624,7 +799,7 @@ static //tPF.PerformNewVertices(); //qq // NMTDS_ShapesDataStructure& tDS=*(tPF.DS()); - NMTDS_InterfPool& tInterfPool=*(tPF.IP()); + NMTDS_InterfPool& tInterfPool=*(tPF.IP()); BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences(); // aNbVV=aVVt.Extent(); @@ -641,4 +816,3 @@ static } } } -// Contribution of Samtech www.samcef.com END diff --git a/src/NMTTools/NMTTools_PaveFiller_8.cxx b/src/NMTTools/NMTTools_PaveFiller_8.cxx index 734d415e5..305f04ca1 100644 --- a/src/NMTTools/NMTTools_PaveFiller_8.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_8.cxx @@ -1,35 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_PaveFiller_8.cxx -// Created: Fri Dec 19 11:15:53 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_PaveFiller_8.cxx +// Created: Fri Dec 19 11:15:53 2003 +// Author: Peter KURNEV +// // -#include +#include #include #include #include +#include + #include #include @@ -45,16 +48,16 @@ #include -// Modified to add new method Thu Sep 14 14:35:18 2006 +// Modified to add new method Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN //======================================================================= // function: SharedEdges // purpose: //======================================================================= void NMTTools_PaveFiller::SharedEdges(const Standard_Integer nF1, - const Standard_Integer nF2, - TColStd_ListOfInteger& aLNE, - TopTools_ListOfShape& aLSE) + const Standard_Integer nF2, + TColStd_ListOfInteger& aLNE, + TopTools_ListOfShape& aLSE) { Standard_Integer nE1, nE2; TColStd_MapOfInteger aM1; @@ -67,7 +70,7 @@ nE1=aExp.Current(); aM1.Add(nE1); } - + aExp.Init(nF2, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { nE2=aExp.Current(); @@ -100,7 +103,7 @@ if (aCBAPI.IsCommonBlock(aPB)) { NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB); // - aIsCommonBlock=1; + aIsCommonBlock=1; // const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks(); aItPBx.Initialize(aLPBx); @@ -139,7 +142,7 @@ // purpose: //======================================================================= Standard_Integer NMTTools_PaveFiller::CommonBlocksFace(const Standard_Integer nF, - NMTTools_ListOfCommonBlock& aLCB) + NMTTools_ListOfCommonBlock& aLCB) { Standard_Integer nE; TopAbs_ShapeEnum aT; @@ -175,7 +178,7 @@ // purpose: //======================================================================= void NMTTools_PaveFiller::RealSplitsFace(const Standard_Integer nF, - BOPTools_ListOfPaveBlock& aLPB) + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE; BOPTools_ListIteratorOfListOfPaveBlock anIt; @@ -200,7 +203,7 @@ // purpose: //======================================================================= Standard_Boolean NMTTools_PaveFiller::HasRealSplitsInOnFace(const Standard_Integer nF1, - const Standard_Integer nF2) + const Standard_Integer nF2) { Standard_Boolean bFlag; BOPTools_ListOfPaveBlock aLPB; @@ -222,9 +225,9 @@ // purpose: //======================================================================= void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer ,//for overriding - const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE1; // @@ -241,8 +244,8 @@ // purpose: //======================================================================= void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nE1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nF1; // @@ -253,7 +256,7 @@ // anItCB.Initialize(aLCB); for (; anItCB.More(); anItCB.Next()) { - NMTTools_CommonBlock& aCB=anItCB.Value(); + NMTTools_CommonBlock& aCB=anItCB.ChangeValue(); const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1); @@ -262,7 +265,7 @@ for (; anItLFCB.More(); anItLFCB.Next()) { nF1=anItLFCB.Value(); if (nF1==nF2) { - aLPB.Append(aPB1R); + aLPB.Append(aPB1R); } } } @@ -272,8 +275,8 @@ // purpose: //======================================================================= void NMTTools_PaveFiller::RealSplitsOnEdge(const Standard_Integer nE1, - const Standard_Integer nE2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nE2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE; // @@ -284,7 +287,7 @@ anItCB.Initialize(aLCB); for (; anItCB.More(); anItCB.Next()) { - NMTTools_CommonBlock& aCB=anItCB.Value(); + NMTTools_CommonBlock& aCB=anItCB.ChangeValue(); const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1); // @@ -294,7 +297,7 @@ const BOPTools_PaveBlock& aPB2=anIt.Value(); nE=aPB2.OriginalEdge(); if (nE==nE2) { - aLPB.Append(aPB1R); + aLPB.Append(aPB1R); } } } @@ -304,8 +307,8 @@ // purpose: //======================================================================= void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer nE1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE2; // @@ -322,13 +325,13 @@ // purpose: //======================================================================= void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer ,//for overriding - const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE1; // - BooleanOperations_ShapesDataStructure *pDS=myDS; +// BooleanOperations_ShapesDataStructure *pDS=myDS; BooleanOperations_OnceExplorer aExp(*myDS); aExp.Init(nF1, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { @@ -343,7 +346,7 @@ // purpose: //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF, - BOPTools_ListOfPaveBlock& aLPB) + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE; TopAbs_ShapeEnum aT; @@ -376,9 +379,9 @@ // purpose: splits of edges from nF1 in nF2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding - const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE1; TopAbs_ShapeEnum aT1, aT2; @@ -403,8 +406,8 @@ // purpose: splits of edge nE1 in aFace2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nF1; TopAbs_ShapeEnum aT1, aT2; @@ -423,7 +426,7 @@ // anItCB.Initialize(aLCB); for (; anItCB.More(); anItCB.Next()) { - NMTTools_CommonBlock& aCB=anItCB.Value(); + NMTTools_CommonBlock& aCB=anItCB.ChangeValue(); const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); const TColStd_ListOfInteger& aLFCB=aCB.Faces(); @@ -431,7 +434,7 @@ for (; anItLFCB.More(); anItLFCB.Next()) { nF1=anItLFCB.Value(); if (nF1==nF2) { - aLPB.Append(aPB1); + aLPB.Append(aPB1); } } } @@ -442,8 +445,8 @@ // purpose: splits of edge nE1 on nE2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1, - const Standard_Integer nE2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nE2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE; TopAbs_ShapeEnum aT1, aT2; @@ -462,7 +465,7 @@ anItCB.Initialize(aLCB); for (; anItCB.More(); anItCB.Next()) { - NMTTools_CommonBlock& aCB=anItCB.Value(); + NMTTools_CommonBlock& aCB=anItCB.ChangeValue(); const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);//XXX // const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks(); @@ -471,7 +474,7 @@ const BOPTools_PaveBlock& aPB2=anIt.Value(); nE=aPB2.OriginalEdge(); if (nE==nE2) { - aLPB.Append(aPB1); + aLPB.Append(aPB1); } } } @@ -482,8 +485,8 @@ // purpose: splits of edge nE1 on face nF2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE2, ip; TopAbs_ShapeEnum aT1, aT2; @@ -511,9 +514,9 @@ // purpose: splits of edges from face nF1 on face nF2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding - const Standard_Integer nF1, - const Standard_Integer nF2, - BOPTools_ListOfPaveBlock& aLPB) + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) { Standard_Integer nE1, ip; TopAbs_ShapeEnum aT1, aT2; @@ -524,7 +527,7 @@ if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) { return 1; // Type mismatch } - BooleanOperations_ShapesDataStructure *pDS=myDS; +// BooleanOperations_ShapesDataStructure *pDS=myDS; BooleanOperations_OnceExplorer aExp(*myDS); aExp.Init(nF1, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { @@ -543,7 +546,7 @@ // purpose: //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF, - TColStd_ListOfInteger& aSplits) + TColStd_ListOfInteger& aSplits) { Standard_Integer nE, iErr; BOPTools_ListIteratorOfListOfPaveBlock aIt; @@ -568,9 +571,9 @@ // purpose: splits of edges from nF1 in nF2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding - const Standard_Integer nF1, - const Standard_Integer nF2, - TColStd_ListOfInteger& aSplits) + const Standard_Integer nF1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) { Standard_Integer nE, iErr; BOPTools_ListIteratorOfListOfPaveBlock aIt; @@ -593,8 +596,8 @@ // purpose: splits of edge nE1 in aFace2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1, - const Standard_Integer nF2, - TColStd_ListOfInteger& aSplits) + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) { Standard_Integer nE, iErr; BOPTools_ListIteratorOfListOfPaveBlock aIt; @@ -617,8 +620,8 @@ // purpose: splits of edge nE1 on nE2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1, - const Standard_Integer nE2, - TColStd_ListOfInteger& aSplits) + const Standard_Integer nE2, + TColStd_ListOfInteger& aSplits) { Standard_Integer nE, iErr; BOPTools_ListIteratorOfListOfPaveBlock aIt; @@ -641,8 +644,8 @@ // purpose: splits of edge nE1 on face nF2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1, - const Standard_Integer nF2, - TColStd_ListOfInteger& aSplits) + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) { Standard_Integer nE, iErr; BOPTools_ListIteratorOfListOfPaveBlock aIt; @@ -665,9 +668,9 @@ // purpose: splits of edges from face nF1 on face nF2 //======================================================================= Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding - const Standard_Integer nF1, - const Standard_Integer nF2, - TColStd_ListOfInteger& aSplits) + const Standard_Integer nF1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) { Standard_Integer nE, iErr; BOPTools_ListIteratorOfListOfPaveBlock aIt; @@ -686,3 +689,142 @@ } return 0; //Ok } +//modified by NIZNHY-PKV Mon Oct 17 12:07:48 2011f +static + void SortPaveBlocks(BOPTools_ListOfPaveBlock &); +static + void SortShell(const Standard_Integer, + BOPTools_PaveBlock *); +static + Standard_Boolean Less(const BOPTools_PaveBlock &, + const BOPTools_PaveBlock &); + +//======================================================================= +// function: RealSplitsInFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nF, + BOPTools_ListOfPaveBlock& aLPBIn) +{ + Standard_Integer j, aNbCBP, nSpIn; + TColStd_MapOfInteger aMFence; + BOPTools_ListOfPaveBlock aLPB; + BOPTools_ListIteratorOfListOfPaveBlock aItPB; + NMTTools_ListIteratorOfListOfCommonBlock aItCB; + // + NMTTools_CommonBlockPool& aCBP=ChangeCommonBlockPool(); + // + aNbCBP=aCBP.Extent(); + for (j=1; j<=aNbCBP; ++j) { + NMTTools_ListOfCommonBlock& aLCB=aCBP(j); + aItCB.Initialize(aLCB); + for (; aItCB.More(); aItCB.Next()) { + NMTTools_CommonBlock& aCB=aItCB.ChangeValue(); + if (aCB.IsPaveBlockOnFace(nF)) { + const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(); + nSpIn=aPB1.Edge(); + if (aMFence.Add(nSpIn)){ + aLPB.Append(aPB1); + } + } + } + } + // + SortPaveBlocks(aLPB); + // + aItPB.Initialize(aLPB); + for (; aItPB.More(); aItPB.Next()) { + const BOPTools_PaveBlock& aPB=aItPB.Value(); + aLPBIn.Append(aPB); + } +} +//======================================================================= +// function: SortPaveBlocks +// purpose: +//======================================================================= +void SortPaveBlocks(BOPTools_ListOfPaveBlock &aLPBIn) +{ + Standard_Integer i, aNbPBIn; + BOPTools_ListIteratorOfListOfPaveBlock aItPB; + BOPTools_PaveBlock *pPB; + // + aNbPBIn=aLPBIn.Extent(); + if (aNbPBIn<2) { + return; + } + // + pPB=new BOPTools_PaveBlock[aNbPBIn]; + // + aItPB.Initialize(aLPBIn); + for (i=0; aItPB.More(); aItPB.Next(), ++i) { + const BOPTools_PaveBlock& aPB=aItPB.Value(); + pPB[i]=aPB; + } + // + SortShell(aNbPBIn, pPB); + // + aLPBIn.Clear(); + for (i=0; i -1) goto m30; + }//if (a[l] < a[j]){ + }//for (i=0; i + +// File: NMTTools_PaveFiller_9.cxx +// Created: Fri Dec 19 11:15:53 2003 +// Author: Peter KURNEV +// // -#include +#include #include @@ -55,10 +56,10 @@ //======================================================================= // function: PrepareFace -// purpose: +// purpose: //======================================================================= - void NMTTools_PaveFiller::PrepareFace(const Standard_Integer nF, - TopoDS_Face& newFace) + void NMTTools_PaveFiller::PrepareFace(const Standard_Integer nF, + TopoDS_Face& newFace) { Standard_Boolean bToReverse, bIsDegenerated; Standard_Integer iRankF, nE, nSp, aNbPB; @@ -97,27 +98,27 @@ const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); aNbPB=aLPB.Extent(); if (!aNbPB) { - aBB.Add(newWire, aE); - continue; + aBB.Add(newWire, aE); + continue; } // aItPB.Initialize(aLPB); for (; aItPB.More(); aItPB.Next()) { - const BOPTools_PaveBlock& aPB=aItPB.Value(); - const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB); - nSp=aPBR.Edge(); - // - aSp=TopoDS::Edge(myDS->Shape(nSp)); - if (!bIsDegenerated) { - bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, myContext); - if (bToReverse) { - aSp.Reverse(); - } - } - else { - aSp.Orientation(anOrE); - } - aBB.Add(newWire, aSp); + const BOPTools_PaveBlock& aPB=aItPB.Value(); + const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB); + nSp=aPBR.Edge(); + // + aSp=TopoDS::Edge(myDS->Shape(nSp)); + if (!bIsDegenerated) { + bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, myContext); + if (bToReverse) { + aSp.Reverse(); + } + } + else { + aSp.Orientation(anOrE); + } + aBB.Add(newWire, aSp); } } aBB.Add(newFace, newWire); diff --git a/src/NMTTools/NMTTools_StdMapNodeOfMapOfPaveBlock.hxx b/src/NMTTools/NMTTools_StdMapNodeOfMapOfPaveBlock.hxx deleted file mode 100644 index af49cafff..000000000 --- a/src/NMTTools/NMTTools_StdMapNodeOfMapOfPaveBlock.hxx +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (C) 2007-2008 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 _NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile -#define _NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_NMTTools_StdMapNodeOfMapOfPaveBlock_HeaderFile -#include -#endif - -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class BOPTools_PaveBlock; -class BOPTools_PaveBlockMapHasher; -class NMTTools_MapOfPaveBlock; -class NMTTools_MapIteratorOfMapOfPaveBlock; - - - -class NMTTools_StdMapNodeOfMapOfPaveBlock : public TCollection_MapNode { - -public: - // Methods PUBLIC - // - -NMTTools_StdMapNodeOfMapOfPaveBlock(const BOPTools_PaveBlock& K,const TCollection_MapNodePtr& n); - - BOPTools_PaveBlock& Key() const; -//Standard_EXPORT ~NMTTools_StdMapNodeOfMapOfPaveBlock(); - - - - - // Type management - // - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -BOPTools_PaveBlock myKey; - - -}; - -#define TheKey BOPTools_PaveBlock -#define TheKey_hxx -#define Hasher BOPTools_PaveBlockMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTTools_MapIteratorOfMapOfPaveBlock -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_Type_() NMTTools_StdMapNodeOfMapOfPaveBlock_Type_() -#define TCollection_Map NMTTools_MapOfPaveBlock -#define TCollection_Map_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_StdMapNode -#undef TCollection_StdMapNode_hxx -#undef TCollection_MapIterator -#undef TCollection_MapIterator_hxx -#undef Handle_TCollection_StdMapNode -#undef TCollection_StdMapNode_Type_ -#undef TCollection_Map -#undef TCollection_Map_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/NMTTools/NMTTools_StdMapNodeOfMapOfPaveBlock_0.cxx b/src/NMTTools/NMTTools_StdMapNodeOfMapOfPaveBlock_0.cxx deleted file mode 100644 index 6d479e813..000000000 --- a/src/NMTTools/NMTTools_StdMapNodeOfMapOfPaveBlock_0.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2007-2008 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 - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _BOPTools_PaveBlock_HeaderFile -#include -#endif -#ifndef _BOPTools_PaveBlockMapHasher_HeaderFile -#include -#endif -#ifndef _NMTTools_MapOfPaveBlock_HeaderFile -#include -#endif -#ifndef _NMTTools_MapIteratorOfMapOfPaveBlock_HeaderFile -#include -#endif -//NMTTools_StdMapNodeOfMapOfPaveBlock::~NMTTools_StdMapNodeOfMapOfPaveBlock() {} - - - -Standard_EXPORT Handle_Standard_Type& NMTTools_StdMapNodeOfMapOfPaveBlock_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("NMTTools_StdMapNodeOfMapOfPaveBlock", - sizeof(NMTTools_StdMapNodeOfMapOfPaveBlock), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(NMTTools_StdMapNodeOfMapOfPaveBlock) Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(NMTTools_StdMapNodeOfMapOfPaveBlock) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(NMTTools_StdMapNodeOfMapOfPaveBlock))) { - _anOtherObject = Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)((Handle(NMTTools_StdMapNodeOfMapOfPaveBlock)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& NMTTools_StdMapNodeOfMapOfPaveBlock::DynamicType() const -{ - return STANDARD_TYPE(NMTTools_StdMapNodeOfMapOfPaveBlock) ; -} -//Standard_Boolean NMTTools_StdMapNodeOfMapOfPaveBlock::IsKind(const Handle(Standard_Type)& AType) const -//{ -// return (STANDARD_TYPE(NMTTools_StdMapNodeOfMapOfPaveBlock) == AType || TCollection_MapNode::IsKind(AType)); -//} -//Handle_NMTTools_StdMapNodeOfMapOfPaveBlock::~Handle_NMTTools_StdMapNodeOfMapOfPaveBlock() {} -#define TheKey BOPTools_PaveBlock -#define TheKey_hxx -#define Hasher BOPTools_PaveBlockMapHasher -#define Hasher_hxx -#define TCollection_StdMapNode NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_hxx -#define TCollection_MapIterator NMTTools_MapIteratorOfMapOfPaveBlock -#define TCollection_MapIterator_hxx -#define Handle_TCollection_StdMapNode Handle_NMTTools_StdMapNodeOfMapOfPaveBlock -#define TCollection_StdMapNode_Type_() NMTTools_StdMapNodeOfMapOfPaveBlock_Type_() -#define TCollection_Map NMTTools_MapOfPaveBlock -#define TCollection_Map_hxx -#include - diff --git a/src/NMTTools/NMTTools_Tools.cdl b/src/NMTTools/NMTTools_Tools.cdl deleted file mode 100644 index 9341d837b..000000000 --- a/src/NMTTools/NMTTools_Tools.cdl +++ /dev/null @@ -1,102 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File: NMTTools_Tools.cdl --- Created: Mon Dec 8 10:32:34 2003 --- Author: Peter KURNEV --- --- -class Tools from NMTTools - - ---Purpose: - -uses - Vertex from TopoDS, - Edge from TopoDS, - Face from TopoDS, - Context from IntTools, - Curve from Geom2d, - - ListOfShape from TopTools, - IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd, - CArray1OfVVInterference from BOPTools, - CArray1OfSSInterference from BOPTools, - ListOfCoupleOfShape from NMTTools, - IndexedDataMapOfShapeIndexedMapOfShape from NMTTools - ---raises - -is - MakeNewVertex (myclass; - aLV : ListOfShape from TopTools; - aNewVertex: out Vertex from TopoDS); - FindChains(myclass; - aVVs:CArray1OfVVInterference from BOPTools; - aMCX: out IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd); - - FindChains(myclass; - aVVs:CArray1OfSSInterference from BOPTools; - aMCX: out IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd); - - FindChains(myclass; - aMCV: IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd; - aMCX: out IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd); - - - IsSplitInOnFace(myclass; - aE : Edge from TopoDS; - aF : Face from TopoDS; - aCtx:out Context from IntTools) - returns Boolean from Standard; - - AreFacesSameDomain(myclass; - aF1 : Face from TopoDS; - aF2 : Face from TopoDS; - aCtx : out Context from IntTools) - returns Boolean from Standard; - - FindChains(myclass; - aLCS:ListOfCoupleOfShape from NMTTools; - aM :out IndexedDataMapOfShapeIndexedMapOfShape from NMTTools); - - FindChains(myclass; - aM1: IndexedDataMapOfShapeIndexedMapOfShape from NMTTools; - aM2:out IndexedDataMapOfShapeIndexedMapOfShape from NMTTools); - ---modified by NIZNHY-PKV Thu Nov 16 10:58:08 2006f --- MakePCurve(myclass; --- aE : Edge from TopoDS; --- aF : Face from TopoDS; --- aC2D: Curve from Geom2d; --- aTolR2D: Real from Standard); - - MakePCurve(myclass; - aE : Edge from TopoDS; - aF : Face from TopoDS; - aC2D : Curve from Geom2d); - - UpdateEdge(myclass; - aE : Edge from TopoDS; - aTol : Real from Standard); ---modified by NIZNHY-PKV Thu Nov 16 10:58:14 2006t ---fields - -end Tools; diff --git a/src/NMTTools/NMTTools_Tools.cxx b/src/NMTTools/NMTTools_Tools.cxx index da3da38a5..7d06d68c1 100644 --- a/src/NMTTools/NMTTools_Tools.cxx +++ b/src/NMTTools/NMTTools_Tools.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: NMTTools_Tools.cxx -// Created: Mon Dec 8 10:35:15 2003 -// Author: Peter KURNEV -// + +// File: NMTTools_Tools.cxx +// Created: Mon Dec 8 10:35:15 2003 +// Author: Peter KURNEV +// // -#include +#include #include @@ -73,25 +74,25 @@ #include #include -static +static void ProcessBlock(const Standard_Integer iV, - const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, - TColStd_IndexedMapOfInteger& aProcessed, - TColStd_IndexedMapOfInteger& aChain); + const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, + TColStd_IndexedMapOfInteger& aProcessed, + TColStd_IndexedMapOfInteger& aChain); static void ProcessBlock(const TopoDS_Shape& aF, - const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, - TopTools_IndexedMapOfShape& aProcessed, - TopTools_IndexedMapOfShape& aChain); + const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, + TopTools_IndexedMapOfShape& aProcessed, + TopTools_IndexedMapOfShape& aChain); //modified by NIZNHY-PKV Thu Nov 16 10:46:53 2006f SKL/PartC5 //======================================================================= // function: UpdateEdge -// purpose: +// purpose: //======================================================================= void NMTTools_Tools::UpdateEdge(const TopoDS_Edge& aE, - const Standard_Real aTolR) -{ + const Standard_Real aTolR) +{ Standard_Real aTolE, aTolES, aTolV; TopoDS_Iterator aIt; BRep_Builder aBB; @@ -111,12 +112,12 @@ static } //======================================================================= // function: MakePCurve -// purpose: +// purpose: //======================================================================= void NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Handle(Geom2d_Curve)& aC2Dx1) - + const TopoDS_Face& aF, + const Handle(Geom2d_Curve)& aC2Dx1) + { Standard_Real aTolE, aT1, aT2, aOutFirst, aOutLast, aOutTol; Handle(Geom2d_Curve) aC2D, aC2DA; @@ -138,10 +139,10 @@ static } // if (aC3DE->IsPeriodic()) { - BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA); + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA); } else { - BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA); + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA); } // aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE); @@ -150,14 +151,14 @@ static /* //======================================================================= // function: MakePCurve -// purpose: +// purpose: //======================================================================= void NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Handle(Geom2d_Curve)& aC2Dx, - const Standard_Real aTolR2D) + const TopoDS_Face& aF, + const Handle(Geom2d_Curve)& aC2Dx, + const Standard_Real aTolR2D) { - Standard_Integer k, aNbV; + Standard_Integer k, aNbV; Standard_Real aTolEdge, aTolFact, aTolV, aTolVmax; Standard_Real aTFirst, aTLast, aOutFirst, aOutLast, aOutTol; TopoDS_Face aFFWD; @@ -197,24 +198,24 @@ static BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True); } if (aC3DE->IsPeriodic()) { - BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aTFirst, aTLast, aC2D, aC2DA); + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aTFirst, aTLast, aC2D, aC2DA); } else { - BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA); + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA); } // aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolFact); BRepLib::SameParameter(aE); } */ -//modified by NIZNHY-PKV Thu Nov 16 10:46:55 2006t +//modified by NIZNHY-PKV Thu Nov 16 10:46:55 2006t //======================================================================= // function: IsSplitInOnFace -// purpose: +// purpose: //======================================================================= Standard_Boolean NMTTools_Tools::IsSplitInOnFace(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - IntTools_Context& aContext) + const TopoDS_Face& aF, + const Handle(IntTools_Context)& aContext) { Standard_Boolean bFlag; Standard_Real aT, aTolE, aTolF, aTol, aDist, aU, aV; @@ -225,7 +226,7 @@ static aTolF=BRep_Tool::Tolerance(aF); aTol=aTolE+aTolF; // - GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF); + GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF); // aT=BOPTools_Tools2D::IntermediatePoint(aE); BOPTools_Tools::PointOnEdge(aE, aT, aP); @@ -244,15 +245,15 @@ static // aProjector.LowerDistanceParameters(aU, aV); aP2D.SetCoord(aU, aV); - bFlag=aContext.IsPointInOnFace (aF, aP2D); + bFlag=aContext->IsPointInOnFace (aF, aP2D); return bFlag; } //======================================================================= // function: NMTTools_Tools::MakeNewVertex -// purpose : +// purpose : //======================================================================= void NMTTools_Tools::MakeNewVertex(const TopTools_ListOfShape& aLVs, - TopoDS_Vertex& aNewVertex) + TopoDS_Vertex& aNewVertex) { Standard_Integer aNb; Standard_Real aTi, aDi, aDmax=-1.e5; @@ -292,10 +293,10 @@ static } //======================================================================= // function: FindChains -// purpose : +// purpose : //======================================================================= void NMTTools_Tools::FindChains(const BOPTools_CArray1OfSSInterference& FFs, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) { Standard_Boolean bIsTangentFaces; Standard_Integer j, aNb, anIndex1, anIndex2; @@ -340,10 +341,10 @@ static } //======================================================================= // function: FindChains -// purpose : +// purpose : //======================================================================= void NMTTools_Tools::FindChains(const BOPTools_CArray1OfVVInterference& VVs, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) { Standard_Integer j, aNb, anIndex1, anIndex2; BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV; @@ -382,10 +383,10 @@ static //======================================================================= // function: FindChains -// purpose : +// purpose : //======================================================================= void NMTTools_Tools::FindChains(const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) { Standard_Integer i, j, aNbCV, aNbV, iV, iVx; TColStd_IndexedMapOfInteger aProcessed, aChain; @@ -412,12 +413,12 @@ static } //======================================================================= // function: ProcessBlock -// purpose: +// purpose: //======================================================================= void ProcessBlock(const Standard_Integer iV, - const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, - TColStd_IndexedMapOfInteger& aProcessed, - TColStd_IndexedMapOfInteger& aChain) + const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, + TColStd_IndexedMapOfInteger& aProcessed, + TColStd_IndexedMapOfInteger& aChain) { Standard_Integer j, aNbV, iVx; // @@ -436,14 +437,14 @@ void ProcessBlock(const Standard_Integer iV, } //======================================================================= // function: AreFacesSameDomain -// purpose : +// purpose : //======================================================================= Standard_Boolean NMTTools_Tools::AreFacesSameDomain(const TopoDS_Face& aF1x, - const TopoDS_Face& aF2y, - IntTools_Context& aCtx) + const TopoDS_Face& aF2y, + const Handle(IntTools_Context)& aCtx) { Standard_Boolean bFlag; - // Modified Thu Sep 14 14:35:18 2006 + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN Standard_Integer aNbE1, aNbE2; Standard_Real aTolF1, aTolF2, aTol; @@ -462,7 +463,7 @@ void ProcessBlock(const Standard_Integer iV, aF2=aF2y; aF2.Orientation(TopAbs_FORWARD); // - // Modified Thu Sep 14 14:35:18 2006 + // Modified Thu Sep 14 14:35:18 2006 // Contribution of Samtech www.samcef.com BEGIN // // 1 @@ -479,7 +480,7 @@ void ProcessBlock(const Standard_Integer iV, const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); if (!BRep_Tool::Degenerated(aE)) { if (!aME1.Contains(aE)) { - return bFlag; + return bFlag; } aME2.Add(aE); } @@ -507,7 +508,7 @@ void ProcessBlock(const Standard_Integer iV, for (; aIt.More(); aIt.Next()) { const TopoDS_Edge& aE=TopoDS::Edge(aIt.Key()); BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP); - bFlag=aCtx.IsValidPointForFace(aP, aF2, aTol); + bFlag=aCtx->IsValidPointForFace(aP, aF2, aTol); break; } // @@ -515,12 +516,12 @@ void ProcessBlock(const Standard_Integer iV, } //======================================================================= // function: FindChains -// purpose : +// purpose : //======================================================================= void NMTTools_Tools::FindChains(const NMTTools_ListOfCoupleOfShape& aLCS, - NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) { - NMTTools_ListIteratorOfListOfCoupleOfShape aItCS; + NMTTools_ListIteratorOfListOfCoupleOfShape aItCS; NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMCV; // aItCS.Initialize(aLCS); @@ -559,10 +560,10 @@ void ProcessBlock(const Standard_Integer iV, } //======================================================================= // function: FindChains -// purpose : +// purpose : //======================================================================= void NMTTools_Tools::FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, - NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) { Standard_Integer i, j, aNbCV, aNbV; TopTools_IndexedMapOfShape aProcessed, aChain; @@ -589,12 +590,12 @@ void ProcessBlock(const Standard_Integer iV, } //======================================================================= // function: ProcessBlock -// purpose: +// purpose: //======================================================================= void ProcessBlock(const TopoDS_Shape& aF, - const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, - TopTools_IndexedMapOfShape& aProcessed, - TopTools_IndexedMapOfShape& aChain) + const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, + TopTools_IndexedMapOfShape& aProcessed, + TopTools_IndexedMapOfShape& aChain) { Standard_Integer j, aNbV; // diff --git a/src/NMTTools/NMTTools_Tools.hxx b/src/NMTTools/NMTTools_Tools.hxx index 89b91404e..6be0cc1a8 100644 --- a/src/NMTTools/NMTTools_Tools.hxx +++ b/src/NMTTools/NMTTools_Tools.hxx @@ -1,138 +1,99 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: NMTTools_Tools.hxx +// Created: Mon Dec 8 10:35:15 2003 +// Author: Peter KURNEV +// + #ifndef _NMTTools_Tools_HeaderFile #define _NMTTools_Tools_HeaderFile -#ifndef _Standard_Boolean_HeaderFile +#include +#include #include -#endif -#ifndef _Handle_Geom2d_Curve_HeaderFile +#include #include -#endif -#ifndef _Standard_Real_HeaderFile #include -#endif -class TopTools_ListOfShape; -class TopoDS_Vertex; -class BOPTools_CArray1OfVVInterference; -class BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger; -class BOPTools_CArray1OfSSInterference; -class TopoDS_Edge; -class TopoDS_Face; -class IntTools_Context; -class NMTTools_ListOfCoupleOfShape; -class NMTTools_IndexedDataMapOfShapeIndexedMapOfShape; -class Geom2d_Curve; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : NMTTools_Tools +//purpose : +//======================================================================= class NMTTools_Tools { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - - -Standard_EXPORT static void MakeNewVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex& aNewVertex) ; - - -Standard_EXPORT static void FindChains(const BOPTools_CArray1OfVVInterference& aVVs,BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ; - - -Standard_EXPORT static void FindChains(const BOPTools_CArray1OfSSInterference& aVVs,BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ; - - -Standard_EXPORT static void FindChains(const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV,BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ; - - -Standard_EXPORT static Standard_Boolean IsSplitInOnFace(const TopoDS_Edge& aE,const TopoDS_Face& aF,IntTools_Context& aCtx) ; - - -Standard_EXPORT static Standard_Boolean AreFacesSameDomain(const TopoDS_Face& aF1,const TopoDS_Face& aF2,IntTools_Context& aCtx) ; - - -Standard_EXPORT static void FindChains(const NMTTools_ListOfCoupleOfShape& aLCS,NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM) ; - - -Standard_EXPORT static void FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM1,NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM2) ; - - -Standard_EXPORT static void MakePCurve(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Handle(Geom2d_Curve)& aC2D) ; - - -Standard_EXPORT static void UpdateEdge(const TopoDS_Edge& aE,const Standard_Real aTol) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - + public: + Standard_EXPORT + static void MakeNewVertex(const TopTools_ListOfShape& aLV, + TopoDS_Vertex& aNewVertex) ; + + Standard_EXPORT + static void FindChains(const BOPTools_CArray1OfVVInterference& aVVs, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ; + + Standard_EXPORT + static void FindChains(const BOPTools_CArray1OfSSInterference& aVVs, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ; + + Standard_EXPORT + static void FindChains(const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCX) ; + + Standard_EXPORT + static Standard_Boolean IsSplitInOnFace(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const Handle(IntTools_Context)& aCtx) ; + + Standard_EXPORT + static Standard_Boolean AreFacesSameDomain(const TopoDS_Face& aF1, + const TopoDS_Face& aF2, + const Handle(IntTools_Context)& aCtx) ; + + Standard_EXPORT + static void FindChains(const NMTTools_ListOfCoupleOfShape& aLCS, + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM) ; + + Standard_EXPORT + static void FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM1, + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aM2) ; + + Standard_EXPORT + static void MakePCurve(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const Handle(Geom2d_Curve)& aC2D) ; + + Standard_EXPORT + static void UpdateEdge(const TopoDS_Edge& aE, + const Standard_Real aTol) ; }; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - #endif diff --git a/src/NMTTools/NMTTools_Tools.ixx b/src/NMTTools/NMTTools_Tools.ixx deleted file mode 100644 index 5b825b3fc..000000000 --- a/src/NMTTools/NMTTools_Tools.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 - - - - diff --git a/src/NMTTools/NMTTools_Tools.jxx b/src/NMTTools/NMTTools_Tools.jxx deleted file mode 100644 index 7b6f648a2..000000000 --- a/src/NMTTools/NMTTools_Tools.jxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile -#include -#endif -#ifndef _BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger_HeaderFile -#include -#endif -#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _IntTools_Context_HeaderFile -#include -#endif -#ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile -#include -#endif -#ifndef _NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile -#include -#endif -#ifndef _Geom2d_Curve_HeaderFile -#include -#endif -#ifndef _NMTTools_Tools_HeaderFile -#include -#endif diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index a40b492e4..7cba7edbe 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -1,30 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_AISShape.cxx // Author : Nicolas REJNERI // Module : GEOM -// $Header$ -// + /*! \class GEOM_AISShape GEOM_AISShape.hxx \brief .... @@ -32,31 +32,63 @@ #include "GEOM_AISShape.ixx" #include "SALOME_InteractiveObject.hxx" +#include "GEOM_AISVector.hxx" // Open CASCADE Includes #include #include + +#include + +#include +#include +#include +#include +#include #include +#include + #include +#include +#include + #include #include #include #include #include #include -#include +#include + #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include +#include + +GEOM_AISShape::TopLevelDispMode GEOM_AISShape::myTopLevelDm = GEOM_AISShape::TopKeepCurrent; +Quantity_Color GEOM_AISShape::myTopLevelColor; -using namespace std; static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, - const Handle(AIS_InteractiveContext)& theIC, - SelectMgr_IndexedMapOfOwner& theMap ) + const Handle(AIS_InteractiveContext)& theIC, + SelectMgr_IndexedMapOfOwner& theMap ) { if ( theObj.IsNull() || theIC.IsNull() ) return; @@ -75,20 +107,20 @@ static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, for ( sel->Init(); sel->More(); sel->Next() ) { Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive(); if ( entity.IsNull() ) - continue; + continue; Handle(SelectMgr_EntityOwner) owner = - Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId()); + Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId()); if ( !owner.IsNull() ) - theMap.Add( owner ); + theMap.Add( owner ); } } } static void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap, - const TopoDS_Shape& aMainShape, - const SelectMgr_IndexedMapOfOwner& anAllMap, - SelectMgr_IndexedMapOfOwner& aToHiliteMap ) + const TopoDS_Shape& aMainShape, + const SelectMgr_IndexedMapOfOwner& anAllMap, + SelectMgr_IndexedMapOfOwner& aToHiliteMap ) { TopTools_IndexedMapOfShape aMapOfShapes; TopExp::MapShapes(aMainShape, aMapOfShapes); @@ -109,10 +141,32 @@ static void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap, } GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape, - const Standard_CString aName) - : SALOME_AISShape(shape), myName(aName) + const Standard_CString aName) + : SALOME_AISShape(shape), myName(aName), myDisplayVectors(false) { myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); + myPrevDisplayMode = 0; + storeBoundaryColors(); + + + myEdgesInShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); + + myUIsoNumber = -1; + myVIsoNumber = -1; + + myTopLevel = Standard_False; + Graphic3d_MaterialAspect aMatAspect; + if ( !HasMaterial() ) { + aMatAspect.SetAmbient( 0.5 ); + aMatAspect.SetDiffuse( 0.5 ); + aMatAspect.SetEmissive( 0.5 ); + aMatAspect.SetShininess(0.5 ); + aMatAspect.SetSpecular( 0.5 ); + + myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect); + myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect); + } + myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); } void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){ @@ -144,49 +198,119 @@ Standard_CString GEOM_AISShape::getName(){ } void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, - const Handle(Prs3d_Presentation)& aPrs, - const Standard_Integer aMode) + const Handle(Prs3d_Presentation)& aPrs, + const Standard_Integer aMode) { if (IsInfinite()) aPrs->SetInfiniteState(Standard_True); //pas de prise en compte lors du FITALL - - StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode; - switch (d) { - case StdSelect_DM_Wireframe: + Handle(AIS_InteractiveContext) anIC = GetContext(); + + // StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode; + bool isTopLev = (isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor); + switch (aMode) { + case 0://StdSelect_DM_Wireframe: { - StdPrs_WFShape::Add(aPrs,myshape,myDrawer); + restoreIsoNumbers(); + // Restore wireframe edges colors + restoreBoundaryColors(); + if(isTopLev) { + SetColor(topLevelColor()); + Handle(Prs3d_LineAspect) anAspect = Attributes()->WireAspect(); + anAspect->SetColor( topLevelColor() ); + Attributes()->SetWireAspect( anAspect ); + } + StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer); break; } - case StdSelect_DM_Shading: + case 1://StdSelect_DM_Shading: { - myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn(); - - Graphic3d_MaterialAspect aMatAspect; - aMatAspect.SetAmbient( 0.5 ); - aMatAspect.SetDiffuse( 0.5 ); - aMatAspect.SetEmissive( 0.5 ); - aMatAspect.SetShininess(0.5 ); - aMatAspect.SetSpecular( 0.5 ); - - myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect); - myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE); - - Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); - Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial(); - FMat.SetTransparency(myTransparency); BMat.SetTransparency(myTransparency); - myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat); - myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat); + restoreIsoNumbers(); + shadingMode(aPresentationManager, aPrs, aMode); + // Store wireframe edges colors + storeBoundaryColors(); + break; + } + case 3: //StdSelect_DM_HLR: + { + if(!isTopLev) + AIS_TexturedShape::Compute(aPresentationManager, aPrs, aMode); + else + shadingMode(aPresentationManager, aPrs, AIS_Shaded); + break; + } + } - //Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect(); - // P->SetPrimitivesAspect(a4bis); - // G->SetGroupPrimitivesAspect(a4bis); - //a4bis->SetInteriorColor(myShadingColor); - myDrawer->ShadingAspect()->SetColor(myShadingColor); + if ( aMode == ShadingWithEdges ) { + // Temporary store number of iso lines in order to recover its later + // when display mode is achnged to 'Wirefame' or 'Shading'. + // Iso lines are not displayed in 'Shading with edges' mode. + storeIsoNumbers(); - // PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces - //StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer); - AIS_Shape::Compute(aPresentationManager, aPrs, aMode); - break; + // Reset number of iso lines to 0 + resetIsoNumbers(); + + //Shaded faces + shadingMode(aPresentationManager, aPrs, AIS_Shaded); + + // Store wireframe edges colors + storeBoundaryColors(); + + // Coloring edges + Handle(Prs3d_LineAspect) anAspect = myDrawer->UnFreeBoundaryAspect(); + anAspect->SetColor( myEdgesInShadingColor ); + myDrawer->SetUnFreeBoundaryAspect( anAspect ); + + anAspect = myDrawer->FreeBoundaryAspect(); + anAspect->SetColor( myEdgesInShadingColor ); + myDrawer->SetFreeBoundaryAspect( anAspect ); + + // Add edges to presentation + StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer); + } + + if (isShowVectors()) + { + const bool isVector = IsKind(STANDARD_TYPE(GEOM_AISVector)); + TopExp_Explorer Exp ( myshape, TopAbs_EDGE ); + for ( ; Exp.More(); Exp.Next() ) { + TopoDS_Vertex aV1, aV2; + TopoDS_Edge anEdgeE = TopoDS::Edge(Exp.Current()); + if ( !isVector ) + // draw curve direction (issue 0021087) + anEdgeE.Orientation( TopAbs_FORWARD ); + + if ( anEdgeE.IsNull() ) continue; + + TopExp::Vertices(anEdgeE, aV1, aV2); + gp_Pnt aP1 = BRep_Tool::Pnt(aV1); + gp_Pnt aP2 = BRep_Tool::Pnt(aV2); + + double fp,lp; + gp_Vec aDirVec; + Handle(Geom_Curve) C = BRep_Tool::Curve(anEdgeE,fp,lp); + + if ( C.IsNull() ) continue; + + if ( anEdgeE.Orientation() == TopAbs_FORWARD ) + C->D1(lp, aP2, aDirVec); + else { + C->D1(fp, aP1, aDirVec); + aP2 = aP1; + } + + GeomAdaptor_Curve aAdC; + aAdC.Load(C, fp, lp); + Standard_Real aDist = GCPnts_AbscissaPoint::Length(aAdC, fp, lp); + + if (aDist > gp::Resolution()) { + gp_Dir aDir; + if ( anEdgeE.Orientation() == TopAbs_FORWARD ) + aDir = aDirVec; + else + aDir = -aDirVec; + + Prs3d_Arrow::Draw(aPrs, aP2, aDir, M_PI/180.*5., aDist/10.); + } } } // aPrs->ReCompute(); // for hidden line recomputation if necessary... @@ -203,10 +327,10 @@ void GEOM_AISShape::SetTransparency(const Standard_Real aValue) } Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); - Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial(); - FMat.SetTransparency(aValue); BMat.SetTransparency(aValue); + FMat.SetTransparency(aValue); myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat); - myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat); + myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(FMat); + myCurrentMaterial = FMat; myTransparency = aValue; } @@ -215,8 +339,13 @@ void GEOM_AISShape::SetShadingColor(const Quantity_Color &aCol) myShadingColor = aCol; } +void GEOM_AISShape::SetEdgesInShadingColor(const Quantity_Color &aCol) +{ + myEdgesInShadingColor = aCol; +} + void GEOM_AISShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, - const Standard_Boolean aHighlight ) + const Standard_Boolean aHighlight ) { Handle(AIS_InteractiveObject) anObj = this; Handle(AIS_InteractiveContext) anIC = GetContext(); @@ -245,3 +374,143 @@ void GEOM_AISShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndex anIC->SetAutomaticHilight( isAutoHilight ); anIC->HilightSelected( false ); } + +void GEOM_AISShape::SetDisplayVectors(bool isDisplayed) +{ + myDisplayVectors = isDisplayed; +} + +void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPrs, + const Standard_Integer aMode) +{ + myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn(); + + Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC); + aMatAspect.SetTransparency(myTransparency); + myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); + myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial ); + myDrawer->ShadingAspect()->Aspect()->SetBackMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial ); + + //Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect(); + // P->SetPrimitivesAspect(a4bis); + // G->SetGroupPrimitivesAspect(a4bis); + //a4bis->SetInteriorColor(myShadingColor); + if( isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor ) + myDrawer->ShadingAspect()->SetColor( topLevelColor() ); + else { + if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT )) + myDrawer->ShadingAspect()->SetColor(myShadingColor); + else + myDrawer->ShadingAspect()->SetColor(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().AmbientColor()); + } + + // PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces + //StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer); + AIS_Shape::Compute(aPresentationManager, aPrs, aMode); +} + +void GEOM_AISShape::storeIsoNumbers() +{ + myUIsoNumber = myDrawer->UIsoAspect()->Number(); + myVIsoNumber = myDrawer->VIsoAspect()->Number(); +} + +void GEOM_AISShape::restoreIsoNumbers() +{ + if ( myUIsoNumber > 0 ) { + // Restore number of U iso lines + Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect(); + anAspect->SetNumber( myUIsoNumber ); + myDrawer->SetUIsoAspect( anAspect ); + } + + if ( myVIsoNumber > 0 ) { + // Restore number of V iso lines + Handle(Prs3d_IsoAspect) anAspect = myDrawer->VIsoAspect(); + anAspect->SetNumber( myVIsoNumber ); + myDrawer->SetVIsoAspect( anAspect ); + } +} + +void GEOM_AISShape::resetIsoNumbers() +{ + Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect(); + anAspect->SetNumber( 0 ); + myDrawer->SetUIsoAspect( anAspect ); + + anAspect = myDrawer->VIsoAspect(); + anAspect->SetNumber( 0 ); + myDrawer->SetVIsoAspect( anAspect ); +} + +void GEOM_AISShape::storeBoundaryColors() +{ + Aspect_TypeOfLine aLT; + Standard_Real aW; + + myDrawer->FreeBoundaryAspect()->Aspect()->Values( myFreeBoundaryColor, aLT, aW); + myDrawer->UnFreeBoundaryAspect()->Aspect()->Values( myUnFreeBoundaryColor, aLT, aW); +} + +void GEOM_AISShape::restoreBoundaryColors() +{ + Handle(Prs3d_LineAspect) anAspect = myDrawer->FreeBoundaryAspect(); + anAspect->SetColor( myFreeBoundaryColor ); + myDrawer->SetFreeBoundaryAspect( anAspect ); + + anAspect = myDrawer->UnFreeBoundaryAspect(); + anAspect->SetColor( myUnFreeBoundaryColor ); + myDrawer->SetUnFreeBoundaryAspect( anAspect ); +} + + +Standard_Boolean GEOM_AISShape::isTopLevel() { + return myTopLevel; +} + +void GEOM_AISShape::setTopLevel(Standard_Boolean f) { + if(f) { + if(f != myTopLevel) + myPrevDisplayMode = DisplayMode(); + Standard_Integer dm; + switch(topLevelDisplayMode()) { + case TopKeepCurrent : dm = myPrevDisplayMode; break; + case TopWireFrame : dm = AIS_WireFrame; break; + case TopShadingWithEdges : dm = ShadingWithEdges; break; + default : dm = AIS_Shaded; break; + } + SetDisplayMode(dm); + } else { + if(f != myTopLevel) + SetDisplayMode(myPrevDisplayMode); + } + myTopLevel = f; +} + +void GEOM_AISShape::setPrevDisplayMode(const Standard_Integer mode) { + myPrevDisplayMode = mode; +} + +Quantity_Color GEOM_AISShape::topLevelColor() { + return myTopLevelColor; +} + +void GEOM_AISShape::setTopLevelColor(const Quantity_Color c) { + myTopLevelColor = c; +} + +GEOM_AISShape::TopLevelDispMode GEOM_AISShape::topLevelDisplayMode() { + return myTopLevelDm; +} +void GEOM_AISShape::setTopLevelDisplayMode(const GEOM_AISShape::TopLevelDispMode dm) { + myTopLevelDm = dm; +} + +Standard_Boolean GEOM_AISShape::switchTopLevel() { + return myTopLevelDm != TopShowAdditionalWActor; +} + +Standard_Boolean GEOM_AISShape::toActivate() { + return Standard_True; +} \ No newline at end of file diff --git a/src/OBJECT/GEOM_AISShape.hxx b/src/OBJECT/GEOM_AISShape.hxx index 643d51019..eec1ef7bf 100644 --- a/src/OBJECT/GEOM_AISShape.hxx +++ b/src/OBJECT/GEOM_AISShape.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_AISShape.hxx // Module : GEOM @@ -56,6 +57,9 @@ #include +#include +#include + class PrsMgr_PresentationManager3d; class Prs3d_Presentation; class SALOME_InteractiveObject; @@ -65,6 +69,24 @@ class GEOM_OBJECT_EXPORT GEOM_AISShape : public SALOME_AISShape { public: + //! Enumeration of display modes + typedef enum { + //WireFrame, //!< the same as AIS_WireFrame + //Shading, //!< the same as AIS_Shaded + ShadingWithEdges = AIS_Shaded+1, //!< shading with edges + TexturedShape = ShadingWithEdges+1 //!< the same as AIS_ExactHLR + } DispMode; + + //! Enumeration of top level display modes + typedef enum { + TopShowAdditionalWActor = 0, + TopKeepCurrent, //!< Keep current display mode + TopWireFrame, + TopShading, + TopShadingWithEdges, + } TopLevelDispMode; + + inline void* operator new(size_t,void* anAddress) { return anAddress; @@ -83,33 +105,78 @@ public: // } // Methods PUBLIC // - GEOM_AISShape(const TopoDS_Shape& shape, const Standard_CString aName); - Standard_Boolean hasIO() ; - void setIO(const Handle(SALOME_InteractiveObject)& name) ; - void setName(const Standard_CString aName) ; - Standard_CString getName() ; - Handle_SALOME_InteractiveObject getIO() ; - void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ); - ~GEOM_AISShape(); - - void SetTransparency(const Standard_Real aValue); - void SetShadingColor(const Quantity_Color &aCol); - - virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, - const Handle(Prs3d_Presentation)& aPresentation, - const Standard_Integer aMode = 0) ; - + GEOM_AISShape(const TopoDS_Shape& shape, const Standard_CString aName); + Standard_Boolean hasIO() ; + void setIO(const Handle(SALOME_InteractiveObject)& name) ; + void setName(const Standard_CString aName) ; + Standard_CString getName() ; + Standard_Boolean isTopLevel(); + void setTopLevel(Standard_Boolean); + Handle_SALOME_InteractiveObject getIO() ; + void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ); + ~GEOM_AISShape(); + + void SetTransparency(const Standard_Real aValue); + void SetShadingColor(const Quantity_Color &aCol); + void SetEdgesInShadingColor(const Quantity_Color &aCol); + void SetDisplayVectors(bool isShow); + + virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer aMode = 0) ; + + virtual bool isShowVectors () { return myDisplayVectors; } + virtual Standard_Boolean switchTopLevel(); + virtual Standard_Boolean toActivate(); + // Type management // - friend Handle_Standard_Type& GEOM_AISShape_Type_(); - const Handle(Standard_Type)& DynamicType() const; - Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + friend Handle_Standard_Type& GEOM_AISShape_Type_(); + const Handle(Standard_Type)& DynamicType() const; + Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + + void storeIsoNumbers(); + void restoreIsoNumbers(); + void resetIsoNumbers(); + + void storeBoundaryColors(); + + static Quantity_Color topLevelColor(); + static void setTopLevelColor(const Quantity_Color c); + + static TopLevelDispMode topLevelDisplayMode(); + static void setTopLevelDisplayMode(const TopLevelDispMode dm); + + void setPrevDisplayMode(const Standard_Integer mode); + Standard_Integer prevDisplayMode() const {return myPrevDisplayMode;} + protected: + void shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPrs, + const Standard_Integer aMode); + + void restoreBoundaryColors(); + Quantity_Color myShadingColor; + Quantity_Color myFreeBoundaryColor; + Quantity_Color myUnFreeBoundaryColor; + + Quantity_Color myEdgesInShadingColor; + + int myUIsoNumber; + int myVIsoNumber; + private: - TCollection_AsciiString myName; + TCollection_AsciiString myName; + bool myDisplayVectors; + Standard_Boolean myTopLevel; + Graphic3d_MaterialAspect myCurrentMaterial; + Standard_Integer myPrevDisplayMode; + + static TopLevelDispMode myTopLevelDm; + static Quantity_Color myTopLevelColor; }; diff --git a/src/OBJECT/GEOM_AISShape.ixx b/src/OBJECT/GEOM_AISShape.ixx index b72aa5a84..5f504a5a5 100644 --- a/src/OBJECT/GEOM_AISShape.ixx +++ b/src/OBJECT/GEOM_AISShape.ixx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_AISShape.ixx // Module : GEOM @@ -54,10 +55,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_AISShape_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,aType7,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOM_AISShape", - sizeof(GEOM_AISShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOM_AISShape), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/OBJECT/GEOM_AISShape.jxx b/src/OBJECT/GEOM_AISShape.jxx index b02bfe1e3..136116d22 100644 --- a/src/OBJECT/GEOM_AISShape.jxx +++ b/src/OBJECT/GEOM_AISShape.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_AISShape.jxx // Module : GEOM diff --git a/src/OBJECT/GEOM_AISTrihedron.cxx b/src/OBJECT/GEOM_AISTrihedron.cxx index 661a1a84a..6763d747b 100755 --- a/src/OBJECT/GEOM_AISTrihedron.cxx +++ b/src/OBJECT/GEOM_AISTrihedron.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM_AISTrihedron : Filter for VTK viewer // File : GEOM_AISTrihedron.cxx // Author : Sergey LITONIN diff --git a/src/OBJECT/GEOM_AISTrihedron.hxx b/src/OBJECT/GEOM_AISTrihedron.hxx index b70bea8b4..b9eccc5cc 100755 --- a/src/OBJECT/GEOM_AISTrihedron.hxx +++ b/src/OBJECT/GEOM_AISTrihedron.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM_AISTrihedron : Filter for VTK viewer // File : GEOM_AISTrihedron.hxx // Author : Sergey LITONIN diff --git a/src/OBJECT/GEOM_AISVector.cxx b/src/OBJECT/GEOM_AISVector.cxx index 44262f149..051b875cc 100644 --- a/src/OBJECT/GEOM_AISVector.cxx +++ b/src/OBJECT/GEOM_AISVector.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_AISVector.cxx // Author : Julia DOROVSKIKH @@ -28,18 +29,8 @@ // OCCT Includes #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + IMPLEMENT_STANDARD_HANDLE(GEOM_AISVector, GEOM_AISShape) IMPLEMENT_STANDARD_RTTIEXT(GEOM_AISVector, GEOM_AISShape) @@ -62,28 +53,4 @@ void GEOM_AISVector::Compute (const Handle(PrsMgr_PresentationManager3d)& thePre const Standard_Integer theMode) { GEOM_AISShape::Compute(thePresentationManager, thePrs, theMode); - - if (myshape.ShapeType() == TopAbs_EDGE) - { - TopoDS_Vertex aV1, aV2; - TopoDS_Edge anEdgeE = TopoDS::Edge(myshape); - TopExp::Vertices(anEdgeE, aV1, aV2); - gp_Pnt aP1 = BRep_Tool::Pnt(aV1); - gp_Pnt aP2 = BRep_Tool::Pnt(aV2); - - gp_Vec aVec (aP1, aP2); - Standard_Real aDist = aVec.Magnitude(); - if (aDist > gp::Resolution()) - { - gp_Dir aDir (aVec); - - Handle(Graphic3d_Group) aG = Prs3d_Root::CurrentGroup(thePrs); - - //thePrs->Color(myShadingColor.Name()); - //aG->BeginPrimitives(); - Prs3d_Arrow::Draw(thePrs, aP2, aDir, PI/180.*5., aDist/10.); - //aG->EndPrimitives(); - } - } - //thePrs->ReCompute(); // for hidden line recomputation if necessary... } diff --git a/src/OBJECT/GEOM_AISVector.hxx b/src/OBJECT/GEOM_AISVector.hxx index 2ffbf3a4f..b53f9a85c 100644 --- a/src/OBJECT/GEOM_AISVector.hxx +++ b/src/OBJECT/GEOM_AISVector.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_AISVector.hxx // Author : Julia DOROVSKIKH @@ -53,6 +54,8 @@ protected: const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + virtual bool isShowVectors() {return true;} + public: DEFINE_STANDARD_RTTI (GEOM_AISVector) }; diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index e9e047146..a68e25b0e 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_Actor.cxx // Author : Christophe ATTANASIO @@ -36,8 +37,11 @@ #include "GEOM_EdgeSource.h" #include "GEOM_WireframeFace.h" #include "GEOM_ShadingFace.h" +#include "GEOM_PainterPolyDataMapper.h" #include "SVTK_Actor.h" +#include + #include #include #include @@ -46,14 +50,8 @@ #include #include -#include -#include -#include #include #include -#include -#include -#include #include #include @@ -68,6 +66,8 @@ #include "utilities.h" +#include "SALOME_InteractiveObject.hxx" + //vtkStandardNewMacro(GEOM_Actor); #ifndef MYDEBUG @@ -75,9 +75,15 @@ #endif GEOM_Actor::GEOM_Actor(): + isOnlyVertex(false), + + myDeflection(-1), + myIsForced(false), + // myDisplayMode(eWireframe), myIsSelected(false), - + myVectorMode(false), + myVertexActor(GEOM_DeviceActor::New(),true), myVertexSource(GEOM_VertexSource::New(),true), @@ -98,12 +104,16 @@ GEOM_Actor::GEOM_Actor(): myHighlightActor(GEOM_DeviceActor::New(),true), myAppendFilter(vtkAppendPolyData::New(),true), - myPolyDataMapper(vtkPolyDataMapper::New(),true), + // Use mapper as an instance of GEOM_PainterPolyDataMapper class + // to prevent drawing of mappers' content (due to an empty definition + // of GEOM_PainterPolyDataMapper::RenderPiece(...)). + // !!! Presentation of GEOM_Actor is drawing only with help of actors + // defined in this class !!! + myPolyDataMapper(GEOM_PainterPolyDataMapper::New(),true), myHighlightProp(vtkProperty::New()), myPreHighlightProp(vtkProperty::New()), myShadingFaceProp(vtkProperty::New()) - { #ifdef MYDEBUG MESSAGE (this<< " GEOM_Actor::GEOM_Actor"); @@ -119,6 +129,7 @@ GEOM_Actor::GEOM_Actor(): myHighlightProp->SetAmbientColor(1, 1, 1); myHighlightProp->SetDiffuseColor(1, 1, 1); myHighlightProp->SetSpecularColor(0.5, 0.5, 0.5); + myHighlightProp->SetPointSize(SALOME_POINT_SIZE); myHighlightActor->SetProperty(myHighlightProp.GetPointer()); this->myHighlightActor->SetInput(myAppendFilter->GetOutput(),false); @@ -135,13 +146,13 @@ GEOM_Actor::GEOM_Actor(): aProperty->SetPointSize(3); aProperty->SetColor(1, 1, 0); - myAppendFilter->AddInput(myIsolatedEdgeSource->GetOutput()); + myAppendFilter->AddInput(myIsolatedEdgeSource->GetOutput()); myIsolatedEdgeActor->SetInput(myIsolatedEdgeSource->GetOutput(),false); aProperty = myIsolatedEdgeActor->GetProperty(); aProperty->SetRepresentation(VTK_WIREFRAME); aProperty->SetColor(1, 0, 0); - myAppendFilter->AddInput(myOneFaceEdgeSource->GetOutput()); + myAppendFilter->AddInput(myOneFaceEdgeSource->GetOutput()); myOneFaceEdgeActor->SetInput(myOneFaceEdgeSource->GetOutput(),false); aProperty = myOneFaceEdgeActor->GetProperty(); aProperty->SetRepresentation(VTK_WIREFRAME); @@ -161,7 +172,7 @@ GEOM_Actor::GEOM_Actor(): myShadingFaceActor->SetInput(myShadingFaceSource->GetOutput(),true); - myShadingFaceProp->SetRepresentation(VTK_SURFACE); + myShadingFaceProp->SetRepresentation(VTKViewer::Representation::Surface); myShadingFaceProp->SetInterpolationToGouraud(); myShadingFaceProp->SetAmbient(1.0); myShadingFaceProp->SetDiffuse(1.0); @@ -172,9 +183,14 @@ GEOM_Actor::GEOM_Actor(): myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer()); + StoreBoundaryColors(); + + myNbIsos[0] = -1; + myNbIsos[1] = -1; + // Toggle display mode setDisplayMode(0); // WIRE FRAME - + SetVectorMode(0); // } @@ -276,8 +292,45 @@ GEOM_Actor:: setDisplayMode(int theMode) { #ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::SetDisplayMode = "<SetProperty(Prop); } + +vtkProperty* GEOM_Actor::GetWireframeProperty() +{ + return myWireframeFaceActor->GetProperty(); +} + void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) { #ifdef MYDEBUG @@ -503,6 +510,12 @@ void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) } +vtkProperty* GEOM_Actor::GetShadingProperty() +{ + return myShadingFaceProp; +} + + void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) { #ifdef MYDEBUG @@ -525,13 +538,15 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) } switch(myDisplayMode){ - case 0://wireframe + case eWireframe://wireframe myPreHighlightProp->SetRepresentationToWireframe(); myHighlightProp->SetRepresentationToWireframe(); break; - case 1://shading + case eShading://shading + case eShadingWithEdges://shading with edges myPreHighlightProp->SetRepresentationToSurface(); myHighlightProp->SetRepresentationToSurface(); + myShadingFaceProp->SetRepresentationToSurface(); break; } @@ -555,7 +570,7 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) this->Device->SetBackfaceProperty(this->BackfaceProperty); } this->Device->SetProperty(this->Property); - if(myShape.ShapeType() == TopAbs_VERTEX) { + /* if(myShape.ShapeType() == TopAbs_VERTEX) { if(ren){ //The parameter determine size of vertex actor relate to diagonal of RendererWindow static vtkFloatingPointType delta = 0.01; @@ -571,7 +586,7 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) this->Device->SetUserMatrix(aMatrix); this->Device->Render(ren,theMapper); aMatrix->Delete(); - } else + } else*/ this->Device->Render(ren, theMapper); } @@ -592,7 +607,7 @@ void GEOM_Actor::ShallowCopy(vtkProp *prop) GEOM_Actor *f = GEOM_Actor::SafeDownCast(prop); if ( f != NULL ) { - this->SetShape(f->getTopo(),f->GetDeflection(),f->GetIsRelative()); + this->SetShape(f->getTopo(),f->GetDeflection()); } // Now do superclass @@ -650,7 +665,7 @@ void GEOM_Actor::highlight(bool highlight) #ifdef MYDEBUG MESSAGE ( this << " GEOM_Actor::highlight highlight="<SetOpacity(opa); myHighlightProp->SetOpacity(opa); myPreHighlightProp->SetOpacity(opa); + myVertexActor->GetProperty()->SetOpacity(opa); } vtkFloatingPointType GEOM_Actor::GetOpacity() @@ -671,10 +687,14 @@ void GEOM_Actor::SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloat { // enk:tested OK myShadingFaceProp->SetColor(r,g,b); // shading color (Shading) - myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b); // standalone edge color (Wireframe) myVertexActor->GetProperty()->SetColor(r,g,b); // vertex actor (Shading/Wireframe) - myOneFaceEdgeActor->GetProperty()->SetColor(r,g,b); // standalone face edge color (Wireframe) - mySharedEdgeActor->GetProperty()->SetColor(r,g,b); // share edge color (Wireframe) + if ( myDisplayMode != (int)eShadingWithEdges ) { + myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b); // standalone edge color (Wireframe) + myOneFaceEdgeActor->GetProperty()->SetColor(r,g,b); // standalone face edge color (Wireframe) + mySharedEdgeActor->GetProperty()->SetColor(r,g,b); // share edge color (Wireframe) + } + + StoreBoundaryColors(); } void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) @@ -687,9 +707,57 @@ void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFlo b = aRGB[2]; } +void GEOM_Actor::SetMaterial(std::vector theProps) +{ + // we set material properties as back and front material + double aCoefnt; + + // Set reflection coefficients + aCoefnt = theProps[0]->GetAmbient(); + myShadingFaceProp->SetAmbient(aCoefnt); + myVertexActor->GetProperty()->SetAmbient(aCoefnt); + + // Set diffuse coefficients + aCoefnt = theProps[0]->GetDiffuse(); + myShadingFaceProp->SetDiffuse(aCoefnt); + myVertexActor->GetProperty()->SetDiffuse(aCoefnt); + + // Set specular coefficients + aCoefnt = theProps[0]->GetSpecular(); + myShadingFaceProp->SetSpecular(aCoefnt); + myVertexActor->GetProperty()->SetSpecular(aCoefnt); + + double* aColor; + + // Set reflection colors + aColor = theProps[0]->GetAmbientColor(); + myShadingFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]); + myVertexActor->GetProperty()->SetAmbientColor(aColor[0], aColor[1], aColor[2]); + + // Set diffuse colors + aColor = theProps[0]->GetDiffuseColor(); + myShadingFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]); + myVertexActor->GetProperty()->SetDiffuseColor(aColor[0], aColor[1], aColor[2]); + + // Set specular colors + aColor = theProps[0]->GetSpecularColor(); + myShadingFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]); + myVertexActor->GetProperty()->SetSpecularColor(aColor[0], aColor[1], aColor[2]); + + // Set shininess + aCoefnt = theProps[0]->GetSpecularPower(); + myShadingFaceProp->SetSpecularPower(aCoefnt); + myVertexActor->GetProperty()->SetSpecularPower(aCoefnt); +} + +vtkProperty* GEOM_Actor::GetMaterial() +{ + return myShadingFaceProp; +} + bool GEOM_Actor::IsInfinitive() { - return (bool)(myShape.Infinite()); + return ((bool)myShape.Infinite() || isOnlyVertex); } /*! @@ -703,7 +771,15 @@ GEOM_Actor #ifdef MYDEBUG MESSAGE ( this << " GEOM_Actor::Highlight myIsSelected="<getEntry() << endl; +// int nbio = mySelector->IObjectCount(); +// cout << " nbio = " << nbio << endl; + if( !mySelector->IsSelected( myIO ) ) { - SetPreSelected( true ); + // printf ("!!!!!!!!!!!!!!!!\n"); + SetPreSelected( true ); } } default: @@ -758,8 +847,8 @@ GEOM_Actor bool GEOM_Actor ::Highlight(vtkInteractorStyle *theInteractorStyle, - SVTK_SelectionEvent* theSelectionEvent, - bool theIsHighlight) + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight) { // define the selection of object #ifdef MYDEBUG @@ -821,13 +910,13 @@ void GEOM_Actor::GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result) else { distance = sqrt( - (pos[0] - this->Position[0])*(pos[0] - this->Position[0]) + + (pos[0] - this->Position[0])*(pos[0] - this->Position[0]) + (pos[1] - this->Position[1])*(pos[1] - this->Position[1]) + (pos[2] - this->Position[2])*(pos[2] - this->Position[2])); for (i = 0; i < 3; i++) - { + { Rz[i] = (pos[i] - this->Position[i])/distance; - } + } } vtkMath::Cross(vup,Rz,Rx); @@ -860,3 +949,68 @@ void GEOM_Actor::GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result) matrix->Delete(); this->Transform->Pop(); } + +void GEOM_Actor::SetEdgesInShadingColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) +{ + myEdgesInShadingColor[0] = r; + myEdgesInShadingColor[1] = g; + myEdgesInShadingColor[2] = b; +} + +void GEOM_Actor::StoreIsoNumbers() +{ + myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]); +} + +void GEOM_Actor::SetIsosWidth(const int width) { + myWireframeFaceActor->GetProperty()->SetLineWidth(width); +} + +int GEOM_Actor::GetIsosWidth() const { + return (int)myWireframeFaceActor->GetProperty()->GetLineWidth(); +} + +void GEOM_Actor::SetWidth(const int width) { + myIsolatedEdgeActor->GetProperty()->SetLineWidth(width); + myOneFaceEdgeActor->GetProperty()->SetLineWidth(width); + mySharedEdgeActor->GetProperty()->SetLineWidth(width); + myHighlightProp->SetLineWidth(width); + myPreHighlightProp->SetLineWidth(width+1); + +} + +int GEOM_Actor::GetWidth() const { + return (int)myIsolatedEdgeActor->GetProperty()->GetLineWidth(); +} + +void GEOM_Actor::RestoreIsoNumbers() +{ + if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 ) + // Restore number of U and (or) V iso lines + myWireframeFaceSource->SetNbIso(myNbIsos); +} + +void GEOM_Actor::ResetIsoNumbers() +{ + int aNb[2] = {0, 0}; + myWireframeFaceSource->SetNbIso(aNb); +} + +void GEOM_Actor::StoreBoundaryColors() +{ + myShadingFaceProp->GetColor(myEdgesInWireframeColor); + +} + +void GEOM_Actor::RestoreBoundaryColors() +{ + myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0], + myEdgesInWireframeColor[1], + myEdgesInWireframeColor[2]); + myOneFaceEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0], + myEdgesInWireframeColor[1], + myEdgesInWireframeColor[2]); + mySharedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0], + myEdgesInWireframeColor[1], + myEdgesInWireframeColor[2]); +} diff --git a/src/OBJECT/GEOM_Actor.h b/src/OBJECT/GEOM_Actor.h index af1b9b7e2..28df32d67 100644 --- a/src/OBJECT/GEOM_Actor.h +++ b/src/OBJECT/GEOM_Actor.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_Actor.h // Author : Christophe ATTANASIO @@ -50,7 +51,6 @@ typedef GEOM_SmartPtr PWFaceSource; class GEOM_ShadingFace; typedef GEOM_SmartPtr PSFaceSource; -#include class vtkRenderer; class vtkAppendPolyData; @@ -63,18 +63,16 @@ public: static GEOM_Actor* New(); void SetShape(const TopoDS_Shape& theShape, - float theDeflection, - bool theIsRelative, - bool theIsVector = false); + float theDeflection, + bool theIsVector = false); - void SetDeflection(float theDeflection, bool theIsRelative); + void SetDeflection(float theDeflection); float GetDeflection() const{ return myDeflection;} - bool GetIsRelative() const{ return myIsRelative;} void AddToRender(vtkRenderer* theRenderer); void RemoveFromRender(vtkRenderer* theRenderer); - enum EDisplayMode{ eWireframe, eShading}; + enum EDisplayMode{ eWireframe, eShading, eShadingWithEdges = eShading + 2 }; /* void SetDisplayMode(EDisplayMode theMode); */ /* EDisplayMode GetDisplayMode() const { return myDisplayMode;} */ @@ -88,6 +86,9 @@ public: void SetWireframeProperty(vtkProperty* Prop); void SetShadingProperty(vtkProperty* Prop); + vtkProperty* GetWireframeProperty(); + vtkProperty* GetShadingProperty(); + void setDeflection(double adef); virtual void setDisplayMode(int thenewmode); @@ -102,7 +103,7 @@ public: void ReleaseGraphicsResources(vtkWindow *); const TopoDS_Shape& getTopo(); void setInputShape(const TopoDS_Shape& ashape, double adef1, - int imode, bool isVector = false); + int imode, bool isVector = false); double getDeflection(); double isVector(); @@ -124,6 +125,10 @@ public: void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); + // Material + void SetMaterial(std::vector theProps); + vtkProperty* GetMaterial(); + virtual bool IsInfinitive(); // overloaded functions @@ -137,15 +142,15 @@ public: virtual bool PreHighlight(vtkInteractorStyle* theInteractorStyle, - SVTK_SelectionEvent* theSelectionEvent, - bool theIsHighlight); + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight); //! To process highlight (called from #SVTK_InteractorStyle) virtual bool Highlight(vtkInteractorStyle* theInteractorStyle, - SVTK_SelectionEvent* theSelectionEvent, - bool theIsHighlight); + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight); //! Visibility management virtual @@ -162,29 +167,59 @@ public: virtual void GetNbIsos(int &theNbU,int &theNbV); + + virtual + void SetIsosWidth(const int width); -protected: - void SetShape(const TopoDS_Shape& theShape, - const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap, - bool theIsVector = false); + int GetIsosWidth() const; + + virtual void SetWidth(const int width); + + int GetWidth() const; + + //! Vector mode management + virtual + void + SetVectorMode(const bool theMode); + + virtual + bool + GetVectorMode(); + + //! Edges in shading color management + void SetEdgesInShadingColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); + + void + StoreIsoNumbers(); + + void + RestoreIsoNumbers(); + + void + ResetIsoNumbers(); +protected: void SetModified(); void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result); + void StoreBoundaryColors(); + void RestoreBoundaryColors(); + GEOM_Actor(); ~GEOM_Actor(); private: TopoDS_Shape myShape; int myNbIsos[2]; + bool isOnlyVertex; float myDeflection; - bool myIsRelative; bool myIsForced; // EDisplayMode myDisplayMode; bool myIsSelected; + bool myVectorMode; PDeviceActor myVertexActor; PVertexSource myVertexSource; @@ -210,12 +245,17 @@ private: vtkSmartPointer myShadingFaceProp; PAppendFilter myAppendFilter; - PPolyDataMapper myPolyDataMapper; + PPolyGeomPainterDataMapper myPolyDataMapper; virtual void SetMapper(vtkMapper*); GEOM_Actor(const GEOM_Actor&); void operator=(const GEOM_Actor&); + + vtkFloatingPointType myEdgesInWireframeColor[3]; + vtkFloatingPointType myEdgesInShadingColor[3]; }; #endif //GEOM_ACTOR_H + + diff --git a/src/OBJECT/GEOM_AssemblyBuilder.cxx b/src/OBJECT/GEOM_AssemblyBuilder.cxx deleted file mode 100644 index 69d7fa9f5..000000000 --- a/src/OBJECT/GEOM_AssemblyBuilder.cxx +++ /dev/null @@ -1,481 +0,0 @@ -// Copyright (C) 2007-2008 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 OBJECT : interactive object for Geometry entities visualization -// File : GEOM_AssemblyBuilder.cxx -// Author : Christophe ATTANASIO -// Module : GEOM -// $Header$ -// -/*! - \class GEOM_AssemblyBuilder GEOM_AssemblyBuilder.h - \brief .... -*/ - -#include "GEOM_AssemblyBuilder.h" -#include "GEOM_Actor.h" - -#include -#include - -#include -#include -#include - -// Open CASCADE Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Qt includes -#include - -#include "utilities.h" - -using namespace std; -// SALOME - -#define MAX2(X, Y) ( Abs(X) > Abs(Y)? Abs(X) : Abs(Y) ) -#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X,Y) , Z) ) - - - - - -void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp, - vtkProperty* FaceProp, - vtkProperty* EdgeFProp, - vtkProperty* EdgeSProp, - vtkProperty* EdgeIProp, - vtkProperty* VertexProp, - vtkProperty* IsoPVProp, - vtkProperty* EdgePVProp, - vtkProperty* VertexPVProp) -{ - // Shading like default OCC material - FaceProp->SetRepresentationToSurface(); - FaceProp->SetInterpolationToGouraud(); - FaceProp->SetAmbient(1.0); - FaceProp->SetDiffuse(1.0); - FaceProp->SetSpecular(0.4); - FaceProp->SetAmbientColor(0.329412, 0.223529, 0.027451); - FaceProp->SetDiffuseColor(0.780392, 0.568627, 0.113725); - FaceProp->SetSpecularColor(0.992157, 0.941176, 0.807843); - - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QColor aColor; - - // Wireframe for iso - aColor = aResMgr->colorValue( "Geometry", "isos_color", QColor( int(0.5*255), int(0.5*255), int(0.5*255) ) ); - float red = aColor.red()/255.0; - float green = aColor.green()/255.0; - float blue = aColor.blue()/255.0; - IsoProp->SetRepresentationToWireframe(); - IsoProp->SetAmbientColor(red, green, blue); - IsoProp->SetDiffuseColor(red, green, blue); - IsoProp->SetSpecularColor(red, green, blue); - - // Wireframe for iso - IsoPVProp->SetRepresentationToWireframe(); - IsoPVProp->SetAmbientColor(0, 1, 1); - IsoPVProp->SetDiffuseColor(0, 1, 1); - IsoPVProp->SetSpecularColor(0, 1, 1); - - // Wireframe for shared edge - aColor = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) ); - red = aColor.red()/255.0; - green = aColor.green()/255.0; - blue = aColor.blue()/255.0; - EdgeSProp->SetRepresentationToWireframe(); - EdgeSProp->SetAmbientColor(red, green, blue); - EdgeSProp->SetDiffuseColor(red, green, blue); - EdgeSProp->SetSpecularColor(red, green, blue); - - // Wireframe for free edge - aColor = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) ); - red = aColor.red()/255.0; - green = aColor.green()/255.0; - blue = aColor.blue()/255.0; - EdgeFProp->SetRepresentationToWireframe(); - EdgeFProp->SetAmbientColor(red, green, blue); - EdgeFProp->SetDiffuseColor(red, green, blue); - EdgeFProp->SetSpecularColor(red, green, blue); - - // Wireframe for isolated edge - aColor = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) ); - red = aColor.red()/255.0; - green = aColor.green()/255.0; - blue = aColor.blue()/255.0; - EdgeIProp->SetRepresentationToWireframe(); - EdgeIProp->SetAmbientColor(red, green, blue); - EdgeIProp->SetDiffuseColor(red, green, blue); - - // Wireframe for Preview edge - EdgePVProp->SetRepresentationToWireframe(); - EdgePVProp->SetAmbientColor(1, 1, 0); - EdgePVProp->SetDiffuseColor(1, 1, 0); - EdgePVProp->SetSpecularColor(1, 1, 0); - - // Wireframe for vertex - aColor = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ); - red = aColor.red()/255.0; - green = aColor.green()/255.0; - blue = aColor.blue()/255.0; - VertexProp->SetRepresentationToWireframe(); - VertexProp->SetAmbientColor(red, green, blue); - VertexProp->SetDiffuseColor(red, green, blue); - VertexProp->SetSpecularColor(red, green, blue); - - // Wireframe for vertex - VertexPVProp->SetRepresentationToWireframe(); - VertexPVProp->SetAmbientColor(0, 1, 1); - VertexPVProp->SetDiffuseColor(0, 1, 1); - VertexPVProp->SetSpecularColor(0, 1, 1); -} - - -void GEOM_AssemblyBuilder::MeshShape(const TopoDS_Shape myShape, - Standard_Real deflection, - Standard_Boolean forced) -{ - // Mesh the shape if necessary - Standard_Boolean alreadymesh = Standard_True; - TopExp_Explorer ex; - TopLoc_Location aLoc; - - for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next()) { - const TopoDS_Face& aFace = TopoDS::Face(ex.Current()); - Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc); - if(aPoly.IsNull()) { alreadymesh = Standard_False; break; } - } - - if(!alreadymesh || forced) { - if(deflection<=0) { - // Compute default deflection - Bnd_Box B; - BRepBndLib::Add(myShape, B); - if ( B.IsVoid() ) return; // NPAL15983 (Bug when displaying empty groups) - Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; - B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - deflection = MAX3( aXmax-aXmin , aYmax-aYmin , aZmax-aZmin) * 0.001 *4; - } - BRepMesh_IncrementalMesh MESH(myShape,deflection); - } -} - - - -vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShape, - Standard_Real deflection, - Standard_Integer mode, - Standard_Boolean forced, - Standard_Boolean isVector) -{ - /* - vtkProperty* IsoProp = vtkProperty::New(); - vtkProperty* FaceProp = vtkProperty::New(); - vtkProperty* EdgeFProp = vtkProperty::New(); - vtkProperty* EdgeSProp = vtkProperty::New(); - vtkProperty* EdgeIProp = vtkProperty::New(); - vtkProperty* VertexProp = vtkProperty::New(); - vtkProperty* IsoPVProp = vtkProperty::New(); - vtkProperty* EdgePVProp = vtkProperty::New(); - vtkProperty* VertexPVProp = vtkProperty::New(); - InitProperties(IsoProp,FaceProp,EdgeFProp,EdgeSProp,EdgeIProp,VertexProp,IsoPVProp,EdgePVProp,VertexPVProp); - */ - - vtkActorCollection* AISActors = vtkActorCollection::New(); - MeshShape(myShape,deflection,forced); - GEOM_Actor* aGeomActor = GEOM_Actor::New(); - aGeomActor->SetShape(myShape,(float)deflection,false,isVector); - AISActors->AddItem(aGeomActor); - - aGeomActor->Delete(); - - /* - if(myShape.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator anItr(myShape); - for(; anItr.More(); anItr.Next()) { - vtkActorCollection* theActors = - GEOM_AssemblyBuilder::BuildActors(anItr.Value(), deflection, mode, forced); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - while(!(anActor==NULL)) { - AISActors->AddItem(anActor); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - // Create graphics properties - - vtkProperty* IsoProp = vtkProperty::New(); - vtkProperty* FaceProp = vtkProperty::New(); - vtkProperty* EdgeFProp = vtkProperty::New(); - vtkProperty* EdgeSProp = vtkProperty::New(); - vtkProperty* EdgeIProp = vtkProperty::New(); - vtkProperty* VertexProp = vtkProperty::New(); - - vtkProperty* IsoPVProp = vtkProperty::New(); - vtkProperty* EdgePVProp = vtkProperty::New(); - vtkProperty* VertexPVProp = vtkProperty::New(); - - InitProperties(IsoProp,FaceProp,EdgeFProp,EdgeSProp,EdgeIProp,VertexProp,IsoPVProp,EdgePVProp,VertexPVProp); - - MeshShape(myShape,deflection,forced); - - if ( myShape.ShapeType() <= 4 && myShape.ShapeType() != TopAbs_COMPOUND) { - - // FACE Actor - // look if edges are free or shared - TopTools_IndexedDataMapOfShapeListOfShape edgemap; - TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,edgemap); - - TopExp_Explorer ex; - - for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next()) { - - GEOM_Actor* FaceActor = GEOM_Actor::New(); - FaceActor->SetShadingProperty(FaceProp); - FaceActor->SetWireframeProperty(IsoProp); - - FaceActor->SetPreviewProperty(IsoPVProp); - - FaceActor->setInputShape(ex.Current(),deflection,mode); - - AISActors->AddItem(FaceActor); - - TopExp_Explorer ex2; - for (ex2.Init(ex.Current(), TopAbs_EDGE); ex2.More(); ex2.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge(ex2.Current()); - - if (BRep_Tool::Degenerated(aEdge)) { - continue; - } - - // compute the number of faces - Standard_Integer nbf = edgemap.FindFromKey(ex2.Current()).Extent(); - GEOM_Actor* EdgeActor = GEOM_Actor::New(); - EdgeActor->SubShapeOn(); - EdgeActor->setInputShape(ex2.Current(),deflection,mode); - - switch (nbf) { - - case 0 : // isolated edge - { - EdgeActor->SetShadingProperty(EdgeIProp); - EdgeActor->SetWireframeProperty(EdgeIProp); - } - break; - - case 1 :// edge in only one face - { - EdgeActor->SetShadingProperty(EdgeFProp); - EdgeActor->SetWireframeProperty(EdgeFProp); - } - break; - - default : // edge shared by at least two faces - { - EdgeActor->SetShadingProperty(EdgeSProp); - EdgeActor->SetWireframeProperty(EdgeSProp); - } - } - - EdgeActor->SetPreviewProperty(EdgePVProp); - AISActors->AddItem(EdgeActor); - } - } - } else if ( myShape.ShapeType() == TopAbs_WIRE ) { // WIRE Actor - TopExp_Explorer ex; - for (ex.Init(myShape, TopAbs_EDGE); ex.More(); ex.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge(ex.Current()); - - if (BRep_Tool::Degenerated(aEdge)) { - continue; - } - - GEOM_Actor* EdgeActor = GEOM_Actor::New(); - EdgeActor->setInputShape(ex.Current(),deflection,mode); - EdgeActor->SetShadingProperty(EdgeIProp); - EdgeActor->SetWireframeProperty(EdgeIProp); - EdgeActor->SetPreviewProperty(EdgePVProp); - - AISActors->AddItem(EdgeActor); - } - } else if ( myShape.ShapeType() == TopAbs_EDGE ) { // EDGE Actor - GEOM_Actor* EdgeActor = GEOM_Actor::New(); - EdgeActor->setInputShape(myShape,deflection,mode,isVector); - EdgeActor->SetShadingProperty(EdgeIProp); - EdgeActor->SetWireframeProperty(EdgeIProp); - EdgeActor->SetPreviewProperty(EdgePVProp); - - AISActors->AddItem(EdgeActor); - } else if ( myShape.ShapeType() == TopAbs_VERTEX ) { // VERTEX Actor - GEOM_Actor* VertexActor = GEOM_Actor::New(); - VertexActor->setInputShape(myShape,deflection,mode); - VertexActor->SetShadingProperty(VertexProp); - VertexActor->SetWireframeProperty(VertexProp); - VertexActor->SetPreviewProperty(VertexPVProp); - - AISActors->AddItem(VertexActor); - - } - */ - - - return AISActors; - -} - - - -//------------------------------------------------------------- -// BUILD ASSEMBLY -//------------------------------------------------------------- -vtkAssembly* GEOM_AssemblyBuilder::BuildAssembly(const TopoDS_Shape& myShape, - Standard_Real deflection, - Standard_Integer mode, - Standard_Boolean forced) -{ - // Create a new vtkAssembly - - vtkAssembly* myVTKShape = vtkAssembly::New(); - /* - // Create graphics properties - - vtkProperty* IsoProp = vtkProperty::New(); - vtkProperty* FaceProp = vtkProperty::New(); - vtkProperty* EdgeFProp = vtkProperty::New(); - vtkProperty* EdgeSProp = vtkProperty::New(); - vtkProperty* EdgeIProp = vtkProperty::New(); - vtkProperty* VertexProp = vtkProperty::New(); - vtkProperty* EdgePVProp = vtkProperty::New(); - vtkProperty* VertexPVProp = vtkProperty::New(); - vtkProperty* IsoPVProp = vtkProperty::New(); - - InitProperties(IsoProp,FaceProp,EdgeFProp,EdgeSProp,EdgeIProp,VertexProp,IsoPVProp,EdgePVProp,VertexPVProp); - - MeshShape(myShape,deflection,forced); - - - // FACE Actor - - // look if edges are free or shared - TopTools_IndexedDataMapOfShapeListOfShape edgemap; - TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,edgemap); - - TopExp_Explorer ex; - - for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next()) { - //const TopoDS_Face& aFace = TopoDS::Face(ex.Current()); - - GEOM_Actor* FaceActor = GEOM_Actor::New(); - FaceActor->SetShadingProperty(FaceProp); - FaceActor->SetWireframeProperty(IsoProp); - - vtkAssembly* myFaceAssembly = vtkAssembly::New(); - - - FaceActor->setInputShape(ex.Current(),deflection,mode); - myFaceAssembly->AddPart(FaceActor); - - TopExp_Explorer ex2; - for (ex2.Init(ex.Current(), TopAbs_EDGE); ex2.More(); ex2.Next()) { - const TopoDS_Edge& aEdge = TopoDS::Edge(ex2.Current()); - - if (BRep_Tool::Degenerated(aEdge)) { - continue; - } - - - // compute the number of faces - Standard_Integer nbf = edgemap.FindFromKey(ex2.Current()).Extent(); - GEOM_Actor* EdgeActor = GEOM_Actor::New(); - switch (nbf) { - - case 0 : // isolated edge - { - EdgeActor->SetShadingProperty(EdgeIProp); - EdgeActor->SetWireframeProperty(EdgeIProp); - } - break; - - case 1 :// edge in only one face - { - EdgeActor->SetShadingProperty(EdgeFProp); - EdgeActor->SetWireframeProperty(EdgeFProp); - } - break; - - default : // edge shared by at least two faces - { - EdgeActor->SetShadingProperty(EdgeSProp); - EdgeActor->SetWireframeProperty(EdgeSProp); - } - } - - EdgeActor->setInputShape(ex2.Current(),deflection,mode); - myFaceAssembly->AddPart(EdgeActor); - } - myVTKShape->AddPart(myFaceAssembly); - } - - */ - - return myVTKShape; - -} - -//------------------------------------------------------------- -// CHANGE SPECIFIC DISPLAY MODE -//------------------------------------------------------------- -void GEOM_AssemblyBuilder::SwitchDisplayMode(vtkAssembly* aOCCAssembly) -{ -} - -void GEOM_AssemblyBuilder::SwitchDisplayMode(vtkActorCollection* aOCCAssembly) -{ -} - -//------------------------------------------------------------- -// DISPLAY/ERASE -//------------------------------------------------------------- - -void GEOM_AssemblyBuilder::DisplayErase(vtkAssembly* mySALOMEAssembly) -{ -} - - -void GEOM_AssemblyBuilder::DisplayErase(vtkActorCollection* mySALOMEActors) -{ -} - - - - - diff --git a/src/OBJECT/GEOM_AssemblyBuilder.h b/src/OBJECT/GEOM_AssemblyBuilder.h deleted file mode 100644 index da50e5e92..000000000 --- a/src/OBJECT/GEOM_AssemblyBuilder.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 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 OBJECT : interactive object for Geometry entities visualization -// File : GEOM_AssemblyBuilder.h -// Author : Christophe ATTANASIO -// Module : GEOM -// $Header$ -// -#include "GEOM_OBJECT_defs.hxx" - -class vtkProperty; -class vtkAssembly; -class vtkActorCollection; - -// Open CASCADE Inlcudes -#include -#include - -class GEOM_OBJECT_EXPORT GEOM_AssemblyBuilder { - - private: - - static void InitProperties(vtkProperty* IsoProp, - vtkProperty* FaceProp, - vtkProperty* EdgeFProp, - vtkProperty* EdgeSProp, - vtkProperty* EdgeIProp, - vtkProperty* VertexProp, - vtkProperty* IsoPVProp, - vtkProperty* EdgePVProp, - vtkProperty* VertePVProp); - - static void MeshShape(const TopoDS_Shape myShape, - Standard_Real deflection, - Standard_Boolean forced); - - - public: - - - //------------------------------------------------------------------ - // WARNING! Poor graphic performance :-( use BuildActors instead - //------------------------------------------------------------------ - - static vtkAssembly* BuildAssembly(const TopoDS_Shape& myShape, - Standard_Real deflection, - Standard_Integer amode, - Standard_Boolean forced); - - //------------------------------------------------------------------ - // Good performance - //------------------------------------------------------------------ - - static vtkActorCollection* BuildActors(const TopoDS_Shape& myShape, - Standard_Real deflection, - Standard_Integer amode, - Standard_Boolean forced, - Standard_Boolean isVector = Standard_False); - - - //------------------------------------------------------------------ - // Change mode - Not implemented !! - //------------------------------------------------------------------ - - static void SwitchDisplayMode(vtkAssembly* mySALOMEAssembly); - static void SwitchDisplayMode(vtkActorCollection* mySALOMEActors); - - //------------------------------------------------------------------ - // Erase/Display - Not implemented !! - //------------------------------------------------------------------ - - static void DisplayErase(vtkAssembly* mySALOMEAssembly); - static void DisplayErase(vtkActorCollection* mySALOMEActors); - - -}; diff --git a/src/OBJECT/GEOM_Constants.h b/src/OBJECT/GEOM_Constants.h new file mode 100644 index 000000000..b890379e3 --- /dev/null +++ b/src/OBJECT/GEOM_Constants.h @@ -0,0 +1,51 @@ +// Copyright (C) 2007-2012 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 +// + +// File : GEOM_Constants.h +// Author : Margarita KARPUNINA +// Module : GEOM +// +#ifndef GEOM_CONSTANTS_H +#define GEOM_CONSTANTS_H + +// minimum allowed value for deflection coefficient +#define DEFLECTION_MIN 1e-06 + +//Define separators +#define NAME_SEPARATOR '_' // character used to separate parameter names +#define DIGIT_SEPARATOR ':' // character used to separate numeric parameter values (color = r:g:b) + +#define VISIBILITY_PROP "Visibility" //Object visibility property +#define OPACITY_PROP "Opacity" //Object opacity property +#define TRANSPARENCY_PROP "Transparency" //Object transparency property +#define DISPLAY_MODE_PROP "DisplayMode" //Object display mode property +#define ISOS_PROP "Isos" //Number of the Isos property of the object +#define COLOR_PROP "Color" //Color of the object +#define VECTOR_MODE_PROP "VectorMode" //Vector mode property +#define DEFLECTION_COEFF_PROP "DeflectionCoeff" //Deflection coeff property +#define MARKER_TYPE_PROP "MarkerType" //Marker type property +#define MATERIAL_PROP "Material" //Object material property +#define EDGE_WIDTH_PROP "EdgeWidth" //Width of the edge +#define ISOS_WIDTH_PROP "IsosWidth" //Width of the iso-lines +#define TOP_LEVEL_PROP "TopLevelFlag" //Top level flag + +#endif //GEOM_CONSTANTS_H diff --git a/src/OBJECT/GEOM_DeviceActor.cxx b/src/OBJECT/GEOM_DeviceActor.cxx index 445ab1470..266814569 100755 --- a/src/OBJECT/GEOM_DeviceActor.cxx +++ b/src/OBJECT/GEOM_DeviceActor.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "GEOM_DeviceActor.h" #include @@ -29,7 +27,7 @@ #include #include #include - +#include #include vtkStandardNewMacro(GEOM_DeviceActor); @@ -38,7 +36,7 @@ GEOM_DeviceActor::GEOM_DeviceActor(): myStripper(vtkStripper::New(),true), myPolyDataMapper(vtkPolyDataMapper::New(),true), myPolyDataNormals(vtkPolyDataNormals::New(),true), - myActor(vtkActor::New(),true) + myActor(VTKViewer_Actor::New(),true) { myStripper->SetInput(myPolyDataNormals->GetOutput()); myPolyDataMapper->SetInput(myStripper->GetOutput()); @@ -74,7 +72,7 @@ GetProperty() { return myActor->GetProperty(); } - + void GEOM_DeviceActor:: SetVisibility(int theVisibility) diff --git a/src/OBJECT/GEOM_DeviceActor.h b/src/OBJECT/GEOM_DeviceActor.h index 84bbbe912..8b36ab7ae 100755 --- a/src/OBJECT/GEOM_DeviceActor.h +++ b/src/OBJECT/GEOM_DeviceActor.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_DEVICEACTOR_H #define GEOM_DEVICEACTOR_H @@ -36,8 +34,9 @@ typedef GEOM_SmartPtr PStripper; class vtkPolyDataNormals; typedef GEOM_SmartPtr PPolyDataNormals; -class vtkActor; -typedef GEOM_SmartPtr PActor; +//class vtkActor; +class VTKViewer_Actor; +typedef GEOM_SmartPtr PActor; class vtkProperty; class vtkRenderer; @@ -61,6 +60,8 @@ public: void AddToRender(vtkRenderer* theRenderer); void RemoveFromRender(vtkRenderer* theRenderer); + + PActor GetDeviceActor() {return myActor;} protected: PPolyDataNormals myPolyDataNormals; diff --git a/src/OBJECT/GEOM_EdgeSource.cxx b/src/OBJECT/GEOM_EdgeSource.cxx deleted file mode 100755 index 12b467de9..000000000 --- a/src/OBJECT/GEOM_EdgeSource.cxx +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (C) 2007-2008 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_EdgeSource.h" - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -vtkStandardNewMacro(GEOM_EdgeSource); - -GEOM_EdgeSource::GEOM_EdgeSource() -{ -} - -GEOM_EdgeSource::~GEOM_EdgeSource() -{ -} - -void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge, - bool theIsVector) -{ - myEdgeSet.Add(theEdge); - myIsVector = theIsVector; -} - -void -GEOM_EdgeSource:: -Execute() -{ - vtkPolyData* aPolyData = GetOutput(); - aPolyData->Allocate(); - vtkPoints* aPts = vtkPoints::New(); - aPolyData->SetPoints(aPts); - aPts->Delete(); - - TEdgeSet::Iterator anIter (myEdgeSet); - for (; anIter.More(); anIter.Next()) { - const TopoDS_Edge& anEdge = anIter.Value(); - OCC2VTK(anEdge,aPolyData,aPts,myIsVector); - } -} - -void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, - vtkPolyData* thePolyData, - vtkPoints* thePts, - bool theIsVector) -{ - Handle(Poly_PolygonOnTriangulation) aEdgePoly; - Standard_Integer i = 1; - Handle(Poly_Triangulation) T; - TopLoc_Location aEdgeLoc; - BRep_Tool::PolygonOnTriangulation(theEdge, aEdgePoly, T, aEdgeLoc, i); - - Handle(Poly_Polygon3D) P; - if(aEdgePoly.IsNull()) - P = BRep_Tool::Polygon3D(theEdge, aEdgeLoc); - - if(P.IsNull() && aEdgePoly.IsNull()) - return; - - // Location edges - //--------------- - gp_Trsf edgeTransf; - Standard_Boolean isidtrsf = true; - if(!aEdgeLoc.IsIdentity()) { - isidtrsf = false; - edgeTransf = aEdgeLoc.Transformation(); - } - - gp_Pnt aP1, aP2; - - if (aEdgePoly.IsNull()) { - Standard_Integer aNbNodes = P->NbNodes(); - const TColgp_Array1OfPnt& aNodesP = P->Nodes(); - - aP1 = aNodesP(1); - aP2 = aNodesP(aNbNodes); - - for (int j = 1; j < aNbNodes; j++) { - gp_Pnt pt1 = aNodesP(j); - gp_Pnt pt2 = aNodesP(j+1); - - if (!isidtrsf) { - // apply edge transformation - pt1.Transform(edgeTransf); - pt2.Transform(edgeTransf); - } - - float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()}; - vtkIdType anIds[2]; - anIds[0] = thePts->InsertNextPoint(aCoord1); - - float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()}; - anIds[1] = thePts->InsertNextPoint(aCoord2); - - thePolyData->InsertNextCell(VTK_LINE,2,anIds); - } - } else { - Standard_Integer aNbNodes = aEdgePoly->NbNodes(); - const TColStd_Array1OfInteger& aNodeIds = aEdgePoly->Nodes(); - const TColgp_Array1OfPnt& anId2Pnts = T->Nodes(); - - aP1 = anId2Pnts(1); - aP2 = anId2Pnts(aNbNodes); - - for(int j = 1; j < aNbNodes; j++) { - Standard_Integer id1 = aNodeIds(j); - Standard_Integer id2 = aNodeIds(j+1); - - gp_Pnt pt1 = anId2Pnts(id1); - gp_Pnt pt2 = anId2Pnts(id2); - - if(!isidtrsf) { - // apply edge transformation - pt1.Transform(edgeTransf); - pt2.Transform(edgeTransf); - } - - float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()}; - vtkIdType anIds[2]; - anIds[0] = thePts->InsertNextPoint(aCoord1); - - float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()}; - anIds[1] = thePts->InsertNextPoint(aCoord2); - - thePolyData->InsertNextCell(VTK_LINE,2,anIds); - } - } - - // vector representation has an arrow on its end - if (theIsVector) - { - if (!isidtrsf) { - // apply edge transformation - aP1.Transform(edgeTransf); - aP2.Transform(edgeTransf); - } - - // draw an arrow - gp_Vec aDirVec (aP1, aP2); - Standard_Real aDist = aDirVec.Magnitude(); - if (aDist < gp::Resolution()) return; - gp_Dir aDirection (aDirVec); - - Standard_Real anAngle = PI/180.*5.; - Standard_Real aLength = aDist/10.; - - Standard_Real dx,dy,dz; - aDirection.Coord(dx,dy,dz); - - // Pointe de la fleche - Standard_Real xo,yo,zo; - aP2.Coord(xo,yo,zo); - - // Centre du cercle base de la fleche - gp_XYZ aPc = aP2.XYZ() - aDirection.XYZ() * aLength; - - // Construction d'un repere i,j pour le cercle - gp_Dir aDirN; - if (Abs(dx) <= Abs(dy) && Abs(dx) <= Abs(dz)) aDirN = gp::DX(); - else if (Abs(dy) <= Abs(dz) && Abs(dy) <= Abs(dx)) aDirN = gp::DY(); - else aDirN = gp::DZ(); - - gp_Dir aDirI = aDirection ^ aDirN; - gp_Dir aDirJ = aDirection ^ aDirI; - - // Add points and segments, composing the arrow - Standard_Real cosinus, sinus, Tg = tan(anAngle); - - float coord[3] = {xo, yo, zo}; - - vtkIdType ptLoc = thePts->InsertNextPoint(coord); - vtkIdType ptFirst = 0; - vtkIdType ptPrev = 0; - vtkIdType ptCur = 0; - - vtkIdType pts[2]; - - int NbPoints = 15; - for (int i = 1; i <= NbPoints; i++, ptPrev = ptCur) - { - cosinus = cos(2. * PI / NbPoints * (i-1)); - sinus = sin(2. * PI / NbPoints * (i-1)); - - gp_XYZ aP = aPc + (aDirI.XYZ() * cosinus + aDirJ.XYZ() * sinus) * aLength * Tg; - coord[0] = aP.X(); - coord[1] = aP.Y(); - coord[2] = aP.Z(); - - // insert pts - ptCur = thePts->InsertNextPoint(coord); - pts[0] = ptCur; - - if (i == 1) { - ptFirst = ptCur; - } - else { - // insert line (ptCur,ptPrev) - pts[1] = ptPrev; - thePolyData->InsertNextCell(VTK_LINE,2,pts); - } - - // insert line (ptCur,ptLoc) - pts[1] = ptLoc; - thePolyData->InsertNextCell(VTK_LINE,2,pts); - } - - // insert line (ptCur,ptFirst) - pts[0] = ptCur; - pts[1] = ptFirst; - thePolyData->InsertNextCell(VTK_LINE,2,pts); - } -} diff --git a/src/OBJECT/GEOM_EdgeSource.h b/src/OBJECT/GEOM_EdgeSource.h deleted file mode 100755 index 8cb2e514d..000000000 --- a/src/OBJECT/GEOM_EdgeSource.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2007-2008 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_EDGESOURCE_H -#define GEOM_EDGESOURCE_H - -#include "GEOM_DeviceActor.h" - -#include -#include - -typedef NCollection_Set TEdgeSet; - -#include - - -class VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataSource -{ -public: - vtkTypeMacro(GEOM_EdgeSource,vtkPolyDataSource); - static GEOM_EdgeSource* New(); - - void AddEdge (const TopoDS_Edge& theEdge, - bool theIsVector = false); - void Clear(){ myEdgeSet.Clear();} - - static - void OCC2VTK(const TopoDS_Edge& theEdge, - vtkPolyData* thePolyData, - vtkPoints* thePts, - bool theIsVector = false); - -protected: - TEdgeSet myEdgeSet; - // The flag is common for all edges, because the shape, - // representing a vector, can have only one edge. - bool myIsVector; - - void Execute(); - - GEOM_EdgeSource(); - ~GEOM_EdgeSource(); - -private: - // Not implememnted - GEOM_EdgeSource(const GEOM_EdgeSource&); - void operator=(const GEOM_EdgeSource&); -}; - - -#endif //GEOM_EDGESOURCE_H diff --git a/src/OBJECT/GEOM_FaceSource.cxx b/src/OBJECT/GEOM_FaceSource.cxx deleted file mode 100755 index 0600ee1d9..000000000 --- a/src/OBJECT/GEOM_FaceSource.cxx +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2007-2008 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_FaceSource.h" - -#include - -#include -#include - -#include -#include - -GEOM_FaceSource::GEOM_FaceSource() -{ -} - -GEOM_FaceSource::~GEOM_FaceSource() -{ -} - -void -GEOM_FaceSource:: -AddFace(const TopoDS_Face& theFace) -{ - myFaceSet.Add(theFace); -} - -void -GEOM_FaceSource:: -MoveTo(gp_Pnt thePnt, - vtkPoints* thePts) -{ - thePts->InsertNextPoint(thePnt.X(), thePnt.Y(), thePnt.Z()); -} - -void -GEOM_FaceSource:: -DrawTo(gp_Pnt thePnt, - vtkPolyData* thePolyData, - vtkPoints* thePts) -{ - vtkIdType anId = - thePts->InsertNextPoint(thePnt.X(), thePnt.Y(), thePnt.Z()); - vtkIdType anIds[2] = {anId-1, anId}; - thePolyData->InsertNextCell(VTK_LINE,2,anIds); -} diff --git a/src/OBJECT/GEOM_FaceSource.h b/src/OBJECT/GEOM_FaceSource.h deleted file mode 100755 index 6378a8eda..000000000 --- a/src/OBJECT/GEOM_FaceSource.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2007-2008 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_FACESOURCE_H -#define GEOM_FACESOURCE_H - -#include "GEOM_DeviceActor.h" - -#include -#include -#include - -typedef NCollection_Set TFaceSet; - -#include - -class GEOM_FaceSource; -typedef GEOM_SmartPtr PFaceSource; - - -class VTK_EXPORT GEOM_FaceSource: public vtkPolyDataSource -{ -public: - vtkTypeMacro(GEOM_FaceSource,vtkPolyDataSource); - - void AddFace(const TopoDS_Face& theFace); - void Clear(){ myFaceSet.Clear();} - -protected: - TFaceSet myFaceSet; - - static - void MoveTo(gp_Pnt thePnt, - vtkPoints* thePts); - static - void DrawTo(gp_Pnt thePnt, - vtkPolyData* thePolyData, - vtkPoints* thePts); - - GEOM_FaceSource(); - ~GEOM_FaceSource(); - -private: - // Not implememnted - GEOM_FaceSource(const GEOM_FaceSource&); - void operator=(const GEOM_FaceSource&); -}; - - -#endif //GEOM_FACESOURCE_H diff --git a/src/OBJECT/GEOM_InteractiveObject.cxx b/src/OBJECT/GEOM_InteractiveObject.cxx index 1f82d31bf..d108c1735 100644 --- a/src/OBJECT/GEOM_InteractiveObject.cxx +++ b/src/OBJECT/GEOM_InteractiveObject.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_InteractiveObject.cxx // Author : Christophe ATTANASIO @@ -32,8 +33,6 @@ #include "GEOM_InteractiveObject.ixx" -using namespace std; - GEOM_InteractiveObject::GEOM_InteractiveObject() : SALOME_InteractiveObject() { @@ -42,9 +41,9 @@ GEOM_InteractiveObject::GEOM_InteractiveObject() } GEOM_InteractiveObject::GEOM_InteractiveObject(const char* anIOR, - const char* aFatherIOR, - const char* aComponentDataType, - const char* anEntry) + const char* aFatherIOR, + const char* aComponentDataType, + const char* anEntry) : SALOME_InteractiveObject(anEntry,aComponentDataType) { myIOR = anIOR; diff --git a/src/OBJECT/GEOM_InteractiveObject.hxx b/src/OBJECT/GEOM_InteractiveObject.hxx index 1acd05421..7caddbfef 100644 --- a/src/OBJECT/GEOM_InteractiveObject.hxx +++ b/src/OBJECT/GEOM_InteractiveObject.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_InteractiveObject.hxx // Module : GEOM @@ -70,9 +71,9 @@ public: // Standard_EXPORT GEOM_InteractiveObject(); Standard_EXPORT GEOM_InteractiveObject(const char* anIOR, - const char* aFatherIOR, - const char* aComponentDataType, - const char* anEntry = ""); + const char* aFatherIOR, + const char* aComponentDataType, + const char* anEntry = ""); Standard_EXPORT void setIOR(const char* anEntry) ; Standard_EXPORT const char* getIOR() ; Standard_EXPORT void setFatherIOR(const char* anEntry) ; @@ -87,7 +88,7 @@ Standard_EXPORT ~GEOM_InteractiveObject(); // Standard_EXPORT friend Handle_Standard_Type& GEOM_InteractiveObject_Type_(); Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; protected: diff --git a/src/OBJECT/GEOM_InteractiveObject.ixx b/src/OBJECT/GEOM_InteractiveObject.ixx index 56d8f268d..ff3ae4767 100644 --- a/src/OBJECT/GEOM_InteractiveObject.ixx +++ b/src/OBJECT/GEOM_InteractiveObject.ixx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_InteractiveObject.ixx // Module : GEOM @@ -46,10 +47,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_InteractiveObject_Type_() static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Type _aType = new Standard_Type("GEOM_InteractiveObject", - sizeof(GEOM_InteractiveObject), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + sizeof(GEOM_InteractiveObject), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); return _aType; } diff --git a/src/OBJECT/GEOM_InteractiveObject.jxx b/src/OBJECT/GEOM_InteractiveObject.jxx index 7455669f9..9da2f88eb 100644 --- a/src/OBJECT/GEOM_InteractiveObject.jxx +++ b/src/OBJECT/GEOM_InteractiveObject.jxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_InteractiveObject.jxx // Module : GEOM diff --git a/src/OBJECT/GEOM_OBJECT_defs.hxx b/src/OBJECT/GEOM_OBJECT_defs.hxx index c7d239347..cbd78b1a8 100755 --- a/src/OBJECT/GEOM_OBJECT_defs.hxx +++ b/src/OBJECT/GEOM_OBJECT_defs.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : GEOM_OBJECT_defs.hxx // Author : Alexander A. BORODIN // Module : GEOM @@ -27,7 +28,7 @@ #define _GEOM_OBJECT_defs_HXX_ #ifdef WIN32 -# if defined GEOM_OBJECT_EXPORTS +# if defined GEOM_OBJECT_EXPORTS || defined GEOMObject_EXPORTS # define GEOM_OBJECT_EXPORT __declspec( dllexport ) # else # define GEOM_OBJECT_EXPORT __declspec( dllimport ) diff --git a/src/OBJECT/GEOM_OCCReader.cxx b/src/OBJECT/GEOM_OCCReader.cxx index 95a4c33b7..d9f1331a9 100644 --- a/src/OBJECT/GEOM_OCCReader.cxx +++ b/src/OBJECT/GEOM_OCCReader.cxx @@ -1,30 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_OCCReader.h // Author : Christophe ATTANASIO // Module : GEOM -// $Header$ -// + #include "GEOM_OCCReader.h" // VTK Includes @@ -61,10 +61,9 @@ #include "utilities.h" -using namespace std; -#define MAX2(X, Y) ( Abs(X) > Abs(Y)? Abs(X) : Abs(Y) ) -#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X,Y) , Z) ) +#define MAX2(X, Y) ( Abs(X) > Abs(Y)? Abs(X) : Abs(Y) ) +#define MAX3(X, Y, Z) ( MAX2 ( MAX2(X,Y) , Z) ) // Constante for iso building static Standard_Real IntersectorConfusion = 1.e-10 ; // -8 ; @@ -130,7 +129,7 @@ void GEOM_OCCReader::Execute() { // Allocation Pts = vtkPoints::New(); Cells = vtkCellArray::New(); - + //Compute number of triangles and points Standard_Integer nbpoly=0,nbpts=0; @@ -142,9 +141,9 @@ void GEOM_OCCReader::Execute() { const TopoDS_Face& aFace = TopoDS::Face(myShape); Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc); if(aPoly.IsNull()) { - Pts->Delete(); - Cells->Delete(); - return; + Pts->Delete(); + Cells->Delete(); + return; } nbpts = aPoly->NbNodes(); @@ -154,9 +153,9 @@ void GEOM_OCCReader::Execute() { Cells->Allocate(Cells->EstimateSize(nbpoly,3)); } else { - Cells->Delete(); - Pts->Delete(); - return; + Cells->Delete(); + Pts->Delete(); + return; } } @@ -209,8 +208,8 @@ void GEOM_OCCReader::ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells){ //======================================================================= void GEOM_OCCReader::TransferFaceWData(const TopoDS_Face& aFace, - vtkPoints* Pts, - vtkCellArray* Cells) + vtkPoints* Pts, + vtkCellArray* Cells) { TopoDS_Face aCopyFace = aFace; aCopyFace.Orientation (TopAbs_FORWARD); @@ -223,17 +222,17 @@ void GEOM_OCCReader::TransferFaceWData(const TopoDS_Face& aFace, //======================================================================= void GEOM_OCCReader::createISO (const TopoDS_Face& TopologicalFace, - const Standard_Real Infinite, - const Standard_Integer NbIsos, - vtkPoints* Pts, - vtkCellArray* Cell) + const Standard_Real Infinite, + const Standard_Integer NbIsos, + vtkPoints* Pts, + vtkCellArray* Cell) { Geom2dHatch_Hatcher aHatcher (Geom2dHatch_Intersector (IntersectorConfusion, - IntersectorTangency), - HatcherConfusion2d, - HatcherConfusion3d, - Standard_True, - Standard_False); + IntersectorTangency), + HatcherConfusion2d, + HatcherConfusion3d, + Standard_True, + Standard_False); Standard_Real myInfinite,myUMin,myUMax,myVMin,myVMax; //myInfinite = Precision::Infinite(); @@ -293,27 +292,27 @@ void GEOM_OCCReader::createISO (const TopoDS_Face& TopologicalFace, //-- Test if a TrimmedCurve is necessary if( Abs(PCurve->FirstParameter()-U1)<= Precision::PConfusion() - && Abs(PCurve->LastParameter()-U2)<= Precision::PConfusion()) { + && Abs(PCurve->LastParameter()-U2)<= Precision::PConfusion()) { aHatcher.AddElement (PCurve, TopologicalEdge.Orientation()) ; } else { if (!PCurve->IsPeriodic()) { - Handle (Geom2d_TrimmedCurve) TrimPCurve =Handle(Geom2d_TrimmedCurve)::DownCast(PCurve); - if (!TrimPCurve.IsNull()) { - if (TrimPCurve->BasisCurve()->FirstParameter()-U1 > Precision::PConfusion() || - U2-TrimPCurve->BasisCurve()->LastParameter() > Precision::PConfusion()) { - aHatcher.AddElement (PCurve, TopologicalEdge.Orientation()) ; - return; - } - } - else { - if (PCurve->FirstParameter()-U1 > Precision::PConfusion()){ - U1=PCurve->FirstParameter(); - } - if (U2-PCurve->LastParameter() > Precision::PConfusion()){ - U2=PCurve->LastParameter(); - } - } + Handle (Geom2d_TrimmedCurve) TrimPCurve =Handle(Geom2d_TrimmedCurve)::DownCast(PCurve); + if (!TrimPCurve.IsNull()) { + if (TrimPCurve->BasisCurve()->FirstParameter()-U1 > Precision::PConfusion() || + U2-TrimPCurve->BasisCurve()->LastParameter() > Precision::PConfusion()) { + aHatcher.AddElement (PCurve, TopologicalEdge.Orientation()) ; + return; + } + } + else { + if (PCurve->FirstParameter()-U1 > Precision::PConfusion()){ + U1=PCurve->FirstParameter(); + } + if (U2-PCurve->LastParameter() > Precision::PConfusion()){ + U2=PCurve->LastParameter(); + } + } } Handle (Geom2d_TrimmedCurve) TrimPCurve = new Geom2d_TrimmedCurve (PCurve, U1, U2) ; aHatcher.AddElement (TrimPCurve, TopologicalEdge.Orientation()) ; @@ -370,16 +369,16 @@ void GEOM_OCCReader::createISO (const TopoDS_Face& TopologicalFace, Index = myUInd(IIso) ; if (Index != 0) { if (aHatcher.TrimDone (Index) && !aHatcher.TrimFailed (Index)) { - aHatcher.ComputeDomains (Index); - if (aHatcher.IsDone (Index)) myNbDom = myNbDom + aHatcher.NbDomains (Index) ; + aHatcher.ComputeDomains (Index); + if (aHatcher.IsDone (Index)) myNbDom = myNbDom + aHatcher.NbDomains (Index) ; } } Index = myVInd(IIso) ; if (Index != 0) { if (aHatcher.TrimDone (Index) && !aHatcher.TrimFailed (Index)) { - aHatcher.ComputeDomains (Index); - if (aHatcher.IsDone (Index)) myNbDom = myNbDom + aHatcher.NbDomains (Index) ; + aHatcher.ComputeDomains (Index); + if (aHatcher.IsDone (Index)) myNbDom = myNbDom + aHatcher.NbDomains (Index) ; } } } @@ -396,22 +395,22 @@ void GEOM_OCCReader::createISO (const TopoDS_Face& TopologicalFace, if (UInd != 0) { Standard_Real UPrm = myUPrm.Value (UIso) ; if (!aHatcher.IsDone (UInd)) { - MESSAGE("DBRep_IsoBuilder:: U iso of parameter: "<= T2 && TI(Intrv + 1) >= T2) - continue; + continue; if (T == GeomAbs_IsoU) { - V1 = Max(T1, TI(Intrv)); - V2 = Min(T2, TI(Intrv + 1)); - stepV = (V2 - V1) / myDiscret; + V1 = Max(T1, TI(Intrv)); + V2 = Min(T2, TI(Intrv + 1)); + stepV = (V2 - V1) / myDiscret; } else { - U1 = Max(T1, TI(Intrv)); - U2 = Min(T2, TI(Intrv + 1)); - stepU = (U2 - U1) / myDiscret; + U1 = Max(T1, TI(Intrv)); + U2 = Min(T2, TI(Intrv + 1)); + stepU = (U2 - U1) / myDiscret; } switch (SurfType) { - //-------------GeomAbs_Plane--------------- + //-------------GeomAbs_Plane--------------- case GeomAbs_Plane : - break; - //----GeomAbs_Cylinder GeomAbs_Cone------ + break; + //----GeomAbs_Cylinder GeomAbs_Cone------ case GeomAbs_Cylinder : case GeomAbs_Cone : - if (T == GeomAbs_IsoV) { - for (j = 1; j < myDiscret; j++) { - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,Pts,Cells); - } - } - break; - //---GeomAbs_Sphere GeomAbs_Torus-------- - //GeomAbs_BezierSurface GeomAbs_BezierSurface + if (T == GeomAbs_IsoV) { + for (j = 1; j < myDiscret; j++) { + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,Pts,Cells); + } + } + break; + //---GeomAbs_Sphere GeomAbs_Torus-------- + //GeomAbs_BezierSurface GeomAbs_BezierSurface case GeomAbs_Sphere : case GeomAbs_Torus : case GeomAbs_OffsetSurface : case GeomAbs_OtherSurface : - for (j = 1; j < myDiscret; j++) { - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,Pts,Cells); - } - break; - //-------------GeomAbs_BSplineSurface------ + for (j = 1; j < myDiscret; j++) { + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,Pts,Cells); + } + break; + //-------------GeomAbs_BSplineSurface------ case GeomAbs_BezierSurface : case GeomAbs_BSplineSurface : - for (j = 1; j <= myDiscret/2; j++) { + for (j = 1; j <= myDiscret/2; j++) { - PlotCount = 0; + PlotCount = 0; - PlotIso ( S, T, U1, V1, (T == GeomAbs_IsoV) ? stepU*2. : stepV*2., halt, Pts, Cells); - U1 += stepU*2.; - V1 += stepV*2.; - } - break; - //-------------GeomAbs_SurfaceOfExtrusion-- - //-------------GeomAbs_SurfaceOfRevolution- + PlotIso ( S, T, U1, V1, (T == GeomAbs_IsoV) ? stepU*2. : stepV*2., halt, Pts, Cells); + U1 += stepU*2.; + V1 += stepV*2.; + } + break; + //-------------GeomAbs_SurfaceOfExtrusion-- + //-------------GeomAbs_SurfaceOfRevolution- case GeomAbs_SurfaceOfExtrusion : case GeomAbs_SurfaceOfRevolution : - if ((T == GeomAbs_IsoV && SurfType == GeomAbs_SurfaceOfRevolution) || - (T == GeomAbs_IsoU && SurfType == GeomAbs_SurfaceOfExtrusion)) { - if (SurfType == GeomAbs_SurfaceOfExtrusion) break; - for (j = 1; j < myDiscret; j++) { - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,Pts,Cells); - } - } else { - CurvType = (S.BasisCurve())->GetType(); - switch (CurvType) { - case GeomAbs_Line : - break; - case GeomAbs_Circle : - case GeomAbs_Ellipse : - for (j = 1; j < myDiscret; j++) { - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,Pts,Cells); - } - break; - case GeomAbs_Parabola : - case GeomAbs_Hyperbola : - case GeomAbs_BezierCurve : - case GeomAbs_BSplineCurve : - case GeomAbs_OtherCurve : - for (j = 1; j <= myDiscret/2; j++) { - - PlotCount = 0; - - PlotIso ( S, T, U1, V1,(T == GeomAbs_IsoV) ? stepU*2. : stepV*2., halt, Pts, Cells); - U1 += stepU*2.; - V1 += stepV*2.; - } - break; - } - } + if ((T == GeomAbs_IsoV && SurfType == GeomAbs_SurfaceOfRevolution) || + (T == GeomAbs_IsoU && SurfType == GeomAbs_SurfaceOfExtrusion)) { + if (SurfType == GeomAbs_SurfaceOfExtrusion) break; + for (j = 1; j < myDiscret; j++) { + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,Pts,Cells); + } + } else { + CurvType = (S.BasisCurve())->GetType(); + switch (CurvType) { + case GeomAbs_Line : + break; + case GeomAbs_Circle : + case GeomAbs_Ellipse : + for (j = 1; j < myDiscret; j++) { + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,Pts,Cells); + } + break; + case GeomAbs_Parabola : + case GeomAbs_Hyperbola : + case GeomAbs_BezierCurve : + case GeomAbs_BSplineCurve : + case GeomAbs_OtherCurve : + for (j = 1; j <= myDiscret/2; j++) { + + PlotCount = 0; + + PlotIso ( S, T, U1, V1,(T == GeomAbs_IsoV) ? stepU*2. : stepV*2., halt, Pts, Cells); + U1 += stepU*2.; + V1 += stepV*2.; + } + break; + } + } } } S.D0(U2,V2,P); @@ -648,13 +647,13 @@ void GEOM_OCCReader::DrawIso(GeomAbs_IsoType T, //======================================================================= void GEOM_OCCReader::PlotIso (BRepAdaptor_Surface& S, - GeomAbs_IsoType T, - Standard_Real& U, - Standard_Real& V, - Standard_Real Step, - Standard_Boolean& halt, - vtkPoints* Pts, - vtkCellArray* Cells) + GeomAbs_IsoType T, + Standard_Real& U, + Standard_Real& V, + Standard_Real Step, + Standard_Boolean& halt, + vtkPoints* Pts, + vtkCellArray* Cells) { ++PlotCount; @@ -696,8 +695,8 @@ void GEOM_OCCReader::PlotIso (BRepAdaptor_Surface& S, //======================================================================= void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, - vtkPoints* Pts, - vtkCellArray* Cells) { + vtkPoints* Pts, + vtkCellArray* Cells) { Handle(Poly_PolygonOnTriangulation) aEdgePoly; @@ -742,9 +741,9 @@ void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, gp_Pnt pt2 = theNodesP(j+1); if(!isidtrsf) { - // apply edge transformation - pt1.Transform(edgeTransf); - pt2.Transform(edgeTransf); + // apply edge transformation + pt1.Transform(edgeTransf); + pt2.Transform(edgeTransf); } // insert pt1 @@ -777,9 +776,9 @@ void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, gp_Pnt pt2 = theNodesPoly(id2); if(!isidtrsf) { - // apply edge transformation - pt1.Transform(edgeTransf); - pt2.Transform(edgeTransf); + // apply edge transformation + pt1.Transform(edgeTransf); + pt2.Transform(edgeTransf); } // insert pt1 @@ -810,7 +809,7 @@ void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, if (aDist < gp::Resolution()) return; gp_Dir aDirection (aDirVec); - Standard_Real anAngle = PI/180.*5.; + Standard_Real anAngle = M_PI/180. * 5.; Standard_Real aLength = aDist/10.; Standard_Real dx,dy,dz; @@ -848,8 +847,8 @@ void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, int NbPoints = 15; for (int i = 1; i <= NbPoints; i++, ptPrev = ptCur) { - cosinus = cos(2. * PI / NbPoints * (i-1)); - sinus = sin(2. * PI / NbPoints * (i-1)); + cosinus = cos(2. * M_PI / NbPoints * (i-1)); + sinus = sin(2. * M_PI / NbPoints * (i-1)); gp_XYZ aP = aPc + (aDirI.XYZ() * cosinus + aDirJ.XYZ() * sinus) * aLength * Tg; coord[0] = aP.X(); @@ -925,8 +924,8 @@ void GEOM_OCCReader::TransferEdgeWData(const TopoDS_Edge& aEdge, //======================================================================= void GEOM_OCCReader::TransferVertexWData(const TopoDS_Vertex& aVertex, - vtkPoints* Pts, - vtkCellArray* Cells) { + vtkPoints* Pts, + vtkCellArray* Cells) { #define ZERO_COORD coord[0] = 0.0; coord[1] = 0.0; coord[2] = 0.0 gp_Pnt P = BRep_Tool::Pnt( aVertex ); @@ -955,7 +954,7 @@ void GEOM_OCCReader::TransferVertexWData(const TopoDS_Vertex& aVertex, Cells->InsertNextCell(2,pts); #undef ZERO_COORD -} +} //======================================================================= // Function : TransferEdgeSData( @@ -963,8 +962,8 @@ void GEOM_OCCReader::TransferVertexWData(const TopoDS_Vertex& aVertex, //======================================================================= void GEOM_OCCReader::TransferEdgeSData(const TopoDS_Edge& aFace, - vtkPoints* Pts, - vtkCellArray* Cells) + vtkPoints* Pts, + vtkCellArray* Cells) { } @@ -974,8 +973,8 @@ void GEOM_OCCReader::TransferEdgeSData(const TopoDS_Edge& aFace, // Purpose : Transfert shading data for FACE //======================================================================= void GEOM_OCCReader::TransferFaceSData(const TopoDS_Face& aFace, - vtkPoints* Pts, - vtkCellArray* Cells) { + vtkPoints* Pts, + vtkCellArray* Cells) { TopLoc_Location aLoc; Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc); @@ -991,7 +990,7 @@ void GEOM_OCCReader::TransferFaceSData(const TopoDS_Face& aFace, Standard_Integer nbNodesInFace = aPoly->NbNodes(); Standard_Integer nbTriInFace = aPoly->NbTriangles(); - + const Poly_Array1OfTriangle& Triangles = aPoly->Triangles(); const TColgp_Array1OfPnt& Nodes = aPoly->Nodes(); @@ -1006,10 +1005,10 @@ void GEOM_OCCReader::TransferFaceSData(const TopoDS_Face& aFace, for(i=1;i<=nbTriInFace;i++) { // Get the triangle - + Standard_Integer N1,N2,N3; Triangles(i).Get(N1,N2,N3); - + vtkIdType pts[3]; pts[0] = N1-1; pts[1] = N2-1; pts[2] = N3-1; Cells->InsertNextCell(3,pts); @@ -1069,5 +1068,3 @@ const TopoDS_Shape& GEOM_OCCReader::getTopo() { int GEOM_OCCReader::getDisplayMode() { return amode; } - - diff --git a/src/OBJECT/GEOM_OCCReader.h b/src/OBJECT/GEOM_OCCReader.h index 869ec4f29..3be818b36 100644 --- a/src/OBJECT/GEOM_OCCReader.h +++ b/src/OBJECT/GEOM_OCCReader.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : GEOM_OCCReader.h // Author : Christophe ATTANASIO @@ -48,9 +49,9 @@ class vtkCellArray; class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource { - // methods + // methods - public: + public: static GEOM_OCCReader* New(); @@ -67,59 +68,59 @@ class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource { GEOM_OCCReader(); ~GEOM_OCCReader(); - void Execute(); + void Execute(); void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells); void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells); void TransferFaceSData(const TopoDS_Face& aFace, - vtkPoints* Pts, - vtkCellArray* Cells); + vtkPoints* Pts, + vtkCellArray* Cells); void TransferFaceWData(const TopoDS_Face& aFace, - vtkPoints* Pts, - vtkCellArray* Cells); + vtkPoints* Pts, + vtkCellArray* Cells); void TransferEdgeSData(const TopoDS_Edge& aEdge, - vtkPoints* Pts, - vtkCellArray* Cells); + vtkPoints* Pts, + vtkCellArray* Cells); void TransferEdgeWData(const TopoDS_Edge& aEdge, - vtkPoints* Pts, - vtkCellArray* Cells); + vtkPoints* Pts, + vtkCellArray* Cells); void TransferVertexWData(const TopoDS_Vertex& aVertex, - vtkPoints* Pts, - vtkCellArray* Cells); + vtkPoints* Pts, + vtkCellArray* Cells); void createISO(const TopoDS_Face &, - double, int, - vtkPoints* Pts, - vtkCellArray* Cells); + double, int, + vtkPoints* Pts, + vtkCellArray* Cells); void DrawIso(GeomAbs_IsoType aType, - Standard_Real PParm, - Standard_Real p1, - Standard_Real p2, - vtkPoints* Pts, - vtkCellArray* Cells, - Standard_Integer& startidx); + Standard_Real PParm, + Standard_Real p1, + Standard_Real p2, + vtkPoints* Pts, + vtkCellArray* Cells, + Standard_Integer& startidx); void MoveTo(gp_Pnt P, - vtkPoints* Pts); + vtkPoints* Pts); void DrawTo(gp_Pnt P, - vtkPoints* Pts, - vtkCellArray* Cells); + vtkPoints* Pts, + vtkCellArray* Cells); void PlotIso(BRepAdaptor_Surface& S, - GeomAbs_IsoType T, - Standard_Real& U, - Standard_Real& V, - Standard_Real Step, - Standard_Boolean& halt, - vtkPoints* Pts, - vtkCellArray* Cells); + GeomAbs_IsoType T, + Standard_Real& U, + Standard_Real& V, + Standard_Real Step, + Standard_Boolean& halt, + vtkPoints* Pts, + vtkCellArray* Cells); // fields @@ -127,7 +128,7 @@ class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource { Standard_Boolean forced; int discretiso; - int amode; + int amode; int nbisos; TopoDS_Shape myShape; bool myIsVector; diff --git a/src/OBJECT/GEOM_PainterPolyDataMapper.cxx b/src/OBJECT/GEOM_PainterPolyDataMapper.cxx new file mode 100644 index 000000000..93022c136 --- /dev/null +++ b/src/OBJECT/GEOM_PainterPolyDataMapper.cxx @@ -0,0 +1,24 @@ +// Copyright (C) 2007-2012 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 "GEOM_PainterPolyDataMapper.h" + +#include + +vtkStandardNewMacro(GEOM_PainterPolyDataMapper); diff --git a/src/OBJECT/GEOM_PainterPolyDataMapper.h b/src/OBJECT/GEOM_PainterPolyDataMapper.h new file mode 100644 index 000000000..ecd880600 --- /dev/null +++ b/src/OBJECT/GEOM_PainterPolyDataMapper.h @@ -0,0 +1,44 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef GEOM_PAINTERPOLYDATAMAPPER_H +#define GEOM_PAINTERPOLYDATAMAPPER_H + +#include + +/* + * This class can be used to prevent drawing of mappers' content (due to an + * empty definition of GEOM_PainterPolyDataMapper::RenderPiece(...) method). + * It is used as poly data mapper in GEOM_Actor class. + */ +class GEOM_PainterPolyDataMapper: public vtkPainterPolyDataMapper +{ + public: + vtkTypeMacro(GEOM_PainterPolyDataMapper,vtkPainterPolyDataMapper); + static GEOM_PainterPolyDataMapper* New(); + + virtual void RenderPiece(vtkRenderer *ren, vtkActor *act) {} + + protected: + GEOM_PainterPolyDataMapper() {} + ~GEOM_PainterPolyDataMapper() {} + +}; + +#endif //GEOM_PAINTERPOLYDATAMAPPER_H diff --git a/src/OBJECT/GEOM_ShadingFace.cxx b/src/OBJECT/GEOM_ShadingFace.cxx deleted file mode 100755 index 755b32925..000000000 --- a/src/OBJECT/GEOM_ShadingFace.cxx +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2007-2008 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_ShadingFace.h" - -#include - -#include -#include - -#include -#include - -#include -#include - - -vtkStandardNewMacro(GEOM_ShadingFace); - -GEOM_ShadingFace::GEOM_ShadingFace() -{ -} - -GEOM_ShadingFace::~GEOM_ShadingFace() -{ -} - -void -GEOM_ShadingFace:: -Execute() -{ - vtkPolyData* aPolyData = GetOutput(); - aPolyData->Allocate(); - vtkPoints* aPts = vtkPoints::New(); - aPolyData->SetPoints(aPts); - aPts->Delete(); - - TFaceSet::Iterator anIter(myFaceSet); - for(; anIter.More(); anIter.Next()){ - const TopoDS_Face& aFace = anIter.Value(); - OCC2VTK(aFace,aPolyData,aPts); - } -} - -void -GEOM_ShadingFace:: -OCC2VTK(const TopoDS_Face& theFace, - vtkPolyData* thePolyData, - vtkPoints* thePts) -{ - TopLoc_Location aLoc; - Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(theFace,aLoc); - if(aPoly.IsNull()) - return; - else{ - gp_Trsf myTransf; - Standard_Boolean identity = true; - if(!aLoc.IsIdentity()){ - identity = false; - myTransf = aLoc.Transformation(); - } - - Standard_Integer i; - int aNbOfNodes = thePts->GetNumberOfPoints(); - const TColgp_Array1OfPnt& Nodes = aPoly->Nodes(); - Standard_Integer nbNodesInFace = aPoly->NbNodes(); - for(i = 1; i <= nbNodesInFace; i++) { - gp_Pnt P = Nodes(i); - if(!identity) - P.Transform(myTransf); - thePts->InsertNextPoint(P.X(),P.Y(),P.Z()); - } - - const Poly_Array1OfTriangle& Triangles = aPoly->Triangles(); - Standard_Integer nbTriInFace = aPoly->NbTriangles(); - for(i = 1; i <= nbTriInFace; i++){ - // Get the triangle - Standard_Integer N1,N2,N3; - Triangles(i).Get(N1,N2,N3); - N1 += aNbOfNodes - 1; - N2 += aNbOfNodes - 1; - N3 += aNbOfNodes - 1; - vtkIdType anIds[3] = {N1, N2, N3}; - thePolyData->InsertNextCell(VTK_TRIANGLE,3,anIds); - } - } -} diff --git a/src/OBJECT/GEOM_ShadingFace.h b/src/OBJECT/GEOM_ShadingFace.h deleted file mode 100755 index 097c1340c..000000000 --- a/src/OBJECT/GEOM_ShadingFace.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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_SHADINGFACE_H -#define GEOM_SHADINGFACE_H - -#include "GEOM_FaceSource.h" - - -class VTK_EXPORT GEOM_ShadingFace: public GEOM_FaceSource -{ -public: - vtkTypeMacro(GEOM_ShadingFace,GEOM_FaceSource); - static GEOM_ShadingFace* New(); - - static - void OCC2VTK(const TopoDS_Face& theFace, - vtkPolyData* theCells, - vtkPoints* thePts); - -protected: - void Execute(); - - GEOM_ShadingFace(); - ~GEOM_ShadingFace(); - -private: - // Not implememnted - GEOM_ShadingFace(const GEOM_ShadingFace&); - void operator=(const GEOM_ShadingFace&); -}; - - -#endif //GEOM_SHADINGFACE_H diff --git a/src/OBJECT/GEOM_SmartPtr.h b/src/OBJECT/GEOM_SmartPtr.h index eedaf8200..75d190cdc 100755 --- a/src/OBJECT/GEOM_SmartPtr.h +++ b/src/OBJECT/GEOM_SmartPtr.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef GEOM_SMARTPTR_H #define GEOM_SMARTPTR_H @@ -43,12 +41,14 @@ public: T* Get() const { return this->GetPointer();} }; - class GEOM_DeviceActor; typedef GEOM_SmartPtr PDeviceActor; class vtkPolyDataMapper; -typedef GEOM_SmartPtr PPolyDataMapper; +typedef GEOM_SmartPtr PPolyDataMapper; + +class GEOM_PainterPolyDataMapper; +typedef GEOM_SmartPtr PPolyGeomPainterDataMapper; #endif //GEOM_SMARTPTR_H diff --git a/src/OBJECT/GEOM_TopWireframeShape.cxx b/src/OBJECT/GEOM_TopWireframeShape.cxx new file mode 100755 index 000000000..b3db3ddda --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.cxx @@ -0,0 +1,102 @@ +// Copyright (C) 2007-2012 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 OBJECT : interactive object for Geometry entities visualization +// File : GEOM_TopWireframeShape.cxx +// Author : +// Module : GEOM + +/*! + \class GEOM_TopWireframeShape GEOM_TopWireframeShape.hxx + \brief This class designed for drawing special OCC wireframe + presentation on the top level of the viewer. +*/ + +//Local includes +#include "GEOM_TopWireframeShape.ixx" +#include "GEOM_AISShape.hxx" + +//GUI includes +#include + +//Open CASCADE includes +#include +#include +#include + +GEOM_TopWireframeShape::GEOM_TopWireframeShape(const TopoDS_Shape& shape) + : SALOME_AISShape(shape) +{ + SetDisplayMode(AIS_WireFrame); + Handle(Prs3d_IsoAspect) anAspect = Attributes()->UIsoAspect(); + anAspect->SetNumber( 0 ); + Attributes()->SetUIsoAspect( anAspect ); + anAspect = Attributes()->VIsoAspect(); + anAspect->SetNumber( 0 ); + Attributes()->SetVIsoAspect( anAspect ); + SetColor(GEOM_AISShape::topLevelColor()); +} + +Handle(SALOME_InteractiveObject) GEOM_TopWireframeShape::getIO(){ + Handle(SALOME_InteractiveObject) IO; + if ( !GetOwner().IsNull() ) + IO = Handle(SALOME_InteractiveObject)::DownCast( GetOwner() ); + return IO; +} + +Standard_Boolean GEOM_TopWireframeShape::hasIO(){ + return !getIO().IsNull(); +} + +void GEOM_TopWireframeShape::setName(const Standard_CString /*aName*/) +{ +} + +Standard_CString GEOM_TopWireframeShape::getName(){ + return ""; +} + + +void GEOM_TopWireframeShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& /*aIndexMap*/, + const Standard_Boolean /*aHighlight*/ ) +{ +} + +Standard_Boolean GEOM_TopWireframeShape::isTopLevel() { + return Standard_True; +} + +void GEOM_TopWireframeShape::setTopLevel(Standard_Boolean /*f*/) { + +} + +Standard_Boolean GEOM_TopWireframeShape::toActivate() { + return Standard_False; +} + +Standard_Boolean GEOM_TopWireframeShape::switchTopLevel() { + return Standard_True; +} + +void GEOM_TopWireframeShape::setIO(const Handle(SALOME_InteractiveObject)& io){ + SetOwner( io ); +} \ No newline at end of file diff --git a/src/OBJECT/GEOM_TopWireframeShape.hxx b/src/OBJECT/GEOM_TopWireframeShape.hxx new file mode 100755 index 000000000..b15f3c670 --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.hxx @@ -0,0 +1,110 @@ +// Copyright (C) 2007-2012 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 OBJECT : interactive object for Geometry entities visualization +// File : GEOM_TopWireframeShape.hxx +// Module : GEOM +// +#ifndef _GEOM_TopWireframeShape_HeaderFile +#define _GEOM_TopWireframeShape_HeaderFile + +#include "GEOM_OBJECT_defs.hxx" + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOM_TopWireframeShape_HeaderFile +#include "Handle_GEOM_TopWireframeShape.hxx" +#endif + +#ifndef _SALOME_AISShape_HeaderFile +#include "SALOME_AISShape.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif + +class GEOM_OBJECT_EXPORT GEOM_TopWireframeShape : public SALOME_AISShape { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // inline void operator delete(void *anAddress, size_t size) + // { + // if (anAddress) Standard::Free((Standard_Address&)anAddress,size); + // } + + // Methods PUBLIC + // + GEOM_TopWireframeShape(const TopoDS_Shape& shape); + virtual Handle_SALOME_InteractiveObject getIO(); + virtual Standard_Boolean hasIO(); + virtual Standard_Boolean isTopLevel(); + virtual Standard_Boolean switchTopLevel(); + virtual Standard_Boolean toActivate(); + virtual void setTopLevel(Standard_Boolean); + virtual Standard_CString getName(); + virtual void setName(const Standard_CString aName); + virtual void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ); + ~GEOM_TopWireframeShape(); + + // Type management + // + friend Handle_Standard_Type& GEOM_TopWireframeShape_Type_(); + const Handle(Standard_Type)& DynamicType() const; + Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + + + void setIO(const Handle(SALOME_InteractiveObject)& io); + +protected: + + // Methods PROTECTED + // + + // Fields PROTECTED + // + +private: + + // Methods PRIVATE + // + + // Fields PRIVATE + // +}; + +// other inline functions and methods (like "C++: function call" methods) +// + +#endif \ No newline at end of file diff --git a/src/OBJECT/GEOM_TopWireframeShape.ixx b/src/OBJECT/GEOM_TopWireframeShape.ixx new file mode 100755 index 000000000..1fd891967 --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.ixx @@ -0,0 +1,89 @@ +// Copyright (C) 2007-2012 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 OBJECT : interactive object for Geometry entities visualization +// File : GEOM_AISShape.ixx +// Module : GEOM +// +#include "GEOM_TopWireframeShape.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +GEOM_TopWireframeShape::~GEOM_TopWireframeShape() {} + +Standard_EXPORT Handle_Standard_Type& GEOM_TopWireframeShape_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_AISShape); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_AISShape); + static Handle_Standard_Type aType2 = STANDARD_TYPE(AIS_Shape); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(AIS_Shape); + static Handle_Standard_Type aType3 = STANDARD_TYPE(AIS_InteractiveObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(AIS_InteractiveObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(SelectMgr_SelectableObject); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(SelectMgr_SelectableObject); + static Handle_Standard_Type aType5 = STANDARD_TYPE(PrsMgr_PresentableObject); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(PrsMgr_PresentableObject); + static Handle_Standard_Type aType6 = STANDARD_TYPE(MMgt_TShared); + if ( aType6.IsNull()) aType6 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType7 = STANDARD_TYPE(Standard_Transient); + if ( aType7.IsNull()) aType7 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,aType7,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOM_TopWireframeShape", + sizeof(GEOM_TopWireframeShape), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOM_TopWireframeShape) Handle(GEOM_TopWireframeShape)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOM_TopWireframeShape) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOM_TopWireframeShape))) { + _anOtherObject = Handle(GEOM_TopWireframeShape)((Handle(GEOM_TopWireframeShape)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOM_TopWireframeShape::DynamicType() const +{ + return STANDARD_TYPE(GEOM_TopWireframeShape) ; +} +Standard_Boolean GEOM_TopWireframeShape::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(GEOM_TopWireframeShape) == AType || SALOME_AISShape::IsKind(AType)); +} +Handle_GEOM_TopWireframeShape::~Handle_GEOM_TopWireframeShape() {} + diff --git a/src/OBJECT/GEOM_TopWireframeShape.jxx b/src/OBJECT/GEOM_TopWireframeShape.jxx new file mode 100755 index 000000000..fade0ed1d --- /dev/null +++ b/src/OBJECT/GEOM_TopWireframeShape.jxx @@ -0,0 +1,33 @@ +// Copyright (C) 2007-2012 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 OBJECT : interactive object for Geometry entities visualization +// File : GEOM_AISShape.jxx +// Module : GEOM +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif + +#ifndef _GEOM_TopWireframeShape_HeaderFile +#include "GEOM_TopWireframeShape.hxx" +#endif diff --git a/src/OBJECT/GEOM_VTKPropertyMaterial.cxx b/src/OBJECT/GEOM_VTKPropertyMaterial.cxx new file mode 100755 index 000000000..cccaa1ef3 --- /dev/null +++ b/src/OBJECT/GEOM_VTKPropertyMaterial.cxx @@ -0,0 +1,39 @@ +// Copyright (C) 2007-2011 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 +// + +// SALOME GEOM : +// File : GEOM_VTKPropertyMaterial.cxx + +#include "GEOM_VTKPropertyMaterial.hxx" + +#include + +vtkStandardNewMacro( GEOM_VTKPropertyMaterial ); + +GEOM_VTKPropertyMaterial::GEOM_VTKPropertyMaterial() +{ + Physical = false; +} + +GEOM_VTKPropertyMaterial::~GEOM_VTKPropertyMaterial() +{ +} diff --git a/src/OBJECT/GEOM_VTKPropertyMaterial.hxx b/src/OBJECT/GEOM_VTKPropertyMaterial.hxx new file mode 100755 index 000000000..c45c3f656 --- /dev/null +++ b/src/OBJECT/GEOM_VTKPropertyMaterial.hxx @@ -0,0 +1,52 @@ +// Copyright (C) 2007-2011 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 +// + +// SALOME GEOM : +// File : GEOM_VTKPropertyMaterial.hxx + +#ifndef GEOM_VTKPropertyMaterial_H +#define GEOM_VTKPropertyMaterial_H + +#include "GEOM_OBJECT_defs.hxx" + +#include + +class GEOM_OBJECT_EXPORT GEOM_VTKPropertyMaterial : public vtkProperty +{ + +protected: + GEOM_VTKPropertyMaterial(); + virtual ~GEOM_VTKPropertyMaterial(); + +public: + vtkTypeMacro(GEOM_VTKPropertyMaterial, vtkProperty); + + vtkSetMacro(Physical, bool); + vtkGetMacro(Physical, bool); + + static GEOM_VTKPropertyMaterial* New(); + +protected: + bool Physical; +}; + +#endif diff --git a/src/OBJECT/GEOM_VTKTrihedron.cxx b/src/OBJECT/GEOM_VTKTrihedron.cxx index 113d7a931..a57f359d1 100644 --- a/src/OBJECT/GEOM_VTKTrihedron.cxx +++ b/src/OBJECT/GEOM_VTKTrihedron.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SALOME GEOM : // File : GEOM_VTKTrihedron.cxx // Author : Sergey LITONIN @@ -44,6 +45,9 @@ #include #include #include +#include +#include +#include /* Class : GEOM_VTKTrihedron @@ -80,10 +84,7 @@ vtkStandardNewMacro( GEOM_VTKTrihedronAxis ); GEOM_VTKTrihedronAxis::GEOM_VTKTrihedronAxis() { - vtkProperty* aProperty = vtkProperty::New(); - aProperty->SetColor( 0.0, 0.0, 1.0 ); - SetProperty( aProperty ); - aProperty->Delete(); + VTKViewer_Axis::SetColor( 0.0, 0.0, 1.0 ); myMatrix = vtkMatrix4x4::New(); myTrsf = vtkTransform::New(); } @@ -97,8 +98,8 @@ GEOM_VTKTrihedronAxis::~GEOM_VTKTrihedronAxis() void GEOM_VTKTrihedronAxis::SetSize( vtkFloatingPointType theSize ) { vtkFloatingPointType aPosition[ 3 ] = { myOri[ 0 ] + myDir[ 0 ] * theSize, - myOri[ 1 ] + myDir[ 1 ] * theSize, - myOri[ 2 ] + myDir[ 2 ] * theSize }; + myOri[ 1 ] + myDir[ 1 ] * theSize, + myOri[ 2 ] + myDir[ 2 ] * theSize }; myLineSource->SetPoint1( myOri[ 0 ], myOri[ 1 ], myOri[ 2 ] ); myLineSource->SetPoint2( aPosition ); @@ -112,7 +113,7 @@ void GEOM_VTKTrihedronAxis::SetSize( vtkFloatingPointType theSize ) aTrsf.SetDisplacement( gp_Ax3( gp_Pnt( 0, 0, 0 ), gp_Dir( 1, 0, 0 ) ), gp_Ax3( GetOri(), gp_Dir( myDir[ 0 ], myDir[ 1 ], myDir[ 2 ] ) ) ); - const gp_XYZ& aTrans = aTrsf.TranslationPart(); +// const gp_XYZ& aTrans = aTrsf.TranslationPart(); gp_Mat aRot = aTrsf.VectorialPart(); for ( int i = 1; i <= 3; i++ ) @@ -122,15 +123,22 @@ void GEOM_VTKTrihedronAxis::SetSize( vtkFloatingPointType theSize ) myArrowActor->SetUserMatrix( myMatrix ); myArrowActor->SetPosition( aPosition ); +#ifdef IPAL21440 + if( vtkCoordinate* aCoord = myLabelActor->GetPositionCoordinate()->GetReferenceCoordinate() ) + aCoord->SetValue( aPosition ); +#else myLabelActor->SetPosition( 0, 0, 0 ); myLabelActor->AddPosition( aPosition ); +#endif } void GEOM_VTKTrihedronAxis::Render(vtkRenderer* theRenderer) { myLineActor->Render( theRenderer ); myArrowActor->Render( theRenderer ); +#ifndef IPAL21440 myLabelActor->Render( theRenderer ); +#endif vtkCamera* aCamera = theRenderer->GetActiveCamera(); SetCamera( aCamera ); @@ -158,25 +166,25 @@ void GEOM_VTKTrihedronAxis::SetAxis( const gp_Ax1& theAxis, vtkFloatingPointType aColor[ 3 ] = { 0, 0, 0 }; aColor[ theRot ] = 1; - vtkProperty* aProperty = vtkProperty::New(); if ( theColor[ 0 ] == -1 ) - aProperty->SetColor( aColor[ 0 ], aColor[ 1 ], aColor[ 2 ] ); + VTKViewer_Axis::SetColor( aColor[ 0 ], aColor[ 1 ], aColor[ 2 ] ); else - aProperty->SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] ); - SetProperty( aProperty ); - aProperty->Delete(); + VTKViewer_Axis::SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] ); +#ifdef IPAL21440 + if ( theRot == 0 ) myTextMapper->SetInput( "X" ); + else if ( theRot == 1 ) myTextMapper->SetInput( "Y" ); + else if ( theRot == 2 ) myTextMapper->SetInput( "Z" ); +#else if ( theRot == 0 ) myVectorText->SetText( "X" ); else if ( theRot == 1 ) myVectorText->SetText( "Y" ); else if ( theRot == 2 ) myVectorText->SetText( "Z" ); +#endif } void GEOM_VTKTrihedronAxis::SetColor( const vtkFloatingPointType theColor[ 3 ] ) { - vtkProperty* aProperty = vtkProperty::New(); - aProperty->SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] ); - SetProperty( aProperty ); - aProperty->Delete(); + VTKViewer_Axis::SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] ); } @@ -193,9 +201,18 @@ GEOM_VTKTrihedron::GEOM_VTKTrihedron() myMapper = vtkPolyDataMapper::New(); myAxis[ 0 ] = myAxis[ 1 ] = myAxis[ 2 ] = 0; mySize = 100; - SetInfinitive( true ); - myColor[ 0 ] = myColor[ 1 ] = myColor[ 1 ] = -1; - SetInfinitive( true ); + + myColor[ 0 ] = myColor[ 1 ] = myColor[ 2 ] = -1; + + myDefaultColor[ 0 ] = myDefaultColor[ 1 ] = myDefaultColor[ 2 ] = 1; + + myPreHighlightColor[ 0 ] = 0; + myPreHighlightColor[ 1 ] = myPreHighlightColor[ 2 ] = 1; + + myHighlightColor[ 0 ] = myHighlightColor[ 1 ] = myHighlightColor[ 2 ] = 1; + + //SetInfinitive( true ); + SetPickable( true ); } GEOM_VTKTrihedron::~GEOM_VTKTrihedron() @@ -247,6 +264,12 @@ void GEOM_VTKTrihedron::SetSize( vtkFloatingPointType theSize ) aRes->Delete(); } +void GEOM_VTKTrihedron::SetVisibility( int theVisibility ) +{ + Superclass::SetVisibility( theVisibility ); + SetVisibility( theVisibility == 1 ? VTKViewer_Trihedron::eOn : VTKViewer_Trihedron::eOff ); +} + void GEOM_VTKTrihedron::SetVisibility( VTKViewer_Trihedron::TVisibility theVis ) { for ( int i = 0; i < 3; i++ ) @@ -361,21 +384,48 @@ bool GEOM_VTKTrihedron::IsSetCamera() const bool GEOM_VTKTrihedron::IsResizable() const { - return true; + return false; } +void GEOM_VTKTrihedron::Highlight( bool theIsHighlight ) +{ + if( theIsHighlight ) + SetAxesColors( myHighlightColor ); + else + ResetAxesColors(); + Superclass::Highlight( theIsHighlight ); +} +bool GEOM_VTKTrihedron::PreHighlight( vtkInteractorStyle *theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight ) +{ + if ( !GetPickable() ) + return false; + if ( !isHighlighted() ) + { + if( theIsHighlight ) + SetAxesColors( myPreHighlightColor ); + else + ResetAxesColors(); + } + return Superclass::PreHighlight( theInteractorStyle, theSelectionEvent, theIsHighlight ); +} +void GEOM_VTKTrihedron::ResetAxesColors() +{ + if( myColor[0] != -1 ) + SetAxesColors( myColor ); + else + SetAxesColors( myDefaultColor, true ); +} - - - - - - - - - +void GEOM_VTKTrihedron::SetAxesColors( vtkFloatingPointType theColor[3], bool theIsDiffuse ) +{ + myAxis[ 0 ]->SetColor( theColor[0], theIsDiffuse ? 0.0 : theColor[1], theIsDiffuse ? 0.0 : theColor[2] ); + myAxis[ 1 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theColor[1], theIsDiffuse ? 0.0 : theColor[2] ); + myAxis[ 2 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theIsDiffuse ? 0.0 : theColor[1], theColor[2] ); +} diff --git a/src/OBJECT/GEOM_VTKTrihedron.hxx b/src/OBJECT/GEOM_VTKTrihedron.hxx index 9dde2edd4..99a3ab60c 100644 --- a/src/OBJECT/GEOM_VTKTrihedron.hxx +++ b/src/OBJECT/GEOM_VTKTrihedron.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SALOME GEOM : // File : GEOM_VTKTrihedron.h // Author : Sergey LITONIN @@ -57,6 +58,7 @@ public: virtual vtkFloatingPointType GetSize() { return mySize;} + virtual void SetVisibility( int theVisibility ); virtual void SetVisibility( VTKViewer_Trihedron::TVisibility theVis ); virtual void VisibilityOff() { SetVisibility( VTKViewer_Trihedron::eOff ); } virtual void VisibilityOn() { SetVisibility( VTKViewer_Trihedron::eOn ); } @@ -79,7 +81,16 @@ public: void SetColor( vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ); void GetColor( vtkFloatingPointType& r, vtkFloatingPointType& g, vtkFloatingPointType& b ); - virtual bool hasHighlight() { return false; } + virtual bool hasHighlight() { return true; } + + virtual void Highlight( bool theHighlight ); + virtual bool PreHighlight( vtkInteractorStyle* theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight ); + +protected: + virtual void ResetAxesColors(); + virtual void SetAxesColors( vtkFloatingPointType theColor[3], bool theIsDiffuse = false ); protected: VTKViewer_Axis* myAxis[3]; @@ -88,6 +99,9 @@ protected: gp_Pnt myLocation; gp_Dir myDirX, myDirY, myDirZ; vtkFloatingPointType myColor[ 3 ]; + vtkFloatingPointType myDefaultColor[ 3 ]; + vtkFloatingPointType myPreHighlightColor[ 3 ]; + vtkFloatingPointType myHighlightColor[ 3 ]; }; #endif diff --git a/src/OBJECT/GEOM_VertexSource.cxx b/src/OBJECT/GEOM_VertexSource.cxx deleted file mode 100755 index 4fdf79092..000000000 --- a/src/OBJECT/GEOM_VertexSource.cxx +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2007-2008 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_VertexSource.h" - -#include - -#include -#include -#include -#include - -#include -#include - -vtkStandardNewMacro(GEOM_VertexSource); - -GEOM_VertexSource::GEOM_VertexSource() -{ -} - -GEOM_VertexSource::~GEOM_VertexSource() -{ -} - -void -GEOM_VertexSource:: -AddVertex(const TopoDS_Vertex& theVertex) -{ - myVertexSet.Add(theVertex); -} - -void -GEOM_VertexSource:: -Execute() -{ - vtkPolyData* aPolyData = GetOutput(); - aPolyData->Allocate(); - vtkPoints* aPts = vtkPoints::New(); - aPolyData->SetPoints(aPts); - aPts->Delete(); - - TVertexSet::Iterator anIter(myVertexSet); - for(; anIter.More(); anIter.Next()){ - const TopoDS_Vertex& aVertex = anIter.Value(); - OCC2VTK(aVertex,aPolyData,aPts); - } -} - -void -GEOM_VertexSource:: -OCC2VTK(const TopoDS_Vertex& theVertex, - vtkPolyData* thePolyData, - vtkPoints* thePts) -{ - gp_Pnt aPnt = BRep_Tool::Pnt(theVertex); - vtkIdType anId = thePts->InsertNextPoint(aPnt.X(),aPnt.Y(),aPnt.Z()); - thePolyData->InsertNextCell(VTK_VERTEX,1,&anId); -} diff --git a/src/OBJECT/GEOM_VertexSource.h b/src/OBJECT/GEOM_VertexSource.h deleted file mode 100755 index 00ac63f85..000000000 --- a/src/OBJECT/GEOM_VertexSource.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2007-2008 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_VERTEXSOURCE_H -#define GEOM_VERTEXSOURCE_H - -#include "GEOM_DeviceActor.h" - -#include -#include - -typedef NCollection_Set TVertexSet; - -#include - - -class VTK_EXPORT GEOM_VertexSource: public vtkPolyDataSource -{ -public: - vtkTypeMacro(GEOM_VertexSource,vtkPolyDataSource); - static GEOM_VertexSource* New(); - - void AddVertex(const TopoDS_Vertex& theVertex); - void Clear(){ myVertexSet.Clear();} - - static - void OCC2VTK(const TopoDS_Vertex& theVertex, - vtkPolyData* thePolyData, - vtkPoints* thePts); - -protected: - TVertexSet myVertexSet; - - void Execute(); - - GEOM_VertexSource(); - ~GEOM_VertexSource(); - -private: - // Not implememnted - GEOM_VertexSource(const GEOM_VertexSource&); - void operator=(const GEOM_VertexSource&); -}; - - -#endif //GEOM_VERTEXSOURCE_H diff --git a/src/OBJECT/GEOM_WireframeFace.cxx b/src/OBJECT/GEOM_WireframeFace.cxx deleted file mode 100755 index 08430275f..000000000 --- a/src/OBJECT/GEOM_WireframeFace.cxx +++ /dev/null @@ -1,507 +0,0 @@ -// Copyright (C) 2007-2008 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_WireframeFace.h" - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -vtkStandardNewMacro(GEOM_WireframeFace); - -GEOM_WireframeFace::GEOM_WireframeFace(): - Discret(15) -{ - NbIso[0] = 1; - NbIso[1] = 1; -} - -GEOM_WireframeFace::~GEOM_WireframeFace() -{ -} - -void -GEOM_WireframeFace:: -Execute() -{ - vtkPolyData* aPolyData = GetOutput(); - aPolyData->Allocate(); - vtkPoints* aPts = vtkPoints::New(); - aPolyData->SetPoints(aPts); - aPts->Delete(); - - TFaceSet::Iterator anIter(myFaceSet); - for(; anIter.More(); anIter.Next()){ - const TopoDS_Face& aFace = anIter.Value(); - OCC2VTK(aFace,aPolyData,aPts,NbIso,Discret); - } -} - -void GEOM_WireframeFace::SetNbIso(const int theNb[2]) -{ - if ( theNb[0] == NbIso[0] && theNb[1] == NbIso[1]) - return; - - NbIso[0] = theNb[0]; - NbIso[1] = theNb[1]; - - Modified(); -} - -void GEOM_WireframeFace::GetNbIso(int &theNbU,int &theNbV) -{ - theNbU = NbIso[0]; - theNbV = NbIso[1]; -} - -void -GEOM_WireframeFace:: -OCC2VTK(const TopoDS_Face& theFace, - vtkPolyData* thePolyData, - vtkPoints* thePts, - const int theNbIso[2], - const int theDiscret) -{ - TopoDS_Face aFace = theFace; - aFace.Orientation(TopAbs_FORWARD); - CreateIso(aFace,theNbIso,theDiscret,thePolyData,thePts); -} - -void -GEOM_WireframeFace:: -CreateIso(const TopoDS_Face& theFace, - const int theNbIso[2], - const int theDiscret, - vtkPolyData* thePolyData, - vtkPoints* thePts) -{ - // Constants for iso building - static Standard_Real INTERSECTOR_CONFUSION = 1.e-10 ; // -8 ; - static Standard_Real INTERSECTOR_TANGENCY = 1.e-10 ; // -8 ; - - static Standard_Real HATHCER_CONFUSION_2D = 1.e-8 ; - static Standard_Real HATHCER_CONFUSION_3D = 1.e-8 ; - - Geom2dHatch_Hatcher - aHatcher(Geom2dHatch_Intersector(INTERSECTOR_CONFUSION, - INTERSECTOR_TANGENCY), - HATHCER_CONFUSION_2D, - HATHCER_CONFUSION_3D, - Standard_True, - Standard_False); - - Standard_Real anUMin, anUMax, aVMin, aVMax; - TColStd_Array1OfReal anUPrm(1, theNbIso[0]), aVPrm(1, theNbIso[1]); - TColStd_Array1OfInteger anUInd(1, theNbIso[0]), aVInd(1, theNbIso[1]); - - anUInd.Init(0); - aVInd.Init(0); - - //----------------------------------------------------------------------- - // If the Min Max bounds are infinite, there are bounded to Infinite - // value. - //----------------------------------------------------------------------- - BRepTools::UVBounds(theFace, anUMin, anUMax, aVMin, aVMax) ; - Standard_Boolean InfiniteUMin = Precision::IsNegativeInfinite (anUMin) ; - Standard_Boolean InfiniteUMax = Precision::IsPositiveInfinite (anUMax) ; - Standard_Boolean InfiniteVMin = Precision::IsNegativeInfinite (aVMin) ; - Standard_Boolean InfiniteVMax = Precision::IsPositiveInfinite (aVMax) ; - - static float VTKINFINITE = 1.0E38; - if(InfiniteUMin && InfiniteUMax){ - anUMin = - VTKINFINITE ; - anUMax = VTKINFINITE ; - }else if(InfiniteUMin){ - anUMin = anUMax - VTKINFINITE ; - }else if(InfiniteUMax){ - anUMax = anUMin + VTKINFINITE ; - } - - if(InfiniteVMin && InfiniteVMax){ - aVMin = - VTKINFINITE ; - aVMax = VTKINFINITE ; - }else if(InfiniteVMin){ - aVMin = aVMax - VTKINFINITE ; - }else if(InfiniteVMax){ - aVMax = aVMin + VTKINFINITE ; - } - - //----------------------------------------------------------------------- - // Retreiving the edges and loading them into the hatcher. - //----------------------------------------------------------------------- - TopExp_Explorer ExpEdges(theFace, TopAbs_EDGE); - for(; ExpEdges.More(); ExpEdges.Next()){ - const TopoDS_Edge& anEdge = TopoDS::Edge(ExpEdges.Current()); - Standard_Real U1, U2 ; - const Handle(Geom2d_Curve) PCurve = - BRep_Tool::CurveOnSurface(anEdge, theFace, U1, U2) ; - - if(PCurve.IsNull() || U1 == U2) - return; - - //-- Test if a TrimmedCurve is necessary - if(Abs(PCurve->FirstParameter()-U1) <= Precision::PConfusion() && - Abs(PCurve->LastParameter()-U2) <= Precision::PConfusion()) - { - aHatcher.AddElement(PCurve, anEdge.Orientation()) ; - }else{ - if(!PCurve->IsPeriodic()){ - Handle(Geom2d_TrimmedCurve) TrimPCurve = - Handle(Geom2d_TrimmedCurve)::DownCast(PCurve); - if(!TrimPCurve.IsNull()){ - Handle_Geom2d_Curve aBasisCurve = TrimPCurve->BasisCurve(); - if(aBasisCurve->FirstParameter()-U1 > Precision::PConfusion() || - U2-aBasisCurve->LastParameter() > Precision::PConfusion()) - { - aHatcher.AddElement(PCurve, anEdge.Orientation()) ; - return; - } - }else{ - if(PCurve->FirstParameter()-U1 > Precision::PConfusion()){ - U1=PCurve->FirstParameter(); - } - if(U2-PCurve->LastParameter() > Precision::PConfusion()){ - U2=PCurve->LastParameter(); - } - } - } - Handle(Geom2d_TrimmedCurve) TrimPCurve = - new Geom2d_TrimmedCurve(PCurve, U1, U2); - aHatcher.AddElement(TrimPCurve, anEdge.Orientation()); - } - } - - - //----------------------------------------------------------------------- - // Loading and trimming the hatchings. - //----------------------------------------------------------------------- - Standard_Integer IIso; - Standard_Real DeltaU = Abs(anUMax - anUMin) ; - Standard_Real DeltaV = Abs(aVMax - aVMin) ; - Standard_Real confusion = Min(DeltaU, DeltaV) * HATHCER_CONFUSION_3D ; - aHatcher.Confusion3d (confusion) ; - - Standard_Real StepU = DeltaU / (Standard_Real)theNbIso[0]; - if(StepU > confusion){ - Standard_Real UPrm = anUMin + StepU / 2.; - gp_Dir2d Dir(0., 1.) ; - for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++) { - anUPrm(IIso) = UPrm ; - gp_Pnt2d Ori (UPrm, 0.) ; - Geom2dAdaptor_Curve HCur (new Geom2d_Line (Ori, Dir)) ; - anUInd(IIso) = aHatcher.AddHatching (HCur) ; - UPrm += StepU ; - } - } - - Standard_Real StepV = DeltaV / (Standard_Real) theNbIso[1] ; - if(StepV > confusion){ - Standard_Real VPrm = aVMin + StepV / 2.; - gp_Dir2d Dir(1., 0.); - for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){ - aVPrm(IIso) = VPrm; - gp_Pnt2d Ori (0., VPrm); - Geom2dAdaptor_Curve HCur(new Geom2d_Line (Ori, Dir)); - aVInd(IIso) = aHatcher.AddHatching (HCur) ; - VPrm += StepV ; - } - } - - //----------------------------------------------------------------------- - // Computation. - //----------------------------------------------------------------------- - aHatcher.Trim() ; - - Standard_Integer aNbDom = 0 ; // for debug purpose - Standard_Integer Index ; - - for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++){ - Index = anUInd(IIso) ; - if(Index != 0){ - if(aHatcher.TrimDone(Index) && !aHatcher.TrimFailed(Index)){ - aHatcher.ComputeDomains(Index); - if(aHatcher.IsDone (Index)) - aNbDom = aHatcher.NbDomains (Index); - } - } - } - - for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){ - Index = aVInd(IIso); - if(Index != 0){ - if(aHatcher.TrimDone (Index) && !aHatcher.TrimFailed(Index)){ - aHatcher.ComputeDomains (Index); - if(aHatcher.IsDone (Index)) - aNbDom = aHatcher.NbDomains (Index); - } - } - } - - //----------------------------------------------------------------------- - // Push iso lines in vtk kernel - //----------------------------------------------------------------------- - for(Standard_Integer UIso = anUPrm.Lower() ; UIso <= anUPrm.Upper(); UIso++){ - Standard_Integer UInd = anUInd.Value(UIso); - if(UInd != 0){ - Standard_Real UPrm = anUPrm.Value(UIso); - if(aHatcher.IsDone(UInd)){ - Standard_Integer NbDom = aHatcher.NbDomains(UInd); - for(Standard_Integer IDom = 1 ; IDom <= NbDom ; IDom++){ - const HatchGen_Domain& Dom = aHatcher.Domain(UInd, IDom) ; - Standard_Real V1 = Dom.HasFirstPoint()? Dom.FirstPoint().Parameter(): aVMin - VTKINFINITE; - Standard_Real V2 = Dom.HasSecondPoint()? Dom.SecondPoint().Parameter(): aVMax + VTKINFINITE; - CreateIso_(theFace, GeomAbs_IsoU, UPrm, V1, V2, theDiscret, thePolyData, thePts); - } - } - } - } - - for(Standard_Integer VIso = aVPrm.Lower() ; VIso <= aVPrm.Upper(); VIso++){ - Standard_Integer VInd = aVInd.Value(VIso); - if(VInd != 0){ - Standard_Real VPrm = aVPrm.Value(VIso); - if(aHatcher.IsDone (VInd)){ - Standard_Integer NbDom = aHatcher.NbDomains(VInd); - for (Standard_Integer IDom = 1 ; IDom <= NbDom ; IDom++){ - const HatchGen_Domain& Dom = aHatcher.Domain(VInd, IDom); - Standard_Real U1 = Dom.HasFirstPoint()? Dom.FirstPoint().Parameter(): aVMin - VTKINFINITE; - Standard_Real U2 = Dom.HasSecondPoint()? Dom.SecondPoint().Parameter(): aVMax + VTKINFINITE; - CreateIso_(theFace, GeomAbs_IsoV, VPrm, U1, U2, theDiscret, thePolyData, thePts); - } - } - } - } -} - - - -void -GEOM_WireframeFace:: -CreateIso_(const TopoDS_Face& theFace, - GeomAbs_IsoType theIsoType, - Standard_Real Par, - Standard_Real T1, - Standard_Real T2, - const int theDiscret, - vtkPolyData* thePolyData, - vtkPoints* thePts) -{ - Standard_Real U1, U2, V1, V2, stepU=0., stepV=0.; - Standard_Integer j; - gp_Pnt P; - - TopLoc_Location aLoc; - const Handle(Geom_Surface)& S = BRep_Tool::Surface(theFace,aLoc); - - if(!S.IsNull()){ - BRepAdaptor_Surface S(theFace,Standard_False); - - GeomAbs_SurfaceType SurfType = S.GetType(); - - GeomAbs_CurveType CurvType = GeomAbs_OtherCurve; - - Standard_Integer Intrv, nbIntv; - Standard_Integer nbUIntv = S.NbUIntervals(GeomAbs_CN); - Standard_Integer nbVIntv = S.NbVIntervals(GeomAbs_CN); - TColStd_Array1OfReal TI(1,Max(nbUIntv, nbVIntv)+1); - - if(theIsoType == GeomAbs_IsoU){ - S.VIntervals(TI, GeomAbs_CN); - V1 = Max(T1, TI(1)); - V2 = Min(T2, TI(2)); - U1 = Par; - U2 = Par; - stepU = 0; - nbIntv = nbVIntv; - }else{ - S.UIntervals(TI, GeomAbs_CN); - U1 = Max(T1, TI(1)); - U2 = Min(T2, TI(2)); - V1 = Par; - V2 = Par; - stepV = 0; - nbIntv = nbUIntv; - } - - S.D0(U1,V1,P); - MoveTo(P,thePts); - - for(Intrv = 1; Intrv <= nbIntv; Intrv++){ - if(TI(Intrv) <= T1 && TI(Intrv + 1) <= T1) - continue; - if(TI(Intrv) >= T2 && TI(Intrv + 1) >= T2) - continue; - if(theIsoType == GeomAbs_IsoU){ - V1 = Max(T1, TI(Intrv)); - V2 = Min(T2, TI(Intrv + 1)); - stepV = (V2 - V1) / theDiscret; - }else{ - U1 = Max(T1, TI(Intrv)); - U2 = Min(T2, TI(Intrv + 1)); - stepU = (U2 - U1) / theDiscret; - } - - switch (SurfType) { - case GeomAbs_Plane : - break; - case GeomAbs_Cylinder : - case GeomAbs_Cone : - if(theIsoType == GeomAbs_IsoV){ - for(j = 1; j < theDiscret; j++){ - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,thePolyData,thePts); - } - } - break; - case GeomAbs_Sphere : - case GeomAbs_Torus : - case GeomAbs_OffsetSurface : - case GeomAbs_OtherSurface : - for(j = 1; j < theDiscret; j++){ - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,thePolyData,thePts); - } - break; - case GeomAbs_BezierSurface : - case GeomAbs_BSplineSurface : - for(j = 1; j <= theDiscret/2; j++){ - Standard_Real aStep = (theIsoType == GeomAbs_IsoV) ? stepU*2. : stepV*2.; - CreateIso__(S, theIsoType, U1, V1, aStep, thePolyData, thePts); - U1 += stepU*2.; - V1 += stepV*2.; - } - break; - case GeomAbs_SurfaceOfExtrusion : - case GeomAbs_SurfaceOfRevolution : - if((theIsoType == GeomAbs_IsoV && SurfType == GeomAbs_SurfaceOfRevolution) || - (theIsoType == GeomAbs_IsoU && SurfType == GeomAbs_SurfaceOfExtrusion)) - { - if(SurfType == GeomAbs_SurfaceOfExtrusion) - break; - for(j = 1; j < theDiscret; j++){ - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,thePolyData,thePts); - } - }else{ - CurvType = (S.BasisCurve())->GetType(); - switch(CurvType){ - case GeomAbs_Line : - break; - case GeomAbs_Circle : - case GeomAbs_Ellipse : - for (j = 1; j < theDiscret; j++) { - U1 += stepU; - V1 += stepV; - S.D0(U1,V1,P); - DrawTo(P,thePolyData,thePts); - } - break; - case GeomAbs_Parabola : - case GeomAbs_Hyperbola : - case GeomAbs_BezierCurve : - case GeomAbs_BSplineCurve : - case GeomAbs_OtherCurve : - for(j = 1; j <= theDiscret/2; j++){ - Standard_Real aStep = (theIsoType == GeomAbs_IsoV) ? stepU*2. : stepV*2.; - CreateIso__(S, theIsoType, U1, V1, aStep, thePolyData, thePts); - U1 += stepU*2.; - V1 += stepV*2.; - } - break; - } - } - } - } - S.D0(U2,V2,P); - DrawTo(P,thePolyData,thePts); - } -} - - - - -void -GEOM_WireframeFace:: -CreateIso__(const BRepAdaptor_Surface& theSurface, - GeomAbs_IsoType theIsoType, - Standard_Real& theU, - Standard_Real& theV, - Standard_Real theStep, - vtkPolyData* thePolyData, - vtkPoints* thePts) -{ - gp_Pnt Pl, Pr, Pm; - if (theIsoType == GeomAbs_IsoU) { - theSurface.D0(theU, theV, Pl); - theSurface.D0(theU, theV + theStep/2., Pm); - theSurface.D0(theU, theV + theStep, Pr); - } else { - theSurface.D0(theU, theV, Pl); - theSurface.D0(theU + theStep/2., theV, Pm); - theSurface.D0(theU + theStep, theV, Pr); - } - - static Standard_Real ISO_RATIO = 1.001; - if (Pm.Distance(Pl) + Pm.Distance(Pr) <= ISO_RATIO*Pl.Distance(Pr)) { - DrawTo(Pr,thePolyData,thePts); - } else { - if (theIsoType == GeomAbs_IsoU) { - CreateIso__(theSurface, theIsoType, theU, theV, theStep/2, thePolyData, thePts); - Standard_Real aLocalV = theV + theStep/2 ; - CreateIso__(theSurface, theIsoType, theU, aLocalV , theStep/2, thePolyData, thePts); - } else { - CreateIso__(theSurface, theIsoType, theU, theV, theStep/2, thePolyData, thePts); - Standard_Real aLocalU = theU + theStep/2 ; - CreateIso__(theSurface, theIsoType, aLocalU , theV, theStep/2, thePolyData, thePts); - } - } -} diff --git a/src/OBJECT/GEOM_WireframeFace.h b/src/OBJECT/GEOM_WireframeFace.h deleted file mode 100755 index 2958694df..000000000 --- a/src/OBJECT/GEOM_WireframeFace.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2007-2008 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_WIREFRAME_FACE_H -#define GEOM_WIREFRAME_FACE_H - -#include "GEOM_FaceSource.h" - -#include -#include - -#include - - -class VTK_EXPORT GEOM_WireframeFace: public GEOM_FaceSource -{ -public: - vtkTypeMacro(GEOM_WireframeFace,GEOM_FaceSource); - static GEOM_WireframeFace* New(); - - /* vtkSetMacro(NbIso,int); - vtkGetMacro(NbIso,int);*/ - - vtkSetMacro(Discret,int); - vtkGetMacro(Discret,int); - - static - void OCC2VTK(const TopoDS_Face& theFace, - vtkPolyData* thePolyData, - vtkPoints* thePts, - const int theNbIso[2], - const int theDiscret = 15); - - //! IsoLines management - // theNb[0] - number of U lines - // theNb[1] - number of V lines - virtual void SetNbIso(const int theNb[2]); - virtual void GetNbIso(int &theNbU,int &theNbV); - -protected: - int NbIso[2], Discret; - - static - void - CreateIso(const TopoDS_Face& theFace, - const int theNbIso[2], - const int theDiscret, - vtkPolyData* thePolyData, - vtkPoints* thePts); - - static - void - CreateIso_(const TopoDS_Face& theFace, - GeomAbs_IsoType theIsoType, - Standard_Real Par, - Standard_Real T1, - Standard_Real T2, - const int theDiscret, - vtkPolyData* thePolyData, - vtkPoints* thePts); - - static - void - CreateIso__(const BRepAdaptor_Surface& theSurface, - GeomAbs_IsoType theIsoType, - Standard_Real& theU, - Standard_Real& theV, - Standard_Real theStep, - vtkPolyData* thePolyData, - vtkPoints* thePts); - - void Execute(); - - GEOM_WireframeFace(); - ~GEOM_WireframeFace(); - -private: - // Not implememnted - GEOM_WireframeFace(const GEOM_WireframeFace&); - void operator=(const GEOM_WireframeFace&); -}; - - -#endif //GEOM_WFACEACTOR_H diff --git a/src/OBJECT/Handle_GEOM_AISShape.hxx b/src/OBJECT/Handle_GEOM_AISShape.hxx index 4556c2712..3fda3f6f3 100644 --- a/src/OBJECT/Handle_GEOM_AISShape.hxx +++ b/src/OBJECT/Handle_GEOM_AISShape.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : Handle_GEOM_AISShape.hxx // Module : GEOM diff --git a/src/OBJECT/Handle_GEOM_InteractiveObject.hxx b/src/OBJECT/Handle_GEOM_InteractiveObject.hxx index 822359cb7..4e2a4c8ad 100644 --- a/src/OBJECT/Handle_GEOM_InteractiveObject.hxx +++ b/src/OBJECT/Handle_GEOM_InteractiveObject.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM OBJECT : interactive object for Geometry entities visualization // File : Handle_GEOM_InteractiveObject.hxx // Module : GEOM diff --git a/src/OBJECT/Handle_GEOM_TopWireframeShape.hxx b/src/OBJECT/Handle_GEOM_TopWireframeShape.hxx new file mode 100755 index 000000000..d703c6869 --- /dev/null +++ b/src/OBJECT/Handle_GEOM_TopWireframeShape.hxx @@ -0,0 +1,100 @@ +// Copyright (C) 2007-2012 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 OBJECT : interactive object for Geometry entities visualization +// File : Handle_GEOM_TopWireframeShape.hxx +// Module : GEOM +// +#ifndef _Handle_GEOM_TopWireframeShape_HeaderFile +#define _Handle_GEOM_TopWireframeShape_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SALOME_AISShape_HeaderFile +#include "Handle_SALOME_AISShape.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SALOME_AISShape); +class GEOM_TopWireframeShape; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_TopWireframeShape); + +class Handle(GEOM_TopWireframeShape) : public Handle(SALOME_AISShape) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(GEOM_TopWireframeShape)():Handle(SALOME_AISShape)() {} + Handle(GEOM_TopWireframeShape)(const Handle(GEOM_TopWireframeShape)& aHandle) : Handle(SALOME_AISShape)(aHandle) + { + } + + Handle(GEOM_TopWireframeShape)(const GEOM_TopWireframeShape* anItem) : Handle(SALOME_AISShape)((SALOME_AISShape *)anItem) + { + } + + Handle(GEOM_TopWireframeShape)& operator=(const Handle(GEOM_TopWireframeShape)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOM_TopWireframeShape)& operator=(const GEOM_TopWireframeShape* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOM_TopWireframeShape* operator->() + { + return (GEOM_TopWireframeShape *)ControlAccess(); + } + + GEOM_TopWireframeShape* operator->() const + { + return (GEOM_TopWireframeShape *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOM_TopWireframeShape)(); + + Standard_EXPORT static const Handle(GEOM_TopWireframeShape) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/OBJECT/Makefile.am b/src/OBJECT/Makefile.am index 671ab5c4c..ae48a97f8 100644 --- a/src/OBJECT/Makefile.am +++ b/src/OBJECT/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM OBJECT : interactive object for Geometry entities visualization # File : Makefile.in # Author : Damien COQUERET (OCC) @@ -30,27 +28,28 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files salomeinclude_HEADERS = \ GEOM_Actor.h \ - GEOM_AssemblyBuilder.h \ GEOM_AISShape.hxx \ GEOM_AISShape.ixx \ GEOM_AISShape.jxx \ Handle_GEOM_AISShape.hxx \ + GEOM_TopWireframeShape.hxx \ + GEOM_TopWireframeShape.ixx \ + GEOM_TopWireframeShape.jxx \ + Handle_GEOM_TopWireframeShape.hxx \ GEOM_InteractiveObject.hxx \ GEOM_InteractiveObject.ixx \ GEOM_InteractiveObject.jxx \ Handle_GEOM_InteractiveObject.hxx \ GEOM_AISTrihedron.hxx \ GEOM_VTKTrihedron.hxx \ + GEOM_VTKPropertyMaterial.hxx \ GEOM_AISVector.hxx \ GEOM_OBJECT_defs.hxx \ GEOM_OCCReader.h \ GEOM_SmartPtr.h \ + GEOM_PainterPolyDataMapper.h \ GEOM_DeviceActor.h \ - GEOM_EdgeSource.h \ - GEOM_FaceSource.h \ - GEOM_ShadingFace.h \ - GEOM_VertexSource.h \ - GEOM_WireframeFace.h + GEOM_Constants.h # Libraries targets lib_LTLIBRARIES = libGEOMObject.la @@ -58,18 +57,15 @@ lib_LTLIBRARIES = libGEOMObject.la dist_libGEOMObject_la_SOURCES = \ GEOM_Actor.cxx \ GEOM_OCCReader.cxx \ - GEOM_AssemblyBuilder.cxx \ GEOM_AISShape.cxx \ + GEOM_TopWireframeShape.cxx \ GEOM_InteractiveObject.cxx \ GEOM_AISTrihedron.cxx \ GEOM_VTKTrihedron.cxx \ + GEOM_VTKPropertyMaterial.cxx \ GEOM_AISVector.cxx \ - GEOM_DeviceActor.cxx \ - GEOM_EdgeSource.cxx \ - GEOM_FaceSource.cxx \ - GEOM_ShadingFace.cxx \ - GEOM_VertexSource.cxx \ - GEOM_WireframeFace.cxx + GEOM_PainterPolyDataMapper.cxx \ + GEOM_DeviceActor.cxx libGEOMObject_la_CPPFLAGS = \ @@ -80,14 +76,17 @@ libGEOMObject_la_CPPFLAGS = \ $(CAS_CPPFLAGS) \ $(VTK_INCLUDES) \ $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) - + $(GUI_CXXFLAGS) \ + -I$(srcdir)/../OCC2VTK + libGEOMObject_la_LDFLAGS = \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ - $(GUI_LDFLAGS) -lqtx -lVTKViewer -lSVTK -lSalomeObject -# $(CORBA_LIBS) \ + ../OCC2VTK/libOCC2VTK.la \ + $(QT_MT_LIBS) \ + $(CAS_KERNEL) -lTKBRep -lTKG2d -lTKG3d -lTKV3d -lTKMesh -lTKGeomBase -lTKGeomAlgo -lTKTopAlgo -lTKService \ + $(VTK_LIBS) \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ + $(GUI_LDFLAGS) -lsuit -lqtx -lVTKViewer -lSVTK -lSalomeObject -lSalomeApp\ + $(CORBA_LIBS) # $(STDLIB) \ # $(PYTHON_LIBS) \ -# $(QT_MT_LIBS) \ -# $(VTK_LIBS) \ # $(OGL_LIBS) diff --git a/src/OBJECT/OBJECT.pro b/src/OBJECT/OBJECT.pro deleted file mode 100644 index 0c8330f26..000000000 --- a/src/OBJECT/OBJECT.pro +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMObject -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -GUI_LDFLAGS = -L$$(GUI_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${CORBA_INCLUDES} $${QT_INCLUDES} $${PYTHON_INCLUDES} $${CAS_CPPFLAGS} $${VTK_INCLUDES} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} - -LIBS += $${KERNEL_LDFLAGS} -lSALOMELocalTrace $${GUI_LDFLAGS} -lqtx -lVTKViewer -lSVTK -lSalomeObject - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OBJECT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = GEOM_Actor.h -HEADERS += GEOM_AssemblyBuilder.h -HEADERS += GEOM_AISShape.hxx -HEADERS += Handle_GEOM_AISShape.hxx -HEADERS += GEOM_InteractiveObject.hxx -HEADERS += Handle_GEOM_InteractiveObject.hxx -HEADERS += GEOM_AISTrihedron.hxx -HEADERS += GEOM_VTKTrihedron.hxx -HEADERS += GEOM_AISVector.hxx -HEADERS += GEOM_OBJECT_defs.hxx - -SOURCES = GEOM_Actor.cxx -SOURCES += GEOM_OCCReader.cxx -SOURCES += GEOM_AssemblyBuilder.cxx -SOURCES += GEOM_AISShape.cxx -SOURCES += GEOM_InteractiveObject.cxx -SOURCES += GEOM_AISTrihedron.cxx -SOURCES += GEOM_VTKTrihedron.cxx -SOURCES += GEOM_AISVector.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/OCC2VTK/GEOM_EdgeSource.cxx b/src/OCC2VTK/GEOM_EdgeSource.cxx new file mode 100755 index 000000000..d7d3a4174 --- /dev/null +++ b/src/OCC2VTK/GEOM_EdgeSource.cxx @@ -0,0 +1,275 @@ +// Copyright (C) 2007-2012 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 "GEOM_EdgeSource.h" + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +vtkStandardNewMacro(GEOM_EdgeSource); + +GEOM_EdgeSource::GEOM_EdgeSource() : + myIsVector(false) +{ +} + +GEOM_EdgeSource::~GEOM_EdgeSource() +{ +} + +void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge, + bool theIsVector) +{ + myEdgeSet.Add(theEdge); + myIsVector = theIsVector; +} + +void +GEOM_EdgeSource:: +Execute() +{ + vtkPolyData* aPolyData = GetOutput(); + aPolyData->Allocate(); + vtkPoints* aPts = vtkPoints::New(); + aPolyData->SetPoints(aPts); + aPts->Delete(); + + TEdgeSet::Iterator anIter (myEdgeSet); + for (; anIter.More(); anIter.Next()) { + TopoDS_Edge anEdge = anIter.Value(); + if ( !myIsVector ) + // draw curve direction (issue 0021087) + anEdge.Orientation( TopAbs_FORWARD ); + OCC2VTK(anEdge,aPolyData,aPts,myIsVector||myIsVectorMode); + } +} + +void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, + vtkPolyData* thePolyData, + vtkPoints* thePts, + bool theIsVector) +{ + Handle(Poly_PolygonOnTriangulation) aEdgePoly; + Standard_Integer i = 1; + Handle(Poly_Triangulation) T; + TopLoc_Location aEdgeLoc; + BRep_Tool::PolygonOnTriangulation(theEdge, aEdgePoly, T, aEdgeLoc, i); + + Handle(Poly_Polygon3D) P; + if(aEdgePoly.IsNull()) + P = BRep_Tool::Polygon3D(theEdge, aEdgeLoc); + + if(P.IsNull() && aEdgePoly.IsNull()) + return; + + // Location edges + //--------------- + gp_Trsf edgeTransf; + Standard_Boolean isidtrsf = true; + if(!aEdgeLoc.IsIdentity()) { + isidtrsf = false; + edgeTransf = aEdgeLoc.Transformation(); + } + + gp_Pnt aP1, aP2; + + if (aEdgePoly.IsNull()) { + Standard_Integer aNbNodes = P->NbNodes(); + const TColgp_Array1OfPnt& aNodesP = P->Nodes(); + + aP1 = aNodesP(1); + aP2 = aNodesP(aNbNodes); + + for (int j = 1; j < aNbNodes; j++) { + gp_Pnt pt1 = aNodesP(j); + gp_Pnt pt2 = aNodesP(j+1); + + if (!isidtrsf) { + // apply edge transformation + pt1.Transform(edgeTransf); + pt2.Transform(edgeTransf); + } + + float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()}; + vtkIdType anIds[2]; + anIds[0] = thePts->InsertNextPoint(aCoord1); + + float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()}; + anIds[1] = thePts->InsertNextPoint(aCoord2); + + thePolyData->InsertNextCell(VTK_LINE,2,anIds); + } + } else { + Standard_Integer aNbNodes = aEdgePoly->NbNodes(); + const TColStd_Array1OfInteger& aNodeIds = aEdgePoly->Nodes(); + const TColgp_Array1OfPnt& anId2Pnts = T->Nodes(); + + aP1 = anId2Pnts(aNodeIds(1)); + aP2 = anId2Pnts(aNodeIds(aNbNodes)); + + for(int j = 1; j < aNbNodes; j++) { + Standard_Integer id1 = aNodeIds(j); + Standard_Integer id2 = aNodeIds(j+1); + + gp_Pnt pt1 = anId2Pnts(id1); + gp_Pnt pt2 = anId2Pnts(id2); + + if(!isidtrsf) { + // apply edge transformation + pt1.Transform(edgeTransf); + pt2.Transform(edgeTransf); + } + + float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()}; + vtkIdType anIds[2]; + anIds[0] = thePts->InsertNextPoint(aCoord1); + + float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()}; + anIds[1] = thePts->InsertNextPoint(aCoord2); + + thePolyData->InsertNextCell(VTK_LINE,2,anIds); + } + } + + + // vector representation has an arrow on its end + if (theIsVector) + { + if (!isidtrsf) { + // apply edge transformation + aP1.Transform(edgeTransf); + aP2.Transform(edgeTransf); + } + + // draw an arrow + + double fp,lp; + gp_Vec aDirVec; + Handle(Geom_Curve) C = BRep_Tool::Curve(theEdge,fp,lp); + if ( theEdge.Orientation() == TopAbs_FORWARD ) { + C->D1(lp, aP2, aDirVec); + } else { + C->D1(fp, aP1, aDirVec); + aP2 = aP1; + } + + GeomAdaptor_Curve aAdC; + aAdC.Load(C, fp, lp); + Standard_Real aDist = GCPnts_AbscissaPoint::Length(aAdC, fp, lp); + if (aDist < gp::Resolution()) return; + + gp_Dir aDirection; + + if ( theEdge.Orientation() == TopAbs_FORWARD ) + aDirection = aDirVec; + else + aDirection = -aDirVec; + + Standard_Real anAngle = M_PI/180.*5.; + Standard_Real aLength = aDist/10.; + + Standard_Real dx,dy,dz; + aDirection.Coord(dx,dy,dz); + + // Arrow Point + Standard_Real xo,yo,zo; + aP2.Coord(xo,yo,zo); + + // Center of circle that arrow based + gp_XYZ aPc = aP2.XYZ() - aDirection.XYZ() * aLength; + + // Construction of the base vectors for the arrow circle + gp_Dir aDirN; + if (Abs(dx) <= Abs(dy) && Abs(dx) <= Abs(dz)) aDirN = gp::DX(); + else if (Abs(dy) <= Abs(dz) && Abs(dy) <= Abs(dx)) aDirN = gp::DY(); + else aDirN = gp::DZ(); + + gp_Dir aDirI = aDirection ^ aDirN; + gp_Dir aDirJ = aDirection ^ aDirI; + + // Add points and segments, composing the arrow + Standard_Real cosinus, sinus, Tg = tan(anAngle); + + float coord[3] = {xo, yo, zo}; + + vtkIdType ptLoc = thePts->InsertNextPoint(coord); + vtkIdType ptFirst = 0; + vtkIdType ptPrev = 0; + vtkIdType ptCur = 0; + + vtkIdType pts[2]; + + int NbPoints = 15; + for (int i = 1; i <= NbPoints; i++, ptPrev = ptCur) + { + cosinus = cos(2. * M_PI / NbPoints * (i-1)); + sinus = sin(2. * M_PI / NbPoints * (i-1)); + + gp_XYZ aP = aPc + (aDirI.XYZ() * cosinus + aDirJ.XYZ() * sinus) * aLength * Tg; + coord[0] = aP.X(); + coord[1] = aP.Y(); + coord[2] = aP.Z(); + + // insert pts + ptCur = thePts->InsertNextPoint(coord); + pts[0] = ptCur; + + if (i == 1) { + ptFirst = ptCur; + } + else { + // insert line (ptCur,ptPrev) + pts[1] = ptPrev; + thePolyData->InsertNextCell(VTK_LINE,2,pts); + } + + // insert line (ptCur,ptLoc) + pts[1] = ptLoc; + thePolyData->InsertNextCell(VTK_LINE,2,pts); + } + + // insert line (ptCur,ptFirst) + pts[0] = ptCur; + pts[1] = ptFirst; + thePolyData->InsertNextCell(VTK_LINE,2,pts); + } +} + +void GEOM_EdgeSource::SetVectorMode (bool theMode) +{ + myIsVectorMode = theMode; +} + +bool GEOM_EdgeSource::GetVectorMode () +{ + return !myIsVector && myIsVectorMode; +} diff --git a/src/OCC2VTK/GEOM_EdgeSource.h b/src/OCC2VTK/GEOM_EdgeSource.h new file mode 100755 index 000000000..282c4c906 --- /dev/null +++ b/src/OCC2VTK/GEOM_EdgeSource.h @@ -0,0 +1,74 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef GEOM_EDGESOURCE_H +#define GEOM_EDGESOURCE_H + +#include "OCC2VTK.h" + +#include +#include + +typedef NCollection_Set TEdgeSet; + +#include +#include + +class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataSource +{ +public: + vtkTypeMacro(GEOM_EdgeSource,vtkPolyDataSource); + static GEOM_EdgeSource* New(); + + void AddEdge (const TopoDS_Edge& theEdge, + bool theIsVector = false); + void Clear(){ myEdgeSet.Clear();} + + void SetVectorMode(bool); + + bool GetVectorMode(); + + static + void OCC2VTK(const TopoDS_Edge& theEdge, + vtkPolyData* thePolyData, + vtkPoints* thePts, + bool theIsVector = false); + + bool IsEmpty(){return myEdgeSet.IsEmpty();} + + +protected: + TEdgeSet myEdgeSet; + // The flag is common for all edges, because the shape, + // representing a vector, can have only one edge. + bool myIsVector, myIsVectorMode; + + void Execute(); + + GEOM_EdgeSource(); + ~GEOM_EdgeSource(); + +private: + // Not implememnted + GEOM_EdgeSource(const GEOM_EdgeSource&); + void operator=(const GEOM_EdgeSource&); +}; + + +#endif //GEOM_EDGESOURCE_H diff --git a/src/OCC2VTK/GEOM_FaceSource.cxx b/src/OCC2VTK/GEOM_FaceSource.cxx new file mode 100755 index 000000000..868232a63 --- /dev/null +++ b/src/OCC2VTK/GEOM_FaceSource.cxx @@ -0,0 +1,63 @@ +// Copyright (C) 2007-2012 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 "GEOM_FaceSource.h" + +#include + +#include +#include + +#include +#include + +GEOM_FaceSource::GEOM_FaceSource() +{ +} + +GEOM_FaceSource::~GEOM_FaceSource() +{ +} + +void +GEOM_FaceSource:: +AddFace(const TopoDS_Face& theFace) +{ + myFaceSet.Add(theFace); +} + +void +GEOM_FaceSource:: +MoveTo(gp_Pnt thePnt, + vtkPoints* thePts) +{ + thePts->InsertNextPoint(thePnt.X(), thePnt.Y(), thePnt.Z()); +} + +void +GEOM_FaceSource:: +DrawTo(gp_Pnt thePnt, + vtkPolyData* thePolyData, + vtkPoints* thePts) +{ + vtkIdType anId = + thePts->InsertNextPoint(thePnt.X(), thePnt.Y(), thePnt.Z()); + vtkIdType anIds[2] = {anId-1, anId}; + thePolyData->InsertNextCell(VTK_LINE,2,anIds); +} diff --git a/src/OCC2VTK/GEOM_FaceSource.h b/src/OCC2VTK/GEOM_FaceSource.h new file mode 100755 index 000000000..557c0605d --- /dev/null +++ b/src/OCC2VTK/GEOM_FaceSource.h @@ -0,0 +1,64 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef GEOM_FACESOURCE_H +#define GEOM_FACESOURCE_H + +#include "OCC2VTK.h" + +#include +#include +#include + +typedef NCollection_Set TFaceSet; + +#include +#include + +class OCC2VTK_EXPORT GEOM_FaceSource: public vtkPolyDataSource +{ +public: + vtkTypeMacro(GEOM_FaceSource,vtkPolyDataSource); + + void AddFace(const TopoDS_Face& theFace); + void Clear(){ myFaceSet.Clear();} + bool IsEmpty(){return myFaceSet.IsEmpty();} + +protected: + TFaceSet myFaceSet; + + static + void MoveTo(gp_Pnt thePnt, + vtkPoints* thePts); + static + void DrawTo(gp_Pnt thePnt, + vtkPolyData* thePolyData, + vtkPoints* thePts); + + GEOM_FaceSource(); + ~GEOM_FaceSource(); + +private: + // Not implememnted + GEOM_FaceSource(const GEOM_FaceSource&); + void operator=(const GEOM_FaceSource&); +}; + + +#endif //GEOM_FACESOURCE_H diff --git a/src/OCC2VTK/GEOM_ShadingFace.cxx b/src/OCC2VTK/GEOM_ShadingFace.cxx new file mode 100755 index 000000000..ad2ae5b18 --- /dev/null +++ b/src/OCC2VTK/GEOM_ShadingFace.cxx @@ -0,0 +1,103 @@ +// Copyright (C) 2007-2012 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 "GEOM_ShadingFace.h" + +#include + +#include +#include + +#include +#include + +#include +#include + + +vtkStandardNewMacro(GEOM_ShadingFace); + +GEOM_ShadingFace::GEOM_ShadingFace() +{ +} + +GEOM_ShadingFace::~GEOM_ShadingFace() +{ +} + +void +GEOM_ShadingFace:: +Execute() +{ + vtkPolyData* aPolyData = GetOutput(); + aPolyData->Allocate(); + vtkPoints* aPts = vtkPoints::New(); + aPolyData->SetPoints(aPts); + aPts->Delete(); + + TFaceSet::Iterator anIter(myFaceSet); + for(; anIter.More(); anIter.Next()){ + const TopoDS_Face& aFace = anIter.Value(); + OCC2VTK(aFace,aPolyData,aPts); + } +} + +void +GEOM_ShadingFace:: +OCC2VTK(const TopoDS_Face& theFace, + vtkPolyData* thePolyData, + vtkPoints* thePts) +{ + TopLoc_Location aLoc; + Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(theFace,aLoc); + if(aPoly.IsNull()) + return; + else{ + gp_Trsf myTransf; + Standard_Boolean identity = true; + if(!aLoc.IsIdentity()){ + identity = false; + myTransf = aLoc.Transformation(); + } + + Standard_Integer i; + int aNbOfNodes = thePts->GetNumberOfPoints(); + const TColgp_Array1OfPnt& Nodes = aPoly->Nodes(); + Standard_Integer nbNodesInFace = aPoly->NbNodes(); + for(i = 1; i <= nbNodesInFace; i++) { + gp_Pnt P = Nodes(i); + if(!identity) + P.Transform(myTransf); + thePts->InsertNextPoint(P.X(),P.Y(),P.Z()); + } + + const Poly_Array1OfTriangle& Triangles = aPoly->Triangles(); + Standard_Integer nbTriInFace = aPoly->NbTriangles(); + for(i = 1; i <= nbTriInFace; i++){ + // Get the triangle + Standard_Integer N1,N2,N3; + Triangles(i).Get(N1,N2,N3); + N1 += aNbOfNodes - 1; + N2 += aNbOfNodes - 1; + N3 += aNbOfNodes - 1; + vtkIdType anIds[3] = {N1, N2, N3}; + thePolyData->InsertNextCell(VTK_TRIANGLE,3,anIds); + } + } +} diff --git a/src/OCC2VTK/GEOM_ShadingFace.h b/src/OCC2VTK/GEOM_ShadingFace.h new file mode 100755 index 000000000..64ae2d0ba --- /dev/null +++ b/src/OCC2VTK/GEOM_ShadingFace.h @@ -0,0 +1,50 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef GEOM_SHADINGFACE_H +#define GEOM_SHADINGFACE_H + +#include "OCC2VTK.h" +#include "GEOM_FaceSource.h" + +class OCC2VTK_EXPORT GEOM_ShadingFace: public GEOM_FaceSource +{ +public: + vtkTypeMacro(GEOM_ShadingFace,GEOM_FaceSource); + static GEOM_ShadingFace* New(); + + static + void OCC2VTK(const TopoDS_Face& theFace, + vtkPolyData* theCells, + vtkPoints* thePts); + +protected: + void Execute(); + + GEOM_ShadingFace(); + ~GEOM_ShadingFace(); + +private: + // Not implememnted + GEOM_ShadingFace(const GEOM_ShadingFace&); + void operator=(const GEOM_ShadingFace&); +}; + + +#endif //GEOM_SHADINGFACE_H diff --git a/src/OCC2VTK/GEOM_VertexSource.cxx b/src/OCC2VTK/GEOM_VertexSource.cxx new file mode 100755 index 000000000..daf61b192 --- /dev/null +++ b/src/OCC2VTK/GEOM_VertexSource.cxx @@ -0,0 +1,75 @@ +// Copyright (C) 2007-2012 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 "GEOM_VertexSource.h" + +#include + +#include +#include +#include +#include + +#include +#include + +vtkStandardNewMacro(GEOM_VertexSource); + +GEOM_VertexSource::GEOM_VertexSource() +{ +} + +GEOM_VertexSource::~GEOM_VertexSource() +{ +} + +void +GEOM_VertexSource:: +AddVertex(const TopoDS_Vertex& theVertex) +{ + myVertexSet.Add(theVertex); +} + +void +GEOM_VertexSource:: +Execute() +{ + vtkPolyData* aPolyData = GetOutput(); + aPolyData->Allocate(); + vtkPoints* aPts = vtkPoints::New(); + aPolyData->SetPoints(aPts); + aPts->Delete(); + + TVertexSet::Iterator anIter(myVertexSet); + for(; anIter.More(); anIter.Next()){ + const TopoDS_Vertex& aVertex = anIter.Value(); + OCC2VTK(aVertex,aPolyData,aPts); + } +} + +void +GEOM_VertexSource:: +OCC2VTK(const TopoDS_Vertex& theVertex, + vtkPolyData* thePolyData, + vtkPoints* thePts) +{ + gp_Pnt aPnt = BRep_Tool::Pnt(theVertex); + vtkIdType anId = thePts->InsertNextPoint(aPnt.X(),aPnt.Y(),aPnt.Z()); + thePolyData->InsertNextCell(VTK_VERTEX,1,&anId); +} diff --git a/src/OCC2VTK/GEOM_VertexSource.h b/src/OCC2VTK/GEOM_VertexSource.h new file mode 100755 index 000000000..9241b2d3a --- /dev/null +++ b/src/OCC2VTK/GEOM_VertexSource.h @@ -0,0 +1,62 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef GEOM_VERTEXSOURCE_H +#define GEOM_VERTEXSOURCE_H + +#include "OCC2VTK.h" + +#include +#include + +typedef NCollection_Set TVertexSet; + +#include +#include + +class OCC2VTK_EXPORT GEOM_VertexSource: public vtkPolyDataSource +{ +public: + vtkTypeMacro(GEOM_VertexSource,vtkPolyDataSource); + static GEOM_VertexSource* New(); + + void AddVertex(const TopoDS_Vertex& theVertex); + void Clear(){ myVertexSet.Clear();} + + static + void OCC2VTK(const TopoDS_Vertex& theVertex, + vtkPolyData* thePolyData, + vtkPoints* thePts); + +protected: + TVertexSet myVertexSet; + + void Execute(); + + GEOM_VertexSource(); + ~GEOM_VertexSource(); + +private: + // Not implememnted + GEOM_VertexSource(const GEOM_VertexSource&); + void operator=(const GEOM_VertexSource&); +}; + + +#endif //GEOM_VERTEXSOURCE_H diff --git a/src/OCC2VTK/GEOM_WireframeFace.cxx b/src/OCC2VTK/GEOM_WireframeFace.cxx new file mode 100755 index 000000000..49e2911ae --- /dev/null +++ b/src/OCC2VTK/GEOM_WireframeFace.cxx @@ -0,0 +1,509 @@ +// Copyright (C) 2007-2012 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 "GEOM_WireframeFace.h" + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +vtkStandardNewMacro(GEOM_WireframeFace); + +GEOM_WireframeFace::GEOM_WireframeFace(): + Discret(15) +{ + NbIso[0] = 1; + NbIso[1] = 1; +} + +GEOM_WireframeFace::~GEOM_WireframeFace() +{ +} + +void +GEOM_WireframeFace:: +Execute() +{ + vtkPolyData* aPolyData = GetOutput(); + aPolyData->Allocate(); + vtkPoints* aPts = vtkPoints::New(); + aPolyData->SetPoints(aPts); + aPts->Delete(); + + TFaceSet::Iterator anIter(myFaceSet); + for(; anIter.More(); anIter.Next()){ + const TopoDS_Face& aFace = anIter.Value(); + OCC2VTK(aFace,aPolyData,aPts,NbIso,Discret); + } +} + +void GEOM_WireframeFace::SetNbIso(const int theNb[2]) +{ + if ( theNb[0] == NbIso[0] && theNb[1] == NbIso[1]) + return; + + NbIso[0] = theNb[0]; + NbIso[1] = theNb[1]; + + Modified(); +} + +void GEOM_WireframeFace::GetNbIso(int &theNbU,int &theNbV) +{ + theNbU = NbIso[0]; + theNbV = NbIso[1]; +} + +void +GEOM_WireframeFace:: +OCC2VTK(const TopoDS_Face& theFace, + vtkPolyData* thePolyData, + vtkPoints* thePts, + const int theNbIso[2], + const int theDiscret) +{ + TopoDS_Face aFace = theFace; + aFace.Orientation(TopAbs_FORWARD); + CreateIso(aFace,theNbIso,theDiscret,thePolyData,thePts); +} + +void +GEOM_WireframeFace:: +CreateIso(const TopoDS_Face& theFace, + const int theNbIso[2], + const int theDiscret, + vtkPolyData* thePolyData, + vtkPoints* thePts) +{ + // Constants for iso building + static Standard_Real INTERSECTOR_CONFUSION = 1.e-10 ; // -8 ; + static Standard_Real INTERSECTOR_TANGENCY = 1.e-10 ; // -8 ; + + static Standard_Real HATHCER_CONFUSION_2D = 1.e-8 ; + static Standard_Real HATHCER_CONFUSION_3D = 1.e-8 ; + + Geom2dHatch_Hatcher + aHatcher(Geom2dHatch_Intersector(INTERSECTOR_CONFUSION, + INTERSECTOR_TANGENCY), + HATHCER_CONFUSION_2D, + HATHCER_CONFUSION_3D, + Standard_True, + Standard_False); + + Standard_Real anUMin, anUMax, aVMin, aVMax; + TColStd_Array1OfReal anUPrm(0, theNbIso[0]), aVPrm(0, theNbIso[1]); + TColStd_Array1OfInteger anUInd(0, theNbIso[0]), aVInd(0, theNbIso[1]); + + anUInd.Init(0); + aVInd.Init(0); + + //----------------------------------------------------------------------- + // If the Min Max bounds are infinite, there are bounded to Infinite + // value. + //----------------------------------------------------------------------- + BRepTools::UVBounds(theFace, anUMin, anUMax, aVMin, aVMax) ; + Standard_Boolean InfiniteUMin = Precision::IsNegativeInfinite (anUMin) ; + Standard_Boolean InfiniteUMax = Precision::IsPositiveInfinite (anUMax) ; + Standard_Boolean InfiniteVMin = Precision::IsNegativeInfinite (aVMin) ; + Standard_Boolean InfiniteVMax = Precision::IsPositiveInfinite (aVMax) ; + + static float VTKINFINITE = 1.0E38; + if(InfiniteUMin && InfiniteUMax){ + anUMin = - VTKINFINITE ; + anUMax = VTKINFINITE ; + }else if(InfiniteUMin){ + anUMin = anUMax - VTKINFINITE ; + }else if(InfiniteUMax){ + anUMax = anUMin + VTKINFINITE ; + } + + if(InfiniteVMin && InfiniteVMax){ + aVMin = - VTKINFINITE ; + aVMax = VTKINFINITE ; + }else if(InfiniteVMin){ + aVMin = aVMax - VTKINFINITE ; + }else if(InfiniteVMax){ + aVMax = aVMin + VTKINFINITE ; + } + + //----------------------------------------------------------------------- + // Retreiving the edges and loading them into the hatcher. + //----------------------------------------------------------------------- + TopExp_Explorer ExpEdges(theFace, TopAbs_EDGE); + for(; ExpEdges.More(); ExpEdges.Next()){ + const TopoDS_Edge& anEdge = TopoDS::Edge(ExpEdges.Current()); + Standard_Real U1, U2 ; + const Handle(Geom2d_Curve) PCurve = + BRep_Tool::CurveOnSurface(anEdge, theFace, U1, U2) ; + + if(PCurve.IsNull() || U1 == U2) + return; + + //-- Test if a TrimmedCurve is necessary + if(Abs(PCurve->FirstParameter()-U1) <= Precision::PConfusion() && + Abs(PCurve->LastParameter()-U2) <= Precision::PConfusion()) + { + aHatcher.AddElement(PCurve, anEdge.Orientation()) ; + }else{ + if(!PCurve->IsPeriodic()){ + Handle(Geom2d_TrimmedCurve) TrimPCurve = + Handle(Geom2d_TrimmedCurve)::DownCast(PCurve); + if(!TrimPCurve.IsNull()){ + Handle_Geom2d_Curve aBasisCurve = TrimPCurve->BasisCurve(); + if(aBasisCurve->FirstParameter()-U1 > Precision::PConfusion() || + U2-aBasisCurve->LastParameter() > Precision::PConfusion()) + { + aHatcher.AddElement(PCurve, anEdge.Orientation()) ; + return; + } + }else{ + if(PCurve->FirstParameter()-U1 > Precision::PConfusion()){ + U1=PCurve->FirstParameter(); + } + if(U2-PCurve->LastParameter() > Precision::PConfusion()){ + U2=PCurve->LastParameter(); + } + } + } + Handle(Geom2d_TrimmedCurve) TrimPCurve = + new Geom2d_TrimmedCurve(PCurve, U1, U2); + aHatcher.AddElement(TrimPCurve, anEdge.Orientation()); + } + } + + + //----------------------------------------------------------------------- + // Loading and trimming the hatchings. + //----------------------------------------------------------------------- + Standard_Integer IIso; + Standard_Real DeltaU = Abs(anUMax - anUMin) ; + Standard_Real DeltaV = Abs(aVMax - aVMin) ; + Standard_Real confusion = Min(DeltaU, DeltaV) * HATHCER_CONFUSION_3D ; + aHatcher.Confusion3d (confusion) ; + + if ( theNbIso[0] ) { + Standard_Real StepU = DeltaU / (Standard_Real)theNbIso[0]; + if(StepU > confusion){ + Standard_Real UPrm = anUMin + StepU / 2.; + gp_Dir2d Dir(0., 1.) ; + for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++) { + anUPrm(IIso) = UPrm ; + gp_Pnt2d Ori (UPrm, 0.) ; + Geom2dAdaptor_Curve HCur (new Geom2d_Line (Ori, Dir)) ; + anUInd(IIso) = aHatcher.AddHatching (HCur) ; + UPrm += StepU ; + } + } + } + + if ( theNbIso[1] ) { + Standard_Real StepV = DeltaV / (Standard_Real) theNbIso[1] ; + if(StepV > confusion){ + Standard_Real VPrm = aVMin + StepV / 2.; + gp_Dir2d Dir(1., 0.); + for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){ + aVPrm(IIso) = VPrm; + gp_Pnt2d Ori (0., VPrm); + Geom2dAdaptor_Curve HCur(new Geom2d_Line (Ori, Dir)); + aVInd(IIso) = aHatcher.AddHatching (HCur) ; + VPrm += StepV ; + } + } + } + + //----------------------------------------------------------------------- + // Computation. + //----------------------------------------------------------------------- + aHatcher.Trim() ; + + Standard_Integer aNbDom = 0 ; // for debug purpose + Standard_Integer Index ; + + for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++){ + Index = anUInd(IIso) ; + if(Index != 0){ + if(aHatcher.TrimDone(Index) && !aHatcher.TrimFailed(Index)){ + aHatcher.ComputeDomains(Index); + if(aHatcher.IsDone (Index)) + aNbDom = aHatcher.NbDomains (Index); + } + } + } + + for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){ + Index = aVInd(IIso); + if(Index != 0){ + if(aHatcher.TrimDone (Index) && !aHatcher.TrimFailed(Index)){ + aHatcher.ComputeDomains (Index); + if(aHatcher.IsDone (Index)) + aNbDom = aHatcher.NbDomains (Index); + } + } + } + + //----------------------------------------------------------------------- + // Push iso lines in vtk kernel + //----------------------------------------------------------------------- + for(Standard_Integer UIso = anUPrm.Lower() ; UIso <= anUPrm.Upper(); UIso++){ + Standard_Integer UInd = anUInd.Value(UIso); + if(UInd != 0){ + Standard_Real UPrm = anUPrm.Value(UIso); + if(aHatcher.IsDone(UInd)){ + Standard_Integer NbDom = aHatcher.NbDomains(UInd); + for(Standard_Integer IDom = 1 ; IDom <= NbDom ; IDom++){ + const HatchGen_Domain& Dom = aHatcher.Domain(UInd, IDom) ; + Standard_Real V1 = Dom.HasFirstPoint()? Dom.FirstPoint().Parameter(): aVMin - VTKINFINITE; + Standard_Real V2 = Dom.HasSecondPoint()? Dom.SecondPoint().Parameter(): aVMax + VTKINFINITE; + CreateIso_(theFace, GeomAbs_IsoU, UPrm, V1, V2, theDiscret, thePolyData, thePts); + } + } + } + } + + for(Standard_Integer VIso = aVPrm.Lower() ; VIso <= aVPrm.Upper(); VIso++){ + Standard_Integer VInd = aVInd.Value(VIso); + if(VInd != 0){ + Standard_Real VPrm = aVPrm.Value(VIso); + if(aHatcher.IsDone (VInd)){ + Standard_Integer NbDom = aHatcher.NbDomains(VInd); + for (Standard_Integer IDom = 1 ; IDom <= NbDom ; IDom++){ + const HatchGen_Domain& Dom = aHatcher.Domain(VInd, IDom); + Standard_Real U1 = Dom.HasFirstPoint()? Dom.FirstPoint().Parameter(): aVMin - VTKINFINITE; + Standard_Real U2 = Dom.HasSecondPoint()? Dom.SecondPoint().Parameter(): aVMax + VTKINFINITE; + CreateIso_(theFace, GeomAbs_IsoV, VPrm, U1, U2, theDiscret, thePolyData, thePts); + } + } + } + } +} + + + +void +GEOM_WireframeFace:: +CreateIso_(const TopoDS_Face& theFace, + GeomAbs_IsoType theIsoType, + Standard_Real Par, + Standard_Real T1, + Standard_Real T2, + const int theDiscret, + vtkPolyData* thePolyData, + vtkPoints* thePts) +{ + Standard_Real U1, U2, V1, V2, stepU=0., stepV=0.; + Standard_Integer j; + gp_Pnt P; + + TopLoc_Location aLoc; + const Handle(Geom_Surface)& S = BRep_Tool::Surface(theFace,aLoc); + + if(!S.IsNull()){ + BRepAdaptor_Surface S(theFace,Standard_False); + + GeomAbs_SurfaceType SurfType = S.GetType(); + + GeomAbs_CurveType CurvType = GeomAbs_OtherCurve; + + Standard_Integer Intrv, nbIntv; + Standard_Integer nbUIntv = S.NbUIntervals(GeomAbs_CN); + Standard_Integer nbVIntv = S.NbVIntervals(GeomAbs_CN); + TColStd_Array1OfReal TI(1,Max(nbUIntv, nbVIntv)+1); + + if(theIsoType == GeomAbs_IsoU){ + S.VIntervals(TI, GeomAbs_CN); + V1 = Max(T1, TI(1)); + V2 = Min(T2, TI(2)); + U1 = Par; + U2 = Par; + stepU = 0; + nbIntv = nbVIntv; + }else{ + S.UIntervals(TI, GeomAbs_CN); + U1 = Max(T1, TI(1)); + U2 = Min(T2, TI(2)); + V1 = Par; + V2 = Par; + stepV = 0; + nbIntv = nbUIntv; + } + + S.D0(U1,V1,P); + MoveTo(P,thePts); + + for(Intrv = 1; Intrv <= nbIntv; Intrv++){ + if(TI(Intrv) <= T1 && TI(Intrv + 1) <= T1) + continue; + if(TI(Intrv) >= T2 && TI(Intrv + 1) >= T2) + continue; + if(theIsoType == GeomAbs_IsoU){ + V1 = Max(T1, TI(Intrv)); + V2 = Min(T2, TI(Intrv + 1)); + stepV = (V2 - V1) / theDiscret; + }else{ + U1 = Max(T1, TI(Intrv)); + U2 = Min(T2, TI(Intrv + 1)); + stepU = (U2 - U1) / theDiscret; + } + + switch (SurfType) { + case GeomAbs_Plane : + break; + case GeomAbs_Cylinder : + case GeomAbs_Cone : + if(theIsoType == GeomAbs_IsoV){ + for(j = 1; j < theDiscret; j++){ + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,thePolyData,thePts); + } + } + break; + case GeomAbs_Sphere : + case GeomAbs_Torus : + case GeomAbs_OffsetSurface : + case GeomAbs_OtherSurface : + for(j = 1; j < theDiscret; j++){ + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,thePolyData,thePts); + } + break; + case GeomAbs_BezierSurface : + case GeomAbs_BSplineSurface : + for(j = 1; j <= theDiscret/2; j++){ + Standard_Real aStep = (theIsoType == GeomAbs_IsoV) ? stepU*2. : stepV*2.; + CreateIso__(S, theIsoType, U1, V1, aStep, thePolyData, thePts); + U1 += stepU*2.; + V1 += stepV*2.; + } + break; + case GeomAbs_SurfaceOfExtrusion : + case GeomAbs_SurfaceOfRevolution : + if((theIsoType == GeomAbs_IsoV && SurfType == GeomAbs_SurfaceOfRevolution) || + (theIsoType == GeomAbs_IsoU && SurfType == GeomAbs_SurfaceOfExtrusion)) + { + if(SurfType == GeomAbs_SurfaceOfExtrusion) + break; + for(j = 1; j < theDiscret; j++){ + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,thePolyData,thePts); + } + }else{ + CurvType = (S.BasisCurve())->GetType(); + switch(CurvType){ + case GeomAbs_Line : + break; + case GeomAbs_Circle : + case GeomAbs_Ellipse : + for (j = 1; j < theDiscret; j++) { + U1 += stepU; + V1 += stepV; + S.D0(U1,V1,P); + DrawTo(P,thePolyData,thePts); + } + break; + case GeomAbs_Parabola : + case GeomAbs_Hyperbola : + case GeomAbs_BezierCurve : + case GeomAbs_BSplineCurve : + case GeomAbs_OtherCurve : + for(j = 1; j <= theDiscret/2; j++){ + Standard_Real aStep = (theIsoType == GeomAbs_IsoV) ? stepU*2. : stepV*2.; + CreateIso__(S, theIsoType, U1, V1, aStep, thePolyData, thePts); + U1 += stepU*2.; + V1 += stepV*2.; + } + break; + } + } + } + } + S.D0(U2,V2,P); + DrawTo(P,thePolyData,thePts); + } +} + + + + +void +GEOM_WireframeFace:: +CreateIso__(const BRepAdaptor_Surface& theSurface, + GeomAbs_IsoType theIsoType, + Standard_Real& theU, + Standard_Real& theV, + Standard_Real theStep, + vtkPolyData* thePolyData, + vtkPoints* thePts) +{ + gp_Pnt Pl, Pr, Pm; + if (theIsoType == GeomAbs_IsoU) { + theSurface.D0(theU, theV, Pl); + theSurface.D0(theU, theV + theStep/2., Pm); + theSurface.D0(theU, theV + theStep, Pr); + } else { + theSurface.D0(theU, theV, Pl); + theSurface.D0(theU + theStep/2., theV, Pm); + theSurface.D0(theU + theStep, theV, Pr); + } + + static Standard_Real ISO_RATIO = 1.001; + if (Pm.Distance(Pl) + Pm.Distance(Pr) <= ISO_RATIO*Pl.Distance(Pr)) { + DrawTo(Pr,thePolyData,thePts); + } else { + if (theIsoType == GeomAbs_IsoU) { + CreateIso__(theSurface, theIsoType, theU, theV, theStep/2, thePolyData, thePts); + Standard_Real aLocalV = theV + theStep/2 ; + CreateIso__(theSurface, theIsoType, theU, aLocalV , theStep/2, thePolyData, thePts); + } else { + CreateIso__(theSurface, theIsoType, theU, theV, theStep/2, thePolyData, thePts); + Standard_Real aLocalU = theU + theStep/2 ; + CreateIso__(theSurface, theIsoType, aLocalU , theV, theStep/2, thePolyData, thePts); + } + } +} diff --git a/src/OCC2VTK/GEOM_WireframeFace.h b/src/OCC2VTK/GEOM_WireframeFace.h new file mode 100755 index 000000000..bd931a8ed --- /dev/null +++ b/src/OCC2VTK/GEOM_WireframeFace.h @@ -0,0 +1,100 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef GEOM_WIREFRAME_FACE_H +#define GEOM_WIREFRAME_FACE_H + +#include "OCC2VTK.h" +#include "GEOM_FaceSource.h" + +#include +#include + +#include + +class OCC2VTK_EXPORT GEOM_WireframeFace: public GEOM_FaceSource +{ +public: + vtkTypeMacro(GEOM_WireframeFace,GEOM_FaceSource); + static GEOM_WireframeFace* New(); + + /* vtkSetMacro(NbIso,int); + vtkGetMacro(NbIso,int);*/ + + vtkSetMacro(Discret,int); + vtkGetMacro(Discret,int); + + static + void OCC2VTK(const TopoDS_Face& theFace, + vtkPolyData* thePolyData, + vtkPoints* thePts, + const int theNbIso[2], + const int theDiscret = 15); + + //! IsoLines management + // theNb[0] - number of U lines + // theNb[1] - number of V lines + virtual void SetNbIso(const int theNb[2]); + virtual void GetNbIso(int &theNbU,int &theNbV); + +protected: + int NbIso[2], Discret; + + static + void + CreateIso(const TopoDS_Face& theFace, + const int theNbIso[2], + const int theDiscret, + vtkPolyData* thePolyData, + vtkPoints* thePts); + + static + void + CreateIso_(const TopoDS_Face& theFace, + GeomAbs_IsoType theIsoType, + Standard_Real Par, + Standard_Real T1, + Standard_Real T2, + const int theDiscret, + vtkPolyData* thePolyData, + vtkPoints* thePts); + + static + void + CreateIso__(const BRepAdaptor_Surface& theSurface, + GeomAbs_IsoType theIsoType, + Standard_Real& theU, + Standard_Real& theV, + Standard_Real theStep, + vtkPolyData* thePolyData, + vtkPoints* thePts); + + void Execute(); + + GEOM_WireframeFace(); + ~GEOM_WireframeFace(); + +private: + // Not implememnted + GEOM_WireframeFace(const GEOM_WireframeFace&); + void operator=(const GEOM_WireframeFace&); +}; + + +#endif //GEOM_WFACEACTOR_H diff --git a/src/OCC2VTK/Makefile.am b/src/OCC2VTK/Makefile.am new file mode 100644 index 000000000..753961700 --- /dev/null +++ b/src/OCC2VTK/Makefile.am @@ -0,0 +1,51 @@ +# Copyright (C) 2007-2012 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 + +# header files +salomeinclude_HEADERS = \ + OCC2VTK.h \ + OCC2VTK_Tools.h \ + GEOM_EdgeSource.h \ + GEOM_FaceSource.h \ + GEOM_ShadingFace.h \ + GEOM_VertexSource.h \ + GEOM_WireframeFace.h + +# Libraries targets +lib_LTLIBRARIES = libOCC2VTK.la + +dist_libOCC2VTK_la_SOURCES = \ + OCC2VTK_Tools.cxx \ + GEOM_EdgeSource.cxx \ + GEOM_FaceSource.cxx \ + GEOM_ShadingFace.cxx \ + GEOM_VertexSource.cxx \ + GEOM_WireframeFace.cxx + +libOCC2VTK_la_CPPFLAGS = \ + $(CAS_CPPFLAGS) \ + $(VTK_INCLUDES) \ + $(KERNEL_CXXFLAGS) + +libOCC2VTK_la_LDFLAGS = \ + $(CAS_KERNEL) -lTKBRep -lTKG2d -lTKG3d -lTKV3d -lTKMesh -lTKGeomBase -lTKGeomAlgo -lTKTopAlgo -lTKService \ + $(VTK_LIBS) \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace diff --git a/src/OCC2VTK/OCC2VTK.h b/src/OCC2VTK/OCC2VTK.h new file mode 100755 index 000000000..2e36a8426 --- /dev/null +++ b/src/OCC2VTK/OCC2VTK.h @@ -0,0 +1,36 @@ +// Copyright (C) 2007-2012 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 OCC2VTK_H +#define OCC2VTK_H + +#if defined WIN32 +# if defined OCC2VTK_EXPORTS +# define OCC2VTK_EXPORT __declspec( dllexport ) +# else +# define OCC2VTK_EXPORT __declspec( dllimport ) +# endif +#else +# define OCC2VTK_EXPORT +#endif + +#endif // OCC2VTK_H diff --git a/src/OCC2VTK/OCC2VTK_Tools.cxx b/src/OCC2VTK/OCC2VTK_Tools.cxx new file mode 100755 index 000000000..5d86fcc0f --- /dev/null +++ b/src/OCC2VTK/OCC2VTK_Tools.cxx @@ -0,0 +1,156 @@ +// Copyright (C) 2007-2012 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 "OCC2VTK_Tools.h" + +#include "GEOM_VertexSource.h" +#include "GEOM_EdgeSource.h" +#include "GEOM_WireframeFace.h" +#include "GEOM_ShadingFace.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define MAX2(X, Y) (Abs(X) > Abs(Y) ? Abs(X) : Abs(Y)) +#define MAX3(X, Y, Z) (MAX2(MAX2(X,Y), Z)) + + +#define DEFAULT_DEFLECTION 0.001 + +namespace GEOM +{ + void MeshShape(const TopoDS_Shape theShape, + float& theDeflection, + bool theForced ) { + + Standard_Real aDeflection = theDeflection <= 0 ? DEFAULT_DEFLECTION : theDeflection; + + //If deflection <= 0, than return default deflection + if(theDeflection <= 0) + theDeflection = aDeflection; + + // Is shape triangulated? + Standard_Boolean alreadymeshed = Standard_True; + TopExp_Explorer ex; + TopLoc_Location aLoc; + for (ex.Init(theShape, TopAbs_FACE); ex.More(); ex.Next()) { + const TopoDS_Face& aFace = TopoDS::Face(ex.Current()); + Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc); + if(aPoly.IsNull()) { + alreadymeshed = Standard_False; + break; + } + } + + if(!alreadymeshed || theForced) { + Bnd_Box B; + BRepBndLib::Add(theShape, B); + if ( B.IsVoid() ) + return; // NPAL15983 (Bug when displaying empty groups) + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + + // This magic line comes from Prs3d_ShadedShape.gxx in OCCT + aDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * aDeflection * 4; + + //Clean triangulation before compute incremental mesh + BRepTools::Clean(theShape); + + //Compute triangulation + BRepMesh_IncrementalMesh MESH(theShape,aDeflection); + } + } + + void SetShape(const TopoDS_Shape& theShape, + const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap, + bool theIsVector, + GEOM_EdgeSource* theIsolatedEdgeSource, + GEOM_EdgeSource* theOneFaceEdgeSource, + GEOM_EdgeSource* theSharedEdgeSource, + GEOM_WireframeFace* theWireframeFaceSource, + GEOM_ShadingFace* theShadingFaceSource) + { + if (theShape.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator anItr(theShape); + for (; anItr.More(); anItr.Next()) { + SetShape(anItr.Value(),theEdgeMap,theIsVector, + theIsolatedEdgeSource, + theOneFaceEdgeSource, + theSharedEdgeSource, + theWireframeFaceSource, + theShadingFaceSource); + } + } + + switch (theShape.ShapeType()) { + case TopAbs_WIRE: { + TopExp_Explorer anEdgeExp(theShape,TopAbs_EDGE); + for (; anEdgeExp.More(); anEdgeExp.Next()){ + const TopoDS_Edge& anEdge = TopoDS::Edge(anEdgeExp.Current()); + if (!BRep_Tool::Degenerated(anEdge)) + theIsolatedEdgeSource->AddEdge(anEdge,theIsVector); + } + break; + } + case TopAbs_EDGE: { + const TopoDS_Edge& anEdge = TopoDS::Edge(theShape); + if (!BRep_Tool::Degenerated(anEdge)) + theIsolatedEdgeSource->AddEdge(anEdge,theIsVector); + break; + } + case TopAbs_VERTEX: { + break; + } + default: { + TopExp_Explorer aFaceExp (theShape,TopAbs_FACE); + for(; aFaceExp.More(); aFaceExp.Next()) { + const TopoDS_Face& aFace = TopoDS::Face(aFaceExp.Current()); + theWireframeFaceSource->AddFace(aFace); + theShadingFaceSource->AddFace(aFace); + TopExp_Explorer anEdgeExp(aFaceExp.Current(), TopAbs_EDGE); + for(; anEdgeExp.More(); anEdgeExp.Next()) { + const TopoDS_Edge& anEdge = TopoDS::Edge(anEdgeExp.Current()); + if(!BRep_Tool::Degenerated(anEdge)){ + // compute the number of faces + int aNbOfFaces = theEdgeMap.FindFromKey(anEdge).Extent(); + switch(aNbOfFaces){ + case 0: // isolated edge + theIsolatedEdgeSource->AddEdge(anEdge,theIsVector); + break; + case 1: // edge in only one face + theOneFaceEdgeSource->AddEdge(anEdge,theIsVector); + break; + default: // edge shared by at least two faces + theSharedEdgeSource->AddEdge(anEdge,theIsVector); + } + } + } + } + } + } + } +} diff --git a/src/OCC2VTK/OCC2VTK_Tools.h b/src/OCC2VTK/OCC2VTK_Tools.h new file mode 100755 index 000000000..967359617 --- /dev/null +++ b/src/OCC2VTK/OCC2VTK_Tools.h @@ -0,0 +1,50 @@ +// Copyright (C) 2007-2012 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 +// + +#ifndef OCC2VTK_TOOLS_H +#define OCC2VTK_TOOLS_H + +#include "OCC2VTK.h" + +#include +#include + +class GEOM_EdgeSource; +class GEOM_WireframeFace; +class GEOM_ShadingFace; + +namespace GEOM +{ + // moved from GEOM_AssemblyBuilder + OCC2VTK_EXPORT void MeshShape(const TopoDS_Shape theShape, + float& theDeflection, + bool theForced = true); + + // moved from GEOM_Actor + OCC2VTK_EXPORT void SetShape(const TopoDS_Shape& theShape, + const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap, + bool theIsVector, + GEOM_EdgeSource* theIsolatedEdgeSource, + GEOM_EdgeSource* theOneFaceEdgeSource, + GEOM_EdgeSource* theSharedEdgeSource, + GEOM_WireframeFace* theWireframeFaceSource, + GEOM_ShadingFace* theShadingFaceSource); +} + +#endif // OCC2VTK_TOOLS_H diff --git a/src/OperationGUI/Makefile.am b/src/OperationGUI/Makefile.am index 3afc05013..3dc6da126 100644 --- a/src/OperationGUI/Makefile.am +++ b/src/OperationGUI/Makefile.am @@ -1,29 +1,25 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# GEOM OPERATIONGUI : # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : OperationGUI -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files @@ -32,9 +28,11 @@ salomeinclude_HEADERS = \ OperationGUI_ArchimedeDlg.h \ OperationGUI_PartitionDlg.h \ OperationGUI_FilletDlg.h \ - OperationGUI_Fillet2dDlg.h \ + OperationGUI_Fillet1d2dDlg.h \ OperationGUI_ChamferDlg.h \ OperationGUI_GetShapesOnShapeDlg.h \ + OperationGUI_GetSharedShapesDlg.h \ + OperationGUI_ExtrudedFeatureDlg.h \ OperationGUI_ClippingDlg.h # Libraries targets @@ -45,18 +43,22 @@ dist_libOperationGUI_la_SOURCES = \ OperationGUI_ArchimedeDlg.cxx \ OperationGUI_PartitionDlg.cxx \ OperationGUI_GetShapesOnShapeDlg.cxx \ + OperationGUI_GetSharedShapesDlg.cxx \ OperationGUI_FilletDlg.cxx \ - OperationGUI_Fillet2dDlg.cxx \ + OperationGUI_Fillet1d2dDlg.cxx \ OperationGUI_ChamferDlg.cxx \ + OperationGUI_ExtrudedFeatureDlg.cxx \ OperationGUI_ClippingDlg.cxx MOC_FILES = \ OperationGUI_ArchimedeDlg_moc.cxx \ OperationGUI_PartitionDlg_moc.cxx \ OperationGUI_GetShapesOnShapeDlg_moc.cxx\ + OperationGUI_GetSharedShapesDlg_moc.cxx \ OperationGUI_FilletDlg_moc.cxx \ - OperationGUI_Fillet2dDlg_moc.cxx \ + OperationGUI_Fillet1d2dDlg_moc.cxx \ OperationGUI_ChamferDlg_moc.cxx \ + OperationGUI_ExtrudedFeatureDlg_moc.cxx \ OperationGUI_ClippingDlg_moc.cxx nodist_libOperationGUI_la_SOURCES = \ @@ -74,6 +76,7 @@ libOperationGUI_la_CPPFLAGS = \ $(GUI_CXXFLAGS) \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ + $(OPENCV_INCLUDES) \ -I$(srcdir)/../GEOMGUI \ -I$(srcdir)/../DlgRef \ -I$(srcdir)/../GEOMBase \ @@ -81,14 +84,15 @@ libOperationGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMAlgo \ + -I$(srcdir)/../GEOM \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl + libOperationGUI_la_LDFLAGS = \ ../GEOMBase/libGEOMBase.la \ - $(CAS_LDPATH) -lTKFillet - + $(CAS_LDPATH) -lTKFillet \ + $(OPENCV_LIBS) ############################### # Obsolete files ? ############################### diff --git a/src/OperationGUI/OperationGUI.cxx b/src/OperationGUI/OperationGUI.cxx index ebc81748d..7c9408444 100644 --- a/src/OperationGUI/OperationGUI.cxx +++ b/src/OperationGUI/OperationGUI.cxx @@ -1,31 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : OperationGUI.cxx -// Author : Damien COQUERET, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : OperationGUI.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. + #include "OperationGUI.h" #include +#include "GeometryGUI_Operations.h" #include #include @@ -38,10 +38,12 @@ #include "OperationGUI_PartitionDlg.h" // Method PARTITION #include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE #include "OperationGUI_FilletDlg.h" // Method FILLET -#include "OperationGUI_Fillet2dDlg.h" // Method FILLET 2D +#include "OperationGUI_Fillet1d2dDlg.h" // Method FILLET 2D and FILLET 1D #include "OperationGUI_ChamferDlg.h" // Method CHAMFER #include "OperationGUI_ClippingDlg.h" // Clipping dialog box #include "OperationGUI_GetShapesOnShapeDlg.h" +#include "OperationGUI_GetSharedShapesDlg.h" +#include "OperationGUI_ExtrudedFeatureDlg.h" // Methods EXTRUDED BOSS / CUT //======================================================================= // function : OperationGUI() @@ -65,23 +67,27 @@ OperationGUI::~OperationGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) +bool OperationGUI::OnGUIEvent (int theCommandID, SUIT_Desktop* parent) { SalomeApp_Application* app = getGeometryGUI()->getApp(); - if ( !app ) return false; + if (!app) return false; getGeometryGUI()->EmitSignalDeactivateDialog(); - switch ( theCommandID ) { - case 503: ( new OperationGUI_PartitionDlg ( getGeometryGUI(), parent ) )->show(); break; - case 504: ( new OperationGUI_ArchimedeDlg ( getGeometryGUI(), parent ) )->show(); break; - case 505: ( new OperationGUI_FilletDlg ( getGeometryGUI(), parent ) )->show(); break; - case 506: ( new OperationGUI_ChamferDlg ( getGeometryGUI(), parent ) )->show(); break; - case 507: ( new OperationGUI_ClippingDlg ( getGeometryGUI(), parent ) )->show(); break; - case 508: ( new OperationGUI_GetShapesOnShapeDlg( getGeometryGUI(), parent ) )->show(); break; - case 509: ( new OperationGUI_Fillet2dDlg ( getGeometryGUI(), parent ) )->show(); break; + switch (theCommandID) { + case GEOMOp::OpPartition: (new OperationGUI_PartitionDlg (getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpArchimede: (new OperationGUI_ArchimedeDlg (getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpFillet3d: (new OperationGUI_FilletDlg (getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpChamfer: (new OperationGUI_ChamferDlg (getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpClipping: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpShapesOnShape: (new OperationGUI_GetShapesOnShapeDlg(getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpSharedShapes: (new OperationGUI_GetSharedShapesDlg (getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpExtrudedBoss: (new OperationGUI_ExtrudedFeatureDlg (BOSS, getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpExtrudedCut: (new OperationGUI_ExtrudedFeatureDlg (CUT, getGeometryGUI(), parent))->show(); break; + case GEOMOp::OpFillet1d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, true))->show(); break; + case GEOMOp::OpFillet2d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, false))->show(); break; default: - app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); } return true; diff --git a/src/OperationGUI/OperationGUI.h b/src/OperationGUI/OperationGUI.h index 760150bac..6d1445105 100644 --- a/src/OperationGUI/OperationGUI.h +++ b/src/OperationGUI/OperationGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -35,6 +36,8 @@ class OperationGUI : public GEOMGUI { public : + enum ExtrudedFeatOperation { CUT = 1, BOSS = 2 }; + OperationGUI( GeometryGUI* ); ~OperationGUI(); diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index fdf1778e3..861ce92f6 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_ArchimedeDlg.cxx // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -106,9 +107,11 @@ void OperationGUI_ArchimedeDlg::Init() double SpecificStep1 = 0.1; double SpecificStep2 = 0.01; /* min, max, myStep and decimals for spin boxes & initial values */ - initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, myStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupPoints->SpinBox_DY, 0.001, COORD_MAX, SpecificStep1, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupPoints->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep2, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, myStep, "weight_precision" ); + initSpinBox( GroupPoints->SpinBox_DY, 0.001, COORD_MAX, SpecificStep1, "density_precision" ); + initSpinBox( GroupPoints->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep2, "parametric_precision" ); + + showOnlyPreviewControl(); GroupPoints->SpinBox_DX->setValue( 100.0 ); GroupPoints->SpinBox_DY->setValue( 1.0 ); @@ -123,13 +126,19 @@ void OperationGUI_ArchimedeDlg::Init() connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); + + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); initName( tr( "GEOM_ARCHIMEDE" ) ); globalSelection( GEOM_ALLSHAPES ); SelectionIntoArgument(); + resize(100,100); } @@ -140,8 +149,10 @@ void OperationGUI_ArchimedeDlg::Init() void OperationGUI_ArchimedeDlg::SetDoubleSpinBoxStep( double step ) { GroupPoints->SpinBox_DX->setSingleStep(step); - GroupPoints->SpinBox_DY->setSingleStep(step); - GroupPoints->SpinBox_DZ->setSingleStep(step); + + // san: Commented so as not to override specific step settings + //GroupPoints->SpinBox_DY->setSingleStep(step); + //GroupPoints->SpinBox_DZ->setSingleStep(step); } //================================================================================= @@ -150,6 +161,7 @@ void OperationGUI_ArchimedeDlg::SetDoubleSpinBoxStep( double step ) //================================================================================= void OperationGUI_ArchimedeDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -184,15 +196,14 @@ void OperationGUI_ArchimedeDlg::SelectionIntoArgument() if (aSelList.Extent() != 1) return; - Standard_Boolean testResult = Standard_False; - myShape = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + myShape = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (!testResult || myShape->_is_nil() || !GEOMBase::IsShape(myShape)) { + if ( !GEOMBase::IsShape(myShape) ) { myShape = GEOM::GEOM_Object::_nil(); return; } - myEditCurrentArgument->setText(GEOMBase::GetName(myShape)); + processPreview(); } //================================================================================= @@ -219,7 +230,8 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + processPreview(); } @@ -263,14 +275,12 @@ bool OperationGUI_ArchimedeDlg::isValid( QString& msg ) //================================================================================= bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; - double aWeight = GroupPoints->SpinBox_DX->value(); double aWaterDensity = GroupPoints->SpinBox_DY->value(); double aMeshDeflection = GroupPoints->SpinBox_DZ->value(); - anObj = GEOM::GEOM_ILocalOperations::_narrow( - getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); if ( !anObj->_is_nil() ) { @@ -280,10 +290,19 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) aParameters << GroupPoints->SpinBox_DX->text(); aParameters << GroupPoints->SpinBox_DY->text(); aParameters << GroupPoints->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } objects.push_back( anObj._retn() ); } return true; } + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::ValueChangedInSpinBox(double newValue) +{ + processPreview(); +} diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.h b/src/OperationGUI/OperationGUI_ArchimedeDlg.h index 640e06f77..82c27685f 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.h +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_ArchimedeDlg.h // Author : Nicolas REJNERI, Open CASCADE S.A.S. @@ -64,6 +65,7 @@ private slots: void LineEditReturnPressed(); void SelectionIntoArgument(); void SetDoubleSpinBoxStep( double ); + void ValueChangedInSpinBox( double ); }; #endif // OPERATIONGUI_ARCHIMEDEDLG_H diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index af89feddd..69c355017 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -1,30 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_ChamferDlg.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. -// + #include "OperationGUI_ChamferDlg.h" -#include +#include #include #include @@ -90,7 +91,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q // Create second group - myGrp2 = new QGroupBox(tr("GEOM_CHAMFER_EDGES"), centralWidget()); + myGrp2 = new QGroupBox(tr("GEOM_CHAMFER_EDGE"), centralWidget()); aLayout = new QGridLayout(myGrp2); aLayout->setMargin(9); aLayout->setSpacing(6); @@ -121,7 +122,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q // Create fourth group - myGrp4 = new QGroupBox(tr("GEOM_CHAMFER_EDGE"), centralWidget()); + myGrp4 = new QGroupBox(tr("GEOM_CHAMFER_EDGES"), centralWidget()); aLayout = new QGridLayout(myGrp4); aLayout->setMargin(9); aLayout->setSpacing(6); @@ -149,9 +150,9 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter; for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) { if (anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24) - initSpinBox(anIter.value(), 0.001, 89.999, 5, 0); + initSpinBox(anIter.value(), 0.001, 89.999, 5, "angle_precision" ); else - initSpinBox(anIter.value(), 0.001, COORD_MAX, SpecificStep, 3); + initSpinBox(anIter.value(), 0.001, COORD_MAX, SpecificStep, "length_precision" ); } setHelpFileName("chamfer_operation_page.html"); @@ -192,6 +193,8 @@ void OperationGUI_ChamferDlg::Init() myFace[ Face1 ] = -1; myFace[ Face2 ] = -1; + showOnlyPreviewControl(); + // signals and slots connections // main buttons @@ -353,7 +356,7 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId) myEditCurrentArgument->setText(""); } - displayPreview(); + processPreview(); } qApp->processEvents(); @@ -367,6 +370,7 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId) //================================================================================= void OperationGUI_ChamferDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -414,14 +418,13 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() { myShape = GEOM::GEOM_Object::_nil(); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil()) { + if ( !anObj->_is_nil() ) { myShape = anObj; myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); - displayPreview(); + processPreview(); } } @@ -432,11 +435,10 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() { myFace[ aCurrFocus ] = -1; if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil()) { + if ( !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger anIndexes; aSelMgr->GetIndexes(aSelList.First(), anIndexes); @@ -445,7 +447,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() QString aFaceName = QString(GEOMBase::GetName(anObj)) + ":%1"; myEditCurrentArgument->setText(aFaceName.arg(anIndex)); myFace[ aCurrFocus ] = anIndex; - displayPreview(); + processPreview(); } } } @@ -455,11 +457,10 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() if (aCurrFocus == Faces) myFaces.Clear(); else myEdges.Clear(); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil()) { + if ( !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger anIndexes; aSelMgr->GetIndexes(aSelList.First(), anIndexes); @@ -481,14 +482,15 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() else if (aConstructorId == 3) myEdges = anIndexes; - displayPreview(); + processPreview(); } } } } // clear selection - if (aCurrFocus != Faces && aCurrFocus != Edges) { + if (aCurrFocus != Face1 && aCurrFocus != Face2 && + aCurrFocus != Faces && aCurrFocus != Edges) { disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); myGeomGUI->getApp()->selectionMgr()->clearSelected(); connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), @@ -525,6 +527,19 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() default: break; } + + //rnv: To fix the bug IPAL22041 TC5.1.5: "Fillet Construcion" dialog loses current selection. + // Restore selection of the main shape, if need, + // because it was canceled. + aSelMgr->selectedObjects(aSelList); + if (aSelList.Extent() == 0 && !myShape->_is_nil()) { + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + ObjectList list; + list.push_back(myShape); + selectObjects(list); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + } } //================================================================================= @@ -556,7 +571,7 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument() activateSelection(); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); + processPreview(); } //================================================================================= @@ -583,7 +598,7 @@ void OperationGUI_ChamferDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -604,7 +619,7 @@ void OperationGUI_ChamferDlg::enterEvent (QEvent*) //================================================================================= void OperationGUI_ChamferDlg::ValueChangedInSpinBox (double) { - displayPreview(); + processPreview(); } //================================================================================= @@ -751,37 +766,37 @@ bool OperationGUI_ChamferDlg::isValid (QString& msg) case 1: if (myRadioButton[ RadioButton21 ]->isChecked()) { - ok = mySpinBox[ SpinBox21 ]->isValid( msg, !IsPreview() ) && ok; - ok = mySpinBox[ SpinBox22 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox21 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox22 ]->isValid( msg, !IsPreview() ) && ok; } else { - ok = mySpinBox[ SpinBox23 ]->isValid( msg, !IsPreview() ) && ok; - ok = mySpinBox[ SpinBox24 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox23 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox24 ]->isValid( msg, !IsPreview() ) && ok; } return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0 && ok; case 2: if (myRadioButton[ RadioButton31 ]->isChecked()) { - ok = mySpinBox[ SpinBox31 ]->isValid( msg, !IsPreview() ) && ok; - ok = mySpinBox[ SpinBox32 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox31 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox32 ]->isValid( msg, !IsPreview() ) && ok; } else { - ok = mySpinBox[ SpinBox33 ]->isValid( msg, !IsPreview() ) && ok; - ok = mySpinBox[ SpinBox34 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox33 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox34 ]->isValid( msg, !IsPreview() ) && ok; } return !myShape->_is_nil() && myFaces.Extent() > 0 && ok; case 3: if (myRadioButton[ RadioButton41 ]->isChecked()) { - ok = mySpinBox[ SpinBox41 ]->isValid( msg, !IsPreview() ) && ok; - ok = mySpinBox[ SpinBox42 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox41 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox42 ]->isValid( msg, !IsPreview() ) && ok; } else { - ok = mySpinBox[ SpinBox43 ]->isValid( msg, !IsPreview() ) && ok; - ok = mySpinBox[ SpinBox44 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox43 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox44 ]->isValid( msg, !IsPreview() ) && ok; } return !myShape->_is_nil() && myEdges.Extent() > 0 && ok; default: return false; @@ -801,37 +816,37 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) myRadioButton[ RadioButton41 ]->isChecked()); int anId = getConstructorId(); + + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + if (anId == 0) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value()); + anObj = anOper->MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value()); if (!anObj->_is_nil()) aParameters << mySpinBox[ SpinBox1 ]->text(); } else if (anId == 1) { if (flag) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdge(myShape, - mySpinBox[ SpinBox21 ]->value(), - mySpinBox[ SpinBox22 ]->value(), - myFace[ Face1 ], - myFace[ Face2 ]); + anObj = anOper->MakeChamferEdge(myShape, + mySpinBox[ SpinBox21 ]->value(), + mySpinBox[ SpinBox22 ]->value(), + myFace[ Face1 ], + myFace[ Face2 ]); if (!anObj->_is_nil()) { - aParameters << mySpinBox[ SpinBox21 ]->text(); - aParameters << mySpinBox[ SpinBox22 ]->text(); + aParameters << mySpinBox[ SpinBox21 ]->text(); + aParameters << mySpinBox[ SpinBox22 ]->text(); } } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdgeAD(myShape, - mySpinBox[ SpinBox23 ]->value(), - mySpinBox[ SpinBox24 ]->value() * PI180, - myFace[ Face1 ], - myFace[ Face2 ]); + anObj = anOper->MakeChamferEdgeAD(myShape, + mySpinBox[ SpinBox23 ]->value(), + mySpinBox[ SpinBox24 ]->value() * M_PI / 180., + myFace[ Face1 ], + myFace[ Face2 ]); if (!anObj->_is_nil()) { - aParameters << mySpinBox[ SpinBox23 ]->text(); - aParameters << mySpinBox[ SpinBox24 ]->text(); + aParameters << mySpinBox[ SpinBox23 ]->text(); + aParameters << mySpinBox[ SpinBox24 ]->text(); } } } @@ -844,27 +859,25 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) anArray[ i - 1 ] = myFaces(i); if (flag) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferFaces(myShape, - mySpinBox[ SpinBox31 ]->value(), - mySpinBox[ SpinBox32 ]->value(), - anArray); + anObj = anOper->MakeChamferFaces(myShape, + mySpinBox[ SpinBox31 ]->value(), + mySpinBox[ SpinBox32 ]->value(), + anArray); if (!anObj->_is_nil()) { - aParameters << mySpinBox[ SpinBox31 ]->text(); - aParameters << mySpinBox[ SpinBox32 ]->text(); + aParameters << mySpinBox[ SpinBox31 ]->text(); + aParameters << mySpinBox[ SpinBox32 ]->text(); } } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferFacesAD(myShape, - mySpinBox[ SpinBox33 ]->value(), - mySpinBox[ SpinBox34 ]->value() * PI180, - anArray); + anObj = anOper->MakeChamferFacesAD(myShape, + mySpinBox[ SpinBox33 ]->value(), + mySpinBox[ SpinBox34 ]->value() * M_PI / 180., + anArray); if (!anObj->_is_nil()) { - aParameters << mySpinBox[ SpinBox33 ]->text(); - aParameters << mySpinBox[ SpinBox34 ]->text(); + aParameters << mySpinBox[ SpinBox33 ]->text(); + aParameters << mySpinBox[ SpinBox34 ]->text(); } } } @@ -874,27 +887,25 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) for (int i = 1, n = myEdges.Extent(); i <= n; i++) anArray[ i - 1 ] = myEdges(i); if (flag) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdges(myShape, - mySpinBox[ SpinBox41 ]->value(), - mySpinBox[ SpinBox42 ]->value(), - anArray); + anObj = anOper->MakeChamferEdges(myShape, + mySpinBox[ SpinBox41 ]->value(), + mySpinBox[ SpinBox42 ]->value(), + anArray); if (!anObj->_is_nil()) { - aParameters << mySpinBox[ SpinBox41 ]->text(); - aParameters << mySpinBox[ SpinBox42 ]->text(); + aParameters << mySpinBox[ SpinBox41 ]->text(); + aParameters << mySpinBox[ SpinBox42 ]->text(); } } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdgesAD(myShape, - mySpinBox[ SpinBox43 ]->value(), - mySpinBox[ SpinBox44 ]->value() * PI180, - anArray); + anObj = anOper->MakeChamferEdgesAD(myShape, + mySpinBox[ SpinBox43 ]->value(), + mySpinBox[ SpinBox44 ]->value() * M_PI / 180., + anArray); if (!anObj->_is_nil()) { - aParameters << mySpinBox[ SpinBox43 ]->text(); - aParameters << mySpinBox[ SpinBox44 ]->text(); + aParameters << mySpinBox[ SpinBox43 ]->text(); + aParameters << mySpinBox[ SpinBox44 ]->text(); } } } @@ -902,7 +913,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) if (!anObj->_is_nil()) { if (!IsPreview()) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back(anObj._retn()); } @@ -953,5 +964,5 @@ void OperationGUI_ChamferDlg::RadioButtonPressed() myRadioButton[ RadioButton41 ]->blockSignals(false); myRadioButton[ RadioButton42 ]->blockSignals(false); - displayPreview(); + processPreview(); } diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h index dfbe25d92..8c61ddd3d 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_ChamferDlg.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -49,9 +50,9 @@ class OperationGUI_ChamferDlg : public GEOMBase_Skeleton enum { MainObj1, MainObj2, Face1, Face2, MainObj3, Faces, MainObj4, Edges}; enum { SpinBox1, - SpinBox21, SpinBox22, SpinBox23, SpinBox24, - SpinBox31, SpinBox32, SpinBox33, SpinBox34, - SpinBox41, SpinBox42, SpinBox43, SpinBox44 }; + SpinBox21, SpinBox22, SpinBox23, SpinBox24, + SpinBox31, SpinBox32, SpinBox33, SpinBox34, + SpinBox41, SpinBox42, SpinBox43, SpinBox44 }; enum { RadioButton21, RadioButton22, RadioButton31, RadioButton32, RadioButton41, RadioButton42 }; @@ -81,9 +82,9 @@ private: void Init(); void enterEvent( QEvent* ); void createSelWg( const QString&, QPixmap&, QWidget*, - QGridLayout*, const int ); + QGridLayout*, const int ); void createRadioWg( const QString&, const QString&, QWidget*, - QGridLayout*, const int, const int, const int ); + QGridLayout*, const int, const int, const int ); void activateSelection(); void enableWidgets(); diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.cxx b/src/OperationGUI/OperationGUI_ClippingDlg.cxx index b24298447..9e93a9cdb 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.cxx +++ b/src/OperationGUI/OperationGUI_ClippingDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_ClippingDlg.cxx // Author : Michael Zorin, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com) @@ -28,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -74,13 +75,15 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI, TextLabelNear = new QLabel( tr( "Near" ), GroupArguments ); GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 ); - SpinBox_Near = new SalomeApp_DoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments ); + SpinBox_Near = new SalomeApp_DoubleSpinBox( GroupArguments ); + initSpinBox( SpinBox_Near, COORD_MIN, COORD_MAX, 10.0, "length_precision" ); GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 ); TextLabelFar = new QLabel( tr( "Far" ), GroupArguments ); GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 ); - SpinBox_Far = new SalomeApp_DoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments ); + SpinBox_Far = new SalomeApp_DoubleSpinBox( GroupArguments ); + initSpinBox( SpinBox_Far, COORD_MIN, COORD_MAX, 10.0, "length_precision" ); GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 ); resetButton = new QPushButton( tr( "Reset" ), GroupArguments ); @@ -160,12 +163,12 @@ void OperationGUI_ClippingDlg::Init() center[2] = ( bounds[4] + bounds[5] ) / 2.0; double width = sqrt( ( bounds[1]-bounds[0] ) * ( bounds[1]-bounds[0] ) + - ( bounds[3]-bounds[2] ) * ( bounds[3]-bounds[2] ) + - ( bounds[5]-bounds[4] ) * ( bounds[5]-bounds[4] ) ); + ( bounds[3]-bounds[2] ) * ( bounds[3]-bounds[2] ) + + ( bounds[5]-bounds[4] ) * ( bounds[5]-bounds[4] ) ); double distance = sqrt( ( position[0]-center[0] ) * ( position[0]-center[0] ) + - ( position[1]-center[1] ) * ( position[1]-center[1] ) + - ( position[2]-center[2] ) * ( position[2]-center[2] ) ); + ( position[1]-center[1] ) * ( position[1]-center[1] ) + + ( position[2]-center[2] ) * ( position[2]-center[2] ) ); vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 }; @@ -246,6 +249,7 @@ bool OperationGUI_ClippingDlg::ClickOnApply() //================================================================================= void OperationGUI_ClippingDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -307,12 +311,12 @@ void OperationGUI_ClippingDlg::onReset() center[2] = ( bounds[4] + bounds[5] ) / 2.0; double width = sqrt( ( bounds[1]-bounds[0] ) * ( bounds[1]-bounds[0] ) + - ( bounds[3]-bounds[2] ) * ( bounds[3]-bounds[2] ) + - ( bounds[5]-bounds[4] ) * ( bounds[5]-bounds[4] ) ); + ( bounds[3]-bounds[2] ) * ( bounds[3]-bounds[2] ) + + ( bounds[5]-bounds[4] ) * ( bounds[5]-bounds[4] ) ); double distance = sqrt( ( position[0]-center[0] ) * ( position[0]-center[0] ) + - ( position[1]-center[1] ) * ( position[1]-center[1] ) + - ( position[2]-center[2] ) * ( position[2]-center[2] ) ); + ( position[1]-center[1] ) * ( position[1]-center[1] ) + + ( position[2]-center[2] ) * ( position[2]-center[2] ) ); vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 }; diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.h b/src/OperationGUI/OperationGUI_ClippingDlg.h index 1e6cba6c6..6b2f41edd 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.h +++ b/src/OperationGUI/OperationGUI_ClippingDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_ClippingDlg.h // Author : Michael Zorin, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com) diff --git a/src/OperationGUI/OperationGUI_ExtrudedFeatureDlg.cxx b/src/OperationGUI/OperationGUI_ExtrudedFeatureDlg.cxx new file mode 100644 index 000000000..135a8532d --- /dev/null +++ b/src/OperationGUI/OperationGUI_ExtrudedFeatureDlg.cxx @@ -0,0 +1,398 @@ +// Copyright (C) 2007-2012 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 : OperationGUI_ExtrudedFeatureDlg.cxx +// Author : Renaud NEDELEC, Open CASCADE S.A.S. + +#include "OperationGUI.h" +#include "OperationGUI_ExtrudedFeatureDlg.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include + +// OCCT Includes +#include + +#include + +//================================================================================= +// class : OperationGUI_ExtrudedFeatureDlg() +// purpose : Constructs a OperationGUI_ExtrudedCutDlg which is a child of 'parent', +// with the name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= + +OperationGUI_ExtrudedFeatureDlg::OperationGUI_ExtrudedFeatureDlg(const int theOperation, + GeometryGUI* theGeometryGUI, + QWidget* parent,bool modal, + Qt::WindowFlags fl) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), + myOperation(theOperation) +{ + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + QPixmap image0; + QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICO_DRAFT"))); + QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHANGE_DIRECTION"))); + QString aTitle; + switch (myOperation) + { + case OperationGUI::BOSS: + image0 = QPixmap(aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_BOSS"))); + aTitle = tr("GEOM_EXTRUDED_BOSS_TITLE"); + setHelpFileName("extruded_boss_operation_page.html"); + break; + case OperationGUI::CUT: + image0 = QPixmap( aResMgr->loadPixmap("GEOM", tr("ICO_EXTRUDED_CUT"))); + aTitle = tr("GEOM_EXTRUDED_CUT_TITLE"); + setHelpFileName("extruded_cut_operation_page.html"); + break; + } + + setWindowTitle(aTitle); + mainFrame()->GroupConstructors->setTitle(aTitle); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + mainFrame()->RadioButton1->setChecked(true); + + myGroup = new DlgRef_2Sel2Spin2Push(centralWidget()); + + myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + + myGroup->PushButton1->setIcon(image1); + myGroup->PushButton2->setIcon(image1); + myGroup->PushButton3->setIcon(image2); + myGroup->PushButton4->setIcon(image3); + myGroup->LineEdit1->setReadOnly(true); + myGroup->LineEdit2->setReadOnly(true); + myGroup->TextLabel1->setText(tr("GEOM_INIT_SHAPE")); + myGroup->TextLabel2->setText(tr("GEOM_PROFILE")); + myGroup->TextLabel3->setText(tr("GEOM_HEIGHT")); + myGroup->TextLabel4->setText(tr("GEOM_DRAFT_ANGLE")); + myGroup->TextLabel5->setText(tr("GEOM_CHANGE_DIRECTION")); + + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); + layout->setSpacing(6); + layout->addWidget(myGroup); + + Init(); + +} + +//================================================================================= +// function : ~OperationGUI_ExtrudedFeatureDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_ExtrudedFeatureDlg::~OperationGUI_ExtrudedFeatureDlg() +{ +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::Init() +{ + // init variables + myEditCurrentArgument = myGroup->LineEdit1; + + // Get setting of step value from file configuration + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + + initSpinBox(myGroup->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(myGroup->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" ); + + myGroup->LineEdit1->setText(""); + myGroup->LineEdit2->setText(""); + myGroup->SpinBox_DX->setValue(10.0); + myGroup->SpinBox_DY->setValue(10.0); + myGroup->SpinBox_DY->setEnabled(false); + myObject1.nullify(); + myObject2.nullify(); + + // signals and slots connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(myGroup->PushButton3, SIGNAL(clicked(bool)), this, SLOT(ButtonClicked(bool))); + connect(myGroup->PushButton4, SIGNAL(clicked(bool)), this, SLOT(ButtonClicked(bool))); + connect(myGroup->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(myGroup->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + switch (myOperation) + { + case OperationGUI::BOSS: + initName(tr("GEOM_EXTRUDED_BOSS")); + break; + case OperationGUI::CUT: + initName(tr("GEOM_EXTRUDED_CUT")); + break; + } + + mainFrame()->RadioButton1->setFocus(); + + globalSelection(GEOM_ALLSHAPES); + + myGroup->PushButton1->click(); + SelectionIntoArgument(); + + resize(minimumSizeHint()); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::ClickOnOk() +{ + setIsApplyAndClose( true ); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_ExtrudedFeatureDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + // activate selection and connect selection manager + myGroup->PushButton1->click(); + return true; +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if (send == myGroup->PushButton1) { + myEditCurrentArgument = myGroup->LineEdit1; + + myGroup->PushButton2->setDown(false); + myGroup->LineEdit2->setEnabled(false); + } + else if (send == myGroup->PushButton2) { + myEditCurrentArgument = myGroup->LineEdit2; + + myGroup->PushButton1->setDown(false); + myGroup->LineEdit1->setEnabled(false); + } + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection is changed or on dialog initialization or activation +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + QList types; + types<LineEdit1) + { + types.clear(); + types<LineEdit2) + { + types.clear(); + types << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE; + } + + GEOM::GeomObjPtr aSelectedObject = getSelected( types ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + if (myEditCurrentArgument == myGroup->LineEdit1) { + myObject1 = aSelectedObject; + if (!myObject2) + myGroup->PushButton2->click(); + } + else if (myEditCurrentArgument == myGroup->LineEdit2) { + myObject2 = aSelectedObject; + if (!myObject1) + myGroup->PushButton1->click(); + } + + displayPreview(true); + } + else { + if (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify(); + else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify(); + } +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + processPreview(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::ValueChangedInSpinBox() +{ + displayPreview(true); +} + +//================================================================================= +// function : ButtonClicked(bool checked) +// purpose : +//================================================================================= +void OperationGUI_ExtrudedFeatureDlg::ButtonClicked(bool checked) +{ + QPushButton* send = (QPushButton*)sender(); + if (send == myGroup->PushButton3) + myGroup->SpinBox_DY->setEnabled(checked); + + displayPreview(true); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_ExtrudedFeatureDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool OperationGUI_ExtrudedFeatureDlg::isValid (QString&) +{ + return myObject1 && myObject2; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_ExtrudedFeatureDlg::execute (ObjectList& objects) +{ + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + + double angle=0.0; + double aHeight = myGroup->SpinBox_DX->value(); + + if (myGroup->PushButton3->isChecked()) + angle=myGroup->SpinBox_DY->value(); + + if (myGroup->PushButton4->isChecked()) + { + aHeight = -aHeight; + angle = -angle; + } + + bool isProtrusion = (myOperation == OperationGUI::BOSS); + + // Hide the initial shape in order to see the modifications on the preview + erase(myObject1.get(),false); + + GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(), + aHeight, + angle, + isProtrusion); + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + + return true; +} + +// //================================================================================= +// // function : addSubshapeToStudy +// // purpose : virtual method to add new SubObjects if local selection +// //================================================================================= +// void OperationGUI_ExtrudedFeatureDlg::addSubshapesToStudy() +// { +// GEOMBase::PublishSubObject( myObject2.get() ); +// } diff --git a/src/OperationGUI/OperationGUI_ExtrudedFeatureDlg.h b/src/OperationGUI/OperationGUI_ExtrudedFeatureDlg.h new file mode 100644 index 000000000..058b354ae --- /dev/null +++ b/src/OperationGUI/OperationGUI_ExtrudedFeatureDlg.h @@ -0,0 +1,89 @@ +// Copyright (C) 2007-2012 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 : OperationGUI_ExtrudedFeatureDlg.h +// Author : Renaud NEDELEC, Open CASCADE S.A.S. + +#ifndef BASICGUI_EXTRUDEDFEATUREDLG_H +#define BASICGUI_EXTRUDEDFEATUREDLG_H + +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" +#include + +// class DlgRef_2Sel1Spin; +// class DlgRef_3Spin; +// class DlgRef_2Sel; +// class DlgRef_1Sel3Spin; +// class DlgRef_1Sel2Spin; +class DlgRef_2Sel2Spin2Push; + +// class QLineEdit; +// class QGroupBox; +// class QButtonGroup; +// class QMenu; +class QAction; + +//================================================================================= +// class : OperationGUI_ExtrudedFeatureDlg +// purpose : +//================================================================================= +class OperationGUI_ExtrudedFeatureDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + OperationGUI_ExtrudedFeatureDlg( const int, GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); + ~OperationGUI_ExtrudedFeatureDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); +// virtual void addSubshapesToStudy(); + +private: + void Init(); + void enterEvent( QEvent* ); + +private: + int myOperation; + + GEOM::GeomObjPtr myObject1; + GEOM::GeomObjPtr myObject2; + + DlgRef_2Sel2Spin2Push* myGroup; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void ValueChangedInSpinBox(); + void ButtonClicked(bool); + +}; + +#endif // BASICGUI_EXTRUDEDFEATUREDLG_H diff --git a/src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx b/src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx new file mode 100644 index 000000000..ee5b86633 --- /dev/null +++ b/src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx @@ -0,0 +1,426 @@ +// Copyright (C) 2007-2012 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 + +// GEOM GEOMGUI : GUI for Geometry component +// File : OperationGUI_Fillet1d2dDlg.cxx +// Author : DMV, OCN. + +#include "OperationGUI_Fillet1d2dDlg.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// OCCT Includes +#include +#include + +#include + +//================================================================================= +// class : OperationGUI_Fillet1d2dDlg() +// purpose : Constructs a OperationGUI_Fillet1d2dDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +OperationGUI_Fillet1d2dDlg::OperationGUI_Fillet1d2dDlg (GeometryGUI* theGeometryGUI, + QWidget* parent, + bool is1D) + : GEOMBase_Skeleton(theGeometryGUI, parent, false), + myIs1D( is1D ) +{ + SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); + QPixmap image0 (aResMgr->loadPixmap("GEOM", myIs1D ? tr("ICON_DLG_FILLET_1D") + : tr("ICON_DLG_FILLET_2D"))); + QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(myIs1D ? tr("GEOM_FILLET_1D_TITLE") : tr("GEOM_FILLET_2D_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(myIs1D ? tr("GEOM_FILLET_1D") : tr("GEOM_FILLET_2D")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->close(); + + GroupVertexes = new DlgRef_2Sel1Spin2Check (centralWidget()); + GroupVertexes->GroupBox1->setTitle(myIs1D ? tr("GEOM_FILLET_1D") : tr("GEOM_FILLET_2D")); + GroupVertexes->TextLabel1->setText(myIs1D ? tr("GEOM_PLANAR_EDGE_WIRE") : tr("GEOM_PLANAR_FACE")); + GroupVertexes->TextLabel2->setText(tr("GEOM_VERTEXES")); + GroupVertexes->TextLabel3->setText(tr("GEOM_RADIUS")); + GroupVertexes->PushButton1->setIcon(iconSelect); + GroupVertexes->PushButton2->setIcon(iconSelect); + GroupVertexes->LineEdit1->setReadOnly(true); + GroupVertexes->LineEdit2->setReadOnly(true); + if (myIs1D) { + GroupVertexes->CheckButton1->setText(tr("GEOM_FILLET_1D_IGNORE_SECANT")); + GroupVertexes->CheckButton1->setChecked(true); + } + else + GroupVertexes->CheckButton1->close(); + GroupVertexes->CheckButton2->close(); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupVertexes); + + /***************************************************************/ + + // Set range of spinboxes + double SpecificStep = 10.0; + initSpinBox(GroupVertexes->SpinBox_DX, 0.00001, COORD_MAX, SpecificStep, "length_precision" ); + + setHelpFileName(myIs1D ? "fillet1d_operation_page.html" : "fillet2d_operation_page.html"); + + // Initialisation + Init(); + resize(100,100); +} + +//================================================================================= +// function : ~OperationGUI_Fillet1d2dDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_Fillet1d2dDlg::~OperationGUI_Fillet1d2dDlg() +{ +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_Fillet1d2dDlg::Init() +{ + // Set Initial values of spinboxes + GroupVertexes->SpinBox_DX->setValue(5); + + // Clear line edits + GroupVertexes->LineEdit1->setText(""); + GroupVertexes->LineEdit2->setText(""); + + myShape = GEOM::GEOM_Object::_nil(); + + myVertexes.Clear(); + + showOnlyPreviewControl(); + + // signals and slots connections + + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() )); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupVertexes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupVertexes->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupVertexes->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupVertexes->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupVertexes->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(GroupVertexes->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview())); + + initName(myIs1D ? tr("GEOM_FILLET_1D") : tr("GEOM_FILLET_2D")); + GroupVertexes->PushButton1->click(); + + SelectionIntoArgument(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_Fillet1d2dDlg::ClickOnOk() +{ + setIsApplyAndClose( true ); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_Fillet1d2dDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + // Reset dialog state + GroupVertexes->LineEdit1->setText(""); + GroupVertexes->LineEdit2->setText(""); + myShape = GEOM::GEOM_Object::_nil(); + myVertexes.Clear(); + GroupVertexes->PushButton1->click(); + + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection is changed or on dialog initialization or activation +//================================================================================= +void OperationGUI_Fillet1d2dDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + // If selection of main object is activated + if (myEditCurrentArgument == GroupVertexes->LineEdit1) { + myShape = GEOM::GEOM_Object::_nil(); + if (aSelList.Extent() == 1) { + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + + if ( !anObj->_is_nil() ) { + QString aName = GEOMBase::GetName( anObj ); + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes(aSelList.First(), aMap); + if ( aMap.Extent() == 1 ) { // Local Selection + int anIndex = aMap( 1 ); + aName += QString( myIs1D ? ":wire_%1" : ":face_%1" ).arg( anIndex ); + + //Find SubShape Object in Father + GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( anObj, aName ); + + if ( aFindedObject->_is_nil()) { // Object not found in study + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + anObj = aShapesOp->GetSubShape( anObj, anIndex ); + } + else + anObj = aFindedObject; // get Object from study + } + else { // Global Selection + if ((myIs1D && aShape.ShapeType() != TopAbs_WIRE) || + (!myIs1D && aShape.ShapeType() != TopAbs_FACE && aShape.ShapeType() != TopAbs_SHELL)) { + anObj = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } + myShape = anObj; + myEditCurrentArgument->setText(aName +); + processPreview(); + } + } + } else if (myEditCurrentArgument == GroupVertexes->LineEdit2) { + myVertexes.Clear(); + bool isPreview = myIs1D; + if (aSelList.Extent() == 1) { + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + + if ( !anObj->_is_nil() ) { + TColStd_IndexedMapOfInteger anIndexes; + aSelMgr->GetIndexes(aSelList.First(), anIndexes); + + if (anIndexes.Extent() > 0) { + QString aName; + if (anIndexes.Extent() == 1) { + int anIndex = anIndexes(1); + aName = QString(GEOMBase::GetName(anObj)) + QString(":vertex_%1").arg(anIndex); + } + else + aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent()); + + isPreview = true; + myEditCurrentArgument->setText(aName); + myVertexes = anIndexes; + } + } + } + if ( isPreview ) + processPreview(); + } + + if (myEditCurrentArgument == GroupVertexes->LineEdit1) { + if (!myShape->_is_nil() && myVertexes.Extent() == 0) + GroupVertexes->PushButton2->click(); + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_Fillet1d2dDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if (send == GroupVertexes->PushButton1) { + myEditCurrentArgument = GroupVertexes->LineEdit1; + GroupVertexes->PushButton2->setDown(false); + GroupVertexes->LineEdit2->setEnabled(false); + } + else if (send == GroupVertexes->PushButton2) { + myEditCurrentArgument = GroupVertexes->LineEdit2; + GroupVertexes->PushButton1->setDown(false); + GroupVertexes->LineEdit1->setEnabled(false); + } + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); + + activateSelection(); + + // seems we need it only to avoid preview disappearing, caused by selection mode change + processPreview(); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_Fillet1d2dDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + + if (send == GroupVertexes->LineEdit1) + myEditCurrentArgument = GroupVertexes->LineEdit1; + else if (send == GroupVertexes->LineEdit2) + myEditCurrentArgument = GroupVertexes->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_Fillet1d2dDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_Fillet1d2dDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_Fillet1d2dDlg::ValueChangedInSpinBox (double) +{ + processPreview(); +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void OperationGUI_Fillet1d2dDlg::activateSelection() +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + globalSelection(); + if (myEditCurrentArgument == GroupVertexes->LineEdit1) + //localSelection(myShape, myIs1D ? TopAbs_WIRE : TopAbs_FACE); + if (myIs1D) + globalSelection(GEOM_WIRE); + else { + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_FACE); + aMap.Add(GEOM_SHELL); + globalSelection(aMap); + } + else if (!myShape->_is_nil() && myEditCurrentArgument == GroupVertexes->LineEdit2) + localSelection(myShape, TopAbs_VERTEX); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_Fillet1d2dDlg::createOperation() +{ + return getGeomEngine()->GetILocalOperations(getStudyId()); +} + +//================================================================================= +// function : isValid() +// purpose : Verify validity of input data +//================================================================================= +bool OperationGUI_Fillet1d2dDlg::isValid (QString& msg) +{ + bool ok = !myShape->_is_nil(); + ok = GroupVertexes->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = (myIs1D || myVertexes.Extent() > 0) && ok; + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_Fillet1d2dDlg::execute (ObjectList& objects) +{ + GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong; + aListOfIndexes->length(myVertexes.Extent()); + + for (int i = 1, n = myVertexes.Extent(); i <= n; i++) + aListOfIndexes[ i - 1 ] = myVertexes(i); + + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = myIs1D ? + anOper->MakeFillet1D(myShape, getRadius(), aListOfIndexes, GroupVertexes->CheckButton1->isChecked()) : + anOper->MakeFillet2D(myShape, getRadius(), aListOfIndexes); + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + + return true; +} + +//================================================================================= +// function : getRadius +// purpose : Get radius +//================================================================================= +double OperationGUI_Fillet1d2dDlg::getRadius() const +{ + return GroupVertexes->SpinBox_DX->value(); +} diff --git a/src/OperationGUI/OperationGUI_Fillet1d2dDlg.h b/src/OperationGUI/OperationGUI_Fillet1d2dDlg.h new file mode 100644 index 000000000..04b4a7fce --- /dev/null +++ b/src/OperationGUI/OperationGUI_Fillet1d2dDlg.h @@ -0,0 +1,73 @@ +// Copyright (C) 2007-2012 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 + +// GEOM GEOMGUI : GUI for Geometry component +// File : OperationGUI_Fillet1d2dDlg.h +// Author : DMV, OCN + +#ifndef OPERATIONGUI_Fillet1d2dDLG_H +#define OPERATIONGUI_Fillet1d2dDLG_H + +#include + +#include + +class DlgRef_2Sel1Spin2Check; + +//================================================================================= +// class : OperationGUI_Fillet1d2dDlg +// purpose : +//================================================================================= +class OperationGUI_Fillet1d2dDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + OperationGUI_Fillet1d2dDlg( GeometryGUI*, QWidget*, bool theIs1D ); + ~OperationGUI_Fillet1d2dDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox( double ); + +private: + void Init(); + void enterEvent( QEvent* ); + void activateSelection(); + double getRadius() const; + +private: + bool myIs1D; + GEOM::GEOM_Object_var myShape; + TColStd_IndexedMapOfInteger myVertexes; + + DlgRef_2Sel1Spin2Check* GroupVertexes; +}; + +#endif // OPERATIONGUI_Fillet1d2dDLG_H diff --git a/src/OperationGUI/OperationGUI_Fillet2dDlg.cxx b/src/OperationGUI/OperationGUI_Fillet2dDlg.cxx deleted file mode 100755 index b33cfc3ee..000000000 --- a/src/OperationGUI/OperationGUI_Fillet2dDlg.cxx +++ /dev/null @@ -1,400 +0,0 @@ -// GEOM GEOMGUI : GUI for Geometry component -// -// Copyright (C) 2003 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 -// -// File : OperationGUI_Fillet2dDlg.cxx -// Author : DMV, OCN. -// - -#include "OperationGUI_Fillet2dDlg.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// OCCT Includes -#include -#include - -#include - -//================================================================================= -// class : OperationGUI_Fillet2dDlg() -// purpose : Constructs a OperationGUI_Fillet2dDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -OperationGUI_Fillet2dDlg::OperationGUI_Fillet2dDlg (GeometryGUI* theGeometryGUI, QWidget* parent) - : GEOMBase_Skeleton(theGeometryGUI, parent, false) -{ - SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); - QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_2D"))); - QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); - - setWindowTitle(tr("GEOM_FILLET_2D_TITLE")); - - /***************************************************************/ - mainFrame()->GroupConstructors->setTitle(tr("GEOM_FILLET_2D")); - mainFrame()->RadioButton1->setIcon(image0); - mainFrame()->RadioButton2->close(); - mainFrame()->RadioButton3->close(); - - GroupVertexes = new DlgRef_2Sel1Spin(centralWidget()); - GroupVertexes->GroupBox1->setTitle(tr("GEOM_FILLET_2D")); - GroupVertexes->TextLabel1->setText(tr("GEOM_PLANAR_FACE")); - GroupVertexes->TextLabel2->setText(tr("GEOM_VERTEXES")); - GroupVertexes->TextLabel3->setText(tr("GEOM_RADIUS")); - GroupVertexes->PushButton1->setIcon(iconSelect); - GroupVertexes->PushButton2->setIcon(iconSelect); - GroupVertexes->LineEdit1->setReadOnly(true); - GroupVertexes->LineEdit2->setReadOnly(true); - - QVBoxLayout* layout = new QVBoxLayout(centralWidget()); - layout->setMargin(0); layout->setSpacing(6); - layout->addWidget(GroupVertexes); - - /***************************************************************/ - - // Set range of spinboxes - double SpecificStep = 10.0; - initSpinBox(GroupVertexes->SpinBox_DX, 0.00001, COORD_MAX, SpecificStep, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - - setHelpFileName("fillet2d_operation_page.html"); - - // Initialisation - Init(); - resize(0,0); -} - -//================================================================================= -// function : ~OperationGUI_Fillet2dDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -OperationGUI_Fillet2dDlg::~OperationGUI_Fillet2dDlg() -{ -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void OperationGUI_Fillet2dDlg::Init() -{ - // Set Initial values of spinboxes - GroupVertexes->SpinBox_DX->setValue(5); - - // Clear line edits - GroupVertexes->LineEdit1->setText(""); - GroupVertexes->LineEdit2->setText(""); - - myShape = GEOM::GEOM_Object::_nil(); - - myVertexes.Clear(); - - // signals and slots connections - - connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() )); - connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - - // connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); - - connect(GroupVertexes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupVertexes->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - - connect(GroupVertexes->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupVertexes->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupVertexes->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - - initName(tr("GEOM_FILLET_2D")); - GroupVertexes->PushButton1->click(); -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void OperationGUI_Fillet2dDlg::ClickOnOk() -{ - if (ClickOnApply()) - ClickOnCancel(); -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -bool OperationGUI_Fillet2dDlg::ClickOnApply() -{ - if (!onAccept()) - return false; - - initName(); - // Reset dialog state - GroupVertexes->LineEdit1->setText(""); - GroupVertexes->LineEdit2->setText(""); - myShape = GEOM::GEOM_Object::_nil(); - myVertexes.Clear(); - GroupVertexes->PushButton1->click(); - - return true; -} - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection is changed or on dialog initialization or activation -//================================================================================= -void OperationGUI_Fillet2dDlg::SelectionIntoArgument() -{ - erasePreview(); - myEditCurrentArgument->setText(""); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - // If selection of main object is activated - if (myEditCurrentArgument == GroupVertexes->LineEdit1) { - myShape = GEOM::GEOM_Object::_nil(); - if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - - if (aResult && !anObj->_is_nil()) { - QString aName = GEOMBase::GetName( anObj ); - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap( 1 ); - aName += QString( ":face_%1" ).arg( anIndex ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( anObj, aName ); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - anObj = aShapesOp->GetSubShape( anObj, anIndex ); - } - else - anObj = aFindedObject; // get Object from study - } - else { // Global Selection - if ( aShape.ShapeType() != TopAbs_FACE ) { - anObj = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } - myShape = anObj; - myEditCurrentArgument->setText(aName -); - displayPreview(); - } - } - } else if (myEditCurrentArgument == GroupVertexes->LineEdit2) { - myVertexes.Clear(); - if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - - if (aResult && !anObj->_is_nil()) { - TColStd_IndexedMapOfInteger anIndexes; - aSelMgr->GetIndexes(aSelList.First(), anIndexes); - - if (anIndexes.Extent() > 0) { - QString aName; - if (anIndexes.Extent() == 1) { - int anIndex = anIndexes(1); - aName = QString(GEOMBase::GetName(anObj)) + QString(":vertex_%1").arg(anIndex); - } - else - aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent()); - - myEditCurrentArgument->setText(aName); - myVertexes = anIndexes; - displayPreview(); - } - } - } - } - - if (myEditCurrentArgument == GroupVertexes->LineEdit1) { - if (!myShape->_is_nil() && myVertexes.Extent() == 0) - GroupVertexes->PushButton2->click(); - } -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void OperationGUI_Fillet2dDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - if (send == GroupVertexes->PushButton1) { - myEditCurrentArgument = GroupVertexes->LineEdit1; - GroupVertexes->PushButton2->setDown(false); - GroupVertexes->LineEdit2->setEnabled(false); - } - else if (send == GroupVertexes->PushButton2) { - myEditCurrentArgument = GroupVertexes->LineEdit2; - GroupVertexes->PushButton1->setDown(false); - GroupVertexes->LineEdit1->setEnabled(false); - } - - // enable line edit - myEditCurrentArgument->setEnabled(true); - myEditCurrentArgument->setFocus(); - // after setFocus(), because it will be setDown(false) when loses focus - send->setDown(true); - - activateSelection(); - - // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void OperationGUI_Fillet2dDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - - if (send == GroupVertexes->LineEdit1) - myEditCurrentArgument = GroupVertexes->LineEdit1; - else if (send == GroupVertexes->LineEdit2) - myEditCurrentArgument = GroupVertexes->LineEdit2; - else - return; - - GEOMBase_Skeleton::LineEditReturnPressed(); -} - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void OperationGUI_Fillet2dDlg::ActivateThisDialog() -{ - GEOMBase_Skeleton::ActivateThisDialog(); -} - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void OperationGUI_Fillet2dDlg::enterEvent (QEvent*) -{ - if (!mainFrame()->GroupConstructors->isEnabled()) - this->ActivateThisDialog(); -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void OperationGUI_Fillet2dDlg::ValueChangedInSpinBox (double) -{ - displayPreview(); -} - -//================================================================================= -// function : activateSelection -// purpose : Activate selection in accordance with myEditCurrentArgument -//================================================================================= -void OperationGUI_Fillet2dDlg::activateSelection() -{ - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - globalSelection(); - if (myEditCurrentArgument == GroupVertexes->LineEdit1) - globalSelection( GEOM_FACE ); // localSelection(myShape, TopAbs_FACE); - else if (!myShape->_is_nil() && myEditCurrentArgument == GroupVertexes->LineEdit2) - localSelection(myShape, TopAbs_VERTEX); - - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); -} - -//================================================================================= -// function : createOperation -// purpose : -//================================================================================= -GEOM::GEOM_IOperations_ptr OperationGUI_Fillet2dDlg::createOperation() -{ - return getGeomEngine()->GetILocalOperations(getStudyId()); -} - -//================================================================================= -// function : isValid() -// purpose : Verify validity of input data -//================================================================================= -bool OperationGUI_Fillet2dDlg::isValid (QString&) -{ - return !myShape->_is_nil() && myVertexes.Extent() > 0; -} - -//================================================================================= -// function : execute -// purpose : -//================================================================================= -bool OperationGUI_Fillet2dDlg::execute (ObjectList& objects) -{ - GEOM::GEOM_Object_var anObj; - - GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong; - aListOfIndexes->length(myVertexes.Extent()); - - for (int i = 1, n = myVertexes.Extent(); i <= n; i++) - aListOfIndexes[ i - 1 ] = myVertexes(i); - - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFillet2D(myShape, getRadius(), aListOfIndexes); - - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); - - return true; -} - -//================================================================================= -// function : getRadius -// purpose : Get radius -//================================================================================= -double OperationGUI_Fillet2dDlg::getRadius() const -{ - return GroupVertexes ->SpinBox_DX->value(); -} diff --git a/src/OperationGUI/OperationGUI_Fillet2dDlg.h b/src/OperationGUI/OperationGUI_Fillet2dDlg.h deleted file mode 100755 index 523dbad04..000000000 --- a/src/OperationGUI/OperationGUI_Fillet2dDlg.h +++ /dev/null @@ -1,75 +0,0 @@ -// GEOM GEOMGUI : GUI for Geometry component -// -// Copyright (C) 2003 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 -// -// File : OperationGUI_Fillet2dDlg.h -// Author : DMV, OCN -// - -#ifndef OPERATIONGUI_FILLET2DDLG_H -#define OPERATIONGUI_FILLET2DDLG_H - -#include - -#include - -class DlgRef_2Sel1Spin; - -//================================================================================= -// class : OperationGUI_Fillet2dDlg -// purpose : -//================================================================================= -class OperationGUI_Fillet2dDlg : public GEOMBase_Skeleton -{ - Q_OBJECT - -public: - OperationGUI_Fillet2dDlg( GeometryGUI*, QWidget* ); - ~OperationGUI_Fillet2dDlg(); - -protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); - -private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox( double ); - -private: - void Init(); - void enterEvent( QEvent* ); - void activateSelection(); - double getRadius() const; - -private: - GEOM::GEOM_Object_var myShape; - TColStd_IndexedMapOfInteger myVertexes; - - DlgRef_2Sel1Spin* GroupVertexes; -}; - -#endif // OPERATIONGUI_FILLET2DDLG_H diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 84a2f3134..49a302a9c 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_FilletDlg.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -110,13 +111,13 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg (GeometryGUI* theGeometryGUI, QWi // Set range of spinboxes double SpecificStep = 10.0; - initSpinBox(Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(Group2->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(Group2->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(Group3->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(Group3->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(Group3->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, "length_precision" ); + initSpinBox(Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, "length_precision" ); + initSpinBox(Group2->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, "length_precision" ); + initSpinBox(Group2->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, "length_precision" ); + initSpinBox(Group3->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, "length_precision" ); + initSpinBox(Group3->SpinBox_DY, 0.001, COORD_MAX, SpecificStep, "length_precision" ); + initSpinBox(Group3->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep, "length_precision" ); setHelpFileName("fillet_operation_page.html"); @@ -159,6 +160,8 @@ void OperationGUI_FilletDlg::Init() myFaces.Clear(); myEdges.Clear(); + showOnlyPreviewControl(); + // signals and slots connections // main buttons @@ -291,7 +294,7 @@ void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId) else myEditCurrentArgument->setText(""); - displayPreview(); + processPreview(); } qApp->processEvents(); @@ -305,6 +308,7 @@ void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId) //================================================================================= void OperationGUI_FilletDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -344,14 +348,13 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() { myShape = GEOM::GEOM_Object::_nil(); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil()) { + if ( !anObj->_is_nil() ) { myShape = anObj; myEditCurrentArgument->setText(GEOMBase::GetName(anObj)); - displayPreview(); + processPreview(); } } @@ -364,11 +367,10 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() if (myEditCurrentArgument == Group2->LineEdit2) myEdges.Clear(); else myFaces.Clear(); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil()) { + if ( !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger anIndexes; aSelMgr->GetIndexes(aSelList.First(), anIndexes); @@ -390,13 +392,13 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() else myFaces = anIndexes; - displayPreview(); + processPreview(); } } } } - // clear selection + // clear selection of the faces or edges if (!(myEditCurrentArgument == Group2->LineEdit2 || myEditCurrentArgument == Group3->LineEdit2)) { disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); @@ -421,6 +423,19 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() default: break; } + + //rnv: To fix the bug IPAL22041 TC5.1.5: "Fillet Construcion" dialog loses current selection. + // Restore selection of the main shape, if need, + // because it was canceled. + aSelMgr->selectedObjects(aSelList); + if (aSelList.Extent() == 0 && !myShape->_is_nil()) { + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + ObjectList list; + list.push_back(myShape); + selectObjects(list); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + } } //================================================================================= @@ -464,7 +479,7 @@ void OperationGUI_FilletDlg::SetEditCurrentArgument() activateSelection(); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); + processPreview(); } //================================================================================= @@ -495,7 +510,7 @@ void OperationGUI_FilletDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -516,7 +531,7 @@ void OperationGUI_FilletDlg::enterEvent (QEvent*) //================================================================================= void OperationGUI_FilletDlg::ValueChangedInSpinBox (double) { - displayPreview(); + processPreview(); } //================================================================================= @@ -596,20 +611,20 @@ bool OperationGUI_FilletDlg::isValid (QString& msg) return !myShape->_is_nil() && ok; case 1: if (Group2->RadioButton1->isChecked()) - ok = Group2->SpinBox_DX->isValid( msg, !IsPreview() ); + ok = Group2->SpinBox_DX->isValid( msg, !IsPreview() ); else { - ok = Group2->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = Group2->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + ok = Group2->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = Group2->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; } return !myShape->_is_nil() && myEdges.Extent() > 0 && ok; case 2: if (Group3->RadioButton1->isChecked()) - ok = Group3->SpinBox_DX->isValid( msg, !IsPreview() ); + ok = Group3->SpinBox_DX->isValid( msg, !IsPreview() ); else { - ok = Group3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = Group3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + ok = Group3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = Group3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; } return !myShape->_is_nil() && myFaces.Extent() > 0 && ok; default: return false; @@ -626,9 +641,11 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; int anId = getConstructorId(); + + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + if (anId == 0) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletAll(myShape, getRadius()); + anObj = anOper->MakeFilletAll(myShape, getRadius()); if (!anObj->_is_nil()) aParameters << Group1->SpinBox_DX->text(); } @@ -641,22 +658,20 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) if (Group2->RadioButton1->isChecked()) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletEdges(myShape, getRadius(), aList); + anObj = anOper->MakeFilletEdges(myShape, getRadius(), aList); if (!anObj->_is_nil()) - aParameters << Group2->SpinBox_DX->text(); + aParameters << Group2->SpinBox_DX->text(); } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletEdgesR1R2(myShape, - Group2->SpinBox_DY->value(), - Group2->SpinBox_DZ->value(), - aList); + anObj = anOper->MakeFilletEdgesR1R2(myShape, + Group2->SpinBox_DY->value(), + Group2->SpinBox_DZ->value(), + aList); if (!anObj->_is_nil()) { - aParameters << Group2->SpinBox_DY->text(); - aParameters << Group2->SpinBox_DZ->text(); + aParameters << Group2->SpinBox_DY->text(); + aParameters << Group2->SpinBox_DZ->text(); } } } @@ -668,20 +683,18 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) aList[ i - 1 ] = myFaces(i); if (Group3->RadioButton1->isChecked()) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletFaces(myShape, getRadius(), aList); + anObj = anOper->MakeFilletFaces(myShape, getRadius(), aList); if (!anObj->_is_nil()) - aParameters << Group3->SpinBox_DX->text(); + aParameters << Group3->SpinBox_DX->text(); } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletFacesR1R2(myShape, - Group3->SpinBox_DY->value(), - Group3->SpinBox_DZ->value(), aList); + anObj = anOper->MakeFilletFacesR1R2(myShape, + Group3->SpinBox_DY->value(), + Group3->SpinBox_DZ->value(), aList); if (!anObj->_is_nil()) { - aParameters << Group3->SpinBox_DY->text(); - aParameters << Group3->SpinBox_DZ->text(); + aParameters << Group3->SpinBox_DY->text(); + aParameters << Group3->SpinBox_DZ->text(); } } } @@ -689,7 +702,7 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) if (!anObj->_is_nil()) { if (!IsPreview()) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back(anObj._retn()); } @@ -739,5 +752,5 @@ void OperationGUI_FilletDlg::RadioButtonClicked() Group3->RadioButton1->blockSignals(false); Group3->RadioButton2->blockSignals(false); - displayPreview(); + processPreview(); } diff --git a/src/OperationGUI/OperationGUI_FilletDlg.h b/src/OperationGUI/OperationGUI_FilletDlg.h index 5a5a71a33..e5bb66d29 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.h +++ b/src/OperationGUI/OperationGUI_FilletDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_FilletDlg.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx index 778af7b67..a3f97c7da 100644 --- a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx +++ b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_GetShapesOnShapeDlg.cxx // Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com) @@ -95,7 +93,7 @@ OperationGUI_GetShapesOnShapeDlg::~OperationGUI_GetShapesOnShapeDlg() //================================================================================= void OperationGUI_GetShapesOnShapeDlg::Init() { - // type for sub shape selection + // type for sub-shape selection GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID")); // commented by skl for IPAL19949 - finder isn't allowed such type //GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL")); @@ -116,6 +114,8 @@ void OperationGUI_GetShapesOnShapeDlg::Init() GroupPoints->LineEdit2->clear(); myObject1 = myObject2 = GEOM::GEOM_Object::_nil(); + showOnlyPreviewControl(); + // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -144,6 +144,7 @@ void OperationGUI_GetShapesOnShapeDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= @@ -152,6 +153,7 @@ void OperationGUI_GetShapesOnShapeDlg::Init() //================================================================================= void OperationGUI_GetShapesOnShapeDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -190,9 +192,8 @@ void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument() int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName, true); if (nbSel > 0) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( GEOMBase::IsShape(aSelectedObject) ) { myEditCurrentArgument->setText(aName); // clear selection @@ -213,6 +214,7 @@ void OperationGUI_GetShapesOnShapeDlg::SelectionIntoArgument() } } } + processPreview(); } //================================================================================= @@ -266,7 +268,8 @@ void OperationGUI_GetShapesOnShapeDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); globalSelection(GEOM_ALLSHAPES); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); + processPreview(); } //================================================================================= @@ -295,9 +298,8 @@ GEOM::GEOM_IOperations_ptr OperationGUI_GetShapesOnShapeDlg::createOperation() bool OperationGUI_GetShapesOnShapeDlg::isValid(QString&) { //Handle(SALOME_InteractiveObject) IO = firstIObject(); - //Standard_Boolean testResult; - //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); - //if (!testResult || anObject->_is_nil()) + //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO ); + //if ( anObject->_is_nil() ) // return false; return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2); @@ -330,11 +332,10 @@ bool OperationGUI_GetShapesOnShapeDlg::execute (ObjectList& objects) default: break; } - GEOM::GEOM_Object_var anObj = - GEOM::GEOM_IShapesOperations::_narrow(getOperation())-> - GetShapesOnShapeAsCompound(myObject2, myObject1, - (CORBA::Short) aLimit, - aState); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1, + (CORBA::Short) aLimit, + aState); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); @@ -350,4 +351,5 @@ void OperationGUI_GetShapesOnShapeDlg::ComboTextChanged() { // VRS ???? What is it for ??? commented for a while... //bool IsEnabled = GroupPoints->ComboBox1->currentIndex() < 3; + processPreview(); } diff --git a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.h b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.h index 1b819641c..d68a86982 100644 --- a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.h +++ b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_GetShapesOnShapeDlg.h // Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com) diff --git a/src/OperationGUI/OperationGUI_GetSharedShapesDlg.cxx b/src/OperationGUI/OperationGUI_GetSharedShapesDlg.cxx new file mode 100644 index 000000000..5872aaaa3 --- /dev/null +++ b/src/OperationGUI/OperationGUI_GetSharedShapesDlg.cxx @@ -0,0 +1,373 @@ +// Copyright (C) 2007-2012 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 +// +// File : OperationGUI_GetSharedShapesDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + +#include "OperationGUI_GetSharedShapesDlg.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +//================================================================================= +// class : OperationGUI_GetSharedShapesDlg() +// purpose : Constructs a OperationGUI_GetSharedShapesDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +OperationGUI_GetSharedShapesDlg::OperationGUI_GetSharedShapesDlg +(GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ + SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); + QPixmap image0(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SHARED_SHAPES"))); + QPixmap image2(aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_SHARED_SHAPES_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_GET_SHARED_SHAPES")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_2Sel1List1Check(centralWidget()); + GroupPoints->GroupBox1->setTitle(tr("GEOM_SHARED_SHAPES_INPUT")); + GroupPoints->TextLabel1->setText(tr("GEOM_SHAPES")); + GroupPoints->TextLabel2->hide(); + GroupPoints->TextLabel3->setText(tr("GEOM_SUBSHAPE_TYPE")); + GroupPoints->PushButton1->setIcon(image2); + GroupPoints->PushButton2->hide(); + GroupPoints->LineEdit1->setReadOnly(true); + GroupPoints->LineEdit2->hide(); + GroupPoints->LineEdit1->setEnabled(true); + GroupPoints->CheckButton1->hide(); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupPoints); + + /***************************************************************/ + + setHelpFileName("shared_shapes_page.html"); + + Init(); +} + +//================================================================================= +// function : ~OperationGUI_GetSharedShapesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_GetSharedShapesDlg::~OperationGUI_GetSharedShapesDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_GetSharedShapesDlg::Init() +{ + /* type for sub-shape selection */ + GroupPoints->ComboBox1->addItem(tr("GEOM_SOLID")); + GroupPoints->ComboBox1->addItem(tr("GEOM_SHELL")); + GroupPoints->ComboBox1->addItem(tr("GEOM_FACE")); + GroupPoints->ComboBox1->addItem(tr("GEOM_WIRE")); + GroupPoints->ComboBox1->addItem(tr("GEOM_EDGE")); + GroupPoints->ComboBox1->addItem(tr("GEOM_VERTEX")); + + GroupPoints->ComboBox1->setCurrentIndex(0); + + showOnlyPreviewControl(); + + /* signals and slots connections */ + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + //initName(getNewObjectName()); + initName(getPrefixByType()); + + ConstructorsClicked(0); + GroupPoints->PushButton1->click(); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void OperationGUI_GetSharedShapesDlg::ConstructorsClicked (int constructorId) +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + globalSelection(); + + myListShapes.length(0); + + GroupPoints->ComboBox1->setCurrentIndex(0); + GroupPoints->PushButton1->setDown(true); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->clear(); + + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); + + myEditCurrentArgument->setFocus(); + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + SelectionIntoArgument(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_GetSharedShapesDlg::ClickOnOk() +{ + setIsApplyAndClose( true ); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_GetSharedShapesDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + //initName(getNewObjectName()); + initName(getPrefixByType()); + + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void OperationGUI_GetSharedShapesDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); + + if (nbSel < 1) { + myListShapes.length(0); + } + + GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true); + if (!myListShapes.length()) + return; + + myEditCurrentArgument->setText(aString); + processPreview(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_GetSharedShapesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if (send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setEnabled(true); + } + + globalSelection(GEOM_ALLSHAPES); + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + send->setDown(true); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_GetSharedShapesDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked(getConstructorId()); + processPreview(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_GetSharedShapesDlg::enterEvent(QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} + +//======================================================================= +//function : ComboTextChanged +//purpose : +//======================================================================= +void OperationGUI_GetSharedShapesDlg::ComboTextChanged() +{ + //initName(getNewObjectName()); + initName(getPrefixByType()); + processPreview(); +} + +//================================================================================= +// function : GetType() +// purpose : +//================================================================================= +int OperationGUI_GetSharedShapesDlg::GetType() const +{ + int aLimit = GroupPoints->ComboBox1->currentIndex(); + + switch (aLimit) { + case 0: aLimit = GEOM::SOLID ; break; + case 1: aLimit = GEOM::SHELL ; break; + case 2: aLimit = GEOM::FACE ; break; + case 3: aLimit = GEOM::WIRE ; break; + case 4: aLimit = GEOM::EDGE ; break; + case 5: aLimit = GEOM::VERTEX; break; + default: aLimit = GEOM::SHAPE ; + } + + return aLimit; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_GetSharedShapesDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool OperationGUI_GetSharedShapesDlg::isValid (QString& msg) +{ + if (myListShapes.length() < 2) { + msg = tr("MSG_SHARED_SHAPES_TOO_FEW_SHAPES"); + return false; + } + return true; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_GetSharedShapesDlg::execute (ObjectList& objects) +{ + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); + GEOM::ListOfGO_var aList = anOper->GetSharedShapesMulti(myListShapes, GetType()); + + if (!aList->length()) + return false; + + if (aList->length() > 1) + myMainFrame->ResultName->setText(getPrefixByType()); + + for (int i = 0, n = aList->length(); i < n; i++) + objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); + + return objects.size(); +} + +//================================================================ +// Function : getFather +// Purpose : Get father object for object to be added in study +// ( called with addInStudy method ) +//================================================================ +GEOM::GEOM_Object_ptr OperationGUI_GetSharedShapesDlg::getFather (GEOM::GEOM_Object_ptr) +{ + if (myListShapes.length() > 0) + //return myListShapes[0]._retn(); + return myListShapes[0]; + return NULL; +} + +//================================================================ +// Function : getPrefixByType +// Purpose : +//================================================================ +QString OperationGUI_GetSharedShapesDlg::getPrefixByType () const +{ + QString aPref; + + int aLimit = GroupPoints->ComboBox1->currentIndex(); + + switch (aLimit) { + case 0: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SOLID")) ; break; + case 1: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHELL")) ; break; + case 2: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_FACE")) ; break; + case 3: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_WIRE")) ; break; + case 4: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_EDGE")) ; break; + case 5: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_VERTEX")); break; + default: aPref = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHAPE")) ; + } + + return aPref; +} diff --git a/src/OperationGUI/OperationGUI_GetSharedShapesDlg.h b/src/OperationGUI/OperationGUI_GetSharedShapesDlg.h new file mode 100644 index 000000000..11a7eadc8 --- /dev/null +++ b/src/OperationGUI/OperationGUI_GetSharedShapesDlg.h @@ -0,0 +1,72 @@ +// Copyright (C) 2007-2012 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 +// +// File : OperationGUI_GetSharedShapesDlg.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. + +#ifndef OPERATIONGUI_GETSHAREDSHAPESDLG_H +#define OPERATIONGUI_GETSHAREDSHAPESDLG_H + +#include + +class DlgRef_2Sel1List1Check; + +//================================================================================= +// class : OperationGUI_GetSharedShapesDlg +// purpose : +//================================================================================= +class OperationGUI_GetSharedShapesDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + OperationGUI_GetSharedShapesDlg (GeometryGUI*, QWidget* = 0); + ~OperationGUI_GetSharedShapesDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); + QString getPrefixByType() const; + +private: + void Init(); + void enterEvent (QEvent*); + int GetType() const; + +private: + GEOM::ListOfGO myListShapes; + + DlgRef_2Sel1List1Check* GroupPoints; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked (int); + void ComboTextChanged(); +}; + +#endif // OPERATIONGUI_GETSHAREDSHAPESDLG_H diff --git a/src/OperationGUI/OperationGUI_MaterialDlg.cxx b/src/OperationGUI/OperationGUI_MaterialDlg.cxx index 7474b761e..dfd5b1ae9 100644 --- a/src/OperationGUI/OperationGUI_MaterialDlg.cxx +++ b/src/OperationGUI/OperationGUI_MaterialDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_MaterialDlg.cxx // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -110,7 +111,7 @@ void OperationGUI_MaterialDlg::Init() QStringList labels; labels << GEOMBase::GetName( anObject ); labels << ( ind < myListMaterials.length() ? - QString::number( myListMaterials[ind] ) : QString( "0" ) ); + QString::number( myListMaterials[ind] ) : QString( "0" ) ); GroupPoints->ListView1->addTopLevelItem( new QTreeWidgetItem( labels ) ); } } @@ -124,7 +125,7 @@ void OperationGUI_MaterialDlg::Init() connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetMaterial() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } @@ -197,7 +198,7 @@ void OperationGUI_MaterialDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); return; } diff --git a/src/OperationGUI/OperationGUI_MaterialDlg.h b/src/OperationGUI/OperationGUI_MaterialDlg.h index a4ed8d65e..d40f50a28 100644 --- a/src/OperationGUI/OperationGUI_MaterialDlg.h +++ b/src/OperationGUI/OperationGUI_MaterialDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_MaterialDlg.h // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com) @@ -40,7 +41,7 @@ class OperationGUI_MaterialDlg : public GEOMBase_Skeleton public: OperationGUI_MaterialDlg( GeometryGUI*, QWidget*, GEOM::ListOfGO, - bool = false ); + bool = false ); ~OperationGUI_MaterialDlg(); private: diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index e52df271c..5c940f1ea 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : OperationGUI_PartitionDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "OperationGUI_PartitionDlg.h" #include @@ -34,12 +35,16 @@ #include #include #include +#include #include #include +#include +#include + //================================================================================= // class : OperationGUI_PartitionDlg() -// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the +// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -62,18 +67,19 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU mainFrame()->RadioButton3->close(); // Full partition (contains half-space partition) - GroupPoints = new DlgRef_2Sel1List1Check( centralWidget() ); + GroupPoints = new DlgRef_2Sel1List2Check( centralWidget() ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); - GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) ); GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) ); GroupPoints->PushButton1->setIcon( image2 ); GroupPoints->PushButton2->setIcon( image2 ); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - GroupPoints->LineEdit1->setEnabled(true); - GroupPoints->LineEdit2->setEnabled(false); + GroupPoints->LineEdit1->setEnabled( true ); + GroupPoints->LineEdit2->setEnabled( false ); GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) ); + GroupPoints->CheckButton2->setText( tr( "GEOM_NO_SELF_INTERSECTION" ) ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); @@ -82,7 +88,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU /***************************************************************/ setHelpFileName( "partition_page.html" ); - + Init(); } @@ -98,12 +104,12 @@ OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg() void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials ) { - myListMaterials = ListMaterials; + myListMaterials = ListMaterials; } - + GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials() -{ - return myListMaterials; +{ + return myListMaterials; } //================================================================================= @@ -112,15 +118,21 @@ GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials() //================================================================================= void OperationGUI_PartitionDlg::Init() { - /* type for sub shape selection */ + /* type for sub-shape selection */ GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SOLID" ) ); + GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::SOLID); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SHELL" ) ); + GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::SHELL); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_FACE" ) ); + GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::FACE); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_WIRE" ) ); + GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::WIRE); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_EDGE" ) ); + GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::EDGE); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) ); + GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX); GroupPoints->CheckButton1->setChecked( false ); - + mainFrame()->GroupBoxPublish->show(); /* signals and slots connections */ @@ -128,18 +140,21 @@ void OperationGUI_PartitionDlg::Init() connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); - + connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - + connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - + connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); + connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); + initName( tr( "GEOM_PARTITION" ) ); ConstructorsClicked( 0 ); @@ -155,21 +170,23 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId ) { disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); globalSelection(); - - myListShapes.length( 0 ); - myListTools.length( 0 ); - myListKeepInside.length( 0 ); - myListRemoveInside.length( 0 ); - myListMaterials.length( 0 ); - + + //myListShapes.length( 0 ); + //myListTools.length( 0 ); + //myListKeepInside.length( 0 ); // obsolete + //myListRemoveInside.length( 0 ); // obsolete + //myListMaterials.length( 0 ); // obsolete + switch ( constructorId ) { case 0: /*Full partition */ GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); - GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); + GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) ); GroupPoints->TextLabel3->show(); GroupPoints->ComboBox1->show(); GroupPoints->ComboBox1->setCurrentIndex( 0 ); GroupPoints->CheckButton1->show(); + GroupPoints->CheckButton2->show(); GroupPoints->PushButton1->setDown( true ); GroupPoints->PushButton2->setDown( false ); GroupPoints->LineEdit1->setEnabled(true); @@ -179,12 +196,14 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId ) GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) ); GroupPoints->TextLabel3->hide(); GroupPoints->ComboBox1->hide(); + GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECT" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) ); GroupPoints->CheckButton1->hide(); + GroupPoints->CheckButton2->hide(); GroupPoints->PushButton1->setDown( true ); GroupPoints->LineEdit1->setEnabled(true); break; - } + } myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->clear(); @@ -195,8 +214,9 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId ) resize( minimumSizeHint() ); myEditCurrentArgument->setFocus(); - connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SelectionIntoArgument(); } @@ -206,6 +226,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId ) //================================================================================= void OperationGUI_PartitionDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -219,9 +240,10 @@ bool OperationGUI_PartitionDlg::ClickOnApply() { if ( !onAccept() ) return false; - + initName(); - ConstructorsClicked( getConstructorId() ); + // 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window + // ConstructorsClicked( getConstructorId() ); return true; } @@ -234,34 +256,52 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); QString aString = ""; - + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); - - if ( nbSel < 1 ) { - if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { - myListShapes.length( 0 ); - myListMaterials.length( 0 ); + + if ( getConstructorId() == 1 ) { + // for half-selection, only one shape can be selected as an object + // and only one plane as a tool + if ( nbSel != 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myListShapes.length( 0 ); + // myListMaterials.length( 0 ); // obsolete + return; + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + myListTools.length( 0 ); + return; + } } - else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) - myListTools.length( 0 ); } - - // One and only one plane can be selected - - if ( getConstructorId() == 1 && - myEditCurrentArgument == GroupPoints->LineEdit2 && - nbSel != 1 ) { - myListTools.length( 0 ); - return; + else { + if ( nbSel < 1 ) { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myListShapes.length( 0 ); + //myListMaterials.length( 0 ); // obsolete + return; + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + myListTools.length( 0 ); + return; + } + } } - + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true); - myListMaterials.length( 0 ); + //myListMaterials.length( 0 ); // obsolete + + GEOM::shape_type type = GEOM::SHAPE; + for (int i = 0; i < myListShapes.length(); i++) + type = qMin( type, myListShapes[i]->GetMaxShapeType() ); + int idx = qMax( 0, GroupPoints->ComboBox1->findData( type ) ); + GroupPoints->ComboBox1->setCurrentIndex( idx ); + if ( !myListShapes.length() ) return; } @@ -269,9 +309,21 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListTools, true); if ( !myListTools.length() ) return; + else if ( myListTools.length() == 1 && getConstructorId() == 1 ) { + GEOM::GEOM_IMeasureOperations_var mOp = getGeomEngine()->GetIMeasureOperations( getStudyId() ); + GEOM::ListOfLong_var intList; + GEOM::ListOfDouble_var dblList; + GEOM::GEOM_IKindOfShape::shape_kind kind = mOp->KindOfShape( myListTools[0].in(), intList.out(), dblList.out() ); + mOp->UnRegister(); + if ( kind < GEOM::GEOM_IKindOfShape::DISK_CIRCLE || kind > GEOM::GEOM_IKindOfShape::PLANAR ) { + myListTools.length( 0 ); + return; + } + } } - + myEditCurrentArgument->setText( aString ); + processPreview(); } @@ -282,7 +334,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() void OperationGUI_PartitionDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->PushButton2->setDown(false); @@ -298,12 +350,13 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument() if ( getConstructorId() == 1 ) globalSelection( GEOM_PLANE ); } - + globalSelection( GEOM_ALLSHAPES ); - + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); send->setDown(true); + processPreview(); } @@ -315,7 +368,7 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 || + if ( send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); @@ -330,10 +383,11 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed() void OperationGUI_PartitionDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - ConstructorsClicked( getConstructorId() ); + ConstructorsClicked( getConstructorId() ); + processPreview(); } @@ -362,10 +416,11 @@ GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool OperationGUI_PartitionDlg::isValid( QString& ) +bool OperationGUI_PartitionDlg::isValid (QString& ) { - return ( myListShapes.length() || myListTools.length() || - myListKeepInside.length() || myListRemoveInside.length() ); + return (getConstructorId() == 0 ? + myListShapes.length() : + myListShapes.length() && myListTools.length()); } @@ -373,40 +428,54 @@ bool OperationGUI_PartitionDlg::isValid( QString& ) // function : execute // purpose : //================================================================================= -bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) +bool OperationGUI_PartitionDlg::execute (ObjectList& objects) { bool res = false; - GEOM::GEOM_Object_var anObj; - QString msg; - int aLimit = GetLimit(); - int aConstructorId = getConstructorId(); - int aKeepNonlimitShapes = 0; - - if ( aConstructorId == 1 ) { - aLimit = GEOM::SHAPE; - } - else { - if ( GroupPoints->CheckButton1->isChecked() ) { - aKeepNonlimitShapes = 1; + GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); + + switch ( getConstructorId() ) { + case 0: + { + int aLimit = GetLimit(); + int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked(); + bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked(); + + anObj = aNoSelfIntersection ? + anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools, + myListKeepInside, myListRemoveInside, + aLimit, false, myListMaterials, aKeepNonlimitShapes) : + anOper->MakePartition(myListShapes, myListTools, + myListKeepInside, myListRemoveInside, + aLimit, false, myListMaterials, aKeepNonlimitShapes); + res = true; } - else { - aKeepNonlimitShapes = 0; + break; + case 1: + { + anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() ); + res = true; } + break; } - if ( isValid( msg ) ) { - anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )-> - MakePartition( myListShapes, myListTools, - myListKeepInside, myListRemoveInside, - aLimit, false, myListMaterials, aKeepNonlimitShapes ); - res = true; + if ( !anObj->_is_nil() ) { + TopoDS_Shape aShape; + GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ); + TopoDS_Iterator It( aShape, Standard_True, Standard_True ); + int nbSubshapes = 0; + for (; It.More(); It.Next()) + nbSubshapes++; + + if ( nbSubshapes ) + objects.push_back( anObj._retn() ); + else + SUIT_MessageBox::warning( this, + QObject::tr( "GEOM_ERROR" ), + QObject::tr( "GEOM_WRN_PARTITION_RESULT_EMPTY" ) ); } - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - return res; } @@ -420,14 +489,15 @@ void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) { // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(), - /*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory, - /*theInheritFirstArg=*/myListShapes.length() == 1 ); // ? false + /*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory, + /*theInheritFirstArg=*/myListShapes.length() == 1, + mainFrame()->CheckBoxAddPrefix->isChecked() ); // ? false } } //======================================================================= //function : ComboTextChanged -//purpose : +//purpose : //======================================================================= void OperationGUI_PartitionDlg::ComboTextChanged() { @@ -438,11 +508,12 @@ void OperationGUI_PartitionDlg::ComboTextChanged() //GroupPoints->TextLabel5->setEnabled(IsEnabled); //GroupPoints->PushButton3->setEnabled(IsEnabled); //GroupPoints->PushButton4->setEnabled(IsEnabled); + processPreview(); } //================================================================================= // function : GetLimit() -// purpose : +// purpose : //================================================================================= int OperationGUI_PartitionDlg::GetLimit() const { diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.h b/src/OperationGUI/OperationGUI_PartitionDlg.h index a540a05eb..7bd209796 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.h +++ b/src/OperationGUI/OperationGUI_PartitionDlg.h @@ -1,47 +1,46 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : OperationGUI_PartitionDlg.h -// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : OperationGUI_PartitionDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + #ifndef OPERATIONGUI_PARTITIONDLG_H #define OPERATIONGUI_PARTITIONDLG_H #include -class DlgRef_2Sel1List1Check; +class DlgRef_2Sel1List2Check; //================================================================================= // class : OperationGUI_PartitionDlg // purpose : //================================================================================= class OperationGUI_PartitionDlg : public GEOMBase_Skeleton -{ +{ Q_OBJECT public: OperationGUI_PartitionDlg( GeometryGUI*, QWidget* = 0 ); ~OperationGUI_PartitionDlg(); - + void SetListMaterials( GEOM::ListOfLong ); GEOM::ListOfLong GetListMaterials(); @@ -64,7 +63,7 @@ private: GEOM::ListOfGO myListRemoveInside; GEOM::ListOfGO myListKeepInside; - DlgRef_2Sel1List1Check* GroupPoints; + DlgRef_2Sel1List2Check* GroupPoints; private slots: void ClickOnOk(); diff --git a/src/PARTITION/Makefile.in b/src/PARTITION/Makefile.in deleted file mode 100644 index eee795478..000000000 --- a/src/PARTITION/Makefile.in +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2007-2008 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 PARTITION : partition algorithm -# File : Makefile.in -# Author : Marc Tajchman (CEA) -# Module : GEOM -# $Header$ -# -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@ - - -@COMMENCE@ - -# Libraries targets -LIB = libGEOMPartition.la -LIB_SRC = Partition_Inter2d.cxx \ - Partition_Inter3d.cxx \ - Partition_Loop2d.cxx \ - Partition_Loop3d.cxx \ - Partition_Spliter.cxx - -LIB_CLIENT_IDL = -LIB_SERVER_IDL = - -# header files -EXPORT_HEADERS = Partition_Spliter.hxx \ - Partition_Inter3d.hxx - -# idl files -EXPORT_IDLS= - - -CPPFLAGS += $(OCC_INCLUDES) $(KERNEL_CXXFLAGS) -CXXFLAGS += $(OCC_CXXFLAGS) $(KERNEL_CXXFLAGS) -LDFLAGS += $(CAS_LDPATH) -lTKBool $(KERNEL_LDFLAGS) - -%_moc.cxx: %.h - $(MOC) $< -o $@ - -@CONCLUDE@ diff --git a/src/PARTITION/Partition.cdl b/src/PARTITION/Partition.cdl deleted file mode 100644 index 1f4c8ed30..000000000 --- a/src/PARTITION/Partition.cdl +++ /dev/null @@ -1,42 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File : Partition.cdl --- Author : Benedicte MARTIN --- Module : GEOM - -package Partition - -uses - TopoDS, - TopTools, - TopAbs, - BRepAlgo, - BRep, - gp -is - class Spliter; - class Inter3d; - class Inter2d; - class Loop2d; - class Loop3d; - -end Partition; diff --git a/src/PARTITION/Partition_Inter2d.cdl b/src/PARTITION/Partition_Inter2d.cdl deleted file mode 100644 index 31ed37847..000000000 --- a/src/PARTITION/Partition_Inter2d.cdl +++ /dev/null @@ -1,89 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File : Partition_Inter2d.cdl --- Author : Benedicte MARTIN --- Module : GEOM - -class Inter2d from Partition - - ---Purpose: Computes the intersections between edges on a face - -- stores result is SD as AsDes from BRepAlgo. - -uses - AsDes from BRepAlgo, - Edge from TopoDS, - Face from TopoDS, - Vertex from TopoDS, - MapOfShape from TopTools, - Real from Standard, - ListOfShape from TopTools - -is - CompletPart2d(myclass ; AsDes : mutable AsDes from BRepAlgo; - F : Face from TopoDS; - NewEdges : MapOfShape from TopTools); - - ---Purpose: Computes the intersections between the edges stored - -- is AsDes as descendants of . Intersections is computed - -- between two edges if one of them is bound in NewEdges. - - - FindEndVertex(myclass; VertList : ListOfShape from TopTools; - f,l : Real from Standard; - E : Edge from TopoDS; - First : out Boolean from Standard; - DU : out Real from Standard) - returns Vertex from TopoDS; - ---Purpose: Returns a vertex from having parameter on - -- most close to or . is True if - -- found vertex is closer to . returns parameter - -- difference. - - AddVonE(myclass; V : Vertex from TopoDS; - E1,E2 : Edge from TopoDS; - AsDes : mutable AsDes from BRepAlgo; - F: Face from TopoDS) - returns Vertex from TopoDS; - ---Purpose: Put V in AsDes as intersection of E1 and E2. - -- Check that vertex equal to V already exists on one - -- of edges, in such a case, V is not added but - -- existing vertex is updated to be on E1 and E2 and - -- is returned insead of V. - -- Optional F is a face E1 and E2 are on. If F is - -- provided, it is used to find new vertices on E1 - -- and E2 resulting from intersection of new edges on - -- the two other faces the F interferes with and - -- through which E1 and E2 pass too. This helps to - -- avoid small edges. - - - GetTolerance(myclass; theV : Vertex from TopoDS; - theU : Real from Standard; - theE : Edge from TopoDS; - theAsDes : AsDes from BRepAlgo) - returns Real from Standard; - ---Purpose: Returns tolerance theV must have atfer its - -- addition to theE with theU parameter. theAsDes is - -- used to find pcurves of theE - -end Inter2d; - diff --git a/src/PARTITION/Partition_Inter2d.cxx b/src/PARTITION/Partition_Inter2d.cxx deleted file mode 100644 index 4469bb5b8..000000000 --- a/src/PARTITION/Partition_Inter2d.cxx +++ /dev/null @@ -1,673 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter2d.cxx -// Author : Benedicte MARTIN -// Module : GEOM -// $Header$ -// -#include "Partition_Inter2d.ixx" - -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef DEB -static Standard_Boolean TestEdges = 0; -static Standard_Integer NbF2d = 0; -static Standard_Integer NbE2d = 0; -#endif - -using namespace std; - -//======================================================================= -//function : getOtherShape -//purpose : -//======================================================================= - -static TopoDS_Shape getOtherShape(const TopoDS_Shape& theS, - const TopTools_ListOfShape& theSList) -{ - TopTools_ListIteratorOfListOfShape anIt( theSList ); - for ( ; anIt.More(); anIt.Next() ) - if (!theS.IsSame( anIt.Value() )) - return anIt.Value(); - - return TopoDS_Shape(); -} - -//======================================================================= -//function : findVOnE -//purpose : on theE, find a vertex close to theV, such that an edge -// passing through it is an itersection of theF1 and theF2. -// theE intersects theE2 at theV -//======================================================================= - -static Standard_Boolean findVOnE(const TopoDS_Vertex & theV, - const TopoDS_Edge& theE, - const TopoDS_Edge& theE2, - const TopoDS_Shape& theF1, - const TopoDS_Shape& theF2, - const Handle(BRepAlgo_AsDes)& theAsDes, - TopoDS_Vertex & theFoundV) -{ - Standard_Real MinDist2 = ::RealLast(); - gp_Pnt P; - - // check all vertices on theE - const TopTools_ListOfShape& aVList = theAsDes->Descendant( theE ); - TopTools_ListIteratorOfListOfShape anIt( aVList ); - if (anIt.More()) - P = BRep_Tool::Pnt( theV ); - for ( ; anIt.More(); anIt.Next() ) - { - // check by distance - TopoDS_Vertex & V = TopoDS::Vertex( anIt.Value() ); - Standard_Real dist2 = P.SquareDistance( BRep_Tool::Pnt( V )); - if (dist2 < MinDist2) - MinDist2 = dist2; - else - continue; - - // V is a candidate if among edges passing through V there is one - // which is an intersection of theF1 and theF2 - TopTools_ListIteratorOfListOfShape anEIt( theAsDes->Ascendant( V )); - Standard_Boolean isOk = Standard_False; - for ( ; !isOk && anEIt.More(); anEIt.Next() ) - { - const TopoDS_Shape & E2 = anEIt.Value(); - if ( theE2.IsSame( E2 )) - continue; - const TopTools_ListOfShape & aFList = theAsDes->Ascendant( E2 ); - if (aFList.IsEmpty()) - continue; - if ( theF1.IsSame( aFList.First() )) - isOk = theF2.IsSame( aFList.Last() ); - else - isOk = theF2.IsSame( aFList.First() ) && theF1.IsSame( aFList.Last() ); - } - if (isOk) - theFoundV = V; - } - - if (theFoundV.IsNull()) - return Standard_False; - - // check that MinDist2 is not too large - Standard_Real f, l; - TopLoc_Location L; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve( theE, L, f, l ); - gp_Pnt P1 = aCurve->Value( f ); - gp_Pnt P2 = aCurve->Value( 0.3 * f + 0.7 * l ); - //gp_Pnt P2 = aCurve->Value( 0.5 * ( f + l )); - if (MinDist2 > P1.SquareDistance( P2 )) - return Standard_False; - -#ifdef DEB - MESSAGE("findVOnE: found MinDist = " << sqrt (MinDist2)); -#endif - - return Standard_True; -} - -//======================================================================= -//function : AddVonE -//purpose : Put V in AsDes as intersection of E1 and E2. -// Check that vertex equal to V already exists on one -// of edges, in such a case, V is not added but -// existing vertex is updated to be on E1 and E2 and -// is returned insead of V. -//======================================================================= - -TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV, - const TopoDS_Edge& E1, - const TopoDS_Edge& E2, - const Handle(BRepAlgo_AsDes)& AsDes, - const TopoDS_Face& theF) - -{ - //------------------------------------------------------------- - // test if the points of intersection already exist. If not, - // add as descendants of the edges. - // nb: theses points are only vertices of intersection. - //------------------------------------------------------------- - const TopTools_ListOfShape& VOnE1 = AsDes->Descendant(E1); - const TopTools_ListOfShape& VOnE2 = AsDes->Descendant(E2); - gp_Pnt P1,P2; - TopoDS_Vertex V1,V2; - TopTools_ListIteratorOfListOfShape it; - BRep_Builder B; - TopAbs_Orientation O1,O2; - Standard_Real U1,U2; - Standard_Real Tol,Tol1,Tol2; - Standard_Boolean OnE1,OnE2; - - TopoDS_Vertex V = theV; - - U1 = BRep_Tool::Parameter(V,E1); - U2 = BRep_Tool::Parameter(V,E2); - O1 = V.Orientation(); - O2 = O1; - P1 = BRep_Tool::Pnt(V); - Tol = BRep_Tool::Tolerance( V ); - OnE1 = OnE2 = Standard_False; - - //----------------------------------------------------------------- - // Search if the point of intersection is a vertex of E1. - //----------------------------------------------------------------- - for (it.Initialize(VOnE1); it.More(); it.Next()) { - const TopoDS_Vertex& CV = TopoDS::Vertex( it.Value() ); - if (V.IsSame( CV )) { - V1 = V; - OnE1 = Standard_True; - break; - } - P2 = BRep_Tool::Pnt( CV ); - Tol1 = 1.1*(Tol + BRep_Tool::Tolerance( CV )); - if (P1.SquareDistance(P2) <= Tol1*Tol1) { - V = CV; - V1 = V; - OnE1 = Standard_True; - break; - } - } - if (OnE1) { - //----------------------------------------------------------------- - // Search if the vertex found is still on E2. - //----------------------------------------------------------------- - for (it.Initialize(VOnE2); it.More(); it.Next()) { - if (V.IsSame( it.Value() )) { - OnE2 = Standard_True; - V2 = V; - break; - } - } - } - if (!OnE2) { - for (it.Initialize(VOnE2); it.More(); it.Next()) { - //----------------------------------------------------------------- - // Search if the point of intersection is a vertex of E2. - //----------------------------------------------------------------- - const TopoDS_Vertex& CV = TopoDS::Vertex( it.Value() ); - P2 = BRep_Tool::Pnt( CV ); - Tol2 = 1.1*(Tol + BRep_Tool::Tolerance( CV )); - if (P1.SquareDistance(P2) <= Tol2*Tol2) { - V = CV; - V2 = V; - OnE2 = Standard_True; - break; - } - } - } - - - if (!OnE1 && !OnE2 && !theF.IsNull()) - { - // if 3 faces intersects each others, 3 new edges on them must pass - // through one vertex but real intersection points of each - // pair of edges are sometimes more far than a tolerance. - // Try to analitically find vertices that E1 and E2 must pass trough - - TopoDS_Shape F1 = getOtherShape( theF, AsDes->Ascendant( E1 )); - TopoDS_Shape F2 = getOtherShape( theF, AsDes->Ascendant( E2 )); - if (!F1.IsNull() && !F2.IsNull() && !F1.IsSame( F2 )) - { - OnE1 = findVOnE ( theV, E1, E2, F1, F2, AsDes, V1 ); - OnE2 = findVOnE ( theV, E2, E1, F1, F2, AsDes, V2 ); - if (OnE2) V = V2; - if (OnE1) V = V1; - } - } - - if (OnE1 && OnE2) { - if (!V1.IsSame(V2)) { - // replace V1 with V2 on all edges V1 is on - Standard_Real UV1; - TopoDS_Edge EWE1; - TopoDS_Vertex VI; - const TopTools_ListOfShape& EdgeWithV1 = AsDes->Ascendant(V1); - - for (it.Initialize(EdgeWithV1); it.More(); it.Next()) { - EWE1 = TopoDS::Edge(it.Value()); - VI = V1; - VI.Orientation(TopAbs_INTERNAL); - UV1 = BRep_Tool::Parameter(VI,EWE1); - VI = V2; - VI.Orientation(TopAbs_INTERNAL); - B.UpdateVertex( VI, UV1, EWE1, GetTolerance( VI, UV1, EWE1, AsDes)); - } - AsDes->Replace(V1,V2); - V = V2; - } - } - - // add existing vertices instead of new ones - if (!OnE1) { - if (OnE2) { - V.Orientation(TopAbs_INTERNAL); - B.UpdateVertex (V, U1, E1, GetTolerance( V, U1, E1, AsDes)); - } - V.Orientation(O1); - AsDes->Add(E1,V); - } - if (!OnE2) { - if (OnE1) { - V.Orientation(TopAbs_INTERNAL); - B.UpdateVertex (V, U2, E2, GetTolerance( V, U2, E2, AsDes )); - } - V.Orientation(O2); - AsDes->Add(E2,V); - } - - return V; -} - -//======================================================================= -//function : FindEndVertex -//purpose : Returns a vertex from having parameter on -// closest to or . is True if -// found vertex is closer to . returns parameter -// difference. -//======================================================================= - -TopoDS_Vertex Partition_Inter2d::FindEndVertex(const TopTools_ListOfShape& LV, - const Standard_Real f, - const Standard_Real l, - const TopoDS_Edge& E, - Standard_Boolean& isFirst, - Standard_Real& minDU) -{ - TopoDS_Vertex endV; - Standard_Real U, endU, min; - minDU = 1.e10; - - TopTools_ListIteratorOfListOfShape it; - it.Initialize(LV); - for (; it.More(); it.Next()) { - const TopoDS_Vertex& v = TopoDS::Vertex(it.Value()); - U = BRep_Tool::Parameter(v, E); - min = Min( Abs(U-f), Abs(U-l) ); - if (min < minDU) { - endV = v; - endU = U; - minDU = min; - } - } - if (Abs(endU-f) < Abs(endU-l)) - isFirst = Standard_True; - else - isFirst = Standard_False; - - return endV; -} - -//======================================================================= -//function : treatClosed -//purpose : add second vertex to closed edge. Vertex is one of -//======================================================================= - -static void treatClosed (const TopoDS_Edge& E1, - const Standard_Real f, - const Standard_Real l, - TopTools_ListOfShape& LV1, - TopTools_ListOfShape& /*LV2*/) -{ - Standard_Boolean isFirst=0; - Standard_Real minDU = 1.e10; - TopoDS_Vertex endV; - endV = Partition_Inter2d::FindEndVertex(LV1, f,l, E1, isFirst,minDU); - - if (minDU > Precision::PConfusion()) - return; // not end point - - Standard_Real newU; - if (isFirst) - newU = f + (l - f); - else - newU = l - (l - f); - - // update end parameter - BRep_Builder B; - endV.Orientation(TopAbs_INTERNAL); - B.UpdateVertex(endV,newU,E1,BRep_Tool::Tolerance(endV)); -} - -//======================================================================= -//function : EdgesPartition -//purpose : -//======================================================================= - -static void EdgesPartition(const TopoDS_Face& F, - const TopoDS_Edge& E1, - const TopoDS_Edge& E2, - const Handle(BRepAlgo_AsDes)& AsDes, - const TopTools_MapOfShape& NewEdges, - const Standard_Boolean WithOri) -{ - - Standard_Real f[3],l[3]; - Standard_Real MilTol2; - Standard_Real Tol = Max (BRep_Tool::Tolerance(E1), - BRep_Tool::Tolerance(E2)); - MilTol2 = Tol * Tol * 10; - - BRep_Tool::Range(E1, f[1], l[1]); - BRep_Tool::Range(E2, f[2], l[2]); - - BRepAdaptor_Curve CE1(E1,F); - BRepAdaptor_Curve CE2(E2,F); - - TopoDS_Edge EI[3]; EI[1] = E1; EI[2] = E2; - TopTools_ListOfShape LV1; // new vertices at intersections on E1 - TopTools_ListOfShape LV2; // ... on E2 - BRep_Builder B; - - // if E1 and E2 are results of intersection of F and two connex faces then - // no need to intersect edges, they can contact by vertices only - // (encounted an exception in TopOpeBRep_EdgesIntersector in such a case) - Standard_Boolean intersect = Standard_True; - TopTools_IndexedMapOfShape ME; - TopExp::MapShapes(F, TopAbs_EDGE, ME); - if (!ME.Contains(E1) && ! ME.Contains(E2)) { // if E1 and E2 are new on F - TopoDS_Shape F1, F2; - const TopTools_ListOfShape& LF1 = AsDes->Ascendant( E1 ); - F1 = F.IsSame( LF1.First() ) ? LF1.Last() : LF1.First(); - const TopTools_ListOfShape& LF2 = AsDes->Ascendant( E2 ); - F2 = F.IsSame( LF2.First() ) ? LF2.Last() : LF2.First(); - if (!F.IsSame(F2) && !F.IsSame(F1) ) { - TopExp_Explorer exp(F2, TopAbs_EDGE); - TopExp::MapShapes(F1, TopAbs_EDGE, ME); - for (; exp.More(); exp.Next()) { - if (ME.Contains( exp.Current())) { - intersect = Standard_False; - break; - } - } - } - } - - if (intersect) { - //------------------------------------------------------ - // compute the points of Intersection in 2D - //----------------------------------------------------- - // i.e. fill LV1 and LV2 - TopOpeBRep_EdgesIntersector EInter; - EInter.SetFaces(F,F); - Standard_Real TolDub = 1.e-7; - EInter.ForceTolerances(TolDub,TolDub); - Standard_Boolean reducesegments = Standard_False; - EInter.Perform (E1,E2,reducesegments); - - Standard_Boolean rejectreducedsegmentpoints = Standard_False; - EInter.InitPoint(rejectreducedsegmentpoints); - for ( ; EInter.MorePoint(); EInter.NextPoint() ) - { - const TopOpeBRep_Point2d& P2D = EInter.Point(); - const gp_Pnt& P = P2D.Value(); - TopoDS_Vertex V = BRepLib_MakeVertex(P); - - //------------------------- - // control the point found. - //------------------------- - gp_Pnt P1 = CE1.Value(P2D.Parameter(1)); - gp_Pnt P2 = CE2.Value(P2D.Parameter(2)); - Standard_Real sqd1 = P1.SquareDistance(P); - Standard_Real sqd2 = P2.SquareDistance(P); - if (sqd1 > MilTol2 || sqd2 > MilTol2 ) - continue; - - // add a new vertex to the both edges - Standard_Real toler = Max( Tol, sqrt( Max( sqd1, sqd2 ))); - Standard_Integer i; - for (i = 1; i <= 2; i++) { - Standard_Real U = P2D.Parameter(i); - V.Orientation(TopAbs_INTERNAL); - B.UpdateVertex( V,U,EI[i], toler); - TopAbs_Orientation OO = TopAbs_REVERSED; - if (WithOri) { - if (P2D.IsVertex(i)) - OO = P2D.Vertex(i).Orientation(); - else if (P2D.Transition(i).Before() == TopAbs_OUT) { - OO = TopAbs_FORWARD; - } - V.Orientation(OO); - if (i == 1) LV1.Append(V); - else LV2.Append(V); - } - } - } - } // if (intersect) - - //---------------------------------- - // Test the extremities of the edges. - //---------------------------------- - // add to LV* vertices for vertex-vertex closeness - Standard_Real U1,U2; - Standard_Real TolConf2, TolConf; - TopoDS_Vertex V1[2],V2[2]; - TopExp::Vertices(E1,V1[0],V1[1]); - TopExp::Vertices(E2,V2[0],V2[1]); - - Standard_Integer i,j,k; - for (j = 0; j < 2; j++) { - if (V1[j].IsNull()) continue; - for ( k = 0; k < 2; k++) { - if (V2[k].IsNull()) continue; - gp_Pnt P1 = BRep_Tool::Pnt(V1[j]); - gp_Pnt P2 = BRep_Tool::Pnt(V2[k]); - TolConf = BRep_Tool::Tolerance(V1[j]) + BRep_Tool::Tolerance(V2[k]); - TolConf = Max (Tol, TolConf); - TolConf2 = TolConf * TolConf; - if (!intersect) - TolConf2 *= 100; - Standard_Real SqDist = P1.SquareDistance(P2); - - if (SqDist <= TolConf2) { - TopoDS_Vertex V = BRepLib_MakeVertex(P1); - V.Orientation(TopAbs_INTERNAL); - U1 = (j == 0) ? f[1] : l[1]; - U2 = (k == 0) ? f[2] : l[2]; - B.UpdateVertex(V,U1,E1,TolConf); - B.UpdateVertex(V,U2,E2,TolConf); - LV1.Prepend(V.Oriented(V1[j].Orientation())); - LV2.Prepend(V.Oriented(V2[k].Orientation())); - } - } - } - - Standard_Boolean AffichPurge = Standard_False; - - if ( LV1.IsEmpty()) return; - - //---------------------------------- - // Purge of all the vertices. - //---------------------------------- - // remove one of close vertices - TopTools_ListIteratorOfListOfShape it1LV1,it1LV2,it2LV1; - gp_Pnt P1,P2; - Standard_Boolean Purge = Standard_True; - - while (Purge) { - i = 1; - Purge = Standard_False; - for (it1LV1.Initialize(LV1),it1LV2.Initialize(LV2); - it1LV1.More(); - it1LV1.Next(),it1LV2.Next()) { - j = 1; - it2LV1.Initialize(LV1); - while (j < i) { - const TopoDS_Vertex& VE1 = TopoDS::Vertex(it1LV1.Value()); - const TopoDS_Vertex& VE2 = TopoDS::Vertex(it2LV1.Value()); - Standard_Real Tol1 = BRep_Tool::Tolerance( VE1 ); - Standard_Real Tol2 = BRep_Tool::Tolerance( VE2 ); - P1 = BRep_Tool::Pnt( VE1 ); - P2 = BRep_Tool::Pnt( VE2 ); - if (P1.IsEqual(P2, Tol1 + Tol2)) { - LV1.Remove(it1LV1); - LV2.Remove(it1LV2); - Purge = Standard_True; - break; - } - j++; - it2LV1.Next(); - } - if (Purge) break; - i++; - } - } - - // care of new closed edges, they always intersect with seam at end - if (V1[0].IsSame( V1[1] ) && NewEdges.Contains(E1) ) - treatClosed (E1, f[1], l[1], LV1, LV2); - if (V2[0].IsSame( V2[1] ) && NewEdges.Contains(E2) ) - treatClosed (E2, f[2], l[2], LV2, LV1); - - //---------------- - // Stocking vertex - //---------------- - - for ( it1LV1.Initialize( LV1 ); it1LV1.More(); it1LV1.Next()) - Partition_Inter2d::AddVonE (TopoDS::Vertex( it1LV1.Value()), - E1, E2, AsDes, F); -} - -//======================================================================= -//function : CompletPart2d -//purpose : Computes the intersections between the edges stored -// is AsDes as descendants of . Intersections is computed -// between two edges if one of them is bound in NewEdges. -//======================================================================= - -void Partition_Inter2d::CompletPart2d (const Handle(BRepAlgo_AsDes)& AsDes, - const TopoDS_Face& F, - const TopTools_MapOfShape& NewEdges) -{ - -#ifdef DEB - NbF2d++; - NbE2d = 0; -#endif - - //Do not intersect the edges of a face - TopTools_IndexedMapOfShape EdgesOfFace; - TopExp::MapShapes( F, TopAbs_EDGE , EdgesOfFace); - - //------------------------------------------------------------------- - // compute the intersection2D on the faces touched by the intersection3D - //------------------------------------------------------------------- - TopTools_ListIteratorOfListOfShape it1LE ; - TopTools_ListIteratorOfListOfShape it2LE ; - - //----------------------------------------------- - // Intersection edge-edge. - //----------------------------------------------- - const TopTools_ListOfShape& LE = AsDes->Descendant(F); - TopoDS_Vertex V1,V2; - Standard_Integer j, i = 1; - - TopoDS_Face FF = F; - FF.Orientation(TopAbs_FORWARD); - - for ( it1LE.Initialize(LE) ; it1LE.More(); it1LE.Next()) { - const TopoDS_Edge& E1 = TopoDS::Edge(it1LE.Value()); - j = 1; - it2LE.Initialize(LE); - - while (j < i && it2LE.More()) { - const TopoDS_Edge& E2 = TopoDS::Edge(it2LE.Value()); - //---------------------------------------------------------- - // Intersections of the new edges obtained by intersection - // between them and with the restrictions edges - //---------------------------------------------------------- - if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) && - (NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) { - EdgesPartition(FF,E1,E2,AsDes,NewEdges,Standard_True); - } - it2LE.Next(); - j++; - } - i++; - } -} - -//======================================================================= -//function : GetTolerance -//purpose : Returns tolerance theV must have atfer its -// addition to theE with theU parameter. theAsDes is -// used to find pcurves of theE -//======================================================================= - -Standard_Real Partition_Inter2d::GetTolerance - (const TopoDS_Vertex & theV, - const Standard_Real theU, - const TopoDS_Edge & theE, - const Handle(BRepAlgo_AsDes)& theAsDes) -{ - Standard_Real aTol = BRep_Tool::Tolerance( theV ); - gp_Pnt aPnt = BRep_Tool::Pnt( theV ); - - // check point on 3D curve - Standard_Real f,l; - Handle(Geom_Curve) C = BRep_Tool::Curve( theE, f, l ); - if (!C.IsNull()) - aTol = Max ( aTol, aPnt.Distance( C->Value( theU ))); - - // check points on pcurves - const TopTools_ListOfShape& aFList = theAsDes->Ascendant( theE ); - TopTools_ListIteratorOfListOfShape aFIt( aFList ); - for ( ; aFIt.More(); aFIt.Next() ) - { - const TopoDS_Face& F = TopoDS::Face( aFIt.Value() ); - Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( theE, F, f, l ); - if (!pcurve.IsNull()) - { - gp_Pnt2d aPnt2d = pcurve->Value( theU ); - TopLoc_Location L; - Handle(Geom_Surface) S = BRep_Tool::Surface( F, L ); - gp_Pnt aPntOnS = S->Value( aPnt2d.X(), aPnt2d.Y() ); - if (!L.IsIdentity()) - aPntOnS.Transform( L.Transformation() ); - aTol = Max ( aTol, aPnt.Distance( aPntOnS )); - } - } - - return aTol; -} diff --git a/src/PARTITION/Partition_Inter2d.hxx b/src/PARTITION/Partition_Inter2d.hxx deleted file mode 100644 index 5942fcf14..000000000 --- a/src/PARTITION/Partition_Inter2d.hxx +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter2d.hxx -// Module : GEOM -// -#ifndef _Partition_Inter2d_HeaderFile -#define _Partition_Inter2d_HeaderFile - -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class BRepAlgo_AsDes; -class TopoDS_Face; -class TopTools_MapOfShape; -class TopoDS_Vertex; -class TopTools_ListOfShape; -class TopoDS_Edge; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class Partition_Inter2d { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static void CompletPart2d(const Handle(BRepAlgo_AsDes)& AsDes,const TopoDS_Face& F,const TopTools_MapOfShape& NewEdges) ; -Standard_EXPORT static TopoDS_Vertex FindEndVertex(const TopTools_ListOfShape& VertList,const Standard_Real f,const Standard_Real l,const TopoDS_Edge& E,Standard_Boolean& First,Standard_Real& DU) ; -Standard_EXPORT static TopoDS_Vertex AddVonE(const TopoDS_Vertex& V,const TopoDS_Edge& E1,const TopoDS_Edge& E2,const Handle(BRepAlgo_AsDes)& AsDes,const TopoDS_Face& F) ; -Standard_EXPORT static Standard_Real GetTolerance(const TopoDS_Vertex& theV,const Standard_Real theU,const TopoDS_Edge& theE,const Handle(BRepAlgo_AsDes)& theAsDes) ; - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/PARTITION/Partition_Inter2d.ixx b/src/PARTITION/Partition_Inter2d.ixx deleted file mode 100644 index 954e70da9..000000000 --- a/src/PARTITION/Partition_Inter2d.ixx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter2d.ixx -// Module : GEOM -// -#include "Partition_Inter2d.jxx" - - - - diff --git a/src/PARTITION/Partition_Inter2d.jxx b/src/PARTITION/Partition_Inter2d.jxx deleted file mode 100644 index 30cc24a04..000000000 --- a/src/PARTITION/Partition_Inter2d.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter2d.jxx -// Module : GEOM -// -#ifndef _BRepAlgo_AsDes_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _Partition_Inter2d_HeaderFile -#include "Partition_Inter2d.hxx" -#endif diff --git a/src/PARTITION/Partition_Inter3d.cdl b/src/PARTITION/Partition_Inter3d.cdl deleted file mode 100644 index f37cbbb9a..000000000 --- a/src/PARTITION/Partition_Inter3d.cdl +++ /dev/null @@ -1,173 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File : Partition_Inter3d.cdl --- Author : Benedicte MARTIN --- Module : GEOM - -class Inter3d from Partition - - ---Purpose: Computes the intersection face face in a set of faces - -- Store the result in a SD as AsDes. - -uses - Edge from TopoDS, - Vertex from TopoDS, - DataMapOfShapeShape from TopTools, - MapOfShape from TopTools, - Boolean from Standard, - AsDes from BRepAlgo, - Image from BRepAlgo, - Shape from TopoDS, - Face from TopoDS, - ListOfShape from TopTools, - Real from Standard, - State from TopAbs, - DataMapOfShapeListOfShape from TopTools - -is - Create returns Inter3d from Partition; - - Create(AsDes : mutable AsDes from BRepAlgo); - - CompletPart3d (me : in out; SetOfFaces1 : ListOfShape from TopTools; - FaceShapeMap: DataMapOfShapeShape from TopTools) - is static; - - FacesPartition (me : in out; F1, F2 : Face from TopoDS) - is static; - - ---------------------------- - ---Category: Result Querying - ---------------------------- - - IsDone(me ; F1,F2 : Face from TopoDS) - returns Boolean from Standard is static; - ---Purpose: return True if F1-F2 pair has been processed - - TouchedFaces(me : in out) returns MapOfShape from TopTools - ---C++: return & - is static; - ---Purpose: return map of faces cut by new or section edges - - NewEdges(me : in out) returns MapOfShape from TopTools - ---C++: return & - is static; - ---Purpose: return new and section edges - - AsDes(me) returns AsDes from BRepAlgo - is static; - ---Purpose: return an object containing info about - -- Ascendants | Descendants - -- ------------------+--------------------- - -- 1. faces | edges cutting them - -- 2. sectoin edges | new vertices on them - - - ------------------------------- - ---Category: Same domain shapes - ------------------------------- - - HasSameDomainF(me; F : Shape from TopoDS) - returns Boolean from Standard; - ---Purpose: Return true if F has same domain faces - - IsSameDomainF(me; F1, F2 : Shape from TopoDS) - returns Boolean from Standard; - ---Purpose: Return true if F1 and F2 are same domain faces - - SameDomain(me; F : Face from TopoDS) - returns ListOfShape from TopTools; - ---C++: return const & - ---Purpose: Return same domain faces of F - - ReplaceSameDomainV (me; V : Vertex from TopoDS; - E : Edge from TopoDS) - returns Vertex from TopoDS; - ---Purpose: return same domain vertex of V if it was replaced - -- and make this vertex to be on E too, else return V - - -------------------------- - ---Category: Section edges - -------------------------- - - SectionEdgesAD (me) returns AsDes from BRepAlgo - is static; - - IsSectionEdge (me; E : Edge from TopoDS) - returns Boolean from Standard; - ---Purpose: return True if E is an edge of an initial face and - -- E intersects aother face - - HasSectionEdge (me; F : Face from TopoDS) - returns Boolean from Standard; - ---Purpose: return True if F is intersected by an edge of - -- other face - - IsSplitOn (me; NewE, OldE : Edge from TopoDS; - F : Face from TopoDS) - returns Boolean from Standard; - ---Purpose: return True if NewE is split of OldE on F; - -- no check if NewE is split of OldE :) - - SectionEdgeFaces (me; SecE : Edge from TopoDS) - returns ListOfShape from TopTools; - ---C++: return const& - ---Purpose: return faces cut by section edge - - -------------------- - ---Category: Private - -------------------- - - Inter3D (me: in out; F1, F2 : Face from TopoDS; - LInt : in out ListOfShape from TopTools) - is static private; - - StorePart3d(me : in out; F1,F2 : Face from TopoDS; - LInt1 : ListOfShape from TopTools) - is static private; - - SetDone(me : in out; F1,F2 : Face from TopoDS) - is static private; - - Affiche (me; SetOfFaces : ListOfShape from TopTools) - is static private; - -fields - - myAsDes : AsDes from BRepAlgo; - myDone : DataMapOfShapeListOfShape from TopTools; - myTouched : MapOfShape from TopTools; - myNewEdges : MapOfShape from TopTools; - - -- section edges: existing edges that are intersection lines, - -- may be partially. - -- Store as - -- FACE -> SECTION EDGES, SECTION EDGE -> OTHER SECTION EDGE - mySectionEdgesAD : AsDes from BRepAlgo; - - -- same domain shapes - -- faces - mySameDomainFM : DataMapOfShapeListOfShape from TopTools; - -- vertex -> vertex replacement - mySameDomainVM : DataMapOfShapeShape from TopTools; - -end Inter3d; diff --git a/src/PARTITION/Partition_Inter3d.cxx b/src/PARTITION/Partition_Inter3d.cxx deleted file mode 100644 index 87de80135..000000000 --- a/src/PARTITION/Partition_Inter3d.cxx +++ /dev/null @@ -1,939 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter3d.cxx -// Author : Benedicte MARTIN -// Module : GEOM -// $Header$ -// -#include "Partition_Inter2d.hxx" -#include "Partition_Inter3d.ixx" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef DEB -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -//======================================================================= -//function : Partition_Inter3d -//purpose : -//======================================================================= - -Partition_Inter3d::Partition_Inter3d() -{ -} -//======================================================================= -//function : Partition_Inter3d -//purpose : -//======================================================================= - -Partition_Inter3d::Partition_Inter3d(const Handle(BRepAlgo_AsDes)& AsDes) - :myAsDes(AsDes) -{ - mySectionEdgesAD = new BRepAlgo_AsDes; -} - -//======================================================================= -//function : CompletPart3d -//purpose : FaceShapeMap is just to know the shape a face belongs to -//======================================================================= - -void Partition_Inter3d::CompletPart3d(const TopTools_ListOfShape& SetOfFaces1, - const TopTools_DataMapOfShapeShape& FaceShapeMap) -{ - if (myAsDes.IsNull()) - myAsDes = new BRepAlgo_AsDes; - - TopTools_ListIteratorOfListOfShape it; - - //--------------------------------------------------------------- - // Construction of bounding boxes. - //--------------------------------------------------------------- - - BRep_Builder B; - TopoDS_Compound CompOS; - B.MakeCompound(CompOS); - for (it.Initialize(SetOfFaces1); it.More(); it.Next()) - B.Add(CompOS, it.Value()); - - TopOpeBRepTool_BoxSort BOS; - BOS.AddBoxesMakeCOB(CompOS,TopAbs_FACE); - - for (it.Initialize(SetOfFaces1); it.More(); it.Next()) { - TopoDS_Face F1 = TopoDS::Face(it.Value()); - - // avoid intersecting faces of one shape - TopoDS_Shape S1; - if (FaceShapeMap.IsBound(F1)) S1 = FaceShapeMap.Find(F1); - - // to filter faces sharing an edge - TopTools_IndexedMapOfShape EM; - TopExp::MapShapes( F1, TopAbs_EDGE, EM); - - TColStd_ListIteratorOfListOfInteger itLI = BOS.Compare(F1); - for (; itLI.More(); itLI.Next()) { - TopoDS_Face F2 = TopoDS::Face(BOS.TouchedShape(itLI)); - if (F1.IsSame(F2) || IsDone(F1,F2)) - continue; - - TopoDS_Shape S2; - if (FaceShapeMap.IsBound(F2)) S2 = FaceShapeMap.Find(F2); - if (!S1.IsNull() && S1.IsSame(S2)) - continue; // descendants of one shape - - TopExp_Explorer expE (F2, TopAbs_EDGE); - for ( ; expE.More(); expE.Next()) - if (EM.Contains( expE.Current() )) - break; - if (expE.More()) - { - // faces have a common edge, check if they are a tool and a face - // generated by the tool in another shape; in that case they are - // to be intersected - TopLoc_Location L1, L2; - Handle(Geom_Surface) S1 = BRep_Tool::Surface( F1, L1 ); - Handle(Geom_Surface) S2 = BRep_Tool::Surface( F2, L2 ); - if ( S1 != S2 || L1 != L2 ) - continue; - } - - F1.Orientation(TopAbs_FORWARD); - F2.Orientation(TopAbs_FORWARD); - FacesPartition(F1,F2); - } - - // mark as modified a face which has at least one new edge - if (!myAsDes->HasDescendant( F1 )) - continue; - TopTools_ListIteratorOfListOfShape itE (myAsDes->Descendant( F1 )); - for ( ; itE.More(); itE.Next()) { - if (myNewEdges.Contains( itE.Value())) { - myTouched.Add( F1 ); - break; - } - } - } -} - -//======================================================================= -//function : PutInBounds -//purpose : -//======================================================================= - -static void PutInBounds (const TopoDS_Face& F, - const TopoDS_Edge& E, - Handle(Geom2d_Curve)& C2d) -{ - Standard_Real umin,umax,vmin,vmax; - Standard_Real f,l; - BRep_Tool::Range(E,f,l); - - TopLoc_Location L; // Recup S avec la location pour eviter la copie. - Handle (Geom_Surface) S = BRep_Tool::Surface(F,L); - - if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface(); - } - if (!S->IsUPeriodic() && !S->IsVPeriodic()) - return; - - BRepTools::UVBounds(F,umin,umax,vmin,vmax); - - gp_Pnt2d Pf = C2d->Value(f); - gp_Pnt2d Pl = C2d->Value(l); - const Standard_Real Um = 0.34*f + 0.66*l; - gp_Pnt2d Pm = C2d->Value( Um ); - - // sometimes on shpere, pcurve is out of domain by V though S is - // UPeriodic, sometimes it is in domain but nontheless it has - // wrong position. - // Check pcurve position by 3D point - if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface ))) - { - // get point on the surface - gp_Pnt Ps = S->Value( Pm.X(), Pm.Y() ); - // get point on the edge - Handle(Geom_Curve) C = BRep_Tool::Curve( E, f, l ); - gp_Pnt Pc = C->Value( Um ); - // compare points - Standard_Real TolE = BRep_Tool::Tolerance( E ); - if ( Pc.SquareDistance( Ps ) * 0.95 < TolE * TolE ) - return; // OK - - // find good UV for Pc: project Pc on S - GeomAdaptor_Surface SA (S); - Extrema_ExtPS anExtPS (Pc, SA, - SA.UResolution( TolE ), SA.VResolution( TolE )); - if (anExtPS.IsDone()) - { - Standard_Integer i, nbExt = anExtPS.NbExt(); - Extrema_POnSurf aPOnSurf; - for (i = 1; i <= nbExt; ++i ) - if (anExtPS.Value( i ) <= TolE) { - aPOnSurf = anExtPS.Point( i ); - break; - } - if (i <= nbExt) { - // a point found - Standard_Real u, v; - aPOnSurf.Parameter( u, v ); - gp_Pnt2d aGoodPm ( u, v ); - C2d->Translate( Pm , aGoodPm ); - } - } - } - - //--------------- - // Recadre en U. - //--------------- - if (S->IsUPeriodic()) { - Standard_Real period = S->UPeriod(); - Standard_Real eps = period*1.e-6; - Standard_Real minC = Min(Pf.X(),Pl.X()); minC = Min(minC,Pm.X()); - Standard_Real maxC = Max(Pf.X(),Pl.X()); maxC = Max(maxC,Pm.X()); - Standard_Real du = 0.; - if (minC< umin - eps) { - du = (int((umin - minC)/period) + 1)*period; - } - if (minC > umax + eps) { - du = -(int((minC - umax)/period) + 1)*period; - } - if (du != 0) { - gp_Vec2d T1(du,0.); - C2d->Translate(T1); - minC += du; maxC += du; - } - // Ajuste au mieux la courbe dans le domaine. - if (maxC > umax +100*eps) { - Standard_Real d1 = maxC - umax; - Standard_Real d2 = umin - minC + period; - if (d2 < d1) du =-period; - if ( du != 0.) { - gp_Vec2d T2(du,0.); - C2d->Translate(T2); - } - } - } - //------------------ - // Recadre en V. - //------------------ - if (S->IsVPeriodic()) { - Standard_Real period = S->VPeriod(); - Standard_Real eps = period*1.e-6; - Standard_Real minC = Min(Pf.Y(),Pl.Y()); minC = Min(minC,Pm.Y()); - Standard_Real maxC = Max(Pf.Y(),Pl.Y()); maxC = Max(maxC,Pm.Y()); - Standard_Real dv = 0.; - if (minC< vmin - eps) { - dv = (int((vmin - minC)/period) + 1)*period; - } - if (minC > vmax + eps) { - dv = -(int((minC - vmax)/period) + 1)*period; - } - if (dv != 0) { - gp_Vec2d T1(0.,dv); - C2d->Translate(T1); - minC += dv; maxC += dv; - } - // Ajuste au mieux la courbe dans le domaine. - if (maxC > vmax +100*eps) { - Standard_Real d1 = maxC - vmax; - Standard_Real d2 = vmin - minC + period; - if (d2 < d1) dv =-period; - if ( dv != 0.) { - gp_Vec2d T2(0.,dv); - C2d->Translate(T2); - } - } - } -} - -//======================================================================= -//function : Inter3D -//purpose : -//======================================================================= - -void Partition_Inter3d::Inter3D(const TopoDS_Face& F1, - const TopoDS_Face& F2, - TopTools_ListOfShape& L) -{ - BRep_Builder B; - - // fill the data Structure - Handle(TopOpeBRepDS_HDataStructure) DatStr = new TopOpeBRepDS_HDataStructure(); - TopOpeBRep_DSFiller DSFiller; - DSFiller.Insert(F1,F2,DatStr); - - // define the GeomTool used by the DSFiller : - // compute BSpline of degree 1 on intersection curves. - Standard_Real tol3dAPPROX = 1e-7; - Standard_Real tol2dAPPROX = 1e-7; - TopOpeBRepTool_GeomTool GT2 (TopOpeBRepTool_APPROX); - GT2.SetTolerances(tol3dAPPROX,tol2dAPPROX); - TopOpeBRepDS_BuildTool BT(GT2); - - // Perform Section - TopOpeBRepBuild_Builder TopB(BT); - TopB.Perform(DatStr); - - // =============== - // Store new edges - // =============== - - L.Clear(); - TopOpeBRepDS_CurveExplorer cex(DatStr->DS()); - for (; cex.More(); cex.Next()) { - const TopOpeBRepDS_Curve& CDS = cex.Curve(); - Standard_Integer ic = cex.Index(); - Handle(Geom2d_Curve) pc1 = CDS.Curve1(); - Handle(Geom2d_Curve) pc2 = CDS.Curve2(); - - TopTools_ListIteratorOfListOfShape itLE = TopB.NewEdges(ic); - while (itLE.More()) { - TopoDS_Edge E = TopoDS::Edge(itLE.Value()); - - PutInBounds (F1,E,pc1); - PutInBounds (F2,E,pc2); - - B.UpdateEdge (E,pc1,F1,0.); - B.UpdateEdge (E,pc2,F2,0.); - - L.Append (E); - - itLE.Next(); - if (itLE.More()) { - pc1 = Handle(Geom2d_Curve)::DownCast(pc1->Copy()); - pc2 = Handle(Geom2d_Curve)::DownCast(pc2->Copy()); - } - } - } - - // ======================== - // store same domain faces - // ======================== - - - if ( DatStr->HasSameDomain( F1 )) - { - TopTools_ListOfShape emptyList; - if (!mySameDomainFM.IsBound(F1)) - mySameDomainFM.Bind(F1,emptyList); - if (!mySameDomainFM.IsBound(F2)) - mySameDomainFM.Bind(F2,emptyList); - mySameDomainFM(F1).Append(F2); - mySameDomainFM(F2).Append(F1); - } - - // ==================== - // Store section edges - // ==================== - - const TopOpeBRepDS_DataStructure& DS = DatStr->DS(); - Standard_Integer j,i,nse = DS.NbSectionEdges(); - if (nse == 0) return; - - - TopoDS_Vertex V, sdeV1, sdeV2; - TopTools_MapOfShape MV; - TopTools_ListOfShape LSE; // list of section edges - TopoDS_Face dummyF; - - for (i = 1; i <= nse; i++) - { - const TopoDS_Edge & se = DS.SectionEdge(i); - if (! TopB.IsSplit(se,TopAbs_ON)) - continue; - LSE.Append( se ); - - // add vertices where section edges interferes with other - // edges as its descendant in myAsDes - - TopoDS_Edge sde, oe; // same domain, other edge - if (DatStr->HasSameDomain(se)) { - sde = TopoDS::Edge( DatStr->SameDomain(se).Value() ); - TopExp::Vertices( sde, sdeV1, sdeV2); - } - TColStd_MapOfInteger MIV; // indices of added edges - TopOpeBRepDS_PointIterator itP (DS.ShapeInterferences( se )); - itP.SupportKind( TopOpeBRepDS_EDGE ); - // loop on intersections of se - for (; itP.More(); itP.Next()) { - oe = TopoDS::Edge( DS.Shape( itP.Support())); - if (itP.IsVertex()) { - // there is a vertex at intersection - if ( !MIV.Add( itP.Current() )) - continue; - V = TopoDS::Vertex( DS.Shape( itP.Current())); - if ( !sde.IsNull() && (V.IsSame(sdeV1) || V.IsSame(sdeV2)) ) - oe = sde; - V = ReplaceSameDomainV( V , oe ); - V.Orientation( TopAbs_INTERNAL); - B.UpdateVertex( V, itP.Parameter(), se, 0.); // AddVonE() sets real U - } - else { - // create a new vertex at the intersection point - const TopOpeBRepDS_Point& DSP = DS.Point( itP.Current()); - V = BRepLib_MakeVertex( DSP.Point() ); - V.Orientation( TopAbs_INTERNAL); - B.UpdateVertex( V, itP.Parameter(), se, DSP.Tolerance()); - // make V be on the other edge - TopOpeBRepDS_PointIterator itOP (DS.ShapeInterferences( oe )); - for (; itOP.More(); itOP.Next()) { - const TopOpeBRepDS_Point& ODSP = DS.Point( itOP.Current()); - if ( DSP.IsEqual (ODSP)) { - B.UpdateVertex( V, itOP.Parameter(), TopoDS::Edge(oe), ODSP.Tolerance()); - break; - } - } - } - // add V on the both intersecting edges - TopoDS_Vertex addedV = Partition_Inter2d::AddVonE( V,se,oe,myAsDes,dummyF); - if (!addedV.IsSame( V )) - mySameDomainVM.Bind (V, addedV); // equal vertex is already there - - MV.Add( addedV ); // to ease storage of vertices of ON splits - } - } - - // add section edge to the face it intersects and find - // splits ON that do not have same domain pair - - TopB.SplitSectionEdges(); // let TopB find ON splits - - TopTools_MapOfShape SPM; // map of ON splits - TopTools_IndexedMapOfShape ME[2]; - TopExp::MapShapes( F1, TopAbs_EDGE, ME[1]); - TopExp::MapShapes( F2, TopAbs_EDGE, ME[0]); - - TopTools_ListIteratorOfListOfShape itSP, itLSE (LSE); - while ( itLSE.More() ) { - - TopoDS_Edge se = TopoDS::Edge( itLSE.Value() ); - - // move itLSE to the next se - Standard_Integer ancRank = DS.AncestorRank(se); - if (ME[ancRank-1].Contains( se )) - { - LSE.Remove( itLSE ); // se is an edge of face it intersects - continue; - } - else - { - itLSE.Next(); - } - - const TopoDS_Face& F = (ancRank == 1) ? F2 : F1; - - // add se to face but dont add twice - TopTools_ListIteratorOfListOfShape itE( myAsDes->Descendant( F )); - if (myAsDes->HasDescendant( F )) { - for ( ; itE.More(); itE.Next()) - if (se.IsSame( itE.Value() )) - break; - } - if (!itE.More()) - { - myAsDes->Add( F, se ); - - // check se pcurve on F - Standard_Real tol, f,l, umin=1e100, umax=-1e100; - Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface( se, F, f,l); - if (pc.IsNull()) { - itSP.Initialize( TopB.Splits(se,TopAbs_ON) ); - for ( ; itSP.More(); itSP.Next()) { - const TopoDS_Edge& E = TopoDS::Edge ( itSP.Value()); - BRep_Tool::Range(E, f, l); - umin = Min( umin, f); - umax = Max( umax, l); - } - Handle(Geom_Curve) C3d = BRep_Tool::Curve( se, f, l); - if (umin < umax) // sometimes umin == umax for closed edge - C3d = new Geom_TrimmedCurve( C3d, umin, umax); - pc = TopOpeBRepTool_CurveTool::MakePCurveOnFace (F,C3d,tol); - if (pc.IsNull()) { - MESSAGE (" CANT BUILD PCURVE "); - } - B.UpdateEdge( se, pc, F, tol); - } - } - - // to detect splits that do not have same domain pair - // ie which split a face into parts and not pass by its boundary - itSP.Initialize( TopB.Splits(se,TopAbs_ON) ); - for ( ; itSP.More(); itSP.Next()) { - const TopoDS_Shape& SP = itSP.Value(); - if (!SPM.Add( SP )) - SPM.Remove( SP ); - } - } - - // store vertices of ON splits and bind section edges to faces - - for (itLSE.Initialize (LSE); itLSE.More(); itLSE.Next()) - { - const TopoDS_Shape& se = itLSE.Value(); - - Standard_Integer ancRank = DS.AncestorRank(se); - TopoDS_Face F = (ancRank == 1) ? F2 : F1; - - // add vertices of ON splits which have no same domain pair - Standard_Boolean added = Standard_False; - itSP.Initialize( TopB.Splits(se,TopAbs_ON) ); - for ( ; itSP.More(); itSP.Next()) - { - if (!SPM.Contains( itSP.Value() )) - continue; - - const TopoDS_Edge& S = TopoDS::Edge ( itSP.Value()); - - added = Standard_True; - mySectionEdgesAD->Add( F, se ); - - TopoDS_Vertex VS[2]; - TopExp::Vertices (S, VS[0], VS[1]); - for (j=0; j<2; ++j) - { - if (mySameDomainVM.IsBound( VS[j] )) - VS[j] = TopoDS::Vertex( mySameDomainVM( VS[j] )); - if ( !MV.Contains( VS[j] )) { - // find equal vertex on se - point interference - gp_Pnt P1 = BRep_Tool::Pnt( VS[j] ); - TopTools_ListIteratorOfListOfShape itV( myAsDes->Descendant(se) ); - for (; itV.More(); itV.Next()) { - V = TopoDS::Vertex( itV.Value() ); - if ( V.IsSame( VS[j] )) - break; - gp_Pnt P2 = BRep_Tool::Pnt( V ); - if (P1.IsEqual( P2, Precision::Confusion())) { - mySameDomainVM.Bind (VS[j], V); - VS[j] = V; - break; - } - } - if (!itV.More()) // no interferences with edges - myAsDes->Add( se, VS[j]); - } - - // add ends of ON splits to F in order to detect later - // if a split is on face in IsSplitOn() - mySectionEdgesAD->Add( F, VS[j]); - } - // in the descendants of F, first go ends of an ON split and - // then a split itself - mySectionEdgesAD->Add( F, S ); - } - if (!added) - mySectionEdgesAD->Add( F, se ); - - myNewEdges.Add( se ); - } -} - -//======================================================================= -//function : FacesPartition -//purpose : -//======================================================================= - -void Partition_Inter3d::FacesPartition(const TopoDS_Face& F1, - const TopoDS_Face& F2) - //(const TopTools_DataMapOfShapeListOfShape& /*SetOfFaces2*/) -{ - TopTools_ListOfShape LInt; - - Inter3D (F1,F2,LInt); - - StorePart3d (F1,F2,LInt); -} - -//======================================================================= -//function : SetDone -//purpose : -//======================================================================= - -void Partition_Inter3d::SetDone(const TopoDS_Face& F1, - const TopoDS_Face& F2) -{ - if (!myDone.IsBound(F1)) { - TopTools_ListOfShape emptyList; - myDone.Bind(F1,emptyList); - } - myDone(F1).Append(F2); - if (!myDone.IsBound(F2)) { - TopTools_ListOfShape emptyList; - myDone.Bind(F2,emptyList); - } - myDone(F2).Append(F1); -} - -//======================================================================= -//function : IsDone -//purpose : -//======================================================================= - -Standard_Boolean Partition_Inter3d::IsDone(const TopoDS_Face& F1, - const TopoDS_Face& F2) - - const -{ - if (myDone.IsBound(F1)) { - TopTools_ListIteratorOfListOfShape it (myDone(F1)); - for (; it.More(); it.Next()) { - if (it.Value().IsSame(F2)) return Standard_True; - } - } - return Standard_False; -} - -//======================================================================= -//function : StorePart3d -//purpose : -//======================================================================= - -void Partition_Inter3d::StorePart3d(const TopoDS_Face& F1, - const TopoDS_Face& F2, - const TopTools_ListOfShape& LInt) -{ - if (!LInt.IsEmpty()) { - myAsDes->Add( F1,LInt); - myAsDes->Add( F2,LInt); - - TopTools_ListIteratorOfListOfShape it(LInt); - for (; it.More(); it.Next()) { - - TopoDS_Edge E = TopoDS::Edge(it.Value()); - - BRep_Builder B; - B.SameParameter(E,Standard_False); - BRepLib::SameParameter(E,1.0e-7); - - myNewEdges.Add(E); - } - } - SetDone(F1,F2); -} - -//======================================================================= -//function : TouchedFaces -//purpose : -//======================================================================= - -TopTools_MapOfShape& Partition_Inter3d::TouchedFaces() -{ - return myTouched; -} - -//======================================================================= -//function : AsDes -//purpose : -//======================================================================= - -Handle(BRepAlgo_AsDes) Partition_Inter3d::AsDes() const -{ - return myAsDes; -} - -//======================================================================= -//function : NewEdges -//purpose : -//======================================================================= - -TopTools_MapOfShape& Partition_Inter3d::NewEdges() -{ - return myNewEdges; -} - -//======================================================================= -//function : Affiche -//purpose : -//======================================================================= - -void Partition_Inter3d::Affiche(const TopTools_ListOfShape& SetOfFaces) const -{ -#ifdef DEB - char PSection[1024]; - char *section=PSection; - Standard_Integer i = 0; - Standard_Real j=1; - TopTools_ListOfShape aList; - TopTools_ListIteratorOfListOfShape it; - for (it.Initialize(SetOfFaces); it.More(); it.Next()) { - const TopoDS_Shape& OS = it.Value(); - aList=myAsDes->Descendant(OS); - MESSAGE ( " the number of items stored in the list " << j << " : " << aList.Extent() ) - j++; - TopTools_ListIteratorOfListOfShape itaList; - for (itaList.Initialize(aList); itaList.More(); itaList.Next()) { - const TopoDS_Shape& SS = itaList.Value(); - i++; - sprintf(PSection,"section_%d",i); - DBRep::Set(section,SS); - } - } -#endif -} - -//======================================================================= -//function : SameDomain -//purpose : -//======================================================================= - -const TopTools_ListOfShape& Partition_Inter3d::SameDomain(const TopoDS_Face& F) const -{ - if (mySameDomainFM.IsBound( F )) - return mySameDomainFM (F); - - static TopTools_ListOfShape emptyList; - return emptyList; -} - -//======================================================================= -//function : HasSameDomainF -//purpose : Return true if F has same domain faces -//======================================================================= - -Standard_Boolean Partition_Inter3d::HasSameDomainF(const TopoDS_Shape& F) const -{ - return mySameDomainFM.IsBound( F ); -} - -//======================================================================= -//function : IsSameDomain -//purpose : Return true if F1 and F2 are same domain faces -//======================================================================= - -Standard_Boolean Partition_Inter3d::IsSameDomainF(const TopoDS_Shape& F1, - const TopoDS_Shape& F2) const -{ - if (mySameDomainFM.IsBound( F1 )) { - TopTools_ListIteratorOfListOfShape it (mySameDomainFM( F1 )); - for (; it.More(); it.Next()) - if (F2.IsSame( it.Value())) - return Standard_True; - } - return F1.IsSame( F2 ); -} - -//======================================================================= -//function : ReplaceSameDomainV -//purpose : return same domain vertex of V if it was replaced -// and make this vertex to be on E too, else return V -//======================================================================= - -TopoDS_Vertex Partition_Inter3d::ReplaceSameDomainV(const TopoDS_Vertex& V, - const TopoDS_Edge& E) const -{ - TopoDS_Vertex SDV = V; - if (mySameDomainVM.IsBound( V )) { - - TopoDS_Vertex V1,V2; - TopExp::Vertices(E,V1,V2); - Standard_Boolean isClosed = V1.IsSame( V2 ) && V.IsSame(V1); - - SDV = TopoDS::Vertex( mySameDomainVM(V) ); - Standard_Real tol = BRep_Tool::Tolerance( V ); - BRep_Builder B; - SDV.Orientation( V.Orientation()); - - if (isClosed) { - Standard_Real f, l; - BRep_Tool::Range (E, f, l); - Standard_Boolean isFirst = IsEqual( BRep_Tool::Parameter(V,E), f ); - B.UpdateVertex(SDV, (isFirst ? f : l), E, tol); - SDV.Reverse(); - B.UpdateVertex(SDV, (isFirst ? l : f), E, tol); - } - else - B.UpdateVertex (SDV, BRep_Tool::Parameter(V,E), E, tol); - - } - return SDV; -} - -//======================================================================= -//function : SectionEdgesAD -//purpose : -//======================================================================= - -Handle(BRepAlgo_AsDes) Partition_Inter3d::SectionEdgesAD() const -{ - return mySectionEdgesAD; -} - -//======================================================================= -//function : IsSectionEdge -//purpose : return True if E is an edge of a face and it -// intersects an other face -//======================================================================= - -Standard_Boolean - Partition_Inter3d::IsSectionEdge(const TopoDS_Edge& E) const -{ - return mySectionEdgesAD->HasAscendant(E); -} - -//======================================================================= -//function : HasSectionEdge -//purpose : return True if an edge of F intersects an other -// face or F is intersected by edge of an other face -//======================================================================= - -Standard_Boolean - Partition_Inter3d::HasSectionEdge(const TopoDS_Face& F) const -{ - return mySectionEdgesAD->HasDescendant(F); -} - -//======================================================================= -//function : IsSplitOn -//purpose : return True if NewE is split of OldE on F -//======================================================================= - -Standard_Boolean - Partition_Inter3d::IsSplitOn(const TopoDS_Edge& NewE, - const TopoDS_Edge& OldE, - const TopoDS_Face& F) const -{ - if (! mySectionEdgesAD->HasDescendant(F)) - return Standard_False; - - TopTools_ListIteratorOfListOfShape itE ( mySectionEdgesAD->Descendant(F) ); - for ( ; itE.More(); itE.Next()) { - if ( itE.Value().ShapeType() != TopAbs_EDGE || - ! OldE.IsSame ( itE.Value() )) - continue; - // an edge encountered, its vertices and a split come next - itE.Next(); - if (!itE.More()) break; - const TopoDS_Shape& V3 = itE.Value(); - if (V3.ShapeType() != TopAbs_VERTEX) continue; - itE.Next(); - if (!itE.More()) break; - const TopoDS_Shape& V4 = itE.Value(); - if (V4.ShapeType() != TopAbs_VERTEX) continue; - - TopoDS_Vertex V1, V2; - TopExp::Vertices( OldE, V1, V2); - - if ( V1.IsSame(V2) && - (V1.IsSame(V3) || V1.IsSame(V4)) ) { - // closed old edge; use the split for the test - itE.Next(); - if (!itE.More()) break; - const TopoDS_Edge& split = TopoDS::Edge( itE.Value() ); - // check distance at middle point of NewE - Standard_Real f1,l1, f2,l2; - Handle(Geom2d_Curve) PC1 = BRep_Tool::CurveOnSurface( split, F ,f1,l1); - if (!PC1.IsNull()) { - Handle(Geom2d_Curve) PC2 = BRep_Tool::CurveOnSurface(NewE, F ,f2,l2); - gp_Pnt2d P = PC2->Value( 0.5*(f2+l2) ); - Geom2dAPI_ProjectPointOnCurve proj (P, PC1, f1, l1); - if (proj.NbPoints() && - proj.LowerDistance() <= Precision::Confusion()) - return Standard_True; - } - else { - Handle(Geom_Curve) C1 = BRep_Tool::Curve( split ,f1,l1); - Handle(Geom_Curve) C2 = BRep_Tool::Curve( NewE ,f2,l2); - gp_Pnt P = C2->Value( 0.5*(f2+l2) ); - GeomAPI_ProjectPointOnCurve proj (P, C1, f1, l1); - if (proj.NbPoints() && - proj.LowerDistance() <= Precision::Confusion()) - return Standard_True; - } - } - else { - Standard_Real u3 = BRep_Tool::Parameter( TopoDS::Vertex(V3), OldE); - Standard_Real u4 = BRep_Tool::Parameter( TopoDS::Vertex(V4), OldE); - - Standard_Real f,l, u; - BRep_Tool::Range( NewE, f,l); - u = 0.5*(f+l); - f = Min(u3,u4); - l = Max(u3,u4); - - if (u <= l && u >= f) - return Standard_True; - } - } - return Standard_False; -} - -//======================================================================= -//function : SectionEdgeFaces -//purpose : return faces cut by section edge -//======================================================================= - -const TopTools_ListOfShape& - Partition_Inter3d::SectionEdgeFaces(const TopoDS_Edge& SecE) const -{ - return mySectionEdgesAD->Ascendant( SecE ); -} diff --git a/src/PARTITION/Partition_Inter3d.hxx b/src/PARTITION/Partition_Inter3d.hxx deleted file mode 100644 index 1573cc5f1..000000000 --- a/src/PARTITION/Partition_Inter3d.hxx +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter3d.hxx -// Module : GEOM -// -#ifndef _Partition_Inter3d_HeaderFile -#define _Partition_Inter3d_HeaderFile - -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class BRepAlgo_AsDes; -class TopTools_ListOfShape; -class TopTools_DataMapOfShapeShape; -class TopoDS_Face; -class TopTools_MapOfShape; -class TopoDS_Shape; -class TopoDS_Vertex; -class TopoDS_Edge; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class Partition_Inter3d { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT Partition_Inter3d(); -Standard_EXPORT Partition_Inter3d(const Handle(BRepAlgo_AsDes)& AsDes); -Standard_EXPORT void CompletPart3d(const TopTools_ListOfShape& SetOfFaces1,const TopTools_DataMapOfShapeShape& FaceShapeMap) ; -Standard_EXPORT void FacesPartition(const TopoDS_Face& F1,const TopoDS_Face& F2) ; -Standard_EXPORT Standard_Boolean IsDone(const TopoDS_Face& F1,const TopoDS_Face& F2) const; -Standard_EXPORT TopTools_MapOfShape& TouchedFaces() ; -Standard_EXPORT Handle_BRepAlgo_AsDes AsDes() const; -Standard_EXPORT TopTools_MapOfShape& NewEdges() ; -Standard_EXPORT Standard_Boolean HasSameDomainF(const TopoDS_Shape& F) const; -Standard_EXPORT Standard_Boolean IsSameDomainF(const TopoDS_Shape& F1,const TopoDS_Shape& F2) const; -Standard_EXPORT const TopTools_ListOfShape& SameDomain(const TopoDS_Face& F) const; -Standard_EXPORT TopoDS_Vertex ReplaceSameDomainV(const TopoDS_Vertex& V,const TopoDS_Edge& E) const; -Standard_EXPORT Handle_BRepAlgo_AsDes SectionEdgesAD() const; -Standard_EXPORT Standard_Boolean IsSectionEdge(const TopoDS_Edge& E) const; -Standard_EXPORT Standard_Boolean HasSectionEdge(const TopoDS_Face& F) const; -Standard_EXPORT Standard_Boolean IsSplitOn(const TopoDS_Edge& NewE,const TopoDS_Edge& OldE,const TopoDS_Face& F) const; -Standard_EXPORT const TopTools_ListOfShape& SectionEdgeFaces(const TopoDS_Edge& SecE) const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT void Inter3D(const TopoDS_Face& F1,const TopoDS_Face& F2,TopTools_ListOfShape& LInt) ; -Standard_EXPORT void StorePart3d(const TopoDS_Face& F1,const TopoDS_Face& F2,const TopTools_ListOfShape& LInt1) ; -Standard_EXPORT void SetDone(const TopoDS_Face& F1,const TopoDS_Face& F2) ; -Standard_EXPORT void Affiche(const TopTools_ListOfShape& SetOfFaces) const; - - - // Fields PRIVATE - // -Handle_BRepAlgo_AsDes myAsDes; -TopTools_DataMapOfShapeListOfShape myDone; -TopTools_MapOfShape myTouched; -TopTools_MapOfShape myNewEdges; -Handle_BRepAlgo_AsDes mySectionEdgesAD; -TopTools_DataMapOfShapeListOfShape mySameDomainFM; -TopTools_DataMapOfShapeShape mySameDomainVM; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/PARTITION/Partition_Inter3d.ixx b/src/PARTITION/Partition_Inter3d.ixx deleted file mode 100644 index a760097d0..000000000 --- a/src/PARTITION/Partition_Inter3d.ixx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter3d.ixx -// Module : GEOM -// -#include "Partition_Inter3d.jxx" - - - - diff --git a/src/PARTITION/Partition_Inter3d.jxx b/src/PARTITION/Partition_Inter3d.jxx deleted file mode 100644 index 54e7732e3..000000000 --- a/src/PARTITION/Partition_Inter3d.jxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Inter3d.jxx -// Module : GEOM -// -#ifndef _BRepAlgo_AsDes_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopoDS_Vertex_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _Partition_Inter3d_HeaderFile -#include "Partition_Inter3d.hxx" -#endif diff --git a/src/PARTITION/Partition_Loop.cdl b/src/PARTITION/Partition_Loop.cdl deleted file mode 100644 index 05bbf3e8b..000000000 --- a/src/PARTITION/Partition_Loop.cdl +++ /dev/null @@ -1,85 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File : Partition_Loop.cdl --- Author : Benedicte MARTIN --- Module : GEOM - -class Loop from Partition - - ---Purpose: Builds the loops from a set of edges on a face. - -uses - - Face from TopoDS, - Edge from TopoDS, - ListOfShape from TopTools, - DataMapOfShapeListOfShape from TopTools - -is - - Create; - - Init (me : in out; F : Face from TopoDS) - ---Purpose: Init with the set of edges must have - -- pcurves on . - is static; - - AddEdge (me : in out; E : in out Edge from TopoDS; - LV : ListOfShape from TopTools) - ---Purpose: Add E with . will be copied and trim - -- by vertices in . - is static; - - AddConstEdge (me : in out; E : Edge from TopoDS) - ---Purpose: Add as const edge, E can be in the result. - is static; - - Perform(me : in out) - ---Purpose: Make loops. - is static; - - NewWires (me) - ---Purpose: Returns the list of wires performed. - -- can be an empty list. - ---C++: return const & - returns ListOfShape from TopTools; - - WiresToFaces (me : in out) - ---Purpose: Build faces from the wires result. - is static; - - NewFaces (me) - ---Purpose: Returns the list of faces. - ---Warning: The method as to be called before. - -- can be an empty list. - ---C++: return const & - returns ListOfShape from TopTools; - - -fields - - myFace : Face from TopoDS; - myConstEdges : ListOfShape from TopTools; - myNewWires : ListOfShape from TopTools; - myNewFaces : ListOfShape from TopTools; - -end Loop; diff --git a/src/PARTITION/Partition_Loop.cxx b/src/PARTITION/Partition_Loop.cxx deleted file mode 100644 index 807bc74af..000000000 --- a/src/PARTITION/Partition_Loop.cxx +++ /dev/null @@ -1,467 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop.cxx -// Author : Benedicte MARTIN -// Module : GEOM -// $Header$ -// -#include - -#include "Partition_Loop.ixx" - -#include "utilities.h" - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -using namespace std; - -static char* name = new char[100]; -static int nbe = 0; - -//======================================================================= -//function : Partition_Loop -//purpose : -//======================================================================= -Partition_Loop::Partition_Loop() -{ -} - -//======================================================================= -//function : Init -//purpose : -//======================================================================= -void Partition_Loop::Init(const TopoDS_Face& F) -{ - myConstEdges.Clear(); - myNewWires .Clear(); - myNewFaces .Clear(); - myFace = F; -} - -//======================================================================= -//function : AddConstEdge -//purpose : -//======================================================================= -void Partition_Loop::AddConstEdge (const TopoDS_Edge& E) -{ - myConstEdges.Append(E); -} - - -//======================================================================= -//function : FindDelta -//purpose : -//======================================================================= -static Standard_Real FindDelta(TopTools_ListOfShape& LE, - const TopoDS_Face& F) -{ - Standard_Real dist, f, l; - Standard_Real d = Precision::Infinite(); - TopTools_ListIteratorOfListOfShape itl; - - for ( itl.Initialize(LE); itl.More(); itl.Next()) { - const TopoDS_Edge& E = TopoDS::Edge(itl.Value()); - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(E,F,f,l); - gp_Pnt2d p = C->Value(f); - gp_Pnt2d pp = C->Value(l); - Standard_Real d1 = p.Distance(pp); - if (d1 connected by the vertex in the list . -// Is erased of the list. If is too in the list -// with the same orientation, it's erased of the list -//======================================================================= -static Standard_Boolean SelectEdge(const TopoDS_Face& F, - const TopoDS_Edge& CE, - const TopoDS_Vertex& CV, - TopoDS_Edge& NE, - TopTools_ListOfShape& LE) -{ - TopTools_ListIteratorOfListOfShape itl; - NE.Nullify(); - for ( itl.Initialize(LE); itl.More(); itl.Next()) { - if (itl.Value().IsEqual(CE)) { - LE.Remove(itl); - break; - } - } - - if (LE.Extent() > 1) { - //-------------------------------------------------------------- - // Several possible edges. - // - Test the edges differents of CE - //-------------------------------------------------------------- - Standard_Real cf, cl, f, l; - TopoDS_Face FForward = F; - Handle(Geom2d_Curve) Cc, C; - FForward.Orientation(TopAbs_FORWARD); - - Cc = BRep_Tool::CurveOnSurface(CE,FForward,cf,cl); - Standard_Real dist,distmin = 100*BRep_Tool::Tolerance(CV); - Standard_Real uc,u; - if (CE.Orientation () == TopAbs_FORWARD) uc = cl; - else uc = cf; - - gp_Pnt2d P2,PV = Cc->Value(uc); - - Standard_Real delta = FindDelta(LE,FForward); - - for ( itl.Initialize(LE); itl.More(); itl.Next()) { - const TopoDS_Edge& E = TopoDS::Edge(itl.Value()); - if (!E.IsSame(CE)) { - C = BRep_Tool::CurveOnSurface(E,FForward,f,l); - if (E.Orientation () == TopAbs_FORWARD) u = f; - else u = l; - P2 = C->Value(u); - dist = PV.Distance(P2); - if (dist <= distmin){ - distmin = dist; - } - - } - } - - Standard_Real anglemax = - PI; - TopoDS_Edge SelectedEdge; - for ( itl.Initialize(LE); itl.More(); itl.Next()) { - const TopoDS_Edge& E = TopoDS::Edge(itl.Value()); - if (!E.IsSame(CE)) { - C = BRep_Tool::CurveOnSurface(E,FForward,f,l); - if (E.Orientation () == TopAbs_FORWARD) u = f; - else u = l; - P2 = C->Value(u); - dist = PV.Distance(P2); - if (dist <= distmin + (1./3)*delta){ - gp_Pnt2d PC, P; - gp_Vec2d CTg1, CTg2, Tg1, Tg2; - Cc->D2(uc, PC, CTg1, CTg2); - C->D2(u, P, Tg1, Tg2); - - Standard_Real angle; - - if (CE.Orientation () == TopAbs_REVERSED && E.Orientation () == TopAbs_FORWARD) { - angle = CTg1.Angle(Tg1.Reversed()); - } - else if (CE.Orientation () == TopAbs_FORWARD && E.Orientation () == TopAbs_REVERSED) { - angle = (CTg1.Reversed()).Angle(Tg1); - } - else if (CE.Orientation () == TopAbs_REVERSED && E.Orientation () == TopAbs_REVERSED) { - angle = CTg1.Angle(Tg1); - } - else if (CE.Orientation () == TopAbs_FORWARD && E.Orientation () == TopAbs_FORWARD) { - angle = (CTg1.Reversed()).Angle(Tg1.Reversed()); - } - if (angle >= anglemax) { - anglemax = angle ; - SelectedEdge = E; - } - } - } - } - for ( itl.Initialize(LE); itl.More(); itl.Next()) { - const TopoDS_Edge& E = TopoDS::Edge(itl.Value()); - if (E.IsEqual(SelectedEdge)) { - NE = TopoDS::Edge(E); - LE.Remove(itl); - break; - } - } - } - else if (LE.Extent() == 1) { - NE = TopoDS::Edge(LE.First()); - LE.RemoveFirst(); - } - else { - return Standard_False; - } - return Standard_True; -} - -//======================================================================= -//function : SamePnt2d -//purpose : -//======================================================================= -static Standard_Boolean SamePnt2d(TopoDS_Vertex V, - TopoDS_Edge& E1, - TopoDS_Edge& E2, - TopoDS_Face& F) -{ - Standard_Real f1,f2,l1,l2; - gp_Pnt2d P1,P2; - TopoDS_Shape aLocalF = F.Oriented(TopAbs_FORWARD); - TopoDS_Face FF = TopoDS::Face(aLocalF); - Handle(Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(E1,FF,f1,l1); - Handle(Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(E2,FF,f2,l2); - if (E1.Orientation () == TopAbs_FORWARD) P1 = C1->Value(f1); - else P1 = C1->Value(l1); - - if (E2.Orientation () == TopAbs_FORWARD) P2 = C2->Value(l2); - else P2 = C2->Value(f2); - Standard_Real Tol = 100*BRep_Tool::Tolerance(V); - Standard_Real Dist = P1.Distance(P2); - return Dist < Tol; -} - -//======================================================================= -//function : PurgeNewEdges -//purpose : -//======================================================================= -static void PurgeNewEdges(TopTools_ListOfShape& ConstEdges, - const TopTools_MapOfOrientedShape& UsedEdges) -{ - TopTools_ListIteratorOfListOfShape it(ConstEdges); - while ( it.More()) { - const TopoDS_Shape& NE = it.Value(); - if (!UsedEdges.Contains(NE)) { - ConstEdges.Remove(it); - } - else { - it.Next(); - } - } -} - -//======================================================================= -//function : StoreInMVE -//purpose : -//======================================================================= -static void StoreInMVE (const TopoDS_Face& F, - TopoDS_Edge& E, - TopTools_DataMapOfShapeListOfShape& MVE ) - -{ - TopoDS_Vertex V1, V2; - TopTools_ListOfShape Empty; - - TopExp::Vertices(E,V1,V2); - if (!MVE.IsBound(V1)) { - MVE.Bind(V1,Empty); - } - MVE(V1).Append(E); - - if (!MVE.IsBound(V2)) { - MVE.Bind(V2,Empty); - } - MVE(V2).Append(E); -} - -//======================================================================= -//function : Perform -//purpose : -//======================================================================= -void Partition_Loop::Perform() -{ - - TopTools_DataMapOfShapeListOfShape MVE; - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit, Mapit1; - TopTools_ListIteratorOfListOfShape itl; - TopoDS_Vertex V1,V2; - - //----------------------------------- - // Construction map vertex => edges - //----------------------------------- - for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) { - TopoDS_Edge& E = TopoDS::Edge(itl.Value()); - StoreInMVE(myFace,E,MVE); - } - - //---------------------------------------------- - // Construction of all the wires and of all the new faces. - //---------------------------------------------- - TopTools_MapOfOrientedShape UsedEdges; - - while (!MVE.IsEmpty()) { - TopoDS_Vertex VF,CV; - TopoDS_Edge CE,NE,EF; - TopoDS_Wire NW; - BRep_Builder B; - Standard_Boolean End= Standard_False; - - B.MakeWire(NW); - //-------------------------------- - // EF first edge. - //-------------------------------- - Mapit.Initialize(MVE); - EF = CE = TopoDS::Edge(Mapit.Value().First()); - - TopExp::Vertices(CE,V1,V2); - //-------------------------------- - // VF first vertex - //-------------------------------- - if (CE.Orientation() == TopAbs_FORWARD) { - CV = VF = V1; - } - else { - CV = VF = V2; - } - if (!MVE.IsBound(CV)) continue; - for ( itl.Initialize(MVE(CV)); itl.More(); itl.Next()) { - if (itl.Value().IsEqual(CE)) { - MVE(CV).Remove(itl); - break; - } - } - - int i = 0; - while (!End) { - //------------------------------- - // Construction of a wire. - //------------------------------- - TopExp::Vertices(CE,V1,V2); - if (!CV.IsSame(V1)) CV = V1; else CV = V2; - B.Add (NW,CE); - UsedEdges.Add(CE); - - //-------------- - // stop test - //-------------- - if (!MVE.IsBound(CV) || MVE(CV).IsEmpty() || CV.IsSame(VF) ) { - if (CV.IsSame(VF)) { - if (MVE(CV).Extent() == 1 ) MVE.UnBind(CV); - else { - for ( itl.Initialize(MVE(CV)); itl.More(); itl.Next()) { - if (itl.Value().IsEqual(CE)) { - MVE(CV).Remove(itl); - break; - } - } - } - } - End=Standard_True; - } - - //-------------- - // select edge - //-------------- - else { - Standard_Boolean find = SelectEdge(myFace,CE,CV,NE,MVE(CV)); - if (find) { - CE=NE; - if (MVE(CV).IsEmpty()) MVE.UnBind(CV); - if (CE.IsNull() ) { - MESSAGE ( " CE is NULL !!! " ) - End=Standard_True; - } - } - else { - MESSAGE ( " edge doesn't exist " ) - End=Standard_True; - } - } - } - - //----------------------------- - // Test if the wire is closed - //----------------------------- - if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace)) { - } - else{ - MESSAGE ( "wire not closed" ) - } - myNewWires.Append (NW); - } - - PurgeNewEdges(myConstEdges,UsedEdges); - -} - - -//======================================================================= -//function : NewWires -//purpose : -//======================================================================= -const TopTools_ListOfShape& Partition_Loop::NewWires() const -{ - return myNewWires; -} - -//======================================================================= -//function : NewFaces -//purpose : -//======================================================================= -const TopTools_ListOfShape& Partition_Loop::NewFaces() const -{ - return myNewFaces; -} - -//======================================================================= -//function : WiresToFaces -//purpose : -//======================================================================= -void Partition_Loop::WiresToFaces() -{ - if (!myNewWires.IsEmpty()) { - BRepAlgo_FaceRestrictor FR; - - TopAbs_Orientation OriF = myFace.Orientation(); - TopoDS_Shape aLocalS = myFace.Oriented(TopAbs_FORWARD); - - FR.Init (TopoDS::Face(aLocalS),Standard_False); - TopTools_ListIteratorOfListOfShape it(myNewWires); - for (; it.More(); it.Next()) { - FR.Add(TopoDS::Wire(it.Value())); - } - - FR.Perform(); - - if (FR.IsDone()) { - for (; FR.More(); FR.Next()) { - myNewFaces.Append(FR.Current().Oriented(OriF)); - } - } - } -} diff --git a/src/PARTITION/Partition_Loop.hxx b/src/PARTITION/Partition_Loop.hxx deleted file mode 100644 index 6d8113716..000000000 --- a/src/PARTITION/Partition_Loop.hxx +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop.hxx -// Module : GEOM -// -#ifndef _Partition_Loop_HeaderFile -#define _Partition_Loop_HeaderFile - -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile -#include -#endif -class TopoDS_Face; -class TopoDS_Edge; -class TopTools_ListOfShape; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class Partition_Loop { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT Partition_Loop(); -Standard_EXPORT void Init(const TopoDS_Face& F) ; -Standard_EXPORT void AddConstEdge(const TopoDS_Edge& E) ; -Standard_EXPORT void Perform() ; -Standard_EXPORT const TopTools_ListOfShape& NewWires() const; -Standard_EXPORT void WiresToFaces() ; -Standard_EXPORT const TopTools_ListOfShape& NewFaces() const; - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Face myFace; -TopTools_ListOfShape myConstEdges; -TopTools_ListOfShape myNewWires; -TopTools_ListOfShape myNewFaces; - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/PARTITION/Partition_Loop.ixx b/src/PARTITION/Partition_Loop.ixx deleted file mode 100644 index 3b69d33db..000000000 --- a/src/PARTITION/Partition_Loop.ixx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop.ixx -// Module : GEOM -// -#include "Partition_Loop.jxx" - - - - diff --git a/src/PARTITION/Partition_Loop.jxx b/src/PARTITION/Partition_Loop.jxx deleted file mode 100644 index a9384fe3a..000000000 --- a/src/PARTITION/Partition_Loop.jxx +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop.jxx -// Module : GEOM -// -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _Partition_Loop_HeaderFile -#include "Partition_Loop.hxx" -#endif diff --git a/src/PARTITION/Partition_Loop2d.cdl b/src/PARTITION/Partition_Loop2d.cdl deleted file mode 100644 index ee7ac3404..000000000 --- a/src/PARTITION/Partition_Loop2d.cdl +++ /dev/null @@ -1,98 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File : Partition_Loop2d.cdl --- Author : Benedicte MARTIN --- Module : GEOM - -class Loop2d from Partition - - ---Purpose: Builds the loops from a set of edges on a face. - -- It works in supposition that all constant edges - -- are split edges of an initialization face and all - -- section edges are new on the face - -uses - - Orientation from TopAbs, - Boolean from Standard, - Face from TopoDS, - Image from BRepAlgo, - Face from TopoDS, - Edge from TopoDS, - ListOfShape from TopTools, - DataMapOfShapeListOfShape from TopTools, - MapOfShape from TopTools -is - - Create; - - Init (me : in out; F : Face from TopoDS) - ---Purpose: Init with the set of edges must have - -- pcurves on . - is static; - - AddConstEdge (me : in out; E : Edge from TopoDS) - ---Purpose: Add as unique edge in the result. - is static; - - AddSectionEdge (me : in out; E : Edge from TopoDS) - ---Purpose: Add as double edge in the result. - is static; - - Perform(me : in out) - ---Purpose: Make loops. - is static; - - NewWires (me) - ---Purpose: Returns the list of wires performed. - -- can be an empty list. - ---C++: return const & - returns ListOfShape from TopTools; - - WiresToFaces (me : in out; EdgeImage : Image from BRepAlgo) - ---Purpose: Build faces from the wires result. - -- serves to find original edge by new - -- one. - is static; - - NewFaces (me) - ---Purpose: Returns the list of faces. - ---Warning: The method as to be called before. - -- can be an empty list. - ---C++: return const & - returns ListOfShape from TopTools; - - -fields - - myFace : Face from TopoDS; - myFaceOri : Orientation from TopAbs; - myConstEdges : ListOfShape from TopTools; - myNewWires : ListOfShape from TopTools; - myNewFaces : ListOfShape from TopTools; - - -- internal wires do not contain constant edges - myInternalWL : ListOfShape from TopTools; - - mySectionEdges : MapOfShape from TopTools; - -end Loop2d; diff --git a/src/PARTITION/Partition_Loop2d.cxx b/src/PARTITION/Partition_Loop2d.cxx deleted file mode 100644 index 534e76a41..000000000 --- a/src/PARTITION/Partition_Loop2d.cxx +++ /dev/null @@ -1,1155 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop2d.cxx -// Author : Benedicte MARTIN -// Module : GEOM -// $Header$ -// -#include "Partition_Loop2d.ixx" - -#include "utilities.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -//======================================================================= -//function : Partition_Loop2d -//purpose : -//======================================================================= - -Partition_Loop2d::Partition_Loop2d() -{ -} - -//======================================================================= -//function : Init -//purpose : Init with the set of edges must have -// pcurves on . -//======================================================================= - -void Partition_Loop2d::Init(const TopoDS_Face& F) -{ - myConstEdges.Clear(); - myNewWires .Clear(); - myNewFaces .Clear(); - myFace = F; - myFaceOri = myFace.Orientation(); - myFace.Orientation( TopAbs_FORWARD ); -} - -//======================================================================= -//function : AddConstEdge -//purpose : Add as unique edge in the result. -//======================================================================= - -void Partition_Loop2d::AddConstEdge (const TopoDS_Edge& E) -{ -#ifdef DEB - Standard_Real f,l; - Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface( E, myFace, f,l); - if (pc.IsNull()) { - INFOS( "AddConstEdge(): EDGE W/O PCURVE on FACE"); - } else -#endif - { - myConstEdges.Append(E); - } -} - -void Partition_Loop2d::AddSectionEdge (const TopoDS_Edge& E) -{ -#ifdef DEB - Standard_Real f,l; - Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface( E, myFace, f,l); - if (pc.IsNull()) - pc = BRep_Tool::CurveOnSurface( E, myFace, f,l); - gp_Vec2d Tg1; - gp_Pnt2d PC; - pc->D1(0.5*(f+l), PC, Tg1); - if (Tg1.Magnitude() <= gp::Resolution()) { - MESSAGE (""); - } - if (pc.IsNull()) { - INFOS( "AddConstEdge(): EDGE W/O PCURVE on FACE"); - } else -#endif - { - myConstEdges.Append(E); - myConstEdges.Append(E.Reversed()); - mySectionEdges.Add( E ); - } -} - -//======================================================================= -//function : preciseU -//purpose : find u such that the 3D point on theE is just out of tolerance -// of theV -//======================================================================= - -static Standard_Real preciseU (const BRepAdaptor_Surface& theSurf, - const TopoDS_Edge& theE, - const TopoDS_Vertex& theV, - const Handle(Geom2d_Curve)& theC, - const Standard_Boolean theFirstEnd) -{ - Standard_Boolean isForward = ( theE.Orientation () == TopAbs_FORWARD ); - if (theFirstEnd) isForward = !isForward; - - // find the first point in 2d and 3d - Standard_Real f,l; - BRep_Tool::Range( theE, f, l ); - Standard_Real u0 = isForward ? l : f; - gp_Pnt2d aP2d0 = theC->Value( u0 ); - gp_Pnt aPnt0 = theSurf.Value( aP2d0.X(), aP2d0.Y() ); - - // shift in 2d and 3d - Standard_Real du = ( l - f ) / 100, du3d = 0; - if (isForward) - du = -du; - - // target parameter - Standard_Real u; - - while (du3d < ::RealSmall()) - { - // u for test - u = u0 + du; - du *= 10; // for the next iteration: increase du untill du3d is large enough - - // find out how u is far from u0 in 3D - gp_Pnt2d aP2d = theC->Value( u ); - gp_Pnt aPnt = theSurf.Value( aP2d.X(), aP2d.Y() ); - du3d = aPnt0.Distance( aPnt ); - } - - // find u such that the 3D point is just out of tolerance of theV - Standard_Real tolV = BRep_Tool::Tolerance( theV ) + Precision::Confusion(); - u = u0 + du * tolV / du3d; - - // check that u is within the range - if ( isForward ? (u < f) : (u > l) ) - u = u0 + du; - - return u; -} - -//======================================================================= -//function : SelectEdge -//purpose : Find in the list the edge connected with by -// the vertex . -// is removed from the list. If is in -// with the same orientation, it's removed from the list -//======================================================================= - -static Standard_Boolean SelectEdge(const BRepAdaptor_Surface& Surf, - const TopoDS_Edge& CE, - const TopoDS_Vertex& CV, - TopoDS_Edge& NE, - const TopTools_ListOfShape& LE) -{ - NE.Nullify(); - - if (LE.Extent() > 1) { - //-------------------------------------------------------------- - // Several possible edges. - // - Test the edges differents of CE - //-------------------------------------------------------------- - TopoDS_Face FForward = Surf.Face(); - TopoDS_Edge aPrevNE; - - gp_Vec2d CTg1, Tg1, CTg2, Tg2; - gp_Pnt2d PC, P; - - Standard_Real f, l; - Handle(Geom2d_Curve) Cc, C; - Cc = BRep_Tool::CurveOnSurface(CE,FForward,f,l); - - Standard_Boolean isForward = ( CE.Orientation () == TopAbs_FORWARD ); - Standard_Real uc, u, du = Precision::PConfusion(); - uc = isForward ? ( l - du ) : ( f + du ); - Cc->D1(uc, PC, CTg1); - if (!isForward) CTg1.Reverse(); - - Standard_Real anglemin = 3 * PI, tolAng = 1.e-8; - - // select an edge whose first derivative is most left of CTg1 - // ie an angle between Tg1 and CTg1 is least - TopTools_ListIteratorOfListOfShape itl; - for ( itl.Initialize(LE); itl.More(); itl.Next()) { - const TopoDS_Edge& E = TopoDS::Edge(itl.Value()); - if (E.IsSame(CE)) - continue; - if (! CV.IsSame( TopExp::FirstVertex( E, Standard_True ))) - continue; - - isForward = ( E.Orientation () == TopAbs_FORWARD ); - - // get E curve - C = BRep_Tool::CurveOnSurface(E,FForward,f,l); - // get the first derivative Tg1 - u = isForward ? ( f + du ) : ( l - du ); - C->D1(u, P, Tg1); - if (!isForward) Tg1.Reverse(); - - // -PI < angle < PI - Standard_Real angle = Tg1.Angle(CTg1); - - if (PI - Abs(angle) <= tolAng) - { - // an angle is too close to PI; assure that an angle sign really - // reflects an edge position: +PI - an edge is worst, - // -PI - an edge is best. - u = preciseU( Surf, CE, CV, Cc, Standard_False); - gp_Vec2d CTg; - Cc->D1(u, PC, CTg); - if (CE.Orientation() == TopAbs_REVERSED) CTg.Reverse(); - - u = preciseU( Surf, E, CV, C, Standard_True); - C->D1(u, P, Tg1); - if (!isForward) Tg1.Reverse(); - - angle = Tg1.Angle(CTg); - } - - Standard_Boolean isClose = ( Abs( angle - anglemin ) <= tolAng ); - if (angle <= anglemin) { - if (isClose) - aPrevNE = NE; - else - aPrevNE.Nullify(); - anglemin = angle ; - NE = E; - } - else - if (isClose) - aPrevNE = E; - - } - if (!aPrevNE.IsNull()) { - // select one of close edges, the most left one. - Cc = BRep_Tool::CurveOnSurface( NE, FForward, f, l ); - uc = preciseU( Surf, NE, CV, Cc, Standard_True); - Cc->D1(uc, PC, CTg1); - if (NE.Orientation() != TopAbs_FORWARD) CTg1.Reverse(); - - u = preciseU( Surf, aPrevNE, CV, C, Standard_True); - C->D1(u, P, Tg1); - if (aPrevNE.Orientation() != TopAbs_FORWARD) Tg1.Reverse(); - - if ( Tg1.Angle(CTg1) < 0) - NE = aPrevNE; - } - } - else if (LE.Extent() == 1) { - NE = TopoDS::Edge(LE.First()); - } - else { - return Standard_False; - } - return !NE.IsNull(); -} - -//======================================================================= -//function : SamePnt2d -//purpose : -//======================================================================= - -static Standard_Boolean SamePnt2d(const TopoDS_Vertex& V1, - const TopoDS_Edge& E1, - const TopoDS_Vertex& V2, - const TopoDS_Edge& E2, - const TopoDS_Face& F) -{ - Standard_Real f1,f2,l1,l2; - Handle(Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(E1,F,f1,l1); - Handle(Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(E2,F,f2,l2); - - gp_Pnt2d P1 = C1->Value( BRep_Tool::Parameter(V1,E1)); - gp_Pnt2d P2 = C2->Value( BRep_Tool::Parameter(V2,E2)); - - Standard_Real Tol = 100 * BRep_Tool::Tolerance(V1); - Standard_Real Dist = P1.Distance(P2); - return Dist < Tol; -} - - -//======================================================================= -//function : StoreInMVE -//purpose : -//======================================================================= - -static void StoreInMVE (const TopoDS_Face& /*F*/, - TopoDS_Edge& E, - TopTools_DataMapOfShapeListOfShape& MVE ) - -{ - TopoDS_Vertex V1, V2; - TopTools_ListOfShape Empty; - - TopExp::Vertices(E,V1,V2); - if (!MVE.IsBound(V1)) { - MVE.Bind(V1,Empty); - } - MVE(V1).Append(E); - - if (!MVE.IsBound(V2)) { - MVE.Bind(V2,Empty); - } - MVE(V2).Append(E); -} - -//======================================================================= -//function : RemoveFromMVE -//purpose : -//======================================================================= - -static void RemoveFromMVE(const TopoDS_Edge& E, - TopTools_DataMapOfShapeListOfShape& MVE) -{ - TopTools_ListIteratorOfListOfShape itl; - TopoDS_Vertex V1,V2; - TopExp::Vertices (E,V1,V2); - if (MVE.IsBound(V1)) - for ( itl.Initialize(MVE(V1)); itl.More(); itl.Next()) { - if (itl.Value().IsEqual(E)) { - MVE(V1).Remove(itl); - break; - } - } - if (MVE.IsBound(V2)) - for ( itl.Initialize(MVE(V2)); itl.More(); itl.Next()) { - if (itl.Value().IsEqual(E)) { - MVE(V2).Remove(itl); - break; - } - } -} -//======================================================================= -//function : addConnected -//purpose : add to all edges reachable from -//======================================================================= - -static void addConnected(const TopoDS_Shape& E, - TopTools_MapOfShape& EM, - TopTools_MapOfShape& VM, - const TopTools_DataMapOfShapeListOfShape& MVE) -{ - // Loop on vertices of E - TopoDS_Iterator itV ( E ); - for ( ; itV.More(); itV.Next()) { - - if ( ! VM.Add ( itV.Value() )) continue; - - // Loop on edges sharing V - TopTools_ListIteratorOfListOfShape itE( MVE( itV.Value() ) ); - for (; itE.More(); itE.Next()) { - if ( EM.Add( itE.Value() )) - addConnected ( itE.Value(), EM, VM, MVE ); - } - } -} -//======================================================================= -//function : canPassToOld -//purpose : -//======================================================================= - -// static Standard_Boolean canPassToOld (const TopoDS_Shape& V, -// TopTools_MapOfShape& UsedShapesMap, -// const TopTools_DataMapOfShapeListOfShape& MVE, -// const TopTools_MapOfShape& SectionEdgesMap) -// { -// TopTools_ListIteratorOfListOfShape itE( MVE(V) ); -// // Loop on edges sharing V -// for (; itE.More(); itE.Next()) { -// if ( !UsedShapesMap.Add( itE.Value() )) -// continue; // already checked - -// if ( !SectionEdgesMap.Contains( itE.Value() )) -// return Standard_True; // WE PASSED - -// TopoDS_Iterator itV( itE.Value() ); -// // Loop on vertices of an edge -// for (; itV.More(); itV.Next()) { -// if ( !UsedShapesMap.Add( itV.Value() )) -// continue; // already checked -// else -// return canPassToOld( itV.Value(), UsedShapesMap, MVE, SectionEdgesMap); -// } -// } -// return Standard_False; -// } - -//======================================================================= -//function : MakeDegenAndSelect -//purpose : Find parameter of intersection of with and -// select an edge with its parameter closest to found one. -// Return new degenerated edge trimming by found parameters -//======================================================================= - -static TopoDS_Edge MakeDegenAndSelect(const TopoDS_Edge& CE, - const TopoDS_Vertex& CV, - TopoDS_Edge& NE, - TopTools_SequenceOfShape& EdgesSeq, - TColStd_SequenceOfReal& USeq, - const TopoDS_Edge& DE) -{ - if (EdgesSeq.Length() < 3) { - if (CE == EdgesSeq.First()) - NE = TopoDS::Edge( EdgesSeq.Last() ); - else - NE = TopoDS::Edge( EdgesSeq.First() ); - return DE; - } - - // find parameter on DE where it intersects CE - - Standard_Real U1; - Standard_Integer i, nb = EdgesSeq.Length(); - for (i=1; i<= nb; ++i) { - if (CE == EdgesSeq(i)) { - U1 = USeq(i); - break; - } - } - - // select NE with param closest to U1 thus finding U2 for a new degen edge - - Standard_Real U2, dU, dUmin = 1.e100; - Standard_Boolean isReversed = ( DE.Orientation() == TopAbs_REVERSED ); - for (i=1; i<= nb; ++i) { - dU = USeq(i) - U1; - if (isReversed ? (dU > 0) : (dU < 0)) - continue; - dU = Abs( dU ); - if ( dU > dUmin || IsEqual( dU, 0.)) - continue; - const TopoDS_Edge& E = TopoDS::Edge ( EdgesSeq(i) ); - if ( ! CV.IsSame( TopExp::FirstVertex( E , Standard_True ))) - continue; - NE = E; - dUmin = dU + Epsilon(dU); - U2 = USeq(i); - } - - // make a new degenerated edge - TopoDS_Edge NewDegen = TopoDS::Edge ( DE.EmptyCopied() ); - - Standard_Real Tol = BRep_Tool::Tolerance( CV ); - TopoDS_Vertex V = CV; - - BRep_Builder B; - V.Orientation( NewDegen.Orientation() ); - B.UpdateVertex( V, U1, NewDegen, Tol); - B.Add ( NewDegen , V ); - - V.Reverse(); - B.UpdateVertex( V, U2, NewDegen, Tol); - B.Add ( NewDegen , V ); - - return NewDegen; -} - -//======================================================================= -//function : prepareDegen -//purpose : Intersect with edges bound to its vertex in -// and store intersection parameter on in -// as well as the edges them-self in . -// Bind to vertex of in -//======================================================================= - -static void prepareDegen (const TopoDS_Edge& DegEdge, - const TopoDS_Face& F, - const TopTools_DataMapOfShapeListOfShape& MVE, - TopTools_SequenceOfShape& EdgesSeq, - TColStd_SequenceOfReal& USeq, - TopTools_DataMapOfShapeInteger& MVDEI, - const Standard_Integer DegEdgeIndex) -{ - const TopoDS_Vertex& V = TopExp::FirstVertex ( DegEdge ); - MVDEI.Bind ( V, DegEdgeIndex ); - - const TopTools_ListOfShape& EdgesList = MVE ( V ); - // if only 2 edges come to degenerated one, no pb in selection and - // no need to intersect them, just simulate asked data - Standard_Boolean doIntersect = ( EdgesList.Extent() > 2 ); - - BRepAdaptor_Curve2d DC, C; - Geom2dInt_GInter InterCC; - Standard_Real Tol = Precision::PConfusion(); - if ( doIntersect ) - DC.Initialize( DegEdge, F ); - - // avoid intersecting twice the same edge - BRepOffset_DataMapOfShapeReal EUMap ( EdgesList.Extent() ); - - Standard_Real U, f, l; - BRep_Tool::Range (DegEdge, f, l); - - TopTools_ListIteratorOfListOfShape itE (EdgesList); - for (; itE.More(); itE.Next()) { - - const TopoDS_Edge& E = TopoDS::Edge ( itE.Value() ); - - if ( !doIntersect) { - U = 0.; // it won't be used - } - else if ( BRep_Tool::IsClosed( E, F )) { - // seam edge: select U among f and l - Standard_Boolean first = Standard_True; - if ( V.IsSame ( TopExp::FirstVertex( E, Standard_True ) )) - first = Standard_False; - if ( DegEdge.Orientation() == TopAbs_REVERSED ) - first = !first; - U = first ? f : l; - } - else if ( EUMap.IsBound( E ) ) { - // same edge already bound - U = EUMap( E ); - } - else { - // intersect 2d curves - C.Initialize( E, F ); - InterCC.Perform ( DC, C , Tol, Tol ); - if (! InterCC.IsDone() || InterCC.NbPoints() == 0) { - MESSAGE ( "NO 2d INTERSECTION ON DEGENERATED EDGE" ); - continue; - } - // hope there is only one point of intersection - U = InterCC.Point( 1 ).ParamOnFirst(); - } - USeq.Append ( U ); - EdgesSeq.Append ( E ); - } -} -//======================================================================= -//function : Perform -//purpose : Make loops. -//======================================================================= - -void Partition_Loop2d::Perform() -{ - - Standard_Integer NbConstEdges = myConstEdges.Extent(); - TopTools_DataMapOfShapeListOfShape MVE(NbConstEdges) , MVE2(NbConstEdges); - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit; - TopTools_ListIteratorOfListOfShape itl; - TopoDS_Vertex V1,V2; - BRepAdaptor_Surface Surface ( myFace, Standard_False ); - - // degenerated edges and parameters of their 2d intersection with other edges - TopoDS_Edge DE [2]; - TopTools_SequenceOfShape SEID [2]; // seq of edges intersecting degenerated - TColStd_SequenceOfReal SeqU [2]; // n-th U corresponds to n-th edge in SEID - TopTools_DataMapOfShapeInteger MVDEI(2); // map vertex - degenerated edge index - Standard_Integer iDeg = 0; // index of degenerated edge [0,1] - - //--------------------------------------------------------- - // Construction map vertex => edges, find degenerated edges - //--------------------------------------------------------- - for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) { - TopoDS_Edge& E = TopoDS::Edge(itl.Value()); - if ( BRep_Tool::Degenerated( E )) { - if (DE[0].IsNull()) DE[0] = E; - else DE[1] = E; - } - else - StoreInMVE(myFace,E,MVE); - } - - // fill data for degenerated edges - if ( ! DE[0].IsNull() ) - prepareDegen ( DE[0], myFace, MVE, SEID[0], SeqU[0], MVDEI, 0); - if ( ! DE[1].IsNull() ) - prepareDegen ( DE[1], myFace, MVE, SEID[1], SeqU[1], MVDEI, 1); - - - // to detect internal wires - Standard_Boolean isInternCW = 0; - MVE2 = MVE; - - - //------------------------------ - // Construction of all the wires - //------------------------------ - // first, we collect wire edges in WEL list looking for same edges that - // will be then removed possibly exploding a wire into parts; - // second, build wire(s) - - while (!MVE.IsEmpty()) { - - TopoDS_Vertex VF,CV; - TopoDS_Edge CE,NE,EF; - TopoDS_Wire NW; - BRep_Builder B; - Standard_Boolean End = Standard_False; - TopTools_ListOfShape WEL; - - Mapit.Initialize(MVE); - if (Mapit.Value().IsEmpty()) { - MVE.UnBind(Mapit.Key()); - continue; - } - - // EF first edge. - EF = CE = TopoDS::Edge(Mapit.Value().First()); - // VF first vertex - VF = TopExp::FirstVertex( CE, Standard_True); - - isInternCW = Standard_True; - - TopTools_MapOfShape addedEM (NbConstEdges); // map of edges added to WEL - TopTools_MapOfShape doubleEM (NbConstEdges); // edges encountered twice in WEL - - //------------------------------- - // Construction of a wire. - //------------------------------- - while (!End) { - - // only a seam is allowed twice in a wire, the others should be removed - if (addedEM.Add ( CE ) || BRep_Tool::IsClosed( CE, myFace ) ) - WEL.Append( CE ); - else { - doubleEM.Add( CE ); - RemoveFromMVE (CE,MVE2); - TopoDS_Edge CERev = CE; - CERev.Reverse(); - RemoveFromMVE (CERev,MVE2); - } - - RemoveFromMVE (CE,MVE); - - CV = TopExp::LastVertex( CE, Standard_True); - - if (isInternCW && !mySectionEdges.Contains(CE)) - // wire is internal if all edges are section ones - isInternCW = Standard_False; - - if (MVDEI.IsBound( CV )) { // CE comes to the degeneration - iDeg = MVDEI( CV ); - TopoDS_Edge NewDegen; - NewDegen = MakeDegenAndSelect( CE, CV, NE, SEID[iDeg], SeqU[iDeg], DE[iDeg]); - WEL.Append( NewDegen ); - CE = NE; - End = CV.IsSame( VF ); - continue; - } - - //-------------- - // stop test - //-------------- - if (MVE(CV).IsEmpty()) { - End=Standard_True; - MVE.UnBind(CV); - } - else if (CV.IsSame(VF) && SamePnt2d(CV,CE, VF,EF, myFace) ) { - End = Standard_True; - } - else { - //---------------------------- - // select new current edge - //---------------------------- - if (! SelectEdge (Surface,CE,CV,NE,MVE(CV))) { - MESSAGE ( " NOT CLOSED WIRE " ); - End=Standard_True; - } - else - CE = NE; - } - } // while ( !End ) - - - // WEL is built, built wire(s) - - - itl.Initialize( WEL ); - if ( doubleEM.IsEmpty()) { // no double edges - B.MakeWire( NW ); - for (; itl.More(); itl.Next()) - B.Add ( NW, itl.Value()); - if (isInternCW) myInternalWL.Append(NW); - else myNewWires.Append (NW); - } - - else { - // remove double and degenerated edges from WEL - while (itl.More()) { - const TopoDS_Edge& E = TopoDS::Edge ( itl.Value() ); - if ( doubleEM.Contains( E ) || BRep_Tool::Degenerated( E )) - WEL.Remove( itl ); - else - itl.Next(); - } - if ( WEL.IsEmpty()) - continue; - // remove double edges from SEID and SeqU - Standard_Integer i,j; - for (j=0; j<2; ++j) { - for (i=1; i<=SEID[j].Length(); ++i) { - if (doubleEM.Contains( SEID[j].Value(i))) { - SEID[j].Remove( i ); - SeqU[j].Remove( i-- ); - } - } - } - // removal of doulbe edges can explode a wire into parts, - // make new wires of them. - // A Loop like previous one but without 2d check - while ( !WEL.IsEmpty() ) { - CE = TopoDS::Edge( WEL.First() ); - WEL.RemoveFirst(); - B.MakeWire( NW ); - VF = TopExp::FirstVertex ( CE, Standard_True); - - End = Standard_False; - while ( !End) { - B.Add( NW, CE ); - CV = TopExp::LastVertex ( CE, Standard_True); - - if (MVDEI.IsBound( CV )) { // CE comes to the degeneration - iDeg = MVDEI( CV ); - TopoDS_Edge NewDegen; - NewDegen = MakeDegenAndSelect( CE, CV, NE, SEID[iDeg], SeqU[iDeg], DE[iDeg]); - B.Add( NW, NewDegen ); - End = CV.IsSame( VF ); - CE = NE; - if (!NE.IsNull()) { // remove NE from WEL - for (itl.Initialize( WEL ); itl.More(); itl.Next()) - if ( NE == itl.Value()) { - WEL.Remove( itl ); - break; - } - } - } // end degeneration - - else { - if (CV.IsSame( VF )) { - End = Standard_True; - continue; - } - // edges in WEL most often are well ordered - // so try to iterate until the End - Standard_Boolean add = Standard_False; - itl.Initialize(WEL); - while ( itl.More() && !End) { - NE = TopoDS::Edge( itl.Value() ); - if ( CV.IsSame( TopExp::FirstVertex( NE, Standard_True ))) { - WEL.Remove( itl ); - if (add) - B.Add( NW, CE ); - CE = NE; - add = Standard_True; - CV = TopExp::LastVertex( CE, Standard_True); - if (MVDEI.IsBound( CV ) || CV.IsSame( VF )) - break; - } - else - itl.Next(); - } - if (!add) - End = Standard_True; - } - } // !End - - myInternalWL.Append( NW ); - } - } // end building new wire(s) from WEL - - } // end Loop on MVE - - // all wires are built - - - // ============================================================ - // select really internal wires i.e. those from which we can`t - // pass to an old (not section) edge - // ============================================================ - - Standard_Integer nbIW = myInternalWL.Extent(); - if (nbIW == 0) - return; - - if ( myNewWires.Extent() != 1 && nbIW > 1) { - TopTools_MapOfShape outerEM (NbConstEdges); // edges connected to non-section ones - TopTools_MapOfShape visitedVM (NbConstEdges); - for ( itl.Initialize( myConstEdges ); itl.More(); itl.Next()) { - if ( ! mySectionEdges.Contains( itl.Value() )) - addConnected (itl.Value(), outerEM, visitedVM, MVE2); - } - // if an edge of a wire is in , the wire is not internal - TopExp_Explorer expIWE; - TopTools_ListIteratorOfListOfShape itIW ( myInternalWL ); - while (itIW.More()) { - expIWE.Init ( itIW.Value() , TopAbs_EDGE ); - if ( outerEM.Contains( expIWE.Current() )) { - myNewWires.Append ( itIW.Value() ); - myInternalWL.Remove( itIW ); // == itIW.Next() - } - else - itIW.Next(); - } - } -} -//======================================================================= -//function : isHole -//purpose : -//======================================================================= - -static Standard_Boolean isHole (const TopoDS_Wire& W, - const TopoDS_Face& F) -{ - BRep_Builder B; - TopoDS_Shape newFace = F.EmptyCopied(); - B.Add(newFace,W.Oriented(TopAbs_FORWARD)); - BRepTopAdaptor_FClass2d classif (TopoDS::Face(newFace), - Precision::PConfusion()); - return (classif.PerformInfinitePoint() == TopAbs_IN); -} - -//======================================================================= -//function : IsInside -//purpose : check if W1 is inside W2. Suppose W2 is not a hole !!!! -//======================================================================= - -static Standard_Boolean isInside(const TopoDS_Face& F, - const TopoDS_Wire& W1, - const TopoDS_Wire& W2) -{ - // make a face with wire W2 - BRep_Builder B; - TopoDS_Shape aLocalShape = F.EmptyCopied(); - TopoDS_Face newFace = TopoDS::Face(aLocalShape); - B.Add(newFace,W2); - - // get any 2d point of W1 - TopExp_Explorer exp(W1,TopAbs_EDGE); - if (BRep_Tool::Degenerated( TopoDS::Edge( exp.Current() ))) - exp.Next(); - const TopoDS_Edge& e = TopoDS::Edge(exp.Current()); - Standard_Real f,l; - Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(e,F,f,l); - gp_Pnt2d pt2d(C2d->Value( 0.5 * ( f + l ))); - - BRepTopAdaptor_FClass2d classif(newFace,Precision::PConfusion()); - return (classif.Perform(pt2d) == TopAbs_IN); -} - -//======================================================================= -//function : NewWires -//purpose : Returns the list of wires performed. -// can be an empty list. -//======================================================================= - -const TopTools_ListOfShape& Partition_Loop2d::NewWires() const -{ - return myNewWires; -} - -//======================================================================= -//function : NewFaces -//purpose : Returns the list of faces. -//Warning : The method as to be called before. -// can be an empty list. -//======================================================================= - -const TopTools_ListOfShape& Partition_Loop2d::NewFaces() const -{ - return myNewFaces; -} - -//======================================================================= -//function : findEqual -//purpose : move wires form to pairs of wires build of the same edges -//======================================================================= - -static void findEqual (TopTools_ListOfShape& WL, - TopTools_DataMapOfShapeShape& EqWM, - const TopoDS_Face& F) -{ - TopTools_ListIteratorOfListOfShape it1, it2; - Standard_Integer i,j; - TColStd_MapOfInteger IndMap; - for (it1.Initialize(WL), i=1; it1.More(); it1.Next(), i++) { - - if (IndMap.Contains(i)) continue; - const TopoDS_Wire& Wire1 = TopoDS::Wire( it1.Value()); - - for (it2.Initialize(WL), j=1; it2.More(); it2.Next(), j++) { - - if (j <= i || IndMap.Contains(j)) continue; - - TopTools_IndexedMapOfShape EdgesMap; - TopExp::MapShapes (Wire1, TopAbs_EDGE, EdgesMap); - - const TopoDS_Shape& Wire2 = it2.Value(); - TopoDS_Iterator itE ( Wire2); - for (; itE.More(); itE.Next()) { - if ( !EdgesMap.Contains( itE.Value()) ) - break; - } - if (!itE.More()) { // all edges are same - if (isHole( Wire1, F)) { - EqWM.Bind ( Wire1, Wire2 ); - } - else { - EqWM.Bind ( Wire2, Wire1 ); - } - IndMap.Add(i); - IndMap.Add(j); - break; - } - } - } - // clear WL - it1.Initialize(WL); - i=1; - while (it1.More()) { - if (IndMap.Contains(i)) - WL.Remove(it1); // next node becomes current and with Next() we would miss it - else - it1.Next(); - i++; - } -} - -//======================================================================= -//function : classify -//purpose : bind to a wire a list of internal wires -//======================================================================= - -static void classify(const TopTools_DataMapOfShapeShape& EqWM, - BRepAlgo_AsDes& OuterInner, - const TopoDS_Face& F) -{ - TopTools_DataMapIteratorOfDataMapOfShapeShape it1, it2; - - for (it1.Initialize(EqWM); it1.More(); it1.Next()) { - // find next after it1.Value() - for (it2.Initialize(EqWM); it2.More(); it2.Next()) - if (it1.Value().IsSame( it2.Value() )) - { - it2.Next(); - break; - } - for ( ; it2.More(); it2.Next()) { - const TopoDS_Wire& Wire1 = TopoDS::Wire( it1.Value() ); - const TopoDS_Wire& Wire2 = TopoDS::Wire( it2.Value() ); - if (isInside(F, Wire1, Wire2)) - OuterInner.Add (Wire2, Wire1); - else if (isInside(F, Wire2, Wire1)) - OuterInner.Add (Wire1, Wire2); - } - } -} -//======================================================================= -//function : WiresToFaces -//purpose : Build faces from the wires result. -// serves to find original edge by new -// one.
    contains edges resulting from face -// intersections -//======================================================================= - -void Partition_Loop2d::WiresToFaces(const BRepAlgo_Image& ) -{ - Standard_Integer nbW = myNewWires.Extent() + myInternalWL.Extent(); - if (nbW==0) - return; - - BRepAlgo_FaceRestrictor FR; - FR.Init (myFace,Standard_False); - - // FaceRestrictor is instable in rather simple cases - // (ex. a single face of bellecoque.brep splited by 10 planes: - // sometimes 1-2 faces are missing ). - // So we use it as less as possible: no holes -> make faces by hands - - - // are there holes in myFace ? - Standard_Boolean hasOldHoles = Standard_False; - TopoDS_Iterator itOldW (myFace); - if ( itOldW.More()) { - const TopoDS_Wire& FirstOldWire = TopoDS::Wire( itOldW.Value() ); - itOldW.Next(); - hasOldHoles = itOldW.More() || isHole( FirstOldWire, myFace); - } - if (myInternalWL.IsEmpty() && !hasOldHoles) { - // each wire bounds one face - BRep_Builder B; - TopTools_ListIteratorOfListOfShape itNW (myNewWires); - for (; itNW.More(); itNW.Next()) { - TopoDS_Face NF = TopoDS::Face ( myFace.EmptyCopied() ); - B.Add ( NF, itNW.Value() ); - NF.Orientation( myFaceOri); - myNewFaces.Append ( NF ); - } - return; - } - - // FaceRestrictor can't classify wires build on all the same edges - // and gives incorrect result in such cases (ex. a plane cut into 2 parts by cylinder) - // We must make faces of equal wires separately. One of equal wires makes a - // hole in a face and should come together with outer wires of face. - // The other of a wires pair bounds a face that may have holes in turn. - - // Find equal wires among internal wires - TopTools_DataMapOfShapeShape EqWM; // key is a hole part of a pair of equal wires - findEqual (myInternalWL, EqWM, myFace); - - if (!EqWM.IsEmpty()) { // there are equal wires - - if (hasOldHoles) - myInternalWL.Append( myNewWires ); // an old wire can be inside an equal wire - - // classify equal wire pairs - BRepAlgo_AsDes OuterInner; - classify (EqWM,OuterInner,myFace); - - // make face of most internal of equal wires and its inner wires - while ( !EqWM.IsEmpty()) { - - TopTools_ListOfShape prevHolesL; // list of hole-part of previous most internal equal wires - - // find most internal wires among pairs (key - hole, value - outer part) - TopTools_DataMapIteratorOfDataMapOfShapeShape it(EqWM); - Standard_Integer nbEqW = EqWM.Extent(); // protection against infinite loop - for ( ; it.More(); it.Next()) { - - TopoDS_Wire outerW = TopoDS::Wire ( it.Value() ); - if ( OuterInner.HasDescendant( outerW ) && // has internal - ! OuterInner.Descendant( outerW ).IsEmpty() ) - continue; - - FR.Add( outerW ); - - // add internal wires that are inside of outerW - TopTools_ListIteratorOfListOfShape itIW (myInternalWL); - while ( itIW.More()) { - TopoDS_Wire IW = TopoDS::Wire ( itIW.Value() ); - if ( isInside (myFace, IW, outerW)) { - FR.Add (IW); - myInternalWL.Remove( itIW ); // == itIW.Next() !!! - } - else - itIW.Next(); - } - - // the hole-part of current pair of equal wires will be in the next new face - prevHolesL.Append ( it.Key() ); - - } // Loop on map of equal pairs searching for innermost wires - - // make faces - FR.Perform(); - if (FR.IsDone()) { - for (; FR.More(); FR.Next()) - myNewFaces.Append(FR.Current()); - } - - FR.Clear(); - - // add hole-parts to FaceRestrictor, - // remove them from the EqWM, - // remove found wires as internal of resting classified wires - Standard_Boolean clearOuterInner = ( prevHolesL.Extent() < EqWM.Extent() ); - TopTools_ListIteratorOfListOfShape itPrev (prevHolesL); - for (; itPrev.More(); itPrev.Next()) { - TopoDS_Wire& Hole = TopoDS::Wire ( itPrev.Value() ); - FR.Add ( Hole ); - if (clearOuterInner) { - const TopoDS_Wire& outerW = TopoDS::Wire ( EqWM.Find( Hole ) ); - // Loop on wires including outerW - TopTools_ListIteratorOfListOfShape itO( OuterInner.Ascendant( outerW )); - for (; itO.More(); itO.Next()) { - TopTools_ListOfShape& innerL = OuterInner.ChangeDescendant( itO.Value() ); - TopTools_ListIteratorOfListOfShape itI (innerL); - // Loop on internal wires of current including wire - for (; itI.More(); itI.Next()) - if ( outerW.IsSame( itI.Value() )) { - innerL.Remove( itI ); break; - } - } - } - EqWM.UnBind ( Hole ); - } - - if (nbEqW == EqWM.Extent()) - { - // error: pb with wires classification -#ifdef DEB - MESSAGE("Partition_Loop2d::WiresToFaces(), pb with wires classification"); -#endif - break; - } - - } // while (!EqWM.IsEmpty) - - } // if !EqWM.IsEmpty() - - myNewWires.Append ( myInternalWL ); - - TopTools_ListIteratorOfListOfShape itW (myNewWires); - for (; itW.More(); itW.Next()) { - TopoDS_Wire& W = TopoDS::Wire ( itW.Value() ); - FR.Add(W); - } - FR.Perform(); - for (; FR.IsDone() && FR.More(); FR.Next()) - myNewFaces.Append(FR.Current()); - - - TopTools_ListIteratorOfListOfShape itNF (myNewFaces); - for (; itNF.More(); itNF.Next()) - itNF.Value().Orientation( myFaceOri ); -} diff --git a/src/PARTITION/Partition_Loop2d.hxx b/src/PARTITION/Partition_Loop2d.hxx deleted file mode 100644 index e60b515a1..000000000 --- a/src/PARTITION/Partition_Loop2d.hxx +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop2d.hxx -// Module : GEOM -// -#ifndef _Partition_Loop2d_HeaderFile -#define _Partition_Loop2d_HeaderFile - -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopAbs_Orientation_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile -#include -#endif -class TopoDS_Face; -class TopoDS_Edge; -class TopTools_ListOfShape; -class BRepAlgo_Image; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class Partition_Loop2d { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT Partition_Loop2d(); -Standard_EXPORT void Init(const TopoDS_Face& F) ; -Standard_EXPORT void AddConstEdge(const TopoDS_Edge& E) ; -Standard_EXPORT void AddSectionEdge(const TopoDS_Edge& E) ; -Standard_EXPORT void Perform() ; -Standard_EXPORT const TopTools_ListOfShape& NewWires() const; -Standard_EXPORT void WiresToFaces(const BRepAlgo_Image& EdgeImage) ; -Standard_EXPORT const TopTools_ListOfShape& NewFaces() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopoDS_Face myFace; -TopAbs_Orientation myFaceOri; -TopTools_ListOfShape myConstEdges; -TopTools_ListOfShape myNewWires; -TopTools_ListOfShape myNewFaces; -TopTools_ListOfShape myInternalWL; -TopTools_MapOfShape mySectionEdges; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/PARTITION/Partition_Loop2d.ixx b/src/PARTITION/Partition_Loop2d.ixx deleted file mode 100644 index 18b728c33..000000000 --- a/src/PARTITION/Partition_Loop2d.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 "Partition_Loop2d.jxx" - - - - diff --git a/src/PARTITION/Partition_Loop2d.jxx b/src/PARTITION/Partition_Loop2d.jxx deleted file mode 100644 index 0118ee22e..000000000 --- a/src/PARTITION/Partition_Loop2d.jxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _BRepAlgo_Image_HeaderFile -#include -#endif -#ifndef _Partition_Loop2d_HeaderFile -#include "Partition_Loop2d.hxx" -#endif diff --git a/src/PARTITION/Partition_Loop3d.cdl b/src/PARTITION/Partition_Loop3d.cdl deleted file mode 100644 index 33e90df74..000000000 --- a/src/PARTITION/Partition_Loop3d.cdl +++ /dev/null @@ -1,84 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File : Partition_Loop3d.cdl --- Module : GEOM - -class Loop3d from Partition - - ---Purpose: Builds the shells from a set of faces. - -- Provides methods for comparing faces mutual - -- location. - -uses - Vec from gp, - MapOfOrientedShape from TopTools, - IndexedDataMapOfShapeListOfShape from TopTools, - Face from TopoDS, - Edge from TopoDS, - ListOfShape from TopTools, - Shape from TopoDS - -is - - Create; - - AddConstFaces (me : in out; S : Shape from TopoDS) - ---Purpose: Add faces of as unique faces in the result. - is static; - - AddSectionFaces (me : in out; S : Shape from TopoDS) - ---Purpose: Add faces of as double faces in the result. - is static; - - MakeShells (me : in out; AvoidFacesMap : MapOfOrientedShape from TopTools) - returns ListOfShape from TopTools is static; - ---Purpose: Make and return shells. - -- can contain faces that must not be - -- added to result shells. - ---C++: return const & - - - ---Category: class methods - - IsInside (myclass; E : Edge from TopoDS; - F1, F2 : Face from TopoDS; - CountDot : Boolean from Standard; - Dot : in out Real from Standard; - GoodOri : in out Boolean from Standard) - returns Boolean from Standard; - ---Purpose: check if is inside by edge . - -- if , compute : scalar production of - -- normalized vectors pointing inside faces, and - -- check if faces are oriented well for sewing - - Normal (myclass; E : Edge from TopoDS; - F : Face from TopoDS) returns Vec from gp; - - -fields - - myNewShells : ListOfShape from TopTools; -- result - - myFaces : ListOfShape from TopTools; - myEFMap : IndexedDataMapOfShapeListOfShape from TopTools; - -end Loop3d; diff --git a/src/PARTITION/Partition_Loop3d.cxx b/src/PARTITION/Partition_Loop3d.cxx deleted file mode 100644 index ccca4a36b..000000000 --- a/src/PARTITION/Partition_Loop3d.cxx +++ /dev/null @@ -1,368 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop3d.cxx -// Module : GEOM -// -#include "Partition_Loop3d.ixx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -//======================================================================= -//function : Partition_Loop3d -//purpose : -//======================================================================= - -Partition_Loop3d::Partition_Loop3d() -{ -} - -//======================================================================= -//function : AddConstFaces -//purpose : Add faces of as unique faces in the result. -//======================================================================= - -void Partition_Loop3d::AddConstFaces(const TopoDS_Shape& S) -{ - TopExp_Explorer FaceExp(S, TopAbs_FACE); - for (; FaceExp.More(); FaceExp.Next()) - myFaces.Append( FaceExp.Current() ); - - TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, myEFMap); -} - -//======================================================================= -//function : AddSectionFaces -//purpose : Add faces of as double faces in the result. -//======================================================================= - -void Partition_Loop3d::AddSectionFaces(const TopoDS_Shape& S) -{ - AddConstFaces( S ); - AddConstFaces( S.Reversed() ); -} - -//======================================================================= -//function : MakeShells -//purpose : Make and return shells. -// can contain faces that must not be -// added to result shells. -//======================================================================= - -const TopTools_ListOfShape& - Partition_Loop3d::MakeShells (const TopTools_MapOfOrientedShape& AvoidFacesMap) -{ - myNewShells.Clear(); - - BRep_Builder Builder; - TopTools_MapOfShape CheckedEdgesMap; - TopTools_MapOfOrientedShape AddedFacesMap; - - TopTools_ListIteratorOfListOfShape itF (myFaces); - for (; itF.More(); itF.Next()) - { - const TopoDS_Shape& FF = itF.Value(); - if (AvoidFacesMap.Contains( FF ) || - ! AddedFacesMap.Add( FF ) ) - continue; - - // make a new shell - TopoDS_Shell Shell; - Builder.MakeShell(Shell); - Builder.Add(Shell,FF); - - // clear the maps from shapes added to previous Shell - TopTools_MapIteratorOfMapOfShape itEM (CheckedEdgesMap); - for (; itEM.More(); itEM.Next()) { - TopTools_ListOfShape& FL = myEFMap.ChangeFromKey( itEM.Key()); - TopTools_ListIteratorOfListOfShape it (FL); - while ( it.More()) { - if (AddedFacesMap.Contains( it.Value())) - FL.Remove( it ); - else - it.Next(); - } - } - CheckedEdgesMap.Clear(); - - - // loop on faces added to Shell; add their neighbor faces to Shell and so on - TopoDS_Iterator itAddedF (Shell); - for (; itAddedF.More(); itAddedF.Next()) - { - const TopoDS_Face& F = TopoDS::Face (itAddedF.Value()); - - // loop on edges of F; find a good neighbor face of F by E - TopExp_Explorer EdgeExp(F, TopAbs_EDGE); - for (; EdgeExp.More(); EdgeExp.Next()) - { - const TopoDS_Edge& E = TopoDS::Edge( EdgeExp.Current()); - if (! CheckedEdgesMap.Add( E )) - continue; - - // candidate faces list - const TopTools_ListOfShape& FL = myEFMap.ChangeFromKey(E); - if (FL.IsEmpty()) - continue; - // select one of neighbors - TopoDS_Face SelF; - if (FL.Extent() == 2) { - if (! F.IsSame( FL.First() )) - SelF = TopoDS::Face( FL.First() ); - else if (!F.IsSame( FL.Last() )) - SelF = TopoDS::Face( FL.Last() ); - } - else { - // check if a face already added to Shell shares E - TopTools_ListIteratorOfListOfShape it (FL); - Standard_Boolean found = Standard_False; - for (; !found && it.More(); it.Next()) - if (F != it.Value()) - found = AddedFacesMap.Contains( it.Value() ); - if (found) - continue; - // select basing on geometrical check - Standard_Boolean GoodOri, inside; - Standard_Real dot, MaxDot = -100; - TopTools_ListOfShape TangFL; // tangent faces - for ( it.Initialize( FL ) ; it.More(); it.Next()) { - const TopoDS_Face& NeighborF = TopoDS::Face( it.Value()); - if (NeighborF.IsSame( F )) - continue; - inside = Partition_Loop3d::IsInside( E, F, NeighborF, 1, dot, GoodOri); - if (!GoodOri) - continue; - if (!inside) - dot = -dot - 3; - if (dot < MaxDot) - continue; - if ( IsEqual( dot, MaxDot)) - TangFL.Append(SelF); - else - TangFL.Clear(); - MaxDot = dot; - SelF = NeighborF; - } - if (!TangFL.IsEmpty()) { - for (it.Initialize( TangFL ); it.More(); it.Next()) { - const TopoDS_Face& NeighborF = TopoDS::Face( it.Value()); - if (Partition_Loop3d:: IsInside( E, SelF , NeighborF, 0, dot, GoodOri)) - SelF = NeighborF; - } - } - } - if (!SelF.IsNull() && - AddedFacesMap.Add( SelF ) && - !AvoidFacesMap.Contains( SelF )) - Builder.Add( Shell, SelF); - - } // loop on edges of F - - } // loop on the faces added to Shell - - // Shell is complete - myNewShells.Append( Shell ); - - } // loop on myFaces - - - // prepare to the next call - myFaces.Clear(); - myEFMap.Clear(); - - return myNewShells; -} - - - -//======================================================================= -//function : Normal -//purpose : -//======================================================================= - -gp_Vec Partition_Loop3d::Normal(const TopoDS_Edge& E, - const TopoDS_Face& F) -{ - gp_Vec Norm, V1, V2; - Standard_Real First, Last; - gp_Pnt Ps; - - Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface (E, F, First, Last); - Handle(Geom_Surface) Sf = BRep_Tool::Surface(F); - - gp_Pnt2d p = C2d->Value( 0.5*(First+Last) ); - Sf->D1(p.X(), p.Y(), Ps, V1, V2); - Norm = V1.Crossed(V2); - - if (F.Orientation() == TopAbs_REVERSED ) - Norm.Reverse(); - - return Norm; -} - -//======================================================================= -//function : NextNormal -//purpose : find normal to F at point a little inside F near the middle of E -//warning : E must be properly oriented in F. -//======================================================================= - -static gp_Vec NextNormal(const TopoDS_Edge& E, - const TopoDS_Face& F) -{ - Standard_Real First, Last; - - Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface (E, F, First, Last); - Handle(Geom_Surface) Sf = BRep_Tool::Surface(F); - - gp_Pnt2d p; - gp_Vec2d v; - C2d->D1( 0.5*(First+Last), p, v); - if (E.Orientation() != F.Orientation()) - v.Reverse(); - gp_Dir2d dir( -v.Y(), v.X() ); // dir inside F - - Standard_Real duv = 1e-6; // this is not Ok and may give incorrect result if - // resolutionUV of compared faces is very different. To have a good result, - //it is necessary to get normal to faces at points equidistant from E in 3D - - p.SetX( p.X() + dir.X()*duv ); - p.SetY( p.Y() + dir.Y()*duv ); - - gp_Pnt Ps; - gp_Vec Norm, V1, V2, VV1, VV2; - Sf->D1( p.X(), p.Y(), Ps, V1, V2); - Norm = V1.Crossed(V2); - - if (F.Orientation() == TopAbs_REVERSED ) - Norm.Reverse(); - - return Norm; -} - - -//======================================================================= -//function : FindEinF -//purpose : find E in F -//======================================================================= - -static TopoDS_Edge FindEinF(const TopoDS_Edge& E, - const TopoDS_Face& F) -{ - TopExp_Explorer expl (F, TopAbs_EDGE); - for (; expl.More(); expl.Next()) - if( E.IsSame( expl.Current() )) - return TopoDS::Edge(expl.Current()); - TopoDS_Edge nullE; - return nullE; -} - -//======================================================================= -//function : IsInside -//purpose : check if is inside by edge . -// if , compute : scalar production of -// normalized vectors pointing inside faces, and -// check if faces are oriented well for sewing -//======================================================================= - -Standard_Boolean Partition_Loop3d::IsInside(const TopoDS_Edge& E, - const TopoDS_Face& F1, - const TopoDS_Face& F2, - const Standard_Boolean CountDot, - Standard_Real& Dot, - Standard_Boolean& GoodOri) -{ - Standard_Real f, l; - gp_Pnt P; - gp_Vec Vc1, Vc2, Vin1, Vin2, Nf1, Nf2; - Handle(Geom_Curve) Curve = BRep_Tool::Curve(E,f,l); - Curve->D1( 0.5*(f + l), P, Vc2); - TopoDS_Edge E1, E2 = FindEinF (E, F2); - if (E2.Orientation() == TopAbs_REVERSED ) Vc2.Reverse(); - - Nf1 = Normal(E,F1); - Nf2 = Normal(E,F2); - - Standard_Real sin = - Nf1.CrossSquareMagnitude(Nf2) / Nf1.SquareMagnitude() / Nf2.SquareMagnitude(); - Standard_Boolean tangent = sin < 0.001; - - Standard_Boolean inside = 0; - if (tangent) { - E1 = FindEinF (E, F1); - gp_Vec NNf1 = NextNormal(E1,F1); - gp_Vec NNf2 = NextNormal(E2,F2); - Vin2 = NNf2.Crossed(Vc2); - inside = Vin2 * NNf1 < 0; - } - else { - Vin2 = Nf2.Crossed(Vc2); - inside = Vin2 * Nf1 < 0; - } - - if (!CountDot) return inside; - - if (tangent) - Vin2 = Nf2.Crossed(Vc2); - else - E1 = FindEinF (E, F1); - - Vc1 = Vc2; - if (E1.Orientation() != E2.Orientation()) - Vc1.Reverse(); - Vin1 = Nf1.Crossed(Vc1); - - if (tangent) { - Standard_Real N1N2 = Nf1 * Nf2; - GoodOri = (Vin2 * Vin1 < 0) ? N1N2 > 0 : N1N2 < 0; - } - else { - Standard_Real V1N2 = Vin1 * Nf2; - GoodOri = ( inside ? V1N2 <= 0 : V1N2 >= 0); - } - - Vin1.Normalize(); - Vin2.Normalize(); - - Dot = Vin2 * Vin1; - - return inside; -} - diff --git a/src/PARTITION/Partition_Loop3d.hxx b/src/PARTITION/Partition_Loop3d.hxx deleted file mode 100644 index cf7a2f209..000000000 --- a/src/PARTITION/Partition_Loop3d.hxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Loop3d.hxx -// Module : GEOM -// -#ifndef _Partition_Loop3d_HeaderFile -#define _Partition_Loop3d_HeaderFile - -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -class TopoDS_Shape; -class TopTools_ListOfShape; -class TopTools_MapOfOrientedShape; -class TopoDS_Edge; -class TopoDS_Face; -class gp_Vec; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class Partition_Loop3d { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT Partition_Loop3d(); -Standard_EXPORT void AddConstFaces(const TopoDS_Shape& S) ; -Standard_EXPORT void AddSectionFaces(const TopoDS_Shape& S) ; -Standard_EXPORT const TopTools_ListOfShape& MakeShells(const TopTools_MapOfOrientedShape& AvoidFacesMap) ; -Standard_EXPORT static Standard_Boolean IsInside(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const Standard_Boolean CountDot,Standard_Real& Dot,Standard_Boolean& GoodOri) ; -Standard_EXPORT static gp_Vec Normal(const TopoDS_Edge& E,const TopoDS_Face& F) ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TopTools_ListOfShape myNewShells; -TopTools_ListOfShape myFaces; -TopTools_IndexedDataMapOfShapeListOfShape myEFMap; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/PARTITION/Partition_Loop3d.ixx b/src/PARTITION/Partition_Loop3d.ixx deleted file mode 100644 index 83205eb5e..000000000 --- a/src/PARTITION/Partition_Loop3d.ixx +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2007-2008 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 "Partition_Loop3d.jxx" - - - - diff --git a/src/PARTITION/Partition_Loop3d.jxx b/src/PARTITION/Partition_Loop3d.jxx deleted file mode 100644 index 7b8e1f45f..000000000 --- a/src/PARTITION/Partition_Loop3d.jxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2008 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 _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfOrientedShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _TopoDS_Face_HeaderFile -#include -#endif -#ifndef _gp_Vec_HeaderFile -#include -#endif -#ifndef _Partition_Loop3d_HeaderFile -#include "Partition_Loop3d.hxx" -#endif diff --git a/src/PARTITION/Partition_Spliter.cdl b/src/PARTITION/Partition_Spliter.cdl deleted file mode 100644 index 1954b9748..000000000 --- a/src/PARTITION/Partition_Spliter.cdl +++ /dev/null @@ -1,183 +0,0 @@ --- Copyright (C) 2007-2008 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 --- --- File : Partition_Spliter.cdl --- Author : Benedicte MARTIN --- Module : GEOM - -class Spliter from Partition - - ---Purpose: Split solids, shells and faces into parts of the - -- same topology if reconstruction level is not - -- limited. - -uses - Inter3d from Partition, - Loop2d from Partition, - Builder from BRep, - ShapeEnum from TopAbs, - Compound from TopoDS, - Face from TopoDS, - Edge from TopoDS, - Shape from TopoDS, - MapOfOrientedShape from TopTools, - IndexedMapOfShape from TopTools, - DataMapOfShapeShape from TopTools, - ListOfShape from TopTools, - MapOfShape from TopTools, - AsDes from BRepAlgo, - Image from BRepAlgo - -is - Create returns Spliter from Partition; - ---Purpose: constructor - - AddShape ( me : in out; S : Shape from TopoDS); - ---Purpose: add object Shape to be splitted. - -- If S is a COMPOUND or COMPSOLID, it will be - -- exploded in order to get more simple object - -- shapes. - -- Object shapes that are vertices, edges or wires - -- won't be splitted and won't be in a result. - - AddTool ( me : in out; S : Shape from TopoDS); - ---Purpose: add cutting tool - - Compute (me : in out; Limit : ShapeEnum from TopAbs - = TopAbs_SHAPE); - ---Purpose: produce a result which is a compound of parts of - -- object shapes. A part can be either a vertex, - -- edge, wire, face, shell or solid. - -- By default, a part is of the same topology as an - -- object shape, else restricts parts - -- reconstruction. - -- If == TopAbs_VERTEX, only new vertices are - -- returned in the result - - KeepShapesInside (me : in out; S : Shape from TopoDS); - ---Purpose: remove shapes that are outside of S from result. - -- S should be an object shape. - ---Warning: call it after Compute() - - RemoveShapesInside (me : in out; S : Shape from TopoDS); - ---Purpose: remove shapes that are inside S from result. - -- S should be an object shape. - ---Warning: call it after Compute() - - Shape ( me ) returns Shape from TopoDS; - ---Purpose: return resulting compound - - Clear ( me : in out); - ---Purpose: clear fields - - - ---Category: private methods - - - MakeSolids (me: in out; Solid : Shape from TopoDS; - Shells: in out ListOfShape from TopTools) - is private; - ---Purpose: make solids out of Shells - - MakeShells (me: in out; S : Shape from TopoDS; - NS: in out ListOfShape from TopTools) is private; - ---Purpose: split S into shells - - MakeFaces (me: in out; S : Shape from TopoDS) - returns Shape from TopoDS is private; - ---Purpose: split faces of S, return compound of new faces - - MakeEdges (me; - E : Edge from TopoDS; - VOnE : ListOfShape from TopTools; - NE : in out ListOfShape from TopTools) - is private; - ---Purpose: cut E by vertices VOnE, return list of new edges - -- NE - - FindFacesInside (me: in out; S : Shape from TopoDS; - CheckClosed : Boolean = Standard_False; - All : Boolean = Standard_False) - returns Shape from TopoDS is private; - ---Purpose: return compound of faces of other shapes that are - -- inside . must have image in myImageShape. - -- makes avoid faces that do not form a - -- closed shell - -- makes return already added faces - - CheckTool ( me: in out; S : Shape from TopoDS) - returns Boolean from Standard is private; - ---Purpose: Return True if is a tool shape. Prepare tool - -- faces of for the search of internal faces. - - MergeEqualEdges (me: in out; LE : ListOfShape from TopTools) is private; - ---Purpose: among LE, find equal edges, choose ones to keep - -- and make them have pcurves on all faces they are - -- shared by - -- contains edge splits - - IsInside (myclass; S1,S2 : Shape from TopoDS) - returns Boolean from Standard is private; - ---Purpose: Return True if the first vertex of S1 inside S2. - -- If S1.IsNull(), check infinite point against S2. - - GetOriginalShape(me; aShape : Shape from TopoDS) - returns Shape from TopoDS is private; - ---Purpose: Return the shape aShape originates from. aShape - -- should be a face or more complex result shape - - FindToolsToReconstruct(me: in out) is private; - ---Purpose: find and store as objects tools which interfere - -- with solids or are inside solids without - -- an interference - -fields - - myDoneStep : ShapeEnum from TopAbs; -- rebuilt level - myShape : Compound from TopoDS; -- result - myBuilder : Builder from BRep; - - myListShapes : ListOfShape from TopTools; -- object shapes - myMapFaces : MapOfShape from TopTools; -- object faces - myMapTools : MapOfShape from TopTools; -- tool faces - myEqualEdges : MapOfShape from TopTools; -- equal splits - myNewSection : MapOfShape from TopTools; -- new secton edges - myClosedShapes : MapOfShape from TopTools; - mySharedFaces : MapOfShape from TopTools; -- faces shared by several shapes - myWrappingSolid: MapOfShape from TopTools; -- solids having other shapes inside - myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face - - myInternalFaces: DataMapOfShapeShape from TopTools; -- shape and its internal faces - myIntNotClFaces: DataMapOfShapeShape from TopTools; -- internal but not closed - - - myAsDes : AsDes from BRepAlgo; - myImagesFaces : Image from BRepAlgo; - myImagesEdges : Image from BRepAlgo; - myImageShape : Image from BRepAlgo; - - -- contains info of same domain shapes and section edges - myInter3d : Inter3d from Partition; - - -- avoid rebuilding twice commont part of solids - myAddedFacesMap: MapOfOrientedShape from TopTools; - -end Spliter; diff --git a/src/PARTITION/Partition_Spliter.cxx b/src/PARTITION/Partition_Spliter.cxx deleted file mode 100644 index b9f437e42..000000000 --- a/src/PARTITION/Partition_Spliter.cxx +++ /dev/null @@ -1,2160 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Spliter.cxx -// Author : Benedicte MARTIN -// Module : GEOM -// $Header$ -// -#include "Partition_Inter2d.hxx" -#include "Partition_Inter3d.hxx" -#include "Partition_Loop2d.hxx" -#include "Partition_Loop3d.hxx" -#include "Partition_Spliter.ixx" - -#include "utilities.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#ifdef DEB -//# define PART_PERF -#endif - -#ifdef PART_PERF -# include -#endif - -using namespace std; - -//======================================================================= -//function : isClosed -//purpose : check id a shape is closed, ie is a solid or a closed shell -//======================================================================= - -static Standard_Boolean isClosed(const TopoDS_Shape& theShape) -{ - Standard_Boolean isClosed = (theShape.ShapeType() == TopAbs_SOLID); - - if (!isClosed && theShape.ShapeType() == TopAbs_SHELL) { - TopTools_IndexedDataMapOfShapeListOfShape MEF; - TopExp::MapShapesAndAncestors(theShape, TopAbs_EDGE, TopAbs_FACE, MEF); - for (Standard_Integer i=1; isClosed && i<=MEF.Extent(); ++i) - isClosed = ( MEF(i).Extent() != 1 ); - } - - return isClosed; -} - -//======================================================================= -//function : Partition_Spliter -//purpose : constructor -//======================================================================= - -Partition_Spliter::Partition_Spliter() -{ - myAsDes = new BRepAlgo_AsDes; - Clear(); -} - -//======================================================================= -//function : AddTool -//purpose : add cutting tool that will _NOT_ be in result -//======================================================================= - -void Partition_Spliter::AddTool(const TopoDS_Shape& S) -{ - if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid - TopoDS_Iterator it (S); - for (; it.More(); it.Next()) - { - AddTool( it.Value()); - myFaceShapeMap.Bind( it.Value(), S ); // to know compound by shape - } - return; - } - - for (TopExp_Explorer exp(S,TopAbs_FACE); exp.More(); exp.Next()) - { - myMapTools.Add(exp.Current()); - myFaceShapeMap.Bind( exp.Current(), S ); - } - if (isClosed( S )) - myClosedShapes.Add( S ); -} - -//======================================================================= -//function : AddShape -//purpose : add object Shape to be splited -//======================================================================= - -void Partition_Spliter::AddShape(const TopoDS_Shape& S) -{ - if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid - TopoDS_Iterator it (S); - for (; it.More(); it.Next()) - { - AddShape( it.Value()); - myFaceShapeMap.Bind( it.Value(), S ); // to know compound by shape - } - return; - } - - TopExp_Explorer exp(S,TopAbs_FACE); - if (!exp.More()) { // do not split edges and vertices - //myBuilder.Add( myShape, S ); - return; - } - - Standard_Integer nbFacesBefore = myMapFaces.Extent(); // not to add twice the same S - for (; exp.More(); exp.Next()) { - const TopoDS_Shape & aFace = exp.Current(); - if ( ! myFaceShapeMap.IsBound( aFace )) // keep shape of tool face added as object - myFaceShapeMap.Bind( aFace, S ); - if (myMapFaces.Add( aFace )) - myImagesFaces.SetRoot( aFace ); - } - - if (nbFacesBefore == myMapFaces.Extent()) - return; - - // solids must be processed before all - if (S.ShapeType() == TopAbs_SOLID) - myListShapes.Prepend(S); - else - myListShapes.Append(S); - - if (isClosed( S )) - myClosedShapes.Add( S ); - -} - -//======================================================================= -//function : Shape -//purpose : return resulting compound -//======================================================================= - -TopoDS_Shape Partition_Spliter::Shape() const -{ - return myShape; -} - -//======================================================================= -//function : Clear -//purpose : clear fields -//======================================================================= - -void Partition_Spliter::Clear() -{ - myDoneStep = TopAbs_SHAPE; - - myListShapes.Clear(); - myMapFaces.Clear(); - myMapTools.Clear(); - myEqualEdges.Clear(); - myNewSection.Clear(); - myClosedShapes.Clear(); - mySharedFaces.Clear(); - myWrappingSolid.Clear(); - myFaceShapeMap.Clear(); - - myInternalFaces.Clear(); - myIntNotClFaces.Clear(); - - myAsDes->Clear(); - myImagesFaces.Clear(); - myImagesEdges.Clear(); - myImageShape.Clear(); - - myInter3d = Partition_Inter3d(myAsDes); - - myAddedFacesMap.Clear(); - -} - -//======================================================================= -//function : Compute -//purpose : produce a result -//======================================================================= - -void Partition_Spliter::Compute(const TopAbs_ShapeEnum Limit) -{ - if ((Limit != TopAbs_SHAPE && myDoneStep == Limit) || - (Limit == TopAbs_SHAPE && myDoneStep == TopAbs_SOLID)) - return; - - myBuilder.MakeCompound( myShape ); - - TopTools_MapIteratorOfMapOfShape it; - TopTools_ListIteratorOfListOfShape itl; - TopExp_Explorer exp; - -#ifdef PART_PERF - OSD_Chronometer aCron; -#endif - - if (myDoneStep > TopAbs_VERTEX) { - - TopTools_ListOfShape aListFaces; - aListFaces = myImagesFaces.Roots(); - for (it.Initialize(myMapTools); it.More(); it.Next()) - aListFaces.Append(it.Key()); - -#ifdef PART_PERF - aCron.Start(); -#endif - - //----------------------------------------------- - // Intersection between faces - //----------------------------------------------- - // result is in myAsDes as a map Face - list of new edges; - // special care is done for section edges, same domain faces and vertices: - // data about them is inside myInter3d - myInter3d.CompletPart3d(aListFaces, myFaceShapeMap); - -#ifdef PART_PERF - MESSAGE("+++ CompletPart3d()"); - aCron.Show( cout ); - aCron.Reset(); - aCron.Start(); -#endif - //----------------------------------------------- - // Intersection of edges - //----------------------------------------------- - - // add tool faces which must be reconstructed to myMapFaces too - FindToolsToReconstruct(); - -#ifdef PART_PERF - MESSAGE("+++ FindToolsToReconstruct()"); - aCron.Show( cout ); - aCron.Reset(); - aCron.Start(); -#endif - - // add existing vertices to edges of object faces in myAsDes - TopTools_MapOfShape DoneEM; - for ( it.Initialize(myMapFaces); it.More(); it.Next()) { - const TopoDS_Shape& F = it.Key(); - TopoDS_Face FForward = TopoDS::Face(F.Oriented(TopAbs_FORWARD)); - for (exp.Init(FForward,TopAbs_EDGE); exp.More(); exp.Next()) { - const TopoDS_Edge& E = TopoDS::Edge( exp.Current() ); - myAsDes->Add(FForward,E); - if (DoneEM.Add(E)) { - TopoDS_Iterator itV(E); - for (; itV.More(); itV.Next()) { - const TopoDS_Vertex& V = TopoDS::Vertex( itV.Value()); - myAsDes->Add(E, myInter3d.ReplaceSameDomainV( V, E )); - } - } - } - } - - // intersect edges that are descendants of a face in myAsDes - TopTools_MapOfShape& Modif = myInter3d.TouchedFaces(); - for ( it.Initialize(Modif); it.More(); it.Next()) { - const TopoDS_Face& F = TopoDS::Face(it.Key()); - Partition_Inter2d::CompletPart2d (myAsDes, F, myInter3d.NewEdges()); - } - // now myAsDes contains also new vertices made at edge intersection as - // descendant of edges both new and old - - myDoneStep = TopAbs_VERTEX; - -#ifdef PART_PERF - MESSAGE("+++ CompletPart2d()"); - aCron.Show( cout ); - aCron.Reset(); - aCron.Start(); -#endif - } // if (myDoneStep > TopAbs_VERTEX) - - if (Limit == TopAbs_VERTEX) { - // add new vertices to myShape - for ( it.Initialize( myInter3d.NewEdges() ); it.More(); it.Next()) { - if (! myAsDes->HasDescendant( it.Key() )) - continue; - itl.Initialize( myAsDes->Descendant( it.Key() )); - for (; itl.More(); itl.Next()) - myBuilder.Add ( myShape, itl.Value() ); - } - return; - } - - - if (myDoneStep > TopAbs_EDGE) { - - //----------------------------------------------- - //----------------------------------------------- - // ------- Reconstruction of all the edges.------ - //----------------------------------------------- - //----------------------------------------------- - - // ============== - // cut new edges - // ============== - TopTools_ListOfShape LSE; // all edge splits - for ( it.Initialize(myInter3d.NewEdges()); it.More(); it.Next()) { - - TopoDS_Vertex V1,V2; - TopoDS_Edge EE = TopoDS::Edge(it.Key()); - - TopTools_ListOfShape aListV, aListF; - aListV = myAsDes->Descendant(EE); // intersection vertices - aListF = myAsDes->Ascendant(EE); // intersected faces - - if (aListV.IsEmpty()) - continue; // new edge does not intersect any other edge - - // Add end vertices to new edges only if - // one face is Tool and the other is Shape - Standard_Boolean isTool1 = ! myMapFaces.Contains( aListF.First() ); - Standard_Boolean isTool2 = ! myMapFaces.Contains( aListF.Last() ); - if (isTool1 || isTool2) - { - TopExp::Vertices(EE,V1,V2); - Standard_Real Tol = Max (BRep_Tool::Tolerance( V1 ), - BRep_Tool::Tolerance( V2 )); - - gp_Pnt P1 = BRep_Tool::Pnt(V1); - gp_Pnt P2 = BRep_Tool::Pnt(V2); - Standard_Boolean AddV1 = Standard_True; - Standard_Boolean AddV2 = Standard_True; - - // add only if there is no intersection at end vertex - for (itl.Initialize(aListV); itl.More(); itl.Next()) { - const TopoDS_Vertex& Ve = TopoDS::Vertex(itl.Value()) ; - Standard_Real Tol2 = Max ( Tol, BRep_Tool::Tolerance( Ve )); - Tol2 *= Tol2; - gp_Pnt P = BRep_Tool::Pnt(Ve); - if (AddV1 && P.SquareDistance(P1) <= Tol2) - AddV1 = Standard_False; - - if (AddV2 && P.SquareDistance(P2) <= Tol2) - AddV2 = Standard_False; - } - - if (AddV1) { - aListV.Append(V1); - myAsDes->Add(EE,V1); - } - - if (AddV2) { - aListV.Append(V2); - myAsDes->Add(EE,V2); - } - } - - // cut new edges - Standard_Integer NbV=aListV.Extent() ; - if (NbV>1 || (NbV==1 && V1.IsSame(V2)) ) { - TopTools_ListOfShape LNE; - MakeEdges (EE,aListV, LNE); - myImagesEdges.Bind(EE,LNE); - LSE.Append( LNE ); - } - } - - // ============== - // cut old edges - // ============== - for ( it.Initialize(myMapFaces); it.More(); it.Next()) { - for (exp.Init( it.Key(), TopAbs_EDGE); exp.More(); exp.Next()) { - const TopoDS_Edge& EE = TopoDS::Edge( exp.Current() ); - if ( myImagesEdges.HasImage( EE )) - continue; - TopTools_ListOfShape LNE; - const TopTools_ListOfShape& aListVV = myAsDes->Descendant(EE); - MakeEdges (EE, aListVV, LNE); - myImagesEdges.Bind(EE,LNE); - LSE.Append( LNE ); - } - } -#ifdef PART_PERF - MESSAGE("+++ Cut Edges"); - aCron.Show( cout ); - aCron.Reset(); - aCron.Start(); -#endif - - // process same domain section edges - MergeEqualEdges( LSE ); - - myDoneStep = TopAbs_EDGE; - -#ifdef PART_PERF - MESSAGE("+++ MergeEqualEdges()"); - aCron.Show( cout ); - aCron.Reset(); - aCron.Start(); -#endif - } // if (myDoneStep > TopAbs_EDGE) - - if (Limit == TopAbs_EDGE) { - // add splits of old edges - TopTools_ListIteratorOfListOfShape itNE; - for (itl.Initialize( myListShapes );itl.More();itl.Next()) { - if (myMapTools.Contains( itl.Value() )) - continue; // skip tool faces - for ( exp.Init( itl.Value(), TopAbs_EDGE ); exp.More(); exp.Next()) { - itNE.Initialize( myImagesEdges.Image( exp.Current() )); - for ( ; itNE.More(); itNE.Next()) - myBuilder.Add ( myShape, itNE.Value() ); - } - } - // add splits of new edges - for ( it.Initialize( myInter3d.NewEdges() ); it.More(); it.Next()) { - itNE.Initialize( myImagesEdges.Image( it.Key() )); - for (; itNE.More(); itNE.Next()) - myBuilder.Add ( myShape, itNE.Value() ); - } - return; - } - - - //----------------------------------------------- - // split faces - //----------------------------------------------- - - if (myDoneStep > TopAbs_FACE) { - - for (itl.Initialize(myListShapes);itl.More();itl.Next()) { - TopoDS_Shape FacesComp = MakeFaces ( itl.Value()); - // there is a cunning here: myImagesFaces keeps faces made by Loop2d - // but some of them may be replaced with splits of same domain face - // and myImageShape keeps ultimate result - myImageShape.Bind( itl.Value(), FacesComp ); - } - - myDoneStep = TopAbs_FACE; -#ifdef PART_PERF - MESSAGE("+++ MakeFaces()"); - aCron.Show( cout ); - aCron.Reset(); - aCron.Start(); -#endif - } - - if (Limit == TopAbs_WIRE || - Limit == TopAbs_FACE) { - for (itl.Initialize(myListShapes);itl.More();itl.Next()) { - if ( myMapTools.Contains( itl.Value() )) - continue; // no result needed for a tool face - const TopoDS_Shape& FacesComp = myImageShape.Image( itl.Value() ).First(); - for ( exp.Init( FacesComp, Limit); exp.More(); exp.Next()) - myBuilder.Add ( myShape, exp.Current()); - } - return; - } - - - //----------------------------------------------- - // split and add solids and shells - //----------------------------------------------- - - Standard_Boolean makeSolids = (Limit == TopAbs_SHAPE || - Limit < TopAbs_SHELL); - for (itl.Initialize(myListShapes);itl.More();itl.Next()) - { - const TopoDS_Shape & S = itl.Value(); - if (S.ShapeType() > TopAbs_SHELL) - continue; - - TopTools_ListOfShape NSL; // new shape list - MakeShells (S , NSL); - if (makeSolids && S.ShapeType() == TopAbs_SOLID ) - MakeSolids( S, NSL ); - - // store new shells or solids - TopTools_ListIteratorOfListOfShape itNSL (NSL); - for ( ; itNSL.More(); itNSL.Next()) - myBuilder.Add (myShape, itNSL.Value()); - } -#ifdef PART_PERF - MESSAGE("+++ MakeShells()"); - aCron.Show( cout ); -#endif - - //----------------------------------------------- - // add split faces - //----------------------------------------------- - - for (itl.Initialize(myListShapes);itl.More();itl.Next()) - { - const TopoDS_Shape & S = itl.Value(); - if (S.ShapeType() != TopAbs_FACE || - myMapTools.Contains( S )) - continue; - TopoDS_Iterator itS( myImageShape.Image(S).First() ); - for (; itS.More(); itS.Next()) - if (! myAddedFacesMap.Contains( itS.Value() )) - myBuilder.Add (myShape, itS.Value()); - } - - myDoneStep = makeSolids ? TopAbs_SOLID : TopAbs_SHELL; - -} - -//======================================================================= -//function : MakeSolids -//purpose : make solids out of Shells -//======================================================================= - -void Partition_Spliter::MakeSolids(const TopoDS_Shape & theSolid, - TopTools_ListOfShape & theShellList) -{ - // for a solid wrapping other shells or solids without intersection, - // it is necessary to find shells making holes in it - - TopTools_ListOfShape aNewSolids; // result - TopTools_ListOfShape aHoleShells; - TopoDS_Shape anInfinitePointShape; - - Standard_Boolean isWrapping = myWrappingSolid.Contains( theSolid ); - if (!isWrapping && !theShellList.IsEmpty()) - { - // check if theSolid initially has internal shells - TopoDS_Iterator aShellExp (theSolid); - aShellExp.Next(); - isWrapping = aShellExp.More(); - } - - TopTools_ListIteratorOfListOfShape aShellIt(theShellList); - for ( ; aShellIt.More(); aShellIt.Next()) - { - const TopoDS_Shape & aShell = aShellIt.Value(); - - // check if a shell is a hole - if (isWrapping && IsInside (anInfinitePointShape, aShell)) - aHoleShells.Append( aShell ); - else - { - // make a solid from a shell - TopoDS_Solid Solid; - myBuilder.MakeSolid( Solid ); - myBuilder.Add (Solid, aShell); - - aNewSolids.Append (Solid); - } - } - - // find an outer shell most close to each hole shell - TopTools_DataMapOfShapeShape aInOutMap; - for (aShellIt.Initialize( aHoleShells ); aShellIt.More(); aShellIt.Next()) - { - const TopoDS_Shape & aHole = aShellIt.Value(); - TopTools_ListIteratorOfListOfShape aSolisIt (aNewSolids); - for ( ; aSolisIt.More(); aSolisIt.Next()) - { - const TopoDS_Shape & aSolid = aSolisIt.Value(); - if (! IsInside( aHole, aSolid )) - continue; - - if ( aInOutMap.IsBound (aHole)) - { - const TopoDS_Shape & aSolid2 = aInOutMap( aHole ); - if ( IsInside( aSolid, aSolid2 )) - { - aInOutMap.UnBind( aHole ); - aInOutMap.Bind ( aHole, aSolid ); - } - } - else - aInOutMap.Bind ( aHole, aSolid ); - } - - // add aHole to a solid - if (aInOutMap.IsBound( aHole )) - myBuilder.Add ( aInOutMap( aHole ), aHole ); - } - - theShellList.Clear(); - theShellList.Append( aNewSolids ); -} - -//======================================================================= -//function : FindFacesInside -//purpose : return compound of faces of other shapes that are -// inside . -// is an object shape. -// makes avoid faces that do not form a -// closed shell -// makes return already added faces -//======================================================================= - -TopoDS_Shape Partition_Spliter::FindFacesInside(const TopoDS_Shape& theShape, - const Standard_Boolean CheckClosed, - const Standard_Boolean All) -{ - // ================================================ - // check if internal faces have been already found - // ================================================ - TopExp_Explorer expl; - if (myInternalFaces.IsBound( theShape )) - { - TopoDS_Shape aIntFComp = myInternalFaces.Find ( theShape ); - TopoDS_Shape aIntRemFComp = myIntNotClFaces.Find ( theShape ); - - expl.Init( aIntRemFComp, TopAbs_FACE); - if (CheckClosed || !expl.More()) - return aIntFComp; - - TopoDS_Compound C; - myBuilder.MakeCompound( C ); - // add removed faces - for (; expl.More(); expl.Next()) - myBuilder.Add( C, expl.Current() ); - // add good internal faces - for (expl.Init( aIntFComp, TopAbs_FACE); expl.More(); expl.Next()) - myBuilder.Add( C, expl.Current() ); - return C; - } - - // =================================== - // get data for internal faces search - // =================================== - - // compound of split faces of theShape - const TopoDS_Shape& CSF = myImageShape.Image(theShape).First(); - - TopTools_MapOfShape MSE, MFP; - TopTools_DataMapOfShapeListOfShape DMSEFP; - TopTools_MapIteratorOfMapOfShape itm; - TopTools_ListOfShape EmptyL; - - // MSE filling: map of new section edges of CSF - for (expl.Init(CSF,TopAbs_EDGE); expl.More(); expl.Next()) { - const TopoDS_Shape & resE = expl.Current() ; - if (myNewSection.Contains( resE )) // only new edges - MSE.Add(resE); - } - - // DMEF: map edge of CSF - faces of CSF - TopTools_IndexedDataMapOfShapeListOfShape DMEF; - TopExp::MapShapesAndAncestors(CSF, TopAbs_EDGE, TopAbs_FACE, DMEF); - - // Fill - // 1. MFP - a map of faces to process: map of resulting faces except - // those of theShape; we`ll add to C those of them which are inside CSF - // 2. DMSEFP - edge of MSE => faces of MFP - TopTools_ListIteratorOfListOfShape itl; - for (itl.Initialize(myListShapes);itl.More();itl.Next()) { - const TopoDS_Shape& aShape = itl.Value(); - if ( theShape.IsSame( aShape )) continue; - // fill maps - // iterate on split faces of aShape - TopoDS_Iterator itF ( myImageShape.Image(aShape).First() ); - for ( ; itF.More(); itF.Next()) { - const TopoDS_Shape& sf = itF.Value(); - MFP.Add(sf); - // iterate on edges of split faces of aShape, - // add to DMSEFP edges that are new - for (expl.Init( sf, TopAbs_EDGE ); expl.More(); expl.Next()) { - TopoDS_Shape se = expl.Current(); - if ( MSE.Contains(se)) {// section edge - if (!DMSEFP.IsBound(se)) - DMSEFP.Bind(se,EmptyL); - DMSEFP(se).Append(sf); - } - } - } - } - - // add tool faces having section edges on faces of theShape to MFP and DMSEFP; - // such tool faces need not to be reconstructed and so they are not in myListShapes - for (itm.Initialize(myMapTools); itm.More(); itm.Next()) - { - const TopoDS_Shape & aToolFace = itm.Key(); - if (myMapFaces.Contains( aToolFace )) - continue; - MFP.Add(aToolFace); - for (expl.Init( aToolFace, TopAbs_EDGE ); expl.More(); expl.Next()) { - TopoDS_Shape se = expl.Current(); - if ( MSE.Contains( se )) {// section edge - if (!DMSEFP.IsBound( se )) - DMSEFP.Bind( se, EmptyL ); - DMSEFP( se ).Append( aToolFace ); - } - } - } - - - // =========================== - // find faces inside theShape - // =========================== - - Standard_Boolean skipAlreadyAdded = Standard_False; - Standard_Boolean GoodOri, inside; - Standard_Real dot; - TopTools_ListOfShape KeepFaces; - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit; - - // iterate on section edges, check faces of other shapes - // sharing section edges and put internal faces to KeepFaces - for (Mapit.Initialize(DMSEFP); Mapit.More() ; Mapit.Next() ) { - // a new edge of theShape - const TopoDS_Edge& E = TopoDS::Edge (Mapit.Key()); - // an original edge of which E is a split - const TopoDS_Edge& OrigE = TopoDS::Edge ( myImagesEdges.Root( E )); - // does OrigE itself splits a face - Standard_Boolean isSectionE = myInter3d.IsSectionEdge ( OrigE ); - - // split faces of other shapes sharing E - TopTools_ListOfShape& LSF = DMSEFP.ChangeFind(E); - itl.Initialize( LSF ); - while (itl.More()) { - // a split faces of other shape - TopoDS_Face aFace1 = TopoDS::Face(itl.Value()); - // remove aFace1 form DMSEFP and MFP - LSF.Remove( itl ); // == itl.Next(); - if (!MFP.Remove( aFace1 )) - continue; // was not is MFP ( i.e already checked) - // check if aFace1 was already added to 2 shells - if (!All && - myAddedFacesMap.Contains( aFace1 ) && - myAddedFacesMap.Contains( aFace1.Reversed() )) { - skipAlreadyAdded = Standard_True; - continue; - } - - // find another face which originates from the same face as aFace1: - // usually aFace2 is internal if aFace1 is not and vice versa - - TopoDS_Shape anOrigFace = aFace1; - if (myImagesFaces.IsImage(aFace1)) - anOrigFace = myImagesFaces.Root(aFace1); - TopoDS_Shape aFace2; - if ( !isSectionE ) { - while (itl.More()) { - aFace2 = itl.Value(); - if (!MFP.Contains( aFace2 )) { - LSF.Remove( itl ); - continue; - } - if (anOrigFace.IsSame( myImagesFaces.Root( aFace2 ))) - break; - itl.Next(); - } - if (itl.More()) { // aFace2 found, remove it from maps - LSF.Remove( itl ); - MFP.Remove(aFace2); - } - else - aFace2.Nullify(); - itl.Initialize( LSF ); - } - - // check that anOrigFace is not same domain with CSF faces it intersects - - const TopTools_ListOfShape& FL = DMEF.FindFromKey(E); //faces of CSF sharing E - const TopoDS_Shape& origF1 = myImagesFaces.Root(FL.First()); - const TopoDS_Shape& origF2 = myImagesFaces.Root(FL.Last()); - Standard_Boolean sameDom1 = anOrigFace.IsSame( origF1 ); - Standard_Boolean sameDom2 = anOrigFace.IsSame( origF2 ); - if (!(sameDom1 || sameDom2) && myInter3d.HasSameDomainF( anOrigFace )) { - sameDom1 = myInter3d.IsSameDomainF( anOrigFace, origF1); - if (origF1 == origF2) - sameDom2 = sameDom1; - else - myInter3d.IsSameDomainF( anOrigFace, origF2); - } - if (sameDom1 && sameDom2) - continue; - if ((sameDom1 || sameDom2)) { - inside = Partition_Loop3d::IsInside (E, - TopoDS::Face(FL.First()), - TopoDS::Face(FL.Last()), - 1, dot, GoodOri); - if (inside || (dot + Precision::Angular() >= 1.0)) - continue; // E is convex between origF1 and origF2 or they are tangent - } - - - // keep one of found faces - - //face of CSF sharing E - const TopoDS_Shape& aShapeFace = sameDom1 ? FL.Last() : FL.First(); - // analyse aFace1 state - inside = Partition_Loop3d::IsInside (E, TopoDS::Face(aShapeFace), aFace1, - 1, dot, GoodOri); - if (inside && isSectionE) - { - // aFace1 must be tested with both adjacent faces of CSF - const TopoDS_Shape& aShapeFace2 = sameDom1 ? FL.First() : FL.Last(); - if (aShapeFace2 != aShapeFace) - inside = Partition_Loop3d::IsInside (E, TopoDS::Face(aShapeFace2), aFace1, - 1, dot, GoodOri); - } - - // store internal face - if (inside) - KeepFaces.Append(aFace1); - - else if (!aFace2.IsNull()) - { - if (dot + Precision::Angular() >= 1.0) - { - // aFace2 state is not clear, it will be analysed alone, - // put it back to the maps - MFP.Add( aFace2 ); - LSF.Append( aFace2 ); - } - else - KeepFaces.Append(aFace2); - } - } - } - - // =================================================== - // add not distributed faces connected with KeepFaces - // =================================================== - - // ultimate list of internal faces - TopTools_ListOfShape KeptFaces; - - // add to MFP not split tool faces as well, they may be connected with - // tool faces interfering with theShape - for ( itm.Initialize(myMapTools); itm.More(); itm.Next() ) { - const TopoDS_Shape& aToolFace = itm.Key(); - if (!myImageShape.HasImage(aToolFace)) - MFP.Add (aToolFace); - } - - if (MFP.IsEmpty()) - KeptFaces.Append (KeepFaces); - - while (!KeepFaces.IsEmpty()) - { - // KeepEdges : map of edges of faces kept last time - TopTools_IndexedMapOfShape KeepEdges; - for ( itl.Initialize(KeepFaces); itl.More(); itl.Next() ) { - TopExp::MapShapes( itl.Value(), TopAbs_EDGE, KeepEdges); - KeptFaces.Append( itl.Value() ); - } - - KeepFaces.Clear(); - - // keep faces connected with already kept faces by KeepEdges - for ( itm.Initialize(MFP); itm.More(); itm.Next() ) { - const TopoDS_Shape& FP = itm.Key(); - for (expl.Init(FP,TopAbs_EDGE); expl.More(); expl.Next()) { - const TopoDS_Shape& se = expl.Current(); - if (!MSE.Contains(se) && KeepEdges.Contains(se) ) { - KeepFaces.Append(FP); - MFP.Remove(FP); - break; - } - } - } - } - - // =============================================================== - // here MFP contains faces outer of theShape and those of shapes - // which do not interfere with theShape at all and between which - // there may be those wrapped by theShape and whose faces may be - // needed to be returned as well - // =============================================================== - - Standard_Boolean isSolid = (theShape.ShapeType() == TopAbs_SOLID); - if (All || isSolid) // All is for sub-result removal - { - // loop on not used faces; checked faces will be removed from MFP - // during the loop - for ( itm.Initialize( MFP ); itm.More(); itm.Next() ) { - const TopoDS_Shape & aFace = itm.Key(); - - // a shape which aFace originates from - TopoDS_Shape anOrigShape = GetOriginalShape( aFace ); - - // find out if all split faces of anOrigShape are not in MFP - // and by the way remove them from MFP - Standard_Boolean isAllOut = Standard_True; - TopoDS_Shape aSplitFaces = anOrigShape; - if (myImageShape.HasImage(anOrigShape)) - aSplitFaces = myImageShape.Image(anOrigShape).First(); - - TopTools_ListOfShape aSplitFaceL; // faces candidate to be kept - for (expl.Init( aSplitFaces, TopAbs_FACE ); expl.More(); expl.Next()) - { - const TopoDS_Shape & aSpFace = expl.Current(); - // a tool face which became object has image but the whole tool shape has not - if (myImageShape.HasImage( aSpFace )) - { - TopExp_Explorer exF (myImageShape.Image( aSpFace ).First(), TopAbs_FACE ); - for ( ; exF.More(); exF.Next() ) - { - aSplitFaceL.Append( exF.Current() ); - if ( ! MFP.Remove( exF.Current() ) && isAllOut ) - // a shared face might be removed from MFP during a prev loop - isAllOut = mySharedFaces.Contains( exF.Current() ); - } - } - else - { - aSplitFaceL.Append( aSpFace ); - if ( ! MFP.Remove( aSpFace ) && isAllOut) - // a shared face might be removed from MFP during a prev loop - isAllOut = mySharedFaces.Contains( aSpFace ); - } - } - itm.Initialize( MFP ); // iterate remaining faces - if ( !isAllOut ) - continue; - - // classify anOrigShape against theShape - if (IsInside (anOrigShape, theShape)) - { - if (isSolid && myClosedShapes.Contains( anOrigShape )) - // to make a special care at solid reconstruction - myWrappingSolid.Add ( theShape ); - - // keep faces of an internal shape anOrigShape - KeptFaces.Append( aSplitFaceL ); - } - } - } - - // ==================================================== - // check if kept faces form a shell without free edges - // ==================================================== - - DMEF.Clear(); // edge - kept faces - MFP.Clear(); // reuse it for wrong faces - if (CheckClosed) { - for (itl.Initialize(KeptFaces); itl.More(); itl.Next() ) - TopExp::MapShapesAndAncestors(itl.Value(), TopAbs_EDGE, TopAbs_FACE, DMEF); - - Standard_Integer i, nb = DMEF.Extent(); - Standard_Boolean isClosed = Standard_False; - while (!isClosed) { - isClosed = Standard_True; - for (i=1; isClosed && i<=nb; ++i) { - const TopoDS_Shape& E = DMEF.FindKey( i ); - if (! BRep_Tool::Degenerated( TopoDS::Edge( E )) && - ! MSE.Contains( E )) - isClosed = ( DMEF(i).Extent() != 1 ); - } - if (!isClosed) { - const TopoDS_Shape& F = DMEF.FindFromIndex( i-1 ).First(); // bad face - MFP.Add( F ); - // remove bad face from DMEF - for (expl.Init( F, TopAbs_EDGE); expl.More(); expl.Next()) { - const TopoDS_Shape& E = expl.Current(); - TopTools_ListOfShape& FL = DMEF.ChangeFromKey( E ); - for (itl.Initialize( FL ); itl.More(); itl.Next() ) { - if ( F.IsSame( itl.Value() )) { - FL.Remove( itl ); - break; - } - } - } - } - } - } - - // ============== - // make a result - // ============== - - TopoDS_Compound C; - // compound of removed internal faces - TopoDS_Compound CNotCl; - - myBuilder.MakeCompound(C); - myBuilder.MakeCompound(CNotCl); - - // add to compounds - for (itl.Initialize(KeptFaces); itl.More(); itl.Next() ) - { - TopoDS_Shape & aIntFace = itl.Value(); - if (! MFP.Contains( aIntFace )) - myBuilder.Add( C, aIntFace); - else - myBuilder.Add( CNotCl, aIntFace); - } - - if (!skipAlreadyAdded && CheckClosed) - { - myInternalFaces.Bind( theShape, C ); - myIntNotClFaces.Bind( theShape, CNotCl ); - } - - return C; -} - -//======================================================================= -//function : MakeShell -//purpose : split S into compound of shells -//======================================================================= - -void Partition_Spliter::MakeShells(const TopoDS_Shape& S, - TopTools_ListOfShape& NS) -{ - Partition_Loop3d ShellMaker; - // get compound of split faces of S - const TopoDS_Shape& FacesComp = myImageShape.Image(S).First(); - ShellMaker.AddConstFaces( FacesComp ); - // add split faces inside S - if (myClosedShapes.Contains( S )) { - TopoDS_Shape InternalFacesComp = FindFacesInside(S, Standard_True); - ShellMaker.AddSectionFaces( InternalFacesComp ); - } - - NS = ShellMaker.MakeShells( myAddedFacesMap ); - - // Add faces added to new shell to myAddedFacesMap: - // avoid rebuilding twice commont part of 2 solids. - TopTools_ListIteratorOfListOfShape itS(NS); - while ( itS.More()) { - TopExp_Explorer expF (itS.Value(), TopAbs_FACE); - for (; expF.More(); expF.Next()) - myAddedFacesMap.Add (expF.Current()); - - itS.Next(); - } -} - -//======================================================================= -//function : findEqual -//purpose : compare edges of EL1 against edges of EL2, -// Result is in EMM binding EL1 edges to list of equal edges. -// Edges are considered equall only if they have same vertices. -// ==True makes consider same edges as equal -// Put in all equal edges -//======================================================================= - -static void findEqual (const TopTools_ListOfShape& EL1, - const TopTools_ListOfShape& EL2, - const Standard_Boolean addSame, - TopTools_DataMapOfShapeListOfShape& EEM, - TopTools_MapOfShape& AllEqMap) -{ - // map vertices to edges for EL2 - TopTools_DataMapOfShapeListOfShape VEM; - TopTools_ListIteratorOfListOfShape itE1, itE2(EL2); - TopoDS_Iterator itV; - TopTools_ListOfShape emptyL; - for (; itE2.More(); itE2.Next()) { - for (itV.Initialize( itE2.Value() ); itV.More(); itV.Next()) { - const TopoDS_Shape& V = itV.Value(); - if (! VEM.IsBound( V ) ) - VEM.Bind( V, emptyL); - VEM( V ).Append( itE2.Value()); - } - } - - gp_Vec D1, D2; - gp_Pnt P; - Standard_Real f,l,u,tol; - Handle(Geom_Curve) C1, C2; - Extrema_ExtPC Extrema; - TopoDS_Vertex V1, V2, V3, V4; - - AllEqMap.Clear(); - - for (itE1.Initialize(EL1); itE1.More(); itE1.Next()) { - const TopoDS_Edge& E1 = TopoDS::Edge( itE1.Value()); - if (BRep_Tool::Degenerated( E1 ) || AllEqMap.Contains (E1)) - continue; - TopExp::Vertices( E1, V1, V2 ); - - if (VEM.IsBound(V1)) - itE2.Initialize( VEM(V1) ); - for (; itE2.More(); itE2.Next()) { - const TopoDS_Edge& E2 = TopoDS::Edge( itE2.Value()); - if (BRep_Tool::Degenerated( E2 ) || AllEqMap.Contains (E2)) - continue; - - if (E1.IsSame(E2)) { - if (!addSame) - continue; - } - else { - TopExp::Vertices( E2, V3, V4); - if (!V2.IsSame(V4) && !V2.IsSame(V3)) - continue; - // E1 and E2 have same vertices - // check D1 at end points. - C2 = BRep_Tool::Curve( E2, f,l); - C1 = BRep_Tool::Curve( E1, f,l); - u = BRep_Tool::Parameter(V1,E1); - C1->D1(u, P, D1); - u = BRep_Tool::Parameter(V1.IsSame(V3) ? V3 : V4, E2); - C2->D1(u, P, D2); - D1.Normalize(); D2.Normalize(); - if (Abs(D1*D2) + Precision::Angular() < 1.0) - continue; - if (! V1.IsSame(V2)) { - u = BRep_Tool::Parameter(V2,E1); - C1->D1(u, P, D1); - u = BRep_Tool::Parameter(V2.IsSame(V3) ? V3 : V4, E2); - C2->D1(u, P, D2); - D1.Normalize(); D2.Normalize(); - if (Abs(D1*D2) + Precision::Angular() < 1.0) - continue; - } - // check distance at a couple of internal points - tol = Max(BRep_Tool::Tolerance(E1), - BRep_Tool::Tolerance(E2)); - GeomAdaptor_Curve AC1(C1); - Extrema.Initialize(AC1,f,l); - Standard_Boolean ok = Standard_True, hasMin = Standard_False; - BRep_Tool::Range( E2, f, l); - Standard_Integer i=1, nbi=3; - for (; iValue( f+(l-f)*i/nbi )); - Standard_Integer j=1, nbj=Extrema.NbExt(); - for (; j<=nbj && ok; ++j) { - if (Extrema.IsMin(j)) { - hasMin = Standard_True; - ok = Extrema.Value(j) <= tol; - } - } - } - if ( !hasMin || !ok) - continue; - } - // bind E2 to E1 in EEM - if (!EEM.IsBound(E1)) { - EEM.Bind (E1, emptyL); - AllEqMap.Add (E1); - } - EEM(E1).Append(E2); - AllEqMap.Add (E2); - } - } -} - -//======================================================================= -//function : MakeFaces -//purpose : split faces of S, return compound of new faces -//======================================================================= - -TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S) -{ - TopoDS_Compound C; - myBuilder.MakeCompound(C); - - TopTools_ListIteratorOfListOfShape itl, itNE; - - TopExp_Explorer exp(S,TopAbs_FACE); - for (; exp.More(); exp.Next()) { - - const TopoDS_Face& F = TopoDS::Face(exp.Current()); - - TopTools_ListOfShape LNF; - - if (myImagesFaces.HasImage( F )) { - myImagesFaces.LastImage( F, LNF ); - TopAbs_Orientation oriF = F.Orientation(); - for ( itl.Initialize( LNF ); itl.More(); itl.Next()) - itl.Value().Orientation( oriF ); - } - else { - - Partition_Loop2d loops; - loops.Init(F); - - TopTools_IndexedMapOfShape EM; - TopExp::MapShapes( F, TopAbs_EDGE, EM); - - TopTools_MapOfShape AddedEqualM, EqualSeamM; - Standard_Boolean needRebuild = Standard_False; - - // add splits to loops - - // LE: old edges + new not splitted edges - const TopTools_ListOfShape& LE = myAsDes->Descendant(F); - for (itl.Initialize(LE); itl.More(); itl.Next()) { - const TopoDS_Edge& E = TopoDS::Edge( itl.Value() ); - - Standard_Boolean isSectionE = myInter3d.IsSectionEdge(E); - Standard_Boolean isNewE = !EM.Contains( E ); - - // LSE: list of split edges - TopTools_ListOfShape LSE; - myImagesEdges.LastImage(E,LSE); // splits of E or E itself - - for (itNE.Initialize(LSE); itNE.More(); itNE.Next()) { - - TopoDS_Edge NE = TopoDS::Edge( itNE.Value() ); - Standard_Boolean isSameE = NE.IsSame ( E ); - - if ( isNewE || isSectionE || !isSameE) { - if (AddedEqualM.Contains( NE )) { - // a seam must be twice in a loop - if (!BRep_Tool::IsClosed( E, F ) || !EqualSeamM.Add( NE )) - continue; - } - - if (isNewE) { - if (isSectionE) { - if ( ! myInter3d.IsSplitOn( NE, E, F) ) - continue; - } - else { - TopoDS_Vertex V1,V2; - TopExp::Vertices(NE,V1,V2); - const TopTools_ListOfShape& EL1 = myAsDes->Ascendant(V1); - const TopTools_ListOfShape& EL2 = myAsDes->Ascendant(V2); - if ( EL1.Extent() < 2 && EL2.Extent() < 2 ) - continue; - } - } - else { - NE.Orientation( E.Orientation()); - if (!isSameE) { - // orient NE because it may be a split of other edge - Standard_Real f,l,u; - Handle(Geom_Curve) C3d = BRep_Tool::Curve( E,f,l ); - Handle(Geom_Curve) NC3d = BRep_Tool::Curve( NE,f,l); - if ( C3d != NC3d) { - gp_Vec D1, ND1; gp_Pnt P; - TopoDS_Vertex V = TopExp::FirstVertex(NE); - u = BRep_Tool::Parameter(V,NE); - NC3d->D1 (u, P, ND1); - u = BRep_Tool::Parameter(V,E); - C3d ->D1 (u, P, D1); - if (ND1.Dot(D1) < 0) - NE.Reverse(); - } - } - } - if (myEqualEdges.Contains( NE )) - AddedEqualM.Add( NE ); - - needRebuild = Standard_True; - } - - if (isNewE || isSectionE) - myNewSection.Add( NE ); - - if (isNewE) - loops.AddSectionEdge(NE); - else - loops.AddConstEdge(NE); - } - } - - //------------------- - // Build the faces. - //------------------- - - if (needRebuild) { - - loops.Perform(); - loops.WiresToFaces(myImagesEdges); - - LNF = loops.NewFaces(); - - myImagesFaces.Bind(F,LNF); - - // replace the result faces that have already been built - // during same domain faces reconstruction done earlier - if (myInter3d.HasSameDomainF( F )) - { - // build map edge to same domain faces: EFM - TopTools_IndexedDataMapOfShapeListOfShape EFM; - TopTools_MapOfShape SDFM; // avoid doubling - itl.Initialize( myInter3d.SameDomain( F )); - for (; itl.More(); itl.Next()) { - if ( !myImagesFaces.HasImage( itl.Value() )) - continue; - // loop on splits of a SD face - TopTools_ListIteratorOfListOfShape itNF; - itNF.Initialize (myImagesFaces.Image( itl.Value() )); - for ( ; itNF.More(); itNF.Next()) { - TopoDS_Shape SDF = itNF.Value(); - if (myImagesFaces.HasImage( SDF )) // already replaced - SDF = myImagesFaces.Image( SDF ).First(); - if (SDFM.Add (SDF)) - TopExp::MapShapesAndAncestors(SDF, TopAbs_EDGE, TopAbs_FACE, EFM); - } - } - // do replace faces in the LNF - TopTools_ListOfShape LOF; - if ( !EFM.IsEmpty() ) - itl.Initialize( LNF ); - while (itl.More()) { - const TopoDS_Shape& NF = itl.Value(); - TopExp_Explorer expE ( NF, TopAbs_EDGE ); - const TopoDS_Edge& E = TopoDS::Edge (expE.Current()); - if (EFM.Contains( E )) { - const TopTools_ListOfShape& SDFL = EFM.FindFromKey( E ); - TopoDS_Shape SDF = SDFL.First(); - Standard_Boolean GoodOri; - Standard_Real dot; - Partition_Loop3d::IsInside (E, TopoDS::Face(NF), TopoDS::Face(SDF), - 1, dot, GoodOri); - if (dot < 0) - { - // NF and SDF are on different side of E - if (SDFL.Extent() == 1) { - itl.Next(); - continue; - } - else - SDF = SDFL.Last(); // next face must be on the same side - } - gp_Vec V1 = Partition_Loop3d::Normal( E, TopoDS::Face( NF )); - gp_Vec V2 = Partition_Loop3d::Normal( E, TopoDS::Face( SDF )); - if (V1*V2 < 0) - SDF.Reverse(); - - if (!myImagesFaces.HasImage( NF )) - myImagesFaces.Bind( NF, SDF ); - - // mySharedFaces is used in FindFacesInside() - mySharedFaces.Add( SDF ); - - LOF.Prepend ( SDF ); - LNF.Remove (itl); - } - else - itl.Next(); - } - - LNF.Append (LOF); - } - } // if (needRebuild) - - else { - LNF.Append( F ); - myImagesFaces.Bind(F,LNF); - } - } // if (myImagesFaces.HasImage( F )) - - // fill the resulting compound - for (itl.Initialize(LNF); itl.More(); itl.Next()) - myBuilder.Add ( C, itl.Value()); - - } // loop on faces of S - - return C; -} - - -//======================================================================= -//function : Tri -//purpose : -//======================================================================= - -static void Tri(const TopoDS_Edge& E, - TopTools_SequenceOfShape& Seq, - const Partition_Inter3d & theInter3d) -{ - Standard_Boolean Invert = Standard_True; - Standard_Real U1,U2; - TopoDS_Vertex V1,V2; - - while (Invert) { - Invert = Standard_False; - for ( Standard_Integer i = 1; i < Seq.Length(); i++) { - - V1 = TopoDS::Vertex(Seq.Value(i)); - V2 = TopoDS::Vertex(Seq.Value(i+1)); - - V1.Orientation(TopAbs_INTERNAL); - V2.Orientation(TopAbs_INTERNAL); - - U1 = BRep_Tool::Parameter(V1,E); - U2 = BRep_Tool::Parameter(V2,E); - - if (IsEqual(U1,U2)) { - if (theInter3d.ReplaceSameDomainV( V1, E ).IsSame( V1 )) - Seq.Remove(i+1); // remove V2 - else - Seq.Remove(i); - i--; - continue; - } - if (U2 < U1) { - Seq.Exchange(i,i+1); - Invert = Standard_True; - } - } - } -} - -//======================================================================= -//function : MakeEdges -//purpose : cut E by vertices VOnE, return list of new edges NE -//======================================================================= - -void Partition_Spliter::MakeEdges (const TopoDS_Edge& E, - const TopTools_ListOfShape& VOnE, - TopTools_ListOfShape& NE ) const -{ - TopoDS_Edge WE = E; - WE.Orientation(TopAbs_FORWARD); - - Standard_Real U1,U2, f, l; - TopoDS_Vertex V1,V2,VF,VL; - - BRep_Tool::Range(WE,f,l); - TopExp::Vertices(WE,VF,VL); - - if (VOnE.Extent() < 3) { // do not rebuild not cut edge - if (( VF.IsSame( VOnE.First() ) && VL.IsSame( VOnE.Last() )) || - VL.IsSame( VOnE.First() ) && VF.IsSame( VOnE.Last() ) ) { - NE.Append( E ); - return; - } - } - - TopTools_SequenceOfShape SV; - TopTools_ListIteratorOfListOfShape itv(VOnE); - TopTools_MapOfOrientedShape VM( VOnE.Extent() ); - for (; itv.More(); itv.Next()) - if ( VM.Add( itv.Value() )) - SV.Append(itv.Value()); - - Tri( WE, SV, myInter3d ); - - if (SV.Length() < 3) { // do not rebuild not cut edge - if (( VF.IsSame( SV.First() ) && VL.IsSame( SV.Last() )) || - VL.IsSame( SV.First() ) && VF.IsSame( SV.Last() ) ) { - NE.Append( E ); - return; - } - } - - Standard_Integer iVer, NbVer = SV.Length(); - - - //---------------------------------------------------------------- - // Construction of the new edges . - //---------------------------------------------------------------- - - if (VF.IsSame(VL)) { // closed edge - if (NbVer==1) - SV.Append( SV.First() ); - else if (!SV.First().IsSame(SV.Last())) { - Standard_Boolean isFirst=0; - Standard_Real minDU = 1.e10; - TopoDS_Vertex endV = Partition_Inter2d::FindEndVertex(VOnE, f,l, E, isFirst,minDU); - if (endV.IsSame(SV.First())) - SV.Append(endV); - else if (endV.IsSame(SV.Last())) - SV.Prepend(endV); - else - MESSAGE ("END VERTEX IS IN SEQUNCE MIDDLE"); - } - NbVer = SV.Length(); - } - - for (iVer=1; iVer < NbVer; iVer++) { - V1 = TopoDS::Vertex(SV(iVer)); - V2 = TopoDS::Vertex(SV(iVer+1)); - - TopoDS_Shape NewEdge = WE.EmptyCopied(); - V1.Orientation(TopAbs_FORWARD); - myBuilder.Add (NewEdge,V1); - V2.Orientation(TopAbs_REVERSED); - myBuilder.Add (NewEdge,V2); - - if (iVer==1) - U1 = f; - else { - V1.Orientation(TopAbs_INTERNAL); - U1=BRep_Tool::Parameter(V1,WE); - } - if (iVer+1 == NbVer) - U2 = l; - else { - V2.Orientation(TopAbs_INTERNAL); - U2=BRep_Tool::Parameter(V2,WE); - } - if (Abs(U1-U2) <= Precision::PConfusion()) { - MESSAGE( "MakeEdges(), EQUAL PARAMETERS OF DIFFERENT VERTICES"); - continue; - } - TopoDS_Edge EE=TopoDS::Edge(NewEdge); - myBuilder.Range (EE,U1,U2); - - TopoDS_Edge NEdge = TopoDS::Edge(NewEdge); - myBuilder.SameParameter(NEdge,Standard_False); - - Standard_Real tol = 1.0e-2; - Standard_Boolean flag = BRep_Tool::SameParameter(NEdge); - if (!flag) { - BRepLib::SameParameter(NEdge,tol); - } - NE.Append(NEdge.Oriented(E.Orientation())); - } -} - -//======================================================================= -//function : MergeEqualEdges -//purpose : find equal edges, choose ones to keep and make -// them have pcurves on all faces they are shared by -//======================================================================= - -void Partition_Spliter::MergeEqualEdges (const TopTools_ListOfShape& LSE) -{ - // find equal edges - // map: edge - equal edges - TopTools_DataMapOfShapeListOfShape EEM( LSE.Extent() ); - findEqual (LSE, LSE, 0, EEM, myEqualEdges); - - TopTools_ListOfShape EEL; // list of equal edges - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itM (EEM); - for ( ; itM.More(); itM.Next()) { - EEL = itM.Value(); - EEL.Append( itM.Key() ); - - // choose an edge to keep, section edges have priority - TopoDS_Edge EKeep; - TopTools_ListIteratorOfListOfShape itEE (EEL); - for (; itEE.More(); itEE.Next()) { - EKeep = TopoDS::Edge( itEE.Value() ); - const TopoDS_Edge& EKeepOrig = TopoDS::Edge( myImagesEdges.Root( EKeep )); - if (myInter3d.IsSectionEdge( EKeepOrig )) - break; - } - - // update edge images and build pcurves - Standard_Real f,l, tol; - for (itEE.Initialize (EEL); itEE.More(); itEE.Next()) { - const TopoDS_Edge& E = TopoDS::Edge( itEE.Value() ); - if ( E.IsSame( EKeep )) - continue; - - // 1. build pcurves of the kept edge on faces where replaced edges exist - const TopoDS_Edge& EReplOrig = TopoDS::Edge( myImagesEdges.Root( E )); - TopTools_ListOfShape FL; - FL = myAsDes->Ascendant( EReplOrig ); - Standard_Integer iFace, iFirstSectionFace = FL.Extent() + 1; - // add faces where the replaced edge is a section edge - if (myInter3d.IsSectionEdge( EReplOrig )) { - TopTools_ListIteratorOfListOfShape seIt; - seIt.Initialize( myInter3d.SectionEdgeFaces ( EReplOrig )); - for ( ; seIt.More(); seIt.Next()) - FL.Append( seIt.Value() ); - } - // loop on faces - TopTools_ListIteratorOfListOfShape itF (FL); - for ( iFace = 1 ; itF.More(); itF.Next(), ++iFace ) { - const TopoDS_Face& F = TopoDS::Face( itF.Value()); - - Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface( EKeep, F, f,l); - if (pc.IsNull()) { - Handle(Geom_Curve) C3d = BRep_Tool::Curve( EKeep, f, l); - C3d = new Geom_TrimmedCurve( C3d, f,l); - pc = TopOpeBRepTool_CurveTool::MakePCurveOnFace (F,C3d,tol); - if (pc.IsNull()) { - MESSAGE (" CANT BUILD PCURVE "); - } - myBuilder.UpdateEdge( EKeep, pc, F, tol); - } - - if (iFace >= iFirstSectionFace || - !BRep_Tool::IsClosed( EReplOrig, F )) - continue; - - // build the second pcurve for a seam - TopoDS_Vertex V = TopExp::FirstVertex( EKeep ); - Standard_Real Ukeep = BRep_Tool::Parameter( V, EKeep ); - Standard_Real Urepl = BRep_Tool::Parameter( V, E ); - - TopoDS_Edge EReplRev = E; - EReplRev.Reverse(); - Handle(Geom2d_Curve) pcRepl1 = BRep_Tool::CurveOnSurface( E, F, f,l); - Handle(Geom2d_Curve) pcRepl2 = BRep_Tool::CurveOnSurface( EReplRev, F, f,l); - - gp_Pnt2d p1r, p2r, pk; - p1r = pcRepl1->Value( Urepl ); - p2r = pcRepl2->Value( Urepl ); - pk = pc->Value( Ukeep ); - - // suppose that pk is equal to either p1r or p2r - Standard_Boolean isUPeriod = - ( Abs( p1r.X() - p2r.X() ) > Abs( p1r.Y() - p2r.Y() )); - Standard_Boolean is1Equal; - if (isUPeriod) - is1Equal = ( Abs( p1r.X() - pk.X() ) < Abs( p2r.X() - pk.X() )); - else - is1Equal = ( Abs( p1r.Y() - pk.Y() ) < Abs( p2r.Y() - pk.Y() )); - - Handle(Geom2d_Curve) pc2 = Handle(Geom2d_Curve)::DownCast - ( pc->Translated( pk, is1Equal ? p2r : p1r ) ); - - if (E.Orientation() == TopAbs_REVERSED) - is1Equal = !is1Equal; - - if (is1Equal) - myBuilder.UpdateEdge( EKeep, pc, pc2, F, tol); - else - myBuilder.UpdateEdge( EKeep, pc2, pc, F, tol); - - } // loop on a Faces where a replaced edge exists - - - // 2. update edge images according to replacement - if (myImagesEdges.HasImage( E )) - myImagesEdges.Remove( E ); - myImagesEdges.Bind( E, EKeep ); - - } // loop on a list of equal edges EEL - } // loop on a map of equal edges EEM -} - -//======================================================================= -//function : KeepShapesInside -//purpose : remove shapes that are outside of S from resul -//======================================================================= - -void Partition_Spliter::KeepShapesInside (const TopoDS_Shape& S) -{ - TopoDS_Iterator it; - if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid - for (it.Initialize( S ); it.More(); it.Next()) - KeepShapesInside( it.Value()); - return; - } - - Standard_Boolean isTool = Standard_False; - if (!myImageShape.HasImage( S )) { - isTool = CheckTool( S ); - if (!isTool) return; - } - - // build map of internal faces - TopTools_IndexedMapOfShape MIF; - TopoDS_Shape IntFacesComp = FindFacesInside( S, Standard_False, Standard_True); - TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF ); - - TopoDS_Compound C; - myBuilder.MakeCompound(C); - - TopAbs_ShapeEnum anInternalShapeType = TopAbs_SHAPE; - if (!MIF.IsEmpty()) - { - // leave in the result only those shapes having a face in MIF - for (it.Initialize( myShape ); it.More(); it.Next()) { - const TopoDS_Shape & aResShape = it.Value(); - TopExp_Explorer expResF( aResShape, TopAbs_FACE ); - for (; expResF.More(); expResF.Next()) { - if ( MIF.Contains( expResF.Current())) { - myBuilder.Add( C, aResShape ); - if (aResShape.ShapeType() < anInternalShapeType) - anInternalShapeType = aResShape.ShapeType(); - break; - } - } - } - } - - // may be S was not split by internal faces then it is missing - // in myShape, add it - if (!isTool && - (anInternalShapeType > TopAbs_SOLID || S.ShapeType() > TopAbs_SOLID)) - { - TopTools_IndexedMapOfShape MSF; // map of split faces of S - TopExp::MapShapes( myImageShape.Image(S).First(), TopAbs_FACE, MSF); - - // find a shape having all faces in MSF - for (it.Initialize( myShape ); it.More(); it.Next()) { - TopExp_Explorer expResF( it.Value(), TopAbs_FACE ); - for (; expResF.More(); expResF.Next()) { - if (! MSF.Contains( expResF.Current())) - break; - } - if (! expResF.More()) { - myBuilder.Add( C, it.Value() ); - break; - } - } - } - - myShape = C; -} - -//======================================================================= -//function : RemoveShapesInside -//purpose : remove shapes that are inside S from resul -//======================================================================= - -void Partition_Spliter::RemoveShapesInside (const TopoDS_Shape& S) -{ - TopoDS_Iterator it; - if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid - for (it.Initialize( S ); it.More(); it.Next()) - RemoveShapesInside( it.Value()); - return; - } - Standard_Boolean isTool = Standard_False; - if (!myImageShape.HasImage( S )) { - isTool = CheckTool( S ); - if (!isTool) return; - } - - TopoDS_Shape IntFacesComp = FindFacesInside( S, Standard_False, Standard_True); - TopTools_IndexedMapOfShape MIF; // map of internal faces - TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF); - - if (MIF.IsEmpty()) return; - - // add to MIF split faces of S - if (myImageShape.HasImage(S)) - TopExp::MapShapes( myImageShape.Image(S).First(), TopAbs_FACE, MIF); - - // leave in the result only those shapes not having all face in MIF - - TopoDS_Compound C; - myBuilder.MakeCompound(C); - - // RMF : faces of removed shapes that encounter once - TopTools_MapOfShape RFM; - - for (it.Initialize( myShape ); it.More(); it.Next()) { - - TopExp_Explorer expResF( it.Value(), TopAbs_FACE ); - for (; expResF.More(); expResF.Next()) - if (!MIF.Contains( expResF.Current())) - break; - - if (expResF.More()) - // add shape to result - myBuilder.Add( C, it.Value() ); - else - // add faces of a removed shape to RFM - for (expResF.ReInit(); expResF.More(); expResF.Next()) { - const TopoDS_Shape& F = expResF.Current(); - if ( ! RFM.Remove ( F )) - RFM.Add( F ); - } - } - - if (!isTool) { - - // rebuild S, it must remain in the result - - Standard_Boolean isClosed = Standard_False; - switch (S.ShapeType()) { - case TopAbs_SOLID : - isClosed = Standard_True; break; - case TopAbs_SHELL: { - TopTools_IndexedDataMapOfShapeListOfShape MEF; - TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, MEF); - Standard_Integer i; - for (i=1; isClosed && i<=MEF.Extent(); ++i) - isClosed = ( MEF(i).Extent() != 1 ); - break; - } - default: - isClosed = Standard_False; - } - if (isClosed) { - - // add to a new shape external faces of removed shapes, ie those in RFM - - TopoDS_Shell Shell; - myBuilder.MakeShell( Shell ); - - // exclude redundant internal face with edges encounterd only once - TopTools_IndexedDataMapOfShapeListOfShape MEF; - TopTools_MapIteratorOfMapOfShape itF (RFM); - for ( ; itF.More(); itF.Next()) - TopExp::MapShapesAndAncestors(itF.Key(), TopAbs_EDGE, TopAbs_FACE, MEF); - - // add only faces forming a closed shell - for (itF.Reset() ; itF.More(); itF.Next()) - { - TopExp_Explorer expE (itF.Key(), TopAbs_EDGE); - for (; expE.More(); expE.Next()) - if (MEF.FindFromKey(expE.Current()).Extent() == 1) - break; - if (!expE.More()) - myBuilder.Add( Shell, itF.Key()); - } - - if (S.ShapeType() == TopAbs_SOLID) { - TopoDS_Solid Solid; - myBuilder.MakeSolid( Solid ); - myBuilder.Add (Solid, Shell); - myBuilder.Add (C, Solid); - } - else - myBuilder.Add (C, Shell); - } - else { - if (myImageShape.HasImage( S )) { - for (it.Initialize( myImageShape.Image(S).First()); it.More(); it.Next()) - myBuilder.Add (C, it.Value()); - } - } - } - - myShape = C; -} - -//======================================================================= -//function : CheckTool -//purpose : Return True if is a tool shape. Prepare tool -// faces of for the search of internal faces. -//======================================================================= - -Standard_Boolean Partition_Spliter::CheckTool(const TopoDS_Shape& S) -{ - // suppose S has not an image - - Standard_Boolean isTool = Standard_False; - TopoDS_Compound C; - myBuilder.MakeCompound( C ); - - TopExp_Explorer expF( S, TopAbs_FACE); - for (; expF.More(); expF.Next()) { - - const TopoDS_Face& F = TopoDS::Face( expF.Current() ); - if (myMapTools.Contains( F )) - isTool = Standard_True; - else - continue; - - if (myImagesFaces.HasImage( F )) { - // F has been reconstructed - TopAbs_Orientation Fori = F.Orientation(); - TopTools_ListOfShape LNF; - myImagesFaces.LastImage( F, LNF); - TopTools_ListIteratorOfListOfShape itF (LNF); - for ( ; itF.More(); itF.Next()) - myBuilder.Add( C, itF.Value().Oriented(Fori) ); - continue; - } - - Standard_Boolean hasSectionE = myInter3d.HasSectionEdge( F ); - Standard_Boolean hasNewE = myAsDes->HasDescendant( F ); - if (!hasSectionE && !hasNewE) - { - // F intersects nothing - myBuilder.Add( C, F ); - continue; - } - - // make an image for F - - TopoDS_Face NF = F; - NF.Orientation(TopAbs_FORWARD); - NF = TopoDS::Face( NF.EmptyCopied() ); // make a copy - TopoDS_Wire NW; - myBuilder.MakeWire( NW ); - - // add edges, as less as possible - TopTools_ListOfShape NEL; - TopTools_ListIteratorOfListOfShape itNE; - if (hasSectionE) { - // add section edges - TopExp_Explorer expE; - for ( ; expE.More(); expE.Next()) { - if (! myImagesEdges.HasImage( expE.Current() )) - continue; - myImagesEdges.LastImage( expE.Current(), NEL ); - for ( itNE.Initialize( NEL ); itNE.More(); itNE.Next()) - myBuilder.Add ( NW, itNE.Value()); - } - } - if (hasNewE) { - // add new adges - NEL = myAsDes->Descendant( F ); - for ( itNE.Initialize( NEL ); itNE.More(); itNE.Next()) { - TopTools_ListOfShape SEL; // splits - myImagesEdges.LastImage( itNE.Value(), SEL ); - TopTools_ListIteratorOfListOfShape itSE (SEL); - for ( ; itSE.More(); itSE.Next()) - myBuilder.Add ( NW, itSE.Value()); - } - } - myBuilder.Add( NF, NW ); - myBuilder.Add (C, NF); - - NF.Orientation( F.Orientation() ); // NF is most probably invalid - myImagesFaces.Bind (F, NF); - } - if (isTool) - myImageShape.Bind (S, C); - - return isTool; -} - -//======================================================================= -//function : IsInside -//purpose : Return True if the first vertex of S1 inside S2. -// If S1.IsNull(), check infinite point against S2. -//======================================================================= - -Standard_Boolean Partition_Spliter::IsInside (const TopoDS_Shape& theS1, - const TopoDS_Shape& theS2) -{ - BRepClass3d_SolidClassifier aClassifier( theS2 ); - - TopExp_Explorer expl( theS1, TopAbs_VERTEX ); - if (!expl.More()) - aClassifier.PerformInfinitePoint( ::RealSmall()); - else - { - const TopoDS_Vertex & aVertex = TopoDS::Vertex( expl.Current() ); - aClassifier.Perform (BRep_Tool::Pnt( aVertex ), - BRep_Tool::Tolerance( aVertex )); - } - - return ( aClassifier.State() == TopAbs_IN ); -} - -//======================================================================= -//function : GetOriginalShape -//purpose : Return the shape aShape originates from. aShape -// should be a face or more complex result shape -//======================================================================= - -TopoDS_Shape Partition_Spliter::GetOriginalShape(const TopoDS_Shape& theShape) const -{ - TopoDS_Shape anOrigShape; - - TopExp_Explorer expl( theShape, TopAbs_FACE); - if (expl.More()) - { - - TopoDS_Shape aFace = expl.Current(); - if (myImagesFaces.IsImage( aFace )) - aFace = myImagesFaces.Root( aFace ); - anOrigShape = myFaceShapeMap.Find( aFace ); - } - return anOrigShape; -} - -//======================================================================= -//function : FindToolsToReconstruct -//purpose : find and store as objects tools which interfere -// with solids or are inside solids without -// an interference -//======================================================================= - -void Partition_Spliter::FindToolsToReconstruct() -{ - if (myMapTools.IsEmpty()) - return; - - Standard_Integer nbFoundTools = 0; - - // build edge - face map in order to detect interference with section edges - TopTools_IndexedDataMapOfShapeListOfShape EFM; - TopTools_MapIteratorOfMapOfShape aMapIt; - for (aMapIt.Initialize(myMapTools); aMapIt.More(); aMapIt.Next()) - TopExp::MapShapesAndAncestors( aMapIt.Key(), TopAbs_EDGE, TopAbs_FACE, EFM); - for (aMapIt.Initialize(myMapFaces); aMapIt.More(); aMapIt.Next()) - TopExp::MapShapesAndAncestors( aMapIt.Key(), TopAbs_EDGE, TopAbs_FACE, EFM); - - TopTools_MapOfShape aCurrentSolids, aCheckedShapes; - - // faces cut by new edges - TopTools_MapOfShape & aSectionFaces = myInter3d.TouchedFaces(); - - // keep solids interfering with each other in aCurrentSolids map - // and add tool faces intersecting solids as object shapes - - TopTools_ListIteratorOfListOfShape itS, itF, itCF, itE; - for (itS.Initialize( myListShapes ); itS.More(); itS.Next()) { - TopExp_Explorer expSo (itS.Value(), TopAbs_SOLID); - for (; expSo.More(); expSo.Next()) { - - // check if a solid has been already processed - const TopoDS_Shape & aSo = expSo.Current(); - if (!aCheckedShapes.Add( aSo )) - continue; - aCurrentSolids.Add( aSo ); - - // faces to check - TopTools_ListOfShape aFacesToCheck; - TopExp_Explorer exp( aSo, TopAbs_FACE ); - for ( ; exp.More(); exp.Next()) - aFacesToCheck.Append ( exp.Current()); - - // add other shapes interefering with a solid. - // iterate faces to check while appending new ones - for (itCF.Initialize (aFacesToCheck) ; itCF.More(); itCF.Next()) - { - const TopoDS_Shape& aCheckFace = itCF.Value(); -// if (!aCheckedShapes.Add( aCheckFace )) -// continue; - - // find faces interfering with aCheckFace - TopTools_ListOfShape anIntFaces; - - // ** 1. faces intersecting aCheckFace with creation of new edges on it - if ( myAsDes->HasDescendant( aCheckFace )) - { - // new edges on aCheckFace - const TopTools_ListOfShape& NEL = myAsDes->Descendant( aCheckFace ); - for (itE.Initialize( NEL); itE.More(); itE.Next()) - { - const TopoDS_Shape & aNewEdge = itE.Value(); - if (!aCheckedShapes.Add( aNewEdge )) - continue; - - // faces interfering by aNewEdge - itF.Initialize (myAsDes->Ascendant( aNewEdge )); - for (; itF.More(); itF.Next()) - if (aCheckFace != itF.Value()) - anIntFaces.Append( itF.Value() ); - - // ** 2. faces having section edge aNewEdge on aFacesToCheck - if (EFM.Contains( aNewEdge)) - { - itF.Initialize ( EFM.FindFromKey (itE.Value())); - for (; itF.More(); itF.Next()) - if (aCheckFace != itF.Value()) - anIntFaces.Append( itF.Value() ); - } - } - } - - // ** 3. faces cut by edges of aCheckFace - TopExp_Explorer expE (aCheckFace, TopAbs_EDGE); - for ( ; expE.More(); expE.Next()) - { - const TopoDS_Shape & aCheckEdge = expE.Current(); - if (aCheckedShapes.Add( aCheckEdge ) && - myInter3d.IsSectionEdge( TopoDS::Edge( aCheckEdge ))) - { - itF.Initialize( myInter3d.SectionEdgeFaces( TopoDS::Edge( aCheckEdge ))); - for (; itF.More(); itF.Next()) - if (aCheckFace != itF.Value()) - anIntFaces.Append( itF.Value() ); - } - } - - // process faces interfering with aCheckFace and shapes they - // belong to - for (itF.Initialize (anIntFaces); itF.More(); itF.Next()) - { - const TopoDS_Shape & F = itF.Value(); - if (! aCheckedShapes.Add( F )) - continue; - - Standard_Boolean isTool = myMapTools.Contains( F ); - if (isTool && - myFaceShapeMap( aCheckFace ).ShapeType() == TopAbs_SOLID ) - { - // a tool interfering with a solid - if (aSectionFaces.Contains( F )) - AddShape( F ); - ++ nbFoundTools; - if (nbFoundTools == myMapTools.Extent()) - return; - } - - const TopoDS_Shape & S = myFaceShapeMap( F ); - if (aCheckedShapes.Add( S )) - { - // a new shape interefering with aCurrentSolids is found - if (!isTool && S.ShapeType() == TopAbs_SOLID) - aCurrentSolids.Add ( S ); - // add faces to aFacesToCheck list - for ( exp.Init( S, TopAbs_FACE ); exp.More(); exp.Next()) - aFacesToCheck.Append ( exp.Current() ); - } - } - } // loop on aFacesToCheck - - // Here aCurrentSolids contains all solids interfering with each other. - // aCheckedShapes contains all faces belonging to shapes included - // in or interfering with aCurrentSolids or previously checked solids. - // Test if tool faces that do not interefere with other shapes are - // wrapped by any of aCurrentSolids - - TopTools_MapIteratorOfMapOfShape aSolidIt (aCurrentSolids); - for ( ; aSolidIt.More(); aSolidIt.Next()) - { - const TopoDS_Shape & aSolid = aSolidIt.Key(); - TopTools_MapOfShape aCheckedTools( myMapTools.Extent() ); - - TopTools_MapIteratorOfMapOfShape aToolIt (myMapTools); - for ( ; aToolIt.More(); aToolIt.Next()) - { - const TopoDS_Shape & aToolFace = aToolIt.Key(); - if (aCheckedShapes.Contains( aToolFace ) || // already found - aCheckedTools.Contains( aToolFace )) // checked against aSolid - continue; - - const TopoDS_Shape & aToolShape = myFaceShapeMap( aToolFace ); - TopExp_Explorer aToolFaceIt( aToolShape, TopAbs_FACE ); - - Standard_Boolean isInside = IsInside( aToolShape, aSolid ); - for ( ; aToolFaceIt.More(); aToolFaceIt.Next() ) - { - const TopoDS_Shape & aTool = aToolFaceIt.Current(); - aCheckedTools.Add( aTool ); - if (isInside) - { - if (aSectionFaces.Contains( aTool )) - AddShape( aTool ); - ++ nbFoundTools; - if (nbFoundTools == myMapTools.Extent()) - return; - aCheckedShapes.Add( aTool ); - } - } - } - } - - } // loop on solid shapes - } -} diff --git a/src/PARTITION/Partition_Spliter.hxx b/src/PARTITION/Partition_Spliter.hxx deleted file mode 100644 index 1b71e20b1..000000000 --- a/src/PARTITION/Partition_Spliter.hxx +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Spliter.hxx -// Module : GEOM -// -#ifndef _Partition_Spliter_HeaderFile -#define _Partition_Spliter_HeaderFile - -#ifndef _TopAbs_ShapeEnum_HeaderFile -#include -#endif -#ifndef _TopoDS_Compound_HeaderFile -#include -#endif -#ifndef _BRep_Builder_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_MapOfShape_HeaderFile -#include -#endif -#ifndef _TopTools_DataMapOfShapeShape_HeaderFile -#include -#endif -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile -#include -#endif -#ifndef _BRepAlgo_Image_HeaderFile -#include -#endif -#ifndef _Partition_Inter3d_HeaderFile -#include "Partition_Inter3d.hxx" -#endif -#ifndef _TopTools_MapOfOrientedShape_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class BRepAlgo_AsDes; -class TopoDS_Shape; -class TopTools_ListOfShape; -class TopoDS_Edge; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class Partition_Spliter { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT Partition_Spliter(); -Standard_EXPORT void AddShape(const TopoDS_Shape& S) ; -Standard_EXPORT void AddTool(const TopoDS_Shape& S) ; -Standard_EXPORT void Compute(const TopAbs_ShapeEnum Limit = TopAbs_SHAPE) ; -Standard_EXPORT void KeepShapesInside(const TopoDS_Shape& S) ; -Standard_EXPORT void RemoveShapesInside(const TopoDS_Shape& S) ; -Standard_EXPORT TopoDS_Shape Shape() const; -Standard_EXPORT void Clear() ; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT void MakeSolids(const TopoDS_Shape& Solid,TopTools_ListOfShape& Shells) ; -Standard_EXPORT void MakeShells(const TopoDS_Shape& S,TopTools_ListOfShape& NS) ; -Standard_EXPORT TopoDS_Shape MakeFaces(const TopoDS_Shape& S) ; -Standard_EXPORT void MakeEdges(const TopoDS_Edge& E,const TopTools_ListOfShape& VOnE,TopTools_ListOfShape& NE) const; -Standard_EXPORT TopoDS_Shape FindFacesInside(const TopoDS_Shape& S,const Standard_Boolean CheckClosed = Standard_False,const Standard_Boolean All = Standard_False) ; -Standard_EXPORT Standard_Boolean CheckTool(const TopoDS_Shape& S) ; -Standard_EXPORT void MergeEqualEdges(const TopTools_ListOfShape& LE) ; -Standard_EXPORT static Standard_Boolean IsInside(const TopoDS_Shape& S1,const TopoDS_Shape& S2) ; -Standard_EXPORT TopoDS_Shape GetOriginalShape(const TopoDS_Shape& aShape) const; -Standard_EXPORT void FindToolsToReconstruct() ; - - - // Fields PRIVATE - // -TopAbs_ShapeEnum myDoneStep; -TopoDS_Compound myShape; -BRep_Builder myBuilder; -TopTools_ListOfShape myListShapes; -TopTools_MapOfShape myMapFaces; -TopTools_MapOfShape myMapTools; -TopTools_MapOfShape myEqualEdges; -TopTools_MapOfShape myNewSection; -TopTools_MapOfShape myClosedShapes; -TopTools_MapOfShape mySharedFaces; -TopTools_MapOfShape myWrappingSolid; -TopTools_DataMapOfShapeShape myFaceShapeMap; -TopTools_DataMapOfShapeShape myInternalFaces; -TopTools_DataMapOfShapeShape myIntNotClFaces; -Handle_BRepAlgo_AsDes myAsDes; -BRepAlgo_Image myImagesFaces; -BRepAlgo_Image myImagesEdges; -BRepAlgo_Image myImageShape; -Partition_Inter3d myInter3d; -TopTools_MapOfOrientedShape myAddedFacesMap; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/PARTITION/Partition_Spliter.ixx b/src/PARTITION/Partition_Spliter.ixx deleted file mode 100644 index 3443f3150..000000000 --- a/src/PARTITION/Partition_Spliter.ixx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Spliter.ixx -// Module : GEOM -// -#include "Partition_Spliter.jxx" - - - - diff --git a/src/PARTITION/Partition_Spliter.jxx b/src/PARTITION/Partition_Spliter.jxx deleted file mode 100644 index 79d17ddb4..000000000 --- a/src/PARTITION/Partition_Spliter.jxx +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2007-2008 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 PARTITION : partition algorithm -// File : Partition_Spliter.jxx -// Module : GEOM -// -#ifndef _BRepAlgo_AsDes_HeaderFile -#include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TopTools_ListOfShape_HeaderFile -#include -#endif -#ifndef _TopoDS_Edge_HeaderFile -#include -#endif -#ifndef _Partition_Spliter_HeaderFile -#include "Partition_Spliter.hxx" -#endif diff --git a/src/PrimitiveGUI/Makefile.am b/src/PrimitiveGUI/Makefile.am index 4825e3f47..eac797a6a 100644 --- a/src/PrimitiveGUI/Makefile.am +++ b/src/PrimitiveGUI/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : PrimitiveGUI @@ -88,8 +86,7 @@ libPrimitiveGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libPrimitiveGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx index b6c831aba..4e74a168c 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -26,6 +27,7 @@ #include "PrimitiveGUI.h" #include +#include "GeometryGUI_Operations.h" #include #include @@ -68,25 +70,25 @@ bool PrimitiveGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; switch ( theCommandID ) { - case 4021: // BOX + case GEOMOp::OpBox: // BOX aDlg = new PrimitiveGUI_BoxDlg( getGeometryGUI(), parent ); break; - case 4022: // CYLINDER + case GEOMOp::OpCylinder: // CYLINDER aDlg = new PrimitiveGUI_CylinderDlg( getGeometryGUI(), parent ); break; - case 4023: // SPHERE + case GEOMOp::OpSphere: // SPHERE aDlg = new PrimitiveGUI_SphereDlg( getGeometryGUI(), parent ); break; - case 4024: // TORUS + case GEOMOp::OpTorus: // TORUS aDlg = new PrimitiveGUI_TorusDlg( getGeometryGUI(), parent ); break; - case 4025: // CONE + case GEOMOp::OpCone: // CONE aDlg = new PrimitiveGUI_ConeDlg( getGeometryGUI(), parent); break; - case 4026: // FACE + case GEOMOp::OpRectangle: // FACE aDlg = new PrimitiveGUI_FaceDlg( getGeometryGUI(), parent); break; - case 4027: // DISK + case GEOMOp::OpDisk: // DISK aDlg = new PrimitiveGUI_DiskDlg( getGeometryGUI(), parent); break; default: diff --git a/src/PrimitiveGUI/PrimitiveGUI.h b/src/PrimitiveGUI/PrimitiveGUI.h index df97571df..66376de34 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.h +++ b/src/PrimitiveGUI/PrimitiveGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/PrimitiveGUI/PrimitiveGUI.pro b/src/PrimitiveGUI/PrimitiveGUI.pro deleted file mode 100644 index ed65cfc48..000000000 --- a/src/PrimitiveGUI/PrimitiveGUI.pro +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = PrimitiveGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../GEOMGUI ../DlgRef ../GEOMBase ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMFiltersSelection $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMBase - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -SOURCES = PrimitiveGUI.cxx -SOURCES += PrimitiveGUI_BoxDlg.cxx -SOURCES += PrimitiveGUI_CylinderDlg.cxx -SOURCES += PrimitiveGUI_SphereDlg.cxx -SOURCES += PrimitiveGUI_TorusDlg.cxx -SOURCES += PrimitiveGUI_ConeDlg.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index ab47b76d3..d06b646ab 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_BoxDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -42,7 +43,6 @@ #include #include -//#include //================================================================================= // class : PrimitiveGUI_BoxDlg() @@ -53,8 +53,7 @@ //================================================================================= PrimitiveGUI_BoxDlg::PrimitiveGUI_BoxDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), - myInitial(true) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) { QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ"))); @@ -113,9 +112,9 @@ void PrimitiveGUI_BoxDlg::Init() double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); // min, max, step and decimals for spin boxes - initSpinBox(GroupDimensions->SpinBox_DX, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DZ, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupDimensions->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY, 0.000001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DZ, 0.000001, COORD_MAX, step, "length_precision" ); // init variables GroupPoints->LineEdit1->setReadOnly(true); @@ -123,7 +122,8 @@ void PrimitiveGUI_BoxDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + myPoint1.nullify(); + myPoint2.nullify(); double initValue = 200.0; GroupDimensions->SpinBox_DX->setValue(initValue); @@ -139,9 +139,6 @@ void PrimitiveGUI_BoxDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); @@ -187,7 +184,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked (int constructorId) disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); globalSelection(); // close local contexts, if any - displayPreview(); + displayPreview(true); break; } } @@ -195,15 +192,9 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked (int constructorId) qApp->processEvents(); updateGeometry(); resize(minimumSizeHint()); + SelectionIntoArgument(); - if (myInitial) { - // on dialog initialization we init the first field with a selected object (if any) - SelectionIntoArgument(); - myInitial = false; - } - else { - displayPreview(); - } + displayPreview(true); } //================================================================================= @@ -212,6 +203,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked (int constructorId) //================================================================================= void PrimitiveGUI_BoxDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -248,72 +240,37 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2 = GEOM::GEOM_Object::_nil(); + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify(); return; } - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) // Local Selection - { - int anIndex = aMap(1); - aName.append(":vertex_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + + myEditCurrentArgument->setText(aName); + + if (myEditCurrentArgument == GroupPoints->LineEdit1) { + myPoint1 = aSelectedObject; + if (myPoint1 && !myPoint2) + GroupPoints->PushButton2->click(); } - else // Global Selection - { - if (aShape.ShapeType() != TopAbs_VERTEX) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + myPoint2 = aSelectedObject; + if (myPoint2 && !myPoint1) + GroupPoints->PushButton1->click(); + } + if ((myPoint1 && !myPoint2) || (myPoint2 && !myPoint1)) { + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); } } - - myEditCurrentArgument->setText(aName); - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - myPoint1 = aSelectedObject; - if (!myPoint1->_is_nil() && myPoint2->_is_nil()) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myPoint2 = aSelectedObject; - if (!myPoint2->_is_nil() && myPoint1->_is_nil()) - GroupPoints->PushButton1->click(); - } - - displayPreview(); + displayPreview(true); } //================================================================================= @@ -330,10 +287,6 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() // clear selection //disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - //if (myInitial) - // myInitial = false; - //else - // myGeomGUI->getApp()->selectionMgr()->clearSelected(); if (send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; @@ -359,20 +312,7 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() this, SLOT(SelectionIntoArgument())); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_BoxDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } //================================================================================= @@ -387,7 +327,7 @@ void PrimitiveGUI_BoxDlg::ActivateThisDialog() connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } - displayPreview(); + displayPreview(true); } //================================================================================= @@ -406,7 +346,7 @@ void PrimitiveGUI_BoxDlg::enterEvent (QEvent*) //================================================================================= void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox() { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -424,18 +364,21 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_BoxDlg::createOperation() //================================================================================= bool PrimitiveGUI_BoxDlg::isValid (QString& msg) { - bool ok = true; + bool ok = false; if( getConstructorId() == 1 ) { - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; - - ok = fabs( GroupDimensions->SpinBox_DX->value() ) > Precision::Confusion() && ok; - ok = fabs( GroupDimensions->SpinBox_DY->value() ) > Precision::Confusion() && ok; - ok = fabs( GroupDimensions->SpinBox_DZ->value() ) > Precision::Confusion() && ok; + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && + qAbs( GroupDimensions->SpinBox_DX->value() ) > Precision::Confusion() && + qAbs( GroupDimensions->SpinBox_DY->value() ) > Precision::Confusion() && + qAbs( GroupDimensions->SpinBox_DZ->value() ) > Precision::Confusion(); + } + else + { + ok = myPoint1 && myPoint2 && myPoint1 != myPoint2; } - return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : ok; + return ok; } //================================================================================= @@ -448,11 +391,13 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { - if (!CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxTwoPnt(myPoint1, myPoint2); + if ( myPoint1 && myPoint2 ) { + anObj = anOper->MakeBoxTwoPnt(myPoint1.get(), myPoint2.get()); res = true; } } @@ -463,14 +408,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects) double y = GroupDimensions->SpinBox_DY->value(); double z = GroupDimensions->SpinBox_DZ->value(); - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z); + anObj = anOper->MakeBoxDXDYDZ(x, y, z); if (!anObj->_is_nil() && !IsPreview()) { - QStringList aParameters; - aParameters << GroupDimensions->SpinBox_DX->text(); - aParameters << GroupDimensions->SpinBox_DY->text(); - aParameters << GroupDimensions->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + QStringList aParameters; + aParameters << GroupDimensions->SpinBox_DX->text(); + aParameters << GroupDimensions->SpinBox_DY->text(); + aParameters << GroupDimensions->SpinBox_DZ->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } @@ -490,9 +435,7 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects) void PrimitiveGUI_BoxDlg::addSubshapesToStudy() { if (getConstructorId() == 0) { - QMap objMap; - objMap[GroupPoints->LineEdit1->text()] = myPoint1; - objMap[GroupPoints->LineEdit2->text()] = myPoint2; - addSubshapesToFather(objMap); + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); } } diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h index 8cb75c19b..da2ce10d6 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_BoxDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef PRIMITIVEGUI_BOXDLG_H #define PRIMITIVEGUI_BOXDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel; class DlgRef_3Spin; @@ -55,10 +57,7 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points containing the vector */ - - // to initialize the first selection field with a selected object on the dialog creation - bool myInitial; + GEOM::GeomObjPtr myPoint1, myPoint2; /* Points containing the vector */ DlgRef_2Sel* GroupPoints; DlgRef_3Spin* GroupDimensions; @@ -67,7 +66,6 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 5bbe43478..f64a9667d 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_ConeDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -53,8 +54,7 @@ //================================================================================= PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), - myInitial(true) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) { QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_CONE_PV"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_CONE_DXYZ"))); @@ -116,12 +116,12 @@ void PrimitiveGUI_ConeDlg::Init() double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints->SpinBox_DX, 0.0, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints->SpinBox_DY, 0.0, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints->SpinBox_DZ, 0.00001, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DX, 0.0, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY, 0.0, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DZ, 0.00001, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupPoints->SpinBox_DX, 0.0, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPoints->SpinBox_DY, 0.0, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPoints->SpinBox_DZ, 0.00001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DX, 0.0, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY, 0.0, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DZ, 0.00001, COORD_MAX, step, "length_precision" ); // init variables GroupPoints->LineEdit1->setReadOnly(true); @@ -129,7 +129,8 @@ void PrimitiveGUI_ConeDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); double aRadius1(100.0), aRadius2(0.0), aHeight(300.0); GroupPoints->SpinBox_DX->setValue(aRadius1); @@ -148,9 +149,6 @@ void PrimitiveGUI_ConeDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); @@ -202,7 +200,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked (int constructorId) disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); globalSelection(); // close local contexts, if any - displayPreview(); + displayPreview(true); break; } } @@ -210,15 +208,9 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked (int constructorId) qApp->processEvents(); updateGeometry(); resize(minimumSizeHint()); + SelectionIntoArgument(); - if (myInitial) { - // on dialog initialization we init the first field with a selected object (if any) - SelectionIntoArgument(); - myInitial = false; - } - else { - displayPreview(); - } + displayPreview(true); } //================================================================================= @@ -227,6 +219,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked (int constructorId) //================================================================================= void PrimitiveGUI_ConeDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -263,79 +256,40 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir = GEOM::GEOM_Object::_nil(); + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint.nullify(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir.nullify(); return; } - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape + TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (myEditCurrentArgument == GroupPoints->LineEdit2) - aNeedType = TopAbs_EDGE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) // Local Selection - { - int anIndex = aMap(1); - if (aNeedType == TopAbs_EDGE) - aName.append(":edge_" + QString::number(anIndex)); - else - aName.append(":vertex_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + + myEditCurrentArgument->setText(aName); + + if (myEditCurrentArgument == GroupPoints->LineEdit1) { + myPoint = aSelectedObject; + if (myPoint && !myDir) + GroupPoints->PushButton2->click(); } - else // Global Selection - { - if (aShape.ShapeType() != aNeedType) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + myDir = aSelectedObject; + if (myDir && !myPoint) + GroupPoints->PushButton1->click(); } - } - - myEditCurrentArgument->setText(aName); - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - myPoint = aSelectedObject; - if (!myPoint->_is_nil() && myDir->_is_nil()) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myDir = aSelectedObject; - if (!myDir->_is_nil() && myPoint->_is_nil()) - GroupPoints->PushButton1->click(); + if ((myPoint && !myDir) || (myDir && !myPoint)) { + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + } } - displayPreview(); + displayPreview(true); } //================================================================================= @@ -375,21 +329,7 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_ConeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } //================================================================================= @@ -401,7 +341,7 @@ void PrimitiveGUI_ConeDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -422,7 +362,7 @@ void PrimitiveGUI_ConeDlg::enterEvent (QEvent*) //================================================================================= void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox() { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -440,24 +380,22 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_ConeDlg::createOperation() //================================================================================= bool PrimitiveGUI_ConeDlg::isValid (QString& msg) { - if (!getRadius1() && !getRadius2()) - return false; - - bool ok = true; + bool ok = false; if( getConstructorId() == 0 ) { - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && + myPoint && myDir; } else if( getConstructorId() == 1 ) { - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ); } - ok = fabs( getHeight() ) > Precision::Confusion() && ok; - return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok; + ok = ( getRadius1() > 0 || getRadius2() > 0 ) && qAbs( getHeight() ) > Precision::Confusion() && ok; + return ok; } //================================================================================= @@ -470,32 +408,32 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight()); + if ( myPoint && myDir ) { + anObj = anOper->MakeConePntVecR1R2H(myPoint.get(), myDir.get(), getRadius1(), getRadius2(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { - QStringList aParameters; - aParameters << GroupPoints->SpinBox_DX->text(); - aParameters << GroupPoints->SpinBox_DY->text(); - aParameters << GroupPoints->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + aParameters << GroupPoints->SpinBox_DY->text(); + aParameters << GroupPoints->SpinBox_DZ->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeConeR1R2H(getRadius1(), getRadius2(), getHeight()); + anObj = anOper->MakeConeR1R2H(getRadius1(), getRadius2(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); aParameters << GroupDimensions->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; @@ -555,15 +493,8 @@ double PrimitiveGUI_ConeDlg::getHeight() const //================================================================================= void PrimitiveGUI_ConeDlg::addSubshapesToStudy() { - QMap objMap; - - switch (getConstructorId()) { - case 0: - objMap[GroupPoints->LineEdit1->text()] = myPoint; - objMap[GroupPoints->LineEdit2->text()] = myDir; - break; - case 1: - return; + if ( getConstructorId() == 0 ) { + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myDir.get() ); } - addSubshapesToFather(objMap); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h index 2d1d6dc83..0e59a1481 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_ConeDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef PRIMITIVEGUI_CONEDLG_H #define PRIMITIVEGUI_CONEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel3Spin; class DlgRef_3Spin; @@ -58,11 +60,8 @@ private: double getHeight() const; private: - GEOM::GEOM_Object_var myPoint, myDir; + GEOM::GeomObjPtr myPoint, myDir; - // to initialize the first selection field with a selected object on the dialog creation - bool myInitial; - DlgRef_2Sel3Spin* GroupPoints; DlgRef_3Spin* GroupDimensions; @@ -70,7 +69,6 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index b77bd11a3..8b810679d 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_CylinderDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -114,10 +115,10 @@ void PrimitiveGUI_CylinderDlg::Init() double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints->SpinBox_DX, 0.00001, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints->SpinBox_DY, 0.00001, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, step, 5); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupPoints->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPoints->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" ); // init variables myEditCurrentArgument = GroupPoints->LineEdit1; @@ -126,7 +127,8 @@ void PrimitiveGUI_CylinderDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); double aRadius(100.0), aHeight(300.0); GroupPoints->SpinBox_DX->setValue(aRadius); @@ -143,9 +145,6 @@ void PrimitiveGUI_CylinderDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); @@ -201,20 +200,9 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked (int constructorId) qApp->processEvents(); updateGeometry(); resize(minimumSizeHint()); + SelectionIntoArgument(); - if (myInitial) { - myInitial = false; - if (constructorId == 0) { - // on dialog initialization we init the first field with a selected object (if any) - SelectionIntoArgument(); - } - else { - displayPreview(); - } - } - else { - displayPreview(); - } + displayPreview(true); } //================================================================================= @@ -223,6 +211,7 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked (int constructorId) //================================================================================= void PrimitiveGUI_CylinderDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -260,78 +249,40 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() if (aSelList.Extent() != 1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) - myPoint = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = GEOM::GEOM_Object::_nil(); + myDir.nullify(); return; } - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape + TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (myEditCurrentArgument == GroupPoints->LineEdit2) - aNeedType = TopAbs_EDGE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { // Local Selection - int anIndex = aMap(1); - if (aNeedType == TopAbs_EDGE) - aName.append(":edge_" + QString::number(anIndex)); - else - aName.append(":vertex_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + + myEditCurrentArgument->setText(aName); + + if (myEditCurrentArgument == GroupPoints->LineEdit1) { + myPoint = aSelectedObject; + if (myPoint && !myDir) + GroupPoints->PushButton2->click(); } - else { // Global Selection - if (aShape.ShapeType() != aNeedType) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + myDir = aSelectedObject; + if (myDir && !myPoint) + GroupPoints->PushButton1->click(); + } + // clear selection + if ((myDir && !myPoint) || (myPoint && !myDir)) { + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); } } - myEditCurrentArgument->setText(aName); - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - myPoint = aSelectedObject; - if (!myPoint->_is_nil() && myDir->_is_nil()) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myDir = aSelectedObject; - if (!myDir->_is_nil() && myPoint->_is_nil()) - GroupPoints->PushButton1->click(); - } - - displayPreview(); + displayPreview(true); } //================================================================================= @@ -371,21 +322,7 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_CylinderDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } //================================================================================= @@ -397,7 +334,7 @@ void PrimitiveGUI_CylinderDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -418,7 +355,7 @@ void PrimitiveGUI_CylinderDlg::enterEvent (QEvent*) //================================================================================= void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox() { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -436,19 +373,20 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_CylinderDlg::createOperation() //================================================================================= bool PrimitiveGUI_CylinderDlg::isValid (QString& msg) { - bool ok = true; + bool ok = false; if( getConstructorId() == 0 ) { - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && + myPoint && myDir; } else if( getConstructorId() == 1 ) { - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ); } - ok = fabs( getHeight() ) > Precision::Confusion() && ok; - return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok; + ok = qAbs( getHeight() ) > Precision::Confusion() && ok; + return ok; } //================================================================================= @@ -461,30 +399,30 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight()); + if ( myPoint && myDir ) { + anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { - QStringList aParameters; - aParameters << GroupPoints->SpinBox_DX->text(); - aParameters << GroupPoints->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + aParameters << GroupPoints->SpinBox_DY->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeCylinderRH(getRadius(), getHeight()); + anObj = anOper->MakeCylinderRH(getRadius(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; @@ -530,15 +468,8 @@ double PrimitiveGUI_CylinderDlg::getHeight() const //================================================================================= void PrimitiveGUI_CylinderDlg::addSubshapesToStudy() { - QMap objMap; - - switch (getConstructorId()) { - case 0: - objMap[GroupPoints->LineEdit1->text()] = myPoint; - objMap[GroupPoints->LineEdit2->text()] = myDir; - break; - case 1: - return; + if ( getConstructorId() == 0 ) { + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myDir.get() ); } - addSubshapesToFather(objMap); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h index 0e6fc18fd..d7035831b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_CylinderDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef PRIMITIVEGUI_CYLINDERDLG_H #define PRIMITIVEGUI_CYLINDERDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel2Spin; class DlgRef_2Spin; @@ -57,7 +59,7 @@ private: double getHeight() const; private: - GEOM::GEOM_Object_var myPoint, myDir; + GEOM::GeomObjPtr myPoint, myDir; // to initialize the first selection field with a selected object on the dialog creation bool myInitial; @@ -69,7 +71,6 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); diff --git a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx index 9344092c8..f73861a4a 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_DiskDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -51,8 +49,7 @@ //================================================================================= PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), - myInitial(true) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_DISK_PNT_VEC_R"))); @@ -132,8 +129,8 @@ void PrimitiveGUI_DiskDlg::Init() double aStep = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPntVecR->SpinBox_DX, 0.00001, COORD_MAX, aStep, 5); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, aStep, 5); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupPntVecR->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" ); // init variables myEditCurrentArgument = GroupPntVecR->LineEdit1; @@ -145,7 +142,11 @@ void PrimitiveGUI_DiskDlg::Init() Group3Pnts->LineEdit1->setText(""); Group3Pnts->LineEdit2->setText(""); Group3Pnts->LineEdit3->setText(""); - myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); + myPoint3.nullify(); GroupPntVecR->SpinBox_DX->setValue(100); GroupDimensions->SpinBox_DX->setValue(100); @@ -159,17 +160,10 @@ void PrimitiveGUI_DiskDlg::Init() connect(GroupPntVecR->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPntVecR->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPntVecR->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPntVecR->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); @@ -207,7 +201,7 @@ void PrimitiveGUI_DiskDlg::RadioButtonClicked() myOrientationType = 2; else if (GroupOrientation->RadioButton3->isChecked()) myOrientationType = 3; - displayPreview(); + displayPreview(true); } //================================================================================= @@ -255,20 +249,9 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked (int constructorId) qApp->processEvents(); updateGeometry(); resize(minimumSizeHint()); + SelectionIntoArgument(); - if (myInitial) { - myInitial = false; - if (constructorId == 1 || constructorId == 2) { - // on dialog initialization we init the first field with a selected object (if any) - SelectionIntoArgument(); - } - else { - displayPreview(); - } - } - else { - displayPreview(); - } + displayPreview(true); } //================================================================================= @@ -277,6 +260,7 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked (int constructorId) //================================================================================= void PrimitiveGUI_DiskDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -313,95 +297,56 @@ void PrimitiveGUI_DiskDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group3Pnts->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group3Pnts->LineEdit2) myPoint2 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group3Pnts->LineEdit3) myPoint3 = GEOM::GEOM_Object::_nil(); + if (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint.nullify(); + else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir.nullify(); + else if (myEditCurrentArgument == Group3Pnts->LineEdit1) myPoint1.nullify(); + else if (myEditCurrentArgument == Group3Pnts->LineEdit2) myPoint2.nullify(); + else if (myEditCurrentArgument == Group3Pnts->LineEdit3) myPoint3.nullify(); return; } - // nbSel == 1 - Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - - // If selected Vertex or Edge on the some Shape Get selection Subshape + TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPntVecR->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (myEditCurrentArgument == GroupPntVecR->LineEdit2) - aNeedType = TopAbs_EDGE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(anIO, aMap); - if (aMap.Extent() == 1) { // Local Selection - int anIndex = aMap(1); - if (aNeedType == TopAbs_EDGE) - aName += QString(":edge_%1").arg(anIndex); - else - aName += QString(":vertex_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + + myEditCurrentArgument->setText(aName); + + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + if (myEditCurrentArgument == GroupPntVecR->LineEdit1) { + myPoint = aSelectedObject; + if (myPoint && !myDir) + GroupPntVecR->PushButton2->click(); } - else { // Global Selection - if (aShape.ShapeType() != aNeedType) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) { + myDir = aSelectedObject; + if (myDir && !myPoint) + GroupPntVecR->PushButton1->click(); + } + else if (myEditCurrentArgument == Group3Pnts->LineEdit1) { + myPoint1 = aSelectedObject; + if (myPoint1 && !myPoint2) + Group3Pnts->PushButton2->click(); + } + else if (myEditCurrentArgument == Group3Pnts->LineEdit2) { + myPoint2 = aSelectedObject; + if (myPoint2 && !myPoint3) + Group3Pnts->PushButton3->click(); + } + else if (myEditCurrentArgument == Group3Pnts->LineEdit3) { + myPoint3 = aSelectedObject; + if (myPoint3 && !myPoint1) + Group3Pnts->PushButton1->click(); } } - myEditCurrentArgument->setText(aName); - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - if (myEditCurrentArgument == GroupPntVecR->LineEdit1) { - myPoint = aSelectedObject; - if (!myPoint->_is_nil() && myDir->_is_nil()) - GroupPntVecR->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) { - myDir = aSelectedObject; - if (!myDir->_is_nil() && myPoint->_is_nil()) - GroupPntVecR->PushButton1->click(); - } - else if (myEditCurrentArgument == Group3Pnts->LineEdit1) { - myPoint1 = aSelectedObject; - if (!myPoint1->_is_nil() && myPoint2->_is_nil()) - Group3Pnts->PushButton2->click(); - } - else if (myEditCurrentArgument == Group3Pnts->LineEdit2) { - myPoint2 = aSelectedObject; - if (!myPoint2->_is_nil() && myPoint3->_is_nil()) - Group3Pnts->PushButton3->click(); - } - else if (myEditCurrentArgument == Group3Pnts->LineEdit3) { - myPoint3 = aSelectedObject; - if (!myPoint3->_is_nil() && myPoint1->_is_nil()) - Group3Pnts->PushButton1->click(); - } - - displayPreview(); + displayPreview(true); } //================================================================================= @@ -468,24 +413,7 @@ void PrimitiveGUI_DiskDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_DiskDlg::LineEditReturnPressed() -{ -QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPntVecR->LineEdit1 || - send == GroupPntVecR->LineEdit2 || - send == Group3Pnts->LineEdit1 || - send == Group3Pnts->LineEdit2 || - send == Group3Pnts->LineEdit3) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } //================================================================================= @@ -496,7 +424,7 @@ void PrimitiveGUI_DiskDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -517,7 +445,7 @@ void PrimitiveGUI_DiskDlg::enterEvent (QEvent*) //================================================================================= void PrimitiveGUI_DiskDlg::ValueChangedInSpinBox() { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -529,14 +457,14 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_DiskDlg::createOperation() return getGeomEngine()->GetI3DPrimOperations(getStudyId()); } -//================================================================================= -// function : isEqual -// purpose : it may also be needed to check for min distance between gp_Pnt-s... -//================================================================================= -static bool isEqual (const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2) -{ - return thePnt1->_is_equivalent(thePnt2); -} +// //================================================================================= +// // function : isEqual +// // purpose : it may also be needed to check for min distance between gp_Pnt-s... +// //================================================================================= +// static bool isEqual (const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2) +// { +// return thePnt1->_is_equivalent(thePnt2); +// } //================================================================================= // function : isValid @@ -544,21 +472,14 @@ static bool isEqual (const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje //================================================================================= bool PrimitiveGUI_DiskDlg::isValid (QString& msg) { - bool ok = true; - if( getConstructorId() == 0 ) - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - else if( getConstructorId() == 1 ) - ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - - const int id = getConstructorId(); - if (id == 0) - return ok; - else if (id == 1) - return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0 && ok; - else if (id == 2) - return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && - !isEqual(myPoint1, myPoint2) && !isEqual(myPoint1, myPoint3) && !isEqual(myPoint2, myPoint3); - return false; + bool ok = false; + if ( getConstructorId() == 0 ) + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && getRadius() > 0; + else if ( getConstructorId() == 1 ) + ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint && myDir && getRadius() > 0; + else if ( getConstructorId() == 2 ) + ok = myPoint1 && myPoint2 && myPoint3 && myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3; + return ok; } //================================================================================= @@ -572,30 +493,29 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeDiskR(getRadius(), myOrientationType); + anObj = anOper->MakeDiskR(getRadius(), myOrientationType); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupDimensions->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeDiskPntVecR(myPoint, myDir, getRadius()); + anObj = anOper->MakeDiskPntVecR(myPoint.get(), myDir.get(), getRadius()); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupPntVecR->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; case 2: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeDiskThreePnt(myPoint1, myPoint2, myPoint3); + anObj = anOper->MakeDiskThreePnt(myPoint1.get(), myPoint2.get(), myPoint3.get()); res = true; break; } @@ -628,18 +548,17 @@ double PrimitiveGUI_DiskDlg::getRadius() const //================================================================================= void PrimitiveGUI_DiskDlg::addSubshapesToStudy() { - QMap objMap; - switch (getConstructorId()) { case 1: - objMap[GroupPntVecR->LineEdit1->text()] = myPoint; - objMap[GroupPntVecR->LineEdit2->text()] = myDir; + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myDir.get() ); break; case 2: - objMap[Group3Pnts->LineEdit1->text()] = myPoint1; - objMap[Group3Pnts->LineEdit2->text()] = myPoint2; - objMap[Group3Pnts->LineEdit3->text()] = myPoint3; + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); + GEOMBase::PublishSubObject( myPoint3.get() ); + break; + default: break; } - addSubshapesToFather(objMap); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h index 83ddb2df0..ae22d2e36 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_DiskDlg.h // Author : Dmitry Matveitchev, OCN @@ -26,7 +24,8 @@ #ifndef BASICGUI_DISKDLG_H #define BASICGUI_DISKDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_3Sel; class DlgRef_2Sel1Spin; @@ -60,10 +59,7 @@ private: int myOrientationType; private: - GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3; - - // to initialize the first selection field with a selected object on the dialog creation - bool myInitial; + GEOM::GeomObjPtr myPoint, myDir, myPoint1, myPoint2, myPoint3; DlgRef_2Sel1Spin* GroupPntVecR; DlgRef_3Sel* Group3Pnts; @@ -79,7 +75,6 @@ private slots: void SelectionIntoArgument(); void ConstructorsClicked( int ); - void LineEditReturnPressed(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(); void SetDoubleSpinBoxStep( double ); diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx index 3f6d5fe6a..d73c69b08 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_FaceDlg.cxx // Author : Dmitry Matveitchev, OCN. @@ -50,17 +48,17 @@ // TRUE to construct a modal dialog. //================================================================================= PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FACE_OBJ_HW"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FACE_HW"))); - setWindowTitle( tr( "GEOM_FACE_TITLE" ) ); + setWindowTitle( tr( "GEOM_RECTANGLE_TITLE" ) ); /***************************************************************/ - mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FACE" ) ); + mainFrame()->GroupConstructors->setTitle( tr( "GEOM_RECTANGLE" ) ); mainFrame()->RadioButton1->setIcon( image2 ); mainFrame()->RadioButton2->setIcon( image0 ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); @@ -126,8 +124,8 @@ void PrimitiveGUI_FaceDlg::Init() /* init variables */ myEditCurrentArgument = GroupPlane->LineEdit1; GroupType->RadioButton1->setChecked(true); - myEdge = GEOM::GEOM_Object::_nil(); - myFace = GEOM::GEOM_Object::_nil(); + myEdge.nullify(); + myFace.nullify(); globalSelection(); // close local contexts, if any // localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); @@ -139,17 +137,17 @@ void PrimitiveGUI_FaceDlg::Init() double aDefaultSize = 100.0; /* min, max, step and decimals for spin boxes */ - initSpinBox( GroupPlane->SpinBox_DX, 0.00001, COORD_MAX, aStep, 5 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPlane->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" ); GroupPlane->SpinBox_DX->setValue( aDefaultSize ); - initSpinBox( GroupPlane->SpinBox_DY, 0.00001, COORD_MAX, aStep, 5 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPlane->SpinBox_DY, 0.00001, COORD_MAX, aStep, "length_precision" ); GroupPlane->SpinBox_DY->setValue( aDefaultSize ); - initSpinBox( GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, aStep, 5 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" ); GroupDimensions->SpinBox_DX->setValue( aDefaultSize ); - initSpinBox( GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, aStep, 5 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, aStep, "length_precision" ); GroupDimensions->SpinBox_DY->setValue( aDefaultSize ); - + /* signals and slots connections */ connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); @@ -161,7 +159,6 @@ void PrimitiveGUI_FaceDlg::Init() connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( GroupPlane->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPlane->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPlane->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( GroupPlane->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); @@ -176,7 +173,7 @@ void PrimitiveGUI_FaceDlg::Init() connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_FACE" ) ); @@ -191,6 +188,8 @@ void PrimitiveGUI_FaceDlg::SetDoubleSpinBoxStep( double step ) { GroupPlane->SpinBox_DX->setSingleStep(step); GroupPlane->SpinBox_DY->setSingleStep(step); + GroupDimensions->SpinBox_DX->setSingleStep(step); + GroupDimensions->SpinBox_DY->setSingleStep(step); } //================================================================================= @@ -199,7 +198,7 @@ void PrimitiveGUI_FaceDlg::SetDoubleSpinBoxStep( double step ) //================================================================================= void PrimitiveGUI_FaceDlg::ValueChangedInSpinBox( double newValue ) { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -214,7 +213,7 @@ void PrimitiveGUI_FaceDlg::RadioButtonClicked() myOrientationType = 2; else if ( GroupOrientation->RadioButton3->isChecked() ) myOrientationType = 3; - displayPreview(); + displayPreview(true); } //================================================================================= @@ -233,6 +232,10 @@ void PrimitiveGUI_FaceDlg::TypeButtonClicked() localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) ); } + myEditCurrentArgument = GroupPlane->LineEdit1; + myEditCurrentArgument->setText( "" ); + myEdge.nullify(); + myFace.nullify(); } //================================================================================= @@ -241,6 +244,7 @@ void PrimitiveGUI_FaceDlg::TypeButtonClicked() //================================================================================= void PrimitiveGUI_FaceDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -287,8 +291,8 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId ) localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); myEditCurrentArgument = GroupPlane->LineEdit1; myEditCurrentArgument->setText(""); - myEdge = GEOM::GEOM_Object::_nil(); - myFace = GEOM::GEOM_Object::_nil(); + myEdge.nullify(); + myFace.nullify(); GroupType->RadioButton1->setChecked( true ); TypeButtonClicked(); GroupDimensions->hide(); @@ -303,7 +307,7 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId ) updateGeometry(); resize( minimumSizeHint() ); SelectionIntoArgument(); - //displayPreview(); + //displayPreview(true); } //================================================================================= @@ -313,7 +317,7 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId ) void PrimitiveGUI_FaceDlg::SelectionIntoArgument() { if (getConstructorId() == 0) { - displayPreview(); + displayPreview(true); return; } @@ -324,56 +328,25 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if ( aSelList.Extent() != 1 ) { - if ( myEditCurrentArgument == GroupPlane->LineEdit1 ) myEdge = GEOM::GEOM_Object::_nil(); + if ( myEditCurrentArgument == GroupPlane->LineEdit1 ) myEdge.nullify(); return; } - // nbSel == 1 - Standard_Boolean aRes = Standard_False; - TopAbs_ShapeEnum aNeedType = TopAbs_EDGE; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName( aSelectedObject ); - - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - if (GroupType->RadioButton2->isChecked()) - aNeedType = TopAbs_FACE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( aSelList.First(), aMap ); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap( 1 ); - if ( aNeedType == TopAbs_EDGE ) - aName += QString( ":edge_%1" ).arg( anIndex ); - else - aName += QString( ":face_%1" ).arg( anIndex ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - } - else - aSelectedObject = aFindedObject; // get Object from study - } - else { // Global Selection - if ( aShape.ShapeType() != aNeedType ) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } + TopAbs_ShapeEnum aNeedType = GroupType->RadioButton2->isChecked() ? TopAbs_FACE : TopAbs_EDGE; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_EDGE ) myEdge = aSelectedObject; else if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_FACE ) myFace = aSelectedObject; } - displayPreview(); + + displayPreview(true); } @@ -398,20 +371,6 @@ void PrimitiveGUI_FaceDlg::SetEditCurrentArgument() SelectionIntoArgument(); } - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_FaceDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPlane->LineEdit1 ) myEditCurrentArgument = GroupPlane->LineEdit1; - else return; - GEOMBase_Skeleton::LineEditReturnPressed(); -} - - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -420,7 +379,7 @@ void PrimitiveGUI_FaceDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -459,28 +418,19 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_FaceDlg::createOperation() //================================================================================= bool PrimitiveGUI_FaceDlg::isValid( QString& msg ) { - bool ok = true; + bool ok = false; if( getConstructorId() == 0 ) { - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ); } else if( getConstructorId() == 1 ) { - ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) && + ( GroupType->RadioButton1->isChecked() ? myEdge : myFace ); } - - const int id = getConstructorId(); - if ( id == 0 ) - return ok; - else if ( id == 1 ) { - if (GroupType->RadioButton1->isChecked()) - return !myEdge->_is_nil() && ok; - else if (GroupType->RadioButton2->isChecked()) - return !myFace->_is_nil() && ok; - } - return false; + return ok; } //================================================================================= @@ -492,31 +442,30 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects) bool res = false; QStringList aParameters; GEOM::GEOM_Object_var anObj; + + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeFaceHW(GroupDimensions->SpinBox_DX->value(), - GroupDimensions->SpinBox_DY->value(), myOrientationType); + anObj = anOper->MakeFaceHW(GroupDimensions->SpinBox_DX->value(), + GroupDimensions->SpinBox_DY->value(), myOrientationType); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; case 1: - if (GroupType->RadioButton1->isChecked()) - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()); - else if (GroupType->RadioButton2->isChecked()) - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()); + anObj = GroupType->RadioButton1->isChecked() ? + anOper->MakeFaceObjHW(myEdge.get(), GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()) : + anOper->MakeFaceObjHW(myFace.get(), GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupPlane->SpinBox_DX->text(); aParameters << GroupPlane->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; @@ -534,14 +483,10 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects) //================================================================================= void PrimitiveGUI_FaceDlg::addSubshapesToStudy() { - QMap objMap; - switch ( getConstructorId() ) { - case 1 : + if ( getConstructorId() == 1 ) { if ( GroupType->RadioButton1->isChecked() ) - objMap[GroupPlane->LineEdit1->text()] = myEdge; + GEOMBase::PublishSubObject( myEdge.get() ); if ( GroupType->RadioButton2->isChecked() ) - objMap[GroupPlane->LineEdit1->text()] = myFace; - break; + GEOMBase::PublishSubObject( myFace.get() ); } - addSubshapesToFather( objMap ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h index 90d034e8b..dc2dc600f 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_FaceDlg.h // Author : Dmitry Matveithev, OCN. @@ -26,7 +24,8 @@ #ifndef BASICGUI_FACEDLG_H #define BASICGUI_FACEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Spin; class DlgRef_1Sel2Spin; @@ -56,8 +55,8 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myEdge; - GEOM::GEOM_Object_var myFace; + GEOM::GeomObjPtr myEdge; + GEOM::GeomObjPtr myFace; int myOrientationType; @@ -74,7 +73,6 @@ private slots: void DeactivateActiveDialog(); void ConstructorsClicked( int ); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox( double ); diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index 6fc293005..0279654c9 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_SphereDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -50,7 +51,7 @@ // TRUE to construct a modal dialog. //================================================================================= PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) :GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPHERE_P" ) ) ); @@ -108,15 +109,15 @@ void PrimitiveGUI_SphereDlg::Init() myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setReadOnly( true ); - myPoint = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); /* min, max, step and decimals for spin boxes */ - initSpinBox( GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox( GroupDimensions->SpinBox_DX, 0.000001, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" ); + initSpinBox( GroupDimensions->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" ); GroupPoints->SpinBox_DX->setValue( 100.0 ); GroupDimensions->SpinBox_DX->setValue( 100.0 ); @@ -127,7 +128,6 @@ void PrimitiveGUI_SphereDlg::Init() connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); @@ -135,7 +135,7 @@ void PrimitiveGUI_SphereDlg::Init() connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_SPHERE" ) ); @@ -172,10 +172,10 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked( int constructorId ) myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setText( "" ); - myPoint = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); break; } case 1: @@ -192,8 +192,9 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked( int constructorId ) qApp->processEvents(); updateGeometry(); resize( minimumSizeHint() ); + SelectionIntoArgument(); - displayPreview(); + displayPreview(true); } @@ -203,6 +204,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked( int constructorId ) //================================================================================= void PrimitiveGUI_SphereDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -239,66 +241,21 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() != 1) { - myPoint = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); return; } - /* nbSel == 1 ! */ - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if ( !testResult || CORBA::is_nil( aSelectedObject ) ) - return; - - QString aName = GEOMBase::GetName( aSelectedObject ); + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX ); TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull() ) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if ( aMap.Extent() == 1 ) { // Local Selection - int anIndex = aMap( 1 ); - aName.append( ":vertex_" + QString::number( anIndex ) ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName ); - - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } - } - else { // Global Selection - if (aShape.ShapeType() != TopAbs_VERTEX) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + myPoint = aSelectedObject; } - myEditCurrentArgument->setText( aName ); - myPoint = aSelectedObject; - - displayPreview(); + displayPreview(true); } -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_SphereDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } -} - - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -325,7 +282,7 @@ void PrimitiveGUI_SphereDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -358,7 +315,7 @@ void PrimitiveGUI_SphereDlg::enterEvent( QEvent* ) //================================================================================= void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox() { - displayPreview(); + displayPreview(true); } @@ -378,12 +335,12 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_SphereDlg::createOperation() //================================================================================= bool PrimitiveGUI_SphereDlg::isValid( QString& msg ) { - bool ok = true; + bool ok = false; if( getConstructorId() == 0 ) - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint; else if( getConstructorId() == 1 ) - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - return getConstructorId() == 0 ? !myPoint->_is_nil() && ok : ok; + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ); + return ok; } //================================================================================= @@ -396,29 +353,31 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch ( getConstructorId() ) { case 0 : { - if ( !CORBA::is_nil( myPoint ) ) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() ); - if (!anObj->_is_nil() && !IsPreview()) + if ( myPoint ) { + anObj = anOper->MakeSpherePntR( myPoint.get(), getRadius() ); + if (!anObj->_is_nil() && !IsPreview()) { - QStringList aParameters; - aParameters << GroupPoints->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); - } - res = true; + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + res = true; } break; } case 1 : { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() ); + anObj = anOper->MakeSphereR( getRadius() ); if (!anObj->_is_nil() && !IsPreview()) { - QStringList aParameters; - aParameters << GroupDimensions->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + QStringList aParameters; + aParameters << GroupDimensions->SpinBox_DX->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; @@ -452,14 +411,7 @@ double PrimitiveGUI_SphereDlg::getRadius() const //================================================================================= void PrimitiveGUI_SphereDlg::addSubshapesToStudy() { - QMap objMap; - - switch ( getConstructorId() ) { - case 0: - objMap[GroupPoints->LineEdit1->text()] = myPoint; - break; - case 1: - return; + if ( getConstructorId() == 0 ) { + GEOMBase::PublishSubObject( myPoint.get() ); } - addSubshapesToFather( objMap ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h index 80ffe3f27..870828ad7 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_SphereDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef PRIMITIVEGUI_SPHEREDLG_H #define PRIMITIVEGUI_SPHEREDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel1Spin; class DlgRef_1Spin; @@ -56,7 +58,7 @@ private: double getRadius() const; private: - GEOM::GEOM_Object_var myPoint; /* Center point */ + GEOM::GeomObjPtr myPoint; /* Center point */ DlgRef_1Sel1Spin* GroupPoints; DlgRef_1Spin* GroupDimensions; @@ -66,7 +68,6 @@ private slots: bool ClickOnApply(); void ActivateThisDialog(); void DeactivateActiveDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index a756fdf62..632a99ae8 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_TorusDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -53,8 +54,7 @@ //================================================================================= PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl), - myInitial(true) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TORUS_PV"))); @@ -115,10 +115,10 @@ void PrimitiveGUI_TorusDlg::Init() double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints->SpinBox_DY, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DX, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY, 0.000001, COORD_MAX, step, 6); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPoints->SpinBox_DY, 0.000001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY, 0.000001, COORD_MAX, step, "length_precision" ); // init variables GroupPoints->LineEdit1->setReadOnly(true); @@ -126,7 +126,8 @@ void PrimitiveGUI_TorusDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint.nullify(); + myDir.nullify(); GroupPoints->SpinBox_DX->setValue(300.0); GroupPoints->SpinBox_DY->setValue(100.0); @@ -142,9 +143,6 @@ void PrimitiveGUI_TorusDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); @@ -200,20 +198,9 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked (int constructorId) qApp->processEvents(); updateGeometry(); resize(minimumSizeHint()); + SelectionIntoArgument(); - if (myInitial) { - myInitial = false; - if (constructorId == 0) { - // on dialog initialization we init the first field with a selected object (if any) - SelectionIntoArgument(); - } - else { - displayPreview(); - } - } - else { - displayPreview(); - } + displayPreview(true); } //================================================================================= @@ -222,6 +209,7 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked (int constructorId) //================================================================================= void PrimitiveGUI_TorusDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -253,82 +241,43 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir = GEOM::GEOM_Object::_nil(); - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) + if (aSelList.Extent() != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint.nullify(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir.nullify(); return; + } - QString aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape + TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (myEditCurrentArgument == GroupPoints->LineEdit2) - aNeedType = TopAbs_EDGE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { // Local Selection - int anIndex = aMap(1); - if (aNeedType == TopAbs_EDGE) - aName.append(":edge_" + QString::number(anIndex)); - else - aName.append(":vertex_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + + myEditCurrentArgument->setText(aName); + + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + if (myEditCurrentArgument == GroupPoints->LineEdit1) { + myPoint = aSelectedObject; + if (myPoint && !myDir) + GroupPoints->PushButton2->click(); } - else { // Global Selection - if (aShape.ShapeType() != aNeedType) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + myDir = aSelectedObject; + if (myDir && !myPoint) + GroupPoints->PushButton1->click(); } } - myEditCurrentArgument->setText(aName); - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - myPoint = aSelectedObject; - if (!myPoint->_is_nil() && myDir->_is_nil()) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myDir = aSelectedObject; - if (!myDir->_is_nil() && myPoint->_is_nil()) - GroupPoints->PushButton1->click(); - } - - displayPreview(); + displayPreview(true); } //================================================================================= @@ -368,21 +317,7 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void PrimitiveGUI_TorusDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + displayPreview(true); } //================================================================================= @@ -394,7 +329,7 @@ void PrimitiveGUI_TorusDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -415,7 +350,7 @@ void PrimitiveGUI_TorusDlg::enterEvent (QEvent*) //================================================================================= void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox() { - displayPreview(); + displayPreview(true); } //================================================================================= @@ -433,18 +368,19 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_TorusDlg::createOperation() //================================================================================= bool PrimitiveGUI_TorusDlg::isValid (QString& msg) { - bool ok = true; + bool ok = false; if( getConstructorId() == 0 ) { - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && + myPoint && myDir; } else if( getConstructorId() == 1 ) { - ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ); } - return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok; + return ok; } //================================================================================= @@ -457,30 +393,30 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2()); + if ( myPoint && myDir ) { + anObj = anOper->MakeTorusPntVecRR(myPoint.get(), myDir.get(), getRadius1(), getRadius2()); if (!anObj->_is_nil() && !IsPreview()) { - QStringList aParameters; - aParameters << GroupPoints->SpinBox_DX->text(); - aParameters << GroupPoints->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + aParameters << GroupPoints->SpinBox_DY->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeTorusRR(getRadius1(), getRadius2()); + anObj = anOper->MakeTorusRR(getRadius1(), getRadius2()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; @@ -526,15 +462,8 @@ double PrimitiveGUI_TorusDlg::getRadius2() const //================================================================================= void PrimitiveGUI_TorusDlg::addSubshapesToStudy() { - QMap objMap; - - switch (getConstructorId()) { - case 0: - objMap[GroupPoints->LineEdit1->text()] = myPoint; - objMap[GroupPoints->LineEdit2->text()] = myDir; - break; - case 1: - return; + if ( getConstructorId() == 0 ) { + GEOMBase::PublishSubObject( myPoint.get() ); + GEOMBase::PublishSubObject( myDir.get() ); } - addSubshapesToFather(objMap); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h index c173b0edf..96c3d6396 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : PrimitiveGUI_TorusDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef PRIMITIVEGUI_TORUSDLG_H #define PRIMITIVEGUI_TORUSDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel2Spin; class DlgRef_2Spin; @@ -57,11 +59,8 @@ private: double getRadius2() const; private: - GEOM::GEOM_Object_var myPoint, myDir; + GEOM::GeomObjPtr myPoint, myDir; - // to initialize the first selection field with a selected object on the dialog creation - bool myInitial; - DlgRef_2Sel2Spin* GroupPoints; DlgRef_2Spin* GroupDimensions; @@ -69,7 +68,6 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); diff --git a/src/RepairGUI/Makefile.am b/src/RepairGUI/Makefile.am index 51e90f1bb..4c1bf3d8e 100644 --- a/src/RepairGUI/Makefile.am +++ b/src/RepairGUI/Makefile.am @@ -1,29 +1,25 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 REPAIRGUI : +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : RepairGUI -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files @@ -40,7 +36,9 @@ salomeinclude_HEADERS = \ RepairGUI_FreeFacesDlg.h \ RepairGUI_ChangeOrientationDlg.h \ RepairGUI_GlueDlg.h \ - RepairGUI_RemoveExtraEdgesDlg.h + RepairGUI_LimitToleranceDlg.h \ + RepairGUI_RemoveExtraEdgesDlg.h \ + RepairGUI_FuseEdgesDlg.h # Libraries targets lib_LTLIBRARIES = libRepairGUI.la @@ -58,7 +56,9 @@ dist_libRepairGUI_la_SOURCES = \ RepairGUI_FreeFacesDlg.h \ RepairGUI_ChangeOrientationDlg.h \ RepairGUI_GlueDlg.h \ + RepairGUI_LimitToleranceDlg.h \ RepairGUI_RemoveExtraEdgesDlg.h \ + RepairGUI_FuseEdgesDlg.h \ \ RepairGUI.cxx \ RepairGUI_SewingDlg.cxx \ @@ -72,7 +72,9 @@ dist_libRepairGUI_la_SOURCES = \ RepairGUI_FreeFacesDlg.cxx \ RepairGUI_ChangeOrientationDlg.cxx \ RepairGUI_GlueDlg.cxx \ - RepairGUI_RemoveExtraEdgesDlg.cxx + RepairGUI_LimitToleranceDlg.cxx \ + RepairGUI_RemoveExtraEdgesDlg.cxx \ + RepairGUI_FuseEdgesDlg.cxx MOC_FILES = \ RepairGUI_SewingDlg_moc.cxx \ @@ -86,7 +88,9 @@ MOC_FILES = \ RepairGUI_FreeFacesDlg_moc.cxx \ RepairGUI_ChangeOrientationDlg_moc.cxx \ RepairGUI_GlueDlg_moc.cxx \ - RepairGUI_RemoveExtraEdgesDlg_moc.cxx + RepairGUI_LimitToleranceDlg_moc.cxx \ + RepairGUI_RemoveExtraEdgesDlg_moc.cxx \ + RepairGUI_FuseEdgesDlg_moc.cxx nodist_libRepairGUI_la_SOURCES = \ $(MOC_FILES) @@ -110,8 +114,7 @@ libRepairGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMImpl \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libRepairGUI_la_LDFLAGS = \ ../GEOMBase/libGEOMBase.la diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index ff1045d49..5144986fa 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -1,31 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : RepairGUI.cxx -// Author : Damien COQUERET, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : RepairGUI.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. + #include "RepairGUI.h" #include +#include "GeometryGUI_Operations.h" #include #include @@ -41,8 +41,10 @@ #include "RepairGUI_FreeBoundDlg.h" // Method FREE BOUNDARIES #include "RepairGUI_FreeFacesDlg.h" // Method FREE FACES #include "RepairGUI_GlueDlg.h" // Method GLUE FACES +#include "RepairGUI_LimitToleranceDlg.h" // Method LIMIT TOLERANCE #include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION -#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES +#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES +#include "RepairGUI_FuseEdgesDlg.h" // Method FUSE COLLINEAR EDGES //======================================================================= // function : RepairGUI() @@ -64,7 +66,7 @@ RepairGUI::~RepairGUI() //======================================================================= // function : OnGUIEvent() -// purpose : +// purpose : //======================================================================= bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { @@ -74,25 +76,28 @@ bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; - switch ( theCommandID ) { - case 601: aDlg = new RepairGUI_SewingDlg ( getGeometryGUI(), parent ); break; - case 602: aDlg = new RepairGUI_GlueDlg ( getGeometryGUI(), parent ); break; - case 603: aDlg = new RepairGUI_SuppressFacesDlg ( getGeometryGUI(), parent ); break; - case 604: aDlg = new RepairGUI_RemoveHolesDlg ( getGeometryGUI(), parent ); break; - case 605: aDlg = new RepairGUI_ShapeProcessDlg ( getGeometryGUI(), parent ); break; - case 606: aDlg = new RepairGUI_CloseContourDlg ( getGeometryGUI(), parent ); break; - case 607: aDlg = new RepairGUI_RemoveIntWiresDlg ( getGeometryGUI(), parent ); break; - case 608: aDlg = new RepairGUI_DivideEdgeDlg ( getGeometryGUI(), parent ); break; - case 609: aDlg = new RepairGUI_FreeBoundDlg ( getGeometryGUI(), parent ); break; - case 610: aDlg = new RepairGUI_FreeFacesDlg ( getGeometryGUI(), parent ); break; - case 611: aDlg = new RepairGUI_ChangeOrientationDlg ( getGeometryGUI(), parent ); break; - case 612: aDlg = new RepairGUI_RemoveExtraEdgesDlg ( getGeometryGUI(), parent ); break; - default: - app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); - break; + switch (theCommandID) { + case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_FACE); break; + case GEOMOp::OpGlueEdges: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_EDGE); break; + case GEOMOp::OpLimitTolerance: aDlg = new RepairGUI_LimitToleranceDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpShapeProcess: aDlg = new RepairGUI_ShapeProcessDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpCloseContour: aDlg = new RepairGUI_CloseContourDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpRemoveIntWires: aDlg = new RepairGUI_RemoveIntWiresDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpAddPointOnEdge: aDlg = new RepairGUI_DivideEdgeDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpFreeBoundaries: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpFreeFaces: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpFuseEdges: aDlg = new RepairGUI_FuseEdgesDlg (getGeometryGUI(), parent); break; + default: + app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; } - if ( aDlg ) + if (aDlg) aDlg->show(); return true; diff --git a/src/RepairGUI/RepairGUI.h b/src/RepairGUI/RepairGUI.h index c829b3b80..97ac66b0c 100644 --- a/src/RepairGUI/RepairGUI.h +++ b/src/RepairGUI/RepairGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx b/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx index 485127b1f..60173a643 100644 --- a/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx +++ b/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_ChangeOrientationDlg.cxx // Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com) @@ -46,8 +47,8 @@ // TRUE to construct a modal dialog. //================================================================================= RepairGUI_ChangeOrientationDlg::RepairGUI_ChangeOrientationDlg( GeometryGUI* theGeometryGUI, - QWidget* parent, - bool modal ) + QWidget* parent, + bool modal ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal ) { //QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE"))); @@ -113,9 +114,11 @@ void RepairGUI_ChangeOrientationDlg::Init() connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "CHANGE_ORIENTATION_NEW_OBJ_NAME" ) ); + resize(100,100); + SelectionIntoArgument(); } @@ -125,6 +128,7 @@ void RepairGUI_ChangeOrientationDlg::Init() //================================================================================= void RepairGUI_ChangeOrientationDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -170,11 +174,10 @@ void RepairGUI_ChangeOrientationDlg::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( aSelList.First(), testResult ); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if ( !testResult ) + if ( CORBA::is_nil( aSelectedObject ) ) return; if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { @@ -224,7 +227,7 @@ void RepairGUI_ChangeOrientationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); } @@ -268,11 +271,12 @@ bool RepairGUI_ChangeOrientationDlg::execute( ObjectList& objects ) bool toCreateCopy = GroupPoints->CheckButton1->isChecked(); GEOM::GEOM_Object_var anObj; + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() ); if ( toCreateCopy ) { - anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientationCopy( myObject ); + anObj = anOper->ChangeOrientationCopy( myObject ); } else { - anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientation( myObject ); + anObj = anOper->ChangeOrientation( myObject ); } if ( !anObj->_is_nil() ) diff --git a/src/RepairGUI/RepairGUI_ChangeOrientationDlg.h b/src/RepairGUI/RepairGUI_ChangeOrientationDlg.h index e248bc7f7..35b43d85d 100644 --- a/src/RepairGUI/RepairGUI_ChangeOrientationDlg.h +++ b/src/RepairGUI/RepairGUI_ChangeOrientationDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_ChangeOrientationDlg.h // Author : Sergey KUUL, Open CASCADE S.A.S. (sergey.kuul@opencascade.com) diff --git a/src/RepairGUI/RepairGUI_CloseContourDlg.cxx b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx index 85705502f..562c94cf6 100644 --- a/src/RepairGUI/RepairGUI_CloseContourDlg.cxx +++ b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_CloseContourDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -133,6 +134,7 @@ void RepairGUI_CloseContourDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= @@ -141,6 +143,7 @@ void RepairGUI_CloseContourDlg::Init() //================================================================================= void RepairGUI_CloseContourDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -182,9 +185,8 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument() Handle(SALOME_InteractiveObject) anIO = aSelList.First(); if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if (aRes && GEOMBase::IsShape(myObject)) { + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( GEOMBase::IsShape(myObject) ) { myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); TopoDS_Shape aShape; if (GEOMBase::GetShape(myObject, aShape, TopAbs_WIRE)) @@ -271,7 +273,7 @@ void RepairGUI_CloseContourDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText( "" ); @@ -318,8 +320,8 @@ bool RepairGUI_CloseContourDlg::isValid (QString&) //================================================================================= bool RepairGUI_CloseContourDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())-> - CloseContour(myObject, myWiresInd, getIsByVertex()); + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->CloseContour(myObject, myWiresInd, getIsByVertex()); bool aResult = !anObj->_is_nil(); if (aResult) diff --git a/src/RepairGUI/RepairGUI_CloseContourDlg.h b/src/RepairGUI/RepairGUI_CloseContourDlg.h index 71d1a3b7e..079ea5cb4 100644 --- a/src/RepairGUI/RepairGUI_CloseContourDlg.h +++ b/src/RepairGUI/RepairGUI_CloseContourDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_CloseContourDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx index e70168621..522f4e87b 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_DivideEdgeDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -28,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -41,8 +42,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -84,7 +87,8 @@ RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg( GeometryGUI* theGeometryGUI, Q myIsParameterGr->addButton( rb2, 1 ); rb1->setChecked( true ); - myValEdt = new SalomeApp_DoubleSpinBox( 0., 1., 0.1, 3, 32, GroupPoints->Box ); + myValEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box ); + initSpinBox( myValEdt, 0., 1., 0.1, "parametric_precision" ); myValEdt->setValue( 0.5 ); QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box ); @@ -124,6 +128,7 @@ void RepairGUI_DivideEdgeDlg::Init() myEditCurrentArgument = GroupPoints->LineEdit1; myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; //myGeomGUI->SetState( 0 ); initSelection(); @@ -138,9 +143,11 @@ void RepairGUI_DivideEdgeDlg::Init() connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) ); + resize(100,100); + SelectionIntoArgument(); } //================================================================================= @@ -158,25 +165,32 @@ void RepairGUI_DivideEdgeDlg::ValueChangedInSpinBox() //================================================================================= void RepairGUI_DivideEdgeDlg::displayPreview() { + erasePreview(); if ( myObject->_is_nil() ) return; TopoDS_Shape aShape; gp_Pnt aPnt; - if ( GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE ) ) { - if (aShape.ShapeType() == TopAbs_EDGE) { - Standard_Real aFP, aLP, aP; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP); - aP = aFP + (aLP - aFP) * myValEdt->value(); - aPnt = aCurve->Value(aP); - BRepBuilderAPI_MakeVertex mkVertex (aPnt); - aShape = mkVertex.Shape(); - // Build prs - SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape ); - if ( aPrs != 0 && !aPrs->IsNull() ) - GEOMBase_Helper::displayPreview( aPrs, false, true ); - } + GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE ); + + if ( myIndex != -1) { + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes(aShape, aShapes); + aShape = aShapes.FindKey(myIndex); } + + if (aShape.ShapeType() == TopAbs_EDGE) { + Standard_Real aFP, aLP, aP; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP); + aP = aFP + (aLP - aFP) * myValEdt->value(); + aPnt = aCurve->Value(aP); + BRepBuilderAPI_MakeVertex mkVertex (aPnt); + aShape = mkVertex.Shape(); + // Build prs + SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape ); + if ( aPrs != 0 && !aPrs->IsNull() ) + GEOMBase_Helper::displayPreview( aPrs, false, true ); + } } //================================================================================= @@ -185,6 +199,7 @@ void RepairGUI_DivideEdgeDlg::displayPreview() //================================================================================= void RepairGUI_DivideEdgeDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -203,6 +218,7 @@ bool RepairGUI_DivideEdgeDlg::ClickOnApply() myEditCurrentArgument->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; initSelection(); @@ -220,6 +236,7 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() myEditCurrentArgument->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; @@ -227,47 +244,45 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() if ( aSelList.Extent() == 1 ) { Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - Standard_Boolean aRes; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName( aSelectedObject ); + GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( !CORBA::is_nil( aSelectedObj ) ) + { TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) { + QString aName = GEOMBase::GetName( aSelectedObj ); + if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) + { const int aType = aShape.ShapeType(); - if ( aType <= TopAbs_EDGE ) { - // edge, wire, face, shell, solid, compound + if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound + { GEOM::short_array anIndexes; TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( anIO, aMap ); - - if ( aMap.Extent() == 1 ) { // local selection - int anIndex = aMap( 1 ); - myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( anIndex ) ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - myObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - } - else { - myObject = aFindedObject; // get Object from study - } + SalomeApp_Application* anApp = + (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + anApp->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) // sub-shape selection + { + myIndex = aMap( 1 ); + myObject = aSelectedObj; + myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( myIndex ) ); } - else if ( aType == TopAbs_EDGE ) { - // single shape selection - myObject = aSelectedObject; + else if ( aType == TopAbs_EDGE ) // single shape selection + { + myIndex = -1; + myObject = aSelectedObj; myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); } - else { - // face, shell, solid or compound was selected, and NOT its subshape. + else // face, shell, solid or compound was selected, and NOT its sub-shape. + { + myIndex = -1; myObject = GEOM::GEOM_Object::_nil(); } } } } } + displayPreview(); } @@ -306,9 +321,10 @@ void RepairGUI_DivideEdgeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); // myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; //myGeomGUI->SetState( 0 ); initSelection(); @@ -350,8 +366,8 @@ bool RepairGUI_DivideEdgeDlg::isValid( QString& msg ) //================================================================================= bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->DivideEdge - ( myObject, -1, myValEdt->value(), getIsByParameter() ); + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->DivideEdge( myObject, myIndex, myValEdt->value(), getIsByParameter() ); bool aResult = !anObj->_is_nil(); if ( aResult ) { @@ -361,7 +377,7 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects ) aParameters << ""; aParameters << myValEdt->text(); aParameters << ""; - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } objects.push_back( anObj._retn() ); } @@ -387,15 +403,3 @@ void RepairGUI_DivideEdgeDlg::initSelection() GEOM::GEOM_Object_var aNullGeomObject; localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects } - -//================================================================================= -// function : addSubshapeToStudy -// purpose : virtual method to add new SubObjects if local selection -//================================================================================= -void RepairGUI_DivideEdgeDlg::addSubshapesToStudy() -{ - QMap objMap; - objMap[GroupPoints->LineEdit1->text()] = myObject; - - addSubshapesToFather( objMap ); -} diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h index d7ceed40e..5b39121e3 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_DivideEdgeDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -49,7 +50,6 @@ protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); - virtual void addSubshapesToStudy(); private: void Init(); @@ -57,6 +57,7 @@ private: void initSelection(); bool getIsByParameter() const; + int myIndex; private: GEOM::GEOM_Object_var myObject; diff --git a/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx index f20e04130..3ef492fcc 100644 --- a/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx +++ b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_FreeBoundDlg.cxx // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) @@ -62,7 +63,7 @@ // purpose : Constructor //================================================================================= RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent ) - : QDialog( theParent, false ), + : QDialog( theParent, 0 ), GEOMBase_Helper( dynamic_cast( theParent ) ), myGeomGUI( theGUI ) { @@ -156,10 +157,10 @@ void RepairGUI_FreeBoundDlg::onHelp() platform = "application"; #endif SUIT_MessageBox::warning( this, - tr( "WRN_WARNING" ), - tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", - platform ) ).arg( myHelpFileName ) ); + tr( "WRN_WARNING" ), + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ).arg( myHelpFileName ) ); } } @@ -185,7 +186,7 @@ void RepairGUI_FreeBoundDlg::onActivate() setEnabled( true ); myGeomGUI->SetActiveDialogBox( this ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); + SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); activateSelection(); onSelectionDone(); } @@ -203,15 +204,14 @@ void RepairGUI_FreeBoundDlg::onSelectionDone() if ( aSelList.Extent() != 1 ) return; - Standard_Boolean isOk = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( aSelList.First(), isOk ); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) + if ( !GEOMBase::IsShape( anObj ) ) return; else { myObj = anObj; - displayPreview( false, true, true, 3 ); + displayPreview( true, false, true, true, 3 ); } } @@ -226,7 +226,7 @@ void RepairGUI_FreeBoundDlg::Init() connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); + SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); activateSelection(); onSelectionDone(); @@ -293,8 +293,8 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects ) GEOM::ListOfGO_var aClosed, anOpen; - bool result = GEOM::GEOM_IHealingOperations::_narrow( - getOperation() )->GetFreeBoundary( myObj, aClosed, anOpen ); + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() ); + bool result = anOper->GetFreeBoundary( myObj, aClosed, anOpen ); if ( result ) { myNbClosed = aClosed->length(); diff --git a/src/RepairGUI/RepairGUI_FreeBoundDlg.h b/src/RepairGUI/RepairGUI_FreeBoundDlg.h index afca4ef79..af65e1602 100644 --- a/src/RepairGUI/RepairGUI_FreeBoundDlg.h +++ b/src/RepairGUI/RepairGUI_FreeBoundDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_FreeBoundDlg.h // Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com) diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx index a4319e05a..399182766 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_FreeFacesDlg.cxx // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) @@ -66,8 +67,8 @@ // TRUE to construct a modal dialog. //================================================================================= RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg( GeometryGUI* GUI, QWidget* parent, - bool modal ) - : QDialog( parent, false ), + bool modal ) + : QDialog( parent, 0 ), GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( GUI ), myDisplayer( 0 ) @@ -170,11 +171,11 @@ void RepairGUI_FreeFacesDlg::onHelp() platform = "application"; #endif SUIT_MessageBox::warning( this, - tr( "WRN_WARNING" ), - tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", - platform ) ). - arg( myHelpFileName ) ); + tr( "WRN_WARNING" ), + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ). + arg( myHelpFileName ) ); } } @@ -200,7 +201,7 @@ void RepairGUI_FreeFacesDlg::onActivate() setEnabled( true ); myGeomGUI->SetActiveDialogBox( this ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); + SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); activateSelection(); } @@ -215,7 +216,7 @@ void RepairGUI_FreeFacesDlg::Init() /* signals and slots connections */ connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); + SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); activateSelection(); onSelectionDone(); @@ -238,17 +239,16 @@ void RepairGUI_FreeFacesDlg::onSelectionDone() return; } - Standard_Boolean isOk = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( aSelList.First(), isOk ); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) { + if ( !GEOMBase::IsShape( anObj ) ) { myEdit->setText( "" ); return; } else { myObj = anObj; - displayPreview( false, true, true, 3 ); + displayPreview( true, false, true, true, 3 ); } } @@ -307,8 +307,8 @@ bool RepairGUI_FreeFacesDlg::isValid( QString& ) bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) { bool aResult = false; - GEOM::ListOfLong_var aFaceLst = - GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->GetFreeFacesIDs( myObj ); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + GEOM::ListOfLong_var aFaceLst = anOper->GetFreeFacesIDs( myObj ); TopoDS_Shape aSelShape; TopoDS_Shape aFace; TopTools_IndexedMapOfShape anIndices; @@ -330,9 +330,9 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) try { getDisplayer()->SetColor( Quantity_NOC_RED ); getDisplayer()->SetToActivate( false ); - aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0; + aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0; if ( aPrs ) - displayPreview( aPrs, true ); + displayPreview( aPrs, true ); } catch( const SALOME::SALOME_Exception& e ) { diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.h b/src/RepairGUI/RepairGUI_FreeFacesDlg.h index 8cd360721..2987c7c1f 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.h +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_FreeFacesDlg.h // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com) diff --git a/src/RepairGUI/RepairGUI_FuseEdgesDlg.cxx b/src/RepairGUI/RepairGUI_FuseEdgesDlg.cxx new file mode 100644 index 000000000..4356b1896 --- /dev/null +++ b/src/RepairGUI/RepairGUI_FuseEdgesDlg.cxx @@ -0,0 +1,347 @@ +// Copyright (C) 2007-2012 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 "RepairGUI_FuseEdgesDlg.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// OCCT Includes +#include +#include + +#include + +//================================================================================= +// class : RepairGUI_FuseEdgesDlg() +// purpose : Constructs a RepairGUI_FuseEdgesDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_FuseEdgesDlg::RepairGUI_FuseEdgesDlg (GeometryGUI* theGeometryGUI, + QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ + SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); + QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FUSE_EDGES"))); + QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_FUSE_EDGES_TITLE")); + + mainFrame()->GroupConstructors->setTitle(tr("GEOM_FUSE_EDGES")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->close(); + + GroupVertexes = new DlgRef_2Sel1Spin (centralWidget()); + GroupVertexes->GroupBox1->setTitle(tr("GEOM_FUSE_EDGES")); + GroupVertexes->TextLabel1->setText(tr("GEOM_WIRE")); + GroupVertexes->TextLabel2->setText(tr("GEOM_VERTEXES")); + GroupVertexes->PushButton1->setIcon(iconSelect); + GroupVertexes->PushButton2->setIcon(iconSelect); + GroupVertexes->LineEdit1->setReadOnly(true); + GroupVertexes->LineEdit2->setReadOnly(true); + + GroupVertexes->TextLabel3->setShown(false); + GroupVertexes->SpinBox_DX->setShown(false); + + QVBoxLayout* layout = new QVBoxLayout (centralWidget()); + layout->setMargin(0); + layout->setSpacing(6); + layout->addWidget(GroupVertexes); + + setHelpFileName("fuse_edges_operation_page.html"); + + // Initialisation + Init(); + resize(100,100); +} + +//================================================================================= +// function : ~RepairGUI_FuseEdgesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_FuseEdgesDlg::~RepairGUI_FuseEdgesDlg() +{ +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_FuseEdgesDlg::Init() +{ + // Clear line edits + GroupVertexes->LineEdit1->setText(""); + GroupVertexes->LineEdit2->setText(""); + + myShape = GEOM::GEOM_Object::_nil(); + + myPoints.clear(); + + // signals and slots connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupVertexes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupVertexes->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupVertexes->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupVertexes->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + initName(tr("FUSE_EDGES_NEW_OBJ_NAME")); + GroupVertexes->PushButton1->click(); + + SelectionIntoArgument(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void RepairGUI_FuseEdgesDlg::ClickOnOk() +{ + setIsApplyAndClose(true); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_FuseEdgesDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + // Reset dialog state + GroupVertexes->LineEdit1->setText(""); + GroupVertexes->LineEdit2->setText(""); + myShape = GEOM::GEOM_Object::_nil(); + myPoints.clear(); + GroupVertexes->PushButton1->click(); + + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection is changed or on dialog initialization or activation +//================================================================================= +void RepairGUI_FuseEdgesDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + // If selection of main object is activated + if (myEditCurrentArgument == GroupVertexes->LineEdit1) { + myShape = GEOM::GEOM_Object::_nil(); + if (aSelList.Extent() == 1) { + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject(aSelList.First()); + + if (!anObj->_is_nil()) { + QString aName = GEOMBase::GetName(anObj); + TopoDS_Shape aShape; + if (GEOMBase::GetShape(anObj, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes(aSelList.First(), aMap); + if (aMap.Extent() == 1) { // Local Selection + int anIndex = aMap(1); + aName += QString(":wire_%1").arg(anIndex); + + //Find SubShape Object in Father + GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(anObj, aName); + + if (aFindedObject->_is_nil()) { // Object not found in study + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); + anObj = aShapesOp->GetSubShape(anObj, anIndex); + } + else + anObj = aFindedObject; // get Object from study + } + else { // Global Selection + if (aShape.ShapeType() != TopAbs_WIRE) { + anObj = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } + myShape = anObj; + myEditCurrentArgument->setText(aName); + } + } + + if (!myShape->_is_nil() && myPoints.isEmpty()) + GroupVertexes->PushButton2->click(); + } + else if (myEditCurrentArgument == GroupVertexes->LineEdit2) { + myPoints = getSelected(TopAbs_VERTEX, -1); + if (!myPoints.isEmpty()) + myEditCurrentArgument->setText(QString::number(myPoints.count()) + "_" + tr("GEOM_POINT") + tr("_S_")); + else + myEditCurrentArgument->setText(""); + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_FuseEdgesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if (send == GroupVertexes->PushButton1) { + myEditCurrentArgument = GroupVertexes->LineEdit1; + GroupVertexes->PushButton2->setDown(false); + GroupVertexes->LineEdit2->setEnabled(false); + } + else if (send == GroupVertexes->PushButton2) { + myEditCurrentArgument = GroupVertexes->LineEdit2; + GroupVertexes->PushButton1->setDown(false); + GroupVertexes->LineEdit1->setEnabled(false); + } + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); + + activateSelection(); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_FuseEdgesDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + + if (send == GroupVertexes->LineEdit1) + myEditCurrentArgument = GroupVertexes->LineEdit1; + else if (send == GroupVertexes->LineEdit2) + myEditCurrentArgument = GroupVertexes->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_FuseEdgesDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void RepairGUI_FuseEdgesDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void RepairGUI_FuseEdgesDlg::activateSelection() +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + globalSelection(); + if (myEditCurrentArgument == GroupVertexes->LineEdit1) + globalSelection(GEOM_WIRE); + else if (!myShape->_is_nil() && myEditCurrentArgument == GroupVertexes->LineEdit2) + localSelection(myShape, TopAbs_VERTEX); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_FuseEdgesDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations(getStudyId()); +} + +//================================================================================= +// function : isValid() +// purpose : Verify validity of input data +//================================================================================= +bool RepairGUI_FuseEdgesDlg::isValid (QString& msg) +{ + return (!myShape->_is_nil()); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_FuseEdgesDlg::execute (ObjectList& objects) +{ + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + + GEOM::ListOfGO_var points = new GEOM::ListOfGO(); + points->length(myPoints.count()); + for (int i = 0; i < myPoints.count(); i++) + points[i] = myPoints[i].copy(); + + GEOM::GEOM_Object_var anObj = anOper->FuseCollinearEdgesWithinWire(myShape, points.in()); + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + + return true; +} + +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void RepairGUI_FuseEdgesDlg::addSubshapesToStudy() +{ + for (int i = 0; i < myPoints.count(); i++) + GEOMBase::PublishSubObject(myPoints[i].get()); +} diff --git a/src/RepairGUI/RepairGUI_FuseEdgesDlg.h b/src/RepairGUI/RepairGUI_FuseEdgesDlg.h new file mode 100644 index 000000000..38d019aff --- /dev/null +++ b/src/RepairGUI/RepairGUI_FuseEdgesDlg.h @@ -0,0 +1,67 @@ +// Copyright (C) 2007-2012 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 + +#ifndef REPAIRGUI_FuseEdgesDLG_H +#define REPAIRGUI_FuseEdgesDLG_H + +#include + +#include + +class DlgRef_2Sel1Spin; + +//================================================================================= +// class : RepairGUI_FuseEdgesDlg +// purpose : +//================================================================================= +class RepairGUI_FuseEdgesDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_FuseEdgesDlg (GeometryGUI*, QWidget*); + ~RepairGUI_FuseEdgesDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual void addSubshapesToStudy(); + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +private: + void Init(); + void enterEvent (QEvent*); + void activateSelection(); + +private: + GEOM::GEOM_Object_var myShape; + QList myPoints; + + DlgRef_2Sel1Spin* GroupVertexes; +}; + +#endif // REPAIRGUI_FuseEdgesDLG_H diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index 3425fc433..77a027681 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -1,39 +1,40 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM RepairGUI : GUI for Geometry component // File : RepairGUI_GlueDlg.cxx -// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + #include "RepairGUI_GlueDlg.h" #include #include #include -#include +#include #include -#include #include #include +#include #include #include #include @@ -57,80 +58,122 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal ) - : GEOMBase_Skeleton( theGeometryGUI, parent, modal ), - myCurrConstrId( -1 ) +RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal, TopAbs_ShapeEnum theGlueMode) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal), + myCurrConstrId(-1), myGlueMode(theGlueMode) { - QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES" ) ) ); - QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES2" ) )); - QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - - setWindowTitle( tr( "GEOM_GLUE_TITLE" ) ); + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_FACES"))); + QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_FACES2"))); + QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_EDGES"))); + QPixmap image4 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_EDGES2"))); + + QString aTitle; + if (theGlueMode == TopAbs_FACE) + aTitle = tr("GEOM_GLUE_FACES_TITLE"); + else if (theGlueMode == TopAbs_EDGE) + aTitle = tr("GEOM_GLUE_EDGES_TITLE"); + setWindowTitle(aTitle); /***************************************************************/ - mainFrame()->GroupConstructors->setTitle( tr( "GEOM_GLUE_TITLE" ) ); - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setIcon( image2 ); - mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->GroupConstructors->setTitle(aTitle); + if (theGlueMode == TopAbs_FACE) { + mainFrame()->RadioButton1->setIcon(image1); + mainFrame()->RadioButton2->setIcon(image2); + } + else if (theGlueMode == TopAbs_EDGE) { + mainFrame()->RadioButton1->setIcon(image3); + mainFrame()->RadioButton2->setIcon(image4); + } + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_1SelExt( centralWidget() ); - GroupPoints->GroupBox1->setTitle( tr( "GEOM_GLUE" ) ); - GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); - GroupPoints->PushButton1->setIcon( image1 ); - GroupPoints->LineEdit1->setReadOnly( true ); - - QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box ); - myTolEdt = new SalomeApp_DoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 7, GroupPoints->Box ); - myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); - - QGridLayout* boxLayout = new QGridLayout( GroupPoints->Box ); - boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 ); - boxLayout->addWidget( aTolLab, 0, 0 ); - boxLayout->addWidget( myTolEdt, 0, 2 ); + GroupPoints = new DlgRef_1SelExt(centralWidget()); + GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints->PushButton1->setIcon(image0); + GroupPoints->LineEdit1->setReadOnly(true); + + QLabel* aTolLab = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints->Box); + myTolEdt = new SalomeApp_DoubleSpinBox(GroupPoints->Box); + initSpinBox(myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision"); + myTolEdt->setValue(DEFAULT_TOLERANCE_VALUE); + + QGridLayout* boxLayout = new QGridLayout(GroupPoints->Box); + boxLayout->setMargin(0); boxLayout->setSpacing(6); + boxLayout->addWidget(aTolLab, 0, 0); + boxLayout->addWidget(myTolEdt, 0, 2); /***************************************************************/ - GroupPoints2 = new DlgRef_1SelExt( centralWidget() ); - GroupPoints2->GroupBox1->setTitle( tr( "GEOM_GLUE" ) ); - GroupPoints2->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); - GroupPoints2->PushButton1->setIcon( image1 ); - GroupPoints2->LineEdit1->setReadOnly( true ); - - QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box ); - myTolEdt2 = new SalomeApp_DoubleSpinBox( GroupPoints2->Box ); - initSpinBox( myTolEdt2, 0, 100, 1e-7, 7 ); - myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE ); - - myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GLUE_FACES" ) ), - GroupPoints2->Box ); - mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), GroupPoints2->Box ); - - boxLayout = new QGridLayout( GroupPoints2->Box ); - boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 ); - boxLayout->addWidget( aTolLab2, 0, 0 ); - boxLayout->addWidget( myTolEdt2, 0, 2 ); - boxLayout->addWidget( myDetectBtn, 1, 0, 1, 3 ); - boxLayout->addWidget( mySubShapesChk, 2, 0, 1, 3 ); - - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupPoints ); - layout->addWidget( GroupPoints2 ); + GroupPoints2 = new DlgRef_1SelExt(centralWidget()); + GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE")); + GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints2->PushButton1->setIcon(image0); + GroupPoints2->LineEdit1->setReadOnly(true); + + QLabel* aTolLab2 = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints2->Box); + myTolEdt2 = new SalomeApp_DoubleSpinBox(GroupPoints2->Box); + initSpinBox(myTolEdt2, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision"); + myTolEdt2->setValue(DEFAULT_TOLERANCE_VALUE); + + QString aGlueString (" [%1]"); + QString aSelString; + if (theGlueMode == TopAbs_FACE) { + aGlueString = aGlueString.arg(tr("GLUE_FACES")); + aSelString = tr("SELECT_FACES"); + } + else if (theGlueMode == TopAbs_EDGE) { + aGlueString = aGlueString.arg(tr("GLUE_EDGES")); + aSelString = tr("SELECT_EDGES"); + } + myDetectBtn = new QPushButton (tr("GEOM_DETECT") + aGlueString, GroupPoints2->Box); + mySubShapesChk = new QCheckBox (aSelString, GroupPoints2->Box); + myGlueAllEdgesChk = 0; + + boxLayout = new QGridLayout(GroupPoints2->Box); + boxLayout->setMargin(0); boxLayout->setSpacing(6); + boxLayout->addWidget(aTolLab2, 0, 0); + boxLayout->addWidget(myTolEdt2, 0, 2); + boxLayout->addWidget(myDetectBtn, 1, 0, 1, 3); + boxLayout->addWidget(mySubShapesChk, 2, 0, 1, 3); + + if (theGlueMode == TopAbs_FACE) { + myGlueAllEdgesChk = new QCheckBox (tr("GLUE_ALL_EDGES"), GroupPoints2->Box); + boxLayout->addWidget(myGlueAllEdgesChk, 3, 0, 1, 3); + myGlueAllEdgesChk->setChecked(false); + } + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupPoints); + layout->addWidget(GroupPoints2); /***************************************************************/ - setHelpFileName( "glue_faces_operation_page.html" ); - + QString aHelpFileName; + switch ( myGlueMode ) { + case TopAbs_EDGE: + { + aHelpFileName = "glue_edges_operation_page.html"; + break; + } + case TopAbs_FACE: + { + aHelpFileName = "glue_faces_operation_page.html"; + break; + } + } + setHelpFileName(aHelpFileName); + // Disable second way of gluing if OCC viewer is not active one - if ( myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type() ) - mainFrame()->RadioButton2->setEnabled( false ); + if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) + mainFrame()->RadioButton2->setEnabled(false); Init(); } - //================================================================================= // function : ~RepairGUI_GlueDlg() // purpose : Destroys the object and frees any allocated resources @@ -139,7 +182,6 @@ RepairGUI_GlueDlg::~RepairGUI_GlueDlg() { } - //================================================================================= // function : Init() // purpose : @@ -151,115 +193,115 @@ void RepairGUI_GlueDlg::Init() myObject = GEOM::GEOM_Object::_nil(); - //myGeomGUI->SetState( 0 ); - //globalSelection( GEOM_COMPOUND ); + //myGeomGUI->SetState(0); + //globalSelection(GEOM_COMPOUND); mainFrame()->GroupBoxPublish->show(); + //Hide preview checkbox + mainFrame()->CheckBoxPreview->hide(); /* signals and slots connections */ - connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); - connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(myTolEdt2, SIGNAL(valueChanged(double)), this, SLOT(onTolerChanged(double))); + connect(mySubShapesChk, SIGNAL(stateChanged(int)), this, SLOT(onSubShapesChk())); - connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) ); - connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect())); - connect( myDetectBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) ); + initName(tr("GLUE_NEW_OBJ_NAME")); - initName( tr( "GLUE_NEW_OBJ_NAME" ) ); + ConstructorsClicked(0); - ConstructorsClicked( 0 ); - activateSelection(); updateButtonState(); } - //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId ) +void RepairGUI_GlueDlg::ConstructorsClicked(int constructorId) { - if ( myCurrConstrId == constructorId ) + if (myCurrConstrId == constructorId) return; - - disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); - - switch ( constructorId ) { + + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + switch (constructorId) { case 0: GroupPoints2->hide(); GroupPoints->show(); - GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit1->setText(""); myEditCurrentArgument = GroupPoints->LineEdit1; - - if ( myCurrConstrId >= 0 ) { + + if (myCurrConstrId >= 0) { // i.e. it is not initialisation // copy tolerance from previous tolerance field - myTolEdt->setValue( myTolEdt2->value() ); + myTolEdt->setValue(myTolEdt2->value()); } break; case 1: GroupPoints->hide(); GroupPoints2->show(); - GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit1->setText(""); myEditCurrentArgument = GroupPoints2->LineEdit1; - - if ( myCurrConstrId >= 0 ) { + + if (myCurrConstrId >= 0) { // i.e. it is not initialisation // copy tolerance from previous tolerance field - myTolEdt2->setValue( myTolEdt->value() ); - mySubShapesChk->setChecked( false ); + myTolEdt2->setValue(myTolEdt->value()); + mySubShapesChk->setChecked(false); clearTemporary(); } break; } - + myCurrConstrId = constructorId; myEditCurrentArgument->setFocus(); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); qApp->processEvents(); updateGeometry(); - resize( minimumSizeHint() ); + resize(minimumSizeHint()); - displayPreview(); + processPreview(); updateButtonState(); activateSelection(); SelectionIntoArgument(); } - //================================================================================= // function : ClickOnOk() // purpose : Same than click on apply but close this dialog. //================================================================================= void RepairGUI_GlueDlg::ClickOnOk() { - if ( ClickOnApply() ) + setIsApplyAndClose(true); + if (ClickOnApply()) ClickOnCancel(); } - //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= bool RepairGUI_GlueDlg::ClickOnApply() { - if ( !onAcceptLocal() ) + if (!onAcceptLocal()) return false; initName(); @@ -267,9 +309,9 @@ bool RepairGUI_GlueDlg::ClickOnApply() //GroupPoints->LineEdit1->setText(""); //myObject = GEOM::GEOM_Object::_nil(); - //globalSelection( GEOM_COMPOUND ); + //globalSelection(GEOM_COMPOUND); - ConstructorsClicked( getConstructorId() ); + ConstructorsClicked(getConstructorId()); return true; } @@ -281,25 +323,24 @@ bool RepairGUI_GlueDlg::ClickOnApply() //================================================================================= void RepairGUI_GlueDlg::SelectionIntoArgument() { - if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) { + if (mySubShapesChk->isChecked() && getConstructorId() == 1) { updateButtonState(); return; } - + erasePreview(); - myEditCurrentArgument->setText( "" ); + myEditCurrentArgument->setText(""); myObject = GEOM::GEOM_Object::_nil(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - if ( aSelList.Extent() == 1 ) { + if (aSelList.Extent() == 1) { Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( aRes ) - myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + myObject = GEOMBase::ConvertIOinGEOMObject(anIO); + if (!CORBA::is_nil(myObject)) + myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); } updateButtonState(); } @@ -311,13 +352,12 @@ void RepairGUI_GlueDlg::SelectionIntoArgument() void RepairGUI_GlueDlg::SetEditCurrentArgument() { const QObject* send = sender(); - if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) { + if (send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1) { myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } } - //================================================================================= // function : LineEditReturnPressed() // purpose : @@ -325,17 +365,16 @@ void RepairGUI_GlueDlg::SetEditCurrentArgument() void RepairGUI_GlueDlg::LineEditReturnPressed() { const QObject* send = sender(); - if ( send == GroupPoints->LineEdit1 ) { + if (send == GroupPoints->LineEdit1) { myEditCurrentArgument = GroupPoints->LineEdit1; GEOMBase_Skeleton::LineEditReturnPressed(); } - else if ( send == GroupPoints2->LineEdit1 ) { + else if (send == GroupPoints2->LineEdit1) { myEditCurrentArgument = GroupPoints2->LineEdit1; GEOMBase_Skeleton::LineEditReturnPressed(); } } - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -343,99 +382,103 @@ void RepairGUI_GlueDlg::LineEditReturnPressed() void RepairGUI_GlueDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); //GroupPoints->LineEdit1->setText(""); //GroupPoints2->LineEdit1->setText(""); //myObject = GEOM::GEOM_Object::_nil(); - //myGeomGUI->SetState( 0 ); - //globalSelection( GEOM_COMPOUND ); + //myGeomGUI->SetState(0); + //globalSelection(GEOM_COMPOUND); activateSelection(); } - //================================================================================= // function : enterEvent() // purpose : Mouse enter onto the dialog to activate it //================================================================================= -void RepairGUI_GlueDlg::enterEvent( QEvent* ) +void RepairGUI_GlueDlg::enterEvent(QEvent*) { - if ( !mainFrame()->GroupConstructors->isEnabled() ) + if (!mainFrame()->GroupConstructors->isEnabled()) ActivateThisDialog(); } - //================================================================================= // function : createOperation // purpose : //================================================================================= GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation() { - return getGeomEngine()->GetIShapesOperations( getStudyId() ); + return getGeomEngine()->GetIShapesOperations(getStudyId()); } //================================================================================= // function : isValid // purpose : //================================================================================= -bool RepairGUI_GlueDlg::isValid( QString& msg ) +bool RepairGUI_GlueDlg::isValid(QString& msg) { bool ok = true; double v = 0; - switch ( getConstructorId() ) + switch (getConstructorId()) { case 0: v = myTolEdt->value(); - ok = myTolEdt->isValid( msg, !IsPreview() ); + ok = myTolEdt->isValid(msg, !IsPreview()); break; case 1: - v = myTolEdt2->value(); - ok = myTolEdt2->isValid( msg, !IsPreview() ); + v = myTolEdt2->value(); + ok = myTolEdt2->isValid(msg, !IsPreview()); break; } - return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok; + return !myObject->_is_nil() && (IsPreview() || v > 0.) && ok; } //================================================================================= // function : execute // purpose : //================================================================================= -bool RepairGUI_GlueDlg::execute( ObjectList& objects ) +bool RepairGUI_GlueDlg::execute(ObjectList& objects) { bool aResult = false; objects.clear(); - switch ( getConstructorId() ) { + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow - ( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value(), true ); + GEOM::GEOM_Object_var anObj; + if (myGlueMode == TopAbs_FACE) + anObj = anOper->MakeGlueFaces(myObject, myTolEdt->value(), true); + else if (myGlueMode == TopAbs_EDGE) + anObj = anOper->MakeGlueEdges(myObject, myTolEdt->value()); + aResult = !anObj->_is_nil(); - if ( aResult && !IsPreview() ) + if (aResult && !IsPreview()) { - QStringList aParameters; - aParameters << myTolEdt->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + QStringList aParameters; + aParameters << myTolEdt->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); - objects.push_back( anObj._retn() ); + objects.push_back(anObj._retn()); } break; } case 1: { - if ( IsPreview() ) { - // if this method is used for displaying preview then we must detect glue faces only - ObjectList::iterator anIter; - for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) - objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) ); - return myTmpObjs.size() ? true : false; + if (IsPreview()) { + // if this method is used for displaying preview then we must detect glue faces/edges only + for (int i = 0; i < myTmpObjs.count(); i++) { + myTmpObjs[i].get()->Register(); // increment counter, since calling function will call UnRegister() + objects.push_back(myTmpObjs[i].copy()); + } + return !myTmpObjs.isEmpty(); } // IsPreview - // Make glue face by list. + // Make glue faces/edges by list. // Iterate through myTmpObjs and verifies where each object is currently selected or not. - QMap selected; + QSet selected; // Get names of selected objects LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -443,38 +486,41 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) aSelMgr->selectedObjects(aSelList); SALOME_ListIteratorOfListIO it (aSelList); - for (; it.More(); it.Next()) - selected.insert(it.Value()->getName(), 0); + for (; it.More(); it.Next()) + selected.insert(it.Value()->getName()); // Iterate through result and select objects with names from selection // ObjectList toRemoveFromEnggine; - ObjectList toGlue; - ObjectList::iterator anIter; - for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) { - if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) ) - toGlue.push_back( *anIter ); - } - - // make glue faces + + // make glue faces/edges GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO(); - aListForGlue->length( toGlue.size() ); - ObjectList::iterator anIter3 = toGlue.begin(); - for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i ) - aListForGlue[ i ] = *anIter3; - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow - ( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true ); + aListForGlue->length(myTmpObjs.count()); + int added = 0; + for (int i = 0; i < myTmpObjs.count(); i++) { + CORBA::String_var tmpior = myGeomGUI->getApp()->orb()->object_to_string(myTmpObjs[i].get()); + if (selected.contains(tmpior.in())) + aListForGlue[ added++ ] = myTmpObjs[i].copy(); + } + aListForGlue->length(added); + + GEOM::GEOM_Object_var anObj; + if (myGlueMode == TopAbs_FACE) { + bool doGlueAllEdges = myGlueAllEdgesChk->isChecked(); + anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(), + true, doGlueAllEdges); + } + else if (myGlueMode == TopAbs_EDGE) + anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in()); aResult = !anObj->_is_nil(); - if ( aResult ) - { - if ( !IsPreview() ) - { - QStringList aParameters; - aParameters << myTolEdt2->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); - } - objects.push_back( anObj._retn() ); + if (aResult) { + if (!IsPreview()) { + QStringList aParameters; + aParameters << myTolEdt2->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + objects.push_back(anObj._retn()); } // Remove from engine useless objects @@ -493,48 +539,49 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) // function : restoreSubShapes // purpose : //================================================================================= -void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject ) +void RepairGUI_GlueDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) { - if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) { + if (mainFrame()->CheckBoxRestoreSS->isChecked()) { GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace; - if ( getConstructorId() == 0 ) // MakeGlueFaces + if (getConstructorId() == 0) // MakeGlueFaces or MakeGlueEdges aFindMethod = GEOM::FSM_GetInPlaceByHistory; // empty list of arguments means that all arguments should be restored - getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(), - aFindMethod, /*theInheritFirstArg=*/true ); + getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), + aFindMethod, /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); } } //================================================================ // Function : clearShapeBufferLocal -// Purpose : +// Purpose : //================================================================ -void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj ) +void RepairGUI_GlueDlg::clearShapeBufferLocal(GEOM::GEOM_Object_ptr theObj) { - if ( CORBA::is_nil( theObj ) ) + if (CORBA::is_nil(theObj)) return; - CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj ); - TCollection_AsciiString asciiIOR( (char *)( IOR.in() ) ); - myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string(theObj); + TCollection_AsciiString asciiIOR((char *)(IOR.in())); + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(asciiIOR); - if ( !getStudy() || !( getStudy()->studyDS() ) ) + if (!getStudy() || !(getStudy()->studyDS())) return; _PTR(Study) aStudy = getStudy()->studyDS(); - _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR.in() ) ) ); - if ( !aSObj ) + _PTR(SObject) aSObj (aStudy->FindObjectIOR(std::string(IOR.in()))); + if (!aSObj) return; - _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); - for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { + _PTR(ChildIterator) anIt (aStudy->NewChildIterator(aSObj)); + for (anIt->InitEx(true); anIt->More(); anIt->Next()) { _PTR(GenericAttribute) anAttr; - if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { - _PTR(AttributeIOR) anIOR ( anAttr ); - TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); - myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + if (anIt->Value()->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR (anAttr); + TCollection_AsciiString asciiIOR((char*)anIOR->Value().c_str()); + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(asciiIOR); } } } @@ -542,84 +589,83 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj ) //================================================================ // Function : onAccept // Purpose : This method should be called from dialog's slots onOk() and onApply() -// It perfroms user input validation, then it +// It perfroms user input validation, then it // performs a proper operation and manages transactions, etc. //================================================================ bool RepairGUI_GlueDlg::onAcceptLocal() { - if ( !getStudy() || !( getStudy()->studyDS() ) ) + if (!getStudy() || !(getStudy()->studyDS())) return false; _PTR(Study) aStudy = getStudy()->studyDS(); bool aLocked = aStudy->GetProperties()->IsLocked(); - if ( aLocked ) { + if (aLocked) { MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); - SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) ); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"), tr("BUT_OK")); return false; } QString msg; - if ( !isValid( msg ) ) { - showError( msg ); + if (!isValid(msg)) { + showError(msg); return false; } - erasePreview( false ); + erasePreview(false); try { - if ( openCommand() ) { + if (openCommand()) { SUIT_OverrideCursor wc; - - myGeomGUI->getApp()->putInfo( "" ); + + myGeomGUI->getApp()->putInfo(""); ObjectList objects; - - if ( !execute( objects ) ) { + + if (!execute(objects)) { wc.suspend(); abortCommand(); showError(); } else { const int nbObjs = objects.size(); - for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { + for (ObjectList::iterator it = objects.begin(); it != objects.end(); ++it) { QString aName = getNewObjectName(); - if ( nbObjs > 1 ) { - if ( aName.isEmpty() ) - aName = getPrefix( *it ); - aName = GEOMBase::GetDefaultName( aName ); + if (nbObjs > 1) { + if (aName.isEmpty()) + aName = getPrefix(*it); + aName = GEOMBase::GetDefaultName(aName); } else { // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() - if ( aName.isEmpty() ) - aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); + if (aName.isEmpty()) + aName = GEOMBase::GetDefaultName(getPrefix(*it)); } - addInStudy( *it, aName.toLatin1().data() ); - display( *it, false ); + addInStudy(*it, aName.toLatin1().data()); + display(*it, false); } - - if ( nbObjs ) { + + if (nbObjs) { commitCommand(); updateObjBrowser(); - myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") ); + myGeomGUI->getApp()->putInfo(QObject::tr("GEOM_PRP_DONE")); } else { abortCommand(); } // JFA 28.12.2004 BEGIN // To enable warnings - if ( !getOperation()->_is_nil() ) { - if ( !getOperation()->IsDone() ) { - wc.suspend(); - QString msgw = QObject::tr( getOperation()->GetErrorCode() ); - SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) ); - } + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); + if (!CORBA::is_nil(anOper) && !anOper->IsDone()) { + wc.suspend(); + QString msgw = QObject::tr(anOper->GetErrorCode()); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK")); } // JFA 28.12.2004 END } } } - catch( const SALOME::SALOME_Exception& e ) { - SalomeApp_Tools::QtCatchCorbaException( e ); + catch(const SALOME::SALOME_Exception& e) { + SalomeApp_Tools::QtCatchCorbaException(e); abortCommand(); } @@ -630,7 +676,6 @@ bool RepairGUI_GlueDlg::onAcceptLocal() return true; } - //================================================================================= // function : onDetect // purpose : @@ -639,32 +684,42 @@ void RepairGUI_GlueDlg::onDetect() { clearTemporary(); QString msg; - if ( !isValid( msg ) ) { - showError( msg ); + if (!isValid(msg)) { + showError(msg); return; } - buttonOk()->setEnabled( false ); - buttonApply()->setEnabled( false ); - globalSelection( GEOM_ALLSHAPES ); - - GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow - ( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() ); - - for ( int i = 0, n = aList->length(); i < n; i++ ) - myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); - - if ( myTmpObjs.size() > 0 ) { - msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() ); - mySubShapesChk->setChecked( true ); + buttonOk()->setEnabled(false); + buttonApply()->setEnabled(false); + globalSelection(GEOM_ALLSHAPES); + + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); + GEOM::ListOfGO_var aList; + if (myGlueMode == TopAbs_FACE) + aList = anOper->GetGlueFaces(myObject.in(), myTolEdt2->value()); + else if (myGlueMode == TopAbs_EDGE) + aList = anOper->GetGlueEdges(myObject.in(), myTolEdt2->value()); + + for (int i = 0, n = aList->length(); i < n; i++) + myTmpObjs << GEOM::GeomObjPtr(aList[i].in()); + + if (!myTmpObjs.isEmpty()) { + if (myGlueMode == TopAbs_FACE) + msg = tr("FACES_FOR_GLUING_ARE_DETECTED").arg(myTmpObjs.count()); + else if (myGlueMode == TopAbs_EDGE) + msg = tr("EDGES_FOR_GLUING_ARE_DETECTED").arg(myTmpObjs.count()); + mySubShapesChk->setChecked(true); } else { - msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" ); + if (myGlueMode == TopAbs_FACE) + msg = tr("THERE_ARE_NO_FACES_FOR_GLUING"); + else if (myGlueMode == TopAbs_EDGE) + msg = tr("THERE_ARE_NO_EDGES_FOR_GLUING"); } - - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ) ; - SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) ); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())) ; + SUIT_MessageBox::information(this, tr("GEOM_FREE_BOUNDS_TLT"), msg, tr("Close")); updateButtonState(); activateSelection(); } @@ -675,48 +730,48 @@ void RepairGUI_GlueDlg::onDetect() //================================================================================= void RepairGUI_GlueDlg::activateSelection() { - erasePreview( false ); - + erasePreview(false); + int anId = getConstructorId(); - if ( anId == 0 ) { + if (anId == 0) { // Case of whole gluing - disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); - - globalSelection( GEOM_ALLSHAPES ); - if ( myObject->_is_nil()) + disconnect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + globalSelection(GEOM_ALLSHAPES); + if (myObject->_is_nil()) SelectionIntoArgument(); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); - } + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + } else { // Second case of gluing - if ( !mySubShapesChk->isChecked() ) - globalSelection( GEOM_ALLSHAPES ); + if (!mySubShapesChk->isChecked()) + globalSelection(GEOM_ALLSHAPES); else { - displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED ); - disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ) ; - globalSelection( GEOM_PREVIEW ); - connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ) ; - } + displayPreview(true, true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED); + disconnect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())) ; + globalSelection(GEOM_PREVIEW); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())) ; + } } updateViewer(); } //================================================================================= // function : updateButtonState -// purpose : Update button state +// purpose : Update button state //================================================================================= void RepairGUI_GlueDlg::updateButtonState() { int anId = getConstructorId(); bool hasMainObj = !myObject->_is_nil(); - if ( anId == 0 ) { - buttonOk()->setEnabled( hasMainObj ); - buttonApply()->setEnabled( hasMainObj ); + if (anId == 0) { + buttonOk()->setEnabled(hasMainObj); + buttonApply()->setEnabled(hasMainObj); } else { @@ -724,17 +779,15 @@ void RepairGUI_GlueDlg::updateButtonState() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - bool wasSelected = false; SALOME_ListIteratorOfListIO it (aSelList); - if (it.More() > 0) - wasSelected = true; - bool wasDetected = myTmpObjs.size() ? true : false; - buttonOk()->setEnabled( hasMainObj && wasDetected && wasSelected ); - buttonApply()->setEnabled( hasMainObj && wasDetected && wasSelected ); - mySubShapesChk->setEnabled( hasMainObj && wasDetected ); - myDetectBtn->setEnabled( hasMainObj ); - if ( !hasMainObj || !wasDetected ) - mySubShapesChk->setChecked( false ); + bool wasSelected = it.More() > 0; + bool wasDetected = !myTmpObjs.isEmpty(); + buttonOk()->setEnabled(hasMainObj && wasDetected && wasSelected); + buttonApply()->setEnabled(hasMainObj && wasDetected && wasSelected); + mySubShapesChk->setEnabled(hasMainObj && wasDetected); + myDetectBtn->setEnabled(hasMainObj); + if (!hasMainObj || !wasDetected) + mySubShapesChk->setChecked(false); } } @@ -744,10 +797,6 @@ void RepairGUI_GlueDlg::updateButtonState() //================================================================================= void RepairGUI_GlueDlg::clearTemporary() { - ObjectList::iterator anIter; - for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) - getGeomEngine()->RemoveObject(*anIter); - myTmpObjs.clear(); } @@ -755,7 +804,7 @@ void RepairGUI_GlueDlg::clearTemporary() // function : onTolerChanged // purpose : Remove temporary objects from engine //================================================================================= -void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ ) +void RepairGUI_GlueDlg::onTolerChanged(double /*theVal*/) { clearTemporary(); activateSelection(); @@ -768,7 +817,7 @@ void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ ) //================================================================================= void RepairGUI_GlueDlg::onSubShapesChk() { - if ( !mySubShapesChk->isChecked() ) + if (!mySubShapesChk->isChecked()) clearTemporary(); activateSelection(); updateButtonState(); diff --git a/src/RepairGUI/RepairGUI_GlueDlg.h b/src/RepairGUI/RepairGUI_GlueDlg.h index 8d838ab85..99febef76 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.h +++ b/src/RepairGUI/RepairGUI_GlueDlg.h @@ -1,33 +1,38 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : RepairGUI_GlueDlg.h -// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// GEOM GEOMGUI : GUI for Geometry component +// File : RepairGUI_GlueDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + #ifndef REPAIRGUI_GLUEDLG_H #define REPAIRGUI_GLUEDLG_H #include +#include + +#include + class DlgRef_1SelExt; class SalomeApp_DoubleSpinBox; class QPushButton; @@ -42,47 +47,50 @@ class RepairGUI_GlueDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_GlueDlg( GeometryGUI*, QWidget* = 0, bool = false ); + RepairGUI_GlueDlg (GeometryGUI*, QWidget* = 0, bool = false, TopAbs_ShapeEnum theGlueMode = TopAbs_FACE); ~RepairGUI_GlueDlg(); protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); - virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr ); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr); private: void Init(); - void enterEvent( QEvent* ); + void enterEvent (QEvent*); void initSelection(); - + void clearTemporary(); - - bool onAcceptLocal(); - void clearShapeBufferLocal( GEOM::GEOM_Object_ptr ); + // Reimplementation of onAccept for local case of this class. - + bool onAcceptLocal(); + void clearShapeBufferLocal (GEOM::GEOM_Object_ptr); + void activateSelection(); void updateButtonState(); void selectTmpInViewer(); - -private: + +private: GEOM::GEOM_Object_var myObject; - ObjectList myTmpObjs; - + QList myTmpObjs; + DlgRef_1SelExt* GroupPoints; DlgRef_1SelExt* GroupPoints2; SalomeApp_DoubleSpinBox* myTolEdt; SalomeApp_DoubleSpinBox* myTolEdt2; QPushButton* myDetectBtn; QCheckBox* mySubShapesChk; - + QCheckBox* myGlueAllEdgesChk; + int myCurrConstrId; - + + TopAbs_ShapeEnum myGlueMode; + protected slots: virtual void ClickOnCancel(); - + private slots: void ClickOnOk(); bool ClickOnApply(); @@ -93,11 +101,10 @@ private slots: void SelectionIntoArgument(); void SetEditCurrentArgument(); - void ConstructorsClicked( int ); - //void ValueChangedInSpinBox(); - + void ConstructorsClicked (int); + void onDetect(); - void onTolerChanged( double ); + void onTolerChanged (double); void onSubShapesChk(); }; diff --git a/src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx b/src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx new file mode 100644 index 000000000..c275fc64c --- /dev/null +++ b/src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx @@ -0,0 +1,442 @@ +// Copyright (C) 2007-2012 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 +// +// File : RepairGUI_LimitToleranceDlg.cxx + +#include "RepairGUI_LimitToleranceDlg.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define DEFAULT_TOLERANCE_VALUE 1e-07 + +//================================================================================= +// class : RepairGUI_LimitToleranceDlg() +// purpose : Constructs a RepairGUI_LimitToleranceDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_LimitToleranceDlg::RepairGUI_LimitToleranceDlg(GeometryGUI* theGeometryGUI, + QWidget* parent, bool modal) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal) +{ + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_LIMIT_TOLERANCE"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_LIMIT_TOLERANCE_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_LIMIT_TOLERANCE_TITLE")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_1SelExt(centralWidget()); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints->PushButton1->setIcon(image1); + GroupPoints->LineEdit1->setReadOnly(true); + + QLabel* aTolLab = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints->Box); + myTolEdt = new SalomeApp_DoubleSpinBox(GroupPoints->Box); + initSpinBox(myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision"); + myTolEdt->setValue(DEFAULT_TOLERANCE_VALUE); + + QGridLayout* boxLayout = new QGridLayout(GroupPoints->Box); + boxLayout->setMargin(0); boxLayout->setSpacing(6); + boxLayout->addWidget(aTolLab, 0, 0); + boxLayout->addWidget(myTolEdt, 0, 2); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupPoints); + + setHelpFileName("limit_tolerance_operation_page.html"); + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_LimitToleranceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_LimitToleranceDlg::~RepairGUI_LimitToleranceDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + + //myGeomGUI->SetState(0); + //globalSelection(GEOM_COMPOUND); + + mainFrame()->GroupBoxPublish->show(); + //Hide preview checkbox + mainFrame()->CheckBoxPreview->hide(); + + /* signals and slots connections */ + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + initName(tr("LIMIT_TOLERANCE_NEW_OBJ_NAME")); + + ConstructorsClicked(0); + + activateSelection(); + updateButtonState(); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void RepairGUI_LimitToleranceDlg::ConstructorsClicked(int constructorId) +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + GroupPoints->show(); + GroupPoints->LineEdit1->setText(""); + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); + + updateButtonState(); + activateSelection(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_LimitToleranceDlg::ClickOnOk() +{ + setIsApplyAndClose( true ); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_LimitToleranceDlg::ClickOnApply() +{ + if (!onAcceptLocal()) + return false; + + initName(); + + ConstructorsClicked(0); + + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection +//================================================================================= +void RepairGUI_LimitToleranceDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + if (aSelList.Extent() == 1) { + Handle(SALOME_InteractiveObject) anIO = aSelList.First(); + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( !CORBA::is_nil( myObject ) ) + myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); + } + updateButtonState(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if (send == GroupPoints->PushButton1) { + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if (send == GroupPoints->LineEdit1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + activateSelection(); +} + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_LimitToleranceDlg::enterEvent(QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_LimitToleranceDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_LimitToleranceDlg::isValid(QString& msg) +{ + double v = myTolEdt->value(); + bool ok = myTolEdt->isValid(msg, true); + return !myObject->_is_nil() && (v > 0.) && ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_LimitToleranceDlg::execute(ObjectList& objects) +{ + bool aResult = false; + objects.clear(); + + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->LimitTolerance(myObject, myTolEdt->value()); + aResult = !anObj->_is_nil(); + if (aResult) { + QStringList aParameters; + aParameters << myTolEdt->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + objects.push_back(anObj._retn()); + } + + return aResult; +} + +//================================================================ +// Function : onAccept +// Purpose : This method should be called from dialog's slots onOk() and onApply() +// It perfroms user input validation, then it +// performs a proper operation and manages transactions, etc. +//================================================================ +bool RepairGUI_LimitToleranceDlg::onAcceptLocal() +{ + if (!getStudy() || !(getStudy()->studyDS())) + return false; + + _PTR(Study) aStudy = getStudy()->studyDS(); + + bool aLocked = aStudy->GetProperties()->IsLocked(); + if (aLocked) { + MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"), tr("BUT_OK")); + return false; + } + + QString msg; + if (!isValid(msg)) { + showError(msg); + return false; + } + + try { + if (openCommand()) { + SUIT_OverrideCursor wc; + + myGeomGUI->getApp()->putInfo(""); + ObjectList objects; + + if (!execute(objects)) { + wc.suspend(); + abortCommand(); + showError(); + } + else { + const int nbObjs = objects.size(); + for (ObjectList::iterator it = objects.begin(); it != objects.end(); ++it) { + QString aName = getNewObjectName(); + if (nbObjs > 1) { + if (aName.isEmpty()) + aName = getPrefix(*it); + aName = GEOMBase::GetDefaultName(aName); + } + else { + // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() + if (aName.isEmpty()) + aName = GEOMBase::GetDefaultName(getPrefix(*it)); + } + addInStudy(*it, aName.toLatin1().data()); + display(*it, false); + } + + if (nbObjs) { + commitCommand(); + updateObjBrowser(); + myGeomGUI->getApp()->putInfo(QObject::tr("GEOM_PRP_DONE")); + } + else { + abortCommand(); + } + + // JFA 28.12.2004 BEGIN // To enable warnings + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + if (!CORBA::is_nil(anOper) && !anOper->IsDone()) { + wc.suspend(); + QString msgw = QObject::tr(anOper->GetErrorCode()); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK")); + } + // JFA 28.12.2004 END + } + } + } + catch(const SALOME::SALOME_Exception& e) { + SalomeApp_Tools::QtCatchCorbaException(e); + abortCommand(); + } + + updateViewer(); + activateSelection(); + updateButtonState(); + + return true; +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection +//================================================================================= +void RepairGUI_LimitToleranceDlg::activateSelection() +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + globalSelection(GEOM_ALLSHAPES); + if (myObject->_is_nil()) + SelectionIntoArgument(); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + updateViewer(); +} + +//================================================================================= +// function : updateButtonState +// purpose : Update button state +//================================================================================= +void RepairGUI_LimitToleranceDlg::updateButtonState() +{ + bool hasMainObj = !myObject->_is_nil(); + buttonOk()->setEnabled(hasMainObj); + buttonApply()->setEnabled(hasMainObj); +} + +//================================================================================= +// function : restoreSubShapes +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) +{ + if (mainFrame()->CheckBoxRestoreSS->isChecked()) { + // empty list of arguments means that all arguments should be restored + getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), + GEOM::FSM_GetInPlace, /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); + } +} diff --git a/src/RepairGUI/RepairGUI_LimitToleranceDlg.h b/src/RepairGUI/RepairGUI_LimitToleranceDlg.h new file mode 100644 index 000000000..7d5d8d549 --- /dev/null +++ b/src/RepairGUI/RepairGUI_LimitToleranceDlg.h @@ -0,0 +1,82 @@ +// Copyright (C) 2007-2012 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 +// +// File : RepairGUI_LimitToleranceDlg.h + +#ifndef REPAIRGUI_LIMITTOLERANCEDLG_H +#define REPAIRGUI_LIMITTOLERANCEDLG_H + +#include + +class DlgRef_1SelExt; +class SalomeApp_DoubleSpinBox; +class QPushButton; +class QCheckBox; + +//================================================================================= +// class : RepairGUI_LimitToleranceDlg +// purpose : +//================================================================================= +class RepairGUI_LimitToleranceDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_LimitToleranceDlg (GeometryGUI*, QWidget* = 0, bool = false); + ~RepairGUI_LimitToleranceDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr); + +private: + void Init(); + void enterEvent (QEvent*); + void initSelection(); + + bool onAcceptLocal(); + + void activateSelection(); + void updateButtonState(); + +private: + GEOM::GEOM_Object_var myObject; + + DlgRef_1SelExt* GroupPoints; + SalomeApp_DoubleSpinBox* myTolEdt; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + + void ActivateThisDialog(); + + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + + void ConstructorsClicked( int ); +}; + +#endif // REPAIRGUI_LIMITTOLERANCEDLG_H diff --git a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx index 850926fe6..3861e384a 100644 --- a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx @@ -1,24 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM RepairGUI : GUI for Geometry component // File : RepairGUI_RemoveExtraEdgesDlg.cxx // Author : Michael Zorin, Open CASCADE S.A.S. @@ -46,7 +44,7 @@ // TRUE to construct a modal dialog. //================================================================================= RepairGUI_RemoveExtraEdgesDlg::RepairGUI_RemoveExtraEdgesDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal ) + bool modal ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal ) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); @@ -63,12 +61,15 @@ RepairGUI_RemoveExtraEdgesDlg::RepairGUI_RemoveExtraEdgesDlg( GeometryGUI* theGe mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_1Sel( centralWidget() ); + GroupPoints = new DlgRef_1Sel1Check( centralWidget() ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_REMOVE_EXTRA_EDGES" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) ); GroupPoints->PushButton1->setIcon( image1 ); GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->CheckButton1->setText( tr( "GEOM_RMEE_UNION_FACES" ) ); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->addWidget( GroupPoints ); @@ -101,9 +102,13 @@ void RepairGUI_RemoveExtraEdgesDlg::Init() myOkObject = false; + GroupPoints->CheckButton1->setChecked( false ); + activateSelection(); mainFrame()->GroupBoxPublish->show(); + //Hide preview checkbox + mainFrame()->CheckBoxPreview->hide(); /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); @@ -113,9 +118,11 @@ void RepairGUI_RemoveExtraEdgesDlg::Init() connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); initName( tr( "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" ) ); + resize(100,100); + SelectionIntoArgument(); } @@ -125,6 +132,7 @@ void RepairGUI_RemoveExtraEdgesDlg::Init() //================================================================================= void RepairGUI_RemoveExtraEdgesDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -174,11 +182,10 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( aSelList.First(), testResult ); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if ( !testResult ) + if ( CORBA::is_nil( aSelectedObject ) ) return; if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { @@ -224,7 +231,7 @@ void RepairGUI_RemoveExtraEdgesDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); activateSelection(); } @@ -248,6 +255,7 @@ void RepairGUI_RemoveExtraEdgesDlg::enterEvent(QEvent* e) void RepairGUI_RemoveExtraEdgesDlg::activateSelection() { TColStd_MapOfInteger aTypes; + aTypes.Add( GEOM_SHELL ); aTypes.Add( GEOM_SOLID ); aTypes.Add( GEOM_COMPOUND ); globalSelection( aTypes ); @@ -278,11 +286,15 @@ bool RepairGUI_RemoveExtraEdgesDlg::isValid( QString& msg ) bool RepairGUI_RemoveExtraEdgesDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj; - - anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->RemoveExtraEdges( myObject ); - - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); + + int nbFacesOptimum = -1; // -1 means do not union faces + if (GroupPoints->CheckButton1->isChecked()) + nbFacesOptimum = 0; // 0 means union all faces, that possible + GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation()); + anObj = anOper->RemoveExtraEdges(myObject, nbFacesOptimum); + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); return true; } @@ -297,7 +309,8 @@ void RepairGUI_RemoveExtraEdgesDlg::restoreSubShapes( SALOMEDS::Study_ptr theS if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) { // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(), - /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GetInPlaceByHistory - /*theInheritFirstArg=*/true ); + /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GetInPlaceByHistory + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked() ); } } diff --git a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.h b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.h index ffc49ce26..3e8d7ba81 100644 --- a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.h +++ b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.h @@ -1,25 +1,23 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 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. // -// 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 // -// 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 // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// GEOM GEOMGUI : GUI for Geometry component + +// GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_RemoveExtraEdgesDlg.h // Author : Michael ZORIN, Open CASCADE S.A.S. // @@ -28,7 +26,7 @@ #include -class DlgRef_1Sel; +class DlgRef_1Sel1Check; //================================================================================= // class : RepairGUI_RemoveExtraEdgesDlg @@ -58,7 +56,7 @@ private: GEOM::GEOM_Object_var myObject; bool myOkObject; - DlgRef_1Sel* GroupPoints; + DlgRef_1Sel1Check* GroupPoints; private slots: void ClickOnOk(); diff --git a/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx index 3ef74ca4a..2fc819511 100644 --- a/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_RemoveHolesDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -134,6 +135,7 @@ void RepairGUI_RemoveHolesDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= @@ -142,6 +144,7 @@ void RepairGUI_RemoveHolesDlg::Init() //================================================================================= void RepairGUI_RemoveHolesDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -184,9 +187,8 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument() Handle(SALOME_InteractiveObject) anIO = aSelList.First(); if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if (aRes && GEOMBase::IsShape(myObject)) { + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( GEOMBase::IsShape(myObject) ) { myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); // clear selection @@ -272,7 +274,7 @@ void RepairGUI_RemoveHolesDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText( "" ); @@ -328,8 +330,8 @@ bool RepairGUI_RemoveHolesDlg::execute (ObjectList& objects) // highlight them (add to objects), display message dialog GEOM::ListOfGO_var aClosed, anOpen; - aResult = GEOM::GEOM_IHealingOperations::_narrow(getOperation())-> - GetFreeBoundary(myObject, aClosed, anOpen); + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + aResult = anOper->GetFreeBoundary(myObject, aClosed, anOpen); if (aResult) { myClosed = aClosed->length(); @@ -344,8 +346,8 @@ bool RepairGUI_RemoveHolesDlg::execute (ObjectList& objects) myClosed = -1; } else { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())-> - FillHoles(myObject, myWiresInd); + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->FillHoles(myObject, myWiresInd); aResult = !anObj->_is_nil(); if (aResult) objects.push_back(anObj._retn()); @@ -402,7 +404,7 @@ void RepairGUI_RemoveHolesDlg::initSelection() //================================================================================= void RepairGUI_RemoveHolesDlg::onDetect() { - displayPreview(false, true, true, 3); + displayPreview(true, false, true, true, 3); // field myClosed,myOpen is initialized in execute() method, called by displayPreview(). QString msg; diff --git a/src/RepairGUI/RepairGUI_RemoveHolesDlg.h b/src/RepairGUI/RepairGUI_RemoveHolesDlg.h index efe07f6a1..834ebf531 100644 --- a/src/RepairGUI/RepairGUI_RemoveHolesDlg.h +++ b/src/RepairGUI/RepairGUI_RemoveHolesDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_RemoveHolesDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx index 8079b166d..44ffc7e1f 100644 --- a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_RemoveIntWiresDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -122,6 +123,7 @@ void RepairGUI_RemoveIntWiresDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= @@ -130,6 +132,7 @@ void RepairGUI_RemoveIntWiresDlg::Init() //================================================================================= void RepairGUI_RemoveIntWiresDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -171,9 +174,8 @@ void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument() Handle(SALOME_InteractiveObject) anIO = aSelList.First(); if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if (aRes && GEOMBase::IsShape(myObject)) { + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( GEOMBase::IsShape(myObject) ) { myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); // clear selection @@ -259,7 +261,7 @@ void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText( "" ); @@ -305,8 +307,8 @@ bool RepairGUI_RemoveIntWiresDlg::isValid (QString&) //================================================================================= bool RepairGUI_RemoveIntWiresDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())-> - RemoveIntWires(myObject, myWiresInd); + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->RemoveIntWires(myObject, myWiresInd); bool aResult = !anObj->_is_nil(); if (aResult) diff --git a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h index 838a6ecde..2eab1b48d 100644 --- a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h +++ b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_RemoveIntWiresDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx index a5d6465d9..15648d3e1 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_SewingDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -28,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -51,7 +52,7 @@ // TRUE to construct a modal dialog. //================================================================================= RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal ) + bool modal ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SEWING" ) ) ); @@ -75,11 +76,12 @@ RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget* QGridLayout* aLay = new QGridLayout( GroupPoints->Box ); aLay->setMargin( 0 ); aLay->setSpacing( 6 ); - myTolEdt = new SalomeApp_DoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 10, GroupPoints->Box ); + myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box ); + initSpinBox( myTolEdt, 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, "len_tol_precision" ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box ); myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ), - GroupPoints->Box ); + GroupPoints->Box ); aLay->addWidget( aLbl1, 0, 0 ); aLay->addWidget( myTolEdt, 0, 1 ); aLay->addWidget( myFreeBoundBtn, 1, 0, 1, 2 ); @@ -120,7 +122,7 @@ void RepairGUI_SewingDlg::Init() myClosed = -1; myOpen = -1; - + /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); @@ -129,11 +131,13 @@ void RepairGUI_SewingDlg::Init() connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) ); initName( tr( "SEWING_NEW_OBJ_NAME" ) ); + resize(100,100); + SelectionIntoArgument(); } @@ -143,6 +147,7 @@ void RepairGUI_SewingDlg::Init() //================================================================================= void RepairGUI_SewingDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -154,7 +159,7 @@ void RepairGUI_SewingDlg::ClickOnOk() bool RepairGUI_SewingDlg::ClickOnApply() { if ( !onAccept() ) - return false; + return false; initName(); @@ -183,9 +188,8 @@ void RepairGUI_SewingDlg::SelectionIntoArgument() if ( aSelList.Extent() == 1 ) { Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( aRes ) + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( !CORBA::is_nil( myObject ) ) myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); } } @@ -226,7 +230,7 @@ void RepairGUI_SewingDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); GroupPoints->LineEdit1->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); @@ -277,33 +281,35 @@ bool RepairGUI_SewingDlg::isValid( QString& msg ) bool RepairGUI_SewingDlg::execute( ObjectList& objects ) { bool aResult = false; + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() ); + if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog GEOM::ListOfGO_var aClosed, anOpen; - aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen ); + aResult = anOper->GetFreeBoundary( myObject, aClosed, anOpen ); if ( aResult ) { myClosed = aClosed->length(); myOpen = anOpen->length(); int i; for ( i = 0; i < myClosed; i++ ) - objects.push_back( aClosed[i]._retn() ); + objects.push_back( aClosed[i]._retn() ); for ( i = 0; i < myOpen; i++ ) - objects.push_back( anOpen[i]._retn() ); + objects.push_back( anOpen[i]._retn() ); } else myClosed = -1; } else { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() ); + GEOM::GEOM_Object_var anObj = anOper->Sew( myObject, myTolEdt->value() ); aResult = !anObj->_is_nil(); if ( aResult ) { if ( !IsPreview() ) { - QStringList aParameters; - aParameters << myTolEdt->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + QStringList aParameters; + aParameters << myTolEdt->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } objects.push_back( anObj._retn() ); } @@ -331,7 +337,7 @@ void RepairGUI_SewingDlg::initSelection() //================================================================================= void RepairGUI_SewingDlg::onDetect() { - displayPreview( false, true, true, 3 ); + displayPreview( true, false, true, true, 3 ); // field myClosed,myOpen is initialized in execute() method, called by displayPreview(). QString msg; diff --git a/src/RepairGUI/RepairGUI_SewingDlg.h b/src/RepairGUI/RepairGUI_SewingDlg.h index 3bd6dfb7e..fa8158057 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.h +++ b/src/RepairGUI/RepairGUI_SewingDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_SewingDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx index 1c4761341..81321e9e0 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx @@ -1,35 +1,35 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_ShapeProcessDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "RepairGUI_ShapeProcessDlg.h" #include #include #include #include -#include #include #include @@ -41,6 +41,8 @@ #include #include +#include + #include #include @@ -55,7 +57,7 @@ // TRUE to construct a modal dialog. //================================================================================= RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal ) + bool modal ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal ) { setHelpFileName( "shape_processing_operation_page.html" ); @@ -80,7 +82,7 @@ void RepairGUI_ShapeProcessDlg::init() initParamsValues(); initSelection(); - + setWindowTitle( tr( "GEOM_SHAPEPROCESS_TITLE" ) ); mainFrame()->GroupConstructors->hide(); @@ -126,8 +128,10 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myFixShapeTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); - myFixShapeMaxTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myFixShapeTol3D = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( myFixShapeTol3D, 0., 100., 1e-7, "len_tol_precision" ); + myFixShapeMaxTol3D = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( myFixShapeMaxTol3D, 0., 100., 1e-7, "len_tol_precision" ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( myFixShapeTol3D, 0, 1 ); @@ -141,7 +145,8 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myFixFaceSizeTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myFixFaceSizeTol = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( myFixFaceSizeTol, 0., 100., 1e-7, "len_tol_precision" ); aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( myFixFaceSizeTol, 0, 1 ); @@ -153,7 +158,8 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myDropSmallEdgesTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myDropSmallEdgesTol3D = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( myDropSmallEdgesTol3D, 0., 100., 1e-7, "len_tol_precision" ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 ); @@ -165,8 +171,10 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySplitAngleAngle = new SalomeApp_DoubleSpinBox( 0, 360, 1, 10, 10, w ); - mySplitAngleMaxTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + mySplitAngleAngle = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( mySplitAngleAngle, 0, 360, 1, "angle_precision" ); + mySplitAngleMaxTol = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( mySplitAngleMaxTol, 0., 100., 1e-7, "ang_tol_precision" ); aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 ); aLay->addWidget( mySplitAngleAngle, 0, 1 ); @@ -192,7 +200,8 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySplitContTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + mySplitContTol3D = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( mySplitContTol3D, 0., 100., 1e-7, "len_tol_precision" ); mySplitContSurfCont = new QComboBox( w ); mySplitContSurfCont->addItems( aContinueties ); mySplitContCurvCont = new QComboBox( w ); @@ -216,9 +225,11 @@ void RepairGUI_ShapeProcessDlg::init() myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w ); myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w ); - myBSplineTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myBSplineTol3D = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( myBSplineTol3D, 0., 100., 1e-7, "len_tol_precision" ); - myBSplineTol2D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myBSplineTol2D = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( myBSplineTol2D, 0., 100., 1e-7, "param_tol_precision" ); myBSplineDegree = new SalomeApp_IntSpinBox( w ); myBSplineSegments = new SalomeApp_IntSpinBox( w ); @@ -258,7 +269,8 @@ void RepairGUI_ShapeProcessDlg::init() myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w ); myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w ); - myToBezierMaxTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myToBezierMaxTol = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( myToBezierMaxTol, 0., 100., 1e-7, "len_tol_precision" ); aLay->addWidget( myToBezierSurfModeChk, 0, 0 ); aLay->addWidget( myToBezier3DCurveChk, 1, 0 ); @@ -273,7 +285,8 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySameParameterTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + mySameParameterTol3D = new SalomeApp_DoubleSpinBox( w ); + initSpinBox( mySameParameterTol3D, 0., 100., 1e-7, "len_tol_precision" ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( mySameParameterTol3D, 0, 1 ); @@ -296,7 +309,7 @@ void RepairGUI_ShapeProcessDlg::init() connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( onApply() ) ); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) ); connect( mySelectWdgt->PushButton1, SIGNAL( clicked() ), this, SLOT( selectClicked() ) ); connect( mySelectWdgt->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( lineEditReturnPressed() ) ); @@ -311,6 +324,7 @@ void RepairGUI_ShapeProcessDlg::init() reset(); initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ) ); + selectionChanged(); } //================================================================================= @@ -319,6 +333,7 @@ void RepairGUI_ShapeProcessDlg::init() //================================================================================= void RepairGUI_ShapeProcessDlg::onOk() { + setIsApplyAndClose( true ); if ( onApply() ) ClickOnCancel(); } @@ -349,18 +364,17 @@ bool RepairGUI_ShapeProcessDlg::onApply() void RepairGUI_ShapeProcessDlg::selectionChanged() { reset(); - + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - Standard_Boolean aRes = Standard_False; int i = 0; myObjects->length(aSelList.Extent()); for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) { - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - myObjects[i++] = aSelectedObject; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() ); + if ( !CORBA::is_nil( aSelectedObject ) ) + myObjects[i++] = aSelectedObject; } myObjects->length( i ); if ( i == 1 ) @@ -400,8 +414,8 @@ void RepairGUI_ShapeProcessDlg::activate() { GEOMBase_Skeleton::ActivateThisDialog(); connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication( ) ))->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) ); - + SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) ); + reset(); //myGeomGUI->SetState( 0 ); initSelection(); @@ -426,7 +440,7 @@ void RepairGUI_ShapeProcessDlg::enterEvent( QEvent* ) void RepairGUI_ShapeProcessDlg::reset() { myObjects = new GEOM::ListOfGO(); - myObjects->length( 0 ); + myObjects->length( 0 ); mySelectWdgt->LineEdit1->setText( "" ); } @@ -438,7 +452,7 @@ void RepairGUI_ShapeProcessDlg::reset() const char* get_convert( const char* theParam, const QString& theValue ) { if ( !strcmp( theParam, "SplitAngle.Angle" ) ) { - double doubleValue = theValue.toDouble() * PI / 180; + double doubleValue = theValue.toDouble() * M_PI / 180.; return CORBA::string_dup( QString::number( doubleValue ).toLatin1().constData() ); } return CORBA::string_dup( theValue.toLatin1().constData() ); @@ -448,14 +462,14 @@ const char* get_convert( const char* theParam, const QString& theValue ) // function : set_convert // purpose : conversion of angle values to degrees (non-angle values are not converted) //================================================================================= -const char* set_convert( const char* theParam, const char* theValue ) +QString set_convert( const char* theParam, const char* theValue ) { if ( !strcmp( theParam, "SplitAngle.Angle" ) ) { - double doubleValue = atof( theValue ) * 180 / PI; - TCollection_AsciiString str( doubleValue ); - return CORBA::string_dup( str.ToCString() ); + Kernel_Utils::Localizer loc; + double doubleValue = atof( theValue ) * 180. / M_PI; + return QString::number( doubleValue ); } - return CORBA::string_dup( theValue ); + return QString( theValue ); } //================================================================================= @@ -487,8 +501,7 @@ void RepairGUI_ShapeProcessDlg::loadDefaults() for ( int j = 0; j < aParams->length(); j++ ) { QWidget* aCtrl = getControl( (const char*)aParams[j] ); - const char* aValue = set_convert( (const char*)aParams[j], aValues[j] ); - setValue( aCtrl, aValue ); + setValue( aCtrl, set_convert( (const char*)aParams[j], aValues[j] ) ); } } } @@ -570,9 +583,9 @@ bool RepairGUI_ShapeProcessDlg::isValid( QString& msg ) const QString& aParam = aListIter.next(); QWidget* aControl = getControl( aParam ); if ( qobject_cast( aControl ) ) - ok = qobject_cast( aControl )->isValid( msg, !IsPreview() ) && ok; + ok = qobject_cast( aControl )->isValid( msg, !IsPreview() ) && ok; else if ( qobject_cast( aControl ) ) - ok = qobject_cast( aControl )->isValid( msg, !IsPreview() ) && ok; + ok = qobject_cast( aControl )->isValid( msg, !IsPreview() ) && ok; } } @@ -603,42 +616,42 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects ) /*//-- check -- int z; - MESSAGE("Objects : "); - for ( z = 0; z < myObjects->length(); z++ ) - MESSAGE(myObjects[z]->GetName() << " "); - MESSAGE("\nOperators : "); - for ( z = 0; z < anOperators->length(); z++ ) - MESSAGE(anOperators[z] << " "); - MESSAGE("\nParameters : "); - for ( z = 0; z < aParams->length(); z++ ) - MESSAGE(aParams[z] << " "); - MESSAGE("\nValues : "); - for ( z = 0; z < aValues->length(); z ++ ) - MESSAGE(aValues[z] << " "); - MESSAGE("\n"); + MESSAGE("Objects : "); + for ( z = 0; z < myObjects->length(); z++ ) + MESSAGE(myObjects[z]->GetName() << " "); + MESSAGE("\nOperators : "); + for ( z = 0; z < anOperators->length(); z++ ) + MESSAGE(anOperators[z] << " "); + MESSAGE("\nParameters : "); + for ( z = 0; z < aParams->length(); z++ ) + MESSAGE(aParams[z] << " "); + MESSAGE("\nValues : "); + for ( z = 0; z < aValues->length(); z ++ ) + MESSAGE(aValues[z] << " "); + MESSAGE("\n"); */// ----------- QStringList anErrorObjNames; for ( int i = 0; i < myObjects->length(); i++ ) { GEOM::GEOM_Object_var obj = myObjects[i]; - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )-> - ProcessShape( obj, anOperators, aParams, aValues ); + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->ProcessShape( obj, anOperators, aParams, aValues ); if ( anObj->_is_nil() ) anErrorObjNames << GEOMBase::GetName( obj ); else { if ( !IsPreview() ) { - QStringList aParameters; + QStringList aParameters; - for ( int i = 0; i < anOperators->length(); i++ ) - aParameters << QString( anOperators[i] ); + for ( int i = 0; i < anOperators->length(); i++ ) + aParameters << QString( anOperators[i] ); - for ( int i = 0; i < aParams->length(); i++ ) - aParameters << QString( aParams[i] ); + for ( int i = 0; i < aParams->length(); i++ ) + aParameters << QString( aParams[i] ); - aParameters << getTexts( aParams ); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + aParameters << getTexts( aParams ); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } objects.push_back( anObj._retn() ); } @@ -668,7 +681,7 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators() for ( int i = 0; i < aCheckedList.count(); i++ ) anOperators[i] = CORBA::string_dup( aCheckedList[i].toLatin1().constData() ); - + return anOperators._retn(); } @@ -816,7 +829,7 @@ QStringList RepairGUI_ShapeProcessDlg::getTexts( const GEOM::string_array& thePa { QString aText = getText( aCtrl ); if( !aText.isNull() ) - aTexts.append( aText ); + aTexts.append( aText ); } } @@ -849,7 +862,7 @@ void RepairGUI_ShapeProcessDlg::advOptionToggled( bool on ) QAbstractButton* btn = (QAbstractButton*)sender(); if ( on && btn->isCheckable() && SUIT_MessageBox::warning( this, - tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ), - SUIT_MessageBox::Yes | SUIT_MessageBox::No ) == SUIT_MessageBox::No ) + tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ), + SUIT_MessageBox::Yes | SUIT_MessageBox::No ) == SUIT_MessageBox::No ) btn->toggle(); } diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.h b/src/RepairGUI/RepairGUI_ShapeProcessDlg.h index e5fd0e902..4ca7e9a8d 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.h +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : RepairGUI_ShapeProcessDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index 7daaab8e1..5af3c37d6 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -1,46 +1,49 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : RepairGUI_SuppressFacesDlg.cxx -// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : RepairGUI_SuppressFacesDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + #include "RepairGUI_SuppressFacesDlg.h" #include #include #include +#include +#include #include +#include #include -#include -#include #include -#include - +// OCCT Includes #include +#include +#include +#include +#include #include -#include +#include //================================================================================= // class : RepairGUI_SuppressFacesDlg() @@ -49,40 +52,43 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal ) - : GEOMBase_Skeleton( theGeometryGUI, parent, modal ) +RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg (GeometryGUI* theGeometryGUI, QWidget* parent, + bool modal) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal) { - QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SUPRESS_FACE" ) ) ); - QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); - - setWindowTitle( tr("GEOM_SUPRESSFACE_TITLE" ) ); + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SUPRESS_FACE"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_SUPRESSFACE_TITLE")); /***************************************************************/ mainFrame()->GroupConstructors->setTitle(tr("GEOM_SUPRESSFACE")); - mainFrame()->RadioButton1->setIcon( image0 ); - mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton2->close(); - mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_1Sel( centralWidget() ); - GroupPoints->GroupBox1->setTitle( tr( "Faces to remove" ) ); - GroupPoints->TextLabel1->setText( tr( "Faces" ) ); - GroupPoints->PushButton1->setIcon( image1 ); - GroupPoints->LineEdit1->setReadOnly( true ); + GroupArgs = new DlgRef_2Sel(centralWidget()); + GroupArgs->GroupBox1->setTitle(tr("Faces to remove")); + GroupArgs->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupArgs->PushButton1->setIcon(image1); + GroupArgs->LineEdit1->setReadOnly(true); + + GroupArgs->TextLabel2->setText(tr("Faces to remove")); + GroupArgs->PushButton2->setIcon(image1); + GroupArgs->LineEdit2->setReadOnly(true); - QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); - layout->setMargin( 0 ); layout->setSpacing( 6 ); - layout->addWidget( GroupPoints ); + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupArgs); /***************************************************************/ - - setHelpFileName( "suppress_faces_operation_page.html" ); + + setHelpFileName("suppress_faces_operation_page.html"); Init(); } - //================================================================================= // function : ~RepairGUI_SuppressFacesDlg() // purpose : Destroys the object and frees any allocated resources @@ -91,35 +97,39 @@ RepairGUI_SuppressFacesDlg::~RepairGUI_SuppressFacesDlg() { } - //================================================================================= // function : Init() // purpose : //================================================================================= void RepairGUI_SuppressFacesDlg::Init() { - /* init variables */ - myEditCurrentArgument = GroupPoints->LineEdit1; + // init variables + GroupArgs->LineEdit1->clear(); + GroupArgs->LineEdit2->clear(); + myObject = GEOM::GEOM_Object::_nil(); + myFacesInd = new GEOM::short_array(); + myFacesInd->length(0); - myObjects = new GEOM::ListOfGO(); - myObjects->length( 0 ); + mainFrame()->GroupBoxPublish->show(); + //Hide preview checkbox + mainFrame()->CheckBoxPreview->hide(); - //myGeomGUI->SetState( 0 ); - initSelection(); - - /* signals and slots connections */ - connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + // signals and slots connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect(GroupArgs->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupArgs->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect(GroupArgs->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupArgs->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) ); -} + initName(tr("SUPRESS_FACE_NEW_OBJ_NAME")); + GroupArgs->PushButton1->click(); + SelectionIntoArgument(); + resize(100,100); +} //================================================================================= // function : ClickOnOk() @@ -127,7 +137,8 @@ void RepairGUI_SuppressFacesDlg::Init() //================================================================================= void RepairGUI_SuppressFacesDlg::ClickOnOk() { - if ( ClickOnApply() ) + setIsApplyAndClose( true ); + if (ClickOnApply()) ClickOnCancel(); } @@ -137,78 +148,123 @@ void RepairGUI_SuppressFacesDlg::ClickOnOk() //================================================================================= bool RepairGUI_SuppressFacesDlg::ClickOnApply() { - if ( !onAccept() ) + if (!onAccept()) return false; initName(); - - myEditCurrentArgument->setText( "" ); - myObjects->length( 0 ); - myFaces.clear(); - - initSelection(); - + // activate first line edit + GroupArgs->PushButton1->click(); return true; } - //================================================================================= // function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 (LineEditC1A1) +// purpose : Called when selection is changed or on dialog initialization or activation //================================================================================= void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText( "" ); + myEditCurrentArgument->setText(""); + // the second argument depends on the first one + GroupArgs->LineEdit2->setText(""); + myFacesInd->length(0); - Standard_Boolean aRes = Standard_False; - int i = 0; - int numFaces = 0; + if (myEditCurrentArgument == GroupArgs->LineEdit1) + myObject = GEOM::GEOM_Object::_nil(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - myObjects->length( aSelList.Extent() ); - myFaces.clear(); - - for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) { - Handle(SALOME_InteractiveObject) anIO = anIt.Value(); - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) { - if ( aShape.ShapeType() <= TopAbs_FACE ) { // FACE, SHELL, SOLID, COMPOUND - GEOM::short_array anIndexes; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( anIO, aMap ); - - if ( !aMap.IsEmpty() ) { - Convert( aMap, anIndexes ); - myObjects[i++] = aSelectedObject; // append the object - myFaces.append( anIndexes ); // append faces' indexes - numFaces += anIndexes.length();// just for text field output - } - } + if (myEditCurrentArgument == GroupArgs->LineEdit1) { + if (aSelList.Extent() == 1) { + Handle(SALOME_InteractiveObject) anIO = aSelList.First(); + + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( GEOMBase::IsShape(myObject) ) { + myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); + TopoDS_Shape aShape; + if (GEOMBase::GetShape(myObject, aShape, TopAbs_FACE)) + GroupArgs->LineEdit2->setText(myEditCurrentArgument->text()); + + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + GroupArgs->PushButton2->click(); } + else + myObject = GEOM::GEOM_Object::_nil(); } } - myObjects->length( i ); // this is the right length, smaller of equal to the previously set - if ( numFaces ) - myEditCurrentArgument->setText( QString::number( numFaces ) + "_" + tr( "GEOM_FACE" ) + tr( "_S_" ) ); -} + else if (myEditCurrentArgument == GroupArgs->LineEdit2) { + TColStd_IndexedMapOfInteger aMap; -//================================================================================= -// function : Convert() -// purpose : -//================================================================================= -void RepairGUI_SuppressFacesDlg::Convert( const TColStd_IndexedMapOfInteger& theMap, GEOM::short_array& theOutSeq ) -{ - const int n = theMap.Extent(); - theOutSeq.length( n ); - for ( int i = 0; i < n; i++ ) - theOutSeq[i] = theMap( i+1 ); + if (aSelList.Extent() == 1) { + Handle(SALOME_InteractiveObject) anIO = aSelList.First(); + aSelMgr->GetIndexes(anIO, aMap); + } + + if (aMap.IsEmpty() && aSelList.Extent() > 0) { // try to detect selected published sub-shape + TColStd_MapOfInteger anIds; + + SalomeApp_Study* appStudy = dynamic_cast(myGeomGUI->getApp()->activeStudy()); + if (!appStudy) return; + _PTR(Study) aStudy = appStudy->studyDS(); + + TopTools_IndexedMapOfShape aMainMap; + TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myObject); + TopExp::MapShapes(aMainShape, aMainMap); + + SALOME_ListIteratorOfListIO anIter (aSelList); + for (int i = 0; anIter.More(); anIter.Next(), i++) { + Handle(SALOME_InteractiveObject) anIO = anIter.Value(); + QString anEntry = anIO->getEntry(); + + _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData())); + GEOM::GEOM_Object_var aGeomObj = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); + TopoDS_Shape aShape; + if (GEOMBase::GetShape(aGeomObj, aShape)) { + if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == TopAbs_FACE) { + TopExp_Explorer anExp (aShape, TopAbs_FACE); + for (; anExp.More(); anExp.Next()) { + TopoDS_Shape aSubShape = anExp.Current(); + int anIndex = aMainMap.FindIndex(aSubShape); + if (anIndex >= 0) { + aMap.Add(anIndex); + anIds.Add(anIndex); + } + } + } + } + } + if (!aMap.IsEmpty()) { + // highlight local faces, correspondent to OB selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + aSelMgr->clearSelected(); + + QString objIOR = GEOMBase::GetIORFromObject(myObject); + Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape( objIOR, true ); + if ( aSh.IsNull() ) + return; + + aSelMgr->AddOrRemoveIndex(aSh->getIO(), anIds, false); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + } + } + + const int n = aMap.Extent(); + myFacesInd->length(n); + for (int i = 1; i <= n; i++) + myFacesInd[i-1] = aMap(i); + if (n) + myEditCurrentArgument->setText(QString::number(n) + "_" + tr("GEOM_FACE") + tr("_S_")); + } } //================================================================================= @@ -217,13 +273,35 @@ void RepairGUI_SuppressFacesDlg::Convert( const TColStd_IndexedMapOfInteger& the //================================================================================= void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument() { - if ( sender() == GroupPoints->PushButton1 ) { - GroupPoints->LineEdit1->setFocus(); - myEditCurrentArgument = GroupPoints->LineEdit1; + QPushButton* send = (QPushButton*)sender(); + + bool isEffective = false; + + if (send == GroupArgs->PushButton1) { + isEffective = true; + myEditCurrentArgument = GroupArgs->LineEdit1; + + GroupArgs->PushButton2->setDown(false); + GroupArgs->LineEdit2->setEnabled(false); + } + else if (send == GroupArgs->PushButton2 && !myObject->_is_nil()) { + isEffective = true; + myEditCurrentArgument = GroupArgs->LineEdit2; + + GroupArgs->PushButton1->setDown(false); + GroupArgs->LineEdit1->setEnabled(false); } - SelectionIntoArgument(); -} + if (isEffective) { + initSelection(); + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); + } +} //================================================================================= // function : LineEditReturnPressed() @@ -231,13 +309,13 @@ void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument() //================================================================================= void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() { - if ( sender() == GroupPoints->LineEdit1 ) { - myEditCurrentArgument = GroupPoints->LineEdit1; + const QObject* send = sender(); + if (send == GroupArgs->LineEdit1 || send == GroupArgs->LineEdit2) { + myEditCurrentArgument = (QLineEdit*)send; GEOMBase_Skeleton::LineEditReturnPressed(); } } - //================================================================================= // function : ActivateThisDialog() // purpose : @@ -245,66 +323,62 @@ void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() void RepairGUI_SuppressFacesDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + + myEditCurrentArgument = GroupArgs->LineEdit1; + myEditCurrentArgument->setText( "" ); + GroupArgs->LineEdit2->setText( "" ); + myObject = GEOM::GEOM_Object::_nil(); + myFacesInd->length( 0 ); - //myGeomGUI->SetState( 0 ); initSelection(); } - //================================================================================= // function : enterEvent() // purpose : Mouse enter onto the dialog to activate it //================================================================================= -void RepairGUI_SuppressFacesDlg::enterEvent( QEvent* ) +void RepairGUI_SuppressFacesDlg::enterEvent (QEvent*) { - if ( !mainFrame()->GroupConstructors->isEnabled() ) + if (!mainFrame()->GroupConstructors->isEnabled()) ActivateThisDialog(); } - //================================================================================= // function : createOperation // purpose : //================================================================================= GEOM::GEOM_IOperations_ptr RepairGUI_SuppressFacesDlg::createOperation() { - return getGeomEngine()->GetIHealingOperations( getStudyId() ); + return getGeomEngine()->GetIHealingOperations(getStudyId()); } //================================================================================= // function : isValid // purpose : //================================================================================= -bool RepairGUI_SuppressFacesDlg::isValid( QString& ) +bool RepairGUI_SuppressFacesDlg::isValid (QString&) { - const int objL = myObjects->length(), facesL = myFaces.size(); - return ( objL && objL == facesL ); + TopoDS_Shape aTmpShape; + return !myObject->_is_nil() && (myFacesInd->length() || + GEOMBase::GetShape(myObject, aTmpShape, TopAbs_WIRE)); } //================================================================================= // function : execute // purpose : //================================================================================= -bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects ) +bool RepairGUI_SuppressFacesDlg::execute (ObjectList& objects) { - QStringList anErrorObjNames; - for ( int i = 0; i < myObjects->length(); i++ ) { - GEOM::GEOM_Object_var obj = myObjects[i]; - GEOM::short_array faces = myFaces[i]; - //MESSAGE(">>>> Dlg, passing faces.. len = " << faces.length()); - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->SuppressFaces( obj, faces ); - if ( anObj->_is_nil() ) - anErrorObjNames << GEOMBase::GetName( obj ); - else - objects.push_back( anObj._retn() ); - } + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->SuppressFaces(myObject, myFacesInd); - if ( !anErrorObjNames.empty() ) - MESSAGE( "ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " ).toLatin1().data() ); + bool aResult = !anObj->_is_nil(); + if (aResult) + objects.push_back(anObj._retn()); - return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing. + return aResult; } //================================================================================= @@ -313,6 +387,37 @@ bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects ) //================================================================================= void RepairGUI_SuppressFacesDlg::initSelection() { - GEOM::GEOM_Object_var aNullGeomObject; - localSelection( aNullGeomObject, TopAbs_FACE ); // load local selection on ALL objects + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + if (myEditCurrentArgument == GroupArgs->LineEdit1) { + TColStd_MapOfInteger aTypes; + aTypes.Add(GEOM_COMPOUND); + aTypes.Add(GEOM_SOLID); + aTypes.Add(GEOM_SHELL); + aTypes.Add(GEOM_FACE); + + globalSelection(aTypes); + } + else if (myEditCurrentArgument == GroupArgs->LineEdit2) { + localSelection(myObject, TopAbs_FACE); + } + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); +} + +//================================================================================= +// function : restoreSubShapes +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) +{ + if (mainFrame()->CheckBoxRestoreSS->isChecked()) { + // empty list of arguments means that all arguments should be restored + getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), + /*theFindMethod=*/GEOM::FSM_GetInPlace, + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); + } } diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h index 66a36ca94..837036dc8 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h @@ -1,44 +1,42 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// GEOM GEOMGUI : GUI for Geometry component -// File : RepairGUI_SuppressFacesDlg.h -// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + +// GEOM GEOMGUI : GUI for Geometry component +// File : RepairGUI_SuppressFacesDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // #ifndef REPAIRGUI_SUPPRESSFACESDLG_H #define REPAIRGUI_SUPPRESSFACESDLG_H #include -#include - -class DlgRef_1Sel; -class TColStd_IndexedMapOfInteger; +class DlgRef_2Sel; //================================================================================= // class : RepairGUI_SuppressFacesDlg // purpose : //================================================================================= class RepairGUI_SuppressFacesDlg : public GEOMBase_Skeleton -{ +{ Q_OBJECT public: @@ -49,32 +47,26 @@ protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); - virtual bool execute( ObjectList& ); + virtual bool execute( ObjectList& ); + virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr ); private: void Init(); void enterEvent( QEvent* ); - - void Convert( const TColStd_IndexedMapOfInteger&, - GEOM::short_array& ); - void initSelection(); - + private: - GEOM::ListOfGO_var myObjects; - QList myFaces; - // GEOM::short_array-s contain indexes of selected faces, - // index of a GEOM::short_array in myFaces list equals to index of - // GEOM::GEOM_Object in myObjects list to which the faces belong to. - - DlgRef_1Sel* GroupPoints; - + GEOM::GEOM_Object_var myObject; + GEOM::short_array_var myFacesInd; + + DlgRef_2Sel* GroupArgs; + private slots: void ClickOnOk(); bool ClickOnApply(); - + void ActivateThisDialog(); - + void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); diff --git a/src/SKETCHER/Makefile.am b/src/SKETCHER/Makefile.am index 1ff014005..503d0b9b5 100644 --- a/src/SKETCHER/Makefile.am +++ b/src/SKETCHER/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM SKETCHER : basic sketcher # File : Makefile.in # Author : Patrick GOLDBRONN (CEA) diff --git a/src/SKETCHER/SKETCHER.pro b/src/SKETCHER/SKETCHER.pro deleted file mode 100644 index 6dd1da34c..000000000 --- a/src/SKETCHER/SKETCHER.pro +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = GEOMSketcher -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel - -CAS_MODELER = -L$${CASROOT}/Linux/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBO -lTKBool -lTKHLR -lTKFillet -lTKOffset -lTKFeat - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${KERNEL_LDFLAGS} -lSALOMELocalTrace $${STDLIB} $${CAS_KERNEL} $${CAS_MODELER} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = Sketcher_Profile.hxx - -SOURCES = Sketcher_Profile.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/SKETCHER/Sketcher_Profile.cxx b/src/SKETCHER/Sketcher_Profile.cxx index eb8fd9f23..163829d20 100644 --- a/src/SKETCHER/Sketcher_Profile.cxx +++ b/src/SKETCHER/Sketcher_Profile.cxx @@ -1,30 +1,30 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM SKETCHER : basic sketcher // File : Sketcher_Profile.cxx // Author : Damien COQUERET // Module : GEOM -// $Header: -// + #include #include @@ -77,6 +77,9 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) first = Standard_True; stayfirst = face = close = Standard_False; + Standard_Integer reversed = 0; + Standard_Integer control_Tolerance = 0; + TopoDS_Shape S; TopoDS_Vertex MP; BRepBuilderAPI_MakeWire MW; @@ -86,6 +89,7 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) Handle(Geom_Surface) Surface; myOK = Standard_False; + myError = 0; //TCollection_AsciiString aCommand(CORBA::string_dup(aCmd)); TCollection_AsciiString aCommand ((char*)aCmd); @@ -204,7 +208,7 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) case 'R': { if (n1 != 2) goto badargs; - angle = a(1).RealValue() * PI180; + angle = a(1).RealValue() * M_PI / 180.; if (a(0) == "RR") { dx = Cos(angle); dy = Sin(angle); @@ -237,13 +241,117 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd) if (n1 != 3) goto badargs; radius = a(1).RealValue(); if (Abs(radius) > Precision::Confusion()) { - angle = a(2).RealValue() * PI180; + angle = a(2).RealValue() * M_PI / 180.; move = circle; } else move = none; break; } + case 'A': // TAngential arc by end point + { + if (n1 != 3) goto badargs; + Standard_Real vx = a(1).RealValue(); + Standard_Real vy = a(2).RealValue(); + if (a(0) == "AA") { + vx -= x; + vy -= y; + } + Standard_Real det = dx * vy - dy * vx; + if ( Abs(det) > Precision::Confusion()) { + // Cosine of alpha = arc of angle / 2 , alpha in [0,Pi] + Standard_Real c = (dx * vx + dy * vy) / Sqrt((dx * dx + dy * dy) * (vx * vx + vy * vy)); + // radius = distance between start and end point / 2 * sin(alpha) + // radius is > 0 or < 0 + radius = (vx * vx + vy * vy)* Sqrt(dx * dx + dy * dy) / (2.0 * det); + if (Abs(radius) > Precision::Confusion()) { + angle = 2.0 * acos(c); // angle in [0,2Pi] + move = circle; + } + else + move = none; + break; + } + else + move = none; + break; + } + case 'U': // Arc by end point and radiUs + { + if (n1 != 5) goto badargs; + Standard_Real vx = a(1).RealValue(); + Standard_Real vy = a(2).RealValue(); + radius = a(3).RealValue(); + reversed = a(4).IntegerValue(); + if (a(0) == "UU") { // Absolute + vx -= x; + vy -= y; + } + Standard_Real length = Sqrt(vx * vx + vy * vy); + if ( (4.0 - (vx * vx + vy * vy) / (radius * radius) >= 0.0 ) && (length > Precision::Confusion()) ) { + // Cosine of alpha = arc angle / 2 , alpha in [0,Pi/2] + Standard_Real c = 0.5 * Sqrt(4.0 - (vx * vx + vy * vy) / (radius * radius)); + angle = 2.0 * acos(c); // angle in [0,Pi] + if ( reversed == 2 ) + angle = angle - 2 * M_PI; + dx = 0.5 * ( vy * 1.0/radius + + vx * Sqrt(4.0 / (vx * vx + vy * vy) - 1.0 / (radius * radius))); + dy = - 0.5 * ( vx * 1.0/radius + - vy * Sqrt(4.0 / (vx * vx + vy * vy) - 1.0 / (radius * radius))); + move = circle; + } + else{ + move = none; + } + break; + } + case 'E': // Arc by end point and cEnter + { + if (n1 != 7) goto badargs; + Standard_Real vx = a(1).RealValue(); + Standard_Real vy = a(2).RealValue(); + Standard_Real vxc = a(3).RealValue(); + Standard_Real vyc = a(4).RealValue(); + reversed = a(5).IntegerValue(); + control_Tolerance = a(6).IntegerValue(); + + if (a(0) == "EE") { // Absolute + vx -= x; + vy -= y; + vxc -= x; + vyc -= y; + } + radius = Sqrt( vxc * vxc + vyc * vyc ); + Standard_Real det = vx * vyc - vy * vxc; + Standard_Real length = Sqrt(vx * vx + vy * vy); + Standard_Real length2 = Sqrt((vx-vxc) * (vx-vxc) + (vy-vyc) * (vy-vyc)); + Standard_Real length3 = Sqrt(vxc * vxc + vyc * vyc); + Standard_Real error = Abs(length2 - radius); + myError = error; + if ( error > Precision::Confusion() ){ + MESSAGE("Warning : The specified end point is not on the Arc, distance = "< Precision::Confusion() && control_Tolerance == 1) // Don't create the arc if the end point + move = none; // is too far from it + else if ( (length > Precision::Confusion()) && + (length2 > Precision::Confusion()) && + (length3 > Precision::Confusion()) ) { + Standard_Real c = ( radius * radius - (vx * vxc + vy * vyc) ) + / ( radius * Sqrt((vx-vxc) * (vx-vxc) + (vy-vyc) * (vy-vyc)) ) ; // Cosine of arc angle + angle = acos(c); // angle in [0,Pi] + if ( reversed == 2 ) + angle = angle - 2 * M_PI; + if (det < 0) + angle = -angle; + dx = vyc / radius; + dy = -vxc / radius; + move = circle; + } + else { + move = none; + } + break; + } case 'I': { if (n1 != 2) goto badargs; diff --git a/src/SKETCHER/Sketcher_Profile.hxx b/src/SKETCHER/Sketcher_Profile.hxx index 7db4b4eaf..f323a058e 100644 --- a/src/SKETCHER/Sketcher_Profile.hxx +++ b/src/SKETCHER/Sketcher_Profile.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM SKETCHER : basic sketcher // File : Sketcher_Profile.h // Author : Damien COQUERET @@ -28,6 +29,7 @@ #include #include #include +#include class Sketcher_Profile { @@ -42,6 +44,8 @@ private: TopoDS_Shape myShape; bool myOK; + std::string myErrMsg; + double myError; public: Standard_EXPORT gp_Pnt GetLastPoint(){return myLastPoint;}; @@ -49,5 +53,7 @@ public: Standard_EXPORT const TopoDS_Shape& GetShape(){return myShape;}; Standard_EXPORT bool IsDone(){return myOK;}; + Standard_EXPORT std::string ErrMsg(){return myErrMsg;}; + Standard_EXPORT double Error(){return myError;}; }; diff --git a/src/STEPExport/Makefile.am b/src/STEPExport/Makefile.am index 3748333cb..96bf0e2b5 100644 --- a/src/STEPExport/Makefile.am +++ b/src/STEPExport/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Pavel TELKOV # Modified by : Alexander BORODIN (OCN) - autotools usage @@ -43,6 +41,6 @@ libSTEPExport_la_CPPFLAGS = \ $(KERNEL_CXXFLAGS) libSTEPExport_la_LDFLAGS = \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \ $(STDLIB) \ $(CAS_LDPATH) -lTKSTEP diff --git a/src/STEPExport/STEPExport.cxx b/src/STEPExport/STEPExport.cxx index debe363a7..4a0805c84 100644 --- a/src/STEPExport/STEPExport.cxx +++ b/src/STEPExport/STEPExport.cxx @@ -1,40 +1,44 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: STEPExport.cxx -// Created: Wed May 19 14:53:52 2004 -// Author: Pavel TELKOV -// + +// File: STEPExport.cxx +// Created: Wed May 19 14:53:52 2004 +// Author: Pavel TELKOV +// // #include "utilities.h" +#include + #include #include +#include #include #include #ifdef WNT - #if defined STEPEXPORT_EXPORTS + #if defined STEPEXPORT_EXPORTS || defined STEPExport_EXPORTS #if defined WIN32 #define STEPEXPORT_EXPORT __declspec( dllexport ) #else @@ -66,16 +70,24 @@ STEPEXPORT_EXPORT try { + // Set "C" numeric locale to save numbers correctly + Kernel_Utils::Localizer loc; + IFSelect_ReturnStatus status ; //VRV: OCC 4.0 migration STEPControl_Writer aWriter; + //VSR: 16/09/09: Convert to METERS + Interface_Static::SetCVal("xstep.cascade.unit","M"); + Interface_Static::SetIVal("write.step.nonmanifold", 1); //JFA: PAL6162 status = aWriter.Transfer( theShape, STEPControl_ManifoldSolidBrep ); status = aWriter.Transfer( theShape, STEPControl_AsIs ); //VRV: OCC 4.0 migration if ( status == IFSelect_RetDone ) - status = aWriter.Write( theFileName.ToCString() ) ; + status = aWriter.Write( theFileName.ToCString() ); + + // Return previous locale if ( status == IFSelect_RetDone ) - return 1; + return 1; } catch(Standard_Failure) { diff --git a/src/STEPExport/STEPExport.pro b/src/STEPExport/STEPExport.pro deleted file mode 100644 index 8f5597513..000000000 --- a/src/STEPExport/STEPExport.pro +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = STEPExport -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${STDLIB} $${CAS_LDPATH} -lTKSTEP $${KERNEL_LDFLAGS} -lSALOMELocalTrace - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += STEPEXPORT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -SOURCES = STEPExport.cxx diff --git a/src/STEPImport/Makefile.am b/src/STEPImport/Makefile.am index f5e90dabd..c96d2fa5c 100644 --- a/src/STEPImport/Makefile.am +++ b/src/STEPImport/Makefile.am @@ -1,30 +1,27 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # File : Makefile.in # Author : Pavel TELKOV # Modified by : Alexander BORODIN (OCN) - autotools usage # Module : GEOM -# $Header$ -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files @@ -43,6 +40,6 @@ libSTEPImport_la_CPPFLAGS = \ $(KERNEL_CXXFLAGS) libSTEPImport_la_LDFLAGS = \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \ $(STDLIB) \ - $(CAS_LDPATH) -lTKSTEP + $(CAS_LDPATH) -lTKSTEP -lTKCAF -lTKLCAF -lTKSTEPBase diff --git a/src/STEPImport/STEPImport.cxx b/src/STEPImport/STEPImport.cxx index 2ee8f1363..f3f0c06c1 100644 --- a/src/STEPImport/STEPImport.cxx +++ b/src/STEPImport/STEPImport.cxx @@ -1,46 +1,67 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 -// -// File: STEPImport.cxx -// Created: Wed May 19 14:41:10 2004 -// Author: Pavel TELKOV -// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// File: STEPImport.cxx +// Created: Wed May 19 14:41:10 2004 +// Author: Pavel TELKOV + #include "utilities.h" -#include +#include +#include +#include #include - +#include +#include #include - +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include +#include +#include +#include +#include +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC #ifdef WNT - #if defined STEPIMPORT_EXPORTS + #if defined STEPIMPORT_EXPORTS || defined STEPImport_EXPORTS #if defined WIN32 #define STEPIMPORT_EXPORT __declspec( dllexport ) #else @@ -65,63 +86,187 @@ extern "C" { -STEPIMPORT_EXPORT + STEPIMPORT_EXPORT TopoDS_Shape Import (const TCollection_AsciiString& theFileName, const TCollection_AsciiString& /*theFormatName*/, - TCollection_AsciiString& theError) + TCollection_AsciiString& theError, + const TDF_Label& theShapeLabel) { MESSAGE("Import STEP model from file " << theFileName.ToCString()); + // Set "C" numeric locale to save numbers correctly + Kernel_Utils::Localizer loc; TopoDS_Shape aResShape; //VRV: OCC 4.0 migration STEPControl_Reader aReader; + //VSR: 16/09/09: Convert to METERS + Interface_Static::SetCVal("xstep.cascade.unit","M"); + Interface_Static::SetIVal("read.step.ideas", 1); + Interface_Static::SetIVal("read.step.nonmanifold", 1); //VRV: OCC 4.0 migration TopoDS_Compound compound; BRep_Builder B; - B.MakeCompound( compound ); + B.MakeCompound(compound); try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString()); if (status == IFSelect_RetDone) { - Standard_Boolean failsonly = Standard_False ; - aReader.PrintCheckLoad (failsonly, IFSelect_ItemsByEntity); - /* Root transfers */ - Standard_Integer nbr = aReader.NbRootsForTransfer(); - aReader.PrintCheckTransfer (failsonly, IFSelect_ItemsByEntity); - - for ( Standard_Integer n=1; n <= nbr; n++) { - Standard_Boolean ok = aReader.TransferRoot(n); - /* Collecting resulting entities */ - Standard_Integer nbs = aReader.NbShapes(); - if (!ok || nbs == 0) - { - // THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM); - continue; // skip empty root - } - /* For a single entity */ - else if (nbr == 1 && nbs == 1) { - aResShape = aReader.Shape(1); - break; - } - - for ( Standard_Integer i=1; i<=nbs; i++ ) { - TopoDS_Shape aShape = aReader.Shape(i); - if ( aShape.IsNull() ) { - // THROW_SALOME_CORBA_EXCEPTION("Null shape in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM) ; - //return aResShape; - continue; - } - else { - B.Add( compound, aShape ) ; - } - } - } - if ( aResShape.IsNull() ) - aResShape = compound; - - } else { + Standard_Boolean failsonly = Standard_False; + aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity); + /* Root transfers */ + Standard_Integer nbr = aReader.NbRootsForTransfer(); + aReader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity); + + for (Standard_Integer n = 1; n <= nbr; n++) { + Standard_Boolean ok = aReader.TransferRoot(n); + /* Collecting resulting entities */ + Standard_Integer nbs = aReader.NbShapes(); + if (!ok || nbs == 0) + { + // THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM); + continue; // skip empty root + } + /* For a single entity */ + else if (nbr == 1 && nbs == 1) { + aResShape = aReader.Shape(1); + // ATTENTION: this is a workaround for mantis issue 0020442 remark 0010776 + // It should be removed after patching OCCT for bug OCC22436 + // (fix for OCCT is expected in service pack next to OCCT6.3sp12) + if (aResShape.ShapeType() == TopAbs_COMPOUND) { + int nbSub1 = 0; + TopoDS_Shape currShape; + TopoDS_Iterator It (aResShape, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + nbSub1++; + currShape = It.Value(); + } + if (nbSub1 == 1) + aResShape = currShape; + } + // END workaround + break; + } + + for (Standard_Integer i = 1; i <= nbs; i++) { + TopoDS_Shape aShape = aReader.Shape(i); + if (aShape.IsNull()) { + // THROW_SALOME_CORBA_EXCEPTION("Null shape in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM) ; + //return aResShape; + continue; + } + else { + B.Add(compound, aShape); + } + } + } + if (aResShape.IsNull()) + aResShape = compound; + + // Check if any BRep entity has been read, there must be at least a vertex + if ( !TopExp_Explorer( aResShape, TopAbs_VERTEX ).More() ) + { + theError = "No geometrical data in the imported file."; + return TopoDS_Shape(); + } + + // BEGIN: Store names of sub-shapes from file + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aResShape, anIndices); + + Handle(Interface_InterfaceModel) Model = aReader.WS()->Model(); + Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader(); + if (!TR.IsNull()) { + Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); + Handle(Standard_Type) tPD = STANDARD_TYPE(StepBasic_ProductDefinition); + Handle(Standard_Type) tShape = STANDARD_TYPE(StepShape_TopologicalRepresentationItem); + Handle(Standard_Type) tGeom = STANDARD_TYPE(StepGeom_GeometricRepresentationItem); + + Standard_Integer nb = Model->NbEntities(); + for (Standard_Integer ie = 1; ie <= nb; ie++) { + Handle(Standard_Transient) enti = Model->Value(ie); + Handle(TCollection_HAsciiString) aName; + if ( enti->IsKind( tShape ) || enti->IsKind(tGeom)) + { + aName = Handle(StepRepr_RepresentationItem)::DownCast(enti)->Name(); + } + else if (enti->DynamicType() == tPD) + { + Handle(StepBasic_ProductDefinition) PD = + Handle(StepBasic_ProductDefinition)::DownCast(enti); + if (PD.IsNull()) continue; + + Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct(); + aName = Prod->Name(); + } + else + { + continue; + } + if ( aName->UsefullLength() < 1 ) + continue; + // skip 'N0NE' name + if ( aName->UsefullLength() == 4 && + toupper (aName->Value(1)) == 'N' && + toupper (aName->Value(2)) == 'O' && + toupper (aName->Value(3)) == 'N' && + toupper (aName->Value(4)) == 'E') + continue; + + // special check to pass names like "Open CASCADE STEP translator 6.3 1" + TCollection_AsciiString aSkipName ("Open CASCADE STEP translator"); + if (aName->Length() >= aSkipName.Length()) { + if (aName->String().SubString(1, aSkipName.Length()).IsEqual(aSkipName)) + continue; + } + TCollection_ExtendedString aNameExt (aName->ToCString()); + + // find target shape + Handle(Transfer_Binder) binder = TP->Find(enti); + if (binder.IsNull()) continue; + TopoDS_Shape S = TransferBRep::ShapeResult(binder); + if (S.IsNull()) continue; + + // as PRODUCT can be included in the main shape + // several times, we look here for all iclusions. + Standard_Integer isub, nbSubs = anIndices.Extent(); + for (isub = 1; isub <= nbSubs; isub++) + { + TopoDS_Shape aSub = anIndices.FindKey(isub); + if (aSub.IsPartner(S)) { + TDF_Label L; + if (enti->IsKind(tGeom)) { + // check all named shapes using iterator + TDF_ChildIDIterator anIt (theShapeLabel, TDataStd_Name::GetID(), Standard_True); + for (; anIt.More(); anIt.Next()) { + Handle(TDataStd_Name) nameAttr = + Handle(TDataStd_Name)::DownCast(anIt.Value()); + if (nameAttr.IsNull()) continue; + TDF_Label Lab = nameAttr->Label(); + Handle(TNaming_NamedShape) shAttr; + if (Lab.FindAttribute(TNaming_NamedShape::GetID(), shAttr) && shAttr->Get().IsEqual(aSub)) + L = Lab; + } + } + // create label and set shape + if (L.IsNull()) + { + TDF_TagSource aTag; + L = aTag.NewChild(theShapeLabel); + TNaming_Builder tnBuild (L); + //tnBuild.Generated(S); + tnBuild.Generated(aSub); + } + // set a name + TDataStd_Name::Set(L, aNameExt); + } + } + } + } + // END: Store names + } + else { // switch (status) { // case IFSelect_RetVoid: // theError = "Nothing created or No data to process"; @@ -139,7 +284,7 @@ STEPIMPORT_EXPORT // break; // } theError = "Wrong format of the imported file. Can't import file."; - aResShape.Nullify(); + aResShape.Nullify(); } } catch (Standard_Failure) { @@ -147,6 +292,7 @@ STEPIMPORT_EXPORT theError = aFail->GetMessageString(); aResShape.Nullify(); } + // Return previous locale return aResShape; } } diff --git a/src/STEPImport/STEPImport.pro b/src/STEPImport/STEPImport.pro deleted file mode 100644 index a88596775..000000000 --- a/src/STEPImport/STEPImport.pro +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = STEPImport -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${STDLIB} $${CAS_LDPATH} -lTKSTEP $${KERNEL_LDFLAGS} -lSALOMELocalTrace - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += STEPIMPORT_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -SOURCES = STEPImport.cxx diff --git a/src/STLExport/Makefile.am b/src/STLExport/Makefile.am index 67cff44cc..d482d48fe 100644 --- a/src/STLExport/Makefile.am +++ b/src/STLExport/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # $Header$ # include $(top_srcdir)/adm_local/unix/make_common_starter.am diff --git a/src/STLExport/STLExport.cxx b/src/STLExport/STLExport.cxx index d264d62a4..9d0fc1f1b 100644 --- a/src/STLExport/STLExport.cxx +++ b/src/STLExport/STLExport.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: STLExport.cxx -// Created: Wed May 19 14:53:52 2004 -// Author: Pavel TELKOV -// + +// File: STLExport.cxx +// Created: Wed May 19 14:53:52 2004 +// Author: Pavel TELKOV +// // #include "utilities.h" @@ -32,7 +33,7 @@ #include #ifdef WIN32 -# if defined STLEXPORT_EXPORTS +# if defined STLEXPORT_EXPORTS || defined STLExport_EXPORTS # define STLEXPORT_EXPORT __declspec( dllexport ) # else # define STLEXPORT_EXPORT __declspec( dllimport ) diff --git a/src/STLExport/STLExport.pro b/src/STLExport/STLExport.pro deleted file mode 100644 index e161a9b08..000000000 --- a/src/STLExport/STLExport.pro +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = STLExport -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -STDLIB = -lstdc++ - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${STDLIB} $${CAS_LDPATH} -lTKSTL $${KERNEL_LDFLAGS} -lSALOMELocalTrace - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -SOURCES = STLExport.cxx diff --git a/src/ShHealOper/Makefile.am b/src/ShHealOper/Makefile.am index 45163e0c9..d2f1cd4ae 100644 --- a/src/ShHealOper/Makefile.am +++ b/src/ShHealOper/Makefile.am @@ -1,24 +1,22 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # GEOM ShHealOper : Shape Healing # File : Makefile.in # Author : Alexander SLADKOV @@ -70,4 +68,4 @@ libShHealOper_la_LDFLAGS = \ $(CAS_KERNEL) \ $(CAS_MATH) \ $(CAS_TKTopAlgo) \ - $(CAS_LDPATH) -lTKBool -lTKShHealing -lTKLCAF + $(CAS_LDPATH) -lTKBool -lTKShHealing -lTKCAF -lTKLCAF diff --git a/src/ShHealOper/ShHealOper.pro b/src/ShHealOper/ShHealOper.pro deleted file mode 100644 index 6bb2a537a..000000000 --- a/src/ShHealOper/ShHealOper.pro +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = ShHealOper -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -STDLIB = -lstdc++ - -CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel - -CAS_MATH = -L$${CASROOT}/Linux/lib -lTKMath - -CAS_TKTopAlgo = -L$${CASROOT}/Linux/lib -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo - -CAS_LDPATH = -L$$(CASROOT)/Linux/lib - -INCLUDEPATH += $${CAS_CPPFLAGS} $${KERNEL_CXXFLAGS} - -LIBS += $${STDLIB} $${CAS_KERNEL} $${CAS_MATH} $${CAS_TKTopAlgo} $${CAS_LDPATH} -lTKBool -lTKShHealing -lTKLCAF - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = ShHealOper_CloseContour.hxx -HEADERS += ShHealOper_EdgeDivide.hxx -HEADERS += ShHealOper_FillHoles.hxx -HEADERS += ShHealOper_RemoveFace.hxx -HEADERS += ShHealOper_RemoveInternalWires.hxx -HEADERS += ShHealOper_Sewing.hxx -HEADERS += ShHealOper_ShapeProcess.hxx -HEADERS += ShHealOper_SpiltCurve2d.hxx -HEADERS += ShHealOper_SplitCurve2d.hxx -HEADERS += ShHealOper_SplitCurve3d.hxx -HEADERS += ShHealOper_ChangeOrientation.hxx -HEADERS += ShHealOper_Tool.hxx - -SOURCES = ShHealOper_CloseContour.cxx -SOURCES += ShHealOper_EdgeDivide.cxx -SOURCES += ShHealOper_FillHoles.cxx -SOURCES += ShHealOper_RemoveFace.cxx -SOURCES += ShHealOper_RemoveInternalWires.cxx -SOURCES += ShHealOper_Sewing.cxx -SOURCES += ShHealOper_ShapeProcess.cxx -SOURCES += ShHealOper_SplitCurve2d.cxx -SOURCES += ShHealOper_SplitCurve3d.cxx -SOURCES += ShHealOper_ChangeOrientation.cxx -SOURCES += ShHealOper_Tool.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/ShHealOper/ShHealOper_ChangeOrientation.cxx b/src/ShHealOper/ShHealOper_ChangeOrientation.cxx index 8be204945..4d2fba884 100644 --- a/src/ShHealOper/ShHealOper_ChangeOrientation.cxx +++ b/src/ShHealOper/ShHealOper_ChangeOrientation.cxx @@ -1,31 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_ChangeOrientation.cxx // Created: 11.07.06 11:46:45 // Author: Sergey KUUL -// + #include #include +#include + #include //======================================================================= @@ -58,7 +61,7 @@ Standard_Boolean ShHealOper_ChangeOrientation::Perform() BRep_Builder B; if (myInitShape.ShapeType() == TopAbs_SHELL) { myResultShape = myInitShape.EmptyCopied(); - TopoDS_Iterator itr(myInitShape); + TopoDS_Iterator itr (myInitShape); while (itr.More()) { B.Add(myResultShape,itr.Value().Reversed()); itr.Next(); @@ -66,23 +69,34 @@ Standard_Boolean ShHealOper_ChangeOrientation::Perform() } else if (myInitShape.ShapeType() == TopAbs_FACE) { myResultShape = myInitShape.EmptyCopied(); - TopoDS_Iterator itr(myInitShape); + TopoDS_Iterator itr (myInitShape); while (itr.More()) { B.Add(myResultShape,itr.Value()); itr.Next(); } myResultShape.Reverse(); } - else if (myInitShape.ShapeType() == TopAbs_WIRE) { - myResultShape = myInitShape.Reversed(); - } - else if (myInitShape.ShapeType() == TopAbs_EDGE) { - myResultShape = myInitShape.Reversed(); + else if ( myInitShape.ShapeType() == TopAbs_WIRE || myInitShape.ShapeType() == TopAbs_EDGE) { + myResultShape = myInitShape.EmptyCopied(); + TopoDS_Iterator itr (myInitShape); + while (itr.More()) { + B.Add(myResultShape,itr.Value()); + itr.Next(); + } + myResultShape.Reverse(); } else { - return false; + BRepBuilderAPI_Copy Copy (myInitShape); + if (!Copy.IsDone()) return false; + + myResultShape = Copy.Shape(); + if (myResultShape.IsNull()) return false; + + if (myResultShape.Orientation() == TopAbs_FORWARD) + myResultShape.Orientation(TopAbs_REVERSED); + else + myResultShape.Orientation(TopAbs_FORWARD); } return true; - } diff --git a/src/ShHealOper/ShHealOper_ChangeOrientation.hxx b/src/ShHealOper/ShHealOper_ChangeOrientation.hxx index 80c82ebed..bed7feb8f 100644 --- a/src/ShHealOper/ShHealOper_ChangeOrientation.hxx +++ b/src/ShHealOper/ShHealOper_ChangeOrientation.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_ChangeOrientation.hxx // Created: 11.07.06 11:22:26 // Author: Sergey KUUL diff --git a/src/ShHealOper/ShHealOper_CloseContour.cxx b/src/ShHealOper/ShHealOper_CloseContour.cxx index 683fec5f4..64749f18c 100644 --- a/src/ShHealOper/ShHealOper_CloseContour.cxx +++ b/src/ShHealOper/ShHealOper_CloseContour.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_CloseContour.cxx // Created: 20.04.04 11:36:01 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_CloseContour.hxx b/src/ShHealOper/ShHealOper_CloseContour.hxx index 4558bb1c9..d2b149a29 100644 --- a/src/ShHealOper/ShHealOper_CloseContour.hxx +++ b/src/ShHealOper/ShHealOper_CloseContour.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_CloseContour.hxx // Created: 20.04.04 10:25:46 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_EdgeDivide.cxx b/src/ShHealOper/ShHealOper_EdgeDivide.cxx index 52e061b6d..e776429d0 100644 --- a/src/ShHealOper/ShHealOper_EdgeDivide.cxx +++ b/src/ShHealOper/ShHealOper_EdgeDivide.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_EdgeDivide.cxx // Created: 30.04.04 16:44:47 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_EdgeDivide.hxx b/src/ShHealOper/ShHealOper_EdgeDivide.hxx index c09d779bd..9aa94e1ae 100644 --- a/src/ShHealOper/ShHealOper_EdgeDivide.hxx +++ b/src/ShHealOper/ShHealOper_EdgeDivide.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_EdgeDivide.hxx // Created: 30.04.04 16:06:25 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_FillHoles.cxx b/src/ShHealOper/ShHealOper_FillHoles.cxx index 3e8f0d4bd..2aa0c38f4 100644 --- a/src/ShHealOper/ShHealOper_FillHoles.cxx +++ b/src/ShHealOper/ShHealOper_FillHoles.cxx @@ -1,62 +1,68 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_FillHoles.cxx // Created: 26.04.04 17:35:30 // Author: Galina KULIKOVA -// + +#include + +#include +#include #include -#include -#include #include -#include -#include -#include + #include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include #include -#include -#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include #include -#include -#include -#include + +#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include + +#include //======================================================================= //function : ShHealOper_FillHoles() @@ -69,33 +75,31 @@ ShHealOper_FillHoles::ShHealOper_FillHoles () //======================================================================= //function : ShHealOper_FillHoles -//purpose : +//purpose : //======================================================================= - ShHealOper_FillHoles::ShHealOper_FillHoles (const TopoDS_Shape& theShape) { - Init(theShape); InitParameters(); } + //======================================================================= //function : Init -//purpose : +//purpose : //======================================================================= - void ShHealOper_FillHoles::Init(const TopoDS_Shape& theShape) { ShHealOper_Tool::Init(theShape); TopExp::MapShapesAndAncestors( myInitShape, TopAbs_EDGE,TopAbs_SHELL , myEdgeShells); TopExp::MapShapesAndAncestors ( myInitShape, TopAbs_EDGE,TopAbs_COMPOUND, myEdgeComps ); - + TopExp::MapShapesAndAncestors ( myInitShape, TopAbs_EDGE,TopAbs_FACE, myEdgeFaces ); } + //======================================================================= //function : InitParameters -//purpose : +//purpose : //======================================================================= - void ShHealOper_FillHoles::InitParameters(Standard_Integer theDegree, Standard_Integer theNbPtsOnCur, Standard_Integer theNbIter, @@ -118,9 +122,8 @@ void ShHealOper_FillHoles::InitParameters(Standard_Integer theDegree, } //======================================================================= //function : Fill -//purpose : +//purpose : //======================================================================= - Standard_Boolean ShHealOper_FillHoles::Fill() { ShapeAnalysis_FreeBounds sab(myInitShape); @@ -130,17 +133,17 @@ Standard_Boolean ShHealOper_FillHoles::Fill() if(!aCompClosed.IsNull()) { TopoDS_Iterator aIt(aCompClosed); - for( ; aIt.More(); aIt.Next()) + for( ; aIt.More(); aIt.Next()) aFillWires.Append(aIt.Value()); } if(!aCompOpen.IsNull()) { TopoDS_Iterator aIt(aCompOpen); - for( ; aIt.More(); aIt.Next()) + for( ; aIt.More(); aIt.Next()) aFillWires.Append(aIt.Value()); } - + TopExp_Explorer aExp(myInitShape,TopAbs_EDGE,TopAbs_FACE); - + for( ; aExp.More(); aExp.Next()) aFillWires.Append(aExp.Current()); @@ -149,9 +152,8 @@ Standard_Boolean ShHealOper_FillHoles::Fill() //======================================================================= //function : Fill -//purpose : +//purpose : //======================================================================= - Standard_Boolean ShHealOper_FillHoles::Fill(const TopTools_SequenceOfShape& theFillShapes) { myDone = Standard_False; @@ -180,36 +182,36 @@ Standard_Boolean ShHealOper_FillHoles::Fill(const TopTools_SequenceOfShape& theF Handle(Geom_Surface) aSurf = buildSurface(aWire,aCurves2d,aOrders,aSenses); if(aSurf.IsNull()) myErrorStatus = ShHealOper_ErrorExecution; - else + else myDone = (addFace(aSurf,aWire,aCurves2d,aOrders,aSenses) || myDone); } if(myDone) myResultShape = myContext->Apply(myResultShape); return myDone; } + //======================================================================= //function : isCircle -//purpose : +//purpose : //======================================================================= static Standard_Boolean isCircle(const TopoDS_Edge theEdge) { Standard_Real aFirst, aLast; Handle(Geom_Curve) aC3D = BRep_Tool::Curve(theEdge,aFirst, aLast ); if(aC3D.IsNull()) return Standard_False; - Standard_Boolean isCirc = (aC3D->Value(aFirst).Distance(aC3D->Value(aLast)) < + Standard_Boolean isCirc = (aC3D->Value(aFirst).Distance(aC3D->Value(aLast)) < aC3D->Value(aFirst).Distance(aC3D->Value((aFirst +aLast)/2))); return isCirc; } //======================================================================= //function : prepareWires -//purpose : +//purpose : //======================================================================= Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfShape& theFillShapes, Handle(TopTools_HSequenceOfShape)& theSeqWires) { Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape; - BRep_Builder aB; Standard_Integer i =1; for( ; i <= theFillShapes.Length(); i++) { TopExp_Explorer aExp; @@ -227,10 +229,10 @@ Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfSha if (!BRep_Tool::Degenerated (TopoDS::Edge (aExp.Current()))) if(myEdgeFaces.Contains(aExp.Current()) && myEdgeFaces.FindFromKey(aExp.Current()).Extent() >1) continue; - aSeqEdges->Append(aExp.Current()); + aSeqEdges->Append(aExp.Current()); } } - + if(aSeqEdges->Length()) { Standard_Real aTol = 0.; @@ -240,23 +242,21 @@ Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfSha Handle(TopTools_HSequenceOfShape) anWiresClosed = new TopTools_HSequenceOfShape, anWiresOpen = new TopTools_HSequenceOfShape; ShapeAnalysis_FreeBounds::SplitWires(aTmpWires, aTol, aShared, anWiresClosed, anWiresOpen); - + for (i = 1; i <= anWiresClosed->Length(); i++) theSeqWires->Append (anWiresClosed->Value (i)); for (i = 1; i <= anWiresOpen->Length(); i++) theSeqWires->Append (anWiresOpen->Value (i)); } - - for( i =1; i <= theSeqWires->Length(); i++) { TopoDS_Wire aWire = TopoDS::Wire(theSeqWires->Value(i)); - + TopoDS_Iterator aIt(aWire); Standard_Integer ne =0; TopoDS_Edge ae; for( ; aIt.More(); aIt.Next(), ne++) - ae = TopoDS::Edge(aIt.Value()); + ae = TopoDS::Edge(aIt.Value()); if((ne == 1) && ( !isCircle(ae))) { theSeqWires->Remove(i--); continue; @@ -266,7 +266,7 @@ Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfSha } //======================================================================= //function : buildSurface -//purpose : +//purpose : //======================================================================= Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWire, @@ -276,9 +276,8 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi { Handle(Geom_BSplineSurface) aSurf; try { - GeomPlate_BuildPlateSurface aBuilder(myDegree, myNbPtsOnCur, myNbIter, - myTol2d, myTol3d, myTolAng, myTolCrv); + myTol2d, myTol3d, myTolAng, myTolCrv); TopoDS_Iterator aIter; for(aIter.Initialize (theWire); aIter.More(); aIter.Next()) { @@ -286,8 +285,8 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi BRepAdaptor_Curve adC(ae); Handle(BRepAdaptor_HCurve) aHAD= new BRepAdaptor_HCurve(adC); Handle(BRepFill_CurveConstraint) aConst = - new BRepFill_CurveConstraint (aHAD, (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d); - //Handle(GeomPlate_CurveConstraint) aConst = + new BRepFill_CurveConstraint (aHAD, (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d); + //Handle(GeomPlate_CurveConstraint) aConst = // new GeomPlate_CurveConstraint(aHAD, (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d); aBuilder.Add (aConst); } @@ -307,17 +306,16 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi S3d.Clear(); aBuilder.Disc2dContour(4,S2d); aBuilder.Disc3dContour(4,0,S3d); - Standard_Real amaxTol = Max( myTol3d, 10* aDist); + Standard_Real amaxTol = Max( myTol3d, 10* aDist); GeomPlate_PlateG0Criterion Criterion( S2d, S3d, amaxTol ); GeomPlate_MakeApprox Approx( aPlSurf, Criterion, myTol3d, myMaxSeg, myMaxDeg ); aSurf = Approx.Surface(); if(aSurf.IsNull()) return aSurf; - + theCurves2d = aBuilder.Curves2d(); theOrders = aBuilder.Order(); theSenses = aBuilder.Sense(); - } catch (Standard_Failure) { @@ -329,7 +327,7 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi //======================================================================= //function : addFace -//purpose : +//purpose : //======================================================================= Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSurf, @@ -338,10 +336,13 @@ Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSu const Handle(TColStd_HArray1OfInteger)& theOrders, const Handle(TColStd_HArray1OfInteger)& theSenses) { +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + BRepBuilderAPI_MakeFace aMakeFace (theSurf, Precision::Confusion()); +#else BRepBuilderAPI_MakeFace aMakeFace (theSurf); +#endif TopoDS_Face aFace = aMakeFace.Face(); aFace.EmptyCopy(); - TopoDS_Wire aWire; BRep_Builder aB; @@ -357,9 +358,9 @@ Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSu BRep_Tool::Range (anEdge, aF, aL); TopLoc_Location aLoc; aB.UpdateEdge (anEdge, theCurves2d->Value (aInd),aFace, 0.); - + aB.Range (anEdge, aFace, aF, aL); - + // Set orientation of the edge: orientation should be changed // if its orientation does not make sence with curve orientation // recommended by GeomPlate @@ -369,7 +370,6 @@ Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSu } aB.SameParameter(anEdge,Standard_False); aB.Add (aWire, anEdge); - Standard_Boolean isAdd = Standard_False; TopoDS_Shape aParent; if(!myEdgeFaces.Contains(anEdge)) continue; @@ -409,7 +409,7 @@ Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSu //======================================================================= //function : getResShape -//purpose : +//purpose : //======================================================================= void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, @@ -432,7 +432,6 @@ void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, aB.MakeShell(aTmpShell); TopTools_SequenceOfShape aseqShells; if(anhasShell) { - aB.Add(aTmpShell,theAddShape); Standard_Integer i =1; for( ; i <= aMapParent.Extent(); i++) { @@ -452,9 +451,8 @@ void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, TopoDS_Shape anshape = asfs->Shape(); myContext->Replace(aseqShells.Value(1),anshape); Standard_Integer i =2; - for( ; i<= aseqShells.Length(); i++) + for( ; i<= aseqShells.Length(); i++) myContext->Remove(aseqShells.Value(i)); - } else { TopoDS_Compound aComp; @@ -465,6 +463,5 @@ void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, aB.Add(aComp,aIt.Value()); aB.Add(aComp,theAddShape); myContext->Replace( oldshape,aComp); - } } diff --git a/src/ShHealOper/ShHealOper_FillHoles.hxx b/src/ShHealOper/ShHealOper_FillHoles.hxx index 473244023..9504973c1 100644 --- a/src/ShHealOper/ShHealOper_FillHoles.hxx +++ b/src/ShHealOper/ShHealOper_FillHoles.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_FillHoles.hxx // Created: 26.04.04 17:15:10 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_RemoveFace.cxx b/src/ShHealOper/ShHealOper_RemoveFace.cxx index 839a41267..d11850acd 100644 --- a/src/ShHealOper/ShHealOper_RemoveFace.cxx +++ b/src/ShHealOper/ShHealOper_RemoveFace.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_RemoveFace.cxx // Created: 16.04.04 12:12:38 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_RemoveFace.hxx b/src/ShHealOper/ShHealOper_RemoveFace.hxx index a93a43dfa..be87f1ada 100644 --- a/src/ShHealOper/ShHealOper_RemoveFace.hxx +++ b/src/ShHealOper/ShHealOper_RemoveFace.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_RemoveFace.hxx // Created: 15.04.04 18:10:16 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_RemoveInternalWires.cxx b/src/ShHealOper/ShHealOper_RemoveInternalWires.cxx index 87a463bdd..7ec7adf9c 100644 --- a/src/ShHealOper/ShHealOper_RemoveInternalWires.cxx +++ b/src/ShHealOper/ShHealOper_RemoveInternalWires.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_RemoveInternalWires.cxx // Created: 26.04.04 14:46:45 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_RemoveInternalWires.hxx b/src/ShHealOper/ShHealOper_RemoveInternalWires.hxx index fd684cc71..1667fbd12 100644 --- a/src/ShHealOper/ShHealOper_RemoveInternalWires.hxx +++ b/src/ShHealOper/ShHealOper_RemoveInternalWires.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_RemoveInternalWires.hxx // Created: 26.04.04 11:22:26 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_Sewing.cxx b/src/ShHealOper/ShHealOper_Sewing.cxx index c81ef5939..6974f5a6c 100644 --- a/src/ShHealOper/ShHealOper_Sewing.cxx +++ b/src/ShHealOper/ShHealOper_Sewing.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_Sewing.cxx // Created: 29.04.04 15:07:10 // Author: Galina KULIKOVA @@ -118,7 +119,7 @@ Standard_Boolean ShHealOper_Sewing::sewing(const TopTools_SequenceOfShape& theSe //analysis either sewing was made by changing number of shells myDone = isSewed(aSewShape); - //keep modification of the subshapes in the Context. + //keep modification of the sub-shapes in the Context. TopExp_Explorer aExp(myInitShape,TopAbs_FACE); for( ; aExp.More(); aExp.Next()) myDone = (getModifications( aExp.Current(),aSewing) || myDone); diff --git a/src/ShHealOper/ShHealOper_Sewing.hxx b/src/ShHealOper/ShHealOper_Sewing.hxx index 466cd7a3b..26640b5f9 100644 --- a/src/ShHealOper/ShHealOper_Sewing.hxx +++ b/src/ShHealOper/ShHealOper_Sewing.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_Sewing.hxx // Created: 29.04.04 13:29:10 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_ShapeProcess.cxx b/src/ShHealOper/ShHealOper_ShapeProcess.cxx index 8c8b1a324..4adbe27ac 100644 --- a/src/ShHealOper/ShHealOper_ShapeProcess.cxx +++ b/src/ShHealOper/ShHealOper_ShapeProcess.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_ShapeProcess.cxx // Created: 14.04.04 10:58:04 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_ShapeProcess.hxx b/src/ShHealOper/ShHealOper_ShapeProcess.hxx index ad6e74917..0f05f8407 100644 --- a/src/ShHealOper/ShHealOper_ShapeProcess.hxx +++ b/src/ShHealOper/ShHealOper_ShapeProcess.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_ShapeProcess.hxx // Created: 13.04.04 11:45:20 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_SpiltCurve2d.hxx b/src/ShHealOper/ShHealOper_SpiltCurve2d.hxx index 9e4b5c07b..52fef06d7 100644 --- a/src/ShHealOper/ShHealOper_SpiltCurve2d.hxx +++ b/src/ShHealOper/ShHealOper_SpiltCurve2d.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_SplitCurve2d.hxx // Created: 05.05.04 12:56:01 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_SplitCurve2d.cxx b/src/ShHealOper/ShHealOper_SplitCurve2d.cxx index 4e495f9e1..e89520e22 100644 --- a/src/ShHealOper/ShHealOper_SplitCurve2d.cxx +++ b/src/ShHealOper/ShHealOper_SplitCurve2d.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_SplitCurve2d.cxx // Created: 05.05.04 13:03:10 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_SplitCurve2d.hxx b/src/ShHealOper/ShHealOper_SplitCurve2d.hxx index cd9d87c6c..179ec0cac 100644 --- a/src/ShHealOper/ShHealOper_SplitCurve2d.hxx +++ b/src/ShHealOper/ShHealOper_SplitCurve2d.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_SplitCurve2d.hxx // Created: 05.05.04 12:56:01 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_SplitCurve3d.cxx b/src/ShHealOper/ShHealOper_SplitCurve3d.cxx index f7286e2e1..16833bdeb 100644 --- a/src/ShHealOper/ShHealOper_SplitCurve3d.cxx +++ b/src/ShHealOper/ShHealOper_SplitCurve3d.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_SplitCurve3d.cxx // Created: 05.05.04 12:48:36 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_SplitCurve3d.hxx b/src/ShHealOper/ShHealOper_SplitCurve3d.hxx index 743124513..22fa4929d 100644 --- a/src/ShHealOper/ShHealOper_SplitCurve3d.hxx +++ b/src/ShHealOper/ShHealOper_SplitCurve3d.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_SplitCurve3d.hxx // Created: 05.05.04 12:28:13 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_Tool.cxx b/src/ShHealOper/ShHealOper_Tool.cxx index e0f394756..ed741cc6e 100644 --- a/src/ShHealOper/ShHealOper_Tool.cxx +++ b/src/ShHealOper/ShHealOper_Tool.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_Tool.cxx // Created: 26.04.04 12:11:33 // Author: Galina KULIKOVA diff --git a/src/ShHealOper/ShHealOper_Tool.hxx b/src/ShHealOper/ShHealOper_Tool.hxx index 502a60f1a..f89da9a50 100644 --- a/src/ShHealOper/ShHealOper_Tool.hxx +++ b/src/ShHealOper/ShHealOper_Tool.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: ShHealOper_Tool.hxx // Created: 26.04.04 11:36:04 // Author: Galina KULIKOVA diff --git a/src/ShapeRecognition/Makefile.am b/src/ShapeRecognition/Makefile.am new file mode 100644 index 000000000..4d7017204 --- /dev/null +++ b/src/ShapeRecognition/Makefile.am @@ -0,0 +1,50 @@ +# Copyright (C) 2007-2012 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 +# + +# GEOM ShapeRecognition : tools for the shape recognition +# File : Makefile.am +# Author : Renaud NEDELEC (OCC) +# Module : GEOM +# + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# header files +salomeinclude_HEADERS = \ + ShapeRec_FeatureDetector.hxx + +# Libraries targets +lib_LTLIBRARIES = libGEOMShapeRec.la + +dist_libGEOMShapeRec_la_SOURCES = \ + ShapeRec_FeatureDetector.cxx + +# additional information to compile and link file + +libGEOMShapeRec_la_CPPFLAGS = \ + $(KERNEL_CXXFLAGS)\ + $(OPENCV_INCLUDES)\ + $(QT_INCLUDES) + + +libGEOMShapeRec_la_LDFLAGS = \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ + $(STDLIB) \ + $(OPENCV_LIBS) \ + $(QT_MT_LIBS) diff --git a/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx new file mode 100644 index 000000000..b405135e5 --- /dev/null +++ b/src/ShapeRecognition/ShapeRec_FeatureDetector.cxx @@ -0,0 +1,313 @@ +// Copyright (C) 2007-2012 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 +// + +// File : ShapeRec_FeatureDetector.cxx +// Author : Renaud NEDELEC, Open CASCADE S.A.S. + +#include "ShapeRec_FeatureDetector.hxx" +#include +#include "utilities.h" + +using namespace cv; + +//TODO : All the following methods but ComputeContours use the C API of OpenCV while ComputContours +// uses the C++ API of the library. +// This should be homogenized and preferably by using the C++ API (which is more recent for all the methods + +// The code has to be "cleaned up" too + +/*! + Constructor + \param theFilename - image to process +*/ +ShapeRec_FeatureDetector::ShapeRec_FeatureDetector(): + corners() +{ + cornerCount = 2000; + rect=cvRect(0,0,0,0); + imagePath = ""; //theFilename; + // Store the dimensions of the picture + imgHeight = 0; + imgWidth = 0; +} + +/*! + Sets the path of the image file to be processed + \param thePath - Location of the image file +*/ +void ShapeRec_FeatureDetector::SetPath( const std::string& thePath ) +{ + imagePath = thePath; + if (imagePath != "") + { + IplImage* src = cvLoadImage(imagePath.c_str(),CV_LOAD_IMAGE_COLOR); + imgHeight = src->height; + imgWidth = src->width; + } +} + +/*! + Computes the corners of the image located at imagePath +*/ +void ShapeRec_FeatureDetector::ComputeCorners(){ + + // Parameters for the corner detection + double qualityLevel = 0.2; + double minDistance = 1; + + // Images to be used for detection + IplImage *eig_img, *temp_img, *src_img_gray; + + // Load image + src_img_gray = cvLoadImage (imagePath.c_str(), CV_LOAD_IMAGE_GRAYSCALE); + + if ( rect.width > 1 ) + { + // If a ROI as been set use it for detection + cvSetImageROI( src_img_gray, rect ); + } + + eig_img = cvCreateImage (cvGetSize (src_img_gray), IPL_DEPTH_32F, 1); + temp_img = cvCreateImage (cvGetSize (src_img_gray), IPL_DEPTH_32F, 1); + corners = (CvPoint2D32f *) cvAlloc (cornerCount * sizeof (CvPoint2D32f)); + + // image height and width + imgHeight = src_img_gray->height; + imgWidth = src_img_gray->width; + + // Corner detection using cvCornerMinEigenVal + // (one of the methods available inOpenCV, there is also a cvConerHarris method that can be used by setting a flag in cvGoodFeaturesToTrack) + cvGoodFeaturesToTrack (src_img_gray, eig_img, temp_img, corners, &cornerCount, /*quality-level=*/qualityLevel, /*min-distance=*/minDistance); + cvFindCornerSubPix (src_img_gray, corners, cornerCount, + cvSize (3, 3), cvSize (-1, -1), cvTermCriteria (CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.03)); + + cvReleaseImage (&eig_img); + cvReleaseImage (&temp_img); + cvReleaseImage (&src_img_gray); + +} + +/*! + Computes the contours of the image located at imagePath +*/ +bool ShapeRec_FeatureDetector::ComputeContours( int detection_method ){ + + // Initialising images + Mat src, src_gray; + Mat detected_edges; + + // Read image + src = imread( imagePath.c_str() ); + if( !src.data ) + return false; + + if ( detection_method == CANNY ) // The problem is that with that filter the detector detects double contours + { + // Thresholds for Canny detector + int lowThreshold = 100; + int ratio = 3; + int kernel_size = 3; // 3,5 or 7 + + // Convert the image to grayscale + if (src.channels() == 3) + cvtColor( src, src_gray, CV_BGR2GRAY ); + else if (src.channels() == 1) + src_gray = src; + + // Reduce noise with a kernel 3x3 + blur( src_gray, detected_edges, Size(3,3) ); + // Canny detector + Canny( detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size, /*L2gradient =*/true ); + } + else if ( detection_method == COLORFILTER ) + { + if ( !rect.width > 1 ) + return false; + detected_edges = _colorFiltering(); + } + else if ( detection_method == RIDGE_DETECTOR ) // Method adapted for engineering drawings (e.g. watershed functionnality could be used here cf.OpenCV documentation and samples) + { + // TODO + return false; + } + _detectAndRetrieveContours( detected_edges ); + + return true; + +} + +/*! + Computes the lines in the image located at imagePath +*/ +bool ShapeRec_FeatureDetector::ComputeLines(){ + MESSAGE("ShapeRec_FeatureDetector::ComputeLines()") + // Initialising images + Mat src, src_gray, detected_edges, dst; + + src=imread(imagePath.c_str(), 0); + + Canny( src, dst, 50, 200, 3 ); + HoughLinesP( dst, lines, 1, CV_PI/180, 80, 30, 10 ); + return true; + +} + +/*! + Stores a region of interest given by user in rect + \param theRect - Region Of Interest of the image located at imagePath +*/ +void ShapeRec_FeatureDetector::SetROI( const QRect& theRect ) +{ + if (!theRect.isEmpty()){ + rect = cvRect(theRect.x(),theRect.y(),theRect.width(),theRect.height()); + } +} + +/*! + Crops the image located at imagePath to the region of interest given by the user via SetROI + and stores the result in /tmp + \param theRect - Region Of Interest of the image located at imagePath +*/ +std::string ShapeRec_FeatureDetector::CroppImage() +{ + IplImage* src = cvLoadImage(imagePath.c_str(),CV_LOAD_IMAGE_COLOR); + + cvSetImageROI(src, rect); + IplImage* cropped_image = cvCreateImage(cvGetSize(src), + src->depth, + src->nChannels); + cvCopy(src, cropped_image, NULL); + cvResetImageROI(src); + + cvSaveImage ("/tmp/cropped_image.bmp", cropped_image); + + return "/tmp/cropped_image.bmp"; +} + + +/*! + Performs contours detection and store them in contours + \param binaryImg - src image to find contours of +*/ +void ShapeRec_FeatureDetector::_detectAndRetrieveContours( Mat binaryImg ) +{ + binaryImg = binaryImg > 1; + int method = CV_CHAIN_APPROX_NONE; + findContours( binaryImg, contours, hierarchy,CV_RETR_CCOMP, method); + // Other possible approximations CV_CHAIN_APPROX_TC89_KCOS, CV_CHAIN_APPROX_TC89_L1, CV_CHAIN_APPROX_SIMPLE cf. OpenCV documentation + // for precise information +} + +/*! + Performs color filtering from the image sample contained in the ROI rect of the image + located at imagePath + Thresholds the result in order ot obtain a binary image + \return binary image resulting from filtering and thersholding +*/ +Mat ShapeRec_FeatureDetector::_colorFiltering() +{ + IplImage* find_image = cvLoadImage(imagePath.c_str(),CV_LOAD_IMAGE_COLOR); + // Reduce noise with a kernel 3x3 + cvSmooth( find_image, find_image, CV_GAUSSIAN, 3, 3 ); + + if ( !rect.width > 1 ) + return Mat(find_image); + + // Crop the image to build an histogram from the selected part + cvSetImageROI(find_image, rect); + IplImage* test_image = cvCreateImage(cvGetSize(find_image), + find_image->depth, + find_image->nChannels); + cvCopy(find_image, test_image, NULL); + cvResetImageROI(find_image); + + IplImage* test_hsv = cvCreateImage(cvGetSize(test_image),8,3); + IplImage* h_plane = cvCreateImage( cvGetSize(test_image), 8, 1 ); + IplImage* s_plane = cvCreateImage( cvGetSize(test_image), 8, 1 ); + CvHistogram* hist; + + cvCvtColor(test_image, test_hsv, CV_BGR2HSV); + + cvCvtPixToPlane(test_hsv, h_plane, s_plane, 0, 0); + IplImage* planes[] = { h_plane, s_plane }; + + //create hist + int hbins = 30, sbins = 32; // TODO think to the best values here + int hist_size[] = { hbins, sbins }; + float hranges[] = { 0, 180 }; + float sranges[] = { 0, 255 }; + float* ranges[] = { hranges, sranges }; + hist = cvCreateHist(2, hist_size, CV_HIST_ARRAY, ranges, 1); + + //calculate hue /saturation histogram + cvCalcHist(planes, hist, 0 ,0); + +// // TEST print of the histogram for debugging +// IplImage* hist_image = cvCreateImage(cvSize(320,300),8,3); +// +// //draw hist on hist_test image. +// cvZero(hist_image); +// float max_value = 0; +// cvGetMinMaxHistValue(hist, 0 , &max_value, 0, 0); +// int bin_w = hist_image->width/size_hist; +// for(int i = 0; i < size_hist; i++ ) +// { +// //prevent overflow +// int val = cvRound( cvGetReal1D(hist->bins,i)*hist_image-> +// height/max_value); +// CvScalar color = CV_RGB(200,0,0); +// //hsv2rgb(i*180.f/size_hist); +// cvRectangle( hist_image, cvPoint(i*bin_w,hist_image->height), +// cvPoint((i+1)*bin_w,hist_image->height - val), +// color, -1, 8, 0 ); +// } +// +// +// cvNamedWindow("hist", 1); cvShowImage("hist",hist_image); + + + //calculate back projection of hue and saturation planes of input image + IplImage* backproject = cvCreateImage(cvGetSize(find_image), 8, 1); + IplImage* binary_backproject = cvCreateImage(cvGetSize(find_image), 8, 1); + IplImage* find_hsv = cvCreateImage(cvGetSize(find_image),8,3); + IplImage* find_hplane = cvCreateImage(cvGetSize(find_image),8,1); + IplImage* find_splane = cvCreateImage(cvGetSize(find_image),8,1); + + cvCvtColor(find_image, find_hsv, CV_BGR2HSV); + cvCvtPixToPlane(find_hsv, find_hplane, find_splane, 0, 0); + IplImage* find_planes[] = { find_hplane, find_splane }; + cvCalcBackProject(find_planes, backproject, hist); + + // Threshold in order to obtain binary image + cvThreshold(backproject, binary_backproject, 1, 255, CV_THRESH_BINARY); // NOTE it would be good to think about the best threshold to use (it's 1 for now) + cvReleaseImage(&test_image); + cvReleaseImage(&test_hsv); + cvReleaseImage(&h_plane); + cvReleaseImage(&s_plane); + cvReleaseImage(&find_image); + cvReleaseImage(&find_hsv); + cvReleaseImage(&find_hplane); + cvReleaseImage(&find_splane); + cvReleaseImage(&backproject); + + return Mat(binary_backproject); +} diff --git a/src/ShapeRecognition/ShapeRec_FeatureDetector.hxx b/src/ShapeRecognition/ShapeRec_FeatureDetector.hxx new file mode 100644 index 000000000..c4b050bde --- /dev/null +++ b/src/ShapeRecognition/ShapeRec_FeatureDetector.hxx @@ -0,0 +1,82 @@ +// Copyright (C) 2007-2012 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 +// + +// File : ShapeRec_FeatureDetector.h +// Author : Renaud NEDELEC, Open CASCADE S.A.S. + +// OpenCV includes +#include +#include +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui/highgui.hpp" + +// Qt +#include + +enum // Method used for contour detection +{ + CANNY, + COLORFILTER, + RIDGE_DETECTOR +}; + +class ShapeRec_FeatureDetector +{ +public: + + typedef std::vector CvContour; + typedef std::vector > CvContoursArray; + + ShapeRec_FeatureDetector(); // Constructor + + void SetPath( const std::string& ); // Sets the image path + void SetROI( const QRect& ); // Sets a Region Of Interest in the image + CvPoint2D32f* GetCorners() { return corners; }; + CvContoursArray GetContours() { return contours; }; + std::vector GetLines() { return lines; }; + std::vector GetContoursHierarchy() { return hierarchy; }; + int GetCornerCount() { return cornerCount; }; + int GetImgHeight() { return imgHeight; }; + int GetImgWidth() { return imgWidth; }; + + std::string CroppImage(); + void ComputeCorners(); // Detects the corners from the image located at imagePath + bool ComputeLines(); // Detects the lines from the image located at imagePath + bool ComputeContours( int method ); // Detects the contours from the image located at imagePath + + +private: + std::string imagePath; + + CvPoint2D32f* corners; + int cornerCount; + + CvContoursArray contours; + std::vector hierarchy; + std::vector lines; + int imgHeight; + int imgWidth; + CvRect rect; + + void _detectAndRetrieveContours( cv::Mat binaryImg ); + cv::Mat _colorFiltering(); +}; diff --git a/src/TransformationGUI/Makefile.am b/src/TransformationGUI/Makefile.am index 4a3725c81..c8f0c2980 100644 --- a/src/TransformationGUI/Makefile.am +++ b/src/TransformationGUI/Makefile.am @@ -1,29 +1,26 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2012 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 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. # -# 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 # -# 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 # -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# GEOM TRANSFORMATIONGUI : + # File : Makefile.am # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Package : TransformationGUI -# + include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files @@ -36,6 +33,7 @@ salomeinclude_HEADERS = \ TransformationGUI_MirrorDlg.h \ TransformationGUI_ScaleDlg.h \ TransformationGUI_OffsetDlg.h \ + TransformationGUI_ProjectionDlg.h \ TransformationGUI_PositionDlg.h # Libraries targets @@ -50,6 +48,7 @@ dist_libTransformationGUI_la_SOURCES = \ TransformationGUI_MirrorDlg.h \ TransformationGUI_ScaleDlg.h \ TransformationGUI_OffsetDlg.h \ + TransformationGUI_ProjectionDlg.h \ TransformationGUI_PositionDlg.h \ \ TransformationGUI.cxx \ @@ -60,6 +59,7 @@ dist_libTransformationGUI_la_SOURCES = \ TransformationGUI_MirrorDlg.cxx \ TransformationGUI_ScaleDlg.cxx \ TransformationGUI_OffsetDlg.cxx \ + TransformationGUI_ProjectionDlg.cxx \ TransformationGUI_PositionDlg.cxx MOC_FILES = \ @@ -70,6 +70,7 @@ MOC_FILES = \ TransformationGUI_MirrorDlg_moc.cxx \ TransformationGUI_ScaleDlg_moc.cxx \ TransformationGUI_OffsetDlg_moc.cxx \ + TransformationGUI_ProjectionDlg_moc.cxx \ TransformationGUI_PositionDlg_moc.cxx nodist_libTransformationGUI_la_SOURCES = \ @@ -95,9 +96,9 @@ libTransformationGUI_la_CPPFLAGS = \ -I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMFiltersSelection \ -I$(top_builddir)/src/DlgRef \ - -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/idl libTransformationGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ - ../GEOMBase/libGEOMBase.la + ../GEOMBase/libGEOMBase.la \ + $(CAS_LDPATH) -lTKShHealing diff --git a/src/TransformationGUI/TransformationGUI.cxx b/src/TransformationGUI/TransformationGUI.cxx index 136102503..e18967620 100644 --- a/src/TransformationGUI/TransformationGUI.cxx +++ b/src/TransformationGUI/TransformationGUI.cxx @@ -1,32 +1,34 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. -// + #include "TransformationGUI.h" #include #include +#include "GeometryGUI_Operations.h" #include #include @@ -44,6 +46,7 @@ #include "TransformationGUI_MirrorDlg.h" // Method MIRROR #include "TransformationGUI_ScaleDlg.h" // Method SCALE #include "TransformationGUI_OffsetDlg.h" // Method OFFSET +#include "TransformationGUI_ProjectionDlg.h" // Method PROJECTION #include "TransformationGUI_PositionDlg.h" // Method POSITION //======================================================================= @@ -77,31 +80,34 @@ bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; switch ( theCommandID ) { - case 5021: // TRANSLATION + case GEOMOp::OpTranslate: // TRANSLATION aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent ); break; - case 5022: // ROTATION + case GEOMOp::OpRotate: // ROTATION aDlg = new TransformationGUI_RotationDlg( getGeometryGUI(), parent ); break; - case 5023: // POSITION + case GEOMOp::OpChangeLoc: // POSITION aDlg = new TransformationGUI_PositionDlg( getGeometryGUI(), parent ); break; - case 5024: // MIRROR + case GEOMOp::OpMirror: // MIRROR aDlg = new TransformationGUI_MirrorDlg( getGeometryGUI(), parent ); break; - case 5025: // SCALE + case GEOMOp::OpScale: // SCALE aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent ); break; - case 5026: // OFFSET + case GEOMOp::OpOffset: // OFFSET aDlg = new TransformationGUI_OffsetDlg( getGeometryGUI(), parent ); break; - case 5027: // MULTI TRANSLATION + case GEOMOp::OpProjection: // PROJECTION + aDlg = new TransformationGUI_ProjectionDlg( getGeometryGUI(), parent ); + break; + case GEOMOp::OpMultiTranslate: // MULTI TRANSLATION aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent ); break; - case 5028: // MULTI ROTATION + case GEOMOp::OpMultiRotate: // MULTI ROTATION aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent ); break; - case 5029: // RELOAD IMPORTED SHAPE + case GEOMOp::OpReimport: // RELOAD IMPORTED SHAPE { SalomeApp_Study* anAppStudy = dynamic_cast(app->activeStudy()); @@ -120,9 +126,8 @@ bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) SALOME_ListIteratorOfListIO aSelIt (aSelList); for (; aSelIt.More(); aSelIt.Next()) { Handle(SALOME_InteractiveObject) io = aSelIt.Value(); - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject(io, testResult); - if (testResult) { + GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( io ); + if ( !CORBA::is_nil( aGeomObj ) ) { anOp->RecomputeObject(aGeomObj); SUIT_ViewWindow* wnd; @@ -133,7 +138,8 @@ bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) if (SUIT_ViewModel* vmodel = vman->getViewModel()) { if (SALOME_View* view = dynamic_cast(vmodel)) { if (view->isVisible(io)) { - aDisp.Erase(io, false, false, view); + aDisp.Erase(io, true, false, view); + getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( getGeometryGUI()->getApp()->orb()->object_to_string( aGeomObj.in() ) ); aDisp.Display(io, true, view); } // ? Redisplay subshapes ? diff --git a/src/TransformationGUI/TransformationGUI.h b/src/TransformationGUI/TransformationGUI.h index 41c1967ae..fcb4240ee 100644 --- a/src/TransformationGUI/TransformationGUI.h +++ b/src/TransformationGUI/TransformationGUI.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI.h // Author : Damien COQUERET, Open CASCADE S.A.S. diff --git a/src/TransformationGUI/TransformationGUI.pro b/src/TransformationGUI/TransformationGUI.pro deleted file mode 100644 index 6d04e6bf0..000000000 --- a/src/TransformationGUI/TransformationGUI.pro +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = lib -TARGET = TransformationGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -VTK_INCLUDES = $$(VTKHOME)/include/vtk - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -GUI_CXXFLAGS = $$(GUI_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -INCLUDEPATH += $${QT_INCLUDES} $${VTK_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${GUI_CXXFLAGS} $${CORBA_INCLUDES} ../GEOMGUI ../DlgRef ../GEOMBase ../OBJECT ../GEOMClient ../GEOMImpl ../GEOMFiltersSelection $$(GEOM_ROOT_DIR)/idl $$(GEOM_ROOT_DIR)/salome_adm/unix - -LIBS += -L$$(GEOM_ROOT_DIR)/lib -lGEOMFiltersSelection -lGEOMBase - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -SOURCES = TransformationGUI.cxx -SOURCES += TransformationGUI_MultiTranslationDlg.cxx -SOURCES += TransformationGUI_MultiRotationDlg.cxx -SOURCES += TransformationGUI_TranslationDlg.cxx -SOURCES += TransformationGUI_RotationDlg.cxx -SOURCES += TransformationGUI_MirrorDlg.cxx -SOURCES += TransformationGUI_ScaleDlg.cxx -SOURCES += TransformationGUI_OffsetDlg.cxx -SOURCES += TransformationGUI_PositionDlg.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index 4e3abf683..635935a05 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_MirrorDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -91,7 +92,7 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg (GeometryGUI* theGeomet // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); - CreateCopyModeChanged(true); + CreateCopyModeChanged(); Init(); } @@ -118,7 +119,8 @@ void TransformationGUI_MirrorDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myArgument = GEOM::GEOM_Object::_nil(); + myObjects.clear(); + myArgument.nullify(); mainFrame()->GroupBoxPublish->show(); @@ -131,14 +133,12 @@ void TransformationGUI_MirrorDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged())); initName(tr("GEOM_MIRROR")); ConstructorsClicked(0); + resize(minimumSizeHint()); } //================================================================================= @@ -150,7 +150,7 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked (int constructorId) disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); GroupPoints->LineEdit2->clear(); - myArgument = GEOM::GEOM_Object::_nil(); + myArgument.nullify(); switch (constructorId) { case 0: // mirror an object by point @@ -171,7 +171,7 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked (int constructorId) SelectionIntoArgument(); } else { - displayPreview(); + processPreview(); } } @@ -181,6 +181,7 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked (int constructorId) //================================================================================= void TransformationGUI_MirrorDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -195,8 +196,11 @@ bool TransformationGUI_MirrorDlg::ClickOnApply() return false; initName(); + // activate selection and connect selection manager ConstructorsClicked(getConstructorId()); + SelectionIntoArgument(); + return true; } @@ -207,93 +211,37 @@ bool TransformationGUI_MirrorDlg::ClickOnApply() void TransformationGUI_MirrorDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myObjects.length(0); - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myArgument = GEOM::GEOM_Object::_nil(); - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - QString aName; - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName); - if (aNbSel < 1) - return; - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects); - if (!myObjects.length()) - return; - else - myEditCurrentArgument->setText(aName); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myObjects = getSelected( TopAbs_SHAPE, -1 ); + if ( !myObjects.isEmpty() ) { + QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } + else { + myEditCurrentArgument->setText(""); + } } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - myArgument = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult || CORBA::is_nil(myArgument)) - return; - - aName = GEOMBase::GetName(myArgument); - - if (testResult && !myArgument->_is_nil()) { - TopoDS_Shape aShape; - if (GEOMBase::GetShape(myArgument, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (getConstructorId() == 1) - aNeedType = TopAbs_EDGE; - else if (getConstructorId() == 2) - aNeedType = TopAbs_FACE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - if (aNeedType == TopAbs_VERTEX) - aName += QString(":vertex_%1").arg(anIndex); - else - aName += QString(":edge_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(myArgument, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - myArgument = aShapesOp->GetSubShape(myArgument, anIndex); - } - else { - myArgument = aFindedObject; // get Object from study - } - } - else { - if (aShape.ShapeType() != aNeedType) { - myArgument = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } + else { + TopAbs_ShapeEnum aNeedType = ( getConstructorId() == 1 ) ? + TopAbs_EDGE : ( ( getConstructorId() == 2 ) ? TopAbs_FACE : TopAbs_VERTEX ); + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + myArgument = aSelectedObject; + if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + } + else { + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + myArgument.nullify(); + myEditCurrentArgument->setText(""); } - myEditCurrentArgument->setText(aName); - - if (!myArgument->_is_nil() && !myObjects.length()) - GroupPoints->PushButton1->click(); } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -325,6 +273,7 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() break; case 2: globalSelection(GEOM_PLANE); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); break; } @@ -341,21 +290,7 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_MirrorDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -366,7 +301,7 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -396,7 +331,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation() //================================================================================= bool TransformationGUI_MirrorDlg::isValid (QString& /*msg*/) { - return !(myObjects.length() == 0 || myArgument->_is_nil()); + return !myObjects.isEmpty() && myArgument; } //================================================================================= @@ -410,21 +345,21 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MirrorPointCopy(myObjects[i], myArgument); + for (int i = 0; i < myObjects.count(); i++) { + anObj = anOper->MirrorPointCopy(myObjects[i].get(), myArgument.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } } else { - for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MirrorPoint(myObjects[i], myArgument); + for (int i = 0; i < myObjects.count(); i++) { + anObj = anOper->MirrorPoint(myObjects[i].get(), myArgument.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -435,17 +370,15 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects) case 1: { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MirrorAxisCopy(myObjects[i], myArgument); + for (int i = 0; i < myObjects.count(); i++) { + anObj = anOper->MirrorAxisCopy(myObjects[i].get(), myArgument.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } } else { - for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MirrorAxis(myObjects[i], myArgument); + for (int i = 0; i < myObjects.count(); i++) { + anObj = anOper->MirrorAxis(myObjects[i].get(), myArgument.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -456,17 +389,15 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects) case 2: { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MirrorPlaneCopy(myObjects[i], myArgument); + for (int i = 0; i < myObjects.count(); i++) { + anObj = anOper->MirrorPlaneCopy(myObjects[i].get(), myArgument.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } } else { - for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MirrorPlane(myObjects[i], myArgument); + for (int i = 0; i < myObjects.count(); i++) { + anObj = anOper->MirrorPlane(myObjects[i].get(), myArgument.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -490,7 +421,8 @@ void TransformationGUI_MirrorDlg::restoreSubShapes (SALOMEDS::Study_ptr theStu // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true); + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); } } @@ -498,9 +430,9 @@ void TransformationGUI_MirrorDlg::restoreSubShapes (SALOMEDS::Study_ptr theStu // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_MirrorDlg::CreateCopyModeChanged (bool isCreateCopy) +void TransformationGUI_MirrorDlg::CreateCopyModeChanged() { - mainFrame()->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled(GroupPoints->CheckButton1->isChecked()); } //================================================================================= @@ -511,18 +443,14 @@ void TransformationGUI_MirrorDlg::addSubshapesToStudy() { bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); if (toCreateCopy) { - QMap objMap; - switch (getConstructorId()) { case 0: - objMap[GroupPoints->LineEdit2->text()] = myArgument; - break; case 1: - objMap[GroupPoints->LineEdit2->text()] = myArgument; - break; case 2: - return; + GEOMBase::PublishSubObject( myArgument.get() ); + break; + default: + break; } - addSubshapesToFather(objMap); } } diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.h b/src/TransformationGUI/TransformationGUI_MirrorDlg.h index 668254090..2a114d2c6 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.h +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_MirrorDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef TRANSFORMATIONGUI_MIRRORDLG_H #define TRANSFORMATIONGUI_MIRRORDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel1Spin2Check; @@ -40,7 +42,7 @@ class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton public: TransformationGUI_MirrorDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_MirrorDlg(); protected: @@ -56,8 +58,8 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myArgument; - GEOM::ListOfGO myObjects; + GEOM::GeomObjPtr myArgument; + QList myObjects; // to initialize the first selection field with a selected object on the dialog creation bool myInitial; @@ -68,11 +70,10 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); - void CreateCopyModeChanged( bool ); + void CreateCopyModeChanged(); }; #endif // TRANSFORMATIONGUI_MIRRORDLG_H diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 80d028e25..f450a2f8c 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -1,28 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : TransformationGUI_MultiRotationDlg.cxx -// Author : Damien COQUERET, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_MultiRotationDlg.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. + #include "TransformationGUI_MultiRotationDlg.h" #include @@ -70,7 +69,7 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - GroupPoints = new DlgRef_2Sel1Spin(centralWidget()); + GroupPoints = new DlgRef_2Sel1SpinInt(centralWidget()); GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE")); GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); @@ -124,28 +123,25 @@ void TransformationGUI_MultiRotationDlg::Init() SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); - double SpecificStep1 = 5; - double SpecificStep2 = 1; + int SpecificStep1 = 5; + int SpecificStep2 = 1; + // init variables + myAng = 45.0; + myStep = 50.0; + myNbTimes1 = myNbTimes2 = 2; + // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints->SpinBox_DX, 1.0, 999, SpecificStep2, 10); + initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2); GroupPoints->SpinBox_DX->setValue(myNbTimes1); - GroupPoints->SpinBox_DX->setDecimals(0); - initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 10); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY1, 1.0, 999, SpecificStep2, 10); - initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY2, 1.0, 999, SpecificStep2, 10); + initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep2); + initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step,"length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep2); GroupDimensions->SpinBox_DX1->setValue(myAng); GroupDimensions->SpinBox_DY1->setValue(myNbTimes1); GroupDimensions->SpinBox_DX2->setValue(myStep); GroupDimensions->SpinBox_DY2->setValue(myNbTimes2); - GroupDimensions->SpinBox_DY1->setDecimals(0); - GroupDimensions->SpinBox_DY2->setDecimals(0); - - // init variables - myAng = 45.0; - myStep = 50.0; - myNbTimes1 = myNbTimes2 = 2; GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); @@ -153,7 +149,10 @@ void TransformationGUI_MultiRotationDlg::Init() GroupDimensions->LineEdit1->setText(""); GroupDimensions->LineEdit2->setText(""); - myBase = myVector = GEOM::GEOM_Object::_nil(); + myBase.nullify(); + myVector.nullify(); + + mainFrame()->GroupBoxPublish->show(); // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -166,16 +165,11 @@ void TransformationGUI_MultiRotationDlg::Init() connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )), this, SLOT(TextValueChangedInSpinBox( const QString& ))); @@ -195,11 +189,13 @@ void TransformationGUI_MultiRotationDlg::Init() //================================================================================= void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step) { - GroupPoints->SpinBox_DX->setSingleStep(step); - GroupDimensions->SpinBox_DX1->setSingleStep(step); - GroupDimensions->SpinBox_DY1->setSingleStep(step); GroupDimensions->SpinBox_DX2->setSingleStep(step); - GroupDimensions->SpinBox_DY2->setSingleStep(step); + + // san: Commented so as not to override specific step settings + //GroupPoints->SpinBox_DX->setSingleStep((int)step); + //GroupDimensions->SpinBox_DX1->setSingleStep(step); + //GroupDimensions->SpinBox_DY1->setSingleStep((int)step); + //GroupDimensions->SpinBox_DY2->setSingleStep((int)step); } //================================================================================= @@ -218,7 +214,8 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId) GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myBase = myVector = GEOM::GEOM_Object::_nil(); + myBase.nullify(); + myVector.nullify(); GroupPoints->SpinBox_DX->setValue(myNbTimes1); @@ -232,7 +229,8 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId) GroupDimensions->LineEdit1->setText(""); GroupDimensions->LineEdit2->setText(""); - myBase = myVector = GEOM::GEOM_Object::_nil(); + myBase.nullify(); + myVector.nullify(); GroupDimensions->SpinBox_DX1->setValue(myAng); GroupDimensions->SpinBox_DY1->setValue(myNbTimes1); @@ -253,7 +251,7 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId) SelectionIntoArgument(); } else { - displayPreview(); + processPreview(); } } @@ -263,6 +261,7 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId) //================================================================================= void TransformationGUI_MultiRotationDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -289,93 +288,53 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply() void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); - - if (myEditCurrentArgument == GroupPoints->LineEdit1 || - myEditCurrentArgument == GroupDimensions->LineEdit1) - myBase = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2) - myVector = GEOM::GEOM_Object::_nil(); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - - if (myEditCurrentArgument == GroupPoints->LineEdit1 || - myEditCurrentArgument == GroupDimensions->LineEdit1) - myBase = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2) { - TopoDS_Shape aShape; - - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName += QString(":edge_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - myVector = aFindedObject; // get existing object - } - } - else { - if (aShape.ShapeType() != TopAbs_EDGE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - myVector = aSelectedObject; - } - } - } - myEditCurrentArgument->setText(aName); - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - if (!myBase->_is_nil() && myVector->_is_nil()) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - if (!myVector->_is_nil() && myBase->_is_nil()) - GroupPoints->PushButton1->click(); - } - else if (myEditCurrentArgument == GroupDimensions->LineEdit1) { - if (!myBase->_is_nil() && myVector->_is_nil()) - GroupDimensions->PushButton2->click(); + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 ) ? + TopAbs_EDGE : TopAbs_SHAPE; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myBase = aSelectedObject; + if ( !myVector ) + GroupPoints->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2) { + myVector = aSelectedObject; + if ( !myBase ) + GroupPoints->PushButton1->click(); + } + else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) { + myBase = aSelectedObject; + if ( !myVector ) + GroupDimensions->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupDimensions->LineEdit2 ) { + myVector = aSelectedObject; + if ( !myBase ) + GroupDimensions->PushButton1->click(); + } + + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); } - else if (myEditCurrentArgument == GroupDimensions->LineEdit2) { - if (!myVector->_is_nil() && myBase->_is_nil()) - GroupDimensions->PushButton1->click(); + else { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1 ) + myBase.nullify(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 ) + myVector.nullify(); + myEditCurrentArgument->setText(""); } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -427,21 +386,7 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || - send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -452,7 +397,7 @@ void TransformationGUI_MultiRotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -478,6 +423,7 @@ void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString GroupDimensions->CheckButton1->setChecked(false); GroupDimensions->CheckButton1->setEnabled(isDigit); } + //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -486,16 +432,28 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (double newValue) { QObject* send = (QObject*)sender(); - if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1) - myNbTimes1 = (int)newValue; - else if (send == GroupDimensions->SpinBox_DX1) + if (send == GroupDimensions->SpinBox_DX1) myAng = newValue; else if (send == GroupDimensions->SpinBox_DX2) myStep = newValue; + + processPreview(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (int newValue) +{ + QObject* send = (QObject*)sender(); + + if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1) + myNbTimes1 = newValue; else if (send == GroupDimensions->SpinBox_DY2) - myNbTimes2 = (int)newValue; + myNbTimes2 = newValue; - displayPreview(); + processPreview(); } //================================================================================= @@ -508,12 +466,10 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle() int aConstructorId = getConstructorId(); - if (aConstructorId == 0) - GroupPoints->SpinBox_DX->setValue(myAng); - else if (aConstructorId == 1) + if (aConstructorId == 1) GroupDimensions->SpinBox_DX1->setValue(myAng); - displayPreview(); + processPreview(); } //================================================================================= @@ -531,19 +487,22 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation() //================================================================================= bool TransformationGUI_MultiRotationDlg::isValid (QString& msg) { - bool ok = true; + bool ok = false; switch(getConstructorId()){ case 0: - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && myBase && myVector; + break; + case 1: + ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && + myBase && myVector; break; - case 1: - ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok; + default: break; } - return !(myBase->_is_nil() || myVector->_is_nil()) && ok; + return ok; } //================================================================================= @@ -557,20 +516,20 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; QStringList aParameters; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MultiRotate1D(myBase, myVector, myNbTimes1); + if ( myBase && myVector ) { + anObj = anOper->MultiRotate1D(myBase.get(), myVector.get(), myNbTimes1); if(!IsPreview()) aParameters<SpinBox_DX->text(); res = true; } break; case 1: - if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2); + if ( myBase && myVector ) { + anObj = anOper->MultiRotate2D(myBase.get(), myVector.get(), myAng, myNbTimes1, myStep, myNbTimes2); if(!IsPreview()) { aParameters<SpinBox_DX1->text(); aParameters<SpinBox_DY1->text(); @@ -584,7 +543,7 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects) if (!anObj->_is_nil()) { if(!IsPreview()) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back(anObj._retn()); } @@ -597,15 +556,33 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects) //================================================================================= void TransformationGUI_MultiRotationDlg::addSubshapesToStudy() { - QMap objMap; - switch (getConstructorId()) { case 0: - objMap[GroupPoints->LineEdit2->text()] = myVector; - break; case 1: - objMap[GroupDimensions->LineEdit2->text()] = myVector; + GEOMBase::PublishSubObject( myVector.get() ); break; + default: + break; + } +} + +//================================================================================= +// function : restoreSubShapes +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) +{ + if (mainFrame()->CheckBoxRestoreSS->isChecked()) { + // we pass here the first operation argument (object) through the list of arguments + // because the rotation operation place its arguments in the data structure in another order, + // and we need to point the first argument directly + GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO; + anArgs->length(1); + anArgs[0] = myBase.copy(); + getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs, + /*theFindMethod=*/GEOM::FSM_MultiTransformed, + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); } - addSubshapesToFather(objMap); } diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h index 1134f7cfc..fac7bd502 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_MultiRotationDlg.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -26,10 +27,11 @@ #ifndef TRANSFORMATIONGUI_MULTIROTATIONDLG_H #define TRANSFORMATIONGUI_MULTIROTATIONDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel4Spin1Check; -class DlgRef_2Sel1Spin; +class DlgRef_2Sel1SpinInt; //================================================================================= // class : TransformationGUI_MultiRotationDlg @@ -41,7 +43,7 @@ class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton public: TransformationGUI_MultiRotationDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_MultiRotationDlg(); protected: @@ -50,13 +52,14 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); virtual void addSubshapesToStudy(); + virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr ); private: void Init(); void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myBase, myVector; + GEOM::GeomObjPtr myBase, myVector; int myNbTimes1; int myNbTimes2; Standard_Real myAng; @@ -65,18 +68,18 @@ private: // to initialize the first selection field with a selected object on the dialog creation bool myInitial; - DlgRef_2Sel1Spin* GroupPoints; + DlgRef_2Sel1SpinInt* GroupPoints; DlgRef_2Sel4Spin1Check* GroupDimensions; private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ReverseAngle(); void ValueChangedInSpinBox( double ); + void ValueChangedInSpinBox( int ); void TextValueChangedInSpinBox( const QString& ); void ConstructorsClicked( int ); void SetDoubleSpinBoxStep( double ); diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index e4c81518b..352f88c2e 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -1,28 +1,27 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 : TransformationGUI_MultiTranslationDlg.cxx -// Author : Damien COQUERET, Open CASCADE S.A.S. +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : TransformationGUI_MultiTranslationDlg.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. + #include "TransformationGUI_MultiTranslationDlg.h" #include @@ -31,8 +30,14 @@ #include #include +#include +#include +#include #include #include +#include +#include +#include // OCCT Includes #include @@ -41,6 +46,10 @@ #include #include #include +#include +#include +#include +#include #include @@ -130,28 +139,25 @@ void TransformationGUI_MultiTranslationDlg::Init() SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); - double SpecificStep = 1; + int SpecificStep = 1; + // init variables + myStepU = myStepV = 50.0; + myNbTimesU = myNbTimesV = 2; + // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints->SpinBox_DY, 1, 999, SpecificStep, 10); + initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPoints->SpinBox_DY, 1, 999, SpecificStep); GroupPoints->SpinBox_DX->setValue(myStepU); GroupPoints->SpinBox_DY->setValue(myNbTimesU); - GroupPoints->SpinBox_DY->setDecimals(0); - initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep, 10); - initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep, 10); + initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep); + initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep); GroupDimensions->SpinBox_DX1->setValue(myStepU); GroupDimensions->SpinBox_DY1->setValue(myNbTimesU); GroupDimensions->SpinBox_DX2->setValue(myStepV); GroupDimensions->SpinBox_DY2->setValue(myNbTimesV); - GroupDimensions->SpinBox_DY1->setDecimals(0); - GroupDimensions->SpinBox_DY2->setDecimals(0); - - // init variables - myStepU = myStepV = 50.0; - myNbTimesU = myNbTimesV = 2; GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); @@ -160,7 +166,11 @@ void TransformationGUI_MultiTranslationDlg::Init() GroupDimensions->LineEdit2->setText(""); GroupDimensions->LineEdit3->setText(""); - myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil(); + myBase.nullify(); + myVectorU.nullify(); + myVectorV.nullify(); + + mainFrame()->GroupBoxPublish->show(); // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -174,26 +184,20 @@ void TransformationGUI_MultiTranslationDlg::Init() connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); - connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )), + connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )), this, SLOT(TextValueChangedInSpinBox(const QString& ))); - connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )), + connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )), this, SLOT(TextValueChangedInSpinBox(const QString& ))); - connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )), + connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )), this, SLOT(TextValueChangedInSpinBox(const QString& ))); - + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); @@ -212,11 +216,13 @@ void TransformationGUI_MultiTranslationDlg::Init() void TransformationGUI_MultiTranslationDlg::SetDoubleSpinBoxStep (double step) { GroupPoints->SpinBox_DX->setSingleStep(step); - GroupPoints->SpinBox_DY->setSingleStep(step); GroupDimensions->SpinBox_DX1->setSingleStep(step); - GroupDimensions->SpinBox_DY1->setSingleStep(step); GroupDimensions->SpinBox_DX2->setSingleStep(step); - GroupDimensions->SpinBox_DY2->setSingleStep(step); + + // san : Commented so as not to override specific step settings + //GroupPoints->SpinBox_DY->setSingleStep((int)step); + //GroupDimensions->SpinBox_DY1->setSingleStep((int)step); + //GroupDimensions->SpinBox_DY2->setSingleStep((int)step); } //================================================================================= @@ -235,7 +241,8 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructor GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myBase = myVectorU = GEOM::GEOM_Object::_nil(); + myBase.nullify(); + myVectorU.nullify(); GroupPoints->SpinBox_DX->setValue(myStepU); GroupPoints->SpinBox_DY->setValue(myNbTimesU); @@ -251,7 +258,9 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructor GroupDimensions->LineEdit1->setText(""); GroupDimensions->LineEdit2->setText(""); GroupDimensions->LineEdit3->setText(""); - myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil(); + myBase.nullify(); + myVectorU.nullify(); + myVectorV.nullify(); GroupDimensions->SpinBox_DX1->setValue(myStepU); GroupDimensions->SpinBox_DY1->setValue(myNbTimesU); @@ -272,7 +281,7 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructor SelectionIntoArgument(); } else { - displayPreview(); + processPreview(); } } @@ -282,6 +291,7 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructor //================================================================================= void TransformationGUI_MultiTranslationDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -308,108 +318,67 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply() void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); - - if (myEditCurrentArgument == GroupPoints->LineEdit1 || - myEditCurrentArgument == GroupDimensions->LineEdit1) - myBase = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2) - myVectorU = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupDimensions->LineEdit3) - myVectorV = GEOM::GEOM_Object::_nil(); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - - if (myEditCurrentArgument == GroupPoints->LineEdit1 || - myEditCurrentArgument == GroupDimensions->LineEdit1) - myBase = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit3) { - TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName += QString(":edge_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - if (myEditCurrentArgument == GroupDimensions->LineEdit3) - myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex); - else - myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - if (myEditCurrentArgument == GroupDimensions->LineEdit3) - myVectorV = aFindedObject; - else - myVectorU = aFindedObject; - } - } - else { - if (aShape.ShapeType() != TopAbs_EDGE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - if (myEditCurrentArgument == GroupDimensions->LineEdit3) - myVectorV = aSelectedObject; - else - myVectorU = aSelectedObject; - } + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit3 ) ? + TopAbs_EDGE : TopAbs_SHAPE; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myBase = aSelectedObject; + if ( !myVectorU ) + GroupPoints->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + myVectorU = aSelectedObject; + if ( !myBase ) + GroupPoints->PushButton1->click(); + } + else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) { + myBase = aSelectedObject; + if ( !myVectorU ) + GroupDimensions->PushButton2->click(); + else if ( !myVectorV ) + GroupDimensions->PushButton3->click(); + } + else if ( myEditCurrentArgument == GroupDimensions->LineEdit2 ) { + myVectorU = aSelectedObject; + if ( !myVectorV ) + GroupDimensions->PushButton3->click(); + else if ( !myBase ) + GroupDimensions->PushButton1->click(); + } + else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) { + myVectorV = aSelectedObject; + if ( !myBase ) + GroupDimensions->PushButton1->click(); + else if ( !myVectorU ) + GroupDimensions->PushButton2->click(); } - } - myEditCurrentArgument->setText(aName); - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - if (!myBase->_is_nil() && myVectorU->_is_nil()) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - if (!myVectorU->_is_nil() && myBase->_is_nil()) - GroupPoints->PushButton1->click(); - } - else if (myEditCurrentArgument == GroupDimensions->LineEdit1) { - if (!myBase->_is_nil() && myVectorU->_is_nil()) - GroupDimensions->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupDimensions->LineEdit2) { - if (!myVectorU->_is_nil() && myVectorV->_is_nil()) - GroupDimensions->PushButton3->click(); + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); } - else if (myEditCurrentArgument == GroupDimensions->LineEdit3) { - if (!myVectorV->_is_nil() && myBase->_is_nil()) - GroupDimensions->PushButton1->click(); + else { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1 ) + myBase.nullify(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2 ) + myVectorU.nullify(); + else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) + myVectorV.nullify(); + myEditCurrentArgument->setText(""); } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -475,22 +444,7 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || - send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || - send == GroupDimensions->LineEdit3) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -501,7 +455,7 @@ void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -524,25 +478,25 @@ void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QSt { QObject* send = (QObject*)sender(); bool isDigit = true; - + switch (getConstructorId()) { - case 0: + case 0: GroupPoints->SpinBox_DX->text().toDouble(&isDigit); if(!isDigit){ GroupPoints->CheckButton1->setChecked(false); } GroupPoints->CheckButton1->setEnabled(isDigit); break; - case 1: + case 1: if (send == GroupDimensions->SpinBox_DX1) { GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit); - if(!isDigit) + if(!isDigit) GroupDimensions->CheckButton1->setChecked(false); GroupDimensions->CheckButton1->setEnabled(isDigit); } else if(send == GroupDimensions->SpinBox_DX2){ GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit); - if(!isDigit) + if(!isDigit) GroupDimensions->CheckButton2->setChecked(false); GroupDimensions->CheckButton2->setEnabled(isDigit); } @@ -561,22 +515,39 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newVal case 0: if (send == GroupPoints->SpinBox_DX) myStepU = newValue; - else if (send == GroupPoints->SpinBox_DY) - myNbTimesU = (int)newValue; break; case 1: if (send == GroupDimensions->SpinBox_DX1) myStepU = newValue; - else if (send == GroupDimensions->SpinBox_DY1) - myNbTimesU = (int)newValue; else if (send == GroupDimensions->SpinBox_DX2) myStepV = newValue; + break; + } + + processPreview(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (int newValue) +{ + QObject* send = (QObject*)sender(); + switch (getConstructorId()) { + case 0: + if (send == GroupPoints->SpinBox_DY) + myNbTimesU = newValue; + break; + case 1: + if (send == GroupDimensions->SpinBox_DY1) + myNbTimesU = newValue; else if (send == GroupDimensions->SpinBox_DY2) - myNbTimesV = (int)newValue; + myNbTimesV = newValue; break; } - displayPreview(); + processPreview(); } //================================================================================= @@ -594,7 +565,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU() else if (aConstructorId == 1) GroupDimensions->SpinBox_DX1->setValue(myStepU); - displayPreview(); + processPreview(); } //================================================================================= @@ -607,7 +578,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepV() GroupDimensions->SpinBox_DX2->setValue(myStepV); - displayPreview(); + processPreview(); } //================================================================================= @@ -625,23 +596,24 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio //================================================================================= bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg) { - int aConstructorId = getConstructorId(); - - if (aConstructorId == 0) { - bool ok = true; - ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; - return !(myBase->_is_nil() || myVectorU->_is_nil()) && ok; - } - else if (aConstructorId == 1) { - bool ok = true; - ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok; - return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()) && ok; + bool ok = false; + switch ( getConstructorId() ) { + case 0: + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && + myBase && myVectorU; + break; + case 1: + ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && + GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && + myBase && myVectorU && myVectorV; + break; + default: + break; } - return 0; + return ok; } //================================================================================= @@ -656,11 +628,13 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects) QStringList aParameters; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU); + if ( myBase && myVectorU ) { + createPathPreview ( myVectorU.get() ); + anObj = anOper->MultiTranslate1D(myBase.get(), myVectorU.get(), myStepU, myNbTimesU); if(!IsPreview()) { aParameters<SpinBox_DX->text(); aParameters<SpinBox_DY->text(); @@ -669,11 +643,12 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects) } break; case 1: - if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) && - !CORBA::is_nil(myVectorV)) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU, - myVectorV, myStepV, myNbTimesV); + if ( myBase && myVectorU && myVectorV ) { + createPathPreview ( myVectorU.get() ); + createPathPreview ( myVectorV.get() ); + anObj = anOper->MultiTranslate2D(myBase.get(), + myVectorU.get(), myStepU, myNbTimesU, + myVectorV.get(), myStepV, myNbTimesV); if(!IsPreview()) { aParameters<SpinBox_DX1->text(); aParameters<SpinBox_DY1->text(); @@ -687,7 +662,7 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects) if (!anObj->_is_nil()) { if(!IsPreview()) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back(anObj._retn()); } @@ -700,16 +675,62 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects) //================================================================================= void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy() { - QMap objMap; - switch (getConstructorId()) { case 0: - objMap[GroupPoints->LineEdit2->text()] = myVectorU; + GEOMBase::PublishSubObject( myVectorU.get() ); break; case 1: - objMap[GroupDimensions->LineEdit2->text()] = myVectorU; - objMap[GroupDimensions->LineEdit3->text()] = myVectorV; + GEOMBase::PublishSubObject( myVectorU.get() ); + GEOMBase::PublishSubObject( myVectorV.get() ); + break; + default: break; } - addSubshapesToFather(objMap); +} + +//================================================================================= +// function : restoreSubShapes +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) +{ + if (mainFrame()->CheckBoxRestoreSS->isChecked()) { + // we pass here the first operation argument (object) through the list of arguments + // because the rotation operation place its arguments in the data structure in another order, + // and we need to point the first argument directly + GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO; + anArgs->length(1); + anArgs[0] = myBase.copy(); + getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs, + /*theFindMethod=*/GEOM::FSM_MultiTransformed, + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); + } +} + +//================================================================================= +// function : createPathPreview +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Object_ptr thePath ) +{ + if ( IsPreview() ) { + TopoDS_Shape aShape; + GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE ); + TopoDS_Edge anEdge = TopoDS::Edge( aShape ); + ShapeAnalysis_Edge aShapeAnal; + TopoDS_Vertex aFirst = aShapeAnal.FirstVertex( anEdge ); + TopoDS_Vertex aLast = aShapeAnal.LastVertex( anEdge ); + TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape(); + const char* aName = "tmpVector"; + Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName ); + + // add Prs to preview + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + if (aPrs) + aPrs->AddObject(anIO); + GEOMBase_Helper::displayPreview( aPrs, false, true ); + } } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h index ab7d67b6a..6a7ce6e08 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_MultiTranslationDlg.h // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H #define TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_2Sel2Spin1Check; class DlgRef_3Sel4Spin2Check; @@ -41,7 +43,7 @@ class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton public: TransformationGUI_MultiTranslationDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_MultiTranslationDlg(); protected: @@ -50,13 +52,15 @@ protected: virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); virtual void addSubshapesToStudy(); + virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr ); private: void Init(); void enterEvent( QEvent* ); + void createPathPreview( GEOM::GEOM_Object_ptr ); private: - GEOM::GEOM_Object_var myBase, myVectorU, myVectorV; + GEOM::GeomObjPtr myBase, myVectorU, myVectorV; int myNbTimesU; int myNbTimesV; Standard_Real myStepU; @@ -72,12 +76,12 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ReverseStepU(); void ReverseStepV(); void ValueChangedInSpinBox( double ); + void ValueChangedInSpinBox( int ); void TextValueChangedInSpinBox( const QString& ); void ConstructorsClicked( int ); void SetDoubleSpinBoxStep( double ); diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx index f548ca48e..8ea9dec4a 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_OffsetDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -42,7 +43,7 @@ // TRUE to construct a modal dialog. //================================================================================= TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_OFFSET" ) ) ); @@ -100,17 +101,19 @@ void TransformationGUI_OffsetDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setReadOnly( true ); + + myObjects.clear(); /* Get setting of step value from file configuration */ double step = 1; /* min, max, step and decimals for spin boxes & initial values */ - initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); GroupPoints->SpinBox_DX->setValue( 1e-05 ); // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked( true ); - CreateCopyModeChanged( true ); + CreateCopyModeChanged(); mainFrame()->GroupBoxPublish->show(); @@ -120,14 +123,16 @@ void TransformationGUI_OffsetDlg::Init() connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) ); - connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) ); + connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged() ) ); initName( tr( "GEOM_OFFSET" ) ); globalSelection( GEOM_ALLSHAPES ); + resize(100,100); + SelectionIntoArgument(); } @@ -137,6 +142,7 @@ void TransformationGUI_OffsetDlg::Init() //================================================================================= void TransformationGUI_OffsetDlg::ClickOnOk() { + setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); } @@ -162,41 +168,16 @@ bool TransformationGUI_OffsetDlg::ClickOnApply() //================================================================================= void TransformationGUI_OffsetDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText( "" ); - QString aName; - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName); - if ( aNbSel < 1 ) { - myObjects.length( 0 ); - return; + myObjects = getSelected( TopAbs_SHAPE, -1 ); + if ( !myObjects.isEmpty() ) { + QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() ); + myEditCurrentArgument->setText( aName ); } - - // nbSel > 0 - GEOMBase::ConvertListOfIOInListOfGO (aSelList, myObjects); - if (!myObjects.length()) - return; - - myEditCurrentArgument->setText(aName); - - displayPreview(); -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_OffsetDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupPoints->LineEdit1 ) { - myEditCurrentArgument = GroupPoints->LineEdit1; - GEOMBase_Skeleton::LineEditReturnPressed(); + else { + myEditCurrentArgument->setText(""); } + + processPreview(); } @@ -236,7 +217,7 @@ void TransformationGUI_OffsetDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); globalSelection( GEOM_ALLSHAPES ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); @@ -249,7 +230,7 @@ void TransformationGUI_OffsetDlg::ActivateThisDialog() //================================================================================= void TransformationGUI_OffsetDlg::ValueChangedInSpinBox() { - displayPreview(); + processPreview(); } @@ -268,17 +249,14 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_OffsetDlg::createOperation() //================================================================================= bool TransformationGUI_OffsetDlg::isValid( QString& msg ) { - //return !(myObjects.length() == 0); - if ( myObjects.length() == 0 ) return false; - - for ( int i = 0; i < myObjects.length(); i++ ) { + bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myObjects.isEmpty(); + for ( int i = 0; i < myObjects.count() && ok; i++ ) { GEOM::shape_type aType = myObjects[i]->GetShapeType(); - if ( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ) { + ok = aType == GEOM::FACE || aType == GEOM::SHELL || aType == GEOM::SOLID; + if ( !ok ) msg = tr( "ERROR_SHAPE_TYPE" ); - return false; - } } - return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ); + return ok; } //================================================================================= @@ -291,23 +269,25 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) { - for ( int i = 0; i < myObjects.length(); i++ ) { + for ( int i = 0; i < myObjects.count(); i++ ) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); + anObj = anOper->OffsetShapeCopy( myObjects[i].get(), GetOffset() ); if ( !anObj->_is_nil() ) { if(!IsPreview()) { anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData()); } - objects.push_back( anObj._retn() ); + objects.push_back( anObj._retn() ); } } } else { - for ( int i = 0; i < myObjects.length(); i++ ) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); + for ( int i = 0; i < myObjects.count(); i++ ) { + anObj = anOper->OffsetShape( myObjects[i].get(), GetOffset() ); if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); + objects.push_back( anObj._retn() ); } } res = true; @@ -325,8 +305,9 @@ void TransformationGUI_OffsetDlg::restoreSubShapes( SALOMEDS::Study_ptr theStu if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) { // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(), - /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true ); + /*theFindMethod=*/GEOM::FSM_Transformed, + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked() ); } } @@ -343,7 +324,7 @@ double TransformationGUI_OffsetDlg::GetOffset() const // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_OffsetDlg::CreateCopyModeChanged( bool isCreateCopy ) +void TransformationGUI_OffsetDlg::CreateCopyModeChanged() { - mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); + mainFrame()->GroupBoxName->setEnabled( GroupPoints->CheckButton1->isChecked() ); } diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.h b/src/TransformationGUI/TransformationGUI_OffsetDlg.h index c83ec5fed..e0aac63b6 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.h +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_OffsetDlg.h // Author : Michael ZORIN, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com) @@ -26,7 +27,8 @@ #ifndef TRANSFORMATIONGUI_OFFSETDLG_H #define TRANSFORMATIONGUI_OFFSETDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_1Sel1Spin1Check; @@ -40,7 +42,7 @@ class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton public: TransformationGUI_OffsetDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_OffsetDlg(); protected: @@ -56,7 +58,7 @@ private: double GetOffset() const; private: - GEOM::ListOfGO myObjects; + QList myObjects; DlgRef_1Sel1Spin1Check* GroupPoints; @@ -65,10 +67,9 @@ private slots: bool ClickOnApply(); void ActivateThisDialog(); void SelectionIntoArgument(); - void LineEditReturnPressed(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(); - void CreateCopyModeChanged( bool ); + void CreateCopyModeChanged(); }; #endif // TRANSFORMATIONGUI_OFFSETDLG_H diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx index e6cd6c213..f31214417 100644 --- a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_PositionDlg.cxx // Author : Damien COQUERET, Open CASCADE S.A.S. @@ -90,8 +91,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg // Activate Create a Copy mode Group1->CheckButton1->setChecked(true); - Group1->CheckButton1->setChecked(false); - CreateCopyModeChanged(true); + CreateCopyModeChanged(); Init(); } @@ -122,12 +122,15 @@ void TransformationGUI_PositionDlg::Init() Group1->LineEdit4->setText(""); Group1->LineEdit5->setText(""); - initSpinBox(Group1->SpinBox_DX, 0, 1, 0.05, 6); // VSR:TODO : DBL_DIGITS_DISPLAY + initSpinBox(Group1->SpinBox_DX, 0, 1, 0.05, "parametric_precision" ); Group1->SpinBox_DX->setValue(0); Group1->CheckButton2->setEnabled(false); - myStartLCS = myEndLCS = GEOM::GEOM_Object::_nil(); + myObjects.clear(); + myStartLCS.nullify(); + myEndLCS.nullify(); + myPath.nullify(); mainFrame()->GroupBoxPublish->show(); @@ -142,12 +145,7 @@ void TransformationGUI_PositionDlg::Init() connect(Group1->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group1->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit4, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit5, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(Group1->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect(Group1->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged())); connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(Group1->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked())); @@ -169,9 +167,9 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId) Group1->LineEdit2->clear(); Group1->LineEdit4->clear(); Group1->LineEdit5->clear(); - myStartLCS = GEOM::GEOM_Object::_nil(); - myEndLCS = GEOM::GEOM_Object::_nil(); - myPath = GEOM::GEOM_Object::_nil(); + myStartLCS.nullify(); + myEndLCS.nullify(); + myPath.nullify(); switch (constructorId) { case 0: @@ -250,7 +248,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId) SelectionIntoArgument(); } else { - displayPreview(); + processPreview(); } } @@ -276,7 +274,7 @@ void TransformationGUI_PositionDlg::SelectionTypeButtonClicked() //================================================================================= void TransformationGUI_PositionDlg::ValueChangedInSpinBox() { - displayPreview(); + processPreview(); } //================================================================================= @@ -285,6 +283,7 @@ void TransformationGUI_PositionDlg::ValueChangedInSpinBox() //================================================================================= void TransformationGUI_PositionDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -299,8 +298,11 @@ bool TransformationGUI_PositionDlg::ClickOnApply() return false; initName(); + // activate selection and connect selection manager ConstructorsClicked(getConstructorId()); + SelectionIntoArgument(); + return true; } @@ -313,124 +315,59 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if (myEditCurrentArgument == Group1->LineEdit1) - myObjects.length(0); - else if (myEditCurrentArgument == Group1->LineEdit2) - myStartLCS = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group1->LineEdit4) - myEndLCS = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == Group1->LineEdit5) - myPath = GEOM::GEOM_Object::_nil(); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - QString aName; - - if (myEditCurrentArgument == Group1->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName); - if (aNbSel < 1) - return; - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects); - if (!myObjects.length()) - return; - else - myEditCurrentArgument->setText(aName); - - if (getConstructorId() == 2) - Group1->PushButton5->click(); - } - else if (myEditCurrentArgument == Group1->LineEdit2) { - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - myStartLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult || CORBA::is_nil(myStartLCS)) - return; - - aName = GEOMBase::GetName(myStartLCS); - myEditCurrentArgument->setText(aName); - - if (!myStartLCS->_is_nil() && myEndLCS->_is_nil()) - Group1->PushButton4->click(); + if ( myEditCurrentArgument == Group1->LineEdit1 ) { + myObjects = getSelected( TopAbs_SHAPE, -1 ); + if ( !myObjects.isEmpty() ) { + QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } } - else if (myEditCurrentArgument == Group1->LineEdit4) { - myEndLCS = GEOM::GEOM_Object::_nil(); - if (aSelList.Extent() != 1) - return; - - Standard_Boolean testResult = Standard_False; - myEndLCS = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult || CORBA::is_nil(myEndLCS)) - return; - - aName = GEOMBase::GetName(myEndLCS); - myEditCurrentArgument->setText(aName); - - if (!myEndLCS->_is_nil() && !myObjects.length()) - Group1->PushButton1->click(); + else if ( myEditCurrentArgument == Group1->LineEdit5 ) { + QList types; + types << TopAbs_EDGE << TopAbs_WIRE; + GEOM::GeomObjPtr aSelectedObject = getSelected( types ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + myPath = aSelectedObject; + if ( myObjects.isEmpty() ) + Group1->PushButton1->click(); + } + else { + myPath.nullify(); + } } - else if (myEditCurrentArgument == Group1->LineEdit5) { - myPath = GEOM::GEOM_Object::_nil(); - if (aSelList.Extent() != 1) - return; - - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult || aSelectedObject->_is_nil()) - return; - - aName = GEOMBase::GetName(myPath); - // Local Selection - TopoDS_Shape S; - if (!GEOMBase::GetShape(aSelectedObject, S)) - return; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - aName = GEOMBase::GetName(aSelectedObject); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName.append(":edge_" + QString::number(anIndex)); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + else { + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_SHAPE ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == Group1->LineEdit2 ) { + myStartLCS = aSelectedObject; + if ( !myEndLCS ) + Group1->PushButton4->click(); + else if ( myObjects.isEmpty() ) + Group1->PushButton1->click(); } - else { // get Object from study - aSelectedObject = aFindedObject; + else if ( myEditCurrentArgument == Group1->LineEdit4 ) { + myEndLCS = aSelectedObject; + if ( myObjects.isEmpty() ) + Group1->PushButton1->click(); + else if ( getConstructorId() == 1 && !myStartLCS ) + Group1->PushButton2->click(); } } else { - if (S.ShapeType() != TopAbs_EDGE && S.ShapeType() != TopAbs_WIRE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - return; - } + if ( myEditCurrentArgument == Group1->LineEdit2 ) + myStartLCS.nullify(); + else if ( myEditCurrentArgument == Group1->LineEdit4 ) + myEndLCS.nullify(); } - - myEditCurrentArgument->setText(aName); - myPath = aSelectedObject; - - if (!myPath->_is_nil() && !myObjects.length()) - Group1->PushButton1->click(); } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -521,28 +458,7 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_PositionDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == Group1->LineEdit1 || - send == Group1->LineEdit2 || - send == Group1->LineEdit4 || - send == Group1->LineEdit5 ) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } - - if (send == Group1->LineEdit5) - Group1->CheckButton2->setEnabled(true); - else - Group1->CheckButton2->setEnabled(false); + processPreview(); } //================================================================================= @@ -553,10 +469,10 @@ void TransformationGUI_PositionDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -586,15 +502,21 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation() //================================================================================= bool TransformationGUI_PositionDlg::isValid (QString& /*msg*/) { - bool res; - if (getConstructorId() == 0) - res = !(myObjects.length() == 0 || myEndLCS->_is_nil()); - else if ( getConstructorId() == 1 ) - res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil()); - else if ( getConstructorId() == 2 ) - res = !(myObjects.length() == 0 || myPath->_is_nil()); - - return res; + bool ok = false; + switch (getConstructorId()) { + case 0: + ok = !myObjects.isEmpty() && myEndLCS; + break; + case 1: + ok = !myObjects.isEmpty() && myStartLCS && myEndLCS; + break; + case 2: + ok = !myObjects.isEmpty() && myPath; + break; + default: + break; + } + return ok; } //================================================================================= @@ -607,16 +529,15 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects) bool toCreateCopy = IsPreview() || Group1->CheckButton1->isChecked(); GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { - for (int i = 0; i < myObjects.length(); i++) { - if (toCreateCopy) - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - PositionShapeCopy(myObjects[i], myObjects[i], myEndLCS); - else - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - PositionShape(myObjects[i], myObjects[i], myEndLCS); + for (int i = 0; i < myObjects.count(); i++) { + anObj = toCreateCopy ? + anOper->PositionShapeCopy(myObjects[i].get(), myObjects[i].get(), myEndLCS.get()) : + anOper->PositionShape(myObjects[i].get(), myObjects[i].get(), myEndLCS.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); @@ -626,13 +547,10 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects) } case 1: { - for (int i = 0; i < myObjects.length(); i++) { - if (toCreateCopy) - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - PositionShapeCopy(myObjects[i], myStartLCS, myEndLCS); - else - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - PositionShape(myObjects[i], myStartLCS, myEndLCS); + for (int i = 0; i < myObjects.count(); i++) { + anObj = toCreateCopy ? + anOper->PositionShapeCopy(myObjects[i].get(), myStartLCS.get(), myEndLCS.get()) : + anOper->PositionShape(myObjects[i].get(), myStartLCS.get(), myEndLCS.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -643,11 +561,10 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects) { double aDistance = Group1->SpinBox_DX->value(); bool toReverse = Group1->CheckButton3->isChecked(); - for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy, toReverse); - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); + for (int i = 0; i < myObjects.count(); i++) { + anObj = anOper->PositionAlongPath(myObjects[i].get(), myPath.get(), aDistance, toCreateCopy, toReverse); + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); } res = true; break; @@ -668,7 +585,8 @@ void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr theS // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true); + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); } } @@ -676,9 +594,9 @@ void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr theS // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_PositionDlg::CreateCopyModeChanged (bool isCreateCopy) +void TransformationGUI_PositionDlg::CreateCopyModeChanged() { - mainFrame()->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled(Group1->CheckButton1->isChecked()); } //================================================================================= @@ -687,9 +605,6 @@ void TransformationGUI_PositionDlg::CreateCopyModeChanged (bool isCreateCopy) //================================================================================= void TransformationGUI_PositionDlg::addSubshapesToStudy() { - QMap objMap; - - objMap[Group1->LineEdit5->text()] = myPath; - - addSubshapesToFather(objMap); + if ( getConstructorId() == 2 ) + GEOMBase::PublishSubObject( myPath.get() ); } diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.h b/src/TransformationGUI/TransformationGUI_PositionDlg.h index a48959b92..1cfa81705 100644 --- a/src/TransformationGUI/TransformationGUI_PositionDlg.h +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_PositionDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef TRANSFORMATIONGUI_POSITIONDLG_H #define TRANSFORMATIONGUI_POSITIONDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_4Sel1Spin3Check; @@ -40,7 +42,7 @@ class TransformationGUI_PositionDlg : public GEOMBase_Skeleton public: TransformationGUI_PositionDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_PositionDlg(); protected: @@ -56,10 +58,10 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myStartLCS; - GEOM::GEOM_Object_var myEndLCS; - GEOM::ListOfGO myObjects; - GEOM::GEOM_Object_var myPath; + GEOM::GeomObjPtr myStartLCS; + GEOM::GeomObjPtr myEndLCS; + QList myObjects; + GEOM::GeomObjPtr myPath; // to initialize the first selection field with a selected object on the dialog creation bool myInitial; @@ -70,11 +72,10 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); - void CreateCopyModeChanged( bool ); + void CreateCopyModeChanged(); void ValueChangedInSpinBox(); void SelectionTypeButtonClicked(); }; diff --git a/src/TransformationGUI/TransformationGUI_ProjectionDlg.cxx b/src/TransformationGUI/TransformationGUI_ProjectionDlg.cxx new file mode 100644 index 000000000..48edd3efa --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_ProjectionDlg.cxx @@ -0,0 +1,289 @@ +// Copyright (C) 2007-2012 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 +// + +// File : TransformationGUI_ProjectionDlg.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + +#include "TransformationGUI.h" +#include "TransformationGUI_ProjectionDlg.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +//================================================================================= +// class : TransformationGUI_ProjectionDlg() +// purpose : Constructs a TransformationGUI_ProjectionDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_ProjectionDlg::TransformationGUI_ProjectionDlg (GeometryGUI* theGeometryGUI, + QWidget* parent, bool modal, Qt::WindowFlags fl) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) +{ + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PROJECTION"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_PROJECTION_TITLE")); + + mainFrame()->GroupConstructors->setTitle(tr("GEOM_PROJECTION")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + myGroup = new DlgRef_2Sel (centralWidget()); + + myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + myGroup->TextLabel1->setText(tr("GEOM_SOURCE_OBJECT")); + myGroup->TextLabel2->setText(tr("GEOM_TARGET_OBJECT")); + myGroup->PushButton1->setIcon(image1); + myGroup->PushButton2->setIcon(image1); + myGroup->LineEdit1->setReadOnly(true); + myGroup->LineEdit2->setReadOnly(true); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(myGroup); + + setHelpFileName("projection_operation_page.html"); + + // Initialisation + Init(); +} + +//================================================================================= +// function : ~TransformationGUI_ProjectionDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_ProjectionDlg::~TransformationGUI_ProjectionDlg() +{ +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_ProjectionDlg::Init() +{ + mainFrame()->GroupBoxPublish->show(); + + // init variables + myEditCurrentArgument = myGroup->LineEdit1; + + myGroup->LineEdit1->setText(""); + myGroup->LineEdit2->setText(""); + myObject1.nullify(); + myObject2.nullify(); + + showOnlyPreviewControl(); + + // signals and slots connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName(mainFrame()->GroupConstructors->title()); + + setTabOrder(mainFrame()->GroupConstructors, mainFrame()->GroupBoxName); + setTabOrder(mainFrame()->GroupBoxName, mainFrame()->GroupMedium); + setTabOrder(mainFrame()->GroupMedium, mainFrame()->GroupButtons); + + mainFrame()->RadioButton1->setFocus(); + + globalSelection(GEOM_ALLSHAPES); + + myGroup->PushButton1->click(); + SelectionIntoArgument(); + resize(100,100); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_ProjectionDlg::ClickOnOk() +{ + setIsApplyAndClose(true); + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_ProjectionDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + // activate selection and connect selection manager + myGroup->PushButton1->click(); + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection is changed or on dialog initialization or activation +//================================================================================= +void TransformationGUI_ProjectionDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_SHAPE); + TopoDS_Shape aShape; + if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) { + QString aName = GEOMBase::GetName(aSelectedObject.get()); + myEditCurrentArgument->setText(aName); + + // clear selection + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myGeomGUI->getApp()->selectionMgr()->clearSelected(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + if (myEditCurrentArgument == myGroup->LineEdit1) { + myObject1 = aSelectedObject; + if (!myObject2) + myGroup->PushButton2->click(); + } + else if (myEditCurrentArgument == myGroup->LineEdit2) { + myObject2 = aSelectedObject; + if (!myObject1) + myGroup->PushButton1->click(); + } + } + else { + if (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify(); + else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify(); + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_ProjectionDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if (send == myGroup->PushButton1) { + myEditCurrentArgument = myGroup->LineEdit1; + + myGroup->PushButton2->setDown(false); + myGroup->LineEdit2->setEnabled(false); + + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_POINT ); + aMap.Add( GEOM_EDGE ); + aMap.Add( GEOM_WIRE ); + globalSelection( aMap ); + } + else if (send == myGroup->PushButton2) { + myEditCurrentArgument = myGroup->LineEdit2; + + myGroup->PushButton1->setDown(false); + myGroup->LineEdit1->setEnabled(false); + + globalSelection( GEOM_FACE ); + } + + // enable line edit + myEditCurrentArgument->setEnabled(true); + myEditCurrentArgument->setFocus(); + // after setFocus(), because it will be setDown(false) when loses focus + send->setDown(true); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_ProjectionDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + processPreview(); +} + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void TransformationGUI_ProjectionDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_ProjectionDlg::createOperation() +{ + return getGeomEngine()->GetITransformOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_ProjectionDlg::isValid (QString&) +{ + return myObject1 && myObject2; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_ProjectionDlg::execute (ObjectList& objects) +{ + GEOM::GEOM_Object_var anObj; + + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + anObj = anOper->ProjectShapeCopy(myObject1.get(), myObject2.get()); + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + + return true; +} diff --git a/src/TransformationGUI/TransformationGUI_ProjectionDlg.h b/src/TransformationGUI/TransformationGUI_ProjectionDlg.h new file mode 100644 index 000000000..43541b48a --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_ProjectionDlg.h @@ -0,0 +1,71 @@ +// Copyright (C) 2007-2012 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 +// + +// File : TransformationGUI_ProjectionDlg.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. + +#ifndef TRANSFORMATIONGUI_PROJECTIONDLG_H +#define TRANSFORMATIONGUI_PROJECTIONDLG_H + +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" + +class DlgRef_2Sel; + +//================================================================================= +// class : TransformationGUI_ProjectionDlg +// purpose : +//================================================================================= +class TransformationGUI_ProjectionDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + TransformationGUI_ProjectionDlg (GeometryGUI*, QWidget* = 0, + bool = false, Qt::WindowFlags = 0 ); + ~TransformationGUI_ProjectionDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + +private: + void Init(); + void enterEvent (QEvent*); + +private: + GEOM::GeomObjPtr myObject1; + GEOM::GeomObjPtr myObject2; + + DlgRef_2Sel* myGroup; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void ActivateThisDialog(); +}; + +#endif // TRANSFORMATIONGUI_PROJECTIONDLG_H diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index c56fd9c9b..945ca796b 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_RotationDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "TransformationGUI_RotationDlg.h" #include @@ -98,7 +99,7 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); - CreateCopyModeChanged(true); + CreateCopyModeChanged(); Init(); } @@ -122,7 +123,7 @@ void TransformationGUI_RotationDlg::Init() double SpecificStep = 5; // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, "angle_precision" ); GroupPoints->SpinBox_DX->setValue(anAngle); // init variables @@ -131,7 +132,11 @@ void TransformationGUI_RotationDlg::Init() GroupPoints->LineEdit4->setText(""); GroupPoints->LineEdit5->setText(""); - myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + myObjects.clear(); + myAxis.nullify(); + myCentPoint.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); mainFrame()->GroupBoxPublish->show(); @@ -146,15 +151,12 @@ void TransformationGUI_RotationDlg::Init() connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged( const QString& )), this, SLOT(TextValueChangedInSpinBox( const QString&))); - connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged())); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); initName(tr("GEOM_ROTATION")); @@ -178,7 +180,7 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId) GroupPoints->LineEdit2->clear(); GroupPoints->ShowRows(4, 4, true); - myAxis = GEOM::GEOM_Object::_nil(); + myAxis.nullify(); GroupPoints->PushButton1->click(); } @@ -195,7 +197,9 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId) GroupPoints->LineEdit4->clear(); GroupPoints->LineEdit5->clear(); - myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + myCentPoint.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); GroupPoints->PushButton1->click(); } @@ -211,7 +215,7 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId) SelectionIntoArgument(); } else { - displayPreview(); + processPreview(); } } @@ -221,6 +225,7 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId) //================================================================================= void TransformationGUI_RotationDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -235,8 +240,11 @@ bool TransformationGUI_RotationDlg::ClickOnApply() return false; initName(); + // activate selection and connect selection manager ConstructorsClicked(getConstructorId()); + SelectionIntoArgument(); + return true; } @@ -247,119 +255,78 @@ bool TransformationGUI_RotationDlg::ClickOnApply() void TransformationGUI_RotationDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myObjects.length(0); - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) - myAxis = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myCentPoint = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit4) - myPoint1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit5) - myPoint2 = GEOM::GEOM_Object::_nil(); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - QString aName; - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName); - if (aNbSel < 1) - return; - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects); - if (!myObjects.length()) - return; - else - myEditCurrentArgument->setText(aName); + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myObjects = getSelected( TopAbs_SHAPE, -1 ); + if ( !myObjects.isEmpty() ) { + QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } + else { + myEditCurrentArgument->setText(""); + } } else { - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 ) ? + TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) - aNeedType = TopAbs_EDGE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) - { - int anIndex = aMap(1); - if (aNeedType == TopAbs_EDGE) - aName += QString(":edge_%1").arg(anIndex); - else - aName += QString(":vertex_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; // get Object from study - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + if ( getConstructorId() == 0 ) { + myAxis = aSelectedObject; + if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + } + else if ( getConstructorId() == 1 ) { + myCentPoint = aSelectedObject; + if ( !myPoint1 ) + GroupPoints->PushButton4->click(); + else if ( !myPoint2 ) + GroupPoints->PushButton5->click(); + else if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + } } - else // Global Selection - { - if (aShape.ShapeType() != aNeedType) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) { + myPoint1 = aSelectedObject; + if ( !myPoint2 ) + GroupPoints->PushButton5->click(); + else if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + else if ( !myCentPoint ) + GroupPoints->PushButton2->click(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) { + myPoint2 = aSelectedObject; + if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + else if ( !myCentPoint ) + GroupPoints->PushButton2->click(); + else if ( !myPoint1 ) + GroupPoints->PushButton4->click(); } } - - myEditCurrentArgument->setText(aName); - - if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) { - myAxis = aSelectedObject; - if (!myAxis->_is_nil() && !myObjects.length()) - GroupPoints->PushButton1->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) { - myCentPoint = aSelectedObject; - if (!myCentPoint->_is_nil() && myPoint1->_is_nil()) - GroupPoints->PushButton4->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit4) { - myPoint1 = aSelectedObject; - if (!myPoint1->_is_nil() && myPoint2->_is_nil()) - GroupPoints->PushButton5->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit5) { - myPoint2 = aSelectedObject; - if (!myPoint2->_is_nil() && !myObjects.length()) - GroupPoints->PushButton1->click(); + else { + if (myEditCurrentArgument == GroupPoints->LineEdit2 ) { + if ( getConstructorId() == 0 ) + myAxis.nullify(); + else if ( getConstructorId() == 1 ) + myCentPoint.nullify(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) { + myPoint1.nullify(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) { + myPoint2.nullify(); + } + myEditCurrentArgument->setText(""); } } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -377,7 +344,11 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->PushButton2->setDown(false); + GroupPoints->PushButton4->setDown(false); + GroupPoints->PushButton5->setDown(false); GroupPoints->LineEdit2->setEnabled(false); + GroupPoints->LineEdit4->setEnabled(false); + GroupPoints->LineEdit5->setEnabled(false); } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; @@ -428,21 +399,7 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_RotationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -453,7 +410,7 @@ void TransformationGUI_RotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -484,7 +441,7 @@ void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s) //================================================================================= void TransformationGUI_RotationDlg::ValueChangedInSpinBox() { - displayPreview(); + processPreview(); } //================================================================================= @@ -502,19 +459,18 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation() //================================================================================= bool TransformationGUI_RotationDlg::isValid (QString& msg) { + bool ok = false; switch (getConstructorId()) { - case 0: { - bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ); - return myObjects.length() > 0 && !(myAxis->_is_nil()) && ok; + case 0: + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myObjects.isEmpty() && myAxis; break; - } case 1: - return myObjects.length() > 0 && !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil()); + ok = !myObjects.isEmpty() && myCentPoint && myPoint1 && myPoint2; break; default: break; } - return false; + return ok; } //================================================================================= @@ -528,36 +484,36 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { QStringList aParameters; aParameters<SpinBox_DX->text(); if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - RotateCopy(myObjects[i], myAxis, GetAngle() * PI180); + anObj = anOper->RotateCopy(myObjects[i].get(), myAxis.get(), GetAngle() * M_PI / 180.); if (!anObj->_is_nil()) { if(!IsPreview()) { - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } objects.push_back(anObj._retn()); } } } else { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - Rotate(myObjects[i], myAxis, GetAngle() * PI180); + anObj = anOper->Rotate(myObjects[i].get(), myAxis.get(), GetAngle() * M_PI / 180.); if (!anObj->_is_nil()) { if(!IsPreview()) { - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); - updateAttributes(anObj, aParameters); - } + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + updateAttributes(anObj, aParameters); + } objects.push_back(anObj._retn()); - } + } } } res = true; @@ -566,19 +522,17 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects) case 1: { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - RotateThreePointsCopy(myObjects[i], myCentPoint, myPoint1, myPoint2); + anObj = anOper->RotateThreePointsCopy(myObjects[i].get(), myCentPoint.get(), myPoint1.get(), myPoint2.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } } else { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - RotateThreePoints(myObjects[i], myCentPoint, myPoint1, myPoint2); + anObj = anOper->RotateThreePoints(myObjects[i].get(), myCentPoint.get(), myPoint1.get(), myPoint2.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -604,10 +558,11 @@ void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theS // and we need to point the first argument directly GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO; anArgs->length(1); - anArgs[0] = myCurrObject; + anArgs[0] = myCurrObject.copy(); getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs, /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true); + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); } } @@ -624,9 +579,9 @@ double TransformationGUI_RotationDlg::GetAngle() const // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_RotationDlg::CreateCopyModeChanged (bool isCreateCopy) +void TransformationGUI_RotationDlg::CreateCopyModeChanged() { - mainFrame()->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled(GroupPoints->CheckButton1->isChecked()); } //================================================================================= @@ -647,17 +602,17 @@ void TransformationGUI_RotationDlg::addSubshapesToStudy() { bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); if (toCreateCopy) { - QMap objMap; switch (getConstructorId()) { case 0: - objMap[GroupPoints->LineEdit2->text()] = myAxis; + GEOMBase::PublishSubObject( myAxis.get() ); break; case 1: - objMap[GroupPoints->LineEdit2->text()] = myCentPoint; - objMap[GroupPoints->LineEdit4->text()] = myPoint1; - objMap[GroupPoints->LineEdit5->text()] = myPoint2; + GEOMBase::PublishSubObject( myCentPoint.get() ); + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); + break; + default: break; } - addSubshapesToFather(objMap); } } diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.h b/src/TransformationGUI/TransformationGUI_RotationDlg.h index 9b774f704..1232e0d6a 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_RotationDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef TRANSFORMATIONGUI_ROTATIONDLG_H #define TRANSFORMATIONGUI_ROTATIONDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_4Sel1Spin2Check; @@ -40,7 +42,7 @@ class TransformationGUI_RotationDlg : public GEOMBase_Skeleton public: TransformationGUI_RotationDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_RotationDlg(); protected: @@ -57,9 +59,9 @@ private: double GetAngle() const; private: - GEOM::ListOfGO myObjects; - GEOM::GEOM_Object_var myCurrObject; - GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2; + QList myObjects; + GEOM::GeomObjPtr myCurrObject; + GEOM::GeomObjPtr myAxis, myCentPoint, myPoint1, myPoint2; // to initialize the first selection field with a selected object on the dialog creation bool myInitial; @@ -70,12 +72,11 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(); void TextValueChangedInSpinBox( const QString& ); - void CreateCopyModeChanged( bool ); + void CreateCopyModeChanged(); void ConstructorsClicked( int ); void onReverse(); }; diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 32daa0cb5..ff31ede29 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_ScaleDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -129,7 +130,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometry CheckBoxCopy->hide(); // Activate Create a Copy mode - CreateCopyModeChanged(true); + CreateCopyModeChanged(); // Allowed inheritance of children and visual properties by the scaling result mainFrame()->GroupBoxPublish->show(); @@ -155,9 +156,9 @@ void TransformationGUI_ScaleDlg::Init() double aFactor = 2.0; double SpecificStep = 0.5; - initSpinBox(SpinBox_FX, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); - initSpinBox(SpinBox_FY, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); - initSpinBox(SpinBox_FZ, COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + initSpinBox(SpinBox_FX, COORD_MIN, COORD_MAX, SpecificStep, "parametric_precision" ); + initSpinBox(SpinBox_FY, COORD_MIN, COORD_MAX, SpecificStep, "parametric_precision" ); + initSpinBox(SpinBox_FZ, COORD_MIN, COORD_MAX, SpecificStep, "parametric_precision" ); SpinBox_FX->setValue(aFactor); SpinBox_FY->setValue(aFactor); SpinBox_FZ->setValue(aFactor); @@ -166,7 +167,8 @@ void TransformationGUI_ScaleDlg::Init() LineEdit1->setText(""); LineEdit2->setText(""); - myPoint = GEOM::GEOM_Object::_nil(); + myObjects.clear(); + myPoint.nullify(); // Signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -176,16 +178,14 @@ void TransformationGUI_ScaleDlg::Init() connect(PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(SpinBox_FX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(SpinBox_FY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(SpinBox_FZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + // san : Commented so as not to override specific step settings + //connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); - - connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged())); initName(tr("GEOM_SCALE")); @@ -200,6 +200,9 @@ void TransformationGUI_ScaleDlg::ConstructorsClicked (int constructorId) { disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + myPoint.nullify(); + LineEdit2->clear(); + switch (constructorId) { case 0: // translation an object by dx, dy, dz TextLabel3->setText(tr("GEOM_SCALE_FACTOR")); @@ -232,7 +235,7 @@ void TransformationGUI_ScaleDlg::ConstructorsClicked (int constructorId) SelectionIntoArgument(); } else { - displayPreview(); + processPreview(); } } @@ -242,6 +245,7 @@ void TransformationGUI_ScaleDlg::ConstructorsClicked (int constructorId) //================================================================================= void TransformationGUI_ScaleDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -256,8 +260,11 @@ bool TransformationGUI_ScaleDlg::ClickOnApply() return false; initName(tr("GEOM_SCALE")); + // activate selection and connect selection manager ConstructorsClicked(getConstructorId()); + SelectionIntoArgument(); + return true; } @@ -268,88 +275,34 @@ bool TransformationGUI_ScaleDlg::ClickOnApply() void TransformationGUI_ScaleDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); - - if (myEditCurrentArgument == LineEdit1) - myObjects.length(0); - else if (myEditCurrentArgument == LineEdit2) - myPoint = GEOM::GEOM_Object::_nil(); - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - QString aName; - - if (myEditCurrentArgument == LineEdit1) - { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName); - if (aNbSel < 1) - return; - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects); - if (!myObjects.length()) - return; - else - myEditCurrentArgument->setText(aName); + if ( myEditCurrentArgument == LineEdit1 ) { + myObjects = getSelected( TopAbs_SHAPE, -1 ); + if ( !myObjects.isEmpty() ) { + QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } + else { + myEditCurrentArgument->setText(""); + } } - else if (myEditCurrentArgument == LineEdit2) - { - GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); - if (aSelList.Extent() == 1) - { - Standard_Boolean testResult = Standard_False; - aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (testResult) - { - aName = GEOMBase::GetName(aSelectedObject); - - TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) - { - int anIndex = aMap(1); - aName += QString(":vertex_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else - aSelectedObject = aFindedObject; // get Object from study - } - else // Global Selection - { - if (aShape.ShapeType() != TopAbs_VERTEX) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } - } - } - } + else { + GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX ); + TopoDS_Shape aShape; + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + myPoint = aSelectedObject; + if ( myObjects.isEmpty() ) + PushButton1->click(); + } + else { + myPoint.nullify(); + myEditCurrentArgument->setText(""); } - - myPoint = aSelectedObject; - myEditCurrentArgument->setText(aName); - - if (!myPoint->_is_nil() && !myObjects.length()) - PushButton1->click(); } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -387,21 +340,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_ScaleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == LineEdit1 || send == LineEdit2) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -412,7 +351,7 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -433,7 +372,7 @@ void TransformationGUI_ScaleDlg::enterEvent (QEvent*) //================================================================================= void TransformationGUI_ScaleDlg::ValueChangedInSpinBox() { - displayPreview(); + processPreview(); } //================================================================================= @@ -462,20 +401,22 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() //================================================================================= bool TransformationGUI_ScaleDlg::isValid (QString& msg) { - // && !myPoint->_is_nil() - if (getConstructorId() == 0) { - bool ok = SpinBox_FX->isValid( msg, !IsPreview() ); - return myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001 && ok; + bool ok = false; + if ( getConstructorId() == 0 ) { + ok = SpinBox_FX->isValid( msg, !IsPreview() ) && + !myObjects.isEmpty() && + qAbs( SpinBox_FX->value() ) > 0.00001; } - - bool ok = true; - ok = SpinBox_FX->isValid( msg, !IsPreview() ) && ok; - ok = SpinBox_FY->isValid( msg, !IsPreview() ) && ok; - ok = SpinBox_FZ->isValid( msg, !IsPreview() ) && ok; - return myObjects.length() > 0 && - fabs(SpinBox_FX->value()) > 0.00001 && - fabs(SpinBox_FY->value()) > 0.00001 && - fabs(SpinBox_FZ->value()) > 0.00001 && ok; + else { + ok = SpinBox_FX->isValid( msg, !IsPreview() ) && + SpinBox_FY->isValid( msg, !IsPreview() ) && + SpinBox_FZ->isValid( msg, !IsPreview() ) && + !myObjects.isEmpty() && + qAbs( SpinBox_FX->value() ) > 0.00001 && + qAbs( SpinBox_FY->value() ) > 0.00001 && + qAbs( SpinBox_FZ->value() ) > 0.00001; + } + return ok; } //================================================================================= @@ -488,16 +429,17 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) + for (int i = 0; i < myObjects.count(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value()); + anObj = anOper->ScaleShapeCopy(myObjects[i].get(), myPoint.get(), SpinBox_FX->value()); if (!anObj->_is_nil()) { if(!IsPreview()) anObj->SetParameters(SpinBox_FX->text().toLatin1().constData()); @@ -507,10 +449,9 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects) } else { - for (int i = 0; i < myObjects.length(); i++) + for (int i = 0; i < myObjects.count(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - ScaleShape(myObjects[i], myPoint, SpinBox_FX->value()); + anObj = anOper->ScaleShape(myObjects[i].get(), myPoint.get(), SpinBox_FX->value()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -521,29 +462,27 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects) { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) + for (int i = 0; i < myObjects.count(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(), - SpinBox_FY->value(), SpinBox_FZ->value()); + anObj = anOper->ScaleShapeAlongAxesCopy(myObjects[i].get(), myPoint.get(), SpinBox_FX->value(), + SpinBox_FY->value(), SpinBox_FZ->value()); if (!anObj->_is_nil()) if(!IsPreview()) { QStringList aParameters; aParameters<text(); aParameters<text(); aParameters<text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } objects.push_back(anObj._retn()); } } else { - for (int i = 0; i < myObjects.length(); i++) + for (int i = 0; i < myObjects.count(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - ScaleShapeAlongAxes(myObjects[i], myPoint, SpinBox_FX->value(), - SpinBox_FY->value(), SpinBox_FZ->value()); + anObj = anOper->ScaleShapeAlongAxes(myObjects[i].get(), myPoint.get(), SpinBox_FX->value(), + SpinBox_FY->value(), SpinBox_FZ->value()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -568,7 +507,8 @@ void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr theStud // empty list of arguments means that all arguments should be restored getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true); + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); } } @@ -576,9 +516,9 @@ void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr theStud // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_ScaleDlg::CreateCopyModeChanged (bool isCreateCopy) +void TransformationGUI_ScaleDlg::CreateCopyModeChanged() { - mainFrame()->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled(CheckBoxCopy->isChecked()); } //================================================================================= @@ -590,11 +530,6 @@ void TransformationGUI_ScaleDlg::addSubshapesToStudy() bool toCreateCopy = IsPreview() || CheckBoxCopy->isChecked(); if (toCreateCopy) { - if (!myPoint->_is_nil()) - { - QMap objMap; - objMap[LineEdit2->text()] = myPoint; - addSubshapesToFather(objMap); - } + GEOMBase::PublishSubObject( myPoint.get() ); } } diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.h b/src/TransformationGUI/TransformationGUI_ScaleDlg.h index 0c22428d0..4f4e104aa 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.h +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_ScaleDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef TRANSFORMATIONGUI_SCALEDLG_H #define TRANSFORMATIONGUI_SCALEDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class QCheckBox; class QGroupBox; @@ -45,7 +47,7 @@ class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton public: TransformationGUI_ScaleDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_ScaleDlg(); protected: @@ -61,8 +63,8 @@ private: void enterEvent( QEvent* ); private: - GEOM::ListOfGO myObjects; - GEOM::GEOM_Object_var myPoint; /* Central Point */ + QList myObjects; + GEOM::GeomObjPtr myPoint; /* Central Point */ // to initialize the first selection field with a selected object on the dialog creation bool myInitial; @@ -86,12 +88,11 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); void ValueChangedInSpinBox(); - void CreateCopyModeChanged( bool ); + void CreateCopyModeChanged(); void SetDoubleSpinBoxStep( double ); }; diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index bdbd96a7c..d14cc37cf 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_TranslationDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -31,16 +32,27 @@ #include #include +#include +#include +#include #include #include +#include +#include +#include // OCCT Includes #include #include +#include #include #include #include #include +#include +#include +#include +#include #include @@ -93,7 +105,7 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg // Activate Create a Copy mode GroupPoints->CheckBox2->setChecked(true); - CreateCopyModeChanged(true); + CreateCopyModeChanged(); Init(); } @@ -118,9 +130,9 @@ void TransformationGUI_TranslationDlg::Init() double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); // min, max, step and decimals for spin boxes & initial values - initSpinBox(GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY - initSpinBox(GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, 3); // VSR: TODO: DBL_DIGITS_DISPLAY + initSpinBox(GroupPoints->SpinBox1, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPoints->SpinBox2, COORD_MIN, COORD_MAX, step, "length_precision" ); + initSpinBox(GroupPoints->SpinBox3, COORD_MIN, COORD_MAX, step, "length_precision" ); GroupPoints->SpinBox1->setValue(0.0); GroupPoints->SpinBox2->setValue(0.0); @@ -135,7 +147,10 @@ void TransformationGUI_TranslationDlg::Init() GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit3->setText(""); - myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + myObjects.clear(); + myVector.nullify(); + myPoint1.nullify(); + myPoint2.nullify(); mainFrame()->GroupBoxPublish->show(); @@ -149,16 +164,14 @@ void TransformationGUI_TranslationDlg::Init() connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ? - connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); - connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged(bool))); - connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged())); + connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged())); initName(tr("GEOM_TRANSLATION")); @@ -211,7 +224,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId) GroupPoints->CheckBox1->hide(); - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + myPoint1.nullify(); + myPoint2.nullify(); GroupPoints->PushButton1->click(); } @@ -230,8 +244,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId) GroupPoints->CheckBox1->show(); - myVector = GEOM::GEOM_Object::_nil(); - ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked()); + myVector.nullify(); + ActivateDistanceChanged(); GroupPoints->PushButton1->click(); } @@ -247,7 +261,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId) SelectionIntoArgument(); } else { - displayPreview(); + processPreview(); } } @@ -257,6 +271,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId) //================================================================================= void TransformationGUI_TranslationDlg::ClickOnOk() { + setIsApplyAndClose( true ); if (ClickOnApply()) ClickOnCancel(); } @@ -271,8 +286,11 @@ bool TransformationGUI_TranslationDlg::ClickOnApply() return false; initName(); + // activate selection and connect selection manager ConstructorsClicked(getConstructorId()); + SelectionIntoArgument(); + return true; } @@ -283,125 +301,60 @@ bool TransformationGUI_TranslationDlg::ClickOnApply() void TransformationGUI_TranslationDlg::SelectionIntoArgument() { erasePreview(); - myEditCurrentArgument->setText(""); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myObjects.length(0); - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myPoint1 = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) - myVector = GEOM::GEOM_Object::_nil(); - else if (myEditCurrentArgument == GroupPoints->LineEdit3) - myPoint2 = GEOM::GEOM_Object::_nil(); - - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); - - QString aName; - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName); - if (aNbSel < 1) - return; - - GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects); - if (!myObjects.length()) - return; - else { - myEditCurrentArgument->setText(aName); - // here we do not switch to the next field, because multiple objects can be selected - /* - if (getConstructorId() == 1) { - if (myPoint1->_is_nil()) - GroupPoints->PushButton2->click(); - } - else if (getConstructorId() == 2) { - if (myVector->_is_nil()) - GroupPoints->PushButton2->click(); - } - */ + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { + myObjects = getSelected( TopAbs_SHAPE, -1 ); + if ( !myObjects.isEmpty() ) { + QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() ); + myEditCurrentArgument->setText( aName ); + } + else { + myEditCurrentArgument->setText(""); } } else { - if (aSelList.Extent() != 1) - return; - - // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - aName = GEOMBase::GetName(aSelectedObject); - - // Get Selected object if selected subshape + TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 ) ? + TopAbs_EDGE : TopAbs_VERTEX; + GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType ); TopoDS_Shape aShape; - if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) - { - TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) - aNeedType = TopAbs_EDGE; - - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) - { - int anIndex = aMap(1); - if (aNeedType == TopAbs_EDGE) - aName += QString(":edge_%1").arg(anIndex); - else - aName += QString(":vertex_%1").arg(anIndex); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName); - - if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations(getStudyId()); - aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); - } - else { - aSelectedObject = aFindedObject; - } + if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) { + QString aName = GEOMBase::GetName( aSelectedObject.get() ); + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + if ( getConstructorId() == 1 ) { + myPoint1 = aSelectedObject; + if ( !myPoint2 ) + GroupPoints->PushButton3->click(); + else if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + } + else if ( getConstructorId() == 2 ) { + myVector = aSelectedObject; + if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + } } - else // Global Selection - { - if (aShape.ShapeType() != aNeedType) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - } + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) { + myPoint2 = aSelectedObject; + if ( myObjects.isEmpty() ) + GroupPoints->PushButton1->click(); + else if ( !myPoint1 ) + GroupPoints->PushButton2->click(); } } - - myEditCurrentArgument->setText(aName); - - if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) { - myPoint1 = aSelectedObject; - if (!myPoint1->_is_nil() && myPoint2->_is_nil()) - GroupPoints->PushButton3->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) { - myVector = aSelectedObject; - if (!myVector->_is_nil() && !myObjects.length()) - GroupPoints->PushButton1->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit3) { - myPoint2 = aSelectedObject; - if (!myPoint2->_is_nil() && !myObjects.length()) - GroupPoints->PushButton1->click(); + else { + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { + if ( getConstructorId() == 1 ) myPoint1.nullify(); + else myVector.nullify(); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) { + myPoint2.nullify(); + } + myEditCurrentArgument->setText(""); } } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - - displayPreview(); + processPreview(); } //================================================================================= @@ -456,20 +409,7 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() send->setDown(true); // seems we need it only to avoid preview disappearing, caused by selection mode change - displayPreview(); -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_TranslationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if (send == GroupPoints->LineEdit1) { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + processPreview(); } //================================================================================= @@ -480,7 +420,7 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); ConstructorsClicked( getConstructorId() ); } @@ -501,7 +441,7 @@ void TransformationGUI_TranslationDlg::enterEvent (QEvent*) //================================================================================= void TransformationGUI_TranslationDlg::ValueChangedInSpinBox() { - displayPreview(); + processPreview(); } //================================================================================= @@ -519,28 +459,25 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() //================================================================================= bool TransformationGUI_TranslationDlg::isValid (QString& msg) { - int aConstructorId = getConstructorId(); - - switch (aConstructorId) { + bool ok = false; + switch (getConstructorId()) { case 0: - { - bool ok = true; - ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok; - ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok; - return myObjects.length() > 0 && ok; - } + ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && + GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && + !myObjects.isEmpty(); + break; case 1: - return myObjects.length() > 0 && !(myPoint1->_is_nil() || myPoint2->_is_nil()); + ok = myPoint1 && myPoint2 && !myObjects.isEmpty(); + break; case 2: - { - bool ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ); - return myObjects.length() > 0 && !(myVector->_is_nil()) && ok; - } + ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && + myVector && !myObjects.isEmpty(); + break; default: break; } - return false; + return ok; } //================================================================================= @@ -554,6 +491,8 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { @@ -567,29 +506,27 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) aParameters<SpinBox3->text(); if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - TranslateDXDYDZCopy(myObjects[i], dx, dy, dz); + anObj = anOper->TranslateDXDYDZCopy(myObjects[i].get(), dx, dy, dz); if (!anObj->_is_nil()) { if(!IsPreview()) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back(anObj._retn()); } } } else { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - TranslateDXDYDZ(myObjects[i], dx, dy, dz); + anObj = anOper->TranslateDXDYDZ(myObjects[i].get(), dx, dy, dz); if (!anObj->_is_nil()) { if(!IsPreview()) { - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); - updateAttributes(anObj, aParameters); - } + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + updateAttributes(anObj, aParameters); + } objects.push_back(anObj._retn()); - } + } } } res = true; @@ -598,19 +535,17 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) case 1: { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2); + anObj = anOper->TranslateTwoPointsCopy(myObjects[i].get(), myPoint1.get(), myPoint2.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } } else { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - TranslateTwoPoints(myObjects[i], myPoint1, myPoint2); + anObj = anOper->TranslateTwoPoints(myObjects[i].get(), myPoint1.get(), myPoint2.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -623,36 +558,36 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) QStringList aParameters; aParameters<SpinBox3->text(); bool byDistance = GroupPoints->CheckBox1->isChecked(); + createPathPreview( myVector.get() ); + if (byDistance) { double aDistance = GroupPoints->SpinBox3->value(); - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy); + anObj = anOper->TranslateVectorDistance(myObjects[i].get(), myVector.get(), aDistance, toCreateCopy); if (!anObj->_is_nil()) { - if(!IsPreview()) { - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); - updateAttributes(anObj, aParameters); - } + if(!IsPreview()) { + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + if (!toCreateCopy) + updateAttributes(anObj, aParameters); + } objects.push_back(anObj._retn()); } } } else { if (toCreateCopy) { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - TranslateVectorCopy(myObjects[i], myVector); + anObj = anOper->TranslateVectorCopy(myObjects[i].get(), myVector.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } } else { - for (int i = 0; i < myObjects.length(); i++) { + for (int i = 0; i < myObjects.count(); i++) { myCurrObject = myObjects[i]; - anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> - TranslateVector(myObjects[i], myVector); + anObj = anOper->TranslateVector(myObjects[i].get(), myVector.get()); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } @@ -678,10 +613,11 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr t // and we need to point the first argument directly GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO; anArgs->length(1); - anArgs[0] = myCurrObject; + anArgs[0] = myCurrObject.copy(); getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs, /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true); + /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); } } @@ -689,19 +625,19 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr t // function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_TranslationDlg::CreateCopyModeChanged (bool isCreateCopy) +void TransformationGUI_TranslationDlg::CreateCopyModeChanged() { - mainFrame()->GroupBoxName->setEnabled(isCreateCopy); + mainFrame()->GroupBoxName->setEnabled(GroupPoints->CheckBox2->isChecked()); } //================================================================================= // function : ActivateDistanceChanged() // purpose : //================================================================================= -void TransformationGUI_TranslationDlg::ActivateDistanceChanged (bool theEnable) +void TransformationGUI_TranslationDlg::ActivateDistanceChanged() { - GroupPoints->SpinBox3->setEnabled(theEnable); - displayPreview(); + GroupPoints->SpinBox3->setEnabled( GroupPoints->CheckBox1->isChecked() ); + processPreview(); } //================================================================================= @@ -712,19 +648,42 @@ void TransformationGUI_TranslationDlg::addSubshapesToStudy() { bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked(); if (toCreateCopy) { - QMap objMap; - switch (getConstructorId()) { - case 0: - return; case 1: - objMap[GroupPoints->LineEdit2->text()] = myPoint1; - objMap[GroupPoints->LineEdit3->text()] = myPoint2; + GEOMBase::PublishSubObject( myPoint1.get() ); + GEOMBase::PublishSubObject( myPoint2.get() ); break; case 2: - objMap[GroupPoints->LineEdit2->text()] = myVector; + GEOMBase::PublishSubObject( myVector.get() ); + break; + default: break; } - addSubshapesToFather(objMap); + } +} + +//================================================================================= +// function : createPathPreview +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::createPathPreview ( GEOM::GEOM_Object_ptr thePath ) +{ + if ( IsPreview() ) { + TopoDS_Shape aShape; + GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE ); + TopoDS_Edge anEdge = TopoDS::Edge( aShape ); + ShapeAnalysis_Edge aShapeAnal; + TopoDS_Vertex aFirst = aShapeAnal.FirstVertex( anEdge ); + TopoDS_Vertex aLast = aShapeAnal.LastVertex( anEdge ); + TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape(); + const char* aName = "tmpVector"; + Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName ); + + // add Prs to preview + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); + if (aPrs) + aPrs->AddObject(anIO); + GEOMBase_Helper::displayPreview( aPrs, false, true ); } } diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.h b/src/TransformationGUI/TransformationGUI_TranslationDlg.h index e08425b5a..2bf0a91af 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.h @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // GEOM GEOMGUI : GUI for Geometry component // File : TransformationGUI_TranslationDlg.h // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. @@ -26,7 +27,8 @@ #ifndef TRANSFORMATIONGUI_TRANSLATIONDLG_H #define TRANSFORMATIONGUI_TRANSLATIONDLG_H -#include +#include "GEOMBase_Skeleton.h" +#include "GEOM_GenericObjPtr.h" class DlgRef_3Sel3Spin2Check; @@ -40,7 +42,7 @@ class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton public: TransformationGUI_TranslationDlg( GeometryGUI*, QWidget* = 0, - bool = false, Qt::WindowFlags = 0 ); + bool = false, Qt::WindowFlags = 0 ); ~TransformationGUI_TranslationDlg(); protected: @@ -54,11 +56,12 @@ protected: private: void Init(); void enterEvent( QEvent* ); + void createPathPreview( GEOM::GEOM_Object_ptr ); private: - GEOM::ListOfGO myObjects; - GEOM::GEOM_Object_var myCurrObject; - GEOM::GEOM_Object_var myVector, myPoint1, myPoint2; + QList myObjects; + GEOM::GeomObjPtr myCurrObject; + GEOM::GeomObjPtr myVector, myPoint1, myPoint2; // to initialize the first selection field with a selected object on the dialog creation bool myInitial; @@ -69,14 +72,13 @@ private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); - void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); void ConstructorsClicked( int ); void ValueChangedInSpinBox(); - void CreateCopyModeChanged( bool ); + void CreateCopyModeChanged(); void SetDoubleSpinBoxStep( double ); - void ActivateDistanceChanged( bool ); + void ActivateDistanceChanged(); }; #endif // TRANSFORMATIONGUI_TRANSLATIONDLG_H diff --git a/src/VTKExport/Makefile.am b/src/VTKExport/Makefile.am new file mode 100644 index 000000000..a3485f69e --- /dev/null +++ b/src/VTKExport/Makefile.am @@ -0,0 +1,45 @@ +# Copyright (C) 2007-2012 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 +# + +# $Header$ +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# header files +salomeinclude_HEADERS = + +# Libraries targets +lib_LTLIBRARIES = libVTKExport.la + +dist_libVTKExport_la_SOURCES = \ + VTKExport.cxx + +# additional information to compile and link file + +libVTKExport_la_CPPFLAGS = \ + $(CAS_CPPFLAGS) \ + $(VTK_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + -I$(srcdir)/../OCC2VTK + +libVTKExport_la_LDFLAGS = \ + ../OCC2VTK/libOCC2VTK.la \ + $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \ + $(STDLIB) \ + $(CAS_LDPATH) diff --git a/src/VTKExport/VTKExport.cxx b/src/VTKExport/VTKExport.cxx new file mode 100644 index 000000000..d7ab92002 --- /dev/null +++ b/src/VTKExport/VTKExport.cxx @@ -0,0 +1,159 @@ +// Copyright (C) 2007-2012 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 +// + +// File: VTKExport.cxx +// Author: Oleg UVAROV +// +#include "utilities.h" + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +# if defined VTKEXPORT_EXPORTS || defined VTKExport_EXPORTS +# define VTKEXPORT_EXPORT __declspec( dllexport ) +# else +# define VTKEXPORT_EXPORT __declspec( dllimport ) +# endif +#else +# define VTKEXPORT_EXPORT +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ + VTKEXPORT_EXPORT + int Export(const TopoDS_Shape& theShape, + const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName) + { + MESSAGE("Export VTK into file " << theFileName.ToCString()); + + try + { + GEOM_VertexSource* myVertexSource = GEOM_VertexSource::New(); + GEOM_EdgeSource* myIsolatedEdgeSource = GEOM_EdgeSource::New(); + GEOM_EdgeSource* myOneFaceEdgeSource = GEOM_EdgeSource::New(); + GEOM_EdgeSource* mySharedEdgeSource = GEOM_EdgeSource::New(); + GEOM_WireframeFace* myWireframeFaceSource = GEOM_WireframeFace::New(); + GEOM_ShadingFace* myShadingFaceSource = GEOM_ShadingFace::New(); + + vtkAppendPolyData* myAppendFilter = vtkAppendPolyData::New(); + myAppendFilter->AddInput( myVertexSource->GetOutput() ); + myAppendFilter->AddInput( myIsolatedEdgeSource->GetOutput() ); + myAppendFilter->AddInput( myOneFaceEdgeSource->GetOutput() ); + myAppendFilter->AddInput( mySharedEdgeSource->GetOutput() ); + //myAppendFilter->AddInput( myWireframeFaceSource->GetOutput() ); // iso-lines are unnecessary + myAppendFilter->AddInput( myShadingFaceSource->GetOutput() ); + + float aDeflection = 0.001; + bool anIsVector = false; + + // Is shape triangulated? + bool wasMeshed = true; + TopExp_Explorer ex; + TopLoc_Location aLoc; + for (ex.Init(theShape, TopAbs_FACE); ex.More(); ex.Next()) { + const TopoDS_Face& aFace = TopoDS::Face(ex.Current()); + Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc); + if(aPoly.IsNull()) { + wasMeshed = false; + break; + } + } + + GEOM::MeshShape( theShape, aDeflection ); + + TopExp_Explorer aVertexExp( theShape, TopAbs_VERTEX ); + for( ; aVertexExp.More(); aVertexExp.Next() ) + { + const TopoDS_Vertex& aVertex = TopoDS::Vertex( aVertexExp.Current() ); + myVertexSource->AddVertex( aVertex ); + } + + TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap; + TopExp::MapShapesAndAncestors( theShape, TopAbs_EDGE, TopAbs_FACE, anEdgeMap ); + + GEOM::SetShape( theShape, + anEdgeMap, + anIsVector, + myIsolatedEdgeSource, + myOneFaceEdgeSource, + mySharedEdgeSource, + myWireframeFaceSource, + myShadingFaceSource ); + + myAppendFilter->Update(); + + // Set "C" numeric locale to save numbers correctly + Kernel_Utils::Localizer loc; + + vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New(); + aWriter->SetInput( myAppendFilter->GetOutput() ); + aWriter->SetFileName( theFileName.ToCString() ); + aWriter->Write(); + aWriter->Delete(); + + myVertexSource->Delete(); + myIsolatedEdgeSource->Delete(); + myOneFaceEdgeSource->Delete(); + mySharedEdgeSource->Delete(); + myWireframeFaceSource->Delete(); + myShadingFaceSource->Delete(); + + myAppendFilter->Delete(); + + if(!wasMeshed) + BRepTools::Clean(theShape); + + return 1; + } + catch(Standard_Failure) + { + //THROW_SALOME_CORBA_EXCEPTION("Exception catched in VTKExport", SALOME::BAD_PARAM); + } + return 0; + } +} diff --git a/src/src.pro b/src/src.pro deleted file mode 100644 index 9246c4dfe..000000000 --- a/src/src.pro +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 2007-2008 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 -# -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS = OBJECT -SUBDIRS += ARCHIMEDE -SUBDIRS += NMTDS -SUBDIRS += NMTTools -SUBDIRS += NMTAlgo -SUBDIRS += GEOMAlgo -SUBDIRS += SKETCHER -SUBDIRS += GEOM -SUBDIRS += BREPExport -SUBDIRS += BREPImport -SUBDIRS += IGESExport -SUBDIRS += IGESImport -SUBDIRS += STEPExport -SUBDIRS += STEPImport -SUBDIRS += STLExport -SUBDIRS += ShHealOper -SUBDIRS += GEOMImpl -SUBDIRS += GEOM_I -SUBDIRS += GEOMClient -SUBDIRS += DlgRef -SUBDIRS += GEOMFiltersSelection -SUBDIRS += GEOMGUI -SUBDIRS += GEOMBase -SUBDIRS += GEOMToolsGUI -SUBDIRS += DisplayGUI -SUBDIRS += BasicGUI -SUBDIRS += PrimitiveGUI -SUBDIRS += GenerationGUI -SUBDIRS += EntityGUI -SUBDIRS += BuildGUI -SUBDIRS += BooleanGUI -SUBDIRS += TransformationGUI -#SUBDIRS += OperationGUI -#SUBDIRS += RepairGUI -#SUBDIRS += MeasureGUI -#SUBDIRS += GroupGUI -#SUBDIRS += BlocksGUI -#SUBDIRS += GEOM_I_Superv -#SUBDIRS += GEOM_SWIG