From: nge Date: Fri, 29 May 2009 14:34:14 +0000 (+0000) Subject: Size Map feature integration. X-Git-Tag: V5_1_2rc1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=db09f96ca8438dbbfe598a79507a7104c0223803;p=plugins%2Fblsurfplugin.git Size Map feature integration. Dev doc added. --- diff --git a/Makefile.am b/Makefile.am index d5c2257..d3ca9b6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,9 +38,9 @@ else !BLSURFPLUGIN_ENABLE_GUI -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files endif -SUBDIRS = idl adm_local resources src bin +SUBDIRS = idl adm_local resources src bin doc -DIST_SUBDIRS = idl adm_local resources src bin +DIST_SUBDIRS = idl adm_local resources src bin doc DISTCLEANFILES = a.out aclocal.m4 configure @@ -52,3 +52,12 @@ EXTRA_DIST += \ dist-hook: rm -rf `find $(distdir) -name CVS` + +usr_docs: + (cd doc && $(MAKE) $(AM_MAKEFLAGS) usr_docs) + +docs: usr_docs + +dev_docs: + (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs) + diff --git a/clean_configure b/clean_configure index 8f00366..0d23d94 100755 --- a/clean_configure +++ b/clean_configure @@ -32,6 +32,7 @@ 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 +rm -Rf salome_adm diff --git a/configure.ac b/configure.ac index 2bdc7c3..6df09ba 100644 --- a/configure.ac +++ b/configure.ac @@ -405,11 +405,18 @@ AC_OUTPUT([ \ adm_local/Makefile \ adm_local/unix/Makefile \ adm_local/unix/config_files/Makefile \ + doc/Makefile \ + doc/salome/Makefile \ + doc/salome/gui/Makefile \ + doc/salome/gui/doxyfile \ + doc/salome/tui/Makefile \ + doc/salome/tui/doxyfile \ bin/VERSION \ bin/Makefile \ idl/Makefile \ resources/Makefile \ src/Makefile \ + src/PluginUtils/Makefile \ src/BLSURFPlugin/Makefile \ src/GUI/Makefile \ BLSURFPLUGIN_version.h \ diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..bf2a8e0 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,34 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# -* Makefile *- +# Author : Patrick GOLDBRONN (CEA) +# Date : 30/11/2001 +# +SUBDIRS = salome + +usr_docs: + (cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs) + +docs: usr_docs + +dev_docs: + (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs) diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am new file mode 100644 index 0000000..b17b95b --- /dev/null +++ b/doc/salome/Makefile.am @@ -0,0 +1,40 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# -* Makefile *- +# Author : Patrick GOLDBRONN (CEA) +# Date : 30/11/2001 +# +SUBDIRS = tui gui +SUBDIRSTUI = tui +SUBDIRSGUI = gui + +usr_docs: + @@SETX@; for d in $(SUBDIRSGUI); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; + +docs: usr_docs + +dev_docs: + @@SETX@; for d in $(SUBDIRSTUI); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am new file mode 100644 index 0000000..e5e5b54 --- /dev/null +++ b/doc/salome/gui/Makefile.am @@ -0,0 +1,44 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# 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.in +# Author : Vasily Rusyaev (Open Cascade NN) +# Module : doc +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +EXTRA_DIST += images input static + +usr_docs: doxyfile + echo "Running doxygen in directory: "`pwd`; \ + $(DOXYGEN) $< + +docs: usr_docs + +clean-local: + -rm -fr BLSURFPLUGIN doxygen.bak + +install-data-local: usr_docs + $(INSTALL) -d $(DESTDIR)$(docdir)/gui + cp -rp BLSURFPLUGIN $(DESTDIR)$(docdir)/gui + +uninstall-local: + rm -rf $(DESTDIR)$(docdir)/gui/BLSURFPLUGIN diff --git a/doc/salome/gui/doxyfile.in b/doc/salome/gui/doxyfile.in new file mode 100755 index 0000000..2c4daef --- /dev/null +++ b/doc/salome/gui/doxyfile.in @@ -0,0 +1,65 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "BLSURFPLUGIN Module Reference Manual v.@VERSION@" +OUTPUT_DIRECTORY = BLSURFPLUGIN +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +TAB_SIZE = 5 + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES + +#--------------------------------------------------------------------------- +#Input related options +#--------------------------------------------------------------------------- +INPUT = @srcdir@/input +FILE_PATTERNS = *.doc +IMAGE_PATH = @srcdir@/images + +#--------------------------------------------------------------------------- +#HTML related options +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = . +HTML_HEADER = @srcdir@/static/header.html +HTML_FOOTER = @srcdir@/static/footer.html +#HTML_STYLESHEET = @srcdir@/static/doxygen.css +TOC_EXPAND = YES +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 300 + +#--------------------------------------------------------------------------- +#LaTeX related option +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO + +#--------------------------------------------------------------------------- +#RTF related options +#--------------------------------------------------------------------------- +GENERATE_RTF = NO diff --git a/doc/salome/gui/input/empty b/doc/salome/gui/input/empty new file mode 100644 index 0000000..e69de29 diff --git a/doc/salome/gui/static/footer.html b/doc/salome/gui/static/footer.html new file mode 100755 index 0000000..56d52a6 --- /dev/null +++ b/doc/salome/gui/static/footer.html @@ -0,0 +1,10 @@ + + + + + +
+
Copyright © 2003-2007 CEA, EDF
+
+ + diff --git a/doc/salome/gui/static/header.html b/doc/salome/gui/static/header.html new file mode 100755 index 0000000..a70a95e --- /dev/null +++ b/doc/salome/gui/static/header.html @@ -0,0 +1,12 @@ + + + + + $title + + +
+
+SALOME documentation central +
+
diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am new file mode 100644 index 0000000..4b05cbf --- /dev/null +++ b/doc/salome/tui/Makefile.am @@ -0,0 +1,44 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# 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.in +# Author : Vasily Rusyaev (Open Cascade NN) +# Module : doc +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +EXTRA_DIST += images static + +dev_docs: doxyfile + echo "Running doxygen in directory: "`pwd`; \ + $(DOXYGEN) $<; + +clean-local: + -rm -fr BLSURFPLUGIN doxygen.bak + +install-data-local: + if test -d BLSURFPLUGIN; then \ + $(INSTALL) -d $(DESTDIR)$(docdir)/tui ; \ + cp -rp BLSURFPLUGIN $(DESTDIR)$(docdir)/tui ; \ + fi; + +uninstall-local: + rm -rf $(DESTDIR)$(docdir)/tui/BLSURFPLUGIN diff --git a/doc/salome/tui/doxyfile.in b/doc/salome/tui/doxyfile.in new file mode 100755 index 0000000..3baf75b --- /dev/null +++ b/doc/salome/tui/doxyfile.in @@ -0,0 +1,263 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Doxyfile 1.4.6 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "BLSURFPLUGIN Module Programming Guide v.@VERSION@" +PROJECT_NUMBER = +OUTPUT_DIRECTORY = BLSURFPLUGIN +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = NO +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = @top_srcdir@ @top_builddir@ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = NO +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 5 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = YES +BUILTIN_STL_SUPPORT = @DOXYGEN_SUPPORT_STL@ +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 25 +SHOW_USED_FILES = NO +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @top_srcdir@/src \ + @top_srcdir@/bin \ + @top_srcdir@/idl \ + @top_builddir@/bin +FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = YES +IMAGE_PATH = @srcdir@/images +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 3 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = . +HTML_FILE_EXTENSION = .html +HTML_HEADER = @srcdir@/static/myheader.html +HTML_FOOTER = @srcdir@/static/footer.html +HTML_STYLESHEET = @srcdir@/static/doxygen.css +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = NO + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = NO +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = NO +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = jpg +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1200 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = NO +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/doc/salome/tui/images/Application-About.png b/doc/salome/tui/images/Application-About.png new file mode 100755 index 0000000..7b58330 Binary files /dev/null and b/doc/salome/tui/images/Application-About.png differ diff --git a/doc/salome/tui/images/application.gif b/doc/salome/tui/images/application.gif new file mode 100755 index 0000000..0b05d5c Binary files /dev/null and b/doc/salome/tui/images/application.gif differ diff --git a/doc/salome/tui/images/html_comments.gif b/doc/salome/tui/images/html_comments.gif new file mode 100755 index 0000000..f0c0f0b Binary files /dev/null and b/doc/salome/tui/images/html_comments.gif differ diff --git a/doc/salome/tui/images/logocorp.gif b/doc/salome/tui/images/logocorp.gif new file mode 100755 index 0000000..7697e08 Binary files /dev/null and b/doc/salome/tui/images/logocorp.gif differ diff --git a/doc/salome/tui/static/doxygen.css b/doc/salome/tui/static/doxygen.css new file mode 100755 index 0000000..4893b5e --- /dev/null +++ b/doc/salome/tui/static/doxygen.css @@ -0,0 +1,152 @@ +H1 { + text-align: center; +} + +CAPTION { + font-weight: bold +} + +/* Link in the top navbar */ +A.qindex {} + +A.qindexRef {} + +/* Link to any cross-referenced Doxygen element */ +A.el { + text-decoration: none; + font-weight: bold +} + +A.elRef { + font-weight: bold +} + +/* Link to any cross-referenced Doxygen element inside a code section + (ex: header) +*/ +A.code { + text-decoration: none; + font-weight: normal; + color: #4444ee +} + +A.codeRef { + font-weight: normal; + color: #4444ee +} + +A:hover { + text-decoration: none; + background-color: lightblue +} + +DL.el { + margin-left: -1cm +} + +/* A code fragment (ex: header) */ +DIV.fragment { + width: 100%; + border: none; + background-color: #CCCCCC +} + +/* 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 +} + +/* Method name (+ type) */ +TD.md { + background-color: lightblue; + font-weight: bold; +} + +/* 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 +} + +/* BODY { + background: url(sources/bg_salome.gif) +} */ + +div.tabs { + text-align: justify; + 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 new file mode 100755 index 0000000..cb55f39 --- /dev/null +++ b/doc/salome/tui/static/footer.html @@ -0,0 +1,5 @@ + + + + diff --git a/doc/salome/tui/static/myheader.html b/doc/salome/tui/static/myheader.html new file mode 100755 index 0000000..d2efb75 --- /dev/null +++ b/doc/salome/tui/static/myheader.html @@ -0,0 +1,13 @@ + + + + + + Main Page + + + + +  + + diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index 026602a..470dffc 100644 --- a/idl/BLSURFPlugin_Algorithm.idl +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -19,12 +19,14 @@ // --- // File : BLSURFPlugin_Algorithm.idl // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #ifndef _SMESH_BLSURFALGORITHM_IDL_ #define _SMESH_BLSURFALGORITHM_IDL_ #include "SMESH_Hypothesis.idl" +#include "GEOM_Gen.idl" #include "SALOME_Exception.idl" /*! @@ -160,8 +162,49 @@ module BLSURFPlugin * Note: the method is mostly for interaction with GUI. */ void SetOptionValues(in string_array options); - }; + /*! + * SizeMap + */ + void SetSizeMapEntries(in string_array sizeMaps); + void ClearSizeMaps(); + + void UnsetEntry(in string entry); + + /*! + * Set a SizeMap on geom object + */ + void SetSizeMap(in GEOM::GEOM_Object GeomObj, in string sizeMap); + void UnsetSizeMap(in GEOM::GEOM_Object GeomObj); + + /*! + * Set a SizeMap on geom object given by entry + */ + void SetSizeMapEntry(in string entry, in string sizeMap); + string GetSizeMapEntry(in string entry); + string_array GetSizeMapEntries(); + + /*! + * Set an attractor on geom object + */ + void SetAttractor(in GEOM::GEOM_Object GeomObj, in string attractor); + void UnsetAttractor(in GEOM::GEOM_Object GeomObj); + + /*! + * Set an attractor on geom object given by entry + */ + void SetAttractorEntry(in string entry, in string attractor); + string GetAttractorEntry(in string entry); + string_array GetAttractorEntries(); + +/* + void SetCustomSizeMapEntry(in string entry, in string sizeMap); + string GetCustomSizeMapEntry(in string entry); + void SetCustomSizeMap(in GEOM::GEOM_Object GeomObj, in string sizeMap); + void UnsetCustomSizeMap(in GEOM::GEOM_Object GeomObj); + string_array GetCustomSizeMapEntries(); +*/ + }; }; #endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 39e7d49..ad1dd02 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -20,14 +20,19 @@ // File : BLSURFPlugin_BLSURF.cxx // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) // & Aurelien ALLEAUME (DISTENE) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #include "BLSURFPlugin_BLSURF.hxx" #include "BLSURFPlugin_Hypothesis.hxx" +#include + + #include #include #include +#include #include #include @@ -35,8 +40,10 @@ #include +#include #include #include +#include #include #include @@ -68,6 +75,131 @@ extern "C"{ #include #endif +#include + +#include +#include +#include +#include + +/* ================================== + * =========== 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[] = { + {"softspace", T_INT, offsetof(PyStdOut, softspace), 0, + "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/////////////////////////// + +//////////////////MY MAPS//////////////////////////////////////// +std::map FaceId2SizeMap; +std::map EdgeId2SizeMap; +std::map VertexId2SizeMap; +std::map FaceId2PythonSmp; +std::map EdgeId2PythonSmp; +std::map VertexId2PythonSmp; + + +bool HasSizeMapOnFace=false; +bool HasSizeMapOnEdge=false; +bool HasSizeMapOnVertex=false; + //============================================================================= /*! * @@ -86,6 +218,28 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId, _requireDescretBoundary = false; _onlyUnaryInput = false; _hypothesis = NULL; + + + /* Initialize the Python interpreter */ + assert(Py_IsInitialized()); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + + main_mod = NULL; + main_mod = PyImport_AddModule("__main__"); + + main_dict = NULL; + main_dict = PyModule_GetDict(main_mod); + + PyRun_SimpleString("from math import *"); + PyGILState_Release(gstate); + + FaceId2SizeMap.clear(); + EdgeId2SizeMap.clear(); + VertexId2SizeMap.clear(); + FaceId2PythonSmp.clear(); + EdgeId2PythonSmp.clear(); + VertexId2PythonSmp.clear(); } //============================================================================= @@ -99,6 +253,7 @@ BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF() MESSAGE("BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF"); } + //============================================================================= /*! * @@ -165,6 +320,39 @@ inline std::string to_string(int i) return o.str(); } +double _smp_phy_size; +status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data); +status_t size_on_edge(integer edge_id, real t, real *size, void *user_data); +status_t size_on_vertex(integer vertex_id, real *size, void *user_data); + +double my_u_min=1e6,my_v_min=1e6,my_u_max=-1e6,my_v_max=-1e6; + +///////////////////////////////////////////////////////// +gp_XY getUV(const TopoDS_Face& face, const gp_XYZ& point) +{ + Handle(Geom_Surface) surface = BRep_Tool::Surface(face); + GeomAPI_ProjectPointOnSurf projector( point, surface ); + if ( !projector.IsDone() || projector.NbPoints()==0 ) + throw "Can't project"; + + Quantity_Parameter u,v; + projector.LowerDistanceParameters(u,v); + return gp_XY(u,v); +} +///////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////// +double getT(const TopoDS_Edge& edge, const gp_XYZ& point) +{ + Standard_Real f,l; + Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, f,l); + GeomAPI_ProjectPointOnCurve projector( point, curve); + if ( projector.NbPoints() == 0 ) + throw; + return projector.LowerDistanceParameter(); +} +///////////////////////////////////////////////////////// + void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsurf_session_t *bls) { int _topology = BLSURFPlugin_Hypothesis::GetDefaultTopology(); @@ -177,7 +365,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu bool _quadAllowed = BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed(); bool _decimesh = BLSURFPlugin_Hypothesis::GetDefaultDecimesh(); int _verb = BLSURFPlugin_Hypothesis::GetDefaultVerbosity(); - + if (hyp) { MESSAGE("BLSURFPlugin_BLSURF::SetParameters"); _topology = (int) hyp->GetTopology(); @@ -204,22 +392,142 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt; for ( opIt = opts.begin(); opIt != opts.end(); ++opIt ) if ( !opIt->second.empty() ) { -#ifdef _DEBUG_ - cout << "blsurf_set_param(): " << opIt->first << " = " << opIt->second << endl; -#endif + MESSAGE("blsurf_set_param(): " << opIt->first << " = " << opIt->second); blsurf_set_param(bls, opIt->first.c_str(), opIt->second.c_str()); } } else { MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults"); } - + _smp_phy_size = _phySize; blsurf_set_param(bls, "topo_points", _topology > 0 ? "1" : "0"); blsurf_set_param(bls, "topo_curves", _topology > 0 ? "1" : "0"); blsurf_set_param(bls, "topo_project", _topology > 0 ? "1" : "0"); blsurf_set_param(bls, "clean_boundary", _topology > 1 ? "1" : "0"); blsurf_set_param(bls, "close_boundary", _topology > 1 ? "1" : "0"); blsurf_set_param(bls, "hphy_flag", to_string(_physicalMesh).c_str()); +// blsurf_set_param(bls, "hphy_flag", "2"); + if ((to_string(_physicalMesh))=="2"){ + GeomSelectionTools* GeomST = new GeomSelectionTools::GeomSelectionTools( SMESH::GetActiveStudyDocument()); + + TopoDS_Shape GeomShape; + TopAbs_ShapeEnum GeomType; + // + // Standard Size Maps + // + MESSAGE("Setting a Size Map"); + const BLSURFPlugin_Hypothesis::TSizeMap & sizeMaps = hyp->GetSizeMapEntries(); + BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt; + int i=0; + for ( smIt = sizeMaps.begin(); smIt != sizeMaps.end(); ++smIt ) { + if ( !smIt->second.empty() ) { + MESSAGE("blsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second); + GeomShape = GeomST->entryToShape(smIt->first); + GeomType = GeomShape.ShapeType(); + if (GeomType == TopAbs_FACE){ + HasSizeMapOnFace = true; + FaceId2SizeMap[TopoDS::Face(GeomShape).HashCode(471662)] = smIt->second; + } + if (GeomType == TopAbs_EDGE){ + HasSizeMapOnEdge = true; + HasSizeMapOnFace = true; + EdgeId2SizeMap[TopoDS::Edge(GeomShape).HashCode(471662)] = smIt->second; + } + if (GeomType == TopAbs_VERTEX){ + HasSizeMapOnVertex = true; + HasSizeMapOnEdge = true; + HasSizeMapOnFace = true; + VertexId2SizeMap[TopoDS::Vertex(GeomShape).HashCode(471662)] = smIt->second; + } + } + } + + // + // Attractors + // + MESSAGE("Setting Attractors"); + const BLSURFPlugin_Hypothesis::TSizeMap & attractors = hyp->GetAttractorEntries(); + BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt; + for ( atIt = attractors.begin(); atIt != attractors.end(); ++atIt ) { + if ( !atIt->second.empty() ) { + MESSAGE("blsurf_set_attractor(): " << atIt->first << " = " << atIt->second); + GeomShape = GeomST->entryToShape(atIt->first); + GeomType = GeomShape.ShapeType(); + + if (GeomType == TopAbs_FACE){ + HasSizeMapOnFace = true; + + double xa, ya, za; // Coordinates of attractor point + double a, b; // Attractor parameter + int pos1, pos2; + // atIt->second has the following pattern: + // ATTRACTOR(xa;ya;za;a;b) + // where: + // xa;ya;za : coordinates of attractor + // a : desired size on attractor + // b : distance of influence of attractor + // + // We search the parameters in the string + pos1 = atIt->second.find(";"); + xa = atof(atIt->second.substr(10, pos1-10).c_str()); + pos2 = atIt->second.find(";", pos1+1); + ya = atof(atIt->second.substr(pos1+1, pos2-pos1-1).c_str()); + pos1 = pos2; + pos2 = atIt->second.find(";", pos1+1); + za = atof(atIt->second.substr(pos1+1, pos2-pos1-1).c_str()); + pos1 = pos2; + pos2 = atIt->second.find(";", pos1+1); + a = atof(atIt->second.substr(pos1+1, pos2-pos1-1).c_str()); + pos1 = pos2; + pos2 = atIt->second.find(")"); + b = atof(atIt->second.substr(pos1+1, pos2-pos1-1).c_str()); + + // Get the (u,v) values of the attractor on the face + gp_XY uvPoint = getUV(TopoDS::Face(GeomShape),gp_XYZ(xa,ya,za)); + Standard_Real u0 = uvPoint.X(); + Standard_Real v0 = uvPoint.Y(); + // We construct the python function + ostringstream attractorFunction; + attractorFunction << "def f(u,v): return "; + attractorFunction << _smp_phy_size << "-(" << _smp_phy_size <<"-" << a << ")"; + attractorFunction << "*exp(-((u-("<second; + } + if (GeomType == TopAbs_VERTEX){ + HasSizeMapOnVertex = true; + HasSizeMapOnEdge = true; + HasSizeMapOnFace = true; + VertexId2SizeMap[TopoDS::Vertex(GeomShape).HashCode(471662)] = atIt->second; + } +*/ + } + } + + +// if (HasSizeMapOnFace){ + // In all size map cases (hphy_flag = 2), at least map on face must be defined + MESSAGE("Setting Size Map on FACES "); + blsurf_data_set_sizemap_iso_cad_face(bls, size_on_surface, &_smp_phy_size); +// } + + if (HasSizeMapOnEdge){ + MESSAGE("Setting Size Map on EDGES "); + blsurf_data_set_sizemap_iso_cad_edge(bls, size_on_edge, &_smp_phy_size); + } + if (HasSizeMapOnVertex){ + MESSAGE("Setting Size Map on VERTICES "); + blsurf_data_set_sizemap_iso_cad_point(bls, size_on_vertex, &_smp_phy_size); + } + } blsurf_set_param(bls, "hphydef", to_string(_phySize).c_str()); blsurf_set_param(bls, "hgeo_flag", to_string(_geometricMesh).c_str()); blsurf_set_param(bls, "angle_meshs", to_string(_angleMeshS).c_str()); @@ -246,10 +554,10 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) MESSAGE("BLSURFPlugin_BLSURF::Compute"); if (aShape.ShapeType() == TopAbs_COMPOUND) { - cout << " the shape is a COMPOUND" << endl; + MESSAGE(" the shape is a COMPOUND"); } else { - cout << " the shape is UNKNOWN" << endl; + MESSAGE(" the shape is UNKNOWN"); }; context_t *ctx = context_new(); @@ -257,19 +565,39 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) cad_t *c = cad_new(ctx); + blsurf_session_t *bls = blsurf_session_new(ctx); + + + SetParameters(_hypothesis, bls); + TopTools_IndexedMapOfShape fmap; TopTools_IndexedMapOfShape emap; TopTools_IndexedMapOfShape pmap; vector curves; vector surfaces; + + fmap.Clear(); + FaceId2PythonSmp.clear(); emap.Clear(); + EdgeId2PythonSmp.clear(); pmap.Clear(); + VertexId2PythonSmp.clear(); surfaces.resize(0); curves.resize(0); + assert(Py_IsInitialized()); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); +/* + Standard_Real u_min; + Standard_Real v_min; + Standard_Real u_max; + Standard_Real v_max; +*/ int iface = 0; + string bad_end = "return"; for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) { TopoDS_Face f=TopoDS::Face(face_iter.Current()); if (fmap.FindIndex(f) > 0) @@ -278,6 +606,26 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) fmap.Add(f); iface++; surfaces.push_back(BRep_Tool::Surface(f)); + // Get bound values of uv surface + //BRep_Tool::Surface(f)->Bounds(u_min,u_max,v_min,v_max); + //MESSAGE("BRep_Tool::Surface(f)->Bounds(u_min,u_max,v_min,v_max): " << u_min << ", " << u_max << ", " << v_min << ", " << v_max); + + if ((HasSizeMapOnFace) && FaceId2SizeMap.find(f.HashCode(471662))!=FaceId2SizeMap.end()){ + MESSAGE("FaceId2SizeMap[f.HashCode(471662)].find(bad_end): " << FaceId2SizeMap[f.HashCode(471662)].find(bad_end)); + MESSAGE("FaceId2SizeMap[f.HashCode(471662)].size(): " << FaceId2SizeMap[f.HashCode(471662)].size()); + MESSAGE("bad_end.size(): " << bad_end.size()); + // check if function ends with "return" + if (FaceId2SizeMap[f.HashCode(471662)].find(bad_end) == (FaceId2SizeMap[f.HashCode(471662)].size()-bad_end.size()-1)) + continue; + // Expr To Python function, verification is performed at validation in GUI + PyObject * obj = NULL; + obj= PyRun_String(FaceId2SizeMap[f.HashCode(471662)].c_str(), Py_file_input, main_dict, NULL); + Py_DECREF(obj); + PyObject * func = NULL; + func = PyObject_GetAttrString(main_mod, "f"); + FaceId2PythonSmp[iface]=func; + FaceId2SizeMap.erase(f.HashCode(471662)); + } cad_face_t *fce = cad_face_new(c, iface, surf_fun, surfaces.back()); cad_face_set_tag(fce, iface); if(f.Orientation() != TopAbs_FORWARD){ @@ -294,6 +642,18 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) double tmin,tmax; curves.push_back(BRep_Tool::CurveOnSurface(e, f, tmin, tmax)); + if ((HasSizeMapOnEdge) && EdgeId2SizeMap.find(e.HashCode(471662))!=EdgeId2SizeMap.end()){ + if (EdgeId2SizeMap[e.HashCode(471662)].find(bad_end) == (EdgeId2SizeMap[e.HashCode(471662)].size()-bad_end.size()-1)) + continue; + // Expr To Python function, verification is performed at validation in GUI + PyObject * obj = NULL; + obj= PyRun_String(EdgeId2SizeMap[e.HashCode(471662)].c_str(), Py_file_input, main_dict, NULL); + Py_DECREF(obj); + PyObject * func = NULL; + func = PyObject_GetAttrString(main_mod, "f"); + EdgeId2PythonSmp[ic]=func; + EdgeId2SizeMap.erase(e.HashCode(471662)); + } cad_edge_t *edg = cad_edge_new(fce, ic, tmin, tmax, curv_fun, curves.back()); cad_edge_set_tag(edg, ic); cad_edge_set_property(edg, EDGE_PROPERTY_SOFT_REQUIRED); @@ -307,7 +667,6 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) Standard_Real d1=0,d2=0; for (TopExp_Explorer ex_edge(e ,TopAbs_VERTEX); ex_edge.More(); ex_edge.Next()) { TopoDS_Vertex v = TopoDS::Vertex(ex_edge.Current()); - ++npts; if (npts == 1){ ip = &ip1; @@ -319,10 +678,22 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) *ip = pmap.FindIndex(v); if(*ip <= 0) *ip = pmap.Add(v); + if ((HasSizeMapOnVertex) && VertexId2SizeMap.find(v.HashCode(471662))!=VertexId2SizeMap.end()){ + if (VertexId2SizeMap[v.HashCode(471662)].find(bad_end) == (VertexId2SizeMap[v.HashCode(471662)].size()-bad_end.size()-1)) + continue; + // Expr To Python function, verification is performed at validation in GUI + PyObject * obj = NULL; + obj= PyRun_String(VertexId2SizeMap[v.HashCode(471662)].c_str(), Py_file_input, main_dict, NULL); + Py_DECREF(obj); + PyObject * func = NULL; + func = PyObject_GetAttrString(main_mod, "f"); + VertexId2PythonSmp[*ip]=func; + VertexId2SizeMap.erase(v.HashCode(471662)); + } } if (npts != 2) { // should not happen - cout << "An edge does not have 2 extremities." << endl; + MESSAGE("An edge does not have 2 extremities."); } else { if (d1 < d2) cad_edge_set_extremities(edg, ip1, ip2); @@ -333,16 +704,13 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) } //for face + PyGILState_Release(gstate); - - blsurf_session_t *bls = blsurf_session_new(ctx); blsurf_data_set_cad(bls, c); - SetParameters(_hypothesis, bls); - - cout << endl; - cout << "Beginning of Surface Mesh generation" << endl; - cout << endl; + std::cout << std::endl; + std::cout << "Beginning of Surface Mesh generation" << std::endl; + std::cout << std::endl; // Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false) #ifndef WNT @@ -380,9 +748,9 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) return error(_comment); } - cout << endl; - cout << "End of Surface Mesh generation" << endl; - cout << endl; + std::cout << std::endl; + std::cout << "End of Surface Mesh generation" << std::endl; + std::cout << std::endl; mesh_t *msh; blsurf_data_get_mesh(bls, &msh); @@ -604,6 +972,125 @@ status_t surf_fun(real *uv, real *xyz, real*du, real *dv, return 0; } + +status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data) +{ + if (face_id == 1) { + if (my_u_min > uv[0]) { + my_u_min = uv[0]; + } + if (my_v_min > uv[1]) { + my_v_min = uv[1]; + } + if (my_u_max < uv[0]) { + my_u_max = uv[0]; + } + if (my_v_max < uv[1]) { + my_v_max = uv[1]; + } + } + + if (FaceId2PythonSmp.count(face_id) != 0){ + PyObject * pyresult = NULL; + PyObject* new_stderr = NULL; + assert(Py_IsInitialized()); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + pyresult = PyObject_CallFunction(FaceId2PythonSmp[face_id],"(f,f)",uv[0],uv[1]); + double result; + if ( pyresult == NULL){ + fflush(stderr); + string err_description=""; + new_stderr = newPyStdOut(err_description); + PySys_SetObject("stderr", new_stderr); + PyErr_Print(); + PySys_SetObject("stderr", PySys_GetObject("__stderr__")); + Py_DECREF(new_stderr); + MESSAGE("Can't evaluate f(" << uv[0] << "," << uv[1] << ")" << " error is " << err_description); + result = *((double*)user_data); + } + else { + result = PyFloat_AsDouble(pyresult); + Py_DECREF(pyresult); + } + *size = result; + //MESSAGE("f(" << uv[0] << "," << uv[1] << ")" << " = " << result); + PyGILState_Release(gstate); + } + else { + *size = *((double*)user_data); + } + return STATUS_OK; +} + +status_t size_on_edge(integer edge_id, real t, real *size, void *user_data) +{ + if (EdgeId2PythonSmp.count(edge_id) != 0){ + PyObject * pyresult = NULL; + PyObject* new_stderr = NULL; + assert(Py_IsInitialized()); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + pyresult = PyObject_CallFunction(EdgeId2PythonSmp[edge_id],"(f)",t); + double result; + if ( pyresult == NULL){ + fflush(stderr); + string err_description=""; + new_stderr = newPyStdOut(err_description); + PySys_SetObject("stderr", new_stderr); + PyErr_Print(); + PySys_SetObject("stderr", PySys_GetObject("__stderr__")); + Py_DECREF(new_stderr); + MESSAGE("Can't evaluate f(" << t << ")" << " error is " << err_description); + result = *((double*)user_data); + } + else { + result = PyFloat_AsDouble(pyresult); + Py_DECREF(pyresult); + } + *size = result; + PyGILState_Release(gstate); + } + else { + *size = *((double*)user_data); + } + return STATUS_OK; +} + +status_t size_on_vertex(integer point_id, real *size, void *user_data) +{ + if (VertexId2PythonSmp.count(point_id) != 0){ + PyObject * pyresult = NULL; + PyObject* new_stderr = NULL; + assert(Py_IsInitialized()); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + pyresult = PyObject_CallFunction(VertexId2PythonSmp[point_id],""); + double result; + if ( pyresult == NULL){ + fflush(stderr); + string err_description=""; + new_stderr = newPyStdOut(err_description); + PySys_SetObject("stderr", new_stderr); + PyErr_Print(); + PySys_SetObject("stderr", PySys_GetObject("__stderr__")); + Py_DECREF(new_stderr); + MESSAGE("Can't evaluate f()" << " error is " << err_description); + result = *((double*)user_data); + } + else { + result = PyFloat_AsDouble(pyresult); + Py_DECREF(pyresult); + } + *size = result; + PyGILState_Release(gstate); + } + else { + *size = *((double*)user_data); + } + return STATUS_OK; +} + status_t message_callback(message_t *msg, void *user_data) { integer errnumber = 0; @@ -621,7 +1108,7 @@ status_t message_callback(message_t *msg, void *user_data) error->append( desc, len ); } else { - cout << desc; + std::cout << desc << std::endl; } return STATUS_OK; } diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx index 8dd022f..8f442fb 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -20,11 +20,13 @@ // File : BLSURFPlugin_BLSURF.hxx // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) // & Aurelien ALLEAUME (DISTENE) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #ifndef _BLSURFPlugin_BLSURF_HXX_ #define _BLSURFPlugin_BLSURF_HXX_ +#include #include "SMESH_2D_Algo.hxx" #include "SMESH_Mesh.hxx" #include "Utils_SALOME_Exception.hxx" @@ -52,9 +54,14 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { istream & LoadFrom(istream & load); friend ostream & operator << (ostream & save, BLSURFPlugin_BLSURF & hyp); friend istream & operator >> (istream & load, BLSURFPlugin_BLSURF & hyp); - + protected: const BLSURFPlugin_Hypothesis* _hypothesis; + + private: + PyObject * main_mod; + PyObject * main_dict; + }; #endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index d5967a8..ae1d60e 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -20,6 +20,7 @@ // File : BLSURFPlugin_Hypothesis.cxx // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) // & Aurelien ALLEAUME (DISTENE) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #include "BLSURFPlugin_Hypothesis.hxx" @@ -121,6 +122,8 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis (int hypId, int studyId, _charOptions.insert( charOptionNames[i] ); _option2value[ charOptionNames[i++] ].clear(); } + + _sizeMap.clear(); } //============================================================================= @@ -334,6 +337,69 @@ void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName) op_val->second.clear(); } + +void BLSURFPlugin_Hypothesis::SetSizeMapEntry(const std::string& entry,const std::string& sizeMap) +{ + if (_sizeMap[entry].compare(sizeMap) != 0) { + _sizeMap[entry]=sizeMap; + NotifySubMeshesHypothesisModification(); + } +} + +std::string BLSURFPlugin_Hypothesis::GetSizeMapEntry(const std::string& entry) +{ + TSizeMap::iterator it = _sizeMap.find( entry ); + if ( it != _sizeMap.end() ) + return it->second; + else + return "No_Such_Entry"; +} + +void BLSURFPlugin_Hypothesis::SetAttractorEntry(const std::string& entry,const std::string& attractor) +{ + if (_attractors[entry].compare(attractor) != 0) { + _attractors[entry]=attractor; + NotifySubMeshesHypothesisModification(); + } +} + +std::string BLSURFPlugin_Hypothesis::GetAttractorEntry(const std::string& entry) +{ + TSizeMap::iterator it = _attractors.find( entry ); + if ( it != _attractors.end() ) + return it->second; + else + return "No_Such_Entry"; +} + + +void BLSURFPlugin_Hypothesis::ClearEntry(const std::string& entry) +{ + TSizeMap::iterator it = _sizeMap.find( entry ); + if ( it != _sizeMap.end() ) { + _sizeMap.erase(it); + NotifySubMeshesHypothesisModification(); + } + else { + TSizeMap::iterator itAt = _attractors.find( entry ); + if ( itAt != _attractors.end() ) { + _attractors.erase(itAt); + NotifySubMeshesHypothesisModification(); + } + else + std::cout<<"No_Such_Entry"<second.empty() ) - save << " " << op_val->first - << " " << op_val->second << "%#"; // "%#" is a mark of value end + if (op_val != _option2value.end()) { + save << " " << "__OPTIONS_BEGIN__"; + for ( ; op_val != _option2value.end(); ++op_val ) { + if ( !op_val->second.empty() ) + save << " " << op_val->first + << " " << op_val->second << "%#"; // "%#" is a mark of value end + } + save << " " << "__OPTIONS_END__"; } + TSizeMap::iterator it_sm = _sizeMap.begin(); + if (it_sm != _sizeMap.end()) { + save << " " << "__SIZEMAP_BEGIN__"; + for ( ; it_sm != _sizeMap.end(); ++it_sm ) { + save << " " << it_sm->first + << " " << it_sm->second << "%#"; // "%#" is a mark of value end + } + save << " " << "__SIZEMAP_END__"; + } + + TSizeMap::iterator it_at = _attractors.begin(); + if (it_at != _attractors.end()) { + save << " " << "__ATTRACTORS_BEGIN__"; + for ( ; it_at != _attractors.end(); ++it_at ) { + save << " " << it_at->first + << " " << it_at->second << "%#"; // "%#" is a mark of value end + } + save << " " << "__ATTRACTORS_END__"; + } + + return save; } @@ -453,11 +544,28 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) else load.clear(std::ios::badbit | load.rdstate()); + std::string option_or_sm; + bool hasOptions = false; + bool hasSizeMap = false; + bool hasAttractor = false; + + isOK = (load >> option_or_sm); + if (isOK) + if (option_or_sm == "__OPTIONS_BEGIN__") + hasOptions = true; + else if (option_or_sm == "__SIZEMAP_BEGIN__") + hasSizeMap = true; + else if (option_or_sm == "__ATTRACTORS_BEGIN__") + hasAttractor = true; + std::string optName, optValue; - while (isOK) { + while (isOK && hasOptions) { isOK = (load >> optName); - if (isOK) + if (isOK) { + if (optName == "__OPTIONS_END__") + break; isOK = (load >> optValue); + } if (isOK) { std::string & value = _option2value[ optName ]; value = optValue; @@ -479,6 +587,79 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) } } + if (hasOptions) { + isOK = (load >> option_or_sm); + if (isOK) + if (option_or_sm == "__SIZEMAP_BEGIN__") + hasSizeMap = true; + else if (option_or_sm == "__ATTRACTORS_BEGIN__") + hasAttractor = true; + } + + std::string smEntry, smValue; + while (isOK && hasSizeMap) { + isOK = (load >> smEntry); + if (isOK) { + if (smEntry == "__SIZEMAP_END__") + break; + isOK = (load >> smValue); + } + if (isOK) { + std::string & value2 = _sizeMap[ smEntry ]; + value2 = smValue; + int len2= value2.size(); + // continue reading until "%#" encountered + while ( value2[len2-1] != '#' || value2[len2-2] != '%' ) + { + isOK = (load >> smValue); + if (isOK) { + value2 += " "; + value2 += smValue; + len2 = value2.size(); + } + else { + break; + } + } + value2[ len2-2 ] = '\0'; //cut off "%#" + } + } + + if (hasSizeMap) { + isOK = (load >> option_or_sm); + if (isOK && option_or_sm == "__ATTRACTORS_BEGIN__") + hasAttractor = true; + } + + std::string atEntry, atValue; + while (isOK && hasAttractor) { + isOK = (load >> atEntry); + if (isOK) { + if (atEntry == "__ATTRACTORS_END__") + break; + isOK = (load >> atValue); + } + if (isOK) { + std::string & value3 = _attractors[ atEntry ]; + value3 = atValue; + int len3= value3.size(); + // continue reading until "%#" encountered + while ( value3[len3-1] != '#' || value3[len3-2] != '%' ) + { + isOK = (load >> atValue); + if (isOK) { + value3 += " "; + value3 += atValue; + len3 = value3.size(); + } + else { + break; + } + } + value3[ len3-2 ] = '\0'; //cut off "%#" + } + } + return load; } diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx index a8fb7d2..de5af16 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx @@ -20,6 +20,7 @@ // File : BLSURFPlugin_Hypothesis.hxx // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) // & Aurelien ALLEAUME (DISTENE) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #ifndef _BLSURFPlugin_Hypothesis_HXX_ @@ -95,6 +96,28 @@ public: void SetVerbosity(int theVal); int GetVerbosity() const { return _verb; } + + void ClearEntry(const std::string& entry); + void ClearSizeMaps(); + + typedef std::map TSizeMap; + + void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap ); + std::string GetSizeMapEntry(const std::string& entry); + const TSizeMap& GetSizeMapEntries() const { return _sizeMap; } + + + void SetAttractorEntry(const std::string& entry,const std::string& attractor ); + std::string GetAttractorEntry(const std::string& entry); + const TSizeMap& GetAttractorEntries() const { return _attractors; }; + + +/* + void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap ); + std::string GetCustomSizeMapEntry(const std::string& entry); + void UnsetCustomSizeMap(const std::string& entry); + const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; } + */ static Topology GetDefaultTopology(); static PhysicalMesh GetDefaultPhysicalMesh(); @@ -152,6 +175,11 @@ private: int _verb; TOptionValues _option2value; TOptionNames _doubleOptions, _charOptions; + TSizeMap _sizeMap; + TSizeMap _attractors; +/* + TSizeMap _customSizeMap; +*/ }; #endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index 55ca0d8..815ea9d 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -19,11 +19,13 @@ // --- // File : BLSURFPlugin_Hypothesis.cxx // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #include "BLSURFPlugin_Hypothesis_i.hxx" #include "SMESH_Gen.hxx" #include "SMESH_PythonDump.hxx" +#include "GEOM_Object.hxx" #include "Utils_CorbaException.hxx" #include "utilities.h" @@ -507,6 +509,273 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array } } +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry,const char* sizeMap) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry); + bool valueChanged = false; + try { + valueChanged = ( this->GetImpl()->GetSizeMapEntry(entry) != sizeMap ); + if ( valueChanged ) + this->GetImpl()->SetSizeMapEntry(entry, sizeMap); + } + catch (const std::invalid_argument& ex) { + SALOME::ExceptionStruct ExDescription; + ExDescription.text = ex.what(); + ExDescription.type = SALOME::BAD_PARAM; + ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)"; + ExDescription.lineNumber = 0; + throw SALOME::SALOME_Exception(ExDescription); + } + catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry); + if ( valueChanged ) + SMESH::TPythonDump() << _this() << ".SetSizeMap(" + << entry << ", '" << sizeMap << "' )"; +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry,const char* attractor ) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry); + bool valueChanged = false; + try { + valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor ); + if ( valueChanged ) + this->GetImpl()->SetAttractorEntry(entry, attractor); + } + catch (const std::invalid_argument& ex) { + SALOME::ExceptionStruct ExDescription; + ExDescription.text = ex.what(); + ExDescription.type = SALOME::BAD_PARAM; + ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)"; + ExDescription.lineNumber = 0; + throw SALOME::SALOME_Exception(ExDescription); + } + catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry); + if ( valueChanged ) + SMESH::TPythonDump() << _this() << ".SetAttractor(" + << entry << ", '" << attractor << "' )"; +} + + +//============================================================================= + +char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + try { + return CORBA::string_dup( this->GetImpl()->GetSizeMapEntry(entry).c_str()); + } + catch (const std::invalid_argument& ex) { + SALOME::ExceptionStruct ExDescription; + ExDescription.text = ex.what(); + ExDescription.type = SALOME::BAD_PARAM; + ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)"; + ExDescription.lineNumber = 0; + throw SALOME::SALOME_Exception(ExDescription); + } + catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + return 0; +} + +//============================================================================= + +char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + try { + return CORBA::string_dup( this->GetImpl()->GetAttractorEntry(entry).c_str()); + } + catch (const std::invalid_argument& ex) { + SALOME::ExceptionStruct ExDescription; + ExDescription.text = ex.what(); + ExDescription.type = SALOME::BAD_PARAM; + ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)"; + ExDescription.lineNumber = 0; + throw SALOME::SALOME_Exception(ExDescription); + } + catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + return 0; +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) +{ + ASSERT(myBaseImpl); + this->GetImpl()->ClearEntry(entry); +// SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )"; +} + +//============================================================================= + +BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() +{ + ASSERT(myBaseImpl); + BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array(); + + const ::BLSURFPlugin_Hypothesis::TSizeMap & sizeMaps= this->GetImpl()->GetSizeMapEntries(); + result->length( sizeMaps.size() ); + + ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin(); + for ( int i = 0 ; smIt != sizeMaps.end(); ++smIt, ++i ) { + string entry_sizemap = smIt->first; + if ( !smIt->second.empty() ) { + entry_sizemap += "|"; + entry_sizemap += smIt->second; + } + result[i] = CORBA::string_dup(entry_sizemap.c_str()); + } + return result._retn(); +} + +//============================================================================= + +BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() +{ + ASSERT(myBaseImpl); + BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array(); + + const ::BLSURFPlugin_Hypothesis::TSizeMap & attractors= this->GetImpl()->GetAttractorEntries(); + result->length( attractors.size() ); + + ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin(); + for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) { + string entry_attractor = atIt->first; + if ( !atIt->second.empty() ) { + entry_attractor += "|"; + entry_attractor += atIt->second; + } + result[i] = CORBA::string_dup(entry_attractor.c_str()); + } + return result._retn(); +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + for (int i = 0; i < sizeMaps.length(); ++i) + { + string entry_sizemap = sizeMaps[i].in(); + int colonPos = entry_sizemap.find( '|' ); + string entry, sizemap; + if ( colonPos == string::npos ) // '|' separator not found + entry = entry_sizemap; + else { + entry = entry_sizemap.substr( 0, colonPos); + if ( colonPos < entry_sizemap.size()-1 && entry_sizemap[colonPos] != ' ') + sizemap = entry_sizemap.substr( colonPos+1 ); + } + this->GetImpl()->SetSizeMapEntry( entry.c_str(), sizemap.c_str() ); + } +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() +{ + ASSERT(myBaseImpl); + this->GetImpl()->ClearSizeMaps(); +} + + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj,const char* sizeMap) +{ + ASSERT(myBaseImpl); + string entry; + entry=GeomObj->GetStudyEntry(); + MESSAGE("IDL : GetName : " << GeomObj->GetName()); + MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")"); + SetSizeMapEntry( entry.c_str(),sizeMap); +} + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) +{ + ASSERT(myBaseImpl); + string entry; + entry=GeomObj->GetStudyEntry(); + MESSAGE("IDL : GetName : " << GeomObj->GetName()); + MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")"); + UnsetEntry( entry.c_str()); + SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )"; +} + + +void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) +{ + ASSERT(myBaseImpl); + string entry; + entry=GeomObj->GetStudyEntry(); + MESSAGE("IDL : GetName : " << GeomObj->GetName()); + MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")"); + SetAttractorEntry( entry.c_str(),attractor); +} + +void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) +{ + ASSERT(myBaseImpl); + string entry; + entry=GeomObj->GetStudyEntry(); + MESSAGE("IDL : GetName : " << GeomObj->GetName()); + MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")"); + UnsetEntry( entry.c_str()); + SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )"; +} + + + + +/* +void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) +{} + +void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj) +{} + +void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception) +{} + +char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) +{} + +void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry) +{ + ASSERT(myBaseImpl); + this->GetImpl()->UnsetCustomSizeMap(entry); + SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )"; +} + + +BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries() +{} + +*/ + + //============================================================================= /*! * BLSURFPlugin_Hypothesis_i::GetImpl diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index 76b826f..eef9617 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -19,6 +19,7 @@ // --- // File : BLSURFPlugin_Hypothesis.hxx // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #ifndef _BLSURFPlugin_Hypothesis_i_HXX_ @@ -31,6 +32,7 @@ #include "BLSURFPlugin_Hypothesis.hxx" class SMESH_Gen; +class GEOM_Object; // BLSURFPlugin parameters hypothesis @@ -98,6 +100,46 @@ class BLSURFPlugin_Hypothesis_i: void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception); + void SetSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception); + + char* GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception); + + void UnsetEntry(const char* entry); + + BLSURFPlugin::string_array* GetSizeMapEntries(); + + void SetSizeMapEntries(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception); + + void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap); + + void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj); + + void ClearSizeMaps(); + + + void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor); + + void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj); + + void SetAttractorEntry(const char* entry,const char* attractor ) throw (SALOME::SALOME_Exception); + + char* GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception); + + BLSURFPlugin::string_array* GetAttractorEntries(); + + +/* + void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap); + + void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj); + + void SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception); + + char* GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception); + + BLSURFPlugin::string_array* GetCustomSizeMapEntries(); +*/ + // Get implementation ::BLSURFPlugin_Hypothesis* GetImpl(); diff --git a/src/BLSURFPlugin/Makefile.am b/src/BLSURFPlugin/Makefile.am index e78b060..5e7b1b3 100644 --- a/src/BLSURFPlugin/Makefile.am +++ b/src/BLSURFPlugin/Makefile.am @@ -24,25 +24,27 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files -salomeinclude_HEADERS = +salomeinclude_HEADERS = \ + BLSURFPlugin_BLSURF.hxx \ + BLSURFPlugin_BLSURF_i.hxx \ + BLSURFPlugin_Hypothesis.hxx \ + BLSURFPlugin_Hypothesis_i.hxx # Libraries targets lib_LTLIBRARIES = libBLSURFEngine.la dist_libBLSURFEngine_la_SOURCES = \ - BLSURFPlugin_BLSURF.hxx \ BLSURFPlugin_BLSURF.cxx \ - BLSURFPlugin_BLSURF_i.hxx \ BLSURFPlugin_BLSURF_i.cxx \ - BLSURFPlugin_Hypothesis.hxx \ BLSURFPlugin_Hypothesis.cxx \ - BLSURFPlugin_Hypothesis_i.hxx \ BLSURFPlugin_Hypothesis_i.cxx \ BLSURFPlugin_i.cxx libBLSURFEngine_la_CPPFLAGS = \ - $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) \ + $(QT_INCLUDES) \ + $(PYTHON_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ $(MED_CXXFLAGS) \ $(GEOM_CXXFLAGS) \ $(CAS_CPPFLAGS) \ @@ -51,11 +53,15 @@ libBLSURFEngine_la_CPPFLAGS = \ $(CORBA_CXXFLAGS) \ $(CORBA_INCLUDES) \ $(BOOST_CPPFLAGS) \ + -I$(srcdir)/../PluginUtils \ -I$(top_builddir)/idl \ - -I$(top_builddir)/salome_adm/unix + -I$(top_builddir)/salome_adm/unix + +#Qt uniquement necessaire pour le getActiveStudyDocument de SMeshGuiUtils.h libBLSURFEngine_la_LDFLAGS = \ ../../idl/libSalomeIDLBLSURFPLUGIN.la \ + ../PluginUtils/libGeomSelectionTools.la \ $(BLSURF_LIBS) \ $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lStdMeshersEngine \ $(KERNEL_LDFLAGS) -lSalomeGenericObj diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index ba14fc8..ab94476 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D + // Copyright (C) 2007-2008 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,14 @@ // File : BLSURFPluginGUI_HypothesisCreator.cxx // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) // & Aurelien ALLEAUME (DISTENE) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #include "BLSURFPluginGUI_HypothesisCreator.h" #include #include +#include #include #include @@ -48,19 +50,33 @@ #include #include #include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// #include #define WITH_SIZE_BOUNDARIES enum Topology { FromCAD, Process, Process2 - }; + } ; enum PhysicalMesh { DefaultSize = 0, - PhysicalUserDefined + PhysicalUserDefined, + SizeMap }; enum GeometricMesh @@ -72,21 +88,188 @@ enum GeometricMesh enum { STD_TAB = 0, ADV_TAB, + SMP_TAB, OPTION_ID_COLUMN = 0, OPTION_NAME_COLUMN, OPTION_VALUE_COLUMN, - NB_COLUMNS + NB_COLUMNS, + SMP_ENTRY_COLUMN = 0, + SMP_NAME_COLUMN, + SMP_SIZEMAP_COLUMN, + SMP_NB_COLUMNS +}; + +enum { + SMP_BTNS = 0, +// SMP_ATTRACTOR_BTN, +// SMP_SEPARATOR1, + SMP_POINT_BTN, + SMP_EDGE_BTN, + SMP_SURFACE_BTN, + SMP_SEPARATOR2, + SMP_REMOVE_BTN, +}; + +/************************************************** + Begin initialization Python structures and objects +***************************************************/ + +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[] = { + {"softspace", T_INT, offsetof(PyStdOut, softspace), 0, + "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 initialization Python structures and objects +**************************************************/ + +/** + * \brief {BLSURFPluginGUI_HypothesisCreator constructor} + * @param theHypType Name of the hypothesis type (here BLSURF_Parameters) + * + * */ BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType ) : SMESHGUI_GenericHypothesisCreator( theHypType ) { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator"); + this->mySMPMap.clear(); + + GeomToolSelected = NULL; + GeomToolSelected = getGeomSelectionTool(); + + aSel = GeomToolSelected->selectionMgr(); + + /* Initialize the Python interpreter */ + if (not Py_IsInitialized()) + throw ("Error: Python interpreter is not initialized"); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + + main_mod = NULL; + main_mod = PyImport_AddModule("__main__"); + + main_dict = NULL; + main_dict = PyModule_GetDict(main_mod); + + PyRun_SimpleString("from math import *"); + PyGILState_Release(gstate); + } BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator() { } +/** + * \brief {Get or create the geom selection tool for active study} + * */ +GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool() +{ + MESSAGE("BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool"); + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + if (that->GeomToolSelected == NULL or that->GeomToolSelected->getMyStudy() != aStudy) { + MESSAGE("GeomToolSelected is created"); + that->GeomToolSelected = new GeomSelectionTools(aStudy); + } + else + MESSAGE("GeomToolSelected already exists"); + return that->GeomToolSelected; +} + namespace { inline bool isDouble( const QString& theText, const bool emptyOK=false ) { QString str = theText.trimmed(); @@ -99,8 +282,10 @@ namespace { } } + bool BLSURFPluginGUI_HypothesisCreator::checkParams() const { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::checkParams"); bool ok = true; if ( !isDouble( myPhySize->text(), false )) { if ( myPhySize->text().isEmpty() ) @@ -153,11 +338,49 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams() const h->SetOptionValues( myOptions ); // restore values } + // SizeMap + if ( ok ) + { + mySizeMapTable->setFocus(); + QApplication::instance()->processEvents(); + + BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() ); + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; + + int row = 0, nbRows = mySizeMapTable->rowCount(); + for ( ; row < nbRows; ++row ) + { + QString entry = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text(); + QString sizeMap = mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->text().trimmed(); + if ( !sizeMap.isEmpty() ) { + if (that->sizeMapValidationFromRow(row)) + { + try { + const char* e = entry.toLatin1().constData(); + const char* s = that->mySMPMap[entry].toLatin1().constData(); + h->SetSizeMapEntry( e, s ); + } + catch ( const SALOME::SALOME_Exception& ex ) + { + SUIT_MessageBox::critical( dlg(), + tr("SMESH_ERROR"), + ex.details.text.in() ); + ok = false; + } + } + else { + ok = false; + } + } + } + } + return ok; } QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::buildFrame"); QFrame* fr = new QFrame( 0 ); QVBoxLayout* lay = new QVBoxLayout( fr ); lay->setMargin( 5 ); @@ -187,7 +410,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() myPhysicalMesh = new QComboBox( myStdGroup ); aStdLayout->addWidget( myPhysicalMesh, row++, 1, 1, 1 ); QStringList physicalTypes; - physicalTypes << tr( "BLSURF_DEFAULT_USER" ) << tr( "BLSURF_CUSTOM_USER" ); + physicalTypes << tr( "BLSURF_DEFAULT_USER" ) << tr( "BLSURF_CUSTOM_USER" ) << tr( "BLSURF_SIZE_MAP"); myPhysicalMesh->addItems( physicalTypes ); aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYDEF" ), myStdGroup), row, 0, 1, 1 ); @@ -289,9 +512,54 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() anAdvLayout->setRowStretch( 4, 5 ); anAdvLayout->setColumnStretch( 1, 5 ); + // Size Maps parameters + + mySmpGroup = new QWidget(); + QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup); + + mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup ); + anSmpLayout->addWidget(mySizeMapTable, 1, 0, 8, 1); + QStringList sizeMapHeaders; + sizeMapHeaders << tr( "SMP_ENTRY_COLUMN" )<< tr( "SMP_NAME_COLUMN" ) << tr( "SMP_SIZEMAP_COLUMN" ); + mySizeMapTable->setHorizontalHeaderLabels(sizeMapHeaders); + mySizeMapTable->horizontalHeader()->hideSection( SMP_ENTRY_COLUMN ); + mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN); + mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN); + mySizeMapTable->setAlternatingRowColors(true); + mySizeMapTable->verticalHeader()->hide(); + +/* + addAttractorButton = new QPushButton(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup); + anSmpLayout->addWidget(addAttractorButton, SMP_ATTRACTOR_BTN, 1, 1, 1); + + QFrame *line = new QFrame(mySmpGroup); + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + anSmpLayout->addWidget(line, SMP_SEPARATOR1, 1, 1, 1); +*/ + addSurfaceButton = new QPushButton(tr("BLSURF_SM_SURFACE"),mySmpGroup); + anSmpLayout->addWidget(addSurfaceButton, SMP_SURFACE_BTN, 1, 1, 1); + + addEdgeButton = new QPushButton(tr("BLSURF_SM_EDGE"),mySmpGroup); + anSmpLayout->addWidget(addEdgeButton, SMP_EDGE_BTN, 1, 1, 1); + + addPointButton = new QPushButton(tr("BLSURF_SM_POINT"),mySmpGroup); + anSmpLayout->addWidget(addPointButton, SMP_POINT_BTN, 1, 1, 1); + + QFrame *line2 = new QFrame(mySmpGroup); + line2->setFrameShape(QFrame::HLine); + line2->setFrameShadow(QFrame::Sunken); + anSmpLayout->addWidget(line2, SMP_SEPARATOR2, 1, 1, 1); + + removeButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup); + anSmpLayout->addWidget(removeButton, SMP_REMOVE_BTN, 1, 1, 1); + + // --- tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) ); - tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) ); + tab->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) ); + tab->insertTab( SMP_TAB, mySmpGroup, tr( "BLSURF_SIZE_MAP" ) ); + tab->setCurrentIndex( STD_TAB ); // --- @@ -300,12 +568,19 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() connect( addBtn->menu(), SIGNAL( aboutToShow() ), this, SLOT( onAddOption() ) ); connect( addBtn->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( onOptionChosenInPopup( QAction* ) ) ); connect( rmBtn, SIGNAL( clicked()), this, SLOT( onDeleteOption() ) ); + + connect(addSurfaceButton, SIGNAL(clicked()), this, SLOT(onAddMapOnSurface())); + connect(addEdgeButton, SIGNAL(clicked()), this, SLOT(onAddMapOnEdge())); + connect(addPointButton, SIGNAL(clicked()), this, SLOT(onAddMapOnPoint())); + connect(removeButton, SIGNAL(clicked()), this, SLOT(onRemoveMap())); + connect(mySizeMapTable, SIGNAL(cellChanged ( int, int )),this,SLOT (onSetSizeMap(int,int ))); return fr; } void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::retrieveParams"); BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; BlsurfHypothesisData data; @@ -332,7 +607,7 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const myAllowQuadrangles->setChecked( data.myAllowQuadrangles ); myDecimesh->setChecked( data.myDecimesh ); myVerbosity->setValue( data.myVerbosity ); - + if ( myOptions.operator->() ) { printf("retrieveParams():myOptions->length()=%d\n",myOptions->length()); for ( int i = 0, nb = myOptions->length(); i < nb; ++i ) { @@ -355,6 +630,29 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const } myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN ); + printf("retrieveParams():that->mySMPMap.size()=%d\n",that->mySMPMap.size()); + QMapIterator i(that->mySMPMap); + GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool(); + while (i.hasNext()) { + i.next(); + const QString entry = i.key(); + string shapeName = myGeomToolSelected->getNameFromEntry(entry.toStdString()); + const QString sizeMap = i.value(); + int row = mySizeMapTable->rowCount(); + mySizeMapTable->setRowCount( row+1 ); + mySizeMapTable->setItem( row, SMP_ENTRY_COLUMN, new QTableWidgetItem( entry ) ); + mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->setFlags( 0 ); + mySizeMapTable->setItem( row, SMP_NAME_COLUMN, new QTableWidgetItem( QString::fromStdString(shapeName) ) ); + mySizeMapTable->item( row, SMP_NAME_COLUMN )->setFlags( 0 ); + mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( sizeMap ) ); + mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable | + Qt::ItemIsEditable | + Qt::ItemIsEnabled ); + } + + mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN ); + mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN); + // update widgets that->onPhysicalMeshChanged(); that->onGeometricMeshChanged(); @@ -373,6 +671,7 @@ QString BLSURFPluginGUI_HypothesisCreator::storeParams() const bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo"); BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() ); @@ -405,11 +704,66 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; that->myOptions = h->GetOptionValues(); + that->mySMPMap.clear(); + + // classic size maps + BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries(); + MESSAGE("mySizeMaps->length() = " << mySizeMaps->length()); + QString fullSizeMaps; + QStringList fullSizeMapList; + GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool(); + for ( int i = 0;ilength(); ++i ) { + fullSizeMaps = mySizeMaps[i].in(); + MESSAGE("fullSizeMaps: " << fullSizeMaps.toStdString()); + fullSizeMapList = fullSizeMaps.split( "|", QString::KeepEmptyParts ); + if ( fullSizeMapList.count() > 1 ) { + string fullSizeMap = fullSizeMapList[1].toStdString(); + int pos = fullSizeMap.find("return")+7; + QString sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos)); + that->mySMPMap[fullSizeMapList[0]] = sizeMap; + MESSAGE("mySMPMap[" << fullSizeMapList[0].toStdString() << "] = " << sizeMap.toStdString()); + that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShape(fullSizeMapList[0].toStdString()).ShapeType(); + MESSAGE("mySMPShapeTypeMap[" << fullSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullSizeMapList[0]]); + } + } + + // custom size maps +/* + BLSURFPlugin::string_array_var myCustomSizeMaps = h->GetCustomSizeMapEntries(); + MESSAGE("myCustomSizeMaps->length() = " << myCustomSizeMaps->length()); + + for ( int i = 0;ilength(); ++i ) { + QString fullCustomSizeMaps = myCustomSizeMaps[i].in(); + QStringList fullCustomSizeMapList = fullCustomSizeMaps.split( "|", QString::KeepEmptyParts ); + if ( fullCustomSizeMapList.count() > 1 ) { + that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1]; + that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShape(fullCustomSizeMapList[0].toStdString()).ShapeType(); + MESSAGE("mySMPMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << fullCustomSizeMapList[1].toStdString()); + MESSAGE("mySMPShapeTypeMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullCustomSizeMapList[0]]); + } + } +*/ + // attractor + BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries(); + MESSAGE("myAttractors->length() = " << allMyAttractors->length()); + + for ( int i = 0;ilength(); ++i ) { + QString myAttractors = allMyAttractors[i].in(); + QStringList myAttractorList = myAttractors.split( "|", QString::KeepEmptyParts ); + if ( myAttractorList.count() > 1 ) { + that->mySMPMap[myAttractorList[0]] = myAttractorList[1]; + that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShape(myAttractorList[0].toStdString()).ShapeType(); + MESSAGE("mySMPMap[" << myAttractorList[0].toStdString() << "] = " << myAttractorList[1].toStdString()); + MESSAGE("mySMPShapeTypeMap[" << myAttractorList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[myAttractorList[0]]); + } + } + return true; } bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo"); BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() ); @@ -434,7 +788,7 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi if ( h->GetVerbosity() != h_data.myVerbosity ) h->SetVerbosity( h_data.myVerbosity ); - if( (int) h_data.myPhysicalMesh == PhysicalUserDefined ) { + if( ((int) h_data.myPhysicalMesh == PhysicalUserDefined)||((int) h_data.myPhysicalMesh == SizeMap) ) { if ( h->GetPhySize() != h_data.myPhySize.toDouble() ) h->SetPhySize( h_data.myPhySize.toDouble() ); } @@ -463,8 +817,43 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi h->SetGeoMax( h_data.myGeoMax.toDouble() ); #endif - printf("storeParamsToHypo():myOptions->length()=%d\n",myOptions->length()); + //printf("storeParamsToHypo():myOptions->length()=%d\n",myOptions->length()); h->SetOptionValues( myOptions ); // is set in checkParams() + + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; + QMapIterator i(that->mySMPMap); + // Iterate over each size map + while (i.hasNext()) { + i.next(); + const QString entry = i.key(); + const QString sizeMap = i.value(); + + if (sizeMap == "__TO_DELETE__") { + MESSAGE("Delete entry " << entry.toStdString() << " from engine"); + h->UnsetEntry(entry.toLatin1().constData()); + } + else if (sizeMap.startsWith("ATTRACTOR")) { + MESSAGE("SetAttractorEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString()); + h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() ); + } + else if (sizeMap.startsWith("def")) { + MESSAGE("SetCustomSizeMapEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString()); +// h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() ); + } + else { + QString fullSizeMap; + fullSizeMap = QString(""); + if (that->mySMPShapeTypeMap[entry] == TopAbs_FACE) + fullSizeMap = QString("def f(u,v): return ") + sizeMap; + else if (that->mySMPShapeTypeMap[entry] == TopAbs_EDGE) + fullSizeMap = QString("def f(t): return ") + sizeMap; + else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX) + fullSizeMap = QString("def f(): return ") + sizeMap; + + MESSAGE("SetSizeMapEntry("<SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() ); + } + } } catch(const SALOME::SALOME_Exception& ex) { @@ -476,6 +865,7 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets"); h_data.myName = myName ? myName->text() : ""; h_data.myTopology = myTopology->currentIndex(); h_data.myPhysicalMesh = myPhysicalMesh->currentIndex(); @@ -526,14 +916,24 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes guiHyp += name + " = " + value + "; "; } } - - cout << "guiHyp : " << guiHyp.toLatin1().data() << endl; + + // SizeMap + row = 0, nbRows = mySizeMapTable->rowCount(); + for ( ; row < nbRows; ++row ) + { + QString entry = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text(); + if ( that->mySMPMap.contains(entry) ) + guiHyp += entry + " = " + that->mySMPMap[entry] + "; "; + } + + MESSAGE("guiHyp : " << guiHyp.toLatin1().data()); return guiHyp; } void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() { - bool isCustom = (myPhysicalMesh->currentIndex() == PhysicalUserDefined); + MESSAGE("BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged"); + bool isCustom = ((myPhysicalMesh->currentIndex() == PhysicalUserDefined) || (myPhysicalMesh->currentIndex() == SizeMap)) ; myPhySize->setEnabled(isCustom); myPhyMax->setEnabled(isCustom); myPhyMin->setEnabled(isCustom); @@ -559,6 +959,7 @@ void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() { } void BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged() { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged"); bool isCustom = (myGeometricMesh->currentIndex() == UserDefined); myAngleMeshS->setEnabled(isCustom); myAngleMeshC->setEnabled(isCustom); @@ -661,6 +1062,308 @@ void BLSURFPluginGUI_HypothesisCreator::onDeleteOption() myOptionTable->removeRow( it.previous() ); } +// ********************** +// *** BEGIN SIZE MAP *** +// ********************** + + +void BLSURFPluginGUI_HypothesisCreator::onRemoveMap() +{ + MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveMap()"); + QList selectedRows; + QList selected = mySizeMapTable->selectedItems(); + QTableWidgetItem* item; + int row; + foreach( item, selected ) { + row = item->row(); + if ( !selectedRows.contains( row ) ) + selectedRows.append( row ); + } + + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; + + qSort( selectedRows ); + QListIterator it( selectedRows ); + it.toBack(); + while ( it.hasPrevious() ) { + row = it.previous(); + QString entry = mySizeMapTable->item(row,SMP_ENTRY_COLUMN)->text(); + if (that->mySMPMap.contains(entry)) + that->mySMPMap[entry] = "__TO_DELETE__"; + if (that->mySMPShapeTypeMap.contains(entry)) + that->mySMPShapeTypeMap.remove(entry); + mySizeMapTable->removeRow(row ); + } + mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN); + mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN); +} + +void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(int row,int col) +{ + MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< row << "," << col << ")"); + if (col == SMP_SIZEMAP_COLUMN) { + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; + QString entry = that->mySizeMapTable->item(row, SMP_ENTRY_COLUMN)->text(); + QString sizeMap = that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->text().trimmed(); + MESSAGE("entry: " << entry.toStdString() << ", sizeMap: " << sizeMap.toStdString()); + if (not that->mySMPShapeTypeMap.contains(entry)) + return; + if (that->mySMPMap.contains(entry)) + if (that->mySMPMap[entry] == sizeMap) + return; + QColor* bgColor = new QColor("white"); + QColor* fgColor = new QColor("black"); + if (not sizeMap.isEmpty()) { + that->mySMPMap[entry] = sizeMap; + if (not sizeMapValidationFromRow(row)) { + bgColor->setRgb(255,0,0); + fgColor->setRgb(255,255,255); + } + } + else { + MESSAGE("Size map empty: reverse to precedent value" ); + that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setText(that->mySMPMap[entry]); + } + that->mySizeMapTable->item(row, SMP_NAME_COLUMN)->setBackground(QBrush(*bgColor)); + that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setBackground(QBrush(*bgColor)); + that->mySizeMapTable->item(row, SMP_NAME_COLUMN)->setForeground(QBrush(*fgColor)); + that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setForeground(QBrush(*fgColor)); + mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN); + } +} + +void BLSURFPluginGUI_HypothesisCreator::onAddMapOnSurface() +{ + insertElementType(TopAbs_FACE); +} + +void BLSURFPluginGUI_HypothesisCreator::onAddMapOnEdge() +{ + insertElementType(TopAbs_EDGE); +} + +void BLSURFPluginGUI_HypothesisCreator::onAddMapOnPoint() +{ + insertElementType(TopAbs_VERTEX); +} + +void BLSURFPluginGUI_HypothesisCreator::insertElementType(TopAbs_ShapeEnum typeShapeAsked) +{ + MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElementType()"); + + BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = + BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis()); + + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; + + TopoDS_Shape S; + string entry, shapeName; +// LightApp_SelectionMgr* aSel = GeomToolSelected->selectionMgr(); + + SALOME_ListIO ListSelectedObjects; + aSel->selectedObjects(ListSelectedObjects, NULL, false ); + if (!ListSelectedObjects.IsEmpty()) + { + SALOME_ListIteratorOfListIO Object_It(ListSelectedObjects); + GeomSelectionTools* myGeomToolSelected = getGeomSelectionTool(); + for (; Object_It.More(); Object_It.Next()) + { + Handle(SALOME_InteractiveObject) anObject = Object_It.Value(); + entry = myGeomToolSelected->getEntryOfObject(anObject); + shapeName = anObject->getName(); + S = myGeomToolSelected->entryToShape(entry); + if ((! S.IsNull()) && (S.ShapeType() == typeShapeAsked)) + { + mySizeMapTable->setFocus(); + QString shapeEntry; + shapeEntry = QString::fromStdString(entry); + double phySize = h->GetPhySize(); + std::ostringstream oss; + oss << phySize; + QString sizeMap; + sizeMap = QString::fromStdString(oss.str()); + if (that->mySMPMap.contains(shapeEntry)) { + if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") { + MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")"); + break; + } + } + that->mySMPMap[shapeEntry] = sizeMap; + that->mySMPShapeTypeMap[shapeEntry] = typeShapeAsked; + int row = mySizeMapTable->rowCount() ; + mySizeMapTable->setRowCount( row+1 ); + mySizeMapTable->setItem( row, SMP_ENTRY_COLUMN, new QTableWidgetItem( shapeEntry ) ); + mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->setFlags( 0 ); + mySizeMapTable->setItem( row, SMP_NAME_COLUMN, new QTableWidgetItem( QString::fromStdString(shapeName) ) ); + mySizeMapTable->item( row, SMP_NAME_COLUMN )->setFlags( 0 ); + mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( sizeMap ) ); + mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled ); + mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN ); + mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN); + mySizeMapTable->clearSelection(); + mySizeMapTable->scrollToItem( mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN ) ); + + if ( myPhysicalMesh->currentIndex() != SizeMap ) { + myPhysicalMesh->setCurrentIndex( SizeMap ); + onPhysicalMeshChanged(); + } + } + } + } +} + +bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation() +{ + MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()"); + int row = 0, nbRows = mySizeMapTable->rowCount(); + for ( ; row < nbRows; ++row ) + if (not sizeMapValidationFromRow(row)) + return false; + return true; +} + +bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError) +{ + MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow()"); + QString myEntry = mySizeMapTable->item( myRow, SMP_ENTRY_COLUMN )->text(); + bool res = sizeMapValidationFromEntry(myEntry,displayError); + mySizeMapTable->setFocus(); + return res; +} + +bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry, bool displayError) +{ + MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry()"); + + BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; + + if (not that->mySMPMap.contains(myEntry)) { + MESSAGE("Geometry with entry "<mySMPShapeTypeMap.contains(myEntry)) { + MESSAGE("Shape type with entry "<mySMPMap[myEntry].startsWith("def")) { + MESSAGE("custom function" ); + expr = that->mySMPMap[myEntry].toStdString(); + } + else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) { + MESSAGE("Attractor" ); +// if ((that->mySMPMap[myEntry].count(QRegExp("ATTRACTOR([0-9])")) != 1)) + if ((that->mySMPMap[myEntry].count('(') != 1) or + (that->mySMPMap[myEntry].count(')') != 1) or + (that->mySMPMap[myEntry].count(';') != 4) or + (that->mySMPMap[myEntry].size() == 15)){ + if (displayError) + SUIT_MessageBox::warning( dlg(),"Definition of attractor : Error" ,"An attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b)" ); + return false; + } + return true; + } + else { + // case size map is empty + if (that->mySMPMap[myEntry].isEmpty()) { + if (displayError) + SUIT_MessageBox::warning( dlg(),"Definition of size map : Error" , "Size map can't be empty"); + return false; + } + + if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_FACE) + expr = "def f(u,v) : return " + that->mySMPMap[myEntry].toStdString(); + else if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_EDGE) + expr = "def f(t) : return " + that->mySMPMap[myEntry].toStdString(); + else if ( that->mySMPShapeTypeMap[myEntry] == TopAbs_VERTEX) + expr = "def f() : return " + that->mySMPMap[myEntry].toStdString(); + } + //assert(Py_IsInitialized()); + if (not Py_IsInitialized()) + throw ("Erreur: Python interpreter is not initialized"); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + + PyObject * obj = NULL; + PyObject* new_stderr = NULL; + string err_description=""; + obj= PyRun_String(expr.c_str(), Py_file_input, main_dict, NULL); + if (obj == NULL){ + fflush(stderr); + err_description=""; + new_stderr=newPyStdOut(err_description); + PySys_SetObject("stderr", new_stderr); + PyErr_Print(); + PySys_SetObject("stderr", PySys_GetObject("__stderr__")); + Py_DECREF(new_stderr); + if (displayError) + SUIT_MessageBox::warning( dlg(),"Definition of Python Function : Error" ,err_description.c_str() ); + PyGILState_Release(gstate); + return false; + } + Py_DECREF(obj); + + PyObject * func = NULL; + func = PyObject_GetAttrString(main_mod, "f"); + if ( func == NULL){ + fflush(stderr); + err_description=""; + new_stderr=newPyStdOut(err_description); + PySys_SetObject("stderr", new_stderr); + PyErr_Print(); + PySys_SetObject("stderr", PySys_GetObject("__stderr__")); + Py_DECREF(new_stderr); + if (displayError) + SUIT_MessageBox::warning( dlg(),"Python Error" ,err_description.c_str() ); + PyGILState_Release(gstate); + return false; + } + + PyGILState_Release(gstate); + + MESSAGE("SizeMap expression "<row(); + int myColumn = index->column(); + + if (myColumn == 2){ + if (!myEditor) { + myEditor = new BLSURFPluginGUI_MapFunctionEditor(sizeMapModel->item(myRow,0)->text()); + connect(myEditor, SIGNAL(FunctionEntered(QString)), this, SLOT(FunctionLightValidation(QString))); + } + myEditor->exec(); +// myEditor->show(); +// myEditor->raise(); +// myEditor->activateWindow(); + + +// BLSURFPluginGUI_MapFunctionEditor* myEditor = new BLSURFPluginGUI_MapFunctionEditor(sizeMapModel->item(myRow,0)->text()); +// myEditor->exec(); + QString myFunction = myEditor->GetFunctionText(); + // FIN RECUPERATION FONCTION + + if (! myFunction.isEmpty()) { + + // MAJ DE LA MAP + + BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = + BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis()); + +// h->SetSizeMapEntry(sizeMapModel->item(myRow,1)->text().toLatin1().constData(), +// item->text().toLatin1().constData()); + h->SetSizeMapEntry(sizeMapModel->item(myRow,1)->text().toLatin1().constData(), + myFunction.toLatin1().constData()); + // FIN MAJ DE LA MAP + } + } +}*/ QString BLSURFPluginGUI_HypothesisCreator::caption() const { @@ -681,3 +1384,13 @@ QString BLSURFPluginGUI_HypothesisCreator::helpPage() const { return "blsurf_hypo_page.html"; } + +LightApp_SelectionMgr* BLSURFPluginGUI_HypothesisCreator::selectionMgr() +{ + + SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if( anApp ) + return dynamic_cast( anApp->selectionMgr() ); + else + return 0; +} diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h index 15e701e..db48e08 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h @@ -20,6 +20,7 @@ // File : BLSURFPluginGUI_HypothesisCreator.h // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) // & Aurelien ALLEAUME (DISTENE) +// Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE) // --- // #ifndef BLSURFPLUGINGUI_HypothesisCreator_H @@ -35,8 +36,13 @@ #define BLSURFPLUGIN_GUI_EXPORT #endif +#include #include #include +#include +#include +#include +#include #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm) class QGroupBox; @@ -45,21 +51,24 @@ class QComboBox; class QCheckBox; class QLineEdit; class QTableWidget; +class QTableView; +class QModelIndex; class QSpinBox; class QMenu; class QAction; +class LightApp_SelectionMgr; typedef struct { int myTopology, myVerbosity; int myPhysicalMesh, myGeometricMesh; double myAngleMeshS, myAngleMeshC, myGradation; - QString myPhySize, myGeoMin, myGeoMax, myPhyMin, myPhyMax; - bool myAllowQuadrangles, myDecimesh; + QString myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax; + bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint; QString myName; - } BlsurfHypothesisData; + /*! * \brief Class for creation of BLSURF hypotheses */ @@ -71,29 +80,40 @@ public: BLSURFPluginGUI_HypothesisCreator( const QString& ); virtual ~BLSURFPluginGUI_HypothesisCreator(); - virtual bool checkParams() const; - virtual QString helpPage() const; + virtual bool checkParams() const; + virtual QString helpPage() const; + void insertElementType( TopAbs_ShapeEnum ); + static LightApp_SelectionMgr* selectionMgr(); protected: - virtual QFrame* buildFrame (); - virtual void retrieveParams() const; - virtual QString storeParams () const; + virtual QFrame* buildFrame (); + virtual void retrieveParams() const; + virtual QString storeParams () const; - virtual QString caption() const; - virtual QPixmap icon() const; - virtual QString type() const; + virtual QString caption() const; + virtual QPixmap icon() const; + virtual QString type() const; protected slots: - void onPhysicalMeshChanged(); - void onGeometricMeshChanged(); - void onAddOption(); - void onDeleteOption(); - void onOptionChosenInPopup( QAction* ); + void onPhysicalMeshChanged(); + void onGeometricMeshChanged(); + void onAddOption(); + void onDeleteOption(); + void onOptionChosenInPopup( QAction* ); + void onAddMapOnSurface(); + void onAddMapOnEdge(); + void onAddMapOnPoint(); + void onRemoveMap(); + void onSetSizeMap(int,int); private: - bool readParamsFromHypo( BlsurfHypothesisData& ) const; - QString readParamsFromWidgets( BlsurfHypothesisData& ) const; - bool storeParamsToHypo( const BlsurfHypothesisData& ) const; + bool readParamsFromHypo( BlsurfHypothesisData& ) const; + QString readParamsFromWidgets( BlsurfHypothesisData& ) const; + bool storeParamsToHypo( const BlsurfHypothesisData& ) const; + bool sizeMapsValidation(); + bool sizeMapValidationFromRow(int,bool displayError = true); + bool sizeMapValidationFromEntry(QString,bool displayError = true); + GeomSelectionTools* getGeomSelectionTool(); private: QWidget* myStdGroup; @@ -116,7 +136,24 @@ private: QSpinBox* myVerbosity; QTableWidget* myOptionTable; + QWidget *mySmpGroup; + QTableWidget *mySizeMapTable; + QPushButton *addAttractorButton; + QPushButton *addSurfaceButton; + QPushButton *addEdgeButton; + QPushButton *addPointButton; + QPushButton *removeButton; + + // map = entry , size map + QMap mySMPMap; + QMap mySMPShapeTypeMap; + GeomSelectionTools* GeomToolSelected; + LightApp_SelectionMgr* aSel; + BLSURFPlugin::string_array_var myOptions; + + PyObject * main_mod; + PyObject * main_dict; }; #endif // BLSURFPLUGINGUI_HypothesisCreator_H diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index 0e4e862..5fb60b8 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -94,6 +94,58 @@ BLSURF_PHY_MESH Physical Mesh + + BLSURF_SIZE_MAP + Size Map + + + SMP_ENTRY_COLUMN + Entry + + + SMP_NAME_COLUMN + Name + + + SMP_SIZEMAP_COLUMN + Size Map + + + BLSURF_SM_SURFACE + Add Map on Surface + + + BLSURF_SM_EDGE + Add Map on Edge + + + BLSURF_SM_POINT + Add Map on Point + + + BLSURF_SM_ATTRACTOR + Add Attractor + + + BLSURF_SM_REMOVE + Remove Map + + + BLSURF_SM_SURF_VALUE + Size on Surface(s) + + + BLSURF_SM_EDGE_VALUE + Size on Edge(s) + + + BLSURF_SM_POINT_VALUE + Size on Point(s) + + + BLSURF_ADV_ARGS + Advanced + BLSURF_TITLE Hypothesis Construction diff --git a/src/GUI/Makefile.am b/src/GUI/Makefile.am index 20136b4..0539f7e 100644 --- a/src/GUI/Makefile.am +++ b/src/GUI/Makefile.am @@ -24,14 +24,14 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files -salomeinclude_HEADERS = +salomeinclude_HEADERS = \ + BLSURFPluginGUI_HypothesisCreator.h # Libraries targets lib_LTLIBRARIES = libBLSURFPluginGUI.la -dist_libBLSURFPluginGUI_la_SOURCES = \ - BLSURFPluginGUI.cxx \ - BLSURFPluginGUI_HypothesisCreator.h \ +dist_libBLSURFPluginGUI_la_SOURCES = \ + BLSURFPluginGUI.cxx \ BLSURFPluginGUI_HypothesisCreator.cxx MOC_FILES = \ @@ -56,11 +56,13 @@ libBLSURFPluginGUI_la_CPPFLAGS = \ $(CORBA_INCLUDES) \ $(BLSURF_INCLUDES) \ -I$(srcdir)/../BLSURFPlugin \ + -I$(srcdir)/../PluginUtils \ -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix libBLSURFPluginGUI_la_LDFLAGS = \ ../BLSURFPlugin/libBLSURFEngine.la \ + ../PluginUtils/libGeomSelectionTools.la \ ${SMESH_LDFLAGS} -lSMESH \ $(CAS_KERNEL) $(BLSURF_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index 5768f50..2d86256 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,10 +23,10 @@ # include $(top_srcdir)/adm_local/unix/make_common_starter.am -SUBDIRS = BLSURFPlugin +SUBDIRS = PluginUtils BLSURFPlugin if BLSURFPLUGIN_ENABLE_GUI SUBDIRS += GUI endif -DIST_SUBDIRS = BLSURFPlugin GUI \ No newline at end of file +DIST_SUBDIRS = PluginUtils BLSURFPlugin GUI diff --git a/src/PluginUtils/GeomSelectionTools.cxx b/src/PluginUtils/GeomSelectionTools.cxx new file mode 100644 index 0000000..9bdad21 --- /dev/null +++ b/src/PluginUtils/GeomSelectionTools.cxx @@ -0,0 +1,273 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// 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 : GeomSelectionTools.cxx +// Authors : Nicolas GEIMER (OCC) +// --- +// + + +#include "GeomSelectionTools.h" +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +/*! + * Constructor + * @param aStudy pointer to the Study + * + */ +GeomSelectionTools::GeomSelectionTools(_PTR(Study) aStudy) +{ + myStudy = aStudy; +} + +/*! + * Accessor to the Study used by this GeomSelectionTools object + * @return The study used by the GeomSelectionTools class + */ +_PTR(Study) GeomSelectionTools::getMyStudy() +{ + return myStudy; +} + +/*! + * Allows to get the selection manager from LightApp + * @return A LightApp_SelectionMgr Pointer or 0 if it can't get it. + */ +LightApp_SelectionMgr* GeomSelectionTools::selectionMgr() +{ + SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if (anApp) + return dynamic_cast( anApp->selectionMgr() ); + else + return 0; +} + +/*! + * Return the list of the selected Salome Interactive Object (SALOME_ListIO*) + * @return the list of the selected Salome Interactive Object + */ +SALOME_ListIO* GeomSelectionTools::getSelectedSalomeObjects() +{ + SALOME_ListIO* selected; + LightApp_SelectionMgr* aSel = selectionMgr(); + aSel->selectedObjects( *selected, NULL, false ); + return selected; +} + +/*! + * Return the first selected Salome Interactive Object (Handle(Salome_InteractiveObject)) + * @return the first selected Salome Interactive Object + */ +Handle(SALOME_InteractiveObject) GeomSelectionTools::getFirstSelectedSalomeObject() +{ + SALOME_ListIO selected; + LightApp_SelectionMgr* aSel = selectionMgr(); + aSel->selectedObjects( selected, NULL, false ); + if (!selected.IsEmpty()){ + SALOME_ListIteratorOfListIO anIt(selected); + Handle(SALOME_InteractiveObject) anIO; + anIO = anIt.Value(); + return anIO; + } + return NULL; +} + +/*! + * Return the entry of the first selected Object + * @return the entry of the first selected Object + */ +std::string GeomSelectionTools::getFirstSelectedEntry() +{ + Handle(SALOME_InteractiveObject) anIO; + std::string entry=""; + anIO=GeomSelectionTools::getFirstSelectedSalomeObject(); + return GeomSelectionTools::getEntryOfObject(anIO); +} + +/*! + * Return the entry of a Salome Interactive Object + * @param anIO the Handle of the Salome Interactive Object + * @return the entry of the Salome Interactive Object + */ +std::string GeomSelectionTools::getEntryOfObject(Handle(SALOME_InteractiveObject) anIO){ + std::string entry=""; + _PTR(SObject) aSO = myStudy->FindObjectID(anIO->getEntry()); + if (aSO){ + _PTR(SObject) aRefSObj; + // If selected object is a reference + if ( aSO->ReferencedObject( aRefSObj )) + entry = aRefSObj->GetID(); + // If selected object is a reference is not a reference + else + entry= anIO->getEntry(); + } + return entry; +} + +/*! + * Retrieve the name from the entry of the object + * @param entry the entry of the object + * @return the name of the object + */ +std::string GeomSelectionTools::getNameFromEntry(std::string entry){ + std::string name = ""; + _PTR(SObject) aSO = myStudy->FindObjectID(entry); + if (aSO){ + _PTR(SObject) aRefSObj; + // If selected object is a reference + if ( aSO->ReferencedObject( aRefSObj )) + name = aRefSObj->GetName(); + // If selected object is a reference is not a reference + else + name = aSO->GetName(); + } + return name; +} + + +/*! + * Retrieve the component type of the first selected object, it manages successfully references. + * @return the component type of the first selected object + */ +std::string GeomSelectionTools::getFirstSelectedComponentDataType() +{ + Handle(SALOME_InteractiveObject) anIO; + std::string DataType=""; + anIO=GeomSelectionTools::getFirstSelectedSalomeObject(); + _PTR(SObject) aSO = myStudy->FindObjectID(anIO->getEntry()); + if (aSO){ + _PTR(SObject) aRefSObj; + // If selected object is a reference + if ( aSO->ReferencedObject( aRefSObj )) + DataType= aRefSObj->GetFatherComponent()->ComponentDataType(); + // If selected object is a reference is not a reference + else + DataType=anIO->getComponentDataType(); + } + return DataType; +} + +/*! + * Retrieve the TopoDS shape from the first selected object + * @return the TopoDS shape from the first selected object, empty TopoDS Shape if a shape is not selected. + */ +TopoDS_Shape GeomSelectionTools::getFirstSelectedTopoDSShape() +{ + Handle(SALOME_InteractiveObject) anIO; + anIO=GeomSelectionTools::getFirstSelectedSalomeObject(); + return entryToShape(anIO->getEntry()); +} + +/*! + * Retrieve the TopoDS shape from the entry + * @return the TopoDS shape from the entry, empty TopoDS Shape if the entry does not define a shape. + */ +TopoDS_Shape GeomSelectionTools::entryToShape(std::string entry){ + TopoDS_Shape S = TopoDS_Shape(); + _PTR(SObject) aSO = myStudy->FindObjectID(entry); + if (aSO){ + _PTR(SObject) aRefSObj; + GEOM::GEOM_Object_var aShape; + // If selected object is a reference + if ( aSO->ReferencedObject( aRefSObj )){ + if (aRefSObj->GetFatherComponent()->ComponentDataType() == "GEOM") + aShape=SMESH::SObjectToInterface(aRefSObj); + } + // If selected object is a reference is not a reference + else { + if ( aSO->GetFatherComponent()->ComponentDataType() == "GEOM") + aShape = SMESH::SObjectToInterface(aSO); + } + if ( !aShape->_is_nil() ){ + if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) + S=gen->GeomObjectToShape( aShape.in() ); + } + } + return S; +} + +/*! + * Gives the ShapeType of the first Selected Object, return TopAbs_SHAPE if the first selected object does not define a shape. + * @return the ShapeType of the first Selected Object, return TopAbs_SHAPE if the first selected object does not define a shape. + */ +TopAbs_ShapeEnum GeomSelectionTools:: getFirstSelectedShapeType() +{ + TopoDS_Shape S=getFirstSelectedTopoDSShape(); + if (!S.IsNull()) + return S.ShapeType(); + else + return TopAbs_SHAPE; +} + +/*! + * Print information to std output of the face (if the first selected object is a face) + * and return the OCC type of face: Plane, Cylinder,Cone, Sphere, Torus, BezierSurface,BSplineSurface, SurfaceOfRevolution,SurfaceOfExtrusion, OtherSurface + * @return the OCC type of face: Plane, Cylinder,Cone, Sphere, Torus, BezierSurface,BSplineSurface, SurfaceOfRevolution,SurfaceOfExtrusion, OtherSurface + * return Other_Surface if the selected face is not a face. + * Information printed is : + * U and V degrees + * U and V number of poles + * U and V number of knots + * U or V is Rational ? + * + */ +GeomAbs_SurfaceType GeomSelectionTools::getFaceInformation() +{ + TopoDS_Shape S=getFirstSelectedTopoDSShape(); + GeomAbs_SurfaceType surf_type=GeomAbs_OtherSurface ; + if (!S.IsNull() && S.ShapeType()==TopAbs_FACE){ + TopoDS_Face f=TopoDS::Face(S); + Handle(Geom_Surface) surf = BRep_Tool::Surface(f); + BRepAdaptor_Surface surf_adap=BRepAdaptor_Surface::BRepAdaptor_Surface(f); + + /* Global Information */ + cout << "GLOBAL INFORMATION" << endl; + cout << "******************" << endl; + stringstream buffer; + buffer << "Degre U : " << surf_adap.UDegree(); + //conversion nécessaire pour affichage + cout << buffer.str() << endl; + cout << " Degre V : " << surf_adap.VDegree() << endl; + cout << " Nb Poles U : " << surf_adap.NbUPoles() << endl; + cout << " Nb Poles V : " << surf_adap.NbVPoles() << endl; + cout << " Nb Noeuds U : " << surf_adap.NbUKnots() << endl; + cout << " Nb Noeuds V : " << surf_adap.NbVKnots() << endl; + cout << " U Rationnel ? " << surf_adap.IsURational() << endl; + cout << " V Rationnel ? " << surf_adap.IsVRational() << endl; + + surf_type=surf_adap.GetType(); + } + return surf_type; +} diff --git a/src/PluginUtils/GeomSelectionTools.h b/src/PluginUtils/GeomSelectionTools.h new file mode 100644 index 0000000..7b491fb --- /dev/null +++ b/src/PluginUtils/GeomSelectionTools.h @@ -0,0 +1,67 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// 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 : GeomSelectionTools.h +// Authors : Nicolas GEIMER (OCC) +// --- + + + +#include "SALOMEDSClient.hxx" +#include "SALOME_InteractiveObject.hxx" +#include + +#include +#include + +class LightApp_SelectionMgr; + + +/*! + * The GeomSelectionTools class gives high level tools to select Geom (and other objects) + * A specific attention has been given to analyze selected GEOM objects. + * + * @param myStudy This class is specific to the study ! + * + */ + +class GeomSelectionTools +{ + +private: + + _PTR(Study) myStudy; + +public: + + GeomSelectionTools(_PTR(Study)); + static LightApp_SelectionMgr* selectionMgr(); + SALOME_ListIO* getSelectedSalomeObjects(); + Handle(SALOME_InteractiveObject) getFirstSelectedSalomeObject(); + std::string getFirstSelectedEntry(); + std::string getEntryOfObject(Handle(SALOME_InteractiveObject)); + std::string getNameFromEntry(std::string); + std::string getFirstSelectedComponentDataType(); + TopoDS_Shape getFirstSelectedTopoDSShape(); + TopAbs_ShapeEnum getFirstSelectedShapeType(); + TopoDS_Shape entryToShape(std::string ); + GeomAbs_SurfaceType getFaceInformation(); + _PTR(Study) getMyStudy(); +}; + + diff --git a/src/PluginUtils/Makefile.am b/src/PluginUtils/Makefile.am new file mode 100644 index 0000000..6ba3947 --- /dev/null +++ b/src/PluginUtils/Makefile.am @@ -0,0 +1,66 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# 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 : Nicolas GEIMER (OCC) +# --- +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# header files +salomeinclude_HEADERS = + +# Libraries targets +lib_LTLIBRARIES = libGeomSelectionTools.la + +dist_libGeomSelectionTools_la_SOURCES = \ + GeomSelectionTools.h \ + GeomSelectionTools.cxx + +MOC_FILES = \ + BLSURFPluginGUI_HypothesisCreator_moc.cxx + +nodist_GeomSelectionTools_la_SOURCES = \ + $(MOC_FILES) + +# additionnal information to compil and link file + +libGeomSelectionTools_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + $(CAS_CPPFLAGS) \ + $(PYTHON_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(GEOM_CXXFLAGS) \ + $(SMESH_CXXFLAGS) \ + $(MED_CXXFLAGS) \ + $(BOOST_CPPFLAGS) \ + $(CORBA_CXXFLAGS) \ + $(CORBA_INCLUDES) \ + -I$(top_builddir)/idl \ + -I$(top_builddir)/salome_adm/unix + +libGeomSelectionTools_la_LDFLAGS = \ + ${SMESH_LDFLAGS} -lSMESH \ + $(CAS_KERNEL) + +# resources files +#nodist_salomeres_DATA = \ +# BLSURFPlugin_images.qm \ +# BLSURFPlugin_msg_en.qm diff --git a/src/PluginUtils/PluginUtils.h b/src/PluginUtils/PluginUtils.h new file mode 100644 index 0000000..69c2e86 --- /dev/null +++ b/src/PluginUtils/PluginUtils.h @@ -0,0 +1,28 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// 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 : PluginUtils.h +// Author : Nicolas GEIMER (OCC) +// Module : BLSURFPlugin +// + + + diff --git a/src/PluginUtils/SizeMapPython.cxx b/src/PluginUtils/SizeMapPython.cxx new file mode 100644 index 0000000..e69de29 diff --git a/src/PluginUtils/SizeMapPython.h b/src/PluginUtils/SizeMapPython.h new file mode 100644 index 0000000..576fc6d --- /dev/null +++ b/src/PluginUtils/SizeMapPython.h @@ -0,0 +1 @@ +#include