Size maps can be defined on vertices, edges or faces.
Implemented :
- SizeMaps arguments passed to BLSurf
- Persistence (hdf+dump)
- can use python fonction (f(u,v) for a face, f(t) for an edge, f() for a vertex)
- verification of this expression in gui (python syntax) and engine (python evaluation).
- make dev_docs
Limitation :
- Objects have to be published to have size map defined on them.
- does not compile with gcc 3.3 (Debian Sarge)
- u,v / t used (Cascade ones) not very clear for user
...Still in development (SID)...
-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
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)
+
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
./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 \
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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)
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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;
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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 GUI doxygen.bak
+
+install-data-local: usr_docs
+ $(INSTALL) -d $(DESTDIR)$(docdir)/gui
+ cp -rp GUI $(DESTDIR)$(docdir)/gui
+
+uninstall-local:
+ rm -rf $(DESTDIR)$(docdir)/gui/GUI
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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 = "GUI Module Reference Manual v.@VERSION@"
+OUTPUT_DIRECTORY = GUI
+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
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+</head>
+<body>
+<hr style="width: 100%; height: 2px;">
+<div style="text-align: center;">Copyright © 2003-2007 CEA, EDF<br>
+</div>
+</body>
+</html>
--- /dev/null
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>$title</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</head>
+<hr>
+<center>
+SALOME documentation central
+</center>
+<hr>
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# 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
--- /dev/null
+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 }
--- /dev/null
+</DIV>
+<DIV class="div-footer">
+Generated on $datetime for $projectname by <A href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></A> $doxygenversion</DIV>
+</BODY>
+</HTML>
--- /dev/null
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
+ <title>Main Page</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+<link href="tabs.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+
+</body>
+</html>
#define _SMESH_BLSURFALGORITHM_IDL_
#include "SMESH_Hypothesis.idl"
+#include "GEOM_Gen.idl"
#include "SALOME_Exception.idl"
/*!
* Note: the method is mostly for interaction with GUI.
*/
void SetOptionValues(in string_array options);
- };
+ /*!
+ * SizeMap
+ */
+ void SetSizeMapEntry(in string entry,in string sizeMap );
+ string GetSizeMapEntry(in string entry);
+ void UnsetEntry(in string entry);
+ string_array GetSizeMapEntries();
+ void SetSizeMapEntries(in string_array sizeMaps);
+ void ClearSizeMaps();
+ void SetSizeMap(in GEOM::GEOM_Object GeomObj, in string sizeMap );
+ void UnsetSizeMap(in GEOM::GEOM_Object GeomObj);
+ };
};
#endif
#include "BLSURFPlugin_BLSURF.hxx"
#include "BLSURFPlugin_Hypothesis.hxx"
+#include <structmember.h>
+
+
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESH_ControlsDef.hxx>
+#include <SMESHGUI_Utils.h>
#include <SMESHDS_Mesh.hxx>
#include <SMDS_MeshElement.hxx>
#include <utilities.h>
+#include <limits>
#include <list>
#include <vector>
+#include <tr1/unordered_map>
+#include <cstdlib>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <fenv.h>
#endif
+#include <GeomSelectionTools.h>
+
+
+/* =========== PYTHON ==============
+ *
+ *
+ * On est trop des brutes !
+ *
+ *
+ *
+ * ==================================*/
+
+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///////////////////////////
+
+
+//////////////////TO WELL DEFINE UNORDERED TOPODS_MAP////////
+
+namespace std {
+namespace tr1 {
+template<>
+ struct hash<TopoDS_Face>
+ : public std::unary_function<TopoDS_Face,std::size_t>
+ {
+ std::size_t operator() (const TopoDS_Face & Face) const
+ { return Face.HashCode(471662);}
+ // { return Face.HashCode(std::numeric_limits<int>::max());}
+};
+
+template<>
+ struct hash<TopoDS_Edge>
+ : public std::unary_function<TopoDS_Edge,std::size_t>
+ {
+ std::size_t operator() (const TopoDS_Edge & Edge) const
+ { return Edge.HashCode(471662);}
+ // { return Face.HashCode(std::numeric_limits<int>::max());}
+};
+
+template<>
+ struct hash<TopoDS_Vertex>
+ : public std::unary_function<TopoDS_Vertex,std::size_t>
+ {
+ std::size_t operator() (const TopoDS_Vertex & Vertex) const
+ { return Vertex.HashCode(471662);}
+ // { return Face.HashCode(std::numeric_limits<int>::max());}
+};
+}
+}
+
+//////////////////MY MAPS////////////////////////////////////////
+std::tr1::unordered_map<TopoDS_Face,string> Face2SizeMap;
+std::tr1::unordered_map<TopoDS_Edge,string> Edge2SizeMap;
+std::tr1::unordered_map<TopoDS_Vertex,string> Vertex2SizeMap;
+std::map<int,PyObject*> FaceId2PythonSmp;
+std::map<int,PyObject*> EdgeId2PythonSmp;
+std::map<int,PyObject*> VertexId2PythonSmp;
+
+
+bool HasSizeMapOnFace=false;
+bool HasSizeMapOnEdge=false;
+bool HasSizeMapOnVertex=false;
+
//=============================================================================
/*!
*
_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);
+
}
//=============================================================================
MESSAGE("BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF");
}
+
//=============================================================================
/*!
*
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;
+
void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsurf_session_t *bls)
{
int _topology = BLSURFPlugin_Hypothesis::GetDefaultTopology();
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();
} 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"){
+ MESSAGE("Setting a Size Map");
+ const BLSURFPlugin_Hypothesis::TSizeMap & sizeMaps = hyp->GetSizeMapEntries();
+ BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt;
+ GeomSelectionTools* GeomST;
+ GeomST=new GeomSelectionTools::GeomSelectionTools( SMESH::GetActiveStudyDocument());
+
+ Face2SizeMap.clear();
+ Edge2SizeMap.clear();
+ Vertex2SizeMap.clear();
+
+ for ( smIt = sizeMaps.begin(); smIt != sizeMaps.end(); ++smIt ) {
+ if ( !smIt->second.empty() ) {
+#ifdef _DEBUG_
+ cout << "blsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second << endl;
+#endif
+ TopoDS_Shape GeomShape=GeomST->entryToShape(smIt->first);
+ TopAbs_ShapeEnum GeomType= GeomShape.ShapeType();
+ if (GeomType==TopAbs_FACE){
+ HasSizeMapOnFace=true;
+ Face2SizeMap[TopoDS::Face(GeomShape)]= smIt->second;
+ }
+ if (GeomType==TopAbs_EDGE){
+ HasSizeMapOnEdge=true;
+ HasSizeMapOnFace=true;
+ Edge2SizeMap[TopoDS::Edge(GeomShape)]= smIt->second;
+ }
+ if (GeomType==TopAbs_VERTEX){
+ HasSizeMapOnVertex=true;
+ HasSizeMapOnEdge=true;
+ HasSizeMapOnFace=true;
+ Vertex2SizeMap[TopoDS::Vertex(GeomShape)]= smIt->second;
+ }
+ }
+ }
+// if (HasSizeMapOnFace){
+ // In all size map cases (hphy_flag = 2), at least map on face must be defined
+ std::cout << "Setting Size Map on FACES " << std::endl;
+ blsurf_data_set_sizemap_iso_cad_face(bls, size_on_surface, &_smp_phy_size);
+// }
+
+ if (HasSizeMapOnEdge){
+ std::cout << "Setting Size Map on EDGES " << std::endl;
+ blsurf_data_set_sizemap_iso_cad_edge(bls, size_on_edge, &_smp_phy_size);
+ }
+ if (HasSizeMapOnVertex){
+ std::cout << "Setting Size Map on VERTICES " << std::endl;
+ 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());
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<Handle(Geom2d_Curve)> curves;
vector<Handle(Geom_Surface)> 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;
for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) {
TopoDS_Face f=TopoDS::Face(face_iter.Current());
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);
+ //std::cout << "BRep_Tool::Surface(f)->Bounds(u_min,u_max,v_min,v_max): " << u_min << ", " << u_max << ", " << v_min << ", " << v_max << std::endl;
+ if ((HasSizeMapOnFace) && Face2SizeMap.find(f)!=Face2SizeMap.end()){
+ // Expr To Python function, verification is performed at validation in GUI
+ PyObject * obj = NULL;
+ obj= PyRun_String(Face2SizeMap[f].c_str(), Py_file_input, main_dict, NULL);
+ Py_DECREF(obj);
+ PyObject * func = NULL;
+ func = PyObject_GetAttrString(main_mod, "f");
+ FaceId2PythonSmp[iface]=func;
+ Face2SizeMap.erase(f);
+ }
cad_face_t *fce = cad_face_new(c, iface, surf_fun, surfaces.back());
cad_face_set_tag(fce, iface);
if(f.Orientation() != TopAbs_FORWARD){
double tmin,tmax;
curves.push_back(BRep_Tool::CurveOnSurface(e, f, tmin, tmax));
+ if ((HasSizeMapOnEdge) && Edge2SizeMap.find(e)!=Edge2SizeMap.end()){
+ // Expr To Python function, verification is performed at validation in GUI
+ PyObject * obj = NULL;
+ obj= PyRun_String(Edge2SizeMap[e].c_str(), Py_file_input, main_dict, NULL);
+ Py_DECREF(obj);
+ PyObject * func = NULL;
+ func = PyObject_GetAttrString(main_mod, "f");
+ EdgeId2PythonSmp[ic]=func;
+ Edge2SizeMap.erase(e);
+ }
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);
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;
*ip = pmap.FindIndex(v);
if(*ip <= 0)
*ip = pmap.Add(v);
+ if ((HasSizeMapOnVertex) && Vertex2SizeMap.find(v)!=Vertex2SizeMap.end()){
+ // Expr To Python function, verification is performed at validation in GUI
+ PyObject * obj = NULL;
+ obj= PyRun_String(Vertex2SizeMap[v].c_str(), Py_file_input, main_dict, NULL);
+ Py_DECREF(obj);
+ PyObject * func = NULL;
+ func = PyObject_GetAttrString(main_mod, "f");
+ VertexId2PythonSmp[*ip]=func;
+ Vertex2SizeMap.erase(v);
+ }
}
if (npts != 2) {
// should not happen
} //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;
cout << "End of Surface Mesh generation" << endl;
cout << endl;
+ cout << "****************** U MIN: " << my_u_min << endl;
+ cout << "****************** V MIN: " << my_v_min << endl;
+ cout << "****************** U MAX: " << my_u_max << endl;
+ cout << "****************** V MAX: " << my_v_max << endl;
+
mesh_t *msh;
blsurf_data_get_mesh(bls, &msh);
if(!msh){
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];
+// cout << "****************** FACE ID / U MIN: " << face_id << " / " << my_u_min << endl;
+ }
+ if (my_v_min > uv[1]) {
+ my_v_min = uv[1];
+// cout << "****************** FACE ID / V MIN: " << face_id << " / " << my_v_min << endl;
+ }
+ if (my_u_max < uv[0]) {
+ my_u_max = uv[0];
+// cout << "****************** FACE ID / U MAX: " << face_id << " / " << my_u_max << endl;
+ }
+ if (my_v_max < uv[1]) {
+ my_v_max = uv[1];
+// cout << "****************** FACE ID / V MAX: " << face_id << " / " << my_v_max << endl;
+ }
+ }
+
+ 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);
+ std::cout << "Can't evaluate f(" << uv[0] << "," << uv[1] << ")" << " error is " << err_description << std::endl;
+ result = *((double*)user_data);
+ }
+ else {
+ result = PyFloat_AsDouble(pyresult);
+ Py_DECREF(pyresult);
+ }
+ *size = result;
+ //std::cout << "f(" << uv[0] << "," << uv[1] << ")" << " = " << result << std::endl;
+ 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);
+ std::cout << "Can't evaluate f(" << t << ")" << " error is " << err_description << std::endl;
+ 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);
+ std::cout << "Can't evaluate f()" << " error is " << err_description << std::endl;
+ 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;
#ifndef _BLSURFPlugin_BLSURF_HXX_
#define _BLSURFPlugin_BLSURF_HXX_
+#include <Python.h>
#include "SMESH_2D_Algo.hxx"
#include "SMESH_Mesh.hxx"
#include "Utils_SALOME_Exception.hxx"
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
//
#include <BLSURFPlugin_Hypothesis.hxx>
#include <utilities.h>
+#include <cstring>
//=============================================================================
BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis (int hypId, int studyId,
_charOptions.insert( charOptionNames[i] );
_option2value[ charOptionNames[i++] ].clear();
}
+
+ _sizeMap.clear();
}
//=============================================================================
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::ClearEntry(const std::string& entry)
+{
+ TSizeMap::iterator it = _sizeMap.find( entry );
+ if ( it != _sizeMap.end() )
+ _sizeMap.erase(it);
+ else
+ std::cout<<"No_Such_Entry"<<std::endl;
+}
+
+
+void BLSURFPlugin_Hypothesis::ClearSizeMaps()
+{
+ _sizeMap.clear();
+}
+
+
+
//=============================================================================
std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save)
{
<< " " << _verb;
TOptionValues::iterator op_val = _option2value.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
+ 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__";
+ }
+
+
return save;
}
else
load.clear(std::ios::badbit | load.rdstate());
+ std::string option_or_sm;
+ bool hasOptions = false;
+ bool hasSizeMap = 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;
+
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;
}
}
+ if (hasOptions) {
+ isOK = (load >> option_or_sm);
+ if (isOK && option_or_sm == "__SIZEMAP_BEGIN__")
+ hasSizeMap = 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 "%#"
+ }
+ }
+
return load;
}
void SetVerbosity(int theVal);
int GetVerbosity() const { return _verb; }
+
+
+ typedef std::map<std::string,std::string> TSizeMap;
+ void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
+ std::string GetSizeMapEntry(const std::string& entry);
+ void ClearEntry(const std::string& entry);
+ void ClearSizeMaps();
+
+ const TSizeMap& GetSizeMapEntries() const { return _sizeMap; }
static Topology GetDefaultTopology();
static PhysicalMesh GetDefaultPhysicalMesh();
int _verb;
TOptionValues _option2value;
TOptionNames _doubleOptions, _charOptions;
+ TSizeMap _sizeMap;
};
#endif
#include "BLSURFPlugin_Hypothesis_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_PythonDump.hxx"
+#include "GEOM_Object.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
}
}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry,const char* sizeMap)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ std::cout << "ENGINE : SETSIZEMAP START ENTRY : " << entry << std::endl;
+ 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 );
+ }
+ std::cout << "ENGINE : SETSIZEMAP END ENTRY : " << entry << std::endl;
+ if ( valueChanged )
+ SMESH::TPythonDump() << _this() << ".SetSizeMap("
+ << entry << ", '" << sizeMap << "' )";
+}
+
+//=============================================================================
+
+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;
+}
+
+//=============================================================================
+
+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();
+}
+
+//=============================================================================
+
+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();
+ std::cout << "IDL : GetName : " << GeomObj->GetName() << std::endl;
+ std::cout << "IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")" << std::endl;
+ SetSizeMapEntry( entry.c_str(),sizeMap);
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj)
+{
+ ASSERT(myBaseImpl);
+ string entry;
+ entry=GeomObj->GetStudyEntry();
+ std::cout << "IDL : GetName : " << GeomObj->GetName() << std::endl;
+ std::cout << "IDL : UNSETSIZEMAP ( "<< entry << ")" << std::endl;
+ UnsetEntry( entry.c_str());
+}
+
+
+
//=============================================================================
/*!
* BLSURFPlugin_Hypothesis_i::GetImpl
#include "BLSURFPlugin_Hypothesis.hxx"
class SMESH_Gen;
+class GEOM_Object;
// BLSURFPlugin parameters hypothesis
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();
+
// Get implementation
::BLSURFPlugin_Hypothesis* GetImpl();
BLSURFPlugin_i.cxx
libBLSURFEngine_la_CPPFLAGS = \
+ $(QT_INCLUDES) \
+ $(PYTHON_INCLUDES) \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \
$(MED_CXXFLAGS) \
$(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
-// 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
// 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 <SMESHGUI_Utils.h>
#include <SMESHGUI_HypothesesUtils.h>
+#include <SMESHGUI_Dialog.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <QTableWidget>
#include <QHeaderView>
#include <QApplication>
-
+#include <QRadioButton>
+#include <QStandardItemModel>
+#include <QStandardItem>
+
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Application.h>
+#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+
+#include <GEOM_Client.hxx>
+#include <TopoDS_Shape.hxx>
+#include <SMESH_Gen_i.hxx>
+#include <boost/shared_ptr.hpp>
+#include <structmember.h>
+
+// #include <GeomSelectionTools.h>
#define WITH_SIZE_BOUNDARIES
enum Topology {
FromCAD,
Process,
Process2
- };
+ } ;
enum PhysicalMesh
{
DefaultSize = 0,
- PhysicalUserDefined
+ PhysicalUserDefined,
+ SizeMap
};
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
+};
+
+
+
+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;
+}
+
+
BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType )
: SMESHGUI_GenericHypothesisCreator( theHypType )
{
+ cout << "BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator" << endl;
+ this->mySMPMap.clear();
+
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ GeomToolSelected = new GeomSelectionTools(aStudy);
+
+ /* 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);
}
BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator()
bool BLSURFPluginGUI_HypothesisCreator::checkParams() const
{
+ cout << "BLSURFPluginGUI_HypothesisCreator::checkParams" << endl;
bool ok = true;
if ( !isDouble( myPhySize->text(), false )) {
if ( myPhySize->text().isEmpty() )
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()
{
+ cout << "BLSURFPluginGUI_HypothesisCreator::buildFrame" << endl;
QFrame* fr = new QFrame( 0 );
QVBoxLayout* lay = new QVBoxLayout( fr );
lay->setMargin( 5 );
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 );
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, 6, 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_ENTRY_COLUMN);
+ mySizeMapTable->setAlternatingRowColors(true);
+ mySizeMapTable->verticalHeader()->hide();
+
+ addSurfaceButton = new QPushButton(tr("BLSURF_SM_SURFACE"),mySmpGroup);
+ anSmpLayout->addWidget(addSurfaceButton, 1, 1, 1, 1);
+
+ addEdgeButton = new QPushButton(tr("BLSURF_SM_EDGE"),mySmpGroup);
+ anSmpLayout->addWidget(addEdgeButton, 2, 1, 1, 1);
+
+ addPointButton = new QPushButton(tr("BLSURF_SM_POINT"),mySmpGroup);
+ anSmpLayout->addWidget(addPointButton, 3, 1, 1, 1);
+
+ QFrame *line = new QFrame(mySmpGroup);
+ line->setFrameShape(QFrame::HLine);
+ line->setFrameShadow(QFrame::Sunken);
+ anSmpLayout->addWidget(line, 4, 1, 1, 1);
+
+ removeButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup);
+ anSmpLayout->addWidget(removeButton, 5, 1, 1, 1);
+
+
// ---
tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) );
+ tab->insertTab( SMP_TAB, mySmpGroup, tr( "BLSURF_SIZE_MAP" ) );
+
tab->setCurrentIndex( STD_TAB );
// ---
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
{
+ cout << "BLSURFPluginGUI_HypothesisCreator::retrieveParams" << endl;
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
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 ) {
}
myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
+ printf("retrieveParams():that->mySMPMap.size()=%d\n",that->mySMPMap.size());
+ QMapIterator<QString, QString> i(that->mySMPMap);
+ while (i.hasNext()) {
+ i.next();
+ const QString entry = i.key();
+ string shapeName = GeomToolSelected->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_ENTRY_COLUMN);
+
// update widgets
that->onPhysicalMeshChanged();
that->onGeometricMeshChanged();
QString guiHyp = that->readParamsFromWidgets( data );
that->storeParamsToHypo( data );
+ //cout<<"BLSURFPluginGUI_HypothesisCreator::storeParams(), guiHyp: "<<endl<<guiHyp.toStdString()<<endl;
return guiHyp;
}
bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const
{
+ cout << "BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo" << endl;
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() );
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
that->myOptions = h->GetOptionValues();
+
+ BLSURFPlugin::string_array_var mySMPString = h->GetSizeMapEntries();
+
+ cout << "mySMPString->length() = " << mySMPString->length() << endl;
+ that->mySMPMap.clear();
+
+ TopoDS_Shape S;
+
+ for ( int i = 0;i<mySMPString->length(); ++i ) {
+ QString sizemaps_line = mySMPString[i].in();
+ QStringList entry_sm = sizemaps_line.split( "|", QString::KeepEmptyParts );
+ if ( entry_sm.count() > 1 ) {
+ string fullSizeMap = entry_sm[1].toStdString();
+ int pos = fullSizeMap.find("return")+7;
+ QString sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
+ that->mySMPMap[entry_sm[0]] = sizeMap;
+ that->mySMPShapeTypeMap[entry_sm[0]] = GeomToolSelected->entryToShape(entry_sm[0].toStdString()).ShapeType();
+ MESSAGE("mySMPMap[" << entry_sm[0].toStdString() << "] = " << sizeMap.toStdString());
+ MESSAGE("mySMPShapeTypeMap[" << entry_sm[0].toStdString() << "] = " << that->mySMPShapeTypeMap[entry_sm[0]]);
+ }
+ }
+
return true;
}
bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const
{
+ cout << "BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo" << endl;
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
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() );
}
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;
+ //printf("storeParamsToHypo():that->mySMPMap.size()=%d\n",that->mySMPMap.size());
+ QMapIterator<QString,QString> i(that->mySMPMap);
+ // Reset the size maps in engine
+ // h->ClearSizeMaps();
+ // Iterate over each size map
+ while (i.hasNext()) {
+ i.next();
+ const QString entry = i.key();
+ const QString sizeMap = i.value();
+
+ if (sizeMap == "__TO_DELETE__") {
+ cout << "Delete entry " << entry.toStdString() << " from engine" << endl;
+ h->UnsetEntry(entry.toLatin1().constData());
+ ok = false;
+ break;
+ }
+
+ 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;
+
+ cout << "SetSizeMapEntry("<<entry.toStdString()<<") = " <<fullSizeMap.toStdString() << endl;
+ h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
+ }
}
catch(const SALOME::SALOME_Exception& ex)
{
QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const
{
+ cout << "BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets" << endl;
h_data.myName = myName ? myName->text() : "";
h_data.myTopology = myTopology->currentIndex();
h_data.myPhysicalMesh = myPhysicalMesh->currentIndex();
guiHyp += name + " = " + value + "; ";
}
}
-
+
+ // 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] + "; ";
+ }
+
cout << "guiHyp : " << guiHyp.toLatin1().data() << endl;
return guiHyp;
}
void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() {
- bool isCustom = (myPhysicalMesh->currentIndex() == PhysicalUserDefined);
+ cout << "BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged" << endl;
+ bool isCustom = ((myPhysicalMesh->currentIndex() == PhysicalUserDefined) || (myPhysicalMesh->currentIndex() == SizeMap)) ;
myPhySize->setEnabled(isCustom);
myPhyMax->setEnabled(isCustom);
myPhyMin->setEnabled(isCustom);
}
void BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged() {
+ cout << "BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged" << endl;
bool isCustom = (myGeometricMesh->currentIndex() == UserDefined);
myAngleMeshS->setEnabled(isCustom);
myAngleMeshC->setEnabled(isCustom);
myOptionTable->removeRow( it.previous() );
}
+// **********************
+// *** BEGIN SIZE MAP ***
+// **********************
+
+
+void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
+{
+ cout<<"BLSURFPluginGUI_HypothesisCreator::onRemoveMap()"<<endl;
+ QList<int> selectedRows;
+ QList<QTableWidgetItem*> 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<int> it( selectedRows );
+ it.toBack();
+ while ( it.hasPrevious() ) {
+ row = it.previous();
+ cout << "delete row #"<< row <<endl;
+ 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_ENTRY_COLUMN);
+}
+
+void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(int row,int col)
+{
+ cout<<"BLSURFPluginGUI_HypothesisCreator::onSetSizeMap()"<<endl;
+ 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();
+ if (not that->mySMPShapeTypeMap.contains(entry))
+ return;
+ QString prevSizeMap = that->mySMPMap[entry];
+ that->mySMPMap[entry] = sizeMap;
+ if (not sizeMapValidationFromEntry(entry)) {
+ that->mySMPMap[entry] = prevSizeMap;
+ that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setText(prevSizeMap);
+ }
+ }
+}
+
+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)
+{
+ cout<<"BLSURFPluginGUI_HypothesisCreator::insertElementType()"<<endl;
+
+ 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);
+ for (; Object_It.More(); Object_It.Next())
+ {
+ Handle(SALOME_InteractiveObject) anObject = Object_It.Value();
+ entry = GeomToolSelected->getEntryOfObject(anObject);
+ shapeName = anObject->getName();
+ S = GeomToolSelected->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_ENTRY_COLUMN);
+ mySizeMapTable->clearSelection();
+ mySizeMapTable->scrollToItem( mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN ) );
+
+ if ( myPhysicalMesh->currentIndex() != SizeMap ) {
+ myPhysicalMesh->setCurrentIndex( SizeMap );
+ onPhysicalMeshChanged();
+ }
+ }
+ }
+ }
+}
+
+bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
+{
+ cout<<"BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()"<<endl;
+ int row = 0, nbRows = mySizeMapTable->rowCount();
+ for ( ; row < nbRows; ++row )
+ if (not sizeMapValidationFromRow(row))
+ return false;
+ return true;
+}
+
+bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow)
+{
+ cout<<"BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow()"<<endl;
+ QString myEntry = mySizeMapTable->item( myRow, SMP_ENTRY_COLUMN )->text();
+ return sizeMapValidationFromEntry(myEntry);
+}
+
+bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry)
+{
+ cout<<"BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry()"<<endl;
+
+ BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+
+ if (not that->mySMPMap.contains(myEntry)) {
+ cout<<"Geometry with entry "<<myEntry.toStdString()<<" was not found."<<endl;
+ return false;
+ }
+ if (not that->mySMPShapeTypeMap.contains(myEntry)) {
+ cout<<"Shape type with entry "<<myEntry.toStdString()<<" was not found."<<endl;
+ return false;
+ }
+
+ string expr;
+
+ 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());
+ 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);
+ 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);
+ SUIT_MessageBox::warning( dlg(),"Python Error" ,err_description.c_str() );
+ PyGILState_Release(gstate);
+ return false;
+ }
+
+ PyGILState_Release(gstate);
+
+ cout<<"SizeMap expression "<<expr<<" is valid"<<endl;
+
+ return true;
+}
+
+/*
+void BLSURFPluginGUI_HypothesisCreator::OnEditMapFunction(QModelIndex* index) {
+ int myRow = index->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
{
{
return "blsurf_hypo_page.html";
}
+
+LightApp_SelectionMgr* BLSURFPluginGUI_HypothesisCreator::selectionMgr()
+{
+
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ if( anApp )
+ return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
+ else
+ return 0;
+}
#define BLSURFPLUGIN_GUI_EXPORT
#endif
+#include <Python.h>
#include <SMESHGUI_Hypotheses.h>
#include <SALOMEconfig.h>
+#include <cstring>
+#include <map>
+#include <TopAbs_ShapeEnum.hxx>
+#include <GeomSelectionTools.h>
#include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
class QGroupBox;
class QCheckBox;
class QLineEdit;
class QTableWidget;
+class QTableView;
+class QStandardItemModel;
+class QStandardItem;
+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
*/
virtual bool checkParams() const;
virtual QString helpPage() const;
+ void insertElementType( TopAbs_ShapeEnum );
+ static LightApp_SelectionMgr* selectionMgr();
protected:
virtual QFrame* buildFrame ();
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 sizeMapsValidation();
+ bool sizeMapValidationFromRow(int);
+ bool sizeMapValidationFromEntry(QString);
private:
QWidget* myStdGroup;
QSpinBox* myVerbosity;
QTableWidget* myOptionTable;
+ QWidget *mySmpGroup;
+ QTableWidget *mySizeMapTable;
+ QPushButton *addEdgeButton;
+ QPushButton *addSurfaceButton;
+ QPushButton *addPointButton;
+ QPushButton *removeButton;
+
+ // map = entry , size map
+ QMap<QString, QString> mySMPMap;
+ QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
+ GeomSelectionTools* GeomToolSelected;
+
BLSURFPlugin::string_array_var myOptions;
+
+ PyObject * main_mod;
+ PyObject * main_dict;
};
#endif // BLSURFPLUGINGUI_HypothesisCreator_H
<source>BLSURF_PHY_MESH</source>
<translation>Physical Mesh</translation>
</message>
+ <message>
+ <source>BLSURF_SIZE_MAP</source>
+ <translation>Size Map</translation>
+ </message>
+ <message>
+ <source>SMP_ENTRY_COLUMN</source>
+ <translation>Entry</translation>
+ </message>
+ <message>
+ <message>
+ <source>SMP_NAME_COLUMN</source>
+ <translation>Name</translation>
+ </message>
+ <message>
+ <source>SMP_SIZEMAP_COLUMN</source>
+ <translation>Size Map</translation>
+ </message>
+ <message>
+ <source>BLSURF_SM_SURFACE</source>
+ <translation>Add Map on Surface</translation>
+ </message>
+ <message>
+ <source>BLSURF_SM_EDGE</source>
+ <translation>Add Map on Edge</translation>
+ </message>
+ <message>
+ <source>BLSURF_SM_POINT</source>
+ <translation>Add Map on Point</translation>
+ </message>
+ <message>
+ <source>BLSURF_SM_REMOVE</source>
+ <translation>Remove Map</translation>
+ </message>
+ <message>
+ <source>BLSURF_SM_SURF_VALUE</source>
+ <translation>Size on Surface(s)</translation>
+ </message>
+ <message>
+ <source>BLSURF_SM_EDGE_VALUE</source>
+ <translation>Size on Edge(s)</translation>
+ </message>
+ <message>
+ <source>BLSURF_SM_POINT_VALUE</source>
+ <translation>Size on Point(s)</translation>
+ </message>
<message>
<source>BLSURF_TITLE</source>
<translation>Hypothesis Construction</translation>
dist_libBLSURFPluginGUI_la_SOURCES = \
BLSURFPluginGUI.cxx \
BLSURFPluginGUI_HypothesisCreator.h \
- BLSURFPluginGUI_HypothesisCreator.cxx
+ BLSURFPluginGUI_HypothesisCreator.cxx
+# ui_BLSURFPluginGUI_MapFunctionEditor.h \
+# BLSURFPluginGUI_MapFunctionEditor.h \
+# BLSURFPluginGUI_MapFunctionEditor.cxx
MOC_FILES = \
BLSURFPluginGUI_HypothesisCreator_moc.cxx
$(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)
#
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
--- /dev/null
+// 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 <sstream>
+
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Application.h>
+#include <SUIT_Session.h>
+
+#include <SALOME_ListIteratorOfListIO.hxx>
+#include <GEOM_Client.hxx>
+#include <SMESH_Gen_i.hxx>
+#include <SMESHGUI_Utils.h>
+#include <boost/shared_ptr.hpp>
+
+#include <TopoDS.hxx>
+#include <BRep_Tool.hxx>
+#include <Handle_Geom_Surface.hxx>
+#include <BRepAdaptor_Surface.hxx>
+#include <GeomAbs_SurfaceType.hxx>
+
+GeomSelectionTools::GeomSelectionTools(_PTR(Study) aStudy)
+{
+ myStudy = aStudy;
+}
+
+
+
+LightApp_SelectionMgr* GeomSelectionTools::selectionMgr()
+{
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ if (anApp)
+ return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
+ else
+ return 0;
+}
+
+SALOME_ListIO* GeomSelectionTools::getSelectedSalomeObjects()
+{
+ SALOME_ListIO* selected;
+ LightApp_SelectionMgr* aSel = selectionMgr();
+ aSel->selectedObjects( *selected, NULL, false );
+ return selected;
+}
+
+
+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;
+}
+
+std::string GeomSelectionTools::getFirstSelectedEntry()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ std::string entry="";
+ anIO=GeomSelectionTools::getFirstSelectedSalomeObject();
+ return GeomSelectionTools::getEntryOfObject(anIO);
+}
+
+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;
+}
+
+
+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;
+}
+
+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;
+}
+
+TopoDS_Shape GeomSelectionTools::getFirstSelectedTopoDSShape()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ anIO=GeomSelectionTools::getFirstSelectedSalomeObject();
+ return entryToShape(anIO->getEntry());
+}
+
+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<GEOM::GEOM_Object>(aRefSObj);
+ }
+ // If selected object is a reference is not a reference
+ else {
+ if ( aSO->GetFatherComponent()->ComponentDataType() == "GEOM")
+ aShape = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aSO);
+ }
+ if ( !aShape->_is_nil() ){
+ if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen())
+ S=gen->GeomObjectToShape( aShape.in() );
+ }
+ }
+ return S;
+}
+
+TopAbs_ShapeEnum GeomSelectionTools:: getFirstSelectedShapeType()
+{
+ TopoDS_Shape S=getFirstSelectedTopoDSShape();
+ if (!S.IsNull())
+ return S.ShapeType();
+ else
+ // FIXME : Gérer l'exception de manière correct si la shape est nulle
+ return TopAbs_SHAPE;
+
+}
+
+void GeomSelectionTools::getFaceInformation()
+{
+ TopoDS_Shape S=getFirstSelectedTopoDSShape();
+ 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; */
+
+ GeomAbs_SurfaceType surf_type=surf_adap.GetType();
+ /*
+ Returns the type of the surface : Plane, Cylinder,
+ Cone, Sphere, Torus, BezierSurface,
+ BSplineSurface, SurfaceOfRevolution,
+ SurfaceOfExtrusion, OtherSurface
+ */
+
+
+
+ }
+ return;
+}
--- /dev/null
+// 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 <SALOME_ListIO.hxx>
+
+#include <TopoDS_Shape.hxx>
+
+class LightApp_SelectionMgr;
+
+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 );
+ void getFaceInformation();
+};
+
+
--- /dev/null
+# 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
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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
+//
+
+
+
--- /dev/null
+#include <Python.h>